[sysprof] libsysprof-ui: tweak empty state and add icon-name property



commit 9cded24b70ea3c1199699360c4e47eec72ca1b53
Author: Christian Hergert <chergert redhat com>
Date:   Wed May 15 17:19:10 2019 -0700

    libsysprof-ui: tweak empty state and add icon-name property

 src/libsysprof-ui/sysprof-empty-state-view.c     | 38 +++++++++++++++---------
 src/libsysprof-ui/ui/sysprof-empty-state-view.ui |  4 +--
 2 files changed, 26 insertions(+), 16 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-empty-state-view.c b/src/libsysprof-ui/sysprof-empty-state-view.c
index 484b93c..9b878d2 100644
--- a/src/libsysprof-ui/sysprof-empty-state-view.c
+++ b/src/libsysprof-ui/sysprof-empty-state-view.c
@@ -28,6 +28,7 @@
 
 typedef struct
 {
+  GtkImage *image;
   GtkLabel *title;
   GtkLabel *subtitle;
 } SysprofEmptyStateViewPrivate;
@@ -38,6 +39,7 @@ enum {
   PROP_0,
   PROP_TITLE,
   PROP_SUBTITLE,
+  PROP_ICON_NAME,
   N_PROPS
 };
 
@@ -51,9 +53,9 @@ sysprof_empty_state_view_new (void)
 
 static gboolean
 sysprof_empty_state_view_action (GtkWidget   *widget,
-                            const gchar *prefix,
-                            const gchar *action_name,
-                            GVariant    *parameter)
+                                 const gchar *prefix,
+                                 const gchar *action_name,
+                                 GVariant    *parameter)
 {
   GtkWidget *toplevel;
   GApplication *app;
@@ -97,8 +99,8 @@ sysprof_empty_state_view_action (GtkWidget   *widget,
 
 static gboolean
 sysprof_empty_state_view_activate_link (SysprofEmptyStateView *self,
-                                   const gchar      *uri,
-                                   GtkLabel         *label)
+                                        const gchar           *uri,
+                                        GtkLabel              *label)
 {
   g_assert (SYSPROF_IS_EMPTY_STATE_VIEW (self));
   g_assert (uri != NULL);
@@ -143,15 +145,21 @@ sysprof_empty_state_view_activate_link (SysprofEmptyStateView *self,
 
 static void
 sysprof_empty_state_view_set_property (GObject      *object,
-                                  guint         prop_id,
-                                  const GValue *value,
-                                  GParamSpec   *pspec)
+                                       guint         prop_id,
+                                       const GValue *value,
+                                       GParamSpec   *pspec)
 {
   SysprofEmptyStateView *self = SYSPROF_EMPTY_STATE_VIEW (object);
   SysprofEmptyStateViewPrivate *priv = sysprof_empty_state_view_get_instance_private (self);
 
   switch (prop_id)
     {
+    case PROP_ICON_NAME:
+      g_object_set (priv->image,
+                    "icon-name", g_value_get_string (value),
+                    NULL);
+      break;
+
     case PROP_TITLE:
       gtk_label_set_label (priv->title, g_value_get_string (value));
       break;
@@ -173,17 +181,18 @@ sysprof_empty_state_view_class_init (SysprofEmptyStateViewClass *klass)
 
   object_class->set_property = sysprof_empty_state_view_set_property;
 
-  properties [PROP_TITLE] =
-    g_param_spec_string ("title",
-                         NULL,
+  properties [PROP_ICON_NAME] =
+    g_param_spec_string ("icon-name", NULL, NULL,
                          NULL,
+                         (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
+
+  properties [PROP_TITLE] =
+    g_param_spec_string ("title", NULL, NULL,
                          NULL,
                          (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
 
   properties [PROP_SUBTITLE] =
-    g_param_spec_string ("subtitle",
-                         NULL,
-                         NULL,
+    g_param_spec_string ("subtitle", NULL, NULL,
                          NULL,
                          (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
 
@@ -192,6 +201,7 @@ sysprof_empty_state_view_class_init (SysprofEmptyStateViewClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/sysprof/ui/sysprof-empty-state-view.ui");
   gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, subtitle);
   gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, title);
+  gtk_widget_class_bind_template_child_private (widget_class, SysprofEmptyStateView, image);
 }
 
 static void
diff --git a/src/libsysprof-ui/ui/sysprof-empty-state-view.ui 
b/src/libsysprof-ui/ui/sysprof-empty-state-view.ui
index 532bb0d..1e26551 100644
--- a/src/libsysprof-ui/ui/sysprof-empty-state-view.ui
+++ b/src/libsysprof-ui/ui/sysprof-empty-state-view.ui
@@ -8,9 +8,9 @@
         <property name="spacing">12</property>
         <property name="visible">true</property>
         <child type="center">
-          <object class="GtkImage">
+          <object class="GtkImage" id="image">
             <property name="icon-name">org.gnome.Sysprof-symbolic</property>
-            <property name="pixel-size">256</property>
+            <property name="pixel-size">192</property>
             <property name="visible">true</property>
             <style>
               <class name="dim-label"/>


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