[gnome-builder] empty-state: add pixel-size property



commit c8cface8a37c2d613d4457704f84a0fdac683c1f
Author: Christian Hergert <chergert redhat com>
Date:   Mon Oct 17 18:15:41 2016 -0700

    empty-state: add pixel-size property
    
    This can be used to tweak the icon size of the empty state.

 contrib/egg/egg-empty-state.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/contrib/egg/egg-empty-state.c b/contrib/egg/egg-empty-state.c
index c8bd85d..80efb79 100644
--- a/contrib/egg/egg-empty-state.c
+++ b/contrib/egg/egg-empty-state.c
@@ -38,6 +38,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (EggEmptyState, egg_empty_state, GTK_TYPE_BIN)
 enum {
   PROP_0,
   PROP_ICON_NAME,
+  PROP_PIXEL_SIZE,
   PROP_RESOURCE,
   PROP_SUBTITLE,
   PROP_TITLE,
@@ -145,6 +146,7 @@ egg_empty_state_get_property (GObject    *object,
                               GParamSpec *pspec)
 {
   EggEmptyState *self = EGG_EMPTY_STATE (object);
+  EggEmptyStatePrivate *priv = egg_empty_state_get_instance_private (self);
 
   switch (prop_id)
     {
@@ -152,6 +154,10 @@ egg_empty_state_get_property (GObject    *object,
       g_value_set_string (value, egg_empty_state_get_icon_name (self));
       break;
 
+    case PROP_PIXEL_SIZE:
+      g_value_set_int (value, gtk_image_get_pixel_size (priv->image));
+      break;
+
     case PROP_SUBTITLE:
       g_value_set_string (value, egg_empty_state_get_subtitle (self));
       break;
@@ -172,6 +178,7 @@ egg_empty_state_set_property (GObject      *object,
                               GParamSpec   *pspec)
 {
   EggEmptyState *self = EGG_EMPTY_STATE (object);
+  EggEmptyStatePrivate *priv = egg_empty_state_get_instance_private (self);
 
   switch (prop_id)
     {
@@ -179,6 +186,10 @@ egg_empty_state_set_property (GObject      *object,
       egg_empty_state_set_icon_name (self, g_value_get_string (value));
       break;
 
+    case PROP_PIXEL_SIZE:
+      gtk_image_set_pixel_size (priv->image, g_value_get_int (value));
+      break;
+
     case PROP_RESOURCE:
       egg_empty_state_set_resource (self, g_value_get_string (value));
       break;
@@ -212,6 +223,15 @@ egg_empty_state_class_init (EggEmptyStateClass *klass)
                          NULL,
                          (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
 
+  properties [PROP_PIXEL_SIZE] =
+    g_param_spec_int ("pixel-size",
+                      "Pixel Size",
+                      "Pixel Size",
+                      0,
+                      G_MAXINT,
+                      128,
+                      (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
   properties [PROP_RESOURCE] =
     g_param_spec_string ("resource",
                          "Resource",


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