[glade] GladeGtkWindow: fix regression in csd handling
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] GladeGtkWindow: fix regression in csd handling
- Date: Mon, 19 Mar 2018 23:47:25 +0000 (UTC)
commit 728ebab0e1637b71064c57cc734c297ff2e5f7c8
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Mon Mar 19 20:44:50 2018 -0300
GladeGtkWindow: fix regression in csd handling
Fixes bug #794492 "Glade always re-enables the client-side-decoration option"
plugins/gtk+/glade-gtk-window.c | 32 ++++++++++++++++++++++++++++----
plugins/gtk+/gtk+.xml.in | 1 +
2 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-window.c b/plugins/gtk+/glade-gtk-window.c
index 86ca162..6ea3916 100644
--- a/plugins/gtk+/glade-gtk-window.c
+++ b/plugins/gtk+/glade-gtk-window.c
@@ -41,15 +41,20 @@
static void
glade_gtk_window_parse_finished (GladeProject * project, GObject * object)
{
- glade_widget_property_set (glade_widget_get_from_gobject (object),
- "use-csd", gtk_window_get_titlebar(GTK_WINDOW (object)) != NULL);
+ GtkWidget *titlebar = gtk_window_get_titlebar(GTK_WINDOW (object));
+ glade_widget_property_set (glade_widget_get_from_gobject (object), "use-csd",
+ titlebar && gtk_widget_get_visible (titlebar));
}
static void
glade_gtk_window_ensure_titlebar_placeholder (GObject *window)
{
- GtkWidget *placeholder = glade_placeholder_new ();
+ GtkWidget *placeholder;
+
+ if (gtk_window_get_titlebar (GTK_WINDOW (window)))
+ return;
+ placeholder = glade_placeholder_new ();
gtk_window_set_titlebar (GTK_WINDOW (window), placeholder);
gtk_widget_hide (placeholder);
@@ -193,7 +198,7 @@ glade_gtk_window_write_widget (GladeWidgetAdaptor * adaptor,
GladeXmlContext * context, GladeXmlNode * node)
{
if (!(glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET) ||
- glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
+ glade_xml_node_verify_silent (node, GLADE_XML_TAG_TEMPLATE)))
return;
/* First chain up and read in all the normal properties.. */
@@ -360,3 +365,22 @@ glade_gtk_window_remove_child (GladeWidgetAdaptor * adaptor,
gtk_container_add (GTK_CONTAINER (object), placeholder);
}
}
+
+GList *
+glade_gtk_window_get_children (GladeWidgetAdaptor *adaptor, GObject *container)
+{
+ GladeWidget *gwidget = glade_widget_get_from_gobject (container);
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (container));
+ GtkWidget *titlebar = gtk_window_get_titlebar (GTK_WINDOW (container));
+ GList *children = NULL;
+ gboolean use_csd;
+
+ if (child)
+ children = g_list_prepend (children, child);
+
+ if (glade_widget_property_get (gwidget, "use-csd", &use_csd) &&
+ use_csd && titlebar)
+ children = g_list_prepend (children, titlebar);
+
+ return children;
+}
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 5e98796..e5539ec 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -747,6 +747,7 @@
<add-child-function>glade_gtk_window_add_child</add-child-function>
<remove-child-function>glade_gtk_window_remove_child</remove-child-function>
<replace-child-function>glade_gtk_window_replace_child</replace-child-function>
+ <get-children-function>glade_gtk_window_get_children</get-children-function>
<special-child-type>type</special-child-type>
<properties>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]