diff options
author | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2012-10-04 04:26:26 -0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-11-26 14:48:49 +0100 |
commit | 2e0c245819eeeca94fc9daf65443bb40e80b49a9 (patch) | |
tree | 106b191999e731c667c478ddd1448e3f8df0bf7c /gdbus/object.c | |
parent | f31e928ccc87172d006a6ebd547e2c6cc39b1f92 (diff) | |
download | neard-2e0c245819eeeca94fc9daf65443bb40e80b49a9.tar.gz neard-2e0c245819eeeca94fc9daf65443bb40e80b49a9.tar.bz2 neard-2e0c245819eeeca94fc9daf65443bb40e80b49a9.zip |
gdbus: Use macros to add annotations
Besides being more readable this way it avoids going over 80 chars.
Diffstat (limited to 'gdbus/object.c')
-rw-r--r-- | gdbus/object.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/gdbus/object.c b/gdbus/object.c index 9689006..24e8285 100644 --- a/gdbus/object.c +++ b/gdbus/object.c @@ -76,6 +76,16 @@ static void print_arguments(GString *gstr, const GDBusArgInfo *args, } } +#define G_DBUS_ANNOTATE(prefix_, name_, value_) \ + prefix_ "<annotation name=\"org.freedesktop.DBus." name_ "\" " \ + "value=\"" value_ "\"/>\n" + +#define G_DBUS_ANNOTATE_DEPRECATED(prefix_) \ + G_DBUS_ANNOTATE(prefix_, "Deprecated", "true") + +#define G_DBUS_ANNOTATE_NOREPLY(prefix_) \ + G_DBUS_ANNOTATE(prefix_, "Method.NoReply", "true") + static void generate_interface_xml(GString *gstr, struct interface_data *iface) { const GDBusMethodTable *method; @@ -90,19 +100,22 @@ static void generate_interface_xml(GString *gstr, struct interface_data *iface) if (!deprecated && !noreply && !(method->in_args && method->in_args->name) && !(method->out_args && method->out_args->name)) - g_string_append_printf(gstr, "\t\t<method name=\"%s\"/>\n", - method->name); + g_string_append_printf(gstr, + "\t\t<method name=\"%s\"/>\n", + method->name); else { - g_string_append_printf(gstr, "\t\t<method name=\"%s\">\n", - method->name); + g_string_append_printf(gstr, + "\t\t<method name=\"%s\">\n", + method->name); print_arguments(gstr, method->in_args, "in"); print_arguments(gstr, method->out_args, "out"); if (deprecated) - g_string_append_printf(gstr, "\t\t\t<annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n"); - + g_string_append_printf(gstr, + G_DBUS_ANNOTATE_DEPRECATED("\t\t\t")); if (noreply) - g_string_append_printf(gstr, "\t\t\t<annotation name=\"org.freedesktop.DBus.Method.NoReply\" value=\"true\"/>\n"); + g_string_append_printf(gstr, + G_DBUS_ANNOTATE_NOREPLY("\t\t\t")); g_string_append_printf(gstr, "\t\t</method>\n"); } @@ -113,15 +126,18 @@ static void generate_interface_xml(GString *gstr, struct interface_data *iface) G_DBUS_SIGNAL_FLAG_DEPRECATED; if (!deprecated && !(signal->args && signal->args->name)) - g_string_append_printf(gstr, "\t\t<signal name=\"%s\"/>\n", - signal->name); + g_string_append_printf(gstr, + "\t\t<signal name=\"%s\"/>\n", + signal->name); else { - g_string_append_printf(gstr, "\t\t<signal name=\"%s\">\n", - signal->name); + g_string_append_printf(gstr, + "\t\t<signal name=\"%s\">\n", + signal->name); print_arguments(gstr, signal->args, NULL); if (deprecated) - g_string_append_printf(gstr, "\t\t\t<annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n"); + g_string_append_printf(gstr, + G_DBUS_ANNOTATE_DEPRECATED("\t\t\t")); g_string_append_printf(gstr, "\t\t</signal>\n"); } |