[gthumb] photo importer: remember the last used filter
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] photo importer: remember the last used filter
- Date: Sat, 27 Apr 2019 12:53:56 +0000 (UTC)
commit 02b676d44d015b2bdf1d8f66e38b26fc8b4f46d0
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Apr 27 14:47:21 2019 +0200
photo importer: remember the last used filter
data/gschemas/org.gnome.gthumb.photo-importer.gschema.xml | 3 +++
extensions/photo_importer/dlg-photo-importer.c | 9 ++++++---
extensions/photo_importer/preferences.h | 3 ++-
3 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/data/gschemas/org.gnome.gthumb.photo-importer.gschema.xml
b/data/gschemas/org.gnome.gthumb.photo-importer.gschema.xml
index 44e6cc20..f0a802b5 100644
--- a/data/gschemas/org.gnome.gthumb.photo-importer.gschema.xml
+++ b/data/gschemas/org.gnome.gthumb.photo-importer.gschema.xml
@@ -25,6 +25,9 @@
<key name="adjust-orientation" type="b">
<default>false</default>
</key>
+ <key name="filter" type="s">
+ <default>'file::type::is_media'</default>
+ </key>
</schema>
</schemalist>
diff --git a/extensions/photo_importer/dlg-photo-importer.c b/extensions/photo_importer/dlg-photo-importer.c
index 7832cefe..b34f523b 100644
--- a/extensions/photo_importer/dlg-photo-importer.c
+++ b/extensions/photo_importer/dlg-photo-importer.c
@@ -526,6 +526,8 @@ filter_combobox_changed_cb (GtkComboBox *widget,
test = gth_main_get_registered_object (GTH_TYPE_TEST, test_id);
gth_file_list_set_filter (GTH_FILE_LIST (data->file_list), test);
+ g_settings_set_string (data->settings, PREF_PHOTO_IMPORTER_FILTER, test_id);
+
g_object_unref (test);
}
@@ -548,7 +550,7 @@ dlg_photo_importer (GthBrowser *browser,
GtkCellRenderer *renderer;
GthFileDataSort *sort_type;
GList *tests, *scan;
- char *general_filter;
+ char *default_filter;
int i, active_filter;
int i_general;
@@ -643,7 +645,7 @@ dlg_photo_importer (GthBrowser *browser,
gtk_box_pack_start (GTK_BOX (GET_WIDGET ("filelist_box")), data->file_list, TRUE, TRUE, 0);
tests = gth_main_get_registered_objects_id (GTH_TYPE_TEST);
- general_filter = "file::type::is_media"; /* default value */
+ default_filter = g_settings_get_string (data->settings, PREF_PHOTO_IMPORTER_FILTER); /* default value
*/
active_filter = 0;
data->filter_combobox = gtk_combo_box_text_new ();
@@ -656,7 +658,7 @@ dlg_photo_importer (GthBrowser *browser,
i_general += 1;
test = gth_main_get_registered_object (GTH_TYPE_TEST, registered_test_id);
- if (strcmp (registered_test_id, general_filter) == 0) {
+ if (strcmp (registered_test_id, default_filter) == 0) {
active_filter = i_general;
gth_file_list_set_filter (GTH_FILE_LIST (data->file_list), test);
}
@@ -676,6 +678,7 @@ dlg_photo_importer (GthBrowser *browser,
gtk_label_set_use_underline (GTK_LABEL (GET_WIDGET ("filter_label")), TRUE);
_g_string_list_free (tests);
+ g_free (default_filter);
data->tags_entry = gth_tags_entry_new (GTH_TAGS_ENTRY_MODE_POPUP);
gtk_widget_show (data->tags_entry);
diff --git a/extensions/photo_importer/preferences.h b/extensions/photo_importer/preferences.h
index 33749f87..fad82275 100644
--- a/extensions/photo_importer/preferences.h
+++ b/extensions/photo_importer/preferences.h
@@ -30,10 +30,11 @@ G_BEGIN_DECLS
#define GTHUMB_PHOTO_IMPORTER_SCHEMA GTHUMB_SCHEMA ".photo-importer"
-/* keys: viewer */
+/* keys */
#define PREF_PHOTO_IMPORTER_DELETE_FROM_DEVICE "delete-from-device"
#define PREF_PHOTO_IMPORTER_ADJUST_ORIENTATION "adjust-orientation"
+#define PREF_PHOTO_IMPORTER_FILTER "filter"
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]