[gnome-software/wip/mcrha/repos-dialog-other-repos-reload] gs-repos-dialog: Other repositories section not removed on reload



commit c11612b70740372b954a86bec437abcb1ae566bc
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 14 18:00:53 2021 +0200

    gs-repos-dialog: Other repositories section not removed on reload
    
    When the reload had been requested, could be after a change in a Flatpak
    repositories, the other repositories section (related to fedora-third-party)
    was not removed, thus the reload duplicated it.

 src/gs-repos-dialog.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c
index 3853998b0..fc9365f2e 100644
--- a/src/gs-repos-dialog.c
+++ b/src/gs-repos-dialog.c
@@ -484,6 +484,7 @@ get_sources_cb (GsPluginLoader *plugin_loader,
                GtkWidget *row;
                g_autofree gchar *anchor = NULL;
                g_autofree gchar *hint = NULL;
+               g_autofree gchar *section_id = NULL;
 
                widget = gtk_switch_new ();
                gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
@@ -527,6 +528,10 @@ get_sources_cb (GsPluginLoader *plugin_loader,
                adw_preferences_page_add (ADW_PREFERENCES_PAGE (dialog->content_page),
                                          ADW_PREFERENCES_GROUP (widget));
 
+               /* use something unique, not clashing with the other section names */
+               section_id = g_strdup_printf ("fedora-third-party::1::%p", widget);
+               g_hash_table_insert (dialog->sections, g_steal_pointer (&section_id), widget);
+
                section = GS_REPOS_SECTION (gs_repos_section_new (dialog->plugin_loader, TRUE));
                gs_repos_section_set_sort_key (section, "900");
                g_signal_connect_object (section, "switch-clicked",
@@ -538,6 +543,10 @@ get_sources_cb (GsPluginLoader *plugin_loader,
                        gs_repos_section_add_repo (section, repo);
                }
 
+               /* use something unique, not clashing with the other section names */
+               section_id = g_strdup_printf ("fedora-third-party::2::%p", section);
+               g_hash_table_insert (dialog->sections, g_steal_pointer (&section_id), section);
+
                adw_preferences_page_add (ADW_PREFERENCES_PAGE (dialog->content_page),
                                          ADW_PREFERENCES_GROUP (section));
        }


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