mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
profiler: dont authorize during profiler startup
This should be done by sources, as there are configurations that will not require polkit communication and that can be frustrating when it happens.
This commit is contained in:
@ -535,27 +535,26 @@ sysprof_local_profiler_wait_cb (GObject *object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_local_profiler_authorize_cb (GObject *object,
|
sysprof_local_profiler_start (SysprofProfiler *profiler)
|
||||||
GAsyncResult *result,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
{
|
||||||
SysprofHelpers *helpers = (SysprofHelpers *)object;
|
SysprofLocalProfiler *self = (SysprofLocalProfiler *)profiler;
|
||||||
g_autoptr(SysprofLocalProfiler) self = user_data;
|
|
||||||
SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
|
SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
|
||||||
|
g_autoptr(SysprofControlSource) control_source = NULL;
|
||||||
g_autofree gchar *keydata = NULL;
|
g_autofree gchar *keydata = NULL;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
g_autoptr(GKeyFile) keyfile = NULL;
|
g_autoptr(GKeyFile) keyfile = NULL;
|
||||||
gsize keylen = 0;
|
gsize keylen = 0;
|
||||||
|
|
||||||
g_assert (SYSPROF_IS_HELPERS (helpers));
|
g_return_if_fail (SYSPROF_IS_LOCAL_PROFILER (self));
|
||||||
g_assert (G_IS_ASYNC_RESULT (result));
|
g_return_if_fail (priv->is_running == FALSE);
|
||||||
g_assert (SYSPROF_IS_LOCAL_PROFILER (self));
|
g_return_if_fail (priv->is_stopping == FALSE);
|
||||||
|
g_return_if_fail (priv->is_starting == FALSE);
|
||||||
|
|
||||||
if (!sysprof_helpers_authorize_finish (helpers, result, &error))
|
g_clear_pointer (&priv->timer, g_timer_destroy);
|
||||||
{
|
g_object_notify (G_OBJECT (self), "elapsed");
|
||||||
sysprof_profiler_emit_failed (SYSPROF_PROFILER (self), error);
|
|
||||||
return;
|
control_source = sysprof_control_source_new ();
|
||||||
}
|
sysprof_profiler_add_source (SYSPROF_PROFILER (self), SYSPROF_SOURCE (control_source));
|
||||||
|
|
||||||
keyfile = g_key_file_new ();
|
keyfile = g_key_file_new ();
|
||||||
|
|
||||||
@ -709,31 +708,6 @@ sysprof_local_profiler_authorize_cb (GObject *object,
|
|||||||
sysprof_local_profiler_finish_startup (self);
|
sysprof_local_profiler_finish_startup (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
sysprof_local_profiler_start (SysprofProfiler *profiler)
|
|
||||||
{
|
|
||||||
SysprofLocalProfiler *self = (SysprofLocalProfiler *)profiler;
|
|
||||||
SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
|
|
||||||
SysprofHelpers *helpers = sysprof_helpers_get_default ();
|
|
||||||
g_autoptr(SysprofControlSource) control_source = NULL;
|
|
||||||
|
|
||||||
g_return_if_fail (SYSPROF_IS_LOCAL_PROFILER (self));
|
|
||||||
g_return_if_fail (priv->is_running == FALSE);
|
|
||||||
g_return_if_fail (priv->is_stopping == FALSE);
|
|
||||||
g_return_if_fail (priv->is_starting == FALSE);
|
|
||||||
|
|
||||||
g_clear_pointer (&priv->timer, g_timer_destroy);
|
|
||||||
g_object_notify (G_OBJECT (self), "elapsed");
|
|
||||||
|
|
||||||
control_source = sysprof_control_source_new ();
|
|
||||||
sysprof_profiler_add_source (SYSPROF_PROFILER (self), SYSPROF_SOURCE (control_source));
|
|
||||||
|
|
||||||
sysprof_helpers_authorize_async (helpers,
|
|
||||||
NULL,
|
|
||||||
sysprof_local_profiler_authorize_cb,
|
|
||||||
g_object_ref (self));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_local_profiler_set_writer (SysprofProfiler *profiler,
|
sysprof_local_profiler_set_writer (SysprofProfiler *profiler,
|
||||||
SysprofCaptureWriter *writer)
|
SysprofCaptureWriter *writer)
|
||||||
|
|||||||
Reference in New Issue
Block a user