aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure24
-rw-r--r--configure.ac10
-rw-r--r--debian/changelog16
-rw-r--r--debian/control4
-rw-r--r--src/common-defs.h14
-rw-r--r--src/freedesktop-interfaces.c200
-rw-r--r--src/gen-sound-service.xml.c6
-rw-r--r--src/indicator-sound.c26
-rw-r--r--src/indicator-sound.h3
-rw-r--r--src/mpris2-controller.c92
-rw-r--r--src/mpris2-controller.vala33
-rw-r--r--src/mpris2-interfaces.c531
-rw-r--r--src/mpris2-interfaces.vala1
-rw-r--r--src/music-player-bridge.h26
-rw-r--r--src/playlists-menu-item.c159
-rw-r--r--src/playlists-menu-item.vala19
-rw-r--r--src/slider-menu-item.c3
-rw-r--r--src/sound-service-dbus.c61
-rw-r--r--src/sound-service.c2
-rw-r--r--src/sound-service.xml6
-rw-r--r--src/sound-state-manager.c2
-rw-r--r--src/transport-menu-item.c49
-rw-r--r--src/transport-menu-item.vala15
-rw-r--r--src/transport-widget.c233
-rw-r--r--src/transport-widget.h25
-rw-r--r--src/voip-input-widget.c4
-rw-r--r--src/volume-widget.c37
-rw-r--r--vapi/common-defs.vapi26
28 files changed, 978 insertions, 649 deletions
diff --git a/configure b/configure
index 283289a..abd39c0 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for indicator-sound 0.6.2.
+# Generated by GNU Autoconf 2.67 for indicator-sound 0.6.3.
#
# Report bugs to <conor.curran@canonical.com>.
#
@@ -761,8 +761,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='indicator-sound'
PACKAGE_TARNAME='indicator-sound'
-PACKAGE_VERSION='0.6.2'
-PACKAGE_STRING='indicator-sound 0.6.2'
+PACKAGE_VERSION='0.6.3'
+PACKAGE_STRING='indicator-sound 0.6.3'
PACKAGE_BUGREPORT='conor.curran@canonical.com'
PACKAGE_URL=''
@@ -1564,7 +1564,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures indicator-sound 0.6.2 to adapt to many kinds of systems.
+\`configure' configures indicator-sound 0.6.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1634,7 +1634,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of indicator-sound 0.6.2:";;
+ short | recursive ) echo "Configuration of indicator-sound 0.6.3:";;
esac
cat <<\_ACEOF
@@ -1767,7 +1767,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-indicator-sound configure 0.6.2
+indicator-sound configure 0.6.3
generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2136,7 +2136,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by indicator-sound $as_me 0.6.2, which was
+It was created by indicator-sound $as_me 0.6.3, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
@@ -2956,7 +2956,7 @@ fi
# Define the identity of the package.
PACKAGE=indicator-sound
- VERSION=0.6.2
+ VERSION=0.6.3
cat >>confdefs.h <<_ACEOF
@@ -12125,11 +12125,11 @@ AM_BACKSLASH='\'
GTK_REQUIRED_VERSION=2.12
INDICATOR_REQUIRED_VERSION=0.3.19
-DBUSMENUGTK_REQUIRED_VERSION=0.3.9
+DBUSMENUGTK_REQUIRED_VERSION=0.3.101
POLKIT_REQUIRED_VERSION=0.92
PULSE_AUDIO_REQUIRED_VERSION=0.9.19
INDICATOR_DISPLAY_OBJECTS=0.1.11
-DBUSMENUGLIB_REQUIRED_VERSION=0.3.9
+DBUSMENUGLIB_REQUIRED_VERSION=0.3.101
GIO_2_0_REQUIRED_VERSION=2.25.13
LIBNOTIFY_REQUIRED_VERSION=0.7.0
@@ -14349,7 +14349,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by indicator-sound $as_me 0.6.2, which was
+This file was extended by indicator-sound $as_me 0.6.3, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14415,7 +14415,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-indicator-sound config.status 0.6.2
+indicator-sound config.status 0.6.3
configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 4446e2b..88535b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
-AC_INIT(indicator-sound, 0.6.2, conor.curran@canonical.com)
+AC_INIT(indicator-sound, 0.6.3, conor.curran@canonical.com)
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-sound, 0.6.2)
+AM_INIT_AUTOMAKE(indicator-sound, 0.6.3)
AM_MAINTAINER_MODE
@@ -25,15 +25,15 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
###########################
# Dependencies
-###########################
+###########################
GTK_REQUIRED_VERSION=2.12
INDICATOR_REQUIRED_VERSION=0.3.19
-DBUSMENUGTK_REQUIRED_VERSION=0.3.9
+DBUSMENUGTK_REQUIRED_VERSION=0.3.101
POLKIT_REQUIRED_VERSION=0.92
PULSE_AUDIO_REQUIRED_VERSION=0.9.19
INDICATOR_DISPLAY_OBJECTS=0.1.11
-DBUSMENUGLIB_REQUIRED_VERSION=0.3.9
+DBUSMENUGLIB_REQUIRED_VERSION=0.3.101
GIO_2_0_REQUIRED_VERSION=2.25.13
LIBNOTIFY_REQUIRED_VERSION=0.7.0
diff --git a/debian/changelog b/debian/changelog
index 24e298f..8eb89ee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,19 @@
+indicator-sound (0.6.3-0ubuntu1) natty; urgency=low
+
+ * New upstream release.
+ - Broken images on playlist items (LP: #727325)
+ - wrong icon for audio-input slider (LP: #723254)
+ - blacklist dbus api lacks query functionality (LP: #730526)
+ - volume goes to zero when using some players like banshee,
+ rhythmbox (LP: #730925)
+ - holding the FW or RW button should have an effect (LP: #694258)
+ - With new notify-osd the volume notification on scroll doesn't work as
+ expected (LP: #729849)
+ * debian/control
+ - Bumped build depends for dbusmenu to >= 0.3.101
+
+ -- Ken VanDine <ken.vandine@canonical.com> Fri, 11 Mar 2011 12:47:26 -0500
+
indicator-sound (0.6.2-0ubuntu1) natty; urgency=low
* New upstream release.
diff --git a/debian/control b/debian/control
index 96132b3..c02a4d0 100644
--- a/debian/control
+++ b/debian/control
@@ -8,8 +8,8 @@ Build-Depends: debhelper (>= 7),
autotools-dev,
libglib2.0-dev (>= 2.22.3),
libgtk2.0-dev (>= 2.12.0),
- libdbusmenu-glib-dev (>= 0.3.97),
- libdbusmenu-gtk-dev (>= 0.3.91) ,
+ libdbusmenu-glib-dev (>= 0.3.101),
+ libdbusmenu-gtk-dev (>= 0.3.101) ,
libindicator-dev (>= 0.3.19),
libpulse-dev (>= 0.9.18),
libpulse-mainloop-glib0 (>= 0.9.18),
diff --git a/src/common-defs.h b/src/common-defs.h
index 2184a48..da504de 100644
--- a/src/common-defs.h
+++ b/src/common-defs.h
@@ -31,6 +31,20 @@ typedef enum {
AVAILABLE
}SoundState;
+typedef enum {
+ TRANSPORT_ACTION_PREVIOUS,
+ TRANSPORT_ACTION_PLAY_PAUSE,
+ TRANSPORT_ACTION_NEXT,
+ TRANSPORT_ACTION_REWIND,
+ TRANSPORT_ACTION_FORWIND,
+ TRANSPORT_ACTION_NO_ACTION
+}TransportAction;
+
+typedef enum {
+ TRANSPORT_STATE_PLAYING,
+ TRANSPORT_STATE_PAUSED
+}TransportState;
+
#define NOT_ACTIVE -1
#define DBUSMENU_PROPERTY_EMPTY -1
diff --git a/src/freedesktop-interfaces.c b/src/freedesktop-interfaces.c
index b687cc8..c91cdb9 100644
--- a/src/freedesktop-interfaces.c
+++ b/src/freedesktop-interfaces.c
@@ -233,21 +233,21 @@ static void free_desktop_object_proxy_class_init (FreeDesktopObjectProxyClass* k
static void _dbus_handle_free_desktop_object_name_owner_changed (FreeDesktopObject* self, GVariant* parameters) {
GVariantIter _arguments_iter;
gchar* name = NULL;
- GVariant* _tmp76_;
- gchar* old_owner = NULL;
GVariant* _tmp77_;
- gchar* new_owner = NULL;
+ gchar* old_owner = NULL;
GVariant* _tmp78_;
+ gchar* new_owner = NULL;
+ GVariant* _tmp79_;
g_variant_iter_init (&_arguments_iter, parameters);
- _tmp76_ = g_variant_iter_next_value (&_arguments_iter);
- name = g_variant_dup_string (_tmp76_, NULL);
- g_variant_unref (_tmp76_);
_tmp77_ = g_variant_iter_next_value (&_arguments_iter);
- old_owner = g_variant_dup_string (_tmp77_, NULL);
+ name = g_variant_dup_string (_tmp77_, NULL);
g_variant_unref (_tmp77_);
_tmp78_ = g_variant_iter_next_value (&_arguments_iter);
- new_owner = g_variant_dup_string (_tmp78_, NULL);
+ old_owner = g_variant_dup_string (_tmp78_, NULL);
g_variant_unref (_tmp78_);
+ _tmp79_ = g_variant_iter_next_value (&_arguments_iter);
+ new_owner = g_variant_dup_string (_tmp79_, NULL);
+ g_variant_unref (_tmp79_);
g_signal_emit_by_name (self, "name-owner-changed", name, old_owner, new_owner);
_g_free0 (name);
_g_free0 (old_owner);
@@ -293,13 +293,13 @@ static gchar** free_desktop_object_proxy_list_names_finish (FreeDesktopObject* s
GVariantIter _reply_iter;
gchar** _result;
int _result_length1;
- GVariant* _tmp79_;
- gchar** _tmp80_;
- int _tmp80__length;
- int _tmp80__size;
- int _tmp80__length1;
- GVariantIter _tmp81_;
- GVariant* _tmp82_;
+ GVariant* _tmp80_;
+ gchar** _tmp81_;
+ int _tmp81__length;
+ int _tmp81__size;
+ int _tmp81__length1;
+ GVariantIter _tmp82_;
+ GVariant* _tmp83_;
_reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), g_simple_async_result_get_op_res_gpointer ((GSimpleAsyncResult *) _res_), error);
if (!_reply_message) {
return NULL;
@@ -311,24 +311,24 @@ static gchar** free_desktop_object_proxy_list_names_finish (FreeDesktopObject* s
_reply = g_dbus_message_get_body (_reply_message);
g_variant_iter_init (&_reply_iter, _reply);
_result_length1 = 0;
- _tmp79_ = g_variant_iter_next_value (&_reply_iter);
- _tmp80_ = g_new (gchar*, 5);
- _tmp80__length = 0;
- _tmp80__size = 4;
- _tmp80__length1 = 0;
- g_variant_iter_init (&_tmp81_, _tmp79_);
- for (; (_tmp82_ = g_variant_iter_next_value (&_tmp81_)) != NULL; _tmp80__length1++) {
- if (_tmp80__size == _tmp80__length) {
- _tmp80__size = 2 * _tmp80__size;
- _tmp80_ = g_renew (gchar*, _tmp80_, _tmp80__size + 1);
+ _tmp80_ = g_variant_iter_next_value (&_reply_iter);
+ _tmp81_ = g_new (gchar*, 5);
+ _tmp81__length = 0;
+ _tmp81__size = 4;
+ _tmp81__length1 = 0;
+ g_variant_iter_init (&_tmp82_, _tmp80_);
+ for (; (_tmp83_ = g_variant_iter_next_value (&_tmp82_)) != NULL; _tmp81__length1++) {
+ if (_tmp81__size == _tmp81__length) {
+ _tmp81__size = 2 * _tmp81__size;
+ _tmp81_ = g_renew (gchar*, _tmp81_, _tmp81__size + 1);
}
- _tmp80_[_tmp80__length++] = g_variant_dup_string (_tmp82_, NULL);
- g_variant_unref (_tmp82_);
+ _tmp81_[_tmp81__length++] = g_variant_dup_string (_tmp83_, NULL);
+ g_variant_unref (_tmp83_);
}
- _result_length1 = _tmp80__length1;
- _tmp80_[_tmp80__length] = NULL;
- _result = _tmp80_;
- g_variant_unref (_tmp79_);
+ _result_length1 = _tmp81__length1;
+ _tmp81_[_tmp81__length] = NULL;
+ _result = _tmp81_;
+ g_variant_unref (_tmp80_);
*result_length1 = _result_length1;
g_object_unref (_reply_message);
return _result;
@@ -356,9 +356,9 @@ static void _dbus_free_desktop_object_list_names_ready (GObject * source_object,
GVariantBuilder _reply_builder;
gchar** result;
int result_length1 = 0;
- gchar** _tmp83_;
- GVariantBuilder _tmp84_;
- int _tmp85_;
+ gchar** _tmp84_;
+ GVariantBuilder _tmp85_;
+ int _tmp86_;
invocation = _user_data_;
result = free_desktop_object_list_names_finish ((FreeDesktopObject*) source_object, _res_, &result_length1, &error);
if (error) {
@@ -367,13 +367,13 @@ static void _dbus_free_desktop_object_list_names_ready (GObject * source_object,
}
_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
- _tmp83_ = result;
- g_variant_builder_init (&_tmp84_, G_VARIANT_TYPE ("as"));
- for (_tmp85_ = 0; _tmp85_ < result_length1; _tmp85_++) {
- g_variant_builder_add_value (&_tmp84_, g_variant_new_string (*_tmp83_));
- _tmp83_++;
+ _tmp84_ = result;
+ g_variant_builder_init (&_tmp85_, G_VARIANT_TYPE ("as"));
+ for (_tmp86_ = 0; _tmp86_ < result_length1; _tmp86_++) {
+ g_variant_builder_add_value (&_tmp85_, g_variant_new_string (*_tmp84_));
+ _tmp84_++;
}
- g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp84_));
+ g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp85_));
result = (_vala_array_free ( result, result_length1, (GDestroyNotify) g_free), NULL);
_reply = g_variant_builder_end (&_reply_builder);
g_dbus_message_set_body (_reply_message, _reply);
@@ -507,7 +507,7 @@ static gchar* free_desktop_introspectable_proxy_Introspect (FreeDesktopIntrospec
GVariant *_reply;
GVariantIter _reply_iter;
gchar* _result;
- GVariant* _tmp86_;
+ GVariant* _tmp87_;
G_IO_ERROR;
_message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.freedesktop.DBus.Introspectable", "Introspect");
g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
@@ -524,9 +524,9 @@ static gchar* free_desktop_introspectable_proxy_Introspect (FreeDesktopIntrospec
}
_reply = g_dbus_message_get_body (_reply_message);
g_variant_iter_init (&_reply_iter, _reply);
- _tmp86_ = g_variant_iter_next_value (&_reply_iter);
- _result = g_variant_dup_string (_tmp86_, NULL);
- g_variant_unref (_tmp86_);
+ _tmp87_ = g_variant_iter_next_value (&_reply_iter);
+ _result = g_variant_dup_string (_tmp87_, NULL);
+ g_variant_unref (_tmp87_);
g_object_unref (_reply_message);
return _result;
}
@@ -671,53 +671,53 @@ static void free_desktop_properties_proxy_class_init (FreeDesktopPropertiesProxy
static void _dbus_handle_free_desktop_properties_properties_changed (FreeDesktopProperties* self, GVariant* parameters) {
GVariantIter _arguments_iter;
gchar* source = NULL;
- GVariant* _tmp87_;
- GHashTable* changed_properties = NULL;
GVariant* _tmp88_;
- GHashTable* _tmp89_;
- GVariantIter _tmp90_;
- GVariant* _tmp91_;
+ GHashTable* changed_properties = NULL;
+ GVariant* _tmp89_;
+ GHashTable* _tmp90_;
+ GVariantIter _tmp91_;
GVariant* _tmp92_;
+ GVariant* _tmp93_;
gchar** invalid = NULL;
int invalid_length1;
- GVariant* _tmp93_;
- gchar** _tmp94_;
- int _tmp94__length;
- int _tmp94__size;
- int _tmp94__length1;
- GVariantIter _tmp95_;
- GVariant* _tmp96_;
+ GVariant* _tmp94_;
+ gchar** _tmp95_;
+ int _tmp95__length;
+ int _tmp95__size;
+ int _tmp95__length1;
+ GVariantIter _tmp96_;
+ GVariant* _tmp97_;
g_variant_iter_init (&_arguments_iter, parameters);
- _tmp87_ = g_variant_iter_next_value (&_arguments_iter);
- source = g_variant_dup_string (_tmp87_, NULL);
- g_variant_unref (_tmp87_);
_tmp88_ = g_variant_iter_next_value (&_arguments_iter);
- _tmp89_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- g_variant_iter_init (&_tmp90_, _tmp88_);
- while (g_variant_iter_loop (&_tmp90_, "{?*}", &_tmp91_, &_tmp92_)) {
- g_hash_table_insert (_tmp89_, g_variant_dup_string (_tmp91_, NULL), g_variant_get_variant (_tmp92_));
- }
- changed_properties = _tmp89_;
+ source = g_variant_dup_string (_tmp88_, NULL);
g_variant_unref (_tmp88_);
+ _tmp89_ = g_variant_iter_next_value (&_arguments_iter);
+ _tmp90_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ g_variant_iter_init (&_tmp91_, _tmp89_);
+ while (g_variant_iter_loop (&_tmp91_, "{?*}", &_tmp92_, &_tmp93_)) {
+ g_hash_table_insert (_tmp90_, g_variant_dup_string (_tmp92_, NULL), g_variant_get_variant (_tmp93_));
+ }
+ changed_properties = _tmp90_;
+ g_variant_unref (_tmp89_);
invalid_length1 = 0;
- _tmp93_ = g_variant_iter_next_value (&_arguments_iter);
- _tmp94_ = g_new (gchar*, 5);
- _tmp94__length = 0;
- _tmp94__size = 4;
- _tmp94__length1 = 0;
- g_variant_iter_init (&_tmp95_, _tmp93_);
- for (; (_tmp96_ = g_variant_iter_next_value (&_tmp95_)) != NULL; _tmp94__length1++) {
- if (_tmp94__size == _tmp94__length) {
- _tmp94__size = 2 * _tmp94__size;
- _tmp94_ = g_renew (gchar*, _tmp94_, _tmp94__size + 1);
+ _tmp94_ = g_variant_iter_next_value (&_arguments_iter);
+ _tmp95_ = g_new (gchar*, 5);
+ _tmp95__length = 0;
+ _tmp95__size = 4;
+ _tmp95__length1 = 0;
+ g_variant_iter_init (&_tmp96_, _tmp94_);
+ for (; (_tmp97_ = g_variant_iter_next_value (&_tmp96_)) != NULL; _tmp95__length1++) {
+ if (_tmp95__size == _tmp95__length) {
+ _tmp95__size = 2 * _tmp95__size;
+ _tmp95_ = g_renew (gchar*, _tmp95_, _tmp95__size + 1);
}
- _tmp94_[_tmp94__length++] = g_variant_dup_string (_tmp96_, NULL);
- g_variant_unref (_tmp96_);
+ _tmp95_[_tmp95__length++] = g_variant_dup_string (_tmp97_, NULL);
+ g_variant_unref (_tmp97_);
}
- invalid_length1 = _tmp94__length1;
- _tmp94_[_tmp94__length] = NULL;
- invalid = _tmp94_;
- g_variant_unref (_tmp93_);
+ invalid_length1 = _tmp95__length1;
+ _tmp95_[_tmp95__length] = NULL;
+ invalid = _tmp95_;
+ g_variant_unref (_tmp94_);
g_signal_emit_by_name (self, "properties-changed", source, changed_properties, invalid, invalid_length1);
_g_free0 (source);
_g_hash_table_unref0 (changed_properties);
@@ -772,34 +772,34 @@ static void _dbus_free_desktop_properties_properties_changed (GObject* _sender,
const gchar * _path;
GVariant *_arguments;
GVariantBuilder _arguments_builder;
- GVariantBuilder _tmp97_;
- GHashTableIter _tmp98_;
- gpointer _tmp99_;
+ GVariantBuilder _tmp98_;
+ GHashTableIter _tmp99_;
gpointer _tmp100_;
- gchar** _tmp101_;
- GVariantBuilder _tmp102_;
- int _tmp103_;
+ gpointer _tmp101_;
+ gchar** _tmp102_;
+ GVariantBuilder _tmp103_;
+ int _tmp104_;
_connection = _data[1];
_path = _data[2];
g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (source));
- g_hash_table_iter_init (&_tmp98_, changed_properties);
- g_variant_builder_init (&_tmp97_, G_VARIANT_TYPE ("a{sv}"));
- while (g_hash_table_iter_next (&_tmp98_, &_tmp99_, &_tmp100_)) {
+ g_hash_table_iter_init (&_tmp99_, changed_properties);
+ g_variant_builder_init (&_tmp98_, G_VARIANT_TYPE ("a{sv}"));
+ while (g_hash_table_iter_next (&_tmp99_, &_tmp100_, &_tmp101_)) {
gchar* _key;
GVariant* _value;
- _key = (gchar*) _tmp99_;
- _value = (GVariant*) _tmp100_;
- g_variant_builder_add (&_tmp97_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
+ _key = (gchar*) _tmp100_;
+ _value = (GVariant*) _tmp101_;
+ g_variant_builder_add (&_tmp98_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
}
- g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp97_));
- _tmp101_ = invalid;
- g_variant_builder_init (&_tmp102_, G_VARIANT_TYPE ("as"));
- for (_tmp103_ = 0; _tmp103_ < invalid_length1; _tmp103_++) {
- g_variant_builder_add_value (&_tmp102_, g_variant_new_string (*_tmp101_));
- _tmp101_++;
+ g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp98_));
+ _tmp102_ = invalid;
+ g_variant_builder_init (&_tmp103_, G_VARIANT_TYPE ("as"));
+ for (_tmp104_ = 0; _tmp104_ < invalid_length1; _tmp104_++) {
+ g_variant_builder_add_value (&_tmp103_, g_variant_new_string (*_tmp102_));
+ _tmp102_++;
}
- g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp102_));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp103_));
_arguments = g_variant_builder_end (&_arguments_builder);
g_dbus_connection_emit_signal (_connection, NULL, _path, "org.freedesktop.DBus.Properties", "PropertiesChanged", _arguments, NULL);
}
diff --git a/src/gen-sound-service.xml.c b/src/gen-sound-service.xml.c
index ebd7879..2590cae 100644
--- a/src/gen-sound-service.xml.c
+++ b/src/gen-sound-service.xml.c
@@ -8,6 +8,12 @@ const char * _sound_service =
" <arg type='b' name='blacklist' direction=\"in\"/>\n"
" <arg type='b' name='result' direction=\"out\"/>\n"
" </method>\n"
+" <method name = \"IsBlacklisted\">\n"
+" <annotation name=\"org.freedesktop.DBus.GLib.Async\" value=\"true\"/>\n"
+" <arg type='s' name='player_desktop_name' direction=\"in\"/>\n"
+" <arg type='b' name='result' direction=\"out\"/>\n"
+" </method>\n"
+"\n"
" <method name = \"GetSoundState\">\n"
" <annotation name=\"org.freedesktop.DBus.GLib.Async\" value=\"true\"/>\n"
" <arg type='i' name='current_state' direction=\"out\"/>\n"
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index 6e1acc9..a7d3808 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -532,17 +532,17 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data)
switch (event->keyval) {
case GDK_Right:
transport_widget_react_to_key_press_event ( transport_widget,
- TRANSPORT_NEXT );
+ TRANSPORT_ACTION_NEXT );
digested = TRUE;
break;
case GDK_Left:
transport_widget_react_to_key_press_event ( transport_widget,
- TRANSPORT_PREVIOUS );
+ TRANSPORT_ACTION_PREVIOUS );
digested = TRUE;
break;
case GDK_KEY_space:
transport_widget_react_to_key_press_event ( transport_widget,
- TRANSPORT_PLAY_PAUSE );
+ TRANSPORT_ACTION_PLAY_PAUSE );
digested = TRUE;
break;
case GDK_Up:
@@ -587,17 +587,17 @@ key_release_cb(GtkWidget* widget, GdkEventKey* event, gpointer data)
switch (event->keyval) {
case GDK_Right:
transport_widget_react_to_key_release_event ( transport_widget,
- TRANSPORT_NEXT );
+ TRANSPORT_ACTION_NEXT );
digested = TRUE;
break;
case GDK_Left:
transport_widget_react_to_key_release_event ( transport_widget,
- TRANSPORT_PREVIOUS );
+ TRANSPORT_ACTION_PREVIOUS );
digested = TRUE;
break;
case GDK_KEY_space:
transport_widget_react_to_key_release_event ( transport_widget,
- TRANSPORT_PLAY_PAUSE );
+ TRANSPORT_ACTION_PLAY_PAUSE );
digested = TRUE;
break;
case GDK_Up:
@@ -640,3 +640,17 @@ indicator_sound_scroll (IndicatorObject *io, gint delta,
sound_state_manager_show_notification (priv->state_manager, value);
}
+
+void
+update_accessible_desc (IndicatorObject * io)
+{
+ GList *entries = indicator_object_get_entries(io);
+ IndicatorObjectEntry * entry = (IndicatorObjectEntry *)entries->data;
+ entry->accessible_desc = get_accessible_desc(io);
+ g_signal_emit(G_OBJECT(io),
+ INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID,
+ 0,
+ entry,
+ TRUE);
+ g_list_free(entries);
+}
diff --git a/src/indicator-sound.h b/src/indicator-sound.h
index 40a3e6f..c945efa 100644
--- a/src/indicator-sound.h
+++ b/src/indicator-sound.h
@@ -53,4 +53,7 @@ struct _IndicatorSound {
// GObject Boiler plate
GType indicator_sound_get_type (void);
+// Update the accessible description
+void update_accessible_desc (IndicatorObject * io);
+
#endif
diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c
index 4b8e59f..4a9b1ff 100644
--- a/src/mpris2-controller.c
+++ b/src/mpris2-controller.c
@@ -25,6 +25,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
+#include <common-defs.h>
#include <gee.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/dbusmenu-glib.h>
@@ -102,8 +103,6 @@ typedef struct _FreeDesktopPropertiesIface FreeDesktopPropertiesIface;
typedef struct _PlayerController PlayerController;
typedef struct _PlayerControllerClass PlayerControllerClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-
-#define TRANSPORT_MENUITEM_TYPE_STATE (transport_menuitem_state_get_type ())
typedef struct _PlayerControllerPrivate PlayerControllerPrivate;
#define TYPE_PLAYER_ITEM (player_item_get_type ())
@@ -141,8 +140,6 @@ typedef struct _TitleMenuitem TitleMenuitem;
typedef struct _TitleMenuitemClass TitleMenuitemClass;
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
-#define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ())
-
#define TYPE_PLAYLISTS_MENUITEM (playlists_menuitem_get_type ())
#define PLAYLISTS_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitem))
#define PLAYLISTS_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYLISTS_MENUITEM, PlaylistsMenuitemClass))
@@ -190,6 +187,8 @@ struct _MprisPlayerIface {
void (*Next_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
void (*Previous) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void (*Previous_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Seek) (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Seek_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
GHashTable* (*get_Metadata) (MprisPlayer* self);
void (*set_Metadata) (MprisPlayer* self, GHashTable* value);
gint32 (*get_Position) (MprisPlayer* self);
@@ -235,11 +234,6 @@ struct _Mpris2ControllerPrivate {
PlayerController* _owner;
};
-typedef enum {
- TRANSPORT_MENUITEM_STATE_PLAYING,
- TRANSPORT_MENUITEM_STATE_PAUSED
-} TransportMenuitemstate;
-
struct _PlayerController {
GObject parent_instance;
PlayerControllerPrivate * priv;
@@ -261,12 +255,6 @@ typedef enum {
PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS
} PlayerControllerwidget_order;
-typedef enum {
- TRANSPORT_MENUITEM_ACTION_PREVIOUS,
- TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE,
- TRANSPORT_MENUITEM_ACTION_NEXT
-} TransportMenuitemaction;
-
struct _Mpris2ControllerFetchPlaylistsData {
int _state_;
GObject* _source_object_;
@@ -336,13 +324,12 @@ MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self);
gchar* mpris_player_get_PlaybackStatus (MprisPlayer* self);
static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controller* self);
static gboolean _mpris2_controller_ensure_correct_playback_status_gsource_func (gpointer self);
-GType transport_menuitem_state_get_type (void) G_GNUC_CONST;
-static TransportMenuitemstate mpris2_controller_determine_play_state (Mpris2Controller* self, const gchar* status);
+static TransportState mpris2_controller_determine_play_state (Mpris2Controller* self, const gchar* status);
PlayerController* mpris2_controller_get_owner (Mpris2Controller* self);
GType player_item_get_type (void) G_GNUC_CONST;
GType player_controller_widget_order_get_type (void) G_GNUC_CONST;
GType transport_menuitem_get_type (void) G_GNUC_CONST;
-void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update);
+void transport_menuitem_change_play_state (TransportMenuitem* self, TransportState update);
static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self);
void player_item_reset (PlayerItem* self, GeeHashSet* attrs);
GeeHashSet* metadata_menuitem_attributes_format (void);
@@ -361,14 +348,15 @@ GHashTable* mpris_player_get_Metadata (MprisPlayer* self);
static GVariant* _variant_new1 (const gchar* value);
static const gchar* _variant_get2 (GVariant* value);
void mpris2_controller_initial_update (Mpris2Controller* self);
-GType transport_menuitem_action_get_type (void) G_GNUC_CONST;
-void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command);
+void mpris2_controller_transport_update (Mpris2Controller* self, TransportAction command);
void mpris_player_PlayPause (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void mpris_player_PlayPause_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Seek (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
gboolean mpris2_controller_connected (Mpris2Controller* self);
void mpris2_controller_expose (Mpris2Controller* self);
void mpris_root_Raise (MprisRoot* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
@@ -487,7 +475,7 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar*
_tmp0_ = _tmp1_ == FALSE;
}
if (_tmp0_) {
- g_warning ("mpris2-controller.vala:70: Property-changed hash is null or this is an" \
+ g_warning ("mpris2-controller.vala:71: Property-changed hash is null or this is an" \
" interface that doesn't concerns us");
return;
}
@@ -497,8 +485,8 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar*
if (play_v != NULL) {
gchar* _tmp4_ = NULL;
gchar* state;
- TransportMenuitemstate _tmp5_;
- TransportMenuitemstate p;
+ TransportState _tmp5_;
+ TransportState p;
gpointer _tmp6_ = NULL;
PlayerItem* _tmp7_;
TransportMenuitem* _tmp8_;
@@ -506,7 +494,7 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar*
state = _tmp4_;
g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, _mpris2_controller_ensure_correct_playback_status_gsource_func, g_object_ref (self), g_object_unref);
_tmp5_ = mpris2_controller_determine_play_state (self, state);
- p = (TransportMenuitemstate) _tmp5_;
+ p = (TransportState) _tmp5_;
_tmp6_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
_tmp8_ = (_tmp7_ = (PlayerItem*) _tmp6_, IS_TRANSPORT_MENUITEM (_tmp7_) ? ((TransportMenuitem*) _tmp7_) : NULL);
transport_menuitem_change_play_state (_tmp8_, p);
@@ -616,9 +604,9 @@ static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controll
gboolean result = FALSE;
gchar* _tmp0_ = NULL;
gchar* _tmp1_;
- TransportMenuitemstate _tmp2_;
- TransportMenuitemstate _tmp3_;
- TransportMenuitemstate p;
+ TransportState _tmp2_;
+ TransportState _tmp3_;
+ TransportState p;
gpointer _tmp4_ = NULL;
PlayerItem* _tmp5_;
TransportMenuitem* _tmp6_;
@@ -626,7 +614,7 @@ static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controll
_tmp0_ = mpris_player_get_PlaybackStatus (self->priv->_player);
_tmp1_ = _tmp0_;
_tmp2_ = mpris2_controller_determine_play_state (self, _tmp1_);
- p = (_tmp3_ = (TransportMenuitemstate) _tmp2_, _g_free0 (_tmp1_), _tmp3_);
+ p = (_tmp3_ = (TransportState) _tmp2_, _g_free0 (_tmp1_), _tmp3_);
_tmp4_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
_tmp6_ = (_tmp5_ = (PlayerItem*) _tmp4_, IS_TRANSPORT_MENUITEM (_tmp5_) ? ((TransportMenuitem*) _tmp5_) : NULL);
transport_menuitem_change_play_state (_tmp6_, p);
@@ -682,13 +670,13 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) {
_tmp9_ = _g_variant_ref0 ((GVariant*) _tmp8_);
v_artists = (_tmp10_ = _tmp9_, _g_hash_table_unref0 (_tmp7_), _tmp10_);
_tmp11_ = g_variant_get_type_string (v_artists);
- g_debug ("mpris2-controller.vala:129: artists is of type %s", _tmp11_);
+ g_debug ("mpris2-controller.vala:130: artists is of type %s", _tmp11_);
_tmp12_ = g_variant_get_type_string (v_artists);
if (g_strcmp0 (_tmp12_, "s") == 0) {
const gchar* _tmp13_ = NULL;
gchar* _tmp14_;
gchar* _tmp15_;
- g_debug ("mpris2-controller.vala:132: SPOTIFY is that you ?");
+ g_debug ("mpris2-controller.vala:133: SPOTIFY is that you ?");
_tmp13_ = g_variant_get_string (v_artists, NULL);
_tmp14_ = g_strdup (_tmp13_);
_tmp15_ = _tmp14_;
@@ -715,7 +703,7 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) {
_tmp20_ = g_strdup ("xesam:artist");
g_hash_table_replace (changed_updates, _tmp20_, _variant_new1 (display_artists));
_tmp21_ = g_hash_table_lookup (changed_updates, "xesam:artist");
- g_debug ("mpris2-controller.vala:140: artist : %s", _variant_get2 ((GVariant*) _tmp21_));
+ g_debug ("mpris2-controller.vala:141: artist : %s", _variant_get2 ((GVariant*) _tmp21_));
_g_free0 (display_artists);
_g_variant_unref0 (v_artists);
}
@@ -725,8 +713,8 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) {
}
-static TransportMenuitemstate mpris2_controller_determine_play_state (Mpris2Controller* self, const gchar* status) {
- TransportMenuitemstate result = 0;
+static TransportState mpris2_controller_determine_play_state (Mpris2Controller* self, const gchar* status) {
+ TransportState result = 0;
gboolean _tmp0_ = FALSE;
g_return_val_if_fail (self != NULL, 0);
if (status != NULL) {
@@ -735,16 +723,16 @@ static TransportMenuitemstate mpris2_controller_determine_play_state (Mpris2Cont
_tmp0_ = FALSE;
}
if (_tmp0_) {
- result = TRANSPORT_MENUITEM_STATE_PLAYING;
+ result = TRANSPORT_STATE_PLAYING;
return result;
}
- result = TRANSPORT_MENUITEM_STATE_PAUSED;
+ result = TRANSPORT_STATE_PAUSED;
return result;
}
void mpris2_controller_initial_update (Mpris2Controller* self) {
- TransportMenuitemstate update = 0;
+ TransportState update = 0;
gchar* _tmp0_ = NULL;
gchar* _tmp1_;
gboolean _tmp2_;
@@ -765,11 +753,11 @@ void mpris2_controller_initial_update (Mpris2Controller* self) {
_tmp0_ = mpris_player_get_PlaybackStatus (self->priv->_player);
_tmp1_ = _tmp0_;
if ((_tmp2_ = _tmp1_ == NULL, _g_free0 (_tmp1_), _tmp2_)) {
- update = TRANSPORT_MENUITEM_STATE_PAUSED;
+ update = TRANSPORT_STATE_PAUSED;
} else {
gchar* _tmp3_ = NULL;
gchar* _tmp4_;
- TransportMenuitemstate _tmp5_;
+ TransportState _tmp5_;
_tmp3_ = mpris_player_get_PlaybackStatus (self->priv->_player);
_tmp4_ = _tmp3_;
_tmp5_ = mpris2_controller_determine_play_state (self, _tmp4_);
@@ -813,16 +801,24 @@ void mpris2_controller_initial_update (Mpris2Controller* self) {
}
-void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command) {
+void mpris2_controller_transport_update (Mpris2Controller* self, TransportAction command) {
g_return_if_fail (self != NULL);
- if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) {
+ if (command == TRANSPORT_ACTION_PLAY_PAUSE) {
mpris_player_PlayPause (self->priv->_player, NULL, NULL);
} else {
- if (command == TRANSPORT_MENUITEM_ACTION_PREVIOUS) {
+ if (command == TRANSPORT_ACTION_PREVIOUS) {
mpris_player_Previous (self->priv->_player, NULL, NULL);
} else {
- if (command == TRANSPORT_MENUITEM_ACTION_NEXT) {
+ if (command == TRANSPORT_ACTION_NEXT) {
mpris_player_Next (self->priv->_player, NULL, NULL);
+ } else {
+ if (command == TRANSPORT_ACTION_REWIND) {
+ mpris_player_Seek (self->priv->_player, (gint64) (-500000), NULL, NULL);
+ } else {
+ if (command == TRANSPORT_ACTION_FORWIND) {
+ mpris_player_Seek (self->priv->_player, (gint64) 400000, NULL, NULL);
+ }
+ }
}
}
}
@@ -968,7 +964,7 @@ static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlayl
{
data->e = data->_inner_error_;
data->_inner_error_ = NULL;
- g_debug ("mpris2-controller.vala:220: Could not fetch playlists because %s", data->e->message);
+ g_debug ("mpris2-controller.vala:229: Could not fetch playlists because %s", data->e->message);
_g_error_free0 (data->e);
data->current_playlists = (_vala_PlaylistDetails_array_free (data->current_playlists, data->current_playlists_length1), NULL);
if (data->_state_ == 0) {
@@ -987,14 +983,14 @@ static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlayl
return FALSE;
}
if (data->current_playlists != NULL) {
- g_debug ("mpris2-controller.vala:225: Size of the playlist array = %i", data->current_playlists_length1);
+ g_debug ("mpris2-controller.vala:234: Size of the playlist array = %i", data->current_playlists_length1);
data->_tmp4_ = NULL;
data->_tmp4_ = gee_abstract_list_get ((GeeAbstractList*) data->self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
data->playlists_item = (data->_tmp5_ = (PlayerItem*) data->_tmp4_, IS_PLAYLISTS_MENUITEM (data->_tmp5_) ? ((PlaylistsMenuitem*) data->_tmp5_) : NULL);
playlists_menuitem_update (data->playlists_item, data->current_playlists, data->current_playlists_length1);
_g_object_unref0 (data->playlists_item);
} else {
- g_warning ("mpris2-controller.vala:230: Playlists are on but its returning no cur" \
+ g_warning ("mpris2-controller.vala:239: Playlists are on but its returning no cur" \
"rent_playlists");
data->_tmp7_ = __bool_dup0 ((data->_tmp6_ = FALSE, &data->_tmp6_));
data->_tmp8_ = data->_tmp7_;
@@ -1026,7 +1022,7 @@ static gboolean mpris2_controller_fetch_active_playlist (Mpris2Controller* self)
mpris_playlists_get_ActivePlaylist (self->priv->_playlists, &_tmp0_);
_tmp1_ = _tmp0_;
if ((_tmp2_ = _tmp1_.valid == FALSE, active_playlist_container_destroy (&_tmp1_), _tmp2_)) {
- g_debug ("mpris2-controller.vala:238: We don't have an active playlist");
+ g_debug ("mpris2-controller.vala:247: We don't have an active playlist");
}
_tmp3_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
playlists_item = (_tmp4_ = (PlayerItem*) _tmp3_, IS_PLAYLISTS_MENUITEM (_tmp4_) ? ((PlaylistsMenuitem*) _tmp4_) : NULL);
@@ -1051,7 +1047,7 @@ void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* pa
GError * e;
e = _inner_error_;
_inner_error_ = NULL;
- g_debug ("mpris2-controller.vala:251: Could not activate playlist %s because %s", (const gchar*) path, e->message);
+ g_debug ("mpris2-controller.vala:260: Could not activate playlist %s because %s", (const gchar*) path, e->message);
_g_error_free0 (e);
}
__finally12:
@@ -1264,7 +1260,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr
GError * e;
e = _inner_error_;
_inner_error_ = NULL;
- g_error ("mpris2-controller.vala:59: Problems connecting to the session bus - %s", e->message);
+ g_error ("mpris2-controller.vala:60: Problems connecting to the session bus - %s", e->message);
_g_error_free0 (e);
}
__finally13:
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index c7305f4..6129458 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Dbusmenu;
+using Transport;
/*
This class will entirely replace mpris-controller.vala hence why there is no
@@ -33,7 +34,7 @@ public class Mpris2Controller : GLib.Object
public Mpris2Controller(PlayerController ctrl)
{
- GLib.Object(owner: ctrl);
+ GLib.Object(owner: ctrl);
}
construct{
@@ -77,7 +78,7 @@ public class Mpris2Controller : GLib.Object
string state = this.player.PlaybackStatus;
//debug("in the property update and the playback status = %s and update = %s", state, (string)play_v);
Timeout.add ( 200, ensure_correct_playback_status );
- TransportMenuitem.state p = (TransportMenuitem.state)this.determine_play_state(state);
+ Transport.State p = (Transport.State)this.determine_play_state(state);
(this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p);
}
Variant? meta_v = changed_properties.lookup("Metadata");
@@ -115,7 +116,7 @@ public class Mpris2Controller : GLib.Object
private bool ensure_correct_playback_status(){
//debug("TEST playback status = %s", this.player.PlaybackStatus);
- TransportMenuitem.state p = (TransportMenuitem.state)this.determine_play_state(this.player.PlaybackStatus);
+ Transport.State p = (Transport.State)this.determine_play_state(this.player.PlaybackStatus);
(this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p);
return false;
}
@@ -142,19 +143,19 @@ public class Mpris2Controller : GLib.Object
return changed_updates;
}
- private TransportMenuitem.state determine_play_state(string? status){
+ private Transport.State determine_play_state(string? status){
if(status != null && status == "Playing"){
- return TransportMenuitem.state.PLAYING;
+ return Transport.State.PLAYING;
}
- return TransportMenuitem.state.PAUSED;
+ return Transport.State.PAUSED;
}
public void initial_update()
{
- TransportMenuitem.state update;
+ Transport.State update;
if(this.player.PlaybackStatus == null){
- update = TransportMenuitem.state.PAUSED;
+ update = Transport.State.PAUSED;
}
else{
update = determine_play_state (this.player.PlaybackStatus);
@@ -174,18 +175,26 @@ public class Mpris2Controller : GLib.Object
}
}
- public void transport_update(TransportMenuitem.action command)
+ public void transport_update(Transport.Action command)
{
//debug("transport_event input = %i", (int)command);
- if(command == TransportMenuitem.action.PLAY_PAUSE){
+ if(command == Transport.Action.PLAY_PAUSE){
this.player.PlayPause.begin();
}
- else if(command == TransportMenuitem.action.PREVIOUS){
+ else if(command == Transport.Action.PREVIOUS){
this.player.Previous.begin();
}
- else if(command == TransportMenuitem.action.NEXT){
+ else if(command == Transport.Action.NEXT){
this.player.Next.begin();
}
+ else if(command == Transport.Action.REWIND){
+ //debug("transport_event rewind = %i", (int)command);
+ this.player.Seek.begin(-500000);
+ }
+ else if(command == Transport.Action.FORWIND){
+ //debug("transport_event input = %i", (int)command);
+ this.player.Seek.begin(400000);
+ }
}
public bool connected()
diff --git a/src/mpris2-interfaces.c b/src/mpris2-interfaces.c
index 8aa2079..2a73d2e 100644
--- a/src/mpris2-interfaces.c
+++ b/src/mpris2-interfaces.c
@@ -96,6 +96,8 @@ struct _MprisPlayerIface {
void (*Next_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
void (*Previous) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void (*Previous_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Seek) (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Seek_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
GHashTable* (*get_Metadata) (MprisPlayer* self);
void (*set_Metadata) (MprisPlayer* self, GHashTable* value);
gint32 (*get_Position) (MprisPlayer* self);
@@ -194,6 +196,8 @@ void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpoin
void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Seek (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
GHashTable* mpris_player_get_Metadata (MprisPlayer* self);
void mpris_player_set_Metadata (MprisPlayer* self, GHashTable* value);
gint32 mpris_player_get_Position (MprisPlayer* self);
@@ -209,6 +213,8 @@ static void mpris_player_proxy_Next_async (MprisPlayer* self, GAsyncReadyCallbac
static void mpris_player_proxy_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
static void mpris_player_proxy_Previous_async (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void mpris_player_proxy_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+static void mpris_player_proxy_Seek_async (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+static void mpris_player_proxy_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
static GHashTable* mpris_player_dbus_proxy_get_Metadata (MprisPlayer* self);
static void mpris_player_dbus_proxy_set_Metadata (MprisPlayer* self, GHashTable* value);
static gint32 mpris_player_dbus_proxy_get_Position (MprisPlayer* self);
@@ -222,6 +228,8 @@ static void _dbus_mpris_player_Next (MprisPlayer* self, GVariant* parameters, GD
static void _dbus_mpris_player_Next_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
static void _dbus_mpris_player_Previous (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation);
static void _dbus_mpris_player_Previous_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
+static void _dbus_mpris_player_Seek (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation);
+static void _dbus_mpris_player_Seek_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_);
static void mpris_player_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
static GVariant* mpris_player_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
static GVariant* _dbus_mpris_player_get_Metadata (MprisPlayer* self);
@@ -314,7 +322,11 @@ static const GDBusMethodInfo _mpris_player_dbus_method_info_Next = {-1, "Next",
static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Previous_in[] = {NULL};
static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Previous_out[] = {NULL};
static const GDBusMethodInfo _mpris_player_dbus_method_info_Previous = {-1, "Previous", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Previous_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Previous_out)};
-static const GDBusMethodInfo * const _mpris_player_dbus_method_info[] = {&_mpris_player_dbus_method_info_PlayPause, &_mpris_player_dbus_method_info_Next, &_mpris_player_dbus_method_info_Previous, NULL};
+static const GDBusArgInfo _mpris_player_dbus_arg_info_Seek_offset = {-1, "offset", "x"};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Seek_in[] = {&_mpris_player_dbus_arg_info_Seek_offset, NULL};
+static const GDBusArgInfo * const _mpris_player_dbus_arg_info_Seek_out[] = {NULL};
+static const GDBusMethodInfo _mpris_player_dbus_method_info_Seek = {-1, "Seek", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Seek_in), (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_Seek_out)};
+static const GDBusMethodInfo * const _mpris_player_dbus_method_info[] = {&_mpris_player_dbus_method_info_PlayPause, &_mpris_player_dbus_method_info_Next, &_mpris_player_dbus_method_info_Previous, &_mpris_player_dbus_method_info_Seek, NULL};
static const GDBusArgInfo _mpris_player_dbus_arg_info_seeked_new_position = {-1, "new_position", "x"};
static const GDBusArgInfo * const _mpris_player_dbus_arg_info_seeked[] = {&_mpris_player_dbus_arg_info_seeked_new_position, NULL};
static const GDBusSignalInfo _mpris_player_dbus_signal_info_seeked = {-1, "Seeked", (GDBusArgInfo **) (&_mpris_player_dbus_arg_info_seeked)};
@@ -1015,6 +1027,16 @@ void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GErro
}
+void mpris_player_Seek (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->Seek (self, offset, _callback_, _user_data_);
+}
+
+
+void mpris_player_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ MPRIS_PLAYER_GET_INTERFACE (self)->Seek_finish (self, _res_, error);
+}
+
+
GHashTable* mpris_player_get_Metadata (MprisPlayer* self) {
return MPRIS_PLAYER_GET_INTERFACE (self)->get_Metadata (self);
}
@@ -1202,6 +1224,35 @@ static void mpris_player_proxy_Previous_finish (MprisPlayer* self, GAsyncResult*
}
+static void mpris_player_proxy_Seek_async (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_) {
+ GDBusMessage *_message;
+ GVariant *_arguments;
+ GVariantBuilder _arguments_builder;
+ G_IO_ERROR;
+ _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Player", "Seek");
+ g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_arguments_builder, g_variant_new_int64 (offset));
+ _arguments = g_variant_builder_end (&_arguments_builder);
+ g_dbus_message_set_body (_message, _arguments);
+ g_dbus_connection_send_message_with_reply (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, _vala_g_async_ready_callback, g_simple_async_result_new ((GObject *) self, _callback_, _user_data_, NULL));
+ g_object_unref (_message);
+}
+
+
+static void mpris_player_proxy_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error) {
+ GDBusMessage *_reply_message;
+ _reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), g_simple_async_result_get_op_res_gpointer ((GSimpleAsyncResult *) _res_), error);
+ if (!_reply_message) {
+ return;
+ }
+ if (g_dbus_message_to_gerror (_reply_message, error)) {
+ g_object_unref (_reply_message);
+ return;
+ }
+ g_object_unref (_reply_message);
+}
+
+
static GHashTable* mpris_player_dbus_proxy_get_Metadata (MprisPlayer* self) {
GVariant *_inner_reply;
GHashTable* _result;
@@ -1363,6 +1414,8 @@ static void mpris_player_proxy_mpris_player_interface_init (MprisPlayerIface* if
iface->Next_finish = mpris_player_proxy_Next_finish;
iface->Previous = mpris_player_proxy_Previous_async;
iface->Previous_finish = mpris_player_proxy_Previous_finish;
+ iface->Seek = mpris_player_proxy_Seek_async;
+ iface->Seek_finish = mpris_player_proxy_Seek_finish;
iface->get_Metadata = mpris_player_dbus_proxy_get_Metadata;
iface->set_Metadata = mpris_player_dbus_proxy_set_Metadata;
iface->get_Position = mpris_player_dbus_proxy_get_Position;
@@ -1459,6 +1512,40 @@ static void _dbus_mpris_player_Previous_ready (GObject * source_object, GAsyncRe
}
+static void _dbus_mpris_player_Seek (MprisPlayer* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
+ GVariantIter _arguments_iter;
+ gint64 offset = 0LL;
+ GVariant* _tmp9_;
+ g_variant_iter_init (&_arguments_iter, parameters);
+ _tmp9_ = g_variant_iter_next_value (&_arguments_iter);
+ offset = g_variant_get_int64 (_tmp9_);
+ g_variant_unref (_tmp9_);
+ mpris_player_Seek (self, offset, (GAsyncReadyCallback) _dbus_mpris_player_Seek_ready, invocation);
+}
+
+
+static void _dbus_mpris_player_Seek_ready (GObject * source_object, GAsyncResult * _res_, gpointer _user_data_) {
+ GDBusMethodInvocation * invocation;
+ GError* error = NULL;
+ GDBusMessage* _reply_message;
+ GVariant* _reply;
+ GVariantBuilder _reply_builder;
+ invocation = _user_data_;
+ mpris_player_Seek_finish ((MprisPlayer*) source_object, _res_, &error);
+ if (error) {
+ g_dbus_method_invocation_return_gerror (invocation, error);
+ return;
+ }
+ _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
+ g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
+ _reply = g_variant_builder_end (&_reply_builder);
+ g_dbus_message_set_body (_reply_message, _reply);
+ g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
+ g_object_unref (invocation);
+ g_object_unref (_reply_message);
+}
+
+
static void mpris_player_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
gpointer* data;
gpointer object;
@@ -1470,6 +1557,8 @@ static void mpris_player_dbus_interface_method_call (GDBusConnection* connection
_dbus_mpris_player_Next (object, parameters, invocation);
} else if (strcmp (method_name, "Previous") == 0) {
_dbus_mpris_player_Previous (object, parameters, invocation);
+ } else if (strcmp (method_name, "Seek") == 0) {
+ _dbus_mpris_player_Seek (object, parameters, invocation);
} else {
g_object_unref (invocation);
}
@@ -1478,22 +1567,22 @@ static void mpris_player_dbus_interface_method_call (GDBusConnection* connection
static GVariant* _dbus_mpris_player_get_Metadata (MprisPlayer* self) {
GHashTable* result;
- GVariantBuilder _tmp9_;
- GHashTableIter _tmp10_;
- gpointer _tmp11_;
+ GVariantBuilder _tmp10_;
+ GHashTableIter _tmp11_;
gpointer _tmp12_;
+ gpointer _tmp13_;
GVariant* _reply;
result = mpris_player_get_Metadata (self);
- g_hash_table_iter_init (&_tmp10_, result);
- g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE ("a{sv}"));
- while (g_hash_table_iter_next (&_tmp10_, &_tmp11_, &_tmp12_)) {
+ g_hash_table_iter_init (&_tmp11_, result);
+ g_variant_builder_init (&_tmp10_, G_VARIANT_TYPE ("a{sv}"));
+ while (g_hash_table_iter_next (&_tmp11_, &_tmp12_, &_tmp13_)) {
gchar* _key;
GVariant* _value;
- _key = (gchar*) _tmp11_;
- _value = (GVariant*) _tmp12_;
- g_variant_builder_add (&_tmp9_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
+ _key = (gchar*) _tmp12_;
+ _value = (GVariant*) _tmp13_;
+ g_variant_builder_add (&_tmp10_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value));
}
- _reply = g_variant_builder_end (&_tmp9_);
+ _reply = g_variant_builder_end (&_tmp10_);
_g_hash_table_unref0 ( result);
return _reply;
}
@@ -1536,16 +1625,16 @@ static GVariant* mpris_player_dbus_interface_get_property (GDBusConnection* conn
static void _dbus_mpris_player_set_Metadata (MprisPlayer* self, GVariant* _value) {
GHashTable* value = NULL;
- GHashTable* _tmp13_;
- GVariantIter _tmp14_;
- GVariant* _tmp15_;
+ GHashTable* _tmp14_;
+ GVariantIter _tmp15_;
GVariant* _tmp16_;
- _tmp13_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- g_variant_iter_init (&_tmp14_, _value);
- while (g_variant_iter_loop (&_tmp14_, "{?*}", &_tmp15_, &_tmp16_)) {
- g_hash_table_insert (_tmp13_, g_variant_dup_string (_tmp15_, NULL), g_variant_get_variant (_tmp16_));
+ GVariant* _tmp17_;
+ _tmp14_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ g_variant_iter_init (&_tmp15_, _value);
+ while (g_variant_iter_loop (&_tmp15_, "{?*}", &_tmp16_, &_tmp17_)) {
+ g_hash_table_insert (_tmp14_, g_variant_dup_string (_tmp16_, NULL), g_variant_get_variant (_tmp17_));
}
- value = _tmp13_;
+ value = _tmp14_;
mpris_player_set_Metadata (self, value);
_g_hash_table_unref0 (value);
}
@@ -1804,26 +1893,26 @@ static void mpris_playlists_proxy_class_init (MprisPlaylistsProxyClass* klass) {
static void _dbus_handle_mpris_playlists_playlist_changed (MprisPlaylists* self, GVariant* parameters) {
GVariantIter _arguments_iter;
PlaylistDetails details = {0};
- GVariant* _tmp17_;
- PlaylistDetails _tmp18_;
- GVariantIter _tmp19_;
- GVariant* _tmp20_;
+ GVariant* _tmp18_;
+ PlaylistDetails _tmp19_;
+ GVariantIter _tmp20_;
GVariant* _tmp21_;
GVariant* _tmp22_;
+ GVariant* _tmp23_;
g_variant_iter_init (&_arguments_iter, parameters);
- _tmp17_ = g_variant_iter_next_value (&_arguments_iter);
- g_variant_iter_init (&_tmp19_, _tmp17_);
- _tmp20_ = g_variant_iter_next_value (&_tmp19_);
- _tmp18_.path = g_variant_dup_string (_tmp20_, NULL);
- g_variant_unref (_tmp20_);
- _tmp21_ = g_variant_iter_next_value (&_tmp19_);
- _tmp18_.name = g_variant_dup_string (_tmp21_, NULL);
+ _tmp18_ = g_variant_iter_next_value (&_arguments_iter);
+ g_variant_iter_init (&_tmp20_, _tmp18_);
+ _tmp21_ = g_variant_iter_next_value (&_tmp20_);
+ _tmp19_.path = g_variant_dup_string (_tmp21_, NULL);
g_variant_unref (_tmp21_);
- _tmp22_ = g_variant_iter_next_value (&_tmp19_);
- _tmp18_.icon_path = g_variant_dup_string (_tmp22_, NULL);
+ _tmp22_ = g_variant_iter_next_value (&_tmp20_);
+ _tmp19_.name = g_variant_dup_string (_tmp22_, NULL);
g_variant_unref (_tmp22_);
- details = _tmp18_;
- g_variant_unref (_tmp17_);
+ _tmp23_ = g_variant_iter_next_value (&_tmp20_);
+ _tmp19_.icon_path = g_variant_dup_string (_tmp23_, NULL);
+ g_variant_unref (_tmp23_);
+ details = _tmp19_;
+ g_variant_unref (_tmp18_);
g_signal_emit_by_name (self, "playlist-changed", &details);
playlist_details_destroy (&details);
}
@@ -1893,13 +1982,13 @@ static PlaylistDetails* mpris_playlists_proxy_GetPlaylists_finish (MprisPlaylist
GVariantIter _reply_iter;
PlaylistDetails* _result;
int _result_length1;
- GVariant* _tmp23_;
- PlaylistDetails* _tmp24_;
- int _tmp24__length;
- int _tmp24__size;
- int _tmp24__length1;
- GVariantIter _tmp25_;
- GVariant* _tmp26_;
+ GVariant* _tmp24_;
+ PlaylistDetails* _tmp25_;
+ int _tmp25__length;
+ int _tmp25__size;
+ int _tmp25__length1;
+ GVariantIter _tmp26_;
+ GVariant* _tmp27_;
_reply_message = g_dbus_connection_send_message_with_reply_finish (g_dbus_proxy_get_connection ((GDBusProxy *) self), g_simple_async_result_get_op_res_gpointer ((GSimpleAsyncResult *) _res_), error);
if (!_reply_message) {
return NULL;
@@ -1911,38 +2000,38 @@ static PlaylistDetails* mpris_playlists_proxy_GetPlaylists_finish (MprisPlaylist
_reply = g_dbus_message_get_body (_reply_message);
g_variant_iter_init (&_reply_iter, _reply);
_result_length1 = 0;
- _tmp23_ = g_variant_iter_next_value (&_reply_iter);
- _tmp24_ = g_new (PlaylistDetails, 5);
- _tmp24__length = 0;
- _tmp24__size = 4;
- _tmp24__length1 = 0;
- g_variant_iter_init (&_tmp25_, _tmp23_);
- for (; (_tmp26_ = g_variant_iter_next_value (&_tmp25_)) != NULL; _tmp24__length1++) {
- PlaylistDetails _tmp27_;
- GVariantIter _tmp28_;
- GVariant* _tmp29_;
+ _tmp24_ = g_variant_iter_next_value (&_reply_iter);
+ _tmp25_ = g_new (PlaylistDetails, 5);
+ _tmp25__length = 0;
+ _tmp25__size = 4;
+ _tmp25__length1 = 0;
+ g_variant_iter_init (&_tmp26_, _tmp24_);
+ for (; (_tmp27_ = g_variant_iter_next_value (&_tmp26_)) != NULL; _tmp25__length1++) {
+ PlaylistDetails _tmp28_;
+ GVariantIter _tmp29_;
GVariant* _tmp30_;
GVariant* _tmp31_;
- if (_tmp24__size == _tmp24__length) {
- _tmp24__size = 2 * _tmp24__size;
- _tmp24_ = g_renew (PlaylistDetails, _tmp24_, _tmp24__size + 1);
+ GVariant* _tmp32_;
+ if (_tmp25__size == _tmp25__length) {
+ _tmp25__size = 2 * _tmp25__size;
+ _tmp25_ = g_renew (PlaylistDetails, _tmp25_, _tmp25__size + 1);
}
- g_variant_iter_init (&_tmp28_, _tmp26_);
- _tmp29_ = g_variant_iter_next_value (&_tmp28_);
- _tmp27_.path = g_variant_dup_string (_tmp29_, NULL);
- g_variant_unref (_tmp29_);
- _tmp30_ = g_variant_iter_next_value (&_tmp28_);
- _tmp27_.name = g_variant_dup_string (_tmp30_, NULL);
+ g_variant_iter_init (&_tmp29_, _tmp27_);
+ _tmp30_ = g_variant_iter_next_value (&_tmp29_);
+ _tmp28_.path = g_variant_dup_string (_tmp30_, NULL);
g_variant_unref (_tmp30_);
- _tmp31_ = g_variant_iter_next_value (&_tmp28_);
- _tmp27_.icon_path = g_variant_dup_string (_tmp31_, NULL);
+ _tmp31_ = g_variant_iter_next_value (&_tmp29_);
+ _tmp28_.name = g_variant_dup_string (_tmp31_, NULL);
g_variant_unref (_tmp31_);
- _tmp24_[_tmp24__length++] = _tmp27_;
- g_variant_unref (_tmp26_);
- }
- _result_length1 = _tmp24__length1;
- _result = _tmp24_;
- g_variant_unref (_tmp23_);
+ _tmp32_ = g_variant_iter_next_value (&_tmp29_);
+ _tmp28_.icon_path = g_variant_dup_string (_tmp32_, NULL);
+ g_variant_unref (_tmp32_);
+ _tmp25_[_tmp25__length++] = _tmp28_;
+ g_variant_unref (_tmp27_);
+ }
+ _result_length1 = _tmp25__length1;
+ _result = _tmp25_;
+ g_variant_unref (_tmp24_);
*result_length1 = _result_length1;
g_object_unref (_reply_message);
return _result;
@@ -1953,12 +2042,12 @@ static gchar** mpris_playlists_dbus_proxy_get_Orderings (MprisPlaylists* self, i
GVariant *_inner_reply;
gchar** _result;
int _result_length1;
- gchar** _tmp32_;
- int _tmp32__length;
- int _tmp32__size;
- int _tmp32__length1;
- GVariantIter _tmp33_;
- GVariant* _tmp34_;
+ gchar** _tmp33_;
+ int _tmp33__length;
+ int _tmp33__size;
+ int _tmp33__length1;
+ GVariantIter _tmp34_;
+ GVariant* _tmp35_;
_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Orderings");
if (!_inner_reply) {
GVariant *_arguments;
@@ -1976,22 +2065,22 @@ static gchar** mpris_playlists_dbus_proxy_get_Orderings (MprisPlaylists* self, i
g_variant_unref (_reply);
}
_result_length1 = 0;
- _tmp32_ = g_new (gchar*, 5);
- _tmp32__length = 0;
- _tmp32__size = 4;
- _tmp32__length1 = 0;
- g_variant_iter_init (&_tmp33_, _inner_reply);
- for (; (_tmp34_ = g_variant_iter_next_value (&_tmp33_)) != NULL; _tmp32__length1++) {
- if (_tmp32__size == _tmp32__length) {
- _tmp32__size = 2 * _tmp32__size;
- _tmp32_ = g_renew (gchar*, _tmp32_, _tmp32__size + 1);
+ _tmp33_ = g_new (gchar*, 5);
+ _tmp33__length = 0;
+ _tmp33__size = 4;
+ _tmp33__length1 = 0;
+ g_variant_iter_init (&_tmp34_, _inner_reply);
+ for (; (_tmp35_ = g_variant_iter_next_value (&_tmp34_)) != NULL; _tmp33__length1++) {
+ if (_tmp33__size == _tmp33__length) {
+ _tmp33__size = 2 * _tmp33__size;
+ _tmp33_ = g_renew (gchar*, _tmp33_, _tmp33__size + 1);
}
- _tmp32_[_tmp32__length++] = g_variant_dup_string (_tmp34_, NULL);
- g_variant_unref (_tmp34_);
+ _tmp33_[_tmp33__length++] = g_variant_dup_string (_tmp35_, NULL);
+ g_variant_unref (_tmp35_);
}
- _result_length1 = _tmp32__length1;
- _tmp32_[_tmp32__length] = NULL;
- _result = _tmp32_;
+ _result_length1 = _tmp33__length1;
+ _tmp33_[_tmp33__length] = NULL;
+ _result = _tmp33_;
*result_length1 = _result_length1;
g_variant_unref (_inner_reply);
return _result;
@@ -2002,20 +2091,20 @@ static void mpris_playlists_dbus_proxy_set_Orderings (MprisPlaylists* self, gcha
GVariant *_arguments;
GVariant *_reply;
GVariantBuilder _arguments_builder;
- gchar** _tmp35_;
- GVariantBuilder _tmp36_;
- int _tmp37_;
+ gchar** _tmp36_;
+ GVariantBuilder _tmp37_;
+ int _tmp38_;
g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Orderings"));
g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
- _tmp35_ = value;
- g_variant_builder_init (&_tmp36_, G_VARIANT_TYPE ("as"));
- for (_tmp37_ = 0; _tmp37_ < value_length1; _tmp37_++) {
- g_variant_builder_add_value (&_tmp36_, g_variant_new_string (*_tmp35_));
- _tmp35_++;
+ _tmp36_ = value;
+ g_variant_builder_init (&_tmp37_, G_VARIANT_TYPE ("as"));
+ for (_tmp38_ = 0; _tmp38_ < value_length1; _tmp38_++) {
+ g_variant_builder_add_value (&_tmp37_, g_variant_new_string (*_tmp36_));
+ _tmp36_++;
}
- g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp36_));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp37_));
g_variant_builder_close (&_arguments_builder);
_arguments = g_variant_builder_end (&_arguments_builder);
_reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
@@ -2072,15 +2161,15 @@ static void mpris_playlists_dbus_proxy_set_PlaylistCount (MprisPlaylists* self,
static void mpris_playlists_dbus_proxy_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result) {
GVariant *_inner_reply;
- ActivePlaylistContainer _tmp38_;
- GVariantIter _tmp39_;
- GVariant* _tmp40_;
+ ActivePlaylistContainer _tmp39_;
+ GVariantIter _tmp40_;
GVariant* _tmp41_;
- PlaylistDetails _tmp42_;
- GVariantIter _tmp43_;
- GVariant* _tmp44_;
+ GVariant* _tmp42_;
+ PlaylistDetails _tmp43_;
+ GVariantIter _tmp44_;
GVariant* _tmp45_;
GVariant* _tmp46_;
+ GVariant* _tmp47_;
_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "ActivePlaylist");
if (!_inner_reply) {
GVariant *_arguments;
@@ -2097,24 +2186,24 @@ static void mpris_playlists_dbus_proxy_get_ActivePlaylist (MprisPlaylists* self,
g_variant_get (_reply, "(v)", &_inner_reply);
g_variant_unref (_reply);
}
- g_variant_iter_init (&_tmp39_, _inner_reply);
- _tmp40_ = g_variant_iter_next_value (&_tmp39_);
- _tmp38_.valid = g_variant_get_boolean (_tmp40_);
- g_variant_unref (_tmp40_);
- _tmp41_ = g_variant_iter_next_value (&_tmp39_);
- g_variant_iter_init (&_tmp43_, _tmp41_);
- _tmp44_ = g_variant_iter_next_value (&_tmp43_);
- _tmp42_.path = g_variant_dup_string (_tmp44_, NULL);
- g_variant_unref (_tmp44_);
- _tmp45_ = g_variant_iter_next_value (&_tmp43_);
- _tmp42_.name = g_variant_dup_string (_tmp45_, NULL);
+ g_variant_iter_init (&_tmp40_, _inner_reply);
+ _tmp41_ = g_variant_iter_next_value (&_tmp40_);
+ _tmp39_.valid = g_variant_get_boolean (_tmp41_);
+ g_variant_unref (_tmp41_);
+ _tmp42_ = g_variant_iter_next_value (&_tmp40_);
+ g_variant_iter_init (&_tmp44_, _tmp42_);
+ _tmp45_ = g_variant_iter_next_value (&_tmp44_);
+ _tmp43_.path = g_variant_dup_string (_tmp45_, NULL);
g_variant_unref (_tmp45_);
- _tmp46_ = g_variant_iter_next_value (&_tmp43_);
- _tmp42_.icon_path = g_variant_dup_string (_tmp46_, NULL);
+ _tmp46_ = g_variant_iter_next_value (&_tmp44_);
+ _tmp43_.name = g_variant_dup_string (_tmp46_, NULL);
g_variant_unref (_tmp46_);
- _tmp38_.details = _tmp42_;
- g_variant_unref (_tmp41_);
- *result = _tmp38_;
+ _tmp47_ = g_variant_iter_next_value (&_tmp44_);
+ _tmp43_.icon_path = g_variant_dup_string (_tmp47_, NULL);
+ g_variant_unref (_tmp47_);
+ _tmp39_.details = _tmp43_;
+ g_variant_unref (_tmp42_);
+ *result = _tmp39_;
g_variant_unref (_inner_reply);
return;
}
@@ -2124,20 +2213,20 @@ static void mpris_playlists_dbus_proxy_set_ActivePlaylist (MprisPlaylists* self,
GVariant *_arguments;
GVariant *_reply;
GVariantBuilder _arguments_builder;
- GVariantBuilder _tmp47_;
GVariantBuilder _tmp48_;
+ GVariantBuilder _tmp49_;
g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.mpris.MediaPlayer2.Playlists"));
g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("ActivePlaylist"));
g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
- g_variant_builder_init (&_tmp47_, G_VARIANT_TYPE_TUPLE);
- g_variant_builder_add_value (&_tmp47_, g_variant_new_boolean ((*value).valid));
g_variant_builder_init (&_tmp48_, G_VARIANT_TYPE_TUPLE);
- g_variant_builder_add_value (&_tmp48_, g_variant_new_object_path ((*value).details.path));
- g_variant_builder_add_value (&_tmp48_, g_variant_new_string ((*value).details.name));
- g_variant_builder_add_value (&_tmp48_, g_variant_new_string ((*value).details.icon_path));
- g_variant_builder_add_value (&_tmp47_, g_variant_builder_end (&_tmp48_));
- g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp47_));
+ g_variant_builder_add_value (&_tmp48_, g_variant_new_boolean ((*value).valid));
+ g_variant_builder_init (&_tmp49_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp49_, g_variant_new_object_path ((*value).details.path));
+ g_variant_builder_add_value (&_tmp49_, g_variant_new_string ((*value).details.name));
+ g_variant_builder_add_value (&_tmp49_, g_variant_new_string ((*value).details.icon_path));
+ g_variant_builder_add_value (&_tmp48_, g_variant_builder_end (&_tmp49_));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp48_));
g_variant_builder_close (&_arguments_builder);
_arguments = g_variant_builder_end (&_arguments_builder);
_reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
@@ -2165,11 +2254,11 @@ static void mpris_playlists_proxy_mpris_playlists_interface_init (MprisPlaylists
static void _dbus_mpris_playlists_ActivatePlaylist (MprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
GVariantIter _arguments_iter;
char* playlist_id = NULL;
- GVariant* _tmp49_;
+ GVariant* _tmp50_;
g_variant_iter_init (&_arguments_iter, parameters);
- _tmp49_ = g_variant_iter_next_value (&_arguments_iter);
- playlist_id = g_variant_dup_string (_tmp49_, NULL);
- g_variant_unref (_tmp49_);
+ _tmp50_ = g_variant_iter_next_value (&_arguments_iter);
+ playlist_id = g_variant_dup_string (_tmp50_, NULL);
+ g_variant_unref (_tmp50_);
mpris_playlists_ActivatePlaylist (self, playlist_id, (GAsyncReadyCallback) _dbus_mpris_playlists_ActivatePlaylist_ready, invocation);
_g_free0 (playlist_id);
}
@@ -2200,26 +2289,26 @@ static void _dbus_mpris_playlists_ActivatePlaylist_ready (GObject * source_objec
static void _dbus_mpris_playlists_GetPlaylists (MprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
GVariantIter _arguments_iter;
guint32 index = 0U;
- GVariant* _tmp50_;
- guint32 max_count = 0U;
GVariant* _tmp51_;
- gchar* order = NULL;
+ guint32 max_count = 0U;
GVariant* _tmp52_;
- gboolean reverse_order = FALSE;
+ gchar* order = NULL;
GVariant* _tmp53_;
+ gboolean reverse_order = FALSE;
+ GVariant* _tmp54_;
g_variant_iter_init (&_arguments_iter, parameters);
- _tmp50_ = g_variant_iter_next_value (&_arguments_iter);
- index = g_variant_get_uint32 (_tmp50_);
- g_variant_unref (_tmp50_);
_tmp51_ = g_variant_iter_next_value (&_arguments_iter);
- max_count = g_variant_get_uint32 (_tmp51_);
+ index = g_variant_get_uint32 (_tmp51_);
g_variant_unref (_tmp51_);
_tmp52_ = g_variant_iter_next_value (&_arguments_iter);
- order = g_variant_dup_string (_tmp52_, NULL);
+ max_count = g_variant_get_uint32 (_tmp52_);
g_variant_unref (_tmp52_);
_tmp53_ = g_variant_iter_next_value (&_arguments_iter);
- reverse_order = g_variant_get_boolean (_tmp53_);
+ order = g_variant_dup_string (_tmp53_, NULL);
g_variant_unref (_tmp53_);
+ _tmp54_ = g_variant_iter_next_value (&_arguments_iter);
+ reverse_order = g_variant_get_boolean (_tmp54_);
+ g_variant_unref (_tmp54_);
mpris_playlists_GetPlaylists (self, index, max_count, order, reverse_order, (GAsyncReadyCallback) _dbus_mpris_playlists_GetPlaylists_ready, invocation);
_g_free0 (order);
}
@@ -2244,9 +2333,9 @@ static void _dbus_mpris_playlists_GetPlaylists_ready (GObject * source_object, G
GVariantBuilder _reply_builder;
PlaylistDetails* result;
int result_length1 = 0;
- PlaylistDetails* _tmp54_;
- GVariantBuilder _tmp55_;
- int _tmp56_;
+ PlaylistDetails* _tmp55_;
+ GVariantBuilder _tmp56_;
+ int _tmp57_;
invocation = _user_data_;
result = mpris_playlists_GetPlaylists_finish ((MprisPlaylists*) source_object, _res_, &result_length1, &error);
if (error) {
@@ -2255,18 +2344,18 @@ static void _dbus_mpris_playlists_GetPlaylists_ready (GObject * source_object, G
}
_reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
- _tmp54_ = result;
- g_variant_builder_init (&_tmp55_, G_VARIANT_TYPE ("a(oss)"));
- for (_tmp56_ = 0; _tmp56_ < result_length1; _tmp56_++) {
- GVariantBuilder _tmp57_;
- g_variant_builder_init (&_tmp57_, G_VARIANT_TYPE_TUPLE);
- g_variant_builder_add_value (&_tmp57_, g_variant_new_object_path ((*_tmp54_).path));
- g_variant_builder_add_value (&_tmp57_, g_variant_new_string ((*_tmp54_).name));
- g_variant_builder_add_value (&_tmp57_, g_variant_new_string ((*_tmp54_).icon_path));
- g_variant_builder_add_value (&_tmp55_, g_variant_builder_end (&_tmp57_));
- _tmp54_++;
- }
- g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp55_));
+ _tmp55_ = result;
+ g_variant_builder_init (&_tmp56_, G_VARIANT_TYPE ("a(oss)"));
+ for (_tmp57_ = 0; _tmp57_ < result_length1; _tmp57_++) {
+ GVariantBuilder _tmp58_;
+ g_variant_builder_init (&_tmp58_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp58_, g_variant_new_object_path ((*_tmp55_).path));
+ g_variant_builder_add_value (&_tmp58_, g_variant_new_string ((*_tmp55_).name));
+ g_variant_builder_add_value (&_tmp58_, g_variant_new_string ((*_tmp55_).icon_path));
+ g_variant_builder_add_value (&_tmp56_, g_variant_builder_end (&_tmp58_));
+ _tmp55_++;
+ }
+ g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp56_));
result = (_vala_PlaylistDetails_array_free ( result, result_length1), NULL);
_reply = g_variant_builder_end (&_reply_builder);
g_dbus_message_set_body (_reply_message, _reply);
@@ -2294,18 +2383,18 @@ static void mpris_playlists_dbus_interface_method_call (GDBusConnection* connect
static GVariant* _dbus_mpris_playlists_get_Orderings (MprisPlaylists* self) {
gchar** result;
int result_length1;
- gchar** _tmp58_;
- GVariantBuilder _tmp59_;
- int _tmp60_;
+ gchar** _tmp59_;
+ GVariantBuilder _tmp60_;
+ int _tmp61_;
GVariant* _reply;
result = mpris_playlists_get_Orderings (self, &result_length1);
- _tmp58_ = result;
- g_variant_builder_init (&_tmp59_, G_VARIANT_TYPE ("as"));
- for (_tmp60_ = 0; _tmp60_ < result_length1; _tmp60_++) {
- g_variant_builder_add_value (&_tmp59_, g_variant_new_string (*_tmp58_));
- _tmp58_++;
+ _tmp59_ = result;
+ g_variant_builder_init (&_tmp60_, G_VARIANT_TYPE ("as"));
+ for (_tmp61_ = 0; _tmp61_ < result_length1; _tmp61_++) {
+ g_variant_builder_add_value (&_tmp60_, g_variant_new_string (*_tmp59_));
+ _tmp59_++;
}
- _reply = g_variant_builder_end (&_tmp59_);
+ _reply = g_variant_builder_end (&_tmp60_);
result = (_vala_array_free ( result, result_length1, (GDestroyNotify) g_free), NULL);
return _reply;
}
@@ -2322,18 +2411,18 @@ static GVariant* _dbus_mpris_playlists_get_PlaylistCount (MprisPlaylists* self)
static GVariant* _dbus_mpris_playlists_get_ActivePlaylist (MprisPlaylists* self) {
ActivePlaylistContainer result = {0};
- GVariantBuilder _tmp61_;
GVariantBuilder _tmp62_;
+ GVariantBuilder _tmp63_;
GVariant* _reply;
mpris_playlists_get_ActivePlaylist (self, &result);
- g_variant_builder_init (&_tmp61_, G_VARIANT_TYPE_TUPLE);
- g_variant_builder_add_value (&_tmp61_, g_variant_new_boolean (result.valid));
g_variant_builder_init (&_tmp62_, G_VARIANT_TYPE_TUPLE);
- g_variant_builder_add_value (&_tmp62_, g_variant_new_object_path (result.details.path));
- g_variant_builder_add_value (&_tmp62_, g_variant_new_string (result.details.name));
- g_variant_builder_add_value (&_tmp62_, g_variant_new_string (result.details.icon_path));
- g_variant_builder_add_value (&_tmp61_, g_variant_builder_end (&_tmp62_));
- _reply = g_variant_builder_end (&_tmp61_);
+ g_variant_builder_add_value (&_tmp62_, g_variant_new_boolean (result.valid));
+ g_variant_builder_init (&_tmp63_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp63_, g_variant_new_object_path (result.details.path));
+ g_variant_builder_add_value (&_tmp63_, g_variant_new_string (result.details.name));
+ g_variant_builder_add_value (&_tmp63_, g_variant_new_string (result.details.icon_path));
+ g_variant_builder_add_value (&_tmp62_, g_variant_builder_end (&_tmp63_));
+ _reply = g_variant_builder_end (&_tmp62_);
active_playlist_container_destroy (& result);
return _reply;
}
@@ -2358,28 +2447,28 @@ static GVariant* mpris_playlists_dbus_interface_get_property (GDBusConnection* c
static void _dbus_mpris_playlists_set_Orderings (MprisPlaylists* self, GVariant* _value) {
gchar** value = NULL;
int value_length1;
- gchar** _tmp63_;
- int _tmp63__length;
- int _tmp63__size;
- int _tmp63__length1;
- GVariantIter _tmp64_;
- GVariant* _tmp65_;
- _tmp63_ = g_new (gchar*, 5);
- _tmp63__length = 0;
- _tmp63__size = 4;
- _tmp63__length1 = 0;
- g_variant_iter_init (&_tmp64_, _value);
- for (; (_tmp65_ = g_variant_iter_next_value (&_tmp64_)) != NULL; _tmp63__length1++) {
- if (_tmp63__size == _tmp63__length) {
- _tmp63__size = 2 * _tmp63__size;
- _tmp63_ = g_renew (gchar*, _tmp63_, _tmp63__size + 1);
+ gchar** _tmp64_;
+ int _tmp64__length;
+ int _tmp64__size;
+ int _tmp64__length1;
+ GVariantIter _tmp65_;
+ GVariant* _tmp66_;
+ _tmp64_ = g_new (gchar*, 5);
+ _tmp64__length = 0;
+ _tmp64__size = 4;
+ _tmp64__length1 = 0;
+ g_variant_iter_init (&_tmp65_, _value);
+ for (; (_tmp66_ = g_variant_iter_next_value (&_tmp65_)) != NULL; _tmp64__length1++) {
+ if (_tmp64__size == _tmp64__length) {
+ _tmp64__size = 2 * _tmp64__size;
+ _tmp64_ = g_renew (gchar*, _tmp64_, _tmp64__size + 1);
}
- _tmp63_[_tmp63__length++] = g_variant_dup_string (_tmp65_, NULL);
- g_variant_unref (_tmp65_);
+ _tmp64_[_tmp64__length++] = g_variant_dup_string (_tmp66_, NULL);
+ g_variant_unref (_tmp66_);
}
- value_length1 = _tmp63__length1;
- _tmp63_[_tmp63__length] = NULL;
- value = _tmp63_;
+ value_length1 = _tmp64__length1;
+ _tmp64_[_tmp64__length] = NULL;
+ value = _tmp64_;
mpris_playlists_set_Orderings (self, value, value_length1);
value = (_vala_array_free (value, value_length1, (GDestroyNotify) g_free), NULL);
}
@@ -2394,33 +2483,33 @@ static void _dbus_mpris_playlists_set_PlaylistCount (MprisPlaylists* self, GVari
static void _dbus_mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, GVariant* _value) {
ActivePlaylistContainer value = {0};
- ActivePlaylistContainer _tmp66_;
- GVariantIter _tmp67_;
- GVariant* _tmp68_;
+ ActivePlaylistContainer _tmp67_;
+ GVariantIter _tmp68_;
GVariant* _tmp69_;
- PlaylistDetails _tmp70_;
- GVariantIter _tmp71_;
- GVariant* _tmp72_;
+ GVariant* _tmp70_;
+ PlaylistDetails _tmp71_;
+ GVariantIter _tmp72_;
GVariant* _tmp73_;
GVariant* _tmp74_;
- g_variant_iter_init (&_tmp67_, _value);
- _tmp68_ = g_variant_iter_next_value (&_tmp67_);
- _tmp66_.valid = g_variant_get_boolean (_tmp68_);
- g_variant_unref (_tmp68_);
- _tmp69_ = g_variant_iter_next_value (&_tmp67_);
- g_variant_iter_init (&_tmp71_, _tmp69_);
- _tmp72_ = g_variant_iter_next_value (&_tmp71_);
- _tmp70_.path = g_variant_dup_string (_tmp72_, NULL);
- g_variant_unref (_tmp72_);
- _tmp73_ = g_variant_iter_next_value (&_tmp71_);
- _tmp70_.name = g_variant_dup_string (_tmp73_, NULL);
+ GVariant* _tmp75_;
+ g_variant_iter_init (&_tmp68_, _value);
+ _tmp69_ = g_variant_iter_next_value (&_tmp68_);
+ _tmp67_.valid = g_variant_get_boolean (_tmp69_);
+ g_variant_unref (_tmp69_);
+ _tmp70_ = g_variant_iter_next_value (&_tmp68_);
+ g_variant_iter_init (&_tmp72_, _tmp70_);
+ _tmp73_ = g_variant_iter_next_value (&_tmp72_);
+ _tmp71_.path = g_variant_dup_string (_tmp73_, NULL);
g_variant_unref (_tmp73_);
- _tmp74_ = g_variant_iter_next_value (&_tmp71_);
- _tmp70_.icon_path = g_variant_dup_string (_tmp74_, NULL);
+ _tmp74_ = g_variant_iter_next_value (&_tmp72_);
+ _tmp71_.name = g_variant_dup_string (_tmp74_, NULL);
g_variant_unref (_tmp74_);
- _tmp66_.details = _tmp70_;
- g_variant_unref (_tmp69_);
- value = _tmp66_;
+ _tmp75_ = g_variant_iter_next_value (&_tmp72_);
+ _tmp71_.icon_path = g_variant_dup_string (_tmp75_, NULL);
+ g_variant_unref (_tmp75_);
+ _tmp67_.details = _tmp71_;
+ g_variant_unref (_tmp70_);
+ value = _tmp67_;
mpris_playlists_set_ActivePlaylist (self, &value);
active_playlist_container_destroy (&value);
}
@@ -2450,15 +2539,15 @@ static void _dbus_mpris_playlists_playlist_changed (GObject* _sender, PlaylistDe
const gchar * _path;
GVariant *_arguments;
GVariantBuilder _arguments_builder;
- GVariantBuilder _tmp75_;
+ GVariantBuilder _tmp76_;
_connection = _data[1];
_path = _data[2];
g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
- g_variant_builder_init (&_tmp75_, G_VARIANT_TYPE_TUPLE);
- g_variant_builder_add_value (&_tmp75_, g_variant_new_object_path ((*details).path));
- g_variant_builder_add_value (&_tmp75_, g_variant_new_string ((*details).name));
- g_variant_builder_add_value (&_tmp75_, g_variant_new_string ((*details).icon_path));
- g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp75_));
+ g_variant_builder_init (&_tmp76_, G_VARIANT_TYPE_TUPLE);
+ g_variant_builder_add_value (&_tmp76_, g_variant_new_object_path ((*details).path));
+ g_variant_builder_add_value (&_tmp76_, g_variant_new_string ((*details).name));
+ g_variant_builder_add_value (&_tmp76_, g_variant_new_string ((*details).icon_path));
+ g_variant_builder_add_value (&_arguments_builder, g_variant_builder_end (&_tmp76_));
_arguments = g_variant_builder_end (&_arguments_builder);
g_dbus_connection_emit_signal (_connection, NULL, _path, "org.mpris.MediaPlayer2.Playlists", "PlaylistChanged", _arguments, NULL);
}
diff --git a/src/mpris2-interfaces.vala b/src/mpris2-interfaces.vala
index 5506a47..5dab1d2 100644
--- a/src/mpris2-interfaces.vala
+++ b/src/mpris2-interfaces.vala
@@ -42,6 +42,7 @@ public interface MprisPlayer : Object {
public abstract async void PlayPause() throws IOError;
public abstract async void Next() throws IOError;
public abstract async void Previous() throws IOError;
+ public abstract async void Seek(int64 offset) throws IOError;
// signals
public signal void Seeked(int64 new_position);
}
diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h
index 075d169..5301177 100644
--- a/src/music-player-bridge.h
+++ b/src/music-player-bridge.h
@@ -15,6 +15,7 @@
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
#include <libdbusmenu-glib/types.h>
+#include <common-defs.h>
#include <gee.h>
#include <gio/gio.h>
@@ -54,10 +55,6 @@ typedef struct _TransportMenuitem TransportMenuitem;
typedef struct _TransportMenuitemClass TransportMenuitemClass;
typedef struct _TransportMenuitemPrivate TransportMenuitemPrivate;
-#define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ())
-
-#define TRANSPORT_MENUITEM_TYPE_STATE (transport_menuitem_state_get_type ())
-
#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ())
#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController))
#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass))
@@ -243,17 +240,6 @@ struct _TransportMenuitemClass {
PlayerItemClass parent_class;
};
-typedef enum {
- TRANSPORT_MENUITEM_ACTION_PREVIOUS,
- TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE,
- TRANSPORT_MENUITEM_ACTION_NEXT
-} TransportMenuitemaction;
-
-typedef enum {
- TRANSPORT_MENUITEM_STATE_PLAYING,
- TRANSPORT_MENUITEM_STATE_PAUSED
-} TransportMenuitemstate;
-
struct _MetadataMenuitem {
PlayerItem parent_instance;
MetadataMenuitemPrivate * priv;
@@ -327,6 +313,8 @@ struct _MprisPlayerIface {
void (*Next_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
void (*Previous) (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void (*Previous_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+ void (*Seek) (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+ void (*Seek_finish) (MprisPlayer* self, GAsyncResult* _res_, GError** error);
GHashTable* (*get_Metadata) (MprisPlayer* self);
void (*set_Metadata) (MprisPlayer* self, GHashTable* value);
gint32 (*get_Position) (MprisPlayer* self);
@@ -435,12 +423,10 @@ void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gch
void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMenuitem* menu);
GType player_item_get_type (void) G_GNUC_CONST;
GType transport_menuitem_get_type (void) G_GNUC_CONST;
-GType transport_menuitem_action_get_type (void) G_GNUC_CONST;
-GType transport_menuitem_state_get_type (void) G_GNUC_CONST;
GType player_controller_get_type (void) G_GNUC_CONST;
TransportMenuitem* transport_menuitem_new (PlayerController* parent);
TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent);
-void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update);
+void transport_menuitem_change_play_state (TransportMenuitem* self, TransportState update);
GeeHashSet* transport_menuitem_attributes_format (void);
GType metadata_menuitem_get_type (void) G_GNUC_CONST;
extern gchar* metadata_menuitem_album_art_cache_dir;
@@ -501,6 +487,8 @@ void mpris_player_Next (MprisPlayer* self, GAsyncReadyCallback _callback_, gpoin
void mpris_player_Next_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
void mpris_player_Previous (MprisPlayer* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void mpris_player_Previous_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
+void mpris_player_Seek (MprisPlayer* self, gint64 offset, GAsyncReadyCallback _callback_, gpointer _user_data_);
+void mpris_player_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** error);
GHashTable* mpris_player_get_Metadata (MprisPlayer* self);
void mpris_player_set_Metadata (MprisPlayer* self, GHashTable* value);
gint32 mpris_player_get_Position (MprisPlayer* self);
@@ -539,7 +527,7 @@ Mpris2Controller* mpris2_controller_new (PlayerController* ctrl);
Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl);
void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar* interface_source, GHashTable* changed_properties, gchar** invalid, int invalid_length1);
void mpris2_controller_initial_update (Mpris2Controller* self);
-void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command);
+void mpris2_controller_transport_update (Mpris2Controller* self, TransportAction command);
gboolean mpris2_controller_connected (Mpris2Controller* self);
void mpris2_controller_expose (Mpris2Controller* self);
void mpris2_controller_fetch_playlists (Mpris2Controller* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
diff --git a/src/playlists-menu-item.c b/src/playlists-menu-item.c
index d5d6888..b8ea942 100644
--- a/src/playlists-menu-item.c
+++ b/src/playlists-menu-item.c
@@ -33,6 +33,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <common-defs.h>
#include <stdlib.h>
#include <string.h>
+#include <gio/gio.h>
#define TYPE_PLAYER_ITEM (player_item_get_type ())
@@ -153,6 +154,7 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (Block1Data* _data1_);
static gboolean playlists_menuitem_already_observed (PlaylistsMenuitem* self, PlaylistDetails* new_detail);
+static gchar* playlists_menuitem_parse_icon_path (PlaylistsMenuitem* self, const gchar* path);
static void _lambda1_ (Block1Data* _data1_);
static void playlists_menuitem_submenu_item_activated (PlaylistsMenuitem* self, gint menu_item_id);
static void __lambda1__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint timestamp, gpointer self);
@@ -164,6 +166,9 @@ void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* pa
GeeHashSet* playlists_menuitem_attributes_format (void);
static GObject * playlists_menuitem_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
static void playlists_menuitem_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);
+static gint _vala_array_length (gpointer array);
PlaylistsMenuitem* playlists_menuitem_construct (GType object_type, PlayerController* parent) {
@@ -226,7 +231,9 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli
Block1Data* _data1_;
gboolean _tmp2_;
DbusmenuMenuitem* _tmp3_ = NULL;
- gint _tmp4_;
+ gchar* _tmp4_ = NULL;
+ gchar* _result_;
+ gint _tmp5_;
_data1_ = g_slice_new0 (Block1Data);
_data1_->_ref_count_ = 1;
_data1_->self = g_object_ref (self);
@@ -240,14 +247,19 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli
_tmp3_ = dbusmenu_menuitem_new ();
_data1_->menuitem = _tmp3_;
dbusmenu_menuitem_property_set (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_LABEL, detail.name);
- dbusmenu_menuitem_property_set (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_ICON_NAME, detail.icon_path);
+ _tmp4_ = playlists_menuitem_parse_icon_path (self, detail.icon_path);
+ _result_ = _tmp4_;
+ if (_result_ != NULL) {
+ dbusmenu_menuitem_property_set (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_ICON_NAME, (const gchar*) _result_);
+ }
dbusmenu_menuitem_property_set (_data1_->menuitem, DBUSMENU_PLAYLIST_MENUITEM_PATH, (const gchar*) detail.path);
dbusmenu_menuitem_property_set_bool (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
dbusmenu_menuitem_property_set_bool (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
g_signal_connect_data (_data1_->menuitem, "item-activated", (GCallback) __lambda1__dbusmenu_menuitem_item_activated, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
- _tmp4_ = dbusmenu_menuitem_get_id (_data1_->menuitem);
- gee_abstract_map_set ((GeeAbstractMap*) self->priv->current_playlists, GINT_TO_POINTER (_tmp4_), _data1_->menuitem);
+ _tmp5_ = dbusmenu_menuitem_get_id (_data1_->menuitem);
+ gee_abstract_map_set ((GeeAbstractMap*) self->priv->current_playlists, GINT_TO_POINTER (_tmp5_), _data1_->menuitem);
dbusmenu_menuitem_child_append (self->root_item, _data1_->menuitem);
+ _g_free0 (_result_);
playlist_details_destroy (&detail);
block1_data_unref (_data1_);
_data1_ = NULL;
@@ -255,26 +267,26 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli
}
}
{
- GeeCollection* _tmp5_ = NULL;
- GeeCollection* _tmp6_;
- GeeIterator* _tmp7_ = NULL;
- GeeIterator* _tmp8_;
+ GeeCollection* _tmp6_ = NULL;
+ GeeCollection* _tmp7_;
+ GeeIterator* _tmp8_ = NULL;
+ GeeIterator* _tmp9_;
GeeIterator* _item_it;
- _tmp5_ = gee_map_get_values ((GeeMap*) self->priv->current_playlists);
- _tmp6_ = _tmp5_;
- _tmp7_ = gee_iterable_iterator ((GeeIterable*) _tmp6_);
- _item_it = (_tmp8_ = _tmp7_, _g_object_unref0 (_tmp6_), _tmp8_);
+ _tmp6_ = gee_map_get_values ((GeeMap*) self->priv->current_playlists);
+ _tmp7_ = _tmp6_;
+ _tmp8_ = gee_iterable_iterator ((GeeIterable*) _tmp7_);
+ _item_it = (_tmp9_ = _tmp8_, _g_object_unref0 (_tmp7_), _tmp9_);
while (TRUE) {
- gboolean _tmp9_;
- gpointer _tmp10_ = NULL;
+ gboolean _tmp10_;
+ gpointer _tmp11_ = NULL;
DbusmenuMenuitem* item;
gboolean within;
- _tmp9_ = gee_iterator_next (_item_it);
- if (!_tmp9_) {
+ _tmp10_ = gee_iterator_next (_item_it);
+ if (!_tmp10_) {
break;
}
- _tmp10_ = gee_iterator_get (_item_it);
- item = (DbusmenuMenuitem*) _tmp10_;
+ _tmp11_ = gee_iterator_get (_item_it);
+ item = (DbusmenuMenuitem*) _tmp11_;
within = FALSE;
{
PlaylistDetails* detail_collection;
@@ -283,15 +295,15 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli
detail_collection = playlists;
detail_collection_length1 = playlists_length1;
for (detail_it = 0; detail_it < playlists_length1; detail_it = detail_it + 1) {
- PlaylistDetails _tmp11_;
- PlaylistDetails _tmp12_ = {0};
+ PlaylistDetails _tmp12_;
+ PlaylistDetails _tmp13_ = {0};
PlaylistDetails detail;
- _tmp11_ = (playlist_details_copy (&detail_collection[detail_it], &_tmp12_), _tmp12_);
- detail = _tmp11_;
+ _tmp12_ = (playlist_details_copy (&detail_collection[detail_it], &_tmp13_), _tmp13_);
+ detail = _tmp12_;
{
- const gchar* _tmp13_ = NULL;
- _tmp13_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
- if (g_strcmp0 (detail.path, _tmp13_) == 0) {
+ const gchar* _tmp14_ = NULL;
+ _tmp14_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ if (g_strcmp0 (detail.path, _tmp14_) == 0) {
within = TRUE;
playlist_details_destroy (&detail);
break;
@@ -301,11 +313,11 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli
}
}
if (within == FALSE) {
- const gchar* _tmp14_ = NULL;
const gchar* _tmp15_ = NULL;
- _tmp14_ = dbusmenu_menuitem_property_get (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
- _tmp15_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
- if (g_strcmp0 (_tmp14_, _tmp15_) == 0) {
+ const gchar* _tmp16_ = NULL;
+ _tmp15_ = dbusmenu_menuitem_property_get (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ _tmp16_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ if (g_strcmp0 (_tmp15_, _tmp16_) == 0) {
dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, "Choose Playlist");
}
dbusmenu_menuitem_child_delete (self->root_item, item);
@@ -317,8 +329,50 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli
}
+static gchar* playlists_menuitem_parse_icon_path (PlaylistsMenuitem* self, const gchar* path) {
+ gchar* result = NULL;
+ GFile* _tmp0_ = NULL;
+ GFile* icon_file;
+ gchar* _tmp1_ = NULL;
+ gchar* _tmp2_;
+ gboolean _tmp3_;
+ gchar* _tmp4_ = NULL;
+ gchar* _tmp5_;
+ gchar** _tmp6_;
+ gchar** _tmp7_ = NULL;
+ gchar** _tmp8_;
+ gint _tmp8__length1;
+ gchar* _tmp9_;
+ gchar* _tmp10_;
+ g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (path != NULL, NULL);
+ if (g_strcmp0 (path, "") == 0) {
+ result = NULL;
+ return result;
+ }
+ _tmp0_ = g_file_new_for_path (path);
+ icon_file = _tmp0_;
+ _tmp1_ = g_file_get_path (icon_file);
+ _tmp2_ = _tmp1_;
+ if ((_tmp3_ = _tmp2_ == NULL, _g_free0 (_tmp2_), _tmp3_)) {
+ result = NULL;
+ _g_object_unref0 (icon_file);
+ return result;
+ }
+ _tmp4_ = g_file_get_basename (icon_file);
+ _tmp5_ = _tmp4_;
+ _tmp7_ = _tmp6_ = g_strsplit (_tmp5_, ".", 0);
+ _tmp8_ = _tmp7_;
+ _tmp8__length1 = _vala_array_length (_tmp6_);
+ _tmp9_ = g_strdup (_tmp8_[0]);
+ result = (_tmp10_ = _tmp9_, _tmp8_ = (_vala_array_free (_tmp8_, _tmp8__length1, (GDestroyNotify) g_free), NULL), _g_free0 (_tmp5_), _tmp10_);
+ _g_object_unref0 (icon_file);
+ return result;
+}
+
+
void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, PlaylistDetails* new_detail) {
- const gchar* _tmp7_ = NULL;
+ const gchar* _tmp8_ = NULL;
g_return_if_fail (self != NULL);
{
GeeCollection* _tmp0_ = NULL;
@@ -343,15 +397,22 @@ void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, Pla
item = (DbusmenuMenuitem*) _tmp5_;
_tmp6_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
if (g_strcmp0 ((*new_detail).path, _tmp6_) == 0) {
+ gchar* _tmp7_ = NULL;
+ gchar* _result_;
dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_LABEL, (*new_detail).name);
- dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_ICON_NAME, (*new_detail).icon_path);
+ _tmp7_ = playlists_menuitem_parse_icon_path (self, (*new_detail).icon_path);
+ _result_ = _tmp7_;
+ if (_result_ != NULL) {
+ dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_ICON_NAME, _result_);
+ }
+ _g_free0 (_result_);
}
_g_object_unref0 (item);
}
_g_object_unref0 (_item_it);
}
- _tmp7_ = dbusmenu_menuitem_property_get (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
- if (g_strcmp0 (_tmp7_, (*new_detail).path) == 0) {
+ _tmp8_ = dbusmenu_menuitem_property_get (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ if (g_strcmp0 (_tmp8_, (*new_detail).path) == 0) {
dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, (*new_detail).name);
}
}
@@ -432,7 +493,7 @@ static void playlists_menuitem_submenu_item_activated (PlaylistsMenuitem* self,
g_return_if_fail (self != NULL);
_tmp0_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->current_playlists, GINT_TO_POINTER (menu_item_id));
if (!_tmp0_) {
- g_warning ("playlists-menu-item.vala:114: item %i was activated but we don't have " \
+ g_warning ("playlists-menu-item.vala:129: item %i was activated but we don't have " \
"a corresponding playlist", menu_item_id);
return;
}
@@ -517,4 +578,34 @@ GType playlists_menuitem_get_type (void) {
}
+static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
+ if ((array != NULL) && (destroy_func != NULL)) {
+ int i;
+ for (i = 0; i < array_length; i = i + 1) {
+ if (((gpointer*) array)[i] != NULL) {
+ destroy_func (((gpointer*) array)[i]);
+ }
+ }
+ }
+}
+
+
+static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
+ _vala_array_destroy (array, array_length, destroy_func);
+ g_free (array);
+}
+
+
+static gint _vala_array_length (gpointer array) {
+ int length;
+ length = 0;
+ if (array) {
+ while (((gpointer*) array)[length]) {
+ length++;
+ }
+ }
+ return length;
+}
+
+
diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala
index f4d7233..98d18f4 100644
--- a/src/playlists-menu-item.vala
+++ b/src/playlists-menu-item.vala
@@ -47,7 +47,11 @@ public class PlaylistsMenuitem : PlayerItem
Dbusmenu.Menuitem menuitem = new Menuitem();
menuitem.property_set (MENUITEM_PROP_LABEL, detail.name);
- menuitem.property_set (MENUITEM_PROP_ICON_NAME, detail.icon_path);
+ var result = this.parse_icon_path (detail.icon_path);
+ if (result != null) {
+ menuitem.property_set (MENUITEM_PROP_ICON_NAME, (string)result);
+ }
+
menuitem.property_set (MENUITEM_PATH, (string)detail.path);
menuitem.property_set_bool (MENUITEM_PROP_VISIBLE, true);
menuitem.property_set_bool (MENUITEM_PROP_ENABLED, true);
@@ -77,12 +81,23 @@ public class PlaylistsMenuitem : PlayerItem
}
}
+ private string? parse_icon_path (string path)
+ {
+ if (path == "")return null;
+ var icon_file = File.new_for_path (path);
+ if (icon_file.get_path() == null)return null;
+ return icon_file.get_basename().split(".")[0];
+ }
+
public void update_individual_playlist (PlaylistDetails new_detail)
{
foreach ( Dbusmenu.Menuitem item in this.current_playlists.values ){
if (new_detail.path == item.property_get (MENUITEM_PATH)){
item.property_set (MENUITEM_PROP_LABEL, new_detail.name);
- item.property_set (MENUITEM_PROP_ICON_NAME, new_detail.icon_path);
+ var result = this.parse_icon_path (new_detail.icon_path);
+ if (result != null) {
+ item.property_set (MENUITEM_PROP_ICON_NAME, result);
+ }
}
}
// If its active make sure the name is updated on the root item.
diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c
index b89f5ca..1c88f01 100644
--- a/src/slider-menu-item.c
+++ b/src/slider-menu-item.c
@@ -92,10 +92,11 @@ handle_event (DbusmenuMenuitem * mi,
input = g_variant_get_variant(value);
}
- gboolean volume_input = g_variant_get_double(input);
if (value != NULL){
if (IS_SLIDER_MENU_ITEM (mi)) {
SliderMenuItemPrivate* priv = SLIDER_MENU_ITEM_GET_PRIVATE (SLIDER_MENU_ITEM (mi));
+ gdouble volume_input = g_variant_get_double(input);
+ //g_debug ("slider menu item about to update volume %f", volume_input);
active_sink_update_volume (priv->a_sink, volume_input);
active_sink_ensure_sink_is_unmuted (priv->a_sink);
}
diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c
index b493ce8..8d0cc0b 100644
--- a/src/sound-service-dbus.c
+++ b/src/sound-service-dbus.c
@@ -74,6 +74,8 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self,
gchar* player_name,
gboolean blacklist);
+static gboolean sound_service_dbus_is_blacklisted (SoundServiceDbus* self,
+ gchar* player_name);
G_DEFINE_TYPE (SoundServiceDbus, sound_service_dbus, G_TYPE_OBJECT);
@@ -147,7 +149,10 @@ sound_service_dbus_create_root_item (SoundServiceDbus* self)
SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self);
priv->root_menuitem = dbusmenu_menuitem_new();
g_debug("Root ID: %d", dbusmenu_menuitem_get_id(priv->root_menuitem));
- DbusmenuServer *server = dbusmenu_server_new(INDICATOR_SOUND_MENU_DBUS_OBJECT_PATH);
+ DbusmenuServer *server = dbusmenu_server_new (INDICATOR_SOUND_MENU_DBUS_OBJECT_PATH);
+ const gchar* paths[] = {"/usr/share/banshee-1/icons", NULL};
+ dbusmenu_server_set_icon_paths (server,
+ paths);
dbusmenu_server_set_root (server, priv->root_menuitem);
g_object_unref (priv->root_menuitem);
priv->active_sink = active_sink_new (self);
@@ -281,7 +286,16 @@ bus_method_call (GDBusConnection * connection,
player_name,
blacklist);
retval = g_variant_new ("(b)", result);
- }
+ }
+ else if (g_strcmp0(method, "IsBlacklisted") == 0) {
+ gchar* player_name;
+ g_variant_get (params, "(s)", &player_name);
+
+ g_debug ("IsBlacklisted - name %s", player_name);
+ gboolean result = sound_service_dbus_is_blacklisted (service,
+ player_name);
+ retval = g_variant_new ("(b)", result);
+ }
else {
g_warning("Calling method '%s' on the sound service but it's unknown", method);
}
@@ -296,17 +310,18 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self,
gboolean blacklist)
{
g_return_val_if_fail (player_name != NULL, FALSE);
+ g_return_val_if_fail (IS_SOUND_SERVICE_DBUS (self), FALSE);
+ GVariant* the_black_list;
gboolean result = FALSE;
- GSettings* our_settings = NULL;
- our_settings = g_settings_new ("com.canonical.indicators.sound");
- GVariant* the_black_list = g_settings_get_value (our_settings,
- "blacklisted-media-players");
+ GSettings* our_settings;
GVariantIter iter;
gchar *str;
- // Firstly prep new array which will be set on the key.
GVariantBuilder builder;
-
+
+ our_settings = g_settings_new ("com.canonical.indicators.sound");
+ the_black_list = g_settings_get_value (our_settings,
+ "blacklisted-media-players");
g_variant_iter_init (&iter, the_black_list);
g_variant_builder_init(&builder, G_VARIANT_TYPE_STRING_ARRAY);
@@ -373,4 +388,34 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self,
return result;
}
+static gboolean sound_service_dbus_is_blacklisted (SoundServiceDbus *self,
+ gchar *player_name)
+{
+ GSettings *our_settings;
+ GVariant *the_black_list;
+ GVariantIter iter;
+ gchar *str;
+ gboolean result = FALSE;
+
+ g_return_val_if_fail (player_name != NULL, FALSE);
+ g_return_val_if_fail (IS_SOUND_SERVICE_DBUS (self), FALSE);
+
+ our_settings = g_settings_new ("com.canonical.indicators.sound");
+ the_black_list = g_settings_get_value (our_settings,
+ "blacklisted-media-players");
+ g_variant_iter_init (&iter, the_black_list);
+ while (g_variant_iter_next (&iter, "s", &str)){
+ if (g_strcmp0 (player_name, str) == 0) {
+ result = TRUE;
+ g_free (str);
+ break;
+ }
+ g_free (str);
+ }
+
+ g_object_unref (our_settings);
+ g_variant_unref (the_black_list);
+
+ return result;
+}
diff --git a/src/sound-service.c b/src/sound-service.c
index c79b9f6..cfc0b7e 100644
--- a/src/sound-service.c
+++ b/src/sound-service.c
@@ -39,10 +39,8 @@ service_shutdown (IndicatorService *service, gpointer user_data)
{
if (mainloop != NULL) {
g_debug("Service shutdown !");
-
close_pulse_activites();
g_main_loop_quit(mainloop);
-
}
return;
}
diff --git a/src/sound-service.xml b/src/sound-service.xml
index 81ebc2d..517088e 100644
--- a/src/sound-service.xml
+++ b/src/sound-service.xml
@@ -7,6 +7,12 @@
<arg type='b' name='blacklist' direction="in"/>
<arg type='b' name='result' direction="out"/>
</method>
+ <method name = "IsBlacklisted">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
+ <arg type='s' name='player_desktop_name' direction="in"/>
+ <arg type='b' name='result' direction="out"/>
+ </method>
+
<method name = "GetSoundState">
<annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
<arg type='i' name='current_state' direction="out"/>
diff --git a/src/sound-state-manager.c b/src/sound-state-manager.c
index 0958763..7095a39 100644
--- a/src/sound-state-manager.c
+++ b/src/sound-state-manager.c
@@ -153,7 +153,7 @@ sound_state_manager_notification_init (SoundStateManager* self)
if (has_notify_osd) {
priv->notification = notify_notification_new(PACKAGE_NAME, NULL, NULL);
notify_notification_set_hint_string(priv->notification,
- "x-canonical-private-synchronous", "");
+ "x-canonical-private-synchronous", PACKAGE_NAME);
}
}
diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c
index a04f269..0cc2850 100644
--- a/src/transport-menu-item.c
+++ b/src/transport-menu-item.c
@@ -57,10 +57,6 @@ typedef struct _TransportMenuitem TransportMenuitem;
typedef struct _TransportMenuitemClass TransportMenuitemClass;
typedef struct _TransportMenuitemPrivate TransportMenuitemPrivate;
-#define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ())
-
-#define TRANSPORT_MENUITEM_TYPE_STATE (transport_menuitem_state_get_type ())
-
#define TYPE_PLAYER_CONTROLLER (player_controller_get_type ())
#define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController))
#define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass))
@@ -102,17 +98,6 @@ struct _TransportMenuitemClass {
PlayerItemClass parent_class;
};
-typedef enum {
- TRANSPORT_MENUITEM_ACTION_PREVIOUS,
- TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE,
- TRANSPORT_MENUITEM_ACTION_NEXT
-} TransportMenuitemaction;
-
-typedef enum {
- TRANSPORT_MENUITEM_STATE_PLAYING,
- TRANSPORT_MENUITEM_STATE_PAUSED
-} TransportMenuitemstate;
-
struct _PlayerController {
GObject parent_instance;
PlayerControllerPrivate * priv;
@@ -134,43 +119,17 @@ GType transport_menuitem_get_type (void) G_GNUC_CONST;
enum {
TRANSPORT_MENUITEM_DUMMY_PROPERTY
};
-GType transport_menuitem_action_get_type (void) G_GNUC_CONST;
-GType transport_menuitem_state_get_type (void) G_GNUC_CONST;
GType player_controller_get_type (void) G_GNUC_CONST;
TransportMenuitem* transport_menuitem_new (PlayerController* parent);
TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent);
-void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update);
+void transport_menuitem_change_play_state (TransportMenuitem* self, TransportState update);
static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const gchar* name, GVariant* input_value, guint timestamp);
PlayerController* player_item_get_owner (PlayerItem* self);
GType mpris2_controller_get_type (void) G_GNUC_CONST;
-void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command);
+void mpris2_controller_transport_update (Mpris2Controller* self, TransportAction command);
GeeHashSet* transport_menuitem_attributes_format (void);
-GType transport_menuitem_action_get_type (void) {
- static volatile gsize transport_menuitem_action_type_id__volatile = 0;
- if (g_once_init_enter (&transport_menuitem_action_type_id__volatile)) {
- static const GEnumValue values[] = {{TRANSPORT_MENUITEM_ACTION_PREVIOUS, "TRANSPORT_MENUITEM_ACTION_PREVIOUS", "previous"}, {TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE, "TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE", "play-pause"}, {TRANSPORT_MENUITEM_ACTION_NEXT, "TRANSPORT_MENUITEM_ACTION_NEXT", "next"}, {0, NULL, NULL}};
- GType transport_menuitem_action_type_id;
- transport_menuitem_action_type_id = g_enum_register_static ("TransportMenuitemaction", values);
- g_once_init_leave (&transport_menuitem_action_type_id__volatile, transport_menuitem_action_type_id);
- }
- return transport_menuitem_action_type_id__volatile;
-}
-
-
-GType transport_menuitem_state_get_type (void) {
- static volatile gsize transport_menuitem_state_type_id__volatile = 0;
- if (g_once_init_enter (&transport_menuitem_state_type_id__volatile)) {
- static const GEnumValue values[] = {{TRANSPORT_MENUITEM_STATE_PLAYING, "TRANSPORT_MENUITEM_STATE_PLAYING", "playing"}, {TRANSPORT_MENUITEM_STATE_PAUSED, "TRANSPORT_MENUITEM_STATE_PAUSED", "paused"}, {0, NULL, NULL}};
- GType transport_menuitem_state_type_id;
- transport_menuitem_state_type_id = g_enum_register_static ("TransportMenuitemstate", values);
- g_once_init_leave (&transport_menuitem_state_type_id__volatile, transport_menuitem_state_type_id);
- }
- return transport_menuitem_state_type_id__volatile;
-}
-
-
TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent) {
TransportMenuitem * self = NULL;
g_return_val_if_fail (parent != NULL, NULL);
@@ -185,7 +144,7 @@ TransportMenuitem* transport_menuitem_new (PlayerController* parent) {
}
-void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update) {
+void transport_menuitem_change_play_state (TransportMenuitem* self, TransportState update) {
gint temp;
g_return_if_fail (self != NULL);
temp = (gint) update;
@@ -223,7 +182,7 @@ static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const
_tmp4_ = g_variant_get_int32 (v);
input = _tmp4_;
_tmp5_ = player_item_get_owner ((PlayerItem*) self);
- mpris2_controller_transport_update (_tmp5_->mpris_bridge, (TransportMenuitemaction) input);
+ mpris2_controller_transport_update (_tmp5_->mpris_bridge, (TransportAction) input);
_g_variant_unref0 (v);
}
diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala
index b0009d9..67e9562 100644
--- a/src/transport-menu-item.vala
+++ b/src/transport-menu-item.vala
@@ -20,19 +20,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
using Dbusmenu;
using Gee;
using DbusmenuTransport;
+using Transport;
public class TransportMenuitem : PlayerItem
{
- public enum action{
- PREVIOUS,
- PLAY_PAUSE,
- NEXT
- }
-
- public enum state{
- PLAYING,
- PAUSED
- }
public TransportMenuitem(PlayerController parent)
{
@@ -40,7 +31,7 @@ public class TransportMenuitem : PlayerItem
this.property_set_int(MENUITEM_PLAY_STATE, 1);
}
- public void change_play_state(state update)
+ public void change_play_state(Transport.State update)
{
//debug("UPDATING THE TRANSPORT DBUSMENUITEM PLAY STATE WITH VALUE %i",
// (int)update);
@@ -62,7 +53,7 @@ public class TransportMenuitem : PlayerItem
int32 input = v.get_int32();
//debug("transport menu item -> handle_event with value %s", input.to_string());
//debug("transport owner name = %s", this.owner.app_info.get_name());
- this.owner.mpris_bridge.transport_update((action)input);
+ this.owner.mpris_bridge.transport_update((Transport.Action)input);
}
public static HashSet<string> attributes_format()
diff --git a/src/transport-widget.c b/src/transport-widget.c
index 7c96684..ef2916d 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -27,7 +27,6 @@ Uses code from ctk
#include <math.h>
#include "transport-widget.h"
-#include "common-defs.h"
#define RECT_WIDTH 130.0f
@@ -77,15 +76,19 @@ typedef struct _TransportWidgetPrivate TransportWidgetPrivate;
struct _TransportWidgetPrivate
{
- TransportWidgetEvent current_command;
- TransportWidgetEvent key_event;
- TransportWidgetEvent motion_event;
- TransportWidgetState current_state;
- GHashTable* command_coordinates;
- DbusmenuMenuitem* twin_item;
- gboolean has_focus;
+ TransportAction current_command;
+ TransportAction key_event;
+ TransportAction motion_event;
+ TransportState current_state;
+ GHashTable* command_coordinates;
+ DbusmenuMenuitem* twin_item;
+ gboolean has_focus;
+ gint hold_timer;
+ gint skip_frequency;
};
+// TODO refactor the UI handlers, consolidate functionality between key press /release
+// and button press / release.
#define TRANSPORT_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRANSPORT_WIDGET_TYPE, TransportWidgetPrivate))
/* Gobject boiler plate */
@@ -119,17 +122,20 @@ static void transport_widget_menu_hidden ( GtkWidget *menu,
static void transport_widget_notify ( GObject *item,
GParamSpec *pspec,
gpointer user_data );
-static TransportWidgetEvent transport_widget_determine_button_event ( TransportWidget* button,
+static TransportAction transport_widget_determine_button_event ( TransportWidget* button,
GdkEventButton* event);
-static TransportWidgetEvent transport_widget_determine_motion_event ( TransportWidget* button,
+static TransportAction transport_widget_determine_motion_event ( TransportWidget* button,
GdkEventMotion* event);
static void transport_widget_react_to_button_release ( TransportWidget* button,
- TransportWidgetEvent command);
+ TransportAction command);
static void transport_widget_toggle_play_pause ( TransportWidget* button,
- TransportWidgetState update);
+ TransportState update);
static void transport_widget_select (GtkItem* menu, gpointer Userdata);
static void transport_widget_deselect (GtkItem* menu, gpointer Userdata);
-static TransportWidgetEvent transport_widget_collision_detection (gint x, gint y);
+static TransportAction transport_widget_collision_detection (gint x, gint y);
+static void transport_widget_start_timing (TransportWidget* widget);
+static gboolean transport_widget_trigger_seek (gpointer userdata);
+static gboolean transport_widget_seek (gpointer userdata);
/// Init functions //////////////////////////////////////////////////////////
@@ -155,11 +161,13 @@ static void
transport_widget_init (TransportWidget *self)
{
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(self);
- priv->current_command = TRANSPORT_NADA;
- priv->current_state = PAUSE;
- priv->key_event = TRANSPORT_NADA;
- priv->motion_event = TRANSPORT_NADA;
+ priv->current_command = TRANSPORT_ACTION_NO_ACTION;
+ priv->current_state = TRANSPORT_STATE_PAUSED;
+ priv->key_event = TRANSPORT_ACTION_NO_ACTION;
+ priv->motion_event = TRANSPORT_ACTION_NO_ACTION;
priv->has_focus = FALSE;
+ priv->hold_timer = 0;
+ priv->skip_frequency = 0;
priv->command_coordinates = g_hash_table_new_full(g_direct_hash,
g_direct_equal,
NULL,
@@ -170,7 +178,7 @@ transport_widget_init (TransportWidget *self)
previous_list = g_list_insert(previous_list, GINT_TO_POINTER(60), 2);
previous_list = g_list_insert(previous_list, GINT_TO_POINTER(34), 3);
g_hash_table_insert(priv->command_coordinates,
- GINT_TO_POINTER(TRANSPORT_PREVIOUS),
+ GINT_TO_POINTER(TRANSPORT_ACTION_PREVIOUS),
previous_list);
GList* play_list = NULL;
@@ -180,7 +188,7 @@ transport_widget_init (TransportWidget *self)
play_list = g_list_insert(play_list, GINT_TO_POINTER(43), 3);
g_hash_table_insert(priv->command_coordinates,
- GINT_TO_POINTER(TRANSPORT_PLAY_PAUSE),
+ GINT_TO_POINTER(TRANSPORT_ACTION_PLAY_PAUSE),
play_list);
GList* next_list = NULL;
@@ -190,7 +198,7 @@ transport_widget_init (TransportWidget *self)
next_list = g_list_insert(next_list, GINT_TO_POINTER(34), 3);
g_hash_table_insert(priv->command_coordinates,
- GINT_TO_POINTER(TRANSPORT_NEXT),
+ GINT_TO_POINTER(TRANSPORT_ACTION_NEXT),
next_list);
gtk_widget_set_size_request(GTK_WIDGET(self), 200, 43);
g_signal_connect (G_OBJECT(self),
@@ -248,7 +256,7 @@ transport_widget_is_selected ( TransportWidget* widget )
static void
transport_widget_toggle_play_pause(TransportWidget* button,
- TransportWidgetState update)
+ TransportState update)
{
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button);
priv->current_state = update;
@@ -276,7 +284,7 @@ transport_widget_menu_hidden ( GtkWidget *menu,
TransportWidget *transport)
{
g_return_if_fail(IS_TRANSPORT_WIDGET(transport));
- transport_widget_react_to_button_release(transport, TRANSPORT_NADA);
+ transport_widget_react_to_button_release(transport, TRANSPORT_ACTION_NO_ACTION);
}
static gboolean
@@ -285,11 +293,18 @@ transport_widget_motion_notify_event (GtkWidget *menuitem,
{
g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
- TransportWidgetEvent result = transport_widget_determine_motion_event ( TRANSPORT_WIDGET(menuitem),
+ TransportAction result = transport_widget_determine_motion_event ( TRANSPORT_WIDGET(menuitem),
event);
-
priv->motion_event = result;
gtk_widget_queue_draw (menuitem);
+ if (priv->hold_timer != 0){
+ g_source_remove (priv->hold_timer);
+ priv->hold_timer = 0;
+ }
+ if(priv->skip_frequency != 0){
+ g_source_remove (priv->skip_frequency);
+ priv->skip_frequency = 0;
+ }
return TRUE;
}
@@ -300,8 +315,8 @@ transport_widget_leave_notify_event (GtkWidget *menuitem,
g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
- priv->motion_event = TRANSPORT_NADA;
- priv->current_command = TRANSPORT_NADA;
+ priv->motion_event = TRANSPORT_ACTION_NO_ACTION;
+ priv->current_command = TRANSPORT_ACTION_NO_ACTION;
gtk_widget_queue_draw (GTK_WIDGET(menuitem));
return TRUE;
@@ -313,15 +328,81 @@ transport_widget_button_press_event (GtkWidget *menuitem,
{
g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE );
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) );
- TransportWidgetEvent result = transport_widget_determine_button_event ( TRANSPORT_WIDGET(menuitem),
+ TransportAction result = transport_widget_determine_button_event ( TRANSPORT_WIDGET(menuitem),
event);
- if(result != TRANSPORT_NADA){
+ if(result != TRANSPORT_ACTION_NO_ACTION){
priv->current_command = result;
gtk_widget_queue_draw (GTK_WIDGET(menuitem));
+ if (priv->current_command == TRANSPORT_ACTION_PREVIOUS ||
+ priv->current_command == TRANSPORT_ACTION_NEXT){
+ transport_widget_start_timing (TRANSPORT_WIDGET(menuitem));
+ }
}
return TRUE;
}
-
+/**
+ * TODO rename or merge
+ * @param widget
+ */
+static void
+transport_widget_start_timing (TransportWidget* widget)
+{
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (widget);
+ if (priv->hold_timer == 0){
+ priv->hold_timer = g_timeout_add (800,
+ transport_widget_trigger_seek,
+ widget);
+ }
+}
+
+static gboolean
+transport_widget_trigger_seek (gpointer userdata)
+{
+ g_return_val_if_fail ( IS_TRANSPORT_WIDGET(userdata), FALSE );
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (TRANSPORT_WIDGET(userdata));
+ if (priv->skip_frequency == 0){
+ priv->skip_frequency = g_timeout_add (100,
+ transport_widget_seek,
+ userdata);
+ }
+ priv->hold_timer = 0;
+ return FALSE;
+}
+
+/**
+ * This will be called repeatedly until a key/button release is received
+ * @param userdata
+ * @return
+ */
+static gboolean
+transport_widget_seek (gpointer userdata)
+{
+ g_return_val_if_fail ( IS_TRANSPORT_WIDGET(userdata), FALSE );
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (TRANSPORT_WIDGET(userdata));
+ GVariant* new_transport_state;
+ if(priv->current_command == TRANSPORT_ACTION_NEXT){
+ //g_debug ("we should be skipping forward");
+ new_transport_state = g_variant_new_int32 ((int)TRANSPORT_ACTION_FORWIND);
+
+ dbusmenu_menuitem_handle_event ( priv->twin_item,
+ "Transport state change",
+ new_transport_state,
+ 0 );
+
+ }
+ else if(priv->current_command == TRANSPORT_ACTION_PREVIOUS){
+ //g_debug ("we should be skipping back");
+ new_transport_state = g_variant_new_int32 ((int)TRANSPORT_ACTION_REWIND);
+
+ dbusmenu_menuitem_handle_event ( priv->twin_item,
+ "Transport state change",
+ new_transport_state,
+ 0 );
+ }
+
+ return TRUE;
+}
+
static gboolean
transport_widget_button_release_event (GtkWidget *menuitem,
GdkEventButton *event)
@@ -329,9 +410,11 @@ transport_widget_button_release_event (GtkWidget *menuitem,
g_return_val_if_fail(IS_TRANSPORT_WIDGET(menuitem), FALSE);
TransportWidget* transport = TRANSPORT_WIDGET(menuitem);
TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
- TransportWidgetEvent result = transport_widget_determine_button_event ( transport,
+ TransportAction result = transport_widget_determine_button_event ( transport,
event );
- if (result != TRANSPORT_NADA && priv->current_command == result){
+ if (result != TRANSPORT_ACTION_NO_ACTION &&
+ priv->current_command == result &&
+ priv->skip_frequency == 0){
GVariant* new_transport_state = g_variant_new_int32 ((int)result);
dbusmenu_menuitem_handle_event ( priv->twin_item,
"Transport state change",
@@ -361,28 +444,34 @@ transport_widget_deselect (GtkItem* item, gpointer Userdata)
void
transport_widget_react_to_key_press_event ( TransportWidget* transport,
- TransportWidgetEvent transport_event )
+ TransportAction transport_event )
{
- if(transport_event != TRANSPORT_NADA){
+ if(transport_event != TRANSPORT_ACTION_NO_ACTION){
TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
priv->current_command = transport_event;
priv->key_event = transport_event;
gtk_widget_realize ( GTK_WIDGET(transport) );
gtk_widget_queue_draw (GTK_WIDGET(transport) );
+ if (priv->current_command == TRANSPORT_ACTION_PREVIOUS ||
+ priv->current_command == TRANSPORT_ACTION_NEXT){
+ transport_widget_start_timing (transport);
+ }
}
}
void
transport_widget_react_to_key_release_event ( TransportWidget* transport,
- TransportWidgetEvent transport_event )
+ TransportAction transport_event )
{
- if(transport_event != TRANSPORT_NADA){
+ if(transport_event != TRANSPORT_ACTION_NO_ACTION){
TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport );
- GVariant* new_transport_event = g_variant_new_int32((int)transport_event);
- dbusmenu_menuitem_handle_event ( priv->twin_item,
- "Transport state change",
- new_transport_event,
- 0 );
+ GVariant* new_transport_event = g_variant_new_int32((int)transport_event);
+ if (priv->skip_frequency == 0){
+ dbusmenu_menuitem_handle_event ( priv->twin_item,
+ "Transport state change",
+ new_transport_event,
+ 0 );
+ }
}
transport_widget_react_to_button_release ( transport,
transport_event );
@@ -395,52 +484,60 @@ transport_widget_focus_update ( TransportWidget* transport, gboolean focus )
priv->has_focus = focus;
}
-static TransportWidgetEvent
+static TransportAction
transport_widget_determine_button_event( TransportWidget* button,
GdkEventButton* event )
{
return transport_widget_collision_detection (event->x, event->y);
}
-static TransportWidgetEvent
+static TransportAction
transport_widget_determine_motion_event( TransportWidget* button,
GdkEventMotion* event )
{
return transport_widget_collision_detection (event->x, event->y);
}
-static TransportWidgetEvent
+static TransportAction
transport_widget_collision_detection ( gint x,
gint y )
{
- TransportWidgetEvent event = TRANSPORT_NADA;
+ TransportAction event = TRANSPORT_ACTION_NO_ACTION;
if (x > 67 && x < 112
&& y > 12 && y < 40){
- event = TRANSPORT_PREVIOUS;
+ event = TRANSPORT_ACTION_PREVIOUS;
}
else if (x > 111 && x < 153
&& y > 5 && y < 47){
- event = TRANSPORT_PLAY_PAUSE;
+ event = TRANSPORT_ACTION_PLAY_PAUSE;
}
else if (x > 152 && x < 197
&& y > 12 && y < 40){
- event = TRANSPORT_NEXT;
+ event = TRANSPORT_ACTION_NEXT;
}
return event;
}
static void
transport_widget_react_to_button_release ( TransportWidget* button,
- TransportWidgetEvent command )
+ TransportAction command )
{
g_return_if_fail(IS_TRANSPORT_WIDGET(button));
TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button);
- priv->current_command = TRANSPORT_NADA;
- priv->key_event = TRANSPORT_NADA;
+ priv->current_command = TRANSPORT_ACTION_NO_ACTION;
+ priv->key_event = TRANSPORT_ACTION_NO_ACTION;
gtk_widget_queue_draw (GTK_WIDGET(button));
+ if (priv->hold_timer != 0){
+ g_source_remove (priv->hold_timer);
+ priv->hold_timer = 0;
+ }
+ if(priv->skip_frequency != 0){
+ g_source_remove (priv->skip_frequency);
+ priv->skip_frequency = 0;
+ }
}
/// internal helper functions //////////////////////////////////////////////////
@@ -1218,7 +1315,7 @@ draw (GtkWidget* button, cairo_t *cr)
MIDDLE_END);
//prev/next button
- if(priv->current_command == TRANSPORT_PREVIOUS)
+ if(priv->current_command == TRANSPORT_ACTION_PREVIOUS)
{
draw_gradient (cr,
X,
@@ -1244,7 +1341,7 @@ draw (GtkWidget* button, cairo_t *cr)
INNER_COMPRESSED_START,
INNER_COMPRESSED_END);
}
- else if(priv->current_command == TRANSPORT_NEXT)
+ else if(priv->current_command == TRANSPORT_ACTION_NEXT)
{
draw_gradient (cr,
RECT_WIDTH / 2 + X,
@@ -1270,7 +1367,7 @@ draw (GtkWidget* button, cairo_t *cr)
INNER_COMPRESSED_START,
INNER_COMPRESSED_END);
}
- else if (priv->motion_event == TRANSPORT_PREVIOUS)
+ else if (priv->motion_event == TRANSPORT_ACTION_PREVIOUS)
{
draw_gradient (cr,
X,
@@ -1296,7 +1393,7 @@ draw (GtkWidget* button, cairo_t *cr)
MIDDLE_START_PRELIGHT,
MIDDLE_END_PRELIGHT);
}
- else if (priv->motion_event == TRANSPORT_NEXT)
+ else if (priv->motion_event == TRANSPORT_ACTION_NEXT)
{
draw_gradient (cr,
RECT_WIDTH / 2 + X,
@@ -1324,7 +1421,7 @@ draw (GtkWidget* button, cairo_t *cr)
}
// play/pause shadow
- if(priv->current_command != TRANSPORT_PLAY_PAUSE)
+ if(priv->current_command != TRANSPORT_ACTION_PLAY_PAUSE)
{
cairo_save (cr);
cairo_rectangle (cr, X, Y, RECT_WIDTH, MIDDLE_RADIUS*2);
@@ -1341,7 +1438,7 @@ draw (GtkWidget* button, cairo_t *cr)
}
// play/pause button
- if(priv->current_command == TRANSPORT_PLAY_PAUSE)
+ if(priv->current_command == TRANSPORT_ACTION_PLAY_PAUSE)
{
draw_circle (cr,
X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f,
@@ -1357,7 +1454,7 @@ draw (GtkWidget* button, cairo_t *cr)
INNER_COMPRESSED_START,
INNER_COMPRESSED_END);
}
- else if (priv->motion_event == TRANSPORT_PLAY_PAUSE)
+ else if (priv->motion_event == TRANSPORT_ACTION_PLAY_PAUSE)
{
/* this subtle offset is to fix alpha borders, should be removed once this draw routine will be refactored */
draw_circle (cr,
@@ -1392,7 +1489,7 @@ draw (GtkWidget* button, cairo_t *cr)
}
// draw previous-button drop-shadow
- if (priv->has_focus && priv->key_event == TRANSPORT_PREVIOUS)
+ if (priv->has_focus && priv->key_event == TRANSPORT_ACTION_PREVIOUS)
{
_setup (&cr_surf, &surf, PREV_WIDTH+6, PREV_HEIGHT+6);
_mask_prev (cr_surf,
@@ -1452,7 +1549,7 @@ draw (GtkWidget* button, cairo_t *cr)
_finalize (cr, &cr_surf, &surf, PREV_X, PREV_Y);
// draw next-button drop-shadow
- if (priv->has_focus && priv->key_event == TRANSPORT_NEXT)
+ if (priv->has_focus && priv->key_event == TRANSPORT_ACTION_NEXT)
{
_setup (&cr_surf, &surf, NEXT_WIDTH+6, NEXT_HEIGHT+6);
_mask_next (cr_surf,
@@ -1512,9 +1609,10 @@ draw (GtkWidget* button, cairo_t *cr)
_finalize (cr, &cr_surf, &surf, NEXT_X, NEXT_Y);
// draw pause-button drop-shadow
- if(priv->current_state == PLAY)
+ if(priv->current_state == TRANSPORT_STATE_PLAYING)
{
- if (priv->has_focus && (priv->key_event == TRANSPORT_NADA || priv->key_event == TRANSPORT_PLAY_PAUSE))
+ if (priv->has_focus && (priv->key_event == TRANSPORT_ACTION_NO_ACTION ||
+ priv->key_event == TRANSPORT_ACTION_PLAY_PAUSE))
{
_setup (&cr_surf, &surf, PAUSE_WIDTH+6, PAUSE_HEIGHT+6);
_mask_pause (cr_surf,
@@ -1573,9 +1671,10 @@ draw (GtkWidget* button, cairo_t *cr)
TRUE);
_finalize (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y);
}
- else if(priv->current_state == PAUSE)
+ else if(priv->current_state == TRANSPORT_STATE_PAUSED)
{
- if (priv->has_focus && (priv->key_event == TRANSPORT_NADA || priv->key_event == TRANSPORT_PLAY_PAUSE))
+ if (priv->has_focus && (priv->key_event == TRANSPORT_ACTION_NO_ACTION ||
+ priv->key_event == TRANSPORT_ACTION_PLAY_PAUSE))
{
_setup (&cr_surf, &surf, PLAY_WIDTH+6, PLAY_HEIGHT+6);
_mask_play (cr_surf,
@@ -1644,11 +1743,11 @@ transport_widget_set_twin_item(TransportWidget* self,
priv->twin_item = twin_item;
g_signal_connect(G_OBJECT(priv->twin_item), "property-changed",
G_CALLBACK(transport_widget_property_update), self);
- gint initial_state = dbusmenu_menuitem_property_get_int( twin_item,
+ gint initial_state = dbusmenu_menuitem_property_get_int (twin_item,
DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE );
//g_debug("TRANSPORT WIDGET - INITIAL UPDATE = %i", initial_state);
- transport_widget_toggle_play_pause( self,
- (TransportWidgetState)initial_state);
+ transport_widget_toggle_play_pause (self,
+ (TransportState)initial_state);
}
/**
@@ -1667,7 +1766,7 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property,
{
int update_value = g_variant_get_int32(value);
//g_debug("transport_widget_update_state - with value %i", update_value);
- transport_widget_toggle_play_pause(bar, (TransportWidgetState)update_value);
+ transport_widget_toggle_play_pause(bar, (TransportState)update_value);
}
}
diff --git a/src/transport-widget.h b/src/transport-widget.h
index d02f59b..e5e91dc 100644
--- a/src/transport-widget.h
+++ b/src/transport-widget.h
@@ -23,6 +23,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <gtk/gtkmenuitem.h>
#include <libdbusmenu-gtk/menuitem.h>
+#include "common-defs.h"
+
G_BEGIN_DECLS
#define TRANSPORT_WIDGET_TYPE (transport_widget_get_type ())
@@ -35,17 +37,6 @@ G_BEGIN_DECLS
typedef struct _TransportWidget TransportWidget;
typedef struct _TransportWidgetClass TransportWidgetClass;
-typedef enum {
- TRANSPORT_PREVIOUS,
- TRANSPORT_PLAY_PAUSE,
- TRANSPORT_NEXT,
- TRANSPORT_NADA
-}TransportWidgetEvent;
-
-typedef enum {
- PLAY,
- PAUSE
-}TransportWidgetState;
struct _TransportWidgetClass {
GtkMenuItemClass parent_class;
@@ -65,12 +56,12 @@ typedef struct
void _color_shade (const CairoColorRGB *a, float k, CairoColorRGB *b);
GType transport_widget_get_type (void);
-GtkWidget* transport_widget_new ( DbusmenuMenuitem *item );
-void transport_widget_react_to_key_press_event ( TransportWidget* widget,
- TransportWidgetEvent transport_event );
-void transport_widget_react_to_key_release_event ( TransportWidget* widget,
- TransportWidgetEvent transport_event );
-gboolean transport_widget_is_selected ( TransportWidget* widget );
+GtkWidget* transport_widget_new (DbusmenuMenuitem *item);
+void transport_widget_react_to_key_press_event (TransportWidget* widget,
+ TransportAction transport_event);
+void transport_widget_react_to_key_release_event (TransportWidget* widget,
+ TransportAction transport_event);
+gboolean transport_widget_is_selected (TransportWidget* widget);
G_END_DECLS
#endif
diff --git a/src/voip-input-widget.c b/src/voip-input-widget.c
index 9b29feb..fc295ce 100644
--- a/src/voip-input-widget.c
+++ b/src/voip-input-widget.c
@@ -95,12 +95,12 @@ voip_input_widget_init (VoipInputWidget *self)
g_signal_connect(priv->ido_voip_input_slider, "slider-released", G_CALLBACK(voip_input_widget_slider_released), self);
GtkWidget* primary_image = ido_scale_menu_item_get_primary_image((IdoScaleMenuItem*)priv->ido_voip_input_slider);
- GIcon * primary_gicon = g_themed_icon_new_with_default_fallbacks("audio-input-microphone");
+ GIcon * primary_gicon = g_themed_icon_new_with_default_fallbacks("audio-input-microphone-none-panel");
gtk_image_set_from_gicon(GTK_IMAGE(primary_image), primary_gicon, GTK_ICON_SIZE_MENU);
g_object_unref(primary_gicon);
GtkWidget* secondary_image = ido_scale_menu_item_get_secondary_image((IdoScaleMenuItem*)priv->ido_voip_input_slider);
- GIcon * secondary_gicon = g_themed_icon_new_with_default_fallbacks("audio-input-microphone-high");
+ GIcon * secondary_gicon = g_themed_icon_new_with_default_fallbacks("audio-input-microphone-high-panel");
gtk_image_set_from_gicon(GTK_IMAGE(secondary_image), secondary_gicon, GTK_ICON_SIZE_MENU);
g_object_unref(secondary_gicon);
diff --git a/src/volume-widget.c b/src/volume-widget.c
index be97994..5c842dc 100644
--- a/src/volume-widget.c
+++ b/src/volume-widget.c
@@ -128,6 +128,7 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property,
GVariant* value, gpointer userdata)
{
g_return_if_fail (IS_VOLUME_WIDGET (userdata));
+ g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE) );
VolumeWidget* mitem = VOLUME_WIDGET(userdata);
VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
//g_debug("scrub-widget::property_update for prop %s", property);
@@ -136,16 +137,8 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property,
GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
GtkRange *range = (GtkRange*)slider;
gdouble update = g_variant_get_double (value);
- //g_debug("volume-widget - update level with value %f", update);
gtk_range_set_value(range, update);
-
- GList *entry = indicator_object_get_entries(priv->indicator);
- g_signal_emit(G_OBJECT(priv->indicator),
- INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID,
- 0,
- entry->data,
- TRUE);
- g_list_free(entry);
+ update_accessible_desc(priv->indicator);
}
}
}
@@ -165,25 +158,19 @@ volume_widget_set_twin_item(VolumeWidget* self,
GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
GtkRange *range = (GtkRange*)slider;
gtk_range_set_value(range, initial_level);
-
- GList *entry = indicator_object_get_entries(priv->indicator);
- g_signal_emit(G_OBJECT(priv->indicator),
- INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID,
- 0,
- entry->data,
- TRUE);
- g_list_free(entry);
+ update_accessible_desc(priv->indicator);
}
static gboolean
volume_widget_change_value_cb (GtkRange *range,
- GtkScrollType scroll,
- gdouble new_value,
- gpointer user_data)
+ GtkScrollType scroll,
+ gdouble new_value,
+ gpointer user_data)
{
g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE);
VolumeWidget* mitem = VOLUME_WIDGET(user_data);
- volume_widget_update(mitem, new_value);
+ //g_debug ("changed value %f", new_value);
+ volume_widget_update(mitem, new_value);
return FALSE;
}
@@ -192,17 +179,19 @@ volume_widget_change_value_cb (GtkRange *range,
which set the slider to 0 or 100. Ignore all other events.
*/
static gboolean
-volume_widget_value_changed_cb(GtkRange *range, gpointer user_data)
+volume_widget_value_changed_cb (GtkRange *range, gpointer user_data)
{
+
g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE);
VolumeWidget* mitem = VOLUME_WIDGET(user_data);
VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem);
- GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
+ GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider);
gdouble current_value = CLAMP(gtk_range_get_value(GTK_RANGE(slider)), 0, 100);
-
+ //g_debug ("value changed %f", gtk_range_get_value(GTK_RANGE(slider)));
if(current_value == 0 || current_value == 100){
volume_widget_update(mitem, current_value);
}
+
return FALSE;
}
diff --git a/vapi/common-defs.vapi b/vapi/common-defs.vapi
index 7b38e9c..7cac0de 100644
--- a/vapi/common-defs.vapi
+++ b/vapi/common-defs.vapi
@@ -41,14 +41,6 @@ namespace DbusmenuTitle{
}
[CCode (cheader_filename = "common-defs.h")]
-namespace DbusmenuScrub{
- public const string MENUITEM_TYPE;
- public const string MENUITEM_POSITION;
- public const string MENUITEM_DURATION;
- public const string MENUITEM_PLAY_STATE;
-}
-
-[CCode (cheader_filename = "common-defs.h")]
namespace DbusmenuPlaylists{
public const string MENUITEM_TYPE;
public const string MENUITEM_TITLE;
@@ -57,4 +49,20 @@ namespace DbusmenuPlaylists{
[CCode (cheader_filename = "common-defs.h")]
namespace DbusmenuPlaylist{
public const string MENUITEM_PATH;
-} \ No newline at end of file
+}
+
+
+[CCode (cprefix ="Transport", cheader_filename = "common-defs.h")]
+namespace Transport{
+ public enum Action{
+ PREVIOUS,
+ PLAY_PAUSE,
+ NEXT,
+ REWIND,
+ FORWIND
+ }
+ public enum State{
+ PLAYING,
+ PAUSED
+ }
+}