summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2019-07-20 15:15:41 +0800
committerraveit65 <[email protected]>2022-07-20 21:40:42 +0200
commit4d5a705583db002ea95687a2c35464f77eb8206f (patch)
tree80908100a92de6f41452e55e3e3dd73f44bb5b1c
parent958b4fa7f6f460121dc1a5eff5ce0a353188333b (diff)
downloadcaja-4d5a705583db002ea95687a2c35464f77eb8206f.tar.bz2
caja-4d5a705583db002ea95687a2c35464f77eb8206f.tar.xz
hide menu and toolbutton when view is only one
-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 9ecfdf4d..f6040205 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 76157148..064e5b92 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,