aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
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
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')
-rw-r--r--modules/calendar/e-cal-attachment-handler.c2
-rw-r--r--modules/calendar/e-cal-shell-sidebar.c45
-rw-r--r--modules/calendar/e-cal-shell-view-actions.c10
-rw-r--r--modules/calendar/e-memo-shell-sidebar.c45
-rw-r--r--modules/calendar/e-memo-shell-view-actions.c10
-rw-r--r--modules/calendar/e-task-shell-sidebar.c45
-rw-r--r--modules/calendar/e-task-shell-view-actions.c10
7 files changed, 55 insertions, 112 deletions
diff --git a/modules/calendar/e-cal-attachment-handler.c b/modules/calendar/e-cal-attachment-handler.c
index 8fd2080769..a9f5237ecc 100644
--- a/modules/calendar/e-cal-attachment-handler.c
+++ b/modules/calendar/e-cal-attachment-handler.c
@@ -296,7 +296,7 @@ attachment_handler_run_dialog (GtkWindow *parent,
if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK)
goto exit;
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
if (source == NULL)
goto exit;
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;
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 16b5ecfb34..bce4fc4266 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -42,7 +42,7 @@ action_calendar_copy_cb (GtkAction *action,
cal_shell_sidebar = cal_shell_view->priv->cal_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);
g_return_if_fail (E_IS_SOURCE (source));
copy_source_dialog (
@@ -84,7 +84,7 @@ action_calendar_delete_cb (GtkAction *action,
cal_shell_sidebar = cal_shell_view->priv->cal_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);
g_return_if_fail (E_IS_SOURCE (source));
/* Ask for confirmation. */
@@ -268,7 +268,7 @@ action_calendar_properties_cb (GtkAction *action,
cal_shell_sidebar = cal_shell_view->priv->cal_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);
g_return_if_fail (E_IS_SOURCE (source));
/* XXX Does this -really- need a source group parameter? */
@@ -370,7 +370,7 @@ action_calendar_refresh_cb (GtkAction *action,
model = e_cal_shell_content_get_model (cal_shell_content);
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);
g_return_if_fail (E_IS_SOURCE (source));
uri = e_source_get_uri (source);
@@ -415,7 +415,7 @@ action_calendar_select_one_cb (GtkAction *action,
cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- primary = e_source_selector_peek_primary_selection (selector);
+ primary = e_source_selector_get_primary_selection (selector);
g_return_if_fail (primary != NULL);
e_source_selector_select_exclusive (selector, primary);
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index f463394fbd..04292af2fd 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -400,31 +400,12 @@ static void
memo_shell_sidebar_primary_selection_changed_cb (EMemoShellSidebar *memo_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 (memo_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-memo-list",
- e_source_peek_uid (source));
-
memo_shell_sidebar_set_default (memo_shell_sidebar, source);
}
@@ -442,7 +423,6 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
ESource *source;
GtkTreeModel *model;
GSList *list, *iter;
- gchar *uid;
priv = E_MEMO_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
@@ -468,19 +448,20 @@ memo_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
G_CALLBACK (memo_shell_sidebar_primary_selection_changed_cb),
shell_sidebar);
- source = NULL;
- uid = e_shell_settings_get_string (
- shell_settings, "cal-primary-memo-list");
- 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-memo-list",
+ 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_memos_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);
@@ -635,7 +616,7 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
memo_shell_sidebar = E_MEMO_SHELL_SIDEBAR (shell_sidebar);
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
if (source != NULL) {
ECal *client;
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index a30d0f1b1f..bebeba1110 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -112,7 +112,7 @@ action_memo_list_copy_cb (GtkAction *action,
memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
g_return_if_fail (E_IS_SOURCE (source));
copy_source_dialog (
@@ -152,7 +152,7 @@ action_memo_list_delete_cb (GtkAction *action,
memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
g_return_if_fail (E_IS_SOURCE (source));
/* Ask for confirmation. */
@@ -249,7 +249,7 @@ action_memo_list_properties_cb (GtkAction *action,
memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
g_return_if_fail (E_IS_SOURCE (source));
calendar_setup_edit_memo_list (GTK_WINDOW (shell_window), source);
@@ -274,7 +274,7 @@ action_memo_list_refresh_cb (GtkAction *action,
model = e_memo_shell_content_get_memo_model (memo_shell_content);
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
g_return_if_fail (E_IS_SOURCE (source));
uri = e_source_get_uri (source);
@@ -319,7 +319,7 @@ action_memo_list_select_one_cb (GtkAction *action,
memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
- primary = e_source_selector_peek_primary_selection (selector);
+ primary = e_source_selector_get_primary_selection (selector);
g_return_if_fail (primary != NULL);
e_source_selector_select_exclusive (selector, primary);
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index b50e463e8a..580cee286f 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -400,31 +400,12 @@ static void
task_shell_sidebar_primary_selection_changed_cb (ETaskShellSidebar *task_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 (task_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-task-list",
- e_source_peek_uid (source));
-
task_shell_sidebar_set_default (task_shell_sidebar, source);
}
@@ -442,7 +423,6 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
ESource *source;
GtkTreeModel *model;
GSList *list, *iter;
- gchar *uid;
priv = E_TASK_SHELL_SIDEBAR_GET_PRIVATE (shell_sidebar);
@@ -468,19 +448,20 @@ task_shell_sidebar_restore_state_cb (EShellWindow *shell_window,
G_CALLBACK (task_shell_sidebar_primary_selection_changed_cb),
shell_sidebar);
- source = NULL;
- uid = e_shell_settings_get_string (
- shell_settings, "cal-primary-task-list");
- 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-task-list",
+ 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_tasks_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);
@@ -635,7 +616,7 @@ task_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
task_shell_sidebar = E_TASK_SHELL_SIDEBAR (shell_sidebar);
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
if (source != NULL) {
ECal *client;
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index b792c829bc..8ab9082ee0 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -135,7 +135,7 @@ action_task_list_copy_cb (GtkAction *action,
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
g_return_if_fail (E_IS_SOURCE (source));
copy_source_dialog (
@@ -175,7 +175,7 @@ action_task_list_delete_cb (GtkAction *action,
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
g_return_if_fail (E_IS_SOURCE (source));
/* Ask for confirmation. */
@@ -272,7 +272,7 @@ action_task_list_properties_cb (GtkAction *action,
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
g_return_if_fail (E_IS_SOURCE (source));
calendar_setup_edit_task_list (GTK_WINDOW (shell_window), source);
@@ -297,7 +297,7 @@ action_task_list_refresh_cb (GtkAction *action,
model = e_task_shell_content_get_task_model (task_shell_content);
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
g_return_if_fail (E_IS_SOURCE (source));
uri = e_source_get_uri (source);
@@ -342,7 +342,7 @@ action_task_list_select_one_cb (GtkAction *action,
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
- primary = e_source_selector_peek_primary_selection (selector);
+ primary = e_source_selector_get_primary_selection (selector);
g_return_if_fail (primary != NULL);
e_source_selector_select_exclusive (selector, primary);