[gthumb/ext] allow to reorder searches as well
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext] allow to reorder searches as well
- Date: Tue, 25 Aug 2009 18:53:25 +0000 (UTC)
commit a59a789d864a181101cdddd34dd8dab59b831b88
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Aug 25 20:51:53 2009 +0200
allow to reorder searches as well
extensions/catalogs/gth-file-source-catalogs.c | 31 ++++++++++++-----------
extensions/search/gth-search.c | 14 ++++++++++
2 files changed, 30 insertions(+), 15 deletions(-)
---
diff --git a/extensions/catalogs/gth-file-source-catalogs.c b/extensions/catalogs/gth-file-source-catalogs.c
index 8ac4be5..f875a52 100644
--- a/extensions/catalogs/gth-file-source-catalogs.c
+++ b/extensions/catalogs/gth-file-source-catalogs.c
@@ -339,26 +339,27 @@ read_metadata_catalog_ready_cb (GObject *object,
gpointer user_data)
{
ReadMetadataOpData *read_metadata = user_data;
- GthCatalog *catalog;
- const char *sort_type;
- gboolean sort_inverse;
- if (object == NULL) {
- read_metadata->callback (G_OBJECT (read_metadata->file_source), error, read_metadata->data);
- read_metadata_free (read_metadata);
- return;
- }
+ /* ignore errors */
+ if (error != NULL)
+ g_clear_error (&error);
- catalog = GTH_CATALOG (object);
- sort_type = gth_catalog_get_order (catalog, &sort_inverse);
- if (sort_type != NULL) {
- g_file_info_set_attribute_string (read_metadata->file_data->info, "sort::type", sort_type);
- g_file_info_set_attribute_boolean (read_metadata->file_data->info, "sort::inverse", sort_inverse);
+ if (object != NULL) {
+ GthCatalog *catalog;
+ const char *sort_type;
+ gboolean sort_inverse;
+
+ catalog = GTH_CATALOG (object);
+ sort_type = gth_catalog_get_order (catalog, &sort_inverse);
+ if (sort_type != NULL) {
+ g_file_info_set_attribute_string (read_metadata->file_data->info, "sort::type", sort_type);
+ g_file_info_set_attribute_boolean (read_metadata->file_data->info, "sort::inverse", sort_inverse);
+ }
+
+ g_object_unref (catalog);
}
read_metadata->callback (G_OBJECT (read_metadata->file_source), error, read_metadata->data);
-
- g_object_unref (catalog);
read_metadata_free (read_metadata);
}
diff --git a/extensions/search/gth-search.c b/extensions/search/gth-search.c
index 789ec26..c5a6205 100644
--- a/extensions/search/gth-search.c
+++ b/extensions/search/gth-search.c
@@ -48,6 +48,8 @@ gth_search_real_create_element (DomDomizable *base,
GthSearch *self;
DomElement *element;
char *uri;
+ const char *sort_order;
+ gboolean sort_inverse;
GList *file_list;
g_return_val_if_fail (DOM_IS_DOCUMENT (doc), NULL);
@@ -68,6 +70,13 @@ gth_search_real_create_element (DomDomizable *base,
dom_element_append_child (element, dom_domizable_create_element (DOM_DOMIZABLE (self->priv->test), doc));
+ sort_order = gth_catalog_get_order (GTH_CATALOG (self), &sort_inverse);
+ if (sort_order != NULL)
+ dom_element_append_child (element, dom_document_create_element (doc, "order",
+ "type", sort_order,
+ "inverse", (sort_inverse ? "1" : "0"),
+ NULL));
+
file_list = gth_catalog_get_file_list (GTH_CATALOG (self));
if (file_list != NULL) {
DomElement *e_file_list;
@@ -131,6 +140,11 @@ gth_search_real_load_from_element (DomDomizable *base,
files = g_list_prepend (files, g_file_new_for_uri (uri));
}
}
+ else if (g_strcmp0 (node->tag_name, "order") == 0)
+ gth_catalog_set_order (GTH_CATALOG (self),
+ dom_element_get_attribute (node, "type"),
+ g_strcmp0 (dom_element_get_attribute (node, "inverse"), "1") == 0);
+
}
gth_catalog_set_file_list (GTH_CATALOG (self), files);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]