[gtk+] aboutdialog: make use-header-bar override work from bindings
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] aboutdialog: make use-header-bar override work from bindings
- Date: Fri, 24 Jan 2014 20:57:19 +0000 (UTC)
commit 22bcd62e2eb900c35979f8a56b9dd59327bec03b
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sun Jan 19 14:48:05 2014 -0800
aboutdialog: make use-header-bar override work from bindings
Instead of setting "use-header-bar" from gtk_about_dialog_new(),
override its default value by inspecting the properties at constructor()
time. This makes it work from bindings as well, since they don't use the
convenience C constructor.
https://bugzilla.gnome.org/show_bug.cgi?id=722574
gtk/gtkaboutdialog.c | 40 +++++++++++++++++++++++++++++++++-------
1 files changed, 33 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c
index 40566f2..09018e4 100644
--- a/gtk/gtkaboutdialog.c
+++ b/gtk/gtkaboutdialog.c
@@ -278,6 +278,37 @@ stack_visible_child_notify (GtkStack *stack,
return FALSE;
}
+static GObject *
+gtk_about_dialog_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_params)
+{
+ GObject *object;
+ guint idx;
+ GParamSpec *pspec;
+ GValue *value;
+
+ for (idx = 0; idx < n_construct_properties; idx++)
+ {
+ pspec = construct_params[idx].pspec;
+ if (g_strcmp0 (pspec->name, "use-header-bar") != 0)
+ continue;
+
+ /* GtkDialog uses "-1" to imply an unset value for this property */
+ value = construct_params[idx].value;
+ if (g_value_get_int (value) == -1)
+ g_value_set_int (value, 1);
+
+ break;
+ }
+
+ object = G_OBJECT_CLASS (gtk_about_dialog_parent_class)->constructor (type,
+ n_construct_properties,
+ construct_params);
+
+ return object;
+}
+
static void
gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
{
@@ -290,6 +321,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
object_class->set_property = gtk_about_dialog_set_property;
object_class->get_property = gtk_about_dialog_get_property;
+ object_class->constructor = gtk_about_dialog_constructor;
object_class->finalize = gtk_about_dialog_finalize;
widget_class->show = gtk_about_dialog_show;
@@ -2329,13 +2361,7 @@ populate_license_page (GtkAboutDialog *about)
GtkWidget *
gtk_about_dialog_new (void)
{
- GtkAboutDialog *dialog;
-
- dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG,
- "use-header-bar", TRUE,
- NULL);
-
- return GTK_WIDGET (dialog);
+ return g_object_new (GTK_TYPE_ABOUT_DIALOG, NULL);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]