[grilo-plugins/wip/hadess/dleyna-change-bus-name: 11/11] dleyna: Allow distributors to change the dleyna bus name



commit d8e7d0d2b3376660a70ad7df3d79581199719f80
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 4 16:22:43 2019 +0100

    dleyna: Allow distributors to change the dleyna bus name
    
    This makes it possible for the dleyna plugin to work against a
    namespaced dleyna D-Bus server, such as the one running inside a
    sandbox alongside the application it supports.

 meson.build                             | 3 +++
 meson_options.txt                       | 1 +
 src/dleyna/grl-dleyna-servers-manager.c | 4 ++--
 src/dleyna/grl-dleyna-source.c          | 2 --
 4 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 96015365..33a6f40f 100644
--- a/meson.build
+++ b/meson.build
@@ -153,6 +153,9 @@ foreach p: plugins
         cdata.set_quoted('DPAP_PLUGIN_ID', 'grl-dpap')
         cdata.set_quoted('DAAP_PLUGIN_ID', 'grl-daap')
     endif
+    if p[NAME] == 'dleyna'
+      cdata.set_quoted('DLEYNA_DBUS_NAME', get_option('dleyna-service-name'))
+    endif
     idx = idx + 1
 endforeach
 
diff --git a/meson_options.txt b/meson_options.txt
index 7ded397b..ec324f63 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,6 +1,7 @@
 option('enable-bookmarks', type: 'combo', choices: [ 'auto', 'yes', 'no' ], value: 'auto', description: 
'Enable Bookmarks plugin')
 option('enable-chromaprint', type: 'combo', choices: [ 'auto', 'yes', 'no' ], value: 'auto', description: 
'Enable Chromaprint plugin')
 option('enable-dleyna', type: 'combo', choices: [ 'auto', 'yes', 'no' ], value: 'auto', description: 'Enable 
dLeyna plugin')
+option('dleyna-service-name', type: 'string', value : 'com.intel.dleyna-server', description: 'D-Bus name 
for dLeyna server')
 option('enable-dmap', type: 'combo', choices: [ 'auto', 'yes', 'no' ], value: 'auto', description: 'Enable 
DMAP plugin')
 option('enable-filesystem', type: 'combo', choices: [ 'auto', 'yes', 'no' ], value: 'auto', description: 
'Enable Filesystem plugin')
 option('enable-flickr', type: 'combo', choices: [ 'auto', 'yes', 'no' ], value: 'auto', description: 'Enable 
Flickr plugin')
diff --git a/src/dleyna/grl-dleyna-servers-manager.c b/src/dleyna/grl-dleyna-servers-manager.c
index 701567c8..ee322e69 100644
--- a/src/dleyna/grl-dleyna-servers-manager.c
+++ b/src/dleyna/grl-dleyna-servers-manager.c
@@ -97,7 +97,7 @@ grl_dleyna_servers_manager_server_found_cb (GrlDleynaServersManager *self,
                                             gpointer                *data)
 {
   grl_dleyna_server_new_for_bus (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE,
-                                 "com.intel.dleyna-server", object_path, NULL,
+                                 DLEYNA_DBUS_NAME, object_path, NULL,
                                  grl_dleyna_servers_manager_server_new_cb, self);
 }
 
@@ -205,7 +205,7 @@ grl_dleyna_servers_manager_init (GrlDleynaServersManager *self)
   self->priv = priv = grl_dleyna_servers_manager_get_instance_private (self);
 
   grl_dleyna_manager_proxy_new_for_bus (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE,
-                                        "com.intel.dleyna-server", "/com/intel/dLeynaServer", NULL,
+                                        DLEYNA_DBUS_NAME, "/com/intel/dLeynaServer", NULL,
                                         grl_dleyna_servers_manager_proxy_new_cb, g_object_ref (self));
   priv->servers = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
 }
diff --git a/src/dleyna/grl-dleyna-source.c b/src/dleyna/grl-dleyna-source.c
index 6da7855f..0ceb9e63 100644
--- a/src/dleyna/grl-dleyna-source.c
+++ b/src/dleyna/grl-dleyna-source.c
@@ -36,8 +36,6 @@
 #define MEDIA_ID_PREFIX "dleyna:"
 #define MEDIA_ID_PREFIX_LENGTH 7
 
-#define DLEYNA_DBUS_NAME "com.intel.dleyna-server"
-
 #define DLEYNA_SEARCH_SPEC                \
   "(DisplayName contains \"%s\" or "      \
   "Album contains \"%s\" or "             \


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