Skip to content

Commit daadabb

Browse files
authored
Merge pull request #567 from Rafostar/mpris-compat
MPRIS compat changes
2 parents c4afd8b + 225e665 commit daadabb

4 files changed

Lines changed: 38 additions & 50 deletions

File tree

src/bin/clapper-app/clapper-app-window.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,8 @@ clapper_app_window_constructed (GObject *object)
12371237
ClapperAppWindow *self = CLAPPER_APP_WINDOW_CAST (object);
12381238
ClapperPlayer *player = clapper_app_window_get_player (self);
12391239
ClapperQueue *queue = clapper_player_get_queue (player);
1240+
ClapperEnhancerProxyList *proxies = clapper_player_get_enhancer_proxies (player);
1241+
ClapperEnhancerProxy *proxy;
12401242
ClapperGtkExtraMenuButton *button;
12411243
AdwStyleManager *manager;
12421244

@@ -1250,10 +1252,6 @@ clapper_app_window_constructed (GObject *object)
12501252
#if (CLAPPER_HAVE_MPRIS || CLAPPER_HAVE_SERVER || CLAPPER_HAVE_DISCOVERER)
12511253
ClapperFeature *feature = NULL;
12521254
#endif
1253-
#if (!CLAPPER_HAVE_MPRIS || !CLAPPER_HAVE_SERVER || !CLAPPER_HAVE_DISCOVERER)
1254-
ClapperEnhancerProxyList *proxies = clapper_player_get_enhancer_proxies (player);
1255-
ClapperEnhancerProxy *proxy;
1256-
#endif
12571255

12581256
gchar mpris_name[45];
12591257
g_snprintf (mpris_name, sizeof (mpris_name),
@@ -1262,22 +1260,22 @@ clapper_app_window_constructed (GObject *object)
12621260
self->settings = g_settings_new (CLAPPER_APP_ID);
12631261
self->last_volume = PERCENTAGE_ROUND (g_settings_get_double (self->settings, "volume"));
12641262

1265-
#if !CLAPPER_HAVE_MPRIS
12661263
if ((proxy = clapper_enhancer_proxy_list_get_proxy_by_module (proxies, "clapper-mpris"))) {
12671264
clapper_enhancer_proxy_set_locally (proxy,
12681265
"own-name", mpris_name,
12691266
"identity", CLAPPER_APP_NAME,
12701267
"desktop-entry", CLAPPER_APP_ID,
12711268
"queue-controllable", TRUE, NULL);
12721269
gst_object_unref (proxy);
1273-
}
1274-
#else
1275-
feature = CLAPPER_FEATURE (clapper_mpris_new (
1276-
mpris_name, CLAPPER_APP_NAME, CLAPPER_APP_ID));
1277-
clapper_mpris_set_queue_controllable (CLAPPER_MPRIS (feature), TRUE);
1278-
clapper_player_add_feature (player, feature);
1279-
gst_object_unref (feature);
1270+
} else {
1271+
#if CLAPPER_HAVE_MPRIS
1272+
feature = CLAPPER_FEATURE (clapper_mpris_new (
1273+
mpris_name, CLAPPER_APP_NAME, CLAPPER_APP_ID));
1274+
clapper_mpris_set_queue_controllable (CLAPPER_MPRIS (feature), TRUE);
1275+
clapper_player_add_feature (player, feature);
1276+
gst_object_unref (feature);
12801277
#endif
1278+
}
12811279

12821280
#if CLAPPER_HAVE_SERVER
12831281
feature = CLAPPER_FEATURE (clapper_server_new ());

src/lib/clapper/clapper-enhancers-loader.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ static HMODULE _enhancers_dll_handle = NULL;
3434
#include "clapper-extractable.h"
3535
#include "clapper-reactable.h"
3636

37-
#include <clapper-functionalities-availability.h>
38-
3937
#define GST_CAT_DEFAULT clapper_enhancers_loader_debug
4038
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
4139

@@ -134,36 +132,6 @@ clapper_enhancers_loader_initialize (ClapperEnhancerProxyList *proxies)
134132
ClapperEnhancerProxy *proxy;
135133
gboolean filled;
136134

137-
/* FIXME: 1.0: Remove together with features code and manager.
138-
* These would clash with each other, so avoid loading these
139-
* as enhancers when also compiled as part of the library. */
140-
#if (CLAPPER_HAVE_MPRIS || CLAPPER_HAVE_DISCOVERER || CLAPPER_HAVE_SERVER)
141-
guint f_index;
142-
const gchar *module_name = peas_plugin_info_get_module_name (info);
143-
const gchar *ported_features[] = {
144-
#if CLAPPER_HAVE_MPRIS
145-
"clapper-mpris",
146-
#endif
147-
#if CLAPPER_HAVE_DISCOVERER
148-
"clapper-discoverer",
149-
#endif
150-
#if CLAPPER_HAVE_SERVER
151-
"clapper-server",
152-
#endif
153-
};
154-
155-
for (f_index = 0; f_index < G_N_ELEMENTS (ported_features); ++f_index) {
156-
if (strcmp (module_name, ported_features[f_index]) == 0) {
157-
GST_INFO ("Skipped \"%s\" enhancer module, since its"
158-
" loaded from deprecated feature object", module_name);
159-
g_clear_object (&info);
160-
}
161-
}
162-
163-
if (!info) // cleared when exists as feature
164-
continue;
165-
#endif
166-
167135
/* Clapper supports only 1 proxy per plugin. Each plugin can
168136
* ship 1 class, but it can implement more than 1 interface. */
169137
proxy = clapper_enhancer_proxy_new_global_take ((GObject *) info);

src/lib/clapper/features/mpris/clapper-mpris.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
*
2424
* Not every OS supports `MPRIS`. Use [const@Clapper.HAVE_MPRIS] macro
2525
* to check if Clapper API was compiled with this feature.
26+
*
27+
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
2628
*/
2729

2830
#include "clapper-mpris.h"
@@ -1346,6 +1348,8 @@ clapper_mpris_property_changed (ClapperFeature *feature, GParamSpec *pspec)
13461348
* Creates a new #ClapperMpris instance.
13471349
*
13481350
* Returns: (transfer full): a new #ClapperMpris instance.
1351+
*
1352+
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
13491353
*/
13501354
ClapperMpris *
13511355
clapper_mpris_new (const gchar *own_name, const gchar *identity,
@@ -1376,6 +1380,8 @@ clapper_mpris_new (const gchar *own_name, const gchar *identity,
13761380
*
13771381
* You probably want to keep this disabled if your application
13781382
* is supposed to manage what is played now and not MPRIS client.
1383+
*
1384+
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
13791385
*/
13801386
void
13811387
clapper_mpris_set_queue_controllable (ClapperMpris *self, gboolean controllable)
@@ -1397,6 +1403,8 @@ clapper_mpris_set_queue_controllable (ClapperMpris *self, gboolean controllable)
13971403
* Get whether remote `MPRIS` clients can control [class@Clapper.Queue].
13981404
*
13991405
* Returns: %TRUE if control over #ClapperQueue is allowed, %FALSE otherwise.
1406+
*
1407+
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
14001408
*/
14011409
gboolean
14021410
clapper_mpris_get_queue_controllable (ClapperMpris *self)
@@ -1412,6 +1420,8 @@ clapper_mpris_get_queue_controllable (ClapperMpris *self)
14121420
* @art_url: (nullable): an art URL
14131421
*
14141422
* Set fallback artwork to show when media does not provide one.
1423+
*
1424+
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
14151425
*/
14161426
void
14171427
clapper_mpris_set_fallback_art_url (ClapperMpris *self, const gchar *art_url)
@@ -1435,6 +1445,8 @@ clapper_mpris_set_fallback_art_url (ClapperMpris *self, const gchar *art_url)
14351445
* Get fallback art URL earlier set by user.
14361446
*
14371447
* Returns: (transfer full) (nullable): fallback art URL.
1448+
*
1449+
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
14381450
*/
14391451
gchar *
14401452
clapper_mpris_get_fallback_art_url (ClapperMpris *self)
@@ -1611,6 +1623,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass)
16111623
* Each #ClapperMpris instance running on the same system must have an unique name.
16121624
*
16131625
* Example: "org.mpris.MediaPlayer2.MyPlayer.instance123"
1626+
*
1627+
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
16141628
*/
16151629
param_specs[PROP_OWN_NAME] = g_param_spec_string ("own-name",
16161630
NULL, NULL, NULL,
@@ -1622,6 +1636,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass)
16221636
* A friendly name to identify the media player.
16231637
*
16241638
* Example: "My Player"
1639+
*
1640+
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
16251641
*/
16261642
param_specs[PROP_IDENTITY] = g_param_spec_string ("identity",
16271643
NULL, NULL, NULL,
@@ -1631,6 +1647,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass)
16311647
* ClapperMpris:desktop-entry:
16321648
*
16331649
* The basename of an installed .desktop file with the ".desktop" extension stripped.
1650+
*
1651+
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
16341652
*/
16351653
param_specs[PROP_DESKTOP_ENTRY] = g_param_spec_string ("desktop-entry",
16361654
NULL, NULL, NULL,
@@ -1640,6 +1658,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass)
16401658
* ClapperMpris:queue-controllable:
16411659
*
16421660
* Whether remote MPRIS clients can control #ClapperQueue.
1661+
*
1662+
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
16431663
*/
16441664
param_specs[PROP_QUEUE_CONTROLLABLE] = g_param_spec_boolean ("queue-controllable",
16451665
NULL, NULL, DEFAULT_QUEUE_CONTROLLABLE,
@@ -1649,6 +1669,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass)
16491669
* ClapperMpris:fallback-art-url:
16501670
*
16511671
* Fallback artwork to show when media does not provide one.
1672+
*
1673+
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
16521674
*/
16531675
param_specs[PROP_FALLBACK_ART_URL] = g_param_spec_string ("fallback-art-url",
16541676
NULL, NULL, NULL,

src/lib/clapper/features/mpris/clapper-mpris.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,22 @@ G_BEGIN_DECLS
3434
#define CLAPPER_TYPE_MPRIS (clapper_mpris_get_type())
3535
#define CLAPPER_MPRIS_CAST(obj) ((ClapperMpris *)(obj))
3636

37-
CLAPPER_API
37+
CLAPPER_DEPRECATED
3838
G_DECLARE_FINAL_TYPE (ClapperMpris, clapper_mpris, CLAPPER, MPRIS, ClapperFeature)
3939

40-
CLAPPER_API
40+
CLAPPER_DEPRECATED
4141
ClapperMpris * clapper_mpris_new (const gchar *own_name, const gchar *identity, const gchar *desktop_entry);
4242

43-
CLAPPER_API
43+
CLAPPER_DEPRECATED
4444
void clapper_mpris_set_queue_controllable (ClapperMpris *mpris, gboolean controllable);
4545

46-
CLAPPER_API
46+
CLAPPER_DEPRECATED
4747
gboolean clapper_mpris_get_queue_controllable (ClapperMpris *mpris);
4848

49-
CLAPPER_API
49+
CLAPPER_DEPRECATED
5050
void clapper_mpris_set_fallback_art_url (ClapperMpris *mpris, const gchar *art_url);
5151

52-
CLAPPER_API
52+
CLAPPER_DEPRECATED
5353
gchar * clapper_mpris_get_fallback_art_url (ClapperMpris *mpris);
5454

5555
G_END_DECLS

0 commit comments

Comments
 (0)