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
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-08-28 07:17:42 +0000
+++ CMakeLists.txt 2014-10-14 16:23:04 +0000
@@ -24,6 +24,7 @@
24find_package(GLog)24find_package(GLog)
25pkg_check_modules(DBUS dbus-1 REQUIRED)25pkg_check_modules(DBUS dbus-1 REQUIRED)
26pkg_check_modules(DBUS_CPP dbus-cpp REQUIRED)26pkg_check_modules(DBUS_CPP dbus-cpp REQUIRED)
27pkg_check_modules(PROCESS_CPP process-cpp REQUIRED)
27pkg_check_modules(PROPERTIES_CPP properties-cpp REQUIRED)28pkg_check_modules(PROPERTIES_CPP properties-cpp REQUIRED)
28pkg_check_modules(GIO gio-2.0 REQUIRED)29pkg_check_modules(GIO gio-2.0 REQUIRED)
29pkg_check_modules(HYBRIS_MEDIA libmedia REQUIRED)30pkg_check_modules(HYBRIS_MEDIA libmedia REQUIRED)
@@ -53,6 +54,7 @@
53 ${DBUS_INCLUDE_DIRS}54 ${DBUS_INCLUDE_DIRS}
54 ${DBUS_CPP_INCLUDE_DIRS}55 ${DBUS_CPP_INCLUDE_DIRS}
55 ${GLog_INCLUDE_DIR}56 ${GLog_INCLUDE_DIR}
57 ${PROCESS_CPP_INCLUDE_DIRS}
56 ${PROPERTIES_CPP_INCLUDE_DIRS}58 ${PROPERTIES_CPP_INCLUDE_DIRS}
5759
58 include/60 include/
5961
=== modified file 'src/core/media/CMakeLists.txt'
--- src/core/media/CMakeLists.txt 2014-09-09 14:02:52 +0000
+++ src/core/media/CMakeLists.txt 2014-10-14 16:23:04 +0000
@@ -95,6 +95,7 @@
95 ${DBUS_CPP_LDFLAGS}95 ${DBUS_CPP_LDFLAGS}
96 ${GLog_LIBRARY}96 ${GLog_LIBRARY}
97 ${PC_GSTREAMER_1_0_LIBRARIES}97 ${PC_GSTREAMER_1_0_LIBRARIES}
98 ${PROCESS_CPP_LDFLAGS}
98 ${GIO_LIBRARIES}99 ${GIO_LIBRARIES}
99 ${HYBRIS_MEDIA_LIBRARIES}100 ${HYBRIS_MEDIA_LIBRARIES}
100)101)
101102
=== modified file 'src/core/media/service_skeleton.cpp'
--- src/core/media/service_skeleton.cpp 2014-09-09 21:27:29 +0000
+++ src/core/media/service_skeleton.cpp 2014-10-14 16:23:04 +0000
@@ -34,6 +34,8 @@
34#include <core/dbus/object.h>34#include <core/dbus/object.h>
35#include <core/dbus/types/object_path.h>35#include <core/dbus/types/object_path.h>
3636
37#include <core/posix/this_process.h>
38
37#include <map>39#include <map>
38#include <regex>40#include <regex>
39#include <sstream>41#include <sstream>
@@ -157,9 +159,20 @@
157 return defaults;159 return defaults;
158 }160 }
159161
162 static std::string service_name()
163 {
164 static const bool export_to_indicator_sound_via_mpris
165 {
166 core::posix::this_process::env::get("UBUNTU_MEDIA_HUB_EXPORT_TO_INDICATOR_VIA_MPRIS", "0") == "1"
167 };
168
169 return export_to_indicator_sound_via_mpris ? "org.mpris.MediaPlayer2.MediaHub" :
170 "hidden.org.mpris.MediaPlayer2.MediaHub";
171 }
172
160 explicit Exported(const dbus::Bus::Ptr& bus, const media::CoverArtResolver& cover_art_resolver)173 explicit Exported(const dbus::Bus::Ptr& bus, const media::CoverArtResolver& cover_art_resolver)
161 : bus{bus},174 : bus{bus},
162 service{dbus::Service::add_service(bus, "org.mpris.MediaPlayer2.MediaHub")},175 service{dbus::Service::add_service(bus, service_name())},
163 object{service->add_object_for_path(dbus::types::ObjectPath{"/org/mpris/MediaPlayer2"})},176 object{service->add_object_for_path(dbus::types::ObjectPath{"/org/mpris/MediaPlayer2"})},
164 media_player{mpris::MediaPlayer2::Skeleton::Configuration{bus, object, media_player_defaults()}},177 media_player{mpris::MediaPlayer2::Skeleton::Configuration{bus, object, media_player_defaults()}},
165 player{mpris::Player::Skeleton::Configuration{bus, object, player_defaults()}},178 player{mpris::Player::Skeleton::Configuration{bus, object, player_defaults()}},
166179
=== modified file 'tests/unit-tests/CMakeLists.txt'
--- tests/unit-tests/CMakeLists.txt 2014-09-09 14:48:51 +0000
+++ tests/unit-tests/CMakeLists.txt 2014-10-14 16:23:04 +0000
@@ -33,6 +33,7 @@
33 ${DBUS_CPP_LDFLAGS}33 ${DBUS_CPP_LDFLAGS}
34 ${GLog_LIBRARY}34 ${GLog_LIBRARY}
35 ${PC_GSTREAMER_1_0_LIBRARIES}35 ${PC_GSTREAMER_1_0_LIBRARIES}
36 ${PROCESS_CPP_LDFLAGS}
36 ${GIO_LIBRARIES}37 ${GIO_LIBRARIES}
3738
38 gmock39 gmock

Subscribers

People subscribed via source and target branches