[gnome-commander] GnomeCmdData: move Layout options to GnomeCmdData::Options



commit 5eb429119b0cf8c26b4f0860d34f7edb582e8269
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Sun Nov 6 23:31:42 2011 +0100

    GnomeCmdData: move Layout options to GnomeCmdData::Options

 src/gnome-cmd-data.cc              |   63 ++++++++++++++---------------------
 src/gnome-cmd-data.h               |   47 +++++++++++++++++++-------
 src/gnome-cmd-file-list.cc         |   10 +++---
 src/gnome-cmd-file-selector.cc     |   10 +++---
 src/gnome-cmd-file.cc              |    4 +-
 src/gnome-cmd-main-win.cc          |    2 +-
 src/gnome-cmd-options-dialog.cc    |   60 +++++++++++++++++-----------------
 src/gnome-cmd-quicksearch-popup.cc |    8 ++--
 src/main.cc                        |    2 +-
 9 files changed, 107 insertions(+), 99 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 5dc37e4..0a4a4a8 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -841,22 +841,14 @@ GnomeCmdData::GnomeCmdData(): search_defaults(selections)
     confirm_copy_overwrite = GNOME_CMD_CONFIRM_OVERWRITE_QUERY;
     confirm_move_overwrite = GNOME_CMD_CONFIRM_OVERWRITE_QUERY;
     confirm_mouse_dnd = TRUE;
-    left_mouse_button_mode = LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK;
-    left_mouse_button_unselects = TRUE;
-    middle_mouse_button_mode = MIDDLE_BUTTON_GOES_UP_DIR;
-    right_mouse_button_mode = RIGHT_BUTTON_POPUPS_MENU;
     color_mode = GNOME_CMD_COLOR_DEEP_BLUE;
     size_disp_mode = GNOME_CMD_SIZE_DISP_MODE_POWERED;
     perm_disp_mode = GNOME_CMD_PERM_DISP_MODE_TEXT;
-    alt_quick_search = FALSE;
-    quick_search_exact_match_begin = TRUE;
-    quick_search_exact_match_end = FALSE;
 
     memset(&filter_settings, 0, sizeof(filter_settings));
     filter_settings.hidden = TRUE;
     filter_settings.backup = TRUE;
 
-    case_sens_sort = TRUE;
     layout = GNOME_CMD_LAYOUT_MIME_ICONS;
     ext_disp_mode = GNOME_CMD_EXT_DISP_BOTH;
     list_orientation = FALSE;
@@ -881,14 +873,9 @@ GnomeCmdData::GnomeCmdData(): search_defaults(selections)
     cmdline_history = NULL;
     cmdline_history_length = 0;
 
-    save_dirs_on_exit = FALSE;
-    save_tabs_on_exit = TRUE;
-    save_dir_history_on_exit = TRUE;
-
     always_show_tabs = FALSE;
     tab_lock_indicator = TAB_LOCK_ICON;
 
-    allow_multiple_instances = FALSE;
     use_internal_viewer = TRUE;
     use_gcmd_block = FALSE;
 
@@ -1064,7 +1051,7 @@ void GnomeCmdData::load()
     filter_settings.hidden = gnome_cmd_data_get_bool ("/options/hidden_filter", TRUE);
     filter_settings.backup = gnome_cmd_data_get_bool ("/options/backup_filter", TRUE);
 
-    case_sens_sort = gnome_cmd_data_get_bool ("/sort/case_sensitive", TRUE);
+    options.case_sens_sort = gnome_cmd_data_get_bool ("/sort/case_sensitive", TRUE);
 
     main_win_width = get_int ("/gnome-commander-size/main_win/width", 600);
     main_win_height = get_int ("/gnome-commander-size/main_win/height", 400);
@@ -1110,10 +1097,10 @@ void GnomeCmdData::load()
     priv->list_font = gnome_cmd_data_get_string ("/options/list_font", "-misc-fixed-medium-r-normal-*-10-*-*-*-c-*-iso8859-1");
 
     ext_disp_mode = (GnomeCmdExtDispMode) gnome_cmd_data_get_int ("/options/ext_disp_mode", GNOME_CMD_EXT_DISP_BOTH);
-    left_mouse_button_mode = (LeftMouseButtonMode) gnome_cmd_data_get_int ("/options/left_mouse_button_mode", LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK);
-    left_mouse_button_unselects = gnome_cmd_data_get_bool ("/options/left_mouse_button_unselects", TRUE);
-    middle_mouse_button_mode = (MiddleMouseButtonMode) gnome_cmd_data_get_int ("/options/middle_mouse_button_mode", MIDDLE_BUTTON_GOES_UP_DIR);
-    right_mouse_button_mode = (RightMouseButtonMode) gnome_cmd_data_get_int ("/options/right_mouse_button_mode", RIGHT_BUTTON_POPUPS_MENU);
+    options.left_mouse_button_mode = (LeftMouseButtonMode) gnome_cmd_data_get_int ("/options/left_mouse_button_mode", LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK);
+    options.left_mouse_button_unselects = gnome_cmd_data_get_bool ("/options/left_mouse_button_unselects", TRUE);
+    options.middle_mouse_button_mode = (MiddleMouseButtonMode) gnome_cmd_data_get_int ("/options/middle_mouse_button_mode", MIDDLE_BUTTON_GOES_UP_DIR);
+    options.right_mouse_button_mode = (RightMouseButtonMode) gnome_cmd_data_get_int ("/options/right_mouse_button_mode", RIGHT_BUTTON_POPUPS_MENU);
     icon_size = gnome_cmd_data_get_int ("/options/icon_size", 16);
     dev_icon_size = gnome_cmd_data_get_int ("/options/dev_icon_size", 16);
     icon_scale_quality = (GdkInterpType) gnome_cmd_data_get_int ("/options/icon_scale_quality", GDK_INTERP_HYPER);
@@ -1140,11 +1127,11 @@ 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);
+    options.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);
-    quick_search_exact_match_begin = gnome_cmd_data_get_bool ("/programs/quick_search_exact_match_begin", TRUE);
-    quick_search_exact_match_end = gnome_cmd_data_get_bool ("/programs/quick_search_exact_match_end", FALSE);
+    options.alt_quick_search = gnome_cmd_data_get_bool ("/programs/alt_quick_search", FALSE);
+    options.quick_search_exact_match_begin = gnome_cmd_data_get_bool ("/programs/quick_search_exact_match_begin", TRUE);
+    options.quick_search_exact_match_end = gnome_cmd_data_get_bool ("/programs/quick_search_exact_match_end", FALSE);
     skip_mounting = gnome_cmd_data_get_bool ("/programs/skip_mounting", FALSE);
 
     priv->symlink_prefix = gnome_cmd_data_get_string ("/options/symlink_prefix", _("link to %s"));
@@ -1180,9 +1167,9 @@ 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);
-    save_dir_history_on_exit = gnome_cmd_data_get_bool ("/options/save_dir_history_on_exit", TRUE);
+    options.save_dirs_on_exit = gnome_cmd_data_get_bool ("/options/save_dirs_on_exit", TRUE);
+    options.save_tabs_on_exit = gnome_cmd_data_get_bool ("/options/save_tabs_on_exit", TRUE);
+    options.save_dir_history_on_exit = gnome_cmd_data_get_bool ("/options/save_dir_history_on_exit", TRUE);
 
     always_show_tabs = gnome_cmd_data_get_bool ("/options/always_show_tabs", FALSE);
     tab_lock_indicator = (TabLockIndicator) gnome_cmd_data_get_int ("/options/tab_lock_indicator", TAB_LOCK_ICON);
@@ -1502,7 +1489,7 @@ void GnomeCmdData::save()
     gnome_cmd_data_set_bool   ("/options/hidden_filter", filter_settings.hidden);
     gnome_cmd_data_set_bool   ("/options/backup_filter", filter_settings.backup);
 
-    gnome_cmd_data_set_bool   ("/sort/case_sensitive", case_sens_sort);
+    gnome_cmd_data_set_bool   ("/sort/case_sensitive", options.case_sens_sort);
 
     gnome_cmd_data_set_int    ("/colors/mode", color_mode);
 
@@ -1537,10 +1524,10 @@ void GnomeCmdData::save()
     gnome_cmd_data_set_string ("/options/list_font", priv->list_font);
 
     gnome_cmd_data_set_int    ("/options/ext_disp_mode", ext_disp_mode);
-    gnome_cmd_data_set_int    ("/options/left_mouse_button_mode", left_mouse_button_mode);
-    gnome_cmd_data_set_bool   ("/options/left_mouse_button_unselects", left_mouse_button_unselects);
-    gnome_cmd_data_set_int    ("/options/middle_mouse_button_mode", middle_mouse_button_mode);
-    gnome_cmd_data_set_int    ("/options/right_mouse_button_mode", right_mouse_button_mode);
+    gnome_cmd_data_set_int    ("/options/left_mouse_button_mode", options.left_mouse_button_mode);
+    gnome_cmd_data_set_bool   ("/options/left_mouse_button_unselects", options.left_mouse_button_unselects);
+    gnome_cmd_data_set_int    ("/options/middle_mouse_button_mode", options.middle_mouse_button_mode);
+    gnome_cmd_data_set_int    ("/options/right_mouse_button_mode", options.right_mouse_button_mode);
     gnome_cmd_data_set_int    ("/options/icon_size", icon_size);
     gnome_cmd_data_set_int    ("/options/dev_icon_size", dev_icon_size);
     gnome_cmd_data_set_int    ("/options/icon_scale_quality", icon_scale_quality);
@@ -1552,11 +1539,11 @@ 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/allow_multiple_instances", options.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/quick_search_exact_match_begin", quick_search_exact_match_begin);
-    gnome_cmd_data_set_bool   ("/programs/quick_search_exact_match_end", quick_search_exact_match_end);
+    gnome_cmd_data_set_bool   ("/programs/alt_quick_search", options.alt_quick_search);
+    gnome_cmd_data_set_bool   ("/programs/quick_search_exact_match_begin", options.quick_search_exact_match_begin);
+    gnome_cmd_data_set_bool   ("/programs/quick_search_exact_match_end", options.quick_search_exact_match_end);
     gnome_cmd_data_set_bool   ("/programs/skip_mounting", skip_mounting);
 
     gnome_cmd_data_set_bool   ("/programs/toolbar_visibility", toolbar_visibility);
@@ -1601,9 +1588,9 @@ 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_bool ("/options/save_dir_history_on_exit", save_dir_history_on_exit);
+    gnome_cmd_data_set_bool ("/options/save_dirs_on_exit", options.save_dirs_on_exit);
+    gnome_cmd_data_set_bool ("/options/save_tabs_on_exit", options.save_tabs_on_exit);
+    gnome_cmd_data_set_bool ("/options/save_dir_history_on_exit", options.save_dir_history_on_exit);
 
     gnome_cmd_data_set_bool ("/options/always_show_tabs", always_show_tabs);
     gnome_cmd_data_set_int ("/options/tab_lock_indicator", (int) tab_lock_indicator);
@@ -1636,7 +1623,7 @@ void GnomeCmdData::save()
 
         xml << XML::tag("History");
 
-        if (save_dir_history_on_exit)
+        if (options.save_dir_history_on_exit)
         {
             xml << XML::tag("Directories");
 
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 3a9842b..477e811 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -65,6 +65,38 @@ struct GnomeCmdData
 
     enum {SEARCH_HISTORY_SIZE=10, ADVRENAME_HISTORY_SIZE=10, INTVIEWER_HISTORY_SIZE=16};
 
+    struct Options
+    {
+        //  Layout
+        LeftMouseButtonMode   left_mouse_button_mode;
+        gboolean              left_mouse_button_unselects;
+        MiddleMouseButtonMode middle_mouse_button_mode;
+        RightMouseButtonMode  right_mouse_button_mode;
+        gboolean              case_sens_sort;
+        gboolean              alt_quick_search;
+        gboolean              quick_search_exact_match_begin;
+        gboolean              quick_search_exact_match_end;
+        gboolean              allow_multiple_instances;
+        gboolean              save_dirs_on_exit;
+        gboolean              save_tabs_on_exit;
+        gboolean              save_dir_history_on_exit;
+
+        Options(): left_mouse_button_mode(LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK),
+                   left_mouse_button_unselects(TRUE),
+                   middle_mouse_button_mode(MIDDLE_BUTTON_GOES_UP_DIR),
+                   right_mouse_button_mode(RIGHT_BUTTON_POPUPS_MENU),
+                   case_sens_sort(TRUE),
+                   alt_quick_search(FALSE),
+                   quick_search_exact_match_begin(TRUE),
+                   quick_search_exact_match_end(FALSE),
+                   allow_multiple_instances(FALSE),
+                   save_dirs_on_exit(FALSE),
+                   save_tabs_on_exit(TRUE),
+                   save_dir_history_on_exit(TRUE)
+        {
+        }
+    };
+
     struct Selection
     {
         std::string name;
@@ -201,16 +233,11 @@ struct GnomeCmdData
     GnomeCmdConfirmOverwriteMode confirm_copy_overwrite;
     GnomeCmdConfirmOverwriteMode confirm_move_overwrite;
     gboolean                     confirm_mouse_dnd;
-    LeftMouseButtonMode          left_mouse_button_mode;
-    gboolean                     left_mouse_button_unselects;
-    MiddleMouseButtonMode        middle_mouse_button_mode;
-    RightMouseButtonMode         right_mouse_button_mode;
     GnomeCmdColorMode            color_mode;
     GnomeCmdSizeDispMode         size_disp_mode;
     GnomeCmdPermDispMode         perm_disp_mode;
-    gboolean                     alt_quick_search;
-    gboolean                     quick_search_exact_match_begin;
-    gboolean                     quick_search_exact_match_end;
+
+    Options                      options;
 
     FilterSettings               filter_settings;
 
@@ -221,7 +248,6 @@ struct GnomeCmdData
     IntViewerConfig              intviewer_defaults;
     BookmarksConfig              bookmarks_defaults;
 
-    gboolean                     case_sens_sort;
     GnomeCmdLayout               layout;
     GnomeCmdExtDispMode          ext_disp_mode;
     gboolean                     list_orientation;
@@ -246,14 +272,9 @@ struct GnomeCmdData
     GList                       *cmdline_history;
     gint                         cmdline_history_length;
 
-    gboolean                     save_dirs_on_exit;
-    gboolean                     save_tabs_on_exit;
-    gboolean                     save_dir_history_on_exit;
-
     gboolean                     always_show_tabs;
     int                          tab_lock_indicator;
 
-    gboolean                     allow_multiple_instances;
     gboolean                     use_internal_viewer;
     gboolean                     use_gcmd_block;
 
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index bafc1e4..a626234 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -1152,7 +1152,7 @@ static void on_file_clicked (GnomeCmdFileList *fl, GnomeCmdFile *f, GdkEventButt
 
     fl->modifier_click = event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK);
 
-    if (event->type == GDK_2BUTTON_PRESS && event->button == 1 && gnome_cmd_data.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK)
+    if (event->type == GDK_2BUTTON_PRESS && event->button == 1 && gnome_cmd_data.options.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK)
     {
         mime_exec_file (f);
     }
@@ -1174,7 +1174,7 @@ static void on_file_clicked (GnomeCmdFileList *fl, GnomeCmdFile *f, GdkEventButt
                 else
                     if (event->state & GDK_CONTROL_MASK)
                     {
-                        if (!fl->priv->selected_files.empty() || gnome_cmd_data.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_SINGLE_CLICK)
+                        if (!fl->priv->selected_files.empty() || gnome_cmd_data.options.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_SINGLE_CLICK)
                             toggle_file_at_row (fl, row);
                         else
                         {
@@ -1189,7 +1189,7 @@ static void on_file_clicked (GnomeCmdFileList *fl, GnomeCmdFile *f, GdkEventButt
                 if (event->button == 3)
                     if (!f->is_dotdot)
                     {
-                        if (gnome_cmd_data.right_mouse_button_mode == GnomeCmdData::RIGHT_BUTTON_SELECTS)
+                        if (gnome_cmd_data.options.right_mouse_button_mode == GnomeCmdData::RIGHT_BUTTON_SELECTS)
                         {
                             if (!fl->priv->selected_files.contain(f))
                             {
@@ -1219,7 +1219,7 @@ static void on_file_released (GnomeCmdFileList *fl, GnomeCmdFile *f, GdkEventBut
     g_return_if_fail (GNOME_CMD_IS_FILE (f));
     g_return_if_fail (event != NULL);
 
-    if (event->type == GDK_BUTTON_RELEASE && event->button == 1 && !fl->modifier_click && gnome_cmd_data.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_SINGLE_CLICK)
+    if (event->type == GDK_BUTTON_RELEASE && event->button == 1 && !fl->modifier_click && gnome_cmd_data.options.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_SINGLE_CLICK)
         mime_exec_file (f);
 }
 
@@ -1269,7 +1269,7 @@ static gint on_button_release (GtkWidget *widget, GdkEventButton *event, GnomeCm
     {
         if (event->button == 1 && state_is_blank (event->state))
         {
-            if (f && !fl->priv->selected_files.contain(f) && gnome_cmd_data.left_mouse_button_unselects)
+            if (f && !fl->priv->selected_files.contain(f) && gnome_cmd_data.options.left_mouse_button_unselects)
                 fl->unselect_all();
             return TRUE;
         }
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index c055dc5..f061582 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -452,14 +452,14 @@ static void on_notebook_switch_page (GtkNotebook *notebook, GtkNotebookPage *pag
 
 static void on_list_file_clicked (GnomeCmdFileList *fl, GnomeCmdFile *f, GdkEventButton *event, GnomeCmdFileSelector *fs)
 {
-    if (event->type == GDK_2BUTTON_PRESS && event->button == 1 && gnome_cmd_data.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK)
+    if (event->type == GDK_2BUTTON_PRESS && event->button == 1 && gnome_cmd_data.options.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK)
         fs->do_file_specific_action (fl, f);
 }
 
 
 static void on_list_file_released (GnomeCmdFileList *fl, GnomeCmdFile *f, GdkEventButton *event, GnomeCmdFileSelector *fs)
 {
-    if (event->type == GDK_BUTTON_RELEASE && event->button == 1 && !fl->modifier_click && gnome_cmd_data.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_SINGLE_CLICK)
+    if (event->type == GDK_BUTTON_RELEASE && event->button == 1 && !fl->modifier_click && gnome_cmd_data.options.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_SINGLE_CLICK)
         fs->do_file_specific_action (fl, f);
 }
 
@@ -475,7 +475,7 @@ static void on_list_list_clicked (GnomeCmdFileList *fl, GnomeCmdFile *f, GdkEven
                 break;
 
             case 2:
-                if (gnome_cmd_data.middle_mouse_button_mode==GnomeCmdData::MIDDLE_BUTTON_GOES_UP_DIR)
+                if (gnome_cmd_data.options.middle_mouse_button_mode==GnomeCmdData::MIDDLE_BUTTON_GOES_UP_DIR)
                 {
                     if (fl->locked)
                         fs->new_tab(gnome_cmd_dir_get_parent (fl->cwd));
@@ -1506,7 +1506,7 @@ XML::xstream &operator << (XML::xstream &xml, GnomeCmdFileSelector &fs)
 {
     GList *tabs = gtk_container_get_children (*fs.notebook);
 
-    if (gnome_cmd_data.save_tabs_on_exit)
+    if (gnome_cmd_data.options.save_tabs_on_exit)
         for (GList *i=tabs; i; i=i->next)
         {
             GnomeCmdFileList *fl = (GnomeCmdFileList *) gtk_bin_get_child (GTK_BIN (i->data));
@@ -1515,7 +1515,7 @@ XML::xstream &operator << (XML::xstream &xml, GnomeCmdFileSelector &fs)
                 xml << *fl;
         }
     else
-        if (gnome_cmd_data.save_dirs_on_exit)
+        if (gnome_cmd_data.options.save_dirs_on_exit)
             for (GList *i=tabs; i; i=i->next)
             {
                 GnomeCmdFileList *fl = (GnomeCmdFileList *) gtk_bin_get_child (GTK_BIN (i->data));
diff --git a/src/gnome-cmd-file.cc b/src/gnome-cmd-file.cc
index 2e78873..b456311 100644
--- a/src/gnome-cmd-file.cc
+++ b/src/gnome-cmd-file.cc
@@ -203,7 +203,7 @@ void gnome_cmd_file_setup (GnomeCmdFile *f, GnomeVFSFileInfo *info, GnomeCmdDir
 
     gchar *utf8_name;
 
-    if (!gnome_cmd_data.case_sens_sort)
+    if (!gnome_cmd_data.options.case_sens_sort)
     {
         gchar *s = get_utf8 (info->name);
         utf8_name = g_utf8_casefold (s, -1);
@@ -762,7 +762,7 @@ void GnomeCmdFile::update_info(GnomeVFSFileInfo *info)
 
     gchar *utf8_name;
 
-    if (!gnome_cmd_data.case_sens_sort)
+    if (!gnome_cmd_data.options.case_sens_sort)
     {
         gchar *s = get_utf8 (info->name);
         utf8_name = g_utf8_casefold (s, -1);
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index 49b984c..53c7a1d 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -140,7 +140,7 @@ gint gnome_cmd_key_snooper(GtkWidget *grab_widget, GdkEventKey *event, GnomeCmdM
           event->keyval == GDK_period || event->keyval == GDK_question|| event->keyval == GDK_asterisk || event->keyval == GDK_bracketleft))
         return FALSE;
 
-    if (!gnome_cmd_data.alt_quick_search)
+    if (!gnome_cmd_data.options.alt_quick_search)
         return FALSE;
 
     if (!state_is_alt (event->state) && !state_is_alt_shift (event->state))
diff --git a/src/gnome-cmd-options-dialog.cc b/src/gnome-cmd-options-dialog.cc
index dfdb6e5..a5c879b 100644
--- a/src/gnome-cmd-options-dialog.cc
+++ b/src/gnome-cmd-options-dialog.cc
@@ -74,16 +74,16 @@ inline GtkWidget *create_general_tab (GtkWidget *parent, GnomeCmdData &cfg)
 
     radio = create_radio (parent, NULL, _("Single click to open items"), "lmb_singleclick_radio");
     gtk_box_pack_start (GTK_BOX (cat_box), radio, FALSE, TRUE, 0);
-    if (cfg.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_SINGLE_CLICK)
+    if (cfg.options.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_SINGLE_CLICK)
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
     radio = create_radio (parent, get_radio_group (radio), _("Double click to open items"), "lmb_doubleclick_radio");
     gtk_container_add (GTK_CONTAINER (cat_box), radio);
-    if (cfg.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK)
+    if (cfg.options.left_mouse_button_mode == GnomeCmdData::LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK)
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
 
     check = create_check (parent, _("Single click unselects files"), "lmb_unselects_check");
     gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.left_mouse_button_unselects);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.options.left_mouse_button_unselects);
 
 
     // Middle mouse button settings
@@ -93,11 +93,11 @@ inline GtkWidget *create_general_tab (GtkWidget *parent, GnomeCmdData &cfg)
 
     radio = create_radio (parent, NULL, _("Up one directory"), "mmb_cd_up_radio");
     gtk_box_pack_start (GTK_BOX (cat_box), radio, FALSE, TRUE, 0);
-    if (cfg.middle_mouse_button_mode == GnomeCmdData::MIDDLE_BUTTON_GOES_UP_DIR)
+    if (cfg.options.middle_mouse_button_mode == GnomeCmdData::MIDDLE_BUTTON_GOES_UP_DIR)
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
     radio = create_radio (parent, get_radio_group (radio), _("Opens new tab"), "mmb_new_tab_radio");
     gtk_container_add (GTK_CONTAINER (cat_box), radio);
-    if (cfg.middle_mouse_button_mode == GnomeCmdData::MIDDLE_BUTTON_OPENS_NEW_TAB)
+    if (cfg.options.middle_mouse_button_mode == GnomeCmdData::MIDDLE_BUTTON_OPENS_NEW_TAB)
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
 
 
@@ -108,11 +108,11 @@ inline GtkWidget *create_general_tab (GtkWidget *parent, GnomeCmdData &cfg)
 
     radio = create_radio (parent, NULL, _("Shows popup menu"), "rmb_popup_radio");
     gtk_box_pack_start (GTK_BOX (cat_box), radio, FALSE, TRUE, 0);
-    if (cfg.right_mouse_button_mode == GnomeCmdData::RIGHT_BUTTON_POPUPS_MENU)
+    if (cfg.options.right_mouse_button_mode == GnomeCmdData::RIGHT_BUTTON_POPUPS_MENU)
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
     radio = create_radio (parent, get_radio_group (radio), _("Selects files"), "rmb_sel_radio");
     gtk_container_add (GTK_CONTAINER (cat_box), radio);
-    if (cfg.right_mouse_button_mode == GnomeCmdData::RIGHT_BUTTON_SELECTS)
+    if (cfg.options.right_mouse_button_mode == GnomeCmdData::RIGHT_BUTTON_SELECTS)
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
 
 
@@ -123,7 +123,7 @@ inline GtkWidget *create_general_tab (GtkWidget *parent, GnomeCmdData &cfg)
 
     check = create_check (parent, _("Case sensitive"), "case_sens_check");
     gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.case_sens_sort);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.options.case_sens_sort);
 
 
     // Quick search options
@@ -133,18 +133,18 @@ inline GtkWidget *create_general_tab (GtkWidget *parent, GnomeCmdData &cfg)
 
     radio = create_radio (parent, NULL, _("CTRL+ALT+letters"), "ctrl_alt_quick_search");
     gtk_box_pack_start (GTK_BOX (cat_box), radio, FALSE, TRUE, 0);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), !cfg.alt_quick_search);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), !cfg.options.alt_quick_search);
     radio = create_radio (parent, get_radio_group (radio), _("ALT+letters (menu access with F10)"), "alt_quick_search");
     gtk_container_add (GTK_CONTAINER (cat_box), radio);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), cfg.alt_quick_search);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), cfg.options.alt_quick_search);
 
     check = create_check (parent, _("Match beginning of the file name"), "qsearch_exact_match_begin");
     gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.quick_search_exact_match_begin);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.options.quick_search_exact_match_begin);
 
     check = create_check (parent, _("Match end of the file name"), "qsearch_exact_match_end");
     gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.quick_search_exact_match_end);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.options.quick_search_exact_match_end);
 
 
     // Multiple instances
@@ -154,7 +154,7 @@ inline GtkWidget *create_general_tab (GtkWidget *parent, GnomeCmdData &cfg)
 
     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), !cfg.allow_multiple_instances);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), !cfg.options.allow_multiple_instances);
 
 
     // Save on exit
@@ -164,16 +164,16 @@ inline GtkWidget *create_general_tab (GtkWidget *parent, GnomeCmdData &cfg)
 
     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), cfg.save_dirs_on_exit);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.options.save_dirs_on_exit);
 
     check = create_check (parent, _("Tabs"), "save_tabs");
     gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
     g_signal_connect (check, "toggled", G_CALLBACK (on_save_tabs_toggled), parent);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.save_tabs_on_exit);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.options.save_tabs_on_exit);
 
     check = create_check (parent, _("Directory history"), "save_dir_history");
     gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.save_dir_history_on_exit);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.options.save_dir_history_on_exit);
 
 
     return frame;
@@ -195,24 +195,24 @@ inline void store_general_options (GtkWidget *dialog, GnomeCmdData &cfg)
     GtkWidget *save_tabs = lookup_widget (dialog, "save_tabs");
     GtkWidget *save_dir_history = lookup_widget (dialog, "save_dir_history");
 
-    cfg.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;
+    cfg.options.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;
 
-    cfg.left_mouse_button_unselects = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (lmb_unselects_check));
+    cfg.options.left_mouse_button_unselects = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (lmb_unselects_check));
 
-    cfg.middle_mouse_button_mode = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mmb_cd_up_radio)) ? GnomeCmdData::MIDDLE_BUTTON_GOES_UP_DIR
-                                                                                                      : GnomeCmdData::MIDDLE_BUTTON_OPENS_NEW_TAB;
+    cfg.options.middle_mouse_button_mode = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (mmb_cd_up_radio)) ? GnomeCmdData::MIDDLE_BUTTON_GOES_UP_DIR
+                                                                                                              : GnomeCmdData::MIDDLE_BUTTON_OPENS_NEW_TAB;
 
-    cfg.right_mouse_button_mode = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rmb_popup_radio)) ? GnomeCmdData::RIGHT_BUTTON_POPUPS_MENU
-                                                                                                     : GnomeCmdData::RIGHT_BUTTON_SELECTS;
+    cfg.options.right_mouse_button_mode = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rmb_popup_radio)) ? GnomeCmdData::RIGHT_BUTTON_POPUPS_MENU
+                                                                                                             : GnomeCmdData::RIGHT_BUTTON_SELECTS;
 
-    cfg.case_sens_sort = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (case_sens_check));
-    cfg.alt_quick_search = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (alt_quick_search));
-    cfg.allow_multiple_instances = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (multiple_instance_check));
-    cfg.quick_search_exact_match_begin = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (qsearch_exact_match_begin));
-    cfg.quick_search_exact_match_end = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (qsearch_exact_match_end));
-    cfg.save_dirs_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_dirs));
-    cfg.save_tabs_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_tabs));
-    cfg.save_dir_history_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_dir_history));
+    cfg.options.case_sens_sort = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (case_sens_check));
+    cfg.options.alt_quick_search = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (alt_quick_search));
+    cfg.options.allow_multiple_instances = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (multiple_instance_check));
+    cfg.options.quick_search_exact_match_begin = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (qsearch_exact_match_begin));
+    cfg.options.quick_search_exact_match_end = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (qsearch_exact_match_end));
+    cfg.options.save_dirs_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_dirs));
+    cfg.options.save_tabs_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_tabs));
+    cfg.options.save_dir_history_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_dir_history));
 }
 
 
diff --git a/src/gnome-cmd-quicksearch-popup.cc b/src/gnome-cmd-quicksearch-popup.cc
index 6ba3d59..c1acae1 100644
--- a/src/gnome-cmd-quicksearch-popup.cc
+++ b/src/gnome-cmd-quicksearch-popup.cc
@@ -75,16 +75,16 @@ static void set_filter (GnomeCmdQuicksearchPopup *popup, const gchar *text)
 
     gchar *pattern;
 
-    if (gnome_cmd_data.quick_search_exact_match_begin)
-        pattern = gnome_cmd_data.quick_search_exact_match_end ? g_strdup (text) : g_strconcat (text, "*", NULL);
+    if (gnome_cmd_data.options.quick_search_exact_match_begin)
+        pattern = gnome_cmd_data.options.quick_search_exact_match_end ? g_strdup (text) : g_strconcat (text, "*", NULL);
     else
-        pattern = gnome_cmd_data.quick_search_exact_match_end ? g_strconcat ("*", text, NULL) : g_strconcat ("*", text, "*", NULL);
+        pattern = gnome_cmd_data.options.quick_search_exact_match_end ? g_strconcat ("*", text, NULL) : g_strconcat ("*", text, "*", NULL);
 
     for (GList *files = popup->priv->fl->get_visible_files(); files; files = files->next)
     {
         GnomeCmdFile *f = (GnomeCmdFile *) files->data;
 
-        if (gnome_cmd_filter_fnmatch (pattern, f->info->name, gnome_cmd_data.case_sens_sort))
+        if (gnome_cmd_filter_fnmatch (pattern, f->info->name, gnome_cmd_data.options.case_sens_sort))
         {
             if (first)
             {
diff --git a/src/main.cc b/src/main.cc
index 868221f..3185c4e 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -141,7 +141,7 @@ int main (int argc, char *argv[])
 
     app = unique_app_new ("org.gnome.GnomeCommander", NULL);
 
-    if (!gnome_cmd_data.allow_multiple_instances && unique_app_is_running (app))
+    if (!gnome_cmd_data.options.allow_multiple_instances && unique_app_is_running (app))
         unique_app_send_message (app, UNIQUE_ACTIVATE, NULL);
     else
     {



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