[gnome-software/801-gs-repos-dialog-hide-empty-frame] gs-repos-dialog: Hide empty frame



commit 63b8bb6524483ea603619178bdf12636b37067ff
Author: Milan Crha <mcrha redhat com>
Date:   Thu Dec 3 17:19:11 2020 +0100

    gs-repos-dialog: Hide empty frame
    
    Hide the repositories frame, when it contains no repository, to not
    clutter the GUI with a frame line.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/801
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/559

 src/gs-repos-dialog.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c
index 53bbf2f3..f1c766be 100644
--- a/src/gs-repos-dialog.c
+++ b/src/gs-repos-dialog.c
@@ -28,6 +28,7 @@ struct _GsReposDialog
 
        GCancellable    *cancellable;
        GsPluginLoader  *plugin_loader;
+       GtkWidget       *frame;
        GtkWidget       *frame_third_party;
        GtkWidget       *label_description;
        GtkWidget       *label_empty;
@@ -569,6 +570,9 @@ get_sources_cb (GsPluginLoader *plugin_loader,
                app = gs_app_list_index (list, i);
                add_repo (dialog, app);
        }
+
+       gtk_widget_set_visible (dialog->frame,
+               gtk_list_box_get_row_at_index (GTK_LIST_BOX (dialog->listbox), 0) != NULL);
 }
 
 static void
@@ -859,6 +863,7 @@ gs_repos_dialog_class_init (GsReposDialogClass *klass)
 
        gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Software/gs-repos-dialog.ui");
 
+       gtk_widget_class_bind_template_child (widget_class, GsReposDialog, frame);
        gtk_widget_class_bind_template_child (widget_class, GsReposDialog, frame_third_party);
        gtk_widget_class_bind_template_child (widget_class, GsReposDialog, label_description);
        gtk_widget_class_bind_template_child (widget_class, GsReposDialog, label_empty);


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