aboutsummaryrefslogtreecommitdiffstats
path: root/modules/addressbook
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-07-06 01:26:43 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-06 04:40:50 +0800
commitdf1dc37704daf3b1f20d1632b1cef1ea0a2181ad (patch)
tree18f00ac12457a5e1f9a5cf2bb2b9db482a150d96 /modules/addressbook
parent7bb795b299758e6a81536b81c19693f353106105 (diff)
downloadgsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.tar.gz
gsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.tar.zst
gsoc2013-evolution-df1dc37704daf3b1f20d1632b1cef1ea0a2181ad.zip
EShellView can load the GalViewCollection itself now.
EShellView no longer needs help from subclasses other than getting the needed GalView subclasses registered. A nice side-effect of this is EShellView subclasses can now use the G_DEFINE_DYNAMIC_TYPE macro.
Diffstat (limited to 'modules/addressbook')
-rw-r--r--modules/addressbook/e-book-shell-view-private.c6
-rw-r--r--modules/addressbook/e-book-shell-view-private.h3
-rw-r--r--modules/addressbook/e-book-shell-view.c56
-rw-r--r--modules/addressbook/e-book-shell-view.h2
-rw-r--r--modules/addressbook/evolution-module-addressbook.c2
5 files changed, 26 insertions, 43 deletions
diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c
index cfb8213ae0..b30ca5f04d 100644
--- a/modules/addressbook/e-book-shell-view-private.c
+++ b/modules/addressbook/e-book-shell-view-private.c
@@ -478,8 +478,7 @@ book_shell_view_notify_view_id_cb (EBookShellView *book_shell_view)
}
void
-e_book_shell_view_private_init (EBookShellView *book_shell_view,
- EShellViewClass *shell_view_class)
+e_book_shell_view_private_init (EBookShellView *book_shell_view)
{
EBookShellViewPrivate *priv = book_shell_view->priv;
GHashTable *uid_to_view;
@@ -492,9 +491,6 @@ e_book_shell_view_private_init (EBookShellView *book_shell_view,
priv->uid_to_view = uid_to_view;
priv->preview_index = -1;
- if (!gal_view_collection_loaded (shell_view_class->view_collection))
- gal_view_collection_load (shell_view_class->view_collection);
-
g_signal_connect (
book_shell_view, "notify::view-id",
G_CALLBACK (book_shell_view_notify_view_id_cb), NULL);
diff --git a/modules/addressbook/e-book-shell-view-private.h b/modules/addressbook/e-book-shell-view-private.h
index a3fe09ac84..d5b6cc5c94 100644
--- a/modules/addressbook/e-book-shell-view-private.h
+++ b/modules/addressbook/e-book-shell-view-private.h
@@ -100,8 +100,7 @@ struct _EBookShellViewPrivate {
};
void e_book_shell_view_private_init
- (EBookShellView *book_shell_view,
- EShellViewClass *shell_view_class);
+ (EBookShellView *book_shell_view);
void e_book_shell_view_private_constructed
(EBookShellView *book_shell_view);
void e_book_shell_view_private_dispose
diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c
index c36d200438..0c812413e2 100644
--- a/modules/addressbook/e-book-shell-view.c
+++ b/modules/addressbook/e-book-shell-view.c
@@ -27,8 +27,10 @@
#include "addressbook/gui/widgets/gal-view-minicard.h"
-static gpointer parent_class;
-static GType book_shell_view_type;
+G_DEFINE_DYNAMIC_TYPE (
+ EBookShellView,
+ e_book_shell_view,
+ E_TYPE_SHELL_VIEW);
static void
book_shell_view_dispose (GObject *object)
@@ -39,7 +41,7 @@ book_shell_view_dispose (GObject *object)
e_book_shell_view_private_dispose (book_shell_view);
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_book_shell_view_parent_class)->dispose (object);
}
static void
@@ -51,7 +53,7 @@ book_shell_view_finalize (GObject *object)
e_book_shell_view_private_finalize (book_shell_view);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_book_shell_view_parent_class)->finalize (object);
}
static void
@@ -60,7 +62,7 @@ book_shell_view_constructed (GObject *object)
EBookShellView *book_shell_view;
/* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_book_shell_view_parent_class)->constructed (object);
book_shell_view = E_BOOK_SHELL_VIEW (object);
e_book_shell_view_private_constructed (book_shell_view);
@@ -215,7 +217,8 @@ book_shell_view_update_actions (EShellView *shell_view)
gboolean source_is_editable;
/* Chain up to parent's update_actions() method. */
- E_SHELL_VIEW_CLASS (parent_class)->update_actions (shell_view);
+ E_SHELL_VIEW_CLASS (e_book_shell_view_parent_class)->
+ update_actions (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
@@ -348,12 +351,16 @@ book_shell_view_update_actions (EShellView *shell_view)
}
static void
-book_shell_view_class_init (EBookShellViewClass *class)
+e_book_shell_view_class_finalize (EBookShellViewClass *class)
+{
+}
+
+static void
+e_book_shell_view_class_init (EBookShellViewClass *class)
{
GObjectClass *object_class;
EShellViewClass *shell_view_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EBookShellViewPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -379,40 +386,21 @@ book_shell_view_class_init (EBookShellViewClass *class)
}
static void
-book_shell_view_init (EBookShellView *book_shell_view,
- EShellViewClass *shell_view_class)
+e_book_shell_view_init (EBookShellView *book_shell_view)
{
book_shell_view->priv =
E_BOOK_SHELL_VIEW_GET_PRIVATE (book_shell_view);
- e_book_shell_view_private_init (book_shell_view, shell_view_class);
-}
-
-GType
-e_book_shell_view_get_type (void)
-{
- return book_shell_view_type;
+ e_book_shell_view_private_init (book_shell_view);
}
void
-e_book_shell_view_register_type (GTypeModule *type_module)
+e_book_shell_view_type_register (GTypeModule *type_module)
{
- const GTypeInfo type_info = {
- sizeof (EBookShellViewClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) book_shell_view_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EBookShellView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) book_shell_view_init,
- NULL /* value_table */
- };
-
- book_shell_view_type = g_type_module_register_type (
- type_module, E_TYPE_SHELL_VIEW,
- "EBookShellView", &type_info, 0);
+ /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
+ * function, so we have to wrap it with a public function in
+ * order to register types from a separate compilation unit. */
+ e_book_shell_view_register_type (type_module);
}
void
diff --git a/modules/addressbook/e-book-shell-view.h b/modules/addressbook/e-book-shell-view.h
index a5e726b422..144effebba 100644
--- a/modules/addressbook/e-book-shell-view.h
+++ b/modules/addressbook/e-book-shell-view.h
@@ -59,7 +59,7 @@ struct _EBookShellViewClass {
};
GType e_book_shell_view_get_type (void);
-void e_book_shell_view_register_type (GTypeModule *type_module);
+void e_book_shell_view_type_register (GTypeModule *type_module);
void e_book_shell_view_disable_searching (EBookShellView *book_shell_view);
void e_book_shell_view_enable_searching (EBookShellView *book_shell_view);
diff --git a/modules/addressbook/evolution-module-addressbook.c b/modules/addressbook/evolution-module-addressbook.c
index 1caf7ddf08..e8a6dafa39 100644
--- a/modules/addressbook/evolution-module-addressbook.c
+++ b/modules/addressbook/evolution-module-addressbook.c
@@ -41,7 +41,7 @@ e_module_load (GTypeModule *type_module)
e_book_config_hook_register_type (type_module);
- e_book_shell_view_register_type (type_module);
+ e_book_shell_view_type_register (type_module);
e_book_shell_backend_type_register (type_module);
e_book_shell_content_type_register (type_module);
e_book_shell_sidebar_type_register (type_module);