[gnome-software/1286-app-pages-no-longer-have-the-app-name-as-the-title: 27/27] gs-shell: Title of the window not updated with the current page title




commit bdbbe935d7b1f3f7970f7c5a70599e3f86f14f65
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jun 22 21:05:02 2021 +0200

    gs-shell: Title of the window not updated with the current page title
    
    The gtk_stack_get_visible_child() returns an old child when being called
    inside stack_notify_visible_child_cb(), thus use the page variable instead,
    which references the page being set as active.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1286

 src/gs-shell.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index c7ffe7f25..c589aa2a0 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -529,20 +529,22 @@ stack_notify_visible_child_cb (GObject    *object,
                break;
        }
 
-       g_clear_object (&shell->main_header_title_binding);
-       shell->main_header_title_binding = g_object_bind_property (gtk_stack_get_visible_child 
(shell->stack_main), "title",
-                                                                  shell->main_header, "title",
-                                                                  G_BINDING_SYNC_CREATE);
-
-       g_clear_object (&shell->application_details_header_binding);
-       shell->application_details_header_binding = g_object_bind_property (gtk_stack_get_visible_child 
(shell->stack_sub), "title",
-                                                                           
shell->application_details_header, "label",
-                                                                           G_BINDING_SYNC_CREATE);
-
-       g_clear_object (&shell->sub_page_header_title_binding);
-       shell->sub_page_header_title_binding = g_object_bind_property (gtk_stack_get_visible_child 
(shell->stack_sub), "title",
-                                                                      shell->sub_page_header_title, "label",
-                                                                      G_BINDING_SYNC_CREATE);
+       if (gs_shell_get_mode_is_main (mode)) {
+               g_clear_object (&shell->main_header_title_binding);
+               shell->main_header_title_binding = g_object_bind_property (page, "title",
+                                                                          shell->main_header, "title",
+                                                                          G_BINDING_SYNC_CREATE);
+       } else {
+               g_clear_object (&shell->application_details_header_binding);
+               shell->application_details_header_binding = g_object_bind_property (page, "title",
+                                                                                   
shell->application_details_header, "label",
+                                                                                   G_BINDING_SYNC_CREATE);
+
+               g_clear_object (&shell->sub_page_header_title_binding);
+               shell->sub_page_header_title_binding = g_object_bind_property (page, "title",
+                                                                              shell->sub_page_header_title, 
"label",
+                                                                              G_BINDING_SYNC_CREATE);
+       }
 
        /* refresh the updates bar when moving out of the loading mode, but only
         * if the Mogwai scheduler state is already known, to avoid spuriously


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