[gnome-calendar/calendar-management] sources-dialog: set the titlebar properly, load sources menu
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/calendar-management] sources-dialog: set the titlebar properly, load sources menu
- Date: Wed, 14 Jan 2015 03:21:01 +0000 (UTC)
commit 5ba1c6980b993ebd120e372cdfcece5131bccb5b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Jan 14 01:20:52 2015 -0200
sources-dialog: set the titlebar properly, load sources menu
src/gcal-source-manager-dialog.c | 49 ++++++++++++++++++++++++++++++++++++-
1 files changed, 47 insertions(+), 2 deletions(-)
---
diff --git a/src/gcal-source-manager-dialog.c b/src/gcal-source-manager-dialog.c
index db96552..7cf88cd 100644
--- a/src/gcal-source-manager-dialog.c
+++ b/src/gcal-source-manager-dialog.c
@@ -22,6 +22,8 @@
struct _GcalSourceManagerDialogPrivate
{
+ GtkWidget *headerbar;
+ GtkWidget *add_button;
GcalManager *manager; /* weak ref */
};
@@ -30,6 +32,18 @@ enum {
PROP_MANAGER
};
+static void gcal_source_manager_dialog_constructed (GObject *object);
+
+static void gcal_source_manager_dialog_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gcal_source_manager_dialog_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
G_DEFINE_TYPE_WITH_PRIVATE (GcalSourceManagerDialog, gcal_source_manager_dialog, GTK_TYPE_DIALOG)
GtkWidget *
@@ -84,10 +98,14 @@ static void
gcal_source_manager_dialog_class_init (GcalSourceManagerDialogClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class;
object_class->finalize = gcal_source_manager_dialog_finalize;
object_class->get_property = gcal_source_manager_dialog_get_property;
object_class->set_property = gcal_source_manager_dialog_set_property;
+ object_class->constructed = gcal_source_manager_dialog_constructed;
+
+ widget_class = GTK_WIDGET_CLASS (klass);
/**
* GcalSourceManagerDialog::manager:
@@ -101,8 +119,35 @@ gcal_source_manager_dialog_class_init (GcalSourceManagerDialogClass *klass)
"A weak reference to the app manager object",
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
- gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
- "/org/gnome/calendar/source-manager-dialog.ui");
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/source-manager-dialog.ui");
+
+ gtk_widget_class_bind_template_child_private (widget_class, GcalSourceManagerDialog, add_button);
+ gtk_widget_class_bind_template_child_private (widget_class, GcalSourceManagerDialog, headerbar);
+}
+
+static void
+gcal_source_manager_dialog_constructed (GObject *object)
+{
+ GcalSourceManagerDialogPrivate *priv;
+
+ GtkBuilder *builder;
+ GMenuModel *sourcesmenu;
+
+ if (G_OBJECT_CLASS (gcal_source_manager_dialog_parent_class)->constructed != NULL)
+ G_OBJECT_CLASS (gcal_source_manager_dialog_parent_class)->constructed (object);
+
+ priv = gcal_source_manager_dialog_get_instance_private (GCAL_SOURCE_MANAGER_DIALOG (object));
+
+ /* setup headerbar */
+ gtk_window_set_titlebar (GTK_WINDOW (object), priv->headerbar);
+
+ /* '+' button menu */
+ builder = gtk_builder_new_from_resource ("/org/gnome/calendar/menus.ui");
+
+ sourcesmenu = (GMenuModel*) gtk_builder_get_object (builder, "sourcesmenu");
+ gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (priv->add_button), sourcesmenu);
+
+ g_object_unref (builder);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]