Merge lp:~thomas-voss/media-hub/do-not-export-to-mpris-by-default into lp:media-hub

Proposed by Thomas Voß
Status: Merged
Approved by: Alberto Aguirre
Approved revision: 73
Merged at revision: 73
Proposed branch: lp:~thomas-voss/media-hub/do-not-export-to-mpris-by-default
Merge into: lp:media-hub
Diff against target: 78 lines (+18/-1)
4 files modified
CMakeLists.txt (+2/-0)
src/core/media/CMakeLists.txt (+1/-0)
src/core/media/service_skeleton.cpp (+14/-1)
tests/unit-tests/CMakeLists.txt (+1/-0)
To merge this branch: bzr merge lp:~thomas-voss/media-hub/do-not-export-to-mpris-by-default
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Alberto Aguirre (community) Approve
Review via email: mp+238324@code.launchpad.net

Commit message

Only expose the service as MPRIS instance if explicitly requested via env variable.

Description of the change

Only expose the service as MPRIS instance if explicitly requested via env variable.

To post a comment you must log in.
Revision history for this message
Alberto Aguirre (albaguirre) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-08-28 07:17:42 +0000
3+++ CMakeLists.txt 2014-10-14 16:23:04 +0000
4@@ -24,6 +24,7 @@
5 find_package(GLog)
6 pkg_check_modules(DBUS dbus-1 REQUIRED)
7 pkg_check_modules(DBUS_CPP dbus-cpp REQUIRED)
8+pkg_check_modules(PROCESS_CPP process-cpp REQUIRED)
9 pkg_check_modules(PROPERTIES_CPP properties-cpp REQUIRED)
10 pkg_check_modules(GIO gio-2.0 REQUIRED)
11 pkg_check_modules(HYBRIS_MEDIA libmedia REQUIRED)
12@@ -53,6 +54,7 @@
13 ${DBUS_INCLUDE_DIRS}
14 ${DBUS_CPP_INCLUDE_DIRS}
15 ${GLog_INCLUDE_DIR}
16+ ${PROCESS_CPP_INCLUDE_DIRS}
17 ${PROPERTIES_CPP_INCLUDE_DIRS}
18
19 include/
20
21=== modified file 'src/core/media/CMakeLists.txt'
22--- src/core/media/CMakeLists.txt 2014-09-09 14:02:52 +0000
23+++ src/core/media/CMakeLists.txt 2014-10-14 16:23:04 +0000
24@@ -95,6 +95,7 @@
25 ${DBUS_CPP_LDFLAGS}
26 ${GLog_LIBRARY}
27 ${PC_GSTREAMER_1_0_LIBRARIES}
28+ ${PROCESS_CPP_LDFLAGS}
29 ${GIO_LIBRARIES}
30 ${HYBRIS_MEDIA_LIBRARIES}
31 )
32
33=== modified file 'src/core/media/service_skeleton.cpp'
34--- src/core/media/service_skeleton.cpp 2014-09-09 21:27:29 +0000
35+++ src/core/media/service_skeleton.cpp 2014-10-14 16:23:04 +0000
36@@ -34,6 +34,8 @@
37 #include <core/dbus/object.h>
38 #include <core/dbus/types/object_path.h>
39
40+#include <core/posix/this_process.h>
41+
42 #include <map>
43 #include <regex>
44 #include <sstream>
45@@ -157,9 +159,20 @@
46 return defaults;
47 }
48
49+ static std::string service_name()
50+ {
51+ static const bool export_to_indicator_sound_via_mpris
52+ {
53+ core::posix::this_process::env::get("UBUNTU_MEDIA_HUB_EXPORT_TO_INDICATOR_VIA_MPRIS", "0") == "1"
54+ };
55+
56+ return export_to_indicator_sound_via_mpris ? "org.mpris.MediaPlayer2.MediaHub" :
57+ "hidden.org.mpris.MediaPlayer2.MediaHub";
58+ }
59+
60 explicit Exported(const dbus::Bus::Ptr& bus, const media::CoverArtResolver& cover_art_resolver)
61 : bus{bus},
62- service{dbus::Service::add_service(bus, "org.mpris.MediaPlayer2.MediaHub")},
63+ service{dbus::Service::add_service(bus, service_name())},
64 object{service->add_object_for_path(dbus::types::ObjectPath{"/org/mpris/MediaPlayer2"})},
65 media_player{mpris::MediaPlayer2::Skeleton::Configuration{bus, object, media_player_defaults()}},
66 player{mpris::Player::Skeleton::Configuration{bus, object, player_defaults()}},
67
68=== modified file 'tests/unit-tests/CMakeLists.txt'
69--- tests/unit-tests/CMakeLists.txt 2014-09-09 14:48:51 +0000
70+++ tests/unit-tests/CMakeLists.txt 2014-10-14 16:23:04 +0000
71@@ -33,6 +33,7 @@
72 ${DBUS_CPP_LDFLAGS}
73 ${GLog_LIBRARY}
74 ${PC_GSTREAMER_1_0_LIBRARIES}
75+ ${PROCESS_CPP_LDFLAGS}
76 ${GIO_LIBRARIES}
77
78 gmock

Subscribers

People subscribed via source and target branches