- New upstream 0.82
- Remove mclasen accidental commit of CFLAGS="-O0 -g3"
This commit is contained in:
parent
6a43f9b52e
commit
83afce05e7
@ -1 +1 @@
|
||||
dbus-glib-0.80.tar.gz
|
||||
dbus-glib-0.82.tar.gz
|
||||
|
||||
@ -1,127 +0,0 @@
|
||||
From a9eaac78c30a9a2728384b88eb6667504b758e24 Mon Sep 17 00:00:00 2001
|
||||
From: Colin Walters <walters@verbum.org>
|
||||
Date: Wed, 7 Jan 2009 10:02:12 -0500
|
||||
Subject: [PATCH] Bug 19441 - Don't send reply when none is requested
|
||||
|
||||
It's normally harmless, but unrequested replies now get noisly
|
||||
denied by the system bus.
|
||||
---
|
||||
dbus/dbus-gobject.c | 42 ++++++++++++++++++++++++------------------
|
||||
1 files changed, 24 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/dbus/dbus-gobject.c b/dbus/dbus-gobject.c
|
||||
index 572fafd..107dd10 100644
|
||||
--- a/dbus/dbus-gobject.c
|
||||
+++ b/dbus/dbus-gobject.c
|
||||
@@ -1117,7 +1117,7 @@ invoke_object_method (GObject *object,
|
||||
DBusConnection *connection,
|
||||
DBusMessage *message)
|
||||
{
|
||||
- gboolean had_error, call_only;
|
||||
+ gboolean had_error, use_thread, send_reply;
|
||||
GError *gerror;
|
||||
GValueArray *value_array;
|
||||
GValue return_value = {0,};
|
||||
@@ -1128,7 +1128,7 @@ invoke_object_method (GObject *object,
|
||||
int out_param_count;
|
||||
int out_param_pos, out_param_gvalue_pos;
|
||||
DBusHandlerResult result;
|
||||
- DBusMessage *reply;
|
||||
+ DBusMessage *reply = NULL;
|
||||
gboolean have_retval;
|
||||
gboolean retval_signals_error;
|
||||
gboolean retval_is_synthetic;
|
||||
@@ -1140,10 +1140,8 @@ invoke_object_method (GObject *object,
|
||||
/* Determine whether or not this method should be invoked in a new
|
||||
thread
|
||||
*/
|
||||
- if (strcmp (string_table_lookup (get_method_data (object_info, method), 2), "A") == 0)
|
||||
- call_only = TRUE;
|
||||
- else
|
||||
- call_only = FALSE;
|
||||
+ use_thread = strcmp (string_table_lookup (get_method_data (object_info, method), 2), "A") == 0;
|
||||
+ send_reply = !dbus_message_get_no_reply (message);
|
||||
|
||||
have_retval = FALSE;
|
||||
retval_signals_error = FALSE;
|
||||
@@ -1194,7 +1192,7 @@ invoke_object_method (GObject *object,
|
||||
g_value_init (g_value_array_get_nth (value_array, 0), G_TYPE_OBJECT);
|
||||
g_value_set_object (g_value_array_get_nth (value_array, 0), object);
|
||||
|
||||
- if (call_only)
|
||||
+ if (use_thread)
|
||||
{
|
||||
GValue context_value = {0,};
|
||||
DBusGMethodInvocation *context;
|
||||
@@ -1340,7 +1338,7 @@ invoke_object_method (GObject *object,
|
||||
value_array->n_values,
|
||||
value_array->values,
|
||||
NULL, method->function);
|
||||
- if (call_only)
|
||||
+ if (use_thread)
|
||||
{
|
||||
result = DBUS_HANDLER_RESULT_HANDLED;
|
||||
goto done;
|
||||
@@ -1354,17 +1352,25 @@ invoke_object_method (GObject *object,
|
||||
{
|
||||
DBusMessageIter iter;
|
||||
|
||||
- reply = dbus_message_new_method_return (message);
|
||||
- if (reply == NULL)
|
||||
- goto nomem;
|
||||
+ /* Careful here - there are two major cases in this section of the code.
|
||||
+ * If send_reply is TRUE, we're constructing a dbus message and freeing
|
||||
+ * the return values. If it's FALSE, then we just need to free the
|
||||
+ * values.
|
||||
+ */
|
||||
+ if (send_reply)
|
||||
+ {
|
||||
+ reply = dbus_message_new_method_return (message);
|
||||
+ if (reply == NULL)
|
||||
+ goto nomem;
|
||||
|
||||
- /* Append output arguments to reply */
|
||||
- dbus_message_iter_init_append (reply, &iter);
|
||||
+ /* Append output arguments to reply */
|
||||
+ dbus_message_iter_init_append (reply, &iter);
|
||||
+ }
|
||||
|
||||
/* First, append the return value, unless it's synthetic */
|
||||
if (have_retval && !retval_is_synthetic)
|
||||
- {
|
||||
- if (!_dbus_gvalue_marshal (&iter, &return_value))
|
||||
+ {
|
||||
+ if (send_reply && !_dbus_gvalue_marshal (&iter, &return_value))
|
||||
goto nomem;
|
||||
if (!retval_is_constant)
|
||||
g_value_unset (&return_value);
|
||||
@@ -1416,7 +1422,7 @@ invoke_object_method (GObject *object,
|
||||
out_param_gvalue_pos++;
|
||||
}
|
||||
|
||||
- if (!_dbus_gvalue_marshal (&iter, &gvalue))
|
||||
+ if (send_reply && !_dbus_gvalue_marshal (&iter, &gvalue))
|
||||
goto nomem;
|
||||
/* Here we actually free the allocated value; we
|
||||
* took ownership of it with _dbus_gvalue_take, unless
|
||||
@@ -1426,7 +1432,7 @@ invoke_object_method (GObject *object,
|
||||
g_value_unset (&gvalue);
|
||||
}
|
||||
}
|
||||
- else
|
||||
+ else if (send_reply)
|
||||
reply = gerror_to_dbus_error_message (object_info, message, gerror);
|
||||
|
||||
if (reply)
|
||||
@@ -1438,7 +1444,7 @@ invoke_object_method (GObject *object,
|
||||
result = DBUS_HANDLER_RESULT_HANDLED;
|
||||
done:
|
||||
g_free (in_signature);
|
||||
- if (!call_only)
|
||||
+ if (!use_thread)
|
||||
{
|
||||
g_array_free (out_param_values, TRUE);
|
||||
g_value_array_free (out_param_gvalues);
|
||||
--
|
||||
1.6.0.6
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
diff -up dbus-glib-0.74/dbus/dbus-gobject.c.getall-wincaps-to-uscore dbus-glib-0.74/dbus/dbus-gobject.c
|
||||
--- dbus-glib-0.74/dbus/dbus-gobject.c.getall-wincaps-to-uscore 2008-05-27 08:49:46.000000000 -0400
|
||||
+++ dbus-glib-0.74/dbus/dbus-gobject.c 2008-05-27 09:39:13.000000000 -0400
|
||||
@@ -775,6 +775,7 @@ get_all_object_properties (DBusConnectio
|
||||
DBusMessageIter iter_dict_entry;
|
||||
DBusMessageIter iter_dict_value;
|
||||
const char *p;
|
||||
+ char *uscore_propname;
|
||||
|
||||
ret = dbus_message_new_method_return (message);
|
||||
if (ret == NULL)
|
||||
@@ -815,13 +816,18 @@ get_all_object_properties (DBusConnectio
|
||||
p++;
|
||||
p++;
|
||||
|
||||
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), prop_name);
|
||||
+ uscore_propname = _dbus_gutils_wincaps_to_uscore (prop_name);
|
||||
+
|
||||
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), uscore_propname);
|
||||
if (pspec == NULL)
|
||||
{
|
||||
- g_warning ("introspection data references non-existing property %s", prop_name);
|
||||
+ g_warning ("introspection data references non-existing property %s", uscore_propname);
|
||||
+ g_free (uscore_propname);
|
||||
continue;
|
||||
}
|
||||
|
||||
+ g_free (uscore_propname);
|
||||
+
|
||||
g_value_init (&value, pspec->value_type);
|
||||
g_object_get_property (object, pspec->name, &value);
|
||||
|
||||
@ -1,629 +0,0 @@
|
||||
From 91f6977a2dc01207072b5718b89c57f439f9339a Mon Sep 17 00:00:00 2001
|
||||
From: David Zeuthen <davidz@redhat.com>
|
||||
Date: Thu, 31 Jul 2008 12:28:07 -0400
|
||||
Subject: [PATCH] add bash completion for dbus-send(1)
|
||||
|
||||
For now, it's in dbus-glib since dbus doesn't have an introspection
|
||||
XML parser (yet).
|
||||
---
|
||||
configure.ac | 13 +
|
||||
dbus/Makefile.am | 17 ++-
|
||||
dbus/dbus-bash-completion-helper.c | 513 ++++++++++++++++++++++++++++++++++++
|
||||
dbus/dbus-bash-completion.sh.in | 21 ++
|
||||
4 files changed, 563 insertions(+), 1 deletions(-)
|
||||
create mode 100644 dbus/dbus-bash-completion-helper.c
|
||||
create mode 100644 dbus/dbus-bash-completion.sh.in
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 839e0e1..a163935 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -54,11 +54,23 @@ AC_ARG_ENABLE(asserts, AS_HELP_STRING([--enable-asserts],[include assertion chec
|
||||
AC_ARG_ENABLE(checks, AS_HELP_STRING([--enable-checks],[include sanity checks on public API]),enable_checks=$enableval,enable_checks=yes)
|
||||
AC_ARG_ENABLE(doxygen-docs, AS_HELP_STRING([--enable-doxygen-docs],[build DOXYGEN documentation (requires Doxygen)]),enable_doxygen_docs=$enableval,enable_doxygen_docs=auto)
|
||||
AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov],[compile with coverage profiling instrumentation (gcc only)]),enable_gcov=$enableval,enable_gcov=no)
|
||||
+AC_ARG_ENABLE(bash-completion, AS_HELP_STRING([--enable-bash-completion],[install bash completion scripts]),enable_bash_completion=$enableval,enable_bash_completion=yes)
|
||||
AC_ARG_WITH(test-socket-dir, AS_HELP_STRING([--with-test-socket-dir=[dirname]],[Where to put sockets for make check]))
|
||||
|
||||
|
||||
AC_ARG_WITH(introspect-xml, AS_HELP_STRING([--with-introspect-xml=[filename]],[Pass in a pregenerated dbus daemon introspection xml file (as generated by 'dbus-daemon --introspect') to use instead of querying the installed dbus daemon]))
|
||||
|
||||
+
|
||||
+AM_CONDITIONAL(DBUS_BASH_COMPLETION, test x$enable_bash_completion = xyes)
|
||||
+if test x$enable_bash_completion = xyes; then
|
||||
+ AC_DEFINE(DBUS_BASH_COMPLETION,1,[Enable bash completion])
|
||||
+fi
|
||||
+
|
||||
+if test x$enable_verbose_mode = xyes; then
|
||||
+ AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
|
||||
+fi
|
||||
+
|
||||
+
|
||||
dnl DBUS_BUILD_TESTS controls unit tests built in to .c files
|
||||
dnl and also some stuff in the test/ subdir
|
||||
AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
|
||||
@@ -867,6 +879,7 @@ echo "
|
||||
Building checks: ${enable_checks}
|
||||
Building Doxygen docs: ${enable_doxygen_docs}
|
||||
Building Gtk-doc docs: ${enable_gtk_doc}
|
||||
+ Bash Completion: ${enable_bash_completion}
|
||||
Gettext libs (empty OK): ${INTLLIBS}
|
||||
Using XML parser: ${with_xml}
|
||||
'make check' socket dir: ${TEST_SOCKET_DIR}
|
||||
diff --git a/dbus/Makefile.am b/dbus/Makefile.am
|
||||
index 2650e8b..bd01d7f 100644
|
||||
--- a/dbus/Makefile.am
|
||||
+++ b/dbus/Makefile.am
|
||||
@@ -91,7 +91,22 @@ regenerate-built-sources:
|
||||
echo '#include "dbus-gmarshal.h"' > dbus-gmarshal.c && \
|
||||
@GLIB_GENMARSHAL@ --prefix=_dbus_g_marshal dbus-gmarshal.list --body >> dbus-gmarshal.c
|
||||
|
||||
-EXTRA_DIST=dbus-gmarshal.list make-dbus-glib-error-switch.sh make-dbus-glib-error-enum.sh
|
||||
+
|
||||
+profiledir = $(sysconfdir)/profile.d
|
||||
+if DBUS_BASH_COMPLETION
|
||||
+libexec_PROGRAMS=dbus-bash-completion-helper
|
||||
+profile_SCRIPTS=dbus-bash-completion.sh
|
||||
+endif
|
||||
+
|
||||
+dbus-bash-completion.sh : dbus-bash-completion.sh.in
|
||||
+ @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
|
||||
+
|
||||
+dbus_bash_completion_helper_SOURCES = \
|
||||
+ dbus-bash-completion-helper.c
|
||||
+dbus_bash_completion_helper_LDADD=$(DBUS_LIBS) $(DBUS_GLIB_LIBS) -lexpat libdbus-gtool.la libdbus-glib-1.la
|
||||
+
|
||||
+
|
||||
+EXTRA_DIST=dbus-gmarshal.list make-dbus-glib-error-switch.sh make-dbus-glib-error-enum.sh dbus-bash-completion.sh.in
|
||||
|
||||
if DBUS_BUILD_TESTS
|
||||
|
||||
diff --git a/dbus/dbus-bash-completion-helper.c b/dbus/dbus-bash-completion-helper.c
|
||||
new file mode 100644
|
||||
index 0000000..022c722
|
||||
--- /dev/null
|
||||
+++ b/dbus/dbus-bash-completion-helper.c
|
||||
@@ -0,0 +1,513 @@
|
||||
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
+/* dbus-bash-completion-helper.c Bash Completion helper routines
|
||||
+ *
|
||||
+ * Copyright (C) 2008 David Zeuthen <davidz@redhat.com>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <config.h>
|
||||
+#include <ctype.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include <dbus/dbus.h>
|
||||
+#include <glib.h>
|
||||
+#include "dbus-gparser.h"
|
||||
+
|
||||
+static void
|
||||
+print_services (DBusConnection *connection)
|
||||
+{
|
||||
+ DBusMessage *message;
|
||||
+ DBusMessage *reply;
|
||||
+ DBusError error;
|
||||
+ DBusMessageIter iter;
|
||||
+ DBusMessageIter iter_array;
|
||||
+ const char *name;
|
||||
+
|
||||
+ /* list both active and activatable names (the shell will sort and
|
||||
+ * uniquify them) - also avoid names that are not well-known
|
||||
+ * (e.g. :1.42).
|
||||
+ */
|
||||
+
|
||||
+ message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
|
||||
+ DBUS_PATH_DBUS,
|
||||
+ DBUS_INTERFACE_DBUS,
|
||||
+ "ListNames");
|
||||
+ dbus_error_init (&error);
|
||||
+ reply = dbus_connection_send_with_reply_and_block (connection,
|
||||
+ message,
|
||||
+ -1,
|
||||
+ &error);
|
||||
+ dbus_message_unref (message);
|
||||
+ dbus_message_iter_init (reply, &iter);
|
||||
+ dbus_message_iter_recurse (&iter, &iter_array);
|
||||
+ while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID)
|
||||
+ {
|
||||
+ dbus_message_iter_get_basic (&iter_array, &name);
|
||||
+ if (name[0] != ':')
|
||||
+ printf ("%s \n", name);
|
||||
+ dbus_message_iter_next (&iter_array);
|
||||
+ }
|
||||
+ dbus_message_unref (reply);
|
||||
+
|
||||
+ message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
|
||||
+ DBUS_PATH_DBUS,
|
||||
+ DBUS_INTERFACE_DBUS,
|
||||
+ "ListActivatableNames");
|
||||
+ dbus_error_init (&error);
|
||||
+ reply = dbus_connection_send_with_reply_and_block (connection,
|
||||
+ message,
|
||||
+ -1,
|
||||
+ &error);
|
||||
+ dbus_message_unref (message);
|
||||
+ dbus_message_iter_init (reply, &iter);
|
||||
+ dbus_message_iter_recurse (&iter, &iter_array);
|
||||
+ while (dbus_message_iter_get_arg_type (&iter_array) != DBUS_TYPE_INVALID)
|
||||
+ {
|
||||
+ dbus_message_iter_get_basic (&iter_array, &name);
|
||||
+ printf ("%s \n", name);
|
||||
+ dbus_message_iter_next (&iter_array);
|
||||
+ }
|
||||
+ dbus_message_unref (reply);
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+have_option (char **tokens, const char *option)
|
||||
+{
|
||||
+ int n;
|
||||
+ for (n = 0; tokens[n] != NULL; n++)
|
||||
+ if (strcmp (tokens[n], option) == 0)
|
||||
+ return TRUE;
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+have_option_with_value (char **tokens, const char *option, const char **value)
|
||||
+{
|
||||
+ int n;
|
||||
+ for (n = 0; tokens[n] != NULL; n++)
|
||||
+ {
|
||||
+ if (g_str_has_prefix (tokens[n], option))
|
||||
+ {
|
||||
+ if (strlen (tokens[n]) > strlen (option))
|
||||
+ *value = tokens[n] + strlen (option);
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+ }
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+print_objects (DBusConnection *connection, const char *service_name, const char *cur)
|
||||
+{
|
||||
+ DBusMessage *message;
|
||||
+ DBusMessage *reply;
|
||||
+ DBusError error;
|
||||
+ DBusMessageIter iter;
|
||||
+ const char *introspection_xml;
|
||||
+ NodeInfo *root;
|
||||
+ GSList *nodes;
|
||||
+ GSList *l;
|
||||
+
|
||||
+ if (cur == NULL)
|
||||
+ cur = "/";
|
||||
+
|
||||
+ message = dbus_message_new_method_call (service_name,
|
||||
+ cur,
|
||||
+ DBUS_INTERFACE_INTROSPECTABLE,
|
||||
+ "Introspect");
|
||||
+ dbus_error_init (&error);
|
||||
+ reply = dbus_connection_send_with_reply_and_block (connection,
|
||||
+ message,
|
||||
+ -1,
|
||||
+ &error);
|
||||
+ dbus_message_unref (message);
|
||||
+ dbus_message_iter_init (reply, &iter);
|
||||
+ dbus_message_iter_get_basic (&iter, &introspection_xml);
|
||||
+
|
||||
+ root = description_load_from_string (introspection_xml, strlen (introspection_xml), NULL);
|
||||
+ nodes = node_info_get_nodes (root);
|
||||
+
|
||||
+ if (g_slist_length (node_info_get_interfaces (root)) > 0)
|
||||
+ printf ("%s \n", cur);
|
||||
+
|
||||
+ for (l = nodes; l != NULL; l = l->next)
|
||||
+ {
|
||||
+ NodeInfo *node = (NodeInfo *) l->data;
|
||||
+ const char *name;
|
||||
+ char *new_path;
|
||||
+
|
||||
+ name = node_info_get_name (node);
|
||||
+ if (strcmp (cur, "/") == 0)
|
||||
+ new_path = g_strdup_printf ("/%s", name);
|
||||
+ else
|
||||
+ new_path = g_strdup_printf ("%s/%s", cur, name);
|
||||
+
|
||||
+ print_objects (connection, service_name, new_path);
|
||||
+
|
||||
+ g_free (new_path);
|
||||
+ }
|
||||
+ node_info_unref (root);
|
||||
+
|
||||
+ dbus_message_unref (reply);
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+is_object_path_with_interfaces (DBusConnection *connection, const char *service_name, const char *object_path)
|
||||
+{
|
||||
+ DBusMessage *message;
|
||||
+ DBusMessage *reply;
|
||||
+ DBusError error;
|
||||
+ DBusMessageIter iter;
|
||||
+ const char *introspection_xml;
|
||||
+ NodeInfo *root;
|
||||
+ gboolean ret;
|
||||
+
|
||||
+ ret = FALSE;
|
||||
+
|
||||
+ message = dbus_message_new_method_call (service_name,
|
||||
+ object_path,
|
||||
+ DBUS_INTERFACE_INTROSPECTABLE,
|
||||
+ "Introspect");
|
||||
+ dbus_error_init (&error);
|
||||
+ reply = dbus_connection_send_with_reply_and_block (connection,
|
||||
+ message,
|
||||
+ -1,
|
||||
+ &error);
|
||||
+ dbus_message_unref (message);
|
||||
+ dbus_message_iter_init (reply, &iter);
|
||||
+ dbus_message_iter_get_basic (&iter, &introspection_xml);
|
||||
+
|
||||
+ root = description_load_from_string (introspection_xml, strlen (introspection_xml), NULL);
|
||||
+
|
||||
+ if (g_slist_length (node_info_get_interfaces (root)) > 0)
|
||||
+ ret = TRUE;
|
||||
+
|
||||
+ node_info_unref (root);
|
||||
+ dbus_message_unref (reply);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+print_methods (DBusConnection *connection, const char *service_name, const char *object_path)
|
||||
+{
|
||||
+ DBusMessage *message;
|
||||
+ DBusMessage *reply;
|
||||
+ DBusError error;
|
||||
+ DBusMessageIter iter;
|
||||
+ const char *introspection_xml;
|
||||
+ NodeInfo *root;
|
||||
+ GSList *interfaces;
|
||||
+ GSList *l;
|
||||
+
|
||||
+ message = dbus_message_new_method_call (service_name,
|
||||
+ object_path,
|
||||
+ DBUS_INTERFACE_INTROSPECTABLE,
|
||||
+ "Introspect");
|
||||
+ dbus_error_init (&error);
|
||||
+ reply = dbus_connection_send_with_reply_and_block (connection,
|
||||
+ message,
|
||||
+ -1,
|
||||
+ &error);
|
||||
+ dbus_message_unref (message);
|
||||
+ dbus_message_iter_init (reply, &iter);
|
||||
+ dbus_message_iter_get_basic (&iter, &introspection_xml);
|
||||
+
|
||||
+ root = description_load_from_string (introspection_xml, strlen (introspection_xml), NULL);
|
||||
+ interfaces = node_info_get_interfaces (root);
|
||||
+ for (l = interfaces; l != NULL; l = l->next)
|
||||
+ {
|
||||
+ InterfaceInfo *interface = (InterfaceInfo *) l->data;
|
||||
+ GSList *methods;
|
||||
+ GSList *ll;
|
||||
+ methods = interface_info_get_methods (interface);
|
||||
+ for (ll = methods; ll != NULL; ll = ll->next)
|
||||
+ {
|
||||
+ MethodInfo *method = (MethodInfo *) ll->data;
|
||||
+ printf ("%s.%s \n", interface_info_get_name (interface), method_info_get_name (method));
|
||||
+ }
|
||||
+ }
|
||||
+ node_info_unref (root);
|
||||
+ dbus_message_unref (reply);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+print_signature (DBusConnection *connection, const char *service_name, const char *object_path, const char *method)
|
||||
+{
|
||||
+ DBusMessage *message;
|
||||
+ DBusMessage *reply;
|
||||
+ DBusError error;
|
||||
+ DBusMessageIter iter;
|
||||
+ const char *introspection_xml;
|
||||
+ NodeInfo *root;
|
||||
+ GSList *interfaces;
|
||||
+ GSList *l;
|
||||
+ char *s;
|
||||
+ char *method_name;
|
||||
+ char *interface_name;
|
||||
+ int n;
|
||||
+
|
||||
+ method_name = NULL;
|
||||
+ interface_name = NULL;
|
||||
+
|
||||
+ s = strrchr (method, '.');
|
||||
+ if (s == NULL || strlen (s) < 2 || s - method < 1)
|
||||
+ goto fail;
|
||||
+ method_name = g_strdup (s + 1);
|
||||
+ interface_name = g_strndup (method, s - method);
|
||||
+ printf (" \n");
|
||||
+
|
||||
+ message = dbus_message_new_method_call (service_name,
|
||||
+ object_path,
|
||||
+ DBUS_INTERFACE_INTROSPECTABLE,
|
||||
+ "Introspect");
|
||||
+ dbus_error_init (&error);
|
||||
+ reply = dbus_connection_send_with_reply_and_block (connection,
|
||||
+ message,
|
||||
+ -1,
|
||||
+ &error);
|
||||
+ dbus_message_unref (message);
|
||||
+ dbus_message_iter_init (reply, &iter);
|
||||
+ dbus_message_iter_get_basic (&iter, &introspection_xml);
|
||||
+
|
||||
+ root = description_load_from_string (introspection_xml, strlen (introspection_xml), NULL);
|
||||
+ interfaces = node_info_get_interfaces (root);
|
||||
+ for (l = interfaces; l != NULL; l = l->next)
|
||||
+ {
|
||||
+ InterfaceInfo *interface = (InterfaceInfo *) l->data;
|
||||
+
|
||||
+ if (strcmp (interface_name, interface_info_get_name (interface)) == 0)
|
||||
+ {
|
||||
+ GSList *methods;
|
||||
+ GSList *ll;
|
||||
+ methods = interface_info_get_methods (interface);
|
||||
+ for (ll = methods; ll != NULL; ll = ll->next)
|
||||
+ {
|
||||
+ MethodInfo *method = (MethodInfo *) ll->data;
|
||||
+ if (strcmp (method_name, method_info_get_name (method)) == 0)
|
||||
+ {
|
||||
+ GSList *args;
|
||||
+ GSList *lll;
|
||||
+ args = method_info_get_args (method);
|
||||
+ for (lll = args, n = 0; lll != NULL; lll = lll->next, n++)
|
||||
+ {
|
||||
+ ArgInfo *arg = (ArgInfo *) lll->data;
|
||||
+ printf ("# %s: arg %d: %s (%s) \n",
|
||||
+ arg_info_get_direction (arg) == ARG_IN ? " IN" : "OUT",
|
||||
+ n,
|
||||
+ arg_info_get_name (arg),
|
||||
+ arg_info_get_type (arg));
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ node_info_unref (root);
|
||||
+ dbus_message_unref (reply);
|
||||
+ fail:
|
||||
+ g_free (method_name);
|
||||
+ g_free (interface_name);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+complete_dbus_send (char *str)
|
||||
+{
|
||||
+ int ret;
|
||||
+ char **tokens;
|
||||
+ int num_tokens;
|
||||
+ const char *cur;
|
||||
+ const char *prev;
|
||||
+ gboolean have_system;
|
||||
+ gboolean have_session;
|
||||
+ gboolean have_print_reply;
|
||||
+ gboolean have_dest;
|
||||
+ DBusConnection *connection;
|
||||
+ DBusBusType bus_type;
|
||||
+ DBusError error;
|
||||
+ const char *target_service;
|
||||
+ const char *object_path;
|
||||
+ const char *method;
|
||||
+ int n;
|
||||
+ int object_path_index;
|
||||
+
|
||||
+ ret = 1;
|
||||
+ connection = NULL;
|
||||
+ target_service = NULL;
|
||||
+
|
||||
+ tokens = g_strsplit (str, " ", 0);
|
||||
+ num_tokens = g_strv_length (tokens);
|
||||
+ if (num_tokens >= 2) {
|
||||
+ cur = tokens[num_tokens - 1];
|
||||
+ prev = tokens[num_tokens - 2];
|
||||
+ } else if (num_tokens == 1) {
|
||||
+ cur = tokens[num_tokens - 1];
|
||||
+ prev = "";
|
||||
+ } else {
|
||||
+ cur = "";
|
||||
+ prev = "";
|
||||
+ }
|
||||
+
|
||||
+ have_system = have_option (tokens, "--system");
|
||||
+ have_session = have_option (tokens, "--session");
|
||||
+ have_print_reply = have_option (tokens, "--print-reply");
|
||||
+ have_dest = have_option_with_value (tokens, "--dest=", &target_service);
|
||||
+
|
||||
+ if (!have_print_reply)
|
||||
+ printf ("--print-reply \n");
|
||||
+
|
||||
+ if (!have_system && !have_session)
|
||||
+ {
|
||||
+ printf ("--system \n");
|
||||
+ printf ("--session \n");
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
+ if (!have_dest && !g_str_has_prefix (cur, "--dest="))
|
||||
+ {
|
||||
+ printf ("--dest=\n");
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
+ if (have_system || have_session)
|
||||
+ {
|
||||
+ bus_type = have_system ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION;
|
||||
+
|
||||
+ dbus_error_init (&error);
|
||||
+ connection = dbus_bus_get (bus_type, &error);
|
||||
+ if (connection == NULL)
|
||||
+ {
|
||||
+ fprintf (stderr, "Failed to open connection to %s message bus: %s: %s\n",
|
||||
+ (bus_type == DBUS_BUS_SYSTEM) ? "system" : "session",
|
||||
+ error.name, error.message);
|
||||
+ dbus_error_free (&error);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (connection != NULL && g_str_has_prefix (cur, "--dest="))
|
||||
+ {
|
||||
+ print_services (connection);
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
+ /* see if we have an object path */
|
||||
+ object_path = NULL;
|
||||
+ object_path_index = 0;
|
||||
+ if (connection != NULL && target_service != NULL)
|
||||
+ {
|
||||
+ for (n = 0; tokens[n] != NULL; n++)
|
||||
+ {
|
||||
+ if (tokens[n] == cur)
|
||||
+ continue;
|
||||
+
|
||||
+ if (*(tokens[n]) == '/')
|
||||
+ {
|
||||
+ if (is_object_path_with_interfaces (connection, target_service, tokens[n]))
|
||||
+ {
|
||||
+ object_path = tokens[n];
|
||||
+ object_path_index = n;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* if we have a connection and a destination but no object path, go ahead and list the object paths */
|
||||
+ if (connection != NULL && target_service != NULL && object_path == NULL)
|
||||
+ {
|
||||
+ print_objects (connection, target_service, NULL);
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
+ /* see if we have a method; it's directly after the object_path */
|
||||
+ method = NULL;
|
||||
+ if (connection != NULL && target_service != NULL && object_path != NULL)
|
||||
+ {
|
||||
+ if ((object_path_index + 1 < num_tokens - 1) &&
|
||||
+ (strlen (tokens[object_path_index + 1]) > 0) &&
|
||||
+ !(strcmp (cur, tokens[object_path_index + 1]) == 0))
|
||||
+ method = tokens[object_path_index + 1];
|
||||
+ }
|
||||
+
|
||||
+ /* if we have connection, destination and object path but no method yet, list the methods */
|
||||
+ if (connection != NULL && target_service != NULL && object_path != NULL && method == NULL)
|
||||
+ {
|
||||
+ print_methods (connection, target_service, object_path);
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
+ /* print signature as comment */
|
||||
+ if (connection != NULL && target_service != NULL && object_path != NULL && method != NULL)
|
||||
+ {
|
||||
+ print_signature (connection, target_service, object_path, method);
|
||||
+ }
|
||||
+
|
||||
+ done:
|
||||
+ ret = 0;
|
||||
+
|
||||
+ fail:
|
||||
+
|
||||
+ g_strfreev (tokens);
|
||||
+
|
||||
+ if (connection != NULL)
|
||||
+ dbus_connection_unref (connection);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ int ret;
|
||||
+ char *cur;
|
||||
+ gboolean dbus_send;
|
||||
+
|
||||
+ ret = 1;
|
||||
+ dbus_send = FALSE;
|
||||
+
|
||||
+ if (argc != 3)
|
||||
+ {
|
||||
+ fprintf (stderr, "invalid use\n");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (strcmp (argv[1], "dbus-send") == 0)
|
||||
+ {
|
||||
+ dbus_send = TRUE;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ fprintf (stderr, "unknown program '%s'\n", argv[1]);
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (strlen (argv[2]) < strlen (argv[1]) + 1)
|
||||
+ {
|
||||
+ fprintf (stderr, "error");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ cur = argv[2] + strlen (argv[1]) + 1;
|
||||
+
|
||||
+ if (dbus_send)
|
||||
+ ret = complete_dbus_send (cur);
|
||||
+
|
||||
+ out:
|
||||
+ return ret;
|
||||
+}
|
||||
diff --git a/dbus/dbus-bash-completion.sh.in b/dbus/dbus-bash-completion.sh.in
|
||||
new file mode 100644
|
||||
index 0000000..a7751da
|
||||
--- /dev/null
|
||||
+++ b/dbus/dbus-bash-completion.sh.in
|
||||
@@ -0,0 +1,21 @@
|
||||
+
|
||||
+# Check for bash
|
||||
+[ -z "$BASH_VERSION" ] && return
|
||||
+
|
||||
+################################################################################
|
||||
+
|
||||
+__dbus_send() {
|
||||
+ local IFS=$'\n'
|
||||
+ local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
+
|
||||
+ # --name=value style option
|
||||
+ if [[ "$cur" == *=* ]] ; then
|
||||
+ cur=${cur/*=/}
|
||||
+ fi
|
||||
+
|
||||
+ COMPREPLY=($(compgen -W "$(@libexecdir@/dbus-bash-completion-helper dbus-send ${COMP_WORDS[@]:0})" -- $cur))
|
||||
+}
|
||||
+
|
||||
+################################################################################
|
||||
+
|
||||
+complete -o nospace -F __dbus_send dbus-send
|
||||
--
|
||||
1.5.6.4
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
|
||||
Summary: GLib bindings for D-Bus
|
||||
Name: dbus-glib
|
||||
Version: 0.80
|
||||
Release: 3%{?dist}
|
||||
Version: 0.82
|
||||
Release: 1%{?dist}
|
||||
URL: http://www.freedesktop.org/software/dbus/
|
||||
Source0: http://dbus.freedesktop.org/releases/dbus-glib/%{name}-%{version}.tar.gz
|
||||
Source1: dbus-bus-introspect.xml
|
||||
@ -71,7 +71,7 @@ autoreconf
|
||||
|
||||
#build with checks for right now but disable checks for final release
|
||||
#%configure --disable-tests --disable-verbose-mode --disable-asserts
|
||||
make CFLAGS="-O0 -g3"
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
@ -104,6 +104,7 @@ rm -rf %{buildroot}
|
||||
%{_libdir}/pkgconfig/dbus-glib-1.pc
|
||||
%{_includedir}/dbus-1.0/dbus/*
|
||||
%{_datadir}/gtk-doc/html/dbus-glib
|
||||
%{_mandir}/man1/*
|
||||
%{_sysconfdir}/bash_completion.d/dbus-bash-completion.sh
|
||||
%{_libexecdir}/dbus-bash-completion-helper
|
||||
|
||||
@ -116,6 +117,10 @@ rm -rf %{buildroot}
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Jul 16 2009 Colin Walters <walters@verbum.org> - 0.82-1
|
||||
- New upstream 0.82
|
||||
- Remove mclasen accidental commit of CFLAGS="-O0 -g3"
|
||||
|
||||
* Sun Jun 14 2009 Matthias Clasen <mclasen@redhat.com> - 0.80-3
|
||||
- Minor directory ownership cleanup
|
||||
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
diff --git a/dbus/dbus-gproxy.c b/dbus/dbus-gproxy.c
|
||||
index 36d55f8..949a0a0 100644
|
||||
--- a/dbus/dbus-gproxy.c
|
||||
+++ b/dbus/dbus-gproxy.c
|
||||
@@ -658,8 +658,15 @@ unassociate_proxies (gpointer key, gpointer val, gpointer user_data)
|
||||
{
|
||||
if (!priv->for_owner)
|
||||
{
|
||||
- g_assert (priv->associated);
|
||||
- g_assert (priv->name_call == NULL);
|
||||
+ /* If a service appeared and then vanished very quickly,
|
||||
+ * it's conceivable we have an inflight request for
|
||||
+ * GetNameOwner here. Cancel it.
|
||||
+ * https://bugs.freedesktop.org/show_bug.cgi?id=18573
|
||||
+ */
|
||||
+ if (priv->name_call)
|
||||
+ dbus_g_proxy_cancel_call (manager->bus_proxy, priv->name_call);
|
||||
+
|
||||
+ priv->name_call = NULL;
|
||||
|
||||
priv->associated = FALSE;
|
||||
manager->unassociated_proxies = g_slist_prepend (manager->unassociated_proxies, proxy);
|
||||
@ -1,12 +0,0 @@
|
||||
diff -up dbus-glib-0.76/configure.ac.gethostbyname dbus-glib-0.76/configure.ac
|
||||
--- dbus-glib-0.76/configure.ac.gethostbyname 2008-11-25 03:11:57.000000000 -0500
|
||||
+++ dbus-glib-0.76/configure.ac 2008-11-25 03:12:23.000000000 -0500
|
||||
@@ -438,7 +438,7 @@ fi
|
||||
|
||||
#### Various functions
|
||||
AC_CHECK_LIB(socket,socket)
|
||||
-AC_CHECK_LIB(nsl,gethostbyname)
|
||||
+AC_SEARCH_LIBS([gethostbyname],[nsl])
|
||||
|
||||
AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user