[gthumb] use a boxed type for the error argument of the GthTask::completed signal
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] use a boxed type for the error argument of the GthTask::completed signal
- Date: Sat, 5 Feb 2011 13:14:37 +0000 (UTC)
commit a4f7ff2af277357c1467a2ed7cfcdb5d110f4f45
Author: Paolo Bacchilega <paobac src gnome org>
Date: Thu Feb 3 21:34:46 2011 +0100
use a boxed type for the error argument of the GthTask::completed signal
gthumb/glib-utils.c | 20 ++++++++++++++++++++
gthumb/glib-utils.h | 5 +++++
gthumb/gth-browser.c | 8 ++++----
gthumb/gth-task.c | 4 ++--
4 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/gthumb/glib-utils.c b/gthumb/glib-utils.c
index 295bb12..120ad3b 100644
--- a/gthumb/glib-utils.c
+++ b/gthumb/glib-utils.c
@@ -103,6 +103,26 @@ g_object_list_get_type (void)
}
+#if NEED_G_TYPE_ERROR
+
+
+GType
+g_error_get_type (void)
+{
+ static GType type = 0;
+
+ if (type == 0)
+ type = g_boxed_type_register_static ("GError",
+ (GBoxedCopyFunc) g_error_copy,
+ (GBoxedFreeFunc) g_error_free);
+
+ return type;
+}
+
+
+#endif
+
+
GEnumValue *
_g_enum_type_get_value (GType enum_type,
int value)
diff --git a/gthumb/glib-utils.h b/gthumb/glib-utils.h
index 258fe47..7423b12 100644
--- a/gthumb/glib-utils.h
+++ b/gthumb/glib-utils.h
@@ -60,6 +60,10 @@ G_BEGIN_DECLS
#define ID_LENGTH 8
#define G_TYPE_OBJECT_LIST (g_object_list_get_type ())
#define G_TYPE_STRING_LIST (g_string_list_get_type ())
+#ifndef G_TYPE_ERROR
+#define NEED_G_TYPE_ERROR 1
+#define G_TYPE_ERROR (g_error_get_type ())
+#endif
/* signals */
@@ -81,6 +85,7 @@ void _g_clear_object (gpointer object_p);
GList * _g_object_list_ref (GList *list);
void _g_object_list_unref (GList *list);
GType g_object_list_get_type (void);
+GType g_error_get_type (void);
GEnumValue * _g_enum_type_get_value (GType enum_type,
int value);
GEnumValue * _g_enum_type_get_value_by_nick (GType enum_type,
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 892793a..0afd31c 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -4740,10 +4740,10 @@ foreground_task_completed_cb (GthTask *task,
gth_statusbar_set_progress (GTH_STATUSBAR (browser->priv->statusbar), NULL, FALSE, 0.0);
gth_browser_update_sensitivity (browser);
if (error != NULL) {
- if (! g_error_matches (error, GTH_TASK_ERROR, GTH_TASK_ERROR_CANCELLED))
- _gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not perform the operation"), &error);
- else
- g_error_free (error);
+ if (! g_error_matches (error, GTH_TASK_ERROR, GTH_TASK_ERROR_CANCELLED)) {
+ GError *local_error = g_error_copy (error);
+ _gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not perform the operation"), &local_error);
+ }
}
g_object_unref (browser->priv->task);
diff --git a/gthumb/gth-task.c b/gthumb/gth-task.c
index da9fe3e..4860191 100644
--- a/gthumb/gth-task.c
+++ b/gthumb/gth-task.c
@@ -105,10 +105,10 @@ gth_task_class_init (GthTaskClass *class)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GthTaskClass, completed),
NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
+ g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE,
1,
- G_TYPE_POINTER);
+ G_TYPE_ERROR);
gth_task_signals[PROGRESS] =
g_signal_new ("progress",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]