[gnome-builder/gnome-builder-43] plugins/sysprof: proxy sysprof messages to notification
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-43] plugins/sysprof: proxy sysprof messages to notification
- Date: Thu, 22 Sep 2022 00:35:12 +0000 (UTC)
commit 4067878be83e2a8609fba311f6612ffb14b15123
Author: Christian Hergert <chergert redhat com>
Date: Wed Sep 21 17:28:21 2022 -0700
plugins/sysprof: proxy sysprof messages to notification
This was missed during the port, but the goal here is to elevate some
messages about the decoding process back to the application. It still
needs some fixes on the sysprof-agent side though.
src/plugins/sysprof/gbp-sysprof-tool.c | 53 ++++++++++++++++++++++++++++++++--
1 file changed, 51 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/sysprof/gbp-sysprof-tool.c b/src/plugins/sysprof/gbp-sysprof-tool.c
index 4b30e0840..59b756706 100644
--- a/src/plugins/sysprof/gbp-sysprof-tool.c
+++ b/src/plugins/sysprof/gbp-sysprof-tool.c
@@ -22,7 +22,9 @@
#include "config.h"
+#include <glib/gi18n.h>
#include <glib/gstdio.h>
+
#include <unistd.h>
#include <libide-gui.h>
@@ -50,6 +52,9 @@ struct _GbpSysprofTool
/* IPC service on @connection */
IpcAgent *sysprof;
+
+ /* Notification for status */
+ IdeNotification *notif;
};
G_DEFINE_FINAL_TYPE (GbpSysprofTool, gbp_sysprof_tool, IDE_TYPE_RUN_TOOL)
@@ -258,6 +263,25 @@ gbp_sysprof_tool_send_signal (IdeRunTool *run_tool,
IDE_EXIT;
}
+static void
+proxy_log_to_notif (IpcAgent *sysprof,
+ const char *message,
+ IdeNotification *notif)
+{
+ g_autofree char *title = NULL;
+
+ g_assert (IPC_IS_AGENT (sysprof));
+ g_assert (IDE_IS_NOTIFICATION (notif));
+
+ if (ide_str_empty0 (message))
+ return;
+
+ title = g_strdup_printf ("Sysprof: %s", message);
+
+ ide_notification_set_title (notif, title);
+ ide_object_message (IDE_OBJECT (notif), "%s", title);
+}
+
static void
gbp_sysprof_tool_started (IdeRunTool *run_tool,
IdeSubprocess *subprocess)
@@ -273,6 +297,19 @@ gbp_sysprof_tool_started (IdeRunTool *run_tool,
g_assert (GBP_IS_SYSPROF_TOOL (self));
g_assert (IDE_IS_SUBPROCESS (subprocess));
+ if (self->notif)
+ {
+ ide_notification_withdraw (self->notif);
+ g_clear_object (&self->notif);
+ }
+
+ self->notif = ide_notification_new ();
+ ide_notification_set_title (self->notif, _("Profiling Application…"));
+ ide_notification_set_body (self->notif, _("Symbol decoding will begin after application exits"));
+ ide_notification_set_icon_name (self->notif, "builder-profiler-symbolic");
+ ide_notification_set_urgent (self->notif, TRUE);
+ ide_notification_attach (self->notif, IDE_OBJECT (self));
+
g_set_object (&self->subprocess, subprocess);
if (self->io_stream == NULL)
@@ -293,8 +330,8 @@ gbp_sysprof_tool_started (IdeRunTool *run_tool,
}
sysprof = ipc_agent_proxy_new_sync (connection,
- G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
- NULL, "/", NULL, &error);
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+ NULL, "/", NULL, &error);
if (sysprof == NULL)
{
@@ -303,6 +340,12 @@ gbp_sysprof_tool_started (IdeRunTool *run_tool,
IDE_EXIT;
}
+ g_signal_connect_object (sysprof,
+ "log",
+ G_CALLBACK (proxy_log_to_notif),
+ self->notif,
+ 0);
+
g_debug ("Control proxy to subprocess created");
g_set_object (&self->sysprof, sysprof);
g_set_object (&self->connection, connection);
@@ -353,6 +396,12 @@ gbp_sysprof_tool_stopped (IdeRunTool *run_tool)
g_clear_object (&self->connection);
g_clear_object (&self->io_stream);
+ if (self->notif)
+ {
+ ide_notification_withdraw (self->notif);
+ g_clear_object (&self->notif);
+ }
+
IDE_EXIT;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]