[gnome-commander] GnomeCmdData: move Filters options to GnomeCmdData::Options
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] GnomeCmdData: move Filters options to GnomeCmdData::Options
- Date: Fri, 11 Nov 2011 17:36:20 +0000 (UTC)
commit 5376222837225ce6da8a50b4f095f6ef1785dc74
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Fri Nov 11 18:17:52 2011 +0100
GnomeCmdData: move Filters options to GnomeCmdData::Options
src/gnome-cmd-data.cc | 63 ++++++++++++++++++---------------------
src/gnome-cmd-data.h | 12 +++++--
src/gnome-cmd-file-list.cc | 4 +-
src/gnome-cmd-main-menu.cc | 4 +-
src/gnome-cmd-main-win.cc | 2 +-
src/gnome-cmd-options-dialog.cc | 26 ++++++++--------
src/gnome-cmd-user-actions.cc | 4 +-
7 files changed, 58 insertions(+), 57 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 89f934e..ae93845 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -54,8 +54,6 @@ struct GnomeCmdData::Private
gint sort_column[2];
gboolean sort_direction[2];
gint main_win_pos[2];
- gchar *backup_pattern;
- GList *backup_pattern_list;
gchar *symlink_prefix;
gchar *ftp_anonymous_password;
@@ -1005,16 +1003,16 @@ void GnomeCmdData::load()
options.confirm_move_overwrite = (GnomeCmdConfirmOverwriteMode) gnome_cmd_data_get_int ("/confirm/move_overwrite", GNOME_CMD_CONFIRM_OVERWRITE_QUERY);
options.confirm_mouse_dnd = gnome_cmd_data_get_bool ("/confirm/confirm_mouse_dnd", TRUE);
- filter_settings.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN] = gnome_cmd_data_get_bool ("/options/show_unknown", FALSE);
- filter_settings.file_types[GNOME_VFS_FILE_TYPE_REGULAR] = gnome_cmd_data_get_bool ("/options/show_regular", FALSE);
- filter_settings.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY] = gnome_cmd_data_get_bool ("/options/show_directory", FALSE);
- filter_settings.file_types[GNOME_VFS_FILE_TYPE_FIFO] = gnome_cmd_data_get_bool ("/options/show_fifo", FALSE);
- filter_settings.file_types[GNOME_VFS_FILE_TYPE_SOCKET] = gnome_cmd_data_get_bool ("/options/show_socket", FALSE);
- filter_settings.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE] = gnome_cmd_data_get_bool ("/options/show_char_device", FALSE);
- filter_settings.file_types[GNOME_VFS_FILE_TYPE_BLOCK_DEVICE] = gnome_cmd_data_get_bool ("/options/show_block_device", FALSE);
- filter_settings.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK] = gnome_cmd_data_get_bool ("/options/show_symbolic_link", FALSE);
- filter_settings.hidden = gnome_cmd_data_get_bool ("/options/hidden_filter", TRUE);
- filter_settings.backup = gnome_cmd_data_get_bool ("/options/backup_filter", TRUE);
+ options.filter.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN] = gnome_cmd_data_get_bool ("/options/show_unknown", FALSE);
+ options.filter.file_types[GNOME_VFS_FILE_TYPE_REGULAR] = gnome_cmd_data_get_bool ("/options/show_regular", FALSE);
+ options.filter.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY] = gnome_cmd_data_get_bool ("/options/show_directory", FALSE);
+ options.filter.file_types[GNOME_VFS_FILE_TYPE_FIFO] = gnome_cmd_data_get_bool ("/options/show_fifo", FALSE);
+ options.filter.file_types[GNOME_VFS_FILE_TYPE_SOCKET] = gnome_cmd_data_get_bool ("/options/show_socket", FALSE);
+ options.filter.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE] = gnome_cmd_data_get_bool ("/options/show_char_device", FALSE);
+ options.filter.file_types[GNOME_VFS_FILE_TYPE_BLOCK_DEVICE] = gnome_cmd_data_get_bool ("/options/show_block_device", FALSE);
+ options.filter.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK] = gnome_cmd_data_get_bool ("/options/show_symbolic_link", FALSE);
+ options.filter.hidden = gnome_cmd_data_get_bool ("/options/hidden_filter", TRUE);
+ options.filter.backup = gnome_cmd_data_get_bool ("/options/backup_filter", TRUE);
options.case_sens_sort = gnome_cmd_data_get_bool ("/sort/case_sensitive", TRUE);
@@ -1139,8 +1137,8 @@ void GnomeCmdData::load()
options.always_show_tabs = gnome_cmd_data_get_bool ("/options/always_show_tabs", FALSE);
options.tab_lock_indicator = (TabLockIndicator) gnome_cmd_data_get_int ("/options/tab_lock_indicator", TAB_LOCK_ICON);
- priv->backup_pattern = gnome_cmd_data_get_string ("/defaults/backup_pattern", "*~;*.bak");
- priv->backup_pattern_list = patlist_new (priv->backup_pattern);
+ options.backup_pattern = gnome_cmd_data_get_string ("/defaults/backup_pattern", "*~;*.bak");
+ options.backup_pattern_list = patlist_new (options.backup_pattern);
main_win_state = (GdkWindowState) gnome_cmd_data_get_int ("/options/main_win_state", (gint) GDK_WINDOW_STATE_MAXIMIZED);
@@ -1441,17 +1439,17 @@ void GnomeCmdData::save()
gnome_cmd_data_set_int ("/confirm/move_overwrite", options.confirm_move_overwrite);
gnome_cmd_data_set_bool ("/confirm/confirm_mouse_dnd", options.confirm_mouse_dnd);
- gnome_cmd_data_set_bool ("/options/show_unknown", filter_settings.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN]);
- gnome_cmd_data_set_bool ("/options/show_regular", filter_settings.file_types[GNOME_VFS_FILE_TYPE_REGULAR]);
- gnome_cmd_data_set_bool ("/options/show_directory", filter_settings.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY]);
- gnome_cmd_data_set_bool ("/options/show_fifo", filter_settings.file_types[GNOME_VFS_FILE_TYPE_FIFO]);
- gnome_cmd_data_set_bool ("/options/show_socket", filter_settings.file_types[GNOME_VFS_FILE_TYPE_SOCKET]);
- gnome_cmd_data_set_bool ("/options/show_char_device", filter_settings.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE]);
- gnome_cmd_data_set_bool ("/options/show_block_device", filter_settings.file_types[GNOME_VFS_FILE_TYPE_BLOCK_DEVICE]);
- gnome_cmd_data_set_bool ("/options/show_symbolic_link", filter_settings.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK]);
+ gnome_cmd_data_set_bool ("/options/show_unknown", options.filter.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN]);
+ gnome_cmd_data_set_bool ("/options/show_regular", options.filter.file_types[GNOME_VFS_FILE_TYPE_REGULAR]);
+ gnome_cmd_data_set_bool ("/options/show_directory", options.filter.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY]);
+ gnome_cmd_data_set_bool ("/options/show_fifo", options.filter.file_types[GNOME_VFS_FILE_TYPE_FIFO]);
+ gnome_cmd_data_set_bool ("/options/show_socket", options.filter.file_types[GNOME_VFS_FILE_TYPE_SOCKET]);
+ gnome_cmd_data_set_bool ("/options/show_char_device", options.filter.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE]);
+ gnome_cmd_data_set_bool ("/options/show_block_device", options.filter.file_types[GNOME_VFS_FILE_TYPE_BLOCK_DEVICE]);
+ gnome_cmd_data_set_bool ("/options/show_symbolic_link", options.filter.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK]);
- 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 ("/options/hidden_filter", options.filter.hidden);
+ gnome_cmd_data_set_bool ("/options/backup_filter", options.filter.backup);
gnome_cmd_data_set_bool ("/sort/case_sensitive", options.case_sens_sort);
@@ -1559,7 +1557,7 @@ void GnomeCmdData::save()
gnome_cmd_data_set_bool ("/options/always_show_tabs", options.always_show_tabs);
gnome_cmd_data_set_int ("/options/tab_lock_indicator", (int) options.tab_lock_indicator);
- gnome_cmd_data_set_string ("/defaults/backup_pattern", priv->backup_pattern);
+ gnome_cmd_data_set_string ("/defaults/backup_pattern", options.backup_pattern);
gnome_cmd_data_set_int ("/options/main_win_state", (gint) main_win_state);
@@ -1745,26 +1743,23 @@ void gnome_cmd_data_get_main_win_pos (gint *x, gint *y)
void gnome_cmd_data_set_backup_pattern (const gchar *value)
{
- g_free (gnome_cmd_data.priv->backup_pattern);
+ g_free (gnome_cmd_data.options.backup_pattern);
+ patlist_free (gnome_cmd_data.options.backup_pattern_list);
- gnome_cmd_data.priv->backup_pattern = g_strdup (value);
-
- if (gnome_cmd_data.priv->backup_pattern_list)
- patlist_free (gnome_cmd_data.priv->backup_pattern_list);
-
- gnome_cmd_data.priv->backup_pattern_list = patlist_new (gnome_cmd_data.priv->backup_pattern);
+ gnome_cmd_data.options.backup_pattern = g_strdup (value);
+ gnome_cmd_data.options.backup_pattern_list = patlist_new (gnome_cmd_data.options.backup_pattern);
}
const gchar *gnome_cmd_data_get_backup_pattern ()
{
- return gnome_cmd_data.priv->backup_pattern;
+ return gnome_cmd_data.options.backup_pattern;
}
GList *gnome_cmd_data_get_backup_pattern_list ()
{
- return gnome_cmd_data.priv->backup_pattern_list;
+ return gnome_cmd_data.options.backup_pattern_list;
}
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 75c952a..44557bc 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -119,6 +119,10 @@ struct GnomeCmdData
GnomeCmdConfirmOverwriteMode confirm_copy_overwrite;
GnomeCmdConfirmOverwriteMode confirm_move_overwrite;
gboolean confirm_mouse_dnd;
+ // Filters
+ FilterSettings filter;
+ gchar *backup_pattern;
+ GList *backup_pattern_list;
Options(): left_mouse_button_mode(LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK),
left_mouse_button_unselects(TRUE),
@@ -150,7 +154,9 @@ struct GnomeCmdData
confirm_delete(TRUE),
confirm_copy_overwrite(GNOME_CMD_CONFIRM_OVERWRITE_QUERY),
confirm_move_overwrite(GNOME_CMD_CONFIRM_OVERWRITE_QUERY),
- confirm_mouse_dnd(TRUE)
+ confirm_mouse_dnd(TRUE),
+ backup_pattern(NULL),
+ backup_pattern_list(NULL)
{
memset(&ls_colors_palette, 0, sizeof(ls_colors_palette));
}
@@ -159,6 +165,8 @@ struct GnomeCmdData
{
g_free (date_format);
g_free (list_font);
+ g_free (backup_pattern);
+ patlist_free (backup_pattern_list);
}
void set_date_format (const GnomeCmdDateFormat format)
@@ -310,8 +318,6 @@ struct GnomeCmdData
Options options;
- FilterSettings filter_settings;
-
std::vector<Selection> selections;
SearchConfig search_defaults;
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 70b44ff..9b929eb 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -2559,9 +2559,9 @@ gboolean GnomeCmdFileList::file_is_wanted(GnomeCmdFile *f)
return FALSE;
if (info->symlink_name && gnome_cmd_data.hide_type(GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK))
return FALSE;
- if (info->name[0] == '.' && gnome_cmd_data.filter_settings.hidden)
+ if (info->name[0] == '.' && gnome_cmd_data.options.filter.hidden)
return FALSE;
- if (gnome_cmd_data.filter_settings.backup && patlist_matches (gnome_cmd_data_get_backup_pattern_list (), info->name))
+ if (gnome_cmd_data.options.filter.backup && patlist_matches (gnome_cmd_data_get_backup_pattern_list (), info->name))
return FALSE;
return TRUE;
diff --git a/src/gnome-cmd-main-menu.cc b/src/gnome-cmd-main-menu.cc
index 17bb2de..226e976 100644
--- a/src/gnome-cmd-main-menu.cc
+++ b/src/gnome-cmd-main-menu.cc
@@ -846,8 +846,8 @@ static void init (GnomeCmdMainMenu *main_menu)
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view_menu_uiinfo[10].widget), gnome_cmd_data.concombo_visibility);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view_menu_uiinfo[11].widget), gnome_cmd_data.cmdline_visibility);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view_menu_uiinfo[12].widget), gnome_cmd_data.buttonbar_visibility);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view_menu_uiinfo[14].widget), !gnome_cmd_data.filter_settings.hidden);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view_menu_uiinfo[15].widget), !gnome_cmd_data.filter_settings.backup);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view_menu_uiinfo[14].widget), !gnome_cmd_data.options.filter.hidden);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view_menu_uiinfo[15].widget), !gnome_cmd_data.options.filter.backup);
g_signal_connect (gnome_cmd_con_list_get (), "list-changed", G_CALLBACK (on_con_list_list_changed), main_menu);
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index 53c7a1d..eda87f5 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -946,7 +946,7 @@ gboolean GnomeCmdMainWin::key_pressed(GdkEventKey *event)
{
case GDK_H:
case GDK_h:
- gnome_cmd_data.filter_settings.hidden = !gnome_cmd_data.filter_settings.hidden;
+ gnome_cmd_data.options.filter.hidden = !gnome_cmd_data.options.filter.hidden;
gnome_cmd_style_create (gnome_cmd_data);
update_style();
gnome_cmd_data.save();
diff --git a/src/gnome-cmd-options-dialog.cc b/src/gnome-cmd-options-dialog.cc
index 50866fb..0a0b606 100644
--- a/src/gnome-cmd-options-dialog.cc
+++ b/src/gnome-cmd-options-dialog.cc
@@ -1068,10 +1068,10 @@ inline GtkWidget *create_filter_tab (GtkWidget *parent, GnomeCmdData &cfg)
check = create_check (parent, _("Hidden files"), "hide_hidden_check");
gtk_container_add (GTK_CONTAINER (cat_box), check);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.filter_settings.hidden);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.options.filter.hidden);
backup_check = create_check (parent, _("Backup files"), "hide_backup_check");
gtk_container_add (GTK_CONTAINER (cat_box), backup_check);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (backup_check), cfg.filter_settings.backup);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (backup_check), cfg.options.filter.backup);
check = create_check (parent, _("Symlinks"), "hide_symlink_check");
gtk_container_add (GTK_CONTAINER (cat_box), check);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.hide_type(GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK));
@@ -1083,7 +1083,7 @@ inline GtkWidget *create_filter_tab (GtkWidget *parent, GnomeCmdData &cfg)
entry = create_entry (parent, "backup_pattern_entry", gnome_cmd_data_get_backup_pattern ());
gtk_box_pack_start (GTK_BOX (cat_box), entry, TRUE, FALSE, 0);
- gtk_widget_set_sensitive (entry, cfg.filter_settings.backup);
+ gtk_widget_set_sensitive (entry, cfg.options.filter.backup);
g_signal_connect (backup_check, "toggled", G_CALLBACK (on_filter_backup_files_toggled), frame);
@@ -1106,33 +1106,33 @@ inline void store_filter_options (GtkWidget *dialog, GnomeCmdData &cfg)
GtkWidget *hide_backup_check = lookup_widget (dialog, "hide_backup_check");
GtkWidget *backup_pattern_entry = lookup_widget (dialog, "backup_pattern_entry");
- cfg.filter_settings.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN] =
+ cfg.options.filter.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN] =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_unknown_check));
- cfg.filter_settings.file_types[GNOME_VFS_FILE_TYPE_REGULAR] =
+ cfg.options.filter.file_types[GNOME_VFS_FILE_TYPE_REGULAR] =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_regular_check));
- cfg.filter_settings.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY] =
+ cfg.options.filter.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY] =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_directory_check));
- cfg.filter_settings.file_types[GNOME_VFS_FILE_TYPE_FIFO] =
+ cfg.options.filter.file_types[GNOME_VFS_FILE_TYPE_FIFO] =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_fifo_check));
- cfg.filter_settings.file_types[GNOME_VFS_FILE_TYPE_SOCKET] =
+ cfg.options.filter.file_types[GNOME_VFS_FILE_TYPE_SOCKET] =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_socket_check));
- cfg.filter_settings.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE] =
+ cfg.options.filter.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE] =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_char_check));
- cfg.filter_settings.file_types[GNOME_VFS_FILE_TYPE_BLOCK_DEVICE] =
+ cfg.options.filter.file_types[GNOME_VFS_FILE_TYPE_BLOCK_DEVICE] =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_block_check));
- cfg.filter_settings.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK] =
+ cfg.options.filter.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK] =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_symlink_check));
- cfg.filter_settings.hidden =
+ cfg.options.filter.hidden =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_hidden_check));
- cfg.filter_settings.backup =
+ cfg.options.filter.backup =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_backup_check));
gnome_cmd_data_set_backup_pattern (gtk_entry_get_text (GTK_ENTRY (backup_pattern_entry)));
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index 2371499..c488544 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1523,7 +1523,7 @@ void view_hidden_files (GtkMenuItem *menuitem, gpointer not_used)
if (!GTK_WIDGET_REALIZED (main_win)) return;
GtkCheckMenuItem *checkitem = (GtkCheckMenuItem *) menuitem;
- gnome_cmd_data.filter_settings.hidden = !checkitem->active;
+ gnome_cmd_data.options.filter.hidden = !checkitem->active;
get_fl (ACTIVE)->reload();
get_fl (INACTIVE)->reload();
}
@@ -1534,7 +1534,7 @@ void view_backup_files (GtkMenuItem *menuitem, gpointer not_used)
if (!GTK_WIDGET_REALIZED (main_win)) return;
GtkCheckMenuItem *checkitem = (GtkCheckMenuItem *) menuitem;
- gnome_cmd_data.filter_settings.backup = !checkitem->active;
+ gnome_cmd_data.options.filter.backup = !checkitem->active;
get_fl (ACTIVE)->reload();
get_fl (INACTIVE)->reload();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]