[gnome-calendar/wip/gbsneto/date-chooser: 5/5] date-selector: bind weekday numbers with desktop
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/gbsneto/date-chooser: 5/5] date-selector: bind weekday numbers with desktop
- Date: Fri, 22 Jul 2016 04:30:45 +0000 (UTC)
commit 5ac6add2d6d30155baf9917420da5c69e1394245
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Jul 22 01:24:56 2016 -0300
date-selector: bind weekday numbers with desktop
The current implementation of the new calendar widget
accepts showing the week numbers in a modern and much
more consistent way.
The behavior, however, is not aligned with the rest of
the application and the desktop, which share a setting
to show or hide the week number.
Fix that by synchronizing the new calendar's week number
property with the specific setting.
src/gcal-date-selector.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-date-selector.c b/src/gcal-date-selector.c
index 56e8ba4..ac3a29b 100644
--- a/src/gcal-date-selector.c
+++ b/src/gcal-date-selector.c
@@ -32,6 +32,8 @@ struct _GcalDateSelector
/* widgets */
GtkWidget *date_chooser;
GtkWidget *date_selector_popover;
+
+ GSettings *settings;
};
enum
@@ -110,6 +112,16 @@ icon_pressed_cb (GcalDateSelector *self,
}
static void
+gcal_date_selector_finalize (GObject *object)
+{
+ GcalDateSelector *self = GCAL_DATE_SELECTOR (object);
+
+ g_clear_object (&self->settings);
+
+ G_OBJECT_CLASS (gcal_date_selector_parent_class)->finalize (object);
+}
+
+static void
gcal_date_selector_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -178,6 +190,7 @@ gcal_date_selector_class_init (GcalDateSelectorClass *klass)
GtkEntryClass *entry_class = GTK_ENTRY_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = gcal_date_selector_finalize;
object_class->get_property = gcal_date_selector_get_property;
object_class->set_property = gcal_date_selector_set_property;
@@ -214,6 +227,14 @@ gcal_date_selector_init (GcalDateSelector *self)
gtk_widget_set_has_window (GTK_WIDGET (self), FALSE);
gtk_widget_init_template (GTK_WIDGET (self));
+
+ self->settings = g_settings_new ("org.gnome.desktop.calendar");
+
+ g_settings_bind (self->settings,
+ "show-weekdate",
+ self->date_chooser,
+ "show-week-numbers",
+ G_SETTINGS_BIND_DEFAULT);
}
/* Public API */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]