aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib/server.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-10-14 13:43:09 -0500
committerTed Gould <ted@gould.cx>2010-10-14 13:43:09 -0500
commite170f6516419cf403931916ac9f6a4b3a0b1997c (patch)
tree1d769d2f0953892f00724ef4eba8364708027ca3 /libdbusmenu-glib/server.c
parent2cc94b5a4b7016d8bf01eec34b6ff7e771d8e682 (diff)
downloadlibdbusmenu-e170f6516419cf403931916ac9f6a4b3a0b1997c.tar.gz
libdbusmenu-e170f6516419cf403931916ac9f6a4b3a0b1997c.tar.bz2
libdbusmenu-e170f6516419cf403931916ac9f6a4b3a0b1997c.zip
Fleshing out the method call function to use the table
Diffstat (limited to 'libdbusmenu-glib/server.c')
-rw-r--r--libdbusmenu-glib/server.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c
index ddf242f..493bbdf 100644
--- a/libdbusmenu-glib/server.c
+++ b/libdbusmenu-glib/server.c
@@ -508,7 +508,27 @@ bus_got_cb (GObject * obj, GAsyncResult * result, gpointer user_data)
static void
bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * method, GVariant * params, GDBusMethodInvocation * invocation, gpointer user_data)
{
+ int i;
+ const gchar * interned_method = g_intern_string(method);
+
+ for (i = 0; i < METHOD_COUNT; i++) {
+ if (dbusmenu_method_table[i].interned_name == interned_method) {
+ if (dbusmenu_method_table[i].func != NULL) {
+ return dbusmenu_method_table[i].func(DBUSMENU_SERVER(user_data), params, invocation);
+ } else {
+ /* If we have a null function we're responding but nothing else. */
+ g_dbus_method_invocation_return_value(invocation, NULL);
+ return;
+ }
+ }
+ }
+ /* We're here because there's an error */
+ g_dbus_method_invocation_return_error(invocation,
+ error_quark(),
+ NOT_IMPLEMENTED,
+ "Unable to find method '%s'",
+ method);
return;
}