Codebase list libcloudproviders / 391d140
Rename DBus interfaces to CloudProvider.Accounts1 and CloudProvider.Manager1 Julius Härtl 6 years ago
7 changed file(s) with 37 addition(s) and 39 deletion(s). Raw diff Collapse all Expand all
1616 Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
1717 -->
1818 <node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
19 <interface name='org.freedesktop.CloudProvider1'>
19 <interface name='org.freedesktop.CloudProvider.Account1'>
2020 <method name='GetName'>
2121 <arg type='s' name='name' direction='out'/>
2222 </method>
1616 Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
1717 -->
1818 <node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
19 <interface name='org.freedesktop.CloudProviderManager1'>
19 <interface name='org.freedesktop.CloudProvider.Manager1'>
2020 <method name='CloudProviderChanged'></method>
2121 </interface>
2222 </node>
244244 g_print ("cloud provider found %s %s\n", bus_name, object_path);
245245 GDBusObjectManager *manager = g_hash_table_lookup(priv->provider_object_managers, bus_name);
246246 if(manager == NULL) {
247 manager = object_manager_client_new_for_bus_sync(G_BUS_TYPE_SESSION,
247 manager = cloud_provider_object_manager_client_new_for_bus_sync(G_BUS_TYPE_SESSION,
248248 G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
249249 bus_name,
250250 object_path,
268268 objects = g_dbus_object_manager_get_objects (manager);
269269 for (l = objects; l != NULL; l = l->next)
270270 {
271 Object *object = OBJECT(l->data);
271 CloudProviderObject *object = CLOUD_PROVIDER_OBJECT(l->data);
272272 g_print (" - Object at %s\n", g_dbus_object_get_object_path (G_DBUS_OBJECT (object)));
273273 g_print("New cloud provider instance\n");
274274 cloud_provider = cloud_provider_proxy_new (bus_name, g_dbus_object_get_object_path (G_DBUS_OBJECT (object)));
3030 GActionGroup *action_group;
3131
3232 GDBusConnection *bus;
33 CloudProvider1 *proxy;
33 CloudProviderAccount1 *proxy;
3434 gchar *bus_name;
3535 gchar *object_path;
3636 GCancellable *cancellable;
6161
6262 g_clear_object (&priv->icon);
6363
64 cloud_provider1_call_get_icon_finish (priv->proxy, &variant_tuple, res, &error);
64 cloud_provider_account1_call_get_icon_finish (priv->proxy, &variant_tuple, res, &error);
6565 if (error != NULL)
6666 {
6767 g_warning ("Error getting the provider icon %s", error->message);
9595 if (priv->name != NULL)
9696 g_free (priv->name);
9797
98 cloud_provider1_call_get_name_finish (priv->proxy, &priv->name, res, &error);
98 cloud_provider_account1_call_get_name_finish (priv->proxy, &priv->name, res, &error);
9999 if (error != NULL)
100100 {
101101 g_warning ("Error getting the provider name %s", error->message);
121121 if (priv->path != NULL)
122122 g_free (priv->path);
123123
124 cloud_provider1_call_get_path_finish (priv->proxy, &priv->path, res, &error);
124 cloud_provider_account1_call_get_path_finish (priv->proxy, &priv->path, res, &error);
125125 if (error != NULL)
126126 {
127127 g_warning ("Error getting the provider name %s", error->message);
144144 GError *error = NULL;
145145 gint status;
146146
147 cloud_provider1_call_get_status_finish (priv->proxy, &status, res, &error);
147 cloud_provider_account1_call_get_status_finish (priv->proxy, &status, res, &error);
148148 if (error != NULL)
149149 {
150150 g_warning ("Error getting the provider name %s", error->message);
165165
166166 if (priv->proxy != NULL)
167167 {
168 cloud_provider1_call_get_name (priv->proxy,
168 cloud_provider_account1_call_get_name (priv->proxy,
169169 NULL,
170170 (GAsyncReadyCallback) on_get_name,
171171 self);
172 cloud_provider1_call_get_status (priv->proxy,
172 cloud_provider_account1_call_get_status (priv->proxy,
173173 NULL,
174174 (GAsyncReadyCallback) on_get_status,
175175 self);
176 cloud_provider1_call_get_icon (priv->proxy,
176 cloud_provider_account1_call_get_icon (priv->proxy,
177177 NULL,
178178 (GAsyncReadyCallback) on_get_icon,
179179 self);
180 cloud_provider1_call_get_path (priv->proxy,
180 cloud_provider_account1_call_get_path (priv->proxy,
181181 NULL,
182182 (GAsyncReadyCallback) on_get_path,
183183 self);
199199 GError *error = NULL;
200200 CloudProviderProxy *self;
201201 CloudProviderProxyPrivate *priv;
202 CloudProvider1 *proxy;
203
204 proxy = cloud_provider1_proxy_new_for_bus_finish (res, &error);
202 CloudProviderAccount1 *proxy;
203
204 proxy = cloud_provider_account1_proxy_new_for_bus_finish (res, &error);
205205 if (error != NULL)
206206 {
207207 if (error->code != G_IO_ERROR_CANCELLED)
241241 priv->bus = bus;
242242 g_clear_object (&priv->cancellable);
243243 priv->cancellable = g_cancellable_new ();
244 cloud_provider1_proxy_new (priv->bus,
244 cloud_provider_account1_proxy_new (priv->bus,
245245 G_DBUS_PROXY_FLAGS_NONE,
246246 priv->bus_name,
247247 priv->object_path,
1616 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1717 */
1818
19 #ifndef CLOUD_PROVIDER_H
20 #define CLOUD_PROVIDER_H
19 #ifndef CLOUD_PROVIDER_PROXY_H
20 #define CLOUD_PROVIDER_PROXY_H
2121
2222 #include <gio/gio.h>
2323 #include "cloudprovider-generated.h"
6969 G_END_DECLS
7070
7171
72 #endif /* CLOUD_PROVIDER_H */
72 #endif /* CLOUD_PROVIDER_PROXY_H */
00 libcloudproviders_headers = [
11 'cloudprovidermanager.h',
2 'cloudproviderproxy.h',
3 'cloudprovider-generated.h',
4 'cloudprovidermanager-generated.h'
2 'cloudproviderproxy.h'
53 ]
64
75 libcloudproviders_sources = [
1412 gdbus_sources = []
1513 gdbus_sources += gnome.gdbus_codegen ('cloudprovider-generated',
1614 join_paths (meson.source_root (), 'data', 'cloudprovider-dbus.xml'),
17 interface_prefix: 'org.freedesktop',
18 namespace: '',
15 interface_prefix: 'org.freedesktop.CloudProvider',
16 namespace: 'CloudProvider',
1917 object_manager: true)
2018 gdbus_sources += gnome.gdbus_codegen ('cloudprovidermanager-generated',
2119 join_paths (meson.source_root (), 'data', 'cloudprovidermanager-dbus.xml'),
22 interface_prefix: 'org.freedesktop',
23 namespace: '')
20 interface_prefix: 'org.freedesktop.CloudProvider',
21 namespace: 'CloudProvider')
2422
2523 libcloudproviders_sources += gdbus_sources
2624
00 #include <glib.h>
11 #include <stdlib.h>
22 #include <gio/gio.h>
3 #include <cloudprovider.h>
3 #include <cloudproviderproxy.h>
44 #include <cloudprovidermanager.h>
55
6 #define TIMEOUT 2000
6 #define TIMEOUT 800
77 #define COUNT_PLACEHOLDER_ACCOUNTS 3
88
99 typedef struct _TestCloudProviderClass TestCloudProviderClass;
258258 g_dbus_connection_emit_signal (cloud_provider->connection,
259259 NULL,
260260 account_object_name,
261 "org.freedesktop.CloudProvider1",
261 "org.freedesktop.CloudProvider.Account1",
262262 "CloudProviderChanged",
263263 NULL,
264264 NULL /*error*/);
267267
268268
269269 static void
270 on_get_name (CloudProvider1 *cloud_provider,
270 on_get_name (CloudProviderAccount1 *cloud_provider,
271271 GDBusMethodInvocation *invocation,
272272 gpointer user_data)
273273 {
277277 }
278278
279279 static void
280 on_get_icon (CloudProvider1 *cloud_provider,
280 on_get_icon (CloudProviderAccount1 *cloud_provider,
281281 GDBusMethodInvocation *invocation,
282282 gpointer user_data)
283283 {
287287 }
288288
289289 static void
290 on_get_path (CloudProvider1 *cloud_provider,
290 on_get_path (CloudProviderAccount1 *cloud_provider,
291291 GDBusMethodInvocation *invocation,
292292 gpointer user_data)
293293 {
297297 }
298298
299299 static void
300 on_get_status (CloudProvider1 *cloud_provider,
300 on_get_status (CloudProviderAccount1 *cloud_provider,
301301 GDBusMethodInvocation *invocation,
302302 gpointer user_data)
303303 {
313313 {
314314 TestCloudProvider *self = user_data;
315315 guint n;
316 ObjectSkeleton *object;
316 CloudProviderObjectSkeleton *object;
317317 self->connection = connection;
318318
319319 g_debug ("Registering cloud provider server 'MyCloud'\n");
328328
329329 account_object_name = g_strdup_printf ("/org/freedesktop/CloudProviderServerExample/%03d", n);
330330 account_name = g_strdup_printf ("MyCloud %d", n);
331 object = object_skeleton_new(account_object_name);
332
333 CloudProvider1 *cloud_provider = cloud_provider1_skeleton_new();
331 object = cloud_provider_object_skeleton_new(account_object_name);
332
333 CloudProviderAccount1 *cloud_provider = cloud_provider_account1_skeleton_new();
334334 g_signal_connect(cloud_provider, "handle_get_name", G_CALLBACK (on_get_name), account_name);
335335 g_signal_connect(cloud_provider, "handle_get_icon", G_CALLBACK (on_get_icon), self);
336336 g_signal_connect(cloud_provider, "handle_get_path", G_CALLBACK (on_get_path), self);
337337 g_signal_connect(cloud_provider, "handle_get_status", G_CALLBACK (on_get_status), self);
338 object_skeleton_set_cloud_provider1(object, cloud_provider);
338 cloud_provider_object_skeleton_set_account1(object, cloud_provider);
339339 g_dbus_object_manager_server_export (self->manager, G_DBUS_OBJECT_SKELETON(object));
340340
341341 export_menu (connection, account_object_name);