treewide: Use DBus defines instead of direct string literals
authorMarijn Suijten <marijns95@gmail.com>
Thu, 7 Jan 2021 23:36:06 +0000 (00:36 +0100)
committerPulseAudio Marge Bot <pulseaudio-maintainers@lists.freedesktop.org>
Mon, 1 Feb 2021 16:10:11 +0000 (16:10 +0000)
While cleaning up the BlueZ counterpart of strings defined in
preprocessor macros it is only consistent to take care of all DBUS_
macros as a whole.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/477>

src/modules/bluetooth/backend-native.c
src/modules/bluetooth/backend-ofono.c
src/modules/bluetooth/bluez5-util.c
src/modules/dbus/module-dbus-protocol.c
src/modules/module-rygel-media-server.c
src/modules/module-zeroconf-publish.c
src/modules/reserve-monitor.c
src/modules/reserve.c
src/pulsecore/protocol-dbus.c
src/pulsecore/rtkit.c
src/tests/ladspa-dbus.py

index 2c49c71..5aab77a 100644 (file)
@@ -75,7 +75,7 @@ struct transport_data {
     "   <arg name=\"opts\" direction=\"in\" type=\"a{sv}\"/>"           \
     "  </method>"                                                       \
     " </interface>"                                                     \
-    " <interface name=\"org.freedesktop.DBus.Introspectable\">"         \
+    " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">"           \
     "  <method name=\"Introspect\">"                                    \
     "   <arg name=\"data\" type=\"s\" direction=\"out\"/>"              \
     "  </method>"                                                       \
@@ -588,7 +588,7 @@ static DBusHandlerResult profile_handler(DBusConnection *c, DBusMessage *m, void
     if (!pa_streq(path, HSP_AG_PROFILE) && !pa_streq(path, HSP_HS_PROFILE))
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
-    if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
+    if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
         const char *xml = PROFILE_INTROSPECT_XML;
 
         pa_assert_se(r = dbus_message_new_method_return(m));
index d7a13ef..b6433fe 100644 (file)
 #define HF_AUDIO_AGENT_XML                                          \
     DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                       \
     "<node>"                                                        \
-    "  <interface name=\"org.freedesktop.DBus.Introspectable\">"    \
+    "  <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">"      \
     "    <method name=\"Introspect\">"                              \
     "      <arg direction=\"out\" type=\"s\" />"                    \
     "    </method>"                                                 \
     "  </interface>"                                                \
-    "  <interface name=\"org.ofono.HandsfreeAudioAgent\">"          \
+    "  <interface name=\"" HF_AUDIO_AGENT_INTERFACE "\">"           \
     "    <method name=\"Release\">"                                 \
     "    </method>"                                                 \
     "    <method name=\"NewConnection\">"                           \
@@ -515,12 +515,12 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *da
     pa_assert(backend);
 
     sender = dbus_message_get_sender(m);
-    if (!pa_safe_streq(backend->ofono_bus_id, sender) && !pa_streq("org.freedesktop.DBus", sender))
+    if (!pa_safe_streq(backend->ofono_bus_id, sender) && !pa_streq(DBUS_SERVICE_DBUS, sender))
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
     dbus_error_init(&err);
 
-    if (dbus_message_is_signal(m, "org.freedesktop.DBus", "NameOwnerChanged")) {
+    if (dbus_message_is_signal(m, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
         const char *name, *old_owner, *new_owner;
 
         if (!dbus_message_get_args(m, &err,
@@ -528,7 +528,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *da
                                    DBUS_TYPE_STRING, &old_owner,
                                    DBUS_TYPE_STRING, &new_owner,
                                    DBUS_TYPE_INVALID)) {
-            pa_log_error("Failed to parse org.freedesktop.DBus.NameOwnerChanged: %s", err.message);
+            pa_log_error("Failed to parse " DBUS_INTERFACE_DBUS ".NameOwnerChanged: %s", err.message);
             goto fail;
         }
 
@@ -664,7 +664,7 @@ static DBusHandlerResult hf_audio_agent_handler(DBusConnection *c, DBusMessage *
 
     pa_log_debug("dbus: path=%s, interface=%s, member=%s", path, interface, member);
 
-    if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
+    if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
         const char *xml = HF_AUDIO_AGENT_XML;
 
         pa_assert_se(r = dbus_message_new_method_return(m));
@@ -718,7 +718,7 @@ pa_bluetooth_backend *pa_bluetooth_ofono_backend_new(pa_core *c, pa_bluetooth_di
     }
 
     if (pa_dbus_add_matches(pa_dbus_connection_get(backend->connection), &err,
-            "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',"
+            "type='signal',sender='" DBUS_SERVICE_DBUS "',interface='" DBUS_INTERFACE_DBUS "',member='NameOwnerChanged',"
             "arg0='" OFONO_SERVICE "'",
             "type='signal',sender='" OFONO_SERVICE "',interface='" HF_AUDIO_MANAGER_INTERFACE "',member='CardAdded'",
             "type='signal',sender='" OFONO_SERVICE "',interface='" HF_AUDIO_MANAGER_INTERFACE "',member='CardRemoved'",
@@ -748,7 +748,7 @@ void pa_bluetooth_ofono_backend_free(pa_bluetooth_backend *backend) {
     dbus_connection_unregister_object_path(pa_dbus_connection_get(backend->connection), HF_AUDIO_AGENT_PATH);
 
     pa_dbus_remove_matches(pa_dbus_connection_get(backend->connection),
-            "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',"
+            "type='signal',sender='" DBUS_SERVICE_DBUS "',interface='" DBUS_INTERFACE_DBUS "',member='NameOwnerChanged',"
             "arg0='" OFONO_SERVICE "'",
             "type='signal',sender='" OFONO_SERVICE "',interface='" HF_AUDIO_MANAGER_INTERFACE "',member='CardAdded'",
             "type='signal',sender='" OFONO_SERVICE "',interface='" HF_AUDIO_MANAGER_INTERFACE "',member='CardRemoved'",
index 42c96b8..be0ccd7 100644 (file)
@@ -42,6 +42,8 @@
 
 #define WAIT_FOR_PROFILES_TIMEOUT_USEC (3 * PA_USEC_PER_SEC)
 
+#define DBUS_INTERFACE_OBJECT_MANAGER DBUS_INTERFACE_DBUS ".ObjectManager"
+
 #define A2DP_OBJECT_MANAGER_PATH "/MediaEndpoint"
 #define A2DP_SOURCE_ENDPOINT A2DP_OBJECT_MANAGER_PATH "/A2DPSource"
 #define A2DP_SINK_ENDPOINT A2DP_OBJECT_MANAGER_PATH "/A2DPSink"
@@ -49,7 +51,7 @@
 #define OBJECT_MANAGER_INTROSPECT_XML                                          \
     DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE                                  \
     "<node>\n"                                                                 \
-    " <interface name=\"org.freedesktop.DBus.ObjectManager\">\n"               \
+    " <interface name=\"" DBUS_INTERFACE_OBJECT_MANAGER "\">\n"                \
     "  <method name=\"GetManagedObjects\">\n"                                  \
     "   <arg name=\"objects\" direction=\"out\" type=\"a{oa{sa{sv}}}\"/>\n"    \
     "  </method>\n"                                                            \
@@ -62,7 +64,7 @@
     "   <arg name=\"interfaces\" type=\"as\"/>\n"                              \
     "  </signal>\n"                                                            \
     " </interface>\n"                                                          \
-    " <interface name=\"org.freedesktop.DBus.Introspectable\">\n"              \
+    " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">\n"                \
     "  <method name=\"Introspect\">\n"                                         \
     "   <arg name=\"data\" direction=\"out\" type=\"s\"/>\n"                   \
     "  </method>\n"                                                            \
@@ -89,7 +91,7 @@
     "  <method name=\"Release\">"                                       \
     "  </method>"                                                       \
     " </interface>"                                                     \
-    " <interface name=\"org.freedesktop.DBus.Introspectable\">"         \
+    " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">"           \
     "  <method name=\"Introspect\">"                                    \
     "   <arg name=\"data\" type=\"s\" direction=\"out\"/>"              \
     "  </method>"                                                       \
@@ -1515,7 +1517,7 @@ static void get_managed_objects(pa_bluetooth_discovery *y) {
 
     pa_assert(y);
 
-    pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, "/", "org.freedesktop.DBus.ObjectManager",
+    pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, "/", DBUS_INTERFACE_OBJECT_MANAGER,
                                                   "GetManagedObjects"));
     send_and_add_to_pending(y, m, get_managed_objects_reply, NULL);
 }
@@ -1537,7 +1539,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
 
     dbus_error_init(&err);
 
-    if (dbus_message_is_signal(m, "org.freedesktop.DBus", "NameOwnerChanged")) {
+    if (dbus_message_is_signal(m, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
         const char *name, *old_owner, *new_owner;
 
         if (!dbus_message_get_args(m, &err,
@@ -1545,7 +1547,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
                                    DBUS_TYPE_STRING, &old_owner,
                                    DBUS_TYPE_STRING, &new_owner,
                                    DBUS_TYPE_INVALID)) {
-            pa_log_error("Failed to parse org.freedesktop.DBus.NameOwnerChanged: %s", err.message);
+            pa_log_error("Failed to parse " DBUS_INTERFACE_DBUS ".NameOwnerChanged: %s", err.message);
             goto fail;
         }
 
@@ -1572,7 +1574,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
         }
 
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-    } else if (dbus_message_is_signal(m, "org.freedesktop.DBus.ObjectManager", "InterfacesAdded")) {
+    } else if (dbus_message_is_signal(m, DBUS_INTERFACE_OBJECT_MANAGER, "InterfacesAdded")) {
         DBusMessageIter arg_i;
 
         if (!y->objects_listed)
@@ -1586,7 +1588,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
         parse_interfaces_and_properties(y, &arg_i);
 
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-    } else if (dbus_message_is_signal(m, "org.freedesktop.DBus.ObjectManager", "InterfacesRemoved")) {
+    } else if (dbus_message_is_signal(m, DBUS_INTERFACE_OBJECT_MANAGER, "InterfacesRemoved")) {
         const char *p;
         DBusMessageIter arg_i;
         DBusMessageIter element_i;
@@ -1623,7 +1625,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
 
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
-    } else if (dbus_message_is_signal(m, "org.freedesktop.DBus.Properties", "PropertiesChanged")) {
+    } else if (dbus_message_is_signal(m, DBUS_INTERFACE_PROPERTIES, "PropertiesChanged")) {
         DBusMessageIter arg_i;
         const char *iface;
 
@@ -1972,7 +1974,7 @@ static DBusHandlerResult endpoint_handler(DBusConnection *c, DBusMessage *m, voi
     if (!a2dp_endpoint_to_a2dp_codec(path))
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
-    if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
+    if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
         const char *xml = ENDPOINT_INTROSPECT_XML;
 
         pa_assert_se(r = dbus_message_new_method_return(m));
@@ -2068,12 +2070,12 @@ static DBusHandlerResult object_manager_handler(DBusConnection *c, DBusMessage *
 
     pa_log_debug("dbus: path=%s, interface=%s, member=%s", path, interface, member);
 
-    if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
+    if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
         const char *xml = OBJECT_MANAGER_INTROSPECT_XML;
 
         pa_assert_se(r = dbus_message_new_method_return(m));
         pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID));
-    } else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.ObjectManager", "GetManagedObjects")) {
+    } else if (dbus_message_is_method_call(m, DBUS_INTERFACE_OBJECT_MANAGER, "GetManagedObjects")) {
         DBusMessageIter iter, array;
         int i;
 
@@ -2193,18 +2195,18 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c, int headset_backe
     y->filter_added = true;
 
     if (pa_dbus_add_matches(conn, &err,
-            "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged'"
+            "type='signal',sender='" DBUS_SERVICE_DBUS "',interface='" DBUS_INTERFACE_DBUS "',member='NameOwnerChanged'"
             ",arg0='" BLUEZ_SERVICE "'",
-            "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.ObjectManager',member='InterfacesAdded'",
-            "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.ObjectManager',"
+            "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_OBJECT_MANAGER "',member='InterfacesAdded'",
+            "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_OBJECT_MANAGER "',"
             "member='InterfacesRemoved'",
-            "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'"
+            "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',member='PropertiesChanged'"
             ",arg0='" BLUEZ_ADAPTER_INTERFACE "'",
-            "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'"
+            "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',member='PropertiesChanged'"
             ",arg0='" BLUEZ_DEVICE_INTERFACE "'",
-            "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'"
+            "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',member='PropertiesChanged'"
             ",arg0='" BLUEZ_MEDIA_ENDPOINT_INTERFACE "'",
-            "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'"
+            "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',member='PropertiesChanged'"
             ",arg0='" BLUEZ_MEDIA_TRANSPORT_INTERFACE "'",
             NULL) < 0) {
         pa_log_error("Failed to add D-Bus matches: %s", err.message);
@@ -2283,19 +2285,19 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
 
         if (y->matches_added)
             pa_dbus_remove_matches(pa_dbus_connection_get(y->connection),
-                "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',"
+                "type='signal',sender='" DBUS_SERVICE_DBUS "',interface='" DBUS_INTERFACE_DBUS "',member='NameOwnerChanged',"
                 "arg0='" BLUEZ_SERVICE "'",
-                "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.ObjectManager',"
+                "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_OBJECT_MANAGER "',"
                 "member='InterfacesAdded'",
-                "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.ObjectManager',"
+                "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_OBJECT_MANAGER "',"
                 "member='InterfacesRemoved'",
-                "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',"
+                "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',"
                 "member='PropertiesChanged',arg0='" BLUEZ_ADAPTER_INTERFACE "'",
-                "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',"
+                "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',"
                 "member='PropertiesChanged',arg0='" BLUEZ_DEVICE_INTERFACE "'",
-                "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',"
+                "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',"
                 "member='PropertiesChanged',arg0='" BLUEZ_MEDIA_ENDPOINT_INTERFACE "'",
-                "type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',"
+                "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',"
                 "member='PropertiesChanged',arg0='" BLUEZ_MEDIA_TRANSPORT_INTERFACE "'",
                 NULL);
 
index 8a83c76..5f542f9 100644 (file)
@@ -158,7 +158,7 @@ static DBusHandlerResult disconnection_filter_cb(DBusConnection *connection, DBu
     pa_assert(message);
     pa_assert(c);
 
-    if (dbus_message_is_signal(message, "org.freedesktop.DBus.Local", "Disconnected")) {
+    if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
         /* The connection died. Now we want to free the connection object, but
          * let's wait until this message is fully processed, in case someone
          * else is interested in this signal too. */
index 7f7fd50..288c1e4 100644 (file)
@@ -96,7 +96,7 @@ PA_MODULE_USAGE("display_name=<UPnP Media Server name>");
     "  <property name=\"Path\" type=\"s\" access=\"read\"/>"            \
     "  <property name=\"DisplayName\" type=\"s\" access=\"read\"/>"     \
     " </interface>"                                                     \
-    " <interface name=\"org.freedesktop.DBus.Properties\">"             \
+    " <interface name=\"" DBUS_INTERFACE_PROPERTIES "\">"               \
     "  <method name=\"Get\">"                                           \
     "   <arg name=\"interface\" direction=\"in\" type=\"s\"/>"          \
     "   <arg name=\"property\" direction=\"in\" type=\"s\"/>"           \
@@ -107,7 +107,7 @@ PA_MODULE_USAGE("display_name=<UPnP Media Server name>");
     "   <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>"    \
     "  </method>"                                                       \
     " </interface>"                                                     \
-    " <interface name=\"org.freedesktop.DBus.Introspectable\">"         \
+    " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">"           \
     "  <method name=\"Introspect\">"                                    \
     "   <arg name=\"data\" type=\"s\" direction=\"out\"/>"              \
     "  </method>"                                                       \
@@ -130,7 +130,7 @@ PA_MODULE_USAGE("display_name=<UPnP Media Server name>");
     " <interface name=\"org.gnome.UPnP.MediaItem2\">"                   \
     "  <property name=\"URLs\" type=\"as\" access=\"read\"/>"           \
     "  <property name=\"MIMEType\" type=\"s\" access=\"read\"/>"        \
-    "  <property name=\"DLNAProfile\" type=\"s\" access=\"read\"/>"        \
+    "  <property name=\"DLNAProfile\" type=\"s\" access=\"read\"/>"     \
     " </interface>"                                                     \
     " <interface name=\"org.gnome.UPnP.MediaObject2\">"                 \
     "  <property name=\"Parent\" type=\"s\" access=\"read\"/>"          \
@@ -138,7 +138,7 @@ PA_MODULE_USAGE("display_name=<UPnP Media Server name>");
     "  <property name=\"Path\" type=\"s\" access=\"read\"/>"            \
     "  <property name=\"DisplayName\" type=\"s\" access=\"read\"/>"     \
     " </interface>"                                                     \
-    " <interface name=\"org.freedesktop.DBus.Properties\">"             \
+    " <interface name=\"" DBUS_INTERFACE_PROPERTIES "\">"               \
     "  <method name=\"Get\">"                                           \
     "   <arg name=\"interface\" direction=\"in\" type=\"s\"/>"          \
     "   <arg name=\"property\" direction=\"in\" type=\"s\"/>"           \
@@ -149,7 +149,7 @@ PA_MODULE_USAGE("display_name=<UPnP Media Server name>");
     "   <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>"    \
     "  </method>"                                                       \
     " </interface>"                                                     \
-    " <interface name=\"org.freedesktop.DBus.Introspectable\">"         \
+    " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">"           \
     "  <method name=\"Introspect\">"                                    \
     "   <arg name=\"data\" type=\"s\" direction=\"out\"/>"              \
     "  </method>"                                                       \
@@ -215,7 +215,7 @@ static bool message_is_property_get(DBusMessage *m, const char *interface, const
 
     pa_assert(m);
 
-    if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Get"))
+    if (!dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "Get"))
         return false;
 
     if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_STRING, &p, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
@@ -234,7 +234,7 @@ static bool message_is_property_get_all(DBusMessage *m, const char *interface) {
 
     pa_assert(m);
 
-    if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "GetAll"))
+    if (!dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "GetAll"))
         return false;
 
     if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
@@ -721,7 +721,7 @@ static DBusHandlerResult root_handler(DBusConnection *c, DBusMessage *m, void *u
         append_property_dict_entry_string(r, &sub, "DisplayName", u->display_name);
         pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
 
-    } else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
+    } else if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
         const char *xml = ROOT_INTROSPECT_XML;
 
         pa_assert_se(r = dbus_message_new_method_return(m));
@@ -913,7 +913,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
             append_sink_or_source_container_mediaobject2_properties(r, &sub, path);
             pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
 
-        } else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
+        } else if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
             pa_strbuf *sb;
             char *xml;
             uint32_t idx;
@@ -1010,7 +1010,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
 
             pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
 
-        } else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) {
+        } else if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
             const char *xml =
                 ITEM_INTROSPECT_XML;
 
index 5fafa6e..7f6c671 100644 (file)
@@ -689,7 +689,7 @@ static char *get_icon_name(pa_module*m) {
 
     msg = dbus_message_new_method_call(HOSTNAME_DBUS_INTERFACE,
                                        HOSTNAME_DBUS_PATH,
-                                       "org.freedesktop.DBus.Properties",
+                                       DBUS_INTERFACE_PROPERTIES,
                                        "Get");
     dbus_message_append_args(msg, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID);
 
index 70de870..9ccf3cd 100644 (file)
@@ -90,7 +90,7 @@ static DBusHandlerResult filter_handler(
        m = userdata;
        assert(m->ref >= 1);
 
-       if (dbus_message_is_signal(s, "org.freedesktop.DBus", "NameOwnerChanged")) {
+       if (dbus_message_is_signal(s, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
                const char *name, *old, *new;
 
                if (!dbus_message_get_args(
index b0038e6..53bcf96 100644 (file)
@@ -71,14 +71,14 @@ static const char introspection[] =
        "  <property name=\"ApplicationName\" type=\"s\" access=\"read\"/>"
        "  <property name=\"ApplicationDeviceName\" type=\"s\" access=\"read\"/>"
        " </interface>"
-       " <interface name=\"org.freedesktop.DBus.Properties\">"
+       " <interface name=\"" DBUS_INTERFACE_PROPERTIES "\">"
        "  <method name=\"Get\">"
        "   <arg name=\"interface\" direction=\"in\" type=\"s\"/>"
        "   <arg name=\"property\" direction=\"in\" type=\"s\"/>"
        "   <arg name=\"value\" direction=\"out\" type=\"v\"/>"
        "  </method>"
        " </interface>"
-       " <interface name=\"org.freedesktop.DBus.Introspectable\">"
+       " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">"
        "  <method name=\"Introspect\">"
        "   <arg name=\"data\" type=\"s\" direction=\"out\"/>"
        "  </method>"
@@ -170,7 +170,7 @@ static DBusHandlerResult object_handler(
 
        } else if (dbus_message_is_method_call(
                           m,
-                          "org.freedesktop.DBus.Properties",
+                          DBUS_INTERFACE_PROPERTIES,
                           "Get")) {
 
                const char *interface, *property;
@@ -234,7 +234,7 @@ static DBusHandlerResult object_handler(
 
        } else if (dbus_message_is_method_call(
                           m,
-                          "org.freedesktop.DBus.Introspectable",
+                          DBUS_INTERFACE_INTROSPECTABLE,
                           "Introspect")) {
                            const char *i = introspection;
 
@@ -300,7 +300,7 @@ static DBusHandlerResult filter_handler(
        d = userdata;
        assert(d->ref >= 1);
 
-       if (dbus_message_is_signal(m, "org.freedesktop.DBus", "NameLost")) {
+       if (dbus_message_is_signal(m, DBUS_INTERFACE_DBUS, "NameLost")) {
                const char *name;
 
                if (!dbus_message_get_args(
@@ -670,7 +670,7 @@ int rd_dbus_get_name_owner(
                        goto fail;
                }
 
-       } else if (dbus_error_has_name(error, "org.freedesktop.DBus.Error.NameHasNoOwner"))
+       } else if (dbus_error_has_name(error, DBUS_ERROR_NAME_HAS_NO_OWNER))
                dbus_error_free(error);
        else {
                r = -EIO;
index 31a48d1..ca32942 100644 (file)
@@ -515,7 +515,7 @@ static DBusHandlerResult handle_message_cb(DBusConnection *connection, DBusMessa
     pa_assert_se(call_info.method = dbus_message_get_member(message));
     pa_assert_se(call_info.method_sig = dbus_message_get_signature(message));
 
-    if (dbus_message_is_method_call(message, "org.freedesktop.DBus.Introspectable", "Introspect") ||
+    if (dbus_message_is_method_call(message, DBUS_INTERFACE_INTROSPECTABLE, "Introspect") ||
         (!dbus_message_get_interface(message) && dbus_message_has_member(message, "Introspect"))) {
         pa_dbus_send_basic_value_reply(connection, message, DBUS_TYPE_STRING, &call_info.obj_entry->introspection);
         goto finish;
index 2b7eb6a..87dd959 100644 (file)
@@ -77,7 +77,7 @@ static long long rtkit_get_int_property(DBusConnection *connection, const char*
         if (!(m = dbus_message_new_method_call(
                               RTKIT_SERVICE_NAME,
                               RTKIT_OBJECT_PATH,
-                              "org.freedesktop.DBus.Properties",
+                              DBUS_INTERFACE_PROPERTIES,
                               "Get"))) {
                 ret = -ENOMEM;
                 goto finish;
index 6f540e5..bd14d0f 100644 (file)
@@ -27,7 +27,7 @@ def get_ladspa_property_interface(sinkname):
     session = dbus.SessionBus()
 
     # get the private D-Bus socket address from PulseAudio properties
-    session_property_iface = dbus.Interface(session.get_object("org.PulseAudio1", "/org/pulseaudio/server_lookup1"), "org.freedesktop.DBus.Properties")
+    session_property_iface = dbus.Interface(session.get_object("org.PulseAudio1", "/org/pulseaudio/server_lookup1"), dbus.PROPERTIES_IFACE)
     socket = session_property_iface.Get("org.PulseAudio.ServerLookup1", "Address")
 
     # connect to the private PulseAudio D-Bus socket
@@ -40,7 +40,7 @@ def get_ladspa_property_interface(sinkname):
     ladspa_sink_path = core.GetSinkByName(sinkname)
 
     # property interface proxy for the sink
-    ladspa_sink_property_iface = dbus.Interface(connection.get_object(object_path=ladspa_sink_path), "org.freedesktop.DBus.Properties")
+    ladspa_sink_property_iface = dbus.Interface(connection.get_object(object_path=ladspa_sink_path), dbus.PROPERTIES_IFACE)
 
     return ladspa_sink_property_iface