[libadwaita/wip/exalm/status-page: 2/2] status-page: Make icon optional




commit d100c052e924d33df3f7c8adad58be9cf14e29f2
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Aug 2 22:44:17 2021 +0500

    status-page: Make icon optional
    
    Some of the views in 
https://gitlab.gnome.org/Teams/Design/app-mockups/-/blob/master/patterns/patterns-aday.png
    have status pages with no icons, let's support that.

 src/adw-status-page.c  | 3 +--
 src/adw-status-page.ui | 6 +++++-
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/adw-status-page.c b/src/adw-status-page.c
index 22209642..9d5a441e 100644
--- a/src/adw-status-page.c
+++ b/src/adw-status-page.c
@@ -310,8 +310,7 @@ adw_status_page_set_icon_name (AdwStatusPage *self,
   g_free (self->icon_name);
   self->icon_name = g_strdup (icon_name);
 
-  gtk_image_set_from_icon_name (self->image,
-                                icon_name ? icon_name : "image-missing");
+  gtk_image_set_from_icon_name (self->image, icon_name);
 
   g_object_notify_by_pspec (G_OBJECT (self), props[PROP_ICON_NAME]);
 }
diff --git a/src/adw-status-page.ui b/src/adw-status-page.ui
index 9a48fffa..ccc93754 100644
--- a/src/adw-status-page.ui
+++ b/src/adw-status-page.ui
@@ -22,7 +22,11 @@
                         <child>
                           <object class="GtkImage" id="image">
                             <property name="pixel-size">128</property>
-                            <property name="icon-name">image-missing</property>
+                            <binding name="visible">
+                              <closure function="string_is_not_empty" type="gboolean">
+                                <lookup name="icon-name">image</lookup>
+                              </closure>
+                            </binding>
                             <style>
                               <class name="icon"/>
                             </style>


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