summaryrefslogtreecommitdiff
path: root/plugins/gtk+
diff options
context:
space:
mode:
authorJuan Pablo Ugarte <juanpablougarte@gmail.com>2020-07-22 19:13:41 -0300
committerJuan Pablo Ugarte <juanpablougarte@gmail.com>2020-07-22 19:22:34 -0300
commite742d393b514508f6372441106d3ba556d2af65a (patch)
tree8a610f4e4b7cc393568b9d8a095409eeb3d8b3db /plugins/gtk+
parent392a3d61992ef100235166baf2ba32cc200c92d7 (diff)
downloadglade-e742d393b514508f6372441106d3ba556d2af65a.tar.gz
GladeGtkDialog, GladeGtkAssistant: ignore use-header-bar property
Remove construct only use-header-bar property from constructor This way we never show a headerbar in the runtime. Fix issue #462 "Crash when creating a new GtkAssistant and pressing it"
Diffstat (limited to 'plugins/gtk+')
-rw-r--r--plugins/gtk+/glade-gtk-about-dialog.c43
-rw-r--r--plugins/gtk+/glade-gtk-assistant.c17
-rw-r--r--plugins/gtk+/glade-gtk-dialog.c13
-rw-r--r--plugins/gtk+/gtk+.xml6
4 files changed, 34 insertions, 45 deletions
diff --git a/plugins/gtk+/glade-gtk-about-dialog.c b/plugins/gtk+/glade-gtk-about-dialog.c
index 3b866236..b5b63b89 100644
--- a/plugins/gtk+/glade-gtk-about-dialog.c
+++ b/plugins/gtk+/glade-gtk-about-dialog.c
@@ -27,49 +27,6 @@
#include "glade-gtk.h"
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-GObject *
-glade_gtk_about_dialog_construct_object (GladeWidgetAdaptor *adaptor,
- guint n_parameters,
- GParameter *parameters)
-{
- GParameter *new_params = g_new0 (GParameter, n_parameters + 1);
- gboolean use_header_bar_set = FALSE;
- GObject *retval;
- gint i;
-
- /* Here we need to force use-header-bar to FALSE in the runtime because
- * GtkAboutDialog set it to TRUE in its constructor which then triggers a
- * warning when glade tries to add placeholders in the action area
- */
- for (i = 0; i < n_parameters; i++)
- {
- new_params[i] = parameters[i];
-
- if (!g_strcmp0 (new_params[i].name, "use-header-bar"))
- {
- /* force the value to 0 */
- g_value_set_int (&new_params[i].value, 0);
- use_header_bar_set = TRUE;
- }
- }
-
- if (!use_header_bar_set)
- {
- GParameter *use_header = &new_params[n_parameters++];
-
- /* append value if it was not part of the parameters */
- use_header->name = "use-header-bar";
- g_value_init (&use_header->value, G_TYPE_INT);
- g_value_set_int (&use_header->value, 0);
- }
-
- retval = GLADE_WIDGET_ADAPTOR_GET_ADAPTOR_CLASS (GTK_TYPE_DIALOG)->construct_object (adaptor, n_parameters, new_params);
- g_free (new_params);
- return retval;
-}
-G_GNUC_END_IGNORE_DEPRECATIONS
-
void
glade_gtk_about_dialog_read_widget (GladeWidgetAdaptor *adaptor,
GladeWidget *widget,
diff --git a/plugins/gtk+/glade-gtk-assistant.c b/plugins/gtk+/glade-gtk-assistant.c
index 7500e094..8f13593a 100644
--- a/plugins/gtk+/glade-gtk-assistant.c
+++ b/plugins/gtk+/glade-gtk-assistant.c
@@ -25,6 +25,20 @@
#include <glib/gi18n-lib.h>
#include <gladeui/glade.h>
+#include "glade-gtk.h"
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GObject *
+glade_gtk_assistant_construct_object (GladeWidgetAdaptor *adaptor,
+ guint n_parameters,
+ GParameter *parameters)
+{
+ g_autofree GParameter *params = glade_gtk_get_params_without_use_header_bar (&n_parameters, parameters);
+
+ return GLADE_WIDGET_ADAPTOR_GET_ADAPTOR_CLASS (GTK_TYPE_WINDOW)->construct_object (adaptor, n_parameters, params);
+}
+G_GNUC_END_IGNORE_DEPRECATIONS
+
static void
glade_gtk_assistant_append_new_page (GladeWidget *parent,
GladeProject *project,
@@ -184,6 +198,9 @@ glade_gtk_assistant_post_create (GladeWidgetAdaptor *adaptor,
GladeWidget *parent = glade_widget_get_from_gobject (object);
GladeProject *project = glade_widget_get_project (parent);
+ /* Chain Up first */
+ GLADE_WIDGET_ADAPTOR_GET_ADAPTOR_CLASS (GTK_TYPE_WINDOW)->post_create (adaptor, object, reason);
+
if (reason == GLADE_CREATE_LOAD)
{
g_signal_connect (project, "parse-finished",
diff --git a/plugins/gtk+/glade-gtk-dialog.c b/plugins/gtk+/glade-gtk-dialog.c
index f9914690..5a6c046c 100644
--- a/plugins/gtk+/glade-gtk-dialog.c
+++ b/plugins/gtk+/glade-gtk-dialog.c
@@ -27,6 +27,19 @@
#include "glade-gtk-action-widgets.h"
#include "glade-gtk-dialog.h"
+#include "glade-gtk.h"
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+GObject *
+glade_gtk_dialog_construct_object (GladeWidgetAdaptor *adaptor,
+ guint n_parameters,
+ GParameter *parameters)
+{
+ g_autofree GParameter *params = glade_gtk_get_params_without_use_header_bar (&n_parameters, parameters);
+
+ return GLADE_WIDGET_ADAPTOR_GET_ADAPTOR_CLASS (GTK_TYPE_WINDOW)->construct_object (adaptor, n_parameters, params);
+}
+G_GNUC_END_IGNORE_DEPRECATIONS
static void
glade_gtk_stop_emission_POINTER (gpointer instance, gpointer dummy,
diff --git a/plugins/gtk+/gtk+.xml b/plugins/gtk+/gtk+.xml
index b837c413..72b30df5 100644
--- a/plugins/gtk+/gtk+.xml
+++ b/plugins/gtk+/gtk+.xml
@@ -2321,6 +2321,7 @@
<glade-widget-class name="GtkDialog" generic-name="dialog" title="Dialog Box"
default-width="320" default-height="260">
+ <construct-object-function>glade_gtk_dialog_construct_object</construct-object-function>
<post-create-function>glade_gtk_dialog_post_create</post-create-function>
<read-child-function>glade_gtk_dialog_read_child</read-child-function>
<write-child-function>glade_gtk_dialog_write_child</write-child-function>
@@ -3302,8 +3303,6 @@
-->
<glade-widget-class name="GtkAboutDialog" generic-name="aboutdialog" title="About Dialog">
-
- <construct-object-function>glade_gtk_about_dialog_construct_object</construct-object-function>
<read-widget-function>glade_gtk_about_dialog_read_widget</read-widget-function>
<set-property-function>glade_gtk_about_dialog_set_property</set-property-function>
@@ -3445,6 +3444,7 @@
<verify-function>glade_gtk_message_dialog_verify_property</verify-function>
<properties>
+ <property id="use-csd" disabled="True"/>
<property id="default-width" default="400" optional="True" optional-default="False"/>
<property id="default-height" default="115" optional="True" optional-default="False"/>
@@ -3529,6 +3529,7 @@
<glade-widget-class name="GtkFontSelection" deprecated="True" generic-name="fontselection" title="Font Selection"/>
<glade-widget-class name="GtkAssistant" generic-name="assistant" title="Assistant" since="2.10">
+ <construct-object-function>glade_gtk_assistant_construct_object</construct-object-function>
<post-create-function>glade_gtk_assistant_post_create</post-create-function>
<add-child-function>glade_gtk_assistant_add_child</add-child-function>
<remove-child-function>glade_gtk_assistant_remove_child</remove-child-function>
@@ -3543,6 +3544,7 @@
<object name="action_area"/>
</internal-children>
<properties>
+ <property id="use-header-bar" since="3.12" disabled="True"/>
<property save="False" id="n-pages" name="Number of Pages">
<parameter-spec>
<type>GParamInt</type>