[gnome-builder] plugins/support: port to GTK 4



commit 4b0bc262f44699cd3b716ce6a6ffcc78d8323e7e
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 11 23:19:14 2022 -0700

    plugins/support: port to GTK 4

 src/plugins/support/gtk/menus.ui                   |  5 ++-
 .../support/ide-support-application-addin.c        |  6 ++--
 src/plugins/support/ide-support.c                  | 41 ++++------------------
 3 files changed, 12 insertions(+), 40 deletions(-)
---
diff --git a/src/plugins/support/gtk/menus.ui b/src/plugins/support/gtk/menus.ui
index 26bfa30af..f1a4f619d 100644
--- a/src/plugins/support/gtk/menus.ui
+++ b/src/plugins/support/gtk/menus.ui
@@ -1,10 +1,9 @@
 <?xml version="1.0"?>
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
   <menu id="ide-primary-workspace-menu">
-    <section id="ide-primary-workspace-menu-placeholder3">
+    <section id="ide-primary-workspace-menu-placeholder2">
       <item>
-        <attribute name="label" translatable="yes">Generate Support Log</attribute>
+        <attribute name="label" translatable="yes">Generate Support Log…</attribute>
         <attribute name="action">app.generate-support</attribute>
       </item>
     </section>
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]