aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar/e-cal-shell-sidebar.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-11-02 02:44:23 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2010-11-10 06:33:21 +0800
commit26afa6081c3d9826dbae78236dd712fad8b7c340 (patch)
tree531e8587a88bc408b91341a98e20fbd934cbb344 /modules/calendar/e-cal-shell-sidebar.c
parentf5460f323b2581af28764b96635b2d3a0f1548c9 (diff)
downloadgsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.tar.gz
gsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.tar.zst
gsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.zip
Utilize the new ESourceSelector:primary-selection property.
Diffstat (limited to 'modules/calendar/e-cal-shell-sidebar.c')
-rw-r--r--modules/calendar/e-cal-shell-sidebar.c45
1 files changed, 13 insertions, 32 deletions
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index 965cc9fa60..66a1102cb7 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -406,31 +406,12 @@ static void
cal_shell_sidebar_primary_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar,
ESourceSelector *selector)
{
- EShell *shell;
- EShellView *shell_view;
- EShellWindow *shell_window;
- EShellSidebar *shell_sidebar;
- EShellSettings *shell_settings;
ESource *source;
- /* XXX ESourceSelector needs a "primary-selection-uid" property
- * so we can just bind the property with GConfBridge. */
-
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
if (source == NULL)
return;
- shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
- shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
- shell_window = e_shell_view_get_shell_window (shell_view);
-
- shell = e_shell_window_get_shell (shell_window);
- shell_settings = e_shell_get_shell_settings (shell);
-
- e_shell_settings_set_string (
- shell_settings, "cal-primary-calendar",
- e_source_peek_uid (source));
-
cal_shell_sidebar_set_default (cal_shell_sidebar, source);
}
@@ -451,7 +432,6 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
GSList *list, *iter;
GObject *object;
const gchar *key;
- gchar *uid;
priv = E_CAL_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
@@ -477,19 +457,20 @@ cal_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
G_CALLBACK (cal_shell_sidebar_primary_selection_changed_cb),
shell_sidebar);
- source = NULL;
- uid = e_shell_settings_get_string (
- shell_settings, "cal-primary-calendar");
- if (uid != NULL)
- source = e_source_list_peek_source_by_uid (source_list, uid);
- if (source == NULL)
- source = e_source_list_peek_source_any (source_list);
- if (source != NULL)
- e_source_selector_set_primary_selection (selector, source);
- g_free (uid);
+ g_object_bind_property_full (
+ shell_settings, "cal-primary-calendar",
+ selector, "primary-selection",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE,
+ (GBindingTransformFunc) e_binding_transform_uid_to_source,
+ (GBindingTransformFunc) e_binding_transform_source_to_uid,
+ g_object_ref (source_list),
+ (GDestroyNotify) g_object_unref);
list = calendar_config_get_calendars_selected ();
for (iter = list; iter != NULL; iter = iter->next) {
+ gchar *uid;
+
uid = iter->data;
source = e_source_list_peek_source_by_uid (source_list, uid);
g_free (uid);
@@ -733,7 +714,7 @@ cal_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
cal_shell_sidebar = E_CAL_SHELL_SIDEBAR (shell_sidebar);
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
if (source != NULL) {
ECal *client;