diff options
Diffstat (limited to 'calendar/gui/e-calendar-selector.c')
-rw-r--r-- | calendar/gui/e-calendar-selector.c | 95 |
1 files changed, 92 insertions, 3 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); |