aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-08-06 09:24:53 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-06 09:24:53 +0800
commit6a2b0904893199ceb5b291405721845fd17a08db (patch)
tree2be4574d4e07423d7b5e197706ed01c2a613f9d2 /calendar
parent9abce979580857b9273ee9efc909bfd1d3004e51 (diff)
downloadgsoc2013-evolution-6a2b0904893199ceb5b291405721845fd17a08db.tar.gz
gsoc2013-evolution-6a2b0904893199ceb5b291405721845fd17a08db.tar.zst
gsoc2013-evolution-6a2b0904893199ceb5b291405721845fd17a08db.zip
More refactoring of settings management.
Diffstat (limited to 'calendar')
-rw-r--r--calendar/gui/calendar-config.c16
-rw-r--r--calendar/gui/calendar-config.h2
-rw-r--r--calendar/gui/e-day-view.c42
-rw-r--r--calendar/gui/e-week-view.c25
-rw-r--r--calendar/gui/gnome-cal.c95
5 files changed, 80 insertions, 100 deletions
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index b1f38c74cb..4099f5fd4b 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -381,14 +381,6 @@ calendar_config_add_notification_dnav_show_week_no (GConfClientNotifyFunc func,
}
/* The positions of the panes in the normal and month views. */
-gint
-calendar_config_get_hpane_pos (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_int (config, CALENDAR_CONFIG_HPANE_POS, NULL);
-}
-
void
calendar_config_set_hpane_pos (gint hpane_pos)
{
@@ -397,14 +389,6 @@ calendar_config_set_hpane_pos (gint hpane_pos)
gconf_client_set_int (config, CALENDAR_CONFIG_HPANE_POS, hpane_pos, NULL);
}
-gint
-calendar_config_get_month_hpane_pos (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_int (config, CALENDAR_CONFIG_MONTH_HPANE_POS, NULL);
-}
-
void
calendar_config_set_month_hpane_pos (gint hpane_pos)
{
diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h
index dddffe6a92..9a8a1dc2f8 100644
--- a/calendar/gui/calendar-config.h
+++ b/calendar/gui/calendar-config.h
@@ -108,10 +108,8 @@ gboolean calendar_config_get_dnav_show_week_no (void);
guint calendar_config_add_notification_dnav_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);
-gint calendar_config_get_month_hpane_pos (void);
void calendar_config_set_month_hpane_pos (gint hpane_pos);
/* The current list of task lists selected */
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 7fc7bfac90..03b1b9cb51 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -611,9 +611,49 @@ day_view_constructed (GObject *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 (
+ e_binding_new (
G_OBJECT (shell_settings), "cal-day-view-show-week-numbers",
G_OBJECT (day_view->week_number_label), "visible");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-marcus-bains-show-line",
+ G_OBJECT (day_view), "marcus-bains-show-line");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-marcus-bains-day-view-color",
+ G_OBJECT (day_view), "marcus-bains-day-view-color");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-marcus-bains-time-bar-color",
+ G_OBJECT (day_view), "marcus-bains-time-bar-color");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-time-divisions",
+ G_OBJECT (day_view), "mins-per-row");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ G_OBJECT (day_view), "week-start-day");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-work-day-end-hour",
+ G_OBJECT (day_view), "work-day-end-hour");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-work-day-end-minute",
+ G_OBJECT (day_view), "work-day-end-minute");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-work-day-start-hour",
+ G_OBJECT (day_view), "work-day-start-hour");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-work-day-start-minute",
+ G_OBJECT (day_view), "work-day-start-minute");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-working-days-bitset",
+ G_OBJECT (day_view), "working-days");
}
static void
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 5d08ee84de..97034f8e01 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -296,6 +296,30 @@ week_view_get_property (GObject *object,
}
static void
+week_view_constructed (GObject *object)
+{
+ ECalModel *model;
+ EWeekView *week_view;
+ EShellSettings *shell_settings;
+
+ week_view = E_WEEK_VIEW (object);
+ model = e_calendar_view_get_model (E_CALENDAR_VIEW (week_view));
+ shell_settings = e_cal_model_get_shell_settings (model);
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-compress-weekend",
+ G_OBJECT (week_view), "compress-weekend");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-show-event-end-times",
+ G_OBJECT (week_view), "show-event-end-times");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ G_OBJECT (week_view), "week-start-day");
+}
+
+static void
week_view_cursor_key_up (EWeekView *week_view)
{
if (week_view->selection_start_day == -1)
@@ -366,6 +390,7 @@ e_week_view_class_init (EWeekViewClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->set_property = week_view_set_property;
object_class->get_property = week_view_get_property;
+ object_class->constructed = week_view_constructed;
gtk_object_class = GTK_OBJECT_CLASS (class);
gtk_object_class->destroy = e_week_view_destroy;
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 9c099e8938..6283e6b8dd 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -326,6 +326,15 @@ view_done_cb (ECalModel *model,
}
static void
+gnome_calendar_update_time_range (GnomeCalendar *gcal)
+{
+ time_t start_time;
+
+ start_time = gcal->priv->base_view_time;
+ gnome_calendar_set_selected_time_range (gcal, start_time);
+}
+
+static void
gnome_calendar_set_shell_settings (GnomeCalendar *gcal,
EShellSettings *shell_settings)
{
@@ -422,10 +431,6 @@ gnome_calendar_constructed (GObject *object)
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);
@@ -438,9 +443,9 @@ gnome_calendar_constructed (GObject *object)
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");
+ g_signal_connect_swapped (
+ calendar_view, "notify::working-days",
+ G_CALLBACK (gnome_calendar_update_time_range), gcal);
/* Week View */
calendar_view = e_week_view_new (model);
@@ -448,10 +453,6 @@ gnome_calendar_constructed (GObject *object)
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);
@@ -470,10 +471,6 @@ gnome_calendar_constructed (GObject *object)
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);
@@ -499,6 +496,8 @@ gnome_calendar_constructed (GObject *object)
e_binding_new (
G_OBJECT (shell_settings), "cal-week-start-day",
G_OBJECT (gcal), "week-start-day");
+
+ gnome_calendar_update_time_range (gcal);
}
/* Class initialization function for the gnome calendar */
@@ -1147,49 +1146,6 @@ gnome_calendar_set_search_query (GnomeCalendar *gcal,
update_todo_view (gcal);
}
-/* Returns the current time, for the ECalendarItem. */
-static struct tm
-get_current_time (ECalendarItem *calitem, gpointer data)
-{
- GnomeCalendar *cal = data;
- struct tm tmp_tm = { 0 };
- struct icaltimetype tt;
-
- g_return_val_if_fail (cal != NULL, tmp_tm);
- g_return_val_if_fail (GNOME_IS_CALENDAR (cal), tmp_tm);
-
- tt = icaltime_from_timet_with_zone (time (NULL), FALSE,
- cal->priv->zone);
-
- /* Now copy it to the struct tm and return it. */
- tmp_tm = icaltimetype_to_tm (&tt);
-
- return tmp_tm;
-}
-
-static void
-set_working_days (GnomeCalendar *calendar)
-{
- time_t start_time;
- gint ii;
-
- /* 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
-working_days_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- GnomeCalendar *calendar = data;
-
- set_working_days (calendar);
-}
-
static void
set_timezone (GnomeCalendar *calendar)
{
@@ -1372,24 +1328,6 @@ update_marcus_bains_line_cb (GnomeCalendar *gcal)
}
static void
-setup_config (GnomeCalendar *calendar)
-{
- GnomeCalendarPrivate *priv;
- guint not;
-
- priv = calendar->priv;
-
- /* 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));
-
- /* Pane positions */
- priv->hpane_pos = calendar_config_get_hpane_pos ();
- priv->hpane_pos_month_view = calendar_config_get_month_hpane_pos ();
-}
-
-static void
setup_widgets (GnomeCalendar *gcal)
{
GnomeCalendarPrivate *priv;
@@ -1441,7 +1379,6 @@ gnome_calendar_init (GnomeCalendar *gcal)
priv->range_selected = FALSE;
priv->lview_select_daten_range = TRUE;
- setup_config (gcal);
setup_widgets (gcal);
priv->calendar_menu = e_cal_menu_new("org.gnome.evolution.calendar.view");
@@ -2274,10 +2211,6 @@ gnome_calendar_set_date_navigator (GnomeCalendar *gcal,
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),