From cb63647c88004417175888cd06a96a1b1ecbb050 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 9 Mar 2013 07:05:17 -0500 Subject: CompEditor: Add a "week-start-day" property. Automatically configured, of course, by ESettingsCompEditor. --- calendar/gui/dialogs/comp-editor.c | 51 ++++++++++++++++++++++++++++++++++++++ calendar/gui/dialogs/comp-editor.h | 3 +++ 2 files changed, 54 insertions(+) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 2dd0b2d13b..cb7de1f881 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -108,6 +108,8 @@ struct _CompEditorPrivate { icaltimezone *zone; gboolean use_24_hour_format; + gint week_start_day; + gint work_day_end_hour; gint work_day_end_minute; gint work_day_start_hour; @@ -137,6 +139,7 @@ enum { PROP_SUMMARY, PROP_TIMEZONE, PROP_USE_24_HOUR_FORMAT, + PROP_WEEK_START_DAY, PROP_WORK_DAY_END_HOUR, PROP_WORK_DAY_END_MINUTE, PROP_WORK_DAY_START_HOUR, @@ -1422,6 +1425,12 @@ comp_editor_set_property (GObject *object, g_value_get_boolean (value)); return; + case PROP_WEEK_START_DAY: + comp_editor_set_week_start_day ( + COMP_EDITOR (object), + g_value_get_int (value)); + return; + case PROP_WORK_DAY_END_HOUR: comp_editor_set_work_day_end_hour ( COMP_EDITOR (object), @@ -1505,6 +1514,12 @@ comp_editor_get_property (GObject *object, COMP_EDITOR (object))); return; + case PROP_WEEK_START_DAY: + g_value_set_int ( + value, comp_editor_get_week_start_day ( + COMP_EDITOR (object))); + return; + case PROP_WORK_DAY_END_HOUR: g_value_set_int ( value, comp_editor_get_work_day_end_hour ( @@ -1891,6 +1906,19 @@ comp_editor_class_init (CompEditorClass *class) FALSE, 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 | + G_PARAM_STATIC_STRINGS)); + g_object_class_install_property ( object_class, PROP_WORK_DAY_END_HOUR, @@ -2529,6 +2557,29 @@ comp_editor_set_use_24_hour_format (CompEditor *editor, g_object_notify (G_OBJECT (editor), "use-24-hour-format"); } +gint +comp_editor_get_week_start_day (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), 0); + + return editor->priv->week_start_day; +} + +void +comp_editor_set_week_start_day (CompEditor *editor, + gint week_start_day) +{ + g_return_if_fail (IS_COMP_EDITOR (editor)); + g_return_if_fail (week_start_day >= 0 && week_start_day < 7); + + if (week_start_day == editor->priv->week_start_day) + return; + + editor->priv->week_start_day = week_start_day; + + g_object_notify (G_OBJECT (editor), "week-start-day"); +} + gint comp_editor_get_work_day_end_hour (CompEditor *editor) { diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 72598acfe0..b343081dcc 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -134,6 +134,9 @@ gboolean comp_editor_get_use_24_hour_format void comp_editor_set_use_24_hour_format (CompEditor *editor, gboolean use_24_hour_format); +gint comp_editor_get_week_start_day (CompEditor *editor); +void comp_editor_set_week_start_day (CompEditor *editor, + gint week_start_day); gint comp_editor_get_work_day_end_hour (CompEditor *editor); void comp_editor_set_work_day_end_hour -- cgit v1.2.3