summaryrefslogtreecommitdiff
path: root/src/lib/eldbus
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-11-04 11:47:34 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-11-04 13:19:57 -0200
commit7b590c126edde338b6a0ef99c6b9213062f7ecbd (patch)
treeb60c61161c8406b56b129fe637b2842516f3e505 /src/lib/eldbus
parentd8ad2507bcbba6215e75dd1e76d8ade379dfe48a (diff)
eldbus/eo: improve API
remove setters that do not make sense, they are set in the constructor functions and cannot be changed. define the Eldbus_Connection_Type in .eo, properly type functions using it.
Diffstat (limited to 'src/lib/eldbus')
-rw-r--r--src/lib/eldbus/eldbus_model_connection.c23
-rw-r--r--src/lib/eldbus/eldbus_model_connection.eo9
-rw-r--r--src/lib/eldbus/eldbus_model_object.c37
-rw-r--r--src/lib/eldbus/eldbus_model_object.eo9
-rw-r--r--src/lib/eldbus/eldbus_types.eot10
5 files changed, 28 insertions, 60 deletions
diff --git a/src/lib/eldbus/eldbus_model_connection.c b/src/lib/eldbus/eldbus_model_connection.c
index 27ace02e99..e311c9824c 100644
--- a/src/lib/eldbus/eldbus_model_connection.c
+++ b/src/lib/eldbus/eldbus_model_connection.c
@@ -39,7 +39,7 @@ _eldbus_model_connection_efl_object_constructor(Eo *obj, Eldbus_Model_Connection
39static void 39static void
40_eldbus_model_connection_constructor(Eo *obj EINA_UNUSED, 40_eldbus_model_connection_constructor(Eo *obj EINA_UNUSED,
41 Eldbus_Model_Connection_Data *pd, 41 Eldbus_Model_Connection_Data *pd,
42 int type, 42 Eldbus_Connection_Type type,
43 const char* address, 43 const char* address,
44 Eina_Bool private) 44 Eina_Bool private)
45{ 45{
@@ -212,38 +212,19 @@ _eldbus_model_connection_address_get(Eo *obj EINA_UNUSED, Eldbus_Model_Connectio
212 return pd->address; 212 return pd->address;
213} 213}
214 214
215static void
216_eldbus_model_connection_address_set(Eo *obj EINA_UNUSED, Eldbus_Model_Connection_Data *pd, const char *value)
217{
218 eina_stringshare_del(pd->address);
219 pd->address = eina_stringshare_add(value);
220}
221
222static Eina_Bool 215static Eina_Bool
223_eldbus_model_connection_private_get(Eo *obj EINA_UNUSED, Eldbus_Model_Connection_Data *pd) 216_eldbus_model_connection_private_get(Eo *obj EINA_UNUSED, Eldbus_Model_Connection_Data *pd)
224{ 217{
225 return pd->private; 218 return pd->private;
226} 219}
227 220
228static void 221static Eldbus_Connection_Type
229_eldbus_model_connection_private_set(Eo *obj EINA_UNUSED, Eldbus_Model_Connection_Data *pd, Eina_Bool value)
230{
231 pd->private = value;
232}
233
234static int
235_eldbus_model_connection_type_get(Eo *obj EINA_UNUSED, Eldbus_Model_Connection_Data *pd) 222_eldbus_model_connection_type_get(Eo *obj EINA_UNUSED, Eldbus_Model_Connection_Data *pd)
236{ 223{
237 return pd->type; 224 return pd->type;
238} 225}
239 226
240static void 227static void
241_eldbus_model_connection_type_set(Eo *obj EINA_UNUSED, Eldbus_Model_Connection_Data *pd, int value)
242{
243 pd->type = value;
244}
245
246static void
247_eldbus_model_connection_connect(Eldbus_Model_Connection_Data *pd) 228_eldbus_model_connection_connect(Eldbus_Model_Connection_Data *pd)
248{ 229{
249 EINA_SAFETY_ON_NULL_RETURN(pd); 230 EINA_SAFETY_ON_NULL_RETURN(pd);
diff --git a/src/lib/eldbus/eldbus_model_connection.eo b/src/lib/eldbus/eldbus_model_connection.eo
index 8a0a392f3b..8d26077848 100644
--- a/src/lib/eldbus/eldbus_model_connection.eo
+++ b/src/lib/eldbus/eldbus_model_connection.eo
@@ -1,3 +1,5 @@
1import eldbus_types;
2
1class Eldbus.Model.Connection (Efl.Object, Efl.Model) { 3class Eldbus.Model.Connection (Efl.Object, Efl.Model) {
2 [[Eldbus model connection class]] 4 [[Eldbus model connection class]]
3 5
@@ -7,25 +9,28 @@ class Eldbus.Model.Connection (Efl.Object, Efl.Model) {
7 9
8 @since 1.16]] 10 @since 1.16]]
9 params { 11 params {
10 @in type: int; [[The connection type]] 12 @in type: Eldbus.Connection.Type; [[The connection type]]
11 @in address: string; [[Remote address of DBus]] 13 @in address: string; [[Remote address of DBus]]
12 @in private_: bool; [[Non shared dbus connection]] 14 @in private_: bool; [[Non shared dbus connection]]
13 } 15 }
14 } 16 }
15 @property type { 17 @property type {
16 [[Connection type]] 18 [[Connection type]]
19 get { }
17 values { 20 values {
18 type: int; [[Connection type]] 21 type: Eldbus.Connection.Type; [[Connection type]]
19 } 22 }
20 } 23 }
21 @property address { 24 @property address {
22 [[Remote DBus address]] 25 [[Remote DBus address]]
26 get { }
23 values { 27 values {
24 address: string; [[Address]] 28 address: string; [[Address]]
25 } 29 }
26 } 30 }
27 @property private { 31 @property private {
28 [[Indicate if the DBus connection is shared or private]] 32 [[Indicate if the DBus connection is shared or private]]
33 get { }
29 values { 34 values {
30 private_: bool; [[Private DBus connection]] 35 private_: bool; [[Private DBus connection]]
31 } 36 }
diff --git a/src/lib/eldbus/eldbus_model_object.c b/src/lib/eldbus/eldbus_model_object.c
index a03030b6a5..b359eaf5e3 100644
--- a/src/lib/eldbus/eldbus_model_object.c
+++ b/src/lib/eldbus/eldbus_model_object.c
@@ -48,7 +48,7 @@ _eldbus_model_object_efl_object_constructor(Eo *obj, Eldbus_Model_Object_Data *p
48static void 48static void
49_eldbus_model_object_constructor(Eo *obj EINA_UNUSED, 49_eldbus_model_object_constructor(Eo *obj EINA_UNUSED,
50 Eldbus_Model_Object_Data *pd, 50 Eldbus_Model_Object_Data *pd,
51 int type, 51 Eldbus_Connection_Type type,
52 const char* address, 52 const char* address,
53 Eina_Bool private, 53 Eina_Bool private,
54 const char* bus, 54 const char* bus,
@@ -231,50 +231,24 @@ _eldbus_model_object_address_get(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *
231 return pd->address; 231 return pd->address;
232} 232}
233 233
234static void
235_eldbus_model_object_address_set(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd, const char *value)
236{
237 eina_stringshare_del(pd->address);
238 pd->address = eina_stringshare_add(value);
239}
240
241static Eina_Bool 234static Eina_Bool
242_eldbus_model_object_private_get(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd) 235_eldbus_model_object_private_get(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd)
243{ 236{
244 return pd->private; 237 return pd->private;
245} 238}
246 239
247static void 240static Eldbus_Connection_Type
248_eldbus_model_object_private_set(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd, Eina_Bool value)
249{
250 pd->private = value;
251}
252
253static int
254_eldbus_model_object_type_get(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd) 241_eldbus_model_object_type_get(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd)
255{ 242{
256 return pd->type; 243 return pd->type;
257} 244}
258 245
259static void
260_eldbus_model_object_type_set(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd, int value)
261{
262 pd->type = value;
263}
264
265static const char * 246static const char *
266_eldbus_model_object_bus_get(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd) 247_eldbus_model_object_bus_get(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd)
267{ 248{
268 return pd->bus; 249 return pd->bus;
269} 250}
270 251
271static void
272_eldbus_model_object_bus_set(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd, const char *value)
273{
274 eina_stringshare_del(pd->bus);
275 pd->bus = eina_stringshare_add(value);
276}
277
278static const char * 252static const char *
279_eldbus_model_object_path_get(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd) 253_eldbus_model_object_path_get(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd)
280{ 254{
@@ -282,13 +256,6 @@ _eldbus_model_object_path_get(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd)
282} 256}
283 257
284static void 258static void
285_eldbus_model_object_path_set(Eo *obj EINA_UNUSED, Eldbus_Model_Object_Data *pd, const char *value)
286{
287 eina_stringshare_del(pd->path);
288 pd->path = eina_stringshare_add(value);
289}
290
291static void
292_eldbus_model_object_connect(Eldbus_Model_Object_Data *pd) 259_eldbus_model_object_connect(Eldbus_Model_Object_Data *pd)
293{ 260{
294 EINA_SAFETY_ON_NULL_RETURN(pd); 261 EINA_SAFETY_ON_NULL_RETURN(pd);
diff --git a/src/lib/eldbus/eldbus_model_object.eo b/src/lib/eldbus/eldbus_model_object.eo
index f02e8bbef7..fde1120aa8 100644
--- a/src/lib/eldbus/eldbus_model_object.eo
+++ b/src/lib/eldbus/eldbus_model_object.eo
@@ -10,7 +10,7 @@ class Eldbus.Model.Object (Efl.Object, Efl.Model) {
10 10
11 @since 1.16]] 11 @since 1.16]]
12 params { 12 params {
13 @in type: int; [[The connection type]] 13 @in type: Eldbus.Connection.Type; [[The connection type]]
14 @in address: string; [[Remote address of DBus]] 14 @in address: string; [[Remote address of DBus]]
15 @in private_: bool; [[Non shared DBus connection]] 15 @in private_: bool; [[Non shared DBus connection]]
16 @in bus: string; [[DBus Name or unique-id]] 16 @in bus: string; [[DBus Name or unique-id]]
@@ -29,30 +29,35 @@ class Eldbus.Model.Object (Efl.Object, Efl.Model) {
29 } 29 }
30 @property type { 30 @property type {
31 [[Connection type]] 31 [[Connection type]]
32 get { }
32 values { 33 values {
33 type: int; [[Connection type]] 34 type: Eldbus.Connection.Type; [[Connection type]]
34 } 35 }
35 } 36 }
36 @property address { 37 @property address {
37 [[Remote address of DBus]] 38 [[Remote address of DBus]]
39 get { }
38 values { 40 values {
39 address: string; [[Address]] 41 address: string; [[Address]]
40 } 42 }
41 } 43 }
42 @property private { 44 @property private {
43 [[Indicate if the DBus connection is shared or private]] 45 [[Indicate if the DBus connection is shared or private]]
46 get { }
44 values { 47 values {
45 private_: bool; [[Private DBus connection]] 48 private_: bool; [[Private DBus connection]]
46 } 49 }
47 } 50 }
48 @property bus { 51 @property bus {
49 [[DBus Name or unique-id]] 52 [[DBus Name or unique-id]]
53 get { }
50 values { 54 values {
51 bus: string; [[DBus name]] 55 bus: string; [[DBus name]]
52 } 56 }
53 } 57 }
54 @property path { 58 @property path {
55 [[DBus path]] 59 [[DBus path]]
60 get { }
56 values { 61 values {
57 path: string; [[DBus path]] 62 path: string; [[DBus path]]
58 } 63 }
diff --git a/src/lib/eldbus/eldbus_types.eot b/src/lib/eldbus/eldbus_types.eot
index 5db90543ae..a4db94e78e 100644
--- a/src/lib/eldbus/eldbus_types.eot
+++ b/src/lib/eldbus/eldbus_types.eot
@@ -4,6 +4,16 @@ struct Eldbus.Proxy; [[Represents a client object bound to an interface]]
4struct Eldbus.Connection; [[Represents a connection of one the type of connection with the DBus daemon.]] 4struct Eldbus.Connection; [[Represents a connection of one the type of connection with the DBus daemon.]]
5struct Eldbus.Object; [[Represents an object path already attached with bus name or unique id]] 5struct Eldbus.Object; [[Represents an object path already attached with bus name or unique id]]
6 6
7enum @extern Eldbus.Connection.Type
8{
9 unknown = 0, [[sentinel, not a real type]]
10 session, [[regular user session bus, used for applications and services running per user]]
11 system, [[system-wide connection bus, used for system services]]
12 starter, [[Uses whatever bus started our application, be session or system]]
13 address, [[A private bus at a specific address]]
14 last, [[sentinel, not a real type]]
15}
16
7enum Eldbus.Introspection.Argument_Direction 17enum Eldbus.Introspection.Argument_Direction
8{ 18{
9 [[Argument direction]] 19 [[Argument direction]]