mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Merge pull request #567 from Rafostar/mpris-compat
MPRIS compat changes
This commit is contained in:
@@ -1237,6 +1237,8 @@ clapper_app_window_constructed (GObject *object)
|
|||||||
ClapperAppWindow *self = CLAPPER_APP_WINDOW_CAST (object);
|
ClapperAppWindow *self = CLAPPER_APP_WINDOW_CAST (object);
|
||||||
ClapperPlayer *player = clapper_app_window_get_player (self);
|
ClapperPlayer *player = clapper_app_window_get_player (self);
|
||||||
ClapperQueue *queue = clapper_player_get_queue (player);
|
ClapperQueue *queue = clapper_player_get_queue (player);
|
||||||
|
ClapperEnhancerProxyList *proxies = clapper_player_get_enhancer_proxies (player);
|
||||||
|
ClapperEnhancerProxy *proxy;
|
||||||
ClapperGtkExtraMenuButton *button;
|
ClapperGtkExtraMenuButton *button;
|
||||||
AdwStyleManager *manager;
|
AdwStyleManager *manager;
|
||||||
|
|
||||||
@@ -1250,10 +1252,6 @@ clapper_app_window_constructed (GObject *object)
|
|||||||
#if (CLAPPER_HAVE_MPRIS || CLAPPER_HAVE_SERVER || CLAPPER_HAVE_DISCOVERER)
|
#if (CLAPPER_HAVE_MPRIS || CLAPPER_HAVE_SERVER || CLAPPER_HAVE_DISCOVERER)
|
||||||
ClapperFeature *feature = NULL;
|
ClapperFeature *feature = NULL;
|
||||||
#endif
|
#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];
|
gchar mpris_name[45];
|
||||||
g_snprintf (mpris_name, sizeof (mpris_name),
|
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->settings = g_settings_new (CLAPPER_APP_ID);
|
||||||
self->last_volume = PERCENTAGE_ROUND (g_settings_get_double (self->settings, "volume"));
|
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"))) {
|
if ((proxy = clapper_enhancer_proxy_list_get_proxy_by_module (proxies, "clapper-mpris"))) {
|
||||||
clapper_enhancer_proxy_set_locally (proxy,
|
clapper_enhancer_proxy_set_locally (proxy,
|
||||||
"own-name", mpris_name,
|
"own-name", mpris_name,
|
||||||
@@ -1270,14 +1267,15 @@ clapper_app_window_constructed (GObject *object)
|
|||||||
"desktop-entry", CLAPPER_APP_ID,
|
"desktop-entry", CLAPPER_APP_ID,
|
||||||
"queue-controllable", TRUE, NULL);
|
"queue-controllable", TRUE, NULL);
|
||||||
gst_object_unref (proxy);
|
gst_object_unref (proxy);
|
||||||
}
|
} else {
|
||||||
#else
|
#if CLAPPER_HAVE_MPRIS
|
||||||
feature = CLAPPER_FEATURE (clapper_mpris_new (
|
feature = CLAPPER_FEATURE (clapper_mpris_new (
|
||||||
mpris_name, CLAPPER_APP_NAME, CLAPPER_APP_ID));
|
mpris_name, CLAPPER_APP_NAME, CLAPPER_APP_ID));
|
||||||
clapper_mpris_set_queue_controllable (CLAPPER_MPRIS (feature), TRUE);
|
clapper_mpris_set_queue_controllable (CLAPPER_MPRIS (feature), TRUE);
|
||||||
clapper_player_add_feature (player, feature);
|
clapper_player_add_feature (player, feature);
|
||||||
gst_object_unref (feature);
|
gst_object_unref (feature);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#if CLAPPER_HAVE_SERVER
|
#if CLAPPER_HAVE_SERVER
|
||||||
feature = CLAPPER_FEATURE (clapper_server_new ());
|
feature = CLAPPER_FEATURE (clapper_server_new ());
|
||||||
|
@@ -34,8 +34,6 @@ static HMODULE _enhancers_dll_handle = NULL;
|
|||||||
#include "clapper-extractable.h"
|
#include "clapper-extractable.h"
|
||||||
#include "clapper-reactable.h"
|
#include "clapper-reactable.h"
|
||||||
|
|
||||||
#include <clapper-functionalities-availability.h>
|
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT clapper_enhancers_loader_debug
|
#define GST_CAT_DEFAULT clapper_enhancers_loader_debug
|
||||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||||
|
|
||||||
@@ -134,36 +132,6 @@ clapper_enhancers_loader_initialize (ClapperEnhancerProxyList *proxies)
|
|||||||
ClapperEnhancerProxy *proxy;
|
ClapperEnhancerProxy *proxy;
|
||||||
gboolean filled;
|
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
|
/* Clapper supports only 1 proxy per plugin. Each plugin can
|
||||||
* ship 1 class, but it can implement more than 1 interface. */
|
* ship 1 class, but it can implement more than 1 interface. */
|
||||||
proxy = clapper_enhancer_proxy_new_global_take ((GObject *) info);
|
proxy = clapper_enhancer_proxy_new_global_take ((GObject *) info);
|
||||||
|
@@ -23,6 +23,8 @@
|
|||||||
*
|
*
|
||||||
* Not every OS supports `MPRIS`. Use [const@Clapper.HAVE_MPRIS] macro
|
* Not every OS supports `MPRIS`. Use [const@Clapper.HAVE_MPRIS] macro
|
||||||
* to check if Clapper API was compiled with this feature.
|
* to check if Clapper API was compiled with this feature.
|
||||||
|
*
|
||||||
|
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "clapper-mpris.h"
|
#include "clapper-mpris.h"
|
||||||
@@ -1346,6 +1348,8 @@ clapper_mpris_property_changed (ClapperFeature *feature, GParamSpec *pspec)
|
|||||||
* Creates a new #ClapperMpris instance.
|
* Creates a new #ClapperMpris instance.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): a new #ClapperMpris instance.
|
* Returns: (transfer full): a new #ClapperMpris instance.
|
||||||
|
*
|
||||||
|
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
|
||||||
*/
|
*/
|
||||||
ClapperMpris *
|
ClapperMpris *
|
||||||
clapper_mpris_new (const gchar *own_name, const gchar *identity,
|
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
|
* You probably want to keep this disabled if your application
|
||||||
* is supposed to manage what is played now and not MPRIS client.
|
* is supposed to manage what is played now and not MPRIS client.
|
||||||
|
*
|
||||||
|
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clapper_mpris_set_queue_controllable (ClapperMpris *self, gboolean controllable)
|
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].
|
* Get whether remote `MPRIS` clients can control [class@Clapper.Queue].
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if control over #ClapperQueue is allowed, %FALSE otherwise.
|
* Returns: %TRUE if control over #ClapperQueue is allowed, %FALSE otherwise.
|
||||||
|
*
|
||||||
|
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
clapper_mpris_get_queue_controllable (ClapperMpris *self)
|
clapper_mpris_get_queue_controllable (ClapperMpris *self)
|
||||||
@@ -1412,6 +1420,8 @@ clapper_mpris_get_queue_controllable (ClapperMpris *self)
|
|||||||
* @art_url: (nullable): an art URL
|
* @art_url: (nullable): an art URL
|
||||||
*
|
*
|
||||||
* Set fallback artwork to show when media does not provide one.
|
* Set fallback artwork to show when media does not provide one.
|
||||||
|
*
|
||||||
|
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clapper_mpris_set_fallback_art_url (ClapperMpris *self, const gchar *art_url)
|
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.
|
* Get fallback art URL earlier set by user.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full) (nullable): fallback art URL.
|
* Returns: (transfer full) (nullable): fallback art URL.
|
||||||
|
*
|
||||||
|
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
|
||||||
*/
|
*/
|
||||||
gchar *
|
gchar *
|
||||||
clapper_mpris_get_fallback_art_url (ClapperMpris *self)
|
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.
|
* Each #ClapperMpris instance running on the same system must have an unique name.
|
||||||
*
|
*
|
||||||
* Example: "org.mpris.MediaPlayer2.MyPlayer.instance123"
|
* 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",
|
param_specs[PROP_OWN_NAME] = g_param_spec_string ("own-name",
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
@@ -1622,6 +1636,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass)
|
|||||||
* A friendly name to identify the media player.
|
* A friendly name to identify the media player.
|
||||||
*
|
*
|
||||||
* Example: "My Player"
|
* Example: "My Player"
|
||||||
|
*
|
||||||
|
* Deprecated: 0.10: Use MPRIS from `clapper-enhancers` repo instead.
|
||||||
*/
|
*/
|
||||||
param_specs[PROP_IDENTITY] = g_param_spec_string ("identity",
|
param_specs[PROP_IDENTITY] = g_param_spec_string ("identity",
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
@@ -1631,6 +1647,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass)
|
|||||||
* ClapperMpris:desktop-entry:
|
* ClapperMpris:desktop-entry:
|
||||||
*
|
*
|
||||||
* The basename of an installed .desktop file with the ".desktop" extension stripped.
|
* 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",
|
param_specs[PROP_DESKTOP_ENTRY] = g_param_spec_string ("desktop-entry",
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
@@ -1640,6 +1658,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass)
|
|||||||
* ClapperMpris:queue-controllable:
|
* ClapperMpris:queue-controllable:
|
||||||
*
|
*
|
||||||
* Whether remote MPRIS clients can control #ClapperQueue.
|
* 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",
|
param_specs[PROP_QUEUE_CONTROLLABLE] = g_param_spec_boolean ("queue-controllable",
|
||||||
NULL, NULL, DEFAULT_QUEUE_CONTROLLABLE,
|
NULL, NULL, DEFAULT_QUEUE_CONTROLLABLE,
|
||||||
@@ -1649,6 +1669,8 @@ clapper_mpris_class_init (ClapperMprisClass *klass)
|
|||||||
* ClapperMpris:fallback-art-url:
|
* ClapperMpris:fallback-art-url:
|
||||||
*
|
*
|
||||||
* Fallback artwork to show when media does not provide one.
|
* 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",
|
param_specs[PROP_FALLBACK_ART_URL] = g_param_spec_string ("fallback-art-url",
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
|
@@ -34,22 +34,22 @@ G_BEGIN_DECLS
|
|||||||
#define CLAPPER_TYPE_MPRIS (clapper_mpris_get_type())
|
#define CLAPPER_TYPE_MPRIS (clapper_mpris_get_type())
|
||||||
#define CLAPPER_MPRIS_CAST(obj) ((ClapperMpris *)(obj))
|
#define CLAPPER_MPRIS_CAST(obj) ((ClapperMpris *)(obj))
|
||||||
|
|
||||||
CLAPPER_API
|
CLAPPER_DEPRECATED
|
||||||
G_DECLARE_FINAL_TYPE (ClapperMpris, clapper_mpris, CLAPPER, MPRIS, ClapperFeature)
|
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);
|
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);
|
void clapper_mpris_set_queue_controllable (ClapperMpris *mpris, gboolean controllable);
|
||||||
|
|
||||||
CLAPPER_API
|
CLAPPER_DEPRECATED
|
||||||
gboolean clapper_mpris_get_queue_controllable (ClapperMpris *mpris);
|
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);
|
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);
|
gchar * clapper_mpris_get_fallback_art_url (ClapperMpris *mpris);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
Reference in New Issue
Block a user