summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2019-07-20 15:15:41 +0800
committerraveit65 <[email protected]>2019-08-26 14:21:14 +0200
commit6589911b919b7ab44556c1966c5ab5befcd46688 (patch)
tree3005e762f7b2f9ec0bb5a468dba53a1aed613208 /src
parent093aacfeccdb47b6b12b1978dd88243479626398 (diff)
downloadcaja-6589911b919b7ab44556c1966c5ab5befcd46688.tar.bz2
caja-6589911b919b7ab44556c1966c5ab5befcd46688.tar.xz
hide menu and toolbutton when view is only one
Diffstat (limited to 'src')
-rw-r--r--src/caja-view-as-action.c5
-rw-r--r--src/caja-window.c29
2 files changed, 20 insertions, 14 deletions
diff --git a/src/caja-view-as-action.c b/src/caja-view-as-action.c
index 115dfedd..4c1a7d4b 100644
--- a/src/caja-view-as-action.c
+++ b/src/caja-view-as-action.c
@@ -158,6 +158,11 @@ view_as_changed_callback (CajaWindow *window,
}
gtk_combo_box_set_active (combo_box, selected_index);
+ if (g_list_length (window->details->short_list_viewers) == 1) {
+ gtk_widget_hide(GTK_WIDGET(combo_box));
+ } else {
+ gtk_widget_show(GTK_WIDGET(combo_box));
+ }
}
diff --git a/src/caja-window.c b/src/caja-window.c
index c9dc3f71..9710bb6f 100644
--- a/src/caja-window.c
+++ b/src/caja-window.c
@@ -1330,7 +1330,6 @@ static void
load_view_as_menu (CajaWindow *window)
{
GList *node;
- int index;
guint merge_id;
if (window->details->short_list_merge_id != 0)
@@ -1364,19 +1363,21 @@ load_view_as_menu (CajaWindow *window)
G_GNUC_END_IGNORE_DEPRECATIONS;
window->details->view_as_radio_action = NULL;
- /* Add a menu item for each view in the preferred list for this location. */
- /* Start on 1, because extra_viewer gets index 0 */
- for (node = window->details->short_list_viewers, index = 1;
- node != NULL;
- node = node->next, ++index)
- {
- /* Menu item in View menu. */
- /* TODO */
- add_view_as_menu_item (window,
- CAJA_MENU_PATH_SHORT_LIST_PLACEHOLDER,
- node->data,
- index,
- merge_id);
+ if (g_list_length (window->details->short_list_viewers) > 1) {
+ int index;
+ /* Add a menu item for each view in the preferred list for this location. */
+ /* Start on 1, because extra_viewer gets index 0 */
+ for (node = window->details->short_list_viewers, index = 1;
+ node != NULL;
+ node = node->next, ++index)
+ {
+ /* Menu item in View menu. */
+ add_view_as_menu_item (window,
+ CAJA_MENU_PATH_SHORT_LIST_PLACEHOLDER,
+ node->data,
+ index,
+ merge_id);
+ }
}
gtk_ui_manager_insert_action_group (window->details->ui_manager,
window->details->view_as_action_group,