[gtk+/gtk-3-18] assistant: Deal with spontaneous page disappearance
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-18] assistant: Deal with spontaneous page disappearance
- Date: Mon, 5 Oct 2015 12:22:52 +0000 (UTC)
commit b06cb4b9d119b8b2589019b89636571eee2b5137
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 5 08:19:07 2015 -0400
assistant: Deal with spontaneous page disappearance
Removing pages from the assistant with gtk_widget_destroy() used
to work. It broke with the recent interposition of a box between
each page and the notebook. Fix this by cleaning up when the box
child is removed.
https://bugzilla.gnome.org/show_bug.cgi?id=756042
gtk/gtkassistant.c | 21 ++++++++-------------
1 files changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c
index 2288350..34a6dd4 100644
--- a/gtk/gtkassistant.c
+++ b/gtk/gtkassistant.c
@@ -88,6 +88,7 @@ struct _GtkAssistantPage
gchar *title;
+ GtkWidget *box;
GtkWidget *page;
GtkWidget *regular_title;
GtkWidget *current_title;
@@ -184,7 +185,7 @@ static void on_assistant_cancel (GtkWidget *wid
GtkAssistant *assistant);
static void on_assistant_last (GtkWidget *widget,
GtkAssistant *assistant);
-static void assistant_remove_page_cb (GtkNotebook *notebook,
+static void assistant_remove_page_cb (GtkContainer *container,
GtkWidget *page,
GtkAssistant *assistant);
@@ -1113,7 +1114,7 @@ on_page_notify_visibility (GtkWidget *widget,
}
static void
-assistant_remove_page_cb (GtkNotebook *notebook,
+assistant_remove_page_cb (GtkContainer *container,
GtkWidget *page,
GtkAssistant *assistant)
{
@@ -1122,15 +1123,6 @@ assistant_remove_page_cb (GtkNotebook *notebook,
GList *page_node;
GList *element;
- if (GTK_IS_BOX (page))
- {
- GList *children;
-
- children = gtk_container_get_children (GTK_CONTAINER (page));
- page = GTK_WIDGET (children->data);
- g_list_free (children);
- }
-
element = find_page (assistant, page);
if (!element)
return;
@@ -1367,7 +1359,7 @@ find_page (GtkAssistant *assistant,
while (child)
{
GtkAssistantPage *page_info = child->data;
- if (page_info->page == page)
+ if (page_info->page == page || page_info->box == page)
return child;
child = child->next;
@@ -1816,9 +1808,12 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
gtk_widget_show (box);
gtk_box_pack_start (GTK_BOX (box), page, TRUE, TRUE, 0);
g_object_set (box, "margin", 12, NULL);
+ g_signal_connect (box, "remove", G_CALLBACK (assistant_remove_page_cb), assistant);
gtk_notebook_insert_page (GTK_NOTEBOOK (priv->content), box, NULL, position);
+ page_info->box = box;
+
if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
{
update_buttons_state (assistant);
@@ -2415,7 +2410,7 @@ gtk_assistant_set_page_has_padding (GtkAssistant *assistant,
{
page_info->has_padding = has_padding;
- g_object_set (gtk_widget_get_parent (page),
+ g_object_set (page_info->box,
"margin", has_padding ? 12 : 0,
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]