[glib] GDBusMenuModel: Allow NULL bus name for peer-to-peer connection



commit e8a09b3f850c06fec256a8152aba016b2fb5b45c
Author: Daiki Ueno <ueno unixuser org>
Date:   Fri Dec 13 18:29:46 2013 +0900

    GDBusMenuModel: Allow NULL bus name for peer-to-peer connection
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720380

 gio/gdbusmenumodel.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gio/gdbusmenumodel.c b/gio/gdbusmenumodel.c
index 9593d97..e29614a 100644
--- a/gio/gdbusmenumodel.c
+++ b/gio/gdbusmenumodel.c
@@ -203,7 +203,7 @@ path_identifier_equal (gconstpointer a,
   ConstPathIdentifier *id_b = b;
 
   return id_a->connection == id_b->connection &&
-         g_str_equal (id_a->bus_name, id_b->bus_name) &&
+         g_strcmp0 (id_a->bus_name, id_b->bus_name) == 0 &&
          g_str_equal (id_a->object_path, id_b->object_path);
 }
 
@@ -857,7 +857,8 @@ g_dbus_menu_model_get_from_group (GDBusMenuGroup *group,
 /**
  * g_dbus_menu_model_get:
  * @connection: a #GDBusConnection
- * @bus_name: the bus name which exports the menu model
+ * @bus_name: (nullable): the bus name which exports the menu model
+ *     or %NULL if @connection is not a message bus connection
  * @object_path: the object path at which the menu model is exported
  *
  * Obtains a #GDBusMenuModel for the menu model which is exported
@@ -883,6 +884,8 @@ g_dbus_menu_model_get (GDBusConnection *connection,
   GDBusMenuModel *proxy;
   GMainContext *context;
 
+  g_return_val_if_fail (bus_name != NULL || g_dbus_connection_get_unique_name (connection) == NULL, NULL);
+
   context = g_main_context_get_thread_default ();
   if (context == NULL)
     context = g_main_context_default ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]