[gthumb] catalogs: correctly update the content of a search catalog
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] catalogs: correctly update the content of a search catalog
- Date: Wed, 11 Dec 2019 16:49:33 +0000 (UTC)
commit 3977fda19284513df0c09882313b7e7db9891f15
Author: Paolo Bacchilega <paobac src gnome org>
Date: Fri Dec 6 12:44:51 2019 +0100
catalogs: correctly update the content of a search catalog
Create the catalog object only after loading the catalog file
to make sure a GthSearch object is created when loading a
.search file.
This allows to reorder files inside a search catalog without
losing the search data.
extensions/catalogs/gth-catalog.c | 393 ++++++++++++-------------
extensions/catalogs/gth-catalog.h | 18 +-
extensions/catalogs/gth-file-source-catalogs.c | 73 ++---
extensions/search/callbacks.c | 3 +
4 files changed, 230 insertions(+), 257 deletions(-)
---
diff --git a/extensions/catalogs/gth-catalog.c b/extensions/catalogs/gth-catalog.c
index b99a125e..dfe21d3f 100644
--- a/extensions/catalogs/gth-catalog.c
+++ b/extensions/catalogs/gth-catalog.c
@@ -40,7 +40,6 @@ struct _GthCatalogPrivate {
gboolean active;
char *order;
gboolean order_inverse;
- GCancellable *cancellable;
};
@@ -251,10 +250,8 @@ gth_catalog_init (GthCatalog *catalog)
catalog->priv->file_hash = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, NULL, NULL);
catalog->priv->name = NULL;
catalog->priv->date_time = gth_datetime_new ();
- catalog->priv->active = FALSE;
catalog->priv->order = NULL;
catalog->priv->order_inverse = FALSE;
- catalog->priv->cancellable = NULL;
}
@@ -265,6 +262,34 @@ gth_catalog_new (void)
}
+GthCatalog *
+gth_catalog_new_from_data (const void *buffer,
+ gsize count,
+ GError **error)
+{
+ char *text_buffer;
+ GthCatalog *catalog = NULL;
+
+ if (buffer == NULL)
+ return NULL;
+
+ text_buffer = (char *) buffer;
+ if (strncmp (text_buffer, "<?xml ", 6) == 0) {
+ catalog = gth_hook_invoke_get ("gth-catalog-load-from-data", (gpointer) buffer);
+ if (catalog != NULL)
+ read_catalog_data_from_xml (catalog, text_buffer, count, error);
+ else
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Invalid file format"));
+ }
+ else {
+ catalog = gth_catalog_new ();
+ read_catalog_data_old_format (catalog, text_buffer, count);
+ }
+
+ return catalog;
+}
+
+
void
gth_catalog_set_file (GthCatalog *catalog,
GFile *file)
@@ -351,25 +376,6 @@ gth_catalog_get_order (GthCatalog *catalog,
}
-void
-gth_catalog_load_from_data (GthCatalog *catalog,
- const void *buffer,
- gsize count,
- GError **error)
-{
- char *text_buffer;
-
- if (buffer == NULL)
- return;
-
- text_buffer = (char *) buffer;
- if (strncmp (text_buffer, "<?xml ", 6) == 0)
- read_catalog_data_from_xml (catalog, text_buffer, count, error);
- else
- read_catalog_data_old_format (catalog, text_buffer, count);
-}
-
-
char *
gth_catalog_to_data (GthCatalog *catalog,
gsize *length)
@@ -466,144 +472,6 @@ gth_catalog_remove_file (GthCatalog *catalog,
}
-/* -- gth_catalog_list_async -- */
-
-
-typedef struct {
- GthCatalog *catalog;
- const char *attributes;
- CatalogReadyCallback list_ready_func;
- gpointer user_data;
- GList *current_file;
- GList *files;
-} ListData;
-
-
-static void
-gth_catalog_list_done (ListData *list_data,
- GError *error)
-{
- GthCatalog *catalog = list_data->catalog;
-
- catalog->priv->active = FALSE;
- if (list_data->list_ready_func != NULL) {
- list_data->files = g_list_reverse (list_data->files);
- list_data->list_ready_func (catalog, list_data->files, error, list_data->user_data);
- }
-
- _g_object_list_unref (list_data->files);
- g_free (list_data);
-}
-
-
-static void
-catalog_file_info_ready_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
-{
- ListData *list_data = user_data;
- GthCatalog *catalog = list_data->catalog;
- GFile *file;
- GFileInfo *info;
-
- file = (GFile*) source_object;
- info = g_file_query_info_finish (file, result, NULL);
- if (info != NULL) {
- list_data->files = g_list_prepend (list_data->files, gth_file_data_new (file, info));
- g_object_unref (info);
- }
-
- list_data->current_file = list_data->current_file->next;
- if (list_data->current_file == NULL) {
- gth_catalog_list_done (list_data, NULL);
- return;
- }
-
- g_file_query_info_async ((GFile *) list_data->current_file->data,
- list_data->attributes,
- 0,
- G_PRIORITY_DEFAULT,
- catalog->priv->cancellable,
- catalog_file_info_ready_cb,
- list_data);
-}
-
-
-static void
-list__catalog_buffer_ready_cb (void **buffer,
- gsize count,
- GError *error,
- gpointer user_data)
-{
- ListData *list_data = user_data;
- GthCatalog *catalog = list_data->catalog;
-
- if ((error == NULL) && (*buffer != NULL)) {
- gth_catalog_load_from_data (catalog, *buffer, count, &error);
- if (error != NULL) {
- gth_catalog_list_done (list_data, error);
- return;
- }
-
- list_data->current_file = catalog->priv->file_list;
- if (list_data->current_file == NULL) {
- gth_catalog_list_done (list_data, NULL);
- return;
- }
-
- g_file_query_info_async ((GFile *) list_data->current_file->data,
- list_data->attributes,
- 0,
- G_PRIORITY_DEFAULT,
- catalog->priv->cancellable,
- catalog_file_info_ready_cb,
- list_data);
- }
- else
- gth_catalog_list_done (list_data, error);
-}
-
-
-void
-gth_catalog_list_async (GthCatalog *catalog,
- const char *attributes,
- GCancellable *cancellable,
- CatalogReadyCallback ready_func,
- gpointer user_data)
-{
- ListData *list_data;
-
- g_return_if_fail (catalog->priv->file != NULL);
-
- if (catalog->priv->active) {
- /* FIXME: object_ready_with_error (catalog, ready_func, user_data, g_error_new (G_IO_ERROR,
G_IO_ERROR_PENDING, "Action pending"));*/
- return;
- }
-
- catalog->priv->active = TRUE;
- catalog->priv->cancellable = cancellable;
-
- list_data = g_new0 (ListData, 1);
- list_data->catalog = catalog;
- list_data->attributes = attributes;
- list_data->list_ready_func = ready_func;
- list_data->user_data = user_data;
-
- _g_file_load_async (catalog->priv->file,
- G_PRIORITY_DEFAULT,
- catalog->priv->cancellable,
- list__catalog_buffer_ready_cb,
- list_data);
-}
-
-
-void
-gth_catalog_cancel (GthCatalog *catalog)
-{
- g_cancellable_cancel (catalog->priv->cancellable);
-}
-
-
static char *
get_display_name (GFile *file,
const char *name,
@@ -804,43 +672,41 @@ gth_catalog_get_base (void)
GFile *
gth_catalog_file_to_gio_file (GFile *file)
{
- GFile *gio_file = NULL;
- char *child_uri;
+ GFile *gio_file = NULL;
+ char *uri;
+ UriParts file_parts;
- child_uri = g_file_get_uri (file);
- if (strncmp (child_uri, "catalog:///", 11) == 0) {
- const char *query;
+ if (! g_file_has_uri_scheme (file, "catalog"))
+ return g_file_dup (file);
- query = strchr (child_uri, '?');
- if (query != NULL) {
- char *uri;
+ uri = g_file_get_uri (file);
+ if (! _g_uri_split (uri, &file_parts))
+ return NULL;
- uri = g_uri_unescape_string (query, "");
- gio_file = g_file_new_for_uri (uri);
+ if (file_parts.query != NULL) {
+ char *new_uri;
- g_free (uri);
- }
- else {
- GFile *base;
- char *base_uri;
- const char *part;
- char *full_uri;
-
- base = gth_catalog_get_base ();
- base_uri = g_file_get_uri (base);
- part = child_uri + 11;
- full_uri = g_strconcat (base_uri, part ? "/" : NULL, part, NULL);
- gio_file = g_file_new_for_uri (full_uri);
-
- g_free (full_uri);
- g_free (base_uri);
- g_object_unref (base);
- }
+ new_uri = g_uri_unescape_string (file_parts.query, NULL);
+ gio_file = g_file_new_for_uri (new_uri);
+
+ g_free (new_uri);
}
- else
- gio_file = g_file_dup (file);
+ else {
+ GFile *base;
+ char *base_uri;
+ char *new_uri;
- g_free (child_uri);
+ base = gth_catalog_get_base ();
+ base_uri = g_file_get_uri (base);
+ new_uri = _g_uri_append_path (base_uri, file_parts.path);
+ gio_file = g_file_new_for_uri (new_uri);
+
+ g_free (new_uri);
+ g_free (base_uri);
+ g_object_unref (base);
+ }
+
+ g_free (uri);
return gio_file;
}
@@ -898,17 +764,16 @@ GFile *
gth_catalog_file_from_relative_path (const char *name,
const char *file_extension)
{
-
- char *partial_uri;
+ char *path;
char *uri;
GFile *file;
- partial_uri = g_uri_escape_string ((name[0] == '/' ? name + 1 : name),
G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, FALSE);
- uri = g_strconcat ("catalog:///", partial_uri, file_extension, NULL);
+ path = g_strconcat (name, file_extension, NULL);
+ uri = _g_uri_append_path ("catalog:///", path);
file = g_file_new_for_uri (uri);
g_free (uri);
- g_free (partial_uri);
+ g_free (path);
return file;
}
@@ -1056,14 +921,12 @@ load__catalog_buffer_ready_cb (void **buffer,
gpointer user_data)
{
LoadData *load_data = user_data;
- GthCatalog *catalog = NULL;
-
- if (error == NULL) {
- catalog = gth_hook_invoke_get ("gth-catalog-load-from-data", *buffer);
- if (catalog != NULL)
- gth_catalog_load_from_data (catalog, *buffer, count, &error);
- }
+ GthCatalog *catalog;
+ if (error == NULL)
+ catalog = gth_catalog_new_from_data (*buffer, count, &error);
+ else
+ catalog = NULL;
load_data->ready_func (G_OBJECT (catalog), error, load_data->user_data);
g_free (load_data);
@@ -1144,9 +1007,7 @@ gth_catalog_load_from_file (GFile *file)
if (! _g_file_load_in_buffer (gio_file, &buffer, &buffer_size, NULL, NULL))
return NULL;
- catalog = gth_hook_invoke_get ("gth-catalog-load-from-data", buffer);
- if (catalog != NULL)
- gth_catalog_load_from_data (catalog, buffer, buffer_size, NULL);
+ catalog = gth_catalog_new_from_data (buffer, buffer_size, NULL);
g_free (buffer);
g_object_unref (gio_file);
@@ -1213,3 +1074,123 @@ gth_catalog_save (GthCatalog *catalog)
_g_object_unref (gio_parent);
g_object_unref (gio_file);
}
+
+
+/* -- gth_catalog_list_async -- */
+
+
+typedef struct {
+ GthCatalog *catalog;
+ const char *attributes;
+ CatalogReadyCallback list_ready_func;
+ gpointer user_data;
+ GList *current_file;
+ GList *files;
+ GCancellable *cancellable;
+} ListData;
+
+
+static void
+gth_catalog_list_done (ListData *list_data,
+ GError *error)
+{
+ if (list_data->list_ready_func != NULL) {
+ list_data->files = g_list_reverse (list_data->files);
+ list_data->list_ready_func (list_data->catalog, list_data->files, error,
list_data->user_data);
+ }
+
+ _g_object_list_unref (list_data->files);
+ _g_object_unref (list_data->cancellable);
+ _g_object_unref (list_data->catalog);
+ g_free (list_data);
+}
+
+
+static void
+catalog_file_info_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ ListData *list_data = user_data;
+ GFile *file;
+ GFileInfo *info;
+
+ file = (GFile*) source_object;
+ info = g_file_query_info_finish (file, result, NULL);
+ if (info != NULL) {
+ list_data->files = g_list_prepend (list_data->files, gth_file_data_new (file, info));
+ g_object_unref (info);
+ }
+
+ list_data->current_file = list_data->current_file->next;
+ if (list_data->current_file == NULL) {
+ gth_catalog_list_done (list_data, NULL);
+ return;
+ }
+
+ g_file_query_info_async ((GFile *) list_data->current_file->data,
+ list_data->attributes,
+ 0,
+ G_PRIORITY_DEFAULT,
+ list_data->cancellable,
+ catalog_file_info_ready_cb,
+ list_data);
+}
+
+
+static void
+list__catalog_buffer_ready_cb (void **buffer,
+ gsize count,
+ GError *error,
+ gpointer user_data)
+{
+ ListData *list_data = user_data;
+
+ if ((error == NULL) && (*buffer != NULL)) {
+ list_data->catalog = gth_catalog_new_from_data (*buffer, count, &error);
+ if (list_data->catalog == NULL) {
+ gth_catalog_list_done (list_data, error);
+ return;
+ }
+
+ list_data->current_file = list_data->catalog->priv->file_list;
+ if (list_data->current_file == NULL) {
+ gth_catalog_list_done (list_data, NULL);
+ return;
+ }
+
+ g_file_query_info_async ((GFile *) list_data->current_file->data,
+ list_data->attributes,
+ 0,
+ G_PRIORITY_DEFAULT,
+ list_data->cancellable,
+ catalog_file_info_ready_cb,
+ list_data);
+ }
+ else
+ gth_catalog_list_done (list_data, error);
+}
+
+
+void
+gth_catalog_list_async (GFile *file,
+ const char *attributes,
+ GCancellable *cancellable,
+ CatalogReadyCallback ready_func,
+ gpointer user_data)
+{
+ ListData *list_data;
+
+ list_data = g_new0 (ListData, 1);
+ list_data->attributes = attributes;
+ list_data->list_ready_func = ready_func;
+ list_data->user_data = user_data;
+ list_data->cancellable = _g_object_ref (cancellable);
+
+ _g_file_load_async (file,
+ G_PRIORITY_DEFAULT,
+ list_data->cancellable,
+ list__catalog_buffer_ready_cb,
+ list_data);
+}
+
diff --git a/extensions/catalogs/gth-catalog.h b/extensions/catalogs/gth-catalog.h
index 45f42d51..4a2b556d 100644
--- a/extensions/catalogs/gth-catalog.h
+++ b/extensions/catalogs/gth-catalog.h
@@ -73,6 +73,9 @@ typedef void (*CatalogReadyCallback) (GthCatalog *catalog,
GType gth_catalog_get_type (void) G_GNUC_CONST;
GthCatalog * gth_catalog_new (void);
+GthCatalog * gth_catalog_new_from_data (const void *buffer,
+ gsize count,
+ GError **error);
void gth_catalog_set_file (GthCatalog *catalog,
GFile *file);
GFile * gth_catalog_get_file (GthCatalog *catalog);
@@ -87,10 +90,6 @@ void gth_catalog_set_order (GthCatalog *catalog,
gboolean inverse);
const char * gth_catalog_get_order (GthCatalog *catalog,
gboolean *inverse);
-void gth_catalog_load_from_data (GthCatalog *catalog,
- const void *buffer,
- gsize count,
- GError **error);
char * gth_catalog_to_data (GthCatalog *catalog,
gsize *length);
void gth_catalog_set_file_list (GthCatalog *catalog,
@@ -101,12 +100,6 @@ gboolean gth_catalog_insert_file (GthCatalog *catalog,
int pos);
int gth_catalog_remove_file (GthCatalog *catalog,
GFile *file);
-void gth_catalog_list_async (GthCatalog *catalog,
- const char *attributes,
- GCancellable *cancellable,
- CatalogReadyCallback ready_func,
- gpointer user_data);
-void gth_catalog_cancel (GthCatalog *catalog);
void gth_catalog_update_metadata (GthCatalog *catalog,
GthFileData *file_data);
int gth_catalog_get_size (GthCatalog *catalog);
@@ -133,5 +126,10 @@ GFile * gth_catalog_get_file_for_tag (const char *tag,
const char *extension);
GthCatalog * gth_catalog_load_from_file (GFile *file);
void gth_catalog_save (GthCatalog *catalog);
+void gth_catalog_list_async (GFile *catalog,
+ const char *attributes,
+ GCancellable *cancellable,
+ CatalogReadyCallback ready_func,
+ gpointer user_data);
#endif /*GTH_CATALOG_H*/
diff --git a/extensions/catalogs/gth-file-source-catalogs.c b/extensions/catalogs/gth-file-source-catalogs.c
index aa45a021..170cae6d 100644
--- a/extensions/catalogs/gth-file-source-catalogs.c
+++ b/extensions/catalogs/gth-file-source-catalogs.c
@@ -185,23 +185,23 @@ gth_file_source_catalogs_get_file_data (GthFileSource *file_source,
typedef struct {
- GthFileSourceCatalogs *catalogs;
+ GthFileSourceCatalogs *file_souce;
GthFileData *file_data;
char *attributes;
ReadyCallback ready_callback;
gpointer user_data;
- GthCatalog *catalog;
+ GFile *gio_file;
} MetadataOpData;
static void
metadata_op_free (MetadataOpData *metadata_op)
{
- gth_file_source_set_active (GTH_FILE_SOURCE (metadata_op->catalogs), FALSE);
+ gth_file_source_set_active (GTH_FILE_SOURCE (metadata_op->file_souce), FALSE);
g_object_unref (metadata_op->file_data);
g_free (metadata_op->attributes);
- g_object_unref (metadata_op->catalog);
- g_object_unref (metadata_op->catalogs);
+ g_object_unref (metadata_op->gio_file);
+ g_object_unref (metadata_op->file_souce);
g_free (metadata_op);
}
@@ -213,7 +213,7 @@ write_metadata_write_buffer_ready_cb (void **buffer,
gpointer user_data)
{
MetadataOpData *metadata_op = user_data;
- GthFileSourceCatalogs *catalogs = metadata_op->catalogs;
+ GthFileSourceCatalogs *catalogs = metadata_op->file_souce;
metadata_op->ready_callback (G_OBJECT (catalogs), error, metadata_op->user_data);
metadata_op_free (metadata_op);
@@ -226,45 +226,51 @@ write_metadata_load_buffer_ready_cb (void **buffer,
GError *error,
gpointer user_data)
{
- MetadataOpData *metadata_op = user_data;
- GthFileSourceCatalogs *catalogs = metadata_op->catalogs;
- GFile *gio_file;
- void *catalog_buffer;
- gsize catalog_size;
+ MetadataOpData *metadata_op = user_data;
+ GthCatalog *catalog;
+ void *catalog_buffer;
+ gsize catalog_size;
if (error != NULL) {
- metadata_op->ready_callback (G_OBJECT (catalogs), error, metadata_op->user_data);
+ metadata_op->ready_callback (G_OBJECT (metadata_op->file_souce), error,
metadata_op->user_data);
+ metadata_op_free (metadata_op);
+ return;
+ }
+
+ catalog = gth_catalog_new_from_data (*buffer, count, &error);
+ if (catalog == NULL) {
+ metadata_op->ready_callback (G_OBJECT (metadata_op->file_souce), error,
metadata_op->user_data);
metadata_op_free (metadata_op);
return;
}
- gth_catalog_load_from_data (metadata_op->catalog, *buffer, count, &error);
+ gth_catalog_set_file (catalog, metadata_op->gio_file);
if (error != NULL) {
- metadata_op->ready_callback (G_OBJECT (catalogs), error, metadata_op->user_data);
+ metadata_op->ready_callback (G_OBJECT (metadata_op->file_souce), error,
metadata_op->user_data);
+ g_object_unref (catalog);
metadata_op_free (metadata_op);
return;
}
if (_g_file_attributes_matches_any (metadata_op->attributes, "sort::*"))
- gth_catalog_set_order (metadata_op->catalog,
+ gth_catalog_set_order (catalog,
g_file_info_get_attribute_string (metadata_op->file_data->info,
"sort::type"),
g_file_info_get_attribute_boolean (metadata_op->file_data->info,
"sort::inverse"));
- gth_hook_invoke ("gth-catalog-read-metadata", metadata_op->catalog, metadata_op->file_data);
+ gth_hook_invoke ("gth-catalog-read-metadata", catalog, metadata_op->file_data);
- catalog_buffer = gth_catalog_to_data (metadata_op->catalog, &catalog_size);
- gio_file = gth_catalog_file_to_gio_file (metadata_op->file_data->file);
- _g_file_write_async (gio_file,
+ catalog_buffer = gth_catalog_to_data (catalog, &catalog_size);
+ _g_file_write_async (metadata_op->gio_file,
catalog_buffer,
catalog_size,
TRUE,
G_PRIORITY_DEFAULT,
- gth_file_source_get_cancellable (GTH_FILE_SOURCE (metadata_op->catalogs)),
+ gth_file_source_get_cancellable (GTH_FILE_SOURCE (metadata_op->file_souce)),
write_metadata_write_buffer_ready_cb,
metadata_op);
- g_object_unref (gio_file);
+ g_object_unref (catalog);
}
@@ -278,7 +284,6 @@ gth_file_source_catalogs_write_metadata (GthFileSource *file_source,
GthFileSourceCatalogs *catalogs = (GthFileSourceCatalogs *) file_source;
char *uri;
MetadataOpData *metadata_op;
- GFile *gio_file;
uri = g_file_get_uri (file_data->file);
if (! g_str_has_suffix (uri, ".gqv")
@@ -291,7 +296,7 @@ gth_file_source_catalogs_write_metadata (GthFileSource *file_source,
}
metadata_op = g_new0 (MetadataOpData, 1);
- metadata_op->catalogs = g_object_ref (catalogs);
+ metadata_op->file_souce = g_object_ref (catalogs);
metadata_op->file_data = g_object_ref (file_data);
metadata_op->attributes = g_strdup (attributes);
metadata_op->ready_callback = callback;
@@ -300,16 +305,13 @@ gth_file_source_catalogs_write_metadata (GthFileSource *file_source,
gth_file_source_set_active (GTH_FILE_SOURCE (catalogs), TRUE);
g_cancellable_reset (gth_file_source_get_cancellable (file_source));
- metadata_op->catalog = gth_catalog_new ();
- gio_file = gth_file_source_to_gio_file (file_source, file_data->file);
- gth_catalog_set_file (metadata_op->catalog, gio_file);
- _g_file_load_async (gio_file,
+ metadata_op->gio_file = gth_file_source_to_gio_file (file_source, file_data->file);
+ _g_file_load_async (metadata_op->gio_file,
G_PRIORITY_DEFAULT,
gth_file_source_get_cancellable (file_source),
write_metadata_load_buffer_ready_cb,
metadata_op);
- g_object_unref (gio_file);
g_free (uri);
}
@@ -531,7 +533,6 @@ typedef struct {
ForEachChildCallback for_each_file_func;
ReadyCallback ready_func;
gpointer user_data;
- GthCatalog *catalog;
GList *to_visit;
} ForEachChildData;
@@ -540,7 +541,6 @@ static void
for_each_child_data_free (ForEachChildData *data)
{
_g_object_list_unref (data->to_visit);
- g_object_ref (data->catalog);
g_free (data->attributes);
g_object_ref (data->file_source);
}
@@ -677,8 +677,7 @@ for_each_child__visit_file (ForEachChildData *data,
|| g_str_has_suffix (uri, ".catalog")
|| g_str_has_suffix (uri, ".search"))
{
- gth_catalog_set_file (data->catalog, gio_file);
- gth_catalog_list_async (data->catalog,
+ gth_catalog_list_async (gio_file,
data->attributes,
gth_file_source_get_cancellable (data->file_source),
for_each_child__catalog_list_ready_cb,
@@ -746,7 +745,6 @@ gth_file_source_catalogs_for_each_child (GthFileSource *file_source,
data->for_each_file_func = for_each_file_func;
data->ready_func = ready_func;
data->user_data = user_data;
- data->catalog = gth_catalog_new ();
gio_parent = gth_file_source_to_gio_file (file_source, parent);
g_file_query_info_async (gio_parent,
@@ -1366,15 +1364,8 @@ catalog_buffer_ready_cb (void **buffer,
return;
}
- data->catalog = gth_hook_invoke_get ("gth-catalog-load-from-data", *buffer);
+ data->catalog = gth_catalog_new_from_data (*buffer, count, &error);
if (data->catalog == NULL) {
- error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _("Invalid file format"));
- remove_from_catalog_end (error, data);
- return;
- }
-
- gth_catalog_load_from_data (data->catalog, *buffer, count, &error);
- if (error != NULL) {
remove_from_catalog_end (error, data);
return;
}
diff --git a/extensions/search/callbacks.c b/extensions/search/callbacks.c
index e3bb7030..6dc1c78a 100644
--- a/extensions/search/callbacks.c
+++ b/extensions/search/callbacks.c
@@ -148,6 +148,9 @@ search__dlg_catalog_properties (GtkBuilder *builder,
if (! _g_content_type_is_a (g_file_info_get_content_type (file_data->info), "gthumb/search"))
return;
+ if (! GTH_IS_SEARCH (catalog))
+ return;
+
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (_gtk_builder_get_widget (builder, "general_page")), vbox, FALSE, FALSE,
0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]