aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-cal-shell-content.c118
-rw-r--r--modules/calendar/e-cal-shell-content.h4
-rw-r--r--modules/calendar/e-cal-shell-settings.c638
-rw-r--r--modules/calendar/e-cal-shell-sidebar.c45
-rw-r--r--modules/calendar/e-cal-shell-sidebar.h2
-rw-r--r--modules/calendar/e-cal-shell-view-private.c92
-rw-r--r--modules/calendar/e-cal-shell-view-private.h3
-rw-r--r--modules/calendar/e-memo-shell-content.c20
-rw-r--r--modules/calendar/e-task-shell-content.c21
-rw-r--r--modules/calendar/e-task-shell-view-actions.c6
-rw-r--r--modules/calendar/e-task-shell-view-private.c65
-rw-r--r--modules/calendar/e-task-shell-view-private.h3
-rw-r--r--modules/calendar/e-task-shell-view.c70
-rw-r--r--modules/calendar/e-task-shell-view.h5
14 files changed, 840 insertions, 252 deletions
diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c
index a688c27d0e..efc67af1fa 100644
--- a/modules/calendar/e-cal-shell-content.c
+++ b/modules/calendar/e-cal-shell-content.c
@@ -32,9 +32,7 @@
#include "calendar/gui/e-cal-list-view.h"
#include "calendar/gui/e-cal-model-calendar.h"
#include "calendar/gui/e-calendar-table.h"
-#include "calendar/gui/e-calendar-table-config.h"
#include "calendar/gui/e-calendar-view.h"
-#include "calendar/gui/e-memo-table-config.h"
#include "widgets/menus/gal-view-etable.h"
@@ -51,9 +49,6 @@ struct _ECalShellContentPrivate {
GtkWidget *task_table;
GtkWidget *memo_table;
- ECalendarTableConfig *task_table_config;
- EMemoTableConfig *memo_table_config;
-
GalViewInstance *view_instance;
guint paned_binding_id;
@@ -74,19 +69,6 @@ typedef enum {
static gpointer parent_class;
static GType cal_shell_content_type;
-static gboolean
-transform_week_start_day (const GValue *src_value,
- GValue *dst_value)
-{
- gint v_int;
-
- /* Transform day numbering from 0 = Sunday to 0 = Monday. */
- v_int = g_value_get_int (src_value);
- g_value_set_int (dst_value, (v_int + 6) % 7);
-
- return TRUE;
-}
-
static void
cal_shell_content_display_view_cb (ECalShellContent *cal_shell_content,
GalView *gal_view)
@@ -277,16 +259,6 @@ cal_shell_content_dispose (GObject *object)
priv->memo_table = NULL;
}
- if (priv->task_table_config != NULL) {
- g_object_unref (priv->task_table_config);
- priv->task_table_config = NULL;
- }
-
- if (priv->memo_table_config != NULL) {
- g_object_unref (priv->memo_table_config);
- priv->memo_table_config = NULL;
- }
-
if (priv->view_instance != NULL) {
g_object_unref (priv->view_instance);
priv->view_instance = NULL;
@@ -312,7 +284,6 @@ cal_shell_content_constructed (GObject *object)
{
ECalShellContentPrivate *priv;
ECalendarView *calendar_view;
- ECalModel *calendar_model;
ECalModel *memo_model;
ECalModel *task_model;
EShell *shell;
@@ -394,6 +365,10 @@ cal_shell_content_constructed (GObject *object)
/* Add views in the order defined by GnomeCalendarViewType, such
* that the notebook page number corresponds to the view type. */
+ /* XXX GnomeCalendar is a widget, but we don't pack it.
+ * Maybe it should just be a GObject instead? */
+ priv->calendar = gnome_calendar_new (shell_settings);
+ g_object_ref_sink (priv->calendar);
calendar = GNOME_CALENDAR (priv->calendar);
for (ii = 0; ii < GNOME_CAL_LAST_VIEW; ii++) {
@@ -457,12 +432,6 @@ cal_shell_content_constructed (GObject *object)
e_memo_table_load_state (E_MEMO_TABLE (widget), filename);
g_free (filename);
- /* Configuration managers for task and memo tables. */
- priv->task_table_config = e_calendar_table_config_new (
- E_CALENDAR_TABLE (priv->task_table));
- priv->memo_table_config = e_memo_table_config_new (
- E_MEMO_TABLE (priv->memo_table));
-
/* Load the view instance. */
view_instance = e_shell_view_new_view_instance (shell_view, NULL);
@@ -507,12 +476,6 @@ cal_shell_content_constructed (GObject *object)
G_OBJECT (shell_settings), "cal-time-divisions",
G_OBJECT (calendar_view), "mins-per-row");
- e_binding_new_full (
- G_OBJECT (shell_settings), "cal-week-start-day",
- G_OBJECT (calendar_view), "week-start-day",
- (EBindingTransform) transform_week_start_day,
- (GDestroyNotify) NULL, NULL);
-
e_binding_new (
G_OBJECT (shell_settings), "cal-work-day-end-hour",
G_OBJECT (calendar_view), "work-day-end-hour");
@@ -530,7 +493,7 @@ cal_shell_content_constructed (GObject *object)
G_OBJECT (calendar_view), "work-day-start-minute");
e_binding_new (
- G_OBJECT (shell_settings), "cal-working-days",
+ G_OBJECT (shell_settings), "cal-working-days-bitset",
G_OBJECT (calendar_view), "working-days");
/* Bind work week view properties to EShellSettings. */
@@ -554,12 +517,6 @@ cal_shell_content_constructed (GObject *object)
G_OBJECT (shell_settings), "cal-time-divisions",
G_OBJECT (calendar_view), "mins-per-row");
- e_binding_new_full (
- G_OBJECT (shell_settings), "cal-week-start-day",
- G_OBJECT (calendar_view), "week-start-day",
- (EBindingTransform) transform_week_start_day,
- (GDestroyNotify) NULL, NULL);
-
e_binding_new (
G_OBJECT (shell_settings), "cal-work-day-end-hour",
G_OBJECT (calendar_view), "work-day-end-hour");
@@ -593,12 +550,6 @@ cal_shell_content_constructed (GObject *object)
G_OBJECT (shell_settings), "cal-show-event-end-times",
G_OBJECT (calendar_view), "show-event-end-times");
- e_binding_new_full (
- G_OBJECT (shell_settings), "cal-week-start-day",
- G_OBJECT (calendar_view), "week-start-day",
- (EBindingTransform) transform_week_start_day,
- (GDestroyNotify) NULL, NULL);
-
/* Bind month view properties to EShellSettings. */
view_type = GNOME_CAL_MONTH_VIEW;
@@ -612,22 +563,6 @@ cal_shell_content_constructed (GObject *object)
G_OBJECT (shell_settings), "cal-show-event-end-times",
G_OBJECT (calendar_view), "show-event-end-times");
- e_binding_new_full (
- G_OBJECT (shell_settings), "cal-week-start-day",
- G_OBJECT (calendar_view), "week-start-day",
- (EBindingTransform) transform_week_start_day,
- (GDestroyNotify) NULL, NULL);
-
- /* Bind calendar model properties to EShellSettings.
- * Note, does not matter from which view we get the
- * model, since it's shared across all of them. */
-
- calendar_model = e_calendar_view_get_model (calendar_view);
-
- e_binding_new (
- G_OBJECT (shell_settings), "cal-use-24-hour-format",
- G_OBJECT (calendar_model), "use-24-hour-format");
-
g_object_unref (memo_model);
g_object_unref (task_model);
}
@@ -654,11 +589,6 @@ cal_shell_content_init (ECalShellContent *cal_shell_content)
cal_shell_content->priv =
E_CAL_SHELL_CONTENT_GET_PRIVATE (cal_shell_content);
- /* XXX GnomeCalendar is a widget, but we don't pack it.
- * Maybe it should just be a GObject instead? */
- cal_shell_content->priv->calendar = gnome_calendar_new ();
- g_object_ref_sink (cal_shell_content->priv->calendar);
-
/* Postpone widget construction until we have a shell view. */
}
@@ -699,15 +629,26 @@ e_cal_shell_content_new (EShellView *shell_view)
"shell-view", shell_view, NULL);
}
+ECalModel *
+e_cal_shell_content_get_model (ECalShellContent *cal_shell_content)
+{
+ GnomeCalendar *calendar;
+
+ g_return_val_if_fail (
+ E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
+
+ calendar = e_cal_shell_content_get_calendar (cal_shell_content);
+
+ return gnome_calendar_get_calendar_model (calendar);
+}
+
GnomeCalendar *
e_cal_shell_content_get_calendar (ECalShellContent *cal_shell_content)
{
g_return_val_if_fail (
E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
- /* FIXME */
- /*return GNOME_CALENDAR (cal_shell_content->priv->calendar);*/
- return NULL;
+ return GNOME_CALENDAR (cal_shell_content->priv->calendar);
}
EMemoTable *
@@ -728,17 +669,6 @@ e_cal_shell_content_get_task_table (ECalShellContent *cal_shell_content)
return E_CALENDAR_TABLE (cal_shell_content->priv->task_table);
}
-icaltimezone *
-e_cal_shell_content_get_timezone (ECalShellContent *cal_shell_content)
-{
- g_return_val_if_fail (
- E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
-
- /* FIXME */
- /*return cal_shell_content->priv->timezone;*/
- return NULL;
-}
-
GalViewInstance *
e_cal_shell_content_get_view_instance (ECalShellContent *cal_shell_content)
{
@@ -751,7 +681,6 @@ e_cal_shell_content_get_view_instance (ECalShellContent *cal_shell_content)
void
e_cal_shell_content_copy_clipboard (ECalShellContent *cal_shell_content)
{
-#if 0
GnomeCalendar *calendar;
EMemoTable *memo_table;
ECalendarTable *task_table;
@@ -778,13 +707,11 @@ e_cal_shell_content_copy_clipboard (ECalShellContent *cal_shell_content)
default:
g_return_if_reached ();
}
-#endif
}
void
e_cal_shell_content_cut_clipboard (ECalShellContent *cal_shell_content)
{
-#if 0
GnomeCalendar *calendar;
EMemoTable *memo_table;
ECalendarTable *task_table;
@@ -811,13 +738,11 @@ e_cal_shell_content_cut_clipboard (ECalShellContent *cal_shell_content)
default:
g_return_if_reached ();
}
-#endif
}
void
e_cal_shell_content_paste_clipboard (ECalShellContent *cal_shell_content)
{
-#if 0
GnomeCalendar *calendar;
EMemoTable *memo_table;
ECalendarTable *task_table;
@@ -844,13 +769,11 @@ e_cal_shell_content_paste_clipboard (ECalShellContent *cal_shell_content)
default:
g_return_if_reached ();
}
-#endif
}
void
e_cal_shell_content_delete_selection (ECalShellContent *cal_shell_content)
{
-#if 0
GnomeCalendar *calendar;
EMemoTable *memo_table;
ECalendarTable *task_table;
@@ -877,13 +800,11 @@ e_cal_shell_content_delete_selection (ECalShellContent *cal_shell_content)
default:
g_return_if_reached ();
}
-#endif
}
void
e_cal_shell_content_delete_selected_occurrence (ECalShellContent *cal_shell_content)
{
-#if 0
GnomeCalendar *calendar;
FocusLocation focus;
@@ -894,5 +815,4 @@ e_cal_shell_content_delete_selected_occurrence (ECalShellContent *cal_shell_cont
if (focus == FOCUS_CALENDAR)
gnome_calendar_delete_selected_occurrence (calendar);
-#endif
}
diff --git a/modules/calendar/e-cal-shell-content.h b/modules/calendar/e-cal-shell-content.h
index 44e13f733c..3db7d33260 100644
--- a/modules/calendar/e-cal-shell-content.h
+++ b/modules/calendar/e-cal-shell-content.h
@@ -81,14 +81,14 @@ GType e_cal_shell_content_get_type (void);
void e_cal_shell_content_register_type
(GTypeModule *type_module);
GtkWidget * e_cal_shell_content_new (EShellView *shell_view);
+ECalModel * e_cal_shell_content_get_model
+ (ECalShellContent *cal_shell_content);
GnomeCalendar * e_cal_shell_content_get_calendar
(ECalShellContent *cal_shell_content);
EMemoTable * e_cal_shell_content_get_memo_table
(ECalShellContent *cal_shell_content);
ECalendarTable *e_cal_shell_content_get_task_table
(ECalShellContent *cal_shell_content);
-icaltimezone * e_cal_shell_content_get_timezone
- (ECalShellContent *cal_shell_content);
GalViewInstance *
e_cal_shell_content_get_view_instance
(ECalShellContent *cal_shell_content);
diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c
index 39581a5181..dbb11ff0f9 100644
--- a/modules/calendar/e-cal-shell-settings.c
+++ b/modules/calendar/e-cal-shell-settings.c
@@ -22,6 +22,452 @@
#include "e-cal-shell-settings.h"
#include <gconf/gconf-client.h>
+#include <libecal/e-cal-util.h>
+
+static gboolean
+transform_string_to_icaltimezone (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ EShellSettings *shell_settings;
+ gboolean use_system_timezone;
+ const gchar *location = NULL;
+ icaltimezone *timezone = NULL;
+
+ shell_settings = E_SHELL_SETTINGS (user_data);
+
+ use_system_timezone = e_shell_settings_get_boolean (
+ shell_settings, "cal-use-system-timezone");
+
+ if (use_system_timezone)
+ timezone = e_cal_util_get_system_timezone ();
+ else
+ location = g_value_get_string (src_value);
+
+ if (location != NULL && *location != '\0')
+ timezone = icaltimezone_get_builtin_timezone (location);
+
+ if (timezone == NULL)
+ timezone = icaltimezone_get_utc_timezone ();
+
+ g_value_set_pointer (dst_value, timezone);
+
+ return TRUE;
+}
+
+static gboolean
+transform_icaltimezone_to_string (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ const gchar *location = NULL;
+ icaltimezone *timezone;
+
+ timezone = g_value_get_pointer (src_value);
+
+ if (timezone != NULL)
+ location = icaltimezone_get_location (timezone);
+
+ if (location == NULL)
+ location = "UTC";
+
+ g_value_set_string (dst_value, location);
+
+ return TRUE;
+}
+
+static gboolean
+transform_weekdays_gconf_to_evolution (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ GDateWeekday weekday;
+
+ /* XXX At some point, Evolution changed its weekday numbering
+ * from 0 = Sunday to 0 = Monday, but did not migrate the
+ * "week_start_day" key. Both enumerations are of course
+ * different from GDateWeekday. We should have saved the
+ * weekday as a string instead. */
+
+ /* This is purposefully verbose for better readability. */
+
+ /* GConf numbering */
+ switch (g_value_get_int (src_value)) {
+ case 0:
+ weekday = G_DATE_SUNDAY;
+ break;
+ case 1:
+ weekday = G_DATE_MONDAY;
+ break;
+ case 2:
+ weekday = G_DATE_TUESDAY;
+ break;
+ case 3:
+ weekday = G_DATE_WEDNESDAY;
+ break;
+ case 4:
+ weekday = G_DATE_THURSDAY;
+ break;
+ case 5:
+ weekday = G_DATE_FRIDAY;
+ break;
+ case 6:
+ weekday = G_DATE_SATURDAY;
+ break;
+ default:
+ return FALSE;
+ }
+
+ /* Evolution numbering */
+ switch (weekday) {
+ case G_DATE_MONDAY:
+ g_value_set_int (dst_value, 0);
+ break;
+ case G_DATE_TUESDAY:
+ g_value_set_int (dst_value, 1);
+ break;
+ case G_DATE_WEDNESDAY:
+ g_value_set_int (dst_value, 2);
+ break;
+ case G_DATE_THURSDAY:
+ g_value_set_int (dst_value, 3);
+ break;
+ case G_DATE_FRIDAY:
+ g_value_set_int (dst_value, 4);
+ break;
+ case G_DATE_SATURDAY:
+ g_value_set_int (dst_value, 5);
+ break;
+ case G_DATE_SUNDAY:
+ g_value_set_int (dst_value, 6);
+ break;
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+transform_weekdays_evolution_to_gconf (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ GDateWeekday weekday;
+
+ /* XXX At some point, Evolution changed its weekday numbering
+ * from 0 = Sunday to 0 = Monday, but did not migrate the
+ * "week_start_day" key. Both enumerations are of course
+ * different from GDateWeekday. We should have saved the
+ * weekday as a string instead. */
+
+ /* This is purposefully verbose for better readability. */
+
+ /* GConf numbering */
+ switch (g_value_get_int (src_value)) {
+ case 0:
+ weekday = G_DATE_MONDAY;
+ break;
+ case 1:
+ weekday = G_DATE_TUESDAY;
+ break;
+ case 2:
+ weekday = G_DATE_WEDNESDAY;
+ break;
+ case 3:
+ weekday = G_DATE_THURSDAY;
+ break;
+ case 4:
+ weekday = G_DATE_FRIDAY;
+ break;
+ case 5:
+ weekday = G_DATE_SATURDAY;
+ break;
+ case 6:
+ weekday = G_DATE_SUNDAY;
+ break;
+ default:
+ return FALSE;
+ }
+
+ /* Evolution numbering */
+ switch (weekday) {
+ case G_DATE_MONDAY:
+ g_value_set_int (dst_value, 1);
+ break;
+ case G_DATE_TUESDAY:
+ g_value_set_int (dst_value, 2);
+ break;
+ case G_DATE_WEDNESDAY:
+ g_value_set_int (dst_value, 3);
+ break;
+ case G_DATE_THURSDAY:
+ g_value_set_int (dst_value, 4);
+ break;
+ case G_DATE_FRIDAY:
+ g_value_set_int (dst_value, 5);
+ break;
+ case G_DATE_SATURDAY:
+ g_value_set_int (dst_value, 6);
+ break;
+ case G_DATE_SUNDAY:
+ g_value_set_int (dst_value, 0);
+ break;
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/* Working day flags */
+enum {
+ WORKING_DAY_SUNDAY = 1 << 0,
+ WORKING_DAY_MONDAY = 1 << 1,
+ WORKING_DAY_TUESDAY = 1 << 2,
+ WORKING_DAY_WEDNESDAY = 1 << 3,
+ WORKING_DAY_THURSDAY = 1 << 4,
+ WORKING_DAY_FRIDAY = 1 << 5,
+ WORKING_DAY_SATURDAY = 1 << 6
+};
+
+static gboolean
+transform_working_days_bitset_to_sunday (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ gint bitset;
+ gboolean working_day;
+
+ bitset = g_value_get_int (src_value);
+ working_day = ((bitset & WORKING_DAY_SUNDAY) != 0);
+ g_value_set_boolean (dst_value, working_day);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_sunday_to_bitset (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ EShellSettings *shell_settings;
+ gint bitset, bit;
+
+ shell_settings = E_SHELL_SETTINGS (user_data);
+
+ bitset = e_shell_settings_get_int (
+ shell_settings, "cal-working-days-bitset");
+
+ bit = g_value_get_boolean (src_value) ? WORKING_DAY_SUNDAY : 0;
+ g_value_set_int (dst_value, (bitset & ~WORKING_DAY_SUNDAY) | bit);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_bitset_to_monday (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ gint bitset;
+ gboolean working_day;
+
+ bitset = g_value_get_int (src_value);
+ working_day = ((bitset & WORKING_DAY_MONDAY) != 0);
+ g_value_set_boolean (dst_value, working_day);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_monday_to_bitset (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ EShellSettings *shell_settings;
+ gint bitset, bit;
+
+ shell_settings = E_SHELL_SETTINGS (user_data);
+
+ bitset = e_shell_settings_get_int (
+ shell_settings, "cal-working-days-bitset");
+
+ bit = g_value_get_boolean (src_value) ? WORKING_DAY_MONDAY : 0;
+ g_value_set_int (dst_value, (bitset & ~WORKING_DAY_MONDAY) | bit);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_bitset_to_tuesday (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ gint bitset;
+ gboolean working_day;
+
+ bitset = g_value_get_int (src_value);
+ working_day = ((bitset & WORKING_DAY_TUESDAY) != 0);
+ g_value_set_boolean (dst_value, working_day);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_tuesday_to_bitset (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ EShellSettings *shell_settings;
+ gint bitset, bit;
+
+ shell_settings = E_SHELL_SETTINGS (user_data);
+
+ bitset = e_shell_settings_get_int (
+ shell_settings, "cal-working-days-bitset");
+
+ bit = g_value_get_boolean (src_value) ? WORKING_DAY_TUESDAY : 0;
+ g_value_set_int (dst_value, (bitset & ~WORKING_DAY_TUESDAY) | bit);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_bitset_to_wednesday (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ gint bitset;
+ gboolean working_day;
+
+ bitset = g_value_get_int (src_value);
+ working_day = ((bitset & WORKING_DAY_WEDNESDAY) != 0);
+ g_value_set_boolean (dst_value, working_day);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_wednesday_to_bitset (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ EShellSettings *shell_settings;
+ gint bitset, bit;
+
+ shell_settings = E_SHELL_SETTINGS (user_data);
+
+ bitset = e_shell_settings_get_int (
+ shell_settings, "cal-working-days-bitset");
+
+ bit = g_value_get_boolean (src_value) ? WORKING_DAY_WEDNESDAY : 0;
+ g_value_set_int (dst_value, (bitset & ~WORKING_DAY_WEDNESDAY) | bit);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_bitset_to_thursday (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ gint bitset;
+ gboolean working_day;
+
+ bitset = g_value_get_int (src_value);
+ working_day = ((bitset & WORKING_DAY_THURSDAY) != 0);
+ g_value_set_boolean (dst_value, working_day);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_thursday_to_bitset (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ EShellSettings *shell_settings;
+ gint bitset, bit;
+
+ shell_settings = E_SHELL_SETTINGS (user_data);
+
+ bitset = e_shell_settings_get_int (
+ shell_settings, "cal-working-days-bitset");
+
+ bit = g_value_get_boolean (src_value) ? WORKING_DAY_THURSDAY : 0;
+ g_value_set_int (dst_value, (bitset & ~WORKING_DAY_THURSDAY) | bit);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_bitset_to_friday (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ gint bitset;
+ gboolean working_day;
+
+ bitset = g_value_get_int (src_value);
+ working_day = ((bitset & WORKING_DAY_FRIDAY) != 0);
+ g_value_set_boolean (dst_value, working_day);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_friday_to_bitset (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ EShellSettings *shell_settings;
+ gint bitset, bit;
+
+ shell_settings = E_SHELL_SETTINGS (user_data);
+
+ bitset = e_shell_settings_get_int (
+ shell_settings, "cal-working-days-bitset");
+
+ bit = g_value_get_boolean (src_value) ? WORKING_DAY_FRIDAY : 0;
+ g_value_set_int (dst_value, (bitset & ~WORKING_DAY_FRIDAY) | bit);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_bitset_to_saturday (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ gint bitset;
+ gboolean working_day;
+
+ bitset = g_value_get_int (src_value);
+ working_day = ((bitset & WORKING_DAY_SATURDAY) != 0);
+ g_value_set_boolean (dst_value, working_day);
+
+ return TRUE;
+}
+
+static gboolean
+transform_working_days_saturday_to_bitset (const GValue *src_value,
+ GValue *dst_value,
+ gpointer user_data)
+{
+ EShellSettings *shell_settings;
+ gint bitset, bit;
+
+ shell_settings = E_SHELL_SETTINGS (user_data);
+
+ bitset = e_shell_settings_get_int (
+ shell_settings, "cal-working-days-bitset");
+
+ bit = g_value_get_boolean (src_value) ? WORKING_DAY_SATURDAY : 0;
+ g_value_set_int (dst_value, (bitset & ~WORKING_DAY_SATURDAY) | bit);
+
+ return TRUE;
+}
void
e_cal_shell_backend_init_settings (EShell *shell)
@@ -35,6 +481,34 @@ e_cal_shell_backend_init_settings (EShell *shell)
"/apps/evolution/calendar/display/compress_weekend");
e_shell_settings_install_property_for_key (
+ "cal-confirm-delete",
+ "/apps/evolution/calendar/prompts/confirm_delete");
+
+ e_shell_settings_install_property_for_key (
+ "cal-confirm-purge",
+ "/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-hide-completed-tasks",
+ "/apps/evolution/calendar/tasks/hide_completed");
+
+ e_shell_settings_install_property_for_key (
+ "cal-hide-completed-tasks-units",
+ "/apps/evolution/calendar/tasks/hide_completed_units");
+
+ e_shell_settings_install_property_for_key (
+ "cal-hide-completed-tasks-value",
+ "/apps/evolution/calendar/tasks/hide_completed_value");
+
+ e_shell_settings_install_property_for_key (
"cal-marcus-bains-day-view-color",
"/apps/evolution/calendar/display/marcus_bains_color_dayview");
@@ -55,9 +529,22 @@ e_cal_shell_backend_init_settings (EShell *shell)
"/apps/evolution/calendar/display/show_event_end");
e_shell_settings_install_property_for_key (
+ "cal-tasks-color-due-today",
+ "/apps/evolution/calendar/tasks/colors/due_today");
+
+ e_shell_settings_install_property_for_key (
+ "cal-tasks-color-overdue",
+ "/apps/evolution/calendar/tasks/colors/overdue");
+
+ e_shell_settings_install_property_for_key (
"cal-time-divisions",
"/apps/evolution/calendar/display/time_divisions");
+ /* Do not bind to this. Use "cal-timezone" instead. */
+ e_shell_settings_install_property_for_key (
+ "cal-timezone-string",
+ "/apps/evolution/calendar/display/timezone");
+
e_shell_settings_install_property_for_key (
"cal-use-24-hour-format",
"/apps/evolution/calendar/display/use_24hour_format");
@@ -66,8 +553,9 @@ e_cal_shell_backend_init_settings (EShell *shell)
"cal-use-system-timezone",
"/apps/evolution/calendar/display/use_system_timezone");
+ /* Do not bind to this. Use "cal-week-start-day" instead. */
e_shell_settings_install_property_for_key (
- "cal-week-start-day",
+ "cal-week-start-day-gconf",
"/apps/evolution/calendar/display/week_start_day");
e_shell_settings_install_property_for_key (
@@ -87,6 +575,152 @@ e_cal_shell_backend_init_settings (EShell *shell)
"/apps/evolution/calendar/display/day_start_minute");
e_shell_settings_install_property_for_key (
- "cal-working-days",
+ "cal-working-days-bitset",
"/apps/evolution/calendar/display/working_days");
+
+ /* These properties use transform functions to convert
+ * GConf values to forms more useful to Evolution. We
+ * have to use separate properties because GConfBridge
+ * does not support transform functions. Much of this
+ * is backward-compatibility cruft for poorly designed
+ * GConf schemas. */
+
+ e_shell_settings_install_property (
+ g_param_spec_pointer (
+ "cal-timezone",
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "cal-timezone-string",
+ G_OBJECT (shell_settings), "cal-timezone",
+ transform_string_to_icaltimezone,
+ transform_icaltimezone_to_string,
+ (GDestroyNotify) NULL, shell_settings);
+
+ e_shell_settings_install_property (
+ g_param_spec_int (
+ "cal-week-start-day",
+ NULL,
+ NULL,
+ 0, /* Monday */
+ 6, /* Sunday */
+ 0,
+ G_PARAM_READWRITE));
+
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "cal-week-start-day-gconf",
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ transform_weekdays_gconf_to_evolution,
+ transform_weekdays_evolution_to_gconf,
+ (GDestroyNotify) NULL, NULL);
+
+ /* XXX These are my favorite. Storing a bit array in GConf
+ * instead of separate boolean keys. Brilliant move. */
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "cal-working-days-sunday",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "cal-working-days-bitset",
+ G_OBJECT (shell_settings), "cal-working-days-sunday",
+ transform_working_days_bitset_to_sunday,
+ transform_working_days_sunday_to_bitset,
+ (GDestroyNotify) NULL, shell_settings);
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "cal-working-days-monday",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "cal-working-days-bitset",
+ G_OBJECT (shell_settings), "cal-working-days-monday",
+ transform_working_days_bitset_to_monday,
+ transform_working_days_monday_to_bitset,
+ (GDestroyNotify) NULL, shell_settings);
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "cal-working-days-tuesday",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "cal-working-days-bitset",
+ G_OBJECT (shell_settings), "cal-working-days-tuesday",
+ transform_working_days_bitset_to_tuesday,
+ transform_working_days_tuesday_to_bitset,
+ (GDestroyNotify) NULL, shell_settings);
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "cal-working-days-wednesday",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "cal-working-days-bitset",
+ G_OBJECT (shell_settings), "cal-working-days-wednesday",
+ transform_working_days_bitset_to_wednesday,
+ transform_working_days_wednesday_to_bitset,
+ (GDestroyNotify) NULL, shell_settings);
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "cal-working-days-thursday",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "cal-working-days-bitset",
+ G_OBJECT (shell_settings), "cal-working-days-thursday",
+ transform_working_days_bitset_to_thursday,
+ transform_working_days_thursday_to_bitset,
+ (GDestroyNotify) NULL, shell_settings);
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "cal-working-days-friday",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "cal-working-days-bitset",
+ G_OBJECT (shell_settings), "cal-working-days-friday",
+ transform_working_days_bitset_to_friday,
+ transform_working_days_friday_to_bitset,
+ (GDestroyNotify) NULL, shell_settings);
+
+ e_shell_settings_install_property (
+ g_param_spec_boolean (
+ "cal-working-days-saturday",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "cal-working-days-bitset",
+ G_OBJECT (shell_settings), "cal-working-days-saturday",
+ transform_working_days_bitset_to_saturday,
+ transform_working_days_saturday_to_bitset,
+ (GDestroyNotify) NULL, shell_settings);
}
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index dc618e2dda..6fb35e1588 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -25,11 +25,11 @@
#include <glib/gi18n.h>
#include "e-util/e-error.h"
+#include "e-util/e-binding.h"
#include "e-util/gconf-bridge.h"
#include "calendar/common/authentication.h"
#include "calendar/gui/calendar-config.h"
#include "calendar/gui/e-calendar-selector.h"
-#include "calendar/gui/e-mini-calendar-config.h"
#include "calendar/gui/misc.h"
#include "e-cal-shell-backend.h"
@@ -42,17 +42,15 @@
struct _ECalShellSidebarPrivate {
GtkWidget *paned;
GtkWidget *selector;
- GtkWidget *mini_calendar;
+ GtkWidget *date_navigator;
/* UID -> Client */
GHashTable *client_table;
-
- EMiniCalendarConfig *mini_calendar_config;
};
enum {
PROP_0,
- PROP_MINI_CALENDAR,
+ PROP_DATE_NAVIGATOR,
PROP_SELECTOR
};
@@ -307,9 +305,9 @@ cal_shell_sidebar_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
- case PROP_MINI_CALENDAR:
+ case PROP_DATE_NAVIGATOR:
g_value_set_object (
- value, e_cal_shell_sidebar_get_mini_calendar (
+ value, e_cal_shell_sidebar_get_date_navigator (
E_CAL_SHELL_SIDEBAR (object)));
return;
@@ -340,18 +338,13 @@ cal_shell_sidebar_dispose (GObject *object)
priv->selector = NULL;
}
- if (priv->mini_calendar != NULL) {
- g_object_unref (priv->mini_calendar);
- priv->mini_calendar = NULL;
+ if (priv->date_navigator != NULL) {
+ g_object_unref (priv->date_navigator);
+ priv->date_navigator = NULL;
}
g_hash_table_remove_all (priv->client_table);
- if (priv->mini_calendar_config != NULL) {
- g_object_unref (priv->mini_calendar_config);
- priv->mini_calendar_config = NULL;
- }
-
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -443,11 +436,17 @@ cal_shell_sidebar_constructed (GObject *object)
e_calendar_item_set_days_start_week_sel (calitem, 9);
e_calendar_item_set_max_days_sel (calitem, 42);
gtk_paned_add2 (GTK_PANED (container), widget);
- priv->mini_calendar = g_object_ref (widget);
+ priv->date_navigator = g_object_ref (widget);
gtk_widget_show (widget);
- priv->mini_calendar_config =
- e_mini_calendar_config_new (E_CALENDAR (widget));
+ e_binding_new (
+ G_OBJECT (shell_settings),
+ "cal-date-navigator-show-week-numbers",
+ G_OBJECT (calitem), "show-week-numbers");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ G_OBJECT (calitem), "week-start-day");
/* Restore the selector state from the last session. */
@@ -547,10 +546,10 @@ cal_shell_sidebar_class_init (ECalShellSidebarClass *class)
g_object_class_install_property (
object_class,
- PROP_MINI_CALENDAR,
+ PROP_DATE_NAVIGATOR,
g_param_spec_object (
- "mini-calendar",
- _("Mini-Calendar Widget"),
+ "date-navigator",
+ _("Date Navigator Widget"),
_("This widget displays a miniature calendar"),
E_TYPE_CALENDAR,
G_PARAM_READABLE));
@@ -665,12 +664,12 @@ e_cal_shell_sidebar_get_clients (ECalShellSidebar *cal_shell_sidebar)
}
ECalendar *
-e_cal_shell_sidebar_get_mini_calendar (ECalShellSidebar *cal_shell_sidebar)
+e_cal_shell_sidebar_get_date_navigator (ECalShellSidebar *cal_shell_sidebar)
{
g_return_val_if_fail (
E_IS_CAL_SHELL_SIDEBAR (cal_shell_sidebar), NULL);
- return E_CALENDAR (cal_shell_sidebar->priv->mini_calendar);
+ return E_CALENDAR (cal_shell_sidebar->priv->date_navigator);
}
ESourceSelector *
diff --git a/modules/calendar/e-cal-shell-sidebar.h b/modules/calendar/e-cal-shell-sidebar.h
index c555537abf..3b7c0fd3b3 100644
--- a/modules/calendar/e-cal-shell-sidebar.h
+++ b/modules/calendar/e-cal-shell-sidebar.h
@@ -84,7 +84,7 @@ void e_cal_shell_sidebar_register_type
GtkWidget * e_cal_shell_sidebar_new (EShellView *shell_view);
GList * e_cal_shell_sidebar_get_clients
(ECalShellSidebar *cal_shell_sidebar);
-ECalendar * e_cal_shell_sidebar_get_mini_calendar
+ECalendar * e_cal_shell_sidebar_get_date_navigator
(ECalShellSidebar *cal_shell_sidebar);
ESourceSelector *
e_cal_shell_sidebar_get_selector
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index c6d10292c3..44aad3db5e 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -58,9 +58,11 @@ cal_shell_view_get_current_time (ECalendarItem *calitem,
ECalShellContent *cal_shell_content;
struct icaltimetype tt;
icaltimezone *timezone;
+ ECalModel *model;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
- timezone = e_cal_shell_content_get_timezone (cal_shell_content);
+ model = e_cal_shell_content_get_model (cal_shell_content);
+ timezone = e_cal_model_get_timezone (model);
tt = icaltime_from_timet_with_zone (time (NULL), FALSE, timezone);
@@ -68,28 +70,28 @@ cal_shell_view_get_current_time (ECalendarItem *calitem,
}
static void
-cal_shell_view_mini_calendar_date_range_changed_cb (ECalShellView *cal_shell_view,
- ECalendarItem *calitem)
+cal_shell_view_date_navigator_date_range_changed_cb (ECalShellView *cal_shell_view,
+ ECalendarItem *calitem)
{
/* FIXME gnome-calendar.c calls update_query() here. */
}
static void
-cal_shell_view_mini_calendar_selection_changed_cb (ECalShellView *cal_shell_view,
- ECalendarItem *calitem)
+cal_shell_view_date_navigator_selection_changed_cb (ECalShellView *cal_shell_view,
+ ECalendarItem *calitem)
{
/* FIXME */
}
static void
-cal_shell_view_mini_calendar_scroll_event_cb (ECalShellView *cal_shell_view,
- GdkEventScroll *event,
- ECalendar *mini_calendar)
+cal_shell_view_date_navigator_scroll_event_cb (ECalShellView *cal_shell_view,
+ GdkEventScroll *event,
+ ECalendar *date_navigator)
{
ECalendarItem *calitem;
GDate start_date, end_date;
- calitem = mini_calendar->calitem;
+ calitem = date_navigator->calitem;
if (!e_calendar_item_get_selection (calitem, &start_date, &end_date))
return;
@@ -112,7 +114,7 @@ cal_shell_view_mini_calendar_scroll_event_cb (ECalShellView *cal_shell_view,
* we could move this handler into ECalShellSidebar. */
e_calendar_item_set_selection (calitem, &start_date, &end_date);
- cal_shell_view_mini_calendar_date_range_changed_cb (
+ cal_shell_view_date_navigator_date_range_changed_cb (
cal_shell_view, calitem);
}
@@ -258,11 +260,11 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
EShellWindow *shell_window;
EShellView *shell_view;
GnomeCalendar *calendar;
- ECalendar *mini_calendar;
+ ECalendar *date_navigator;
EMemoTable *memo_table;
ECalendarTable *task_table;
ESourceSelector *selector;
- guint id;
+ ECalModel *model;
shell_view = E_SHELL_VIEW (cal_shell_view);
shell_backend = e_shell_view_get_shell_backend (shell_view);
@@ -279,16 +281,20 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
priv->cal_shell_sidebar = g_object_ref (shell_sidebar);
cal_shell_content = E_CAL_SHELL_CONTENT (shell_content);
+ model = e_cal_shell_content_get_model (cal_shell_content);
calendar = e_cal_shell_content_get_calendar (cal_shell_content);
memo_table = e_cal_shell_content_get_memo_table (cal_shell_content);
task_table = e_cal_shell_content_get_task_table (cal_shell_content);
cal_shell_sidebar = E_CAL_SHELL_SIDEBAR (shell_sidebar);
selector = e_cal_shell_sidebar_get_selector (cal_shell_sidebar);
- mini_calendar = e_cal_shell_sidebar_get_mini_calendar (cal_shell_sidebar);
+ date_navigator = e_cal_shell_sidebar_get_date_navigator (cal_shell_sidebar);
+
+ /* Give GnomeCalendar a handle to the date navigator. */
+ gnome_calendar_set_date_navigator (calendar, date_navigator);
e_calendar_item_set_get_time_callback (
- mini_calendar->calitem, (ECalendarItemGetTimeCallback)
+ date_navigator->calitem, (ECalendarItemGetTimeCallback)
cal_shell_view_get_current_time, cal_shell_view, NULL);
/* KILL-BONOBO FIXME -- Need to connect to the "user-created"
@@ -302,18 +308,23 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
#endif
g_signal_connect_swapped (
- mini_calendar, "scroll-event",
- G_CALLBACK (cal_shell_view_mini_calendar_scroll_event_cb),
+ model, "notify::timezone",
+ G_CALLBACK (e_cal_shell_view_update_timezone),
cal_shell_view);
g_signal_connect_swapped (
- mini_calendar->calitem, "date-range-changed",
- G_CALLBACK (cal_shell_view_mini_calendar_date_range_changed_cb),
+ date_navigator, "scroll-event",
+ G_CALLBACK (cal_shell_view_date_navigator_scroll_event_cb),
cal_shell_view);
g_signal_connect_swapped (
- mini_calendar->calitem, "selection-changed",
- G_CALLBACK (cal_shell_view_mini_calendar_selection_changed_cb),
+ date_navigator->calitem, "date-range-changed",
+ G_CALLBACK (cal_shell_view_date_navigator_date_range_changed_cb),
+ cal_shell_view);
+
+ g_signal_connect_swapped (
+ date_navigator->calitem, "selection-changed",
+ G_CALLBACK (cal_shell_view_date_navigator_selection_changed_cb),
cal_shell_view);
g_signal_connect_swapped (
@@ -355,14 +366,6 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
G_CALLBACK (e_cal_shell_view_update_search_filter),
cal_shell_view);
- /* Listen for configuration changes. */
-
- /* Timezone */
- id = calendar_config_add_notification_timezone (
- cal_shell_view_config_timezone_changed_cb, cal_shell_view);
- priv->notifications = g_list_prepend (
- priv->notifications, GUINT_TO_POINTER (id));
-
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);
@@ -399,13 +402,6 @@ e_cal_shell_view_private_dispose (ECalShellView *cal_shell_view)
g_object_unref (priv->taskpad_activity);
priv->taskpad_activity = NULL;
}
-
- for (iter = priv->notifications; iter != NULL; iter = iter->next) {
- guint notification_id = GPOINTER_TO_UINT (iter->data);
- calendar_config_remove_notification (notification_id);
- }
- g_list_free (priv->notifications);
- priv->notifications = NULL;
}
void
@@ -423,7 +419,7 @@ e_cal_shell_view_execute_search (ECalShellView *cal_shell_view)
EShellWindow *shell_window;
EShellContent *shell_content;
GnomeCalendar *calendar;
- ECalendar *mini_calendar;
+ ECalendar *date_navigator;
GtkRadioAction *action;
GString *string;
FilterRule *rule;
@@ -549,16 +545,16 @@ e_cal_shell_view_execute_search (ECalShellView *cal_shell_view)
g_object_unref (rule);
cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
- mini_calendar = e_cal_shell_sidebar_get_mini_calendar (cal_shell_sidebar);
+ date_navigator = e_cal_shell_sidebar_get_date_navigator (cal_shell_sidebar);
if (range_search) {
- /* Switch to list view and hide the mini calendar. */
+ /* Switch to list view and hide the date navigator. */
action = GTK_RADIO_ACTION (ACTION (CALENDAR_VIEW_LIST));
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
- gtk_widget_hide (GTK_WIDGET (mini_calendar));
+ gtk_widget_hide (GTK_WIDGET (date_navigator));
} else {
- /* Ensure the mini calendar is visible. */
- gtk_widget_show (GTK_WIDGET (mini_calendar));
+ /* Ensure the date navigator is visible. */
+ gtk_widget_show (GTK_WIDGET (date_navigator));
}
/* Submit the query. */
@@ -789,24 +785,19 @@ e_cal_shell_view_update_sidebar (ECalShellView *cal_shell_view)
void
e_cal_shell_view_update_timezone (ECalShellView *cal_shell_view)
{
-#if 0
ECalShellContent *cal_shell_content;
ECalShellSidebar *cal_shell_sidebar;
- GnomeCalendarViewType view_type;
- ECalendarView *calendar_view;
icaltimezone *timezone;
+ ECalModel *model;
GList *clients, *iter;
cal_shell_content = cal_shell_view->priv->cal_shell_content;
- view_type = e_cal_shell_content_get_current_view (cal_shell_content);
- calendar_view = e_cal_shell_content_get_calendar_view (
- cal_shell_content, view_type);
+ model = e_cal_shell_content_get_model (cal_shell_content);
+ timezone = e_cal_model_get_timezone (model);
cal_shell_sidebar = cal_shell_view->priv->cal_shell_sidebar;
clients = e_cal_shell_sidebar_get_clients (cal_shell_sidebar);
- timezone = calendar_config_get_icaltimezone ();
-
for (iter = clients; iter != NULL; iter = iter->next) {
ECal *client = iter->data;
@@ -814,8 +805,5 @@ e_cal_shell_view_update_timezone (ECalShellView *cal_shell_view)
e_cal_set_default_timezone (client, timezone, NULL);
}
- e_calendar_view_set_icaltimezone (calendar_view, timezone);
-
g_list_free (clients);
-#endif
}
diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h
index 8308e0bf7f..2e1388a50f 100644
--- a/modules/calendar/e-cal-shell-view-private.h
+++ b/modules/calendar/e-cal-shell-view-private.h
@@ -102,9 +102,6 @@ struct _ECalShellViewPrivate {
EActivity *calendar_activity;
EActivity *memopad_activity;
EActivity *taskpad_activity;
-
- /* GConf notification IDs */
- GList *notifications;
};
void e_cal_shell_view_private_init
diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c
index ce020158ae..ece6eb694a 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-shell-content.c
@@ -29,7 +29,6 @@
#include "calendar/gui/comp-util.h"
#include "calendar/gui/e-cal-model-memos.h"
#include "calendar/gui/e-memo-table.h"
-#include "calendar/gui/e-memo-table-config.h"
#include "widgets/menus/gal-view-etable.h"
@@ -52,7 +51,6 @@ struct _EMemoShellContentPrivate {
GtkWidget *memo_preview;
ECalModel *memo_model;
- EMemoTableConfig *table_config;
GalViewInstance *view_instance;
gchar *current_uid;
@@ -328,11 +326,6 @@ memo_shell_content_dispose (GObject *object)
priv->memo_model = NULL;
}
- if (priv->table_config != NULL) {
- g_object_unref (priv->table_config);
- priv->table_config = NULL;
- }
-
if (priv->view_instance != NULL) {
g_object_unref (priv->view_instance);
priv->view_instance = NULL;
@@ -359,7 +352,10 @@ static void
memo_shell_content_constructed (GObject *object)
{
EMemoShellContentPrivate *priv;
+ EShell *shell;
+ EShellSettings *shell_settings;
EShellContent *shell_content;
+ EShellWindow *shell_window;
EShellView *shell_view;
GalViewInstance *view_instance;
ETable *table;
@@ -375,6 +371,11 @@ 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_settings = e_shell_get_shell_settings (shell);
+
+ priv->memo_model = e_cal_model_memos_new (shell_settings);
/* Build content widgets. */
@@ -416,9 +417,6 @@ memo_shell_content_constructed (GObject *object)
widget = E_MEMO_TABLE (priv->memo_table)->etable;
table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
- priv->table_config = e_memo_table_config_new (
- E_MEMO_TABLE (priv->memo_table));
-
e_table_set_state (table, E_MEMO_TABLE_DEFAULT_STATE);
e_table_drag_source_set (
@@ -561,8 +559,6 @@ memo_shell_content_init (EMemoShellContent *memo_shell_content)
memo_shell_content->priv =
E_MEMO_SHELL_CONTENT_GET_PRIVATE (memo_shell_content);
- memo_shell_content->priv->memo_model = e_cal_model_memos_new ();
-
/* Postpone widget construction until we have a shell view. */
}
diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c
index 0177c6c3c3..8a4e0f1442 100644
--- a/modules/calendar/e-task-shell-content.c
+++ b/modules/calendar/e-task-shell-content.c
@@ -23,13 +23,13 @@
#include <glib/gi18n.h>
+#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"
-#include "calendar/gui/e-calendar-table-config.h"
#include "widgets/menus/gal-view-etable.h"
@@ -53,7 +53,6 @@ struct _ETaskShellContentPrivate {
GtkWidget *task_preview;
ECalModel *task_model;
- ECalendarTableConfig *table_config;
GalViewInstance *view_instance;
gchar *current_uid;
@@ -327,11 +326,6 @@ task_shell_content_dispose (GObject *object)
priv->task_model = NULL;
}
- if (priv->table_config != NULL) {
- g_object_unref (priv->table_config);
- priv->table_config = NULL;
- }
-
if (priv->view_instance != NULL) {
g_object_unref (priv->view_instance);
priv->view_instance = NULL;
@@ -358,7 +352,10 @@ static void
task_shell_content_constructed (GObject *object)
{
ETaskShellContentPrivate *priv;
+ EShell *shell;
+ EShellSettings *shell_settings;
EShellContent *shell_content;
+ EShellWindow *shell_window;
EShellView *shell_view;
GalViewInstance *view_instance;
ETable *table;
@@ -374,6 +371,11 @@ task_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_settings = e_shell_get_shell_settings (shell);
+
+ priv->task_model = e_cal_model_tasks_new (shell_settings);
/* Build content widgets. */
@@ -415,9 +417,6 @@ task_shell_content_constructed (GObject *object)
widget = E_CALENDAR_TABLE (priv->task_table)->etable;
table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
- priv->table_config = e_calendar_table_config_new (
- E_CALENDAR_TABLE (priv->task_table));
-
e_table_set_state (table, E_CALENDAR_TABLE_DEFAULT_STATE);
e_table_drag_source_set (
@@ -585,8 +584,6 @@ task_shell_content_init (ETaskShellContent *task_shell_content)
task_shell_content->priv =
E_TASK_SHELL_CONTENT_GET_PRIVATE (task_shell_content);
- task_shell_content->priv->task_model = e_cal_model_tasks_new ();
-
/* Postpone widget construction until we have a shell view. */
}
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index 4deed9fdf0..eea80b77c6 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -579,7 +579,7 @@ action_task_purge_cb (GtkAction *action,
shell_view = E_SHELL_VIEW (task_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- if (!calendar_config_get_confirm_purge ())
+ if (!e_task_shell_view_get_confirm_purge (task_shell_view))
goto purge;
/* XXX This needs reworked. The dialog looks like ass. */
@@ -608,11 +608,11 @@ action_task_purge_cb (GtkAction *action,
return;
if (active)
- calendar_config_set_confirm_purge (FALSE);
+ e_task_shell_view_set_confirm_purge (task_shell_view, FALSE);
purge:
- /* FIXME */
+ /* FIXME KILL-BONOBO */
;
}
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index be281f1c6e..1cbadcb53c 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -24,12 +24,8 @@
#include "widgets/menus/gal-view-factory-etable.h"
static void
-task_shell_view_config_hide_completed_tasks_changed_cb (GConfClient *client,
- guint id,
- GConfEntry *entry,
- gpointer user_data)
+task_shell_view_process_completed_tasks (ETaskShellView *task_shell_view)
{
- ETaskShellView *task_shell_view = user_data;
ETaskShellContent *task_shell_content;
ETaskShellSidebar *task_shell_sidebar;
ECalendarTable *task_table;
@@ -51,17 +47,6 @@ task_shell_view_config_hide_completed_tasks_changed_cb (GConfClient *client,
}
static void
-task_shell_view_config_timezone_changed_cb (GConfClient *client,
- guint id,
- GConfEntry *entry,
- gpointer user_data)
-{
- ETaskShellView *task_shell_view = user_data;
-
- e_task_shell_view_update_timezone (task_shell_view);
-}
-
-static void
task_shell_view_table_popup_event_cb (EShellView *shell_view,
GdkEventButton *event)
{
@@ -228,11 +213,13 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
ETaskShellViewPrivate *priv = task_shell_view->priv;
ETaskShellContent *task_shell_content;
ETaskShellSidebar *task_shell_sidebar;
- EShellView *shell_view;
+ EShell *shell;
EShellBackend *shell_backend;
EShellContent *shell_content;
+ EShellSettings *shell_settings;
EShellSidebar *shell_sidebar;
EShellWindow *shell_window;
+ EShellView *shell_view;
ECalendarTable *task_table;
ECalModel *model;
ETable *table;
@@ -245,6 +232,9 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
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_window_add_action_group (shell_window, "tasks");
e_shell_window_add_action_group (shell_window, "tasks-filter");
@@ -262,6 +252,11 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
selector = e_task_shell_sidebar_get_selector (task_shell_sidebar);
g_signal_connect_swapped (
+ model, "notify::timezone",
+ G_CALLBACK (e_task_shell_view_update_timezone),
+ task_shell_view);
+
+ g_signal_connect_swapped (
task_table, "open-component",
G_CALLBACK (e_task_shell_view_open_task),
task_shell_view);
@@ -338,28 +333,23 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
/* Listen for configuration changes. */
- /* Timezone */
- id = calendar_config_add_notification_timezone (
- task_shell_view_config_timezone_changed_cb, task_shell_view);
- priv->notifications = g_list_prepend (
- priv->notifications, GUINT_TO_POINTER (id));
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-confirm-purge",
+ G_OBJECT (task_shell_view), "confirm-purge");
/* Hide Completed Tasks (enable/units/value) */
- id = calendar_config_add_notification_hide_completed_tasks (
- task_shell_view_config_hide_completed_tasks_changed_cb,
+ g_signal_connect_swapped (
+ shell_settings, "notify::cal-hide-completed-tasks",
+ G_CALLBACK (task_shell_view_process_completed_tasks),
task_shell_view);
- priv->notifications = g_list_prepend (
- priv->notifications, GUINT_TO_POINTER (id));
- id = calendar_config_add_notification_hide_completed_tasks_units (
- task_shell_view_config_hide_completed_tasks_changed_cb,
+ g_signal_connect_swapped (
+ shell_settings, "notify::cal-hide-completed-tasks-units",
+ G_CALLBACK (task_shell_view_process_completed_tasks),
task_shell_view);
- priv->notifications = g_list_prepend (
- priv->notifications, GUINT_TO_POINTER (id));
- id = calendar_config_add_notification_hide_completed_tasks_value (
- task_shell_view_config_hide_completed_tasks_changed_cb,
+ g_signal_connect_swapped (
+ shell_settings, "notify::cal-hide-completed-tasks-value",
+ G_CALLBACK (task_shell_view_process_completed_tasks),
task_shell_view);
- priv->notifications = g_list_prepend (
- priv->notifications, GUINT_TO_POINTER (id));
e_task_shell_view_actions_init (task_shell_view);
e_task_shell_view_update_sidebar (task_shell_view);
@@ -390,13 +380,6 @@ e_task_shell_view_private_dispose (ETaskShellView *task_shell_view)
g_source_remove (priv->update_timeout);
priv->update_timeout = 0;
}
-
- for (iter = priv->notifications; iter != NULL; iter = iter->next) {
- guint notification_id = GPOINTER_TO_UINT (iter->data);
- calendar_config_remove_notification (notification_id);
- }
- g_list_free (priv->notifications);
- priv->notifications = NULL;
}
void
diff --git a/modules/calendar/e-task-shell-view-private.h b/modules/calendar/e-task-shell-view-private.h
index d3bb3cf086..50fa306696 100644
--- a/modules/calendar/e-task-shell-view-private.h
+++ b/modules/calendar/e-task-shell-view-private.h
@@ -102,8 +102,7 @@ struct _ETaskShellViewPrivate {
EActivity *activity;
guint update_timeout;
- /* GConf notification IDs */
- GList *notifications;
+ guint confirm_purge : 1;
};
void e_task_shell_view_private_init
diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c
index ce1b53a43c..b1298eaa29 100644
--- a/modules/calendar/e-task-shell-view.c
+++ b/modules/calendar/e-task-shell-view.c
@@ -21,10 +21,49 @@
#include "e-task-shell-view-private.h"
+enum {
+ PROP_0,
+ PROP_CONFIRM_PURGE
+};
+
static gpointer parent_class;
static GType task_shell_view_type;
static void
+task_shell_view_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CONFIRM_PURGE:
+ e_task_shell_view_set_confirm_purge (
+ E_TASK_SHELL_VIEW (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+task_shell_view_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CONFIRM_PURGE:
+ g_value_set_boolean (
+ value, e_task_shell_view_get_confirm_purge (
+ E_TASK_SHELL_VIEW (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
task_shell_view_dispose (GObject *object)
{
e_task_shell_view_private_dispose (E_TASK_SHELL_VIEW (object));
@@ -201,6 +240,8 @@ task_shell_view_class_init (ETaskShellViewClass *class,
g_type_class_add_private (class, sizeof (ETaskShellViewPrivate));
object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = task_shell_view_set_property;
+ object_class->get_property = task_shell_view_get_property;
object_class->dispose = task_shell_view_dispose;
object_class->finalize = task_shell_view_finalize;
object_class->constructed = task_shell_view_constructed;
@@ -215,6 +256,16 @@ task_shell_view_class_init (ETaskShellViewClass *class,
shell_view_class->new_shell_content = e_task_shell_content_new;
shell_view_class->new_shell_sidebar = e_task_shell_sidebar_new;
shell_view_class->update_actions = task_shell_view_update_actions;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CONFIRM_PURGE,
+ g_param_spec_boolean (
+ "confirm-purge",
+ "Confirm Purge",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
}
static void
@@ -253,3 +304,22 @@ e_task_shell_view_register_type (GTypeModule *type_module)
type_module, E_TYPE_SHELL_VIEW,
"ETaskShellView", &type_info, 0);
}
+
+gboolean
+e_task_shell_view_get_confirm_purge (ETaskShellView *task_shell_view)
+{
+ g_return_val_if_fail (E_IS_TASK_SHELL_VIEW (task_shell_view), FALSE);
+
+ return task_shell_view->priv->confirm_purge;
+}
+
+void
+e_task_shell_view_set_confirm_purge (ETaskShellView *task_shell_view,
+ gboolean confirm_purge)
+{
+ g_return_if_fail (E_IS_TASK_SHELL_VIEW (task_shell_view));
+
+ task_shell_view->priv->confirm_purge = confirm_purge;
+
+ g_object_notify (G_OBJECT (task_shell_view), "confirm-purge");
+}
diff --git a/modules/calendar/e-task-shell-view.h b/modules/calendar/e-task-shell-view.h
index 8478e53cc2..853d90cac1 100644
--- a/modules/calendar/e-task-shell-view.h
+++ b/modules/calendar/e-task-shell-view.h
@@ -61,6 +61,11 @@ struct _ETaskShellViewClass {
GType e_task_shell_view_get_type (void);
void e_task_shell_view_register_type (GTypeModule *type_module);
+gboolean e_task_shell_view_get_confirm_purge
+ (ETaskShellView *task_shell_view);
+void e_task_shell_view_set_confirm_purge
+ (ETaskShellView *task_shell_view,
+ gboolean confirm_purge);
G_END_DECLS