Codebase list libcloudproviders / c723574
libcloudproviders: Rename CloudProviderAccount to CloudProviderAccountExporter Julius Härtl 6 years ago
10 changed file(s) with 304 addition(s) and 304 deletion(s). Raw diff Collapse all Expand all
1717 */
1818
1919 #include "cloudprovider.h"
20 #include "cloudprovideraccountpriv.h"
20 #include "cloudprovideraccountexporterpriv.h"
2121 #include "cloudprovider-generated.h"
2222 #include <gio/gio.h>
2323
5757 * function to export the accounts the user set up.
5858 */
5959 void
60 cloud_provider_add_account (CloudProvider *cloud_provider,
61 CloudProviderAccount *account)
60 cloud_provider_add_account (CloudProvider *cloud_provider,
61 CloudProviderAccountExporter *account)
6262 {
6363 CloudProviderPrivate *priv = cloud_provider_get_instance_private(cloud_provider);
6464 CloudProviderObjectSkeleton *object;
65 gchar *object_path = g_strconcat (priv->object_path, "/", cloud_provider_account_get_object_name (account), NULL);
65 gchar *object_path = g_strconcat (priv->object_path, "/", cloud_provider_account_exporter_get_object_name (account), NULL);
6666 object = cloud_provider_object_skeleton_new(object_path);
67 cloud_provider_object_skeleton_set_account1(object, CLOUD_PROVIDER_ACCOUNT1 (cloud_provider_account_get_skeleton (account)));
67 cloud_provider_object_skeleton_set_account1(object, CLOUD_PROVIDER_ACCOUNT1 (cloud_provider_account_exporter_get_skeleton (account)));
6868 g_dbus_object_manager_server_export (priv->manager, G_DBUS_OBJECT_SKELETON(object));
6969 g_free(object_path);
7070 }
2121 #include "cloudprovider-generated.h"
2222 /* for CloudProviderStatus enum */
2323 #include "cloudproviderproxy.h"
24 #include "cloudprovideraccount.h"
24 #include "cloudprovideraccountexporter.h"
2525
2626 G_BEGIN_DECLS
2727
7171 const gchar *account_name);
7272
7373 void
74 cloud_provider_add_account (CloudProvider* cloud_provider,
75 CloudProviderAccount *account);
74 cloud_provider_add_account (CloudProvider *cloud_provider,
75 CloudProviderAccountExporter *account);
7676
7777 void
7878 cloud_provider_export_objects (CloudProvider* cloud_provider);
+0
-192
src/cloudprovideraccount.c less more
0 /* cloudprovideraccount.c
1 *
2 * Copyright (C) 2017 Julius Haertl <jus@bitgrid.net>
3 *
4 * This file is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as
6 * published by the Free Software Foundation; either version 3 of the
7 * License, or (at your option) any later version.
8 *
9 * This file is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include <gio/gio.h>
19 #include "cloudprovideraccount.h"
20 #include "cloudprovider-generated.h"
21
22 typedef struct
23 {
24 gchar *object_name;
25 CloudProviderAccount1 *skeleton;
26 } CloudProviderAccountPrivate;
27
28 G_DEFINE_TYPE_WITH_PRIVATE (CloudProviderAccount, cloud_provider_account, G_TYPE_OBJECT)
29
30 gchar *
31 cloud_provider_account_get_object_name (CloudProviderAccount *self)
32 {
33 CloudProviderAccountPrivate *priv = cloud_provider_account_get_instance_private (self);
34 return priv->object_name;
35 }
36
37 GDBusInterfaceSkeleton*
38 cloud_provider_account_get_skeleton (CloudProviderAccount *self)
39 {
40 CloudProviderAccountPrivate *priv = cloud_provider_account_get_instance_private (self);
41 return G_DBUS_INTERFACE_SKELETON(priv->skeleton);
42 }
43
44 static void
45 on_get_name (CloudProviderAccount *self,
46 GDBusMethodInvocation *invocation,
47 gpointer user_data)
48 {
49 CloudProviderAccountPrivate *priv = cloud_provider_account_get_instance_private (self);
50 gchar *name;
51 g_signal_emit_by_name (CLOUD_PROVIDER_ACCOUNT(self), "handle_get_name", &name);
52 cloud_provider_account1_complete_get_name (priv->skeleton, invocation, name);
53 }
54
55 static void
56 on_get_icon (CloudProviderAccount *self,
57 GDBusMethodInvocation *invocation,
58 gpointer user_data)
59 {
60 CloudProviderAccountPrivate *priv = cloud_provider_account_get_instance_private (self);
61 GIcon *icon = NULL;
62 g_signal_emit_by_name (CLOUD_PROVIDER_ACCOUNT(self), "handle_get_icon", &icon);
63 cloud_provider_account1_complete_get_icon (priv->skeleton, invocation, g_variant_new("v", g_icon_serialize(icon)));
64 }
65
66 static void
67 on_get_path (CloudProviderAccount *self,
68 GDBusMethodInvocation *invocation,
69 gpointer user_data)
70 {
71 CloudProviderAccountPrivate *priv = cloud_provider_account_get_instance_private (self);
72 gchar *path = NULL;
73 g_signal_emit_by_name (CLOUD_PROVIDER_ACCOUNT(self), "handle_get_path", &path);
74 cloud_provider_account1_complete_get_path (priv->skeleton, invocation, path);
75 }
76
77 static void
78 on_get_status (CloudProviderAccount *self,
79 GDBusMethodInvocation *invocation,
80 gpointer user_data)
81 {
82 CloudProviderAccountPrivate *priv = cloud_provider_account_get_instance_private (self);
83 gint *status = g_new0(gint, 1);
84 g_signal_emit_by_name (CLOUD_PROVIDER_ACCOUNT(self), "handle_get_status", status);
85 cloud_provider_account1_complete_get_status (priv->skeleton, invocation, *status);
86 g_free(status);
87 }
88
89 static void
90 on_get_status_details (CloudProviderAccount *self,
91 GDBusMethodInvocation *invocation,
92 gpointer user_data)
93 {
94 CloudProviderAccountPrivate *priv = cloud_provider_account_get_instance_private (self);
95 gchar *status_details = NULL;
96 g_signal_emit_by_name (CLOUD_PROVIDER_ACCOUNT(self), "handle_get_status_details", &status_details);
97 cloud_provider_account1_complete_get_status_details (priv->skeleton, invocation, status_details);
98 }
99
100 CloudProviderAccount*
101 cloud_provider_account_new (const gchar *object_name)
102 {
103 CloudProviderAccount *self;
104 CloudProviderAccountPrivate *priv;
105
106 self = g_object_new (TYPE_CLOUD_PROVIDER_ACCOUNT, NULL);
107 priv = cloud_provider_account_get_instance_private (self);
108
109 priv->skeleton = cloud_provider_account1_skeleton_new ();
110
111 g_signal_connect_swapped(priv->skeleton, "handle_get_name", G_CALLBACK (on_get_name), self);
112 g_signal_connect_swapped(priv->skeleton, "handle_get_icon", G_CALLBACK (on_get_icon), self);
113 g_signal_connect_swapped(priv->skeleton, "handle_get_path", G_CALLBACK (on_get_path), self);
114 g_signal_connect_swapped(priv->skeleton, "handle_get_status", G_CALLBACK (on_get_status), self);
115 g_signal_connect_swapped(priv->skeleton, "handle_get_status_details", G_CALLBACK (on_get_status_details), self);
116
117 priv->object_name = g_strdup (object_name);
118
119 return self;
120 }
121
122 static void
123 cloud_provider_account_finalize (GObject *object)
124 {
125 CloudProviderAccount *self = (CloudProviderAccount *)object;
126 CloudProviderAccountPrivate *priv = cloud_provider_account_get_instance_private (self);
127
128 g_free (priv->object_name);
129 g_object_unref (priv->skeleton);
130
131 G_OBJECT_CLASS (cloud_provider_account_parent_class)->finalize (object);
132 }
133
134 static void
135 cloud_provider_account_class_init (CloudProviderAccountClass *klass)
136 {
137 GObjectClass *object_class = G_OBJECT_CLASS (klass);
138
139 object_class->finalize = cloud_provider_account_finalize;
140
141 g_signal_new ("handle_get_name",
142 G_TYPE_FROM_CLASS (klass),
143 G_SIGNAL_RUN_LAST,
144 0,
145 NULL,
146 NULL,
147 g_cclosure_marshal_generic,
148 G_TYPE_POINTER,
149 0);
150 g_signal_new ("handle_get_icon",
151 G_TYPE_FROM_CLASS (klass),
152 G_SIGNAL_RUN_LAST,
153 0,
154 NULL,
155 NULL,
156 g_cclosure_marshal_generic,
157 G_TYPE_POINTER,
158 0);
159 g_signal_new ("handle_get_path",
160 G_TYPE_FROM_CLASS (klass),
161 G_SIGNAL_RUN_LAST,
162 0,
163 NULL,
164 NULL,
165 g_cclosure_marshal_generic,
166 G_TYPE_POINTER,
167 0);
168 g_signal_new ("handle_get_status",
169 G_TYPE_FROM_CLASS (klass),
170 G_SIGNAL_RUN_LAST,
171 0,
172 NULL,
173 NULL,
174 g_cclosure_marshal_generic,
175 G_TYPE_POINTER,
176 0);
177 g_signal_new ("handle_get_status_details",
178 G_TYPE_FROM_CLASS (klass),
179 G_SIGNAL_RUN_LAST,
180 0,
181 NULL,
182 NULL,
183 g_cclosure_marshal_generic,
184 G_TYPE_POINTER,
185 0);
186 }
187
188 static void
189 cloud_provider_account_init (CloudProviderAccount *self)
190 {
191 }
+0
-56
src/cloudprovideraccount.h less more
0 /* cloudprovideraccount.h
1 *
2 * Copyright (C) 2017 Julius Haertl <jus@bitgrid.net>
3 *
4 * This file is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as
6 * published by the Free Software Foundation; either version 3 of the
7 * License, or (at your option) any later version.
8 *
9 * This file is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef CLOUD_PROVIDER_ACCOUNT_H
19 #define CLOUD_PROVIDER_ACCOUNT_H
20
21 G_BEGIN_DECLS
22
23 #define TYPE_CLOUD_PROVIDER_ACCOUNT (cloud_provider_account_get_type())
24 #define CLOUD_PROVIDER_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLOUD_PROVIDER_ACCOUNT, CloudProviderAccount))
25 #define CLOUD_PROVIDER_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLOUD_PROVIDER_ACCOUNT, CloudProviderAccountClass))
26 #define IS_CLOUD_PROVIDER_ACCOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CLOUD_PROVIDER_ACCOUNT))
27 #define IS_CLOUD_PROVIDER_ACCOUNT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLOUD_PROVIDER_ACCOUNT))
28 #define CLOUD_PROVIDER_ACCOUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLOUD_PROVIDER_ACCOUNT, CloudProviderAccountClass))
29
30 typedef struct _CloudProviderAccount CloudProviderAccount;
31 typedef struct _CloudProviderAccountClass CloudProviderAccountClass;
32
33
34 struct _CloudProviderAccountClass
35 {
36 GObjectClass parent_class;
37 };
38
39 struct _CloudProviderAccount
40 {
41 GObject parent_instance;
42 };
43
44 GType
45 cloud_provider_account_get_type (void) G_GNUC_CONST;
46
47 void
48 cloud_provider_account_emit_changed (CloudProviderAccount *cloud_provider_account);
49
50 CloudProviderAccount*
51 cloud_provider_account_new (const gchar *account_object_name);
52
53 G_END_DECLS
54
55 #endif /* CLOUD_PROVIDER_ACCOUNT_H */
0 /* cloudprovideraccountexporter.c
1 *
2 * Copyright (C) 2017 Julius Haertl <jus@bitgrid.net>
3 *
4 * This file is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as
6 * published by the Free Software Foundation; either version 3 of the
7 * License, or (at your option) any later version.
8 *
9 * This file is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include <gio/gio.h>
19 #include "cloudprovideraccountexporter.h"
20 #include "cloudprovider-generated.h"
21
22 typedef struct
23 {
24 gchar *object_name;
25 CloudProviderAccount1 *skeleton;
26 } CloudProviderAccountExporterPrivate;
27
28 G_DEFINE_TYPE_WITH_PRIVATE (CloudProviderAccountExporter, cloud_provider_account_exporter, G_TYPE_OBJECT)
29
30 gchar *
31 cloud_provider_account_exporter_get_object_name (CloudProviderAccountExporter *self)
32 {
33 CloudProviderAccountExporterPrivate *priv = cloud_provider_account_exporter_get_instance_private (self);
34 return priv->object_name;
35 }
36
37 GDBusInterfaceSkeleton*
38 cloud_provider_account_exporter_get_skeleton (CloudProviderAccountExporter *self)
39 {
40 CloudProviderAccountExporterPrivate *priv = cloud_provider_account_exporter_get_instance_private (self);
41 return G_DBUS_INTERFACE_SKELETON(priv->skeleton);
42 }
43
44 static void
45 on_get_name (CloudProviderAccountExporter *self,
46 GDBusMethodInvocation *invocation,
47 gpointer user_data)
48 {
49 CloudProviderAccountExporterPrivate *priv = cloud_provider_account_exporter_get_instance_private (self);
50 gchar *name;
51 g_signal_emit_by_name (CLOUD_PROVIDER_ACCOUNT_EXPORTER(self), "handle_get_name", &name);
52 cloud_provider_account1_complete_get_name (priv->skeleton, invocation, name);
53 }
54
55 static void
56 on_get_icon (CloudProviderAccountExporter *self,
57 GDBusMethodInvocation *invocation,
58 gpointer user_data)
59 {
60 CloudProviderAccountExporterPrivate *priv = cloud_provider_account_exporter_get_instance_private (self);
61 GIcon *icon = NULL;
62 g_signal_emit_by_name (CLOUD_PROVIDER_ACCOUNT_EXPORTER(self), "handle_get_icon", &icon);
63 cloud_provider_account1_complete_get_icon (priv->skeleton, invocation, g_variant_new("v", g_icon_serialize(icon)));
64 }
65
66 static void
67 on_get_path (CloudProviderAccountExporter *self,
68 GDBusMethodInvocation *invocation,
69 gpointer user_data)
70 {
71 CloudProviderAccountExporterPrivate *priv = cloud_provider_account_exporter_get_instance_private (self);
72 gchar *path = NULL;
73 g_signal_emit_by_name (CLOUD_PROVIDER_ACCOUNT_EXPORTER(self), "handle_get_path", &path);
74 cloud_provider_account1_complete_get_path (priv->skeleton, invocation, path);
75 }
76
77 static void
78 on_get_status (CloudProviderAccountExporter *self,
79 GDBusMethodInvocation *invocation,
80 gpointer user_data)
81 {
82 CloudProviderAccountExporterPrivate *priv = cloud_provider_account_exporter_get_instance_private (self);
83 gint *status = g_new0(gint, 1);
84 g_signal_emit_by_name (CLOUD_PROVIDER_ACCOUNT_EXPORTER(self), "handle_get_status", status);
85 cloud_provider_account1_complete_get_status (priv->skeleton, invocation, *status);
86 g_free(status);
87 }
88
89 static void
90 on_get_status_details (CloudProviderAccountExporter *self,
91 GDBusMethodInvocation *invocation,
92 gpointer user_data)
93 {
94 CloudProviderAccountExporterPrivate *priv = cloud_provider_account_exporter_get_instance_private (self);
95 gchar *status_details = NULL;
96 g_signal_emit_by_name (CLOUD_PROVIDER_ACCOUNT_EXPORTER(self), "handle_get_status_details", &status_details);
97 cloud_provider_account1_complete_get_status_details (priv->skeleton, invocation, status_details);
98 }
99
100 CloudProviderAccountExporter*
101 cloud_provider_account_exporter_new (const gchar *object_name)
102 {
103 CloudProviderAccountExporter *self;
104 CloudProviderAccountExporterPrivate *priv;
105
106 self = g_object_new (TYPE_CLOUD_PROVIDER_ACCOUNT_EXPORTER, NULL);
107 priv = cloud_provider_account_exporter_get_instance_private (self);
108
109 priv->skeleton = cloud_provider_account1_skeleton_new ();
110
111 g_signal_connect_swapped(priv->skeleton, "handle_get_name", G_CALLBACK (on_get_name), self);
112 g_signal_connect_swapped(priv->skeleton, "handle_get_icon", G_CALLBACK (on_get_icon), self);
113 g_signal_connect_swapped(priv->skeleton, "handle_get_path", G_CALLBACK (on_get_path), self);
114 g_signal_connect_swapped(priv->skeleton, "handle_get_status", G_CALLBACK (on_get_status), self);
115 g_signal_connect_swapped(priv->skeleton, "handle_get_status_details", G_CALLBACK (on_get_status_details), self);
116
117 priv->object_name = g_strdup (object_name);
118
119 return self;
120 }
121
122 static void
123 cloud_provider_account_exporter_finalize (GObject *object)
124 {
125 CloudProviderAccountExporter *self = (CloudProviderAccountExporter *)object;
126 CloudProviderAccountExporterPrivate *priv = cloud_provider_account_exporter_get_instance_private (self);
127
128 g_free (priv->object_name);
129 g_object_unref (priv->skeleton);
130
131 G_OBJECT_CLASS (cloud_provider_account_exporter_parent_class)->finalize (object);
132 }
133
134 static void
135 cloud_provider_account_exporter_class_init (CloudProviderAccountExporterClass *klass)
136 {
137 GObjectClass *object_class = G_OBJECT_CLASS (klass);
138
139 object_class->finalize = cloud_provider_account_exporter_finalize;
140
141 g_signal_new ("handle_get_name",
142 G_TYPE_FROM_CLASS (klass),
143 G_SIGNAL_RUN_LAST,
144 0,
145 NULL,
146 NULL,
147 g_cclosure_marshal_generic,
148 G_TYPE_POINTER,
149 0);
150 g_signal_new ("handle_get_icon",
151 G_TYPE_FROM_CLASS (klass),
152 G_SIGNAL_RUN_LAST,
153 0,
154 NULL,
155 NULL,
156 g_cclosure_marshal_generic,
157 G_TYPE_POINTER,
158 0);
159 g_signal_new ("handle_get_path",
160 G_TYPE_FROM_CLASS (klass),
161 G_SIGNAL_RUN_LAST,
162 0,
163 NULL,
164 NULL,
165 g_cclosure_marshal_generic,
166 G_TYPE_POINTER,
167 0);
168 g_signal_new ("handle_get_status",
169 G_TYPE_FROM_CLASS (klass),
170 G_SIGNAL_RUN_LAST,
171 0,
172 NULL,
173 NULL,
174 g_cclosure_marshal_generic,
175 G_TYPE_POINTER,
176 0);
177 g_signal_new ("handle_get_status_details",
178 G_TYPE_FROM_CLASS (klass),
179 G_SIGNAL_RUN_LAST,
180 0,
181 NULL,
182 NULL,
183 g_cclosure_marshal_generic,
184 G_TYPE_POINTER,
185 0);
186 }
187
188 static void
189 cloud_provider_account_exporter_init (CloudProviderAccountExporter *self)
190 {
191 }
0 /* cloudprovideraccount.h
1 *
2 * Copyright (C) 2017 Julius Haertl <jus@bitgrid.net>
3 *
4 * This file is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as
6 * published by the Free Software Foundation; either version 3 of the
7 * License, or (at your option) any later version.
8 *
9 * This file is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef CLOUD_PROVIDER_ACCOUNT_EXPORTER_H
19 #define CLOUD_PROVIDER_ACCOUNT_EXPORTER_H
20
21 G_BEGIN_DECLS
22
23 #define TYPE_CLOUD_PROVIDER_ACCOUNT_EXPORTER (cloud_provider_account_exporter_get_type())
24 #define CLOUD_PROVIDER_ACCOUNT_EXPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_CLOUD_PROVIDER_ACCOUNT_EXPORTER, CloudProviderAccountExporter))
25 #define CLOUD_PROVIDER_ACCOUNT_EXPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLOUD_PROVIDER_ACCOUNT_EXPORTER, CloudProviderAccountExporterClass))
26 #define IS_CLOUD_PROVIDER_ACCOUNT_EXPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_CLOUD_PROVIDER_ACCOUNT_EXPORTER))
27 #define IS_CLOUD_PROVIDER_ACCOUNT_EXPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLOUD_PROVIDER_ACCOUNT_EXPORTER))
28 #define CLOUD_PROVIDER_ACCOUNT_EXPORTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLOUD_PROVIDER_ACCOUNT_EXPORTER, CloudProviderAccountExporterClass))
29
30 typedef struct _CloudProviderAccountExporter CloudProviderAccountExporter;
31 typedef struct _CloudProviderAccountExporterClass CloudProviderAccountExporterClass;
32
33
34 struct _CloudProviderAccountExporterClass
35 {
36 GObjectClass parent_class;
37 };
38
39 struct _CloudProviderAccountExporter
40 {
41 GObject parent_instance;
42 };
43
44 GType
45 cloud_provider_account_exporter_get_type (void) G_GNUC_CONST;
46
47 void
48 cloud_provider_account_exporter_emit_changed (CloudProviderAccountExporter *cloud_provider_account);
49
50 CloudProviderAccountExporter*
51 cloud_provider_account_exporter_new (const gchar *account_object_name);
52
53 G_END_DECLS
54
55 #endif /* CLOUD_PROVIDER_ACCOUNT_EXPORTER_H */
0 /* cloudprovideraccountexporterpriv.h
1 *
2 * Copyright (C) 2017 Julius Haertl <jus@bitgrid.net>
3 *
4 * This file is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as
6 * published by the Free Software Foundation; either version 3 of the
7 * License, or (at your option) any later version.
8 *
9 * This file is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef CLOUD_PROVIDER_ACCOUNT_EXPORTER_PRIV_H
19 #define CLOUD_PROVIDER_ACCOUNT_EXPORTER_PRIV_H
20
21 #include "cloudprovideraccountexporter.h"
22 #include <gio/gio.h>
23 G_BEGIN_DECLS
24
25 GDBusInterfaceSkeleton*
26 cloud_provider_account_exporter_get_skeleton (CloudProviderAccountExporter *self);
27
28 gchar *
29 cloud_provider_account_exporter_get_object_name (CloudProviderAccountExporter *self);
30
31 #endif
+0
-32
src/cloudprovideraccountpriv.h less more
0 /* cloudprovideraccountpriv.h
1 *
2 * Copyright (C) 2017 Julius Haertl <jus@bitgrid.net>
3 *
4 * This file is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as
6 * published by the Free Software Foundation; either version 3 of the
7 * License, or (at your option) any later version.
8 *
9 * This file is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef CLOUD_PROVIDER_ACCOUNT_PRIV_H
19 #define CLOUD_PROVIDER_ACCOUNT_PRIV_H
20
21 #include "cloudprovideraccount.h"
22 #include <gio/gio.h>
23 G_BEGIN_DECLS
24
25 GDBusInterfaceSkeleton*
26 cloud_provider_account_get_skeleton (CloudProviderAccount *self);
27
28 gchar *
29 cloud_provider_account_get_object_name (CloudProviderAccount *self);
30
31 #endif
22 'cloudproviderproxy.h',
33 'cloudproviders.h',
44 'cloudprovider.h',
5 'cloudprovideraccount.h',
5 'cloudprovideraccountexporter.h',
66 ]
77
88 libcloudproviders_sources = [
1010 'cloudproviderproxy.c',
1111 'cloudproviders.c',
1212 'cloudprovider.c',
13 'cloudprovideraccount.c',
13 'cloudprovideraccountexporter.c',
1414 ]
1515
1616 libcloudproviders_deps = [glib, gio, gio_unix]
11 #include <stdlib.h>
22 #include <gio/gio.h>
33 #include <cloudprovider.h>
4 #include <cloudprovideraccount.h>
4 #include <cloudprovideraccountexporter.h>
55 /* for CLoudProviderStatus enum */
66 #include <cloudproviderproxy.h>
77
237237
238238
239239 static gchar *
240 on_get_name (CloudProviderAccount *account,
240 on_get_name (CloudProviderAccountExporter *account,
241241 gpointer user_data)
242242 {
243243 gchar *name = (gchar*)user_data;
245245 }
246246
247247 static GIcon *
248 on_get_icon (CloudProviderAccount *account,
248 on_get_icon (CloudProviderAccountExporter *account,
249249 gpointer user_data)
250250 {
251251 TestCloudProvider *self = user_data;
253253 }
254254
255255 static gchar *
256 on_get_path (CloudProviderAccount *account,
256 on_get_path (CloudProviderAccountExporter *account,
257257 gpointer user_data)
258258 {
259259 TestCloudProvider *self = user_data;
261261 }
262262
263263 static guint
264 on_get_status (CloudProviderAccount *account,
264 on_get_status (CloudProviderAccountExporter *account,
265265 gpointer user_data)
266266 {
267267 TestCloudProvider *self = user_data;
269269 }
270270
271271 static gchar *
272 on_get_status_details (CloudProviderAccount *account,
272 on_get_status_details (CloudProviderAccountExporter *account,
273273 gpointer user_data)
274274 {
275275 gchar *description = "";
309309 gchar *account_object_name = g_strdup_printf ("MyCloud%d", n);
310310 gchar *account_name = g_strdup_printf ("MyCloud %d", n);
311311
312 CloudProviderAccount *cloud_provider_account = cloud_provider_account_new(account_object_name);
313 g_signal_connect(cloud_provider_account, "handle_get_name", G_CALLBACK (on_get_name), account_name);
314 g_signal_connect(cloud_provider_account, "handle_get_icon", G_CALLBACK (on_get_icon), self);
315 g_signal_connect(cloud_provider_account, "handle_get_path", G_CALLBACK (on_get_path), self);
316 g_signal_connect(cloud_provider_account, "handle_get_status", G_CALLBACK (on_get_status), self);
317 g_signal_connect(cloud_provider_account, "handle_get_status_details", G_CALLBACK (on_get_status_details), self);
318
319 cloud_provider_add_account(self->cloud_provider, cloud_provider_account);
312 CloudProviderAccountExporter *cloud_provider_account_exporter = cloud_provider_account_exporter_new(account_object_name);
313 g_signal_connect(cloud_provider_account_exporter, "handle_get_name", G_CALLBACK (on_get_name), account_name);
314 g_signal_connect(cloud_provider_account_exporter, "handle_get_icon", G_CALLBACK (on_get_icon), self);
315 g_signal_connect(cloud_provider_account_exporter, "handle_get_path", G_CALLBACK (on_get_path), self);
316 g_signal_connect(cloud_provider_account_exporter, "handle_get_status", G_CALLBACK (on_get_status), self);
317 g_signal_connect(cloud_provider_account_exporter, "handle_get_status_details", G_CALLBACK (on_get_status_details), self);
318
319 cloud_provider_add_account(self->cloud_provider, cloud_provider_account_exporter);
320320 cloud_provider_export_menu (self->cloud_provider, account_object_name, get_model ());
321321 cloud_provider_export_action_group (self->cloud_provider, account_object_name, get_action_group ());
322322