mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 15:40:53 +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]);
|
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;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
|
void (*prepare) (SysprofAid *self,
|
||||||
|
SysprofProfiler *profiler);
|
||||||
|
|
||||||
/*< gpointer >*/
|
/*< gpointer >*/
|
||||||
gpointer _reserved[16];
|
gpointer _reserved[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
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
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
void sysprof_aid_set_display_name (SysprofAid *self,
|
void sysprof_aid_set_display_name (SysprofAid *self,
|
||||||
const gchar *display_name);
|
const gchar *display_name);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
GIcon *sysprof_aid_get_icon (SysprofAid *self);
|
GIcon *sysprof_aid_get_icon (SysprofAid *self);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
void sysprof_aid_set_icon (SysprofAid *self,
|
void sysprof_aid_set_icon (SysprofAid *self,
|
||||||
GIcon *icon);
|
GIcon *icon);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
void sysprof_aid_set_icon_name (SysprofAid *self,
|
void sysprof_aid_set_icon_name (SysprofAid *self,
|
||||||
const gchar *icon_name);
|
const gchar *icon_name);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
void sysprof_aid_prepare (SysprofAid *self,
|
||||||
|
SysprofProfiler *profiler);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
@ -48,9 +48,25 @@ sysprof_cpu_aid_new (void)
|
|||||||
return g_object_new (SYSPROF_TYPE_CPU_AID, NULL);
|
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
|
static void
|
||||||
sysprof_cpu_aid_class_init (SysprofCpuAidClass *klass)
|
sysprof_cpu_aid_class_init (SysprofCpuAidClass *klass)
|
||||||
{
|
{
|
||||||
|
SysprofAidClass *aid_class = SYSPROF_AID_CLASS (klass);
|
||||||
|
|
||||||
|
aid_class->prepare = sysprof_cpu_aid_prepare;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@ -166,6 +166,12 @@ sysprof_profiler_assistant_foreach_cb (GtkWidget *widget,
|
|||||||
|
|
||||||
sysprof_profiler_add_pid (profiler, pid);
|
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
|
static void
|
||||||
@ -221,6 +227,9 @@ sysprof_profiler_assistant_record_clicked_cb (SysprofProfilerAssistant *self,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Now allow the aids to add their sources */
|
/* 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);
|
g_signal_emit (self, signals [START_RECORDING], 0, profiler);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user