aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-08-01 19:29:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-06 04:13:02 +0800
commitde85e3c7862100da10fe860aef2b651245a1fdbf (patch)
treedd4a3482966c041a80c9798d45b73f5fe986dad6
parentfac731e7359c978ff730d48f9ab88a5794450206 (diff)
downloadgsoc2013-evolution-de85e3c7862100da10fe860aef2b651245a1fdbf.tar
gsoc2013-evolution-de85e3c7862100da10fe860aef2b651245a1fdbf.tar.gz
gsoc2013-evolution-de85e3c7862100da10fe860aef2b651245a1fdbf.tar.bz2
gsoc2013-evolution-de85e3c7862100da10fe860aef2b651245a1fdbf.tar.lz
gsoc2013-evolution-de85e3c7862100da10fe860aef2b651245a1fdbf.tar.xz
gsoc2013-evolution-de85e3c7862100da10fe860aef2b651245a1fdbf.tar.zst
gsoc2013-evolution-de85e3c7862100da10fe860aef2b651245a1fdbf.zip
Replace more "config" classes with property bindings.
-rw-r--r--calendar/gui/Makefile.am10
-rw-r--r--calendar/gui/calendar-config.c477
-rw-r--r--calendar/gui/calendar-config.h55
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c293
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.h4
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c30
-rw-r--r--calendar/gui/dialogs/comp-editor-util.h7
-rw-r--r--calendar/gui/dialogs/event-page.c8
-rw-r--r--calendar/gui/dialogs/memo-page.c7
-rw-r--r--calendar/gui/dialogs/recurrence-page.c51
-rw-r--r--calendar/gui/dialogs/task-details-page.c7
-rw-r--r--calendar/gui/dialogs/task-page.c7
-rw-r--r--calendar/gui/e-cal-list-view.c30
-rw-r--r--calendar/gui/e-cal-model-calendar.c10
-rw-r--r--calendar/gui/e-cal-model-calendar.h43
-rw-r--r--calendar/gui/e-cal-model-memos.c8
-rw-r--r--calendar/gui/e-cal-model-memos.h41
-rw-r--r--calendar/gui/e-cal-model-tasks.c250
-rw-r--r--calendar/gui/e-cal-model-tasks.h65
-rw-r--r--calendar/gui/e-cal-model.c138
-rw-r--r--calendar/gui/e-cal-model.h2
-rw-r--r--calendar/gui/e-calendar-table-config.c268
-rw-r--r--calendar/gui/e-calendar-table-config.h74
-rw-r--r--calendar/gui/e-calendar-table.c63
-rw-r--r--calendar/gui/e-calendar-table.h2
-rw-r--r--calendar/gui/e-calendar-view.c223
-rw-r--r--calendar/gui/e-calendar-view.h1
-rw-r--r--calendar/gui/e-cell-date-edit-config.c321
-rw-r--r--calendar/gui/e-cell-date-edit-config.h57
-rw-r--r--calendar/gui/e-cell-date-edit-text.c218
-rw-r--r--calendar/gui/e-cell-date-edit-text.h66
-rw-r--r--calendar/gui/e-date-edit-config.c257
-rw-r--r--calendar/gui/e-date-edit-config.h56
-rw-r--r--calendar/gui/e-day-view.c58
-rw-r--r--calendar/gui/e-day-view.h6
-rw-r--r--calendar/gui/e-memo-table-config.c245
-rw-r--r--calendar/gui/e-memo-table-config.h56
-rw-r--r--calendar/gui/e-memo-table.c60
-rw-r--r--calendar/gui/e-memo-table.h8
-rw-r--r--calendar/gui/e-mini-calendar-config.c235
-rw-r--r--calendar/gui/e-mini-calendar-config.h55
-rw-r--r--calendar/gui/e-week-view.c5
-rw-r--r--calendar/gui/ea-gnome-calendar.c4
-rw-r--r--calendar/gui/gnome-cal.c804
-rw-r--r--calendar/gui/gnome-cal.h23
-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
-rw-r--r--widgets/misc/e-dateedit.c336
-rw-r--r--widgets/table/e-cell-date-edit.h17
61 files changed, 2620 insertions, 3533 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 0878c0eae9..981393f55c 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -85,18 +85,12 @@ libcal_gui_la_SOURCES = \
e-cal-list-view.h \
e-cal-model-memos.c \
e-cal-model-memos.h \
- e-calendar-table-config.c \
- e-calendar-table-config.h \
e-calendar-selector.c \
e-calendar-selector.h \
- e-cell-date-edit-config.c \
- e-cell-date-edit-config.h \
e-cell-date-edit-text.h \
e-cell-date-edit-text.c \
e-comp-editor-registry.c \
e-comp-editor-registry.h \
- e-date-edit-config.c \
- e-date-edit-config.h \
e-date-time-list.c \
e-date-time-list.h \
e-day-view-layout.c \
@@ -128,10 +122,6 @@ libcal_gui_la_SOURCES = \
e-memo-list-selector.h \
e-memo-table.c \
e-memo-table.h \
- e-memo-table-config.c \
- e-memo-table-config.h \
- e-mini-calendar-config.c \
- e-mini-calendar-config.h \
e-month-view.c \
e-month-view.h \
e-select-names-editable.c \
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index a57b0c2411..b1f38c74cb 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -211,18 +211,6 @@ calendar_config_set_timezone (const gchar *timezone)
gconf_client_set_string (config, CALENDAR_CONFIG_TIMEZONE, "UTC", NULL);
}
-guint
-calendar_config_add_notification_timezone (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_TIMEZONE, func, data, NULL, NULL);
-
- return id;
-}
-
/* Whether we use 24-hour format or 12-hour format (AM/PM). */
gboolean
calendar_config_get_24_hour_format (void)
@@ -239,26 +227,6 @@ calendar_config_get_24_hour_format (void)
return TRUE;
}
-void
-calendar_config_set_24_hour_format (gboolean use_24_hour)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_24HOUR, use_24_hour, NULL);
-}
-
-guint
-calendar_config_add_notification_24_hour_format (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_24HOUR, func, data, NULL, NULL);
-
- return id;
-}
-
/* The start day of the week (0 = Sun to 6 = Mon). */
gint
calendar_config_get_week_start_day (void)
@@ -268,26 +236,6 @@ calendar_config_get_week_start_day (void)
return gconf_client_get_int (config, CALENDAR_CONFIG_WEEK_START, NULL);
}
-void
-calendar_config_set_week_start_day (gint week_start_day)
-{
- calendar_config_init ();
-
- gconf_client_set_int (config, CALENDAR_CONFIG_WEEK_START, week_start_day, NULL);
-}
-
-guint
-calendar_config_add_notification_week_start_day (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_WEEK_START, func, data, NULL, NULL);
-
- return id;
-}
-
/* The start and end times of the work-day. */
gint
calendar_config_get_day_start_hour (void)
@@ -305,18 +253,6 @@ calendar_config_set_day_start_hour (gint day_start_hour)
gconf_client_set_int (config, CALENDAR_CONFIG_DAY_START_HOUR, day_start_hour, NULL);
}
-guint
-calendar_config_add_notification_day_start_hour (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_DAY_START_HOUR, func, data, NULL, NULL);
-
- return id;
-}
-
gint
calendar_config_get_day_start_minute (void)
{
@@ -333,18 +269,6 @@ calendar_config_set_day_start_minute (gint day_start_min)
gconf_client_set_int (config, CALENDAR_CONFIG_DAY_START_MINUTE, day_start_min, NULL);
}
-guint
-calendar_config_add_notification_day_start_minute (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_DAY_START_MINUTE, func, data, NULL, NULL);
-
- return id;
-}
-
gint
calendar_config_get_day_end_hour (void)
{
@@ -361,18 +285,6 @@ calendar_config_set_day_end_hour (gint day_end_hour)
gconf_client_set_int (config, CALENDAR_CONFIG_DAY_END_HOUR, day_end_hour, NULL);
}
-guint
-calendar_config_add_notification_day_end_hour (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_DAY_END_HOUR, func, data, NULL, NULL);
-
- return id;
-}
-
gint
calendar_config_get_day_end_minute (void)
{
@@ -389,18 +301,6 @@ calendar_config_set_day_end_minute (gint day_end_min)
gconf_client_set_int (config, CALENDAR_CONFIG_DAY_END_MINUTE, day_end_min, NULL);
}
-guint
-calendar_config_add_notification_day_end_minute (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_DAY_END_MINUTE, func, data, NULL, NULL);
-
- return id;
-}
-
/* The time divisions in the Day/Work-Week view in minutes (5/10/15/30/60). */
gint
calendar_config_get_time_divisions (void)
@@ -459,66 +359,6 @@ calendar_config_add_notification_month_scroll_by_week (GConfClientNotifyFunc fun
return id;
}
-/* Whether we show the Marcus Bains Line (current time), and in what colors. */
-void
-calendar_config_get_marcus_bains (gboolean *show_line, const gchar **dayview_color, const gchar **timebar_color)
-{
- static gchar *dcolor = NULL, *tcolor = NULL;
-
- calendar_config_init ();
-
- if (dcolor)
- g_free (dcolor);
- if (tcolor)
- g_free (tcolor);
-
- dcolor = gconf_client_get_string (config, CALENDAR_CONFIG_MARCUS_BAINS_COLOR_DAYVIEW, NULL);
- tcolor = gconf_client_get_string (config, CALENDAR_CONFIG_MARCUS_BAINS_COLOR_TIMEBAR, NULL);
-
- *show_line = gconf_client_get_bool (config, CALENDAR_CONFIG_MARCUS_BAINS_LINE, NULL);
- *dayview_color = dcolor;
- *timebar_color = tcolor;
-}
-
-void
-calendar_config_add_notification_marcus_bains (GConfClientNotifyFunc func, gpointer data, gint *not_show, gint *not_dcolor, gint *not_tcolor)
-{
- calendar_config_init ();
-
- *not_show = gconf_client_notify_add (config, CALENDAR_CONFIG_MARCUS_BAINS_LINE, func, data, NULL, NULL);
- *not_dcolor = gconf_client_notify_add (config, CALENDAR_CONFIG_MARCUS_BAINS_COLOR_DAYVIEW, func, data, NULL, NULL);
- *not_tcolor = gconf_client_notify_add (config, CALENDAR_CONFIG_MARCUS_BAINS_COLOR_TIMEBAR, func, data, NULL, NULL);
-}
-
-/* Whether we show week number in the Day View. */
-gboolean
-calendar_config_get_dview_show_week_no (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_DV_WEEK_NUMBER, NULL);
-}
-
-void
-calendar_config_set_dview_show_week_no (gboolean show_week_no)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_DV_WEEK_NUMBER, show_week_no, NULL);
-}
-
-guint
-calendar_config_add_notification_dview_show_week_no (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_DV_WEEK_NUMBER, func, data, NULL, NULL);
-
- return id;
-}
-
/* Whether we show week numbers in the Date Navigator. */
gboolean
calendar_config_get_dnav_show_week_no (void)
@@ -528,14 +368,6 @@ calendar_config_get_dnav_show_week_no (void)
return gconf_client_get_bool (config, CALENDAR_CONFIG_DN_SHOW_WEEK_NUMBERS, NULL);
}
-void
-calendar_config_set_dnav_show_week_no (gboolean show_week_no)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_DN_SHOW_WEEK_NUMBERS, show_week_no, NULL);
-}
-
guint
calendar_config_add_notification_dnav_show_week_no (GConfClientNotifyFunc func, gpointer data)
{
@@ -565,34 +397,6 @@ calendar_config_set_hpane_pos (gint hpane_pos)
gconf_client_set_int (config, CALENDAR_CONFIG_HPANE_POS, hpane_pos, NULL);
}
-gboolean
-calendar_config_get_preview_state (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_TASK_PREVIEW, NULL);
-}
-
-void
-calendar_config_set_preview_state (gboolean state)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_TASK_PREVIEW, state, NULL);
-}
-
-guint
-calendar_config_add_notification_preview_state (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_TASK_PREVIEW, func, data, NULL, NULL);
-
- return id;
-}
-
gint
calendar_config_get_month_hpane_pos (void)
{
@@ -609,22 +413,6 @@ calendar_config_set_month_hpane_pos (gint hpane_pos)
gconf_client_set_int (config, CALENDAR_CONFIG_MONTH_HPANE_POS, hpane_pos, NULL);
}
-gfloat
-calendar_config_get_tag_vpane_pos (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_float (config, CALENDAR_CONFIG_TAG_VPANE_POS, NULL);
-}
-
-void
-calendar_config_set_tag_vpane_pos (gfloat vpane_pos)
-{
- calendar_config_init ();
-
- gconf_client_set_float (config, CALENDAR_CONFIG_TAG_VPANE_POS, vpane_pos, NULL);
-}
-
/* The current list of task lists selected */
GSList *
calendar_config_get_tasks_selected (void)
@@ -683,22 +471,6 @@ calendar_config_add_notification_primary_tasks (GConfClientNotifyFunc func, gpoi
return id;
}
-gint
-calendar_config_get_task_vpane_pos (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_int (config, CALENDAR_CONFIG_TASK_VPANE_POS, NULL);
-}
-
-void
-calendar_config_set_task_vpane_pos (gint vpane_pos)
-{
- calendar_config_init ();
-
- gconf_client_set_int (config, CALENDAR_CONFIG_TASK_VPANE_POS, vpane_pos, NULL);
-}
-
/***************************************/
/* The current list of memo lists selected */
@@ -769,55 +541,6 @@ calendar_config_get_compress_weekend (void)
return gconf_client_get_bool (config, CALENDAR_CONFIG_COMPRESS_WEEKEND, NULL);
}
-void
-calendar_config_set_compress_weekend (gboolean compress)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_COMPRESS_WEEKEND, compress, NULL);
-}
-
-guint
-calendar_config_add_notification_compress_weekend (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_COMPRESS_WEEKEND, func, data, NULL, NULL);
-
- return id;
-}
-
-/* Whether we show event end times. */
-gboolean
-calendar_config_get_show_event_end (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_EVENT_END, NULL);
-}
-
-void
-calendar_config_set_show_event_end (gboolean show_end)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_EVENT_END, show_end, NULL);
-}
-
-guint
-calendar_config_add_notification_show_event_end (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_SHOW_EVENT_END, func, data, NULL, NULL);
-
- return id;
-}
-
/* The working days of the week, a bit-wise combination of flags. */
CalWeekdays
calendar_config_get_working_days (void)
@@ -827,14 +550,6 @@ calendar_config_get_working_days (void)
return gconf_client_get_int (config, CALENDAR_CONFIG_WORKING_DAYS, NULL);
}
-void
-calendar_config_set_working_days (CalWeekdays days)
-{
- calendar_config_init ();
-
- gconf_client_set_int (config, CALENDAR_CONFIG_WORKING_DAYS, days, NULL);
-}
-
guint
calendar_config_add_notification_working_days (GConfClientNotifyFunc func, gpointer data)
{
@@ -864,18 +579,6 @@ calendar_config_set_hide_completed_tasks (gboolean hide)
gconf_client_set_bool (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED, hide, NULL);
}
-guint
-calendar_config_add_notification_hide_completed_tasks (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED , func, data, NULL, NULL);
-
- return id;
-}
-
CalUnits
calendar_config_get_hide_completed_tasks_units (void)
{
@@ -921,18 +624,6 @@ calendar_config_set_hide_completed_tasks_units (CalUnits cu)
g_free (units);
}
-guint
-calendar_config_add_notification_hide_completed_tasks_units (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_UNITS , func, data, NULL, NULL);
-
- return id;
-}
-
gint
calendar_config_get_hide_completed_tasks_value (void)
{
@@ -949,18 +640,6 @@ calendar_config_set_hide_completed_tasks_value (gint value)
gconf_client_set_int (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_VALUE, value, NULL);
}
-guint
-calendar_config_add_notification_hide_completed_tasks_value (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_VALUE , func, data, NULL, NULL);
-
- return id;
-}
-
/**
* calendar_config_get_confirm_delete:
*
@@ -978,162 +657,6 @@ calendar_config_get_confirm_delete (void)
}
/**
- * calendar_config_set_confirm_delete:
- * @confirm: Whether confirmation is required when deleting items.
- *
- * Sets the configuration value for whether a confirmation dialog is presented
- * when deleting calendar/tasks items.
- **/
-void
-calendar_config_set_confirm_delete (gboolean confirm)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_PROMPT_DELETE, confirm, NULL);
-}
-
-/**
- * calendar_config_get_confirm_purge:
- *
- * Queries the configuration value for whether a confirmation dialog is
- * presented when purging calendar/tasks items.
- *
- * Return value: Whether confirmation is required when purging items.
- **/
-gboolean
-calendar_config_get_confirm_purge (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_bool (config, CALENDAR_CONFIG_PROMPT_PURGE, NULL);
-}
-
-/**
- * calendar_config_set_confirm_purge:
- * @confirm: Whether confirmation is required when purging items.
- *
- * Sets the configuration value for whether a confirmation dialog is presented
- * when purging calendar/tasks items.
- **/
-void
-calendar_config_set_confirm_purge (gboolean confirm)
-{
- calendar_config_init ();
-
- gconf_client_set_bool (config, CALENDAR_CONFIG_PROMPT_PURGE, confirm, NULL);
-}
-
-/**
- * calendar_config_get_tasks_due_today_color:
- * @color: the location to store the color
- *
- * Queries the color to be used to display tasks that are due today.
- **/
-void
-calendar_config_get_tasks_due_today_color (GdkColor *color)
-{
- const gchar *key = CALENDAR_CONFIG_TASKS_DUE_TODAY_COLOR;
- GError *error = NULL;
- gchar *color_spec;
-
- g_return_if_fail (color != NULL);
-
- calendar_config_init ();
-
- color_spec = gconf_client_get_string (config, key, &error);
-
- if (color_spec != NULL && !gdk_color_parse (color_spec, color))
- g_warning ("Unknown color \"%s\"", color_spec);
- else if (error != NULL) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
-
- g_free (color_spec);
-}
-
-/**
- * calendar_config_set_tasks_due_today_color:
- * @color: a #GdkColor
- *
- * Sets the color to be used to display tasks that are due today.
- **/
-void
-calendar_config_set_tasks_due_today_color (GdkColor *color)
-{
- const gchar *key = CALENDAR_CONFIG_TASKS_DUE_TODAY_COLOR;
- GError *error = NULL;
- gchar color_spec[16];
-
- g_return_if_fail (color != NULL);
-
- g_snprintf (color_spec, sizeof (color_spec), "#%04x%04x%04x",
- color->red, color->green, color->blue);
-
- calendar_config_init ();
-
- if (!gconf_client_set_string (config, key, color_spec, &error)) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
-}
-
-/**
- * calendar_config_get_tasks_overdue_color:
- * @color: the location to store the color
- *
- * Queries the color to be used to display overdue tasks.
- **/
-void
-calendar_config_get_tasks_overdue_color (GdkColor *color)
-{
- const gchar *key = CALENDAR_CONFIG_TASKS_OVERDUE_COLOR;
- GError *error = NULL;
- gchar *color_spec;
-
- g_return_if_fail (color != NULL);
-
- calendar_config_init ();
-
- color_spec = gconf_client_get_string (config, key, &error);
-
- if (color_spec != NULL && !gdk_color_parse (color_spec, color))
- g_warning ("Unknown color \"%s\"", color_spec);
- else if (error != NULL) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
-
- g_free (color_spec);
-}
-
-/**
- * calendar_config_set_tasks_overdue_color:
- * @color: a #GdkColor
- *
- * Sets the color to be used to display overdue tasks.
- **/
-void
-calendar_config_set_tasks_overdue_color (GdkColor *color)
-{
- const gchar *key = CALENDAR_CONFIG_TASKS_OVERDUE_COLOR;
- GError *error = NULL;
- gchar color_spec[16];
-
- g_return_if_fail (color != NULL);
-
- g_snprintf (color_spec, sizeof (color_spec), "#%04x%04x%04x",
- color->red, color->green, color->blue);
-
- calendar_config_init ();
-
- if (!gconf_client_set_string (config, key, color_spec, &error)) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
-}
-
-/**
* calendar_config_get_use_default_reminder:
*
* Queries whether new appointments should be created with a default reminder.
diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h
index 241ed8fe4c..dddffe6a92 100644
--- a/calendar/gui/calendar-config.h
+++ b/calendar/gui/calendar-config.h
@@ -71,86 +71,49 @@ gchar * calendar_config_get_timezone (void);
gchar * calendar_config_get_timezone_stored (void);
icaltimezone *calendar_config_get_icaltimezone (void);
void calendar_config_set_timezone (const gchar *timezone);
-guint calendar_config_add_notification_timezone (GConfClientNotifyFunc func, gpointer data);
/* The working days of the week, a bit-wise combination of flags. */
CalWeekdays calendar_config_get_working_days (void);
-void calendar_config_set_working_days (CalWeekdays days);
guint calendar_config_add_notification_working_days (GConfClientNotifyFunc func, gpointer data);
/* The start day of the week (0 = Sun to 6 = Sat). */
gint calendar_config_get_week_start_day (void);
-void calendar_config_set_week_start_day (gint week_start_day);
-guint calendar_config_add_notification_week_start_day (GConfClientNotifyFunc func, gpointer data);
/* The start and end times of the work-day. */
gint calendar_config_get_day_start_hour (void);
void calendar_config_set_day_start_hour (gint day_start_hour);
-guint calendar_config_add_notification_day_start_hour (GConfClientNotifyFunc func, gpointer data);
gint calendar_config_get_day_start_minute (void);
void calendar_config_set_day_start_minute (gint day_start_min);
-guint calendar_config_add_notification_day_start_minute (GConfClientNotifyFunc func, gpointer data);
gint calendar_config_get_day_end_hour (void);
void calendar_config_set_day_end_hour (gint day_end_hour);
-guint calendar_config_add_notification_day_end_hour (GConfClientNotifyFunc func, gpointer data);
gint calendar_config_get_day_end_minute (void);
void calendar_config_set_day_end_minute (gint day_end_min);
-guint calendar_config_add_notification_day_end_minute (GConfClientNotifyFunc func, gpointer data);
/* Whether we use 24-hour format or 12-hour format (AM/PM). */
gboolean calendar_config_get_24_hour_format (void);
-void calendar_config_set_24_hour_format (gboolean use_24_hour);
-guint calendar_config_add_notification_24_hour_format (GConfClientNotifyFunc func, gpointer data);
/* The time divisions in the Day/Work-Week view in minutes (5/10/15/30/60). */
gint calendar_config_get_time_divisions (void);
void calendar_config_set_time_divisions (gint divisions);
guint calendar_config_add_notification_time_divisions (GConfClientNotifyFunc func, gpointer data);
-/* Whether we show the Marcus Bains Line, and in what colors. */
-void calendar_config_get_marcus_bains (gboolean *show_line, const gchar **dayview_color, const gchar **timebar_color);
-void calendar_config_add_notification_marcus_bains (GConfClientNotifyFunc func, gpointer data, gint *not_show, gint *not_dcolor, gint *not_tcolor);
-
-/* Whether we show event end times. */
-gboolean calendar_config_get_show_event_end (void);
-void calendar_config_set_show_event_end (gboolean show_end);
-guint calendar_config_add_notification_show_event_end (GConfClientNotifyFunc func, gpointer data);
-
/* Whether we compress the weekend in the week/month views. */
gboolean calendar_config_get_compress_weekend (void);
-void calendar_config_set_compress_weekend (gboolean compress);
-guint calendar_config_add_notification_compress_weekend (GConfClientNotifyFunc func, gpointer data);
/* Whether we show week numbers in the Date Navigator. */
gboolean calendar_config_get_dnav_show_week_no (void);
-void calendar_config_set_dnav_show_week_no (gboolean show_week_no);
guint calendar_config_add_notification_dnav_show_week_no (GConfClientNotifyFunc func, gpointer data);
-/* Whether we show week number in the day view. */
-gboolean calendar_config_get_dview_show_week_no (void);
-void calendar_config_set_dview_show_week_no (gboolean show_week_no);
-guint calendar_config_add_notification_dview_show_week_no (GConfClientNotifyFunc func, gpointer data);
-
/* The positions of the panes in the normal and month views. */
gint calendar_config_get_hpane_pos (void);
void calendar_config_set_hpane_pos (gint hpane_pos);
-gboolean calendar_config_get_preview_state (void);
-void calendar_config_set_preview_state (gboolean state);
-guint calendar_config_add_notification_preview_state (GConfClientNotifyFunc func, gpointer data);
-
gint calendar_config_get_month_hpane_pos (void);
void calendar_config_set_month_hpane_pos (gint hpane_pos);
-gint calendar_config_get_month_vpane_pos (void);
-void calendar_config_set_month_vpane_pos (gint vpane_pos);
-
-gfloat calendar_config_get_tag_vpane_pos (void);
-void calendar_config_set_tag_vpane_pos (gfloat vpane_pos);
-
/* The current list of task lists selected */
GSList *calendar_config_get_tasks_selected (void);
void calendar_config_set_tasks_selected (GSList *selected);
@@ -161,10 +124,6 @@ gchar *calendar_config_get_primary_tasks (void);
void calendar_config_set_primary_tasks (const gchar *primary_uid);
guint calendar_config_add_notification_primary_tasks (GConfClientNotifyFunc func, gpointer data);
-/* The pane position */
-gint calendar_config_get_task_vpane_pos (void);
-void calendar_config_set_task_vpane_pos (gint vpane_pos);
-
/* The current list of memo lists selected */
GSList *calendar_config_get_memos_selected (void);
void calendar_config_set_memos_selected (GSList *selected);
@@ -175,34 +134,20 @@ gchar *calendar_config_get_primary_memos (void);
void calendar_config_set_primary_memos (const gchar *primary_uid);
guint calendar_config_add_notification_primary_memos (GConfClientNotifyFunc func, gpointer data);
-/* Colors for the task list */
-void calendar_config_get_tasks_due_today_color (GdkColor *color);
-void calendar_config_set_tasks_due_today_color (GdkColor *color);
-
-void calendar_config_get_tasks_overdue_color (GdkColor *color);
-void calendar_config_set_tasks_overdue_color (GdkColor *color);
-
/* Settings to hide completed tasks. */
gboolean calendar_config_get_hide_completed_tasks (void);
void calendar_config_set_hide_completed_tasks (gboolean hide);
-guint calendar_config_add_notification_hide_completed_tasks (GConfClientNotifyFunc func, gpointer data);
CalUnits calendar_config_get_hide_completed_tasks_units(void);
void calendar_config_set_hide_completed_tasks_units(CalUnits units);
-guint calendar_config_add_notification_hide_completed_tasks_units (GConfClientNotifyFunc func, gpointer data);
gint calendar_config_get_hide_completed_tasks_value(void);
void calendar_config_set_hide_completed_tasks_value(gint value);
-guint calendar_config_add_notification_hide_completed_tasks_value (GConfClientNotifyFunc func, gpointer data);
gchar * calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed);
/* Confirmation options */
gboolean calendar_config_get_confirm_delete (void);
-void calendar_config_set_confirm_delete (gboolean confirm);
-
-gboolean calendar_config_get_confirm_purge (void);
-void calendar_config_set_confirm_purge (gboolean confirm);
/* Default reminder options */
gboolean calendar_config_get_use_default_reminder (void);
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index 09f6d104b6..5c56d69007 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -37,10 +37,6 @@
#include <glib/gi18n.h>
#include <string.h>
-static const gint week_start_day_map[] = {
- 1, 2, 3, 4, 5, 6, 0, -1
-};
-
static const gint time_division_map[] = {
60, 30, 15, 10, 5, -1
};
@@ -99,22 +95,6 @@ eccp_widget_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
}
static void
-working_days_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
-{
- CalWeekdays working_days = 0;
- guint32 mask = 1;
- gint day;
-
- for (day = 0; day < 7; day++) {
- if (e_dialog_toggle_get (prefs->working_days[day]))
- working_days |= mask;
- mask <<= 1;
- }
-
- calendar_config_set_working_days (working_days);
-}
-
-static void
timezone_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
{
icaltimezone *zone;
@@ -268,27 +248,6 @@ end_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
calendar_config_set_day_end_hour (end_hour);
calendar_config_set_day_end_minute (end_minute);
}
-static void
-week_start_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
-{
- gint week_start_day;
-
- week_start_day = e_dialog_combo_box_get (prefs->week_start_day, week_start_day_map);
- calendar_config_set_week_start_day (week_start_day);
-}
-
-static void
-use_24_hour_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
-{
- gboolean use_24_hour;
-
- use_24_hour = gtk_toggle_button_get_active (toggle);
-
- e_date_edit_set_use_24_hour_format (E_DATE_EDIT (prefs->start_of_day), use_24_hour);
- e_date_edit_set_use_24_hour_format (E_DATE_EDIT (prefs->end_of_day), use_24_hour);
-
- calendar_config_set_24_hour_format (use_24_hour);
-}
static void
time_divisions_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
@@ -300,30 +259,6 @@ time_divisions_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
}
static void
-show_end_times_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
-{
- calendar_config_set_show_event_end (gtk_toggle_button_get_active (toggle));
-}
-
-static void
-compress_weekend_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
-{
- calendar_config_set_compress_weekend (gtk_toggle_button_get_active (toggle));
-}
-
-static void
-dnav_show_week_no_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
-{
- calendar_config_set_dnav_show_week_no (gtk_toggle_button_get_active (toggle));
-}
-
-static void
-dview_show_week_no_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
-{
- calendar_config_set_dview_show_week_no (gtk_toggle_button_get_active (toggle));
-}
-
-static void
month_scroll_by_week_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
{
calendar_config_set_month_scroll_by_week (gtk_toggle_button_get_active (toggle));
@@ -356,30 +291,6 @@ hide_completed_tasks_units_changed (GtkWidget *widget, CalendarPrefsDialog *pref
}
static void
-tasks_due_today_set_color (GtkColorButton *color_button, CalendarPrefsDialog *prefs)
-{
- GdkColor color;
-
- gtk_color_button_get_color (color_button, &color);
- calendar_config_set_tasks_due_today_color (&color);
-}
-
-static void
-tasks_overdue_set_color (GtkColorButton *color_button, CalendarPrefsDialog *prefs)
-{
- GdkColor color;
-
- gtk_color_button_get_color (color_button, &color);
- calendar_config_set_tasks_overdue_color (&color);
-}
-
-static void
-confirm_delete_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
-{
- calendar_config_set_confirm_delete (gtk_toggle_button_get_active (toggle));
-}
-
-static void
default_reminder_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs)
{
calendar_config_set_use_default_reminder (gtk_toggle_button_get_active (toggle));
@@ -516,27 +427,14 @@ update_system_tz_widgets (EShellSettings *shell_settings,
static void
setup_changes (CalendarPrefsDialog *prefs)
{
- gint i;
-
- for (i = 0; i < 7; i ++)
- g_signal_connect (G_OBJECT (prefs->working_days[i]), "toggled", G_CALLBACK (working_days_changed), prefs);
-
g_signal_connect (G_OBJECT (prefs->timezone), "changed", G_CALLBACK (timezone_changed), prefs);
g_signal_connect (G_OBJECT (prefs->day_second_zone), "clicked", G_CALLBACK (day_second_zone_clicked), prefs);
g_signal_connect (G_OBJECT (prefs->start_of_day), "changed", G_CALLBACK (start_of_day_changed), prefs);
g_signal_connect (G_OBJECT (prefs->end_of_day), "changed", G_CALLBACK (end_of_day_changed), prefs);
- g_signal_connect (G_OBJECT (prefs->week_start_day), "changed", G_CALLBACK (week_start_day_changed), prefs);
-
- g_signal_connect (G_OBJECT (prefs->use_24_hour), "toggled", G_CALLBACK (use_24_hour_toggled), prefs);
-
g_signal_connect (G_OBJECT (prefs->time_divisions), "changed", G_CALLBACK (time_divisions_changed), prefs);
- g_signal_connect (G_OBJECT (prefs->show_end_times), "toggled", G_CALLBACK (show_end_times_toggled), prefs);
- g_signal_connect (G_OBJECT (prefs->compress_weekend), "toggled", G_CALLBACK (compress_weekend_toggled), prefs);
- g_signal_connect (G_OBJECT (prefs->dnav_show_week_no), "toggled", G_CALLBACK (dnav_show_week_no_toggled), prefs);
- g_signal_connect (G_OBJECT (prefs->dview_show_week_no), "toggled", G_CALLBACK (dview_show_week_no_toggled), prefs);
g_signal_connect (G_OBJECT (prefs->month_scroll_by_week), "toggled", G_CALLBACK (month_scroll_by_week_toggled), prefs);
g_signal_connect (G_OBJECT (prefs->tasks_hide_completed), "toggled",
@@ -544,12 +442,7 @@ setup_changes (CalendarPrefsDialog *prefs)
g_signal_connect (G_OBJECT (prefs->tasks_hide_completed_interval), "value-changed",
G_CALLBACK (hide_completed_tasks_changed), prefs);
g_signal_connect (G_OBJECT (prefs->tasks_hide_completed_units), "changed", G_CALLBACK (hide_completed_tasks_units_changed), prefs);
- g_signal_connect (G_OBJECT (prefs->tasks_due_today_color), "color-set",
- G_CALLBACK (tasks_due_today_set_color), prefs);
- g_signal_connect (G_OBJECT (prefs->tasks_overdue_color), "color-set",
- G_CALLBACK (tasks_overdue_set_color), prefs);
- g_signal_connect (G_OBJECT (prefs->confirm_delete), "toggled", G_CALLBACK (confirm_delete_toggled), prefs);
g_signal_connect (G_OBJECT (prefs->default_reminder), "toggled", G_CALLBACK (default_reminder_toggled), prefs);
g_signal_connect (G_OBJECT (prefs->default_reminder_interval), "changed",
G_CALLBACK (default_reminder_interval_changed), prefs);
@@ -582,19 +475,9 @@ show_fb_config (CalendarPrefsDialog *prefs)
static void
show_task_list_config (CalendarPrefsDialog *prefs)
{
- GtkColorButton *color_button;
- GdkColor color;
CalUnits units;
gboolean hide_completed_tasks;
- color_button = GTK_COLOR_BUTTON (prefs->tasks_due_today_color);
- calendar_config_get_tasks_due_today_color (&color);
- gtk_color_button_set_color (color_button, &color);
-
- color_button = GTK_COLOR_BUTTON (prefs->tasks_overdue_color);
- calendar_config_get_tasks_overdue_color (&color);
- gtk_color_button_set_color (color_button, &color);
-
/* Hide Completed Tasks. */
hide_completed_tasks = calendar_config_get_hide_completed_tasks ();
e_dialog_toggle_set (prefs->tasks_hide_completed, hide_completed_tasks);
@@ -652,8 +535,7 @@ show_alarms_config (CalendarPrefsDialog *prefs)
static void
show_config (CalendarPrefsDialog *prefs)
{
- CalWeekdays working_days;
- gint mask, day, week_start_day, time_divisions;
+ gint mask, day, time_divisions;
icaltimezone *zone;
gboolean sensitive, set = FALSE;
gchar *location;
@@ -672,50 +554,16 @@ show_config (CalendarPrefsDialog *prefs)
/* Day's second zone */
update_day_second_zone_caption (prefs);
- /* Working Days. */
- working_days = calendar_config_get_working_days ();
- mask = 1 << 0;
- for (day = 0; day < 7; day++) {
- e_dialog_toggle_set (prefs->working_days[day], (working_days & mask) ? TRUE : FALSE);
- mask <<= 1;
- }
-
- /* Week Start Day. */
- week_start_day = calendar_config_get_week_start_day ();
- e_dialog_combo_box_set (prefs->week_start_day, week_start_day, week_start_day_map);
-
/* Start of Day. */
e_date_edit_set_time_of_day (E_DATE_EDIT (prefs->start_of_day), calendar_config_get_day_start_hour (), calendar_config_get_day_start_minute ());
/* End of Day. */
e_date_edit_set_time_of_day (E_DATE_EDIT (prefs->end_of_day), calendar_config_get_day_end_hour (), calendar_config_get_day_end_minute ());
- /* 12/24 Hour Format. */
- if (calendar_config_get_24_hour_format ())
- e_dialog_toggle_set (prefs->use_24_hour, TRUE);
- else
- e_dialog_toggle_set (prefs->use_12_hour, TRUE);
-
- sensitive = calendar_config_locale_supports_12_hour_format ();
- gtk_widget_set_sensitive (prefs->use_12_hour, sensitive);
- gtk_widget_set_sensitive (prefs->use_24_hour, sensitive);
-
/* Time Divisions. */
time_divisions = calendar_config_get_time_divisions ();
e_dialog_combo_box_set (prefs->time_divisions, time_divisions, time_division_map);
- /* Show Appointment End Times. */
- e_dialog_toggle_set (prefs->show_end_times, calendar_config_get_show_event_end ());
-
- /* Compress Weekend. */
- e_dialog_toggle_set (prefs->compress_weekend, calendar_config_get_compress_weekend ());
-
- /* Date Navigator - Show Week Numbers. */
- e_dialog_toggle_set (prefs->dnav_show_week_no, calendar_config_get_dnav_show_week_no ());
-
- /* Day/Work Week view - Show Week Number. */
- e_dialog_toggle_set (prefs->dview_show_week_no, calendar_config_get_dview_show_week_no ());
-
/* Month View - Scroll by a week */
e_dialog_toggle_set (prefs->month_scroll_by_week, calendar_config_get_month_scroll_by_week ());
@@ -729,7 +577,6 @@ show_config (CalendarPrefsDialog *prefs)
show_fb_config (prefs);
/* Other page */
- e_dialog_toggle_set (prefs->confirm_delete, calendar_config_get_confirm_delete ());
e_dialog_toggle_set (prefs->default_reminder, calendar_config_get_use_default_reminder ());
e_dialog_spin_set (prefs->default_reminder_interval, calendar_config_get_default_reminder_interval ());
e_dialog_combo_box_set (prefs->default_reminder_units, calendar_config_get_default_reminder_units (), default_reminder_units_map);
@@ -771,23 +618,18 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
ECalConfig *ec;
ECalConfigTargetPrefs *target;
EShellSettings *shell_settings;
+ gboolean locale_supports_12_hour_format;
gint i;
GtkWidget *toplevel;
GtkWidget *widget;
GSList *l;
- const gchar *working_day_names[] = {
- "sun_button",
- "mon_button",
- "tue_button",
- "wed_button",
- "thu_button",
- "fri_button",
- "sat_button",
- };
gchar *gladefile;
shell_settings = e_shell_get_shell_settings (shell);
+ locale_supports_12_hour_format =
+ calendar_config_locale_supports_12_hour_format ();
+
gladefile = g_build_filename (EVOLUTION_GLADEDIR,
"cal-prefs-dialog.glade",
NULL);
@@ -828,14 +670,78 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
prefs->system_tz_label = glade_xml_get_widget (gui, "system-tz-label");
prefs->timezone = glade_xml_get_widget (gui, "timezone");
prefs->day_second_zone = glade_xml_get_widget (gui, "day_second_zone");
- for (i = 0; i < 7; i++)
- prefs->working_days[i] = glade_xml_get_widget (gui, working_day_names[i]);
- prefs->week_start_day = glade_xml_get_widget (gui, "week_start_day");
- prefs->start_of_day = glade_xml_get_widget (gui, "start_of_day");
- prefs->end_of_day = glade_xml_get_widget (gui, "end_of_day");
- prefs->use_12_hour = glade_xml_get_widget (gui, "use_12_hour");
- prefs->use_24_hour = glade_xml_get_widget (gui, "use_24_hour");
- prefs->confirm_delete = glade_xml_get_widget (gui, "confirm_delete");
+
+ widget = glade_xml_get_widget (gui, "sun_button");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-working-days-sunday",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "mon_button");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-working-days-monday",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "tue_button");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-working-days-tuesday",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "wed_button");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-working-days-wednesday",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "thu_button");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-working-days-thursday",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "fri_button");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-working-days-friday",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "sat_button");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-working-days-saturday",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "week_start_day");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "start_of_day");
+ prefs->start_of_day = widget; /* XXX delete this */
+ if (locale_supports_12_hour_format)
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-use-24-hour-format",
+ G_OBJECT (widget), "use-24-hour-format");
+
+ widget = glade_xml_get_widget (gui, "end_of_day");
+ prefs->end_of_day = widget; /* XXX delete this */
+ if (locale_supports_12_hour_format)
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-use-24-hour-format",
+ G_OBJECT (widget), "use-24-hour-format");
+
+ widget = glade_xml_get_widget (gui, "use_12_hour");
+ gtk_widget_set_sensitive (widget, locale_supports_12_hour_format);
+ e_mutual_binding_new_with_negation (
+ G_OBJECT (shell_settings), "cal-use-24-hour-format",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "use_24_hour");
+ gtk_widget_set_sensitive (widget, locale_supports_12_hour_format);
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-use-24-hour-format",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "confirm_delete");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-confirm-delete",
+ G_OBJECT (widget), "active");
+
prefs->default_reminder = glade_xml_get_widget (gui, "default_reminder");
prefs->default_reminder_interval = glade_xml_get_widget (gui, "default_reminder_interval");
prefs->default_reminder_units = glade_xml_get_widget (gui, "default_reminder_units");
@@ -845,13 +751,45 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
/* Display tab */
prefs->time_divisions = glade_xml_get_widget (gui, "time_divisions");
- prefs->show_end_times = glade_xml_get_widget (gui, "show_end_times");
- prefs->compress_weekend = glade_xml_get_widget (gui, "compress_weekend");
- prefs->dnav_show_week_no = glade_xml_get_widget (gui, "dnav_show_week_no");
- prefs->dview_show_week_no = glade_xml_get_widget (gui, "dview_show_week_no");
+
+ widget = glade_xml_get_widget (gui, "show_end_times");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-show-event-end-times",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "compress_weekend");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-compress-weekend",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "dnav_show_week_no");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers",
+ G_OBJECT (widget), "active");
+
+ widget = glade_xml_get_widget (gui, "dview_show_week_no");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-day-view-show-week-numbers",
+ G_OBJECT (widget), "active");
+
prefs->month_scroll_by_week = glade_xml_get_widget (gui, "month_scroll_by_week");
- prefs->tasks_due_today_color = glade_xml_get_widget (gui, "tasks_due_today_color");
- prefs->tasks_overdue_color = glade_xml_get_widget (gui, "tasks_overdue_color");
+
+ widget = glade_xml_get_widget (gui, "tasks_due_today_color");
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "cal-tasks-color-due-today",
+ G_OBJECT (widget), "color",
+ e_binding_transform_string_to_color,
+ e_binding_transform_color_to_string,
+ (GDestroyNotify) NULL, NULL);
+
+ widget = glade_xml_get_widget (gui, "tasks_overdue_color");
+ e_mutual_binding_new_full (
+ G_OBJECT (shell_settings), "cal-tasks-color-overdue",
+ G_OBJECT (widget), "color",
+ e_binding_transform_string_to_color,
+ e_binding_transform_color_to_string,
+ (GDestroyNotify) NULL, NULL);
+
prefs->tasks_hide_completed = glade_xml_get_widget (gui, "tasks_hide_completed");
prefs->tasks_hide_completed_interval = glade_xml_get_widget (gui, "tasks_hide_completed_interval");
prefs->tasks_hide_completed_units = glade_xml_get_widget (gui, "tasks_hide_completed_units");
@@ -918,7 +856,6 @@ cal_prefs_dialog_create_time_edit (void)
dedit = e_date_edit_new ();
gtk_widget_show (GTK_WIDGET (dedit));
- e_date_edit_set_use_24_hour_format (E_DATE_EDIT (dedit), calendar_config_get_24_hour_format ());
e_date_edit_set_time_popup_range (E_DATE_EDIT (dedit), 0, 24);
e_date_edit_set_show_date (E_DATE_EDIT (dedit), FALSE);
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h
index 0889a395bf..5d0a3716a6 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.h
+++ b/calendar/gui/dialogs/cal-prefs-dialog.h
@@ -69,8 +69,6 @@ struct _CalendarPrefsDialog {
GtkWidget *week_start_day;
GtkWidget *start_of_day;
GtkWidget *end_of_day;
- GtkWidget *use_12_hour;
- GtkWidget *use_24_hour;
GtkWidget *confirm_delete;
GtkWidget *default_reminder;
GtkWidget *default_reminder_interval;
@@ -86,8 +84,6 @@ struct _CalendarPrefsDialog {
GtkWidget *dnav_show_week_no;
GtkWidget *dview_show_week_no;
GtkWidget *month_scroll_by_week;
- GtkWidget *tasks_due_today_color;
- GtkWidget *tasks_overdue_color;
GtkWidget *tasks_hide_completed;
GtkWidget *tasks_hide_completed_interval;
GtkWidget *tasks_hide_completed_units;
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index e330a7f9d4..cfe4139708 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -32,8 +32,9 @@
#include <glib/gi18n.h>
#include <libedataserver/e-time-utils.h>
#include <libecal/e-cal-time-util.h>
+#include "e-util/e-binding.h"
+#include "widgets/misc/e-dateedit.h"
#include "../calendar-config.h"
-#include "../e-date-edit-config.h"
#include "comp-editor-util.h"
@@ -204,16 +205,9 @@ comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label)
gtk_label_set_text (GTK_LABEL (label), buffer);
}
-static void
-date_edit_destroy_cb (EDateEdit *date_edit, gpointer data)
-{
- EDateEditConfig *config = data;
-
- g_object_unref (config);
-}
-
/**
* comp_editor_new_date_edit:
+ * @shell_settings: an #EShellSettings
* @show_date: Whether to show a date picker in the widget.
* @show_time: Whether to show a time picker in the widget.
* @make_time_insensitive: Whether the time field is made insensitive rather
@@ -225,11 +219,14 @@ date_edit_destroy_cb (EDateEdit *date_edit, gpointer data)
* Return value: A newly-created #EDateEdit widget.
**/
GtkWidget *
-comp_editor_new_date_edit (gboolean show_date, gboolean show_time,
- gboolean make_time_insensitive)
+comp_editor_new_date_edit (EShellSettings *shell_settings,
+ gboolean show_date,
+ gboolean show_time,
+ gboolean make_time_insensitive)
{
EDateEdit *dedit;
- EDateEditConfig *config;
+
+ g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL);
dedit = E_DATE_EDIT (e_date_edit_new ());
@@ -241,8 +238,13 @@ comp_editor_new_date_edit (gboolean show_date, gboolean show_time,
e_date_edit_set_make_time_insensitive (dedit, FALSE);
#endif
- config = e_date_edit_config_new (dedit);
- g_signal_connect (G_OBJECT (dedit), "destroy", G_CALLBACK (date_edit_destroy_cb), config);
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers",
+ G_OBJECT (dedit), "show-week-numbers");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ G_OBJECT (dedit), "week-start-day");
return GTK_WIDGET (dedit);
}
diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h
index c2b5a052a3..96638aabd0 100644
--- a/calendar/gui/dialogs/comp-editor-util.h
+++ b/calendar/gui/dialogs/comp-editor-util.h
@@ -26,6 +26,7 @@
#define _COMP_EDITOR_UTIL_H_
#include <gtk/gtk.h>
+#include <shell/e-shell-settings.h>
#include "comp-editor-page.h"
void comp_editor_dates (CompEditorPageDates *date, ECalComponent *comp);
@@ -33,8 +34,10 @@ void comp_editor_free_dates (CompEditorPageDates *dates);
void comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label);
-GtkWidget *comp_editor_new_date_edit (gboolean show_date, gboolean show_time,
- gboolean make_time_insensitive);
+GtkWidget * comp_editor_new_date_edit (EShellSettings *shell_settings,
+ gboolean show_date,
+ gboolean show_time,
+ gboolean make_time_insensitive);
struct tm comp_editor_get_current_time (GtkObject *object, gpointer data);
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index ed31badd11..de62e687a8 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -3173,7 +3173,13 @@ GtkWidget *make_date_edit (void);
GtkWidget *
make_date_edit (void)
{
- return comp_editor_new_date_edit (TRUE, TRUE, TRUE);
+ EShell *shell;
+ EShellSettings *shell_settings;
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ return comp_editor_new_date_edit (shell_settings, TRUE, TRUE, TRUE);
}
GtkWidget *make_timezone_entry (void);
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index 1edee08466..a510328af6 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -1201,9 +1201,14 @@ GtkWidget *memo_page_create_date_edit (void);
GtkWidget *
memo_page_create_date_edit (void)
{
+ EShell *shell;
+ EShellSettings *shell_settings;
GtkWidget *widget;
- widget = comp_editor_new_date_edit (TRUE, FALSE, TRUE);
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ widget = comp_editor_new_date_edit (shell_settings, TRUE, FALSE, TRUE);
e_date_edit_set_allow_no_date_set (E_DATE_EDIT (widget), TRUE);
gtk_widget_show (widget);
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index 092a44db15..66f21522b5 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -34,6 +34,7 @@
#include <glib/gi18n.h>
#include <glade/glade.h>
#include <libedataserver/e-time-utils.h>
+#include <e-util/e-binding.h>
#include <e-util/e-dialog-widgets.h>
#include <e-util/e-util-private.h>
#include <misc/e-dateedit.h>
@@ -44,7 +45,6 @@
#include "../weekday-picker.h"
#include "comp-editor-util.h"
#include "../e-date-time-list.h"
-#include "../e-mini-calendar-config.h"
#include "recurrence-page.h"
#define RECURRENCE_PAGE_GET_PRIVATE(obj) \
@@ -186,7 +186,6 @@ struct _RecurrencePagePrivate {
/* For the recurrence preview, the actual widget */
GtkWidget *preview_calendar;
- EMiniCalendarConfig *preview_calendar_config;
};
@@ -321,11 +320,6 @@ recurrence_page_dispose (GObject *object)
priv->exception_list_store = NULL;
}
- if (priv->preview_calendar_config != NULL) {
- g_object_unref (priv->preview_calendar_config);
- priv->preview_calendar_config = NULL;
- }
-
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (recurrence_page_parent_class)->dispose (object);
}
@@ -1329,6 +1323,8 @@ static void
make_ending_until_special (RecurrencePage *rpage)
{
RecurrencePagePrivate *priv = rpage->priv;
+ EShell *shell;
+ EShellSettings *shell_settings;
CompEditor *editor;
CompEditorFlags flags;
EDateEdit *de;
@@ -1340,10 +1336,13 @@ make_ending_until_special (RecurrencePage *rpage)
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
flags = comp_editor_get_flags (editor);
+ shell = comp_editor_get_shell (editor);
+ shell_settings = e_shell_get_shell_settings (shell);
+
/* Create the widget */
- priv->ending_date_edit = comp_editor_new_date_edit (TRUE, FALSE,
- FALSE);
+ priv->ending_date_edit = comp_editor_new_date_edit (
+ shell_settings, TRUE, FALSE, FALSE);
de = E_DATE_EDIT (priv->ending_date_edit);
gtk_container_add (GTK_CONTAINER (priv->ending_special),
@@ -2068,9 +2067,16 @@ create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget **
{
RecurrencePagePrivate *priv;
GtkWidget *dialog, *toplevel;
+ CompEditor *editor;
+ EShell *shell;
+ EShellSettings *shell_settings;
priv = rpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
+ shell = comp_editor_get_shell (editor);
+ shell_settings = e_shell_get_shell_settings (shell);
+
toplevel = gtk_widget_get_toplevel (priv->main);
dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (toplevel),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -2078,7 +2084,7 @@ create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget **
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
NULL);
- *date_edit = comp_editor_new_date_edit (TRUE, FALSE, TRUE);
+ *date_edit = comp_editor_new_date_edit (shell_settings, TRUE, FALSE, TRUE);
gtk_widget_show (*date_edit);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), *date_edit, FALSE, TRUE, 6);
@@ -2234,6 +2240,9 @@ static void
init_widgets (RecurrencePage *rpage)
{
RecurrencePagePrivate *priv;
+ EShell *shell;
+ EShellSettings *shell_settings;
+ CompEditor *editor;
ECalendar *ecal;
GtkAdjustment *adj;
GtkTreeViewColumn *column;
@@ -2241,11 +2250,23 @@ init_widgets (RecurrencePage *rpage)
priv = rpage->priv;
+ editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
+ shell = comp_editor_get_shell (editor);
+ shell_settings = e_shell_get_shell_settings (shell);
+
/* Recurrence preview */
priv->preview_calendar = e_calendar_new ();
ecal = E_CALENDAR (priv->preview_calendar);
- priv->preview_calendar_config = e_mini_calendar_config_new (ecal);
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers",
+ G_OBJECT (ecal->calitem), "show-week-numbers");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ G_OBJECT (ecal->calitem), "week-start-day");
+
g_signal_connect((ecal->calitem), "date_range_changed",
G_CALLBACK (preview_date_range_changed_cb),
rpage);
@@ -2392,6 +2413,12 @@ GtkWidget *make_exdate_date_edit (void);
GtkWidget *
make_exdate_date_edit (void)
{
- return comp_editor_new_date_edit (TRUE, TRUE, FALSE);
+ EShell *shell;
+ EShellSettings *shell_settings;
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ return comp_editor_new_date_edit (shell_settings, TRUE, TRUE, FALSE);
}
diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c
index e6104ee2d0..38faa99c0b 100644
--- a/calendar/gui/dialogs/task-details-page.c
+++ b/calendar/gui/dialogs/task-details-page.c
@@ -768,9 +768,14 @@ GtkWidget *task_details_page_create_date_edit (void);
GtkWidget *
task_details_page_create_date_edit (void)
{
+ EShell *shell;
+ EShellSettings *shell_settings;
GtkWidget *dedit;
- dedit = comp_editor_new_date_edit (TRUE, TRUE, FALSE);
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ dedit = comp_editor_new_date_edit (shell_settings, TRUE, TRUE, FALSE);
e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE);
return dedit;
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 8a273c2944..08bcedc7e7 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -2150,9 +2150,14 @@ GtkWidget *task_page_create_date_edit (void);
GtkWidget *
task_page_create_date_edit (void)
{
+ EShell *shell;
+ EShellSettings *shell_settings;
GtkWidget *dedit;
- dedit = comp_editor_new_date_edit (TRUE, TRUE, TRUE);
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ dedit = comp_editor_new_date_edit (shell_settings, TRUE, TRUE, TRUE);
e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE);
return dedit;
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c
index 2bd1311c8e..5cf64aebf7 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -35,6 +35,7 @@
#include <glib/gstdio.h>
#include <gdk/gdkkeysyms.h>
#include <misc/e-gui-utils.h>
+#include <e-util/e-binding.h>
#include <table/e-table-memory-store.h>
#include <table/e-cell-checkbox.h>
#include <table/e-cell-toggle.h>
@@ -187,15 +188,15 @@ e_cal_list_view_save_state (ECalListView *cal_list_view, gchar *filename)
static void
setup_e_table (ECalListView *cal_list_view)
{
- ECalModelCalendar *model;
- ETableExtras *extras;
- GList *strings;
- ECell *cell, *popup_cell;
- GnomeCanvas *canvas;
- GtkStyle *style;
- gchar *etspecfile;
+ ECalModel *model;
+ ETableExtras *extras;
+ GList *strings;
+ ECell *cell, *popup_cell;
+ GnomeCanvas *canvas;
+ GtkStyle *style;
+ gchar *etspecfile;
- model = E_CAL_MODEL_CALENDAR (e_calendar_view_get_model (E_CALENDAR_VIEW (cal_list_view)));
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (cal_list_view));
/* Create the header columns */
@@ -217,9 +218,22 @@ setup_e_table (ECalListView *cal_list_view)
"bg_color_column", E_CAL_MODEL_FIELD_COLOR,
NULL);
+ e_mutual_binding_new (
+ G_OBJECT (model), "timezone",
+ G_OBJECT (cell), "timezone");
+
+ e_mutual_binding_new (
+ G_OBJECT (model), "use-24-hour-format",
+ G_OBJECT (cell), "use-24-hour-format");
+
popup_cell = e_cell_date_edit_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
g_object_unref (cell);
+
+ e_mutual_binding_new (
+ G_OBJECT (model), "use-24-hour-format",
+ G_OBJECT (popup_cell), "use-24-hour-format");
+
e_table_extras_add_cell (extras, "dateedit", popup_cell);
cal_list_view->dates_cell = E_CELL_DATE_EDIT (popup_cell);
diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c
index 452ce88b34..7c3529c80b 100644
--- a/calendar/gui/e-cal-model-calendar.c
+++ b/calendar/gui/e-cal-model-calendar.c
@@ -570,8 +570,12 @@ ecmc_fill_component_from_model (ECalModel *model, ECalModelComponent *comp_data,
/**
* e_cal_model_calendar_new
*/
-ECalModelCalendar *
-e_cal_model_calendar_new (void)
+ECalModel *
+e_cal_model_calendar_new (EShellSettings *shell_settings)
{
- return g_object_new (E_TYPE_CAL_MODEL_CALENDAR, NULL);
+ g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL);
+
+ return g_object_new (
+ E_TYPE_CAL_MODEL_CALENDAR,
+ "shell-settings", shell_settings, NULL);
}
diff --git a/calendar/gui/e-cal-model-calendar.h b/calendar/gui/e-cal-model-calendar.h
index abe536399f..f1027032cb 100644
--- a/calendar/gui/e-cal-model-calendar.h
+++ b/calendar/gui/e-cal-model-calendar.h
@@ -28,14 +28,29 @@
#include "e-cal-model.h"
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_CAL_MODEL_CALENDAR \
+ (e_cal_model_calendar_get_type ())
+#define E_CAL_MODEL_CALENDAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CAL_MODEL_CALENDAR, ECalModelCalendar))
+#define E_CAL_MODEL_CALENDAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CAL_MODEL_CALENDAR, ECalModelCalendarClass))
+#define E_IS_CAL_MODEL_CALENDAR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CAL_MODEL_CALENDAR))
+#define E_IS_CAL_MODEL_CALENDAR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CAL_MODEL_CALENDAR))
+#define E_CAL_MODEL_CALENDAR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CAL_MODEL_CALENDAR, ECalModelCalendarClass))
-#define E_TYPE_CAL_MODEL_CALENDAR (e_cal_model_calendar_get_type ())
-#define E_CAL_MODEL_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_MODEL_CALENDAR, ECalModelCalendar))
-#define E_CAL_MODEL_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_MODEL_CALENDAR, ECalModelCalendarClass))
-#define E_IS_CAL_MODEL_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_MODEL_CALENDAR))
-#define E_IS_CAL_MODEL_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_MODEL_CALENDAR))
+G_BEGIN_DECLS
+typedef struct _ECalModelCalendar ECalModelCalendar;
+typedef struct _ECalModelCalendarClass ECalModelCalendarClass;
typedef struct _ECalModelCalendarPrivate ECalModelCalendarPrivate;
typedef enum {
@@ -47,18 +62,18 @@ typedef enum {
E_CAL_MODEL_CALENDAR_FIELD_LAST
} ECalModelCalendarField;
-typedef struct {
- ECalModel model;
+struct _ECalModelCalendar {
+ ECalModel parent;
ECalModelCalendarPrivate *priv;
-} ECalModelCalendar;
+};
-typedef struct {
+struct _ECalModelCalendarClass {
ECalModelClass parent_class;
-} ECalModelCalendarClass;
+};
-GType e_cal_model_calendar_get_type (void);
-ECalModelCalendar *e_cal_model_calendar_new (void);
+GType e_cal_model_calendar_get_type (void);
+ECalModel * e_cal_model_calendar_new (EShellSettings *shell_settings);
G_END_DECLS
-#endif
+#endif /* E_CAL_MODEL_CALENDAR_H */
diff --git a/calendar/gui/e-cal-model-memos.c b/calendar/gui/e-cal-model-memos.c
index 38e55ef71a..41f63700c8 100644
--- a/calendar/gui/e-cal-model-memos.c
+++ b/calendar/gui/e-cal-model-memos.c
@@ -261,7 +261,11 @@ ecmm_fill_component_from_model (ECalModel *model, ECalModelComponent *comp_data,
* e_cal_model_memos_new
*/
ECalModel *
-e_cal_model_memos_new (void)
+e_cal_model_memos_new (EShellSettings *shell_settings)
{
- return g_object_new (E_TYPE_CAL_MODEL_MEMOS, NULL);
+ g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL);
+
+ return g_object_new (
+ E_TYPE_CAL_MODEL_MEMOS,
+ "shell-settings", shell_settings, NULL);
}
diff --git a/calendar/gui/e-cal-model-memos.h b/calendar/gui/e-cal-model-memos.h
index f7a5d17091..b58faa539b 100644
--- a/calendar/gui/e-cal-model-memos.h
+++ b/calendar/gui/e-cal-model-memos.h
@@ -29,14 +29,29 @@
#include "e-cal-model.h"
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_CAL_MODEL_MEMOS \
+ (e_cal_model_memos_get_type ())
+#define E_CAL_MODEL_MEMOS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CAL_MODEL_MEMOS, ECalModelMemo))
+#define E_CAL_MODEL_MEMOS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CAL_MODEL_MEMOS, ECalModelMemoClass))
+#define E_IS_CAL_MODEL_MEMOS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CAL_MODEL_MEMOS))
+#define E_IS_CAL_MODEL_MEMOS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CAL_MODEL_MEMOS))
+#define E_CAL_MODEL_MEMOS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CAL_MODEL_MEMOS, ECalModelMemoClass))
-#define E_TYPE_CAL_MODEL_MEMOS (e_cal_model_memos_get_type ())
-#define E_CAL_MODEL_MEMOS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_MODEL_MEMOS, ECalModelMemo))
-#define E_CAL_MODEL_MEMOS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_MODEL_MEMOS, ECalModelMemoClass))
-#define E_IS_CAL_MODEL_MEMOS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_MODEL_MEMOS))
-#define E_IS_CAL_MODEL_MEMOS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_MODEL_MEMOS))
+G_BEGIN_DECLS
+typedef struct _ECalModelMemos ECalModelMemos;
+typedef struct _ECalModelMemosClass ECalModelMemosClass;
typedef struct _ECalModelMemosPrivate ECalModelMemosPrivate;
typedef enum {
@@ -46,18 +61,18 @@ typedef enum {
} ECalModelMemoField;
-typedef struct {
- ECalModel model;
+struct _ECalModelMemos {
+ ECalModel parent;
ECalModelMemosPrivate *priv;
-} ECalModelMemos;
+};
-typedef struct {
+struct _ECalModelMemosClass {
ECalModelClass parent_class;
-} ECalModelMemosClass;
+};
GType e_cal_model_memos_get_type (void);
-ECalModel * e_cal_model_memos_new (void);
+ECalModel * e_cal_model_memos_new (EShellSettings *shell_settings);
G_END_DECLS
-#endif
+#endif /* E_CAL_MODEL_MEMOS_H */
diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c
index 6d841c495e..10e59d08af 100644
--- a/calendar/gui/e-cal-model-tasks.c
+++ b/calendar/gui/e-cal-model-tasks.c
@@ -36,12 +36,15 @@
#include "e-cell-date-edit-text.h"
#include "misc.h"
+#define E_CAL_MODEL_TASKS_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CAL_MODEL_TASKS, ECalModelTasksPrivate))
+
struct _ECalModelTasksPrivate {
- guint reserved;
+ gchar *color_due_today;
+ gchar *color_overdue;
};
-static void e_cal_model_tasks_finalize (GObject *object);
-
static gint ecmt_column_count (ETableModel *etm);
static gpointer ecmt_value_at (ETableModel *etm, gint col, gint row);
static void ecmt_set_value_at (ETableModel *etm, gint col, gint row, gconstpointer value);
@@ -59,56 +62,153 @@ static void commit_component_changes (ECalModelComponent *comp_data);
G_DEFINE_TYPE (ECalModelTasks, e_cal_model_tasks, E_TYPE_CAL_MODEL)
+enum {
+ PROP_0,
+ PROP_COLOR_DUE_TODAY,
+ PROP_COLOR_OVERDUE
+};
+
static void
-e_cal_model_tasks_class_init (ECalModelTasksClass *klass)
+cal_model_tasks_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- ETableModelClass *etm_class = E_TABLE_MODEL_CLASS (klass);
- ECalModelClass *model_class = E_CAL_MODEL_CLASS (klass);
-
- object_class->finalize = e_cal_model_tasks_finalize;
-
- etm_class->column_count = ecmt_column_count;
- etm_class->value_at = ecmt_value_at;
- etm_class->set_value_at = ecmt_set_value_at;
- etm_class->is_cell_editable = ecmt_is_cell_editable;
- etm_class->duplicate_value = ecmt_duplicate_value;
- etm_class->free_value = ecmt_free_value;
- etm_class->initialize_value = ecmt_initialize_value;
- etm_class->value_is_empty = ecmt_value_is_empty;
- etm_class->value_to_string = ecmt_value_to_string;
-
- model_class->get_color_for_component = ecmt_get_color_for_component;
- model_class->fill_component_from_model = ecmt_fill_component_from_model;
+ switch (property_id) {
+ case PROP_COLOR_DUE_TODAY:
+ e_cal_model_tasks_set_color_due_today (
+ E_CAL_MODEL_TASKS (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_COLOR_OVERDUE:
+ e_cal_model_tasks_set_color_overdue (
+ E_CAL_MODEL_TASKS (object),
+ g_value_get_string (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-e_cal_model_tasks_init (ECalModelTasks *model)
+cal_model_tasks_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_COLOR_DUE_TODAY:
+ g_value_set_string (
+ value,
+ e_cal_model_tasks_get_color_due_today (
+ E_CAL_MODEL_TASKS (object)));
+ return;
+
+ case PROP_COLOR_OVERDUE:
+ g_value_set_string (
+ value,
+ e_cal_model_tasks_get_color_overdue (
+ E_CAL_MODEL_TASKS (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+cal_model_tasks_finalize (GObject *object)
{
ECalModelTasksPrivate *priv;
- priv = g_new0 (ECalModelTasksPrivate, 1);
- model->priv = priv;
+ priv = E_CAL_MODEL_TASKS_GET_PRIVATE (object);
+
+ g_free (priv->color_due_today);
+ g_free (priv->color_overdue);
- e_cal_model_set_component_kind (E_CAL_MODEL (model), ICAL_VTODO_COMPONENT);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (e_cal_model_tasks_parent_class)->finalize (object);
}
static void
-e_cal_model_tasks_finalize (GObject *object)
+cal_model_tasks_constructed (GObject *object)
{
- ECalModelTasksPrivate *priv;
- ECalModelTasks *model = (ECalModelTasks *) object;
+ ECalModel *model;
+ EShellSettings *shell_settings;
- g_return_if_fail (E_IS_CAL_MODEL_TASKS (model));
+ model = E_CAL_MODEL (object);
+ shell_settings = e_cal_model_get_shell_settings (model);
- priv = model->priv;
- if (priv) {
- g_free (priv);
- model->priv = NULL;
- }
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-tasks-color-due-today",
+ G_OBJECT (model), "color-due-today");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-tasks-color-overdue",
+ G_OBJECT (model), "color-overdue");
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_cal_model_tasks_parent_class)->constructed (object);
+}
+
+static void
+e_cal_model_tasks_class_init (ECalModelTasksClass *class)
+{
+ GObjectClass *object_class;
+ ETableModelClass *table_model_class;
+ ECalModelClass *cal_model_class;
+
+ g_type_class_add_private (class, sizeof (ECalModelTasksPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = cal_model_tasks_set_property;
+ object_class->get_property = cal_model_tasks_get_property;
+ object_class->finalize = cal_model_tasks_finalize;
+ object_class->constructed = cal_model_tasks_constructed;
+
+ table_model_class = E_TABLE_MODEL_CLASS (class);
+ table_model_class->column_count = ecmt_column_count;
+ table_model_class->value_at = ecmt_value_at;
+ table_model_class->set_value_at = ecmt_set_value_at;
+ table_model_class->is_cell_editable = ecmt_is_cell_editable;
+ table_model_class->duplicate_value = ecmt_duplicate_value;
+ table_model_class->free_value = ecmt_free_value;
+ table_model_class->initialize_value = ecmt_initialize_value;
+ table_model_class->value_is_empty = ecmt_value_is_empty;
+ table_model_class->value_to_string = ecmt_value_to_string;
+
+ cal_model_class = E_CAL_MODEL_CLASS (class);
+ cal_model_class->get_color_for_component = ecmt_get_color_for_component;
+ cal_model_class->fill_component_from_model = ecmt_fill_component_from_model;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_COLOR_DUE_TODAY,
+ g_param_spec_string (
+ "color-due-today",
+ "Color Due Today",
+ NULL,
+ "#1e90ff",
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_COLOR_OVERDUE,
+ g_param_spec_string (
+ "color-overdue",
+ "Color Overdue",
+ NULL,
+ "#ff0000",
+ G_PARAM_READWRITE));
+}
+
+static void
+e_cal_model_tasks_init (ECalModelTasks *model)
+{
+ model->priv = E_CAL_MODEL_TASKS_GET_PRIVATE (model);
- if (G_OBJECT_CLASS (e_cal_model_tasks_parent_class)->finalize)
- G_OBJECT_CLASS (e_cal_model_tasks_parent_class)->finalize (object);
+ e_cal_model_set_component_kind (
+ E_CAL_MODEL (model), ICAL_VTODO_COMPONENT);
}
/* ETableModel methods */
@@ -1038,11 +1138,9 @@ ecmt_value_to_string (ETableModel *etm, gint col, gconstpointer value)
/* ECalModel class methods */
static const gchar *
-ecmt_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data)
+ecmt_get_color_for_component (ECalModel *model,
+ ECalModelComponent *comp_data)
{
- static gchar color_spec[16];
- GdkColor color;
-
g_return_val_if_fail (E_IS_CAL_MODEL_TASKS (model), NULL);
g_return_val_if_fail (comp_data != NULL, NULL);
@@ -1051,24 +1149,19 @@ ecmt_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data)
switch (get_due_status ((ECalModelTasks *) model, comp_data)) {
case E_CAL_MODEL_TASKS_DUE_TODAY:
- /* XXX ugly hack */
- calendar_config_get_tasks_due_today_color (&color);
- g_snprintf (color_spec, sizeof (color_spec), "#%04x%04x%04x",
- color.red, color.green, color.blue);
- return color_spec;
+ return e_cal_model_tasks_get_color_due_today (
+ E_CAL_MODEL_TASKS (model));
case E_CAL_MODEL_TASKS_DUE_OVERDUE:
- /* XXX ugly hack */
- calendar_config_get_tasks_overdue_color (&color);
- g_snprintf (color_spec, sizeof (color_spec), "#%04x%04x%04x",
- color.red, color.green, color.blue);
- return color_spec;
+ return e_cal_model_tasks_get_color_overdue (
+ E_CAL_MODEL_TASKS (model));
case E_CAL_MODEL_TASKS_DUE_NEVER:
case E_CAL_MODEL_TASKS_DUE_FUTURE:
case E_CAL_MODEL_TASKS_DUE_COMPLETE:
break;
}
- return E_CAL_MODEL_CLASS (e_cal_model_tasks_parent_class)->get_color_for_component (model, comp_data);
+ return E_CAL_MODEL_CLASS (e_cal_model_tasks_parent_class)->
+ get_color_for_component (model, comp_data);
}
static void
@@ -1103,13 +1196,56 @@ ecmt_fill_component_from_model (ECalModel *model, ECalModelComponent *comp_data,
e_table_model_value_at (source_model, E_CAL_MODEL_TASKS_FIELD_URL, row));
}
-/**
- * e_cal_model_tasks_new
- */
ECalModel *
-e_cal_model_tasks_new (void)
+e_cal_model_tasks_new (EShellSettings *shell_settings)
+{
+ g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL);
+
+ return g_object_new (
+ E_TYPE_CAL_MODEL_TASKS,
+ "shell-settings", shell_settings, NULL);
+}
+
+const gchar *
+e_cal_model_tasks_get_color_due_today (ECalModelTasks *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL_TASKS (model), NULL);
+
+ return model->priv->color_due_today;
+}
+
+void
+e_cal_model_tasks_set_color_due_today (ECalModelTasks *model,
+ const gchar *color_due_today)
+{
+ g_return_if_fail (E_IS_CAL_MODEL_TASKS (model));
+ g_return_if_fail (color_due_today != NULL);
+
+ g_free (model->priv->color_due_today);
+ model->priv->color_due_today = g_strdup (color_due_today);
+
+ g_object_notify (G_OBJECT (model), "color-due-today");
+}
+
+const gchar *
+e_cal_model_tasks_get_color_overdue (ECalModelTasks *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL_TASKS (model), NULL);
+
+ return model->priv->color_overdue;
+}
+
+void
+e_cal_model_tasks_set_color_overdue (ECalModelTasks *model,
+ const gchar *color_overdue)
{
- return g_object_new (E_TYPE_CAL_MODEL_TASKS, NULL);
+ g_return_if_fail (E_IS_CAL_MODEL_TASKS (model));
+ g_return_if_fail (color_overdue != NULL);
+
+ g_free (model->priv->color_overdue);
+ model->priv->color_overdue = g_strdup (color_overdue);
+
+ g_object_notify (G_OBJECT (model), "color-overdue");
}
/**
diff --git a/calendar/gui/e-cal-model-tasks.h b/calendar/gui/e-cal-model-tasks.h
index 88b0d071e2..056325547d 100644
--- a/calendar/gui/e-cal-model-tasks.h
+++ b/calendar/gui/e-cal-model-tasks.h
@@ -28,14 +28,29 @@
#include "e-cal-model.h"
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_CAL_MODEL_TASKS \
+ (e_cal_model_tasks_get_type ())
+#define E_CAL_MODEL_TASKS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CAL_MODEL_TASKS, ECalModelTasks))
+#define E_CAL_MODEL_TASKS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CAL_MODEL_TASKS, ECalModelTasksClass))
+#define E_IS_CAL_MODEL_TASKS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CAL_MODEL_TASKS))
+#define E_IS_CAL_MODEL_TASKS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CAL_MODEL_TASKS))
+#define E_CAL_MODEL_TASKS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CAL_MODEL_TASKS, ECalModelTasksClass))
-#define E_TYPE_CAL_MODEL_TASKS (e_cal_model_tasks_get_type ())
-#define E_CAL_MODEL_TASKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_MODEL_TASKS, ECalModelTasks))
-#define E_CAL_MODEL_TASKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_MODEL_TASKS, ECalModelTasksClass))
-#define E_IS_CAL_MODEL_TASKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_MODEL_TASKS))
-#define E_IS_CAL_MODEL_TASKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_MODEL_TASKS))
+G_BEGIN_DECLS
+typedef struct _ECalModelTasks ECalModelTasks;
+typedef struct _ECalModelTasksClass ECalModelTasksClass;
typedef struct _ECalModelTasksPrivate ECalModelTasksPrivate;
typedef enum {
@@ -54,22 +69,36 @@ typedef enum {
E_CAL_MODEL_TASKS_FIELD_LAST
} ECalModelTasksField;
-typedef struct {
- ECalModel model;
+struct _ECalModelTasks {
+ ECalModel parent;
ECalModelTasksPrivate *priv;
-} ECalModelTasks;
+};
-typedef struct {
+struct _ECalModelTasksClass {
ECalModelClass parent_class;
-} ECalModelTasksClass;
-
-GType e_cal_model_tasks_get_type (void);
-ECalModel * e_cal_model_tasks_new (void);
+};
-void e_cal_model_tasks_mark_comp_complete (ECalModelTasks *model, ECalModelComponent *comp_data);
-void e_cal_model_tasks_mark_comp_incomplete (ECalModelTasks *model, ECalModelComponent *comp_data);
-void e_cal_model_tasks_update_due_tasks (ECalModelTasks *model);
+GType e_cal_model_tasks_get_type (void);
+ECalModel * e_cal_model_tasks_new (EShellSettings *shell_settings);
+const gchar * e_cal_model_tasks_get_color_due_today
+ (ECalModelTasks *model);
+void e_cal_model_tasks_set_color_due_today
+ (ECalModelTasks *model,
+ const gchar *color_due_today);
+const gchar * e_cal_model_tasks_get_color_overdue
+ (ECalModelTasks *model);
+void e_cal_model_tasks_set_color_overdue
+ (ECalModelTasks *model,
+ const gchar *color_overdue);
+void e_cal_model_tasks_mark_comp_complete
+ (ECalModelTasks *model,
+ ECalModelComponent *comp_data);
+void e_cal_model_tasks_mark_comp_incomplete
+ (ECalModelTasks *model,
+ ECalModelComponent *comp_data);
+void e_cal_model_tasks_update_due_tasks
+ (ECalModelTasks *model);
G_END_DECLS
-#endif
+#endif /* E_CAL_MODEL_TASKS_H */
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index c87674fcc7..cbe3326760 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -36,6 +36,7 @@
#include "itip-utils.h"
#include "misc.h"
#include "calendar-config.h"
+#include "e-util/e-binding.h"
#include "e-util/e-util.h"
#define E_CAL_MODEL_GET_PRIVATE(obj) \
@@ -54,6 +55,8 @@ typedef struct {
} ECalModelClient;
struct _ECalModelPrivate {
+ EShellSettings *shell_settings;
+
/* The list of clients we are managing. Each element is of type ECalModelClient */
GList *clients;
@@ -112,6 +115,8 @@ static void remove_client (ECalModel *model, ECalModelClient *client_data);
enum {
PROP_0,
+ PROP_SHELL_SETTINGS,
+ PROP_TIMEZONE,
PROP_USE_24_HOUR_FORMAT
};
@@ -130,12 +135,34 @@ static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE (ECalModel, e_cal_model, E_TABLE_MODEL_TYPE)
static void
+cal_model_set_shell_settings (ECalModel *cal_model,
+ EShellSettings *shell_settings)
+{
+ g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings));
+ g_return_if_fail (cal_model->priv->shell_settings == NULL);
+
+ cal_model->priv->shell_settings = g_object_ref (shell_settings);
+}
+
+static void
cal_model_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_SHELL_SETTINGS:
+ cal_model_set_shell_settings (
+ E_CAL_MODEL (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_TIMEZONE:
+ e_cal_model_set_timezone (
+ E_CAL_MODEL (object),
+ g_value_get_pointer (value));
+ return;
+
case PROP_USE_24_HOUR_FORMAT:
e_cal_model_set_use_24_hour_format (
E_CAL_MODEL (object),
@@ -153,6 +180,20 @@ cal_model_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_SHELL_SETTINGS:
+ g_value_set_object (
+ value,
+ e_cal_model_get_shell_settings (
+ E_CAL_MODEL (object)));
+ return;
+
+ case PROP_TIMEZONE:
+ g_value_set_pointer (
+ value,
+ e_cal_model_get_timezone (
+ E_CAL_MODEL (object)));
+ return;
+
case PROP_USE_24_HOUR_FORMAT:
g_value_set_boolean (
value,
@@ -171,6 +212,11 @@ cal_model_dispose (GObject *object)
priv = E_CAL_MODEL_GET_PRIVATE (object);
+ if (priv->shell_settings != NULL) {
+ g_object_unref (priv->shell_settings);
+ priv->shell_settings = NULL;
+ }
+
if (priv->clients) {
while (priv->clients != NULL) {
ECalModelClient *client_data = (ECalModelClient *) priv->clients->data;
@@ -227,6 +273,24 @@ cal_model_finalize (GObject *object)
}
static void
+cal_model_constructed (GObject *object)
+{
+ ECalModel *model;
+ EShellSettings *shell_settings;
+
+ model = E_CAL_MODEL (object);
+ shell_settings = e_cal_model_get_shell_settings (model);
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-use-24-hour-format",
+ G_OBJECT (model), "use-24-hour-format");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-timezone",
+ G_OBJECT (model), "timezone");
+}
+
+static void
e_cal_model_class_init (ECalModelClass *class)
{
GObjectClass *object_class;
@@ -240,6 +304,7 @@ e_cal_model_class_init (ECalModelClass *class)
object_class->get_property = cal_model_get_property;
object_class->dispose = cal_model_dispose;
object_class->finalize = cal_model_finalize;
+ object_class->constructed = cal_model_constructed;
etm_class = E_TABLE_MODEL_CLASS (class);
etm_class->column_count = ecm_column_count;
@@ -259,6 +324,26 @@ e_cal_model_class_init (ECalModelClass *class)
g_object_class_install_property (
object_class,
+ PROP_SHELL_SETTINGS,
+ g_param_spec_object (
+ "shell-settings",
+ _("Shell Settings"),
+ _("Application-wide settings"),
+ E_TYPE_SHELL_SETTINGS,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_TIMEZONE,
+ g_param_spec_pointer (
+ "timezone",
+ "Time Zone",
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
PROP_USE_24_HOUR_FORMAT,
g_param_spec_boolean (
"use-24-hour-format",
@@ -1169,6 +1254,14 @@ ecm_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data)
return assigned_colors[first_empty].color;
}
+EShellSettings *
+e_cal_model_get_shell_settings (ECalModel *model)
+{
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
+
+ return model->priv->shell_settings;
+}
+
/**
* e_cal_model_get_component_kind
*/
@@ -1203,12 +1296,9 @@ e_cal_model_set_component_kind (ECalModel *model, icalcomponent_kind kind)
ECalModelFlags
e_cal_model_get_flags (ECalModel *model)
{
- ECalModelPrivate *priv;
-
- g_return_val_if_fail (E_IS_CAL_MODEL (model), E_CAL_MODEL_FLAGS_INVALID);
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), 0);
- priv = model->priv;
- return priv->flags;
+ return model->priv->flags;
}
/**
@@ -1217,12 +1307,9 @@ e_cal_model_get_flags (ECalModel *model)
void
e_cal_model_set_flags (ECalModel *model, ECalModelFlags flags)
{
- ECalModelPrivate *priv;
-
g_return_if_fail (E_IS_CAL_MODEL (model));
- priv = model->priv;
- priv->flags = flags;
+ model->priv->flags = flags;
}
/**
@@ -1232,6 +1319,7 @@ icaltimezone *
e_cal_model_get_timezone (ECalModel *model)
{
g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
+
return model->priv->zone;
}
@@ -1239,35 +1327,35 @@ e_cal_model_get_timezone (ECalModel *model)
* e_cal_model_set_timezone
*/
void
-e_cal_model_set_timezone (ECalModel *model, icaltimezone *zone)
+e_cal_model_set_timezone (ECalModel *model,
+ icaltimezone *zone)
{
- ECalModelPrivate *priv;
-
g_return_if_fail (E_IS_CAL_MODEL (model));
- priv = model->priv;
- if (priv->zone != zone) {
- e_table_model_pre_change (E_TABLE_MODEL (model));
- priv->zone = zone;
+ if (model->priv->zone == zone)
+ return;
- /* the timezone affects the times shown for date fields,
- so we need to redisplay everything */
- e_table_model_changed (E_TABLE_MODEL (model));
- }
+ e_table_model_pre_change (E_TABLE_MODEL (model));
+ model->priv->zone = zone;
+
+ /* the timezone affects the times shown for date fields,
+ so we need to redisplay everything */
+ e_table_model_changed (E_TABLE_MODEL (model));
+
+ g_object_notify (G_OBJECT (model), "timezone");
}
/**
* e_cal_model_set_default_category
*/
void
-e_cal_model_set_default_category (ECalModel *model, const gchar *default_cat)
+e_cal_model_set_default_category (ECalModel *model,
+ const gchar *default_category)
{
g_return_if_fail (E_IS_CAL_MODEL (model));
- if (model->priv->default_category)
- g_free (model->priv->default_category);
-
- model->priv->default_category = g_strdup (default_cat);
+ g_free (model->priv->default_category);
+ model->priv->default_category = g_strdup (default_category);
}
/**
diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h
index adaf736494..fa2209a828 100644
--- a/calendar/gui/e-cal-model.h
+++ b/calendar/gui/e-cal-model.h
@@ -29,6 +29,7 @@
#include <table/e-table-model.h>
#include <libecal/e-cal.h>
#include "e-cell-date-edit-text.h"
+#include <shell/e-shell-settings.h>
G_BEGIN_DECLS
@@ -129,6 +130,7 @@ typedef time_t (*ECalModelDefaultTimeFunc)(ECalModel *model, gpointer user_data)
GType e_cal_model_get_type (void);
GType e_cal_model_component_get_type (void);
+EShellSettings * e_cal_model_get_shell_settings (ECalModel *model);
icalcomponent_kind e_cal_model_get_component_kind (ECalModel *model);
void e_cal_model_set_component_kind (ECalModel *model,
icalcomponent_kind kind);
diff --git a/calendar/gui/e-calendar-table-config.c b/calendar/gui/e-calendar-table-config.c
deleted file mode 100644
index 8b73056f51..0000000000
--- a/calendar/gui/e-calendar-table-config.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include "calendar-config.h"
-#include "e-cell-date-edit-config.h"
-#include "e-calendar-table-config.h"
-
-#define E_CALENDAR_TABLE_CONFIG_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE \
- ((obj), E_TYPE_CALENDAR_TABLE_CONFIG, ECalendarTableConfigPrivate))
-
-struct _ECalendarTableConfigPrivate {
- ECalendarTable *table;
- ECellDateEditConfig *cell_config;
- GList *notifications;
-};
-
-enum {
- PROP_0,
- PROP_TABLE
-};
-
-static gpointer parent_class;
-
-static void
-calendar_table_config_set_timezone (ECalendarTable *table)
-{
- ECalModel *model;
- icaltimezone *zone;
-
- zone = calendar_config_get_icaltimezone ();
- model = e_calendar_table_get_model (table);
- if (model != NULL)
- e_cal_model_set_timezone (model, zone);
-}
-
-static void
-calendar_table_config_timezone_changed_cb (GConfClient *client,
- guint id,
- GConfEntry *entry,
- gpointer data)
-{
- ECalendarTableConfig *table_config = data;
-
- calendar_table_config_set_timezone (table_config->priv->table);
-}
-
-static void
-calendar_table_config_set_twentyfour_hour (ECalendarTable *table)
-{
- ECalModel *model;
- gboolean use_24_hour;
-
- use_24_hour = calendar_config_get_24_hour_format ();
-
- model = e_calendar_table_get_model (table);
- if (model != NULL)
- e_cal_model_set_use_24_hour_format (model, use_24_hour);
-}
-
-static void
-calendar_table_config_twentyfour_hour_changed_cb (GConfClient *client,
- guint id,
- GConfEntry *entry,
- gpointer data)
-{
- ECalendarTableConfig *table_config = data;
-
- calendar_table_config_set_twentyfour_hour (table_config->priv->table);
-}
-
-static void
-calendar_table_config_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id) {
- case PROP_TABLE:
- e_calendar_table_config_set_table (
- E_CALENDAR_TABLE_CONFIG (object),
- g_value_get_object (value));
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-calendar_table_config_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id) {
- case PROP_TABLE:
- g_value_set_object (
- value, e_calendar_table_config_get_table (
- E_CALENDAR_TABLE_CONFIG (object)));
- return;
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-calendar_table_config_dispose (GObject *object)
-{
- ECalendarTableConfig *table_config = E_CALENDAR_TABLE_CONFIG (object);
-
- e_calendar_table_config_set_table (table_config, NULL);
-
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-calendar_table_config_class_init (ECalendarTableConfigClass *class)
-{
- GObjectClass *object_class;
-
- parent_class = g_type_class_peek_parent (class);
- g_type_class_add_private (class, sizeof (ECalendarTableConfigPrivate));
-
- object_class = G_OBJECT_CLASS (class);
- object_class->set_property = calendar_table_config_set_property;
- object_class->get_property = calendar_table_config_get_property;
- object_class->dispose = calendar_table_config_dispose;
-
- g_object_class_install_property (
- object_class,
- PROP_TABLE,
- g_param_spec_object (
- "table",
- NULL,
- NULL,
- E_TYPE_CALENDAR_TABLE,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT));
-}
-
-static void
-calendar_table_config_init (ECalendarTableConfig *table_config)
-{
- table_config->priv =
- E_CALENDAR_TABLE_CONFIG_GET_PRIVATE (table_config);
-}
-
-GType
-e_calendar_table_config_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (ECalendarTableConfigClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) calendar_table_config_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (ECalendarTableConfig),
- 0, /* n_preallocs */
- (GInstanceInitFunc) calendar_table_config_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "ECalendarTableConfig", &type_info, 0);
- }
-
- return type;
-}
-
-ECalendarTableConfig *
-e_calendar_table_config_new (ECalendarTable *table)
-{
- g_return_val_if_fail (E_IS_CALENDAR_TABLE (table), NULL);
-
- return g_object_new (
- E_TYPE_CALENDAR_TABLE_CONFIG,
- "table", table, NULL);
-}
-
-ECalendarTable *
-e_calendar_table_config_get_table (ECalendarTableConfig *table_config)
-{
- g_return_val_if_fail (E_IS_CALENDAR_TABLE_CONFIG (table_config), NULL);
-
- return table_config->priv->table;
-}
-
-void
-e_calendar_table_config_set_table (ECalendarTableConfig *table_config,
- ECalendarTable *table)
-{
- ECalendarTableConfigPrivate *priv;
- guint notification;
- GList *list, *iter;
-
- g_return_if_fail (E_IS_CALENDAR_TABLE_CONFIG (table_config));
-
- priv = table_config->priv;
-
- if (table_config->priv->table) {
- g_object_unref (table_config->priv->table);
- table_config->priv->table = NULL;
- }
-
- if (table_config->priv->cell_config) {
- g_object_unref (table_config->priv->cell_config);
- table_config->priv->cell_config = NULL;
- }
-
- list = table_config->priv->notifications;
- for (iter = list; iter != NULL; iter = iter->next) {
- notification = GPOINTER_TO_UINT (iter->data);
- calendar_config_remove_notification (notification);
- }
- g_list_free (list);
- table_config->priv->notifications = NULL;
-
- if (table == NULL)
- return;
-
- table_config->priv->table = g_object_ref (table);
-
- /* Time zone */
- calendar_table_config_set_timezone (table);
-
- notification = calendar_config_add_notification_timezone (
- calendar_table_config_timezone_changed_cb, table_config);
- table_config->priv->notifications = g_list_prepend (
- table_config->priv->notifications,
- GUINT_TO_POINTER (notification));
-
- /* 24 Hour format */
- calendar_table_config_set_twentyfour_hour (table);
-
- notification = calendar_config_add_notification_24_hour_format (
- calendar_table_config_twentyfour_hour_changed_cb, table_config);
- table_config->priv->notifications = g_list_prepend (
- table_config->priv->notifications,
- GUINT_TO_POINTER (notification));
-
- /* Date cell */
- table_config->priv->cell_config =
- e_cell_date_edit_config_new (table->dates_cell);
-}
diff --git a/calendar/gui/e-calendar-table-config.h b/calendar/gui/e-calendar-table-config.h
deleted file mode 100644
index 36745064d1..0000000000
--- a/calendar/gui/e-calendar-table-config.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef E_CALENDAR_TABLE_CONFIG_H
-#define E_CALENDAR_TABLE_CONFIG_H
-
-#include "e-calendar-table.h"
-
-/* Standard GObject macros */
-#define E_TYPE_CALENDAR_TABLE_CONFIG \
- (e_calendar_table_config_get_type ())
-#define E_CALENDAR_TABLE_CONFIG(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST \
- ((obj), E_TYPE_CALENDAR_TABLE_CONFIG, ECalendarTableConfig))
-#define E_CALENDAR_TABLE_CONFIG_CLASS(cls) \
- (G_TYPE_CHECK_CLASS_CAST \
- ((cls), E_TYPE_CALENDAR_TABLE_CONFIG, ECalendarTableConfigClass))
-#define E_IS_CALENDAR_TABLE_CONFIG(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE \
- ((obj), E_TYPE_CALENDAR_TABLE_CONFIG))
-#define E_IS_CALENDAR_TABLE_CONFIG_CLASS(cls) \
- (G_TYPE_CHECK_CLASS_TYPE \
- ((cls), E_TYPE_CALENDAR_TABLE_CONFIG))
-#define E_CALENDAR_TABLE_CONFIG_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS \
- ((obj), E_TYPE_CALENDAR_TABLE_CONFIG, ECalendarTableConfigClass))
-
-G_BEGIN_DECLS
-
-typedef struct _ECalendarTableConfig ECalendarTableConfig;
-typedef struct _ECalendarTableConfigClass ECalendarTableConfigClass;
-typedef struct _ECalendarTableConfigPrivate ECalendarTableConfigPrivate;
-
-struct _ECalendarTableConfig {
- GObject parent;
- ECalendarTableConfigPrivate *priv;
-};
-
-struct _ECalendarTableConfigClass {
- GObjectClass parent_class;
-};
-
-GType e_calendar_table_config_get_type(void);
-ECalendarTableConfig *
- e_calendar_table_config_new (ECalendarTable *table);
-ECalendarTable *e_calendar_table_config_get_table
- (ECalendarTableConfig *table_config);
-void e_calendar_table_config_set_table
- (ECalendarTableConfig *table_config,
- ECalendarTable *table);
-
-G_END_DECLS
-
-#endif /* E_CALENDAR_TABLE_CONFIG_H */
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 3d08d7850f..755dfebec0 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -89,12 +89,10 @@ enum {
};
static GtkTargetEntry target_types[] = {
- { "text/calendar", 0, TARGET_TYPE_VCALENDAR },
- { "text/x-calendar", 0, TARGET_TYPE_VCALENDAR }
+ { (gchar *) "text/calendar", 0, TARGET_TYPE_VCALENDAR },
+ { (gchar *) "text/x-calendar", 0, TARGET_TYPE_VCALENDAR }
};
-static guint n_target_types = G_N_ELEMENTS (target_types);
-
static struct tm e_calendar_table_get_current_time (ECellDateEdit *ecde, gpointer data);
static gpointer parent_class;
@@ -102,11 +100,14 @@ static guint signals[LAST_SIGNAL];
static GdkAtom clipboard_atom;
/* The icons to represent the task. */
-#define E_CALENDAR_MODEL_NUM_ICONS 4
-static const gchar * icon_names[E_CALENDAR_MODEL_NUM_ICONS] = {
- "stock_task", "stock_task-recurring", "stock_task-assigned", "stock_task-assigned-to"
+#define NUM_ICONS 4
+static const gchar *icon_names[NUM_ICONS] = {
+ "stock_task",
+ "stock_task-recurring",
+ "stock_task-assigned",
+ "stock_task-assigned-to"
};
-static GdkPixbuf* icon_pixbufs[E_CALENDAR_MODEL_NUM_ICONS] = { NULL };
+static GdkPixbuf *icon_pixbufs[NUM_ICONS] = { NULL };
static void
calendar_table_emit_open_component (ECalendarTable *cal_table,
@@ -654,10 +655,22 @@ calendar_table_constructed (GObject *object)
"bg_color_column", E_CAL_MODEL_FIELD_COLOR,
NULL);
+ e_mutual_binding_new (
+ G_OBJECT (model), "timezone",
+ G_OBJECT (cell), "timezone");
+
+ e_mutual_binding_new (
+ G_OBJECT (model), "use-24-hour-format",
+ G_OBJECT (cell), "use-24-hour-format");
+
popup_cell = e_cell_date_edit_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
g_object_unref (cell);
+ e_mutual_binding_new (
+ G_OBJECT (model), "use-24-hour-format",
+ G_OBJECT (popup_cell), "use-24-hour-format");
+
e_table_extras_add_cell (extras, "dateedit", popup_cell);
cal_table->dates_cell = E_CELL_DATE_EDIT (popup_cell);
@@ -799,11 +812,11 @@ calendar_table_constructed (GObject *object)
/* Create pixmaps */
if (!icon_pixbufs[0])
- for (i = 0; i < E_CALENDAR_MODEL_NUM_ICONS; i++) {
+ for (i = 0; i < NUM_ICONS; i++) {
icon_pixbufs[i] = e_icon_factory_get_icon (icon_names[i], GTK_ICON_SIZE_MENU);
}
- cell = e_cell_toggle_new (0, E_CALENDAR_MODEL_NUM_ICONS, icon_pixbufs);
+ cell = e_cell_toggle_new (0, NUM_ICONS, icon_pixbufs);
e_table_extras_add_cell(extras, "icon", cell);
e_table_extras_add_pixbuf(extras, "icon", icon_pixbufs[0]);
@@ -975,14 +988,6 @@ e_calendar_table_new (EShellView *shell_view,
"model", model, "shell-view", shell_view, NULL);
}
-EShellView *
-e_calendar_table_get_shell_view (ECalendarTable *cal_table)
-{
- g_return_val_if_fail (E_IS_CALENDAR_TABLE (cal_table), NULL);
-
- return cal_table->priv->shell_view;
-}
-
/**
* e_calendar_table_get_model:
* @cal_table: A calendar table.
@@ -1020,6 +1025,14 @@ e_calendar_table_get_table (ECalendarTable *cal_table)
return e_table_scrolled_get_table (table_scrolled);
}
+EShellView *
+e_calendar_table_get_shell_view (ECalendarTable *cal_table)
+{
+ g_return_val_if_fail (E_IS_CALENDAR_TABLE (cal_table), NULL);
+
+ return cal_table->priv->shell_view;
+}
+
/* Used from e_table_selected_row_foreach(); puts the selected row number in an
* gint pointed to by the closure data.
*/
@@ -1332,12 +1345,14 @@ e_calendar_table_copy_clipboard (ECalendarTable *cal_table)
e_table_selected_row_foreach (etable, copy_row_cb, cal_table);
comp_str = icalcomponent_as_ical_string_r (cal_table->tmp_vcal);
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (cal_table), clipboard_atom);
- if (!gtk_clipboard_set_with_data(clipboard, target_types, n_target_types,
- clipboard_get_calendar_cb,
- NULL, comp_str)) {
+ if (!gtk_clipboard_set_with_data (
+ clipboard, target_types, G_N_ELEMENTS (target_types),
+ clipboard_get_calendar_cb, NULL, comp_str)) {
/* no-op */
} else {
- gtk_clipboard_set_can_store (clipboard, target_types + 1, n_target_types - 1);
+ gtk_clipboard_set_can_store (
+ clipboard, target_types + 1,
+ G_N_ELEMENTS (target_types) - 1);
}
/* free memory */
@@ -1628,7 +1643,9 @@ e_calendar_table_get_current_time (ECellDateEdit *ecde, gpointer data)
* Hide completed tasks.
*/
void
-e_calendar_table_process_completed_tasks (ECalendarTable *table, GList *clients_list, gboolean config_changed)
+e_calendar_table_process_completed_tasks (ECalendarTable *table,
+ GList *clients_list,
+ gboolean config_changed)
{
ECalModel *model;
static GMutex *mutex = NULL;
diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h
index 4645be188b..d2b376ba9d 100644
--- a/calendar/gui/e-calendar-table.h
+++ b/calendar/gui/e-calendar-table.h
@@ -119,8 +119,6 @@ void e_calendar_table_process_completed_tasks
GList *clients_list,
gboolean config_changed);
-gboolean ec_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, GtkWidget *etable_wgt, ECalModel *model);
-
G_END_DECLS
#endif /* _E_CALENDAR_TABLE_H_ */
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 543623beaf..b2addc64fa 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -58,6 +58,10 @@
#include "e-cal-popup.h"
#include "misc.h"
+#define E_CALENDAR_VIEW_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CALENDAR_VIEW, ECalendarViewPrivate))
+
struct _ECalendarViewPrivate {
/* The GnomeCalendar we are associated to */
GnomeCalendar *calendar;
@@ -69,12 +73,7 @@ struct _ECalendarViewPrivate {
gchar *default_category;
};
-static void e_calendar_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
-static void e_calendar_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
-static void e_calendar_view_destroy (GtkObject *object);
-
-/* Property IDs */
-enum props {
+enum {
PROP_0,
PROP_MODEL
};
@@ -92,7 +91,7 @@ enum {
LAST_SIGNAL
};
-static guint signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE (ECalendarView, e_calendar_view, GTK_TYPE_TABLE)
@@ -105,77 +104,125 @@ static GtkTargetEntry target_types[] = {
{ (gchar *) "text/calendar", 0, TARGET_TYPE_VCALENDAR }
};
-static guint n_target_types = G_N_ELEMENTS (target_types);
+static void
+calendar_view_set_model (ECalendarView *calendar_view,
+ ECalModel *model)
+{
+ g_return_if_fail (calendar_view->priv->model == NULL);
+ g_return_if_fail (E_IS_CAL_MODEL (model));
+
+ calendar_view->priv->model = g_object_ref (model);
+}
static void
-e_calendar_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+calendar_view_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- ECalendarView *cal_view;
+ switch (property_id) {
+ case PROP_MODEL:
+ calendar_view_set_model (
+ E_CALENDAR_VIEW (object),
+ g_value_get_object (value));
+ return;
+ }
- cal_view = E_CALENDAR_VIEW (object);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+static void
+calendar_view_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
switch (property_id) {
- case PROP_MODEL:
- e_calendar_view_set_model (cal_view, E_CAL_MODEL (g_value_get_object (value)));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
+ case PROP_MODEL:
+ g_value_set_object (
+ value, e_calendar_view_get_model (
+ E_CALENDAR_VIEW (object)));
+ return;
}
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-e_calendar_view_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+calendar_view_dispose (GObject *object)
{
- ECalendarView *cal_view;
+ ECalendarViewPrivate *priv;
- cal_view = E_CALENDAR_VIEW (object);
+ priv = E_CALENDAR_VIEW_GET_PRIVATE (object);
- switch (property_id) {
- case PROP_MODEL:
- g_value_set_object (value, e_calendar_view_get_model (cal_view));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
+ if (priv->model != NULL) {
+ g_signal_handlers_disconnect_matched (
+ priv->model, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, object);
+ g_object_unref (priv->model);
+ priv->model = NULL;
}
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (e_calendar_view_parent_class)->dispose (object);
}
static void
-e_calendar_view_class_init (ECalendarViewClass *klass)
+calendar_view_finalize (GObject *object)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
+ ECalendarViewPrivate *priv;
+
+ priv = E_CALENDAR_VIEW_GET_PRIVATE (object);
+
+ g_free (priv->default_category);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (e_calendar_view_parent_class)->finalize (object);
+}
+
+static void
+e_calendar_view_class_init (ECalendarViewClass *class)
+{
+ GObjectClass *object_class;
GtkBindingSet *binding_set;
- /* Method override */
- gobject_class->set_property = e_calendar_view_set_property;
- gobject_class->get_property = e_calendar_view_get_property;
- object_class->destroy = e_calendar_view_destroy;
-
- klass->selection_changed = NULL;
- klass->selected_time_changed = NULL;
- klass->event_changed = NULL;
- klass->event_added = NULL;
- klass->user_created = NULL;
-
- klass->get_selected_events = NULL;
- klass->get_selected_time_range = NULL;
- klass->set_selected_time_range = NULL;
- klass->get_visible_time_range = NULL;
- klass->update_query = NULL;
- klass->open_event = e_calendar_view_open_event;
- klass->paste_text = NULL;
-
- g_object_class_install_property (gobject_class, PROP_MODEL,
- g_param_spec_object ("model", NULL, NULL, E_TYPE_CAL_MODEL,
- G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_type_class_add_private (class, sizeof (ECalendarViewPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = calendar_view_set_property;
+ object_class->get_property = calendar_view_get_property;
+ object_class->dispose = calendar_view_dispose;
+ object_class->finalize = calendar_view_finalize;
+
+ class->selection_changed = NULL;
+ class->selected_time_changed = NULL;
+ class->event_changed = NULL;
+ class->event_added = NULL;
+ class->user_created = NULL;
+
+ class->get_selected_events = NULL;
+ class->get_selected_time_range = NULL;
+ class->set_selected_time_range = NULL;
+ class->get_visible_time_range = NULL;
+ class->update_query = NULL;
+ class->open_event = e_calendar_view_open_event;
+ class->paste_text = NULL;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_MODEL,
+ g_param_spec_object (
+ "model",
+ "Model",
+ NULL,
+ E_TYPE_CAL_MODEL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
/* Create class' signals */
signals[SELECTION_CHANGED] =
g_signal_new ("selection_changed",
- G_TYPE_FROM_CLASS (klass),
+ G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ECalendarViewClass, selection_changed),
NULL, NULL,
@@ -183,7 +230,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
G_TYPE_NONE, 0);
signals[SELECTED_TIME_CHANGED] =
g_signal_new ("selected_time_changed",
- G_TYPE_FROM_CLASS (klass),
+ G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ECalendarViewClass, selected_time_changed),
NULL, NULL,
@@ -191,7 +238,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
G_TYPE_NONE, 0);
signals[TIMEZONE_CHANGED] =
g_signal_new ("timezone_changed",
- G_TYPE_FROM_CLASS (klass),
+ G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ECalendarViewClass, timezone_changed),
NULL, NULL,
@@ -220,7 +267,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
signals[USER_CREATED] =
g_signal_new ("user_created",
- G_TYPE_FROM_CLASS (klass),
+ G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ECalendarViewClass, user_created),
NULL, NULL,
@@ -229,7 +276,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
signals[OPEN_EVENT] =
g_signal_new ("open_event",
- G_TYPE_FROM_CLASS (klass),
+ G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (ECalendarViewClass, open_event),
NULL, NULL,
@@ -240,7 +287,7 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
* Key bindings
*/
- binding_set = gtk_binding_set_by_class (klass);
+ binding_set = gtk_binding_set_by_class (class);
gtk_binding_entry_add_signal (binding_set, GDK_o,
GDK_CONTROL_MASK,
@@ -252,6 +299,12 @@ e_calendar_view_class_init (ECalendarViewClass *klass)
#endif
}
+static void
+e_calendar_view_init (ECalendarView *calendar_view)
+{
+ calendar_view->priv = E_CALENDAR_VIEW_GET_PRIVATE (calendar_view);
+}
+
void
e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart,
icaltimezone *default_zone, icalcomponent *icalcomp, gboolean in_top_canvas)
@@ -377,41 +430,6 @@ e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart
#endif
}
-static void
-e_calendar_view_init (ECalendarView *cal_view)
-{
- cal_view->priv = g_new0 (ECalendarViewPrivate, 1);
-}
-
-static void
-e_calendar_view_destroy (GtkObject *object)
-{
- ECalendarView *cal_view = (ECalendarView *) object;
-
- g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
-
- if (cal_view->priv) {
- if (cal_view->priv->model) {
- g_signal_handlers_disconnect_matched (cal_view->priv->model,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, cal_view);
- g_object_unref (cal_view->priv->model);
- cal_view->priv->model = NULL;
- }
-
- if (cal_view->priv->default_category) {
- g_free (cal_view->priv->default_category);
- cal_view->priv->default_category = NULL;
- }
-
- g_free (cal_view->priv);
- cal_view->priv = NULL;
- }
-
- if (GTK_OBJECT_CLASS (e_calendar_view_parent_class)->destroy)
- GTK_OBJECT_CLASS (e_calendar_view_parent_class)->destroy (object);
-}
-
GnomeCalendar *
e_calendar_view_get_calendar (ECalendarView *cal_view)
{
@@ -436,21 +454,6 @@ e_calendar_view_get_model (ECalendarView *cal_view)
return cal_view->priv->model;
}
-void
-e_calendar_view_set_model (ECalendarView *cal_view, ECalModel *model)
-{
- g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
- g_return_if_fail (E_IS_CAL_MODEL (model));
-
- if (cal_view->priv->model) {
- g_signal_handlers_disconnect_matched (cal_view->priv->model, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, cal_view);
- g_object_unref (cal_view->priv->model);
- }
-
- cal_view->priv->model = g_object_ref (model);
-}
-
icaltimezone *
e_calendar_view_get_timezone (ECalendarView *cal_view)
{
@@ -759,13 +762,13 @@ e_calendar_view_copy_clipboard (ECalendarView *cal_view)
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (cal_view), GDK_SELECTION_CLIPBOARD);
comp_str = icalcomponent_as_ical_string_r (vcal_comp);
- if (!gtk_clipboard_set_with_data (clipboard, target_types, n_target_types,
+ if (!gtk_clipboard_set_with_data (clipboard, target_types, G_N_ELEMENTS (target_types),
clipboard_get_calendar_cb,
clipboard_clear_calendar_cb,
comp_str)) {
g_free (comp_str);
} else {
- gtk_clipboard_set_can_store (clipboard, target_types + 1, n_target_types - 1);
+ gtk_clipboard_set_can_store (clipboard, target_types + 1, G_N_ELEMENTS (target_types) - 1);
}
/* free memory */
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index 84d3d3c65f..58334d3264 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -130,7 +130,6 @@ GType e_calendar_view_get_type (void);
GnomeCalendar *e_calendar_view_get_calendar (ECalendarView *cal_view);
void e_calendar_view_set_calendar (ECalendarView *cal_view, GnomeCalendar *calendar);
ECalModel *e_calendar_view_get_model (ECalendarView *cal_view);
-void e_calendar_view_set_model (ECalendarView *cal_view, ECalModel *model);
icaltimezone *e_calendar_view_get_timezone (ECalendarView *cal_view);
void e_calendar_view_set_timezone (ECalendarView *cal_view, icaltimezone *zone);
const gchar *e_calendar_view_get_default_category (ECalendarView *cal_view);
diff --git a/calendar/gui/e-cell-date-edit-config.c b/calendar/gui/e-cell-date-edit-config.c
deleted file mode 100644
index 5b04791412..0000000000
--- a/calendar/gui/e-cell-date-edit-config.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include "calendar-config.h"
-#include "e-mini-calendar-config.h"
-#include "e-cell-date-edit-config.h"
-
-struct _ECellDateEditConfigPrivate {
- ECellDateEdit *cell;
-
- EMiniCalendarConfig *mini_config;
-
- GList *notifications;
-};
-
-/* Property IDs */
-enum props {
- PROP_0,
- PROP_CELL
-};
-
-G_DEFINE_TYPE (ECellDateEditConfig, e_cell_date_edit_config, G_TYPE_OBJECT)
-
-static void
-e_cell_date_edit_config_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
-{
- ECellDateEditConfig *view_config;
-
- view_config = E_CELL_DATE_EDIT_CONFIG (object);
-
- switch (property_id) {
- case PROP_CELL:
- e_cell_date_edit_config_set_cell (view_config, g_value_get_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-e_cell_date_edit_config_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
-{
- ECellDateEditConfig *view_config;
-
- view_config = E_CELL_DATE_EDIT_CONFIG (object);
-
- switch (property_id) {
- case PROP_CELL:
- g_value_set_object (value, e_cell_date_edit_config_get_cell (view_config));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-e_cell_date_edit_config_dispose (GObject *object)
-{
- ECellDateEditConfig *view_config = E_CELL_DATE_EDIT_CONFIG (object);
-
- e_cell_date_edit_config_set_cell (view_config, NULL);
-
- if (G_OBJECT_CLASS (e_cell_date_edit_config_parent_class)->dispose)
- G_OBJECT_CLASS (e_cell_date_edit_config_parent_class)->dispose (object);
-}
-
-static void
-e_cell_date_edit_config_finalize (GObject *object)
-{
- ECellDateEditConfig *view_config = E_CELL_DATE_EDIT_CONFIG (object);
- ECellDateEditConfigPrivate *priv;
-
- priv = view_config->priv;
-
- g_free (priv);
-
- if (G_OBJECT_CLASS (e_cell_date_edit_config_parent_class)->finalize)
- G_OBJECT_CLASS (e_cell_date_edit_config_parent_class)->finalize (object);
-}
-
-static void
-e_cell_date_edit_config_class_init (ECellDateEditConfigClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GParamSpec *spec;
-
- /* Method override */
- gobject_class->set_property = e_cell_date_edit_config_set_property;
- gobject_class->get_property = e_cell_date_edit_config_get_property;
- gobject_class->dispose = e_cell_date_edit_config_dispose;
- gobject_class->finalize = e_cell_date_edit_config_finalize;
-
- spec = g_param_spec_object ("cell", NULL, NULL, e_cell_date_edit_get_type (),
- G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
- g_object_class_install_property (gobject_class, PROP_CELL, spec);
-}
-
-static void
-e_cell_date_edit_config_init (ECellDateEditConfig *view_config)
-{
- view_config->priv = g_new0 (ECellDateEditConfigPrivate, 1);
-
-}
-
-ECellDateEditConfig *
-e_cell_date_edit_config_new (ECellDateEdit *cell)
-{
- ECellDateEditConfig *view_config;
-
- view_config = g_object_new (e_cell_date_edit_config_get_type (), "cell", cell, NULL);
-
- return view_config;
-}
-
-ECellDateEdit *
-e_cell_date_edit_config_get_cell (ECellDateEditConfig *view_config)
-{
- ECellDateEditConfigPrivate *priv;
-
- g_return_val_if_fail (view_config != NULL, NULL);
- g_return_val_if_fail (E_IS_CELL_DATE_EDIT_CONFIG (view_config), NULL);
-
- priv = view_config->priv;
-
- return priv->cell;
-}
-
-static void
-set_timezone (ECellDateEdit *cell)
-{
- ECellDateEditText *cell_text;
- ECellPopup *cell_popup;
- icaltimezone *zone;
-
- zone = calendar_config_get_icaltimezone ();
-
- cell_popup = E_CELL_POPUP (cell);
- cell_text = E_CELL_DATE_EDIT_TEXT (cell_popup->child);
- e_cell_date_edit_text_set_timezone (cell_text, zone);
-}
-
-static void
-timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- ECellDateEditConfig *view_config = data;
- ECellDateEditConfigPrivate *priv;
-
- priv = view_config->priv;
-
- set_timezone (priv->cell);
-}
-
-static void
-set_twentyfour_hour (ECellDateEdit *cell)
-{
- ECellDateEditText *cell_text;
- ECellPopup *cell_popup;
- gboolean use_24_hour;
-
- use_24_hour = calendar_config_get_24_hour_format ();
-
- e_cell_date_edit_freeze (cell);
- g_object_set (G_OBJECT (cell),
- "use_24_hour_format", use_24_hour,
- NULL);
- e_cell_date_edit_thaw (cell);
-
- cell_popup = E_CELL_POPUP (cell);
- cell_text = E_CELL_DATE_EDIT_TEXT (cell_popup->child);
- e_cell_date_edit_text_set_use_24_hour_format (cell_text, use_24_hour);
-}
-
-static void
-twentyfour_hour_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- ECellDateEditConfig *view_config = data;
- ECellDateEditConfigPrivate *priv;
-
- priv = view_config->priv;
-
- set_twentyfour_hour (priv->cell);
-}
-
-static void
-set_range (ECellDateEdit *cell)
-{
- gint start_hour, end_hour;
-
- start_hour = calendar_config_get_day_start_hour ();
- end_hour = calendar_config_get_day_end_hour ();
-
- /* Round up the end hour. */
- if (calendar_config_get_day_end_minute () != 0)
- end_hour++;
-
- /* Make sure the start hour is ok */
- if (start_hour > end_hour)
- start_hour = end_hour;
-
- /* We use the default 0 - 24 now. */
-#if 0
- g_object_set (G_OBJECT (cell),
- "lower_hour", start_hour,
- "upper_hour", end_hour,
- NULL);
-#endif
-}
-
-static void
-day_start_hour_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- ECellDateEditConfig *view_config = data;
- ECellDateEditConfigPrivate *priv;
-
- priv = view_config->priv;
-
- set_range (priv->cell);
-}
-
-static void
-day_end_hour_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- ECellDateEditConfig *view_config = data;
- ECellDateEditConfigPrivate *priv;
-
- priv = view_config->priv;
-
- set_range (priv->cell);
-}
-
-static void
-day_end_minute_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- ECellDateEditConfig *view_config = data;
- ECellDateEditConfigPrivate *priv;
-
- priv = view_config->priv;
-
- set_range (priv->cell);
-}
-
-void
-e_cell_date_edit_config_set_cell (ECellDateEditConfig *view_config, ECellDateEdit *cell)
-{
- ECellDateEditConfigPrivate *priv;
- guint not;
- GList *l;
-
- g_return_if_fail (view_config != NULL);
- g_return_if_fail (E_IS_CELL_DATE_EDIT_CONFIG (view_config));
-
- priv = view_config->priv;
-
- if (priv->cell) {
- g_object_unref (priv->cell);
- priv->cell = NULL;
- }
-
- if (priv->mini_config) {
- g_object_unref (priv->mini_config);
- priv->mini_config = NULL;
- }
-
- for (l = priv->notifications; l; l = l->next)
- calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
-
- g_list_free (priv->notifications);
- priv->notifications = NULL;
-
- /* If the new view is NULL, return right now */
- if (!cell)
- return;
-
- priv->cell = g_object_ref (cell);
-
- /* Time zone */
- set_timezone (cell);
-
- not = calendar_config_add_notification_timezone (timezone_changed_cb, view_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- /* 24 Hour format */
- set_twentyfour_hour (cell);
-
- not = calendar_config_add_notification_24_hour_format (twentyfour_hour_changed_cb, view_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- /* Popup time range */
- set_range (cell);
-
- not = calendar_config_add_notification_day_start_hour (day_start_hour_changed_cb, view_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
- not = calendar_config_add_notification_day_end_hour (day_end_hour_changed_cb, view_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
- not = calendar_config_add_notification_day_end_minute (day_end_minute_changed_cb, view_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- /* The mini calendar */
- priv->mini_config = e_mini_calendar_config_new (E_CALENDAR (cell->calendar));
-}
diff --git a/calendar/gui/e-cell-date-edit-config.h b/calendar/gui/e-cell-date-edit-config.h
deleted file mode 100644
index 9917378dd1..0000000000
--- a/calendar/gui/e-cell-date-edit-config.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_CELL_DATE_EDIT_CONFIG_H_
-#define _E_CELL_DATE_EDIT_CONFIG_H_
-
-#include <table/e-cell-date-edit.h>
-#include "e-cell-date-edit-text.h"
-
-G_BEGIN_DECLS
-
-#define E_CELL_DATE_EDIT_CONFIG(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_cell_date_edit_config_get_type (), ECellDateEditConfig)
-#define E_CELL_DATE_EDIT_CONFIG_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_cell_date_edit_config_get_type (), ECellDateEditConfigClass)
-#define E_IS_CELL_DATE_EDIT_CONFIG(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_cell_date_edit_config_get_type ())
-
-typedef struct _ECellDateEditConfig ECellDateEditConfig;
-typedef struct _ECellDateEditConfigClass ECellDateEditConfigClass;
-typedef struct _ECellDateEditConfigPrivate ECellDateEditConfigPrivate;
-
-struct _ECellDateEditConfig {
- GObject parent;
-
- ECellDateEditConfigPrivate *priv;
-};
-
-struct _ECellDateEditConfigClass {
- GObjectClass parent_class;
-};
-
-GType e_cell_date_edit_config_get_type (void);
-ECellDateEditConfig *e_cell_date_edit_config_new (ECellDateEdit *cell);
-ECellDateEdit *e_cell_date_edit_config_get_cell (ECellDateEditConfig *cell_config);
-void e_cell_date_edit_config_set_cell (ECellDateEditConfig *view_config, ECellDateEdit *cell);
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/gui/e-cell-date-edit-text.c b/calendar/gui/e-cell-date-edit-text.c
index 64dd48ddf1..c99d62d4e9 100644
--- a/calendar/gui/e-cell-date-edit-text.c
+++ b/calendar/gui/e-cell-date-edit-text.c
@@ -37,51 +37,109 @@
#include "e-cell-date-edit-text.h"
-G_DEFINE_TYPE (ECellDateEditText, e_cell_date_edit_text, E_CELL_TEXT_TYPE)
+#define E_CELL_DATE_EDIT_TEXT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_CELL_DATE_EDIT_TEXT, ECellDateEditTextPrivate))
-void
-e_cell_date_edit_text_set_timezone (ECellDateEditText *ecd,
- icaltimezone *zone)
+struct _ECellDateEditTextPrivate {
+
+ /* The timezone to display the date in. */
+ icaltimezone *timezone;
+
+ /* Whether to display in 24-hour format. */
+ gboolean use_24_hour_format;
+};
+
+enum {
+ PROP_0,
+ PROP_TIMEZONE,
+ PROP_USE_24_HOUR_FORMAT
+};
+
+static gpointer parent_class;
+
+static void
+cell_date_edit_text_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- g_return_if_fail (E_IS_CELL_DATE_EDIT_TEXT (ecd));
+ switch (property_id) {
+ case PROP_TIMEZONE:
+ e_cell_date_edit_text_set_timezone (
+ E_CELL_DATE_EDIT_TEXT (object),
+ g_value_get_pointer (value));
+ return;
- ecd->zone = zone;
+ case PROP_USE_24_HOUR_FORMAT:
+ e_cell_date_edit_text_set_use_24_hour_format (
+ E_CELL_DATE_EDIT_TEXT (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
-void
-e_cell_date_edit_text_set_use_24_hour_format (ECellDateEditText *ecd,
- gboolean use_24_hour)
+static void
+cell_date_edit_text_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- g_return_if_fail (E_IS_CELL_DATE_EDIT_TEXT (ecd));
+ switch (property_id) {
+ case PROP_TIMEZONE:
+ g_value_set_pointer (
+ value,
+ e_cell_date_edit_text_get_timezone (
+ E_CELL_DATE_EDIT_TEXT (object)));
+ return;
+
+ case PROP_USE_24_HOUR_FORMAT:
+ g_value_set_boolean (
+ value,
+ e_cell_date_edit_text_get_use_24_hour_format (
+ E_CELL_DATE_EDIT_TEXT (object)));
+ return;
+ }
- ecd->use_24_hour_format = use_24_hour;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static gchar *
-ecd_get_text (ECellText *cell, ETableModel *model, gint col, gint row)
+cell_date_edit_text_get_text (ECellText *cell,
+ ETableModel *model,
+ gint col,
+ gint row)
{
ECellDateEditText *ecd = E_CELL_DATE_EDIT_TEXT (cell);
ECellDateEditValue *dv = e_table_model_value_at (model, col, row);
+ gboolean use_24_hour_format;
+ icaltimezone *timezone;
struct tm tmp_tm;
gchar buffer[64];
if (!dv)
return g_strdup ("");
+ timezone = e_cell_date_edit_text_get_timezone (ecd);
+ use_24_hour_format = e_cell_date_edit_text_get_use_24_hour_format (ecd);
+
/* Note that although the property may be in a different
timezone, we convert it to the current timezone to display
it in the table. If the user actually edits the value,
it will be set to the current timezone. See set_value(). */
- tmp_tm = icaltimetype_to_tm_with_zone (&dv->tt, dv->zone, ecd->zone);
+ tmp_tm = icaltimetype_to_tm_with_zone (&dv->tt, dv->zone, timezone);
- e_time_format_date_and_time (&tmp_tm, ecd->use_24_hour_format,
+ e_time_format_date_and_time (&tmp_tm, use_24_hour_format,
!dv->tt.is_date, FALSE,
buffer, sizeof (buffer));
return g_strdup (buffer);
}
static void
-ecd_free_text (ECellText *cell, gchar *text)
+cell_date_edit_text_free_text (ECellText *cell,
+ gchar *text)
{
g_free (text);
}
@@ -100,7 +158,7 @@ show_date_warning (ECellDateEditText *ecd)
matter. */
tmp_tm = localtime (&t);
- if (ecd->use_24_hour_format)
+ if (e_cell_date_edit_text_get_use_24_hour_format (ecd))
/* strftime format of a weekday, a date and a time, 24-hour. */
format = _("%a %m/%d/%Y %H:%M:%S");
else
@@ -120,8 +178,11 @@ show_date_warning (ECellDateEditText *ecd)
}
static void
-ecd_set_value (ECellText *cell, ETableModel *model, gint col, gint row,
- const gchar *text)
+cell_date_edit_text_set_value (ECellText *cell,
+ ETableModel *model,
+ gint col,
+ gint row,
+ const gchar *text)
{
ECellDateEditText *ecd = E_CELL_DATE_EDIT_TEXT (cell);
ETimeParseStatus status;
@@ -162,7 +223,7 @@ ecd_set_value (ECellText *cell, ETableModel *model, gint col, gint row,
if (is_date) {
dv.zone = NULL;
} else {
- dv.zone = ecd->zone;
+ dv.zone = e_cell_date_edit_text_get_timezone (ecd);
}
value = &dv;
@@ -172,20 +233,76 @@ ecd_set_value (ECellText *cell, ETableModel *model, gint col, gint row,
}
static void
-e_cell_date_edit_text_class_init (ECellDateEditTextClass *ecdet)
+cell_date_edit_text_class_init (ECellDateEditTextClass *class)
{
- ECellTextClass *ectc = E_CELL_TEXT_CLASS (ecdet);
-
- ectc->get_text = ecd_get_text;
- ectc->free_text = ecd_free_text;
- ectc->set_value = ecd_set_value;
+ GObjectClass *object_class;
+ ECellTextClass *cell_text_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (ECellDateEditTextPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = cell_date_edit_text_set_property;
+ object_class->get_property = cell_date_edit_text_get_property;
+
+ cell_text_class = E_CELL_TEXT_CLASS (class);
+ cell_text_class->get_text = cell_date_edit_text_get_text;
+ cell_text_class->free_text = cell_date_edit_text_free_text;
+ cell_text_class->set_value = cell_date_edit_text_set_value;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_TIMEZONE,
+ g_param_spec_pointer (
+ "timezone",
+ "Time Zone",
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_USE_24_HOUR_FORMAT,
+ g_param_spec_boolean (
+ "use-24-hour-format",
+ "Use 24-Hour Format",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
}
static void
-e_cell_date_edit_text_init (ECellDateEditText *ecd)
+cell_date_edit_text_init (ECellDateEditText *ecd)
{
- ecd->zone = icaltimezone_get_utc_timezone ();
- ecd->use_24_hour_format = TRUE;
+ ecd->priv = E_CELL_DATE_EDIT_TEXT_GET_PRIVATE (ecd);
+
+ ecd->priv->timezone = icaltimezone_get_utc_timezone ();
+ ecd->priv->use_24_hour_format = TRUE;
+}
+
+GType
+e_cell_date_edit_text_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ const GTypeInfo type_info = {
+ sizeof (ECellDateEditTextClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) cell_date_edit_text_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (ECellDateEditText),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) cell_date_edit_text_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_CELL_TEXT_TYPE, "ECellDateEditText", &type_info, 0);
+ }
+
+ return type;
}
/**
@@ -201,10 +318,49 @@ ECell *
e_cell_date_edit_text_new (const gchar *fontname,
GtkJustification justify)
{
- ECellDateEditText *ecd = g_object_new (e_cell_date_edit_text_get_type (), NULL);
+ ECell *cell;
+
+ cell = g_object_new (E_TYPE_CELL_DATE_EDIT_TEXT, NULL);
+ e_cell_text_construct (E_CELL_TEXT (cell), fontname, justify);
+
+ return cell;
+}
+
+icaltimezone *
+e_cell_date_edit_text_get_timezone (ECellDateEditText *ecd)
+{
+ g_return_val_if_fail (E_IS_CELL_DATE_EDIT_TEXT (ecd), NULL);
+
+ return ecd->priv->timezone;
+}
+
+void
+e_cell_date_edit_text_set_timezone (ECellDateEditText *ecd,
+ icaltimezone *timezone)
+{
+ g_return_if_fail (E_IS_CELL_DATE_EDIT_TEXT (ecd));
+
+ ecd->priv->timezone = timezone;
+
+ g_object_notify (G_OBJECT (ecd), "timezone");
+}
+
+gboolean
+e_cell_date_edit_text_get_use_24_hour_format (ECellDateEditText *ecd)
+{
+ g_return_val_if_fail (E_IS_CELL_DATE_EDIT_TEXT (ecd), FALSE);
+
+ return ecd->priv->use_24_hour_format;
+}
+
+void
+e_cell_date_edit_text_set_use_24_hour_format (ECellDateEditText *ecd,
+ gboolean use_24_hour)
+{
+ g_return_if_fail (E_IS_CELL_DATE_EDIT_TEXT (ecd));
- e_cell_text_construct (E_CELL_TEXT (ecd), fontname, justify);
+ ecd->priv->use_24_hour_format = use_24_hour;
- return (ECell *) ecd;
+ g_object_notify (G_OBJECT (ecd), "use-24-hour-format");
}
diff --git a/calendar/gui/e-cell-date-edit-text.h b/calendar/gui/e-cell-date-edit-text.h
index 5dc1f0c4bd..a49b68d36b 100644
--- a/calendar/gui/e-cell-date-edit-text.h
+++ b/calendar/gui/e-cell-date-edit-text.h
@@ -27,42 +27,60 @@
#include <libical/ical.h>
#include <table/e-cell-text.h>
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_CELL_DATE_EDIT_TEXT \
+ (e_cell_date_edit_text_get_type ())
+#define E_CELL_DATE_EDIT_TEXT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_CELL_DATE_EDIT_TEXT, ECellDateEditText))
+#define E_CELL_DATE_EDIT_TEXT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_CELL_DATE_EDIT_TEXT, ECellDateEditTextClass))
+#define E_IS_CELL_DATE_EDIT_TEXT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_CELL_DATE_EDIT_TEXT))
+#define E_IS_CELL_DATE_EDIT_TEXT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_CELL_DATE_EDIT_TEXT))
+#define E_CELL_DATE_EDIT_TEXT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_CELL_DATE_EDIT_TEXT, ECellDateEditTextClass))
-#define E_CELL_DATE_EDIT_TEXT_TYPE (e_cell_date_edit_text_get_type ())
-#define E_CELL_DATE_EDIT_TEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_DATE_EDIT_TEXT_TYPE, ECellDateEditText))
-#define E_CELL_DATE_EDIT_TEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_DATE_EDIT_TEXT_TYPE, ECellDateEditTextClass))
-#define E_IS_CELL_DATE_EDIT_TEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_DATE_EDIT_TEXT_TYPE))
-#define E_IS_CELL_DATE_EDIT_TEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_DATE_EDIT_TEXT_TYPE))
+G_BEGIN_DECLS
+typedef struct _ECellDateEditText ECellDateEditText;
+typedef struct _ECellDateEditTextClass ECellDateEditTextClass;
+typedef struct _ECellDateEditTextPrivate ECellDateEditTextPrivate;
typedef struct _ECellDateEditValue ECellDateEditValue;
+
struct _ECellDateEditValue {
struct icaltimetype tt;
icaltimezone *zone;
};
-typedef struct {
- ECellText base;
-
- /* The timezone to display the date in. */
- icaltimezone *zone;
-
- /* Whether to display in 24-hour format. */
- gboolean use_24_hour_format;
-} ECellDateEditText;
+struct _ECellDateEditText {
+ ECellText parent;
+ ECellDateEditTextPrivate *priv;
+};
-typedef struct {
+struct _ECellDateEditTextClass {
ECellTextClass parent_class;
-} ECellDateEditTextClass;
+};
-GType e_cell_date_edit_text_get_type (void);
-ECell *e_cell_date_edit_text_new (const gchar *fontname,
- GtkJustification justify);
+GType e_cell_date_edit_text_get_type (void);
+ECell * e_cell_date_edit_text_new (const gchar *fontname,
+ GtkJustification justify);
+icaltimezone * e_cell_date_edit_text_get_timezone
+ (ECellDateEditText *ecd);
+void e_cell_date_edit_text_set_timezone
+ (ECellDateEditText *ecd,
+ icaltimezone *timezone);
+gboolean e_cell_date_edit_text_get_use_24_hour_format
+ (ECellDateEditText *ecd);
+void e_cell_date_edit_text_set_use_24_hour_format
+ (ECellDateEditText *ecd,
+ gboolean use_24_hour);
-void e_cell_date_edit_text_set_timezone (ECellDateEditText *ecd,
- icaltimezone *zone);
-void e_cell_date_edit_text_set_use_24_hour_format (ECellDateEditText *ecd,
- gboolean use_24_hour);
G_END_DECLS
#endif /* _E_CELL_DATE_EDIT_TEXT_H_ */
diff --git a/calendar/gui/e-date-edit-config.c b/calendar/gui/e-date-edit-config.c
deleted file mode 100644
index bead58f5d2..0000000000
--- a/calendar/gui/e-date-edit-config.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include "calendar-config.h"
-#include "e-date-edit-config.h"
-
-struct _EDateEditConfigPrivate {
- EDateEdit *edit;
-
- GList *notifications;
-};
-
-/* Property IDs */
-enum props {
- PROP_0,
- PROP_EDIT
-};
-
-G_DEFINE_TYPE (EDateEditConfig, e_date_edit_config, G_TYPE_OBJECT)
-
-static void
-e_date_edit_config_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
-{
- EDateEditConfig *edit_config;
-
- edit_config = E_DATE_EDIT_CONFIG (object);
-
- switch (property_id) {
- case PROP_EDIT:
- e_date_edit_config_set_edit (edit_config, g_value_get_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-e_date_edit_config_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
-{
- EDateEditConfig *edit_config;
-
- edit_config = E_DATE_EDIT_CONFIG (object);
-
- switch (property_id) {
- case PROP_EDIT:
- g_value_set_object (value, e_date_edit_config_get_edit (edit_config));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-e_date_edit_config_dispose (GObject *object)
-{
- EDateEditConfig *edit_config = E_DATE_EDIT_CONFIG (object);
-
- e_date_edit_config_set_edit (edit_config, NULL);
-
- if (G_OBJECT_CLASS (e_date_edit_config_parent_class)->dispose)
- G_OBJECT_CLASS (e_date_edit_config_parent_class)->dispose (object);
-}
-
-static void
-e_date_edit_config_finalize (GObject *object)
-{
- EDateEditConfig *edit_config = E_DATE_EDIT_CONFIG (object);
- EDateEditConfigPrivate *priv;
-
- priv = edit_config->priv;
-
- g_free (priv);
-
- if (G_OBJECT_CLASS (e_date_edit_config_parent_class)->finalize)
- G_OBJECT_CLASS (e_date_edit_config_parent_class)->finalize (object);
-}
-
-static void
-e_date_edit_config_class_init (EDateEditConfigClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GParamSpec *spec;
-
- /* Method override */
- gobject_class->set_property = e_date_edit_config_set_property;
- gobject_class->get_property = e_date_edit_config_get_property;
- gobject_class->dispose = e_date_edit_config_dispose;
- gobject_class->finalize = e_date_edit_config_finalize;
-
- spec = g_param_spec_object ("edit", NULL, NULL, e_date_edit_get_type (),
- G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
- g_object_class_install_property (gobject_class, PROP_EDIT, spec);
-}
-
-static void
-e_date_edit_config_init (EDateEditConfig *edit_config)
-{
- edit_config->priv = g_new0 (EDateEditConfigPrivate, 1);
-
-}
-
-EDateEditConfig *
-e_date_edit_config_new (EDateEdit *date_edit)
-{
- EDateEditConfig *edit_config;
-
- edit_config = g_object_new (e_date_edit_config_get_type (), "edit", date_edit, NULL);
-
- return edit_config;
-}
-
-EDateEdit *
-e_date_edit_config_get_edit (EDateEditConfig *edit_config)
-{
- EDateEditConfigPrivate *priv;
-
- g_return_val_if_fail (edit_config != NULL, NULL);
- g_return_val_if_fail (E_IS_DATE_EDIT_CONFIG (edit_config), NULL);
-
- priv = edit_config->priv;
-
- return priv->edit;
-}
-
-static void
-set_week_start (EDateEdit *date_edit)
-{
- gint week_start_day;
-
- week_start_day = calendar_config_get_week_start_day ();
-
- /* Convert it to 0 (Mon) to 6 (Sun), which is what we use. */
- week_start_day = (week_start_day + 6) % 7;
-
- e_date_edit_set_week_start_day (date_edit, week_start_day);
-}
-
-static void
-week_start_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- EDateEditConfig *edit_config = data;
- EDateEditConfigPrivate *priv;
-
- priv = edit_config->priv;
-
- set_week_start (priv->edit);
-}
-
-static void
-set_twentyfour_hour (EDateEdit *date_edit)
-{
- gboolean use_24_hour;
-
- use_24_hour = calendar_config_get_24_hour_format ();
-
- e_date_edit_set_use_24_hour_format (date_edit, use_24_hour);
-}
-
-static void
-twentyfour_hour_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- EDateEditConfig *edit_config = data;
- EDateEditConfigPrivate *priv;
-
- priv = edit_config->priv;
-
- set_twentyfour_hour (priv->edit);
-}
-
-static void
-set_dnav_show_week_no (EDateEdit *date_edit)
-{
- gboolean show_week_no;
-
- show_week_no = calendar_config_get_dnav_show_week_no ();
-
- e_date_edit_set_show_week_numbers (date_edit, show_week_no);
-}
-
-static void
-dnav_show_week_no_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- EDateEditConfig *edit_config = data;
- EDateEditConfigPrivate *priv;
-
- priv = edit_config->priv;
-
- set_dnav_show_week_no (priv->edit);
-}
-void
-e_date_edit_config_set_edit (EDateEditConfig *edit_config, EDateEdit *date_edit)
-{
- EDateEditConfigPrivate *priv;
- guint not;
- GList *l;
-
- g_return_if_fail (edit_config != NULL);
- g_return_if_fail (E_IS_DATE_EDIT_CONFIG (edit_config));
-
- priv = edit_config->priv;
-
- if (priv->edit) {
- g_object_unref (priv->edit);
- priv->edit = NULL;
- }
-
- for (l = priv->notifications; l; l = l->next)
- calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
-
- g_list_free (priv->notifications);
- priv->notifications = NULL;
-
- /* If the new edit is NULL, return right now */
- if (!date_edit)
- return;
-
- priv->edit = g_object_ref (date_edit);
-
- /* Week start */
- set_week_start (date_edit);
-
- not = calendar_config_add_notification_week_start_day (week_start_changed_cb, edit_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- /* 24 Hour format */
- set_twentyfour_hour (date_edit);
-
- not = calendar_config_add_notification_24_hour_format (twentyfour_hour_changed_cb, edit_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- /* Show week numbers */
- set_dnav_show_week_no (date_edit);
-
- not = calendar_config_add_notification_dnav_show_week_no (dnav_show_week_no_changed_cb, edit_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-}
diff --git a/calendar/gui/e-date-edit-config.h b/calendar/gui/e-date-edit-config.h
deleted file mode 100644
index 4065ec74e7..0000000000
--- a/calendar/gui/e-date-edit-config.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_DATE_EDIT_CONFIG_H_
-#define _E_DATE_EDIT_CONFIG_H_
-
-#include <misc/e-dateedit.h>
-
-G_BEGIN_DECLS
-
-#define E_DATE_EDIT_CONFIG(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_date_edit_config_get_type (), EDateEditConfig)
-#define E_DATE_EDIT_CONFIG_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_date_edit_config_get_type (), EDateEditConfigClass)
-#define E_IS_DATE_EDIT_CONFIG(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_date_edit_config_get_type ())
-
-typedef struct _EDateEditConfig EDateEditConfig;
-typedef struct _EDateEditConfigClass EDateEditConfigClass;
-typedef struct _EDateEditConfigPrivate EDateEditConfigPrivate;
-
-struct _EDateEditConfig {
- GObject parent;
-
- EDateEditConfigPrivate *priv;
-};
-
-struct _EDateEditConfigClass {
- GObjectClass parent_class;
-};
-
-GType e_date_edit_config_get_type (void);
-EDateEditConfig *e_date_edit_config_new (EDateEdit *date_edit);
-EDateEdit *e_date_edit_config_get_edit (EDateEditConfig *edit_config);
-void e_date_edit_config_set_edit (EDateEditConfig *edit_config, EDateEdit *date_edit);
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 117e69d1ff..7fc7bfac90 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -38,6 +38,7 @@
#include <e-util/e-unicode.h>
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
#include <glib/gi18n.h>
+#include <e-util/e-binding.h>
#include <e-util/e-categories-config.h>
#include <e-util/e-dialog-utils.h>
@@ -600,6 +601,22 @@ day_view_get_property (GObject *object,
}
static void
+day_view_constructed (GObject *object)
+{
+ ECalModel *model;
+ EDayView *day_view;
+ EShellSettings *shell_settings;
+
+ day_view = E_DAY_VIEW (object);
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view));
+ shell_settings = e_cal_model_get_shell_settings (model);
+
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-day-view-show-week-numbers",
+ G_OBJECT (day_view->week_number_label), "visible");
+}
+
+static void
e_day_view_class_init (EDayViewClass *class)
{
GObjectClass *object_class;
@@ -610,6 +627,7 @@ e_day_view_class_init (EDayViewClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->set_property = day_view_set_property;
object_class->get_property = day_view_get_property;
+ object_class->constructed = day_view_constructed;
gtk_object_class = GTK_OBJECT_CLASS (class);
gtk_object_class->destroy = e_day_view_destroy;
@@ -984,12 +1002,6 @@ timezone_changed_cb (ECalendarView *cal_view, icaltimezone *old_zone,
}
static void
-dview_show_week_no_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- e_day_view_set_show_week_number (data, calendar_config_get_dview_show_week_no ());
-}
-
-static void
e_day_view_init (EDayView *day_view)
{
gint day;
@@ -1094,9 +1106,6 @@ e_day_view_init (EDayView *day_view)
day_view->week_number_label = gtk_label_new ("");
gtk_table_attach (GTK_TABLE (day_view), day_view->week_number_label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
- day_view->wn_notif_id = calendar_config_add_notification_dview_show_week_no (dview_show_week_no_changed_cb, day_view);
- if (calendar_config_get_dview_show_week_no ())
- gtk_widget_show (day_view->week_number_label);
/*
* Top Canvas
@@ -1350,8 +1359,9 @@ e_day_view_new (ECalModel *model)
{
ECalendarView *day_view;
- day_view = g_object_new (E_TYPE_DAY_VIEW, NULL);
- e_calendar_view_set_model (day_view, model);
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
+
+ day_view = g_object_new (E_TYPE_DAY_VIEW, "model", model, NULL);
init_model (E_DAY_VIEW (day_view), model);
return day_view;
@@ -1369,11 +1379,6 @@ e_day_view_destroy (GtkObject *object)
e_day_view_stop_auto_scroll (day_view);
- if (day_view->wn_notif_id) {
- calendar_config_remove_notification (day_view->wn_notif_id);
- day_view->wn_notif_id = 0;
- }
-
if (day_view->large_font_desc) {
pango_font_description_free (day_view->large_font_desc);
day_view->large_font_desc = NULL;
@@ -2590,27 +2595,6 @@ e_day_view_recalc_day_starts (EDayView *day_view,
g_free (str);
}
-gboolean
-e_day_view_get_show_week_number (EDayView *day_view)
-{
- g_return_val_if_fail (day_view != NULL, FALSE);
-
- return GTK_WIDGET_VISIBLE (day_view->week_number_label);
-}
-
-void
-e_day_view_set_show_week_number (EDayView *day_view, gboolean show)
-{
- g_return_if_fail (day_view != NULL);
-
- if (e_day_view_get_show_week_number (day_view) != show) {
- if (show)
- gtk_widget_show (day_view->week_number_label);
- else
- gtk_widget_hide (day_view->week_number_label);
- }
-}
-
/* Whether we are displaying a work-week, in which case the display always
starts on the first day of the working week. */
gboolean
diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h
index 8d778fa442..683e231d14 100644
--- a/calendar/gui/e-day-view.h
+++ b/calendar/gui/e-day-view.h
@@ -233,8 +233,6 @@ struct _EDayView {
/* label showing week number in upper-left corner */
GtkWidget *week_number_label;
- /* option change notification id for week number */
- guint wn_notif_id;
/* S-expression for query and the query object */
ECalView *query;
@@ -634,10 +632,6 @@ void e_day_view_ensure_rows_visible (EDayView *day_view,
gint start_row,
gint end_row);
-/* Week number in upper-left corner of the day view widget */
-gboolean e_day_view_get_show_week_number (EDayView *day_view);
-void e_day_view_set_show_week_number (EDayView *day_view, gboolean show);
-
G_END_DECLS
#endif /* _E_DAY_VIEW_H_ */
diff --git a/calendar/gui/e-memo-table-config.c b/calendar/gui/e-memo-table-config.c
deleted file mode 100644
index d79dac7073..0000000000
--- a/calendar/gui/e-memo-table-config.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@ximian.com>
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include "calendar-config.h"
-#include "e-cell-date-edit-config.h"
-#include "e-memo-table-config.h"
-
-struct _EMemoTableConfigPrivate {
- EMemoTable *table;
-
- ECellDateEditConfig *cell_config;
-
- GList *notifications;
-};
-
-G_DEFINE_TYPE (EMemoTableConfig, e_memo_table_config, G_TYPE_OBJECT)
-
-/* Property IDs */
-enum props {
- PROP_0,
- PROP_TABLE
-};
-
-static void
-e_memo_table_config_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
-{
- EMemoTableConfig *table_config;
-
- table_config = E_MEMO_TABLE_CONFIG (object);
-
- switch (property_id) {
- case PROP_TABLE:
- e_memo_table_config_set_table (table_config, g_value_get_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-e_memo_table_config_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
-{
- EMemoTableConfig *table_config;
-
- table_config = E_MEMO_TABLE_CONFIG (object);
-
- switch (property_id) {
- case PROP_TABLE:
- g_value_set_object (value, e_memo_table_config_get_table (table_config));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-e_memo_table_config_dispose (GObject *object)
-{
- EMemoTableConfig *table_config = E_MEMO_TABLE_CONFIG (object);
-
- e_memo_table_config_set_table (table_config, NULL);
-
- if (G_OBJECT_CLASS (e_memo_table_config_parent_class)->dispose)
- G_OBJECT_CLASS (e_memo_table_config_parent_class)->dispose (object);
-}
-
-static void
-e_memo_table_config_finalize (GObject *object)
-{
- EMemoTableConfig *table_config = E_MEMO_TABLE_CONFIG (object);
- EMemoTableConfigPrivate *priv;
-
- priv = table_config->priv;
-
- g_free (priv);
-
- if (G_OBJECT_CLASS (e_memo_table_config_parent_class)->finalize)
- G_OBJECT_CLASS (e_memo_table_config_parent_class)->finalize (object);
-}
-
-static void
-e_memo_table_config_class_init (EMemoTableConfigClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GParamSpec *spec;
-
- /* Method override */
- gobject_class->set_property = e_memo_table_config_set_property;
- gobject_class->get_property = e_memo_table_config_get_property;
- gobject_class->dispose = e_memo_table_config_dispose;
- gobject_class->finalize = e_memo_table_config_finalize;
-
- spec = g_param_spec_object ("table", NULL, NULL, e_memo_table_get_type (),
- G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
- g_object_class_install_property (gobject_class, PROP_TABLE, spec);
-}
-
-static void
-e_memo_table_config_init (EMemoTableConfig *table_config)
-{
- table_config->priv = g_new0 (EMemoTableConfigPrivate, 1);
-
-}
-
-EMemoTableConfig *
-e_memo_table_config_new (EMemoTable *table)
-{
- EMemoTableConfig *table_config;
-
- table_config = g_object_new (e_memo_table_config_get_type (), "table", table, NULL);
-
- return table_config;
-}
-
-EMemoTable *
-e_memo_table_config_get_table (EMemoTableConfig *table_config)
-{
- EMemoTableConfigPrivate *priv;
-
- g_return_val_if_fail (table_config != NULL, NULL);
- g_return_val_if_fail (E_IS_MEMO_TABLE_CONFIG (table_config), NULL);
-
- priv = table_config->priv;
-
- return priv->table;
-}
-
-static void
-set_timezone (EMemoTable *table)
-{
- ECalModel *model;
- icaltimezone *zone;
-
- zone = calendar_config_get_icaltimezone ();
- model = e_memo_table_get_model (table);
- if (model)
- e_cal_model_set_timezone (model, zone);
-}
-
-static void
-timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- EMemoTableConfig *table_config = data;
- EMemoTableConfigPrivate *priv;
-
- priv = table_config->priv;
-
- set_timezone (priv->table);
-}
-
-static void
-set_twentyfour_hour (EMemoTable *table)
-{
- ECalModel *model;
- gboolean use_24_hour;
-
- use_24_hour = calendar_config_get_24_hour_format ();
-
- model = e_memo_table_get_model (table);
- if (model)
- e_cal_model_set_use_24_hour_format (model, use_24_hour);
-}
-
-static void
-twentyfour_hour_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- EMemoTableConfig *table_config = data;
- EMemoTableConfigPrivate *priv;
-
- priv = table_config->priv;
-
- set_twentyfour_hour (priv->table);
-}
-
-void
-e_memo_table_config_set_table (EMemoTableConfig *table_config, EMemoTable *table)
-{
- EMemoTableConfigPrivate *priv;
- guint not;
- GList *l;
-
- g_return_if_fail (table_config != NULL);
- g_return_if_fail (E_IS_MEMO_TABLE_CONFIG (table_config));
-
- priv = table_config->priv;
-
- if (priv->table) {
- g_object_unref (priv->table);
- priv->table = NULL;
- }
-
- if (priv->cell_config) {
- g_object_unref (priv->cell_config);
- priv->cell_config = NULL;
- }
-
- for (l = priv->notifications; l; l = l->next)
- calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
-
- g_list_free (priv->notifications);
- priv->notifications = NULL;
-
- /* If the new view is NULL, return right now */
- if (!table)
- return;
-
- priv->table = g_object_ref (table);
-
- /* Time zone */
- set_timezone (table);
-
- not = calendar_config_add_notification_timezone (timezone_changed_cb, table_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- /* 24 Hour format */
- set_twentyfour_hour (table);
-
- not = calendar_config_add_notification_24_hour_format (twentyfour_hour_changed_cb, table_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- /* Date cell */
- priv->cell_config = e_cell_date_edit_config_new (table->dates_cell);
-}
diff --git a/calendar/gui/e-memo-table-config.h b/calendar/gui/e-memo-table-config.h
deleted file mode 100644
index 68960d58dc..0000000000
--- a/calendar/gui/e-memo-table-config.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@ximian.com>
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_MEMO_TABLE_CONFIG_H_
-#define _E_MEMO_TABLE_CONFIG_H_
-
-#include "e-memo-table.h"
-
-G_BEGIN_DECLS
-
-#define E_MEMO_TABLE_CONFIG(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_memo_table_config_get_type (), EMemoTableConfig)
-#define E_MEMO_TABLE_CONFIG_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_memo_table_config_get_type (), EMemoTableConfigClass)
-#define E_IS_MEMO_TABLE_CONFIG(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_memo_table_config_get_type ())
-
-typedef struct _EMemoTableConfig EMemoTableConfig;
-typedef struct _EMemoTableConfigClass EMemoTableConfigClass;
-typedef struct _EMemoTableConfigPrivate EMemoTableConfigPrivate;
-
-struct _EMemoTableConfig {
- GObject parent;
-
- EMemoTableConfigPrivate *priv;
-};
-
-struct _EMemoTableConfigClass {
- GObjectClass parent_class;
-};
-
-GType e_memo_table_config_get_type (void);
-EMemoTableConfig *e_memo_table_config_new (EMemoTable *table);
-EMemoTable *e_memo_table_config_get_table (EMemoTableConfig *view_config);
-void e_memo_table_config_set_table (EMemoTableConfig *view_config, EMemoTable *table);
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c
index 1cfc2b662b..a7f2508b3f 100644
--- a/calendar/gui/e-memo-table.c
+++ b/calendar/gui/e-memo-table.c
@@ -35,6 +35,7 @@
#include <unistd.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
+#include <e-util/e-binding.h>
#include <widgets/misc/e-gui-utils.h>
#include <table/e-cell-checkbox.h>
#include <table/e-cell-toggle.h>
@@ -92,8 +93,6 @@ static GtkTargetEntry target_types[] = {
{ (gchar *) "text/x-calendar", 0, TARGET_TYPE_VCALENDAR }
};
-static guint n_target_types = G_N_ELEMENTS (target_types);
-
static struct tm e_memo_table_get_current_time (ECellDateEdit *ecde, gpointer data);
static gpointer parent_class;
@@ -101,11 +100,12 @@ static guint signals[LAST_SIGNAL];
static GdkAtom clipboard_atom;
/* The icons to represent the task. */
-#define E_MEMO_MODEL_NUM_ICONS 2
-static const gchar * icon_names[E_MEMO_MODEL_NUM_ICONS] = {
- "stock_notes", "stock_insert-note"
+#define NUM_ICONS 2
+static const gchar *icon_names[NUM_ICONS] = {
+ "stock_notes",
+ "stock_insert-note"
};
-static GdkPixbuf* icon_pixbufs[E_MEMO_MODEL_NUM_ICONS] = { NULL };
+static GdkPixbuf *icon_pixbufs[NUM_ICONS] = { NULL };
static void
memo_table_emit_open_component (EMemoTable *memo_table,
@@ -222,6 +222,7 @@ memo_table_query_tooltip_cb (EMemoTable *memo_table,
GString *tmp2;
gchar buff[1001];
gboolean free_text = FALSE;
+ gboolean use_24_hour_format;
ECalComponent *new_comp;
ECalComponentOrganizer organizer;
ECalComponentDateTime dtstart, dtdue;
@@ -333,6 +334,7 @@ memo_table_query_tooltip_cb (EMemoTable *memo_table,
}
tmp2 = g_string_new ("");
+ use_24_hour_format = e_cal_model_get_use_24_hour_format (model);
if (dtstart.value) {
buff[0] = 0;
@@ -340,7 +342,7 @@ memo_table_query_tooltip_cb (EMemoTable *memo_table,
tmp_tm = icaltimetype_to_tm_with_zone (
dtstart.value, zone, default_zone);
e_time_format_date_and_time (
- &tmp_tm, calendar_config_get_24_hour_format (),
+ &tmp_tm, use_24_hour_format,
FALSE, FALSE, buff, 1000);
if (buff [0]) {
@@ -355,7 +357,7 @@ memo_table_query_tooltip_cb (EMemoTable *memo_table,
tmp_tm = icaltimetype_to_tm_with_zone (
dtdue.value, zone, default_zone);
e_time_format_date_and_time (
- &tmp_tm, calendar_config_get_24_hour_format (),
+ &tmp_tm, use_24_hour_format,
FALSE, FALSE, buff, 1000);
if (buff [0]) {
@@ -567,10 +569,22 @@ memo_table_constructed (GObject *object)
cell = e_cell_date_edit_text_new (NULL, GTK_JUSTIFY_LEFT);
g_object_set (cell, "bg_color_column", E_CAL_MODEL_FIELD_COLOR, NULL);
+ e_mutual_binding_new (
+ G_OBJECT (model), "timezone",
+ G_OBJECT (cell), "timezone");
+
+ e_mutual_binding_new (
+ G_OBJECT (model), "use-24-hour-format",
+ G_OBJECT (cell), "use-24-hour-format");
+
popup_cell = e_cell_date_edit_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
g_object_unref (cell);
+ e_mutual_binding_new (
+ G_OBJECT (model), "use-24-hour-format",
+ G_OBJECT (popup_cell), "use-24-hour-format");
+
e_table_extras_add_cell (extras, "dateedit", popup_cell);
memo_table->dates_cell = E_CELL_DATE_EDIT (popup_cell);
@@ -585,11 +599,11 @@ memo_table_constructed (GObject *object)
/* Create pixmaps */
if (!icon_pixbufs[0])
- for (i = 0; i < E_MEMO_MODEL_NUM_ICONS; i++) {
+ for (i = 0; i < NUM_ICONS; i++) {
icon_pixbufs[i] = e_icon_factory_get_icon (icon_names[i], GTK_ICON_SIZE_MENU);
}
- cell = e_cell_toggle_new (0, E_MEMO_MODEL_NUM_ICONS, icon_pixbufs);
+ cell = e_cell_toggle_new (0, NUM_ICONS, icon_pixbufs);
e_table_extras_add_cell (extras, "icon", cell);
e_table_extras_add_pixbuf (extras, "icon", icon_pixbufs[0]);
@@ -757,14 +771,6 @@ e_memo_table_new (EShellView *shell_view,
"model", model, "shell-view", shell_view, NULL);
}
-EShellView *
-e_memo_table_get_shell_view (EMemoTable *memo_table)
-{
- g_return_val_if_fail (E_IS_MEMO_TABLE (memo_table), NULL);
-
- return memo_table->priv->shell_view;
-}
-
/**
* e_memo_table_get_model:
* @memo_table: A calendar table.
@@ -803,6 +809,14 @@ e_memo_table_get_table (EMemoTable *memo_table)
return e_table_scrolled_get_table (table_scrolled);
}
+EShellView *
+e_memo_table_get_shell_view (EMemoTable *memo_table)
+{
+ g_return_val_if_fail (E_IS_MEMO_TABLE (memo_table), NULL);
+
+ return memo_table->priv->shell_view;
+}
+
/* Used from e_table_selected_row_foreach(); puts the selected row number in an
* gint pointed to by the closure data.
*/
@@ -1046,12 +1060,14 @@ e_memo_table_copy_clipboard (EMemoTable *memo_table)
e_table_selected_row_foreach (etable, copy_row_cb, memo_table);
comp_str = icalcomponent_as_ical_string_r (memo_table->tmp_vcal);
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (memo_table), clipboard_atom);
- if (!gtk_clipboard_set_with_data(clipboard, target_types, n_target_types,
- clipboard_get_calendar_cb,
- NULL, comp_str)) {
+ if (!gtk_clipboard_set_with_data (
+ clipboard, target_types, G_N_ELEMENTS (target_types),
+ clipboard_get_calendar_cb, NULL, comp_str)) {
/* no-op */
} else {
- gtk_clipboard_set_can_store (clipboard, target_types + 1, n_target_types - 1);
+ gtk_clipboard_set_can_store (
+ clipboard, target_types + 1,
+ G_N_ELEMENTS (target_types) - 1);
}
/* free memory */
diff --git a/calendar/gui/e-memo-table.h b/calendar/gui/e-memo-table.h
index f3b02e0c04..0bb79694b0 100644
--- a/calendar/gui/e-memo-table.h
+++ b/calendar/gui/e-memo-table.h
@@ -98,6 +98,14 @@ GtkWidget * e_memo_table_new (EShellView *shell_view,
ECalModel * e_memo_table_get_model (EMemoTable *memo_table);
ETable * e_memo_table_get_table (EMemoTable *memo_table);
EShellView * e_memo_table_get_shell_view (EMemoTable *memo_table);
+icaltimezone * e_memo_table_get_timezone (EMemoTable *memo_table);
+void e_memo_table_set_timezone (EMemoTable *memo_table,
+ icaltimezone *timezone);
+gboolean e_memo_table_get_use_24_hour_format
+ (EMemoTable *memo_table);
+void e_memo_table_set_use_24_hour_format
+ (EMemoTable *memo_table,
+ gboolean use_24_hour_format);
void e_memo_table_delete_selected (EMemoTable *memo_table);
GSList * e_memo_table_get_selected (EMemoTable *memo_table);
diff --git a/calendar/gui/e-mini-calendar-config.c b/calendar/gui/e-mini-calendar-config.c
deleted file mode 100644
index d9b2192ad2..0000000000
--- a/calendar/gui/e-mini-calendar-config.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#include "calendar-config.h"
-#include "e-mini-calendar-config.h"
-
-struct _EMiniCalendarConfigPrivate {
- ECalendar *mini_cal;
-
- GList *notifications;
-};
-
-/* Property IDs */
-enum props {
- PROP_0,
- PROP_CALENDAR
-};
-
-G_DEFINE_TYPE (EMiniCalendarConfig, e_mini_calendar_config, G_TYPE_OBJECT)
-
-static void
-e_mini_calendar_config_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
-{
- EMiniCalendarConfig *mini_config;
-
- mini_config = E_MINI_CALENDAR_CONFIG (object);
-
- switch (property_id) {
- case PROP_CALENDAR:
- e_mini_calendar_config_set_calendar (mini_config, g_value_get_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-e_mini_calendar_config_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
-{
- EMiniCalendarConfig *mini_config;
-
- mini_config = E_MINI_CALENDAR_CONFIG (object);
-
- switch (property_id) {
- case PROP_CALENDAR:
- g_value_set_object (value, e_mini_calendar_config_get_calendar (mini_config));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- break;
- }
-}
-
-static void
-e_mini_calendar_config_dispose (GObject *object)
-{
- EMiniCalendarConfig *mini_config = E_MINI_CALENDAR_CONFIG (object);
-
- e_mini_calendar_config_set_calendar (mini_config, NULL);
-
- if (G_OBJECT_CLASS (e_mini_calendar_config_parent_class)->dispose)
- G_OBJECT_CLASS (e_mini_calendar_config_parent_class)->dispose (object);
-}
-
-static void
-e_mini_calendar_config_finalize (GObject *object)
-{
- EMiniCalendarConfig *mini_config = E_MINI_CALENDAR_CONFIG (object);
- EMiniCalendarConfigPrivate *priv;
-
- priv = mini_config->priv;
-
- g_free (priv);
-
- if (G_OBJECT_CLASS (e_mini_calendar_config_parent_class)->finalize)
- G_OBJECT_CLASS (e_mini_calendar_config_parent_class)->finalize (object);
-}
-
-static void
-e_mini_calendar_config_class_init (EMiniCalendarConfigClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GParamSpec *spec;
-
- /* Method override */
- gobject_class->set_property = e_mini_calendar_config_set_property;
- gobject_class->get_property = e_mini_calendar_config_get_property;
- gobject_class->dispose = e_mini_calendar_config_dispose;
- gobject_class->finalize = e_mini_calendar_config_finalize;
-
- spec = g_param_spec_object ("calendar", NULL, NULL, e_calendar_get_type (),
- G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
- g_object_class_install_property (gobject_class, PROP_CALENDAR, spec);
-}
-
-static void
-e_mini_calendar_config_init (EMiniCalendarConfig *mini_config)
-{
- mini_config->priv = g_new0 (EMiniCalendarConfigPrivate, 1);
-
-}
-
-EMiniCalendarConfig *
-e_mini_calendar_config_new (ECalendar *mini_cal)
-{
- EMiniCalendarConfig *mini_config;
-
- mini_config = g_object_new (e_mini_calendar_config_get_type (), "calendar", mini_cal, NULL);
-
- return mini_config;
-}
-
-ECalendar *
-e_mini_calendar_config_get_calendar (EMiniCalendarConfig *mini_config)
-{
- EMiniCalendarConfigPrivate *priv;
-
- g_return_val_if_fail (mini_config != NULL, NULL);
- g_return_val_if_fail (E_IS_MINI_CALENDAR_CONFIG (mini_config), NULL);
-
- priv = mini_config->priv;
-
- return priv->mini_cal;
-}
-
-static void
-set_week_start (ECalendar *mini_cal)
-{
- gint week_start_day;
-
- week_start_day = calendar_config_get_week_start_day ();
-
- /* Convert it to 0 (Mon) to 6 (Sun), which is what we use. */
- week_start_day = (week_start_day + 6) % 7;
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (mini_cal->calitem),
- "week_start_day", week_start_day,
- NULL);
-}
-
-static void
-week_start_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- EMiniCalendarConfig *mini_config = data;
- EMiniCalendarConfigPrivate *priv;
-
- priv = mini_config->priv;
-
- set_week_start (priv->mini_cal);
-}
-
-static void
-set_dnav_show_week_no (ECalendar *mini_cal)
-{
- gboolean show_week_no;
-
- show_week_no = calendar_config_get_dnav_show_week_no ();
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (mini_cal->calitem),
- "show_week_numbers", show_week_no,
- NULL);
-}
-
-static void
-dnav_show_week_no_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- EMiniCalendarConfig *mini_config = data;
- EMiniCalendarConfigPrivate *priv;
-
- priv = mini_config->priv;
-
- set_dnav_show_week_no (priv->mini_cal);
-}
-
-void
-e_mini_calendar_config_set_calendar (EMiniCalendarConfig *mini_config, ECalendar *mini_cal)
-{
- EMiniCalendarConfigPrivate *priv;
- guint not;
- GList *l;
-
- g_return_if_fail (mini_config != NULL);
- g_return_if_fail (E_IS_MINI_CALENDAR_CONFIG (mini_config));
-
- priv = mini_config->priv;
-
- if (priv->mini_cal) {
- g_object_unref (priv->mini_cal);
- priv->mini_cal = NULL;
- }
-
- for (l = priv->notifications; l; l = l->next)
- calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
-
- g_list_free (priv->notifications);
- priv->notifications = NULL;
-
- /* If the new view is NULL, return right now */
- if (!mini_cal)
- return;
-
- priv->mini_cal = g_object_ref (mini_cal);
-
- /* Week start */
- set_week_start (mini_cal);
-
- not = calendar_config_add_notification_week_start_day (week_start_changed_cb, mini_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- /* Show week numbers */
- set_dnav_show_week_no (mini_cal);
-
- not = calendar_config_add_notification_dnav_show_week_no (dnav_show_week_no_changed_cb, mini_config);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-}
diff --git a/calendar/gui/e-mini-calendar-config.h b/calendar/gui/e-mini-calendar-config.h
deleted file mode 100644
index 60c88a1b9c..0000000000
--- a/calendar/gui/e-mini-calendar-config.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * JP Rosevear <jpr@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_MINI_CALENDAR_CONFIG_H_
-#define _E_MINI_CALENDAR_CONFIG_H_
-
-#include <misc/e-calendar.h>
-
-G_BEGIN_DECLS
-
-#define E_MINI_CALENDAR_CONFIG(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_mini_calendar_config_get_type (), EMiniCalendarConfig)
-#define E_MINI_CALENDAR_CONFIG_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_mini_calendar_config_get_type (), EMiniCalendarConfigClass)
-#define E_IS_MINI_CALENDAR_CONFIG(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_mini_calendar_config_get_type ())
-
-typedef struct _EMiniCalendarConfig EMiniCalendarConfig;
-typedef struct _EMiniCalendarConfigClass EMiniCalendarConfigClass;
-typedef struct _EMiniCalendarConfigPrivate EMiniCalendarConfigPrivate;
-
-struct _EMiniCalendarConfig {
- GObject parent;
-
- EMiniCalendarConfigPrivate *priv;
-};
-
-struct _EMiniCalendarConfigClass {
- GObjectClass parent_class;
-};
-
-GType e_mini_calendar_config_get_type (void);
-EMiniCalendarConfig *e_mini_calendar_config_new (ECalendar *mini_cal);
-ECalendar *e_mini_calendar_config_get_calendar (EMiniCalendarConfig *mini_config);
-void e_mini_calendar_config_set_calendar (EMiniCalendarConfig *mini_config, ECalendar *mini_cal);
-
-G_END_DECLS
-
-#endif
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 397bb025ca..5d08ee84de 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -830,8 +830,9 @@ e_week_view_new (ECalModel *model)
{
ECalendarView *week_view;
- week_view = g_object_new (E_TYPE_WEEK_VIEW, NULL);
- e_calendar_view_set_model (week_view, model);
+ g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
+
+ week_view = g_object_new (E_TYPE_WEEK_VIEW, "model", model, NULL);
init_model (E_WEEK_VIEW (week_view), model);
return week_view;
diff --git a/calendar/gui/ea-gnome-calendar.c b/calendar/gui/ea-gnome-calendar.c
index 73dae8f891..52798c99f0 100644
--- a/calendar/gui/ea-gnome-calendar.c
+++ b/calendar/gui/ea-gnome-calendar.c
@@ -261,6 +261,7 @@ ea_gnome_calendar_ref_child (AtkObject *obj, gint i)
GnomeCalendar * calendarWidget;
GnomeCalendarViewType view_type;
ECalendarView *view;
+ ECalendar *date_navigator;
GtkWidget *childWidget;
g_return_val_if_fail (EA_IS_GNOME_CALENDAR (obj), NULL);
@@ -283,7 +284,8 @@ ea_gnome_calendar_ref_child (AtkObject *obj, gint i)
break;
case 1:
/* for calendar */
- childWidget = gnome_calendar_get_e_calendar_widget (calendarWidget);
+ date_navigator = gnome_calendar_get_date_navigator (calendarWidget);
+ childWidget = GTK_WIDGET (date_navigator);
child = gtk_widget_get_accessible (childWidget);
break;
default:
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 6befd21388..f47d9053a8 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -45,9 +45,11 @@
#include <widgets/menus/gal-view-factory-etable.h>
#include <widgets/menus/gal-view-etable.h>
#include <widgets/menus/gal-define-views-dialog.h>
+#include "e-util/e-binding.h"
#include "e-util/e-util.h"
#include "e-util/e-error.h"
#include "e-util/e-util-private.h"
+#include "shell/e-shell.h"
#include "e-comp-editor-registry.h"
#include "dialogs/delete-error.h"
#include "dialogs/event-editor.h"
@@ -58,8 +60,6 @@
#include "e-month-view.h"
#include "e-week-view.h"
#include "e-cal-list-view.h"
-#include "e-mini-calendar-config.h"
-#include "e-calendar-table-config.h"
#include "gnome-cal.h"
#include "calendar-config.h"
#include "calendar-view.h"
@@ -78,8 +78,9 @@ static GHashTable *non_intrusive_error_table = NULL;
/* Private part of the GnomeCalendar structure */
struct _GnomeCalendarPrivate {
- /* The clients for display */
+ EShellSettings *shell_settings;
+ /* The clients for display */
GHashTable *clients;
GList *clients_list;
ECal *default_client;
@@ -96,7 +97,6 @@ struct _GnomeCalendarPrivate {
GtkWidget *hpane;
ECalendar *date_navigator;
- EMiniCalendarConfig *date_navigator_config;
/* plugin menu managers */
ECalMenu *calendar_menu;
@@ -128,7 +128,7 @@ struct _GnomeCalendarPrivate {
guint day_selected_id;
/* Our current week start */
- gint week_start;
+ gint week_start_day;
/* Our current timezone. */
icaltimezone *zone;
@@ -152,7 +152,12 @@ struct _GnomeCalendarPrivate {
GMutex *todo_update_lock;
};
-/* Signal IDs */
+enum {
+ PROP_0,
+ PROP_DATE_NAVIGATOR,
+ PROP_SHELL_SETTINGS,
+ PROP_WEEK_START_DAY
+};
enum {
DATES_SHOWN_CHANGED,
@@ -164,9 +169,7 @@ enum {
LAST_SIGNAL
};
-static guint gnome_calendar_signals[LAST_SIGNAL];
-
-
+static guint signals[LAST_SIGNAL];
static void gnome_calendar_destroy (GtkObject *object);
static void gnome_calendar_goto_date (GnomeCalendar *gcal,
@@ -177,7 +180,6 @@ static void gnome_calendar_change_view (GnomeCalendar *gcal,
static void update_view_times (GnomeCalendar *gcal, time_t start_time);
static void gnome_calendar_update_date_navigator (GnomeCalendar *gcal);
-static void gnome_calendar_hpane_realized (GtkWidget *w, GnomeCalendar *gcal);
static void gnome_calendar_date_navigator_scrolled (GtkWidget *widget, GdkEventScroll *event, gpointer user_data);
static gboolean gnome_calendar_hpane_resized (GtkWidget *w, GdkEventButton *e, GnomeCalendar *gcal);
@@ -229,16 +231,334 @@ message_push (Message *msg)
G_DEFINE_TYPE (GnomeCalendar, gnome_calendar, GTK_TYPE_VBOX)
+static void
+update_adjustment (GnomeCalendar *gcal,
+ GtkAdjustment *adjustment,
+ EWeekView *week_view)
+{
+ GDate date;
+ gint week_offset;
+ struct icaltimetype start_tt = icaltime_null_time ();
+ time_t lower;
+ guint32 old_first_day_julian, new_first_day_julian;
+
+ /* If we don't have a valid date set yet, just return. */
+ if (!g_date_valid (&week_view->first_day_shown))
+ return;
+
+ /* Determine the first date shown. */
+ date = week_view->base_date;
+ week_offset = floor (adjustment->value + 0.5);
+ g_date_add_days (&date, week_offset * 7);
+
+ /* Convert the old & new first days shown to julian values. */
+ old_first_day_julian = g_date_get_julian (&week_view->first_day_shown);
+ new_first_day_julian = g_date_get_julian (&date);
+
+ /* If we are already showing the date, just return. */
+ if (old_first_day_julian == new_first_day_julian)
+ return;
+
+ /* Convert it to a time_t. */
+ start_tt.year = g_date_get_year (&date);
+ start_tt.month = g_date_get_month (&date);
+ start_tt.day = g_date_get_day (&date);
+
+ lower = icaltime_as_timet_with_zone (start_tt, gcal->priv->zone);
+
+ e_week_view_set_update_base_date (week_view, FALSE);
+ gnome_calendar_set_selected_time_range (gcal, lower);
+ e_week_view_set_update_base_date (week_view, TRUE);
+}
+
+static void
+week_view_adjustment_changed_cb (GtkAdjustment *adjustment,
+ GnomeCalendar *gcal)
+{
+ ECalendarView *view;
+
+ view = gnome_calendar_get_calendar_view (gcal, GNOME_CAL_WEEK_VIEW);
+ update_adjustment (gcal, adjustment, E_WEEK_VIEW (view));
+}
+
+static void
+month_view_adjustment_changed_cb (GtkAdjustment *adjustment,
+ GnomeCalendar *gcal)
+{
+ ECalendarView *view;
+
+ view = gnome_calendar_get_calendar_view (gcal, GNOME_CAL_MONTH_VIEW);
+ update_adjustment (gcal, adjustment, E_WEEK_VIEW (view));
+}
+
+static void
+view_selection_changed_cb (GnomeCalendar *gcal)
+{
+ g_signal_emit (gcal, signals[CALENDAR_SELECTION_CHANGED], 0);
+}
+
+static void
+view_progress_cb (ECalModel *model,
+ const gchar *message,
+ gint percent,
+ ECalSourceType type,
+ GnomeCalendar *gcal)
+{
+#if 0 /* KILL-BONOBO */
+ ECalendarView *view;
+
+ view = gnome_calendar_get_calendar_view (gcal, GNOME_CAL_WEEK_VIEW);
+ e_calendar_view_set_status_message (view, message, percent);
+#endif
+}
+
+static void
+view_done_cb (ECalModel *model,
+ ECalendarStatus status,
+ ECalSourceType type,
+ GnomeCalendar *gcal)
+{
+#if 0 /* KILL-BONOBO */
+ ECalendarView *view;
+
+ view = gnome_calendar_get_calendar_view (gcal, GNOME_CAL_WEEK_VIEW);
+ e_calendar_view_set_status_message (view, NULL, -1);
+#endif
+}
+
+static void
+gnome_calendar_set_shell_settings (GnomeCalendar *gcal,
+ EShellSettings *shell_settings)
+{
+ g_return_if_fail (E_IS_SHELL_SETTINGS (shell_settings));
+ g_return_if_fail (gcal->priv->shell_settings == NULL);
+
+ gcal->priv->shell_settings = g_object_ref (shell_settings);
+}
+
+static void
+gnome_calendar_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_DATE_NAVIGATOR:
+ gnome_calendar_set_date_navigator (
+ GNOME_CALENDAR (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_SHELL_SETTINGS:
+ gnome_calendar_set_shell_settings (
+ GNOME_CALENDAR (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_WEEK_START_DAY:
+ gnome_calendar_set_week_start_day (
+ GNOME_CALENDAR (object),
+ g_value_get_int (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+gnome_calendar_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_DATE_NAVIGATOR:
+ g_value_set_object (
+ value, gnome_calendar_get_date_navigator (
+ GNOME_CALENDAR (object)));
+ return;
+
+ case PROP_SHELL_SETTINGS:
+ g_value_set_object (
+ value, gnome_calendar_get_shell_settings (
+ GNOME_CALENDAR (object)));
+ return;
+
+ case PROP_WEEK_START_DAY:
+ g_value_set_int (
+ value, gnome_calendar_get_week_start_day (
+ GNOME_CALENDAR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+gnome_calendar_constructed (GObject *object)
+{
+ GnomeCalendar *gcal = GNOME_CALENDAR (object);
+ EShellSettings *shell_settings;
+ ECalendarView *calendar_view;
+ ECalModel *model;
+ GtkAdjustment *adjustment;
+
+ shell_settings = gnome_calendar_get_shell_settings (gcal);
+
+ /* Create the model for the views. */
+ model = e_cal_model_calendar_new (shell_settings);
+ e_cal_model_set_flags (model, E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES);
+
+ g_signal_connect (
+ model, "cal-view-progress",
+ G_CALLBACK (view_progress_cb), gcal);
+
+ g_signal_connect (
+ model, "cal-view-done",
+ G_CALLBACK (view_done_cb), gcal);
+
+ /* Day View */
+ calendar_view = e_day_view_new (model);
+ e_calendar_view_set_calendar (calendar_view, gcal);
+ e_calendar_view_set_timezone (calendar_view, gcal->priv->zone);
+ gcal->priv->views[GNOME_CAL_DAY_VIEW] = calendar_view;
+
+ e_binding_new (
+ G_OBJECT (gcal), "week-start-day",
+ G_OBJECT (calendar_view), "week-start-day");
+
+ g_signal_connect_swapped (
+ calendar_view, "selection-changed",
+ G_CALLBACK (view_selection_changed_cb), gcal);
+
+ /* Work Week View */
+ calendar_view = e_day_view_new (model);
+ e_day_view_set_work_week_view (E_DAY_VIEW (calendar_view), TRUE);
+ e_day_view_set_days_shown (E_DAY_VIEW (calendar_view), 5);
+ e_calendar_view_set_calendar (calendar_view, gcal);
+ e_calendar_view_set_timezone (calendar_view, gcal->priv->zone);
+ gcal->priv->views[GNOME_CAL_WORK_WEEK_VIEW] = calendar_view;
+
+ e_binding_new (
+ G_OBJECT (gcal), "week-start-day",
+ G_OBJECT (calendar_view), "week-start-day");
+
+ /* Week View */
+ calendar_view = e_week_view_new (model);
+ e_calendar_view_set_calendar (calendar_view, gcal);
+ e_calendar_view_set_timezone (calendar_view, gcal->priv->zone);
+ gcal->priv->views[GNOME_CAL_WEEK_VIEW] = calendar_view;
+
+ e_binding_new (
+ G_OBJECT (gcal), "week-start-day",
+ G_OBJECT (calendar_view), "week-start-day");
+
+ g_signal_connect_swapped (
+ calendar_view, "selection-changed",
+ G_CALLBACK (view_selection_changed_cb), gcal);
+
+ adjustment = gtk_range_get_adjustment (
+ GTK_RANGE (E_WEEK_VIEW (calendar_view)->vscrollbar));
+ g_signal_connect (
+ adjustment, "value-changed",
+ G_CALLBACK (week_view_adjustment_changed_cb), gcal);
+
+ /* Month View */
+ calendar_view = e_month_view_new (model);
+ e_week_view_set_multi_week_view (E_WEEK_VIEW (calendar_view), TRUE);
+ e_week_view_set_weeks_shown (E_WEEK_VIEW (calendar_view), 6);
+ e_calendar_view_set_calendar (calendar_view, gcal);
+ e_calendar_view_set_timezone (calendar_view, gcal->priv->zone);
+ gcal->priv->views[GNOME_CAL_MONTH_VIEW] = calendar_view;
+
+ e_binding_new (
+ G_OBJECT (gcal), "week-start-day",
+ G_OBJECT (calendar_view), "week-start-day");
+
+ g_signal_connect_swapped (
+ calendar_view, "selection-changed",
+ G_CALLBACK (view_selection_changed_cb), gcal);
+
+ adjustment = gtk_range_get_adjustment (
+ GTK_RANGE (E_WEEK_VIEW (calendar_view)->vscrollbar));
+ g_signal_connect (
+ adjustment, "value-changed",
+ G_CALLBACK (month_view_adjustment_changed_cb), gcal);
+
+ /* List View */
+ calendar_view = e_cal_list_view_new (model);
+ e_calendar_view_set_calendar (calendar_view, gcal);
+ e_calendar_view_set_timezone (calendar_view, gcal->priv->zone);
+ gcal->priv->views[GNOME_CAL_LIST_VIEW] = calendar_view;
+
+ g_signal_connect_swapped (
+ calendar_view, "selection-changed",
+ G_CALLBACK (view_selection_changed_cb), gcal);
+
+ /* Bind to EShellSettings -after- the views are set up. */
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ G_OBJECT (gcal), "week-start-day");
+}
+
/* Class initialization function for the gnome calendar */
static void
gnome_calendar_class_init (GnomeCalendarClass *class)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
+ GtkObjectClass *gtk_object_class;
GtkBindingSet *binding_set;
- object_class = (GtkObjectClass *) class;
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = gnome_calendar_set_property;
+ object_class->get_property = gnome_calendar_get_property;
+ object_class->constructed = gnome_calendar_constructed;
+
+ gtk_object_class = GTK_OBJECT_CLASS (class);
+ gtk_object_class->destroy = gnome_calendar_destroy;
+
+ class->dates_shown_changed = NULL;
+ class->calendar_selection_changed = NULL;
+ class->source_added = NULL;
+ class->source_removed = NULL;
+ class->goto_date = gnome_calendar_goto_date;
+ class->change_view = gnome_calendar_change_view;
- gnome_calendar_signals[DATES_SHOWN_CHANGED] =
+ g_object_class_install_property (
+ object_class,
+ PROP_DATE_NAVIGATOR,
+ g_param_spec_object (
+ "date-navigator",
+ "Date Navigator",
+ NULL,
+ E_TYPE_CALENDAR,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHELL_SETTINGS,
+ g_param_spec_object (
+ "shell-settings",
+ _("Shell Settings"),
+ _("Application-wide settings"),
+ E_TYPE_SHELL_SETTINGS,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_WEEK_START_DAY,
+ g_param_spec_int (
+ "week-start-day",
+ "Week Start Day",
+ NULL,
+ 0, /* Monday */
+ 6, /* Sunday */
+ 0,
+ G_PARAM_READWRITE));
+
+ signals[DATES_SHOWN_CHANGED] =
g_signal_new ("dates_shown_changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -247,7 +567,7 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- gnome_calendar_signals[CALENDAR_SELECTION_CHANGED] =
+ signals[CALENDAR_SELECTION_CHANGED] =
g_signal_new ("calendar_selection_changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
@@ -256,7 +576,7 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- gnome_calendar_signals[SOURCE_ADDED] =
+ signals[SOURCE_ADDED] =
g_signal_new ("source_added",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
@@ -267,7 +587,7 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
2,
G_TYPE_INT, G_TYPE_OBJECT);
- gnome_calendar_signals[SOURCE_REMOVED] =
+ signals[SOURCE_REMOVED] =
g_signal_new ("source_removed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
@@ -278,7 +598,7 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
2,
G_TYPE_INT, G_TYPE_OBJECT);
- gnome_calendar_signals[GOTO_DATE] =
+ signals[GOTO_DATE] =
g_signal_new ("goto_date",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
@@ -289,7 +609,7 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
1,
G_TYPE_INT);
- gnome_calendar_signals[CHANGE_VIEW] =
+ signals[CHANGE_VIEW] =
g_signal_new ("change_view",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
@@ -300,15 +620,6 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
1,
G_TYPE_INT);
- object_class->destroy = gnome_calendar_destroy;
-
- class->dates_shown_changed = NULL;
- class->calendar_selection_changed = NULL;
- class->source_added = NULL;
- class->source_removed = NULL;
- class->goto_date = gnome_calendar_goto_date;
- class->change_view = gnome_calendar_change_view;
-
/*
* Key bindings
*/
@@ -858,37 +1169,6 @@ get_current_time (ECalendarItem *calitem, gpointer data)
}
static void
-view_selection_changed_cb (GtkWidget *view, GnomeCalendar *gcal)
-{
- g_signal_emit (gcal, gnome_calendar_signals[CALENDAR_SELECTION_CHANGED], 0);
-}
-
-static void
-set_week_start (GnomeCalendar *calendar)
-{
- time_t start_time;
- gint ii;
-
- calendar->priv->week_start = calendar_config_get_week_start_day ();
-
- /* Only do this if views exist */
- for (ii = 0; ii < GNOME_CAL_LAST_VIEW; ii++)
- if (gnome_calendar_get_calendar_view (calendar, ii) == NULL)
- return;
-
- start_time = calendar->priv->base_view_time;
- gnome_calendar_set_selected_time_range (calendar, start_time);
-}
-
-static void
-week_start_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- GnomeCalendar *calendar = data;
-
- set_week_start (calendar);
-}
-
-static void
set_working_days (GnomeCalendar *calendar)
{
time_t start_time;
@@ -928,17 +1208,6 @@ set_timezone (GnomeCalendar *calendar)
/* FIXME Error checking */
e_cal_set_default_timezone (client, priv->zone, NULL);
}
-
- if (priv->views [priv->current_view_type])
- e_calendar_view_set_timezone (priv->views [priv->current_view_type], priv->zone);
-}
-
-static void
-timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- GnomeCalendar *calendar = data;
-
- set_timezone (calendar);
}
struct _mupdate_todo_msg {
@@ -1045,7 +1314,6 @@ process_completed_tasks (GnomeCalendar *gcal, gboolean config_changed)
#if 0 /* KILL-BONOBO */
GnomeCalendarPrivate *priv;
- g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR(gcal));
priv = gcal->priv;
@@ -1105,12 +1373,6 @@ update_marcus_bains_line_cb (GnomeCalendar *gcal)
}
static void
-config_hide_completed_tasks_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- process_completed_tasks (data, TRUE);
-}
-
-static void
setup_config (GnomeCalendar *calendar)
{
GnomeCalendarPrivate *priv;
@@ -1118,124 +1380,17 @@ setup_config (GnomeCalendar *calendar)
priv = calendar->priv;
- /* Week Start */
- set_week_start (calendar);
- not = calendar_config_add_notification_week_start_day (week_start_changed_cb, calendar);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
/* Working Days */
set_working_days (calendar);
not = calendar_config_add_notification_working_days (working_days_changed_cb, calendar);
priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
- /* Timezone */
- set_timezone (calendar);
- not = calendar_config_add_notification_timezone (timezone_changed_cb, calendar);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- /* Hide completed tasks */
- not = calendar_config_add_notification_hide_completed_tasks (config_hide_completed_tasks_changed_cb,
- calendar);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- not = calendar_config_add_notification_hide_completed_tasks_units (config_hide_completed_tasks_changed_cb,
- calendar);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- not = calendar_config_add_notification_hide_completed_tasks_value (config_hide_completed_tasks_changed_cb,
- calendar);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
/* Pane positions */
priv->hpane_pos = calendar_config_get_hpane_pos ();
priv->hpane_pos_month_view = calendar_config_get_month_hpane_pos ();
}
static void
-update_adjustment (GnomeCalendar *gcal, GtkAdjustment *adjustment, EWeekView *week_view)
-{
- GDate date;
- gint week_offset;
- struct icaltimetype start_tt = icaltime_null_time ();
- time_t lower;
- guint32 old_first_day_julian, new_first_day_julian;
-
- /* If we don't have a valid date set yet, just return. */
- if (!g_date_valid (&week_view->first_day_shown))
- return;
-
- /* Determine the first date shown. */
- date = week_view->base_date;
- week_offset = floor (adjustment->value + 0.5);
- g_date_add_days (&date, week_offset * 7);
-
- /* Convert the old & new first days shown to julian values. */
- old_first_day_julian = g_date_get_julian (&week_view->first_day_shown);
- new_first_day_julian = g_date_get_julian (&date);
-
- /* If we are already showing the date, just return. */
- if (old_first_day_julian == new_first_day_julian)
- return;
-
- /* Convert it to a time_t. */
- start_tt.year = g_date_get_year (&date);
- start_tt.month = g_date_get_month (&date);
- start_tt.day = g_date_get_day (&date);
-
- lower = icaltime_as_timet_with_zone (start_tt, gcal->priv->zone);
-
- e_week_view_set_update_base_date (week_view, FALSE);
- gnome_calendar_set_selected_time_range (gcal, lower);
- e_week_view_set_update_base_date (week_view, TRUE);
-}
-
-static void
-week_view_adjustment_changed_cb (GtkAdjustment *adjustment, GnomeCalendar *gcal)
-{
- ECalendarView *view;
-
- view = gnome_calendar_get_calendar_view (gcal, GNOME_CAL_WEEK_VIEW);
- update_adjustment (gcal, adjustment, E_WEEK_VIEW (view));
-}
-
-static void
-month_view_adjustment_changed_cb (GtkAdjustment *adjustment, GnomeCalendar *gcal)
-{
- ECalendarView *view;
-
- view = gnome_calendar_get_calendar_view (gcal, GNOME_CAL_MONTH_VIEW);
- update_adjustment (gcal, adjustment, E_WEEK_VIEW (view));
-}
-
-static void
-view_progress_cb (ECalModel *model, const gchar *message, gint percent, ECalSourceType type, GnomeCalendar *gcal)
-{
-#if 0 /* KILL-BONOBO */
- ECalendarView *view;
-
- view = gnome_calendar_get_calendar_view (gcal, GNOME_CAL_WEEK_VIEW);
- e_calendar_view_set_status_message (view, message, percent);
-#endif
-}
-
-static void
-view_done_cb (ECalModel *model, ECalendarStatus status, ECalSourceType type, GnomeCalendar *gcal)
-{
-#if 0 /* KILL-BONOBO */
- ECalendarView *view;
-
- view = gnome_calendar_get_calendar_view (gcal, GNOME_CAL_WEEK_VIEW);
- e_calendar_view_set_status_message (view, NULL, -1);
-#endif
-}
-
-GtkWidget *
-gnome_calendar_get_tag (GnomeCalendar *gcal)
-{
- return GTK_WIDGET (gcal->priv->date_navigator);
-}
-
-static void
setup_widgets (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
@@ -1243,59 +1398,14 @@ setup_widgets (GnomeCalendar *gcal)
gchar *filename;
ETable *etable;
GtkAdjustment *adjustment;
- ECalModel *w_model;
GtkWidget *vbox;
GtkWidget *label;
- ECalendarView *calendar_view;
ECalModel *cal_model;
gint i;
gchar *tmp;
priv = gcal->priv;
- /* The main HPaned, with the notebook of calendar views on the left
- and the ECalendar and ToDo list on the right. */
- priv->hpane = gtk_hpaned_new ();
- g_signal_connect_after(priv->hpane, "realize",
- G_CALLBACK(gnome_calendar_hpane_realized), gcal);
- g_signal_connect (priv->hpane, "button_release_event",
- G_CALLBACK (gnome_calendar_hpane_resized), gcal);
- gtk_widget_show (priv->hpane);
- gtk_box_pack_start (GTK_BOX (gcal), priv->hpane, TRUE, TRUE, 6);
-
- /* The ECalendar. */
- w = e_calendar_new ();
- priv->date_navigator = E_CALENDAR (w);
- priv->date_navigator_config = e_mini_calendar_config_new (priv->date_navigator);
- e_calendar_item_set_days_start_week_sel (priv->date_navigator->calitem, 9);
- e_calendar_item_set_max_days_sel (priv->date_navigator->calitem, 42);
- gtk_widget_show (w);
- e_calendar_item_set_get_time_callback (priv->date_navigator->calitem,
- (ECalendarItemGetTimeCallback) get_current_time,
- gcal, NULL);
-
- g_signal_connect (priv->date_navigator->calitem, "selection_changed",
- G_CALLBACK (gnome_calendar_on_date_navigator_selection_changed), gcal);
- g_signal_connect (priv->date_navigator->calitem, "date_range_changed",
- G_CALLBACK (gnome_calendar_on_date_navigator_date_range_changed), gcal);
- g_signal_connect (w, "scroll-event",
- G_CALLBACK (gnome_calendar_date_navigator_scrolled), gcal);
-
- /* The ToDo list. */
- vbox = gtk_vbox_new (FALSE, 0);
- sep = gtk_hseparator_new ();
- gtk_box_pack_start ((GtkBox *)vbox, sep, FALSE, TRUE, 0);
-
- label = gtk_label_new (NULL);
- tmp = g_strdup_printf ("<b> %s </b>", _("Tasks"));
- gtk_label_set_markup ((GtkLabel *)label, tmp);
- g_free (tmp);
- gtk_box_pack_start ((GtkBox *)vbox, label, FALSE, TRUE, 0);
-
- gtk_widget_show (label);
- gtk_widget_show (vbox);
- gtk_widget_show (sep);
-
/* update_todo_view (gcal); */
/* Timeout check to hide completed items */
@@ -1303,81 +1413,9 @@ setup_widgets (GnomeCalendar *gcal)
priv->update_timeout = g_timeout_add_full (G_PRIORITY_LOW, 60000, (GSourceFunc) update_todo_view_cb, gcal, NULL);
#endif
- /* Create the model for the views */
- cal_model = (ECalModel *) e_cal_model_calendar_new ();
- e_cal_model_set_flags (cal_model, E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES);
-
- /* The Day View. */
- calendar_view = e_day_view_new (cal_model);
- e_calendar_view_set_calendar (calendar_view, gcal);
- e_calendar_view_set_timezone (calendar_view, priv->zone);
- priv->views[GNOME_CAL_DAY_VIEW] = calendar_view;
-
- g_signal_connect (
- calendar_view, "selection-changed",
- G_CALLBACK (view_selection_changed_cb), gcal);
-
- /* The Work Week View. */
- calendar_view = e_day_view_new (cal_model);
- e_day_view_set_work_week_view (E_DAY_VIEW (calendar_view), TRUE);
- e_day_view_set_days_shown (E_DAY_VIEW (calendar_view), 5);
- e_calendar_view_set_calendar (calendar_view, gcal);
- e_calendar_view_set_timezone (calendar_view, priv->zone);
- priv->views[GNOME_CAL_WORK_WEEK_VIEW] = calendar_view;
-
/* The Marcus Bains line */
priv->update_marcus_bains_line_timeout = g_timeout_add_full (G_PRIORITY_LOW, 60000, (GSourceFunc) update_marcus_bains_line_cb, gcal, NULL);
- /* The Week View. */
- calendar_view = e_week_view_new (cal_model);
- e_calendar_view_set_calendar (calendar_view, gcal);
- e_calendar_view_set_timezone (calendar_view, priv->zone);
- priv->views[GNOME_CAL_WEEK_VIEW] = calendar_view;
-
- g_signal_connect (
- calendar_view, "selection-changed",
- G_CALLBACK (view_selection_changed_cb), gcal);
-
- adjustment = gtk_range_get_adjustment (
- GTK_RANGE (E_WEEK_VIEW (calendar_view)->vscrollbar));
- g_signal_connect (
- adjustment, "value-changed",
- G_CALLBACK (week_view_adjustment_changed_cb), gcal);
- w_model = e_calendar_view_get_model (calendar_view);
- g_signal_connect (
- w_model, "cal-view-progress",
- G_CALLBACK (view_progress_cb), gcal);
- g_signal_connect (w_model, "cal-view-done",
- G_CALLBACK (view_done_cb), gcal);
-
- /* The Month View. */
- calendar_view = e_month_view_new (cal_model);
- e_calendar_view_set_calendar (calendar_view, gcal);
- e_calendar_view_set_timezone (calendar_view, priv->zone);
- e_week_view_set_multi_week_view (E_WEEK_VIEW (calendar_view), TRUE);
- e_week_view_set_weeks_shown (E_WEEK_VIEW (calendar_view), 6);
- priv->views[GNOME_CAL_MONTH_VIEW] = calendar_view;
-
- g_signal_connect (
- calendar_view, "selection-changed",
- G_CALLBACK (view_selection_changed_cb), gcal);
-
- adjustment = gtk_range_get_adjustment (
- GTK_RANGE (E_WEEK_VIEW (calendar_view)->vscrollbar));
- g_signal_connect (
- adjustment, "value-changed",
- G_CALLBACK (month_view_adjustment_changed_cb), gcal);
-
- /* The List View. */
- calendar_view = e_cal_list_view_new (cal_model);
- e_calendar_view_set_calendar (calendar_view, gcal);
- e_calendar_view_set_timezone (calendar_view, priv->zone);
- priv->views[GNOME_CAL_LIST_VIEW] = calendar_view;
-
- g_signal_connect (
- calendar_view, "selection-changed",
- G_CALLBACK (view_selection_changed_cb), gcal);
-
update_memo_view (gcal);
}
@@ -1438,6 +1476,11 @@ gnome_calendar_destroy (GtkObject *object)
GList *l;
gint i;
+ if (priv->shell_settings != NULL) {
+ g_object_unref (priv->shell_settings);
+ priv->shell_settings = NULL;
+ }
+
/* Clean up the clients */
for (l = priv->clients_list; l != NULL; l = l->next) {
g_signal_handlers_disconnect_matched (l->data, G_SIGNAL_MATCH_DATA,
@@ -1458,8 +1501,6 @@ gnome_calendar_destroy (GtkObject *object)
}
priv->default_client = NULL;
- g_object_unref (priv->date_navigator_config);
-
for (l = priv->notifications; l; l = l->next)
calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
g_list_free (priv->notifications);
@@ -1540,7 +1581,6 @@ gnome_calendar_goto_date (GnomeCalendar *gcal,
time_t new_time = 0;
gboolean need_updating = FALSE;
- g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR(gcal));
priv = gcal->priv;
@@ -1564,11 +1604,11 @@ gnome_calendar_goto_date (GnomeCalendar *gcal,
need_updating = TRUE;
break;
case GNOME_CAL_GOTO_FIRST_DAY_OF_WEEK:
- new_time = time_week_begin_with_zone (priv->base_view_time, priv->week_start, priv->zone);
+ new_time = time_week_begin_with_zone (priv->base_view_time, priv->week_start_day, priv->zone);
need_updating = TRUE;
break;
case GNOME_CAL_GOTO_LAST_DAY_OF_WEEK:
- new_time = time_week_begin_with_zone (priv->base_view_time, priv->week_start, priv->zone);
+ new_time = time_week_begin_with_zone (priv->base_view_time, priv->week_start_day, priv->zone);
if (priv->current_view_type == GNOME_CAL_DAY_VIEW ||
priv->current_view_type == GNOME_CAL_WORK_WEEK_VIEW) {
/* FIXME Shouldn't hard code work week end */
@@ -1605,7 +1645,6 @@ gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time)
GnomeCalendarPrivate *priv;
gint i;
- g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
g_return_if_fail (new_time != -1);
@@ -1673,7 +1712,6 @@ gnome_calendar_direction (GnomeCalendar *gcal, gint direction)
void
gnome_calendar_next (GnomeCalendar *gcal)
{
- g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
gnome_calendar_direction (gcal, 1);
@@ -1682,7 +1720,6 @@ gnome_calendar_next (GnomeCalendar *gcal)
void
gnome_calendar_previous (GnomeCalendar *gcal)
{
- g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
gnome_calendar_direction (gcal, -1);
@@ -1693,7 +1730,6 @@ gnome_calendar_dayjump (GnomeCalendar *gcal, time_t time)
{
GnomeCalendarPrivate *priv;
- g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
priv = gcal->priv;
@@ -2013,7 +2049,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
priv->clients_list = g_list_remove (priv->clients_list, ecal);
g_hash_table_remove (priv->clients, e_source_peek_uid (source));
- g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source);
+ g_signal_emit (gcal, signals[SOURCE_REMOVED], 0, source);
g_object_unref (source);
g_warning ("Unable to load the calendar %s \n", e_cal_get_error_message (status));
@@ -2080,7 +2116,7 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar
g_object_unref (priv->default_client);
priv->default_client = NULL;
- g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source);
+ g_signal_emit (gcal, signals[SOURCE_REMOVED], 0, source);
g_object_unref (source);
g_warning ("Unable to load the calendar %s \n", e_cal_get_error_message (status));
@@ -2175,7 +2211,7 @@ backend_died_cb (ECal *ecal, gpointer data)
/* e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1); KILL-BONOBO */
- g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source);
+ g_signal_emit (gcal, signals[SOURCE_REMOVED], 0, source);
g_object_unref (source);
@@ -2192,32 +2228,99 @@ backend_died_cb (ECal *ecal, gpointer data)
}
GtkWidget *
-gnome_calendar_construct (GnomeCalendar *gcal)
+gnome_calendar_new (EShellSettings *shell_settings)
{
- GnomeCalendarPrivate *priv;
+ g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL);
- g_return_val_if_fail (gcal != NULL, NULL);
+ return g_object_new (
+ GNOME_TYPE_CALENDAR,
+ "shell-settings", shell_settings, NULL);
+}
+
+EShellSettings *
+gnome_calendar_get_shell_settings (GnomeCalendar *gcal)
+{
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
- priv = gcal->priv;
+ return gcal->priv->shell_settings;
+}
- return GTK_WIDGET (gcal);
+ECalendar *
+gnome_calendar_get_date_navigator (GnomeCalendar *gcal)
+{
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
+
+ return gcal->priv->date_navigator;
}
-GtkWidget *
-gnome_calendar_new (void)
+void
+gnome_calendar_set_date_navigator (GnomeCalendar *gcal,
+ ECalendar *date_navigator)
{
- GnomeCalendar *gcal;
+ ECalendarItem *calitem;
- gcal = g_object_new (gnome_calendar_get_type (), NULL);
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- if (!gnome_calendar_construct (gcal)) {
- g_message (G_STRLOC ": Could not construct the calendar GUI");
- g_object_unref (gcal);
- return NULL;
+ if (date_navigator != NULL) {
+ g_return_if_fail (E_IS_CALENDAR (date_navigator));
+ g_object_ref (date_navigator);
}
- return GTK_WIDGET (gcal);
+ /* FIXME This ignores the possibility that a date navigator
+ * object already exists. But this function should
+ * only be called once anyway. */
+ if (gcal->priv->date_navigator != NULL)
+ g_object_unref (gcal->priv->date_navigator);
+
+ gcal->priv->date_navigator = date_navigator;
+ calitem = date_navigator->calitem;
+
+ e_calendar_item_set_get_time_callback (
+ calitem, (ECalendarItemGetTimeCallback)
+ get_current_time, gcal, NULL);
+
+ g_signal_connect (
+ calitem, "selection-changed",
+ G_CALLBACK (gnome_calendar_on_date_navigator_selection_changed),
+ gcal);
+
+ g_signal_connect (
+ calitem, "date-range-changed",
+ G_CALLBACK (gnome_calendar_on_date_navigator_date_range_changed),
+ gcal);
+
+ g_signal_connect (
+ date_navigator, "scroll-event",
+ G_CALLBACK (gnome_calendar_date_navigator_scrolled),
+ gcal);
+
+ g_object_notify (G_OBJECT (gcal), "date-navigator");
+}
+
+gint
+gnome_calendar_get_week_start_day (GnomeCalendar *gcal)
+{
+ g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), 0);
+
+ return gcal->priv->week_start_day;
+}
+
+void
+gnome_calendar_set_week_start_day (GnomeCalendar *gcal,
+ gint week_start_day)
+{
+ time_t start_time;
+
+ g_return_if_fail (GNOME_IS_CALENDAR (gcal));
+ g_return_if_fail (week_start_day >= 0);
+ g_return_if_fail (week_start_day < 7);
+
+ gcal->priv->week_start_day = week_start_day;
+
+ start_time = gcal->priv->base_view_time;
+ gnome_calendar_set_selected_time_range (gcal, start_time);
+
+ g_object_notify (G_OBJECT (gcal), "week-start-day");
}
/**
@@ -2233,7 +2336,6 @@ gnome_calendar_get_calendar_model (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
- g_return_val_if_fail (gcal != NULL, NULL);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
priv = gcal->priv;
@@ -2249,7 +2351,6 @@ gnome_calendar_get_default_client (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
- g_return_val_if_fail (gcal != NULL, NULL);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
priv = gcal->priv;
@@ -2272,7 +2373,6 @@ gnome_calendar_add_source (GnomeCalendar *gcal, ESource *source)
GnomeCalendarPrivate *priv;
ECal *client;
- g_return_val_if_fail (gcal != NULL, FALSE);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
@@ -2310,7 +2410,7 @@ gnome_calendar_add_source (GnomeCalendar *gcal, ESource *source)
g_hash_table_insert (priv->clients, g_strdup (e_source_peek_uid (source)), client);
priv->clients_list = g_list_prepend (priv->clients_list, client);
- g_signal_emit (gcal, gnome_calendar_signals[SOURCE_ADDED], 0, source);
+ g_signal_emit (gcal, signals[SOURCE_ADDED], 0, source);
open_ecal (gcal, client, FALSE, client_cal_opened_cb);
@@ -2332,13 +2432,12 @@ gnome_calendar_remove_source (GnomeCalendar *gcal, ESource *source)
{
gboolean result;
- g_return_val_if_fail (gcal != NULL, FALSE);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
result = gnome_calendar_remove_source_by_uid (gcal, e_source_peek_uid (source));
if (result)
- g_signal_emit (gcal, gnome_calendar_signals[SOURCE_REMOVED], 0, source);
+ g_signal_emit (gcal, signals[SOURCE_REMOVED], 0, source);
return result;
}
@@ -2351,7 +2450,6 @@ gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, const gchar *uid)
ECalModel *model;
GList *l;
- g_return_val_if_fail (gcal != NULL, FALSE);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
g_return_val_if_fail (uid != NULL, FALSE);
@@ -2407,7 +2505,6 @@ gnome_calendar_set_default_source (GnomeCalendar *gcal, ESource *source)
GnomeCalendarPrivate *priv;
ECal *client;
- g_return_val_if_fail (gcal != NULL, FALSE);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
@@ -2489,7 +2586,6 @@ gnome_calendar_new_task (GnomeCalendar *gcal, time_t *dtstart, time_t *dtend)
ECalComponentDateTime dt;
struct icaltimetype itt;
- g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
priv = gcal->priv;
@@ -2576,6 +2672,10 @@ gnome_calendar_update_date_navigator (GnomeCalendar *gcal)
priv = gcal->priv;
+ /* If the ECalendar is not yet set, we just return. */
+ if (priv->date_navigator == NULL)
+ return;
+
/* If the ECalendar isn't visible, we just return. */
if (!GTK_WIDGET_VISIBLE (priv->date_navigator))
return;
@@ -2590,7 +2690,7 @@ gnome_calendar_update_date_navigator (GnomeCalendar *gcal)
if (priv->current_view_type == GNOME_CAL_MONTH_VIEW) {
EWeekView *week_view = E_WEEK_VIEW (priv->views[priv->current_view_type]);
- if (priv->week_start == 0
+ if (priv->week_start_day == 0
&& (!week_view->multi_week_view || week_view->compress_weekend))
g_date_add_days (&start_date, 1);
}
@@ -2625,7 +2725,7 @@ gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, Gnom
if (priv->current_view_type == GNOME_CAL_MONTH_VIEW) {
EWeekView *week_view = E_WEEK_VIEW (priv->views[priv->current_view_type]);
- if (priv->week_start == 0 && (!week_view->multi_week_view || week_view->compress_weekend))
+ if (priv->week_start_day == 0 && (!week_view->multi_week_view || week_view->compress_weekend))
g_date_add_days (&start_date, 1);
}
time_to_gdate_with_zone (&end_date, end, priv->zone);
@@ -2645,7 +2745,7 @@ gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, Gnom
Note that if weekends are compressed and the week start day is set
to Sunday we don't actually show complete weeks in the Week view,
so this may need tweaking. */
- if (g_date_get_weekday (&new_start_date) % 7 == priv->week_start)
+ if (g_date_get_weekday (&new_start_date) % 7 == priv->week_start_day)
starts_on_week_start_day = TRUE;
/* Update selection to be in the new time range */
@@ -2697,20 +2797,6 @@ gnome_calendar_on_date_navigator_date_range_changed (ECalendarItem *calitem, Gno
}
static void
-gnome_calendar_hpane_realized (GtkWidget *w, GnomeCalendar *gcal)
-{
- GnomeCalendarPrivate *priv;
-
- priv = gcal->priv;
-
- if (priv->current_view_type == GNOME_CAL_MONTH_VIEW && !priv->range_selected) {
- gtk_paned_set_position (GTK_PANED (priv->hpane), priv->hpane_pos_month_view);
- } else {
- gtk_paned_set_position (GTK_PANED (priv->hpane), priv->hpane_pos);
- }
-}
-
-static void
gnome_calendar_date_navigator_scrolled (GtkWidget *widget, GdkEventScroll *event, gpointer user_data)
{
GnomeCalendar *gcal = user_data;
@@ -2810,7 +2896,6 @@ gnome_calendar_paste_clipboard (GnomeCalendar *gcal)
icaltimezone*
gnome_calendar_get_timezone (GnomeCalendar *gcal)
{
- g_return_val_if_fail (gcal != NULL, NULL);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
return gcal->priv->zone;
@@ -2839,7 +2924,7 @@ gnome_calendar_notify_dates_shown_changed (GnomeCalendar *gcal)
priv->visible_start = start_time;
priv->visible_end = end_time;
- g_signal_emit (gcal, gnome_calendar_signals[DATES_SHOWN_CHANGED], 0);
+ g_signal_emit (gcal, signals[DATES_SHOWN_CHANGED], 0);
}
update_memo_view (gcal);
}
@@ -2989,15 +3074,8 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than)
}
-GtkWidget *
-gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal)
-{
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
-
- return GTK_WIDGET(gcal->priv->date_navigator);
-}
-
-ECalMenu *gnome_calendar_get_calendar_menu (GnomeCalendar *gcal)
+ECalMenu *
+gnome_calendar_get_calendar_menu (GnomeCalendar *gcal)
{
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index f5e4534a75..9340633acb 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -29,10 +29,10 @@
#include <time.h>
#include <gtk/gtk.h>
-#include <bonobo/bonobo-ui-component.h>
#include <misc/e-calendar.h>
#include <libecal/e-cal.h>
#include <e-util/e-popup.h>
+#include <shell/e-shell-settings.h>
#include "e-cal-menu.h"
#include "e-calendar-table.h"
@@ -100,10 +100,20 @@ struct _GnomeCalendarClass {
void (* goto_date) (GnomeCalendar *gcal, GnomeCalendarGotoDateType date);
};
-GType gnome_calendar_get_type (void);
-GtkWidget *gnome_calendar_construct (GnomeCalendar *gcal);
-
-GtkWidget *gnome_calendar_new (void);
+GType gnome_calendar_get_type (void);
+GtkWidget * gnome_calendar_new (EShellSettings *shell_settings);
+EShellSettings *gnome_calendar_get_shell_settings
+ (GnomeCalendar *gcal);
+ECalendar * gnome_calendar_get_date_navigator
+ (GnomeCalendar *gcal);
+void gnome_calendar_set_date_navigator
+ (GnomeCalendar *gcal,
+ ECalendar *date_navigator);
+gint gnome_calendar_get_week_start_day
+ (GnomeCalendar *gcal);
+void gnome_calendar_set_week_start_day
+ (GnomeCalendar *gcal,
+ gint week_start_day);
ECalModel *gnome_calendar_get_calendar_model (GnomeCalendar *gcal);
ECal *gnome_calendar_get_default_client (GnomeCalendar *gcal);
@@ -133,9 +143,6 @@ void gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_ty
struct _ECalendarView *gnome_calendar_get_calendar_view (GnomeCalendar *gcal,
GnomeCalendarViewType view_type);
-GtkWidget *gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal);
-GtkWidget *gnome_calendar_get_tag (GnomeCalendar *gcal);
-
ECalMenu *gnome_calendar_get_calendar_menu (GnomeCalendar *gcal);
void gnome_calendar_set_selected_time_range (GnomeCalendar *gcal,
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
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
index 775ab3b8a3..07a9fc61c4 100644
--- a/widgets/misc/e-dateedit.c
+++ b/widgets/misc/e-dateedit.c
@@ -42,6 +42,10 @@
#include <e-util/e-util.h>
#include "e-calendar.h"
+#define E_DATE_EDIT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_DATE_EDIT, EDateEditPrivate))
+
struct _EDateEditPrivate {
GtkWidget *date_entry;
GtkWidget *date_button;
@@ -108,16 +112,18 @@ struct _EDateEditPrivate {
};
enum {
+ PROP_0,
+ PROP_SHOW_WEEK_NUMBERS,
+ PROP_USE_24_HOUR_FORMAT,
+ PROP_WEEK_START_DAY
+};
+
+enum {
CHANGED,
LAST_SIGNAL
};
-static gint date_edit_signals [LAST_SIGNAL] = { 0 };
-
-static void e_date_edit_class_init (EDateEditClass *class);
-static void e_date_edit_init (EDateEdit *dedit);
static void create_children (EDateEdit *dedit);
-static void e_date_edit_dispose (GObject *object);
static gboolean e_date_edit_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
static void e_date_edit_grab_focus (GtkWidget *widget);
@@ -188,87 +194,168 @@ static gboolean e_date_edit_set_time_internal (EDateEdit *dedit,
gint hour,
gint minute);
-static GtkHBoxClass *parent_class;
+static gpointer parent_class;
+static gint signals[LAST_SIGNAL];
-/**
- * e_date_edit_get_type:
- *
- * Returns the GType for the EDateEdit widget
- */
-GType
-e_date_edit_get_type (void)
-{
- static GType date_edit_type = 0;
+static void
+date_edit_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHOW_WEEK_NUMBERS:
+ e_date_edit_set_show_week_numbers (
+ E_DATE_EDIT (object),
+ g_value_get_boolean (value));
+ return;
- if (!date_edit_type) {
- static const GTypeInfo date_edit_info = {
- sizeof (EDateEditClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_date_edit_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EDateEdit),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_date_edit_init,
- };
+ case PROP_USE_24_HOUR_FORMAT:
+ e_date_edit_set_use_24_hour_format (
+ E_DATE_EDIT (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_WEEK_START_DAY:
+ e_date_edit_set_week_start_day (
+ E_DATE_EDIT (object),
+ g_value_get_int (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
- date_edit_type = g_type_register_static (GTK_TYPE_HBOX, "EDateEdit", &date_edit_info, 0);
+static void
+date_edit_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHOW_WEEK_NUMBERS:
+ g_value_set_boolean (
+ value, e_date_edit_get_show_week_numbers (
+ E_DATE_EDIT (object)));
+ return;
+
+ case PROP_USE_24_HOUR_FORMAT:
+ g_value_set_boolean (
+ value, e_date_edit_get_use_24_hour_format (
+ E_DATE_EDIT (object)));
+ return;
+
+ case PROP_WEEK_START_DAY:
+ g_value_set_int (
+ value, e_date_edit_get_week_start_day (
+ E_DATE_EDIT (object)));
+ return;
}
- return date_edit_type;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-e_date_edit_class_init (EDateEditClass *class)
+date_edit_dispose (GObject *object)
{
- GObjectClass *object_class = (GObjectClass *) class;
- GtkWidgetClass *widget_class = (GtkWidgetClass *) class;
+ EDateEdit *dedit;
- parent_class = g_type_class_ref (GTK_TYPE_HBOX);
+ dedit = E_DATE_EDIT (object);
- date_edit_signals [CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EDateEditClass, changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ e_date_edit_set_get_time_callback (dedit, NULL, NULL, NULL);
- object_class->dispose = e_date_edit_dispose;
+ if (dedit->priv->cal_popup != NULL) {
+ gtk_widget_destroy (dedit->priv->cal_popup);
+ dedit->priv->cal_popup = NULL;
+ }
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+date_edit_class_init (EDateEditClass *class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EDateEditPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = date_edit_set_property;
+ object_class->get_property = date_edit_get_property;
+ object_class->dispose = date_edit_dispose;
+
+ widget_class = GTK_WIDGET_CLASS (class);
widget_class->mnemonic_activate = e_date_edit_mnemonic_activate;
widget_class->grab_focus = e_date_edit_grab_focus;
- class->changed = NULL;
+ g_object_class_install_property (
+ object_class,
+ PROP_SHOW_WEEK_NUMBERS,
+ g_param_spec_boolean (
+ "show-week-numbers",
+ "Show Week Numbers",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_USE_24_HOUR_FORMAT,
+ g_param_spec_boolean (
+ "use-24-hour-format",
+ "Use 24-Hour Format",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_WEEK_START_DAY,
+ g_param_spec_int (
+ "week-start-day",
+ "Week Start Day",
+ NULL,
+ 0, /* Monday */
+ 6, /* Sunday */
+ 0,
+ G_PARAM_READWRITE));
+
+ signals[CHANGED] = g_signal_new (
+ "changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EDateEditClass, changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
static void
-e_date_edit_init (EDateEdit *dedit)
+date_edit_init (EDateEdit *dedit)
{
- EDateEditPrivate *priv;
+ dedit->priv = E_DATE_EDIT_GET_PRIVATE (dedit);
- dedit->priv = priv = g_new0 (EDateEditPrivate, 1);
+ dedit->priv->show_date = TRUE;
+ dedit->priv->show_time = TRUE;
+ dedit->priv->use_24_hour_format = TRUE;
- priv->show_date = TRUE;
- priv->show_time = TRUE;
- priv->use_24_hour_format = TRUE;
+ dedit->priv->make_time_insensitive = FALSE;
- priv->make_time_insensitive = FALSE;
+ dedit->priv->lower_hour = 0;
+ dedit->priv->upper_hour = 24;
- priv->lower_hour = 0;
- priv->upper_hour = 24;
+ dedit->priv->date_is_valid = TRUE;
+ dedit->priv->date_set_to_none = TRUE;
+ dedit->priv->time_is_valid = TRUE;
+ dedit->priv->time_set_to_none = TRUE;
+ dedit->priv->time_callback = NULL;
+ dedit->priv->time_callback_data = NULL;
+ dedit->priv->time_callback_destroy = NULL;
- priv->date_is_valid = TRUE;
- priv->date_set_to_none = TRUE;
- priv->time_is_valid = TRUE;
- priv->time_set_to_none = TRUE;
- priv->time_callback = NULL;
- priv->time_callback_data = NULL;
- priv->time_callback_destroy = NULL;
-
- priv->twodigit_year_can_future = TRUE;
+ dedit->priv->twodigit_year_can_future = TRUE;
create_children (dedit);
@@ -276,6 +363,32 @@ e_date_edit_init (EDateEdit *dedit)
e_date_edit_set_time (dedit, 0);
}
+GType
+e_date_edit_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EDateEditClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) date_edit_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EDateEdit),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) date_edit_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_HBOX, "EDateEdit", &type_info, 0);
+ }
+
+ return type;
+}
+
/**
* e_date_edit_new:
*
@@ -472,29 +585,6 @@ create_children (EDateEdit *dedit)
G_CALLBACK (on_date_popup_none_button_clicked), dedit);
}
-static void
-e_date_edit_dispose (GObject *object)
-{
- EDateEdit *dedit;
-
- g_return_if_fail (E_IS_DATE_EDIT (object));
-
- dedit = E_DATE_EDIT (object);
-
- if (dedit->priv) {
- e_date_edit_set_get_time_callback (dedit, NULL, NULL, NULL);
-
- gtk_widget_destroy (dedit->priv->cal_popup);
- dedit->priv->cal_popup = NULL;
-
- g_free (dedit->priv);
- dedit->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
/* GtkWidget::mnemonic_activate() handler for the EDateEdit */
static gboolean
e_date_edit_mnemonic_activate (GtkWidget *widget, gboolean group_cycling)
@@ -647,8 +737,7 @@ e_date_edit_set_time (EDateEdit *dedit,
/* Emit the signals if the date and/or time has actually changed. */
if (date_changed || time_changed)
- g_signal_emit (dedit,
- date_edit_signals [CHANGED], 0);
+ g_signal_emit (dedit, signals[CHANGED], 0);
}
/**
@@ -715,8 +804,7 @@ e_date_edit_set_date (EDateEdit *dedit,
/* Emit the signals if the date has actually changed. */
if (date_changed)
- g_signal_emit (dedit,
- date_edit_signals [CHANGED], 0);
+ g_signal_emit (dedit, signals[CHANGED], 0);
}
/**
@@ -792,8 +880,7 @@ e_date_edit_set_time_of_day (EDateEdit *dedit,
e_date_edit_update_time_entry (dedit);
if (time_changed)
- g_signal_emit (dedit,
- date_edit_signals [CHANGED], 0);
+ g_signal_emit (dedit, signals[CHANGED], 0);
}
void
@@ -818,8 +905,7 @@ e_date_edit_set_date_and_time_of_day (EDateEdit *dedit,
e_date_edit_update_time_combo_state (dedit);
if (date_changed || time_changed)
- g_signal_emit (dedit,
- date_edit_signals [CHANGED], 0);
+ g_signal_emit (dedit, signals[CHANGED], 0);
}
/**
@@ -969,21 +1055,21 @@ e_date_edit_set_make_time_insensitive (EDateEdit *dedit,
/**
* e_date_edit_get_week_start_day:
* @dedit: an #EDateEdit widget
- * @Returns: the week start day, from 0 (Sunday) to 6 (Saturday).
+ * @Returns: the week start day, from 0 (Monday) to 6 (Sunday).
*
* Description: Returns the week start day currently used in the calendar
* popup.
*/
gint
-e_date_edit_get_week_start_day (EDateEdit *dedit)
+e_date_edit_get_week_start_day (EDateEdit *dedit)
{
gint week_start_day;
g_return_val_if_fail (E_IS_DATE_EDIT (dedit), 1);
- g_object_get (E_CALENDAR (dedit->priv->calendar)->calitem,
- "week_start_day", &week_start_day,
- NULL);
+ g_object_get (
+ E_CALENDAR (dedit->priv->calendar)->calitem,
+ "week_start_day", &week_start_day, NULL);
return week_start_day;
}
@@ -991,50 +1077,54 @@ e_date_edit_get_week_start_day (EDateEdit *dedit)
/**
* e_date_edit_set_week_start_day:
* @dedit: an #EDateEdit widget
- * @week_start_day: the week start day, from 0 (Sunday) to 6 (Saturday).
+ * @week_start_day: the week start day, from 0 (Monday) to 6 (Sunday).
*
* Description: Sets the week start day to use in the calendar popup.
*/
void
-e_date_edit_set_week_start_day (EDateEdit *dedit,
- gint week_start_day)
+e_date_edit_set_week_start_day (EDateEdit *dedit,
+ gint week_start_day)
{
g_return_if_fail (E_IS_DATE_EDIT (dedit));
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (E_CALENDAR (dedit->priv->calendar)->calitem),
- "week_start_day", week_start_day,
- NULL);
+ gnome_canvas_item_set (
+ GNOME_CANVAS_ITEM (E_CALENDAR (dedit->priv->calendar)->calitem),
+ "week_start_day", week_start_day, NULL);
+
+ g_object_notify (G_OBJECT (dedit), "week-start-day");
}
/* Whether we show week numbers in the date popup. */
gboolean
-e_date_edit_get_show_week_numbers (EDateEdit *dedit)
+e_date_edit_get_show_week_numbers (EDateEdit *dedit)
{
gboolean show_week_numbers;
g_return_val_if_fail (E_IS_DATE_EDIT (dedit), FALSE);
- g_object_get (E_CALENDAR (dedit->priv->calendar)->calitem,
- "show_week_numbers", &show_week_numbers,
- NULL);
+ g_object_get (
+ E_CALENDAR (dedit->priv->calendar)->calitem,
+ "show_week_numbers", &show_week_numbers, NULL);
return show_week_numbers;
}
void
-e_date_edit_set_show_week_numbers (EDateEdit *dedit,
- gboolean show_week_numbers)
+e_date_edit_set_show_week_numbers (EDateEdit *dedit,
+ gboolean show_week_numbers)
{
g_return_if_fail (E_IS_DATE_EDIT (dedit));
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (E_CALENDAR (dedit->priv->calendar)->calitem),
- "show_week_numbers", show_week_numbers,
- NULL);
+ gnome_canvas_item_set (
+ GNOME_CANVAS_ITEM (E_CALENDAR (dedit->priv->calendar)->calitem),
+ "show_week_numbers", show_week_numbers, NULL);
+
+ g_object_notify (G_OBJECT (dedit), "show-week-numbers");
}
/* Whether we use 24 hour format in the time field & popup. */
gboolean
-e_date_edit_get_use_24_hour_format (EDateEdit *dedit)
+e_date_edit_get_use_24_hour_format (EDateEdit *dedit)
{
g_return_val_if_fail (E_IS_DATE_EDIT (dedit), TRUE);
@@ -1042,8 +1132,8 @@ e_date_edit_get_use_24_hour_format (EDateEdit *dedit)
}
void
-e_date_edit_set_use_24_hour_format (EDateEdit *dedit,
- gboolean use_24_hour_format)
+e_date_edit_set_use_24_hour_format (EDateEdit *dedit,
+ gboolean use_24_hour_format)
{
g_return_if_fail (E_IS_DATE_EDIT (dedit));
@@ -1055,6 +1145,8 @@ e_date_edit_set_use_24_hour_format (EDateEdit *dedit,
rebuild_time_popup (dedit);
e_date_edit_update_time_entry (dedit);
+
+ g_object_notify (G_OBJECT (dedit), "use-24-hour-format");
}
/* Whether we allow the date to be set to 'None'. e_date_edit_get_time() will
@@ -1399,8 +1491,8 @@ rebuild_time_popup (EDateEdit *dedit)
/* For 12-hour am/pm format, we want space padding, not zero padding. This
* can be done with strftime's %l, but it's a potentially unportable extension. */
- if (!priv->use_24_hour_format && buffer [0] == '0')
- buffer [0] = ' ';
+ if (!priv->use_24_hour_format && buffer[0] == '0')
+ buffer[0] = ' ';
gtk_combo_box_append_text (combo, buffer);
}
@@ -1736,8 +1828,8 @@ e_date_edit_update_time_entry (EDateEdit *dedit)
/* For 12-hour am/pm format, we want space padding, not zero padding. This
* can be done with strftime's %l, but it's a potentially unportable extension. */
- if (!priv->use_24_hour_format && buffer [0] == '0')
- buffer [0] = ' ';
+ if (!priv->use_24_hour_format && buffer[0] == '0')
+ buffer[0] = ' ';
gtk_entry_set_text (GTK_ENTRY (GTK_BIN (priv->time_combo)->child),
buffer);
@@ -1860,8 +1952,7 @@ e_date_edit_check_date_changed (EDateEdit *dedit)
tmp_tm.tm_mday);
if (date_changed)
- g_signal_emit (dedit,
- date_edit_signals [CHANGED], 0);
+ g_signal_emit (dedit, signals[CHANGED], 0);
}
/* Parses the time, and if it is different from the current settings it
@@ -1891,8 +1982,7 @@ e_date_edit_check_time_changed (EDateEdit *dedit)
if (time_changed) {
e_date_edit_update_time_entry (dedit);
- g_signal_emit (dedit,
- date_edit_signals [CHANGED], 0);
+ g_signal_emit (dedit, signals[CHANGED], 0);
}
}
diff --git a/widgets/table/e-cell-date-edit.h b/widgets/table/e-cell-date-edit.h
index 72fe952e31..4de4dc1819 100644
--- a/widgets/table/e-cell-date-edit.h
+++ b/widgets/table/e-cell-date-edit.h
@@ -81,21 +81,22 @@ struct _ECellDateEditClass {
ECellPopupClass parent_class;
};
-GType e_cell_date_edit_get_type (void);
-ECell *e_cell_date_edit_new (void);
+GType e_cell_date_edit_get_type (void);
+ECell * e_cell_date_edit_new (void);
/* These freeze and thaw the rebuilding of the time list. They are useful when
setting several properties which result in rebuilds of the list, e.g. the
lower_hour, upper_hour and use_24_hour_format properties. */
-void e_cell_date_edit_freeze (ECellDateEdit *ecde);
-void e_cell_date_edit_thaw (ECellDateEdit *ecde);
+void e_cell_date_edit_freeze (ECellDateEdit *ecde);
+void e_cell_date_edit_thaw (ECellDateEdit *ecde);
/* Sets a callback to use to get the current time. This is useful if the
application needs to use its own timezone data rather than rely on the
Unix timezone. */
-void e_cell_date_edit_set_get_time_callback(ECellDateEdit *ecde,
- ECellDateEditGetTimeCallback cb,
- gpointer data,
- GDestroyNotify destroy);
+void e_cell_date_edit_set_get_time_callback
+ (ECellDateEdit *ecde,
+ ECellDateEditGetTimeCallback cb,
+ gpointer data,
+ GDestroyNotify destroy);
#endif /* _E_CELL_DATE_EDIT_H_ */