[gnome-commander] Options: always show the tab bar



commit 6e2408aad354068edb8d2437ed1a1273791489e1
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Sun Feb 6 00:54:47 2011 +0100

    Options: always show the tab bar

 doc/C/gnome-commander.xml       |   34 +++++++++++++++++++++++++++++++++
 src/gnome-cmd-data.cc           |    6 +++++
 src/gnome-cmd-data.h            |    2 +
 src/gnome-cmd-file-selector.cc  |    2 +
 src/gnome-cmd-options-dialog.cc |   40 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 84 insertions(+), 0 deletions(-)
---
diff --git a/doc/C/gnome-commander.xml b/doc/C/gnome-commander.xml
index 10c566f..32b1107 100644
--- a/doc/C/gnome-commander.xml
+++ b/doc/C/gnome-commander.xml
@@ -4708,6 +4708,33 @@
 		</sect3>
 <!-- ====Confirmation==== -->
     </sect2>
+    <!-- Tabs options -->
+    <sect2 id="gnome-commander-prefs-tabs">
+      <title>Tabs</title>
+      <!--brief desciption-->
+      <para>This section of the option dialog lets you configure parameters for tabs.</para>
+      <itemizedlist>
+        <listitem>
+          <para><guilabel>Always show the tab bar</guilabel> If you're only viewing one file list in a &app; window, the tab bar is not normally shown. Check this preference to always show the tab bar, including when the &app; window contains only file list</para>
+        </listitem>
+      </itemizedlist>
+      <!-- ==== Figure ==== -->
+      <figure id="options-network-fig">
+        <title>Tabs options</title>
+        <screenshot>
+          <mediaobject>
+            <imageobject>
+              <imagedata fileref="figures/gnome-commander_options_tabs.png" format="PNG"/>
+            </imageobject>
+            <textobject>
+              <phrase>Shows &app; tabs preferences dialog.</phrase>
+            </textobject>
+          </mediaobject>
+        </screenshot>
+      </figure>
+      <!-- ==== End of Figure ==== -->
+      <para/>
+    </sect2>
     <sect2 id="gnome-commander-prefs-confirmation">
       <title>Confirmation</title>
       <para>The Confirmation tab allows You to configure when a confirmation dialog
@@ -7377,6 +7404,13 @@
                                 </row>
                                 <row valign="top">
                                     <entry><para></para></entry>
+                                    <entry><para>always_show_tabs</para></entry>
+                                    <entry><para>boolean</para></entry>
+                                    <entry><para></para></entry>
+                                    <entry><para><xref linkend="gnome-commander-prefs-tabs"/></para></entry>
+                                </row>
+                                <row valign="top">
+                                    <entry><para></para></entry>
                                     <entry><para>allow_multiple_instances</para></entry>
                                     <entry><para></para></entry>
                                     <entry><para></para></entry>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 0c601d8..8604090 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -945,6 +945,8 @@ GnomeCmdData::GnomeCmdData()
     save_dirs_on_exit = FALSE;
     save_tabs_on_exit = TRUE;
 
+    always_show_tabs = FALSE;
+
     allow_multiple_instances = FALSE;
     use_internal_viewer = TRUE;
     use_gcmd_block = FALSE;
@@ -1227,6 +1229,8 @@ void GnomeCmdData::load()
     save_dirs_on_exit = gnome_cmd_data_get_bool ("/options/save_dirs_on_exit", TRUE);
     save_tabs_on_exit = gnome_cmd_data_get_bool ("/options/save_tabs_on_exit", TRUE);
 
+    always_show_tabs = gnome_cmd_data_get_bool ("/options/always_show_tabs", FALSE);
+
     priv->last_pattern = gnome_cmd_data_get_string ("/defaults/last_pattern", "");
     priv->backup_pattern = gnome_cmd_data_get_string ("/defaults/backup_pattern", "*~;*.bak");
     priv->backup_pattern_list = patlist_new (priv->backup_pattern);
@@ -1642,6 +1646,8 @@ void GnomeCmdData::save()
     gnome_cmd_data_set_bool ("/options/save_dirs_on_exit", save_dirs_on_exit);
     gnome_cmd_data_set_bool ("/options/save_tabs_on_exit", save_tabs_on_exit);
 
+    gnome_cmd_data_set_bool ("/options/always_show_tabs", always_show_tabs);
+
     gnome_cmd_data_set_string ("/defaults/last_pattern", priv->last_pattern);
     gnome_cmd_data_set_string ("/defaults/backup_pattern", priv->backup_pattern);
 
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 693fa19..691ddea 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -242,6 +242,8 @@ struct GnomeCmdData
     gboolean                     save_dirs_on_exit;
     gboolean                     save_tabs_on_exit;
 
+    gboolean                     always_show_tabs;
+
     gboolean                     allow_multiple_instances;
     gboolean                     use_internal_viewer;
     gboolean                     use_gcmd_block;
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index c3d275e..4510504 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -984,6 +984,8 @@ void GnomeCmdFileSelector::update_style()
     if (priv->realized)
         update_files();
 
+    notebook->show_tabs(gnome_cmd_data.always_show_tabs ? GnomeCmdNotebook::SHOW_TABS : GnomeCmdNotebook::HIDE_TABS_IF_ONE);
+
     create_con_buttons (this);
     update_connections();
 }
diff --git a/src/gnome-cmd-options-dialog.cc b/src/gnome-cmd-options-dialog.cc
index 872c6c3..51eb4db 100644
--- a/src/gnome-cmd-options-dialog.cc
+++ b/src/gnome-cmd-options-dialog.cc
@@ -831,6 +831,43 @@ inline void store_layout_options (GtkWidget *dialog)
 
 /***********************************************************************
  *
+ *  The Tabs tab
+ *
+ **********************************************************************/
+
+static GtkWidget *create_tabs_tab (GtkWidget *parent)
+{
+    GtkWidget *frame, *hbox, *vbox, *cat, *cat_box;
+    GtkWidget *radio, *check;
+
+    frame = create_tabframe (parent);
+    hbox = create_tabhbox (parent);
+    gtk_container_add (GTK_CONTAINER (frame), hbox);
+    vbox = create_tabvbox (parent);
+    gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+
+    cat_box = create_vbox (parent, FALSE, 0);
+    cat = create_category (parent, cat_box, _("Tabs labels"));
+    gtk_box_pack_start (GTK_BOX (vbox), cat, FALSE, TRUE, 0);
+
+    check = create_check (parent, _("Always show the tab bar"), "always_show_tabs");
+    gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), gnome_cmd_data.always_show_tabs);
+
+    return frame;
+}
+
+
+inline void store_tabs_options (GtkWidget *dialog)
+{
+    GtkWidget *always_show_tabs = lookup_widget (dialog, "always_show_tabs");
+
+    gnome_cmd_data.always_show_tabs = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (always_show_tabs));
+}
+
+
+/***********************************************************************
+ *
  *  The Confirmation tab
  *
  **********************************************************************/
@@ -1931,6 +1968,7 @@ static void response_callback (GtkDialog *dialog, int response_id, GnomeCmdNoteb
     static const char *help_id[] = {"gnome-commander-prefs-general",
                                     "gnome-commander-prefs-format",
                                     "gnome-commander-prefs-layout",
+                                    "gnome-commander-prefs-tabs",
                                     "gnome-commander-prefs-confirmation",
                                     "gnome-commander-prefs-filters",
                                     "gnome-commander-prefs-network",
@@ -1999,6 +2037,7 @@ gboolean gnome_cmd_options_dialog (GtkWindow *parent, GnomeCmdData &cfg)
     notebook->append_page(create_general_tab (dialog), _("General"));
     notebook->append_page(create_format_tab (dialog), _("Format"));
     notebook->append_page(create_layout_tab (dialog), _("Layout"));
+    notebook->append_page(create_tabs_tab (dialog), _("Tabs"));
     notebook->append_page(create_confirmation_tab (dialog), _("Confirmation"));
     notebook->append_page(create_filter_tab (dialog), _("Filters"));
     notebook->append_page(create_network_tab (dialog), _("Network"));
@@ -2022,6 +2061,7 @@ gboolean gnome_cmd_options_dialog (GtkWindow *parent, GnomeCmdData &cfg)
         store_general_options (dialog);
         store_format_options (dialog);
         store_layout_options (dialog);
+        store_tabs_options (dialog);
         store_confirmation_options (dialog);
         store_filter_options (dialog);
         store_network_options (dialog);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]