Rename file filtering options.
authorLaurent Monin <geeqie@norz.org>
Sat, 12 Apr 2008 09:12:37 +0000 (09:12 +0000)
committerLaurent Monin <geeqie@norz.org>
Sat, 12 Apr 2008 09:12:37 +0000 (09:12 +0000)
src/filelist.c
src/globals.c
src/preferences.c
src/rcfile.c
src/typedefs.h
src/view_dir_tree.c

index 21cc334..ddf8f6b 100644 (file)
@@ -318,7 +318,7 @@ gint filter_name_exists(const gchar *name)
        GList *work;
        gint ln;
 
-       if (!extension_list || options->file_filter_disable) return TRUE;
+       if (!extension_list || options->file_filter.disable) return TRUE;
 
        ln = strlen(name);
        work = extension_list;
@@ -378,7 +378,7 @@ void filter_write_list(SecureSaveInfo *ssi)
                gchar *extensions = escquote_value(fe->extensions);
                gchar *description = escquote_value(fe->description);
 
-               secure_fprintf(ssi, "filter_ext: \"%s%s\" %s %s\n",
+               secure_fprintf(ssi, "file_filter.ext: \"%s%s\" %s %s\n",
                               (fe->enabled) ? "" : "#",
                               fe->key, extensions, description);
                g_free(extensions);
@@ -423,7 +423,7 @@ GList *path_list_filter(GList *list, gint is_dir_list)
 {
        GList *work;
 
-       if (!is_dir_list && options->file_filter_disable && options->show_dot_files) return list;
+       if (!is_dir_list && options->file_filter.disable && options->file_filter.show_dot_files) return list;
 
        work = list;
        while (work)
@@ -433,7 +433,7 @@ GList *path_list_filter(GList *list, gint is_dir_list)
 
                base = filename_from_path(name);
 
-               if ((!options->show_dot_files && ishidden(base)) ||
+               if ((!options->file_filter.show_dot_files && ishidden(base)) ||
                    (!is_dir_list && !filter_name_exists(base)) ||
                    (is_dir_list && base[0] == '.' && (strcmp(base, GQ_CACHE_LOCAL_THUMB) == 0 ||
                                                       strcmp(base, GQ_CACHE_LOCAL_METADATA) == 0)) )
@@ -1220,7 +1220,7 @@ static gint filelist_read_real(const gchar *path, GList **files, GList **dirs, g
        while ((dir = readdir(dp)) != NULL)
                {
                gchar *name = dir->d_name;
-               if (options->show_dot_files || !ishidden(name))
+               if (options->file_filter.show_dot_files || !ishidden(name))
                        {
                        gchar *filepath = g_strconcat(pathl, "/", name, NULL);
                        if ((follow_symlinks ? 
@@ -1349,7 +1349,7 @@ GList *filelist_filter(GList *list, gint is_dir_list)
 {
        GList *work;
 
-       if (!is_dir_list && options->file_filter_disable && options->show_dot_files) return list;
+       if (!is_dir_list && options->file_filter.disable && options->file_filter.show_dot_files) return list;
 
        work = list;
        while (work)
@@ -1357,7 +1357,7 @@ GList *filelist_filter(GList *list, gint is_dir_list)
                FileData *fd = (FileData *)(work->data);
                const gchar *name = fd->name;
 
-               if ((!options->show_dot_files && ishidden(name)) ||
+               if ((!options->file_filter.show_dot_files && ishidden(name)) ||
                    (!is_dir_list && !filter_name_exists(name)) ||
                    (is_dir_list && name[0] == '.' && (strcmp(name, GQ_CACHE_LOCAL_THUMB) == 0 ||
                                                       strcmp(name, GQ_CACHE_LOCAL_METADATA) == 0)) )
index 0999ece..9bc4d20 100644 (file)
@@ -67,8 +67,8 @@ ConfOptions *init_options(ConfOptions *options)
        options->thumbnail_fast = TRUE;
        options->thumbnail_spec_standard = TRUE;
        options->enable_metadata_dirs = FALSE;
-       options->show_dot_files = FALSE;
-       options->file_filter_disable = FALSE;
+       options->file_filter.show_dot_files = FALSE;
+       options->file_filter.disable = FALSE;
        
        
        options->thumbnails_enabled = FALSE;
index fd688a1..0457baf 100644 (file)
@@ -178,9 +178,9 @@ static void config_window_apply(void)
        buf = gtk_entry_get_text(GTK_ENTRY(safe_delete_path_entry));
        if (buf && strlen(buf) > 0) options->safe_delete_path = remove_trailing_slash(buf);
 
-       if (options->show_dot_files != c_options->show_dot_files) refresh = TRUE;
+       if (options->file_filter.show_dot_files != c_options->file_filter.show_dot_files) refresh = TRUE;
        if (options->file_sort.case_sensitive != c_options->file_sort.case_sensitive) refresh = TRUE;
-       if (options->file_filter_disable != c_options->file_filter_disable) refresh = TRUE;
+       if (options->file_filter.disable != c_options->file_filter.disable) refresh = TRUE;
 
        options->startup_path_enable = c_options->startup_path_enable;
        options->confirm_delete = c_options->confirm_delete;
@@ -208,9 +208,9 @@ static void config_window_apply(void)
 #endif
        options->thumbnail_spec_standard = c_options->thumbnail_spec_standard;
        options->enable_metadata_dirs = c_options->enable_metadata_dirs;
-       options->show_dot_files = c_options->show_dot_files;
+       options->file_filter.show_dot_files = c_options->file_filter.show_dot_files;
        options->file_sort.case_sensitive = c_options->file_sort.case_sensitive;
-       options->file_filter_disable = c_options->file_filter_disable;
+       options->file_filter.disable = c_options->file_filter.disable;
 
        sidecar_ext_parse(gtk_entry_get_text(GTK_ENTRY(sidecar_ext_entry)), FALSE);
 
@@ -1004,12 +1004,12 @@ static void config_tab_filtering(GtkWidget *notebook)
        group = pref_box_new(vbox, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
 
        pref_checkbox_new_int(group, _("Show entries that begin with a dot"),
-                             options->show_dot_files, &c_options->show_dot_files);
+                             options->file_filter.show_dot_files, &c_options->file_filter.show_dot_files);
        pref_checkbox_new_int(group, _("Case sensitive sort"),
                              options->file_sort.case_sensitive, &c_options->file_sort.case_sensitive);
 
        ct_button = pref_checkbox_new_int(group, _("Disable File Filtering"),
-                                         options->file_filter_disable, &c_options->file_filter_disable);
+                                         options->file_filter.disable, &c_options->file_filter.disable);
 
 
        group = pref_group_new(vbox, FALSE, _("Grouping sidecar extensions"), GTK_ORIENTATION_VERTICAL);
@@ -1024,7 +1024,7 @@ static void config_tab_filtering(GtkWidget *notebook)
        frame = pref_group_parent(group);
        g_signal_connect(G_OBJECT(ct_button), "toggled",
                         G_CALLBACK(filter_disable_cb), frame);
-       gtk_widget_set_sensitive(frame, !options->file_filter_disable);
+       gtk_widget_set_sensitive(frame, !options->file_filter.disable);
 
        scrolled = gtk_scrolled_window_new(NULL, NULL);
        gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_IN);
index c6c57c3..4edf3b8 100644 (file)
@@ -379,8 +379,8 @@ void save_options(void)
 
        secure_fprintf(ssi, "\n##### Filtering Options #####\n\n");
 
-       write_bool_option(ssi, "show_dotfiles", options->show_dot_files);
-       write_bool_option(ssi, "disable_filtering", options->file_filter_disable);
+       write_bool_option(ssi, "file_filter.show_dot_files", options->file_filter.show_dot_files);
+       write_bool_option(ssi, "file_filter.disable", options->file_filter.disable);
        
        filter_write_list(ssi);
        
@@ -687,12 +687,12 @@ void load_options(void)
 
                /* filtering options */
 
-               options->show_dot_files = read_bool_option(f, option,
-                       "show_dotfiles", value, options->show_dot_files);
-               options->file_filter_disable = read_bool_option(f, option,
-                       "disable_filtering", value, options->file_filter_disable);
+               options->file_filter.show_dot_files = read_bool_option(f, option,
+                       "file_filter.show_dot_files", value, options->file_filter.show_dot_files);
+               options->file_filter.disable = read_bool_option(f, option,
+                       "file_filter.disable", value, options->file_filter.disable);
 
-               if (strcasecmp(option, "filter_ext") == 0)
+               if (strcasecmp(option, "file_filter.ext") == 0)
                        {
                        filter_parse(value_all);
                        }
index 04c0483..f2e93d0 100644 (file)
@@ -813,8 +813,10 @@ struct _ConfOptions
        gint thumbnails_enabled;
 
        /* file filtering */
-       gint show_dot_files;
-       gint file_filter_disable;
+       struct {
+               gint show_dot_files;
+               gint disable;
+       } file_filter;
 
        /* collections */
        struct {
index c1d689f..061987a 100644 (file)
@@ -1062,7 +1062,7 @@ static gint vdtree_populate_path_by_iter(ViewDirTree *vdt, GtkTreeIter *iter, gi
        /* when hidden files are not enabled, and the user enters a hidden path,
         * allow the tree to display that path by specifically inserting the hidden entries
         */
-       if (!options->show_dot_files &&
+       if (!options->file_filter.show_dot_files &&
            target_path &&
            strncmp(nd->fd->path, target_path, strlen(nd->fd->path)) == 0)
                {