[sysprof] libsysprof-ui: only handle selected aids



commit 85f78a5838b404475526af4380f28bd6d4d5bd53
Author: Christian Hergert <chergert redhat com>
Date:   Sun May 19 22:53:03 2019 -0700

    libsysprof-ui: only handle selected aids

 src/libsysprof-ui/sysprof-aid-icon.c           | 8 ++++++++
 src/libsysprof-ui/sysprof-aid-icon.h           | 7 ++++---
 src/libsysprof-ui/sysprof-profiler-assistant.c | 7 +++++--
 3 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-aid-icon.c b/src/libsysprof-ui/sysprof-aid-icon.c
index 6ee91a7..5dc43fb 100644
--- a/src/libsysprof-ui/sysprof-aid-icon.c
+++ b/src/libsysprof-ui/sysprof-aid-icon.c
@@ -63,6 +63,14 @@ sysprof_aid_icon_new (SysprofAid *aid)
                        NULL);
 }
 
+gboolean
+sysprof_aid_icon_is_selected (SysprofAidIcon *self)
+{
+  g_return_val_if_fail (SYSPROF_IS_AID_ICON (self), FALSE);
+
+  return gtk_widget_get_visible (GTK_WIDGET (self->check));
+}
+
 /**
  * sysprof_aid_icon_get_aid:
  *
diff --git a/src/libsysprof-ui/sysprof-aid-icon.h b/src/libsysprof-ui/sysprof-aid-icon.h
index b49726b..20f53f6 100644
--- a/src/libsysprof-ui/sysprof-aid-icon.h
+++ b/src/libsysprof-ui/sysprof-aid-icon.h
@@ -31,8 +31,9 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (SysprofAidIcon, sysprof_aid_icon, SYSPROF, AID_ICON, GtkFlowBoxChild)
 
-GtkWidget  *sysprof_aid_icon_new     (SysprofAid     *aid);
-SysprofAid *sysprof_aid_icon_get_aid (SysprofAidIcon *self);
-void        sysprof_aid_icon_toggle  (SysprofAidIcon *self);
+GtkWidget  *sysprof_aid_icon_new         (SysprofAid     *aid);
+SysprofAid *sysprof_aid_icon_get_aid     (SysprofAidIcon *self);
+void        sysprof_aid_icon_toggle      (SysprofAidIcon *self);
+gboolean    sysprof_aid_icon_is_selected (SysprofAidIcon *self);
 
 G_END_DECLS
diff --git a/src/libsysprof-ui/sysprof-profiler-assistant.c b/src/libsysprof-ui/sysprof-profiler-assistant.c
index 5a96ace..ef22031 100644
--- a/src/libsysprof-ui/sysprof-profiler-assistant.c
+++ b/src/libsysprof-ui/sysprof-profiler-assistant.c
@@ -169,9 +169,12 @@ sysprof_profiler_assistant_foreach_cb (GtkWidget       *widget,
     }
   else if (SYSPROF_IS_AID_ICON (widget))
     {
-      SysprofAid *aid = sysprof_aid_icon_get_aid (SYSPROF_AID_ICON (widget));
+      if (sysprof_aid_icon_is_selected (SYSPROF_AID_ICON (widget)))
+        {
+          SysprofAid *aid = sysprof_aid_icon_get_aid (SYSPROF_AID_ICON (widget));
 
-      sysprof_aid_prepare (aid, profiler);
+          sysprof_aid_prepare (aid, profiler);
+        }
     }
 }
 


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