[gnome-initial-setup: 10/20] gis-page-header: Add a pixbuf property



commit 3126310e49e74d4981d8e3530d8276e8d36045da
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Feb 6 13:57:17 2020 +0000

    gis-page-header: Add a pixbuf property
    
    This accompanies the `icon-name` property, and allows a `GdkPixbuf` to
    be used to set the image in the header. It’s subject to the `show-icon`
    property just like `icon-name` is, and works like the corresponding
    `GtkImage` property.
    
    This should allow us to show the user avatar in the header on some
    pages, which should clarify which user those pages refers to, since it
    could get confusing when working with a child user account *and* a
    parent user account for parental controls.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 gnome-initial-setup/gis-page-header.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/gnome-initial-setup/gis-page-header.c b/gnome-initial-setup/gis-page-header.c
index cc73fe7..8da1ee4 100644
--- a/gnome-initial-setup/gis-page-header.c
+++ b/gnome-initial-setup/gis-page-header.c
@@ -31,6 +31,7 @@ enum {
   PROP_TITLE,
   PROP_SUBTITLE,
   PROP_ICON_NAME,
+  PROP_PIXBUF,
   PROP_SHOW_ICON,
   PROP_LAST,
 };
@@ -95,6 +96,10 @@ gis_page_header_get_property (GObject    *object,
       g_object_get_property (G_OBJECT (header->icon), "icon-name", value);
       break;
 
+    case PROP_PIXBUF:
+      g_object_get_property (G_OBJECT (header->icon), "pixbuf", value);
+      break;
+
     case PROP_SHOW_ICON:
       g_value_set_boolean (value, gtk_widget_get_visible (header->icon));
       break;
@@ -129,6 +134,10 @@ gis_page_header_set_property (GObject      *object,
       g_object_set_property (G_OBJECT (header->icon), "icon-name", value);
       break;
 
+    case PROP_PIXBUF:
+      g_object_set_property (G_OBJECT (header->icon), "pixbuf", value);
+      break;
+
     case PROP_SHOW_ICON:
       gtk_widget_set_visible (header->icon, g_value_get_boolean (value));
       break;
@@ -172,6 +181,12 @@ gis_page_header_class_init (GisPageHeaderClass *klass)
                          NULL,
                          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
+  obj_props[PROP_PIXBUF] =
+    g_param_spec_object ("pixbuf",
+                         "", "",
+                         GDK_TYPE_PIXBUF,
+                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
   obj_props[PROP_SHOW_ICON] =
     g_param_spec_boolean ("show-icon",
                           "", "",


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