[gnome-commander] XML config: write current dirs on exit



commit 924d5bbc035eefaea2203113a58cf0ad925a2d96
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Mon Aug 2 23:28:45 2010 +0200

    XML config: write current dirs on exit

 src/gnome-cmd-data.cc           |    3 +++
 src/gnome-cmd-data.h            |    1 +
 src/gnome-cmd-file-selector.cc  |    4 ++++
 src/gnome-cmd-options-dialog.cc |    6 ++++++
 4 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 70aae4f..b843866 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -940,6 +940,7 @@ GnomeCmdData::GnomeCmdData()
     cmdline_history = NULL;
     cmdline_history_length = 0;
 
+    save_dirs_on_exit = TRUE;
     save_tabs_on_exit = TRUE;
 
     allow_multiple_instances = FALSE;
@@ -1223,6 +1224,7 @@ void GnomeCmdData::load()
     gnome_cmd_data_get_color ("/colors/ls_colors_white_fg", priv->ls_colors_palette.white_fg);
     gnome_cmd_data_get_color ("/colors/ls_colors_white_bg", priv->ls_colors_palette.white_bg);
 
+    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);
 
     priv->start_dirs[LEFT] = gnome_cmd_data_get_string ("/options/start_dir_left", g_get_home_dir ());
@@ -1642,6 +1644,7 @@ void GnomeCmdData::save()
         g_free (tmp);
     }
 
+    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_string ("/options/start_dir_left", priv->start_dirs[LEFT]);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index f2b6579..8dfbcde 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -230,6 +230,7 @@ struct GnomeCmdData
     GList                       *cmdline_history;
     gint                         cmdline_history_length;
 
+    gboolean                     save_dirs_on_exit;
     gboolean                     save_tabs_on_exit;
 
     gboolean                     allow_multiple_instances;
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index 002757c..a492c2e 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -1370,6 +1370,10 @@ XML::xstream &operator << (XML::xstream &xml, GnomeCmdFileSelector &fs)
 
         g_list_free (tabs);
     }
+    else
+        if (gnome_cmd_data.save_dirs_on_exit)
+            if (fs.is_local())
+                xml << *fs.file_list();
 
     return xml;
 }
diff --git a/src/gnome-cmd-options-dialog.cc b/src/gnome-cmd-options-dialog.cc
index 0950d2a..0ffd0ba 100644
--- a/src/gnome-cmd-options-dialog.cc
+++ b/src/gnome-cmd-options-dialog.cc
@@ -159,6 +159,10 @@ static GtkWidget *create_general_tab (GtkWidget *parent)
     cat = create_category (parent, cat_box, _("Save on exit"));
     gtk_box_pack_start (GTK_BOX (vbox), cat, FALSE, TRUE, 0);
 
+    check = create_check (parent, _("Directories"), "save_dirs");
+    gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), gnome_cmd_data.save_dirs_on_exit);
+
     check = create_check (parent, _("Tabs"), "save_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.save_tabs_on_exit);
@@ -177,6 +181,7 @@ inline void store_general_options (GnomeCmdOptionsDialog *dialog)
     GtkWidget *case_sens_check = lookup_widget (GTK_WIDGET (dialog), "case_sens_check");
     GtkWidget *alt_quick_search = lookup_widget (GTK_WIDGET (dialog), "alt_quick_search");
     GtkWidget *multiple_instance_check = lookup_widget (GTK_WIDGET (dialog), "multiple_instance_check");
+    GtkWidget *save_dirs = lookup_widget (GTK_WIDGET (dialog), "save_dirs");
     GtkWidget *save_tabs = lookup_widget (GTK_WIDGET (dialog), "save_tabs");
 
     gnome_cmd_data.left_mouse_button_mode = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (lmb_singleclick_radio)) ? GnomeCmdData::LEFT_BUTTON_OPENS_WITH_SINGLE_CLICK : GnomeCmdData::LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK;
@@ -194,6 +199,7 @@ inline void store_general_options (GnomeCmdOptionsDialog *dialog)
     gnome_cmd_data.case_sens_sort = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (case_sens_check));
     gnome_cmd_data.alt_quick_search = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (alt_quick_search));
     gnome_cmd_data.allow_multiple_instances = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (multiple_instance_check));
+    gnome_cmd_data.save_dirs_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_dirs));
     gnome_cmd_data.save_tabs_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_tabs));
 }
 



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