vala r1982 - in trunk: . gobject vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1982 - in trunk: . gobject vala
- Date: Wed, 5 Nov 2008 18:17:57 +0000 (UTC)
Author: juergbi
Date: Wed Nov 5 18:17:57 2008
New Revision: 1982
URL: http://svn.gnome.org/viewvc/vala?rev=1982&view=rev
Log:
2008-11-05 JÃrg Billeter <j bitron ch>
* vala/valaenum.vala:
* gobject/valadbusclientmodule.vala:
* gobject/valagsignalmodule.vala:
Support enums in D-Bus clients and servers, fixes bug 534105
Modified:
trunk/ChangeLog
trunk/gobject/valadbusclientmodule.vala
trunk/gobject/valagsignalmodule.vala
trunk/vala/valaenum.vala
Modified: trunk/gobject/valadbusclientmodule.vala
==============================================================================
--- trunk/gobject/valadbusclientmodule.vala (original)
+++ trunk/gobject/valadbusclientmodule.vala Wed Nov 5 18:17:57 2008
@@ -460,6 +460,13 @@
}
carray_type.add_argument (get_dbus_g_type (array_type.element_type));
return carray_type;
+ } else if (data_type.data_type is Enum) {
+ var en = (Enum) data_type.data_type;
+ if (en.is_flags) {
+ return new CCodeIdentifier ("G_TYPE_UINT");
+ } else {
+ return new CCodeIdentifier ("G_TYPE_INT");
+ }
} else if (data_type.data_type == null) {
critical ("Internal error during DBus type generation with: %s", data_type.to_string ());
return new CCodeIdentifier ("G_TYPE_NONE");
Modified: trunk/gobject/valagsignalmodule.vala
==============================================================================
--- trunk/gobject/valagsignalmodule.vala (original)
+++ trunk/gobject/valagsignalmodule.vala Wed Nov 5 18:17:57 2008
@@ -47,6 +47,17 @@
return ("VOID");
} else if (dbus && t.get_type_signature ().has_prefix ("(")) {
return ("BOXED");
+ } else if (t.data_type is Enum) {
+ var en = (Enum) t.data_type;
+ if (dbus) {
+ if (en.is_flags) {
+ return ("UINT");
+ } else {
+ return ("INT");
+ }
+ } else {
+ return en.get_marshaller_type_name ();
+ }
} else {
return t.data_type.get_marshaller_type_name ();
}
@@ -266,6 +277,13 @@
get_value_function = "g_value_get_pointer";
} else if (dbus && p.parameter_type.get_type_signature ().has_prefix ("(")) {
get_value_function = "g_value_get_boxed";
+ } else if (dbus && p.parameter_type.data_type is Enum) {
+ var en = (Enum) p.parameter_type.data_type;
+ if (en.is_flags) {
+ get_value_function = "g_value_get_uint";
+ } else {
+ get_value_function = "g_value_get_int";
+ }
} else {
get_value_function = p.parameter_type.data_type.get_get_value_function ();
}
@@ -306,6 +324,13 @@
set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_take_object"));
} else if (dbus && return_type.get_type_signature ().has_prefix ("(")) {
set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_take_boxed"));
+ } else if (dbus && return_type.data_type is Enum) {
+ var en = (Enum) return_type.data_type;
+ if (en.is_flags) {
+ set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_set_uint"));
+ } else {
+ set_fc = new CCodeFunctionCall (new CCodeIdentifier ("g_value_set_int"));
+ }
} else {
set_fc = new CCodeFunctionCall (new CCodeIdentifier (return_type.data_type.get_set_value_function ()));
}
Modified: trunk/vala/valaenum.vala
==============================================================================
--- trunk/vala/valaenum.vala (original)
+++ trunk/vala/valaenum.vala Wed Nov 5 18:17:57 2008
@@ -289,4 +289,12 @@
public override string? get_default_value () {
return "0";
}
+
+ public override string? get_type_signature () {
+ if (is_flags) {
+ return "u";
+ } else {
+ return "i";
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]