Option to show-hide selectable bars
authorColin Clark <colin.clark@cclark.uk>
Sat, 9 Sep 2023 14:30:14 +0000 (15:30 +0100)
committerColin Clark <colin.clark@cclark.uk>
Sat, 9 Sep 2023 14:30:14 +0000 (15:30 +0100)
An option to show or hide the menu, tool and status bars via a
keystroke.
The menu item is View/Hide Selectable Bars and the default keystroke is
control-backtick.
Preferences/General contains the option to select which of the three
bars should be shown or hidden.

doc/docbook/GuideMainWindowMenus.xml
doc/docbook/GuideOptionsGeneral.xml
src/layout-image.cc
src/layout-util.cc
src/layout.cc
src/layout.h
src/options.cc
src/options.h
src/preferences.cc
src/rcfile.cc

index 326fcc1..09cff95 100644 (file)
           </para>
         </listitem>
       </varlistentry>
-      <varlistentry>
-        <term>
-          <menuchoice>
-            <guimenu>Files and Folders</guimenu>
-            <guimenuitem>Hide toolbar</guimenuitem>
-          </menuchoice>
-        </term>
-        <listitem>
-          <para>Toggles visibility of the tool bar. A check appears next to this item when the tool bar is not visible.</para>
-        </listitem>
-      </varlistentry>
     </variablelist>
     <variablelist>
       <varlistentry>
       </varlistentry>
       <varlistentry>
         <term>
-          <guimenu>Hide Bars</guimenu>
+          <menuchoice>
+            <shortcut>
+              <keycombo>
+                <keycap>`</keycap>
+              </keycombo>
+            </shortcut>
+            <guimenu>Hide Bars and Files</guimenu>
+          </menuchoice>
+         </term>
+        <listitem>
+          <para>This item is intended to be used by its shortcut key. When pressed, the info sidebar, sort manager, file list, menu and status bars will be hidden (if displayed). Pressing the shortcut key again will revert the display to its previous layout.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>
+          <menuchoice>
+            <shortcut>
+              <keycombo>
+                <keycap>Control</keycap>
+                <keycap>`</keycap>
+              </keycombo>
+            </shortcut>
+            <guimenu>Hide Selectable Bars</guimenu>
+          </menuchoice>
         </term>
         <listitem>
-          <para>This item is intended to be used by its shortcut key - by default this is the backtick key. When pressed, the info sidebar, sort manager and file list will be hidden (if displayed). Pressing backtick again will revert the display to its previous layout.</para>
+          <para>This item is intended to be used by its shortcut key. When pressed, bars selected in Preferences/General will be hidden. Pressing shortcut key again will revert the display to its previous layout.</para>
         </listitem>
       </varlistentry>
       <varlistentry>
index 33f99f7..9d2a1a6 100644 (file)
       <para>Geeqie must be restarted for changes to take effect.</para>
     </note>
   </section>
+  <section id="HideSelectableBars">
+    <title>Hide Selectable Bars</title>
+    <para>The menu item Hide Selectable Bars will toggle display of the bars selected here. The default keystroke for this action is <code>control + backtick</code></para>
+    <note>
+      <para>Geeqie must be restarted for changes to take effect.</para>
+    </note>
+  </section>
   <section id="AppImageUpdatesNotifications">
     <title>AppImage updates notifications</title>
     <para>Show a notification on start-up if the server has a newer version than the current. Requires an Internet connection. Displayed only if an AppImage is being run.</para>
index e992f75..bea2029 100644 (file)
@@ -884,6 +884,8 @@ static GtkWidget *layout_image_pop_menu(LayoutWindow *lw)
 
        item = menu_item_add_check(menu, _("Hide file _list"), lw->options.tools_hidden,
                                   G_CALLBACK(li_pop_menu_hide_cb), lw);
+
+       item = menu_item_add_check(menu, _("Hide Selectable Bars"), lw->options.selectable_toolbars_hidden, G_CALLBACK(layout_selectable_toolbars_toggle), lw);
        if (fullscreen) gtk_widget_set_sensitive(item, FALSE);
 
        return menu;
index 5adde45..5afa757 100644 (file)
@@ -1085,14 +1085,14 @@ static void layout_menu_hide_cb(GtkAction *, gpointer data)
        layout_tools_hide_toggle(lw);
 }
 
-static void layout_menu_toolbar_cb(GtkToggleAction *action, gpointer data)
+static void layout_menu_selectable_toolbars_cb(GtkToggleAction *action, gpointer data)
 {
        auto lw = static_cast<LayoutWindow *>(data);
 
-       if (lw->options.toolbar_hidden == gtk_toggle_action_get_active(action)) return;
+       if (lw->options.selectable_toolbars_hidden == gtk_toggle_action_get_active(action)) return;
 
        layout_exit_fullscreen(lw);
-       layout_toolbar_toggle(lw);
+       layout_selectable_toolbars_toggle(lw);
 }
 
 static void layout_menu_info_pixel_cb(GtkToggleAction *action, gpointer data)
@@ -2691,10 +2691,10 @@ static GtkToggleActionEntry menu_toggle_entries[] = {
   { "ShowInfoPixel",   GQ_ICON_SELECT_COLOR,   N_("Pi_xel Info"),                      nullptr,                        N_("Show Pixel Info"),                  CB(layout_menu_info_pixel_cb),   FALSE  },
   { "IgnoreAlpha", GQ_ICON_STRIKETHROUGH,           N_("Hide _alpha"),          "<shift>A",     N_("Hide alpha channel"),       CB(layout_menu_alter_ignore_alpha_cb), FALSE},
   { "FloatTools",      PIXBUF_INLINE_ICON_FLOAT,N_("_Float file list"),                "L",                    N_("Float file list"),                  CB(layout_menu_float_cb),        FALSE  },
-  { "HideToolbar",     nullptr,                        N_("Hide tool_bar"),                    nullptr,                        N_("Hide toolbar"),                     CB(layout_menu_toolbar_cb),      FALSE  },
+  { "HideSelectableToolbars",  nullptr,                        N_("Hide Selectable Bars"),                     "<control>grave",                       N_("Hide Selectable Bars"),                     CB(layout_menu_selectable_toolbars_cb),  FALSE  },
   { "SBar",    GQ_ICON_PROPERTIES,                     N_("_Info sidebar"),                    "<control>K",           N_("Info sidebar"),                     CB(layout_menu_bar_cb),          FALSE  },
   { "SBarSort",        PIXBUF_INLINE_ICON_SORT,        N_("Sort _manager"),                    "<shift>S",             N_("Sort manager"),                     CB(layout_menu_bar_sort_cb),     FALSE  },
-  { "HideBars",                nullptr,                        N_("Hide Bars"),                        "grave",                N_("Hide Bars"),                        CB(layout_menu_hide_bars_cb),    FALSE  },
+  { "HideBars",                nullptr,                        N_("Hide Bars and Files"),                      "grave",                N_("Hide Bars and Files"),                      CB(layout_menu_hide_bars_cb),    FALSE  },
   { "SlideShow",       GQ_ICON_PLAY,   N_("Toggle _slideshow"),                "S",                    N_("Toggle slideshow"),                 CB(layout_menu_slideshow_cb),    FALSE  },
   { "UseColorProfiles",        GQ_ICON_COLOR_MANAGEMENT,       N_("Use _color profiles"),              nullptr,                        N_("Use color profiles"),               CB(layout_color_menu_enable_cb), FALSE},
   { "UseImageProfile", nullptr,                        N_("Use profile from _image"),          nullptr,                        N_("Use profile from image"),           CB(layout_color_menu_use_image_cb), FALSE},
@@ -2884,7 +2884,6 @@ static const gchar *menu_ui_description =
 "        <separator/>"
 "        <menuitem action='FloatTools'/>"
 "        <menuitem action='HideTools'/>"
-"        <menuitem action='HideToolbar'/>"
 "      </menu>"
 "      <placeholder name='DirSection'/>"
 "      <separator/>"
@@ -2973,6 +2972,7 @@ static const gchar *menu_ui_description =
 "      <menuitem action='SBar'/>"
 "      <menuitem action='SBarSort'/>"
 "      <menuitem action='HideBars'/>"
+"      <menuitem action='HideSelectableToolbars'/>"
 "      <menuitem action='ShowInfoPixel'/>"
 "      <menuitem action='IgnoreAlpha'/>"
 "      <placeholder name='ToolsSection'/>"
@@ -3872,8 +3872,8 @@ static void layout_util_sync_views(LayoutWindow *lw)
        action = gtk_action_group_get_action(lw->action_group, "SBarSort");
        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), layout_bar_sort_enabled(lw));
 
-       action = gtk_action_group_get_action(lw->action_group, "HideToolbar");
-       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->options.toolbar_hidden);
+       action = gtk_action_group_get_action(lw->action_group, "HideSelectableToolbars");
+       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->options.selectable_toolbars_hidden);
 
        action = gtk_action_group_get_action(lw->action_group, "ShowInfoPixel");
        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->options.show_info_pixel);
index 0dc3ab8..1d885cf 100644 (file)
@@ -341,7 +341,6 @@ static GtkWidget *layout_tool_setup(LayoutWindow *lw)
 
                gtk_widget_show(scroll_window);
                gtk_widget_show(menu_bar);
-               if (lw->options.toolbar_hidden) gtk_widget_hide(toolbar);
 
                gtk_box_pack_start(GTK_BOX(box), scroll_window, FALSE, FALSE, 0);
                gtk_box_pack_start(GTK_BOX(box), toolbar, FALSE, FALSE, 0);
@@ -352,7 +351,6 @@ static GtkWidget *layout_tool_setup(LayoutWindow *lw)
                DEBUG_NAME(menu_tool_bar);
                gtk_widget_show(menu_tool_bar);
                gtk_box_pack_start(GTK_BOX(lw->main_box), lw->menu_tool_bar, FALSE, FALSE, 0);
-               if (lw->options.toolbar_hidden) gtk_widget_hide(lw->toolbar[TOOLBAR_MAIN]);
                }
 
        tabcomp = tab_completion_new_with_history(&lw->path_entry, nullptr, "path_list", -1,
@@ -2094,20 +2092,81 @@ gboolean layout_tools_float_get(LayoutWindow *lw, gboolean *popped, gboolean *hi
        return TRUE;
 }
 
-void layout_toolbar_toggle(LayoutWindow *lw)
+void layout_selectable_toolbars_toggle(LayoutWindow *lw)
 {
+       lw = current_lw;
+
        if (!layout_valid(&lw)) return;
        if (!lw->toolbar[TOOLBAR_MAIN]) return;
+       if (!lw->menu_bar) return;
+       if (!lw->info_box) return;
+
+       lw->options.selectable_toolbars_hidden = !lw->options.selectable_toolbars_hidden;
+
+       if (options->selectable_bars.tool_bar)
+               {
+               if (lw->options.selectable_toolbars_hidden)
+                       {
+                       if (gtk_widget_get_visible(lw->toolbar[TOOLBAR_MAIN]))
+                               {
+                               gtk_widget_hide(lw->toolbar[TOOLBAR_MAIN]);
+                               }
+                       }
+               else
+                       {
+                       if (!gtk_widget_get_visible(lw->toolbar[TOOLBAR_MAIN]))
+                               {
+                               gtk_widget_show(lw->toolbar[TOOLBAR_MAIN]);
+                               }
+                       }
+               }
+       else
+               {
+               gtk_widget_show(lw->toolbar[TOOLBAR_MAIN]);
+               }
 
-       lw->options.toolbar_hidden = !lw->options.toolbar_hidden;
+       if (options->selectable_bars.menu_bar)
+               {
+               if (lw->options.selectable_toolbars_hidden)
+                       {
+                       if (gtk_widget_get_visible(lw->menu_bar))
+                               {
+                               gtk_widget_hide(lw->menu_bar);
+                               }
+                       }
+               else
+                       {
+                       if (!gtk_widget_get_visible(lw->menu_bar))
+                               {
+                               gtk_widget_show(lw->menu_bar);
+                               }
+                       }
+               }
+       else
+               {
+               gtk_widget_show(lw->menu_bar);
+               }
 
-       if (lw->options.toolbar_hidden)
+       if (options->selectable_bars.status_bar)
                {
-               if (gtk_widget_get_visible(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_hide(lw->toolbar[TOOLBAR_MAIN]);
+               if (lw->options.selectable_toolbars_hidden)
+                       {
+                       if (gtk_widget_get_visible(lw->info_box))
+                               {
+                               gtk_widget_hide(lw->info_box);
+                               }
+                       }
+               else
+                       {
+                       if (!gtk_widget_get_visible(lw->info_box))
+                               {
+                               gtk_widget_show(lw->info_box);
+                               }
+                       }
                }
        else
                {
-               if (!gtk_widget_get_visible(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_show(lw->toolbar[TOOLBAR_MAIN]);
+               gtk_widget_show(lw->info_box);
                }
 }
 
@@ -2731,7 +2790,6 @@ void layout_write_attributes(LayoutOptions *layout, GString *outstr, gint indent
        WRITE_NL(); WRITE_BOOL(*layout, tools_hidden);
        WRITE_SEPARATOR();
 
-       WRITE_NL(); WRITE_BOOL(*layout, toolbar_hidden);
        WRITE_NL(); WRITE_BOOL(*layout, show_info_pixel);
        WRITE_NL(); WRITE_BOOL(*layout, ignore_alpha);
        WRITE_SEPARATOR();
@@ -2851,7 +2909,6 @@ void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names
 
                if (READ_BOOL(*layout, tools_float)) continue;
                if (READ_BOOL(*layout, tools_hidden)) continue;
-               if (READ_BOOL(*layout, toolbar_hidden)) continue;
                if (READ_BOOL(*layout, show_info_pixel)) continue;
                if (READ_BOOL(*layout, ignore_alpha)) continue;
 
index a0d72aa..00d0c8b 100644 (file)
@@ -236,7 +236,7 @@ void layout_tools_float_toggle(LayoutWindow *lw);
 void layout_tools_hide_toggle(LayoutWindow *lw);
 
 
-void layout_toolbar_toggle(LayoutWindow *lw);
+void layout_selectable_toolbars_toggle(LayoutWindow *lw);
 void layout_info_pixel_set(LayoutWindow *lw, gboolean show);
 
 void layout_split_change(LayoutWindow *lw, ImageSplitMode mode);
index 30ca7e9..02d0e23 100644 (file)
@@ -330,7 +330,7 @@ LayoutOptions *init_layout_options(LayoutOptions *options)
        options->show_thumbnails = FALSE;
        options->style = 0;
        options->show_info_pixel = FALSE;
-       options->toolbar_hidden = FALSE;
+       options->selectable_toolbars_hidden = FALSE;
        options->tools_float = FALSE;
        options->tools_hidden = FALSE;
        options->image_overlay.histogram_channel = HCHAN_RGB;
index 67553d4..35c9134 100644 (file)
@@ -385,6 +385,13 @@ struct ConfOptions
                gint duplicates;
        } threads;
 
+       /* Selectable bars */
+       struct {
+               gboolean menu_bar;
+               gboolean tool_bar;
+               gboolean status_bar;
+       } selectable_bars;
+
        gchar *mouse_button_8; /**< user-definable mouse buttons */
        gchar *mouse_button_9; /**< user-definable mouse buttons */
 
@@ -555,7 +562,7 @@ struct LayoutOptions
 
        gboolean tools_float;
        gboolean tools_hidden;
-       gboolean toolbar_hidden;
+       gboolean selectable_toolbars_hidden;
 
        struct {
                gboolean info;
index 982b967..09975cf 100644 (file)
@@ -442,6 +442,10 @@ static void config_window_apply()
        options->show_predefined_keyword_tree = c_options->show_predefined_keyword_tree;
        options->expand_menu_toolbar = c_options->expand_menu_toolbar;
 
+       options->selectable_bars.menu_bar = c_options->selectable_bars.menu_bar;
+       options->selectable_bars.tool_bar = c_options->selectable_bars.tool_bar;
+       options->selectable_bars.status_bar = c_options->selectable_bars.status_bar;
+
        options->marks_save = c_options->marks_save;
        options->with_rename = c_options->with_rename;
        options->collections_duplicates = c_options->collections_duplicates;
@@ -2070,6 +2074,20 @@ static void config_tab_general(GtkWidget *notebook)
 
        pref_spacer(group, PREF_PAD_GROUP);
 
+       group = pref_group_new(vbox, FALSE, _("Hide Selectable Bars"), GTK_ORIENTATION_VERTICAL);
+
+       pref_checkbox_new_int(group, _("Menu bar"),
+                               options->selectable_bars.menu_bar, &c_options->selectable_bars.menu_bar);
+
+       pref_checkbox_new_int(group, _("Tool bar"),
+                               options->selectable_bars.tool_bar, &c_options->selectable_bars.tool_bar);
+
+       pref_checkbox_new_int(group, _("Status bar"),
+                               options->selectable_bars.status_bar, &c_options->selectable_bars.status_bar);
+       gtk_widget_set_tooltip_text(group, _("The Hide Selectable Bars menu item (default keystroke is control-backtick) will toggle the display of the bars selected here"));
+
+       pref_spacer(group, PREF_PAD_GROUP);
+
        if (g_getenv("APPDIR") && strstr(g_getenv("APPDIR"), "/tmp/.mount_Geeqie"))
                {
                group = pref_group_new(vbox, FALSE, _("AppImage updates notifications"), GTK_ORIENTATION_VERTICAL);
index 6bc142d..a11d983 100644 (file)
@@ -364,6 +364,10 @@ static void write_global_attributes(GString *outstr, gint indent)
        WRITE_NL(); WRITE_BOOL(*options, collections_on_top);
        WRITE_NL(); WRITE_BOOL(*options, hide_window_in_fullscreen);
 
+       WRITE_NL(); WRITE_BOOL(*options, selectable_bars.menu_bar);
+       WRITE_NL(); WRITE_BOOL(*options, selectable_bars.status_bar);
+       WRITE_NL(); WRITE_BOOL(*options, selectable_bars.tool_bar);
+
        /* File operations Options */
        WRITE_NL(); WRITE_BOOL(*options, file_ops.enable_in_place_rename);
        WRITE_NL(); WRITE_BOOL(*options, file_ops.confirm_delete);
@@ -859,6 +863,10 @@ static gboolean load_global_params(const gchar **attribute_names, const gchar **
                if (READ_BOOL(*options, collections_on_top)) continue;
                if (READ_BOOL(*options, hide_window_in_fullscreen)) continue;
 
+               if (READ_BOOL(*options, selectable_bars.menu_bar)) continue;
+               if (READ_BOOL(*options, selectable_bars.status_bar)) continue;
+               if (READ_BOOL(*options, selectable_bars.tool_bar)) continue;
+
                /* Properties dialog options */
                if (READ_CHAR(*options, properties.tabs_order)) continue;