2005-10-29 Robert McQueen <robot101@debian.org>
authorRobert McQueen <robot101@debian.org>
Sat, 29 Oct 2005 17:02:58 +0000 (17:02 +0000)
committerRobert McQueen <robot101@debian.org>
Sat, 29 Oct 2005 17:02:58 +0000 (17:02 +0000)
        * glib/Makefile.am, glib/examples/Makefile.am,
        glib/examples/statemachine/Makefile.am: Merge patch from Ubuntu by
        Daniel Stone to replace explicit calls to libtool with $(LIBTOOL).

        * test/python/.cvsignore: Add run-with-tmp-session-bus.conf.

        * tools/dbus-monitor.1, tools/dbus-monitor.c: Merge dbus-monitor patch
        from Ubuntu by Daniel Silverstone to allow specifying match rules on
        the command line.

ChangeLog
glib/Makefile.am
glib/examples/Makefile.am
glib/examples/statemachine/Makefile.am
test/python/.cvsignore
tools/dbus-monitor.1
tools/dbus-monitor.c

index f30b345..626aa79 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-10-29  Robert McQueen  <robot101@debian.org>
+
+       * glib/Makefile.am, glib/examples/Makefile.am,
+       glib/examples/statemachine/Makefile.am: Merge patch from Ubuntu by
+       Daniel Stone to replace explicit calls to libtool with $(LIBTOOL).
+
+       * test/python/.cvsignore: Add run-with-tmp-session-bus.conf.
+
+       * tools/dbus-monitor.1, tools/dbus-monitor.c: Merge dbus-monitor patch
+       from Ubuntu by Daniel Silverstone to allow specifying match rules on
+       the command line.
+
 2005-10-27  Ross Burton  <ross@openedhand.com>
 
        * dbus/dbus-marshal-header.c:
index 6e5c78e..f87145e 100644 (file)
@@ -5,7 +5,7 @@ INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_GLIB_T
 lib_LTLIBRARIES=libdbus-glib-1.la
 
 dbus-glib-error-switch.h: $(top_srcdir)/dbus/dbus-protocol.h make-dbus-glib-error-switch.sh
-       libtool --mode=execute $(srcdir)/make-dbus-glib-error-switch.sh $(top_srcdir)/dbus/dbus-protocol.h $@
+       $(LIBTOOL) --mode=execute $(srcdir)/make-dbus-glib-error-switch.sh $(top_srcdir)/dbus/dbus-protocol.h $@
 
 BUILT_SOURCES = dbus-glib-error-switch.h
 
index e0f825c..34b9cb8 100644 (file)
@@ -15,7 +15,7 @@ example_service_LDADD= $(top_builddir)/glib/libdbus-glib-1.la
 BUILT_SOURCES = example-service-glue.h
 
 example-service-glue.h: example-service.xml
-       libtool --mode=execute $(top_builddir)/glib/dbus-binding-tool --prefix=some_object --mode=glib-server --output=example-service-glue.h $(srcdir)/example-service.xml
+       $(LIBTOOL) --mode=execute $(top_builddir)/glib/dbus-binding-tool --prefix=some_object --mode=glib-server --output=example-service-glue.h $(srcdir)/example-service.xml
 
 
 ## Makefile.am bits for another client/server pair
@@ -31,7 +31,7 @@ example_signal_emitter_LDADD= $(top_builddir)/glib/libdbus-glib-1.la
 BUILT_SOURCES += example-signal-emitter-glue.h
 
 example-signal-emitter-glue.h: example-signal-emitter.xml
-       libtool --mode=execute $(top_builddir)/glib/dbus-binding-tool --prefix=test_object --mode=glib-server --output=example-signal-emitter-glue.h $(srcdir)/example-signal-emitter.xml
+       $(LIBTOOL) --mode=execute $(top_builddir)/glib/dbus-binding-tool --prefix=test_object --mode=glib-server --output=example-signal-emitter-glue.h $(srcdir)/example-signal-emitter.xml
 
 CLEANFILES = $(BUILT_SOURCES)
 
index 8395457..0fea83e 100644 (file)
@@ -19,10 +19,10 @@ statemachine_client_LDADD= $(top_builddir)/glib/libdbus-glib-1.la $(DBUS_GTK_THR
 BUILT_SOURCES = statemachine-server-glue.h statemachine-glue.h
 
 statemachine-server-glue.h: statemachine-server.xml
-       libtool --mode=execute $(top_builddir)/glib/dbus-binding-tool --prefix=sm_server --mode=glib-server --output=$@ $<
+       $(LIBTOOL) --mode=execute $(top_builddir)/glib/dbus-binding-tool --prefix=sm_server --mode=glib-server --output=$@ $<
 
 statemachine-glue.h: statemachine.xml
-       libtool --mode=execute $(top_builddir)/glib/dbus-binding-tool --prefix=sm_object --mode=glib-server --output=$@ $<
+       $(LIBTOOL) --mode=execute $(top_builddir)/glib/dbus-binding-tool --prefix=sm_object --mode=glib-server --output=$@ $<
 
 sm-marshal.c: Makefile sm-marshal.list
        @GLIB_GENMARSHAL@ --prefix=sm_marshal $(srcdir)/sm-marshal.list --header --body > $@.tmp && mv $@.tmp $@
index 282522d..f5e130d 100644 (file)
@@ -1,2 +1,3 @@
 Makefile
 Makefile.in
+run-with-tmp-session-bus.conf
index d6a780d..6a8a212 100644 (file)
@@ -9,6 +9,7 @@ dbus-monitor \- debug probe to print message bus messages
 .PP
 .B dbus-monitor
 [\-\-system | \-\-session]
+[watch expressions]
 
 .SH DESCRIPTION
 
@@ -25,6 +26,11 @@ The \-\-system and \-\-session options direct \fIdbus-monitor\fP to
 monitor the system or session buses respectively.  If neither is
 specified, \fIdbus-monitor\fP monitors the session bus.
 
+.PP
+In order to get \fIdbus-monitor\fP to see the messages you are interested
+in, you should specify a set of watch expressions as you would expect to
+be passed to the \fIdbus_bus_add_watch\fP function.
+
 .PP 
 The message bus configuration may keep \fIdbus-monitor\fP from seeing
 all messages, especially if you run the monitor as a non-root user.
@@ -37,6 +43,15 @@ Monitor the system message bus.
 .I "--session"
 Monitor the session message bus.  (This is the default.)
 
+.SH EXAMPLE
+Here is an example of using dbus-monitor to watch for the gnome typing
+monitor to say things
+.nf
+
+  dbus-monitor "type='signal',sender='org.gnome.TypingMonitor',interface='org.gnome.TypingMonitor'"
+
+.fi
+
 .SH AUTHOR
 dbus-monitor was written by Philip Blundell.
 
index 9bd95ea..d768cad 100644 (file)
@@ -49,7 +49,7 @@ filter_func (DBusConnection     *connection,
 static void
 usage (char *name, int ecode)
 {
-  fprintf (stderr, "Usage: %s [--system | --session]\n", name);
+  fprintf (stderr, "Usage: %s [--system | --session] [watch expressions]\n", name);
   exit (ecode);
 }
 
@@ -60,8 +60,8 @@ main (int argc, char *argv[])
   DBusError error;
   DBusBusType type = DBUS_BUS_SESSION;
   GMainLoop *loop;
-  int i;
-
+  int i = 0, j = 0, numFilters = 0;
+  char **filters = NULL;
   for (i = 1; i < argc; i++)
     {
       char *arg = argv[i];
@@ -73,14 +73,18 @@ main (int argc, char *argv[])
       else if (!strcmp (arg, "--help"))
        usage (argv[0], 0);
       else if (!strcmp (arg, "--"))
-       break;
+       continue;
       else if (arg[0] == '-')
        usage (argv[0], 1);
+      else {
+       numFilters++;
+       filters = (char **)realloc(filters, numFilters * sizeof(char *));
+       filters[j] = (char *)malloc((strlen(arg) + 1) * sizeof(char *));
+       snprintf(filters[j], strlen(arg) + 1, "%s", arg);
+       j++;
+      }
     }
 
-  if (argc > 2)
-    usage (argv[0], 1);
-
   loop = g_main_loop_new (NULL, FALSE);
 
   dbus_error_init (&error);
@@ -96,26 +100,45 @@ main (int argc, char *argv[])
 
   dbus_connection_setup_with_g_main (connection, NULL);
 
-  dbus_bus_add_match (connection,
-                     "type='signal'",
-                     &error);
-  if (dbus_error_is_set (&error))
-    goto lose;
-  dbus_bus_add_match (connection,
-                     "type='method_call'",
-                     &error);
-  if (dbus_error_is_set (&error))
-    goto lose;
-  dbus_bus_add_match (connection,
-                     "type='method_return'",
-                     &error);
-  if (dbus_error_is_set (&error))
-    goto lose;
-  dbus_bus_add_match (connection,
-                     "type='error'",
-                     &error);
-  if (dbus_error_is_set (&error))
-    goto lose;
+  if (numFilters)
+    {
+      for (i = 0; i < j; i++)
+        {
+          dbus_bus_add_match (connection, filters[i], &error);
+          if (dbus_error_is_set (&error))
+            {
+              fprintf (stderr, "Failed to setup match \"%s\": %s\n",
+                       filters[i], error.message);
+              dbus_error_free (&error);
+              exit (1);
+            }
+         free(filters[i]);
+        }
+    }
+  else
+    {
+      dbus_bus_add_match (connection,
+                         "type='signal'",
+                         &error);
+      if (dbus_error_is_set (&error))
+        goto lose;
+      dbus_bus_add_match (connection,
+                         "type='method_call'",
+                         &error);
+      if (dbus_error_is_set (&error))
+        goto lose;
+      dbus_bus_add_match (connection,
+                         "type='method_return'",
+                         &error);
+      if (dbus_error_is_set (&error))
+        goto lose;
+      dbus_bus_add_match (connection,
+                         "type='error'",
+                         &error);
+      if (dbus_error_is_set (&error))
+        goto lose;
+    }
+
   if (!dbus_connection_add_filter (connection, filter_func, NULL, NULL)) {
     fprintf (stderr, "Couldn't add filter!\n");
     exit (1);