month-view: read 12/24 time format setting

The setting will be used when showing the start time of events in the
overflow popover.
This commit is contained in:
Erick Pérez Castellanos
2014-12-20 09:10:00 -05:00
parent 5051ba600f
commit 9badd9f502
3 changed files with 29 additions and 8 deletions
+22
View File
@@ -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;
}
+3
View File
@@ -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__ */
+4 -8
View File
@@ -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);