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
This commit is contained in:
parent
6e96111d9f
commit
22bcd62e2e
@ -278,6 +278,37 @@ stack_visible_child_notify (GtkStack *stack,
|
|||||||
return FALSE;
|
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
|
static void
|
||||||
gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
|
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->set_property = gtk_about_dialog_set_property;
|
||||||
object_class->get_property = gtk_about_dialog_get_property;
|
object_class->get_property = gtk_about_dialog_get_property;
|
||||||
|
|
||||||
|
object_class->constructor = gtk_about_dialog_constructor;
|
||||||
object_class->finalize = gtk_about_dialog_finalize;
|
object_class->finalize = gtk_about_dialog_finalize;
|
||||||
|
|
||||||
widget_class->show = gtk_about_dialog_show;
|
widget_class->show = gtk_about_dialog_show;
|
||||||
@ -2329,13 +2361,7 @@ populate_license_page (GtkAboutDialog *about)
|
|||||||
GtkWidget *
|
GtkWidget *
|
||||||
gtk_about_dialog_new (void)
|
gtk_about_dialog_new (void)
|
||||||
{
|
{
|
||||||
GtkAboutDialog *dialog;
|
return g_object_new (GTK_TYPE_ABOUT_DIALOG, NULL);
|
||||||
|
|
||||||
dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG,
|
|
||||||
"use-header-bar", TRUE,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
return GTK_WIDGET (dialog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user