[gnome-software: 4/7] repos-dialog: Use HdyPreferencesPage




commit a9ccaa8d636b69627d0e6d5bd1453db688d02ffb
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Fri Jul 30 09:12:13 2021 +0200

    repos-dialog: Use HdyPreferencesPage
    
    This makes the code simpler and the UI more in line with the rest of
    GNOME.

 src/gs-repos-dialog.c  | 12 ++++++------
 src/gs-repos-dialog.ui | 17 +----------------
 2 files changed, 7 insertions(+), 22 deletions(-)
---
diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c
index 554d7d61b..bbb8bd5af 100644
--- a/src/gs-repos-dialog.c
+++ b/src/gs-repos-dialog.c
@@ -32,7 +32,7 @@ struct _GsReposDialog
        GsPluginLoader  *plugin_loader;
        GtkWidget       *status_empty;
        GtkWidget       *label_header;
-       GtkWidget       *content_box;
+       GtkWidget       *content_page;
        GtkWidget       *spinner;
        GtkWidget       *stack;
 };
@@ -418,7 +418,7 @@ get_sources_cb (GsPluginLoader *plugin_loader,
 
        /* remove previous */
        g_hash_table_remove_all (dialog->sections);
-       gs_container_remove_all (GTK_CONTAINER (dialog->content_box));
+       gs_container_remove_all (GTK_CONTAINER (dialog->content_page));
 
        /* stop the spinner */
        gs_stop_spinner (GTK_SPINNER (dialog->spinner));
@@ -445,10 +445,10 @@ get_sources_cb (GsPluginLoader *plugin_loader,
        sections = g_list_sort (sections, repos_dialog_compare_sections_cb);
        for (GList *link = sections; link; link = g_list_next (link)) {
                GtkWidget *section = link->data;
-               gtk_container_add (GTK_CONTAINER (dialog->content_box), section);
+               gtk_container_add (GTK_CONTAINER (dialog->content_page), section);
        }
 
-       gtk_widget_set_visible (dialog->content_box, sections != NULL);
+       gtk_widget_set_visible (dialog->content_page, sections != NULL);
 
        if (other_repos) {
                GsReposSection *section;
@@ -498,7 +498,7 @@ get_sources_cb (GsPluginLoader *plugin_loader,
                        gs_repos_section_add_repo (section, repo);
                }
 
-               gtk_container_add (GTK_CONTAINER (dialog->content_box), GTK_WIDGET (section));
+               gtk_container_add (GTK_CONTAINER (dialog->content_page), GTK_WIDGET (section));
        }
 }
 
@@ -680,7 +680,7 @@ gs_repos_dialog_class_init (GsReposDialogClass *klass)
 
        gtk_widget_class_bind_template_child (widget_class, GsReposDialog, status_empty);
        gtk_widget_class_bind_template_child (widget_class, GsReposDialog, label_header);
-       gtk_widget_class_bind_template_child (widget_class, GsReposDialog, content_box);
+       gtk_widget_class_bind_template_child (widget_class, GsReposDialog, content_page);
        gtk_widget_class_bind_template_child (widget_class, GsReposDialog, spinner);
        gtk_widget_class_bind_template_child (widget_class, GsReposDialog, stack);
 }
diff --git a/src/gs-repos-dialog.ui b/src/gs-repos-dialog.ui
index 543e3e9ae..6857b7ade 100644
--- a/src/gs-repos-dialog.ui
+++ b/src/gs-repos-dialog.ui
@@ -57,23 +57,8 @@
               </packing>
             </child>
             <child>
-              <object class="GtkScrolledWindow" id="scrolledwindow">
+              <object class="HdyPreferencesPage" id="content_page">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hscrollbar_policy">never</property>
-                <property name="vscrollbar_policy">automatic</property>
-                <property name="shadow_type">none</property>
-                <child>
-                  <object class="GtkBox" id="content_box">
-                    <property name="visible">True</property>
-                    <property name="margin_start">52</property>
-                    <property name="margin_end">52</property>
-                    <property name="margin_top">32</property>
-                    <property name="margin_bottom">40</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">20</property>
-                  </object>
-                </child>
               </object>
               <packing>
                 <property name="name">sources</property>


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