Blame SOURCES/0002-Revert-sharing-Fix-function-arguments.patch

37ea90
From 0d732317df634f7586cf6c5e34394082ea5ea931 Mon Sep 17 00:00:00 2001
2f9b22
From: Rui Matos <tiagomatos@gmail.com>
2f9b22
Date: Wed, 11 Oct 2017 18:10:40 +0200
2f9b22
Subject: [PATCH 2/3] Revert "sharing: Fix function arguments"
dce4b5
dce4b5
This reverts commit 5b6b26eba58f5c3b8b5441f07f0af7a84af5cc52.
dce4b5
---
dce4b5
 plugins/sharing/gsd-sharing-manager.c | 11 +++++++----
dce4b5
 1 file changed, 7 insertions(+), 4 deletions(-)
dce4b5
dce4b5
diff --git a/plugins/sharing/gsd-sharing-manager.c b/plugins/sharing/gsd-sharing-manager.c
2f9b22
index a90df9a6..26663442 100644
dce4b5
--- a/plugins/sharing/gsd-sharing-manager.c
dce4b5
+++ b/plugins/sharing/gsd-sharing-manager.c
37ea90
@@ -101,99 +101,102 @@ static const char * const services[] = {
37ea90
         "vino-server",
37ea90
         "gnome-remote-desktop",
37ea90
         "gnome-user-share-webdav"
37ea90
 };
37ea90
 
37ea90
 static void
37ea90
 handle_unit_cb (GObject      *source_object,
37ea90
                 GAsyncResult *res,
37ea90
                 gpointer      user_data)
37ea90
 {
37ea90
         GError *error = NULL;
37ea90
         GVariant *ret;
37ea90
         const char *operation = user_data;
37ea90
 
37ea90
         ret = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source_object),
37ea90
                                              res, &error);
37ea90
         if (!ret) {
37ea90
                 if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
37ea90
                         g_warning ("Failed to %s service: %s", operation, error->message);
37ea90
                 g_error_free (error);
37ea90
                 return;
37ea90
         }
37ea90
 
37ea90
         g_variant_unref (ret);
37ea90
 
37ea90
 }
37ea90
 
dce4b5
 static void
dce4b5
 gsd_sharing_manager_handle_service (GsdSharingManager   *manager,
dce4b5
                                     const char          *method,
dce4b5
+                                    GAsyncReadyCallback  callback,
dce4b5
                                     ServiceInfo         *service)
dce4b5
 {
dce4b5
         char *service_file;
37ea90
 
37ea90
         service_file = g_strdup_printf ("%s.service", service->name);
37ea90
         g_dbus_connection_call (manager->priv->connection,
37ea90
                                 "org.freedesktop.systemd1",
37ea90
                                 "/org/freedesktop/systemd1",
37ea90
                                 "org.freedesktop.systemd1.Manager",
37ea90
                                 method,
37ea90
                                 g_variant_new ("(ss)", service_file, "replace"),
37ea90
                                 NULL,
dce4b5
                                 G_DBUS_CALL_FLAGS_NONE,
dce4b5
                                 -1,
dce4b5
                                 manager->priv->cancellable,
dce4b5
-                                handle_unit_cb,
dce4b5
-                                (gpointer) method);
dce4b5
+                                callback,
dce4b5
+                                manager);
dce4b5
         g_free (service_file);
dce4b5
 }
dce4b5
 
37ea90
 static void
37ea90
 gsd_sharing_manager_start_service (GsdSharingManager *manager,
37ea90
                                    ServiceInfo       *service)
37ea90
 {
37ea90
         g_debug ("About to start %s", service->name);
37ea90
 
dce4b5
         /* We use StartUnit, not StartUnitReplace, since the latter would
dce4b5
          * cancel any pending start we already have going from an
dce4b5
          * earlier _start_service() call */
dce4b5
-        gsd_sharing_manager_handle_service (manager, "StartUnit", service);
dce4b5
+        gsd_sharing_manager_handle_service (manager, "StartUnit",
dce4b5
+                                            handle_unit_cb, "start");
dce4b5
 }
dce4b5
 
dce4b5
 static void
37ea90
 gsd_sharing_manager_stop_service (GsdSharingManager *manager,
37ea90
                                   ServiceInfo       *service)
dce4b5
 {
dce4b5
         g_debug ("About to stop %s", service->name);
dce4b5
 
dce4b5
-        gsd_sharing_manager_handle_service (manager, "StopUnit", service);
dce4b5
+        gsd_sharing_manager_handle_service (manager, "StopUnit",
dce4b5
+                                            handle_unit_cb, "stop");
dce4b5
 }
dce4b5
 
dce4b5
 #ifdef HAVE_NETWORK_MANAGER
37ea90
 static gboolean
37ea90
 service_is_enabled_on_current_connection (GsdSharingManager *manager,
37ea90
                                           ServiceInfo       *service)
37ea90
 {
37ea90
         char **connections;
37ea90
         int j;
37ea90
         gboolean ret;
37ea90
         connections = g_settings_get_strv (service->settings, "enabled-connections");
37ea90
         ret = FALSE;
37ea90
         for (j = 0; connections[j] != NULL; j++) {
37ea90
                 if (g_strcmp0 (connections[j], manager->priv->current_network) == 0) {
37ea90
                         ret = TRUE;
37ea90
                         break;
37ea90
                 }
37ea90
         }
37ea90
 
37ea90
         g_strfreev (connections);
37ea90
         return ret;
37ea90
 }
37ea90
 #else
37ea90
 static gboolean
37ea90
 service_is_enabled_on_current_connection (GsdSharingManager *manager,
37ea90
                                           ServiceInfo       *service)
37ea90
 {
37ea90
         return FALSE;
37ea90
 }
37ea90
 #endif /* HAVE_NETWORK_MANAGER */
dce4b5
-- 
37ea90
2.17.0
dce4b5