[gnome-builder/wip/gtk4-port] plugins/support: port the support log plugin



commit 8f45f5ecf3153550b7f27fcf22efbb1a0186fc34
Author: Christian Hergert <chergert redhat com>
Date:   Tue Apr 19 10:44:24 2022 -0700

    plugins/support: port the support log plugin

 src/plugins/meson.build                            |  2 +-
 .../support/ide-support-application-addin.c        |  6 ++--
 src/plugins/support/ide-support.c                  | 41 ++++------------------
 3 files changed, 11 insertions(+), 38 deletions(-)
---
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index 2fbaeacf6..c19478b57 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -123,7 +123,7 @@ subdir('rust-analyzer')
 subdir('spellcheck')
 subdir('stylelint')
 #subdir('sublime')
-#subdir('support')
+subdir('support')
 #subdir('symbol-tree')
 #subdir('sysprof')
 subdir('sysroot')
diff --git a/src/plugins/support/ide-support-application-addin.c 
b/src/plugins/support/ide-support-application-addin.c
index 1b11db2e3..216b076c4 100644
--- a/src/plugins/support/ide-support-application-addin.c
+++ b/src/plugins/support/ide-support-application-addin.c
@@ -94,10 +94,10 @@ generate_support_activate (GSimpleAction              *action,
                                    GTK_BUTTONS_CLOSE,
                                    "%s", text);
   gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-  g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-  ide_gtk_window_present (GTK_WINDOW (dialog));
+  g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
+  gtk_window_present (GTK_WINDOW (dialog));
 
-  dzl_file_manager_show (file, NULL);
+  ide_file_manager_show (file, NULL);
 
 cleanup:
   g_free (text);
diff --git a/src/plugins/support/ide-support.c b/src/plugins/support/ide-support.c
index aa2bcb4e6..89c94b7db 100644
--- a/src/plugins/support/ide-support.c
+++ b/src/plugins/support/ide-support.c
@@ -22,39 +22,21 @@
 
 #include "config.h"
 
-#include <dazzle.h>
 #include <gtk/gtk.h>
-#include <libide-gui.h>
-#include <ide-build-ident.h>
 #include <libpeas/peas.h>
 #include <string.h>
 
-#include "ide-support.h"
-
-static gchar *
-str_to_key (const gchar *str)
-{
-  return g_strdelimit (g_strdup (str), " ", '_');
-}
-
-static void
-counter_arena_foreach_cb (DzlCounter *counter,
-                          gpointer    user_data)
-{
-  GString *str = (GString *)user_data;
-  g_autofree gchar *category = str_to_key (counter->category);
-  g_autofree gchar *name = str_to_key (counter->name);
+#include <libide-gui.h>
+#include <ide-build-ident.h>
 
-  g_string_append_printf (str,
-                          "%s.%s = %"G_GINT64_FORMAT"\n",
-                          category, name, dzl_counter_get (counter));
-}
+#include "ide-support.h"
 
 gchar *
 ide_get_support_log (void)
 {
   PeasEngine *engine = peas_engine_get_default ();
   const GList *plugins;
+  GListModel *monitors;
   GChecksum *checksum;
   GDateTime *now;
   GDateTime *started_at;
@@ -126,14 +108,14 @@ ide_get_support_log (void)
   g_string_append (str, "[runtime.display]\n");
   g_string_append_printf (str, "name = \"%s\"\n", gdk_display_get_name (display));
 
-  n_monitors = gdk_display_get_n_monitors (display);
+  monitors = gdk_display_get_monitors (display);
+  n_monitors = g_list_model_get_n_items (monitors);
   g_string_append_printf (str, "n_monitors = %u\n", n_monitors);
   for (i = 0; i < n_monitors; i++)
     {
-      GdkMonitor *monitor;
+      g_autoptr(GdkMonitor) monitor = g_list_model_get_item (monitors, i);
       GdkRectangle geom;
 
-      monitor = gdk_display_get_monitor (display, i);
       gdk_monitor_get_geometry (monitor, &geom);
       g_string_append_printf (str, "geometry[%u] = [%u,%u]\n",
                               i, geom.width, geom.height);
@@ -180,15 +162,6 @@ ide_get_support_log (void)
       g_free (key);
     }
   g_strfreev (env);
-  g_string_append (str, "\n");
-
-  /*
-   * Log the counters.
-   */
-  g_string_append (str, "[runtime.counters]\n");
-  dzl_counter_arena_foreach (dzl_counter_arena_get_default (),
-                             counter_arena_foreach_cb, str);
-
   g_string_append (str, "\n\n");
 
   /*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]