[libcloudproviders/account-wrapper: 2/2] test: Use CloudProviderAccount wrapper



commit c231df199654e6677cc3e9262773d8fd0f065f67
Author: Julius Härtl <jus bitgrid net>
Date:   Thu Aug 31 18:20:39 2017 +0200

    test: Use CloudProviderAccount wrapper

 test/testcloudproviderserver.c | 57 ++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 33 deletions(-)
---
diff --git a/test/testcloudproviderserver.c b/test/testcloudproviderserver.c
index 46c7c46..6ade8fb 100644
--- a/test/testcloudproviderserver.c
+++ b/test/testcloudproviderserver.c
@@ -2,6 +2,7 @@
 #include <stdlib.h>
 #include <gio/gio.h>
 #include <cloudprovider.h>
+#include <cloudprovideraccount.h>
 /* for CLoudProviderStatus enum */
 #include <cloudproviderproxy.h>
 
@@ -236,50 +237,41 @@ change_random_cloud_provider_state (gpointer user_data)
 }
 
 
-static void
-on_get_name (CloudProviderAccount1          *cloud_provider,
-                GDBusMethodInvocation  *invocation,
-                gpointer                user_data)
+static gchar *
+on_get_name (CloudProviderAccount *account,
+             gpointer              user_data)
 {
-    gchar *name = user_data;
-    g_dbus_method_invocation_return_value (invocation,
-                                           g_variant_new ("(s)", name));
+  gchar *name = (gchar*)user_data;
+  return name;
 }
 
-static void
-on_get_icon (CloudProviderAccount1          *cloud_provider,
-                GDBusMethodInvocation  *invocation,
-                gpointer                user_data)
+static GIcon *
+on_get_icon (CloudProviderAccount *account,
+             gpointer              user_data)
 {
     TestCloudProvider *self = user_data;
-    g_dbus_method_invocation_return_value (invocation,
-                                           g_variant_new ("(v)", g_icon_serialize(self->icon)));
+    return self->icon;
 }
 
-static void
-on_get_path (CloudProviderAccount1          *cloud_provider,
-             GDBusMethodInvocation  *invocation,
-             gpointer                user_data)
+static gchar *
+on_get_path (CloudProviderAccount *account,
+             gpointer              user_data)
 {
     TestCloudProvider *self = user_data;
-    g_dbus_method_invocation_return_value (invocation,
-                                           g_variant_new ("(s)", self->path));
+    return self->path;
 }
 
-static void
-on_get_status (CloudProviderAccount1          *cloud_provider,
-                GDBusMethodInvocation  *invocation,
-                gpointer                user_data)
+static guint
+on_get_status (CloudProviderAccount *account,
+               gpointer              user_data)
 {
     TestCloudProvider *self = user_data;
-    g_dbus_method_invocation_return_value (invocation,
-                                           g_variant_new ("(i)", self->status));
+    return self->status;
 }
 
-static void
-on_get_status_details (CloudProviderAccount1     *cloud_provider,
-                GDBusMethodInvocation  *invocation,
-                gpointer                user_data)
+static gchar *
+on_get_status_details (CloudProviderAccount *account,
+                       gpointer              user_data)
 {
     gchar *description = "";
     TestCloudProvider *self = user_data;
@@ -294,8 +286,7 @@ on_get_status_details (CloudProviderAccount1     *cloud_provider,
         description = "Error";
         break;
     }
-    g_dbus_method_invocation_return_value (invocation,
-                                           g_variant_new ("(s)", description));
+    return description;
 }
 
 static void
@@ -319,14 +310,14 @@ on_bus_acquired (GDBusConnection *connection,
       gchar *account_object_name = g_strdup_printf ("MyCloud%d", n);
       gchar *account_name = g_strdup_printf ("MyCloud %d", n);
 
-      CloudProviderAccount1 *cloud_provider_account = cloud_provider_account1_skeleton_new();
+      CloudProviderAccount *cloud_provider_account = cloud_provider_account_new(account_object_name);
       g_signal_connect(cloud_provider_account, "handle_get_name", G_CALLBACK (on_get_name), account_name);
       g_signal_connect(cloud_provider_account, "handle_get_icon", G_CALLBACK (on_get_icon), self);
       g_signal_connect(cloud_provider_account, "handle_get_path", G_CALLBACK (on_get_path), self);
       g_signal_connect(cloud_provider_account, "handle_get_status", G_CALLBACK (on_get_status), self);
       g_signal_connect(cloud_provider_account, "handle_get_status_details", G_CALLBACK 
(on_get_status_details), self);
 
-      cloud_provider_export_account(self->cloud_provider, account_object_name, cloud_provider_account);
+      cloud_provider_add_account(self->cloud_provider, cloud_provider_account);
       cloud_provider_export_menu (self->cloud_provider, account_object_name, get_model ());
       cloud_provider_export_action_group (self->cloud_provider, account_object_name, get_action_group ());
 


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