[gnome-software/wip/hughsie/fix-alternates-regression: 10/12] details-page: Only connect up settings changed once



commit 774fc46305a6b13ec99ed556e80a9c3768dbdf05
Author: Richard Hughes <richard hughsie com>
Date:   Mon Oct 8 19:48:51 2018 +0100

    details-page: Only connect up settings changed once
    
    This is currently added every time the application changes...

 src/gs-details-page.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 5b9c0f6f..b2904b01 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -1895,10 +1895,10 @@ gs_details_page_reload (GsPage *page)
 }
 
 static void
-settings_changed_cb (GsDetailsPage *self,
-                    const gchar *key,
-                    gpointer data)
+settings_changed_cb (GsDetailsPage *self, const gchar *key, gpointer data)
 {
+       if (self->app == NULL)
+               return;
        if (g_strcmp0 (key, "show-nonfree-ui") == 0) {
                gs_details_page_refresh_all (self);
        }
@@ -1957,10 +1957,6 @@ gs_details_page_set_app (GsDetailsPage *self, GsApp *app)
 
        /* change widgets */
        gs_details_page_refresh_all (self);
-
-       g_signal_connect_swapped (self->settings, "changed",
-                                 G_CALLBACK (settings_changed_cb),
-                                 self);
 }
 
 GsApp *
@@ -2625,6 +2621,9 @@ gs_details_page_init (GsDetailsPage *self)
        self->session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT, gs_user_agent (),
                                                       NULL);
        self->settings = g_settings_new ("org.gnome.software");
+       g_signal_connect_swapped (self->settings, "changed",
+                                 G_CALLBACK (settings_changed_cb),
+                                 self);
        self->size_group_origin_popover = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
        gtk_list_box_set_header_func (GTK_LIST_BOX (self->list_box_addons),


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