[maemo-commits] [maemo-commits] r18083 - projects/haf/trunk/dbus-glib/debian/patches

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Apr 16 15:23:01 EEST 2009
Author: makarhun
Date: 2009-04-16 15:23:00 +0300 (Thu, 16 Apr 2009)
New Revision: 18083

Added:
   projects/haf/trunk/dbus-glib/debian/patches/60-NameOwnerChanged-arg0-matching.patch
Modified:
   projects/haf/trunk/dbus-glib/debian/patches/series
Log:
added arg0 matching for for nameownerchanged

Added: projects/haf/trunk/dbus-glib/debian/patches/60-NameOwnerChanged-arg0-matching.patch
===================================================================
--- projects/haf/trunk/dbus-glib/debian/patches/60-NameOwnerChanged-arg0-matching.patch	2009-04-16 12:14:50 UTC (rev 18082)
+++ projects/haf/trunk/dbus-glib/debian/patches/60-NameOwnerChanged-arg0-matching.patch	2009-04-16 12:23:00 UTC (rev 18083)
@@ -0,0 +1,118 @@
+Index: dbus-glib-0.78/dbus/dbus-gproxy.c
+===================================================================
+--- dbus-glib-0.78.orig/dbus/dbus-gproxy.c
++++ dbus-glib-0.78/dbus/dbus-gproxy.c
+@@ -471,7 +471,7 @@ g_proxy_list_free (DBusGProxyList *list)
+ }
+ 
+ static char*
+-g_proxy_get_match_rule (DBusGProxy *proxy)
++g_proxy_get_signal_match_rule (DBusGProxy *proxy)
+ {
+   DBusGProxyPrivate *priv = DBUS_G_PROXY_GET_PRIVATE(proxy);
+   /* FIXME Escaping is required here */
+@@ -484,6 +484,21 @@ g_proxy_get_match_rule (DBusGProxy *prox
+                             priv->path, priv->interface);
+ }
+ 
++static char *
++g_proxy_get_owner_match_rule (DBusGProxy *proxy)
++{
++  DBusGProxyPrivate *priv = DBUS_G_PROXY_GET_PRIVATE(proxy);
++  if (priv->name) 
++    {
++      return g_strdup_printf ("type='signal',sender='" DBUS_SERVICE_DBUS
++        "',path='" DBUS_PATH_DBUS
++        "',interface='" DBUS_INTERFACE_DBUS
++        "',member='NameOwnerChanged'"
++        ",arg0='%s'", priv->name);
++    }
++  return NULL;
++}
++
+ typedef struct
+ {
+   char *name;
+@@ -914,18 +929,6 @@ dbus_g_proxy_manager_register (DBusGProx
+                                                     tristring_equal,
+                                                     NULL,
+                                                     (GFreeFunc) g_proxy_list_free);
+-      /* FIXME - for now we listen for all NameOwnerChanged; once
+-       * Anders' detail patch lands we should add individual rules
+-       * 
+-       * NOTE: if you change this, be sure to change the matching
+-       * call to dbus_bus_remove_match in dbus_g_proxy_manager_unregister.
+-       */
+-      dbus_bus_add_match (manager->connection,
+-                          "type='signal',sender='" DBUS_SERVICE_DBUS
+-			  "',path='" DBUS_PATH_DBUS
+-			  "',interface='" DBUS_INTERFACE_DBUS
+-			  "',member='NameOwnerChanged'",
+-			  NULL);
+     }
+   else
+     {
+@@ -948,20 +951,25 @@ dbus_g_proxy_manager_register (DBusGProx
+ 
+   if (list->proxies == NULL && priv->name)
+     {
+-      /* We have to add the match rule to the server,
++      /* We have to add match rules to the server,
+        * but only if the server is a message bus,
+        * not if it's a peer.
+        */
+        char *rule;
+        
+-       rule = g_proxy_get_match_rule (proxy);
+-       
++       rule = g_proxy_get_signal_match_rule (proxy);
++
+        /* We don't check for errors; it's not like anyone would handle them, and
+         * we don't want a round trip here.
+         */
+        dbus_bus_add_match (manager->connection,
+ 			   rule, NULL);
+-       
++       g_free (rule);
++        
++       rule = g_proxy_get_owner_match_rule (proxy);
++       if (rule)
++         dbus_bus_add_match (manager->connection,
++                             rule, NULL);
+        g_free (rule);
+     }
+ 
+@@ -1065,27 +1073,21 @@ dbus_g_proxy_manager_unregister (DBusGPr
+                            tri);
+       list = NULL;
+ 
+-      rule = g_proxy_get_match_rule (proxy);
++      rule = g_proxy_get_signal_match_rule (proxy);
+       dbus_bus_remove_match (manager->connection,
+                              rule, NULL);
+       g_free (rule);
++      rule = g_proxy_get_owner_match_rule (proxy);
++      if (rule)
++        dbus_bus_remove_match (manager->connection,
++                               rule, NULL);
++      g_free (rule);    
+     }
+   
+   if (g_hash_table_size (manager->proxy_lists) == 0)
+     {
+       g_hash_table_destroy (manager->proxy_lists);
+       manager->proxy_lists = NULL;
+-
+-      /*
+-       * NOTE: if you change this, be sure to change the matching
+-       * call to dbus_bus_add_match in dbus_g_proxy_manager_register.
+-       */
+-      dbus_bus_remove_match (manager->connection,
+-                             "type='signal',sender='" DBUS_SERVICE_DBUS
+-			     "',path='" DBUS_PATH_DBUS
+-			     "',interface='" DBUS_INTERFACE_DBUS
+-			     "',member='NameOwnerChanged'",
+-			     NULL);
+     }
+ 
+   g_free (tri);

Modified: projects/haf/trunk/dbus-glib/debian/patches/series
===================================================================
--- projects/haf/trunk/dbus-glib/debian/patches/series	2009-04-16 12:14:50 UTC (rev 18082)
+++ projects/haf/trunk/dbus-glib/debian/patches/series	2009-04-16 12:23:00 UTC (rev 18083)
@@ -4,3 +4,4 @@
 20-owner_names-assert.patch
 99-dbus-error.patch
 50-free-user-error.patch
+60-NameOwnerChanged-arg0-matching.patch


More information about the maemo-commits mailing list