mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +02:00
clapper-app: Add support for MPRIS enhancer
This commit is contained in:
@@ -86,9 +86,7 @@ typedef struct
|
|||||||
gint64 last_tick;
|
gint64 last_tick;
|
||||||
} ClapperAppWindowResizeData;
|
} ClapperAppWindowResizeData;
|
||||||
|
|
||||||
#if CLAPPER_HAVE_MPRIS
|
|
||||||
static guint16 instance_count = 0;
|
static guint16 instance_count = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline GQuark
|
static inline GQuark
|
||||||
clapper_app_window_extra_options_get_quark (void)
|
clapper_app_window_extra_options_get_quark (void)
|
||||||
@@ -1252,16 +1250,28 @@ 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
|
#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),
|
||||||
"org.mpris.MediaPlayer2.Clapper.instance%" G_GUINT16_FORMAT, instance_count++);
|
"org.mpris.MediaPlayer2.Clapper.instance%" G_GUINT16_FORMAT, instance_count++);
|
||||||
#endif
|
|
||||||
|
|
||||||
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 !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,
|
||||||
|
"identity", CLAPPER_APP_NAME,
|
||||||
|
"desktop-entry", CLAPPER_APP_ID,
|
||||||
|
"queue-controllable", TRUE, NULL);
|
||||||
|
gst_object_unref (proxy);
|
||||||
|
}
|
||||||
|
#else
|
||||||
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);
|
||||||
|
Reference in New Issue
Block a user