<div>Hi,</div><div><br></div><div>I&#39;ve been having some trouble running dbus glib (server or client) on a GMainContext other than the default one.</div><div>So I made a few changes to the code and it seems to be working well.</div>
<div>This is based on the 0.76-4 version.</div><div>I believe that would be interesting to make this changes available to other users.</div><div><br></div><div>Can anyone check whether the following diff output fits?</div>
<div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>Thanks.</div></div><div><br></div><div><div>--- ./dbus/dbus-glib.h<span class="Apple-tab-span" style="white-space:pre">        </span>2008-05-14 07:21:15.000000000 -0300</div>
<div>+++ ./dbusPatched/dbus-glib.h<span class="Apple-tab-span" style="white-space:pre">        </span>2011-03-11 10:21:37.246480524 -0300</div><div>@@ -101,10 +101,16 @@</div><div> </div><div> void             dbus_g_thread_init (void);</div>
<div> </div><div>-DBusGConnection* dbus_g_connection_open (const gchar  *address,</div><div>-                                         GError      **error);</div><div>-DBusGConnection* dbus_g_bus_get         (DBusBusType   type,</div>
<div>-                                         GError      **error);</div><div>+DBusGConnection* dbus_g_connection_open_with_context (const gchar   *address,</div><div>+<span class="Apple-tab-span" style="white-space:pre">                                                </span>      GMainContext  *context,</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">                                                </span>      GError        **error);</div><div>+DBusGConnection* dbus_g_connection_open<span class="Apple-tab-span" style="white-space:pre">                </span>     (const gchar   *address,</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">                                                </span>      GError        **error);</div><div>+DBusGConnection* dbus_g_bus_get_with_context<span class="Apple-tab-span" style="white-space:pre">        </span>     (DBusBusType   type,</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">                                                </span>      GMainContext  *context,</div><div>+<span class="Apple-tab-span" style="white-space:pre">                                                </span>      GError        **error);</div><div>+DBusGConnection* dbus_g_bus_get<span class="Apple-tab-span" style="white-space:pre">                        </span>     (DBusBusType   type,</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">                                                </span>      GError        **error);</div><div> </div><div> typedef struct _DBusGObjectInfo DBusGObjectInfo;</div><div> typedef struct _DBusGMethodInfo DBusGMethodInfo;</div>
<div><br></div><div><br></div><div>--- ./dbus/dbus-gmain.c<span class="Apple-tab-span" style="white-space:pre">        </span>2008-05-14 07:21:15.000000000 -0300</div><div>+++ ./<meta http-equiv="content-type" content="text/html; charset=utf-8">dbusPatched/dbus-gmain.c<span class="Apple-tab-span" style="white-space:pre">        </span>2011-03-11 10:19:13.457478007 -0300</div>
<div>@@ -689,6 +689,7 @@</div><div> /**</div><div>  * dbus_g_connection_open:</div><div>  * @address: address of the connection to open</div><div>+ * @context: the #GMainContext or #NULL for default context</div><div>  * @error: address where an error can be returned.</div>
<div>  *</div><div>  * Returns a connection to the given address.</div><div>@@ -699,8 +700,9 @@</div><div>  * Returns: a DBusConnection</div><div>  */</div><div> DBusGConnection*</div><div>-dbus_g_connection_open (const gchar  *address,</div>
<div>-                        GError      **error)</div><div>+dbus_g_connection_open_with_context (const gchar    *address,</div><div>+<span class="Apple-tab-span" style="white-space:pre">                                </span>     GMainContext   *context,</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">                                </span>     GError        **error)</div><div> {</div><div>   DBusConnection *connection;</div><div>   DBusError derror;</div><div>@@ -720,14 +722,33 @@</div><div>
     }</div><div> </div><div>   /* does nothing if it&#39;s already been done */</div><div>-  dbus_connection_setup_with_g_main (connection, NULL);</div><div>+  dbus_connection_setup_with_g_main (connection, context);</div>
<div> </div><div>   return DBUS_G_CONNECTION_FROM_CONNECTION (connection);</div><div> }</div><div> </div><div> /**</div><div>+ * dbus_g_connection_open:</div><div>+ * @address: address of the connection to open</div><div>
+ * @error: address where an error can be returned.</div><div>+ *</div><div>+ * Returns a connection to the given address.</div><div>+ *</div><div>+ * Wrapper to a more general dbus_g_connection_open.</div><div>+ *</div><div>
+ * Returns: a DBusConnection</div><div>+ */</div><div>+DBusGConnection*</div><div>+dbus_g_connection_open (const gchar  *address,</div><div>+                        GError      **error)</div><div>+{</div><div>+  return dbus_g_connection_open_with_context (address, NULL, error);</div>
<div>+}</div><div>+</div><div>+/**</div><div>  * dbus_g_bus_get:</div><div>  * @type: bus type</div><div>+ * @context: the #GMainContext or #NULL for default context</div><div>  * @error: address where an error can be returned.</div>
<div>  *</div><div>  * Returns a connection to the given bus. The connection is a global variable</div><div>@@ -739,8 +760,9 @@</div><div>  * Returns: a DBusConnection</div><div>  */</div><div> DBusGConnection*</div><div>
-dbus_g_bus_get (DBusBusType     type,</div><div>-                GError        **error)</div><div>+dbus_g_bus_get_with_context (DBusBusType     type,</div><div>+<span class="Apple-tab-span" style="white-space:pre">                        </span>     GMainContext   *context,</div>
<div>+<span class="Apple-tab-span" style="white-space:pre">                        </span>     GError        **error)</div><div> {</div><div>   DBusConnection *connection;</div><div>   DBusError derror;</div><div>@@ -760,11 +782,30 @@</div><div>
     }</div><div> </div><div>   /* does nothing if it&#39;s already been done */</div><div>-  dbus_connection_setup_with_g_main (connection, NULL);</div><div>+  dbus_connection_setup_with_g_main (connection, context);</div>
<div> </div><div>   return DBUS_G_CONNECTION_FROM_CONNECTION (connection);</div><div> }</div><div> </div><div>+/**</div><div>+ * dbus_g_bus_get:</div><div>+ * @type: bus type</div><div>+ * @error: address where an error can be returned.</div>
<div>+ *</div><div>+ * Returns a connection to the given bus. The connection is a global variable</div><div>+ * shared with other callers of this function.</div><div>+ * </div><div>+ * Wrapper to a more general dbus_g_bus_get.</div>
<div>+ *</div><div>+ * Returns: a DBusConnection</div><div>+ */</div><div>+DBusGConnection*</div><div>+dbus_g_bus_get (DBusBusType     type,</div><div>+                GError        **error)</div><div>+{</div><div>+  return dbus_g_bus_get_with_context (type, NULL, error);</div>
<div>+}</div><div>+</div><div> /** @} */ /* end of public API */</div><div> </div><div> #ifdef DBUS_BUILD_TESTS</div></div><div><br></div><div><br></div><div>-- </div><div>Marcus Nascimento</div>