aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2012-07-12 19:52:11 +0200
committerSebastien Bacher <seb128@ubuntu.com>2012-07-12 19:52:11 +0200
commit612866753e2b554abb0b448ae6a8c8ce1c2f4d87 (patch)
tree03ced96344802a4e338eb53d35d1c677f8354460 /src
parent31b5a5a6508535ed1af86919c79d75571f1a65ef (diff)
parent2900797204c4446a7f46515364c6aa868a5f4fab (diff)
downloadayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.tar.gz
ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.tar.bz2
ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.zip
Import upstream version 12.10.0
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in37
-rw-r--r--src/fetch-file.c2
-rw-r--r--src/freedesktop-interfaces.c2
-rw-r--r--src/metadata-menu-item.c61
-rw-r--r--src/mpris2-controller.c2
-rw-r--r--src/mpris2-interfaces.c2
-rw-r--r--src/mpris2-watcher.c3
-rw-r--r--src/music-player-bridge.c809
-rw-r--r--src/music-player-bridge.h9
-rw-r--r--src/music-player-bridge.vala47
-rw-r--r--src/player-controller.c139
-rw-r--r--src/player-controller.vala23
-rw-r--r--src/player-item.c2
-rw-r--r--src/playlists-menu-item.c24
-rw-r--r--src/settings-manager.c204
-rw-r--r--src/settings-manager.vala26
-rw-r--r--src/specific-items-manager.c20
-rw-r--r--src/transport-menu-item.c2
-rw-r--r--src/transport-widget.c5
-rw-r--r--src/volume-widget.c25
20 files changed, 944 insertions, 500 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index ca34bba..29fd250 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -33,6 +33,23 @@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -56,7 +73,10 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/Makefile.am.marshal
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/gcov.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/gcov.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
@@ -177,6 +197,11 @@ SOURCES = $(libsoundmenu_la_SOURCES) \
$(indicator_sound_service_SOURCES)
DIST_SOURCES = $(libsoundmenu_la_SOURCES) \
$(indicator_sound_service_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -524,7 +549,6 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
install-soundmenulibLTLIBRARIES: $(soundmenulib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(soundmenulibdir)" || $(MKDIR_P) "$(DESTDIR)$(soundmenulibdir)"
@list='$(soundmenulib_LTLIBRARIES)'; test -n "$(soundmenulibdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -532,6 +556,8 @@ install-soundmenulibLTLIBRARIES: $(soundmenulib_LTLIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(soundmenulibdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(soundmenulibdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(soundmenulibdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(soundmenulibdir)"; \
}
@@ -557,8 +583,11 @@ libsoundmenu.la: $(libsoundmenu_la_OBJECTS) $(libsoundmenu_la_DEPENDENCIES) $(EX
$(AM_V_CCLD)$(libsoundmenu_la_LINK) -rpath $(soundmenulibdir) $(libsoundmenu_la_OBJECTS) $(libsoundmenu_la_LIBADD) $(LIBS)
install-libexecPROGRAMS: $(libexec_PROGRAMS)
@$(NORMAL_INSTALL)
- test -z "$(libexecdir)" || $(MKDIR_P) "$(DESTDIR)$(libexecdir)"
@list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \
+ fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p || test -f $$p1; \
diff --git a/src/fetch-file.c b/src/fetch-file.c
index 7c49d4b..8cb4d09 100644
--- a/src/fetch-file.c
+++ b/src/fetch-file.c
@@ -1,4 +1,4 @@
-/* fetch-file.c generated by valac 0.14.2, the Vala compiler
+/* fetch-file.c generated by valac 0.16.1, the Vala compiler
* generated from fetch-file.vala, do not modify */
/*
diff --git a/src/freedesktop-interfaces.c b/src/freedesktop-interfaces.c
index e68fd67..a37eabf 100644
--- a/src/freedesktop-interfaces.c
+++ b/src/freedesktop-interfaces.c
@@ -1,4 +1,4 @@
-/* freedesktop-interfaces.c generated by valac 0.14.2, the Vala compiler
+/* freedesktop-interfaces.c generated by valac 0.16.1, the Vala compiler
* generated from freedesktop-interfaces.vala, do not modify */
/*
diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c
index 1b75751..378188c 100644
--- a/src/metadata-menu-item.c
+++ b/src/metadata-menu-item.c
@@ -1,4 +1,4 @@
-/* metadata-menu-item.c generated by valac 0.14.2, the Vala compiler
+/* metadata-menu-item.c generated by valac 0.16.1, the Vala compiler
* generated from metadata-menu-item.vala, do not modify */
/*
@@ -33,8 +33,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string.h>
#include <common-defs.h>
#include <gio/gio.h>
-#include <gdk-pixbuf/gdk-pixdata.h>
#include <glib/gstdio.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gee.h>
@@ -165,9 +165,9 @@ void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, cons
#define PLAYER_ITEM_EMPTY (-1)
FetchFile* fetch_file_new (const gchar* uri, const gchar* prop);
FetchFile* fetch_file_construct (GType object_type, const gchar* uri, const gchar* prop);
-static void __lambda0_ (MetadataMenuitem* self);
+static void __lambda2_ (MetadataMenuitem* self);
static void metadata_menuitem_on_fetcher_failed (MetadataMenuitem* self);
-static void ___lambda0__fetch_file_failed (FetchFile* _sender, gpointer self);
+static void ___lambda2__fetch_file_failed (FetchFile* _sender, gpointer self);
static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByteArray* update, const gchar* property);
static void _metadata_menuitem_on_fetcher_completed_fetch_file_completed (FetchFile* _sender, GByteArray* data, const gchar* property, gpointer self);
void fetch_file_fetch_data (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
@@ -416,13 +416,13 @@ static gchar* string_strip (const gchar* self) {
}
-static void __lambda0_ (MetadataMenuitem* self) {
+static void __lambda2_ (MetadataMenuitem* self) {
metadata_menuitem_on_fetcher_failed (self);
}
-static void ___lambda0__fetch_file_failed (FetchFile* _sender, gpointer self) {
- __lambda0_ (self);
+static void ___lambda2__fetch_file_failed (FetchFile* _sender, gpointer self) {
+ __lambda2_ (self);
}
@@ -543,7 +543,7 @@ void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, cons
_g_object_unref0 (metadata_menuitem_fetcher);
metadata_menuitem_fetcher = _tmp23_;
_tmp24_ = metadata_menuitem_fetcher;
- g_signal_connect_object (_tmp24_, "failed", (GCallback) ___lambda0__fetch_file_failed, self, 0);
+ g_signal_connect_object (_tmp24_, "failed", (GCallback) ___lambda2__fetch_file_failed, self, 0);
_tmp25_ = metadata_menuitem_fetcher;
g_signal_connect_object (_tmp25_, "completed", (GCallback) _metadata_menuitem_on_fetcher_completed_fetch_file_completed, self, 0);
_tmp26_ = metadata_menuitem_fetcher;
@@ -621,37 +621,40 @@ static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByt
const gchar* _tmp14_;
GdkPixbufLoader* _tmp15_;
GdkPixbufFormat* _tmp16_ = NULL;
- const gchar* _tmp17_ = NULL;
- const gchar* _tmp18_;
+ gchar* _tmp17_ = NULL;
+ gchar* _tmp18_;
const gchar* _tmp19_;
const gchar* _tmp20_;
- const gchar* _tmp22_;
- gchar* _tmp23_;
+ const gchar* _tmp21_;
+ const gchar* _tmp23_;
+ gchar* _tmp24_;
_tmp13_ = icon;
_tmp14_ = path;
_tmp15_ = loader;
_tmp16_ = gdk_pixbuf_loader_get_format (_tmp15_);
_tmp17_ = gdk_pixbuf_format_get_name (_tmp16_);
- gdk_pixbuf_save (_tmp13_, _tmp14_, _tmp17_, &_inner_error_, NULL);
+ _tmp18_ = _tmp17_;
+ gdk_pixbuf_save (_tmp13_, _tmp14_, _tmp18_, &_inner_error_, NULL);
+ _g_free0 (_tmp18_);
if (_inner_error_ != NULL) {
_g_free0 (path);
_g_object_unref0 (icon);
_g_object_unref0 (loader);
goto __catch6_g_error;
}
- _tmp18_ = property;
- _tmp19_ = path;
- dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, _tmp18_, _tmp19_);
- _tmp20_ = self->priv->previous_temp_album_art_path;
- if (_tmp20_ != NULL) {
- const gchar* _tmp21_;
- _tmp21_ = self->priv->previous_temp_album_art_path;
- g_remove (_tmp21_);
+ _tmp19_ = property;
+ _tmp20_ = path;
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, _tmp19_, _tmp20_);
+ _tmp21_ = self->priv->previous_temp_album_art_path;
+ if (_tmp21_ != NULL) {
+ const gchar* _tmp22_;
+ _tmp22_ = self->priv->previous_temp_album_art_path;
+ g_remove (_tmp22_);
}
- _tmp22_ = path;
- _tmp23_ = g_strdup (_tmp22_);
+ _tmp23_ = path;
+ _tmp24_ = g_strdup (_tmp23_);
_g_free0 (self->priv->previous_temp_album_art_path);
- self->priv->previous_temp_album_art_path = _tmp23_;
+ self->priv->previous_temp_album_art_path = _tmp24_;
}
_g_free0 (path);
_g_object_unref0 (icon);
@@ -661,14 +664,14 @@ static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByt
__catch6_g_error:
{
GError* e = NULL;
- GError* _tmp24_;
- const gchar* _tmp25_;
+ GError* _tmp25_;
+ const gchar* _tmp26_;
e = _inner_error_;
_inner_error_ = NULL;
- _tmp24_ = e;
- _tmp25_ = _tmp24_->message;
+ _tmp25_ = e;
+ _tmp26_ = _tmp25_->message;
g_warning ("metadata-menu-item.vala:163: Problem creating file from bytearray fetc" \
-"hed from the interweb - error: %s", _tmp25_);
+"hed from the interweb - error: %s", _tmp26_);
_g_error_free0 (e);
}
__finally6:
diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c
index a471d07..60344df 100644
--- a/src/mpris2-controller.c
+++ b/src/mpris2-controller.c
@@ -1,4 +1,4 @@
-/* mpris2-controller.c generated by valac 0.14.2, the Vala compiler
+/* mpris2-controller.c generated by valac 0.16.1, the Vala compiler
* generated from mpris2-controller.vala, do not modify */
/*
diff --git a/src/mpris2-interfaces.c b/src/mpris2-interfaces.c
index d625955..b4f4ea2 100644
--- a/src/mpris2-interfaces.c
+++ b/src/mpris2-interfaces.c
@@ -1,4 +1,4 @@
-/* mpris2-interfaces.c generated by valac 0.14.2, the Vala compiler
+/* mpris2-interfaces.c generated by valac 0.16.1, the Vala compiler
* generated from mpris2-interfaces.vala, do not modify */
/*
diff --git a/src/mpris2-watcher.c b/src/mpris2-watcher.c
index 7379c72..50be453 100644
--- a/src/mpris2-watcher.c
+++ b/src/mpris2-watcher.c
@@ -1,4 +1,4 @@
-/* mpris2-watcher.c generated by valac 0.14.2, the Vala compiler
+/* mpris2-watcher.c generated by valac 0.16.1, the Vala compiler
* generated from mpris2-watcher.vala, do not modify */
/*
@@ -327,7 +327,6 @@ static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckFo
_data_->_address_collection_size_ = 0;
_data_->address_collection = _data_->_tmp6_;
_data_->address_collection_length1 = _data_->_tmp6__length1;
- _data_->address_it = 0;
for (_data_->address_it = 0; _data_->address_it < _data_->_tmp6__length1; _data_->address_it = _data_->address_it + 1) {
_data_->_tmp7_ = g_strdup (_data_->address_collection[_data_->address_it]);
_data_->address = _data_->_tmp7_;
diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c
index f04450b..a96d27c 100644
--- a/src/music-player-bridge.c
+++ b/src/music-player-bridge.c
@@ -1,4 +1,4 @@
-/* music-player-bridge.c generated by valac 0.14.2, the Vala compiler
+/* music-player-bridge.c generated by valac 0.16.1, the Vala compiler
* generated from music-player-bridge.vala, do not modify */
/*
@@ -169,20 +169,23 @@ static gchar* music_player_bridge_determine_key (gchar* desktop_or_interface);
void player_controller_remove_from_menu (PlayerController* self);
void mpris2_watcher_check_for_active_clients (Mpris2Watcher* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void mpris2_watcher_check_for_active_clients_finish (Mpris2Watcher* self, GAsyncResult* _res_);
+static void music_player_bridge_on_preferred_update (MusicPlayerBridge* self, GeeArrayList* preferred);
+void player_controller_set_as_preferred (PlayerController* self, gboolean val);
static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self);
+GeeArrayList* settings_manager_fetch_preferred (SettingsManager* self);
GeeArrayList* settings_manager_fetch_interested (SettingsManager* self);
static GAppInfo* music_player_bridge_create_app_info (const gchar* desktop);
static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop);
static gint music_player_bridge_calculate_menu_position (MusicPlayerBridge* self);
GType player_controller_state_get_type (void) G_GNUC_CONST;
-PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state);
-PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state);
+PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state, gboolean is_preferred);
+PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state, gboolean is_preferred);
static void music_player_bridge_establish_file_monitoring (MusicPlayerBridge* self, GAppInfo* info, const gchar* mpris_key);
static Block1Data* block1_data_ref (Block1Data* _data1_);
-static void block1_data_unref (Block1Data* _data1_);
-static void ___lambda2_ (Block1Data* _data1_, GFile* desktop_file, GFile* other_file, GFileMonitorEvent event_type);
+static void block1_data_unref (void * _userdata_);
+static void ___lambda4_ (Block1Data* _data1_, GFile* desktop_file, GFile* other_file, GFileMonitorEvent event_type);
static void music_player_bridge_relevant_desktop_file_changed (MusicPlayerBridge* self, GFile* desktop_file, GFile* other_file, GFileMonitorEvent event_type, GFileMonitor* monitor);
-static void ____lambda2__g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self);
+static void ____lambda4__g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self);
void settings_manager_remove_interested (SettingsManager* self, const gchar* app_desktop_name);
#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4
void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name, gboolean use_playlists);
@@ -209,6 +212,7 @@ static GObject * music_player_bridge_constructor (GType type, guint n_construct_
SettingsManager* settings_manager_new (void);
SettingsManager* settings_manager_construct (GType object_type);
static void _music_player_bridge_on_blacklist_update_settings_manager_blacklist_updates (SettingsManager* _sender, gchar** new_blacklist, int new_blacklist_length1, gpointer self);
+static void _music_player_bridge_on_preferred_update_settings_manager_preferred_updates (SettingsManager* _sender, GeeArrayList* new_preferred, gpointer self);
static void music_player_bridge_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
@@ -232,7 +236,7 @@ static void music_player_bridge_on_blacklist_update (MusicPlayerBridge* self, gc
gint _tmp0__length1;
Mpris2Watcher* _tmp15_;
g_return_if_fail (self != NULL);
- g_debug ("music-player-bridge.vala:47: some blacklist update");
+ g_debug ("music-player-bridge.vala:48: some blacklist update");
_tmp0_ = blacklist;
_tmp0__length1 = blacklist_length1;
{
@@ -271,7 +275,7 @@ static void music_player_bridge_on_blacklist_update (MusicPlayerBridge* self, gc
GeeHashMap* _tmp13_;
const gchar* _tmp14_;
_tmp8_ = key;
- g_debug ("music-player-bridge.vala:52: Apparently %s is now blacklisted - remove" \
+ g_debug ("music-player-bridge.vala:53: Apparently %s is now blacklisted - remove" \
" thy self", _tmp8_);
_tmp9_ = self->priv->registered_clients;
_tmp10_ = key;
@@ -293,122 +297,254 @@ static void music_player_bridge_on_blacklist_update (MusicPlayerBridge* self, gc
}
+static gpointer _g_object_ref0 (gpointer self) {
+ return self ? g_object_ref (self) : NULL;
+}
+
+
+static void music_player_bridge_on_preferred_update (MusicPlayerBridge* self, GeeArrayList* preferred) {
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (preferred != NULL);
+ g_debug ("music-player-bridge.vala:64: Preferred players update. Clearing curren" \
+"t preferred players...");
+ {
+ GeeHashMap* _tmp0_;
+ GeeCollection* _tmp1_;
+ GeeCollection* _tmp2_;
+ GeeCollection* _tmp3_;
+ GeeIterator* _tmp4_ = NULL;
+ GeeIterator* _tmp5_;
+ GeeIterator* _player_controller_it;
+ _tmp0_ = self->priv->registered_clients;
+ _tmp1_ = gee_abstract_map_get_values ((GeeMap*) _tmp0_);
+ _tmp2_ = _tmp1_;
+ _tmp3_ = _tmp2_;
+ _tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
+ _tmp5_ = _tmp4_;
+ _g_object_unref0 (_tmp3_);
+ _player_controller_it = _tmp5_;
+ while (TRUE) {
+ GeeIterator* _tmp6_;
+ gboolean _tmp7_ = FALSE;
+ GeeIterator* _tmp8_;
+ gpointer _tmp9_ = NULL;
+ PlayerController* player_controller;
+ PlayerController* _tmp10_;
+ _tmp6_ = _player_controller_it;
+ _tmp7_ = gee_iterator_next (_tmp6_);
+ if (!_tmp7_) {
+ break;
+ }
+ _tmp8_ = _player_controller_it;
+ _tmp9_ = gee_iterator_get (_tmp8_);
+ player_controller = (PlayerController*) _tmp9_;
+ _tmp10_ = player_controller;
+ player_controller_set_as_preferred (_tmp10_, FALSE);
+ _g_object_unref0 (player_controller);
+ }
+ _g_object_unref0 (_player_controller_it);
+ }
+ {
+ GeeArrayList* _tmp11_;
+ GeeArrayList* _tmp12_;
+ GeeArrayList* _s_list;
+ GeeArrayList* _tmp13_;
+ gint _tmp14_;
+ gint _tmp15_;
+ gint _s_size;
+ gint _s_index;
+ _tmp11_ = preferred;
+ _tmp12_ = _g_object_ref0 (_tmp11_);
+ _s_list = _tmp12_;
+ _tmp13_ = _s_list;
+ _tmp14_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp13_);
+ _tmp15_ = _tmp14_;
+ _s_size = _tmp15_;
+ _s_index = -1;
+ while (TRUE) {
+ gint _tmp16_;
+ gint _tmp17_;
+ gint _tmp18_;
+ GeeArrayList* _tmp19_;
+ gint _tmp20_;
+ gpointer _tmp21_ = NULL;
+ gchar* s;
+ const gchar* _tmp22_;
+ gchar* _tmp23_;
+ gchar* _tmp24_ = NULL;
+ gchar* key;
+ GeeHashMap* _tmp25_;
+ const gchar* _tmp26_;
+ gboolean _tmp27_ = FALSE;
+ _tmp16_ = _s_index;
+ _s_index = _tmp16_ + 1;
+ _tmp17_ = _s_index;
+ _tmp18_ = _s_size;
+ if (!(_tmp17_ < _tmp18_)) {
+ break;
+ }
+ _tmp19_ = _s_list;
+ _tmp20_ = _s_index;
+ _tmp21_ = gee_abstract_list_get ((GeeAbstractList*) _tmp19_, _tmp20_);
+ s = (gchar*) _tmp21_;
+ _tmp22_ = s;
+ _tmp23_ = g_strdup (_tmp22_);
+ _tmp24_ = music_player_bridge_determine_key (_tmp23_);
+ key = _tmp24_;
+ _tmp25_ = self->priv->registered_clients;
+ _tmp26_ = key;
+ _tmp27_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp25_, _tmp26_);
+ if (_tmp27_) {
+ const gchar* _tmp28_;
+ GeeHashMap* _tmp29_;
+ const gchar* _tmp30_;
+ gpointer _tmp31_ = NULL;
+ PlayerController* _tmp32_;
+ _tmp28_ = key;
+ g_debug ("music-player-bridge.vala:73: Setting %s as preferred player", _tmp28_);
+ _tmp29_ = self->priv->registered_clients;
+ _tmp30_ = key;
+ _tmp31_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp29_, _tmp30_);
+ _tmp32_ = (PlayerController*) _tmp31_;
+ player_controller_set_as_preferred (_tmp32_, TRUE);
+ _g_object_unref0 (_tmp32_);
+ }
+ _g_free0 (key);
+ _g_free0 (s);
+ }
+ _g_object_unref0 (_s_list);
+ }
+}
+
+
static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self) {
+ SettingsManager* _tmp0_;
+ GeeArrayList* _tmp1_ = NULL;
+ GeeArrayList* preferred_players;
g_return_if_fail (self != NULL);
+ _tmp0_ = self->priv->settings_manager;
+ _tmp1_ = settings_manager_fetch_preferred (_tmp0_);
+ preferred_players = _tmp1_;
{
- SettingsManager* _tmp0_;
- GeeArrayList* _tmp1_ = NULL;
+ SettingsManager* _tmp2_;
+ GeeArrayList* _tmp3_ = NULL;
GeeArrayList* _desktop_list;
- GeeArrayList* _tmp2_;
- gint _tmp3_;
- gint _tmp4_;
+ GeeArrayList* _tmp4_;
+ gint _tmp5_;
+ gint _tmp6_;
gint _desktop_size;
gint _desktop_index;
- _tmp0_ = self->priv->settings_manager;
- _tmp1_ = settings_manager_fetch_interested (_tmp0_);
- _desktop_list = _tmp1_;
- _tmp2_ = _desktop_list;
- _tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp2_);
- _tmp4_ = _tmp3_;
- _desktop_size = _tmp4_;
+ _tmp2_ = self->priv->settings_manager;
+ _tmp3_ = settings_manager_fetch_interested (_tmp2_);
+ _desktop_list = _tmp3_;
+ _tmp4_ = _desktop_list;
+ _tmp5_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp4_);
+ _tmp6_ = _tmp5_;
+ _desktop_size = _tmp6_;
_desktop_index = -1;
while (TRUE) {
- gint _tmp5_;
- gint _tmp6_;
gint _tmp7_;
- GeeArrayList* _tmp8_;
+ gint _tmp8_;
gint _tmp9_;
- gpointer _tmp10_ = NULL;
+ GeeArrayList* _tmp10_;
+ gint _tmp11_;
+ gpointer _tmp12_ = NULL;
gchar* desktop;
- const gchar* _tmp11_;
- const gchar* _tmp12_;
- gchar* _tmp13_ = NULL;
- gchar* _tmp14_;
- GAppInfo* _tmp15_ = NULL;
- GAppInfo* _tmp16_;
+ const gchar* _tmp13_;
+ const gchar* _tmp14_;
+ gchar* _tmp15_ = NULL;
+ gchar* _tmp16_;
+ GAppInfo* _tmp17_ = NULL;
+ GAppInfo* _tmp18_;
GAppInfo* app_info;
- GAppInfo* _tmp17_;
- const gchar* _tmp19_;
- gchar* _tmp20_;
- gchar* _tmp21_ = NULL;
- gchar* mpris_key;
- DbusmenuMenuitem* _tmp22_;
- GAppInfo* _tmp23_;
- const gchar* _tmp24_;
- gchar* _tmp25_ = NULL;
- gchar* _tmp26_;
- gint _tmp27_ = 0;
- PlayerController* _tmp28_;
- PlayerController* _tmp29_;
- PlayerController* ctrl;
- GeeHashMap* _tmp30_;
- const gchar* _tmp31_;
+ GAppInfo* _tmp19_;
+ GeeArrayList* _tmp21_;
+ const gchar* _tmp22_;
+ gboolean _tmp23_ = FALSE;
+ gboolean is_preferred;
+ DbusmenuMenuitem* _tmp24_;
+ GAppInfo* _tmp25_;
+ const gchar* _tmp26_;
+ gchar* _tmp27_ = NULL;
+ gchar* _tmp28_;
+ gint _tmp29_ = 0;
+ gboolean _tmp30_;
+ PlayerController* _tmp31_;
PlayerController* _tmp32_;
- GAppInfo* _tmp33_;
- const gchar* _tmp34_;
- _tmp5_ = _desktop_index;
- _desktop_index = _tmp5_ + 1;
- _tmp6_ = _desktop_index;
- _tmp7_ = _desktop_size;
- if (!(_tmp6_ < _tmp7_)) {
+ PlayerController* ctrl;
+ const gchar* _tmp33_;
+ gchar* _tmp34_;
+ gchar* _tmp35_ = NULL;
+ gchar* mpris_key;
+ GeeHashMap* _tmp36_;
+ const gchar* _tmp37_;
+ PlayerController* _tmp38_;
+ GAppInfo* _tmp39_;
+ const gchar* _tmp40_;
+ _tmp7_ = _desktop_index;
+ _desktop_index = _tmp7_ + 1;
+ _tmp8_ = _desktop_index;
+ _tmp9_ = _desktop_size;
+ if (!(_tmp8_ < _tmp9_)) {
break;
}
- _tmp8_ = _desktop_list;
- _tmp9_ = _desktop_index;
- _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_);
- desktop = (gchar*) _tmp10_;
- _tmp11_ = desktop;
- g_debug ("music-player-bridge.vala:64: interested client found : %s", _tmp11_);
- _tmp12_ = desktop;
- _tmp13_ = g_strconcat (_tmp12_, ".desktop", NULL);
- _tmp14_ = _tmp13_;
- _tmp15_ = music_player_bridge_create_app_info (_tmp14_);
+ _tmp10_ = _desktop_list;
+ _tmp11_ = _desktop_index;
+ _tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _tmp10_, _tmp11_);
+ desktop = (gchar*) _tmp12_;
+ _tmp13_ = desktop;
+ g_debug ("music-player-bridge.vala:83: interested client found : %s", _tmp13_);
+ _tmp14_ = desktop;
+ _tmp15_ = g_strconcat (_tmp14_, ".desktop", NULL);
_tmp16_ = _tmp15_;
- _g_free0 (_tmp14_);
- app_info = _tmp16_;
- _tmp17_ = app_info;
- if (_tmp17_ == NULL) {
- const gchar* _tmp18_;
- _tmp18_ = desktop;
- g_warning ("music-player-bridge.vala:67: Could not create app_info for path %s \n" \
-" Getting out of here ", _tmp18_);
+ _tmp17_ = music_player_bridge_create_app_info (_tmp16_);
+ _tmp18_ = _tmp17_;
+ _g_free0 (_tmp16_);
+ app_info = _tmp18_;
+ _tmp19_ = app_info;
+ if (_tmp19_ == NULL) {
+ const gchar* _tmp20_;
+ _tmp20_ = desktop;
+ g_warning ("music-player-bridge.vala:86: Could not create app_info for path %s \n" \
+" Getting out of here ", _tmp20_);
_g_object_unref0 (app_info);
_g_free0 (desktop);
continue;
}
- _tmp19_ = desktop;
- _tmp20_ = g_strdup (_tmp19_);
- _tmp21_ = music_player_bridge_determine_key (_tmp20_);
- mpris_key = _tmp21_;
- _tmp22_ = self->priv->root_menu;
- _tmp23_ = app_info;
- _tmp24_ = desktop;
- _tmp25_ = music_player_bridge_fetch_icon_name (_tmp24_);
- _tmp26_ = _tmp25_;
- _tmp27_ = music_player_bridge_calculate_menu_position (self);
- _tmp28_ = player_controller_new (_tmp22_, _tmp23_, NULL, _tmp26_, _tmp27_, NULL, PLAYER_CONTROLLER_STATE_OFFLINE);
- _tmp29_ = _tmp28_;
- _g_free0 (_tmp26_);
- ctrl = _tmp29_;
- _tmp30_ = self->priv->registered_clients;
- _tmp31_ = mpris_key;
- _tmp32_ = ctrl;
- gee_abstract_map_set ((GeeAbstractMap*) _tmp30_, _tmp31_, _tmp32_);
- _tmp33_ = app_info;
- _tmp34_ = mpris_key;
- music_player_bridge_establish_file_monitoring (self, _tmp33_, _tmp34_);
- _g_object_unref0 (ctrl);
+ _tmp21_ = preferred_players;
+ _tmp22_ = desktop;
+ _tmp23_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp21_, _tmp22_);
+ is_preferred = _tmp23_;
+ _tmp24_ = self->priv->root_menu;
+ _tmp25_ = app_info;
+ _tmp26_ = desktop;
+ _tmp27_ = music_player_bridge_fetch_icon_name (_tmp26_);
+ _tmp28_ = _tmp27_;
+ _tmp29_ = music_player_bridge_calculate_menu_position (self);
+ _tmp30_ = is_preferred;
+ _tmp31_ = player_controller_new (_tmp24_, _tmp25_, NULL, _tmp28_, _tmp29_, NULL, PLAYER_CONTROLLER_STATE_OFFLINE, _tmp30_);
+ _tmp32_ = _tmp31_;
+ _g_free0 (_tmp28_);
+ ctrl = _tmp32_;
+ _tmp33_ = desktop;
+ _tmp34_ = g_strdup (_tmp33_);
+ _tmp35_ = music_player_bridge_determine_key (_tmp34_);
+ mpris_key = _tmp35_;
+ _tmp36_ = self->priv->registered_clients;
+ _tmp37_ = mpris_key;
+ _tmp38_ = ctrl;
+ gee_abstract_map_set ((GeeAbstractMap*) _tmp36_, _tmp37_, _tmp38_);
+ _tmp39_ = app_info;
+ _tmp40_ = mpris_key;
+ music_player_bridge_establish_file_monitoring (self, _tmp39_, _tmp40_);
_g_free0 (mpris_key);
+ _g_object_unref0 (ctrl);
_g_object_unref0 (app_info);
_g_free0 (desktop);
}
_g_object_unref0 (_desktop_list);
}
-}
-
-
-static gpointer _g_object_ref0 (gpointer self) {
- return self ? g_object_ref (self) : NULL;
+ _g_object_unref0 (preferred_players);
}
@@ -418,15 +554,19 @@ static Block1Data* block1_data_ref (Block1Data* _data1_) {
}
-static void block1_data_unref (Block1Data* _data1_) {
+static void block1_data_unref (void * _userdata_) {
+ Block1Data* _data1_;
+ _data1_ = (Block1Data*) _userdata_;
if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
- _g_object_unref0 (_data1_->self);
+ MusicPlayerBridge * self;
+ self = _data1_->self;
+ _g_object_unref0 (self);
g_slice_free (Block1Data, _data1_);
}
}
-static void ___lambda2_ (Block1Data* _data1_, GFile* desktop_file, GFile* other_file, GFileMonitorEvent event_type) {
+static void ___lambda4_ (Block1Data* _data1_, GFile* desktop_file, GFile* other_file, GFileMonitorEvent event_type) {
MusicPlayerBridge * self;
GFile* _tmp0_;
GFile* _tmp1_;
@@ -442,8 +582,8 @@ static void ___lambda2_ (Block1Data* _data1_, GFile* desktop_file, GFile* other_
}
-static void ____lambda2__g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self) {
- ___lambda2_ (self, file, other_file, event_type);
+static void ____lambda4__g_file_monitor_changed (GFileMonitor* _sender, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer self) {
+ ___lambda4_ (self, file, other_file, event_type);
}
@@ -476,39 +616,37 @@ static void music_player_bridge_establish_file_monitoring (MusicPlayerBridge* se
Block1Data* _data1_;
GFile* _tmp7_;
GFileMonitor* _tmp8_ = NULL;
- GFileMonitor* _tmp9_;
GFileMonitor* monitor;
+ GFileMonitor* _tmp9_;
GFileMonitor* _tmp10_;
GFileMonitor* _tmp11_;
- GFileMonitor* _tmp12_;
- const gchar* _tmp13_;
- GeeHashMap* _tmp14_;
+ const gchar* _tmp12_;
+ GeeHashMap* _tmp13_;
+ const gchar* _tmp14_;
const gchar* _tmp15_;
- const gchar* _tmp16_;
_data1_ = g_slice_new0 (Block1Data);
_data1_->_ref_count_ = 1;
_data1_->self = g_object_ref (self);
_tmp7_ = f;
_tmp8_ = g_file_monitor (_tmp7_, G_FILE_MONITOR_SEND_MOVED, NULL, &_inner_error_);
- _tmp9_ = _g_object_ref0 (_tmp8_);
- monitor = _tmp9_;
+ monitor = _tmp8_;
if (_inner_error_ != NULL) {
block1_data_unref (_data1_);
_data1_ = NULL;
goto __catch0_g_error;
}
+ _tmp9_ = monitor;
+ _data1_->weak_monitor = _tmp9_;
_tmp10_ = monitor;
- _data1_->weak_monitor = _tmp10_;
+ g_signal_connect_data (_tmp10_, "changed", (GCallback) ____lambda4__g_file_monitor_changed, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
_tmp11_ = monitor;
- g_signal_connect_data (_tmp11_, "changed", (GCallback) ____lambda2__g_file_monitor_changed, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
- _tmp12_ = monitor;
- g_object_ref ((GObject*) _tmp12_);
- _tmp13_ = file_path;
- g_debug ("music-player-bridge.vala:95: monitoring file '%s'", _tmp13_);
- _tmp14_ = self->priv->file_monitors;
- _tmp15_ = file_path;
- _tmp16_ = mpris_key;
- gee_abstract_map_set ((GeeAbstractMap*) _tmp14_, _tmp15_, _tmp16_);
+ g_object_ref ((GObject*) _tmp11_);
+ _tmp12_ = file_path;
+ g_debug ("music-player-bridge.vala:116: monitoring file '%s'", _tmp12_);
+ _tmp13_ = self->priv->file_monitors;
+ _tmp14_ = file_path;
+ _tmp15_ = mpris_key;
+ gee_abstract_map_set ((GeeAbstractMap*) _tmp13_, _tmp14_, _tmp15_);
_g_object_unref0 (monitor);
block1_data_unref (_data1_);
_data1_ = NULL;
@@ -517,13 +655,13 @@ static void music_player_bridge_establish_file_monitoring (MusicPlayerBridge* se
__catch0_g_error:
{
GError* e = NULL;
- GAppInfo* _tmp17_;
- const gchar* _tmp18_ = NULL;
+ GAppInfo* _tmp16_;
+ const gchar* _tmp17_ = NULL;
e = _inner_error_;
_inner_error_ = NULL;
- _tmp17_ = info;
- _tmp18_ = g_app_info_get_name (_tmp17_);
- g_warning ("music-player-bridge.vala:99: Unable to create a file monitor for %s", _tmp18_);
+ _tmp16_ = info;
+ _tmp17_ = g_app_info_get_name (_tmp16_);
+ g_warning ("music-player-bridge.vala:120: Unable to create a file monitor for %s", _tmp17_);
_g_error_free0 (e);
_g_object_unref0 (f);
_g_free0 (file_path);
@@ -582,7 +720,7 @@ static void music_player_bridge_relevant_desktop_file_changed (MusicPlayerBridge
path = _tmp2_;
_tmp3_ = path;
if (_tmp3_ == NULL) {
- g_warning ("music-player-bridge.vala:114: relevant_desktop_file_changed is returni" \
+ g_warning ("music-player-bridge.vala:135: relevant_desktop_file_changed is returni" \
"ng a file with no path !");
_g_free0 (path);
return;
@@ -593,7 +731,7 @@ static void music_player_bridge_relevant_desktop_file_changed (MusicPlayerBridge
if (!_tmp6_) {
const gchar* _tmp7_;
_tmp7_ = path;
- g_warning ("music-player-bridge.vala:118: relevant_desktop_file_changed is returni" \
+ g_warning ("music-player-bridge.vala:139: relevant_desktop_file_changed is returni" \
"ng a file which we know nothing about - %s", _tmp7_);
_g_free0 (path);
return;
@@ -604,7 +742,7 @@ static void music_player_bridge_relevant_desktop_file_changed (MusicPlayerBridge
mpris_key = (gchar*) _tmp10_;
_tmp11_ = path;
_tmp12_ = mpris_key;
- g_debug ("music-player-bridge.vala:124: file \"%s\" was removed; stopping monito" \
+ g_debug ("music-player-bridge.vala:145: file \"%s\" was removed; stopping monito" \
"ring \"%s\"", _tmp11_, _tmp12_);
_tmp13_ = self->priv->registered_clients;
_tmp14_ = mpris_key;
@@ -715,9 +853,16 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c
gchar* _tmp21_;
gchar* _tmp22_ = NULL;
gchar* mpris_key;
- GeeHashMap* _tmp23_;
- const gchar* _tmp24_;
- gboolean _tmp25_ = FALSE;
+ SettingsManager* _tmp23_;
+ GeeArrayList* _tmp24_ = NULL;
+ GeeArrayList* _tmp25_;
+ const gchar* _tmp26_;
+ gboolean _tmp27_ = FALSE;
+ gboolean _tmp28_;
+ gboolean is_preferred;
+ GeeHashMap* _tmp29_;
+ const gchar* _tmp30_;
+ gboolean _tmp31_ = FALSE;
g_return_if_fail (self != NULL);
g_return_if_fail (desktop != NULL);
g_return_if_fail (dbus_name != NULL);
@@ -733,7 +878,7 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c
if (_tmp3_) {
const gchar* _tmp4_;
_tmp4_ = dbus_name;
- g_warning ("music-player-bridge.vala:147: Client %s attempting to register without" \
+ g_warning ("music-player-bridge.vala:168: Client %s attempting to register without" \
" desktop entry being set on the mpris root", _tmp4_);
return;
}
@@ -747,12 +892,12 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c
if (_tmp10_) {
const gchar* _tmp11_;
_tmp11_ = desktop;
- g_debug ("music-player-bridge.vala:152: Client %s attempting to register but I'm" \
+ g_debug ("music-player-bridge.vala:173: Client %s attempting to register but I'm" \
" afraid it is blacklisted", _tmp11_);
return;
}
_tmp12_ = desktop;
- g_debug ("music-player-bridge.vala:157: client_has_become_available %s", _tmp12_);
+ g_debug ("music-player-bridge.vala:178: client_has_become_available %s", _tmp12_);
_tmp13_ = desktop;
_tmp14_ = g_strconcat (_tmp13_, ".desktop", NULL);
_tmp15_ = _tmp14_;
@@ -764,7 +909,7 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c
if (_tmp18_ == NULL) {
const gchar* _tmp19_;
_tmp19_ = desktop;
- g_warning ("music-player-bridge.vala:160: Could not create app_info for path %s \n" \
+ g_warning ("music-player-bridge.vala:181: Could not create app_info for path %s \n" \
" Getting out of here ", _tmp19_);
_g_object_unref0 (app_info);
return;
@@ -773,109 +918,119 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c
_tmp21_ = g_strdup (_tmp20_);
_tmp22_ = music_player_bridge_determine_key (_tmp21_);
mpris_key = _tmp22_;
- _tmp23_ = self->priv->registered_clients;
- _tmp24_ = mpris_key;
- _tmp25_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp23_, _tmp24_);
- if (_tmp25_ == FALSE) {
- const gchar* _tmp26_;
- DbusmenuMenuitem* _tmp27_;
- GAppInfo* _tmp28_;
- const gchar* _tmp29_;
- const gchar* _tmp30_;
- gchar* _tmp31_ = NULL;
- gchar* _tmp32_;
- gint _tmp33_ = 0;
- gboolean _tmp34_;
- PlayerController* _tmp35_;
- PlayerController* _tmp36_;
+ _tmp23_ = self->priv->settings_manager;
+ _tmp24_ = settings_manager_fetch_preferred (_tmp23_);
+ _tmp25_ = _tmp24_;
+ _tmp26_ = desktop;
+ _tmp27_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp25_, _tmp26_);
+ _tmp28_ = _tmp27_;
+ _g_object_unref0 (_tmp25_);
+ is_preferred = _tmp28_;
+ _tmp29_ = self->priv->registered_clients;
+ _tmp30_ = mpris_key;
+ _tmp31_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp29_, _tmp30_);
+ if (_tmp31_ == FALSE) {
+ const gchar* _tmp32_;
+ DbusmenuMenuitem* _tmp33_;
+ GAppInfo* _tmp34_;
+ const gchar* _tmp35_;
+ const gchar* _tmp36_;
+ gchar* _tmp37_ = NULL;
+ gchar* _tmp38_;
+ gint _tmp39_ = 0;
+ gboolean _tmp40_;
+ gboolean _tmp41_;
+ PlayerController* _tmp42_;
+ PlayerController* _tmp43_;
PlayerController* ctrl;
- GeeHashMap* _tmp37_;
- const gchar* _tmp38_;
- PlayerController* _tmp39_;
- const gchar* _tmp40_;
- SettingsManager* _tmp41_;
- const gchar* _tmp42_;
- GAppInfo* _tmp43_;
- const gchar* _tmp44_;
- _tmp26_ = dbus_name;
- g_debug ("music-player-bridge.vala:168: New client has registered that we have n" \
-"ot seen before: %s", _tmp26_);
- _tmp27_ = self->priv->root_menu;
- _tmp28_ = app_info;
- _tmp29_ = dbus_name;
- _tmp30_ = desktop;
- _tmp31_ = music_player_bridge_fetch_icon_name (_tmp30_);
- _tmp32_ = _tmp31_;
- _tmp33_ = music_player_bridge_calculate_menu_position (self);
- _tmp34_ = use_playlists;
- _tmp35_ = player_controller_new (_tmp27_, _tmp28_, _tmp29_, _tmp32_, _tmp33_, &_tmp34_, PLAYER_CONTROLLER_STATE_READY);
- _tmp36_ = _tmp35_;
- _g_free0 (_tmp32_);
- ctrl = _tmp36_;
- _tmp37_ = self->priv->registered_clients;
- _tmp38_ = mpris_key;
- _tmp39_ = ctrl;
- gee_abstract_map_set ((GeeAbstractMap*) _tmp37_, _tmp38_, _tmp39_);
- _tmp40_ = desktop;
- g_debug ("music-player-bridge.vala:177: Have not seen this %s before, new contro" \
-"ller created.", _tmp40_);
- _tmp41_ = self->priv->settings_manager;
- _tmp42_ = desktop;
- settings_manager_add_interested (_tmp41_, _tmp42_);
- _tmp43_ = app_info;
- _tmp44_ = mpris_key;
- music_player_bridge_establish_file_monitoring (self, _tmp43_, _tmp44_);
- g_debug ("music-player-bridge.vala:180: application added to the interested list");
+ GeeHashMap* _tmp44_;
+ const gchar* _tmp45_;
+ PlayerController* _tmp46_;
+ const gchar* _tmp47_;
+ SettingsManager* _tmp48_;
+ const gchar* _tmp49_;
+ GAppInfo* _tmp50_;
+ const gchar* _tmp51_;
+ _tmp32_ = dbus_name;
+ g_debug ("music-player-bridge.vala:190: New client has registered that we have n" \
+"ot seen before: %s", _tmp32_);
+ _tmp33_ = self->priv->root_menu;
+ _tmp34_ = app_info;
+ _tmp35_ = dbus_name;
+ _tmp36_ = desktop;
+ _tmp37_ = music_player_bridge_fetch_icon_name (_tmp36_);
+ _tmp38_ = _tmp37_;
+ _tmp39_ = music_player_bridge_calculate_menu_position (self);
+ _tmp40_ = use_playlists;
+ _tmp41_ = is_preferred;
+ _tmp42_ = player_controller_new (_tmp33_, _tmp34_, _tmp35_, _tmp38_, _tmp39_, &_tmp40_, PLAYER_CONTROLLER_STATE_READY, _tmp41_);
+ _tmp43_ = _tmp42_;
+ _g_free0 (_tmp38_);
+ ctrl = _tmp43_;
+ _tmp44_ = self->priv->registered_clients;
+ _tmp45_ = mpris_key;
+ _tmp46_ = ctrl;
+ gee_abstract_map_set ((GeeAbstractMap*) _tmp44_, _tmp45_, _tmp46_);
+ _tmp47_ = desktop;
+ g_debug ("music-player-bridge.vala:200: Have not seen this %s before, new contro" \
+"ller created.", _tmp47_);
+ _tmp48_ = self->priv->settings_manager;
+ _tmp49_ = desktop;
+ settings_manager_add_interested (_tmp48_, _tmp49_);
+ _tmp50_ = app_info;
+ _tmp51_ = mpris_key;
+ music_player_bridge_establish_file_monitoring (self, _tmp50_, _tmp51_);
+ g_debug ("music-player-bridge.vala:203: application added to the interested list");
_g_object_unref0 (ctrl);
} else {
- GeeHashMap* _tmp45_;
- const gchar* _tmp46_;
- gpointer _tmp47_ = NULL;
- PlayerController* _tmp48_;
- gboolean _tmp49_;
- gboolean* _tmp50_;
- GeeHashMap* _tmp51_;
- const gchar* _tmp52_;
- gpointer _tmp53_ = NULL;
- PlayerController* _tmp54_;
- GeeHashMap* _tmp55_;
- const gchar* _tmp56_;
- gpointer _tmp57_ = NULL;
- PlayerController* _tmp58_;
+ GeeHashMap* _tmp52_;
+ const gchar* _tmp53_;
+ gpointer _tmp54_ = NULL;
+ PlayerController* _tmp55_;
+ gboolean _tmp56_;
+ gboolean* _tmp57_;
+ GeeHashMap* _tmp58_;
const gchar* _tmp59_;
- const gchar* _tmp60_;
- gboolean _tmp61_;
- gchar* _tmp62_ = NULL;
- gchar* _tmp63_;
- _tmp45_ = self->priv->registered_clients;
- _tmp46_ = mpris_key;
- _tmp47_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp45_, _tmp46_);
- _tmp48_ = (PlayerController*) _tmp47_;
- _tmp49_ = use_playlists;
- _tmp50_ = __bool_dup0 (&_tmp49_);
- _g_free0 (_tmp48_->use_playlists);
- _tmp48_->use_playlists = _tmp50_;
- _g_object_unref0 (_tmp48_);
- _tmp51_ = self->priv->registered_clients;
- _tmp52_ = mpris_key;
- _tmp53_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp51_, _tmp52_);
- _tmp54_ = (PlayerController*) _tmp53_;
- player_controller_update_state (_tmp54_, PLAYER_CONTROLLER_STATE_READY);
- _g_object_unref0 (_tmp54_);
- _tmp55_ = self->priv->registered_clients;
- _tmp56_ = mpris_key;
- _tmp57_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp55_, _tmp56_);
- _tmp58_ = (PlayerController*) _tmp57_;
- _tmp59_ = dbus_name;
- player_controller_activate (_tmp58_, _tmp59_);
- _g_object_unref0 (_tmp58_);
- _tmp60_ = dbus_name;
- _tmp61_ = use_playlists;
- _tmp62_ = bool_to_string (_tmp61_);
- _tmp63_ = _tmp62_;
- g_debug ("music-player-bridge.vala:186: Application has already registered - awa" \
-"ken the hibernation: %s with playlists %s \n", _tmp60_, _tmp63_);
- _g_free0 (_tmp63_);
+ gpointer _tmp60_ = NULL;
+ PlayerController* _tmp61_;
+ GeeHashMap* _tmp62_;
+ const gchar* _tmp63_;
+ gpointer _tmp64_ = NULL;
+ PlayerController* _tmp65_;
+ const gchar* _tmp66_;
+ const gchar* _tmp67_;
+ gboolean _tmp68_;
+ gchar* _tmp69_ = NULL;
+ gchar* _tmp70_;
+ _tmp52_ = self->priv->registered_clients;
+ _tmp53_ = mpris_key;
+ _tmp54_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp52_, _tmp53_);
+ _tmp55_ = (PlayerController*) _tmp54_;
+ _tmp56_ = use_playlists;
+ _tmp57_ = __bool_dup0 (&_tmp56_);
+ _g_free0 (_tmp55_->use_playlists);
+ _tmp55_->use_playlists = _tmp57_;
+ _g_object_unref0 (_tmp55_);
+ _tmp58_ = self->priv->registered_clients;
+ _tmp59_ = mpris_key;
+ _tmp60_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp58_, _tmp59_);
+ _tmp61_ = (PlayerController*) _tmp60_;
+ player_controller_update_state (_tmp61_, PLAYER_CONTROLLER_STATE_READY);
+ _g_object_unref0 (_tmp61_);
+ _tmp62_ = self->priv->registered_clients;
+ _tmp63_ = mpris_key;
+ _tmp64_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp62_, _tmp63_);
+ _tmp65_ = (PlayerController*) _tmp64_;
+ _tmp66_ = dbus_name;
+ player_controller_activate (_tmp65_, _tmp66_);
+ _g_object_unref0 (_tmp65_);
+ _tmp67_ = dbus_name;
+ _tmp68_ = use_playlists;
+ _tmp69_ = bool_to_string (_tmp68_);
+ _tmp70_ = _tmp69_;
+ g_debug ("music-player-bridge.vala:209: Application has already registered - awa" \
+"ken the hibernation: %s with playlists %s \n", _tmp67_, _tmp70_);
+ _g_free0 (_tmp70_);
}
_g_free0 (mpris_key);
_g_object_unref0 (app_info);
@@ -888,8 +1043,8 @@ void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gch
g_return_if_fail (self != NULL);
g_return_if_fail (mpris_root_interface != NULL);
_tmp0_ = mpris_root_interface;
- g_debug ("music-player-bridge.vala:192: MusicPlayerBridge -> client with dbus in" \
-"terface %s has vanished", _tmp0_);
+ g_debug ("music-player-bridge.vala:215: \n" \
+" MusicPlayerBridge -> client with dbus interface %s has vanished", _tmp0_);
_tmp1_ = self->priv->root_menu;
if (_tmp1_ != NULL) {
const gchar* _tmp2_;
@@ -901,7 +1056,7 @@ void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gch
const gchar* _tmp7_;
gboolean _tmp11_;
_tmp2_ = mpris_root_interface;
- g_debug ("music-player-bridge.vala:195: attempt to remove %s", _tmp2_);
+ g_debug ("music-player-bridge.vala:218: \n attempt to remove %s", _tmp2_);
_tmp3_ = mpris_root_interface;
_tmp4_ = g_strdup (_tmp3_);
_tmp5_ = music_player_bridge_determine_key (_tmp4_);
@@ -932,7 +1087,7 @@ void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gch
player_controller_hibernate (_tmp15_);
_g_object_unref0 (_tmp15_);
_tmp16_ = mpris_key;
- g_debug ("music-player-bridge.vala:199: Successively offlined client %s", _tmp16_);
+ g_debug ("music-player-bridge.vala:222: \n Successively offlined client %s", _tmp16_);
}
_g_free0 (mpris_key);
}
@@ -998,7 +1153,7 @@ void music_player_bridge_enable_player_specific_items_for_client (MusicPlayerBri
if (_tmp5_ == FALSE) {
const gchar* _tmp6_;
_tmp6_ = desktop_id;
- g_warning ("music-player-bridge.vala:218: we don't have a client with desktop id %" \
+ g_warning ("music-player-bridge.vala:241: we don't have a client with desktop id %" \
"s registered", _tmp6_);
_g_free0 (mpris_key);
return;
@@ -1040,7 +1195,7 @@ void music_player_bridge_enable_track_specific_items_for_client (MusicPlayerBrid
if (_tmp5_ == FALSE) {
const gchar* _tmp6_;
_tmp6_ = desktop_id;
- g_warning ("music-player-bridge.vala:229: we don't have a client with desktop id %" \
+ g_warning ("music-player-bridge.vala:252: we don't have a client with desktop id %" \
"s registered", _tmp6_);
_g_free0 (mpris_key);
return;
@@ -1083,7 +1238,7 @@ static GAppInfo* music_player_bridge_create_app_info (const gchar* desktop) {
if (_tmp5_) {
const gchar* _tmp6_;
_tmp6_ = desktop;
- g_warning ("music-player-bridge.vala:239: Could not create a desktopappinfo instan" \
+ g_warning ("music-player-bridge.vala:262: Could not create a desktopappinfo instan" \
"ce from app: %s", _tmp6_);
result = NULL;
_g_object_unref0 (info);
@@ -1147,7 +1302,7 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) {
GError* _error_ = NULL;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("music-player-bridge.vala:255: Error loading keyfile - FileError");
+ g_warning ("music-player-bridge.vala:278: Error loading keyfile - FileError");
result = NULL;
_g_error_free0 (_error_);
_g_key_file_free0 (desktop_keyfile);
@@ -1160,7 +1315,7 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) {
GError* _error_ = NULL;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("music-player-bridge.vala:259: Error loading keyfile - KeyFileError");
+ g_warning ("music-player-bridge.vala:282: Error loading keyfile - KeyFileError");
result = NULL;
_g_error_free0 (_error_);
_g_key_file_free0 (desktop_keyfile);
@@ -1203,7 +1358,7 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) {
GError* _error_ = NULL;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("music-player-bridge.vala:268: Error trying to fetch the icon name from" \
+ g_warning ("music-player-bridge.vala:291: Error trying to fetch the icon name from" \
" the keyfile");
result = NULL;
_g_error_free0 (_error_);
@@ -1220,96 +1375,120 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) {
}
+static gboolean string_contains (const gchar* self, const gchar* needle) {
+ gboolean result = FALSE;
+ const gchar* _tmp0_;
+ gchar* _tmp1_ = NULL;
+ g_return_val_if_fail (self != NULL, FALSE);
+ g_return_val_if_fail (needle != NULL, FALSE);
+ _tmp0_ = needle;
+ _tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_);
+ result = _tmp1_ != NULL;
+ return result;
+}
+
+
static gchar* music_player_bridge_determine_key (gchar* desktop_or_interface) {
gchar* result = NULL;
const gchar* _tmp0_;
- gchar* _tmp1_;
+ gboolean _tmp1_ = FALSE;
+ const gchar* _tmp3_;
+ gchar* _tmp4_;
gchar* _result_;
- const gchar* _tmp2_;
- gchar** _tmp3_;
- gchar** _tmp4_ = NULL;
+ const gchar* _tmp5_;
+ gchar** _tmp6_;
+ gchar** _tmp7_ = NULL;
gchar** tokens;
gint tokens_length1;
gint _tokens_size_;
- gboolean _tmp5_ = FALSE;
- gchar** _tmp6_;
- gint _tmp6__length1;
- gboolean _tmp8_;
- const gchar* _tmp13_;
- gchar** _tmp14_;
- gchar** _tmp15_ = NULL;
+ gboolean _tmp8_ = FALSE;
+ gchar** _tmp9_;
+ gint _tmp9__length1;
+ gboolean _tmp11_;
+ const gchar* _tmp16_;
+ gchar** _tmp17_;
+ gchar** _tmp18_ = NULL;
gchar** temp;
gint temp_length1;
gint _temp_size_;
- gboolean _tmp16_ = FALSE;
- gchar** _tmp17_;
- gint _tmp17__length1;
- gboolean _tmp19_;
+ gboolean _tmp19_ = FALSE;
+ gchar** _tmp20_;
+ gint _tmp20__length1;
+ gboolean _tmp22_;
g_return_val_if_fail (desktop_or_interface != NULL, NULL);
_tmp0_ = desktop_or_interface;
- _tmp1_ = g_strdup (_tmp0_);
- _result_ = _tmp1_;
- _tmp2_ = desktop_or_interface;
- _tmp4_ = _tmp3_ = g_strsplit (_tmp2_, ".", 0);
- tokens = _tmp4_;
- tokens_length1 = _vala_array_length (_tmp3_);
- _tokens_size_ = tokens_length1;
- _tmp6_ = tokens;
- _tmp6__length1 = tokens_length1;
- if (_tmp6_ != NULL) {
- gchar** _tmp7_;
- gint _tmp7__length1;
- _tmp7_ = tokens;
- _tmp7__length1 = tokens_length1;
- _tmp5_ = _tmp7__length1 > 1;
- } else {
- _tmp5_ = FALSE;
+ _tmp1_ = string_contains (_tmp0_, "amarok");
+ if (_tmp1_) {
+ gchar* _tmp2_;
+ _tmp2_ = g_strdup ("amarok");
+ result = _tmp2_;
+ _g_free0 (desktop_or_interface);
+ return result;
}
- _tmp8_ = _tmp5_;
- if (_tmp8_) {
- gchar** _tmp9_;
- gint _tmp9__length1;
+ _tmp3_ = desktop_or_interface;
+ _tmp4_ = g_strdup (_tmp3_);
+ _result_ = _tmp4_;
+ _tmp5_ = desktop_or_interface;
+ _tmp7_ = _tmp6_ = g_strsplit (_tmp5_, ".", 0);
+ tokens = _tmp7_;
+ tokens_length1 = _vala_array_length (_tmp6_);
+ _tokens_size_ = tokens_length1;
+ _tmp9_ = tokens;
+ _tmp9__length1 = tokens_length1;
+ if (_tmp9_ != NULL) {
gchar** _tmp10_;
gint _tmp10__length1;
- const gchar* _tmp11_;
- gchar* _tmp12_;
- _tmp9_ = tokens;
- _tmp9__length1 = tokens_length1;
_tmp10_ = tokens;
_tmp10__length1 = tokens_length1;
- _tmp11_ = _tmp9_[_tmp10__length1 - 1];
- _tmp12_ = g_strdup (_tmp11_);
+ _tmp8_ = _tmp10__length1 > 1;
+ } else {
+ _tmp8_ = FALSE;
+ }
+ _tmp11_ = _tmp8_;
+ if (_tmp11_) {
+ gchar** _tmp12_;
+ gint _tmp12__length1;
+ gchar** _tmp13_;
+ gint _tmp13__length1;
+ const gchar* _tmp14_;
+ gchar* _tmp15_;
+ _tmp12_ = tokens;
+ _tmp12__length1 = tokens_length1;
+ _tmp13_ = tokens;
+ _tmp13__length1 = tokens_length1;
+ _tmp14_ = _tmp12_[_tmp13__length1 - 1];
+ _tmp15_ = g_strdup (_tmp14_);
_g_free0 (_result_);
- _result_ = _tmp12_;
+ _result_ = _tmp15_;
}
- _tmp13_ = _result_;
- _tmp15_ = _tmp14_ = g_strsplit (_tmp13_, "-", 0);
- temp = _tmp15_;
- temp_length1 = _vala_array_length (_tmp14_);
+ _tmp16_ = _result_;
+ _tmp18_ = _tmp17_ = g_strsplit (_tmp16_, "-", 0);
+ temp = _tmp18_;
+ temp_length1 = _vala_array_length (_tmp17_);
_temp_size_ = temp_length1;
- _tmp17_ = temp;
- _tmp17__length1 = temp_length1;
- if (_tmp17_ != NULL) {
- gchar** _tmp18_;
- gint _tmp18__length1;
- _tmp18_ = temp;
- _tmp18__length1 = temp_length1;
- _tmp16_ = _tmp18__length1 > 1;
+ _tmp20_ = temp;
+ _tmp20__length1 = temp_length1;
+ if (_tmp20_ != NULL) {
+ gchar** _tmp21_;
+ gint _tmp21__length1;
+ _tmp21_ = temp;
+ _tmp21__length1 = temp_length1;
+ _tmp19_ = _tmp21__length1 > 1;
} else {
- _tmp16_ = FALSE;
+ _tmp19_ = FALSE;
}
- _tmp19_ = _tmp16_;
- if (_tmp19_) {
- gchar** _tmp20_;
- gint _tmp20__length1;
- const gchar* _tmp21_;
- gchar* _tmp22_;
- _tmp20_ = temp;
- _tmp20__length1 = temp_length1;
- _tmp21_ = _tmp20_[0];
- _tmp22_ = g_strdup (_tmp21_);
+ _tmp22_ = _tmp19_;
+ if (_tmp22_) {
+ gchar** _tmp23_;
+ gint _tmp23__length1;
+ const gchar* _tmp24_;
+ gchar* _tmp25_;
+ _tmp23_ = temp;
+ _tmp23__length1 = temp_length1;
+ _tmp24_ = _tmp23_[0];
+ _tmp25_ = g_strdup (_tmp24_);
_g_free0 (_result_);
- _result_ = _tmp22_;
+ _result_ = _tmp25_;
}
result = _result_;
temp = (_vala_array_free (temp, temp_length1, (GDestroyNotify) g_free), NULL);
@@ -1324,6 +1503,11 @@ static void _music_player_bridge_on_blacklist_update_settings_manager_blacklist_
}
+static void _music_player_bridge_on_preferred_update_settings_manager_preferred_updates (SettingsManager* _sender, GeeArrayList* new_preferred, gpointer self) {
+ music_player_bridge_on_preferred_update (self, new_preferred);
+}
+
+
static GObject * music_player_bridge_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
GObject * obj;
GObjectClass * parent_class;
@@ -1332,6 +1516,7 @@ static GObject * music_player_bridge_constructor (GType type, guint n_construct_
GeeHashMap* _tmp1_;
SettingsManager* _tmp2_;
SettingsManager* _tmp3_;
+ SettingsManager* _tmp4_;
parent_class = G_OBJECT_CLASS (music_player_bridge_parent_class);
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = MUSIC_PLAYER_BRIDGE (obj);
@@ -1346,6 +1531,8 @@ static GObject * music_player_bridge_constructor (GType type, guint n_construct_
self->priv->settings_manager = _tmp2_;
_tmp3_ = self->priv->settings_manager;
g_signal_connect_object (_tmp3_, "blacklist-updates", (GCallback) _music_player_bridge_on_blacklist_update_settings_manager_blacklist_updates, self, 0);
+ _tmp4_ = self->priv->settings_manager;
+ g_signal_connect_object (_tmp4_, "preferred-updates", (GCallback) _music_player_bridge_on_preferred_update_settings_manager_preferred_updates, self, 0);
return obj;
}
diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h
index 7583b11..4909fc6 100644
--- a/src/music-player-bridge.h
+++ b/src/music-player-bridge.h
@@ -1,4 +1,4 @@
-/* music-player-bridge.h generated by valac 0.14.2, the Vala compiler, do not modify */
+/* music-player-bridge.h generated by valac 0.16.1, the Vala compiler, do not modify */
#ifndef __MUSIC_PLAYER_BRIDGE_H__
@@ -458,8 +458,8 @@ GType mpris2_controller_get_type (void) G_GNUC_CONST;
GType player_controller_widget_order_get_type (void) G_GNUC_CONST;
GType player_controller_state_get_type (void) G_GNUC_CONST;
#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4
-PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state);
-PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state);
+PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state, gboolean is_preferred);
+PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state, gboolean is_preferred);
void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state);
void player_controller_activate (PlayerController* self, const gchar* dbus_name);
void player_controller_instantiate (PlayerController* self);
@@ -467,6 +467,7 @@ void player_controller_enable_track_specific_items (PlayerController* self, cons
void player_controller_enable_player_specific_items (PlayerController* self, const gchar* object_path);
gint player_controller_track_specific_count (PlayerController* self);
void player_controller_remove_from_menu (PlayerController* self);
+void player_controller_set_as_preferred (PlayerController* self, gboolean val);
void player_controller_hibernate (PlayerController* self);
void player_controller_update_layout (PlayerController* self);
const gchar* player_controller_get_dbus_name (PlayerController* self);
@@ -477,6 +478,7 @@ gint player_controller_get_menu_offset (PlayerController* self);
void player_controller_set_menu_offset (PlayerController* self, gint value);
const gchar* player_controller_get_icon_name (PlayerController* self);
void player_controller_set_icon_name (PlayerController* self, const gchar* value);
+gboolean player_controller_get_is_preferred (PlayerController* self);
GType mpris_root_proxy_get_type (void) G_GNUC_CONST;
guint mpris_root_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
GType mpris_root_get_type (void) G_GNUC_CONST;
@@ -570,6 +572,7 @@ GType settings_manager_get_type (void) G_GNUC_CONST;
SettingsManager* settings_manager_new (void);
SettingsManager* settings_manager_construct (GType object_type);
gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_length1);
+GeeArrayList* settings_manager_fetch_preferred (SettingsManager* self);
GeeArrayList* settings_manager_fetch_interested (SettingsManager* self);
void settings_manager_clear_list (SettingsManager* self);
void settings_manager_remove_interested (SettingsManager* self, const gchar* app_desktop_name);
diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala
index 18f1c40..606b129 100644
--- a/src/music-player-bridge.vala
+++ b/src/music-player-bridge.vala
@@ -40,6 +40,7 @@ public class MusicPlayerBridge : GLib.Object
this.file_monitors = new HashMap<string, string> ();
this.settings_manager = new SettingsManager();
this.settings_manager.blacklist_updates.connect ( this.on_blacklist_update );
+ this.settings_manager.preferred_updates.connect ( this.on_preferred_update );
}
private void on_blacklist_update ( string[] blacklist )
@@ -58,8 +59,26 @@ public class MusicPlayerBridge : GLib.Object
this.watcher.check_for_active_clients.begin();
}
+ private void on_preferred_update ( Gee.ArrayList<string> preferred )
+ {
+ debug ("Preferred players update. Clearing current preferred players...");
+
+ foreach (var player_controller in this.registered_clients.values) {
+ player_controller.set_as_preferred (false);
+ }
+
+ foreach (var s in preferred) {
+ string key = this.determine_key (s);
+ if (this.registered_clients.has_key (key)) {
+ debug ("Setting %s as preferred player", key);
+ this.registered_clients[key].set_as_preferred (true);
+ }
+ }
+ }
+
private void try_to_add_inactive_familiar_clients()
{
+ var preferred_players = this.settings_manager.fetch_preferred ();
foreach ( string desktop in this.settings_manager.fetch_interested()){
debug ( "interested client found : %s", desktop );
AppInfo? app_info = create_app_info ( desktop.concat( ".desktop" ) );
@@ -68,14 +87,16 @@ public class MusicPlayerBridge : GLib.Object
desktop );
continue;
}
- var mpris_key = determine_key ( desktop );
+ bool is_preferred = desktop in preferred_players;
PlayerController ctrl = new PlayerController ( this.root_menu,
app_info,
null,
this.fetch_icon_name(desktop),
calculate_menu_position(),
null,
- PlayerController.state.OFFLINE );
+ PlayerController.state.OFFLINE,
+ is_preferred );
+ var mpris_key = determine_key ( desktop );
this.registered_clients.set(mpris_key, ctrl);
this.establish_file_monitoring (app_info, mpris_key);
}
@@ -163,7 +184,8 @@ public class MusicPlayerBridge : GLib.Object
}
var mpris_key = determine_key ( desktop );
- // Are we sure clients will appear like this with the new registration method in place.
+ bool is_preferred = desktop in this.settings_manager.fetch_preferred ();
+
if ( this.registered_clients.has_key (mpris_key) == false ){
debug("New client has registered that we have not seen before: %s", dbus_name );
PlayerController ctrl = new PlayerController ( this.root_menu,
@@ -172,7 +194,8 @@ public class MusicPlayerBridge : GLib.Object
this.fetch_icon_name(desktop),
this.calculate_menu_position(),
use_playlists,
- PlayerController.state.READY );
+ PlayerController.state.READY,
+ is_preferred);
this.registered_clients.set ( mpris_key, ctrl );
debug ( "Have not seen this %s before, new controller created.", desktop );
this.settings_manager.add_interested ( desktop );
@@ -189,14 +212,14 @@ public class MusicPlayerBridge : GLib.Object
public void client_has_vanished ( string mpris_root_interface )
{
- debug("MusicPlayerBridge -> client with dbus interface %s has vanished",
+ debug("\n MusicPlayerBridge -> client with dbus interface %s has vanished",
mpris_root_interface );
if (root_menu != null){
- debug("attempt to remove %s", mpris_root_interface);
+ debug("\n attempt to remove %s", mpris_root_interface);
var mpris_key = determine_key ( mpris_root_interface );
if ( mpris_key != null && this.registered_clients.has_key(mpris_key)){
registered_clients[mpris_key].hibernate();
- debug("Successively offlined client %s", mpris_key);
+ debug("\n Successively offlined client %s", mpris_key);
}
}
}
@@ -279,15 +302,21 @@ public class MusicPlayerBridge : GLib.Object
*/
private static string? determine_key(owned string desktop_or_interface)
{
+ // handle the special case of amarok, (kde4-amarok desktop file name)
+ if (desktop_or_interface.contains("amarok")){
+ return "amarok";
+ }
+
var result = desktop_or_interface;
+
var tokens = desktop_or_interface.split( "." );
if (tokens != null && tokens.length > 1){
result = tokens[tokens.length - 1];
- }
+ }
var temp = result.split("-");
if (temp != null && temp.length > 1){
result = temp[0];
- }
+ }
return result;
}
diff --git a/src/player-controller.c b/src/player-controller.c
index d086e5d..1f9ae8d 100644
--- a/src/player-controller.c
+++ b/src/player-controller.c
@@ -1,4 +1,4 @@
-/* player-controller.c generated by valac 0.14.2, the Vala compiler
+/* player-controller.c generated by valac 0.16.1, the Vala compiler
* generated from player-controller.vala, do not modify */
/*
@@ -137,6 +137,7 @@ struct _PlayerControllerPrivate {
GAppInfo* _app_info;
gint _menu_offset;
gchar* _icon_name;
+ gboolean _is_preferred;
SpecificItemsManager* track_specific_mgr;
SpecificItemsManager* player_specific_mgr;
};
@@ -193,18 +194,20 @@ enum {
PLAYER_CONTROLLER_DBUS_NAME,
PLAYER_CONTROLLER_APP_INFO,
PLAYER_CONTROLLER_MENU_OFFSET,
- PLAYER_CONTROLLER_ICON_NAME
+ PLAYER_CONTROLLER_ICON_NAME,
+ PLAYER_CONTROLLER_IS_PREFERRED
};
GType player_controller_widget_order_get_type (void) G_GNUC_CONST;
GType player_controller_state_get_type (void) G_GNUC_CONST;
#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4
-PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state);
-PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state);
+PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state, gboolean is_preferred);
+PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state, gboolean is_preferred);
static gboolean* _bool_dup (gboolean* self);
void player_controller_set_app_info (PlayerController* self, GAppInfo* value);
void player_controller_set_dbus_name (PlayerController* self, const gchar* value);
void player_controller_set_icon_name (PlayerController* self, const gchar* value);
void player_controller_set_menu_offset (PlayerController* self, gint value);
+static void player_controller_set_is_preferred (PlayerController* self, gboolean value);
static void player_controller_construct_widgets (PlayerController* self);
static void player_controller_establish_mpris_connection (PlayerController* self);
void player_controller_update_layout (PlayerController* self);
@@ -227,6 +230,7 @@ static void player_controller_determine_state (PlayerController* self);
void player_controller_remove_from_menu (PlayerController* self);
static gboolean _bool_equal (const gboolean* s1, const gboolean* s2);
GType playlists_menuitem_get_type (void) G_GNUC_CONST;
+void player_controller_set_as_preferred (PlayerController* self, gboolean val);
void player_controller_hibernate (PlayerController* self);
GType transport_menuitem_get_type (void) G_GNUC_CONST;
void transport_menuitem_change_play_state (TransportMenuitem* self, TransportState update);
@@ -235,6 +239,7 @@ GeeHashSet* metadata_menuitem_relevant_attributes_for_ui (void);
GType metadata_menuitem_get_type (void) G_GNUC_CONST;
void metadata_menuitem_toggle_active_triangle (MetadataMenuitem* self, gboolean update);
void metadata_menuitem_should_collapse (MetadataMenuitem* self, gboolean collapse);
+gboolean player_controller_get_is_preferred (PlayerController* self);
gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs);
void transport_menuitem_handle_cached_action (TransportMenuitem* self);
PlayerItem* player_item_new (const gchar* type);
@@ -295,7 +300,7 @@ static gpointer _g_object_ref0 (gpointer self) {
}
-PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state) {
+PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state, gboolean is_preferred) {
PlayerController * self = NULL;
gboolean* _tmp0_;
gboolean* _tmp1_;
@@ -307,9 +312,10 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit
GeeArrayList* _tmp7_;
PlayerControllerstate _tmp8_;
gint _tmp9_;
- GAppInfo* _tmp10_;
- const gchar* _tmp11_ = NULL;
- const gchar* _tmp12_;
+ gboolean _tmp10_;
+ GAppInfo* _tmp11_;
+ const gchar* _tmp12_ = NULL;
+ const gchar* _tmp13_;
g_return_val_if_fail (root != NULL, NULL);
g_return_val_if_fail (app != NULL, NULL);
g_return_val_if_fail (icon_name != NULL, NULL);
@@ -335,20 +341,22 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit
self->current_state = (gint) _tmp8_;
_tmp9_ = offset;
player_controller_set_menu_offset (self, _tmp9_);
+ _tmp10_ = is_preferred;
+ player_controller_set_is_preferred (self, _tmp10_);
player_controller_construct_widgets (self);
player_controller_establish_mpris_connection (self);
player_controller_update_layout (self);
- _tmp10_ = self->priv->_app_info;
- _tmp11_ = g_app_info_get_name (_tmp10_);
- _tmp12_ = self->priv->_icon_name;
- g_debug ("player-controller.vala:74: New player controller for %s with icon nam" \
-"e %s", _tmp11_, _tmp12_);
+ _tmp11_ = self->priv->_app_info;
+ _tmp12_ = g_app_info_get_name (_tmp11_);
+ _tmp13_ = self->priv->_icon_name;
+ g_debug ("player-controller.vala:78: New player controller for %s with icon nam" \
+"e %s", _tmp12_, _tmp13_);
return self;
}
-PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state) {
- return player_controller_construct (TYPE_PLAYER_CONTROLLER, root, app, dbus_name, icon_name, offset, use_playlists, initial_state);
+PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state, gboolean is_preferred) {
+ return player_controller_construct (TYPE_PLAYER_CONTROLLER, root, app, dbus_name, icon_name, offset, use_playlists, initial_state, is_preferred);
}
@@ -361,7 +369,7 @@ void player_controller_update_state (PlayerController* self, PlayerControllersta
_tmp0_ = self->priv->_app_info;
_tmp1_ = g_app_info_get_name (_tmp0_);
_tmp2_ = new_state;
- g_debug ("player-controller.vala:79: update_state - player controller %s : new s" \
+ g_debug ("player-controller.vala:83: update_state - player controller %s : new s" \
"tate %i", _tmp1_, (gint) _tmp2_);
_tmp3_ = new_state;
self->current_state = (gint) _tmp3_;
@@ -386,7 +394,7 @@ void player_controller_instantiate (PlayerController* self) {
g_return_if_fail (self != NULL);
_tmp0_ = self->priv->_app_info;
_tmp1_ = g_app_info_get_name (_tmp0_);
- g_debug ("player-controller.vala:99: instantiate in player controller for %s", _tmp1_);
+ g_debug ("player-controller.vala:103: instantiate in player controller for %s", _tmp1_);
{
GAppInfo* _tmp2_;
_tmp2_ = self->priv->_app_info;
@@ -410,7 +418,7 @@ void player_controller_instantiate (PlayerController* self) {
_tmp4_ = g_app_info_get_name (_tmp3_);
_tmp5_ = _error_;
_tmp6_ = _tmp5_->message;
- g_warning ("player-controller.vala:105: Failed to launch app %s with error message" \
+ g_warning ("player-controller.vala:109: Failed to launch app %s with error message" \
": %s", _tmp4_, _tmp6_);
_g_error_free0 (_error_);
}
@@ -514,14 +522,14 @@ static void player_controller_establish_mpris_connection (PlayerController* self
}
_tmp3_ = _tmp0_;
if (_tmp3_) {
- g_debug ("player-controller.vala:139: establish_mpris_connection - Not ready to " \
+ g_debug ("player-controller.vala:143: establish_mpris_connection - Not ready to " \
"connect");
return;
}
_tmp4_ = self->use_playlists;
_tmp5_ = bool_to_string (*_tmp4_);
_tmp6_ = _tmp5_;
- g_debug ("player-controller.vala:142: establish mpris connection - use playlist" \
+ g_debug ("player-controller.vala:146: establish mpris connection - use playlist" \
"s value = %s ", _tmp6_);
_g_free0 (_tmp6_);
_tmp7_ = mpris2_controller_new (self);
@@ -615,6 +623,15 @@ void player_controller_remove_from_menu (PlayerController* self) {
}
+void player_controller_set_as_preferred (PlayerController* self, gboolean val) {
+ gboolean _tmp0_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = val;
+ player_controller_set_is_preferred (self, _tmp0_);
+ player_controller_update_layout (self);
+}
+
+
void player_controller_hibernate (PlayerController* self) {
GeeArrayList* _tmp0_;
gpointer _tmp1_ = NULL;
@@ -660,15 +677,17 @@ void player_controller_update_layout (PlayerController* self) {
gpointer _tmp3_ = NULL;
MetadataMenuitem* metadata_menuitem;
gint _tmp4_;
- MetadataMenuitem* _tmp13_;
- GeeArrayList* _tmp14_;
- gpointer _tmp15_ = NULL;
- PlayerItem* _tmp16_;
- GeeHashSet* _tmp17_ = NULL;
- GeeHashSet* _tmp18_;
- gboolean _tmp19_ = FALSE;
- GAppInfo* _tmp20_;
- const gchar* _tmp21_ = NULL;
+ GeeArrayList* _tmp12_;
+ gpointer _tmp13_ = NULL;
+ PlayerItem* _tmp14_;
+ GeeHashSet* _tmp15_ = NULL;
+ GeeHashSet* _tmp16_;
+ gboolean _tmp17_ = FALSE;
+ gboolean _tmp18_;
+ gboolean should_collapse;
+ MetadataMenuitem* _tmp19_;
+ gboolean _tmp20_;
+ gboolean _tmp21_;
PlaylistsMenuitem* _tmp28_;
DbusmenuMenuitem* _tmp29_;
gboolean* _tmp30_;
@@ -687,8 +706,7 @@ void player_controller_update_layout (PlayerController* self) {
GeeArrayList* _tmp8_;
gpointer _tmp9_ = NULL;
PlayerItem* _tmp10_;
- GAppInfo* _tmp11_;
- const gchar* _tmp12_ = NULL;
+ gboolean _tmp11_;
_tmp5_ = metadata_menuitem;
metadata_menuitem_should_collapse (_tmp5_, TRUE);
_tmp6_ = playlists_menuitem;
@@ -697,27 +715,28 @@ void player_controller_update_layout (PlayerController* self) {
_tmp8_ = self->custom_items;
_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
_tmp10_ = (PlayerItem*) _tmp9_;
- _tmp11_ = self->priv->_app_info;
- _tmp12_ = g_app_info_get_id (_tmp11_);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp10_, DBUSMENU_MENUITEM_PROP_VISIBLE, g_strcmp0 (_tmp12_, "rhythmbox.desktop") == 0);
+ _tmp11_ = self->priv->_is_preferred;
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp10_, DBUSMENU_MENUITEM_PROP_VISIBLE, _tmp11_);
_g_object_unref0 (_tmp10_);
_g_object_unref0 (metadata_menuitem);
_g_object_unref0 (playlists_menuitem);
return;
}
- _tmp13_ = metadata_menuitem;
- _tmp14_ = self->custom_items;
- _tmp15_ = gee_abstract_list_get ((GeeAbstractList*) _tmp14_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
- _tmp16_ = (PlayerItem*) _tmp15_;
- _tmp17_ = metadata_menuitem_relevant_attributes_for_ui ();
- _tmp18_ = _tmp17_;
- _tmp19_ = player_item_populated (_tmp16_, _tmp18_);
- metadata_menuitem_should_collapse (_tmp13_, !_tmp19_);
- _g_object_unref0 (_tmp18_);
+ _tmp12_ = self->custom_items;
+ _tmp13_ = gee_abstract_list_get ((GeeAbstractList*) _tmp12_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ _tmp14_ = (PlayerItem*) _tmp13_;
+ _tmp15_ = metadata_menuitem_relevant_attributes_for_ui ();
+ _tmp16_ = _tmp15_;
+ _tmp17_ = player_item_populated (_tmp14_, _tmp16_);
+ _tmp18_ = !_tmp17_;
_g_object_unref0 (_tmp16_);
- _tmp20_ = self->priv->_app_info;
- _tmp21_ = g_app_info_get_id (_tmp20_);
- if (g_strcmp0 (_tmp21_, "rhythmbox.desktop") == 0) {
+ _g_object_unref0 (_tmp14_);
+ should_collapse = _tmp18_;
+ _tmp19_ = metadata_menuitem;
+ _tmp20_ = should_collapse;
+ metadata_menuitem_should_collapse (_tmp19_, _tmp20_);
+ _tmp21_ = self->priv->_is_preferred;
+ if (_tmp21_) {
GeeArrayList* _tmp22_;
gpointer _tmp23_ = NULL;
TransportMenuitem* transport;
@@ -986,6 +1005,25 @@ void player_controller_set_icon_name (PlayerController* self, const gchar* value
}
+gboolean player_controller_get_is_preferred (PlayerController* self) {
+ gboolean result;
+ gboolean _tmp0_;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp0_ = self->priv->_is_preferred;
+ result = _tmp0_;
+ return result;
+}
+
+
+static void player_controller_set_is_preferred (PlayerController* self, gboolean value) {
+ gboolean _tmp0_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = value;
+ self->priv->_is_preferred = _tmp0_;
+ g_object_notify ((GObject *) self, "is-preferred");
+}
+
+
static void player_controller_class_init (PlayerControllerClass * klass) {
player_controller_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (PlayerControllerPrivate));
@@ -993,9 +1031,10 @@ static void player_controller_class_init (PlayerControllerClass * klass) {
G_OBJECT_CLASS (klass)->set_property = _vala_player_controller_set_property;
G_OBJECT_CLASS (klass)->finalize = player_controller_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_DBUS_NAME, g_param_spec_string ("dbus-name", "dbus-name", "dbus-name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_APP_INFO, g_param_spec_object ("app-info", "app-info", "app-info", G_TYPE_APP_INFO, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_APP_INFO, g_param_spec_object ("app-info", "app-info", "app-info", g_app_info_get_type (), G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_MENU_OFFSET, g_param_spec_int ("menu-offset", "menu-offset", "menu-offset", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_ICON_NAME, g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_IS_PREFERRED, g_param_spec_boolean ("is-preferred", "is-preferred", "is-preferred", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}
@@ -1049,6 +1088,9 @@ static void _vala_player_controller_get_property (GObject * object, guint proper
case PLAYER_CONTROLLER_ICON_NAME:
g_value_set_string (value, player_controller_get_icon_name (self));
break;
+ case PLAYER_CONTROLLER_IS_PREFERRED:
+ g_value_set_boolean (value, player_controller_get_is_preferred (self));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -1072,6 +1114,9 @@ static void _vala_player_controller_set_property (GObject * object, guint proper
case PLAYER_CONTROLLER_ICON_NAME:
player_controller_set_icon_name (self, g_value_get_string (value));
break;
+ case PLAYER_CONTROLLER_IS_PREFERRED:
+ player_controller_set_is_preferred (self, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
diff --git a/src/player-controller.vala b/src/player-controller.vala
index 80a48c3..fd66a8a 100644
--- a/src/player-controller.vala
+++ b/src/player-controller.vala
@@ -40,7 +40,7 @@ public class PlayerController : GLib.Object
}
public int current_state = state.OFFLINE;
-
+
public Dbusmenu.Menuitem root_menu;
public string dbus_name { get; set;}
public ArrayList<PlayerItem> custom_items;
@@ -49,6 +49,7 @@ public class PlayerController : GLib.Object
public int menu_offset { get; set;}
public string icon_name { get; set; }
public bool? use_playlists;
+ public bool is_preferred { get; private set; }
private SpecificItemsManager track_specific_mgr;
private SpecificItemsManager player_specific_mgr;
@@ -58,7 +59,8 @@ public class PlayerController : GLib.Object
string icon_name,
int offset,
bool? use_playlists,
- state initial_state)
+ state initial_state,
+ bool is_preferred)
{
this.use_playlists = use_playlists;
this.root_menu = root;
@@ -68,6 +70,8 @@ public class PlayerController : GLib.Object
this.custom_items = new ArrayList<PlayerItem>();
this.current_state = initial_state;
this.menu_offset = offset;
+ this.is_preferred = is_preferred;
+
this.construct_widgets();
this.establish_mpris_connection();
this.update_layout();
@@ -156,6 +160,11 @@ public class PlayerController : GLib.Object
}
}
+ public void set_as_preferred (bool val) {
+ this.is_preferred = val;
+ this.update_layout();
+ }
+
public void hibernate()
{
update_state(PlayerController.state.OFFLINE);
@@ -175,12 +184,14 @@ public class PlayerController : GLib.Object
metadata_menuitem.should_collapse (true);
playlists_menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE,
false);
- this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE,
- this.app_info.get_id() == "rhythmbox.desktop");
+ this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE, is_preferred);
return;
}
- metadata_menuitem.should_collapse (!this.custom_items[widget_order.METADATA].populated (MetadataMenuitem.relevant_attributes_for_ui()) );
- if (this.app_info.get_id() == "rhythmbox.desktop"){
+
+ bool should_collapse = !this.custom_items[widget_order.METADATA].populated (MetadataMenuitem.relevant_attributes_for_ui());
+ metadata_menuitem.should_collapse (should_collapse);
+
+ if (is_preferred){
TransportMenuitem transport = this.custom_items[widget_order.TRANSPORT] as TransportMenuitem;
transport.handle_cached_action();
}
diff --git a/src/player-item.c b/src/player-item.c
index 2cb449b..77f51dc 100644
--- a/src/player-item.c
+++ b/src/player-item.c
@@ -1,4 +1,4 @@
-/* player-item.c generated by valac 0.14.2, the Vala compiler
+/* player-item.c generated by valac 0.16.1, the Vala compiler
* generated from player-item.vala, do not modify */
/*
diff --git a/src/playlists-menu-item.c b/src/playlists-menu-item.c
index a84aae4..acfc95f 100644
--- a/src/playlists-menu-item.c
+++ b/src/playlists-menu-item.c
@@ -1,4 +1,4 @@
-/* playlists-menu-item.c generated by valac 0.14.2, the Vala compiler
+/* playlists-menu-item.c generated by valac 0.16.1, the Vala compiler
* generated from playlists-menu-item.vala, do not modify */
/*
@@ -153,13 +153,13 @@ void playlist_details_copy (const PlaylistDetails* self, PlaylistDetails* dest);
void playlist_details_destroy (PlaylistDetails* self);
void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1);
static Block2Data* block2_data_ref (Block2Data* _data2_);
-static void block2_data_unref (Block2Data* _data2_);
+static void block2_data_unref (void * _userdata_);
static gboolean playlists_menuitem_already_observed (PlaylistsMenuitem* self, PlaylistDetails* new_detail);
static gboolean playlists_menuitem_is_video_related (PlaylistsMenuitem* self, PlaylistDetails* new_detail);
static gchar* playlists_menuitem_truncate_item_label_if_needs_be (PlaylistsMenuitem* self, const gchar* item_label);
-static void ____lambda1_ (Block2Data* _data2_);
+static void ____lambda3_ (Block2Data* _data2_);
static void playlists_menuitem_submenu_item_activated (PlaylistsMenuitem* self, gint menu_item_id);
-static void _____lambda1__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self);
+static void _____lambda3__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint arg1, gpointer self);
void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, PlaylistDetails* new_detail);
void playlists_menuitem_active_playlist_update (PlaylistsMenuitem* self, PlaylistDetails* detail);
PlayerController* player_item_get_owner (PlayerItem* self);
@@ -191,16 +191,20 @@ static Block2Data* block2_data_ref (Block2Data* _data2_) {
}
-static void block2_data_unref (Block2Data* _data2_) {
+static void block2_data_unref (void * _userdata_) {
+ Block2Data* _data2_;
+ _data2_ = (Block2Data*) _userdata_;
if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
- _g_object_unref0 (_data2_->self);
+ PlaylistsMenuitem * self;
+ self = _data2_->self;
_g_object_unref0 (_data2_->menuitem);
+ _g_object_unref0 (self);
g_slice_free (Block2Data, _data2_);
}
}
-static void ____lambda1_ (Block2Data* _data2_) {
+static void ____lambda3_ (Block2Data* _data2_) {
PlaylistsMenuitem * self;
DbusmenuMenuitem* _tmp0_;
gint _tmp1_;
@@ -213,8 +217,8 @@ static void ____lambda1_ (Block2Data* _data2_) {
}
-static void _____lambda1__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) {
- ____lambda1_ (self);
+static void _____lambda3__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint arg1, gpointer self) {
+ ____lambda3_ (self);
}
@@ -305,7 +309,7 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli
_tmp19_ = _data2_->menuitem;
dbusmenu_menuitem_property_set_bool (_tmp19_, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
_tmp20_ = _data2_->menuitem;
- g_signal_connect_data (_tmp20_, "item-activated", (GCallback) _____lambda1__dbusmenu_menuitem_item_activated, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
+ g_signal_connect_data (_tmp20_, "item-activated", (GCallback) _____lambda3__dbusmenu_menuitem_item_activated, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0);
_tmp21_ = self->priv->current_playlists;
_tmp22_ = _data2_->menuitem;
_tmp23_ = dbusmenu_menuitem_get_id (_tmp22_);
diff --git a/src/settings-manager.c b/src/settings-manager.c
index 29e6f13..52d187c 100644
--- a/src/settings-manager.c
+++ b/src/settings-manager.c
@@ -1,4 +1,4 @@
-/* settings-manager.c generated by valac 0.14.2, the Vala compiler
+/* settings-manager.c generated by valac 0.16.1, the Vala compiler
* generated from settings-manager.vala, do not modify */
/*
@@ -68,15 +68,18 @@ enum {
SettingsManager* settings_manager_new (void);
SettingsManager* settings_manager_construct (GType object_type);
gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_length1);
+GeeArrayList* settings_manager_fetch_preferred (SettingsManager* self);
GeeArrayList* settings_manager_fetch_interested (SettingsManager* self);
static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle);
void settings_manager_clear_list (SettingsManager* self);
void settings_manager_remove_interested (SettingsManager* self, const gchar* app_desktop_name);
void settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name);
static void settings_manager_on_blacklist_event (SettingsManager* self);
+static void settings_manager_on_preferred_event (SettingsManager* self);
static void g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
static GObject * settings_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void _settings_manager_on_blacklist_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
+static void _settings_manager_on_preferred_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self);
static void settings_manager_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
@@ -115,6 +118,83 @@ gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_len
}
+GeeArrayList* settings_manager_fetch_preferred (SettingsManager* self) {
+ GeeArrayList* result = NULL;
+ GeeArrayList* _tmp0_;
+ GeeArrayList* list;
+ GSettings* _tmp1_;
+ gchar** _tmp2_;
+ gchar** _tmp3_ = NULL;
+ gchar** preferred;
+ gint preferred_length1;
+ gint _preferred_size_;
+ GeeArrayList* _tmp4_ = NULL;
+ GeeArrayList* interested;
+ gchar** _tmp5_;
+ gint _tmp5__length1;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
+ list = _tmp0_;
+ _tmp1_ = self->priv->settings;
+ _tmp3_ = _tmp2_ = g_settings_get_strv (_tmp1_, "preferred-media-players");
+ preferred = _tmp3_;
+ preferred_length1 = _vala_array_length (_tmp2_);
+ _preferred_size_ = preferred_length1;
+ _tmp4_ = settings_manager_fetch_interested (self);
+ interested = _tmp4_;
+ _tmp5_ = preferred;
+ _tmp5__length1 = preferred_length1;
+ {
+ gchar** s_collection = NULL;
+ gint s_collection_length1 = 0;
+ gint _s_collection_size_ = 0;
+ gint s_it = 0;
+ s_collection = _tmp5_;
+ s_collection_length1 = _tmp5__length1;
+ for (s_it = 0; s_it < _tmp5__length1; s_it = s_it + 1) {
+ gchar* _tmp6_;
+ gchar* s = NULL;
+ _tmp6_ = g_strdup (s_collection[s_it]);
+ s = _tmp6_;
+ {
+ gboolean _tmp7_ = FALSE;
+ GeeArrayList* _tmp8_;
+ const gchar* _tmp9_;
+ gboolean _tmp10_ = FALSE;
+ gboolean _tmp14_;
+ _tmp8_ = list;
+ _tmp9_ = s;
+ _tmp10_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp8_, _tmp9_);
+ if (!_tmp10_) {
+ GeeArrayList* _tmp11_;
+ const gchar* _tmp12_;
+ gboolean _tmp13_ = FALSE;
+ _tmp11_ = interested;
+ _tmp12_ = s;
+ _tmp13_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp11_, _tmp12_);
+ _tmp7_ = _tmp13_;
+ } else {
+ _tmp7_ = FALSE;
+ }
+ _tmp14_ = _tmp7_;
+ if (_tmp14_) {
+ GeeArrayList* _tmp15_;
+ const gchar* _tmp16_;
+ _tmp15_ = list;
+ _tmp16_ = s;
+ gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_);
+ }
+ _g_free0 (s);
+ }
+ }
+ }
+ result = list;
+ _g_object_unref0 (interested);
+ preferred = (_vala_array_free (preferred, preferred_length1, (GDestroyNotify) g_free), NULL);
+ return result;
+}
+
+
static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle) {
int i;
for (i = 0; i < stack_length; i++) {
@@ -128,83 +208,81 @@ static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gc
GeeArrayList* settings_manager_fetch_interested (SettingsManager* self) {
GeeArrayList* result = NULL;
- GSettings* _tmp0_;
- gchar** _tmp1_;
- gchar** _tmp2_ = NULL;
+ gint _tmp0_ = 0;
+ gchar** _tmp1_ = NULL;
gchar** blacklisted;
gint blacklisted_length1;
gint _blacklisted_size_;
- GSettings* _tmp3_;
- gchar** _tmp4_;
- gchar** _tmp5_ = NULL;
+ GSettings* _tmp2_;
+ gchar** _tmp3_;
+ gchar** _tmp4_ = NULL;
gchar** interested;
gint interested_length1;
gint _interested_size_;
- GeeArrayList* _tmp6_;
+ GeeArrayList* _tmp5_;
GeeArrayList* list;
- gchar** _tmp7_;
- gint _tmp7__length1;
+ gchar** _tmp6_;
+ gint _tmp6__length1;
g_return_val_if_fail (self != NULL, NULL);
- _tmp0_ = self->priv->settings;
- _tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "blacklisted-media-players");
- blacklisted = _tmp2_;
- blacklisted_length1 = _vala_array_length (_tmp1_);
+ _tmp1_ = settings_manager_fetch_blacklist (self, &_tmp0_);
+ blacklisted = _tmp1_;
+ blacklisted_length1 = _tmp0_;
_blacklisted_size_ = blacklisted_length1;
- _tmp3_ = self->priv->settings;
- _tmp5_ = _tmp4_ = g_settings_get_strv (_tmp3_, "interested-media-players");
- interested = _tmp5_;
- interested_length1 = _vala_array_length (_tmp4_);
+ _tmp2_ = self->priv->settings;
+ _tmp4_ = _tmp3_ = g_settings_get_strv (_tmp2_, "interested-media-players");
+ interested = _tmp4_;
+ interested_length1 = _vala_array_length (_tmp3_);
_interested_size_ = interested_length1;
- _tmp6_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
- list = _tmp6_;
- _tmp7_ = interested;
- _tmp7__length1 = interested_length1;
+ _tmp5_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
+ list = _tmp5_;
+ _tmp6_ = interested;
+ _tmp6__length1 = interested_length1;
{
gchar** s_collection = NULL;
gint s_collection_length1 = 0;
gint _s_collection_size_ = 0;
gint s_it = 0;
- s_collection = _tmp7_;
- s_collection_length1 = _tmp7__length1;
- for (s_it = 0; s_it < _tmp7__length1; s_it = s_it + 1) {
- gchar* _tmp8_;
+ s_collection = _tmp6_;
+ s_collection_length1 = _tmp6__length1;
+ for (s_it = 0; s_it < _tmp6__length1; s_it = s_it + 1) {
+ gchar* _tmp7_;
gchar* s = NULL;
- _tmp8_ = g_strdup (s_collection[s_it]);
- s = _tmp8_;
+ _tmp7_ = g_strdup (s_collection[s_it]);
+ s = _tmp7_;
{
- const gchar* _tmp9_;
- GeeArrayList* _tmp11_;
- const gchar* _tmp12_;
- gboolean _tmp13_ = FALSE;
- const gchar* _tmp14_;
- gchar** _tmp15_;
- gint _tmp15__length1;
- GeeArrayList* _tmp16_;
- const gchar* _tmp17_;
- _tmp9_ = s;
- if (g_strcmp0 (_tmp9_, "banshee-1") == 0) {
- gchar* _tmp10_;
- _tmp10_ = g_strdup ("banshee");
+ const gchar* _tmp8_;
+ GeeArrayList* _tmp10_;
+ const gchar* _tmp11_;
+ gboolean _tmp12_ = FALSE;
+ const gchar* _tmp13_;
+ gchar** _tmp14_;
+ gint _tmp14__length1;
+ GeeArrayList* _tmp15_;
+ const gchar* _tmp16_;
+ _tmp8_ = s;
+ if (g_strcmp0 (_tmp8_, "banshee-1") == 0) {
+ gchar* _tmp9_;
+ _tmp9_ = g_strdup ("banshee");
_g_free0 (s);
- s = _tmp10_;
+ s = _tmp9_;
}
- _tmp11_ = list;
- _tmp12_ = s;
- _tmp13_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp11_, _tmp12_);
- if (_tmp13_) {
+ _tmp10_ = list;
+ _tmp11_ = s;
+ _tmp12_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp10_, _tmp11_);
+ if (_tmp12_) {
_g_free0 (s);
continue;
}
- _tmp14_ = s;
- _tmp15_ = blacklisted;
- _tmp15__length1 = blacklisted_length1;
- if (_vala_string_array_contains (_tmp15_, _tmp15__length1, _tmp14_)) {
+ _tmp13_ = s;
+ _tmp14_ = blacklisted;
+ _tmp14__length1 = blacklisted_length1;
+ if (_vala_string_array_contains (_tmp14_, _tmp14__length1, _tmp13_)) {
_g_free0 (s);
continue;
}
- _tmp16_ = list;
- _tmp17_ = s;
- gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_);
+ _tmp15_ = list;
+ _tmp16_ = s;
+ gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_);
_g_free0 (s);
}
}
@@ -381,6 +459,17 @@ static void settings_manager_on_blacklist_event (SettingsManager* self) {
}
+static void settings_manager_on_preferred_event (SettingsManager* self) {
+ GeeArrayList* _tmp0_ = NULL;
+ GeeArrayList* _tmp1_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = settings_manager_fetch_preferred (self);
+ _tmp1_ = _tmp0_;
+ g_signal_emit_by_name (self, "preferred-updates", _tmp1_);
+ _g_object_unref0 (_tmp1_);
+}
+
+
static void g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
typedef void (*GMarshalFunc_VOID__BOXED_INT) (gpointer data1, gpointer arg_1, gint arg_2, gpointer data2);
register GMarshalFunc_VOID__BOXED_INT callback;
@@ -406,12 +495,18 @@ static void _settings_manager_on_blacklist_event_g_settings_changed (GSettings*
}
+static void _settings_manager_on_preferred_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) {
+ settings_manager_on_preferred_event (self);
+}
+
+
static GObject * settings_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
GObject * obj;
GObjectClass * parent_class;
SettingsManager * self;
GSettings* _tmp0_;
GSettings* _tmp1_;
+ GSettings* _tmp2_;
parent_class = G_OBJECT_CLASS (settings_manager_parent_class);
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = SETTINGS_MANAGER (obj);
@@ -420,6 +515,8 @@ static GObject * settings_manager_constructor (GType type, guint n_construct_pro
self->priv->settings = _tmp0_;
_tmp1_ = self->priv->settings;
g_signal_connect_object (_tmp1_, "changed::blacklisted-media-players", (GCallback) _settings_manager_on_blacklist_event_g_settings_changed, self, 0);
+ _tmp2_ = self->priv->settings;
+ g_signal_connect_object (_tmp2_, "changed::preferred-media-players", (GCallback) _settings_manager_on_preferred_event_g_settings_changed, self, 0);
return obj;
}
@@ -430,6 +527,7 @@ static void settings_manager_class_init (SettingsManagerClass * klass) {
G_OBJECT_CLASS (klass)->constructor = settings_manager_constructor;
G_OBJECT_CLASS (klass)->finalize = settings_manager_finalize;
g_signal_new ("blacklist_updates", TYPE_SETTINGS_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOXED_INT, G_TYPE_NONE, 2, G_TYPE_STRV, G_TYPE_INT);
+ g_signal_new ("preferred_updates", TYPE_SETTINGS_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GEE_TYPE_ARRAY_LIST);
}
diff --git a/src/settings-manager.vala b/src/settings-manager.vala
index d57241e..458ac21 100644
--- a/src/settings-manager.vala
+++ b/src/settings-manager.vala
@@ -22,12 +22,14 @@ public class SettingsManager : GLib.Object
{
private Settings settings;
public signal void blacklist_updates ( string[] new_blacklist );
+ public signal void preferred_updates (Gee.ArrayList<string> new_preferred);
public SettingsManager ( ){
}
construct{
this.settings = new Settings ("com.canonical.indicator.sound");
- this.settings.changed["blacklisted-media-players"].connect (on_blacklist_event);
+ this.settings.changed["blacklisted-media-players"].connect (on_blacklist_event);
+ this.settings.changed["preferred-media-players"].connect (on_preferred_event);
}
public string[] fetch_blacklist()
@@ -35,9 +37,24 @@ public class SettingsManager : GLib.Object
return this.settings.get_strv ("blacklisted-media-players");
}
+ public ArrayList<string> fetch_preferred()
+ {
+ var list = new ArrayList<string>();
+
+ var preferred = this.settings.get_strv ("preferred-media-players");
+ var interested = fetch_interested ();
+
+ foreach (var s in preferred) {
+ if (!(s in list) && interested.contains (s))
+ list.add (s);
+ }
+
+ return list;
+ }
+
public ArrayList<string> fetch_interested()
{
- var blacklisted = this.settings.get_strv ("blacklisted-media-players");
+ var blacklisted = fetch_blacklist ();
var interested = this.settings.get_strv ("interested-media-players");
var list = new ArrayList<string>();
foreach(var s in interested){
@@ -91,6 +108,11 @@ public class SettingsManager : GLib.Object
this.blacklist_updates(this.settings.get_strv ("blacklisted-media-players"));
}
+ private void on_preferred_event()
+ {
+ this.preferred_updates (this.fetch_preferred());
+ }
+
// Convenient debug method inorder to provide visability over
// the contents of both interested and blacklisted containers in its gsettings
/**
diff --git a/src/specific-items-manager.c b/src/specific-items-manager.c
index 2c3fbf8..3c51f0a 100644
--- a/src/specific-items-manager.c
+++ b/src/specific-items-manager.c
@@ -1,4 +1,4 @@
-/* specific-items-manager.c generated by valac 0.14.2, the Vala compiler
+/* specific-items-manager.c generated by valac 0.16.1, the Vala compiler
* generated from specific-items-manager.vala, do not modify */
/*
@@ -134,7 +134,7 @@ static void specific_items_manager_set_owner (SpecificItemsManager* self, Player
static PlayerController* specific_items_manager_get_owner (SpecificItemsManager* self);
const gchar* player_controller_get_dbus_name (PlayerController* self);
static void specific_items_manager_on_root_changed (SpecificItemsManager* self, GObject* newroot);
-static void _specific_items_manager_on_root_changed_dbusmenu_client_root_changed (DbusmenuClient* _sender, GObject* object, gpointer self);
+static void _specific_items_manager_on_root_changed_dbusmenu_client_root_changed (DbusmenuClient* _sender, GObject* arg1, gpointer self);
static gint specific_items_manager_figure_out_positioning (SpecificItemsManager* self);
gint player_controller_get_menu_offset (PlayerController* self);
#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4
@@ -144,9 +144,9 @@ GType player_item_get_type (void) G_GNUC_CONST;
GType mpris2_controller_get_type (void) G_GNUC_CONST;
static gboolean _bool_equal (const gboolean* s1, const gboolean* s2);
static void specific_items_manager_on_child_added (SpecificItemsManager* self, GObject* child, guint position);
-static void _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added (DbusmenuMenuitem* _sender, GObject* position, guint p0, gpointer self);
+static void _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added (DbusmenuMenuitem* _sender, GObject* position, guint arg2, gpointer self);
static void specific_items_manager_on_child_removed (SpecificItemsManager* self, GObject* child);
-static void _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed (DbusmenuMenuitem* _sender, GObject* object, gpointer self);
+static void _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed (DbusmenuMenuitem* _sender, GObject* arg1, gpointer self);
static void specific_items_manager_set_proxy_items (SpecificItemsManager* self, GeeArrayList* value);
static GObject * specific_items_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void specific_items_manager_finalize (GObject* obj);
@@ -166,8 +166,8 @@ GType specific_items_manager_category_get_type (void) {
}
-static void _specific_items_manager_on_root_changed_dbusmenu_client_root_changed (DbusmenuClient* _sender, GObject* object, gpointer self) {
- specific_items_manager_on_root_changed (self, object);
+static void _specific_items_manager_on_root_changed_dbusmenu_client_root_changed (DbusmenuClient* _sender, GObject* arg1, gpointer self) {
+ specific_items_manager_on_root_changed (self, arg1);
}
@@ -304,13 +304,13 @@ static gpointer _g_object_ref0 (gpointer self) {
}
-static void _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added (DbusmenuMenuitem* _sender, GObject* position, guint p0, gpointer self) {
- specific_items_manager_on_child_added (self, position, p0);
+static void _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added (DbusmenuMenuitem* _sender, GObject* position, guint arg2, gpointer self) {
+ specific_items_manager_on_child_added (self, position, arg2);
}
-static void _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed (DbusmenuMenuitem* _sender, GObject* object, gpointer self) {
- specific_items_manager_on_child_removed (self, object);
+static void _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed (DbusmenuMenuitem* _sender, GObject* arg1, gpointer self) {
+ specific_items_manager_on_child_removed (self, arg1);
}
diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c
index 4fb493a..76f5a4c 100644
--- a/src/transport-menu-item.c
+++ b/src/transport-menu-item.c
@@ -1,4 +1,4 @@
-/* transport-menu-item.c generated by valac 0.14.2, the Vala compiler
+/* transport-menu-item.c generated by valac 0.16.1, the Vala compiler
* generated from transport-menu-item.vala, do not modify */
/*
diff --git a/src/transport-widget.c b/src/transport-widget.c
index 09bb302..0931e1d 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -1849,11 +1849,6 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property,
//g_debug("transport_widget_update_state - with value %i", new_state);
if (new_state == TRANSPORT_STATE_LAUNCHING){
#if GTK_CHECK_VERSION(3, 0, 0)
- gtk_style_context_notify_state_change (spinner_style_context,
- gtk_widget_get_window ( GTK_WIDGET(userdata)),
- NULL,
- GTK_STATE_FLAG_ACTIVE,
- TRUE);
gtk_style_context_set_state (spinner_style_context, GTK_STATE_FLAG_ACTIVE);
#endif
diff --git a/src/volume-widget.c b/src/volume-widget.c
index ac603c1..1258c20 100644
--- a/src/volume-widget.c
+++ b/src/volume-widget.c
@@ -135,16 +135,28 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property,
if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_LEVEL, property) == 0){
g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE) );
+ gdouble update = g_variant_get_double (value);
+
if(priv->grabbed == FALSE){
GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
GtkRange *range = (GtkRange*)slider;
- gdouble update = g_variant_get_double (value);
gtk_range_set_value(range, update);
/*
g_debug ("volume-widget::volume_widget_property_update - volume - value %f", update);
-*/
- update_accessible_desc(priv->indicator);
+ AtkObject* atk_object;
+ atk_object = gtk_widget_get_accessible (priv->ido_volume_slider);
+ if (atk_object != NULL){
+ atk_object_set_name (atk_object, desc);
+
+ }*/
}
+ gchar* desc = g_strdup_printf(_("Volume (%'.0f%%)"),
+ update);
+ dbusmenu_menuitem_property_set (priv->twin_item,
+ DBUSMENU_MENUITEM_PROP_ACCESSIBLE_DESC,
+ desc);
+ g_free (desc);
+ update_accessible_desc(priv->indicator);
}
else if(g_ascii_strcasecmp(DBUSMENU_VOLUME_MENUITEM_MUTE, property) == 0){
g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_BOOLEAN));
@@ -196,6 +208,13 @@ volume_widget_set_twin_item(VolumeWidget* self,
initial_level = 0;
}
gtk_range_set_value(range, initial_level);
+ gchar* desc = g_strdup_printf(_("Volume (%'.0f%%)"),
+ initial_level);
+ dbusmenu_menuitem_property_set (priv->twin_item,
+ DBUSMENU_MENUITEM_PROP_ACCESSIBLE_DESC,
+ desc);
+ g_free (desc);
+
}
static gboolean