mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-ui: add hostinfo source when cpu is selected
This commit is contained in:
@ -222,3 +222,14 @@ sysprof_aid_set_display_name (SysprofAid *self,
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_DISPLAY_NAME]);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
sysprof_aid_prepare (SysprofAid *self,
|
||||
SysprofProfiler *profiler)
|
||||
{
|
||||
g_return_if_fail (SYSPROF_IS_AID (self));
|
||||
g_return_if_fail (SYSPROF_IS_PROFILER (profiler));
|
||||
|
||||
if (SYSPROF_AID_GET_CLASS (self)->prepare)
|
||||
SYSPROF_AID_GET_CLASS (self)->prepare (self, profiler);
|
||||
}
|
||||
|
||||
@ -38,22 +38,28 @@ struct _SysprofAidClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (*prepare) (SysprofAid *self,
|
||||
SysprofProfiler *profiler);
|
||||
|
||||
/*< gpointer >*/
|
||||
gpointer _reserved[16];
|
||||
};
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
const gchar *sysprof_aid_get_display_name (SysprofAid *self);
|
||||
const gchar *sysprof_aid_get_display_name (SysprofAid *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_aid_set_display_name (SysprofAid *self,
|
||||
const gchar *display_name);
|
||||
void sysprof_aid_set_display_name (SysprofAid *self,
|
||||
const gchar *display_name);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
GIcon *sysprof_aid_get_icon (SysprofAid *self);
|
||||
GIcon *sysprof_aid_get_icon (SysprofAid *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_aid_set_icon (SysprofAid *self,
|
||||
GIcon *icon);
|
||||
void sysprof_aid_set_icon (SysprofAid *self,
|
||||
GIcon *icon);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_aid_set_icon_name (SysprofAid *self,
|
||||
const gchar *icon_name);
|
||||
void sysprof_aid_set_icon_name (SysprofAid *self,
|
||||
const gchar *icon_name);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_aid_prepare (SysprofAid *self,
|
||||
SysprofProfiler *profiler);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -48,9 +48,25 @@ sysprof_cpu_aid_new (void)
|
||||
return g_object_new (SYSPROF_TYPE_CPU_AID, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_cpu_aid_prepare (SysprofAid *self,
|
||||
SysprofProfiler *profiler)
|
||||
{
|
||||
g_autoptr(SysprofSource) source = NULL;
|
||||
|
||||
g_assert (SYSPROF_IS_CPU_AID (self));
|
||||
g_assert (SYSPROF_IS_PROFILER (profiler));
|
||||
|
||||
source = sysprof_hostinfo_source_new ();
|
||||
sysprof_profiler_add_source (profiler, source);
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_cpu_aid_class_init (SysprofCpuAidClass *klass)
|
||||
{
|
||||
SysprofAidClass *aid_class = SYSPROF_AID_CLASS (klass);
|
||||
|
||||
aid_class->prepare = sysprof_cpu_aid_prepare;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -166,6 +166,12 @@ sysprof_profiler_assistant_foreach_cb (GtkWidget *widget,
|
||||
|
||||
sysprof_profiler_add_pid (profiler, pid);
|
||||
}
|
||||
else if (SYSPROF_IS_AID_ICON (widget))
|
||||
{
|
||||
SysprofAid *aid = sysprof_aid_icon_get_aid (SYSPROF_AID_ICON (widget));
|
||||
|
||||
sysprof_aid_prepare (aid, profiler);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -221,6 +227,9 @@ sysprof_profiler_assistant_record_clicked_cb (SysprofProfilerAssistant *self,
|
||||
#endif
|
||||
|
||||
/* Now allow the aids to add their sources */
|
||||
gtk_container_foreach (GTK_CONTAINER (self->aid_flow_box),
|
||||
(GtkCallback) sysprof_profiler_assistant_foreach_cb,
|
||||
profiler);
|
||||
|
||||
g_signal_emit (self, signals [START_RECORDING], 0, profiler);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user