[gtk/wip/exalm/subtitle] appchooserdialog: Don't show subtitle label when subtitle is null



commit 80867acf942336b82d1b324bd05c345236abd22a
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sat May 2 23:34:58 2020 +0500

    appchooserdialog: Don't show subtitle label when subtitle is null
    
    Looks like 67822d0c9a23f6db7e816fd6466720c167dcbe7f and
    3f1bd3722dd3374bef07346138a0ed9e95d3b9fe collided, and subtitle can be null
    now. Add a check so that we don't end up with empty label in that case.

 gtk/gtkappchooserdialog.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkappchooserdialog.c b/gtk/gtkappchooserdialog.c
index 5f1d6df068..9b5ef3180e 100644
--- a/gtk/gtkappchooserdialog.c
+++ b/gtk/gtkappchooserdialog.c
@@ -239,12 +239,15 @@ set_dialog_properties (GtkAppChooserDialog *self)
       gtk_widget_add_css_class (label, GTK_STYLE_CLASS_TITLE);
       gtk_widget_set_parent (label, box);
 
-      label = gtk_label_new (subtitle);
-      gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
-      gtk_label_set_single_line_mode (GTK_LABEL (label), TRUE);
-      gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
-      gtk_widget_add_css_class (label, GTK_STYLE_CLASS_SUBTITLE);
-      gtk_widget_set_parent (label, box);
+      if (subtitle)
+        {
+          label = gtk_label_new (subtitle);
+          gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
+          gtk_label_set_single_line_mode (GTK_LABEL (label), TRUE);
+          gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
+          gtk_widget_add_css_class (label, GTK_STYLE_CLASS_SUBTITLE);
+          gtk_widget_set_parent (label, box);
+        }
 
       gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header), box);
     }


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