[gnome-calendar] month-view: read 12/24 time format setting



commit 9badd9f50222d3df9e7531939ce795a1540074b7
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Fri Dec 19 21:47:26 2014 -0500

    month-view: read 12/24 time format setting
    
    The setting will be used when showing the start time of events in the
    overflow popover.

 src/gcal-month-view.c |   22 ++++++++++++++++++++++
 src/gcal-month-view.h |    3 +++
 src/gcal-window.c     |   12 ++++--------
 3 files changed, 29 insertions(+), 8 deletions(-)
---
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index 33c897b..7d7ff44 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -93,6 +93,11 @@ typedef struct
   gint            pressed_overflow_indicator;
   gint            hovered_overflow_indicator;
 
+  /**
+   * clock format from GNOME desktop settings
+   */
+  gboolean        use_24h_format;
+
   /* text direction factors */
   gint            k;
 
@@ -1886,3 +1891,20 @@ gcal_month_view_set_first_weekday (GcalMonthView *view,
       g_free (date);
     }
 }
+
+/**
+ * gcal_month_view_set_use_24h_format:
+ * @view:
+ * @use_24h:
+ *
+ * Whether the view will show time using 24h or 12h format
+ **/
+void
+gcal_month_view_set_use_24h_format (GcalMonthView *view,
+                                    gboolean       use_24h)
+{
+  GcalMonthViewPrivate *priv;
+
+  priv = gcal_month_view_get_instance_private (view);
+  priv->use_24h_format = use_24h;
+}
diff --git a/src/gcal-month-view.h b/src/gcal-month-view.h
index 464f24e..cbd59c7 100644
--- a/src/gcal-month-view.h
+++ b/src/gcal-month-view.h
@@ -55,6 +55,9 @@ GtkWidget*     gcal_month_view_new              (GcalManager *manager);
 void           gcal_month_view_set_first_weekday (GcalMonthView *view,
                                                  gint           day_nr);
 
+void           gcal_month_view_set_use_24h_format (GcalMonthView *view,
+                                                  gboolean       use_24h);
+
 G_END_DECLS
 
 #endif /* __GCAL_MONTH_VIEW_H__ */
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 33864b2..f68b2cb 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -1259,14 +1259,10 @@ gcal_window_constructed (GObject *object)
                         priv->views[GCAL_WINDOW_VIEW_WEEK],
                         "week", _("Week"));
 
-  priv->views[GCAL_WINDOW_VIEW_MONTH] =
-    gcal_month_view_new (priv->manager);
-  gcal_month_view_set_first_weekday (
-      GCAL_MONTH_VIEW (priv->views[GCAL_WINDOW_VIEW_MONTH]),
-      get_first_weekday ());
-  gtk_stack_add_titled (GTK_STACK (priv->views_stack),
-                        priv->views[GCAL_WINDOW_VIEW_MONTH],
-                        "month", _("Month"));
+  priv->views[GCAL_WINDOW_VIEW_MONTH] = gcal_month_view_new (priv->manager);
+  gcal_month_view_set_first_weekday (GCAL_MONTH_VIEW (priv->views[GCAL_WINDOW_VIEW_MONTH]), 
get_first_weekday ());
+  gcal_month_view_set_use_24h_format (GCAL_MONTH_VIEW (priv->views[GCAL_WINDOW_VIEW_MONTH]), use_24h_format);
+  gtk_stack_add_titled (GTK_STACK (priv->views_stack), priv->views[GCAL_WINDOW_VIEW_MONTH], "month", 
_("Month"));
 
   priv->views[GCAL_WINDOW_VIEW_YEAR] =
     gcal_year_view_new (priv->manager);


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