aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar/e-memo-shell-backend.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-12-08 04:25:02 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-12-08 11:11:21 +0800
commita01525c9316b13153cb00fa99cdc587e3ce7c350 (patch)
tree8053b4a68ca33a68cb8123f0a703c003184fa8d0 /modules/calendar/e-memo-shell-backend.c
parent8927e9d2e0d2bfc0f0a2cc7821d2ef8658e8670f (diff)
downloadgsoc2013-evolution-a01525c9316b13153cb00fa99cdc587e3ce7c350.tar.gz
gsoc2013-evolution-a01525c9316b13153cb00fa99cdc587e3ce7c350.tar.zst
gsoc2013-evolution-a01525c9316b13153cb00fa99cdc587e3ce7c350.zip
Miscellaneous EShellView-related cleanups.
Diffstat (limited to 'modules/calendar/e-memo-shell-backend.c')
-rw-r--r--modules/calendar/e-memo-shell-backend.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c
index c83c0fdfd9..93d2084885 100644
--- a/modules/calendar/e-memo-shell-backend.c
+++ b/modules/calendar/e-memo-shell-backend.c
@@ -48,6 +48,10 @@
#define WEB_BASE_URI "webcal://"
#define PERSONAL_RELATIVE_URI "system"
+#define E_MEMO_SHELL_BACKEND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendPrivate))
+
struct _EMemoShellBackendPrivate {
ESourceList *source_list;
};
@@ -57,8 +61,10 @@ enum {
PROP_SOURCE_LIST
};
-static gpointer parent_class;
-static GType memo_shell_backend_type;
+G_DEFINE_DYNAMIC_TYPE (
+ EMemoShellBackend,
+ e_memo_shell_backend,
+ E_TYPE_SHELL_BACKEND)
static void
memo_shell_backend_ensure_sources (EShellBackend *shell_backend)
@@ -527,7 +533,7 @@ memo_shell_backend_dispose (GObject *object)
{
EMemoShellBackendPrivate *priv;
- priv = E_MEMO_SHELL_BACKEND (object)->priv;
+ priv = E_MEMO_SHELL_BACKEND_GET_PRIVATE (object);
if (priv->source_list != NULL) {
g_object_unref (priv->source_list);
@@ -535,7 +541,7 @@ memo_shell_backend_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_memo_shell_backend_parent_class)->dispose (object);
}
static void
@@ -560,16 +566,15 @@ memo_shell_backend_constructed (GObject *object)
shell_backend);
/* Chain up to parent's constructed() method. */
- G_OBJECT_CLASS (parent_class)->constructed (object);
+ G_OBJECT_CLASS (e_memo_shell_backend_parent_class)->constructed (object);
}
static void
-memo_shell_backend_class_init (EMemoShellBackendClass *class)
+e_memo_shell_backend_class_init (EMemoShellBackendClass *class)
{
GObjectClass *object_class;
EShellBackendClass *shell_backend_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EMemoShellBackendPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -599,38 +604,24 @@ memo_shell_backend_class_init (EMemoShellBackendClass *class)
}
static void
-memo_shell_backend_init (EMemoShellBackend *memo_shell_backend)
+e_memo_shell_backend_class_finalize (EMemoShellBackendClass *class)
{
- memo_shell_backend->priv = G_TYPE_INSTANCE_GET_PRIVATE (
- memo_shell_backend, E_TYPE_MEMO_SHELL_BACKEND,
- EMemoShellBackendPrivate);
}
-GType
-e_memo_shell_backend_get_type (void)
+static void
+e_memo_shell_backend_init (EMemoShellBackend *memo_shell_backend)
{
- return memo_shell_backend_type;
+ memo_shell_backend->priv =
+ E_MEMO_SHELL_BACKEND_GET_PRIVATE (memo_shell_backend);
}
void
-e_memo_shell_backend_register_type (GTypeModule *type_module)
+e_memo_shell_backend_type_register (GTypeModule *type_module)
{
- const GTypeInfo type_info = {
- sizeof (EMemoShellBackendClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) memo_shell_backend_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EMemoShellBackend),
- 0, /* n_preallocs */
- (GInstanceInitFunc) memo_shell_backend_init,
- NULL /* value_table */
- };
-
- memo_shell_backend_type = g_type_module_register_type (
- type_module, E_TYPE_SHELL_BACKEND,
- "EMemoShellBackend", &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_memo_shell_backend_register_type (type_module);
}
ESourceList *
@@ -659,7 +650,8 @@ e_memo_shell_backend_get_selected_memo_lists (EMemoShellBackend *memo_shell_back
if (strv != NULL) {
for (ii = 0; strv[ii] != NULL; ii++)
- selected_memo_lists = g_slist_append (selected_memo_lists, g_strdup (strv[ii]));
+ selected_memo_lists = g_slist_append (
+ selected_memo_lists, g_strdup (strv[ii]));
g_strfreev (strv);
}
@@ -682,7 +674,9 @@ e_memo_shell_backend_set_selected_memo_lists (EMemoShellBackend *memo_shell_back
g_ptr_array_add (array, NULL);
settings = g_settings_new ("org.gnome.evolution.calendar");
- g_settings_set_strv (settings, "selected-memos", (const gchar *const *) array->pdata);
+ g_settings_set_strv (
+ settings, "selected-memos",
+ (const gchar *const *) array->pdata);
g_object_unref (settings);
g_ptr_array_free (array, FALSE);