[vala] Fix compatibility with GLib 2.16 for D-Bus and GAsync support
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Fix compatibility with GLib 2.16 for D-Bus and GAsync support
- Date: Mon, 22 Mar 2010 08:58:46 +0000 (UTC)
commit 53dfc50cdd1a755f445db0abcdcb1bed27760919
Author: Michal Hruby <michal mhr gmail com>
Date: Mon Mar 22 09:56:36 2010 +0100
Fix compatibility with GLib 2.16 for D-Bus and GAsync support
Fixes bug 598546.
codegen/valadbusclientmodule.vala | 6 ++++--
codegen/valadbusmodule.vala | 3 ++-
codegen/valagasyncmodule.vala | 11 ++++++++++-
3 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valadbusclientmodule.vala b/codegen/valadbusclientmodule.vala
index f3c97c3..7d4e4c1 100644
--- a/codegen/valadbusclientmodule.vala
+++ b/codegen/valadbusclientmodule.vala
@@ -1703,10 +1703,11 @@ internal class Vala.DBusClientModule : DBusModule {
generate_client_error_cases (error_block, error_types, new CCodeMemberAccess (new CCodeIdentifier ("_dbus_error"), "name"), new CCodeIdentifier ("_edomain"), new CCodeIdentifier ("_ecode"));
- var g_set_error = new CCodeFunctionCall (new CCodeIdentifier ("g_set_error_literal"));
+ var g_set_error = new CCodeFunctionCall (new CCodeIdentifier ("g_set_error"));
g_set_error.add_argument (new CCodeIdentifier ("error"));
g_set_error.add_argument (new CCodeIdentifier ("_edomain"));
g_set_error.add_argument (new CCodeIdentifier ("_ecode"));
+ g_set_error.add_argument (new CCodeConstant ("\"%s\""));
g_set_error.add_argument (new CCodeMemberAccess (new CCodeIdentifier ("_dbus_error"), "message"));
error_block.add_statement (new CCodeExpressionStatement (g_set_error));
@@ -1746,10 +1747,11 @@ internal class Vala.DBusClientModule : DBusModule {
// throw error and return if proxy is disposed
var dispose_return_block = new CCodeBlock ();
if (m.get_error_types ().size > 0) {
- var set_error_call = new CCodeFunctionCall (new CCodeIdentifier ("g_set_error_literal"));
+ var set_error_call = new CCodeFunctionCall (new CCodeIdentifier ("g_set_error"));
set_error_call.add_argument (new CCodeIdentifier ("error"));
set_error_call.add_argument (new CCodeIdentifier ("DBUS_GERROR"));
set_error_call.add_argument (new CCodeIdentifier ("DBUS_GERROR_DISCONNECTED"));
+ set_error_call.add_argument (new CCodeConstant ("\"%s\""));
set_error_call.add_argument (new CCodeConstant ("\"Connection is closed\""));
dispose_return_block.add_statement (new CCodeExpressionStatement (set_error_call));
}
diff --git a/codegen/valadbusmodule.vala b/codegen/valadbusmodule.vala
index 8325aa6..83ff555 100644
--- a/codegen/valadbusmodule.vala
+++ b/codegen/valadbusmodule.vala
@@ -256,10 +256,11 @@ internal class Vala.DBusModule : GAsyncModule {
var error_block = new CCodeBlock ();
error_block.suppress_newline = true;
- var set_error_call = new CCodeFunctionCall (new CCodeIdentifier ("g_set_error_literal"));
+ var set_error_call = new CCodeFunctionCall (new CCodeIdentifier ("g_set_error"));
set_error_call.add_argument (new CCodeIdentifier ("error"));
set_error_call.add_argument (new CCodeIdentifier ("DBUS_GERROR"));
set_error_call.add_argument (new CCodeIdentifier ("DBUS_GERROR_INVALID_ARGS"));
+ set_error_call.add_argument (new CCodeConstant ("\"%s\""));
set_error_call.add_argument (new CCodeConstant ("\"Invalid enumeration value\""));
error_block.add_statement (new CCodeExpressionStatement (set_error_call));
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index c9d9d76..ae3c105 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -180,7 +180,16 @@ internal class Vala.GAsyncModule : GSignalModule {
create_result.add_argument (gobject_cast);
} else {
- create_result.add_argument (new CCodeConstant ("NULL"));
+ if (context.require_glib_version (2, 20)) {
+ create_result.add_argument (new CCodeConstant ("NULL"));
+ } else {
+ var object_creation = new CCodeFunctionCall (new CCodeIdentifier ("g_object_newv"));
+ object_creation.add_argument (new CCodeConstant ("G_TYPE_OBJECT"));
+ object_creation.add_argument (new CCodeConstant ("0"));
+ object_creation.add_argument (new CCodeConstant ("NULL"));
+
+ create_result.add_argument (object_creation);
+ }
}
create_result.add_argument (new CCodeIdentifier ("_callback_"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]