[gnome-calendar/calendar-editor] source-dialog: setup headerbar properly



commit 1dfb26cbacc71e8f4a2d727f1f3446d9e59de72b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Feb 9 12:00:38 2015 -0200

    source-dialog: setup headerbar properly

 src/gcal-source-dialog.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index 3a35926..8321cc4 100644
--- a/src/gcal-source-dialog.c
+++ b/src/gcal-source-dialog.c
@@ -20,6 +20,10 @@
 
 typedef struct
 {
+  GtkWidget          *headerbar;
+  GtkWidget          *stack;
+
+  /* flags */
   gint                mode : 1;
 
   /* manager */
@@ -50,6 +54,17 @@ gcal_source_dialog_new (void)
 }
 
 static void
+gcal_source_dialog_constructed (GObject *object)
+{
+  GcalSourceDialog *self = (GcalSourceDialog *)object;
+  GcalSourceDialogPrivate *priv = gcal_source_dialog_get_instance_private (self);
+
+  G_OBJECT_CLASS (gcal_source_dialog_parent_class)->constructed (object);
+
+  gtk_window_set_titlebar (GTK_WINDOW (object), priv->headerbar);
+}
+
+static void
 gcal_source_dialog_finalize (GObject *object)
 {
   GcalSourceDialog *self = (GcalSourceDialog *)object;
@@ -92,13 +107,20 @@ static void
 gcal_source_dialog_class_init (GcalSourceDialogClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class;
 
+  object_class->constructed = gcal_source_dialog_constructed;
   object_class->finalize = gcal_source_dialog_finalize;
   object_class->get_property = gcal_source_dialog_get_property;
   object_class->set_property = gcal_source_dialog_set_property;
 
+  widget_class = GTK_WIDGET_CLASS (klass);
+
   /* bind things for/from the template class */
   gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), 
"/org/gnome/calendar/source-dialog.ui");
+
+  gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, headerbar);
+  gtk_widget_class_bind_template_child_private (widget_class, GcalSourceDialog, stack);
 }
 
 static void


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