diff options
author | Fabiano FidĂȘncio <fidencio@redhat.com> | 2013-09-03 07:31:28 +0800 |
---|---|---|
committer | Fabiano FidĂȘncio <fidencio@redhat.com> | 2013-09-05 21:00:59 +0800 |
commit | 96c6e7bc26132d31c87e05a6ef702b008a47ac85 (patch) | |
tree | 4efa9ec983e9a7f4e3a12b8c7b700a63d9cf2a44 /calendar/gui | |
parent | a9d4764be5833cd5499039303926991caff41c2b (diff) | |
download | gsoc2013-evolution-96c6e7bc26132d31c87e05a6ef702b008a47ac85.tar gsoc2013-evolution-96c6e7bc26132d31c87e05a6ef702b008a47ac85.tar.gz gsoc2013-evolution-96c6e7bc26132d31c87e05a6ef702b008a47ac85.tar.bz2 gsoc2013-evolution-96c6e7bc26132d31c87e05a6ef702b008a47ac85.tar.lz gsoc2013-evolution-96c6e7bc26132d31c87e05a6ef702b008a47ac85.tar.xz gsoc2013-evolution-96c6e7bc26132d31c87e05a6ef702b008a47ac85.tar.zst gsoc2013-evolution-96c6e7bc26132d31c87e05a6ef702b008a47ac85.zip |
Add EShellView to E{Calendar,MemoList,TaskList}Selector
https://bugzilla.gnome.org/show_bug.cgi?id=657808
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/e-calendar-selector.c | 95 | ||||
-rw-r--r-- | calendar/gui/e-calendar-selector.h | 6 | ||||
-rw-r--r-- | calendar/gui/e-memo-list-selector.c | 92 | ||||
-rw-r--r-- | calendar/gui/e-memo-list-selector.h | 6 | ||||
-rw-r--r-- | calendar/gui/e-task-list-selector.c | 92 | ||||
-rw-r--r-- | calendar/gui/e-task-list-selector.h | 6 |
6 files changed, 287 insertions, 10 deletions
diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c index 4ced766039..1b0ee913b3 100644 --- a/calendar/gui/e-calendar-selector.c +++ b/calendar/gui/e-calendar-selector.c @@ -29,7 +29,7 @@ ((obj), E_TYPE_CALENDAR_SELECTOR, ECalendarSelectorPrivate)) struct _ECalendarSelectorPrivate { - gint dummy_value; + EShellView *shell_view; }; G_DEFINE_TYPE ( @@ -37,6 +37,11 @@ G_DEFINE_TYPE ( e_calendar_selector, E_TYPE_CLIENT_SELECTOR) +enum { + PROP_0, + PROP_SHELL_VIEW, +}; + static gboolean calendar_selector_update_single_object (ECalClient *client, icalcomponent *icalcomp) @@ -207,6 +212,71 @@ exit: return success; } +EShellView * +e_calendar_selector_get_shell_view (ECalendarSelector *calendar_selector) +{ + g_return_val_if_fail (E_IS_CALENDAR_SELECTOR (calendar_selector), NULL); + + return calendar_selector->priv->shell_view; +} + +static void +e_calendar_selector_set_shell_view (ECalendarSelector *calendar_selector, + EShellView *shell_view) +{ + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); + g_return_if_fail (calendar_selector->priv->shell_view == NULL); + + calendar_selector->priv->shell_view = g_object_ref (shell_view); +} + +static void +calendar_selector_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SHELL_VIEW: + e_calendar_selector_set_shell_view ( + E_CALENDAR_SELECTOR (object), + g_value_get_object (value)); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +calendar_selector_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SHELL_VIEW: + g_value_set_object ( + value, + e_calendar_selector_get_shell_view (E_CALENDAR_SELECTOR (object))); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +calendar_selector_dispose (GObject *object) +{ + ECalendarSelectorPrivate *priv; + + priv = E_CALENDAR_SELECTOR_GET_PRIVATE (object); + + g_clear_object (&priv->shell_view); + + /* Chain up to the parent' s dispose() method. */ + G_OBJECT_CLASS (e_calendar_selector_parent_class)->dispose (object); +} + static void e_calendar_selector_class_init (ECalendarSelectorClass *class) { @@ -217,9 +287,24 @@ e_calendar_selector_class_init (ECalendarSelectorClass *class) object_class = G_OBJECT_CLASS (class); object_class->constructed = calendar_selector_constructed; + object_class->set_property = calendar_selector_set_property; + object_class->get_property = calendar_selector_get_property; + object_class->dispose = calendar_selector_dispose; source_selector_class = E_SOURCE_SELECTOR_CLASS (class); source_selector_class->data_dropped = calendar_selector_data_dropped; + + g_object_class_install_property ( + object_class, + PROP_SHELL_VIEW, + g_param_spec_object ( + "shell-view", + NULL, + NULL, + E_TYPE_SHELL_VIEW, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); } static void @@ -235,12 +320,14 @@ e_calendar_selector_init (ECalendarSelector *selector) } GtkWidget * -e_calendar_selector_new (EClientCache *client_cache) +e_calendar_selector_new (EClientCache *client_cache, + EShellView *shell_view) { ESourceRegistry *registry; GtkWidget *widget; g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL); + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); registry = e_client_cache_ref_registry (client_cache); @@ -248,7 +335,9 @@ e_calendar_selector_new (EClientCache *client_cache) E_TYPE_CALENDAR_SELECTOR, "client-cache", client_cache, "extension-name", E_SOURCE_EXTENSION_CALENDAR, - "registry", registry, NULL); + "registry", registry, + "shell-view", shell_view, + NULL); g_object_unref (registry); diff --git a/calendar/gui/e-calendar-selector.h b/calendar/gui/e-calendar-selector.h index 13d16897f9..2e39c4b571 100644 --- a/calendar/gui/e-calendar-selector.h +++ b/calendar/gui/e-calendar-selector.h @@ -22,6 +22,7 @@ #define E_CALENDAR_SELECTOR_H #include <e-util/e-util.h> +#include <shell/e-shell-view.h> /* Standard GObject macros */ #define E_TYPE_CALENDAR_SELECTOR \ @@ -58,7 +59,10 @@ struct _ECalendarSelectorClass { }; GType e_calendar_selector_get_type (void); -GtkWidget * e_calendar_selector_new (EClientCache *client_cache); +GtkWidget * e_calendar_selector_new (EClientCache *client_cache, + EShellView *shell_backend); +EShellView * e_calendar_selector_get_shell_view + (ECalendarSelector *calendar_selector); G_END_DECLS diff --git a/calendar/gui/e-memo-list-selector.c b/calendar/gui/e-memo-list-selector.c index f52a2a6bcf..a1cc8a7e30 100644 --- a/calendar/gui/e-memo-list-selector.c +++ b/calendar/gui/e-memo-list-selector.c @@ -32,7 +32,7 @@ ((obj), E_TYPE_MEMO_LIST_SELECTOR, EMemoListSelectorPrivate)) struct _EMemoListSelectorPrivate { - gint dummy_value; + EShellView *shell_view; }; G_DEFINE_TYPE ( @@ -40,6 +40,11 @@ G_DEFINE_TYPE ( e_memo_list_selector, E_TYPE_CLIENT_SELECTOR) +enum { + PROP_0, + PROP_SHELL_VIEW +}; + static gboolean memo_list_selector_update_single_object (ECalClient *client, icalcomponent *icalcomp) @@ -323,6 +328,71 @@ memo_list_selector_data_dropped (ESourceSelector *selector, return TRUE; } +EShellView * +e_memo_list_selector_get_shell_view (EMemoListSelector *memo_list_selector) +{ + g_return_val_if_fail (E_IS_MEMO_LIST_SELECTOR (memo_list_selector), NULL); + + return memo_list_selector->priv->shell_view; +} + +static void +e_memo_list_selector_set_shell_view (EMemoListSelector *memo_list_selector, + EShellView *shell_view) +{ + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); + g_return_if_fail (memo_list_selector->priv->shell_view == NULL); + + memo_list_selector->priv->shell_view = g_object_ref (shell_view); +} + +static void +memo_list_selector_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SHELL_VIEW: + e_memo_list_selector_set_shell_view ( + E_MEMO_LIST_SELECTOR (object), + g_value_get_object (value)); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +memo_list_selector_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SHELL_VIEW: + g_value_set_object ( + value, + e_memo_list_selector_get_shell_view (E_MEMO_LIST_SELECTOR (object))); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +memo_list_selector_dispose (GObject *object) +{ + EMemoListSelectorPrivate *priv; + + priv = E_MEMO_LIST_SELECTOR_GET_PRIVATE (object); + + g_clear_object (&priv->shell_view); + + /* Chain up to the parent' s dispose() method. */ + G_OBJECT_CLASS (e_memo_list_selector_parent_class)->dispose (object); +} + static void e_memo_list_selector_class_init (EMemoListSelectorClass *class) { @@ -333,9 +403,24 @@ e_memo_list_selector_class_init (EMemoListSelectorClass *class) object_class = G_OBJECT_CLASS (class); object_class->constructed = memo_list_selector_constructed; + object_class->set_property = memo_list_selector_set_property; + object_class->get_property = memo_list_selector_get_property; + object_class->dispose = memo_list_selector_dispose; source_selector_class = E_SOURCE_SELECTOR_CLASS (class); source_selector_class->data_dropped = memo_list_selector_data_dropped; + + g_object_class_install_property ( + object_class, + PROP_SHELL_VIEW, + g_param_spec_object ( + "shell-view", + NULL, + NULL, + E_TYPE_SHELL_VIEW, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); } static void @@ -351,12 +436,14 @@ e_memo_list_selector_init (EMemoListSelector *selector) } GtkWidget * -e_memo_list_selector_new (EClientCache *client_cache) +e_memo_list_selector_new (EClientCache *client_cache, + EShellView *shell_view) { ESourceRegistry *registry; GtkWidget *widget; g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL); + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); registry = e_client_cache_ref_registry (client_cache); @@ -364,6 +451,7 @@ e_memo_list_selector_new (EClientCache *client_cache) E_TYPE_MEMO_LIST_SELECTOR, "client-cache", client_cache, "extension-name", E_SOURCE_EXTENSION_MEMO_LIST, + "shell-view", shell_view, "registry", registry, NULL); g_object_unref (registry); diff --git a/calendar/gui/e-memo-list-selector.h b/calendar/gui/e-memo-list-selector.h index e29bfb3133..0a68a76965 100644 --- a/calendar/gui/e-memo-list-selector.h +++ b/calendar/gui/e-memo-list-selector.h @@ -27,6 +27,7 @@ #define E_MEMO_LIST_SELECTOR_H #include <e-util/e-util.h> +#include <shell/e-shell-view.h> /* Standard GObject macros */ #define E_TYPE_MEMO_LIST_SELECTOR \ @@ -63,7 +64,10 @@ struct _EMemoListSelectorClass { }; GType e_memo_list_selector_get_type (void); -GtkWidget * e_memo_list_selector_new (EClientCache *client_cache); +GtkWidget * e_memo_list_selector_new (EClientCache *client_cache, + EShellView *shell_view); +EShellView * e_memo_list_selector_get_shell_view + (EMemoListSelector *memo_list_selector); G_END_DECLS diff --git a/calendar/gui/e-task-list-selector.c b/calendar/gui/e-task-list-selector.c index e48b9620e7..dc1340eb00 100644 --- a/calendar/gui/e-task-list-selector.c +++ b/calendar/gui/e-task-list-selector.c @@ -32,7 +32,7 @@ ((obj), E_TYPE_TASK_LIST_SELECTOR, ETaskListSelectorPrivate)) struct _ETaskListSelectorPrivate { - gint dummy_value; + EShellView *shell_view; }; G_DEFINE_TYPE ( @@ -40,6 +40,11 @@ G_DEFINE_TYPE ( e_task_list_selector, E_TYPE_CLIENT_SELECTOR) +enum { + PROP_0, + PROP_SHELL_VIEW +}; + static gboolean task_list_selector_update_single_object (ECalClient *client, icalcomponent *icalcomp) @@ -325,6 +330,71 @@ task_list_selector_data_dropped (ESourceSelector *selector, return TRUE; } +EShellView * +e_task_list_selector_get_shell_view (ETaskListSelector *task_list_selector) +{ + g_return_val_if_fail (E_IS_TASK_LIST_SELECTOR (task_list_selector), NULL); + + return task_list_selector->priv->shell_view; +} + +static void +e_task_list_selector_set_shell_view (ETaskListSelector *task_list_selector, + EShellView *shell_view) +{ + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); + g_return_if_fail (task_list_selector->priv->shell_view == NULL); + + task_list_selector->priv->shell_view = g_object_ref (shell_view); +} + +static void +task_list_selector_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SHELL_VIEW: + e_task_list_selector_set_shell_view ( + E_TASK_LIST_SELECTOR (object), + g_value_get_object (value)); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +task_list_selector_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SHELL_VIEW: + g_value_set_object ( + value, + e_task_list_selector_get_shell_view (E_TASK_LIST_SELECTOR (object))); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +task_list_selector_dispose (GObject *object) +{ + ETaskListSelectorPrivate *priv; + + priv = E_TASK_LIST_SELECTOR_GET_PRIVATE (object); + + g_clear_object (&priv->shell_view); + + /* Chain up to the parent' s dispose() method. */ + G_OBJECT_CLASS (e_task_list_selector_parent_class)->dispose (object); +} + static void e_task_list_selector_class_init (ETaskListSelectorClass *class) { @@ -335,9 +405,24 @@ e_task_list_selector_class_init (ETaskListSelectorClass *class) object_class = G_OBJECT_CLASS (class); object_class->constructed = task_list_selector_constructed; + object_class->set_property = task_list_selector_set_property; + object_class->get_property = task_list_selector_get_property; + object_class->dispose = task_list_selector_dispose; source_selector_class = E_SOURCE_SELECTOR_CLASS (class); source_selector_class->data_dropped = task_list_selector_data_dropped; + + g_object_class_install_property ( + object_class, + PROP_SHELL_VIEW, + g_param_spec_object ( + "shell-view", + NULL, + NULL, + E_TYPE_SHELL_VIEW, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); } static void @@ -353,12 +438,14 @@ e_task_list_selector_init (ETaskListSelector *selector) } GtkWidget * -e_task_list_selector_new (EClientCache *client_cache) +e_task_list_selector_new (EClientCache *client_cache, + EShellView *shell_view) { ESourceRegistry *registry; GtkWidget *widget; g_return_val_if_fail (E_IS_CLIENT_CACHE (client_cache), NULL); + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL); registry = e_client_cache_ref_registry (client_cache); @@ -366,6 +453,7 @@ e_task_list_selector_new (EClientCache *client_cache) E_TYPE_TASK_LIST_SELECTOR, "client-cache", client_cache, "extension-name", E_SOURCE_EXTENSION_TASK_LIST, + "shell-view", shell_view, "registry", registry, NULL); g_object_unref (registry); diff --git a/calendar/gui/e-task-list-selector.h b/calendar/gui/e-task-list-selector.h index 1c0ba17a5b..c296d7d973 100644 --- a/calendar/gui/e-task-list-selector.h +++ b/calendar/gui/e-task-list-selector.h @@ -27,6 +27,7 @@ #define E_TASK_LIST_SELECTOR_H #include <e-util/e-util.h> +#include <shell/e-shell-view.h> /* Standard GObject macros */ #define E_TYPE_TASK_LIST_SELECTOR \ @@ -63,7 +64,10 @@ struct _ETaskListSelectorClass { }; GType e_task_list_selector_get_type (void); -GtkWidget * e_task_list_selector_new (EClientCache *client_cache); +GtkWidget * e_task_list_selector_new (EClientCache *client_cache, + EShellView *shell_view); +EShellView * e_task_list_selector_get_shell_view + (ETaskListSelector *task_list_selector); G_END_DECLS |