summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2011-04-08 11:30:38 -0400
committerDavid Zeuthen <davidz@redhat.com>2011-04-08 11:30:38 -0400
commitd1d89198713d32f55b086f96aad9600c784fc869 (patch)
tree61826d39eb0c1814ba6892ba2aaf19bc303301ef
parent6f9c4061ed73b72714854cc27459c855bd47bbfa (diff)
Nuke type-safe callbacks for now
Signed-off-by: David Zeuthen <davidz@redhat.com>
-rw-r--r--src/codegen.py32
-rw-r--r--src/test.c26
2 files changed, 13 insertions, 45 deletions
diff --git a/src/codegen.py b/src/codegen.py
index 490e5c7..e9eb1b9 100644
--- a/src/codegen.py
+++ b/src/codegen.py
@@ -267,38 +267,6 @@ class CodeGenerator:
self.h.write('\n')
self.h.write('\n')
- # macros for typesafe callbacks - TODO: use G_DEFINE_CALLBACK() as proposed here
- #
- # https://mail.gnome.org/archives/gtk-devel-list/2011-March/msg00069.html
- #
- if len(i.methods) > 0:
- self.h.write('\n')
- self.h.write('/* Type-safe signal callbacks */\n')
- self.h.write('#if __GNUC__ >= 4\n')
- for m in i.methods:
- self.h.write('#define %s%s_HANDLE_%s_CALLBACK(f, user_type) (__builtin_choose_expr (__builtin_types_compatible_p (typeof (&f), '
- %(i.ns_upper, i.name_upper, m.name_lower.upper()))
- self.h.write('gboolean (*) (%s*, GDBusMethodInvocation*, '%(i.camel_name))
- for a in m.in_args:
- self.h.write('%s, '%(a.ctype_in))
- self.h.write('user_type)), G_CALLBACK (f), f))\n')
- for s in i.signals:
- self.h.write('#define %s%s_%s_CALLBACK(f, user_type) (__builtin_choose_expr (__builtin_types_compatible_p (typeof (&f), '
- %(i.ns_upper, i.name_upper, s.name_lower.upper()))
- self.h.write('void (*) (%s*, '%(i.camel_name))
- for a in s.args:
- self.h.write('%s, '%(a.ctype_in))
- self.h.write('user_type)), G_CALLBACK (f), f))\n')
- self.h.write('#else /* __GNUC__ >= 4 */\n')
- for m in i.methods:
- self.h.write('#define %s%s_HANDLE_%s_CALLBACK(f, user_type) (G_CALLBACK (f))\n'
- %(i.ns_upper, i.name_upper, m.name_lower.upper()))
- for s in i.signals:
- self.h.write('#define %s%s_%s_CALLBACK(f, user_type) (G_CALLBACK (f))\n'
- %(i.ns_upper, i.name_upper, s.name_lower.upper()))
- self.h.write('#endif /* __GNUC__ >= 4 */\n')
- self.h.write('\n')
-
# Then method call declarations
if len(i.methods) > 0:
self.h.write('\n')
diff --git a/src/test.c b/src/test.c
index b2e0040..43f172f 100644
--- a/src/test.c
+++ b/src/test.c
@@ -437,23 +437,23 @@ on_bus_acquired (GDBusConnection *connection,
g_assert_no_error (error);
g_signal_connect (exported_bar_object,
"handle-hello-world",
- FOO_BAR_HANDLE_HELLO_WORLD_CALLBACK (on_handle_hello_world, gpointer),
+ G_CALLBACK (on_handle_hello_world),
NULL);
g_signal_connect (exported_bar_object,
"handle-test-primitive-types",
- FOO_BAR_HANDLE_TEST_PRIMITIVE_TYPES_CALLBACK (on_handle_test_primitive_types, gpointer),
+ G_CALLBACK (on_handle_test_primitive_types),
NULL);
g_signal_connect (exported_bar_object,
"handle-test-non-primitive-types",
- FOO_BAR_HANDLE_TEST_NON_PRIMITIVE_TYPES_CALLBACK (on_handle_test_non_primitive_types, gpointer),
+ G_CALLBACK (on_handle_test_non_primitive_types),
NULL);
g_signal_connect (exported_bar_object,
"handle-request-signal-emission",
- FOO_BAR_HANDLE_REQUEST_SIGNAL_EMISSION_CALLBACK (on_handle_request_signal_emission, gpointer),
+ G_CALLBACK (on_handle_request_signal_emission),
NULL);
g_signal_connect (exported_bar_object,
"handle-request-multi-property-mods",
- FOO_BAR_HANDLE_REQUEST_MULTI_PROPERTY_MODS_CALLBACK (on_handle_request_multi_property_mods, gpointer),
+ G_CALLBACK (on_handle_request_multi_property_mods),
NULL);
exported_bat_object = foo_bat_stub_new ();
@@ -464,7 +464,7 @@ on_bus_acquired (GDBusConnection *connection,
g_assert_no_error (error);
g_signal_connect (exported_bat_object,
"handle-force-method",
- FOO_BAT_HANDLE_FORCE_METHOD_CALLBACK (on_handle_force_method, gpointer),
+ G_CALLBACK (on_handle_force_method),
NULL);
g_object_set (exported_bat_object,
"force-i", g_variant_new_int32 (43),
@@ -492,15 +492,15 @@ on_bus_acquired (GDBusConnection *connection,
NULL);
g_signal_connect (exported_authorize_object,
"handle-check-not-authorized",
- FOO_AUTHORIZE_HANDLE_CHECK_NOT_AUTHORIZED_CALLBACK (on_handle_check_not_authorized, gpointer),
+ G_CALLBACK (on_handle_check_not_authorized),
NULL);
g_signal_connect (exported_authorize_object,
"handle-check-authorized",
- FOO_AUTHORIZE_HANDLE_CHECK_AUTHORIZED_CALLBACK (on_handle_check_authorized, gpointer),
+ G_CALLBACK (on_handle_check_authorized),
NULL);
g_signal_connect (exported_authorize_object,
"handle-check-not-authorized-from-object",
- FOO_AUTHORIZE_HANDLE_CHECK_NOT_AUTHORIZED_FROM_OBJECT_CALLBACK (on_handle_check_not_authorized_from_object, gpointer),
+ G_CALLBACK (on_handle_check_not_authorized_from_object),
NULL);
@@ -515,7 +515,7 @@ on_bus_acquired (GDBusConnection *connection,
g_assert_no_error (error);
g_signal_connect (exported_thread_object_1,
"handle-get-self",
- FOO_METHOD_THREADS_HANDLE_GET_SELF_CALLBACK (on_handle_get_self, gpointer),
+ G_CALLBACK (on_handle_get_self),
NULL);
exported_thread_object_2 = foo_method_threads_stub_new ();
@@ -526,7 +526,7 @@ on_bus_acquired (GDBusConnection *connection,
g_assert_no_error (error);
g_signal_connect (exported_thread_object_2,
"handle-get-self",
- FOO_METHOD_THREADS_HANDLE_GET_SELF_CALLBACK (on_handle_get_self, gpointer),
+ G_CALLBACK (on_handle_get_self),
NULL);
method_handler_thread = g_thread_self ();
@@ -858,7 +858,7 @@ check_bar_proxy (FooBar *proxy,
g_signal_connect (proxy,
"test-signal",
- FOO_BAR_TEST_SIGNAL_CALLBACK (on_test_signal, gpointer),
+ G_CALLBACK (on_test_signal),
data);
error = NULL;
ret = foo_bar_call_request_signal_emission_sync (proxy, 0, NULL, &error);
@@ -1018,7 +1018,7 @@ check_bat_proxy (FooBat *proxy,
force_signal_received = FALSE;
g_signal_connect (proxy,
"force-signal",
- FOO_BAT_FORCE_SIGNAL_CALLBACK (on_force_signal, gpointer),
+ G_CALLBACK (on_force_signal),
&force_signal_received);
error = NULL;