[gtk+] assistant: Handle page-type and title changes properly



commit e28b3d129647e4e7f4fa82456a3b967009896aab
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Oct 26 09:01:07 2015 -0400

    assistant: Handle page-type and title changes properly
    
    We need to update our state when a pages' type or title changes.

 gtk/gtkassistant.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c
index 34a6dd4..05d39e6 100644
--- a/gtk/gtkassistant.c
+++ b/gtk/gtkassistant.c
@@ -1100,9 +1100,9 @@ alternative_button_order (GtkAssistant *assistant)
 }
 
 static void
-on_page_notify_visibility (GtkWidget  *widget,
-                           GParamSpec *arg,
-                           gpointer    data)
+on_page_notify (GtkWidget  *widget,
+                GParamSpec *arg,
+                gpointer    data)
 {
   GtkAssistant *assistant = GTK_ASSISTANT (data);
 
@@ -1128,6 +1128,7 @@ assistant_remove_page_cb (GtkContainer *container,
     return;
 
   page_info = element->data;
+g_print ("remove page cb: %s\n", page_info->title);
 
   /* If this is the current page, we need to switch away. */
   if (page_info == priv->current_page)
@@ -1153,7 +1154,7 @@ assistant_remove_page_cb (GtkContainer *container,
         }
     }
 
-  g_signal_handlers_disconnect_by_func (page_info->page, on_page_notify_visibility, assistant);
+  g_signal_handlers_disconnect_by_func (page_info->page, on_page_notify, assistant);
 
   gtk_size_group_remove_widget (priv->title_size_group, page_info->regular_title);
   gtk_size_group_remove_widget (priv->title_size_group, page_info->current_title);
@@ -1790,7 +1791,13 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
   gtk_size_group_add_widget (priv->title_size_group, page_info->current_title);
 
   g_signal_connect (G_OBJECT (page), "notify::visible",
-                    G_CALLBACK (on_page_notify_visibility), assistant);
+                    G_CALLBACK (on_page_notify), assistant);
+
+  g_signal_connect (G_OBJECT (page), "child-notify::page-title",
+                    G_CALLBACK (on_page_notify), assistant);
+
+  g_signal_connect (G_OBJECT (page), "child-notify::page-type",
+                    G_CALLBACK (on_page_notify), assistant);
 
   n_pages = g_list_length (priv->pages);
 
@@ -2013,6 +2020,8 @@ gtk_assistant_set_page_title (GtkAssistant *assistant,
   gtk_label_set_text ((GtkLabel*) page_info->regular_title, title);
   gtk_label_set_text ((GtkLabel*) page_info->current_title, title);
 
+  update_title_state (assistant);
+
   gtk_container_child_notify (GTK_CONTAINER (assistant), page, "title");
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]