[gnome-commander] Always reopen the tab which was previously closed in the options dialog



commit 114c488b069d232c7122c4cf05a9d631f17de20b
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sun Mar 23 00:07:39 2014 +0100

    Always reopen the tab which was previously closed in the options dialog

 NEWS                                    |    1 +
 doc/C/releases.xml                      |    2 +-
 src/dialogs/gnome-cmd-options-dialog.cc |    9 +++++++++
 3 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 64d7b13..fa8b888 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ gnome-commander 1.6.0
 Bug fixes:
  * ... 
 New features:
+* Always reopen the tab which was previously closed in the options dialog
 * New or updated translations: 
      ...
 * New key bindings:
diff --git a/doc/C/releases.xml b/doc/C/releases.xml
index aa5f4c8..7b04dc7 100644
--- a/doc/C/releases.xml
+++ b/doc/C/releases.xml
@@ -38,7 +38,7 @@
                 <para>
                     <itemizedlist>
                         <listitem>
-                            <para>???</para>
+                            <para>Always reopen the tab which was previously closed in the options 
dialog</para>
                         </listitem>
                         <listitem>
                             <para>New or updated docs: ??</para>
diff --git a/src/dialogs/gnome-cmd-options-dialog.cc b/src/dialogs/gnome-cmd-options-dialog.cc
index 9596713..7818deb 100644
--- a/src/dialogs/gnome-cmd-options-dialog.cc
+++ b/src/dialogs/gnome-cmd-options-dialog.cc
@@ -1980,6 +1980,9 @@ static void response_callback (GtkDialog *dialog, int response_id, GnomeCmdNoteb
 
 gboolean gnome_cmd_options_dialog (GtkWindow *parent, GnomeCmdData::Options &cfg)
 {
+    // variable for storing the last active tab
+    static gint activetab = 0;
+
     GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Options"), parent,
                                                      GtkDialogFlags (GTK_DIALOG_MODAL | 
GTK_DIALOG_DESTROY_WITH_PARENT),
                                                      GTK_STOCK_HELP, GTK_RESPONSE_HELP,
@@ -2025,6 +2028,9 @@ gboolean gnome_cmd_options_dialog (GtkWindow *parent, GnomeCmdData::Options &cfg
     notebook->append_page(create_programs_tab (dialog, cfg), _("Programs"));
     notebook->append_page(create_devices_tab (dialog, cfg), _("Devices"));
 
+    // open the tab which was actinve when closing the options notebook last time 
+    notebook->set_current_page (activetab);
+
 #if GTK_CHECK_VERSION (2, 14, 0)
     gtk_widget_show_all (content_area);
 #else
@@ -2049,6 +2055,9 @@ gboolean gnome_cmd_options_dialog (GtkWindow *parent, GnomeCmdData::Options &cfg
         store_devices_options (dialog, cfg);
     }
 
+    // store the current active tab
+    activetab = notebook->get_current_page();
+
     gtk_widget_destroy (dialog);
 
     return result==GTK_RESPONSE_OK;


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