diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-09-20 00:52:08 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-09-20 00:52:08 +0800 |
commit | 3e3c13b439668945241b32cf8c1fd3d6e625f9f5 (patch) | |
tree | e04d52d21a23f84155cceebf3fa9a56b3eea47d3 /addressbook/gui/widgets | |
parent | 0c27b4ab1b75a29a0ea2b2c6ae3a568663179bdf (diff) | |
download | gsoc2013-evolution-3e3c13b439668945241b32cf8c1fd3d6e625f9f5.tar gsoc2013-evolution-3e3c13b439668945241b32cf8c1fd3d6e625f9f5.tar.gz gsoc2013-evolution-3e3c13b439668945241b32cf8c1fd3d6e625f9f5.tar.bz2 gsoc2013-evolution-3e3c13b439668945241b32cf8c1fd3d6e625f9f5.tar.lz gsoc2013-evolution-3e3c13b439668945241b32cf8c1fd3d6e625f9f5.tar.xz gsoc2013-evolution-3e3c13b439668945241b32cf8c1fd3d6e625f9f5.tar.zst gsoc2013-evolution-3e3c13b439668945241b32cf8c1fd3d6e625f9f5.zip |
Replace EActivityHandler with a new activity-tracking system that uses
EActivity objects instead of numeric handler IDs. Create an EActivity,
configure it, and (optionally) connect to its "cancelled" and "completed"
signals. Then hand it to the shell view via e_shell_view_add_activity().
When finished with the activity, call e_activity_finish() and unref it.
svn path=/branches/kill-bonobo/; revision=36391
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 7a4f27d65f..de10df9a41 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -63,7 +63,7 @@ #define d(x) -static void status_message (GtkObject *object, const gchar *status, EAddressbookView *view); +static void status_message (EAddressbookView *view, const gchar *status); static void search_result (EAddressbookView *view, EBookViewStatus status); static void folder_bar_message (EAddressbookView *view, const gchar *status); static void stop_state_changed (GtkObject *object, EAddressbookView *view); @@ -76,6 +76,7 @@ struct _EAddressbookViewPrivate { gpointer shell_view; /* weak pointer */ EAddressbookModel *model; + EActivity *activity; GList *clipboard_contacts; ESource *source; @@ -97,7 +98,6 @@ enum { enum { POPUP_EVENT, - STATUS_MESSAGE, COMMAND_STATE_CHANGE, SELECTION_CHANGE, LAST_SIGNAL @@ -534,6 +534,13 @@ addressbook_view_dispose (GObject *object) priv->model = NULL; } + if (priv->activity != NULL) { + /* XXX Activity is not cancellable. */ + e_activity_complete (priv->activity); + g_object_unref (priv->activity); + priv->activity = NULL; + } + if (priv->invisible != NULL) { gtk_widget_destroy (priv->invisible); priv->invisible = NULL; @@ -646,16 +653,6 @@ addressbook_view_class_init (EAddressbookViewClass *class) G_TYPE_NONE, 1, GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); - signals[STATUS_MESSAGE] = g_signal_new ( - "status-message", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookViewClass, status_message), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, - G_TYPE_POINTER); - signals[COMMAND_STATE_CHANGE] = g_signal_new ( "command-state-change", G_OBJECT_CLASS_TYPE (object_class), @@ -746,8 +743,9 @@ e_addressbook_view_new (EShellView *shell_view, view = E_ADDRESSBOOK_VIEW (widget); - g_signal_connect (view->priv->model, "status_message", - G_CALLBACK (status_message), view); + g_signal_connect_swapped ( + view->priv->model, "status_message", + G_CALLBACK (status_message), view); g_signal_connect_swapped ( view->priv->model, "search_result", G_CALLBACK (search_result), view); @@ -851,15 +849,26 @@ e_addressbook_view_get_source (EAddressbookView *view) } static void -emit_status_message (EAddressbookView *view, const gchar *status) +status_message (EAddressbookView *view, + const gchar *status) { - g_signal_emit (view, signals[STATUS_MESSAGE], 0, status); -} + EActivity *activity; -static void -status_message (GtkObject *object, const gchar *status, EAddressbookView *view) -{ - emit_status_message (view, status); + activity = view->priv->activity; + + if (status == NULL || *status == '\0') { + if (activity != NULL) { + e_activity_complete (activity); + g_object_unref (activity); + view->priv->activity = NULL; + } + + } else if (activity == NULL) { + activity = e_activity_new (status); + view->priv->activity = activity; + + } else + e_activity_set_primary_text (activity, status); } static void |