[gnome-software: 1/2] repos-dialog: Correctly set section descriptions




commit ae7fa43f904e6d7dc02bbbdf694fd309f9c1110f
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Wed Aug 11 13:02:27 2021 +0200

    repos-dialog: Correctly set section descriptions

 src/gs-repos-dialog.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)
---
diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c
index 2662a70af..4b85b4efb 100644
--- a/src/gs-repos-dialog.c
+++ b/src/gs-repos-dialog.c
@@ -474,8 +474,6 @@ get_sources_cb (GsPluginLoader *plugin_loader,
 
        if (other_repos) {
                GsReposSection *section;
-               GtkWidget *label;
-               GtkStyleContext *style;
                g_autofree gchar *anchor = NULL;
                g_autofree gchar *hint = NULL;
 
@@ -499,21 +497,13 @@ get_sources_cb (GsPluginLoader *plugin_loader,
                                _("Additional repositories from selected third parties — %s."),
                                anchor);
 
-               label = gtk_label_new ("");
-               g_object_set (G_OBJECT (label),
-                             "halign", GTK_ALIGN_START,
-                             "hexpand", TRUE,
-                             "label", hint,
-                             "use-markup", TRUE,
-                             "visible", TRUE,
-                             "wrap", TRUE,
-                             "xalign", 0.0,
-                             NULL);
-               style = gtk_widget_get_style_context (label);
-               gtk_style_context_add_class (style, "dim-label");
-
-               gtk_box_pack_start (GTK_BOX (section), label, FALSE, TRUE, 0);
-               gtk_box_reorder_child (GTK_BOX (section), label, 1);
+/* HdyPreferencesGroup:use-markup doesn't exist before 1.4, configurations where
+ * GNOME 41 will be used and Libhandy 1.4 won't be available are unlikely, so
+ * let's just ignore the description in such cases. */
+#if HDY_CHECK_VERSION(1, 4, 0)
+               hdy_preferences_group_set_description (HDY_PREFERENCES_GROUP (section), hint);
+               hdy_preferences_group_set_use_markup (HDY_PREFERENCES_GROUP (section), TRUE);
+#endif
 
                for (GSList *link = other_repos; link; link = g_slist_next (link)) {
                        GsApp *repo = link->data;


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