1 |
commit: a9b15954374b862493738cf6c0d1ad39a6040723 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Apr 3 11:45:23 2019 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 4 00:26:11 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=a9b15954 |
7 |
|
8 |
kde-plasma/plasma-pa: Backport patch to port from GConf to GSettings |
9 |
|
10 |
Thanks-to: Lars Wendler <polynomial-c <AT> gentoo.org> |
11 |
Bug: https://bugs.gentoo.org/658660 |
12 |
Package-Manager: Portage-2.3.62, Repoman-2.3.12 |
13 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
14 |
|
15 |
.../files/plasma-pa-5.15.4-gsettings.patch | 622 +++++++++++++++++++++ |
16 |
kde-plasma/plasma-pa/plasma-pa-5.15.49.9999.ebuild | 4 +- |
17 |
2 files changed, 625 insertions(+), 1 deletion(-) |
18 |
|
19 |
diff --git a/kde-plasma/plasma-pa/files/plasma-pa-5.15.4-gsettings.patch b/kde-plasma/plasma-pa/files/plasma-pa-5.15.4-gsettings.patch |
20 |
new file mode 100644 |
21 |
index 0000000000..5ecb0ea216 |
22 |
--- /dev/null |
23 |
+++ b/kde-plasma/plasma-pa/files/plasma-pa-5.15.4-gsettings.patch |
24 |
@@ -0,0 +1,622 @@ |
25 |
+From c6f41bea3371e6e1948a99ac64d5882d76d9c66e Mon Sep 17 00:00:00 2001 |
26 |
+From: Nicolas Fella <nicolas.fella@×××.de> |
27 |
+Date: Sun, 31 Mar 2019 16:19:55 +0200 |
28 |
+Subject: [PATCH] Port from GConf to GSettings |
29 |
+ |
30 |
+Summary: |
31 |
+CCBUG: 386665 |
32 |
+ |
33 |
+As discussed in bug 386665 GConf is deprecated and needs to be replaced by GSettings to keep features enabled. |
34 |
+ |
35 |
+Question: Do we need GConf as a fallback for PA versions without module-gsettings? |
36 |
+ |
37 |
+Test Plan: |
38 |
+Checkboxes in Advanced tab are enabled again. |
39 |
+Changed settings are shown in dconf-editor and vice versa. |
40 |
+Combine output checkbox shows/hides combined sink in applet |
41 |
+ |
42 |
+Reviewers: drosca, davidedmundson |
43 |
+ |
44 |
+Reviewed By: drosca |
45 |
+ |
46 |
+Subscribers: pino, lbeltrame, evpokp, rikmills, broulik, asturmlechner, plasma-devel |
47 |
+ |
48 |
+Tags: #plasma |
49 |
+ |
50 |
+Differential Revision: https://phabricator.kde.org/D14147 |
51 |
+--- |
52 |
+ CMakeLists.txt | 15 ++-- |
53 |
+ cmake/FindGIO.cmake | 72 +++++++++++++++++++ |
54 |
+ config.h.cmake | 3 +- |
55 |
+ src/CMakeLists.txt | 18 ++++- |
56 |
+ src/gsettingsitem.cpp | 91 ++++++++++++++++++++++++ |
57 |
+ src/gsettingsitem.h | 59 +++++++++++++++ |
58 |
+ src/kcm/package/contents/ui/Advanced.qml | 8 +-- |
59 |
+ src/modulemanager.cpp | 79 +++++++++++++------- |
60 |
+ src/modulemanager.h | 14 ++-- |
61 |
+ 9 files changed, 315 insertions(+), 44 deletions(-) |
62 |
+ create mode 100644 cmake/FindGIO.cmake |
63 |
+ create mode 100644 src/gsettingsitem.cpp |
64 |
+ create mode 100644 src/gsettingsitem.h |
65 |
+ |
66 |
+diff --git a/CMakeLists.txt b/CMakeLists.txt |
67 |
+index 9973ef7..d33dc1d 100644 |
68 |
+--- a/CMakeLists.txt |
69 |
++++ b/CMakeLists.txt |
70 |
+@@ -20,11 +20,6 @@ include(KDECompilerSettings NO_POLICY_SCOPE) |
71 |
+ include(ECMOptionalAddSubdirectory) |
72 |
+ |
73 |
+ include(FindPkgConfig) |
74 |
+-pkg_check_modules(GCONF gconf-2.0) |
75 |
+-pkg_check_modules(GOBJECT gobject-2.0) |
76 |
+-if (GCONF_FOUND AND GOBJECT_FOUND) |
77 |
+- set(HAVE_GCONF TRUE) |
78 |
+-endif() |
79 |
+ |
80 |
+ find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS |
81 |
+ Core |
82 |
+@@ -45,6 +40,16 @@ find_package(PulseAudio 5.0.0 REQUIRED) |
83 |
+ find_package(Canberra REQUIRED) |
84 |
+ find_package(GLIB2 REQUIRED) |
85 |
+ |
86 |
++option(USE_GCONF "Use legacy GConf instead of GSettings") |
87 |
++ |
88 |
++pkg_check_modules(GOBJECT gobject-2.0 REQUIRED) |
89 |
++if(USE_GCONF) |
90 |
++ pkg_check_modules(GCONF gconf-2.0 REQUIRED) |
91 |
++else() |
92 |
++ find_package(GIO REQUIRED) |
93 |
++ set(USE_GSETTINGS True) |
94 |
++endif() |
95 |
++ |
96 |
+ find_package(CanberraPulse) |
97 |
+ set_package_properties(CanberraPulse PROPERTIES |
98 |
+ DESCRIPTION "Pulseaudio backend for libcanberra" |
99 |
+diff --git a/cmake/FindGIO.cmake b/cmake/FindGIO.cmake |
100 |
+new file mode 100644 |
101 |
+index 0000000..827c243 |
102 |
+--- /dev/null |
103 |
++++ b/cmake/FindGIO.cmake |
104 |
+@@ -0,0 +1,72 @@ |
105 |
++# - Try to find the GIO libraries |
106 |
++# Once done this will define |
107 |
++# |
108 |
++# GIO_FOUND - system has GIO |
109 |
++# GIO_INCLUDE_DIR - the GIO include directory |
110 |
++# GIO_LIBRARIES - GIO library |
111 |
++# |
112 |
++# Copyright (c) 2010 Dario Freddi <drf@×××.org> |
113 |
++# |
114 |
++# Redistribution and use is allowed according to the terms of the BSD license. |
115 |
++# For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
116 |
++ |
117 |
++if(GIO_INCLUDE_DIR AND GIO_LIBRARIES) |
118 |
++ # Already in cache, be silent |
119 |
++ set(GIO_FIND_QUIETLY TRUE) |
120 |
++endif(GIO_INCLUDE_DIR AND GIO_LIBRARIES) |
121 |
++ |
122 |
++if (NOT WIN32) |
123 |
++ include(UsePkgConfig) |
124 |
++ pkgconfig(gio-2.0 _LibGIOIncDir _LibGIOLinkDir _LibGIOLinkFlags _LibGIOCflags) |
125 |
++endif(NOT WIN32) |
126 |
++ |
127 |
++MESSAGE(STATUS "gio include dir: ${_LibGIOIncDir}") |
128 |
++ |
129 |
++# first try without default paths to respect PKG_CONFIG_PATH |
130 |
++ |
131 |
++find_path(GIO_MAIN_INCLUDE_DIR glib.h |
132 |
++ PATH_SUFFIXES glib-2.0 |
133 |
++ PATHS ${_LibGIOIncDir} |
134 |
++ NO_DEFAULT_PATH) |
135 |
++ |
136 |
++find_path(GIO_MAIN_INCLUDE_DIR glib.h |
137 |
++ PATH_SUFFIXES glib-2.0 |
138 |
++ PATHS ${_LibGIOIncDir} ) |
139 |
++ |
140 |
++MESSAGE(STATUS "found gio main include dir: ${GIO_MAIN_INCLUDE_DIR}") |
141 |
++ |
142 |
++# search the glibconfig.h include dir under the same root where the library is found |
143 |
++find_library(GIO_LIBRARIES |
144 |
++ NAMES gio-2.0 |
145 |
++ PATHS ${_LibGIOLinkDir} |
146 |
++ NO_DEFAULT_PATH) |
147 |
++ |
148 |
++find_library(GIO_LIBRARIES |
149 |
++ NAMES gio-2.0 |
150 |
++ PATHS ${_LibGIOLinkDir}) |
151 |
++ |
152 |
++ |
153 |
++get_filename_component(GIOLibDir "${GIO_LIBRARIES}" PATH) |
154 |
++ |
155 |
++find_path(GIO_INTERNAL_INCLUDE_DIR glibconfig.h |
156 |
++ PATH_SUFFIXES glib-2.0/include |
157 |
++ PATHS ${_LibGIOIncDir} "${GIOLibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH} |
158 |
++ NO_DEFAULT_PATH) |
159 |
++ |
160 |
++find_path(GIO_INTERNAL_INCLUDE_DIR glibconfig.h |
161 |
++ PATH_SUFFIXES glib-2.0/include |
162 |
++ PATHS ${_LibGIOIncDir} "${GIOLibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH}) |
163 |
++ |
164 |
++set(GIO_INCLUDE_DIR "${GIO_MAIN_INCLUDE_DIR}") |
165 |
++ |
166 |
++# not sure if this include dir is optional or required |
167 |
++# for now it is optional |
168 |
++if(GIO_INTERNAL_INCLUDE_DIR) |
169 |
++ set(GIO_INCLUDE_DIR ${GIO_INCLUDE_DIR} "${GIO_INTERNAL_INCLUDE_DIR}") |
170 |
++endif(GIO_INTERNAL_INCLUDE_DIR) |
171 |
++ |
172 |
++include(FindPackageHandleStandardArgs) |
173 |
++find_package_handle_standard_args(GIO DEFAULT_MSG GIO_LIBRARIES GIO_MAIN_INCLUDE_DIR) |
174 |
++ |
175 |
++mark_as_advanced(GIO_INCLUDE_DIR GIO_LIBRARIES) |
176 |
++ |
177 |
+diff --git a/config.h.cmake b/config.h.cmake |
178 |
+index 1643e50..7d801c3 100644 |
179 |
+--- a/config.h.cmake |
180 |
++++ b/config.h.cmake |
181 |
+@@ -1,3 +1,4 @@ |
182 |
+ /* config.h. Generated by cmake from config.h.cmake */ |
183 |
+ |
184 |
+-#cmakedefine01 HAVE_GCONF |
185 |
++#cmakedefine01 USE_GSETTINGS |
186 |
++#cmakedefine01 USE_GCONF |
187 |
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt |
188 |
+index 8684251..d4a6c4b 100644 |
189 |
+--- a/src/CMakeLists.txt |
190 |
++++ b/src/CMakeLists.txt |
191 |
+@@ -37,11 +37,16 @@ set(qml_SRCS |
192 |
+ set_property(SOURCE qml/dbus/osdService.xml APPEND PROPERTY CLASSNAME OsdServiceInterface) |
193 |
+ qt5_add_dbus_interface(dbus_SRCS qml/dbus/osdService.xml osdservice) |
194 |
+ |
195 |
+-if (HAVE_GCONF) |
196 |
++if (USE_GCONF) |
197 |
+ include_directories(${GCONF_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS}) |
198 |
+ set(cpp_SRCS ${cpp_SRCS} gconfitem.cpp) |
199 |
+ endif() |
200 |
+ |
201 |
++if (USE_GSETTINGS) |
202 |
++ include_directories(${GIO_INCLUDE_DIRS} ${GOBJECT_INCLUDE_DIRS}) |
203 |
++ set(cpp_SRCS ${cpp_SRCS} gsettingsitem.cpp) |
204 |
++endif() |
205 |
++ |
206 |
+ add_library(plasma-volume-declarative SHARED ${dbus_SRCS} ${cpp_SRCS} ${qml_SRCS}) |
207 |
+ target_link_libraries(plasma-volume-declarative |
208 |
+ Qt5::Core |
209 |
+@@ -52,12 +57,19 @@ target_link_libraries(plasma-volume-declarative |
210 |
+ ${PULSEAUDIO_LIBRARY} |
211 |
+ ${PULSEAUDIO_MAINLOOP_LIBRARY} |
212 |
+ ${CANBERRA_LIBRARIES} |
213 |
++ ${GOBJECT_LIBRARIES} |
214 |
+ ) |
215 |
+ |
216 |
+-if (HAVE_GCONF) |
217 |
++if (USE_GCONF) |
218 |
+ target_link_libraries(plasma-volume-declarative |
219 |
+ ${GCONF_LDFLAGS} |
220 |
+- ${GOBJECT_LDFLAGS} |
221 |
++ ) |
222 |
++endif() |
223 |
++ |
224 |
++if (USE_GSETTINGS) |
225 |
++ target_link_libraries(plasma-volume-declarative |
226 |
++ ${GIO_LIBRARIES} |
227 |
++ GLIB2::GLIB2 |
228 |
+ ) |
229 |
+ endif() |
230 |
+ |
231 |
+diff --git a/src/gsettingsitem.cpp b/src/gsettingsitem.cpp |
232 |
+new file mode 100644 |
233 |
+index 0000000..b3a9353 |
234 |
+--- /dev/null |
235 |
++++ b/src/gsettingsitem.cpp |
236 |
+@@ -0,0 +1,91 @@ |
237 |
++/* |
238 |
++ * Copyright (C) 2018 Nicolas Fella <nicolas.fella@×××.de> |
239 |
++ * |
240 |
++ * This library is free software; you can redistribute it and/or |
241 |
++ * modify it under the terms of the GNU Lesser General Public License |
242 |
++ * version 2.1 as published by the Free Software Foundation. |
243 |
++ * |
244 |
++ * This library is distributed in the hope that it will be useful, but |
245 |
++ * WITHOUT ANY WARRANTY; without even the implied warranty of |
246 |
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
247 |
++ * Lesser General Public License for more details. |
248 |
++ * |
249 |
++ * You should have received a copy of the GNU Lesser General Public |
250 |
++ * License along with this library; if not, write to the Free Software |
251 |
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
252 |
++ * 02110-1301 USA |
253 |
++ * |
254 |
++ */ |
255 |
++ |
256 |
++#include <QString> |
257 |
++#include <QVariant> |
258 |
++ |
259 |
++#include <gio/gio.h> |
260 |
++ |
261 |
++#include "gsettingsitem.h" |
262 |
++#include "debug.h" |
263 |
++ |
264 |
++QVariant GSettingsItem::value(const QString &key) const |
265 |
++{ |
266 |
++ GVariant *gvalue = g_settings_get_value(m_settings, key.toLatin1().data()); |
267 |
++ |
268 |
++ QVariant toReturn; |
269 |
++ |
270 |
++ switch (g_variant_classify(gvalue)) { |
271 |
++ case G_VARIANT_CLASS_BOOLEAN: |
272 |
++ toReturn = QVariant((bool)g_variant_get_boolean(gvalue)); |
273 |
++ break; |
274 |
++ case G_VARIANT_CLASS_STRING: |
275 |
++ toReturn = QVariant(QString::fromUtf8(g_variant_get_string(gvalue, nullptr))); |
276 |
++ break; |
277 |
++ default: |
278 |
++ qCWarning(PLASMAPA()) << "Unhandled variant type in value()"; |
279 |
++ } |
280 |
++ |
281 |
++ g_variant_unref(gvalue); |
282 |
++ |
283 |
++ return toReturn; |
284 |
++} |
285 |
++ |
286 |
++void GSettingsItem::set(const QString &key, const QVariant &val) |
287 |
++{ |
288 |
++ // It might be hard to detect the right GVariant type from |
289 |
++ // complext QVariant types such as string lists or more detailed |
290 |
++ // types such as integers (GVariant has different sizes), |
291 |
++ // therefore we get the current value for the key and convert |
292 |
++ // to QVariant using the GVariant type |
293 |
++ GVariant *oldValue = g_settings_get_value(m_settings, key.toLatin1().data()); |
294 |
++ GVariant *newValue = nullptr; |
295 |
++ |
296 |
++ switch (g_variant_type_peek_string(g_variant_get_type(oldValue))[0]) { |
297 |
++ case G_VARIANT_CLASS_BOOLEAN: |
298 |
++ newValue = g_variant_new_boolean(val.toBool()); |
299 |
++ break; |
300 |
++ case G_VARIANT_CLASS_STRING: |
301 |
++ newValue = g_variant_new_string(val.toString().toUtf8().constData()); |
302 |
++ break; |
303 |
++ default: |
304 |
++ qCWarning(PLASMAPA()) << "Unhandled variant type in set()"; |
305 |
++ } |
306 |
++ |
307 |
++ if (newValue) { |
308 |
++ g_settings_set_value(m_settings, key.toLatin1().data(), newValue); |
309 |
++ } |
310 |
++ |
311 |
++ g_variant_unref(oldValue); |
312 |
++} |
313 |
++ |
314 |
++GSettingsItem::GSettingsItem(const QString &key, QObject *parent) |
315 |
++ : QObject (parent) |
316 |
++{ |
317 |
++ m_settings = g_settings_new_with_path("org.freedesktop.pulseaudio.module-group", key.toLatin1().data()); |
318 |
++ |
319 |
++ g_signal_connect(m_settings, "changed", G_CALLBACK(GSettingsItem::settingChanged), this); |
320 |
++} |
321 |
++ |
322 |
++GSettingsItem::~GSettingsItem() |
323 |
++{ |
324 |
++ g_settings_sync(); |
325 |
++ if (m_settings) |
326 |
++ g_object_unref(m_settings); |
327 |
++} |
328 |
+diff --git a/src/gsettingsitem.h b/src/gsettingsitem.h |
329 |
+new file mode 100644 |
330 |
+index 0000000..9afcfc2 |
331 |
+--- /dev/null |
332 |
++++ b/src/gsettingsitem.h |
333 |
+@@ -0,0 +1,59 @@ |
334 |
++/* |
335 |
++ * Copyright (C) 2018 Nicolas Fella <nicolas.fella@×××.de> |
336 |
++ * |
337 |
++ * This library is free software; you can redistribute it and/or |
338 |
++ * modify it under the terms of the GNU Lesser General Public License |
339 |
++ * version 2.1 as published by the Free Software Foundation. |
340 |
++ * |
341 |
++ * This library is distributed in the hope that it will be useful, but |
342 |
++ * WITHOUT ANY WARRANTY; without even the implied warranty of |
343 |
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
344 |
++ * Lesser General Public License for more details. |
345 |
++ * |
346 |
++ * You should have received a copy of the GNU Lesser General Public |
347 |
++ * License along with this library; if not, write to the Free Software |
348 |
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
349 |
++ * 02110-1301 USA |
350 |
++ * |
351 |
++ */ |
352 |
++ |
353 |
++#ifndef GSETTINGSITEM_H |
354 |
++#define GSETTINGSITEM_H |
355 |
++ |
356 |
++#include <QVariant> |
357 |
++#include <QStringList> |
358 |
++#include <QObject> |
359 |
++ |
360 |
++#include <gio/gio.h> |
361 |
++ |
362 |
++class GSettingsItem : public QObject |
363 |
++{ |
364 |
++ Q_OBJECT |
365 |
++ |
366 |
++ public: |
367 |
++ |
368 |
++ explicit GSettingsItem(const QString &key, QObject *parent = nullptr); |
369 |
++ virtual ~GSettingsItem() override; |
370 |
++ |
371 |
++ QVariant value(const QString &key) const; |
372 |
++ void set(const QString &key, const QVariant &val); |
373 |
++ |
374 |
++ |
375 |
++Q_SIGNALS: |
376 |
++ void subtreeChanged(); |
377 |
++ |
378 |
++private: |
379 |
++ GSettings *m_settings; |
380 |
++ |
381 |
++static void settingChanged(GSettings *settings, const gchar *key, gpointer data) |
382 |
++{ |
383 |
++ Q_UNUSED(settings) |
384 |
++ Q_UNUSED(key) |
385 |
++ |
386 |
++ GSettingsItem *self = static_cast<GSettingsItem *>(data); |
387 |
++ Q_EMIT self->subtreeChanged(); |
388 |
++} |
389 |
++ |
390 |
++}; |
391 |
++ |
392 |
++#endif // GCONFITEM_H |
393 |
+diff --git a/src/kcm/package/contents/ui/Advanced.qml b/src/kcm/package/contents/ui/Advanced.qml |
394 |
+index 536ae3e..48512e7 100644 |
395 |
+--- a/src/kcm/package/contents/ui/Advanced.qml |
396 |
++++ b/src/kcm/package/contents/ui/Advanced.qml |
397 |
+@@ -73,7 +73,7 @@ ScrollView { |
398 |
+ text: i18nd("kcm_pulseaudio", "Add virtual output device for simultaneous output on all local sound cards") |
399 |
+ checked: moduleManager.combineSinks |
400 |
+ onCheckedChanged: moduleManager.combineSinks = checked; |
401 |
+- enabled: moduleManager.loadedModules.indexOf("module-gconf") != -1 |
402 |
++ enabled: moduleManager.configModuleLoaded |
403 |
+ visible: moduleManager.settingsSupported |
404 |
+ } |
405 |
+ |
406 |
+@@ -84,7 +84,7 @@ ScrollView { |
407 |
+ text: i18nd("kcm_pulseaudio", "Automatically switch all running streams when a new output becomes available") |
408 |
+ checked: moduleManager.switchOnConnect |
409 |
+ onCheckedChanged: moduleManager.switchOnConnect = checked; |
410 |
+- enabled: moduleManager.loadedModules.indexOf("module-gconf") != -1 |
411 |
++ enabled: moduleManager.configModuleLoaded |
412 |
+ visible: moduleManager.settingsSupported |
413 |
+ } |
414 |
+ |
415 |
+@@ -92,8 +92,8 @@ ScrollView { |
416 |
+ Layout.alignment: Qt.AlignHCenter |
417 |
+ enabled: false |
418 |
+ font.italic: true |
419 |
+- text: i18nd("kcm_pulseaudio", "Requires 'module-gconf' PulseAudio module") |
420 |
+- visible: moduleManager.settingsSupported && moduleManager.loadedModules.indexOf("module-gconf") == -1 |
421 |
++ text: i18nd("kcm_pulseaudio", "Requires %1 PulseAudio module", moduleManager.configModuleName) |
422 |
++ visible: moduleManager.settingsSupported && !moduleManager.configModuleLoaded |
423 |
+ } |
424 |
+ |
425 |
+ Header { |
426 |
+diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp |
427 |
+index 5245ac5..a43182e 100644 |
428 |
+--- a/src/modulemanager.cpp |
429 |
++++ b/src/modulemanager.cpp |
430 |
+@@ -23,10 +23,15 @@ |
431 |
+ #include "module.h" |
432 |
+ #include "../config.h" |
433 |
+ |
434 |
+-#if HAVE_GCONF |
435 |
++#if USE_GSETTINGS |
436 |
++#include "gsettingsitem.h" |
437 |
++ |
438 |
++#define PA_SETTINGS_PATH_MODULES "/org/freedesktop/pulseaudio/module-groups" |
439 |
++#endif |
440 |
++ |
441 |
++#if USE_GCONF |
442 |
+ #include "gconfitem.h" |
443 |
+-#define PA_GCONF_ROOT "/system/pulseaudio" |
444 |
+-#define PA_GCONF_PATH_MODULES PA_GCONF_ROOT"/modules" |
445 |
++#define PA_SETTINGS_PATH_MODULES "/system/pulseaudio/modules" |
446 |
+ #endif |
447 |
+ |
448 |
+ #include <QTimer> |
449 |
+@@ -34,29 +39,38 @@ |
450 |
+ namespace QPulseAudio |
451 |
+ { |
452 |
+ |
453 |
+-#if HAVE_GCONF |
454 |
+-class GConfModule : public GConfItem |
455 |
++#if USE_GCONF || USE_GSETTINGS |
456 |
++ |
457 |
++#if USE_GSETTINGS |
458 |
++class ConfigModule : public GSettingsItem |
459 |
++#elif USE_GCONF |
460 |
++class ConfigModule : public GConfItem |
461 |
++#endif |
462 |
+ { |
463 |
+ public: |
464 |
+- GConfModule(const QString &configName, const QString &moduleName, QObject *parent); |
465 |
++ ConfigModule(const QString &configName, const QString &moduleName, QObject *parent); |
466 |
+ bool isEnabled() const; |
467 |
+ void setEnabled(bool enabled, const QVariant &args=QVariant()); |
468 |
+ private: |
469 |
+ QString m_moduleName; |
470 |
+ }; |
471 |
+ |
472 |
+-GConfModule::GConfModule(const QString &configName, const QString &moduleName, QObject *parent) : |
473 |
+- GConfItem(QStringLiteral(PA_GCONF_PATH_MODULES"/") + configName, parent), |
474 |
++ConfigModule::ConfigModule(const QString &configName, const QString &moduleName, QObject *parent) : |
475 |
++#if USE_GSETTINGS |
476 |
++ GSettingsItem(QStringLiteral(PA_SETTINGS_PATH_MODULES"/") + configName + QStringLiteral("/"), parent), |
477 |
++#elif USE_GCONF |
478 |
++ GConfItem(QStringLiteral(PA_SETTINGS_PATH_MODULES"/") + configName, parent), |
479 |
++#endif |
480 |
+ m_moduleName(moduleName) |
481 |
+ { |
482 |
+ } |
483 |
+ |
484 |
+-bool GConfModule::isEnabled() const |
485 |
++bool ConfigModule::isEnabled() const |
486 |
+ { |
487 |
+ return value(QStringLiteral("enabled")).toBool(); |
488 |
+ } |
489 |
+ |
490 |
+-void GConfModule::setEnabled(bool enabled, const QVariant &args) |
491 |
++void ConfigModule::setEnabled(bool enabled, const QVariant &args) |
492 |
+ { |
493 |
+ set(QStringLiteral("locked"), true); |
494 |
+ |
495 |
+@@ -69,20 +83,20 @@ void GConfModule::setEnabled(bool enabled, const QVariant &args) |
496 |
+ } |
497 |
+ set(QStringLiteral("locked"), false); |
498 |
+ } |
499 |
+-#endif |
500 |
+ |
501 |
++#endif |
502 |
+ |
503 |
+ ModuleManager::ModuleManager(QObject *parent) : |
504 |
+ QObject(parent) |
505 |
+ { |
506 |
+-#if HAVE_GCONF |
507 |
+- m_combineSinks = new GConfModule(QStringLiteral("combine"), QStringLiteral("module-combine"), this); |
508 |
+- m_switchOnConnect = new GConfModule(QStringLiteral("switch-on-connect"), QStringLiteral("module-switch-on-connect"), this); |
509 |
+- m_deviceManager = new GConfModule(QStringLiteral("device-manager"), QStringLiteral("module-device-manager"), this); |
510 |
+- |
511 |
+- connect(m_combineSinks, &GConfItem::subtreeChanged, this, &ModuleManager::combineSinksChanged); |
512 |
+- connect(m_switchOnConnect, &GConfItem::subtreeChanged, this, &ModuleManager::switchOnConnectChanged); |
513 |
+- connect(m_deviceManager, &GConfItem::subtreeChanged, this, &ModuleManager::switchOnConnectChanged); |
514 |
++#if USE_GCONF || USE_GSETTINGS |
515 |
++ m_combineSinks = new ConfigModule(QStringLiteral("combine"), QStringLiteral("module-combine"), this); |
516 |
++ m_switchOnConnect = new ConfigModule(QStringLiteral("switch-on-connect"), QStringLiteral("module-switch-on-connect"), this); |
517 |
++ m_deviceManager = new ConfigModule(QStringLiteral("device-manager"), QStringLiteral("module-device-manager"), this); |
518 |
++ |
519 |
++ connect(m_combineSinks, &ConfigModule::subtreeChanged, this, &ModuleManager::combineSinksChanged); |
520 |
++ connect(m_switchOnConnect, &ConfigModule::subtreeChanged, this, &ModuleManager::switchOnConnectChanged); |
521 |
++ connect(m_deviceManager, &ConfigModule::subtreeChanged, this, &ModuleManager::switchOnConnectChanged); |
522 |
+ #endif |
523 |
+ |
524 |
+ QTimer *updateModulesTimer = new QTimer(this); |
525 |
+@@ -100,7 +114,7 @@ ModuleManager::~ModuleManager() |
526 |
+ |
527 |
+ bool ModuleManager::settingsSupported() const |
528 |
+ { |
529 |
+-#if HAVE_GCONF |
530 |
++#if USE_GCONF || USE_GSETTINGS |
531 |
+ return true; |
532 |
+ #else |
533 |
+ return false; |
534 |
+@@ -109,7 +123,7 @@ bool ModuleManager::settingsSupported() const |
535 |
+ |
536 |
+ bool ModuleManager::combineSinks() const |
537 |
+ { |
538 |
+-#if HAVE_GCONF |
539 |
++#if USE_GCONF || USE_GSETTINGS |
540 |
+ return m_combineSinks->isEnabled(); |
541 |
+ #else |
542 |
+ return false; |
543 |
+@@ -118,21 +132,21 @@ bool ModuleManager::combineSinks() const |
544 |
+ |
545 |
+ void ModuleManager::setCombineSinks(bool combineSinks) |
546 |
+ { |
547 |
+-#if HAVE_GCONF |
548 |
++#if USE_GCONF || USE_GSETTINGS |
549 |
+ m_combineSinks->setEnabled(combineSinks); |
550 |
+ #else |
551 |
+- Q_UNUSED(combineSinks) |
552 |
++ Q_UNUSED(combineSinks() |
553 |
+ #endif |
554 |
+ } |
555 |
+ |
556 |
+ bool ModuleManager::switchOnConnect() const |
557 |
+ { |
558 |
++#if USE_GCONF || USE_GSETTINGS |
559 |
+ //switch on connect and device-manager do the same task. Only one should be enabled |
560 |
+ |
561 |
+ //Note on the first run m_deviceManager will appear to be disabled even though it's actually running |
562 |
+ //because there is no gconf entry, however m_switchOnConnect will only exist if set by Plasma PA |
563 |
+ //hence only check this entry |
564 |
+-#if HAVE_GCONF |
565 |
+ return m_switchOnConnect->isEnabled() ; |
566 |
+ #else |
567 |
+ return false; |
568 |
+@@ -141,7 +155,7 @@ bool ModuleManager::switchOnConnect() const |
569 |
+ |
570 |
+ void ModuleManager::setSwitchOnConnect(bool switchOnConnect) |
571 |
+ { |
572 |
+-#if HAVE_GCONF |
573 |
++#if USE_GCONF || USE_GSETTINGS |
574 |
+ m_deviceManager->setEnabled(!switchOnConnect); |
575 |
+ m_switchOnConnect->setEnabled(switchOnConnect); |
576 |
+ #else |
577 |
+@@ -164,4 +178,19 @@ void ModuleManager::updateLoadedModules() |
578 |
+ Q_EMIT loadedModulesChanged(); |
579 |
+ } |
580 |
+ |
581 |
++bool ModuleManager::configModuleLoaded() const |
582 |
++{ |
583 |
++ return m_loadedModules.contains(configModuleName()); |
584 |
++} |
585 |
++ |
586 |
++QString ModuleManager::configModuleName() const |
587 |
++{ |
588 |
++#if USE_GCONF |
589 |
++ return QStringLiteral("module-gconf"); |
590 |
++#elif USE_GSETTINGS |
591 |
++ return QStringLiteral("module-gsettings"); |
592 |
++#else |
593 |
++ return QString(); |
594 |
++#endif |
595 |
++} |
596 |
+ } |
597 |
+diff --git a/src/modulemanager.h b/src/modulemanager.h |
598 |
+index 17efd6d..291936e 100644 |
599 |
+--- a/src/modulemanager.h |
600 |
++++ b/src/modulemanager.h |
601 |
+@@ -29,11 +29,9 @@ |
602 |
+ // Properties need fully qualified classes even with pointers. |
603 |
+ #include "client.h" |
604 |
+ |
605 |
+-class GConfItem; |
606 |
+- |
607 |
+ namespace QPulseAudio |
608 |
+ { |
609 |
+-class GConfModule; |
610 |
++class ConfigModule; |
611 |
+ |
612 |
+ class ModuleManager : public QObject |
613 |
+ { |
614 |
+@@ -41,6 +39,8 @@ class ModuleManager : public QObject |
615 |
+ Q_PROPERTY(bool settingsSupported READ settingsSupported CONSTANT) |
616 |
+ Q_PROPERTY(bool combineSinks READ combineSinks WRITE setCombineSinks NOTIFY combineSinksChanged) |
617 |
+ Q_PROPERTY(bool switchOnConnect READ switchOnConnect WRITE setSwitchOnConnect NOTIFY switchOnConnectChanged) |
618 |
++ Q_PROPERTY(bool configModuleLoaded READ configModuleLoaded NOTIFY loadedModulesChanged) |
619 |
++ Q_PROPERTY(QString configModuleName READ configModuleName CONSTANT) |
620 |
+ Q_PROPERTY(QStringList loadedModules READ loadedModules NOTIFY loadedModulesChanged) |
621 |
+ public: |
622 |
+ explicit ModuleManager(QObject *parent = nullptr); |
623 |
+@@ -52,6 +52,8 @@ public: |
624 |
+ bool switchOnConnect() const; |
625 |
+ void setSwitchOnConnect(bool switchOnConnect); |
626 |
+ QStringList loadedModules() const; |
627 |
++ bool configModuleLoaded() const; |
628 |
++ QString configModuleName() const; |
629 |
+ |
630 |
+ Q_SIGNALS: |
631 |
+ void combineSinksChanged(); |
632 |
+@@ -61,9 +63,9 @@ Q_SIGNALS: |
633 |
+ private: |
634 |
+ void updateLoadedModules(); |
635 |
+ |
636 |
+- GConfModule *m_combineSinks; |
637 |
+- GConfModule *m_switchOnConnect; |
638 |
+- GConfModule *m_deviceManager; |
639 |
++ ConfigModule *m_combineSinks; |
640 |
++ ConfigModule *m_switchOnConnect; |
641 |
++ ConfigModule *m_deviceManager; |
642 |
+ QStringList m_loadedModules; |
643 |
+ }; |
644 |
+ |
645 |
+-- |
646 |
+2.21.0 |
647 |
|
648 |
diff --git a/kde-plasma/plasma-pa/plasma-pa-5.15.49.9999.ebuild b/kde-plasma/plasma-pa/plasma-pa-5.15.49.9999.ebuild |
649 |
index a997dc657b..1f2e426c8b 100644 |
650 |
--- a/kde-plasma/plasma-pa/plasma-pa-5.15.49.9999.ebuild |
651 |
+++ b/kde-plasma/plasma-pa/plasma-pa-5.15.49.9999.ebuild |
652 |
@@ -3,6 +3,7 @@ |
653 |
|
654 |
EAPI=7 |
655 |
|
656 |
+CMAKE_REMOVE_MODULES_LIST=( FindGLIB2 ) |
657 |
KDE_HANDBOOK="forceoptional" |
658 |
inherit kde5 |
659 |
|
660 |
@@ -20,6 +21,7 @@ DEPEND=" |
661 |
$(add_qt_dep qtdeclarative) |
662 |
$(add_qt_dep qtgui) |
663 |
$(add_qt_dep qtwidgets) |
664 |
+ dev-libs/glib:2 |
665 |
media-libs/libcanberra |
666 |
media-sound/pulseaudio |
667 |
" |
668 |
@@ -30,4 +32,4 @@ RDEPEND="${DEPEND} |
669 |
x11-themes/sound-theme-freedesktop |
670 |
" |
671 |
|
672 |
-PATCHES=( "${FILESDIR}/${PN}-5.13.3-automagic_gconf.patch" ) |
673 |
+PATCHES=( "${FILESDIR}/${PN}-5.15.4-gsettings.patch" ) |