aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-05-09 04:50:40 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-05-09 04:50:40 +0800
commit538b8a736343c38907a2e8dbea3ba496c0d24ee7 (patch)
tree6122ca27c5f96507edad9eecd433c8f80dced502 /calendar
parent2a54f0a220d86b271901697ce938b30c2f3ca41a (diff)
downloadgsoc2013-evolution-538b8a736343c38907a2e8dbea3ba496c0d24ee7.tar.gz
gsoc2013-evolution-538b8a736343c38907a2e8dbea3ba496c0d24ee7.tar.zst
gsoc2013-evolution-538b8a736343c38907a2e8dbea3ba496c0d24ee7.zip
Adapt memos to EShellBackend changes.
Diffstat (limited to 'calendar')
-rw-r--r--calendar/modules/e-cal-shell-backend.c34
-rw-r--r--calendar/modules/e-memo-shell-backend.c167
-rw-r--r--calendar/modules/e-memo-shell-backend.h6
-rw-r--r--calendar/modules/e-memo-shell-migrate.c4
-rw-r--r--calendar/modules/e-memo-shell-sidebar.c9
-rw-r--r--calendar/modules/e-memo-shell-view-actions.c5
-rw-r--r--calendar/modules/e-memo-shell-view-private.c16
-rw-r--r--calendar/modules/e-memo-shell-view-private.h8
-rw-r--r--calendar/modules/e-memo-shell-view.c42
-rw-r--r--calendar/modules/e-memo-shell-view.h5
10 files changed, 202 insertions, 94 deletions
diff --git a/calendar/modules/e-cal-shell-backend.c b/calendar/modules/e-cal-shell-backend.c
index 8efade4a7c..d5b3ac7725 100644
--- a/calendar/modules/e-cal-shell-backend.c
+++ b/calendar/modules/e-cal-shell-backend.c
@@ -62,6 +62,11 @@ struct _ECalShellBackendPrivate {
ESourceList *source_list;
};
+enum {
+ PROP_0,
+ PROP_SOURCE_LIST
+};
+
/* Module Entry Point */
void e_module_load (GTypeModule *type_module);
void e_module_unload (GTypeModule *type_module);
@@ -520,6 +525,24 @@ cal_shell_backend_window_created_cb (EShellBackend *shell_backend,
}
static void
+cal_shell_backend_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SOURCE_LIST:
+ g_value_set_object (
+ value,
+ e_cal_shell_backend_get_source_list (
+ E_CAL_SHELL_BACKEND (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
cal_shell_backend_dispose (GObject *object)
{
ECalShellBackendPrivate *priv;
@@ -577,6 +600,7 @@ cal_shell_backend_class_init (ECalShellBackendClass *class)
g_type_class_add_private (class, sizeof (ECalShellBackendPrivate));
object_class = G_OBJECT_CLASS (class);
+ object_class->get_property = cal_shell_backend_get_property;
object_class->dispose = cal_shell_backend_dispose;
object_class->constructed = cal_shell_backend_constructed;
@@ -590,6 +614,16 @@ cal_shell_backend_class_init (ECalShellBackendClass *class)
shell_backend_class->is_busy = NULL;
shell_backend_class->shutdown = NULL;
shell_backend_class->migrate = e_cal_shell_backend_migrate;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SOURCE_LIST,
+ g_param_spec_object (
+ "source-list",
+ _("Source List"),
+ _("The registry of calendars"),
+ E_TYPE_SOURCE_LIST,
+ G_PARAM_READABLE));
}
static void
diff --git a/calendar/modules/e-memo-shell-backend.c b/calendar/modules/e-memo-shell-backend.c
index fb0296f8c8..e91399af24 100644
--- a/calendar/modules/e-memo-shell-backend.c
+++ b/calendar/modules/e-memo-shell-backend.c
@@ -19,6 +19,8 @@
*
*/
+#include "e-memo-shell-backend.h"
+
#include <string.h>
#include <glib/gi18n.h>
#include <libecal/e-cal.h>
@@ -37,19 +39,31 @@
#include "calendar/gui/dialogs/calendar-setup.h"
#include "calendar/gui/dialogs/memo-editor.h"
+#include "e-memo-shell-migrate.h"
#include "e-memo-shell-view.h"
-#include "e-memo-shell-backend-migrate.h"
-#define MODULE_NAME "memos"
-#define MODULE_ALIASES ""
-#define MODULE_SCHEMES "memo"
-#define MODULE_SORT_ORDER 500
+#define E_MEMO_SHELL_BACKEND_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEMO_SHELL_BACKEND, EMemoShellBackendPrivate))
#define WEB_BASE_URI "webcal://"
#define PERSONAL_RELATIVE_URI "system"
+struct _EMemoShellBackendPrivate {
+ ESourceList *source_list;
+};
+
+enum {
+ PROP_0,
+ PROP_SOURCE_LIST
+};
+
/* Module Entry Point */
-void e_shell_backend_init (GTypeModule *type_module);
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+GType e_memo_shell_backend_type = 0;
+static gpointer parent_class;
static void
memo_module_ensure_sources (EShellBackend *shell_backend)
@@ -478,32 +492,49 @@ memo_module_window_created_cb (EShellBackend *shell_backend,
source_entries, G_N_ELEMENTS (source_entries));
}
-static EShellBackendInfo module_info = {
+static void
+memo_shell_backend_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SOURCE_LIST:
+ g_value_set_object (
+ value,
+ e_memo_shell_backend_get_source_list (
+ E_MEMO_SHELL_BACKEND (object)));
+ return;
+ }
- MODULE_NAME,
- MODULE_ALIASES,
- MODULE_SCHEMES,
- MODULE_SORT_ORDER,
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
- /* start */ NULL,
- /* is_busy */ NULL,
- /* shutdown */ NULL,
- e_memo_shell_backend_migrate
-};
+static void
+memo_shell_backend_dispose (GObject *object)
+{
+ EMemoShellBackendPrivate *priv;
-void
-e_shell_backend_init (GTypeModule *type_module)
+ priv = E_MEMO_SHELL_BACKEND_GET_PRIVATE (object);
+
+ if (priv->source_list != NULL) {
+ g_object_unref (priv->source_list);
+ priv->source_list = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+memo_shell_backend_constructed (GObject *object)
{
EShell *shell;
EShellBackend *shell_backend;
- shell_backend = E_SHELL_BACKEND (type_module);
+ shell_backend = E_SHELL_BACKEND (object);
shell = e_shell_backend_get_shell (shell_backend);
- e_shell_backend_set_info (
- shell_backend, &module_info,
- e_memo_shell_view_get_type (type_module));
-
memo_module_ensure_sources (shell_backend);
g_signal_connect_swapped (
@@ -514,3 +545,93 @@ e_shell_backend_init (GTypeModule *type_module)
shell, "window-created",
G_CALLBACK (memo_module_window_created_cb), shell_backend);
}
+
+static void
+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);
+ object_class->get_property = memo_shell_backend_get_property;
+ object_class->dispose = memo_shell_backend_dispose;
+ object_class->constructed = memo_shell_backend_constructed;
+
+ shell_backend_class = E_SHELL_BACKEND_CLASS (class);
+ shell_backend_class->name = "memos";
+ shell_backend_class->aliases = "";
+ shell_backend_class->schemes = "memo";
+ shell_backend_class->sort_order = 500;
+ shell_backend_class->view_type = E_TYPE_MEMO_SHELL_VIEW;
+ shell_backend_class->start = NULL;
+ shell_backend_class->is_busy = NULL;
+ shell_backend_class->shutdown = NULL;
+ shell_backend_class->migrate = e_memo_shell_backend_migrate;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SOURCE_LIST,
+ g_param_spec_object (
+ "source-list",
+ _("Source List"),
+ _("The registry of memo lists"),
+ E_TYPE_SOURCE_LIST,
+ G_PARAM_READABLE));
+}
+
+static void
+memo_shell_backend_init (EMemoShellBackend *memo_shell_backend)
+{
+ memo_shell_backend->priv =
+ E_MEMO_SHELL_BACKEND_GET_PRIVATE (memo_shell_backend);
+}
+
+GType
+e_memo_shell_backend_get_type (GTypeModule *type_module)
+{
+ if (e_memo_shell_backend_type == 0) {
+ 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 */
+ };
+
+ e_memo_shell_backend_type =
+ g_type_module_register_type (
+ type_module, E_TYPE_SHELL_BACKEND,
+ "EMemoShellBackend", &type_info, 0);
+ }
+
+ return e_memo_shell_backend_type;
+}
+
+ESourceList *
+e_memo_shell_backend_get_source_list (EMemoShellBackend *memo_shell_backend)
+{
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_BACKEND (memo_shell_backend), NULL);
+
+ return memo_shell_backend->priv->source_list;
+}
+
+void
+e_module_load (GTypeModule *type_module)
+{
+ e_memo_shell_backend_get_type (type_module);
+ e_memo_shell_view_get_type (type_module);
+}
+
+void
+e_module_unload (GTypeModule *type_module)
+{
+}
diff --git a/calendar/modules/e-memo-shell-backend.h b/calendar/modules/e-memo-shell-backend.h
index a7bf63e0d8..3a8b06a744 100644
--- a/calendar/modules/e-memo-shell-backend.h
+++ b/calendar/modules/e-memo-shell-backend.h
@@ -23,6 +23,7 @@
#define E_MEMO_SHELL_BACKEND_H
#include <shell/e-shell-backend.h>
+#include <libedataserver/e-source-list.h>
/* Standard GObject macros */
#define E_TYPE_MEMO_SHELL_BACKEND \
@@ -60,7 +61,10 @@ struct _EMemoShellBackendClass {
EShellBackendClass parent_class;
};
-GType e_memo_shell_backend_get_type (GTypeModule *type_module);
+GType e_memo_shell_backend_get_type
+ (GTypeModule *type_module);
+ESourceList * e_memo_shell_backend_get_source_list
+ (EMemoShellBackend *memo_shell_backend);
G_END_DECLS
diff --git a/calendar/modules/e-memo-shell-migrate.c b/calendar/modules/e-memo-shell-migrate.c
index 8bdf08fe4e..763d366eab 100644
--- a/calendar/modules/e-memo-shell-migrate.c
+++ b/calendar/modules/e-memo-shell-migrate.c
@@ -1,5 +1,5 @@
/*
- * e-memo-shell-backend-migrate.c
+ * e-memo-shell-migrate.c
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -19,7 +19,7 @@
*
*/
-#include "e-memo-shell-backend-migrate.h"
+#include "e-memo-shell-migrate.h"
#include <string.h>
#include <glib/gi18n.h>
diff --git a/calendar/modules/e-memo-shell-sidebar.c b/calendar/modules/e-memo-shell-sidebar.c
index 4dcff2ff35..db3c75cfe7 100644
--- a/calendar/modules/e-memo-shell-sidebar.c
+++ b/calendar/modules/e-memo-shell-sidebar.c
@@ -33,6 +33,7 @@
#include "calendar/gui/misc.h"
#include "e-memo-shell-view.h"
+#include "e-memo-shell-backend.h"
#define E_MEMO_SHELL_SIDEBAR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -361,8 +362,8 @@ memo_shell_sidebar_constructed (GObject *object)
{
EMemoShellSidebarPrivate *priv;
EShellView *shell_view;
+ EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
- EMemoShellView *memo_shell_view;
ESourceSelector *selector;
ESourceList *source_list;
ESource *source;
@@ -380,8 +381,10 @@ memo_shell_sidebar_constructed (GObject *object)
shell_sidebar = E_SHELL_SIDEBAR (object);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- memo_shell_view = E_MEMO_SHELL_VIEW (shell_view);
- source_list = e_memo_shell_view_get_source_list (memo_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ source_list = e_memo_shell_backend_get_source_list (
+ E_MEMO_SHELL_BACKEND (shell_backend));
container = GTK_CONTAINER (shell_sidebar);
diff --git a/calendar/modules/e-memo-shell-view-actions.c b/calendar/modules/e-memo-shell-view-actions.c
index d45f74fc38..30dfde6f0e 100644
--- a/calendar/modules/e-memo-shell-view-actions.c
+++ b/calendar/modules/e-memo-shell-view-actions.c
@@ -156,6 +156,7 @@ static void
action_memo_list_delete_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
+ EMemoShellBackend *memo_shell_backend;
EMemoShellContent *memo_shell_content;
EMemoShellSidebar *memo_shell_sidebar;
EShellWindow *shell_window;
@@ -174,6 +175,9 @@ action_memo_list_delete_cb (GtkAction *action,
shell_view = E_SHELL_VIEW (memo_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ memo_shell_backend = memo_shell_view->priv->memo_shell_backend;
+ source_list = e_memo_shell_backend_get_source_list (memo_shell_backend);
+
memo_shell_content = memo_shell_view->priv->memo_shell_content;
memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
model = e_memo_table_get_model (memo_table);
@@ -214,7 +218,6 @@ action_memo_list_delete_cb (GtkAction *action,
source_group = e_source_peek_group (source);
e_source_group_remove_source (source_group, source);
- source_list = memo_shell_view->priv->source_list;
if (!e_source_list_sync (source_list, &error)) {
g_warning ("%s", error->message);
g_error_free (error);
diff --git a/calendar/modules/e-memo-shell-view-private.c b/calendar/modules/e-memo-shell-view-private.c
index 2fcd5ddd9a..dbb474a7a2 100644
--- a/calendar/modules/e-memo-shell-view-private.c
+++ b/calendar/modules/e-memo-shell-view-private.c
@@ -151,16 +151,6 @@ void
e_memo_shell_view_private_init (EMemoShellView *memo_shell_view,
EShellViewClass *shell_view_class)
{
- EMemoShellViewPrivate *priv = memo_shell_view->priv;
- ESourceList *source_list;
- GObject *object;
-
- object = G_OBJECT (shell_view_class->type_module);
- source_list = g_object_get_data (object, "source-list");
- g_return_if_fail (E_IS_SOURCE_LIST (source_list));
-
- priv->source_list = g_object_ref (source_list);
-
if (!gal_view_collection_loaded (shell_view_class->view_collection))
memo_shell_view_load_view_collection (shell_view_class);
@@ -176,6 +166,7 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
EMemoShellContent *memo_shell_content;
EMemoShellSidebar *memo_shell_sidebar;
EShellView *shell_view;
+ EShellBackend *shell_backend;
EShellContent *shell_content;
EShellSidebar *shell_sidebar;
EShellWindow *shell_window;
@@ -185,6 +176,7 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
ESourceSelector *selector;
shell_view = E_SHELL_VIEW (memo_shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
shell_content = e_shell_view_get_shell_content (shell_view);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
@@ -193,6 +185,7 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
e_shell_window_add_action_group (shell_window, "memos-filter");
/* Cache these to avoid lots of awkward casting. */
+ priv->memo_shell_backend = g_object_ref (shell_backend);
priv->memo_shell_content = g_object_ref (shell_content);
priv->memo_shell_sidebar = g_object_ref (shell_sidebar);
@@ -285,8 +278,7 @@ e_memo_shell_view_private_dispose (EMemoShellView *memo_shell_view)
{
EMemoShellViewPrivate *priv = memo_shell_view->priv;
- DISPOSE (priv->source_list);
-
+ DISPOSE (priv->memo_shell_backend);
DISPOSE (priv->memo_shell_content);
DISPOSE (priv->memo_shell_sidebar);
diff --git a/calendar/modules/e-memo-shell-view-private.h b/calendar/modules/e-memo-shell-view-private.h
index 9667bc5ec7..04857efe69 100644
--- a/calendar/modules/e-memo-shell-view-private.h
+++ b/calendar/modules/e-memo-shell-view-private.h
@@ -43,6 +43,7 @@
#include "calendar/gui/dialogs/copy-source-dialog.h"
#include "calendar/gui/dialogs/memo-editor.h"
+#include "e-memo-shell-backend.h"
#include "e-memo-shell-content.h"
#include "e-memo-shell-sidebar.h"
#include "e-memo-shell-view-actions.h"
@@ -84,13 +85,8 @@ enum {
struct _EMemoShellViewPrivate {
- /*** Module Data ***/
-
- ESourceList *source_list;
-
- /*** Other Stuff ***/
-
/* These are just for convenience. */
+ EMemoShellBackend *memo_shell_backend;
EMemoShellContent *memo_shell_content;
EMemoShellSidebar *memo_shell_sidebar;
diff --git a/calendar/modules/e-memo-shell-view.c b/calendar/modules/e-memo-shell-view.c
index 89efd8f15d..78c594d6c5 100644
--- a/calendar/modules/e-memo-shell-view.c
+++ b/calendar/modules/e-memo-shell-view.c
@@ -21,32 +21,10 @@
#include "e-memo-shell-view-private.h"
-enum {
- PROP_0,
- PROP_SOURCE_LIST
-};
-
GType e_memo_shell_view_type = 0;
static gpointer parent_class;
static void
-memo_shell_view_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id) {
- case PROP_SOURCE_LIST:
- g_value_set_object (
- value, e_memo_shell_view_get_source_list (
- E_MEMO_SHELL_VIEW (object)));
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
memo_shell_view_dispose (GObject *object)
{
e_memo_shell_view_private_dispose (E_MEMO_SHELL_VIEW (object));
@@ -190,7 +168,6 @@ memo_shell_view_class_init (EMemoShellViewClass *class,
g_type_class_add_private (class, sizeof (EMemoShellViewPrivate));
object_class = G_OBJECT_CLASS (class);
- object_class->get_property = memo_shell_view_get_property;
object_class->dispose = memo_shell_view_dispose;
object_class->finalize = memo_shell_view_finalize;
object_class->constructed = memo_shell_view_constructed;
@@ -202,20 +179,9 @@ memo_shell_view_class_init (EMemoShellViewClass *class,
shell_view_class->ui_manager_id = "org.gnome.evolution.memos";
shell_view_class->search_options = "/memo-search-options";
shell_view_class->search_rules = "memotypes.xml";
- shell_view_class->type_module = type_module;
shell_view_class->new_shell_content = e_memo_shell_content_new;
shell_view_class->new_shell_sidebar = e_memo_shell_sidebar_new;
shell_view_class->update_actions = memo_shell_view_update_actions;
-
- g_object_class_install_property (
- object_class,
- PROP_SOURCE_LIST,
- g_param_spec_object (
- "source-list",
- _("Source List"),
- _("The registry of memo lists"),
- E_TYPE_SOURCE_LIST,
- G_PARAM_READABLE));
}
static void
@@ -253,11 +219,3 @@ e_memo_shell_view_get_type (GTypeModule *type_module)
return e_memo_shell_view_type;
}
-
-ESourceList *
-e_memo_shell_view_get_source_list (EMemoShellView *memo_shell_view)
-{
- g_return_val_if_fail (E_IS_MEMO_SHELL_VIEW (memo_shell_view), NULL);
-
- return memo_shell_view->priv->source_list;
-}
diff --git a/calendar/modules/e-memo-shell-view.h b/calendar/modules/e-memo-shell-view.h
index 0cc77ad1d7..72b9564ac1 100644
--- a/calendar/modules/e-memo-shell-view.h
+++ b/calendar/modules/e-memo-shell-view.h
@@ -61,10 +61,7 @@ struct _EMemoShellViewClass {
EShellViewClass parent_class;
};
-GType e_memo_shell_view_get_type
- (GTypeModule *type_module);
-ESourceList * e_memo_shell_view_get_source_list
- (EMemoShellView *memo_shell_view);
+GType e_memo_shell_view_get_type (GTypeModule *type_module);
G_END_DECLS