[gnome-commander/gcmd-1-3] one instance mode: configuration via 'Options|General' tab



commit fe97476a6bbfd0b8ddcfdc3d0885539b5234a154
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Wed Mar 3 17:56:17 2010 +0100

    one instance mode: configuration via 'Options|General' tab

 src/gnome-cmd-data.cc           |    3 +++
 src/gnome-cmd-data.h            |    1 +
 src/gnome-cmd-options-dialog.cc |   12 ++++++++++++
 3 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 2e400d2..16aa5ac 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -947,6 +947,7 @@ GnomeCmdData::GnomeCmdData()
     cmdline_history = NULL;
     cmdline_history_length = 0;
 
+    allow_multiple_instances = FALSE;
     use_internal_viewer = TRUE;
     use_gcmd_block = FALSE;
     use_gnome_auth_manager = FALSE;
@@ -1186,6 +1187,7 @@ void GnomeCmdData::load()
         gui_update_rate = MAX_GUI_UPDATE_RATE;
 
     honor_expect_uris = gnome_cmd_data_get_bool ("/programs/honor_expect_uris", FALSE);
+    allow_multiple_instances = gnome_cmd_data_get_bool ("/programs/allow_multiple_instances", FALSE);
     use_internal_viewer = gnome_cmd_data_get_bool ("/programs/use_internal_viewer", TRUE);
     alt_quick_search = gnome_cmd_data_get_bool ("/programs/alt_quick_search", FALSE);
     skip_mounting = gnome_cmd_data_get_bool ("/programs/skip_mounting", FALSE);
@@ -1586,6 +1588,7 @@ void GnomeCmdData::save()
     gnome_cmd_data_set_int    ("/options/gui_update_rate", gui_update_rate);
 
     gnome_cmd_data_set_bool   ("/programs/honor_expect_uris", honor_expect_uris);
+    gnome_cmd_data_set_bool   ("/programs/allow_multiple_instances", allow_multiple_instances);
     gnome_cmd_data_set_bool   ("/programs/use_internal_viewer", use_internal_viewer);
     gnome_cmd_data_set_bool   ("/programs/alt_quick_search", alt_quick_search);
     gnome_cmd_data_set_bool   ("/programs/skip_mounting", skip_mounting);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index aa9f434..0609d46 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -229,6 +229,7 @@ struct GnomeCmdData
     GList                       *cmdline_history;
     gint                         cmdline_history_length;
 
+    gboolean                     allow_multiple_instances;
     gboolean                     use_internal_viewer;
     gboolean                     use_gcmd_block;
     gboolean                     use_gnome_auth_manager;
diff --git a/src/gnome-cmd-options-dialog.cc b/src/gnome-cmd-options-dialog.cc
index a4f456e..5826a50 100644
--- a/src/gnome-cmd-options-dialog.cc
+++ b/src/gnome-cmd-options-dialog.cc
@@ -144,6 +144,16 @@ static GtkWidget *create_general_tab (GtkWidget *parent)
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), gnome_cmd_data.alt_quick_search);
 
 
+    // Multiple instances
+    cat_box = create_vbox (parent, FALSE, 0);
+    cat = create_category (parent, cat_box, _("Multiple instances"));
+    gtk_box_pack_start (GTK_BOX (vbox), cat, FALSE, TRUE, 0);
+
+    check = create_check (parent, _("Don't start a new instance"), "multiple_instance_check");
+    gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), !gnome_cmd_data.allow_multiple_instances);
+
+
     return frame;
 }
 
@@ -156,6 +166,7 @@ inline void store_general_options (GnomeCmdOptionsDialog *dialog)
     GtkWidget *ft_regex_radio = lookup_widget (GTK_WIDGET (dialog), "ft_regex_radio");
     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");
 
     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;
 
@@ -171,6 +182,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));
 }
 
 



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