aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-08-08 09:43:09 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-09 09:03:18 +0800
commit3b0699fc304d0f4aecb261d19869de221f5d6abf (patch)
treeeb434f85371c9d5ae75a8425fc622c31e08baa5b /modules/calendar
parent65695ae516532a4b6e129a0703b1056a3996de0c (diff)
downloadgsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.tar.gz
gsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.tar.zst
gsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.zip
More refactoring of settings management.
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-cal-shell-settings.c18
-rw-r--r--modules/calendar/e-cal-shell-sidebar.c3
-rw-r--r--modules/calendar/e-memo-shell-content.c17
-rw-r--r--modules/calendar/e-memo-shell-sidebar.c50
-rw-r--r--modules/calendar/e-memo-shell-sidebar.h2
-rw-r--r--modules/calendar/e-memo-shell-view-private.c37
-rw-r--r--modules/calendar/e-memo-shell-view-private.h2
-rw-r--r--modules/calendar/e-task-shell-content.c8
-rw-r--r--modules/calendar/e-task-shell-view-private.c5
9 files changed, 87 insertions, 55 deletions
diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c
index dbb11ff0f9..4d75bae4e9 100644
--- a/modules/calendar/e-cal-shell-settings.c
+++ b/modules/calendar/e-cal-shell-settings.c
@@ -489,14 +489,14 @@ e_cal_shell_backend_init_settings (EShell *shell)
"/apps/evolution/calendar/prompts/confirm_purge");
e_shell_settings_install_property_for_key (
- "cal-date-navigator-show-week-numbers",
- "/apps/evolution/calendar/date_navigator/show_week_numbers");
-
- e_shell_settings_install_property_for_key (
"cal-day-view-show-week-numbers",
"/apps/evolution/calendar/display/day_view_show_week_number");
e_shell_settings_install_property_for_key (
+ "cal-free-busy-template",
+ "/apps/evolution/calendar/publish/template");
+
+ e_shell_settings_install_property_for_key (
"cal-hide-completed-tasks",
"/apps/evolution/calendar/tasks/hide_completed");
@@ -529,6 +529,10 @@ e_cal_shell_backend_init_settings (EShell *shell)
"/apps/evolution/calendar/display/show_event_end");
e_shell_settings_install_property_for_key (
+ "cal-show-week-numbers",
+ "/apps/evolution/calendar/date_navigator/show_week_numbers");
+
+ e_shell_settings_install_property_for_key (
"cal-tasks-color-due-today",
"/apps/evolution/calendar/tasks/colors/due_today");
@@ -597,7 +601,8 @@ e_cal_shell_backend_init_settings (EShell *shell)
G_OBJECT (shell_settings), "cal-timezone",
transform_string_to_icaltimezone,
transform_icaltimezone_to_string,
- (GDestroyNotify) NULL, shell_settings);
+ (GDestroyNotify) g_object_unref,
+ g_object_ref (shell_settings));
e_shell_settings_install_property (
g_param_spec_int (
@@ -722,5 +727,6 @@ e_cal_shell_backend_init_settings (EShell *shell)
G_OBJECT (shell_settings), "cal-working-days-saturday",
transform_working_days_bitset_to_saturday,
transform_working_days_saturday_to_bitset,
- (GDestroyNotify) NULL, shell_settings);
+ (GDestroyNotify) g_object_unref,
+ g_object_ref (shell_settings));
}
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index 6fb35e1588..28f96e553d 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -440,8 +440,7 @@ cal_shell_sidebar_constructed (GObject *object)
gtk_widget_show (widget);
e_binding_new (
- G_OBJECT (shell_settings),
- "cal-date-navigator-show-week-numbers",
+ G_OBJECT (shell_settings), "cal-show-week-numbers",
G_OBJECT (calitem), "show-week-numbers");
e_binding_new (
diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c
index ece6eb694a..3a7ee78718 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-shell-content.c
@@ -25,7 +25,6 @@
#include "e-util/gconf-bridge.h"
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/comp-util.h"
#include "calendar/gui/e-cal-model-memos.h"
#include "calendar/gui/e-memo-table.h"
@@ -353,11 +352,12 @@ memo_shell_content_constructed (GObject *object)
{
EMemoShellContentPrivate *priv;
EShell *shell;
+ EShellView *shell_view;
EShellSettings *shell_settings;
+ EShellBackend *shell_backend;
EShellContent *shell_content;
- EShellWindow *shell_window;
- EShellView *shell_view;
GalViewInstance *view_instance;
+ icaltimezone *timezone;
ETable *table;
GConfBridge *bridge;
GtkWidget *container;
@@ -371,12 +371,16 @@ memo_shell_content_constructed (GObject *object)
shell_content = E_SHELL_CONTENT (object);
shell_view = e_shell_content_get_shell_view (shell_content);
- shell_window = e_shell_view_get_shell_window (shell_view);
- shell = e_shell_window_get_shell (shell_window);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
priv->memo_model = e_cal_model_memos_new (shell_settings);
+ timezone = e_shell_settings_get_pointer (
+ shell_settings, "cal-timezone");
+
/* Build content widgets. */
container = GTK_WIDGET (object);
@@ -406,8 +410,7 @@ memo_shell_content_constructed (GObject *object)
widget = e_cal_component_preview_new ();
e_cal_component_preview_set_default_timezone (
- E_CAL_COMPONENT_PREVIEW (widget),
- calendar_config_get_icaltimezone ());
+ E_CAL_COMPONENT_PREVIEW (widget), timezone);
gtk_container_add (GTK_CONTAINER (container), widget);
priv->memo_preview = g_object_ref (widget);
gtk_widget_show (widget);
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index ca5d05c40b..0962a8a20d 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -25,6 +25,7 @@
#include <glib/gi18n.h>
#include <libecal/e-cal.h>
+#include "e-util/e-binding.h"
#include "e-util/e-error.h"
#include "e-util/e-util.h"
#include "calendar/common/authentication.h"
@@ -41,6 +42,7 @@
struct _EMemoShellSidebarPrivate {
GtkWidget *selector;
+ icaltimezone *timezone;
/* UID -> Client */
GHashTable *client_table;
@@ -90,33 +92,6 @@ memo_shell_sidebar_emit_status_message (EMemoShellSidebar *memo_shell_sidebar,
}
static void
-memo_shell_sidebar_update_timezone (EMemoShellSidebar *memo_shell_sidebar)
-{
- GHashTable *client_table;
- icaltimezone *zone;
- GList *values;
-
- zone = calendar_config_get_icaltimezone ();
- client_table = memo_shell_sidebar->priv->client_table;
- values = g_hash_table_get_values (client_table);
-
- while (values != NULL) {
- ECal *client = values->data;
-
- if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
- e_cal_set_default_timezone (client, zone, NULL);
-
- values = g_list_delete_link (values, values);
- }
-
- /* XXX Need to call e_cal_component_preview_set_default_timezone()
- * here but the sidebar is not really supposed to access content
- * stuff. I guess we could emit an "update-timezone" signal
- * here, but that feels wrong. Maybe this whole thing should
- * be in EMemoShellView instead. */
-}
-
-static void
memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
ECal *client)
{
@@ -483,13 +458,6 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
}
static void
-memo_shell_sidebar_client_added (EMemoShellSidebar *memo_shell_sidebar,
- ECal *client)
-{
- memo_shell_sidebar_update_timezone (memo_shell_sidebar);
-}
-
-static void
memo_shell_sidebar_client_removed (EMemoShellSidebar *memo_shell_sidebar,
ECal *client)
{
@@ -532,7 +500,6 @@ memo_shell_sidebar_class_init (EMemoShellSidebarClass *class)
shell_sidebar_class = E_SHELL_SIDEBAR_CLASS (class);
shell_sidebar_class->check_state = memo_shell_sidebar_check_state;
- class->client_added = memo_shell_sidebar_client_added;
class->client_removed = memo_shell_sidebar_client_removed;
g_object_class_install_property (
@@ -632,6 +599,19 @@ e_memo_shell_sidebar_new (EShellView *shell_view)
"shell-view", shell_view, NULL);
}
+GList *
+e_memo_shell_sidebar_get_clients (EMemoShellSidebar *memo_shell_sidebar)
+{
+ GHashTable *client_table;
+
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_SIDEBAR (memo_shell_sidebar), NULL);
+
+ client_table = memo_shell_sidebar->priv->client_table;
+
+ return g_hash_table_get_values (client_table);
+}
+
ESourceSelector *
e_memo_shell_sidebar_get_selector (EMemoShellSidebar *memo_shell_sidebar)
{
diff --git a/modules/calendar/e-memo-shell-sidebar.h b/modules/calendar/e-memo-shell-sidebar.h
index 665c8f218a..068d7436bc 100644
--- a/modules/calendar/e-memo-shell-sidebar.h
+++ b/modules/calendar/e-memo-shell-sidebar.h
@@ -80,6 +80,8 @@ GType e_memo_shell_sidebar_get_type (void);
void e_memo_shell_sidebar_register_type
(GTypeModule *type_module);
GtkWidget * e_memo_shell_sidebar_new(EShellView *shell_view);
+GList * e_memo_shell_sidebar_get_clients
+ (EMemoShellSidebar *memo_shell_sidebar);
ESourceSelector *
e_memo_shell_sidebar_get_selector
(EMemoShellSidebar *memo_shell_sidebar);
diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c
index 4953a388d3..da321d5c19 100644
--- a/modules/calendar/e-memo-shell-view-private.c
+++ b/modules/calendar/e-memo-shell-view-private.c
@@ -67,6 +67,7 @@ memo_shell_view_selector_client_added_cb (EMemoShellView *memo_shell_view,
model = e_memo_table_get_model (memo_table);
e_cal_model_add_client (model, client);
+ e_memo_shell_view_update_timezone (memo_shell_view);
}
static void
@@ -198,6 +199,11 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
g_signal_connect_swapped (
+ model, "notify::timezone",
+ G_CALLBACK (e_memo_shell_view_update_timezone),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
memo_table, "open-component",
G_CALLBACK (e_memo_shell_view_open_memo),
memo_shell_view);
@@ -269,6 +275,7 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
e_memo_shell_view_actions_init (memo_shell_view);
e_memo_shell_view_update_sidebar (memo_shell_view);
e_memo_shell_view_update_search_filter (memo_shell_view);
+ e_memo_shell_view_update_timezone (memo_shell_view);
e_memo_shell_view_execute_search (memo_shell_view);
}
@@ -522,3 +529,33 @@ e_memo_shell_view_update_sidebar (EMemoShellView *memo_shell_view)
g_string_free (string, TRUE);
}
+
+void
+e_memo_shell_view_update_timezone (EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoShellSidebar *memo_shell_sidebar;
+ ECalComponentPreview *memo_preview;
+ icaltimezone *timezone;
+ ECalModel *model;
+ GList *clients, *iter;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_preview = e_memo_shell_content_get_memo_preview (memo_shell_content);
+ model = e_memo_shell_content_get_memo_model (memo_shell_content);
+ timezone = e_cal_model_get_timezone (model);
+
+ memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
+ clients = e_memo_shell_sidebar_get_clients (memo_shell_sidebar);
+
+ for (iter = clients; iter != NULL; iter = iter->next) {
+ ECal *client = iter->data;
+
+ if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
+ e_cal_set_default_timezone (client, timezone, NULL);
+ }
+
+ e_cal_component_preview_set_default_timezone (memo_preview, timezone);
+
+ g_list_free (clients);
+}
diff --git a/modules/calendar/e-memo-shell-view-private.h b/modules/calendar/e-memo-shell-view-private.h
index c41eaed7c0..c7ece91f68 100644
--- a/modules/calendar/e-memo-shell-view-private.h
+++ b/modules/calendar/e-memo-shell-view-private.h
@@ -120,6 +120,8 @@ void e_memo_shell_view_update_sidebar
(EMemoShellView *memo_shell_view);
void e_memo_shell_view_update_search_filter
(EMemoShellView *memo_shell_view);
+void e_memo_shell_view_update_timezone
+ (EMemoShellView *memo_shell_view);
G_END_DECLS
diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c
index 8a4e0f1442..88e5e4d856 100644
--- a/modules/calendar/e-task-shell-content.c
+++ b/modules/calendar/e-task-shell-content.c
@@ -26,7 +26,6 @@
#include "e-util/e-binding.h"
#include "e-util/gconf-bridge.h"
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/comp-util.h"
#include "calendar/gui/e-cal-model-tasks.h"
#include "calendar/gui/e-calendar-table.h"
@@ -358,6 +357,7 @@ task_shell_content_constructed (GObject *object)
EShellWindow *shell_window;
EShellView *shell_view;
GalViewInstance *view_instance;
+ icaltimezone *timezone;
ETable *table;
GConfBridge *bridge;
GtkWidget *container;
@@ -377,6 +377,9 @@ task_shell_content_constructed (GObject *object)
priv->task_model = e_cal_model_tasks_new (shell_settings);
+ timezone = e_shell_settings_get_pointer (
+ shell_settings, "cal-timezone");
+
/* Build content widgets. */
container = GTK_WIDGET (object);
@@ -406,8 +409,7 @@ task_shell_content_constructed (GObject *object)
widget = e_cal_component_preview_new ();
e_cal_component_preview_set_default_timezone (
- E_CAL_COMPONENT_PREVIEW (widget),
- calendar_config_get_icaltimezone ());
+ E_CAL_COMPONENT_PREVIEW (widget), timezone);
gtk_container_add (GTK_CONTAINER (container), widget);
priv->task_preview = g_object_ref (widget);
gtk_widget_show (widget);
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 1cbadcb53c..38c5ab6033 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -704,16 +704,17 @@ e_task_shell_view_update_timezone (ETaskShellView *task_shell_view)
ETaskShellSidebar *task_shell_sidebar;
ECalComponentPreview *task_preview;
icaltimezone *timezone;
+ ECalModel *model;
GList *clients, *iter;
task_shell_content = task_shell_view->priv->task_shell_content;
task_preview = e_task_shell_content_get_task_preview (task_shell_content);
+ model = e_task_shell_content_get_task_model (task_shell_content);
+ timezone = e_cal_model_get_timezone (model);
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
clients = e_task_shell_sidebar_get_clients (task_shell_sidebar);
- timezone = calendar_config_get_icaltimezone ();
-
for (iter = clients; iter != NULL; iter = iter->next) {
ECal *client = iter->data;