From 1c376612b85d85da0fd284c9e2f03cddd8c3ac2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Thu, 26 Jun 2025 19:05:53 +0200 Subject: [PATCH 1/3] clapper: Do not skip on loading ported enhancers With some workarounds, we can make enhancers that were ported from features still be loaded and used within single process without requirement for building Clapper with their old implementations disabled. Since MPRIS enhancer already has workarounds in place, lets just remove all code that was skipping its loading. --- src/lib/clapper/clapper-enhancers-loader.c | 32 ---------------------- 1 file changed, 32 deletions(-) diff --git a/src/lib/clapper/clapper-enhancers-loader.c b/src/lib/clapper/clapper-enhancers-loader.c index 0ef148e6..1418642a 100644 --- a/src/lib/clapper/clapper-enhancers-loader.c +++ b/src/lib/clapper/clapper-enhancers-loader.c @@ -34,8 +34,6 @@ static HMODULE _enhancers_dll_handle = NULL; #include "clapper-extractable.h" #include "clapper-reactable.h" -#include - #define GST_CAT_DEFAULT clapper_enhancers_loader_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); @@ -134,36 +132,6 @@ clapper_enhancers_loader_initialize (ClapperEnhancerProxyList *proxies) ClapperEnhancerProxy *proxy; gboolean filled; - /* FIXME: 1.0: Remove together with features code and manager. - * These would clash with each other, so avoid loading these - * as enhancers when also compiled as part of the library. */ -#if (CLAPPER_HAVE_MPRIS || CLAPPER_HAVE_DISCOVERER || CLAPPER_HAVE_SERVER) - guint f_index; - const gchar *module_name = peas_plugin_info_get_module_name (info); - const gchar *ported_features[] = { -#if CLAPPER_HAVE_MPRIS - "clapper-mpris", -#endif -#if CLAPPER_HAVE_DISCOVERER - "clapper-discoverer", -#endif -#if CLAPPER_HAVE_SERVER - "clapper-server", -#endif - }; - - for (f_index = 0; f_index < G_N_ELEMENTS (ported_features); ++f_index) { - if (strcmp (module_name, ported_features[f_index]) == 0) { - GST_INFO ("Skipped \"%s\" enhancer module, since its" - " loaded from deprecated feature object", module_name); - g_clear_object (&info); - } - } - - if (!info) // cleared when exists as feature - continue; -#endif - /* Clapper supports only 1 proxy per plugin. Each plugin can * ship 1 class, but it can implement more than 1 interface. */ proxy = clapper_enhancer_proxy_new_global_take ((GObject *) info); From 31564b568be52660fe502cdb1adc9a709ac953f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Thu, 26 Jun 2025 19:09:29 +0200 Subject: [PATCH 2/3] clapper-app: Prefer MPRIS enhancer over feature object First try to find and use new MPRIS enhancer plugin, then old MPRIS feature as fallback --- src/bin/clapper-app/clapper-app-window.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/bin/clapper-app/clapper-app-window.c b/src/bin/clapper-app/clapper-app-window.c index 792ae82b..5876ec1e 100644 --- a/src/bin/clapper-app/clapper-app-window.c +++ b/src/bin/clapper-app/clapper-app-window.c @@ -1237,6 +1237,8 @@ clapper_app_window_constructed (GObject *object) ClapperAppWindow *self = CLAPPER_APP_WINDOW_CAST (object); ClapperPlayer *player = clapper_app_window_get_player (self); ClapperQueue *queue = clapper_player_get_queue (player); + ClapperEnhancerProxyList *proxies = clapper_player_get_enhancer_proxies (player); + ClapperEnhancerProxy *proxy; ClapperGtkExtraMenuButton *button; AdwStyleManager *manager; @@ -1250,10 +1252,6 @@ clapper_app_window_constructed (GObject *object) #if (CLAPPER_HAVE_MPRIS || CLAPPER_HAVE_SERVER || CLAPPER_HAVE_DISCOVERER) ClapperFeature *feature = NULL; #endif -#if (!CLAPPER_HAVE_MPRIS || !CLAPPER_HAVE_SERVER || !CLAPPER_HAVE_DISCOVERER) - ClapperEnhancerProxyList *proxies = clapper_player_get_enhancer_proxies (player); - ClapperEnhancerProxy *proxy; -#endif gchar mpris_name[45]; g_snprintf (mpris_name, sizeof (mpris_name), @@ -1262,7 +1260,6 @@ clapper_app_window_constructed (GObject *object) self->settings = g_settings_new (CLAPPER_APP_ID); self->last_volume = PERCENTAGE_ROUND (g_settings_get_double (self->settings, "volume")); -#if !CLAPPER_HAVE_MPRIS if ((proxy = clapper_enhancer_proxy_list_get_proxy_by_module (proxies, "clapper-mpris"))) { clapper_enhancer_proxy_set_locally (proxy, "own-name", mpris_name, @@ -1270,14 +1267,15 @@ clapper_app_window_constructed (GObject *object) "desktop-entry", CLAPPER_APP_ID, "queue-controllable", TRUE, NULL); gst_object_unref (proxy); - } -#else - feature = CLAPPER_FEATURE (clapper_mpris_new ( - mpris_name, CLAPPER_APP_NAME, CLAPPER_APP_ID)); - clapper_mpris_set_queue_controllable (CLAPPER_MPRIS (feature), TRUE); - clapper_player_add_feature (player, feature); - gst_object_unref (feature); + } else { +#if CLAPPER_HAVE_MPRIS + feature = CLAPPER_FEATURE (clapper_mpris_new ( + mpris_name, CLAPPER_APP_NAME, CLAPPER_APP_ID)); + clapper_mpris_set_queue_controllable (CLAPPER_MPRIS (feature), TRUE); + clapper_player_add_feature (player, feature); + gst_object_unref (feature); #endif + } #if CLAPPER_HAVE_SERVER feature = CLAPPER_FEATURE (clapper_server_new ()); From 225e665aff1d318688bca1b05a11de29adfc7ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Thu, 26 Jun 2025 19:11:27 +0200 Subject: [PATCH 3/3] clapper: Deprecate MPRIS feature It was ported to Clapper Enhancers repo as a plugin and applications using old one should slowy move towards using new plugin instead --- .../clapper/features/mpris/clapper-mpris.c | 22 +++++++++++++++++++ .../clapper/features/mpris/clapper-mpris.h | 12 +++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/lib/clapper/features/mpris/clapper-mpris.c b/src/lib/clapper/features/mpris/clapper-mpris.c index 6158da19..1e0016cd 100644 --- a/src/lib/clapper/features/mpris/clapper-mpris.c +++ b/src/lib/clapper/features/mpris/clapper-mpris.c @@ -23,6 +23,8 @@ * * Not every OS supports `MPRIS`. Use [const@Clapper.HAVE_MPRIS] macro * to check if Clapper API was compiled with this feature. + * + * Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead. */ #include "clapper-mpris.h" @@ -1346,6 +1348,8 @@ clapper_mpris_property_changed (ClapperFeature *feature, GParamSpec *pspec) * Creates a new #ClapperMpris instance. * * Returns: (transfer full): a new #ClapperMpris instance. + * + * Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead. */ ClapperMpris * clapper_mpris_new (const gchar *own_name, const gchar *identity, @@ -1376,6 +1380,8 @@ clapper_mpris_new (const gchar *own_name, const gchar *identity, * * You probably want to keep this disabled if your application * is supposed to manage what is played now and not MPRIS client. + * + * Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead. */ void clapper_mpris_set_queue_controllable (ClapperMpris *self, gboolean controllable) @@ -1397,6 +1403,8 @@ clapper_mpris_set_queue_controllable (ClapperMpris *self, gboolean controllable) * Get whether remote `MPRIS` clients can control [class@Clapper.Queue]. * * Returns: %TRUE if control over #ClapperQueue is allowed, %FALSE otherwise. + * + * Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead. */ gboolean clapper_mpris_get_queue_controllable (ClapperMpris *self) @@ -1412,6 +1420,8 @@ clapper_mpris_get_queue_controllable (ClapperMpris *self) * @art_url: (nullable): an art URL * * Set fallback artwork to show when media does not provide one. + * + * Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead. */ void 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) * Get fallback art URL earlier set by user. * * Returns: (transfer full) (nullable): fallback art URL. + * + * Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead. */ gchar * clapper_mpris_get_fallback_art_url (ClapperMpris *self) @@ -1611,6 +1623,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass) * Each #ClapperMpris instance running on the same system must have an unique name. * * Example: "org.mpris.MediaPlayer2.MyPlayer.instance123" + * + * Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead. */ param_specs[PROP_OWN_NAME] = g_param_spec_string ("own-name", NULL, NULL, NULL, @@ -1622,6 +1636,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass) * A friendly name to identify the media player. * * Example: "My Player" + * + * Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead. */ param_specs[PROP_IDENTITY] = g_param_spec_string ("identity", NULL, NULL, NULL, @@ -1631,6 +1647,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass) * ClapperMpris:desktop-entry: * * The basename of an installed .desktop file with the ".desktop" extension stripped. + * + * Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead. */ param_specs[PROP_DESKTOP_ENTRY] = g_param_spec_string ("desktop-entry", NULL, NULL, NULL, @@ -1640,6 +1658,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass) * ClapperMpris:queue-controllable: * * Whether remote MPRIS clients can control #ClapperQueue. + * + * Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead. */ param_specs[PROP_QUEUE_CONTROLLABLE] = g_param_spec_boolean ("queue-controllable", NULL, NULL, DEFAULT_QUEUE_CONTROLLABLE, @@ -1649,6 +1669,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass) * ClapperMpris:fallback-art-url: * * Fallback artwork to show when media does not provide one. + * + * Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead. */ param_specs[PROP_FALLBACK_ART_URL] = g_param_spec_string ("fallback-art-url", NULL, NULL, NULL, diff --git a/src/lib/clapper/features/mpris/clapper-mpris.h b/src/lib/clapper/features/mpris/clapper-mpris.h index 7d68a11d..d26530a1 100644 --- a/src/lib/clapper/features/mpris/clapper-mpris.h +++ b/src/lib/clapper/features/mpris/clapper-mpris.h @@ -34,22 +34,22 @@ G_BEGIN_DECLS #define CLAPPER_TYPE_MPRIS (clapper_mpris_get_type()) #define CLAPPER_MPRIS_CAST(obj) ((ClapperMpris *)(obj)) -CLAPPER_API +CLAPPER_DEPRECATED G_DECLARE_FINAL_TYPE (ClapperMpris, clapper_mpris, CLAPPER, MPRIS, ClapperFeature) -CLAPPER_API +CLAPPER_DEPRECATED ClapperMpris * clapper_mpris_new (const gchar *own_name, const gchar *identity, const gchar *desktop_entry); -CLAPPER_API +CLAPPER_DEPRECATED void clapper_mpris_set_queue_controllable (ClapperMpris *mpris, gboolean controllable); -CLAPPER_API +CLAPPER_DEPRECATED gboolean clapper_mpris_get_queue_controllable (ClapperMpris *mpris); -CLAPPER_API +CLAPPER_DEPRECATED void clapper_mpris_set_fallback_art_url (ClapperMpris *mpris, const gchar *art_url); -CLAPPER_API +CLAPPER_DEPRECATED gchar * clapper_mpris_get_fallback_art_url (ClapperMpris *mpris); G_END_DECLS