[gnome-builder] workbench: add helper to show debug counters
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] workbench: add helper to show debug counters
- Date: Wed, 14 Jun 2017 08:21:50 +0000 (UTC)
commit 01235c5fac059f90b87978912fa9e61c060b367e
Author: Christian Hergert <chergert redhat com>
Date: Wed Jun 14 01:21:38 2017 -0700
workbench: add helper to show debug counters
This shows a window when the "counters" action is activated that gives us
access to the debug counters within Builder.
libide/workbench/ide-workbench-actions.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/libide/workbench/ide-workbench-actions.c b/libide/workbench/ide-workbench-actions.c
index e08834f..b10e3cb 100644
--- a/libide/workbench/ide-workbench-actions.c
+++ b/libide/workbench/ide-workbench-actions.c
@@ -18,7 +18,9 @@
#define G_LOG_DOMAIN "ide-workbench"
+#include <dazzle.h>
#include <glib/gi18n.h>
+#include <unistd.h>
#include "ide-debug.h"
@@ -196,6 +198,32 @@ ide_workbench_actions_global_search (GSimpleAction *action,
ide_workbench_header_bar_focus_search (self->header_bar);
}
+static void
+ide_workbench_actions_counters (GSimpleAction *action,
+ GVariant *variant,
+ gpointer user_data)
+{
+ IdeWorkbench *self = user_data;
+ DzlCounterArena *arena;
+ GtkWindow *window;
+
+ g_assert (G_IS_SIMPLE_ACTION (action));
+ g_assert (IDE_IS_WORKBENCH (self));
+
+ arena = dzl_counter_arena_new_for_pid (getpid ());
+ window = g_object_new (DZL_TYPE_COUNTERS_WINDOW,
+ "title", _("Builder Statistics"),
+ "default-width", 800,
+ "default-height", 600,
+ "transient-for", self,
+ "modal", FALSE,
+ NULL);
+ dzl_counters_window_set_arena (DZL_COUNTERS_WINDOW (window), arena);
+ gtk_window_present (window);
+
+ dzl_counter_arena_unref (arena);
+}
+
void
ide_workbench_actions_init (IdeWorkbench *self)
{
@@ -206,6 +234,7 @@ ide_workbench_actions_init (IdeWorkbench *self)
{ "open-with-dialog", ide_workbench_actions_open_with_dialog },
{ "save-all", ide_workbench_actions_save_all },
{ "save-all-quit", ide_workbench_actions_save_all_quit },
+ { "counters", ide_workbench_actions_counters },
};
g_action_map_add_action_entries (G_ACTION_MAP (self), actions, G_N_ELEMENTS (actions), self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]