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 | |
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')
-rw-r--r-- | addressbook/gui/component/e-book-shell-view-private.c | 42 | ||||
-rw-r--r-- | addressbook/gui/component/e-book-shell-view-private.h | 4 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 51 |
3 files changed, 30 insertions, 67 deletions
diff --git a/addressbook/gui/component/e-book-shell-view-private.c b/addressbook/gui/component/e-book-shell-view-private.c index 94bc96588a..70ba2b2815 100644 --- a/addressbook/gui/component/e-book-shell-view-private.c +++ b/addressbook/gui/component/e-book-shell-view-private.c @@ -42,36 +42,6 @@ popup_event (EBookShellView *book_shell_view, } static void -set_status_message (EAddressbookView *view, - const gchar *message, - EBookShellView *book_shell_view) -{ - /* XXX Give EAddressbookView an EShellView pointer - * and have it handle this directly. */ - - EActivityHandler *activity_handler; - guint activity_id; - - activity_handler = book_shell_view->priv->activity_handler; - activity_id = book_shell_view->priv->activity_id; - - if (message == NULL || *message == '\0') { - if (activity_id > 0) { - e_activity_handler_operation_finished ( - activity_handler, activity_id); - activity_id = 0; - } - } else if (activity_id == 0) - activity_id = e_activity_handler_operation_started ( - activity_handler, message, TRUE); - else - e_activity_handler_operation_progressing ( - activity_handler, activity_id, message, -1.0); - - book_shell_view->priv->activity_id = activity_id; -} - -static void book_shell_view_selection_change_foreach (gint row, EBookShellView *book_shell_view) { @@ -240,10 +210,6 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view, widget, "popup-event", G_CALLBACK (popup_event), book_shell_view); - g_signal_connect ( - widget, "status-message", - G_CALLBACK (set_status_message), book_shell_view); - g_signal_connect_swapped ( widget, "command-state-change", G_CALLBACK (e_book_shell_view_actions_update), @@ -418,7 +384,6 @@ e_book_shell_view_private_init (EBookShellView *book_shell_view, priv->source_list = g_object_ref (source_list); priv->contact_actions = gtk_action_group_new ("contacts"); - priv->activity_handler = e_activity_handler_new (); priv->uid_to_view = uid_to_view; priv->uid_to_editor = uid_to_editor; @@ -436,7 +401,6 @@ e_book_shell_view_private_constructed (EBookShellView *book_shell_view) EBookShellViewPrivate *priv = book_shell_view->priv; EShellContent *shell_content; EShellSidebar *shell_sidebar; - EShellTaskbar *shell_taskbar; EShellView *shell_view; EShellWindow *shell_window; ESourceSelector *selector; @@ -487,10 +451,6 @@ e_book_shell_view_private_constructed (EBookShellView *book_shell_view) priv->preview = g_object_ref (widget); gtk_widget_show (widget); - shell_taskbar = e_shell_view_get_shell_taskbar (shell_view); - e_activity_handler_attach_task_bar ( - priv->activity_handler, shell_taskbar); - shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); selector = e_book_shell_sidebar_get_selector ( E_BOOK_SHELL_SIDEBAR (shell_sidebar)); @@ -545,8 +505,6 @@ e_book_shell_view_private_dispose (EBookShellView *book_shell_view) DISPOSE (priv->notebook); DISPOSE (priv->preview); - DISPOSE (priv->activity_handler); - g_hash_table_remove_all (priv->uid_to_view); g_hash_table_remove_all (priv->uid_to_editor); diff --git a/addressbook/gui/component/e-book-shell-view-private.h b/addressbook/gui/component/e-book-shell-view-private.h index bdfc362ee3..b8d2a0ccb7 100644 --- a/addressbook/gui/component/e-book-shell-view-private.h +++ b/addressbook/gui/component/e-book-shell-view-private.h @@ -34,7 +34,6 @@ #include <e-util/gconf-bridge.h> #include <shell/e-shell-content.h> #include <shell/e-shell-sidebar.h> -#include <shell/e-activity-handler.h> #include <eab-gui-util.h> #include <e-addressbook-view.h> @@ -94,13 +93,10 @@ struct _EBookShellViewPrivate { GtkWidget *notebook; GtkWidget *preview; - EActivityHandler *activity_handler; - GHashTable *uid_to_view; GHashTable *uid_to_editor; EBook *book; - guint activity_id; gchar *password; }; 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 |