[gnome-builder] empty-state: hide empty labels



commit 2e53e58d5d2e268b7dcd3932087c2414eddac1aa
Author: Christian Hergert <chergert redhat com>
Date:   Mon Oct 17 17:01:52 2016 -0700

    empty-state: hide empty labels
    
    This allows the empty state to be used with just a subtitle or just a
    title and get the sizing/alignment right.

 contrib/egg/egg-empty-state.c  |    2 ++
 contrib/egg/egg-empty-state.ui |    2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/contrib/egg/egg-empty-state.c b/contrib/egg/egg-empty-state.c
index 4bb83d8..c8bd85d 100644
--- a/contrib/egg/egg-empty-state.c
+++ b/contrib/egg/egg-empty-state.c
@@ -318,6 +318,7 @@ egg_empty_state_set_subtitle (EggEmptyState *self,
   if (g_strcmp0 (subtitle, egg_empty_state_get_subtitle (self)) != 0)
     {
       gtk_label_set_label (priv->subtitle, subtitle);
+      gtk_widget_set_visible (GTK_WIDGET (priv->subtitle), subtitle && *subtitle);
       g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SUBTITLE]);
     }
 }
@@ -343,6 +344,7 @@ egg_empty_state_set_title (EggEmptyState *self,
   if (g_strcmp0 (title, egg_empty_state_get_title (self)) != 0)
     {
       gtk_label_set_label (priv->title, title);
+      gtk_widget_set_visible (GTK_WIDGET (priv->title), title && *title);
       g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TITLE]);
     }
 }
diff --git a/contrib/egg/egg-empty-state.ui b/contrib/egg/egg-empty-state.ui
index a84a1dd..d0de349 100644
--- a/contrib/egg/egg-empty-state.ui
+++ b/contrib/egg/egg-empty-state.ui
@@ -18,7 +18,6 @@
         </child>
         <child>
           <object class="GtkLabel" id="title">
-            <property name="visible">true</property>
             <style>
               <class name="dim-label"/>
             </style>
@@ -30,7 +29,6 @@
         </child>
         <child>
           <object class="GtkLabel" id="subtitle">
-            <property name="visible">true</property>
             <property name="track-visited-links">false</property>
             <property name="use-markup">true</property>
             <property name="wrap">true</property>


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