[sysprof] libsysprof-ui: add selected property to icon



commit ace73a6f51a0ddd11ebe43e07011342220f47fb0
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jun 7 00:15:00 2019 -0700

    libsysprof-ui: add selected property to icon

 src/libsysprof-ui/sysprof-aid-icon.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
---
diff --git a/src/libsysprof-ui/sysprof-aid-icon.c b/src/libsysprof-ui/sysprof-aid-icon.c
index 5dc43fb..eba2b4f 100644
--- a/src/libsysprof-ui/sysprof-aid-icon.c
+++ b/src/libsysprof-ui/sysprof-aid-icon.c
@@ -41,6 +41,7 @@ G_DEFINE_TYPE (SysprofAidIcon, sysprof_aid_icon, GTK_TYPE_FLOW_BOX_CHILD)
 enum {
   PROP_0,
   PROP_AID,
+  PROP_SELECTED,
   N_PROPS
 };
 
@@ -129,6 +130,10 @@ sysprof_aid_icon_get_property (GObject    *object,
       g_value_set_object (value, sysprof_aid_icon_get_aid (self));
       break;
 
+    case PROP_SELECTED:
+      g_value_set_boolean (value, gtk_widget_get_visible (GTK_WIDGET (self->check)));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -148,6 +153,10 @@ sysprof_aid_icon_set_property (GObject      *object,
       sysprof_aid_icon_set_aid (self, g_value_get_object (value));
       break;
 
+    case PROP_SELECTED:
+      gtk_widget_set_visible (GTK_WIDGET (self->check), g_value_get_boolean (value));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -170,6 +179,13 @@ sysprof_aid_icon_class_init (SysprofAidIconClass *klass)
                          SYSPROF_TYPE_AID,
                          (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
 
+  properties [PROP_SELECTED] =
+    g_param_spec_boolean ("selected",
+                          "Selected",
+                          "If the item is selected",
+                          FALSE,
+                          (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
   g_object_class_install_properties (object_class, N_PROPS, properties);
 
   gtk_widget_class_set_css_name (widget_class, "sysprofaidicon");


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