diff options
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/misc/Makefile.am | 2 | ||||
-rw-r--r-- | widgets/misc/e-activity.c | 84 | ||||
-rw-r--r-- | widgets/misc/e-activity.h | 4 |
3 files changed, 58 insertions, 32 deletions
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am index ffc5195367..2fa7327e35 100644 --- a/widgets/misc/Makefile.am +++ b/widgets/misc/Makefile.am @@ -51,6 +51,7 @@ widgetsinclude_HEADERS = \ e-attachment-view.h \ e-calendar.h \ e-calendar-item.h \ + e-camel-activity.h \ e-canvas.h \ e-canvas-background.h \ e-canvas-utils.h \ @@ -115,6 +116,7 @@ libemiscwidgets_la_SOURCES = \ e-attachment-view.c \ e-calendar.c \ e-calendar-item.c \ + e-camel-activity.c \ e-canvas.c \ e-canvas-background.c \ e-canvas-utils.c \ diff --git a/widgets/misc/e-activity.c b/widgets/misc/e-activity.c index d40d5aacbe..7cd89a7c47 100644 --- a/widgets/misc/e-activity.c +++ b/widgets/misc/e-activity.c @@ -24,6 +24,8 @@ #include <stdarg.h> #include <glib/gi18n.h> +#include "e-util/e-util.h" + #define E_ACTIVITY_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_ACTIVITY, EActivityPrivate)) @@ -58,6 +60,7 @@ enum { CANCELLED, CLICKED, COMPLETED, + DESCRIBE, LAST_SIGNAL }; @@ -84,6 +87,20 @@ activity_idle_complete_cb (EActivity *activity) return FALSE; } +static gboolean +activity_describe_accumulator (GSignalInvocationHint *ihint, + GValue *return_accu, + const GValue *handler_return, + gpointer accu_data) +{ + const gchar *string; + + string = g_value_get_string (handler_return); + g_value_set_string (return_accu, string); + + return (string == NULL); +} + static void activity_set_property (GObject *object, guint property_id, @@ -211,6 +228,34 @@ activity_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } +static void +activity_cancelled (EActivity *activity) +{ + activity->priv->cancelled = TRUE; + + if (activity->priv->idle_id > 0) { + g_source_remove (activity->priv->idle_id); + activity->priv->idle_id = 0; + } +} + +static void +activity_completed (EActivity *activity) +{ + activity->priv->completed = TRUE; + + if (activity->priv->idle_id > 0) { + g_source_remove (activity->priv->idle_id); + activity->priv->idle_id = 0; + } +} + +static void +activity_clicked (EActivity *activity) +{ + /* Allow subclasses to safely chain up. */ +} + static gchar * activity_describe (EActivity *activity) { @@ -248,34 +293,6 @@ activity_describe (EActivity *activity) } static void -activity_cancelled (EActivity *activity) -{ - activity->priv->cancelled = TRUE; - - if (activity->priv->idle_id > 0) { - g_source_remove (activity->priv->idle_id); - activity->priv->idle_id = 0; - } -} - -static void -activity_completed (EActivity *activity) -{ - activity->priv->completed = TRUE; - - if (activity->priv->idle_id > 0) { - g_source_remove (activity->priv->idle_id); - activity->priv->idle_id = 0; - } -} - -static void -activity_clicked (EActivity *activity) -{ - /* Allow subclasses to safely chain up. */ -} - -static void activity_class_init (EActivityClass *class) { GObjectClass *object_class; @@ -288,10 +305,10 @@ activity_class_init (EActivityClass *class) object_class->get_property = activity_get_property; object_class->finalize = activity_finalize; - class->describe = activity_describe; class->cancelled = activity_cancelled; class->completed = activity_completed; class->clicked = activity_clicked; + class->describe = activity_describe; g_object_class_install_property ( object_class, @@ -398,6 +415,15 @@ activity_class_init (EActivityClass *class) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + signals[DESCRIBE] = g_signal_new ( + "describe", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (EActivityClass, describe), + activity_describe_accumulator, NULL, + e_marshal_STRING__VOID, + G_TYPE_STRING, 0); } static void diff --git a/widgets/misc/e-activity.h b/widgets/misc/e-activity.h index 68f0bf20be..34974dd415 100644 --- a/widgets/misc/e-activity.h +++ b/widgets/misc/e-activity.h @@ -57,13 +57,11 @@ struct _EActivity { struct _EActivityClass { GObjectClass parent_class; - /* Methods */ - gchar * (*describe) (EActivity *activity); - /* Signals */ void (*cancelled) (EActivity *activity); void (*completed) (EActivity *activity); void (*clicked) (EActivity *activity); + gchar * (*describe) (EActivity *activity); }; GType e_activity_get_type (void); |