From 7ee6ef65f1019389c172478a80b8f0aa73a1453e Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 13 Sep 2008 04:02:09 +0000 Subject: Allow EShellContent, EShellSidebar, and EShellTaskbar to be subclassed, and begin doing so for Calendars, Memos and Tasks. Makes the code cleaner. svn path=/branches/kill-bonobo/; revision=36317 --- .../gui/component/e-book-shell-view-actions.c | 2 +- .../gui/component/e-book-shell-view-private.c | 3 +-- .../gui/component/e-book-shell-view-private.h | 5 ++--- addressbook/gui/component/e-book-shell-view.c | 2 +- addressbook/gui/widgets/e-addressbook-selector.c | 26 +++++++++++++++++----- addressbook/gui/widgets/e-addressbook-selector.h | 6 ++--- 6 files changed, 28 insertions(+), 16 deletions(-) (limited to 'addressbook') diff --git a/addressbook/gui/component/e-book-shell-view-actions.c b/addressbook/gui/component/e-book-shell-view-actions.c index 515531af88..d12f15e1f4 100644 --- a/addressbook/gui/component/e-book-shell-view-actions.c +++ b/addressbook/gui/component/e-book-shell-view-actions.c @@ -728,7 +728,7 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view) } void -e_book_shell_view_update_actions (EBookShellView *book_shell_view, +e_book_shell_view_actions_update (EBookShellView *book_shell_view, EABView *view) { EShellView *shell_view; diff --git a/addressbook/gui/component/e-book-shell-view-private.c b/addressbook/gui/component/e-book-shell-view-private.c index 1ed66f8289..037ef035bf 100644 --- a/addressbook/gui/component/e-book-shell-view-private.c +++ b/addressbook/gui/component/e-book-shell-view-private.c @@ -190,7 +190,7 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view) g_signal_connect_swapped ( uid_view, "command-state-change", - G_CALLBACK (e_book_shell_view_update_actions), + G_CALLBACK (e_book_shell_view_actions_update), book_shell_view); book = e_book_new (source, NULL); @@ -396,7 +396,6 @@ e_book_shell_view_private_dispose (EBookShellView *book_shell_view) DISPOSE (priv->contact_actions); DISPOSE (priv->notebook); - DISPOSE (priv->scrolled_window); DISPOSE (priv->selector); DISPOSE (priv->activity_handler); diff --git a/addressbook/gui/component/e-book-shell-view-private.h b/addressbook/gui/component/e-book-shell-view-private.h index 6fbff31c5d..ba805b0dc9 100644 --- a/addressbook/gui/component/e-book-shell-view-private.h +++ b/addressbook/gui/component/e-book-shell-view-private.h @@ -33,10 +33,10 @@ #include #include +#include #include #include -#include #include #include #include @@ -92,7 +92,6 @@ struct _EBookShellViewPrivate { /*** Other Stuff ***/ GtkWidget *notebook; - GtkWidget *scrolled_window; GtkWidget *selector; EActivityHandler *activity_handler; @@ -121,7 +120,7 @@ void e_book_shell_view_private_finalize void e_book_shell_view_actions_init (EBookShellView *book_shell_view); -void e_book_shell_view_update_actions +void e_book_shell_view_actions_update (EBookShellView *book_shell_view, EABView *view); EABView * e_book_shell_view_get_current_view diff --git a/addressbook/gui/component/e-book-shell-view.c b/addressbook/gui/component/e-book-shell-view.c index ce0c8f2b55..262c7da616 100644 --- a/addressbook/gui/component/e-book-shell-view.c +++ b/addressbook/gui/component/e-book-shell-view.c @@ -151,7 +151,7 @@ book_shell_view_source_list_changed_cb (EBookShellView *book_shell_view, #if 0 eab_view_setup_menus (view, bonobo_uic); #endif - e_book_shell_view_update_actions (book_shell_view, view); + e_book_shell_view_actions_update (book_shell_view, view); } } diff --git a/addressbook/gui/widgets/e-addressbook-selector.c b/addressbook/gui/widgets/e-addressbook-selector.c index e071e948f4..dfd0e32a7a 100644 --- a/addressbook/gui/widgets/e-addressbook-selector.c +++ b/addressbook/gui/widgets/e-addressbook-selector.c @@ -147,6 +147,9 @@ addressbook_selector_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time_) { + /* XXX This is exactly the same as in ECalendarSelector. + * Consider merging this callback into ESourceSelector. */ + GtkTreeView *tree_view; GtkTreeViewDropPosition pos; @@ -163,6 +166,9 @@ addressbook_selector_drag_motion (GtkWidget *widget, gint y, guint time_) { + /* XXX This is exactly the same as in ECalendarSelector. + * Consider merging this callback into ESourceSelector. */ + GtkTreeView *tree_view; GtkTreeModel *model; GtkTreePath *path = NULL; @@ -201,9 +207,9 @@ exit: gtk_tree_path_free (path); if (object != NULL) - g_object_ref (object); + g_object_unref (object); - gdk_drag_status (context, action, GDK_CURRENT_TIME); + gdk_drag_status (context, action, time_); return TRUE; } @@ -215,6 +221,9 @@ addressbook_selector_drag_drop (GtkWidget *widget, gint y, guint time_) { + /* XXX This is exactly the same as in ECalendarSelector. + * Consider merging this callback into ESourceSelector. */ + GtkTreeView *tree_view; GtkTreeModel *model; GtkTreePath *path; @@ -235,7 +244,7 @@ addressbook_selector_drag_drop (GtkWidget *widget, g_return_val_if_fail (valid, FALSE); gtk_tree_model_get (model, &iter, 0, &object, -1); - drop_zone = !E_IS_SOURCE_GROUP (object); + drop_zone = E_IS_SOURCE (object); g_object_unref (object); return drop_zone; @@ -250,6 +259,11 @@ addressbook_selector_drag_data_received (GtkWidget *widget, guint info, guint time_) { + /* XXX This is NEARLY the same as in ECalendarSelector. + * Consider merging this callback into ESourceSelector. + * Use a callback to allow subclasses to handle the + * received selection data. */ + MergeContext *merge_context; GtkTreeView *tree_view; GtkTreeModel *model; @@ -266,7 +280,7 @@ addressbook_selector_drag_data_received (GtkWidget *widget, tree_view = GTK_TREE_VIEW (widget); model = gtk_tree_view_get_model (tree_view); - string = (gchar *) selection_data->data; + string = (const gchar *) selection_data->data; remove_from_source = (context->action == GDK_ACTION_MOVE); if (!gtk_tree_view_get_dest_row_at_pos (tree_view, x, y, &path, NULL)) @@ -303,10 +317,10 @@ addressbook_selector_drag_data_received (GtkWidget *widget, success = TRUE; exit: - if (path) + if (path != NULL) gtk_tree_path_free (path); - if (object) + if (object != NULL) g_object_unref (object); gtk_drag_finish (context, success, remove_from_source, time_); diff --git a/addressbook/gui/widgets/e-addressbook-selector.h b/addressbook/gui/widgets/e-addressbook-selector.h index f78442601d..67a2c8f6e5 100644 --- a/addressbook/gui/widgets/e-addressbook-selector.h +++ b/addressbook/gui/widgets/e-addressbook-selector.h @@ -34,13 +34,13 @@ (G_TYPE_CHECK_CLASS_CAST \ ((cls), E_TYPE_ADDRESSBOOK_SELECTOR, EAddressbookSelectorClass)) #define E_IS_ADDRESSBOOK_SELECTOR(obj) \ - (E_TYPE_CHECK_INSTANCE_TYPE \ + (G_TYPE_CHECK_INSTANCE_TYPE \ ((obj), E_TYPE_ADDRESSBOOK_SELECTOR)) #define E_IS_ADDRESSBOOK_SELECTOR_CLASS(cls) \ - (E_TYPE_CHECK_CLASS_TYPE \ + (G_TYPE_CHECK_CLASS_TYPE \ ((cls), E_TYPE_ADDRESSBOOK_SELECTOR)) #define E_ADDRESSBOOK_SELECTOR_GET_CLASS(obj) \ - (E_TYPE_INSTANCE_GET_CLASS \ + (G_TYPE_INSTANCE_GET_CLASS \ ((obj), E_TYPE_ADDRESSBOOK_SELECTOR, EAddressbookSelectorClass)) G_BEGIN_DECLS -- cgit