[gtk/new-sysprof: 1/2] application: Drop support for profiler activation




commit 62bd05956025916d01d14c194138f87bf53e995e
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Aug 19 16:26:51 2020 -0400

    application: Drop support for profiler activation
    
    Drop support for the org.gnome.Sysprof3.Profiler
    D-Bus interface. It is not really used, and if
    we don't expose it, we can simplify our profiler
    infrastructure.

 gtk/gtkapplication.c | 132 ---------------------------------------------------
 1 file changed, 132 deletions(-)
---
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index 62e83fe7ac..4a5c473685 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -157,7 +157,6 @@ typedef struct
   GtkActionMuxer  *muxer;
   GtkBuilder      *menus_builder;
   char            *help_overlay_path;
-  guint            profiler_id;
 } GtkApplicationPrivate;
 
 G_DEFINE_TYPE_WITH_PRIVATE (GtkApplication, gtk_application, G_TYPE_APPLICATION)
@@ -502,120 +501,12 @@ gtk_application_finalize (GObject *object)
   G_OBJECT_CLASS (gtk_application_parent_class)->finalize (object);
 }
 
-#ifdef G_OS_UNIX
-
-static const char org_gnome_Sysprof3_Profiler_xml[] =
-  "<node>"
-    "<interface name='org.gnome.Sysprof3.Profiler'>"
-      "<property name='Capabilities' type='a{sv}' access='read'/>"
-      "<method name='Start'>"
-        "<arg type='a{sv}' name='options' direction='in'/>"
-        "<arg type='h' name='fd' direction='in'/>"
-      "</method>"
-      "<method name='Stop'>"
-      "</method>"
-    "</interface>"
-  "</node>";
-
-static GDBusInterfaceInfo *org_gnome_Sysprof3_Profiler;
-
-static void
-sysprof_profiler_method_call (GDBusConnection       *connection,
-                              const char            *sender,
-                              const char            *object_path,
-                              const char            *interface_name,
-                              const char            *method_name,
-                              GVariant              *parameters,
-                              GDBusMethodInvocation *invocation,
-                              gpointer               user_data)
-{
-  if (strcmp (method_name, "Start") == 0)
-    {
-      GDBusMessage *message;
-      GUnixFDList *fd_list;
-      GVariant *options;
-      int fd = -1;
-      int idx;
-
-      if (GDK_PROFILER_IS_RUNNING)
-        {
-          g_dbus_method_invocation_return_error (invocation,
-                                                 G_DBUS_ERROR,
-                                                 G_DBUS_ERROR_FAILED,
-                                                 "Profiler already running");
-          return;
-        }
-
-      g_variant_get (parameters, "(@a{sv}h)", &options, &idx);
-
-      message = g_dbus_method_invocation_get_message (invocation);
-      fd_list = g_dbus_message_get_unix_fd_list (message);
-      if (fd_list)
-        fd = g_unix_fd_list_get (fd_list, idx, NULL);
-
-      gdk_profiler_start (fd);
-
-      g_variant_unref (options);
-    }
-  else if (strcmp (method_name, "Stop") == 0)
-    {
-      if (!GDK_PROFILER_IS_RUNNING)
-        {
-          g_dbus_method_invocation_return_error (invocation,
-                                                 G_DBUS_ERROR,
-                                                 G_DBUS_ERROR_FAILED,
-                                                 "Profiler not running");
-          return;
-        }
-
-      gdk_profiler_stop ();
-    }
-  else
-    {
-      g_dbus_method_invocation_return_error (invocation,
-                                             G_DBUS_ERROR,
-                                             G_DBUS_ERROR_UNKNOWN_METHOD,
-                                             "Unknown method");
-      return;
-    }
-
-  g_dbus_method_invocation_return_value (invocation, NULL);
-}
-
 static gboolean
 gtk_application_dbus_register (GApplication     *application,
                                GDBusConnection  *connection,
                                const char       *object_path,
                                GError          **error)
 {
-  GtkApplicationPrivate *priv = gtk_application_get_instance_private (GTK_APPLICATION (application));
-  GDBusInterfaceVTable vtable = {
-    sysprof_profiler_method_call,
-    NULL,
-    NULL
-  };
-
-  if (org_gnome_Sysprof3_Profiler == NULL)
-    {
-      GDBusNodeInfo *info;
-
-      info = g_dbus_node_info_new_for_xml (org_gnome_Sysprof3_Profiler_xml, error);
-      if (info == NULL)
-        return FALSE;
-
-      org_gnome_Sysprof3_Profiler = g_dbus_node_info_lookup_interface (info, "org.gnome.Sysprof3.Profiler");
-      g_dbus_interface_info_ref (org_gnome_Sysprof3_Profiler);
-      g_dbus_node_info_unref (info);
-    }
-
-  priv->profiler_id = g_dbus_connection_register_object (connection,
-                                                         "/org/gtk/Profiler",
-                                                         org_gnome_Sysprof3_Profiler,
-                                                         &vtable,
-                                                         NULL,
-                                                         NULL,
-                                                         error);
-
   return TRUE;
 }
 
@@ -624,31 +515,8 @@ gtk_application_dbus_unregister (GApplication     *application,
                                  GDBusConnection  *connection,
                                  const char       *object_path)
 {
-  GtkApplicationPrivate *priv = gtk_application_get_instance_private (GTK_APPLICATION (application));
-
-  g_dbus_connection_unregister_object (connection, priv->profiler_id);
 }
 
-#else
-
-static gboolean
-gtk_application_dbus_register (GApplication     *application,
-                               GDBusConnection  *connection,
-                               const char       *object_path,
-                               GError          **error)
-{
-  return TRUE;
-}
-
-static void
-gtk_application_dbus_unregister (GApplication     *application,
-                                 GDBusConnection  *connection,
-                                 const char       *object_path)
-{
-}
-
-#endif
-
 static void
 gtk_application_class_init (GtkApplicationClass *class)
 {


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