[evolution] CompEditor: Add a "week-start-day" property.



commit cb63647c88004417175888cd06a96a1b1ecbb050
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Mar 9 07:05:17 2013 -0500

    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 ++
 modules/settings/e-settings-comp-editor.c |    5 +++
 3 files changed, 59 insertions(+), 0 deletions(-)
---
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 2dd0b2d..cb7de1f 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 (
@@ -1893,6 +1908,19 @@ comp_editor_class_init (CompEditorClass *class)
 
        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,
                g_param_spec_int (
                        "work-day-end-hour",
@@ -2530,6 +2558,29 @@ comp_editor_set_use_24_hour_format (CompEditor *editor,
 }
 
 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)
 {
        g_return_val_if_fail (IS_COMP_EDITOR (editor), 0);
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index 72598ac..b343081 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
diff --git a/modules/settings/e-settings-comp-editor.c b/modules/settings/e-settings-comp-editor.c
index a10983a..574b1fb 100644
--- a/modules/settings/e-settings-comp-editor.c
+++ b/modules/settings/e-settings-comp-editor.c
@@ -63,6 +63,11 @@ settings_comp_editor_constructed (GObject *object)
                G_BINDING_SYNC_CREATE);
 
        g_object_bind_property (
+               shell_settings, "cal-week-start-day",
+               extensible, "week-start-day",
+               G_BINDING_SYNC_CREATE);
+
+       g_object_bind_property (
                shell_settings, "cal-work-day-end-hour",
                extensible, "work-day-end-hour",
                G_BINDING_SYNC_CREATE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]