[glib/wip/ebassi/application-quit: 4/4] Add a Quit method to the Application interface(s)



commit 4b9610cfab43d6e5c3bada19698f538f965e0b92
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Oct 4 00:55:50 2015 +0100

    Add a Quit method to the Application interface(s)
    
    Both org.freedesktop.Application and org.gtk.Application interfaces
    should have a Quit method. We tie it to the GApplication::quit signal we
    previously add.

 gio/gapplicationimpl-dbus.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/gio/gapplicationimpl-dbus.c b/gio/gapplicationimpl-dbus.c
index 94cf6ea..f4bf2bb 100644
--- a/gio/gapplicationimpl-dbus.c
+++ b/gio/gapplicationimpl-dbus.c
@@ -65,7 +65,10 @@ static const gchar org_gtk_Application_xml[] =
         "<arg type='a{sv}' name='platform-data' direction='in'/>"
         "<arg type='i' name='exit-status' direction='out'/>"
       "</method>"
-    "<property name='Busy' type='b' access='read'/>"
+      "<method name='Quit'>"
+        "<arg type='a{sv}' name='platform-data' direction='in'/>"
+      "</method>"
+      "<property name='Busy' type='b' access='read'/>"
     "</interface>"
   "</node>";
 
@@ -86,6 +89,9 @@ static const gchar org_freedesktop_Application_xml[] =
         "<arg type='av' name='parameter' direction='in'/>"
         "<arg type='a{sv}' name='platform-data' direction='in'/>"
       "</method>"
+      "<method name='Quit'>"
+        "<arg type='a{sv}' name='platform-data' direction='in'/>"
+      "</method>"
     "</interface>"
   "</node>";
 
@@ -300,6 +306,19 @@ g_application_impl_method_call (GDBusConnection       *connection,
 
       g_dbus_method_invocation_return_value (invocation, NULL);
     }
+  else if (g_str_equal (method_name, "Quit"))
+    {
+      /* Completely the same for both freedesktop and gtk interfaces */
+
+      g_variant_get (parameters, "(@a{sv})", &platform_data);
+
+      class->before_emit (impl->app, platform_data);
+      g_signal_emit_by_name (impl->app, "quit");
+      class->after_emit (impl->app, platform_data);
+      g_variant_unref (platform_data);
+
+      g_dbus_method_invocation_return_value (invocation, NULL);
+    }
   else
     g_assert_not_reached ();
 }


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