diff options
author | Ryan Lortie <desrt@desrt.ca> | 2010-07-16 17:27:23 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2010-07-16 17:27:23 -0400 |
commit | 6eec812ad4a014b679e630aca5fc1917a1d2b665 (patch) | |
tree | 2d9d7fb40cc0b1b749d70346aa5d01e45697d2b3 /service | |
parent | e7fd6d849feaea45d76cda1eb074c9ea59b85637 (diff) | |
download | dconf-6eec812ad4a014b679e630aca5fc1917a1d2b665.tar.gz |
Move the GDBus interface to a separate file
Diffstat (limited to 'service')
-rw-r--r-- | service/Makefile.am | 3 | ||||
-rw-r--r-- | service/dconf-interfaces.c | 61 | ||||
-rw-r--r-- | service/dconf-interfaces.h | 4 | ||||
-rw-r--r-- | service/service.c | 58 |
4 files changed, 70 insertions, 56 deletions
diff --git a/service/Makefile.am b/service/Makefile.am index ceb9e7d..f5e3a70 100644 --- a/service/Makefile.am +++ b/service/Makefile.am @@ -9,7 +9,8 @@ dconf_service_LDADD = $(gio_LIBS) dconf_service_SOURCES = \ ../gvdb/gvdb-builder.c \ ../gvdb/gvdb-reader.c \ - dconf-rebuilder.h \ + dconf-interfaces.h \ + dconf-interfaces.c \ dconf-rebuilder.h \ dconf-rebuilder.c \ dconf-writer.h \ diff --git a/service/dconf-interfaces.c b/service/dconf-interfaces.c new file mode 100644 index 0000000..08db86e --- /dev/null +++ b/service/dconf-interfaces.c @@ -0,0 +1,61 @@ +#include "dconf-interfaces.h" + +static const GDBusArgInfo name_arg = { -1, (gchar *) "name", (gchar *) "s" }; +static const GDBusArgInfo path_arg = { -1, (gchar *) "path", (gchar *) "s" }; +static const GDBusArgInfo names_arg = { -1, (gchar *) "names", (gchar *) "as" }; +static const GDBusArgInfo serial_arg = { -1, (gchar *) "serial", (gchar *) "t" }; +static const GDBusArgInfo value_arg = { -1, (gchar *) "value", (gchar *) "av" }; +static const GDBusArgInfo values_arg = { -1, (gchar *) "values", (gchar *) "a(sav)" }; + +static const GDBusArgInfo *write_in[] = { &name_arg, &value_arg, NULL }; +static const GDBusArgInfo *write_out[] = { &serial_arg, NULL }; +static const GDBusArgInfo *many_in[] = { &path_arg, &values_arg, NULL }; +static const GDBusArgInfo *many_out[] = { &serial_arg, NULL }; +static const GDBusArgInfo *notify_args[] = { &path_arg, &names_arg, NULL }; + +static const GDBusMethodInfo write_method = { + -1, (gchar *) "Write", + (GDBusArgInfo **) write_in, + (GDBusArgInfo **) write_out +}; + +static const GDBusMethodInfo writemany_method = { + -1, (gchar *) "WriteMany", + (GDBusArgInfo **) many_in, + (GDBusArgInfo **) many_out +}; + +static const GDBusSignalInfo notify_signal = { + -1, (gchar *) "Notify", + (GDBusArgInfo **) notify_args +}; + +static const GDBusPropertyInfo shmdir_property = { + -1, (gchar *) "ShmDirectory", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE +}; + +static const GDBusMethodInfo *writer_methods[] = { + &write_method, &writemany_method, NULL +}; + +static const GDBusSignalInfo *writer_signals[] = { + ¬ify_signal, NULL +}; + +static const GDBusPropertyInfo *writer_info_properties[] = { + &shmdir_property, NULL +}; + +const GDBusInterfaceInfo ca_desrt_dconf_Writer = { + -1, (gchar *) "ca.desrt.dconf.Writer", + (GDBusMethodInfo **) writer_methods, + (GDBusSignalInfo **) writer_signals, + (GDBusPropertyInfo **) NULL +}; + +const GDBusInterfaceInfo ca_desrt_dconf_WriterInfo = { + -1, (gchar *) "ca.desrt.dconf.WriterInfo", + (GDBusMethodInfo **) NULL, + (GDBusSignalInfo **) NULL, + (GDBusPropertyInfo **) writer_info_properties +}; diff --git a/service/dconf-interfaces.h b/service/dconf-interfaces.h new file mode 100644 index 0000000..d8af50d --- /dev/null +++ b/service/dconf-interfaces.h @@ -0,0 +1,4 @@ +#include <gio/gio.h> + +extern const GDBusInterfaceInfo ca_desrt_dconf_Writer; +extern const GDBusInterfaceInfo ca_desrt_dconf_WriterInfo; diff --git a/service/service.c b/service/service.c index a9d9806..fdbf71c 100644 --- a/service/service.c +++ b/service/service.c @@ -21,8 +21,8 @@ #include <gio/gio.h> #include <string.h> -#include <stdio.h> +#include "dconf-interfaces.h" #include "dconf-writer.h" static guint64 dconf_service_serial; @@ -312,63 +312,11 @@ subtree_introspect (GDBusConnection *connection, const gchar *node, gpointer user_data) { - static const GDBusArgInfo name_arg = { -1, (gchar *) "name", (gchar *) "s" }; - static const GDBusArgInfo path_arg = { -1, (gchar *) "path", (gchar *) "s" }; - static const GDBusArgInfo names_arg = { -1, (gchar *) "names", (gchar *) "as" }; - static const GDBusArgInfo serial_arg = { -1, (gchar *) "serial", (gchar *) "t" }; - static const GDBusArgInfo value_arg = { -1, (gchar *) "value", (gchar *) "av" }; - static const GDBusArgInfo values_arg = { -1, (gchar *) "values", (gchar *) "a(sav)" }; - - static const GDBusArgInfo *write_in[] = { &name_arg, &value_arg, NULL }; - static const GDBusArgInfo *write_out[] = { &serial_arg, NULL }; - static const GDBusArgInfo *many_in[] = { &path_arg, &values_arg, NULL }; - static const GDBusArgInfo *many_out[] = { &serial_arg, NULL }; - static const GDBusArgInfo *notify_args[] = { &path_arg, &names_arg, NULL }; - - static const GDBusMethodInfo write_method = { - -1, (gchar *) "Write", - (GDBusArgInfo **) write_in, - (GDBusArgInfo **) write_out - }; - static const GDBusMethodInfo writemany_method = { - -1, (gchar *) "WriteMany", - (GDBusArgInfo **) many_in, - (GDBusArgInfo **) many_out - }; - static const GDBusSignalInfo notify_signal = { - -1, (gchar *) "Notify", - (GDBusArgInfo **) notify_args - }; - static const GDBusPropertyInfo shmdir_property = { - -1, (gchar *) "ShmDirectory", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE - }; - static const GDBusMethodInfo *writer_methods[] = { - &write_method, &writemany_method, NULL - }; - static const GDBusSignalInfo *writer_signals[] = { - ¬ify_signal, NULL - }; - static const GDBusPropertyInfo *writer_info_properties[] = { - &shmdir_property, NULL - }; - static const GDBusInterfaceInfo writer_interface = { - -1, (gchar *) "ca.desrt.dconf.Writer", - (GDBusMethodInfo **) writer_methods, - (GDBusSignalInfo **) writer_signals, - (GDBusPropertyInfo **) NULL - }; - static const GDBusInterfaceInfo writer_info_interface = { - -1, (gchar *) "ca.desrt.dconf.WriterInfo", - (GDBusMethodInfo **) NULL, - (GDBusSignalInfo **) NULL, - (GDBusPropertyInfo **) writer_info_properties - }; - /* The root node supports only the info iface */ if (node == NULL) { const GDBusInterfaceInfo *interfaces[] = { - &writer_info_interface, NULL + &ca_desrt_dconf_WriterInfo, NULL }; return g_memdup (interfaces, sizeof interfaces); @@ -376,7 +324,7 @@ subtree_introspect (GDBusConnection *connection, else { const GDBusInterfaceInfo *interfaces[] = { - &writer_info_interface, &writer_interface, NULL + &ca_desrt_dconf_WriterInfo, &ca_desrt_dconf_Writer, NULL }; return g_memdup (interfaces, sizeof interfaces); |