aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@novell.com>2010-04-22 00:06:38 +0800
committerMichael Meeks <michael.meeks@novell.com>2010-04-22 00:06:38 +0800
commita84b1a325147e6321b90f491a1dc686e588869dc (patch)
tree409a66488e99ed288c9ff2b4eb90f1993ae537ab /modules
parente9c4388490925de25b029fa0d6437a34a6386c05 (diff)
parentece7dcdcea82d0e1fbc104cf48b2928a449b8748 (diff)
downloadgsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.tar
gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.tar.gz
gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.tar.bz2
gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.tar.lz
gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.tar.xz
gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.tar.zst
gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.zip
Merge commit 'origin/gnome-2-30' into express2
Diffstat (limited to 'modules')
-rw-r--r--modules/calendar/e-cal-shell-view-private.c85
-rw-r--r--modules/calendar/e-cal-shell-view-private.h4
-rw-r--r--modules/mail/e-mail-shell-view-private.c1
3 files changed, 89 insertions, 1 deletions
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 1c9c26840c..4730ca004b 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -26,6 +26,16 @@
#include "calendar/gui/calendar-view-factory.h"
#include "widgets/menus/gal-view-factory-etable.h"
+#define CHECK_NB 5
+
+static const gchar * files_to_check [CHECK_NB] = {
+ ETC_TIMEZONE,
+ ETC_TIMEZONE_MAJ,
+ ETC_SYSCONFIG_CLOCK,
+ ETC_CONF_D_CLOCK,
+ ETC_LOCALTIME
+};
+
static void
cal_shell_view_process_completed_tasks (ECalShellView *cal_shell_view,
gboolean config_changed)
@@ -416,6 +426,72 @@ e_cal_shell_view_private_init (ECalShellView *cal_shell_view,
G_CALLBACK (cal_shell_view_notify_view_id_cb), NULL);
}
+
+static void
+system_timezone_monitor_changed (GFileMonitor *handle,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event,
+ gpointer user_data)
+{
+ ECalShellView *view = E_CAL_SHELL_VIEW (user_data);
+ ECalShellViewPrivate *priv = view->priv;
+ ECalShellContent *cal_shell_content;
+ icaltimezone *timezone = NULL, *current_zone = NULL;
+ EShellSettings *settings;
+ EShellBackend *shell_backend;
+ EShell *shell;
+ ECalModel *model;
+ const gchar *location;
+
+ if (event != G_FILE_MONITOR_EVENT_CHANGED &&
+ event != G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT &&
+ event != G_FILE_MONITOR_EVENT_DELETED &&
+ event != G_FILE_MONITOR_EVENT_CREATED)
+ return;
+
+ cal_shell_content = priv->cal_shell_content;
+ model = e_cal_shell_content_get_model (cal_shell_content);
+ current_zone = e_cal_model_get_timezone (model);
+ timezone = e_cal_util_get_system_timezone ();
+
+ if (!g_strcmp0 (icaltimezone_get_tzid (timezone), icaltimezone_get_tzid (current_zone)))
+ return;
+
+ shell_backend = e_shell_view_get_shell_backend ((EShellView *) view);
+ shell = e_shell_backend_get_shell (shell_backend);
+ settings = e_shell_get_shell_settings (shell);
+ location = icaltimezone_get_location (timezone);
+ if (location == NULL)
+ location = "UTC";
+
+ g_object_set (settings, "cal-timezone-string", location, NULL);
+ g_object_set (settings, "cal-timezone", timezone, NULL);
+}
+
+static void
+init_timezone_monitors (ECalShellView *view)
+{
+ ECalShellViewPrivate *priv = view->priv;
+ gint i;
+
+ for (i = 0; i < CHECK_NB; i++) {
+ GFile *file;
+
+ file = g_file_new_for_path (files_to_check[i]);
+ priv->monitors[i] = g_file_monitor_file (file,
+ G_FILE_MONITOR_NONE,
+ NULL, NULL);
+ g_object_unref (file);
+
+ if (priv->monitors[i])
+ g_signal_connect (G_OBJECT (priv->monitors[i]),
+ "changed",
+ G_CALLBACK (system_timezone_monitor_changed),
+ view);
+ }
+}
+
void
e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
{
@@ -575,6 +651,7 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
(GHookFunc) e_cal_shell_view_update_search_filter,
cal_shell_view);
+ init_timezone_monitors (cal_shell_view);
e_cal_shell_view_actions_init (cal_shell_view);
e_cal_shell_view_update_sidebar (cal_shell_view);
e_cal_shell_view_update_search_filter (cal_shell_view);
@@ -598,6 +675,7 @@ void
e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view)
{
ECalShellViewPrivate *priv = cal_shell_view->priv;
+ gint i;
/* Calling calendar's save state from here, because it is too late in its dispose */
if (priv->cal_shell_content)
@@ -627,6 +705,11 @@ e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view)
g_object_unref (priv->taskpad_activity);
priv->taskpad_activity = NULL;
}
+
+ for (i = 0; i < CHECK_NB; i++) {
+ g_object_unref (priv->monitors[i]);
+ priv->monitors[i] = NULL;
+ }
}
void
@@ -988,7 +1071,7 @@ e_cal_shell_view_update_timezone (ECalShellView *cal_shell_view)
cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
clients = e_cal_shell_sidebar_get_clients (cal_shell_sidebar);
-
+
for (iter = clients; iter != NULL; iter = iter->next) {
ECal *client = iter->data;
diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h
index c69ffc7605..71a191f332 100644
--- a/modules/calendar/e-cal-shell-view-private.h
+++ b/modules/calendar/e-cal-shell-view-private.h
@@ -27,6 +27,7 @@
#include <string.h>
#include <glib/gi18n.h>
#include <libecal/e-cal-time-util.h>
+#include <libecal/e-cal-system-timezone.h>
#include <libedataserver/e-categories.h>
#include <libedataserver/e-data-server-util.h>
#include <libedataserver/e-sexp.h>
@@ -81,6 +82,7 @@
/* ETable Specifications */
#define ETSPEC_FILENAME "e-calendar-table.etspec"
+#define CHECK_NB 5
G_BEGIN_DECLS
@@ -114,6 +116,8 @@ struct _ECalShellViewPrivate {
EActivity *calendar_activity;
EActivity *memopad_activity;
EActivity *taskpad_activity;
+
+ GFileMonitor *monitors[CHECK_NB];
};
void e_cal_shell_view_private_init
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 00dcb2ff1d..2cc46da1b7 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -475,6 +475,7 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view)
mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar);
folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar);
+ em_folder_tree_set_selectable_widget (folder_tree, message_list);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree));
mail_shell_content = E_MAIL_SHELL_CONTENT (shell_content);