diff options
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/Makefile.in | 3 | ||||
-rw-r--r-- | src/fetch-file.c | 313 | ||||
-rw-r--r-- | src/freedesktop-interfaces.c | 15 | ||||
-rw-r--r-- | src/metadata-menu-item.c | 608 | ||||
-rw-r--r-- | src/metadata-widget.c | 26 | ||||
-rw-r--r-- | src/mpris2-controller.c | 1113 | ||||
-rw-r--r-- | src/mpris2-controller.vala | 5 | ||||
-rw-r--r-- | src/mpris2-interfaces.c | 80 | ||||
-rw-r--r-- | src/mpris2-watcher.c | 572 | ||||
-rw-r--r-- | src/music-player-bridge.c | 862 | ||||
-rw-r--r-- | src/music-player-bridge.h | 3 | ||||
-rw-r--r-- | src/music-player-bridge.vala | 2 | ||||
-rw-r--r-- | src/player-controller.c | 639 | ||||
-rw-r--r-- | src/player-controller.vala | 8 | ||||
-rw-r--r-- | src/player-item.c | 298 | ||||
-rw-r--r-- | src/playlists-menu-item.c | 507 | ||||
-rw-r--r-- | src/playlists-menu-item.vala | 1 | ||||
-rw-r--r-- | src/settings-manager.c | 215 | ||||
-rw-r--r-- | src/slider-menu-item.c | 3 | ||||
-rw-r--r-- | src/specific-items-manager.c | 315 | ||||
-rw-r--r-- | src/specific-items-manager.vala | 8 | ||||
-rw-r--r-- | src/transport-menu-item.c | 98 | ||||
-rw-r--r-- | src/transport-widget.c | 8 |
26 files changed, 3693 insertions, 2036 deletions
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for indicator-sound 0.7.6.1. +# Generated by GNU Autoconf 2.68 for indicator-sound 0.7.8.0. # # Report bugs to <conor.curran@canonical.com>. # @@ -630,8 +630,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='indicator-sound' PACKAGE_TARNAME='indicator-sound' -PACKAGE_VERSION='0.7.6.1' -PACKAGE_STRING='indicator-sound 0.7.6.1' +PACKAGE_VERSION='0.7.8.0' +PACKAGE_STRING='indicator-sound 0.7.8.0' PACKAGE_BUGREPORT='conor.curran@canonical.com' PACKAGE_URL='' @@ -1438,7 +1438,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.7.6.1 to adapt to many kinds of systems. +\`configure' configures indicator-sound 0.7.8.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1508,7 +1508,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of indicator-sound 0.7.6.1:";; + short | recursive ) echo "Configuration of indicator-sound 0.7.8.0:";; esac cat <<\_ACEOF @@ -1645,7 +1645,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -indicator-sound configure 0.7.6.1 +indicator-sound configure 0.7.8.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2014,7 +2014,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.7.6.1, which was +It was created by indicator-sound $as_me 0.7.8.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2834,7 +2834,7 @@ fi # Define the identity of the package. PACKAGE=indicator-sound - VERSION=0.7.6.1 + VERSION=0.7.8.0 cat >>confdefs.h <<_ACEOF @@ -15499,7 +15499,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.7.6.1, which was +This file was extended by indicator-sound $as_me 0.7.8.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15565,7 +15565,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.7.6.1 +indicator-sound config.status 0.7.8.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index cfdb702..38965bf 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(indicator-sound, 0.7.6.1, conor.curran@canonical.com) +AC_INIT(indicator-sound, 0.7.8.0, conor.curran@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-sound, 0.7.6.1) +AM_INIT_AUTOMAKE(indicator-sound, 0.7.8.0) AM_MAINTAINER_MODE diff --git a/src/Makefile.am b/src/Makefile.am index 2381429..e79f64e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,7 +29,7 @@ libsoundmenu_la_SOURCES = \ dbus-shared-names.h libsoundmenu_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror -DG_LOG_DOMAIN=\"Indicator-Sound\" -libsoundmenu_la_LIBADD = $(APPLET_LIBS) +libsoundmenu_la_LIBADD = $(APPLET_LIBS) -lm libsoundmenu_la_LDFLAGS = -module -avoid-version @@ -66,7 +66,6 @@ music_bridge_VALASOURCES = \ music_bridge_VALAFLAGS = \ --ccode \ - --disable-dbus-transformation \ -H music-player-bridge.h -d . \ --vapidir=$(top_srcdir)/vapi/ \ --vapidir=./ \ diff --git a/src/Makefile.in b/src/Makefile.in index 3accc56..8a4a45c 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -363,7 +363,7 @@ libsoundmenu_la_SOURCES = \ dbus-shared-names.h libsoundmenu_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror -DG_LOG_DOMAIN=\"Indicator-Sound\" -libsoundmenu_la_LIBADD = $(APPLET_LIBS) +libsoundmenu_la_LIBADD = $(APPLET_LIBS) -lm libsoundmenu_la_LDFLAGS = -module -avoid-version #################################################################### @@ -392,7 +392,6 @@ music_bridge_VALASOURCES = \ music_bridge_VALAFLAGS = \ --ccode \ - --disable-dbus-transformation \ -H music-player-bridge.h -d . \ --vapidir=$(top_srcdir)/vapi/ \ --vapidir=./ \ diff --git a/src/fetch-file.c b/src/fetch-file.c index 401c53f..e5f36b1 100644 --- a/src/fetch-file.c +++ b/src/fetch-file.c @@ -1,4 +1,4 @@ -/* fetch-file.c generated by valac 0.12.1, the Vala compiler +/* fetch-file.c generated by valac 0.14.0, the Vala compiler * generated from fetch-file.vala, do not modify */ /* @@ -69,11 +69,13 @@ struct _FetchFileFetchDataData { GAsyncResult* _res_; GSimpleAsyncResult* _async_result; FetchFile* self; - GFileInputStream* _tmp0_; + GFile* _tmp0_; GFileInputStream* _tmp1_; GFileInputStream* _tmp2_; - GDataInputStream* _tmp3_; - GError * e; + GFileInputStream* _tmp3_; + GDataInputStream* _tmp4_; + GDataInputStream* _tmp5_; + GError* e; GError * _inner_error_; }; @@ -84,19 +86,42 @@ struct _FetchFileReadSomethingAsyncData { GSimpleAsyncResult* _async_result; FetchFile* self; gssize size; - guint8* _tmp0_; + gssize _tmp0_; + guint8* _tmp1_; guint8* buffer; gint buffer_length1; gint _buffer_size_; gssize bufsize; - gboolean _tmp1_; - gssize _tmp2_; - gssize _tmp3_; - guint8* _tmp4_; + gboolean _tmp2_; + gboolean _tmp3_; + gssize _tmp4_; + GDataInputStream* _tmp5_; + guint8* _tmp6_; + gint _tmp6__length1; + gssize _tmp7_; + gssize _tmp8_; + gssize _tmp9_; + gssize _tmp10_; + gssize _tmp11_; + gssize _tmp12_; + guint8* _tmp13_; guint8* cpybuf; gint cpybuf_length1; gint _cpybuf_size_; - GError * e; + guint8* _tmp14_; + gint _tmp14__length1; + guint8* _tmp15_; + gint _tmp15__length1; + gssize _tmp16_; + GByteArray* _tmp17_; + guint8* _tmp18_; + gint _tmp18__length1; + GByteArray* _tmp19_; + guint8* _tmp20_; + gint _tmp20__length1; + GError* e; + GByteArray* _tmp21_; + const gchar* _tmp22_; GError * _inner_error_; }; @@ -115,11 +140,11 @@ FetchFile* fetch_file_construct (GType object_type, const gchar* uri, const gcha static void fetch_file_fetch_data_data_free (gpointer _data); void fetch_file_fetch_data (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_); void fetch_file_fetch_data_finish (FetchFile* self, GAsyncResult* _res_); -static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data); +static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* _data_); static void fetch_file_read_something_async (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_); static void fetch_file_read_something_finish (FetchFile* self, GAsyncResult* _res_); static void fetch_file_read_something_async_data_free (gpointer _data); -static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncData* data); +static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncData* _data_); static void fetch_file_read_something_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); const gchar* fetch_file_get_intended_property (FetchFile* self); const gchar* fetch_file_get_uri (FetchFile* self); @@ -134,9 +159,13 @@ static void _vala_fetch_file_set_property (GObject * object, guint property_id, FetchFile* fetch_file_construct (GType object_type, const gchar* uri, const gchar* prop) { FetchFile * self = NULL; + const gchar* _tmp0_; + const gchar* _tmp1_; g_return_val_if_fail (uri != NULL, NULL); g_return_val_if_fail (prop != NULL, NULL); - self = (FetchFile*) g_object_new (object_type, "uri", uri, "intended-property", prop, NULL); + _tmp0_ = uri; + _tmp1_ = prop; + self = (FetchFile*) g_object_new (object_type, "uri", _tmp0_, "intended-property", _tmp1_, NULL); return self; } @@ -147,10 +176,10 @@ FetchFile* fetch_file_new (const gchar* uri, const gchar* prop) { static void fetch_file_fetch_data_data_free (gpointer _data) { - FetchFileFetchDataData* data; - data = _data; - _g_object_unref0 (data->self); - g_slice_free (FetchFileFetchDataData, data); + FetchFileFetchDataData* _data_; + _data_ = _data; + _g_object_unref0 (_data_->self); + g_slice_free (FetchFileFetchDataData, _data_); } @@ -161,10 +190,12 @@ static gpointer _g_object_ref0 (gpointer self) { void fetch_file_fetch_data (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_) { FetchFileFetchDataData* _data_; + FetchFile* _tmp0_; _data_ = g_slice_new0 (FetchFileFetchDataData); _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, fetch_file_fetch_data); g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, fetch_file_fetch_data_data_free); - _data_->self = _g_object_ref0 (self); + _tmp0_ = _g_object_ref0 (self); + _data_->self = _tmp0_; fetch_file_fetch_data_co (_data_); } @@ -175,66 +206,71 @@ void fetch_file_fetch_data_finish (FetchFile* self, GAsyncResult* _res_) { } -static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data) { - switch (data->_state_) { +static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* _data_) { + switch (_data_->_state_) { case 0: goto _state_0; default: g_assert_not_reached (); } _state_0: - data->_tmp0_ = NULL; - data->_tmp0_ = g_file_read (data->self->priv->file, NULL, &data->_inner_error_); - data->_tmp1_ = data->_tmp0_; - if (data->_inner_error_ != NULL) { - goto __catch14_g_error; + { + _data_->_tmp0_ = _data_->self->priv->file; + _data_->_tmp1_ = NULL; + _data_->_tmp1_ = g_file_read (_data_->_tmp0_, NULL, &_data_->_inner_error_); + _data_->_tmp2_ = _data_->_tmp1_; + if (_data_->_inner_error_ != NULL) { + goto __catch14_g_error; + } + _data_->_tmp3_ = _data_->_tmp2_; + _data_->_tmp4_ = g_data_input_stream_new ((GInputStream*) _data_->_tmp3_); + _g_object_unref0 (_data_->self->priv->stream); + _data_->self->priv->stream = _data_->_tmp4_; + _g_object_unref0 (_data_->_tmp3_); + _data_->_tmp5_ = _data_->self->priv->stream; + g_data_input_stream_set_byte_order (_data_->_tmp5_, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN); } - data->_tmp2_ = data->_tmp1_; - data->_tmp3_ = NULL; - data->_tmp3_ = g_data_input_stream_new ((GInputStream*) data->_tmp2_); - _g_object_unref0 (data->self->priv->stream); - data->self->priv->stream = data->_tmp3_; - _g_object_unref0 (data->_tmp2_); - g_data_input_stream_set_byte_order (data->self->priv->stream, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN); goto __finally14; __catch14_g_error: { - data->e = data->_inner_error_; - data->_inner_error_ = NULL; - g_signal_emit_by_name (data->self, "failed"); - _g_error_free0 (data->e); + _data_->e = _data_->_inner_error_; + _data_->_inner_error_ = NULL; + g_signal_emit_by_name (_data_->self, "failed"); + _g_error_free0 (_data_->e); } __finally14: - if (data->_inner_error_ != NULL) { - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); - g_clear_error (&data->_inner_error_); + if (_data_->_inner_error_ != NULL) { + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code); + g_clear_error (&_data_->_inner_error_); return FALSE; } - fetch_file_read_something_async (data->self, NULL, NULL); - if (data->_state_ == 0) { - g_simple_async_result_complete_in_idle (data->_async_result); + fetch_file_read_something_async (_data_->self, NULL, NULL); + if (_data_->_state_ == 0) { + g_simple_async_result_complete_in_idle (_data_->_async_result); } else { - g_simple_async_result_complete (data->_async_result); + g_simple_async_result_complete (_data_->_async_result); } - g_object_unref (data->_async_result); + g_object_unref (_data_->_async_result); return FALSE; } static void fetch_file_read_something_async_data_free (gpointer _data) { - FetchFileReadSomethingAsyncData* data; - data = _data; - _g_object_unref0 (data->self); - g_slice_free (FetchFileReadSomethingAsyncData, data); + FetchFileReadSomethingAsyncData* _data_; + _data_ = _data; + _g_object_unref0 (_data_->self); + g_slice_free (FetchFileReadSomethingAsyncData, _data_); } static void fetch_file_read_something_async (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_) { FetchFileReadSomethingAsyncData* _data_; + FetchFile* _tmp0_; _data_ = g_slice_new0 (FetchFileReadSomethingAsyncData); _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, fetch_file_read_something_async); g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, fetch_file_read_something_async_data_free); - _data_->self = _g_object_ref0 (self); + _tmp0_ = _g_object_ref0 (self); + _data_->self = _tmp0_; fetch_file_read_something_async_co (_data_); } @@ -246,16 +282,16 @@ static void fetch_file_read_something_finish (FetchFile* self, GAsyncResult* _re static void fetch_file_read_something_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { - FetchFileReadSomethingAsyncData* data; - data = _user_data_; - data->_source_object_ = source_object; - data->_res_ = _res_; - fetch_file_read_something_async_co (data); + FetchFileReadSomethingAsyncData* _data_; + _data_ = _user_data_; + _data_->_source_object_ = source_object; + _data_->_res_ = _res_; + fetch_file_read_something_async_co (_data_); } -static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncData* data) { - switch (data->_state_) { +static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncData* _data_) { + switch (_data_->_state_) { case 0: goto _state_0; case 1: @@ -264,108 +300,142 @@ static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncD g_assert_not_reached (); } _state_0: - data->size = (gssize) 1024; - data->_tmp0_ = NULL; - data->_tmp0_ = g_new0 (guint8, data->size); - data->buffer = data->_tmp0_; - data->buffer_length1 = data->size; - data->_buffer_size_ = data->size; - data->bufsize = (gssize) 1; + _data_->size = (gssize) 1024; + _data_->_tmp0_ = _data_->size; + _data_->_tmp1_ = NULL; + _data_->_tmp1_ = g_new0 (guint8, _data_->_tmp0_); + _data_->buffer = _data_->_tmp1_; + _data_->buffer_length1 = _data_->_tmp0_; + _data_->_buffer_size_ = _data_->buffer_length1; + _data_->bufsize = (gssize) 1; { - data->_tmp1_ = TRUE; + _data_->_tmp2_ = TRUE; while (TRUE) { - if (!data->_tmp1_) { - if (!(data->bufsize > 0)) { + _data_->_tmp3_ = _data_->_tmp2_; + if (!_data_->_tmp3_) { + _data_->_tmp4_ = _data_->bufsize; + if (!(_data_->_tmp4_ > ((gssize) 0))) { break; } } - data->_tmp1_ = FALSE; - data->_state_ = 1; - g_input_stream_read_async ((GInputStream*) data->self->priv->stream, data->buffer, (gsize) data->buffer_length1, G_PRIORITY_DEFAULT, NULL, fetch_file_read_something_async_ready, data); - return FALSE; - _state_1: - data->_tmp2_ = g_input_stream_read_finish ((GInputStream*) data->self->priv->stream, data->_res_, &data->_inner_error_); - data->_tmp3_ = data->_tmp2_; - if (data->_inner_error_ != NULL) { - goto __catch15_g_error; - } - data->bufsize = data->_tmp3_; - if (data->bufsize < 1) { - break; - } - if (data->bufsize != data->size) { - data->_tmp4_ = NULL; - data->_tmp4_ = g_new0 (guint8, data->bufsize); - data->cpybuf = data->_tmp4_; - data->cpybuf_length1 = data->bufsize; - data->_cpybuf_size_ = data->bufsize; - memcpy (data->cpybuf, data->buffer, (gsize) data->bufsize); - g_byte_array_append (data->self->priv->data, data->cpybuf, data->cpybuf_length1); - data->cpybuf = (g_free (data->cpybuf), NULL); - } else { - g_byte_array_append (data->self->priv->data, data->buffer, data->buffer_length1); + _data_->_tmp2_ = FALSE; + { + _data_->_tmp5_ = _data_->self->priv->stream; + _data_->_tmp6_ = _data_->buffer; + _data_->_tmp6__length1 = _data_->buffer_length1; + _data_->_state_ = 1; + g_input_stream_read_async ((GInputStream*) _data_->_tmp5_, _data_->_tmp6_, (gsize) _data_->_tmp6__length1, G_PRIORITY_DEFAULT, NULL, fetch_file_read_something_async_ready, _data_); + return FALSE; + _state_1: + _data_->_tmp7_ = 0L; + _data_->_tmp7_ = g_input_stream_read_finish ((GInputStream*) _data_->_tmp5_, _data_->_res_, &_data_->_inner_error_); + _data_->_tmp8_ = _data_->_tmp7_; + if (_data_->_inner_error_ != NULL) { + goto __catch15_g_error; + } + _data_->bufsize = _data_->_tmp8_; + _data_->_tmp9_ = _data_->bufsize; + if (_data_->_tmp9_ < ((gssize) 1)) { + break; + } + _data_->_tmp10_ = _data_->bufsize; + _data_->_tmp11_ = _data_->size; + if (_data_->_tmp10_ != _data_->_tmp11_) { + _data_->_tmp12_ = _data_->bufsize; + _data_->_tmp13_ = NULL; + _data_->_tmp13_ = g_new0 (guint8, _data_->_tmp12_); + _data_->cpybuf = _data_->_tmp13_; + _data_->cpybuf_length1 = _data_->_tmp12_; + _data_->_cpybuf_size_ = _data_->cpybuf_length1; + _data_->_tmp14_ = _data_->cpybuf; + _data_->_tmp14__length1 = _data_->cpybuf_length1; + _data_->_tmp15_ = _data_->buffer; + _data_->_tmp15__length1 = _data_->buffer_length1; + _data_->_tmp16_ = _data_->bufsize; + memcpy (_data_->_tmp14_, _data_->_tmp15_, (gsize) _data_->_tmp16_); + _data_->_tmp17_ = _data_->self->priv->data; + _data_->_tmp18_ = _data_->cpybuf; + _data_->_tmp18__length1 = _data_->cpybuf_length1; + g_byte_array_append (_data_->_tmp17_, _data_->_tmp18_, _data_->_tmp18__length1); + _data_->cpybuf = (g_free (_data_->cpybuf), NULL); + } else { + _data_->_tmp19_ = _data_->self->priv->data; + _data_->_tmp20_ = _data_->buffer; + _data_->_tmp20__length1 = _data_->buffer_length1; + g_byte_array_append (_data_->_tmp19_, _data_->_tmp20_, _data_->_tmp20__length1); + } } goto __finally15; __catch15_g_error: { - data->e = data->_inner_error_; - data->_inner_error_ = NULL; - g_signal_emit_by_name (data->self, "failed"); - _g_error_free0 (data->e); + _data_->e = _data_->_inner_error_; + _data_->_inner_error_ = NULL; + g_signal_emit_by_name (_data_->self, "failed"); + _g_error_free0 (_data_->e); } __finally15: - if (data->_inner_error_ != NULL) { - data->buffer = (g_free (data->buffer), NULL); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); - g_clear_error (&data->_inner_error_); + if (_data_->_inner_error_ != NULL) { + _data_->buffer = (g_free (_data_->buffer), NULL); + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code); + g_clear_error (&_data_->_inner_error_); return FALSE; } } } - g_signal_emit_by_name (data->self, "completed", data->self->priv->data, data->self->priv->_intended_property); - data->buffer = (g_free (data->buffer), NULL); - if (data->_state_ == 0) { - g_simple_async_result_complete_in_idle (data->_async_result); + _data_->_tmp21_ = _data_->self->priv->data; + _data_->_tmp22_ = _data_->self->priv->_intended_property; + g_signal_emit_by_name (_data_->self, "completed", _data_->_tmp21_, _data_->_tmp22_); + _data_->buffer = (g_free (_data_->buffer), NULL); + if (_data_->_state_ == 0) { + g_simple_async_result_complete_in_idle (_data_->_async_result); } else { - g_simple_async_result_complete (data->_async_result); + g_simple_async_result_complete (_data_->_async_result); } - g_object_unref (data->_async_result); + g_object_unref (_data_->_async_result); return FALSE; } const gchar* fetch_file_get_uri (FetchFile* self) { const gchar* result; + const gchar* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_uri; + _tmp0_ = self->priv->_uri; + result = _tmp0_; return result; } static void fetch_file_set_uri (FetchFile* self, const gchar* value) { - gchar* _tmp0_; + const gchar* _tmp0_; + gchar* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = g_strdup (value); + _tmp0_ = value; + _tmp1_ = g_strdup (_tmp0_); _g_free0 (self->priv->_uri); - self->priv->_uri = _tmp0_; + self->priv->_uri = _tmp1_; g_object_notify ((GObject *) self, "uri"); } const gchar* fetch_file_get_intended_property (FetchFile* self) { const gchar* result; + const gchar* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_intended_property; + _tmp0_ = self->priv->_intended_property; + result = _tmp0_; return result; } static void fetch_file_set_intended_property (FetchFile* self, const gchar* value) { - gchar* _tmp0_; + const gchar* _tmp0_; + gchar* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = g_strdup (value); + _tmp0_ = value; + _tmp1_ = g_strdup (_tmp0_); _g_free0 (self->priv->_intended_property); - self->priv->_intended_property = _tmp0_; + self->priv->_intended_property = _tmp1_; g_object_notify ((GObject *) self, "intended-property"); } @@ -374,7 +444,8 @@ static void g_cclosure_user_marshal_VOID__POINTER_STRING (GClosure * closure, GV typedef void (*GMarshalFunc_VOID__POINTER_STRING) (gpointer data1, gpointer arg_1, const char* arg_2, gpointer data2); register GMarshalFunc_VOID__POINTER_STRING callback; register GCClosure * cc; - register gpointer data1, data2; + register gpointer data1; + register gpointer data2; cc = (GCClosure *) closure; g_return_if_fail (n_param_values == 3); if (G_CCLOSURE_SWAP_DATA (closure)) { @@ -393,17 +464,19 @@ static GObject * fetch_file_constructor (GType type, guint n_construct_propertie GObject * obj; GObjectClass * parent_class; FetchFile * self; - GFile* _tmp0_ = NULL; - GByteArray* _tmp1_ = NULL; + const gchar* _tmp0_; + GFile* _tmp1_ = NULL; + GByteArray* _tmp2_; parent_class = G_OBJECT_CLASS (fetch_file_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = FETCH_FILE (obj); - _tmp0_ = g_file_new_for_uri (self->priv->_uri); + _tmp0_ = self->priv->_uri; + _tmp1_ = g_file_new_for_uri (_tmp0_); _g_object_unref0 (self->priv->file); - self->priv->file = _tmp0_; - _tmp1_ = g_byte_array_new (); + self->priv->file = _tmp1_; + _tmp2_ = g_byte_array_new (); _g_byte_array_free0 (self->priv->data); - self->priv->data = _tmp1_; + self->priv->data = _tmp2_; return obj; } diff --git a/src/freedesktop-interfaces.c b/src/freedesktop-interfaces.c index 287c3e0..cc229c8 100644 --- a/src/freedesktop-interfaces.c +++ b/src/freedesktop-interfaces.c @@ -1,4 +1,4 @@ -/* freedesktop-interfaces.c generated by valac 0.12.1, the Vala compiler +/* freedesktop-interfaces.c generated by valac 0.14.0, the Vala compiler * generated from freedesktop-interfaces.vala, do not modify */ /* @@ -184,7 +184,8 @@ static void g_cclosure_user_marshal_VOID__STRING_STRING_STRING (GClosure * closu typedef void (*GMarshalFunc_VOID__STRING_STRING_STRING) (gpointer data1, const char* arg_1, const char* arg_2, const char* arg_3, gpointer data2); register GMarshalFunc_VOID__STRING_STRING_STRING callback; register GCClosure * cc; - register gpointer data1, data2; + register gpointer data1; + register gpointer data2; cc = (GCClosure *) closure; g_return_if_fail (n_param_values == 4); if (G_CCLOSURE_SWAP_DATA (closure)) { @@ -374,7 +375,7 @@ static void _dbus_free_desktop_object_list_names_ready (GObject * source_object, _tmp84_++; } g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp85_)); - result = (_vala_array_free ( result, result_length1, (GDestroyNotify) g_free), NULL); + 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); g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); @@ -449,6 +450,7 @@ guint free_desktop_object_register_object (gpointer object, GDBusConnection* con static void _free_desktop_object_unregister_object (gpointer user_data) { gpointer* data; data = user_data; + g_signal_handlers_disconnect_by_func (data[0], _dbus_free_desktop_object_name_owner_changed, data); g_object_unref (data[0]); g_object_unref (data[1]); g_free (data[2]); @@ -457,6 +459,7 @@ static void _free_desktop_object_unregister_object (gpointer user_data) { gchar* free_desktop_introspectable_Introspect (FreeDesktopIntrospectable* self, GError** error) { + g_return_val_if_fail (self != NULL, NULL); return FREE_DESKTOP_INTROSPECTABLE_GET_INTERFACE (self)->Introspect (self, error); } @@ -553,7 +556,7 @@ static void _dbus_free_desktop_introspectable_Introspect (FreeDesktopIntrospecta _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); g_variant_builder_add_value (&_reply_builder, g_variant_new_string (result)); - _g_free0 ( result); + _g_free0 (result); _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); @@ -622,7 +625,8 @@ static void g_cclosure_user_marshal_VOID__STRING_BOXED_BOXED_INT (GClosure * clo typedef void (*GMarshalFunc_VOID__STRING_BOXED_BOXED_INT) (gpointer data1, const char* arg_1, gpointer arg_2, gpointer arg_3, gint arg_4, gpointer data2); register GMarshalFunc_VOID__STRING_BOXED_BOXED_INT callback; register GCClosure * cc; - register gpointer data1, data2; + register gpointer data1; + register gpointer data2; cc = (GCClosure *) closure; g_return_if_fail (n_param_values == 5); if (G_CCLOSURE_SWAP_DATA (closure)) { @@ -824,6 +828,7 @@ guint free_desktop_properties_register_object (gpointer object, GDBusConnection* static void _free_desktop_properties_unregister_object (gpointer user_data) { gpointer* data; data = user_data; + g_signal_handlers_disconnect_by_func (data[0], _dbus_free_desktop_properties_properties_changed, data); g_object_unref (data[0]); g_object_unref (data[1]); g_free (data[2]); diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c index 7e368e2..0e6f819 100644 --- a/src/metadata-menu-item.c +++ b/src/metadata-menu-item.c @@ -1,4 +1,4 @@ -/* metadata-menu-item.c generated by valac 0.12.1, the Vala compiler +/* metadata-menu-item.c generated by valac 0.14.0, the Vala compiler * generated from metadata-menu-item.vala, do not modify */ /* @@ -165,9 +165,9 @@ void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, cons #define PLAYER_ITEM_EMPTY (-1) FetchFile* fetch_file_new (const gchar* uri, const gchar* prop); FetchFile* fetch_file_construct (GType object_type, const gchar* uri, const gchar* prop); -static void _lambda0_ (MetadataMenuitem* self); +static void __lambda0_ (MetadataMenuitem* self); static void metadata_menuitem_on_fetcher_failed (MetadataMenuitem* self); -static void __lambda0__fetch_file_failed (FetchFile* _sender, gpointer self); +static void ___lambda0__fetch_file_failed (FetchFile* _sender, gpointer self); static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByteArray* update, const gchar* property); static void _metadata_menuitem_on_fetcher_completed_fetch_file_completed (FetchFile* _sender, GByteArray* data, const gchar* property, gpointer self); void fetch_file_fetch_data (FetchFile* self, GAsyncReadyCallback _callback_, gpointer _user_data_); @@ -192,8 +192,10 @@ static void metadata_menuitem_finalize (GObject* obj); MetadataMenuitem* metadata_menuitem_construct (GType object_type, PlayerController* parent) { MetadataMenuitem * self = NULL; + PlayerController* _tmp0_; g_return_val_if_fail (parent != NULL, NULL); - self = (MetadataMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_METADATA_MENUITEM_TYPE, "owner", parent, NULL); + _tmp0_ = parent; + self = (MetadataMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_METADATA_MENUITEM_TYPE, "owner", _tmp0_, NULL); return self; } @@ -207,18 +209,24 @@ static void metadata_menuitem_clean_album_art_temp_dir (void) { const gchar* _tmp0_ = NULL; gchar* _tmp1_ = NULL; gchar* path; - GFile* _tmp2_ = NULL; + const gchar* _tmp2_; + GFile* _tmp3_ = NULL; GFile* album_art_dir; - gboolean _tmp3_; + GFile* _tmp4_; + gboolean _tmp5_ = FALSE; _tmp0_ = g_get_user_cache_dir (); _tmp1_ = g_build_filename (_tmp0_, METADATA_MENUITEM_ALBUM_ART_DIR_SUFFIX, NULL); path = _tmp1_; - _tmp2_ = g_file_new_for_path (path); - album_art_dir = _tmp2_; - _tmp3_ = metadata_menuitem_delete_album_art_contents (album_art_dir); - if (_tmp3_ == FALSE) { + _tmp2_ = path; + _tmp3_ = g_file_new_for_path (_tmp2_); + album_art_dir = _tmp3_; + _tmp4_ = album_art_dir; + _tmp5_ = metadata_menuitem_delete_album_art_contents (_tmp4_); + if (_tmp5_ == FALSE) { + const gchar* _tmp6_; + _tmp6_ = path; g_warning ("metadata-menu-item.vala:58: could not remove the temp album art files " \ -"%s", path); +"%s", _tmp6_); } _g_object_unref0 (album_art_dir); _g_free0 (path); @@ -230,12 +238,14 @@ static gchar* metadata_menuitem_create_album_art_temp_dir (void) { const gchar* _tmp0_ = NULL; gchar* _tmp1_ = NULL; gchar* path; - gint _tmp2_; + const gchar* _tmp2_; + gint _tmp3_ = 0; _tmp0_ = g_get_user_cache_dir (); _tmp1_ = g_build_filename (_tmp0_, METADATA_MENUITEM_ALBUM_ART_DIR_SUFFIX, NULL); path = _tmp1_; - _tmp2_ = g_mkdir (path, 0700); - if (_tmp2_ == (-1)) { + _tmp2_ = path; + _tmp3_ = g_mkdir (_tmp2_, 0700); + if (_tmp3_ == (-1)) { g_warning ("metadata-menu-item.vala:66: could not create a temp dir for remote alb" \ "um art, it must have been created already"); } @@ -255,96 +265,126 @@ static const gchar* string_to_string (const gchar* self) { static gboolean metadata_menuitem_delete_album_art_contents (GFile* dir) { gboolean result = FALSE; gboolean _result_; - GFileEnumerator* _tmp0_ = NULL; - GFileEnumerator* e; GError * _inner_error_ = NULL; g_return_val_if_fail (dir != NULL, FALSE); _result_ = TRUE; - _tmp0_ = g_file_enumerate_children (dir, G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error_); - e = _tmp0_; - if (_inner_error_ != NULL) { - goto __catch2_g_error; - } - while (TRUE) { - GFileInfo* _tmp1_ = NULL; - GFileInfo* file; - const gchar* _tmp2_ = NULL; - const gchar* _tmp3_ = NULL; - GFile* _tmp4_ = NULL; - GFile* child; - _tmp1_ = g_file_enumerator_next_file (e, NULL, &_inner_error_); - file = _tmp1_; + { + GFile* _tmp0_; + GFileEnumerator* _tmp1_ = NULL; + GFileEnumerator* e; + _tmp0_ = dir; + _tmp1_ = g_file_enumerate_children (_tmp0_, G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &_inner_error_); + e = _tmp1_; if (_inner_error_ != NULL) { - _g_object_unref0 (e); goto __catch2_g_error; } - _tmp2_ = g_file_info_get_name (file); - g_debug ("metadata-menu-item.vala:82: file name = %s", _tmp2_); - if (file == NULL) { - _g_object_unref0 (file); - break; - } - _tmp3_ = g_file_info_get_name (file); - _tmp4_ = g_file_get_child (dir, _tmp3_); - child = _tmp4_; - g_file_delete (child, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch3_g_error; - } - goto __finally3; - __catch3_g_error: - { - GError * error_; - gchar* _tmp5_ = NULL; - gchar* _tmp6_; - const gchar* _tmp7_ = NULL; - const gchar* _tmp8_ = NULL; - gchar* _tmp9_ = NULL; - gchar* _tmp10_; - error_ = _inner_error_; - _inner_error_ = NULL; - _tmp5_ = g_file_get_basename (child); - _tmp6_ = _tmp5_; - _tmp7_ = string_to_string (_tmp6_); - _tmp8_ = string_to_string (error_->message); - _tmp9_ = g_strconcat ("Unable to delete file '", _tmp7_, ": ", _tmp8_, NULL); - _tmp10_ = _tmp9_; - g_warning ("metadata-menu-item.vala:92: %s", _tmp10_); - _g_free0 (_tmp10_); - _g_free0 (_tmp6_); - _result_ = FALSE; - _g_error_free0 (error_); - } - __finally3: - if (_inner_error_ != NULL) { + while (TRUE) { + GFileEnumerator* _tmp2_; + GFileInfo* _tmp3_ = NULL; + GFileInfo* file; + GFileInfo* _tmp4_; + const gchar* _tmp5_ = NULL; + GFileInfo* _tmp6_; + GFile* _tmp7_; + GFileInfo* _tmp8_; + const gchar* _tmp9_ = NULL; + GFile* _tmp10_ = NULL; + GFile* child; + _tmp2_ = e; + _tmp3_ = g_file_enumerator_next_file (_tmp2_, NULL, &_inner_error_); + file = _tmp3_; + if (_inner_error_ != NULL) { + _g_object_unref0 (e); + goto __catch2_g_error; + } + _tmp4_ = file; + _tmp5_ = g_file_info_get_name (_tmp4_); + g_debug ("metadata-menu-item.vala:82: file name = %s", _tmp5_); + _tmp6_ = file; + if (_tmp6_ == NULL) { + _g_object_unref0 (file); + break; + } + _tmp7_ = dir; + _tmp8_ = file; + _tmp9_ = g_file_info_get_name (_tmp8_); + _tmp10_ = g_file_get_child (_tmp7_, _tmp9_); + child = _tmp10_; + { + GFile* _tmp11_; + _tmp11_ = child; + g_file_delete (_tmp11_, NULL, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch3_g_error; + } + } + goto __finally3; + __catch3_g_error: + { + GError* error_ = NULL; + GFile* _tmp12_; + gchar* _tmp13_ = NULL; + gchar* _tmp14_; + const gchar* _tmp15_ = NULL; + GError* _tmp16_; + const gchar* _tmp17_; + const gchar* _tmp18_ = NULL; + gchar* _tmp19_ = NULL; + gchar* _tmp20_; + error_ = _inner_error_; + _inner_error_ = NULL; + _tmp12_ = child; + _tmp13_ = g_file_get_basename (_tmp12_); + _tmp14_ = _tmp13_; + _tmp15_ = string_to_string (_tmp14_); + _tmp16_ = error_; + _tmp17_ = _tmp16_->message; + _tmp18_ = string_to_string (_tmp17_); + _tmp19_ = g_strconcat ("Unable to delete file '", _tmp15_, ": ", _tmp18_, NULL); + _tmp20_ = _tmp19_; + g_warning ("metadata-menu-item.vala:92: %s", _tmp20_); + _g_free0 (_tmp20_); + _g_free0 (_tmp14_); + _result_ = FALSE; + _g_error_free0 (error_); + } + __finally3: + if (_inner_error_ != NULL) { + _g_object_unref0 (child); + _g_object_unref0 (file); + _g_object_unref0 (e); + goto __catch2_g_error; + } _g_object_unref0 (child); _g_object_unref0 (file); - _g_object_unref0 (e); - goto __catch2_g_error; } - _g_object_unref0 (child); - _g_object_unref0 (file); + _g_object_unref0 (e); } - _g_object_unref0 (e); goto __finally2; __catch2_g_error: { - GError * _error_; - gchar* _tmp11_ = NULL; - gchar* _tmp12_; - const gchar* _tmp13_ = NULL; - gchar* _tmp14_ = NULL; - gchar* _tmp15_; + GError* _error_ = NULL; + GFile* _tmp21_; + gchar* _tmp22_ = NULL; + gchar* _tmp23_; + const gchar* _tmp24_ = NULL; + gchar* _tmp25_ = NULL; + gchar* _tmp26_; + GError* _tmp27_; + const gchar* _tmp28_; _error_ = _inner_error_; _inner_error_ = NULL; - _tmp11_ = g_file_get_basename (dir); - _tmp12_ = _tmp11_; - _tmp13_ = string_to_string (_tmp12_); - _tmp14_ = g_strconcat ("Unable to read files from directory '", _tmp13_, "': %s", NULL); - _tmp15_ = _tmp14_; - g_warning (_tmp15_, _error_->message); - _g_free0 (_tmp15_); - _g_free0 (_tmp12_); + _tmp21_ = dir; + _tmp22_ = g_file_get_basename (_tmp21_); + _tmp23_ = _tmp22_; + _tmp24_ = string_to_string (_tmp23_); + _tmp25_ = g_strconcat ("Unable to read files from directory '", _tmp24_, "': %s", NULL); + _tmp26_ = _tmp25_; + _tmp27_ = _error_; + _tmp28_ = _tmp27_->message; + g_warning (_tmp26_, _tmp28_); + _g_free0 (_tmp26_); + _g_free0 (_tmp23_); _result_ = FALSE; _g_error_free0 (_error_); } @@ -363,22 +403,24 @@ static gchar* string_strip (const gchar* self) { gchar* result = NULL; gchar* _tmp0_ = NULL; gchar* _result_; + const gchar* _tmp1_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = g_strdup (self); _result_ = _tmp0_; - g_strstrip (_result_); + _tmp1_ = _result_; + g_strstrip (_tmp1_); result = _result_; return result; } -static void _lambda0_ (MetadataMenuitem* self) { +static void __lambda0_ (MetadataMenuitem* self) { metadata_menuitem_on_fetcher_failed (self); } -static void __lambda0__fetch_file_failed (FetchFile* _sender, gpointer self) { - _lambda0_ (self); +static void ___lambda0__fetch_file_failed (FetchFile* _sender, gpointer self) { + __lambda0_ (self); } @@ -388,63 +430,90 @@ static void _metadata_menuitem_on_fetcher_completed_fetch_file_completed (FetchF void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, const gchar* prop) { - GFile* _tmp0_ = NULL; + const gchar* _tmp0_; + GFile* _tmp1_ = NULL; GFile* art_file; - gboolean _tmp1_; - FetchFile* _tmp10_ = NULL; + GFile* _tmp2_; + gboolean _tmp3_ = FALSE; + const gchar* _tmp19_; + const gchar* _tmp20_; + const gchar* _tmp21_; + const gchar* _tmp22_; + FetchFile* _tmp23_; + FetchFile* _tmp24_; + FetchFile* _tmp25_; + FetchFile* _tmp26_; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (uri != NULL); g_return_if_fail (prop != NULL); - _tmp0_ = g_file_new_for_uri (uri); - art_file = _tmp0_; - _tmp1_ = g_file_is_native (art_file); - if (_tmp1_ == TRUE) { - gboolean _tmp2_; + _tmp0_ = uri; + _tmp1_ = g_file_new_for_uri (_tmp0_); + art_file = _tmp1_; + _tmp2_ = art_file; + _tmp3_ = g_file_is_native (_tmp2_); + if (_tmp3_ == TRUE) { + GFile* _tmp4_; + gboolean _tmp5_ = FALSE; gchar* path = NULL; - gchar* _tmp3_ = NULL; - gchar* _tmp4_; - gchar* _tmp5_ = NULL; - gchar* _tmp6_; - gchar* _tmp7_; - gchar* _tmp8_ = NULL; - gchar* _tmp9_; - _tmp2_ = g_file_query_exists (art_file, NULL); - if (_tmp2_ == FALSE) { - dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, prop, PLAYER_ITEM_EMPTY); + _tmp4_ = art_file; + _tmp5_ = g_file_query_exists (_tmp4_, NULL); + if (_tmp5_ == FALSE) { + const gchar* _tmp6_; + _tmp6_ = prop; + dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, _tmp6_, PLAYER_ITEM_EMPTY); _g_object_unref0 (art_file); return; } - _tmp3_ = string_strip (uri); - _tmp4_ = _tmp3_; - _tmp5_ = g_filename_from_uri (_tmp4_, NULL, &_inner_error_); - _tmp6_ = _tmp5_; - _g_free0 (_tmp4_); - _tmp7_ = _tmp6_; - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_CONVERT_ERROR) { - goto __catch4_g_convert_error; + { + const gchar* _tmp7_; + gchar* _tmp8_ = NULL; + gchar* _tmp9_; + gchar* _tmp10_ = NULL; + gchar* _tmp11_; + gchar* _tmp12_; + const gchar* _tmp13_; + gchar* _tmp14_ = NULL; + gchar* _tmp15_; + const gchar* _tmp16_; + const gchar* _tmp17_; + _tmp7_ = uri; + _tmp8_ = string_strip (_tmp7_); + _tmp9_ = _tmp8_; + _tmp10_ = g_filename_from_uri (_tmp9_, NULL, &_inner_error_); + _tmp11_ = _tmp10_; + _g_free0 (_tmp9_); + _tmp12_ = _tmp11_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_CONVERT_ERROR) { + goto __catch4_g_convert_error; + } + _g_free0 (path); + _g_object_unref0 (art_file); + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return; } _g_free0 (path); - _g_object_unref0 (art_file); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return; + path = _tmp12_; + _tmp13_ = uri; + _tmp14_ = string_strip (_tmp13_); + _tmp15_ = _tmp14_; + g_debug ("metadata-menu-item.vala:116: Populating the artwork field with %s", _tmp15_); + _g_free0 (_tmp15_); + _tmp16_ = prop; + _tmp17_ = path; + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, _tmp16_, _tmp17_); } - _g_free0 (path); - path = _tmp7_; - _tmp8_ = string_strip (uri); - _tmp9_ = _tmp8_; - g_debug ("metadata-menu-item.vala:116: Populating the artwork field with %s", _tmp9_); - _g_free0 (_tmp9_); - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, prop, path); goto __finally4; __catch4_g_convert_error: { - GError * e; + GError* e = NULL; + const gchar* _tmp18_; e = _inner_error_; _inner_error_ = NULL; - g_warning ("metadata-menu-item.vala:120: Problem converting URI %s to file path", uri); + _tmp18_ = uri; + g_warning ("metadata-menu-item.vala:120: Problem converting URI %s to file path", _tmp18_); _g_error_free0 (e); } __finally4: @@ -459,17 +528,24 @@ void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, cons _g_object_unref0 (art_file); return; } - g_debug ("metadata-menu-item.vala:126: fetch_art -remotely %s", metadata_menuitem_album_art_cache_dir); - if (metadata_menuitem_album_art_cache_dir == NULL) { + _tmp19_ = metadata_menuitem_album_art_cache_dir; + g_debug ("metadata-menu-item.vala:126: fetch_art -remotely %s", _tmp19_); + _tmp20_ = metadata_menuitem_album_art_cache_dir; + if (_tmp20_ == NULL) { _g_object_unref0 (art_file); return; } - _tmp10_ = fetch_file_new (uri, prop); + _tmp21_ = uri; + _tmp22_ = prop; + _tmp23_ = fetch_file_new (_tmp21_, _tmp22_); _g_object_unref0 (metadata_menuitem_fetcher); - metadata_menuitem_fetcher = _tmp10_; - g_signal_connect_object (metadata_menuitem_fetcher, "failed", (GCallback) __lambda0__fetch_file_failed, self, 0); - g_signal_connect_object (metadata_menuitem_fetcher, "completed", (GCallback) _metadata_menuitem_on_fetcher_completed_fetch_file_completed, self, 0); - fetch_file_fetch_data (metadata_menuitem_fetcher, NULL, NULL); + metadata_menuitem_fetcher = _tmp23_; + _tmp24_ = metadata_menuitem_fetcher; + g_signal_connect_object (_tmp24_, "failed", (GCallback) ___lambda0__fetch_file_failed, self, 0); + _tmp25_ = metadata_menuitem_fetcher; + g_signal_connect_object (_tmp25_, "completed", (GCallback) _metadata_menuitem_on_fetcher_completed_fetch_file_completed, self, 0); + _tmp26_ = metadata_menuitem_fetcher; + fetch_file_fetch_data (_tmp26_, NULL, NULL); _g_object_unref0 (art_file); } @@ -487,70 +563,110 @@ static gpointer _g_object_ref0 (gpointer self) { static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByteArray* update, const gchar* property) { - GdkPixbufLoader* _tmp0_ = NULL; - GdkPixbufLoader* loader; - GdkPixbuf* _tmp1_ = NULL; - GdkPixbuf* _tmp2_; - GdkPixbuf* icon; - gchar* _tmp3_ = NULL; - gchar* path; - gint _tmp4_; - gint r; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (update != NULL); g_return_if_fail (property != NULL); - _tmp0_ = gdk_pixbuf_loader_new (); - loader = _tmp0_; - gdk_pixbuf_loader_write (loader, update->data, (gsize) ((gint) update->len), &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (loader); - goto __catch5_g_error; - } - gdk_pixbuf_loader_close (loader, &_inner_error_); - if (_inner_error_ != NULL) { - _g_object_unref0 (loader); - goto __catch5_g_error; - } - _tmp1_ = gdk_pixbuf_loader_get_pixbuf (loader); - _tmp2_ = _g_object_ref0 (_tmp1_); - icon = _tmp2_; - _tmp3_ = g_strconcat (metadata_menuitem_album_art_cache_dir, "/downloaded-coverart-XXXXXX", NULL); - path = _tmp3_; - _tmp4_ = g_mkstemp (path); - r = _tmp4_; - if (r != (-1)) { - GdkPixbufFormat* _tmp5_ = NULL; - const gchar* _tmp6_ = NULL; - gchar* _tmp7_; - _tmp5_ = gdk_pixbuf_loader_get_format (loader); - _tmp6_ = gdk_pixbuf_format_get_name (_tmp5_); - gdk_pixbuf_save (icon, path, _tmp6_, &_inner_error_, NULL); + { + GdkPixbufLoader* _tmp0_; + GdkPixbufLoader* loader; + GdkPixbufLoader* _tmp1_; + GByteArray* _tmp2_; + guint8* _tmp3_; + gint _tmp3__length1; + GdkPixbufLoader* _tmp4_; + GdkPixbufLoader* _tmp5_; + GdkPixbuf* _tmp6_ = NULL; + GdkPixbuf* _tmp7_; + GdkPixbuf* icon; + const gchar* _tmp8_; + gchar* _tmp9_ = NULL; + gchar* path; + const gchar* _tmp10_; + gint _tmp11_ = 0; + gint r; + gint _tmp12_; + _tmp0_ = gdk_pixbuf_loader_new (); + loader = _tmp0_; + _tmp1_ = loader; + _tmp2_ = update; + _tmp3_ = _tmp2_->data; + _tmp3__length1 = (gint) _tmp2_->len; + gdk_pixbuf_loader_write (_tmp1_, _tmp3_, (gsize) _tmp3__length1, &_inner_error_); if (_inner_error_ != NULL) { - _g_free0 (path); - _g_object_unref0 (icon); _g_object_unref0 (loader); goto __catch5_g_error; } - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, property, path); - if (self->priv->previous_temp_album_art_path != NULL) { - g_remove (self->priv->previous_temp_album_art_path); + _tmp4_ = loader; + gdk_pixbuf_loader_close (_tmp4_, &_inner_error_); + if (_inner_error_ != NULL) { + _g_object_unref0 (loader); + goto __catch5_g_error; + } + _tmp5_ = loader; + _tmp6_ = gdk_pixbuf_loader_get_pixbuf (_tmp5_); + _tmp7_ = _g_object_ref0 (_tmp6_); + icon = _tmp7_; + _tmp8_ = metadata_menuitem_album_art_cache_dir; + _tmp9_ = g_strconcat (_tmp8_, "/downloaded-coverart-XXXXXX", NULL); + path = _tmp9_; + _tmp10_ = path; + _tmp11_ = g_mkstemp (_tmp10_); + r = _tmp11_; + _tmp12_ = r; + if (_tmp12_ != (-1)) { + GdkPixbuf* _tmp13_; + const gchar* _tmp14_; + GdkPixbufLoader* _tmp15_; + GdkPixbufFormat* _tmp16_ = NULL; + const gchar* _tmp17_ = NULL; + const gchar* _tmp18_; + const gchar* _tmp19_; + const gchar* _tmp20_; + const gchar* _tmp22_; + gchar* _tmp23_; + _tmp13_ = icon; + _tmp14_ = path; + _tmp15_ = loader; + _tmp16_ = gdk_pixbuf_loader_get_format (_tmp15_); + _tmp17_ = gdk_pixbuf_format_get_name (_tmp16_); + gdk_pixbuf_save (_tmp13_, _tmp14_, _tmp17_, &_inner_error_, NULL); + if (_inner_error_ != NULL) { + _g_free0 (path); + _g_object_unref0 (icon); + _g_object_unref0 (loader); + goto __catch5_g_error; + } + _tmp18_ = property; + _tmp19_ = path; + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, _tmp18_, _tmp19_); + _tmp20_ = self->priv->previous_temp_album_art_path; + if (_tmp20_ != NULL) { + const gchar* _tmp21_; + _tmp21_ = self->priv->previous_temp_album_art_path; + g_remove (_tmp21_); + } + _tmp22_ = path; + _tmp23_ = g_strdup (_tmp22_); + _g_free0 (self->priv->previous_temp_album_art_path); + self->priv->previous_temp_album_art_path = _tmp23_; } - _tmp7_ = g_strdup (path); - _g_free0 (self->priv->previous_temp_album_art_path); - self->priv->previous_temp_album_art_path = _tmp7_; + _g_free0 (path); + _g_object_unref0 (icon); + _g_object_unref0 (loader); } - _g_free0 (path); - _g_object_unref0 (icon); - _g_object_unref0 (loader); goto __finally5; __catch5_g_error: { - GError * e; + GError* e = NULL; + GError* _tmp24_; + const gchar* _tmp25_; e = _inner_error_; _inner_error_ = NULL; + _tmp24_ = e; + _tmp25_ = _tmp24_->message; g_warning ("metadata-menu-item.vala:163: Problem creating file from bytearray fetc" \ -"hed from the interweb - error: %s", e->message); +"hed from the interweb - error: %s", _tmp25_); _g_error_free0 (e); } __finally5: @@ -564,53 +680,75 @@ static void metadata_menuitem_on_fetcher_completed (MetadataMenuitem* self, GByt static void metadata_menuitem_real_handle_event (DbusmenuMenuitem* base, const gchar* name, GVariant* input_value, guint timestamp) { MetadataMenuitem * self; - PlayerController* _tmp0_ = NULL; + PlayerController* _tmp0_; + PlayerController* _tmp1_; + gint _tmp2_; self = (MetadataMenuitem*) base; g_return_if_fail (name != NULL); g_return_if_fail (input_value != NULL); _tmp0_ = player_item_get_owner ((PlayerItem*) self); - if (_tmp0_->current_state == PLAYER_CONTROLLER_STATE_OFFLINE) { - PlayerController* _tmp1_ = NULL; - _tmp1_ = player_item_get_owner ((PlayerItem*) self); - player_controller_instantiate (_tmp1_); + _tmp1_ = _tmp0_; + _tmp2_ = _tmp1_->current_state; + if (_tmp2_ == ((gint) PLAYER_CONTROLLER_STATE_OFFLINE)) { + PlayerController* _tmp3_; + PlayerController* _tmp4_; + _tmp3_ = player_item_get_owner ((PlayerItem*) self); + _tmp4_ = _tmp3_; + player_controller_instantiate (_tmp4_); } else { - PlayerController* _tmp2_ = NULL; - _tmp2_ = player_item_get_owner ((PlayerItem*) self); - if (_tmp2_->current_state == PLAYER_CONTROLLER_STATE_CONNECTED) { - PlayerController* _tmp3_ = NULL; - _tmp3_ = player_item_get_owner ((PlayerItem*) self); - mpris2_controller_expose (_tmp3_->mpris_bridge); + PlayerController* _tmp5_; + PlayerController* _tmp6_; + gint _tmp7_; + _tmp5_ = player_item_get_owner ((PlayerItem*) self); + _tmp6_ = _tmp5_; + _tmp7_ = _tmp6_->current_state; + if (_tmp7_ == ((gint) PLAYER_CONTROLLER_STATE_CONNECTED)) { + PlayerController* _tmp8_; + PlayerController* _tmp9_; + Mpris2Controller* _tmp10_; + _tmp8_ = player_item_get_owner ((PlayerItem*) self); + _tmp9_ = _tmp8_; + _tmp10_ = _tmp9_->mpris_bridge; + mpris2_controller_expose (_tmp10_); } } } void metadata_menuitem_alter_label (MetadataMenuitem* self, const gchar* new_title) { + const gchar* _tmp0_; + const gchar* _tmp1_; g_return_if_fail (self != NULL); g_return_if_fail (new_title != NULL); - if (new_title == NULL) { + _tmp0_ = new_title; + if (_tmp0_ == NULL) { return; } - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME, new_title); + _tmp1_ = new_title; + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME, _tmp1_); } void metadata_menuitem_toggle_active_triangle (MetadataMenuitem* self, gboolean update) { + gboolean _tmp0_; g_return_if_fail (self != NULL); g_debug ("metadata-menu-item.vala:189: toggle active triangle"); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING, update); + _tmp0_ = update; + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING, _tmp0_); } void metadata_menuitem_should_collapse (MetadataMenuitem* self, gboolean collapse) { + gboolean _tmp0_; g_return_if_fail (self != NULL); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS, collapse); + _tmp0_ = collapse; + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS, _tmp0_); } GeeHashSet* metadata_menuitem_attributes_format (void) { GeeHashSet* result = NULL; - GeeHashSet* _tmp0_ = NULL; + GeeHashSet* _tmp0_; GeeHashSet* attrs; _tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); attrs = _tmp0_; @@ -628,7 +766,7 @@ GeeHashSet* metadata_menuitem_attributes_format (void) { GeeHashSet* metadata_menuitem_relevant_attributes_for_ui (void) { GeeHashSet* result = NULL; - GeeHashSet* _tmp0_ = NULL; + GeeHashSet* _tmp0_; GeeHashSet* attrs; _tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); attrs = _tmp0_; @@ -646,16 +784,22 @@ static GObject * metadata_menuitem_constructor (GType type, guint n_construct_pr GObjectClass * parent_class; MetadataMenuitem * self; gchar* _tmp0_ = NULL; - PlayerController* _tmp1_ = NULL; - GAppInfo* _tmp2_ = NULL; - const gchar* _tmp3_ = NULL; - PlayerController* _tmp4_ = NULL; - GAppInfo* _tmp5_ = NULL; - const gchar* _tmp6_ = NULL; - PlayerController* _tmp7_ = NULL; - const gchar* _tmp8_ = NULL; - GeeHashSet* _tmp9_ = NULL; - GeeHashSet* _tmp10_; + PlayerController* _tmp1_; + PlayerController* _tmp2_; + GAppInfo* _tmp3_; + GAppInfo* _tmp4_; + const gchar* _tmp5_ = NULL; + PlayerController* _tmp6_; + PlayerController* _tmp7_; + GAppInfo* _tmp8_; + GAppInfo* _tmp9_; + const gchar* _tmp10_ = NULL; + PlayerController* _tmp11_; + PlayerController* _tmp12_; + const gchar* _tmp13_; + const gchar* _tmp14_; + GeeHashSet* _tmp15_ = NULL; + GeeHashSet* _tmp16_; parent_class = G_OBJECT_CLASS (metadata_menuitem_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = METADATA_MENUITEM (obj); @@ -666,23 +810,29 @@ static GObject * metadata_menuitem_constructor (GType type, guint n_construct_pr _g_free0 (metadata_menuitem_album_art_cache_dir); metadata_menuitem_album_art_cache_dir = _tmp0_; _tmp1_ = player_item_get_owner ((PlayerItem*) self); - _tmp2_ = player_controller_get_app_info (_tmp1_); - _tmp3_ = g_app_info_get_name (_tmp2_); + _tmp2_ = _tmp1_; + _tmp3_ = player_controller_get_app_info (_tmp2_); + _tmp4_ = _tmp3_; + _tmp5_ = g_app_info_get_name (_tmp4_); g_debug ("metadata-menu-item.vala:42: JUST ABOUT TO ATTEMPT PLAYER NAME SETTING " \ -"%s", _tmp3_); - _tmp4_ = player_item_get_owner ((PlayerItem*) self); - _tmp5_ = player_controller_get_app_info (_tmp4_); - _tmp6_ = g_app_info_get_name (_tmp5_); - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME, _tmp6_); - _tmp7_ = player_item_get_owner ((PlayerItem*) self); - _tmp8_ = player_controller_get_icon_name (_tmp7_); - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_ICON, _tmp8_); +"%s", _tmp5_); + _tmp6_ = player_item_get_owner ((PlayerItem*) self); + _tmp7_ = _tmp6_; + _tmp8_ = player_controller_get_app_info (_tmp7_); + _tmp9_ = _tmp8_; + _tmp10_ = g_app_info_get_name (_tmp9_); + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME, _tmp10_); + _tmp11_ = player_item_get_owner ((PlayerItem*) self); + _tmp12_ = _tmp11_; + _tmp13_ = player_controller_get_icon_name (_tmp12_); + _tmp14_ = _tmp13_; + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_ICON, _tmp14_); dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING, FALSE); dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS, TRUE); - _tmp9_ = metadata_menuitem_relevant_attributes_for_ui (); - _tmp10_ = _tmp9_; - player_item_reset ((PlayerItem*) self, _tmp10_); - _g_object_unref0 (_tmp10_); + _tmp15_ = metadata_menuitem_relevant_attributes_for_ui (); + _tmp16_ = _tmp15_; + player_item_reset ((PlayerItem*) self, _tmp16_); + _g_object_unref0 (_tmp16_); return obj; } diff --git a/src/metadata-widget.c b/src/metadata-widget.c index d21c10d..8ab7d1d 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -212,9 +212,9 @@ metadata_widget_init (MetadataWidget *self) // player label GtkWidget* player_label; player_label = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(player_label), (gfloat)0, (gfloat)0); + gtk_misc_set_alignment(GTK_MISC(player_label), (gfloat)0, (gfloat)0.5); gtk_misc_set_padding (GTK_MISC(player_label), (gfloat)1, (gfloat)0); - gtk_widget_set_size_request (player_label, 200, 25); + gtk_widget_set_size_request (player_label, 200, 24); priv->player_label = player_label; gtk_box_pack_start (GTK_BOX(outer_v_box), priv->player_label, FALSE, FALSE, 0); @@ -319,9 +319,8 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget, MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(meta); GtkStyle *style; - int x, y, arrow_width, arrow_height; + int x, y, arrow_width, arrow_height; - gint offset = 3; arrow_width = 5; arrow_height = 9; @@ -331,7 +330,9 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget, gtk_widget_get_allocation (widget, &allocation); x = allocation.x; y = 0; - + + gint offset = (allocation.height - gdk_pixbuf_get_height (priv->icon_buf)) / 2; + // Draw player icon if (priv->icon_buf != NULL){ gdk_cairo_set_source_pixbuf (cr, @@ -340,11 +341,11 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget, y + offset); cairo_paint (cr); } - + // Draw triangle but only if the player is running. if (dbusmenu_menuitem_property_get_bool (priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING)){ - y += (double)arrow_height/2.0 + offset; + y += allocation.height/2.0 - (double)arrow_height/2.0; cairo_set_line_width (cr, 1.0); //g_debug ("triangle drawing"); @@ -426,9 +427,8 @@ metadata_widget_icon_triangle_draw_cb (GtkWidget *widget, GtkStyle *style; cairo_t *cr; - int x, y, arrow_width, arrow_height; + int x, y, arrow_width, arrow_height; - gint offset = 3; arrow_width = 5; arrow_height = 9; @@ -440,7 +440,9 @@ metadata_widget_icon_triangle_draw_cb (GtkWidget *widget, gtk_widget_get_allocation (widget, &allocation); x = allocation.x; y = allocation.y; - + + gint offset = (allocation.height - gdk_pixbuf_get_height (priv->icon_buf)) / 2; + // Draw player icon if (priv->icon_buf != NULL){ gdk_cairo_set_source_pixbuf (cr, @@ -449,11 +451,11 @@ metadata_widget_icon_triangle_draw_cb (GtkWidget *widget, y + offset); cairo_paint (cr); } - + // Draw triangle but only if the player is running. if (dbusmenu_menuitem_property_get_bool (priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING)){ - y += (double)arrow_height/2.0 + offset; + y += allocation.height/2.0 - (double)arrow_height/2.0; cairo_set_line_width (cr, 1.0); cairo_move_to (cr, x, y); diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c index b08c8a6..797ff61 100644 --- a/src/mpris2-controller.c +++ b/src/mpris2-controller.c @@ -1,4 +1,4 @@ -/* mpris2-controller.c generated by valac 0.12.1, the Vala compiler +/* mpris2-controller.c generated by valac 0.14.0, the Vala compiler * generated from mpris2-controller.vala, do not modify */ /* @@ -264,17 +264,25 @@ struct _Mpris2ControllerFetchPlaylistsData { PlaylistDetails* current_playlists; gint current_playlists_length1; gint _current_playlists_size_; - gint _tmp0_; - PlaylistDetails* _tmp1_; + MprisPlaylists* _tmp0_; + gint _tmp1_; PlaylistDetails* _tmp2_; - gint _tmp2__length1; - gint __tmp2__size_; - GError * e; - gpointer _tmp3_; - PlayerItem* _tmp4_; + PlaylistDetails* _tmp3_; + gint _tmp3__length1; + gint __tmp3__size_; + GError* e; + PlaylistDetails* _tmp4_; + gint _tmp4__length1; + PlayerController* _tmp5_; + GeeArrayList* _tmp6_; + gpointer _tmp7_; PlaylistsMenuitem* playlists_item; - gboolean _tmp5_; - gboolean* _tmp6_; + PlaylistsMenuitem* _tmp8_; + PlaylistDetails* _tmp9_; + gint _tmp9__length1; + PlayerController* _tmp10_; + gboolean _tmp11_; + gboolean* _tmp12_; GError * _inner_error_; }; @@ -314,6 +322,7 @@ enum { MPRIS2_CONTROLLER_PROPERTIES_INTERFACE, MPRIS2_CONTROLLER_OWNER }; +#define MPRIS2_CONTROLLER_MAX_PLAYLIST_COUNT 20 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); @@ -366,7 +375,7 @@ static void mpris2_controller_on_playlistdetails_changed (Mpris2Controller* self GType playlists_menuitem_get_type (void) G_GNUC_CONST; void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, PlaylistDetails* new_detail); static void mpris2_controller_fetch_playlists_data_free (gpointer _data); -static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlaylistsData* data); +static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlaylistsData* _data_); MprisPlaylists* mpris2_controller_get_playlists (Mpris2Controller* self); void mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); PlaylistDetails* mpris_playlists_GetPlaylists_finish (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error); @@ -398,8 +407,10 @@ static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify Mpris2Controller* mpris2_controller_construct (GType object_type, PlayerController* ctrl) { Mpris2Controller * self = NULL; + PlayerController* _tmp0_; g_return_val_if_fail (ctrl != NULL, NULL); - self = (Mpris2Controller*) g_object_new (object_type, "owner", ctrl, NULL); + _tmp0_ = ctrl; + self = (Mpris2Controller*) g_object_new (object_type, "owner", _tmp0_, NULL); return self; } @@ -451,128 +462,194 @@ static gboolean _mpris2_controller_fetch_active_playlist_gsource_func (gpointer void mpris2_controller_property_changed_cb (Mpris2Controller* self, const gchar* interface_source, GHashTable* changed_properties, gchar** invalid, int invalid_length1) { gboolean _tmp0_ = FALSE; - gconstpointer _tmp2_ = NULL; - GVariant* _tmp3_; + GHashTable* _tmp1_; + gboolean _tmp4_; + GHashTable* _tmp5_; + gconstpointer _tmp6_ = NULL; + GVariant* _tmp7_; GVariant* play_v; - gconstpointer _tmp9_ = NULL; - GVariant* _tmp10_; + GVariant* _tmp8_; + GHashTable* _tmp19_; + gconstpointer _tmp20_ = NULL; + GVariant* _tmp21_; GVariant* meta_v; - gconstpointer _tmp11_ = NULL; - GVariant* _tmp12_; + GVariant* _tmp22_; + GHashTable* _tmp23_; + gconstpointer _tmp24_ = NULL; + GVariant* _tmp25_; GVariant* playlist_v; - gboolean _tmp13_ = FALSE; - gconstpointer _tmp15_ = NULL; - GVariant* _tmp16_; + gboolean _tmp26_ = FALSE; + GVariant* _tmp27_; + gboolean _tmp31_; + GHashTable* _tmp32_; + gconstpointer _tmp33_ = NULL; + GVariant* _tmp34_; GVariant* playlist_count_v; - gboolean _tmp17_ = FALSE; - gconstpointer _tmp19_ = NULL; - GVariant* _tmp20_; + gboolean _tmp35_ = FALSE; + GVariant* _tmp36_; + gboolean _tmp40_; + GHashTable* _tmp41_; + gconstpointer _tmp42_ = NULL; + GVariant* _tmp43_; GVariant* playlist_orderings_v; - gboolean _tmp21_ = FALSE; - gconstpointer _tmp23_ = NULL; - GVariant* _tmp24_; + gboolean _tmp44_ = FALSE; + GVariant* _tmp45_; + gboolean _tmp49_; + GHashTable* _tmp50_; + gconstpointer _tmp51_ = NULL; + GVariant* _tmp52_; GVariant* identity_v; + GVariant* _tmp53_; g_return_if_fail (self != NULL); g_return_if_fail (interface_source != NULL); g_return_if_fail (changed_properties != NULL); - if (changed_properties == NULL) { + _tmp1_ = changed_properties; + if (_tmp1_ == NULL) { _tmp0_ = TRUE; } else { - gboolean _tmp1_; - _tmp1_ = g_str_has_prefix (interface_source, MPRIS_PREFIX); - _tmp0_ = _tmp1_ == FALSE; + const gchar* _tmp2_; + gboolean _tmp3_ = FALSE; + _tmp2_ = interface_source; + _tmp3_ = g_str_has_prefix (_tmp2_, MPRIS_PREFIX); + _tmp0_ = _tmp3_ == FALSE; } - if (_tmp0_) { - g_warning ("mpris2-controller.vala:77: Property-changed hash is null or this is an" \ + _tmp4_ = _tmp0_; + if (_tmp4_) { + g_warning ("mpris2-controller.vala:78: Property-changed hash is null or this is an" \ " interface that doesn't concern us"); return; } - _tmp2_ = g_hash_table_lookup (changed_properties, "PlaybackStatus"); - _tmp3_ = _g_variant_ref0 ((GVariant*) _tmp2_); - play_v = _tmp3_; - if (play_v != NULL) { - gchar* _tmp4_ = NULL; + _tmp5_ = changed_properties; + _tmp6_ = g_hash_table_lookup (_tmp5_, "PlaybackStatus"); + _tmp7_ = _g_variant_ref0 ((GVariant*) _tmp6_); + play_v = _tmp7_; + _tmp8_ = play_v; + if (_tmp8_ != NULL) { + MprisPlayer* _tmp9_; + gchar* _tmp10_; + gchar* _tmp11_; gchar* state; - TransportState _tmp5_; + const gchar* _tmp12_; + TransportState _tmp13_ = 0; TransportState p; - gpointer _tmp6_ = NULL; - PlayerItem* _tmp7_; - TransportMenuitem* _tmp8_; - _tmp4_ = mpris_player_get_PlaybackStatus (self->priv->_player); - state = _tmp4_; + PlayerController* _tmp14_; + GeeArrayList* _tmp15_; + gpointer _tmp16_ = NULL; + TransportMenuitem* _tmp17_; + TransportState _tmp18_; + _tmp9_ = self->priv->_player; + _tmp10_ = mpris_player_get_PlaybackStatus (_tmp9_); + _tmp11_ = _tmp10_; + state = _tmp11_; 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 = (TransportState) _tmp5_; - _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); - _tmp7_ = (PlayerItem*) _tmp6_; - _tmp8_ = IS_TRANSPORT_MENUITEM (_tmp7_) ? ((TransportMenuitem*) _tmp7_) : NULL; - transport_menuitem_change_play_state (_tmp8_, p); - _g_object_unref0 (_tmp8_); + _tmp12_ = state; + _tmp13_ = mpris2_controller_determine_play_state (self, _tmp12_); + p = (TransportState) _tmp13_; + _tmp14_ = self->priv->_owner; + _tmp15_ = _tmp14_->custom_items; + _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) _tmp15_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + _tmp17_ = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp16_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp16_)) : NULL; + _tmp18_ = p; + transport_menuitem_change_play_state (_tmp17_, _tmp18_); + _g_object_unref0 (_tmp17_); _g_free0 (state); } - _tmp9_ = g_hash_table_lookup (changed_properties, "Metadata"); - _tmp10_ = _g_variant_ref0 ((GVariant*) _tmp9_); - meta_v = _tmp10_; - if (meta_v != NULL) { + _tmp19_ = changed_properties; + _tmp20_ = g_hash_table_lookup (_tmp19_, "Metadata"); + _tmp21_ = _g_variant_ref0 ((GVariant*) _tmp20_); + meta_v = _tmp21_; + _tmp22_ = meta_v; + if (_tmp22_ != NULL) { g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 200, _mpris2_controller_ensure_correct_metadata_gsource_func, g_object_ref (self), g_object_unref); } - _tmp11_ = g_hash_table_lookup (changed_properties, "ActivePlaylist"); - _tmp12_ = _g_variant_ref0 ((GVariant*) _tmp11_); - playlist_v = _tmp12_; - if (playlist_v != NULL) { - gboolean _tmp14_; - _tmp14_ = TRUE; - _tmp13_ = _bool_equal (self->priv->_owner->use_playlists, &_tmp14_) == TRUE; + _tmp23_ = changed_properties; + _tmp24_ = g_hash_table_lookup (_tmp23_, "ActivePlaylist"); + _tmp25_ = _g_variant_ref0 ((GVariant*) _tmp24_); + playlist_v = _tmp25_; + _tmp27_ = playlist_v; + if (_tmp27_ != NULL) { + PlayerController* _tmp28_; + gboolean* _tmp29_; + gboolean _tmp30_; + _tmp28_ = self->priv->_owner; + _tmp29_ = _tmp28_->use_playlists; + _tmp30_ = TRUE; + _tmp26_ = _bool_equal (_tmp29_, &_tmp30_) == TRUE; } else { - _tmp13_ = FALSE; + _tmp26_ = FALSE; } - if (_tmp13_) { + _tmp31_ = _tmp26_; + if (_tmp31_) { g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 300, _mpris2_controller_fetch_active_playlist_gsource_func, g_object_ref (self), g_object_unref); } - _tmp15_ = g_hash_table_lookup (changed_properties, "PlaylistCount"); - _tmp16_ = _g_variant_ref0 ((GVariant*) _tmp15_); - playlist_count_v = _tmp16_; - if (playlist_count_v != NULL) { - gboolean _tmp18_; - _tmp18_ = TRUE; - _tmp17_ = _bool_equal (self->priv->_owner->use_playlists, &_tmp18_) == TRUE; + _tmp32_ = changed_properties; + _tmp33_ = g_hash_table_lookup (_tmp32_, "PlaylistCount"); + _tmp34_ = _g_variant_ref0 ((GVariant*) _tmp33_); + playlist_count_v = _tmp34_; + _tmp36_ = playlist_count_v; + if (_tmp36_ != NULL) { + PlayerController* _tmp37_; + gboolean* _tmp38_; + gboolean _tmp39_; + _tmp37_ = self->priv->_owner; + _tmp38_ = _tmp37_->use_playlists; + _tmp39_ = TRUE; + _tmp35_ = _bool_equal (_tmp38_, &_tmp39_) == TRUE; } else { - _tmp17_ = FALSE; + _tmp35_ = FALSE; } - if (_tmp17_) { + _tmp40_ = _tmp35_; + if (_tmp40_) { mpris2_controller_fetch_playlists (self, NULL, NULL); mpris2_controller_fetch_active_playlist (self); } - _tmp19_ = g_hash_table_lookup (changed_properties, "Orderings"); - _tmp20_ = _g_variant_ref0 ((GVariant*) _tmp19_); - playlist_orderings_v = _tmp20_; - if (playlist_orderings_v != NULL) { - gboolean _tmp22_; - _tmp22_ = TRUE; - _tmp21_ = _bool_equal (self->priv->_owner->use_playlists, &_tmp22_) == TRUE; + _tmp41_ = changed_properties; + _tmp42_ = g_hash_table_lookup (_tmp41_, "Orderings"); + _tmp43_ = _g_variant_ref0 ((GVariant*) _tmp42_); + playlist_orderings_v = _tmp43_; + _tmp45_ = playlist_orderings_v; + if (_tmp45_ != NULL) { + PlayerController* _tmp46_; + gboolean* _tmp47_; + gboolean _tmp48_; + _tmp46_ = self->priv->_owner; + _tmp47_ = _tmp46_->use_playlists; + _tmp48_ = TRUE; + _tmp44_ = _bool_equal (_tmp47_, &_tmp48_) == TRUE; } else { - _tmp21_ = FALSE; + _tmp44_ = FALSE; } - if (_tmp21_) { + _tmp49_ = _tmp44_; + if (_tmp49_) { mpris2_controller_fetch_playlists (self, NULL, NULL); mpris2_controller_fetch_active_playlist (self); } - _tmp23_ = g_hash_table_lookup (changed_properties, "Identity"); - _tmp24_ = _g_variant_ref0 ((GVariant*) _tmp23_); - identity_v = _tmp24_; - if (identity_v != NULL) { - gpointer _tmp25_ = NULL; - PlayerItem* _tmp26_; + _tmp50_ = changed_properties; + _tmp51_ = g_hash_table_lookup (_tmp50_, "Identity"); + _tmp52_ = _g_variant_ref0 ((GVariant*) _tmp51_); + identity_v = _tmp52_; + _tmp53_ = identity_v; + if (_tmp53_ != NULL) { + PlayerController* _tmp54_; + GeeArrayList* _tmp55_; + gpointer _tmp56_ = NULL; MetadataMenuitem* md; - gchar* _tmp27_ = NULL; - gchar* _tmp28_; - _tmp25_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp26_ = (PlayerItem*) _tmp25_; - md = IS_METADATA_MENUITEM (_tmp26_) ? ((MetadataMenuitem*) _tmp26_) : NULL; - _tmp27_ = mpris_root_get_Identity (self->priv->_mpris2_root); - _tmp28_ = _tmp27_; - metadata_menuitem_alter_label (md, _tmp28_); - _g_free0 (_tmp28_); + MetadataMenuitem* _tmp57_; + MprisRoot* _tmp58_; + gchar* _tmp59_; + gchar* _tmp60_; + gchar* _tmp61_; + _tmp54_ = self->priv->_owner; + _tmp55_ = _tmp54_->custom_items; + _tmp56_ = gee_abstract_list_get ((GeeAbstractList*) _tmp55_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp56_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp56_)) : NULL; + _tmp57_ = md; + _tmp58_ = self->priv->_mpris2_root; + _tmp59_ = mpris_root_get_Identity (_tmp58_); + _tmp60_ = _tmp59_; + _tmp61_ = _tmp60_; + metadata_menuitem_alter_label (_tmp57_, _tmp61_); + _g_free0 (_tmp61_); _g_object_unref0 (md); } _g_variant_unref0 (identity_v); @@ -588,42 +665,48 @@ static gboolean mpris2_controller_ensure_correct_metadata (Mpris2Controller* sel gboolean result = FALSE; GHashTable* _tmp0_ = NULL; GHashTable* changed_updates; - gpointer _tmp1_ = NULL; + PlayerController* _tmp1_; + GeeArrayList* _tmp2_; + gpointer _tmp3_ = NULL; PlayerItem* metadata; - GeeHashSet* _tmp2_ = NULL; - GeeHashSet* _tmp3_; GeeHashSet* _tmp4_ = NULL; GeeHashSet* _tmp5_; - gpointer _tmp6_ = NULL; - PlayerItem* _tmp7_; + GeeHashSet* _tmp6_ = NULL; + GeeHashSet* _tmp7_; + PlayerController* _tmp8_; + GeeArrayList* _tmp9_; + gpointer _tmp10_ = NULL; MetadataMenuitem* md; - GeeHashSet* _tmp8_ = NULL; - GeeHashSet* _tmp9_; - gboolean _tmp10_; - gboolean _tmp11_; + GeeHashSet* _tmp11_ = NULL; + GeeHashSet* _tmp12_; + gboolean _tmp13_ = FALSE; + gboolean _tmp14_; gboolean collapsing; g_return_val_if_fail (self != NULL, FALSE); _tmp0_ = mpris2_controller_clean_metadata (self); changed_updates = _tmp0_; - _tmp1_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - metadata = (PlayerItem*) _tmp1_; - _tmp2_ = metadata_menuitem_relevant_attributes_for_ui (); - _tmp3_ = _tmp2_; - player_item_reset (metadata, _tmp3_); - _g_object_unref0 (_tmp3_); + _tmp1_ = self->priv->_owner; + _tmp2_ = _tmp1_->custom_items; + _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + metadata = (PlayerItem*) _tmp3_; _tmp4_ = metadata_menuitem_relevant_attributes_for_ui (); _tmp5_ = _tmp4_; - player_item_update (metadata, changed_updates, _tmp5_); + player_item_reset (metadata, _tmp5_); _g_object_unref0 (_tmp5_); - _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp7_ = (PlayerItem*) _tmp6_; - md = IS_METADATA_MENUITEM (_tmp7_) ? ((MetadataMenuitem*) _tmp7_) : NULL; - _tmp8_ = metadata_menuitem_relevant_attributes_for_ui (); - _tmp9_ = _tmp8_; - _tmp10_ = player_item_populated (metadata, _tmp9_); - _tmp11_ = !_tmp10_; - _g_object_unref0 (_tmp9_); - collapsing = _tmp11_; + _tmp6_ = metadata_menuitem_relevant_attributes_for_ui (); + _tmp7_ = _tmp6_; + player_item_update (metadata, changed_updates, _tmp7_); + _g_object_unref0 (_tmp7_); + _tmp8_ = self->priv->_owner; + _tmp9_ = _tmp8_->custom_items; + _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp10_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp10_)) : NULL; + _tmp11_ = metadata_menuitem_relevant_attributes_for_ui (); + _tmp12_ = _tmp11_; + _tmp13_ = player_item_populated (metadata, _tmp12_); + _tmp14_ = !_tmp13_; + _g_object_unref0 (_tmp12_); + collapsing = _tmp14_; metadata_menuitem_should_collapse (md, collapsing); result = FALSE; _g_object_unref0 (md); @@ -635,26 +718,32 @@ static gboolean mpris2_controller_ensure_correct_metadata (Mpris2Controller* sel static gboolean mpris2_controller_ensure_correct_playback_status (Mpris2Controller* self) { gboolean result = FALSE; - gchar* _tmp0_ = NULL; + MprisPlayer* _tmp0_; gchar* _tmp1_; - TransportState _tmp2_; - TransportState _tmp3_; + gchar* _tmp2_; + gchar* _tmp3_; + TransportState _tmp4_ = 0; + TransportState _tmp5_; TransportState p; - gpointer _tmp4_ = NULL; - PlayerItem* _tmp5_; - TransportMenuitem* _tmp6_; + PlayerController* _tmp6_; + GeeArrayList* _tmp7_; + gpointer _tmp8_ = NULL; + TransportMenuitem* _tmp9_; g_return_val_if_fail (self != NULL, FALSE); - _tmp0_ = mpris_player_get_PlaybackStatus (self->priv->_player); - _tmp1_ = _tmp0_; - _tmp2_ = mpris2_controller_determine_play_state (self, _tmp1_); - _tmp3_ = (TransportState) _tmp2_; - _g_free0 (_tmp1_); - p = _tmp3_; - _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); - _tmp5_ = (PlayerItem*) _tmp4_; - _tmp6_ = IS_TRANSPORT_MENUITEM (_tmp5_) ? ((TransportMenuitem*) _tmp5_) : NULL; - transport_menuitem_change_play_state (_tmp6_, p); - _g_object_unref0 (_tmp6_); + _tmp0_ = self->priv->_player; + _tmp1_ = mpris_player_get_PlaybackStatus (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = _tmp2_; + _tmp4_ = mpris2_controller_determine_play_state (self, _tmp3_); + _tmp5_ = (TransportState) _tmp4_; + _g_free0 (_tmp3_); + p = _tmp5_; + _tmp6_ = self->priv->_owner; + _tmp7_ = _tmp6_->custom_items; + _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + _tmp9_ = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp8_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp8_)) : NULL; + transport_menuitem_change_play_state (_tmp9_, p); + _g_object_unref0 (_tmp9_); result = FALSE; return result; } @@ -667,54 +756,80 @@ static GVariant* _variant_new1 (const gchar* value) { static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) { GHashTable* result = NULL; - GHashTable* _tmp0_ = NULL; - GHashTable* changed_updates; - GHashTable* _tmp1_ = NULL; + MprisPlayer* _tmp0_; + GHashTable* _tmp1_; GHashTable* _tmp2_; - gconstpointer _tmp3_ = NULL; - GVariant* _tmp4_; - GVariant* _tmp5_; + GHashTable* changed_updates; + MprisPlayer* _tmp3_; + GHashTable* _tmp4_; + GHashTable* _tmp5_; + GHashTable* _tmp6_; + gconstpointer _tmp7_ = NULL; + GVariant* _tmp8_; + GVariant* _tmp9_; GVariant* artist_v; + GVariant* _tmp10_; g_return_val_if_fail (self != NULL, NULL); - _tmp0_ = mpris_player_get_Metadata (self->priv->_player); - changed_updates = _tmp0_; - _tmp1_ = mpris_player_get_Metadata (self->priv->_player); + _tmp0_ = self->priv->_player; + _tmp1_ = mpris_player_get_Metadata (_tmp0_); _tmp2_ = _tmp1_; - _tmp3_ = g_hash_table_lookup (_tmp2_, "xesam:artist"); - _tmp4_ = _g_variant_ref0 ((GVariant*) _tmp3_); + changed_updates = _tmp2_; + _tmp3_ = self->priv->_player; + _tmp4_ = mpris_player_get_Metadata (_tmp3_); _tmp5_ = _tmp4_; - _g_hash_table_unref0 (_tmp2_); - artist_v = _tmp5_; - if (artist_v != NULL) { + _tmp6_ = _tmp5_; + _tmp7_ = g_hash_table_lookup (_tmp6_, "xesam:artist"); + _tmp8_ = _g_variant_ref0 ((GVariant*) _tmp7_); + _tmp9_ = _tmp8_; + _g_hash_table_unref0 (_tmp6_); + artist_v = _tmp9_; + _tmp10_ = artist_v; + if (_tmp10_ != NULL) { gchar* display_artists = NULL; - const gchar* _tmp6_ = NULL; - gchar* _tmp12_; - _tmp6_ = g_variant_get_type_string (artist_v); - if (g_strcmp0 (_tmp6_, "s") == 0) { - const gchar* _tmp7_ = NULL; - gchar* _tmp8_; - _tmp7_ = g_variant_get_string (artist_v, NULL); - _tmp8_ = g_strdup (_tmp7_); + GVariant* _tmp11_; + const gchar* _tmp12_ = NULL; + GHashTable* _tmp21_; + gchar* _tmp22_; + const gchar* _tmp23_; + GVariant* _tmp24_; + _tmp11_ = artist_v; + _tmp12_ = g_variant_get_type_string (_tmp11_); + if (g_strcmp0 (_tmp12_, "s") == 0) { + GVariant* _tmp13_; + const gchar* _tmp14_ = NULL; + gchar* _tmp15_; + _tmp13_ = artist_v; + _tmp14_ = g_variant_get_string (_tmp13_, NULL); + _tmp15_ = g_strdup (_tmp14_); _g_free0 (display_artists); - display_artists = _tmp8_; + display_artists = _tmp15_; } else { - size_t _tmp9_; - gchar** _tmp10_ = NULL; + GVariant* _tmp16_; + size_t _tmp17_; + gchar** _tmp18_ = NULL; gchar** artists; gint artists_length1; gint _artists_size_; - gchar* _tmp11_ = NULL; - _tmp10_ = g_variant_dup_strv (artist_v, &_tmp9_); - artists = _tmp10_; - artists_length1 = _tmp9_; - _artists_size_ = _tmp9_; - _tmp11_ = g_strjoinv (", ", artists); + gchar** _tmp19_; + gint _tmp19__length1; + gchar* _tmp20_ = NULL; + _tmp16_ = artist_v; + _tmp18_ = g_variant_dup_strv (_tmp16_, &_tmp17_); + artists = _tmp18_; + artists_length1 = _tmp17_; + _artists_size_ = artists_length1; + _tmp19_ = artists; + _tmp19__length1 = artists_length1; + _tmp20_ = g_strjoinv (", ", _tmp19_); _g_free0 (display_artists); - display_artists = _tmp11_; + display_artists = _tmp20_; artists = (_vala_array_free (artists, artists_length1, (GDestroyNotify) g_free), NULL); } - _tmp12_ = g_strdup ("xesam:artist"); - g_hash_table_replace (changed_updates, _tmp12_, _variant_new1 (display_artists)); + _tmp21_ = changed_updates; + _tmp22_ = g_strdup ("xesam:artist"); + _tmp23_ = display_artists; + _tmp24_ = _variant_new1 (_tmp23_); + g_hash_table_replace (_tmp21_, _tmp22_, _tmp24_); _g_free0 (display_artists); } result = changed_updates; @@ -726,13 +841,19 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) { static TransportState mpris2_controller_determine_play_state (Mpris2Controller* self, const gchar* status) { TransportState result = 0; gboolean _tmp0_ = FALSE; + const gchar* _tmp1_; + gboolean _tmp3_; g_return_val_if_fail (self != NULL, 0); - if (status != NULL) { - _tmp0_ = g_strcmp0 (status, "Playing") == 0; + _tmp1_ = status; + if (_tmp1_ != NULL) { + const gchar* _tmp2_; + _tmp2_ = status; + _tmp0_ = g_strcmp0 (_tmp2_, "Playing") == 0; } else { _tmp0_ = FALSE; } - if (_tmp0_) { + _tmp3_ = _tmp0_; + if (_tmp3_) { result = TRANSPORT_STATE_PLAYING; return result; } @@ -743,74 +864,108 @@ static TransportState mpris2_controller_determine_play_state (Mpris2Controller* void mpris2_controller_initial_update (Mpris2Controller* self) { TransportState update = 0; - gchar* _tmp0_ = NULL; + MprisPlayer* _tmp0_; gchar* _tmp1_; - gboolean _tmp2_; - gchar* _tmp6_ = NULL; - gchar* _tmp7_; - gboolean _tmp8_; - gpointer _tmp13_ = NULL; - PlayerItem* _tmp14_; - TransportMenuitem* _tmp15_; - GHashTable* _tmp16_ = NULL; + gchar* _tmp2_; + gchar* _tmp3_; + gboolean _tmp4_; + MprisRoot* _tmp10_; + gchar* _tmp11_; + gchar* _tmp12_; + gchar* _tmp13_; + gboolean _tmp14_; + PlayerController* _tmp23_; + GeeArrayList* _tmp24_; + gpointer _tmp25_ = NULL; + TransportMenuitem* _tmp26_; + TransportState _tmp27_; + GHashTable* _tmp28_ = NULL; GHashTable* cleaned_metadata; - gpointer _tmp17_ = NULL; - PlayerItem* _tmp18_; - GeeHashSet* _tmp19_ = NULL; - GeeHashSet* _tmp20_; - gboolean _tmp21_; + PlayerController* _tmp29_; + GeeArrayList* _tmp30_; + gpointer _tmp31_ = NULL; + PlayerItem* _tmp32_; + GHashTable* _tmp33_; + GeeHashSet* _tmp34_ = NULL; + GeeHashSet* _tmp35_; + PlayerController* _tmp36_; + gboolean* _tmp37_; + gboolean _tmp38_; g_return_if_fail (self != NULL); - _tmp0_ = mpris_player_get_PlaybackStatus (self->priv->_player); - _tmp1_ = _tmp0_; - _tmp2_ = _tmp1_ == NULL; - _g_free0 (_tmp1_); - if (_tmp2_) { + _tmp0_ = self->priv->_player; + _tmp1_ = mpris_player_get_PlaybackStatus (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = _tmp2_; + _tmp4_ = _tmp3_ == NULL; + _g_free0 (_tmp3_); + if (_tmp4_) { update = TRANSPORT_STATE_PAUSED; } else { - gchar* _tmp3_ = NULL; - gchar* _tmp4_; - TransportState _tmp5_; - _tmp3_ = mpris_player_get_PlaybackStatus (self->priv->_player); - _tmp4_ = _tmp3_; - _tmp5_ = mpris2_controller_determine_play_state (self, _tmp4_); - update = _tmp5_; - _g_free0 (_tmp4_); + MprisPlayer* _tmp5_; + gchar* _tmp6_; + gchar* _tmp7_; + gchar* _tmp8_; + TransportState _tmp9_ = 0; + _tmp5_ = self->priv->_player; + _tmp6_ = mpris_player_get_PlaybackStatus (_tmp5_); + _tmp7_ = _tmp6_; + _tmp8_ = _tmp7_; + _tmp9_ = mpris2_controller_determine_play_state (self, _tmp8_); + update = _tmp9_; + _g_free0 (_tmp8_); } - _tmp6_ = mpris_root_get_Identity (self->priv->_mpris2_root); - _tmp7_ = _tmp6_; - _tmp8_ = _tmp7_ != NULL; - _g_free0 (_tmp7_); - if (_tmp8_) { - gpointer _tmp9_ = NULL; - PlayerItem* _tmp10_; + _tmp10_ = self->priv->_mpris2_root; + _tmp11_ = mpris_root_get_Identity (_tmp10_); + _tmp12_ = _tmp11_; + _tmp13_ = _tmp12_; + _tmp14_ = _tmp13_ != NULL; + _g_free0 (_tmp13_); + if (_tmp14_) { + PlayerController* _tmp15_; + GeeArrayList* _tmp16_; + gpointer _tmp17_ = NULL; MetadataMenuitem* md; - gchar* _tmp11_ = NULL; - gchar* _tmp12_; - _tmp9_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp10_ = (PlayerItem*) _tmp9_; - md = IS_METADATA_MENUITEM (_tmp10_) ? ((MetadataMenuitem*) _tmp10_) : NULL; - _tmp11_ = mpris_root_get_Identity (self->priv->_mpris2_root); - _tmp12_ = _tmp11_; - metadata_menuitem_alter_label (md, _tmp12_); - _g_free0 (_tmp12_); + MetadataMenuitem* _tmp18_; + MprisRoot* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_; + _tmp15_ = self->priv->_owner; + _tmp16_ = _tmp15_->custom_items; + _tmp17_ = gee_abstract_list_get ((GeeAbstractList*) _tmp16_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp17_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp17_)) : NULL; + _tmp18_ = md; + _tmp19_ = self->priv->_mpris2_root; + _tmp20_ = mpris_root_get_Identity (_tmp19_); + _tmp21_ = _tmp20_; + _tmp22_ = _tmp21_; + metadata_menuitem_alter_label (_tmp18_, _tmp22_); + _g_free0 (_tmp22_); _g_object_unref0 (md); } - _tmp13_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); - _tmp14_ = (PlayerItem*) _tmp13_; - _tmp15_ = IS_TRANSPORT_MENUITEM (_tmp14_) ? ((TransportMenuitem*) _tmp14_) : NULL; - transport_menuitem_change_play_state (_tmp15_, update); - _g_object_unref0 (_tmp15_); - _tmp16_ = mpris2_controller_clean_metadata (self); - cleaned_metadata = _tmp16_; - _tmp17_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp18_ = (PlayerItem*) _tmp17_; - _tmp19_ = metadata_menuitem_attributes_format (); - _tmp20_ = _tmp19_; - player_item_update (_tmp18_, cleaned_metadata, _tmp20_); - _g_object_unref0 (_tmp20_); - _g_object_unref0 (_tmp18_); - _tmp21_ = TRUE; - if (_bool_equal (self->priv->_owner->use_playlists, &_tmp21_) == TRUE) { + _tmp23_ = self->priv->_owner; + _tmp24_ = _tmp23_->custom_items; + _tmp25_ = gee_abstract_list_get ((GeeAbstractList*) _tmp24_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + _tmp26_ = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp25_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp25_)) : NULL; + _tmp27_ = update; + transport_menuitem_change_play_state (_tmp26_, _tmp27_); + _g_object_unref0 (_tmp26_); + _tmp28_ = mpris2_controller_clean_metadata (self); + cleaned_metadata = _tmp28_; + _tmp29_ = self->priv->_owner; + _tmp30_ = _tmp29_->custom_items; + _tmp31_ = gee_abstract_list_get ((GeeAbstractList*) _tmp30_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + _tmp32_ = (PlayerItem*) _tmp31_; + _tmp33_ = cleaned_metadata; + _tmp34_ = metadata_menuitem_attributes_format (); + _tmp35_ = _tmp34_; + player_item_update (_tmp32_, _tmp33_, _tmp35_); + _g_object_unref0 (_tmp35_); + _g_object_unref0 (_tmp32_); + _tmp36_ = self->priv->_owner; + _tmp37_ = _tmp36_->use_playlists; + _tmp38_ = TRUE; + if (_bool_equal (_tmp37_, &_tmp38_) == TRUE) { mpris2_controller_fetch_playlists (self, NULL, NULL); mpris2_controller_fetch_active_playlist (self); } @@ -819,21 +974,41 @@ void mpris2_controller_initial_update (Mpris2Controller* self) { void mpris2_controller_transport_update (Mpris2Controller* self, TransportAction command) { + TransportAction _tmp0_; g_return_if_fail (self != NULL); - if (command == TRANSPORT_ACTION_PLAY_PAUSE) { - mpris_player_PlayPause (self->priv->_player, NULL, NULL); + _tmp0_ = command; + if (_tmp0_ == TRANSPORT_ACTION_PLAY_PAUSE) { + MprisPlayer* _tmp1_; + _tmp1_ = self->priv->_player; + mpris_player_PlayPause (_tmp1_, NULL, NULL); } else { - if (command == TRANSPORT_ACTION_PREVIOUS) { - mpris_player_Previous (self->priv->_player, NULL, NULL); + TransportAction _tmp2_; + _tmp2_ = command; + if (_tmp2_ == TRANSPORT_ACTION_PREVIOUS) { + MprisPlayer* _tmp3_; + _tmp3_ = self->priv->_player; + mpris_player_Previous (_tmp3_, NULL, NULL); } else { - if (command == TRANSPORT_ACTION_NEXT) { - mpris_player_Next (self->priv->_player, NULL, NULL); + TransportAction _tmp4_; + _tmp4_ = command; + if (_tmp4_ == TRANSPORT_ACTION_NEXT) { + MprisPlayer* _tmp5_; + _tmp5_ = self->priv->_player; + mpris_player_Next (_tmp5_, NULL, NULL); } else { - if (command == TRANSPORT_ACTION_REWIND) { - mpris_player_Seek (self->priv->_player, (gint64) (-500000), NULL, NULL); + TransportAction _tmp6_; + _tmp6_ = command; + if (_tmp6_ == TRANSPORT_ACTION_REWIND) { + MprisPlayer* _tmp7_; + _tmp7_ = self->priv->_player; + mpris_player_Seek (_tmp7_, (gint64) (-500000), NULL, NULL); } else { - if (command == TRANSPORT_ACTION_FORWIND) { - mpris_player_Seek (self->priv->_player, (gint64) 400000, NULL, NULL); + TransportAction _tmp8_; + _tmp8_ = command; + if (_tmp8_ == TRANSPORT_ACTION_FORWIND) { + MprisPlayer* _tmp9_; + _tmp9_ = self->priv->_player; + mpris_player_Seek (_tmp9_, (gint64) 400000, NULL, NULL); } } } @@ -845,45 +1020,58 @@ void mpris2_controller_transport_update (Mpris2Controller* self, TransportAction gboolean mpris2_controller_connected (Mpris2Controller* self) { gboolean result = FALSE; gboolean _tmp0_ = FALSE; + MprisPlayer* _tmp1_; + gboolean _tmp3_; g_return_val_if_fail (self != NULL, FALSE); - if (self->priv->_player != NULL) { - _tmp0_ = self->priv->_mpris2_root != NULL; + _tmp1_ = self->priv->_player; + if (_tmp1_ != NULL) { + MprisRoot* _tmp2_; + _tmp2_ = self->priv->_mpris2_root; + _tmp0_ = _tmp2_ != NULL; } else { _tmp0_ = FALSE; } - result = _tmp0_; + _tmp3_ = _tmp0_; + result = _tmp3_; return result; } void mpris2_controller_expose (Mpris2Controller* self) { - gboolean _tmp0_; + gboolean _tmp0_ = FALSE; g_return_if_fail (self != NULL); _tmp0_ = mpris2_controller_connected (self); if (_tmp0_ == TRUE) { - mpris_root_Raise (self->priv->_mpris2_root, NULL, NULL); + MprisRoot* _tmp1_; + _tmp1_ = self->priv->_mpris2_root; + mpris_root_Raise (_tmp1_, NULL, NULL); } } static void mpris2_controller_on_playlistdetails_changed (Mpris2Controller* self, PlaylistDetails* details) { - gpointer _tmp0_ = NULL; - PlayerItem* _tmp1_; + PlayerController* _tmp0_; + GeeArrayList* _tmp1_; + gpointer _tmp2_ = NULL; PlaylistsMenuitem* playlists_item; + PlaylistDetails _tmp3_; g_return_if_fail (self != NULL); - _tmp0_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); - _tmp1_ = (PlayerItem*) _tmp0_; - playlists_item = IS_PLAYLISTS_MENUITEM (_tmp1_) ? ((PlaylistsMenuitem*) _tmp1_) : NULL; - playlists_menuitem_update_individual_playlist (playlists_item, details); + g_return_if_fail (details != NULL); + _tmp0_ = self->priv->_owner; + _tmp1_ = _tmp0_->custom_items; + _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) _tmp1_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); + playlists_item = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _tmp2_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _tmp2_)) : NULL; + _tmp3_ = *details; + playlists_menuitem_update_individual_playlist (playlists_item, &_tmp3_); _g_object_unref0 (playlists_item); } static void mpris2_controller_fetch_playlists_data_free (gpointer _data) { - Mpris2ControllerFetchPlaylistsData* data; - data = _data; - _g_object_unref0 (data->self); - g_slice_free (Mpris2ControllerFetchPlaylistsData, data); + Mpris2ControllerFetchPlaylistsData* _data_; + _data_ = _data; + _g_object_unref0 (_data_->self); + g_slice_free (Mpris2ControllerFetchPlaylistsData, _data_); } @@ -894,10 +1082,12 @@ static gpointer _g_object_ref0 (gpointer self) { void mpris2_controller_fetch_playlists (Mpris2Controller* self, GAsyncReadyCallback _callback_, gpointer _user_data_) { Mpris2ControllerFetchPlaylistsData* _data_; + Mpris2Controller* _tmp0_; _data_ = g_slice_new0 (Mpris2ControllerFetchPlaylistsData); _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, mpris2_controller_fetch_playlists); g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, mpris2_controller_fetch_playlists_data_free); - _data_->self = _g_object_ref0 (self); + _tmp0_ = _g_object_ref0 (self); + _data_->self = _tmp0_; mpris2_controller_fetch_playlists_co (_data_); } @@ -909,11 +1099,11 @@ void mpris2_controller_fetch_playlists_finish (Mpris2Controller* self, GAsyncRes static void mpris2_controller_fetch_playlists_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { - Mpris2ControllerFetchPlaylistsData* data; - data = _user_data_; - data->_source_object_ = source_object; - data->_res_ = _res_; - mpris2_controller_fetch_playlists_co (data); + Mpris2ControllerFetchPlaylistsData* _data_; + _data_ = _user_data_; + _data_->_source_object_ = source_object; + _data_->_res_ = _res_; + mpris2_controller_fetch_playlists_co (_data_); } @@ -941,8 +1131,8 @@ static gpointer __bool_dup0 (gpointer self) { } -static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlaylistsData* data) { - switch (data->_state_) { +static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlaylistsData* _data_) { + switch (_data_->_state_) { case 0: goto _state_0; case 1: @@ -951,103 +1141,128 @@ static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlayl g_assert_not_reached (); } _state_0: - data->current_playlists = NULL; - data->current_playlists_length1 = 0; - data->_current_playlists_size_ = 0; - data->_state_ = 1; - mpris_playlists_GetPlaylists (data->self->priv->_playlists, (guint32) 0, (guint32) 10, "Alphabetical", FALSE, mpris2_controller_fetch_playlists_ready, data); - return FALSE; - _state_1: - data->_tmp1_ = NULL; - data->_tmp1_ = mpris_playlists_GetPlaylists_finish (data->self->priv->_playlists, data->_res_, &data->_tmp0_, &data->_inner_error_); - data->_tmp2_ = data->_tmp1_; - data->_tmp2__length1 = data->_tmp0_; - data->__tmp2__size_ = data->_tmp0_; - if (data->_inner_error_ != NULL) { - if (data->_inner_error_->domain == G_IO_ERROR) { - goto __catch11_g_io_error; - } - data->current_playlists = (_vala_PlaylistDetails_array_free (data->current_playlists, data->current_playlists_length1), NULL); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); - g_clear_error (&data->_inner_error_); + _data_->current_playlists = NULL; + _data_->current_playlists_length1 = 0; + _data_->_current_playlists_size_ = _data_->current_playlists_length1; + { + _data_->_tmp0_ = _data_->self->priv->_playlists; + _data_->_tmp1_ = 0; + _data_->_state_ = 1; + mpris_playlists_GetPlaylists (_data_->_tmp0_, (guint32) 0, (guint32) MPRIS2_CONTROLLER_MAX_PLAYLIST_COUNT, "Alphabetical", FALSE, mpris2_controller_fetch_playlists_ready, _data_); return FALSE; + _state_1: + _data_->_tmp2_ = NULL; + _data_->_tmp2_ = mpris_playlists_GetPlaylists_finish (_data_->_tmp0_, _data_->_res_, &_data_->_tmp1_, &_data_->_inner_error_); + _data_->_tmp3_ = _data_->_tmp2_; + _data_->_tmp3__length1 = _data_->_tmp1_; + _data_->__tmp3__size_ = _data_->_tmp3__length1; + if (_data_->_inner_error_ != NULL) { + if (_data_->_inner_error_->domain == G_IO_ERROR) { + goto __catch11_g_io_error; + } + _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL); + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code); + g_clear_error (&_data_->_inner_error_); + return FALSE; + } + _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL); + _data_->current_playlists = _data_->_tmp3_; + _data_->current_playlists_length1 = _data_->_tmp3__length1; + _data_->_current_playlists_size_ = _data_->current_playlists_length1; } - data->current_playlists = (_vala_PlaylistDetails_array_free (data->current_playlists, data->current_playlists_length1), NULL); - data->current_playlists = data->_tmp2_; - data->current_playlists_length1 = data->_tmp2__length1; - data->_current_playlists_size_ = data->_tmp2__length1; goto __finally11; __catch11_g_io_error: { - data->e = data->_inner_error_; - data->_inner_error_ = NULL; - _g_error_free0 (data->e); - data->current_playlists = (_vala_PlaylistDetails_array_free (data->current_playlists, data->current_playlists_length1), NULL); - if (data->_state_ == 0) { - g_simple_async_result_complete_in_idle (data->_async_result); + _data_->e = _data_->_inner_error_; + _data_->_inner_error_ = NULL; + _g_error_free0 (_data_->e); + _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL); + if (_data_->_state_ == 0) { + g_simple_async_result_complete_in_idle (_data_->_async_result); } else { - g_simple_async_result_complete (data->_async_result); + g_simple_async_result_complete (_data_->_async_result); } - g_object_unref (data->_async_result); + g_object_unref (_data_->_async_result); return FALSE; } __finally11: - if (data->_inner_error_ != NULL) { - data->current_playlists = (_vala_PlaylistDetails_array_free (data->current_playlists, data->current_playlists_length1), NULL); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); - g_clear_error (&data->_inner_error_); + if (_data_->_inner_error_ != NULL) { + _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL); + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code); + g_clear_error (&_data_->_inner_error_); return FALSE; } - if (data->current_playlists != NULL) { - data->_tmp3_ = NULL; - data->_tmp3_ = gee_abstract_list_get ((GeeAbstractList*) data->self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); - data->_tmp4_ = (PlayerItem*) data->_tmp3_; - data->playlists_item = IS_PLAYLISTS_MENUITEM (data->_tmp4_) ? ((PlaylistsMenuitem*) data->_tmp4_) : NULL; - playlists_menuitem_update (data->playlists_item, data->current_playlists, data->current_playlists_length1); - _g_object_unref0 (data->playlists_item); + _data_->_tmp4_ = _data_->current_playlists; + _data_->_tmp4__length1 = _data_->current_playlists_length1; + if (_data_->_tmp4_ != NULL) { + _data_->_tmp5_ = _data_->self->priv->_owner; + _data_->_tmp6_ = _data_->_tmp5_->custom_items; + _data_->_tmp7_ = NULL; + _data_->_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp6_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); + _data_->playlists_item = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _data_->_tmp7_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _data_->_tmp7_)) : NULL; + _data_->_tmp8_ = _data_->playlists_item; + _data_->_tmp9_ = _data_->current_playlists; + _data_->_tmp9__length1 = _data_->current_playlists_length1; + playlists_menuitem_update (_data_->_tmp8_, _data_->_tmp9_, _data_->_tmp9__length1); + _g_object_unref0 (_data_->playlists_item); } else { - g_warning ("mpris2-controller.vala:242: Playlists are on but its returning no cur" \ + g_warning ("mpris2-controller.vala:243: Playlists are on but its returning no cur" \ "rent_playlists"); - data->_tmp5_ = FALSE; - data->_tmp6_ = __bool_dup0 (&data->_tmp5_); - _g_free0 (data->self->priv->_owner->use_playlists); - data->self->priv->_owner->use_playlists = data->_tmp6_; + _data_->_tmp10_ = _data_->self->priv->_owner; + _data_->_tmp11_ = FALSE; + _data_->_tmp12_ = __bool_dup0 (&_data_->_tmp11_); + _g_free0 (_data_->_tmp10_->use_playlists); + _data_->_tmp10_->use_playlists = _data_->_tmp12_; } - data->current_playlists = (_vala_PlaylistDetails_array_free (data->current_playlists, data->current_playlists_length1), NULL); - if (data->_state_ == 0) { - g_simple_async_result_complete_in_idle (data->_async_result); + _data_->current_playlists = (_vala_PlaylistDetails_array_free (_data_->current_playlists, _data_->current_playlists_length1), NULL); + if (_data_->_state_ == 0) { + g_simple_async_result_complete_in_idle (_data_->_async_result); } else { - g_simple_async_result_complete (data->_async_result); + g_simple_async_result_complete (_data_->_async_result); } - g_object_unref (data->_async_result); + g_object_unref (_data_->_async_result); return FALSE; } static gboolean mpris2_controller_fetch_active_playlist (Mpris2Controller* self) { gboolean result = FALSE; - ActivePlaylistContainer _tmp0_ = {0}; + MprisPlaylists* _tmp0_; ActivePlaylistContainer _tmp1_; - gboolean _tmp2_; - gpointer _tmp3_ = NULL; - PlayerItem* _tmp4_; + ActivePlaylistContainer _tmp2_; + ActivePlaylistContainer _tmp3_; + gboolean _tmp4_; + gboolean _tmp5_; + PlayerController* _tmp6_; + GeeArrayList* _tmp7_; + gpointer _tmp8_ = NULL; PlaylistsMenuitem* playlists_item; - ActivePlaylistContainer _tmp5_ = {0}; - ActivePlaylistContainer _tmp6_; + MprisPlaylists* _tmp9_; + ActivePlaylistContainer _tmp10_; + ActivePlaylistContainer _tmp11_; + ActivePlaylistContainer _tmp12_; + PlaylistDetails _tmp13_; g_return_val_if_fail (self != NULL, FALSE); - mpris_playlists_get_ActivePlaylist (self->priv->_playlists, &_tmp0_); - _tmp1_ = _tmp0_; - _tmp2_ = _tmp1_.valid == FALSE; - active_playlist_container_destroy (&_tmp1_); - if (_tmp2_) { + _tmp0_ = self->priv->_playlists; + mpris_playlists_get_ActivePlaylist (_tmp0_, &_tmp1_); + _tmp2_ = _tmp1_; + _tmp3_ = _tmp2_; + _tmp4_ = _tmp3_.valid; + _tmp5_ = _tmp4_ == FALSE; + active_playlist_container_destroy (&_tmp3_); + if (_tmp5_) { } - _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); - _tmp4_ = (PlayerItem*) _tmp3_; - playlists_item = IS_PLAYLISTS_MENUITEM (_tmp4_) ? ((PlaylistsMenuitem*) _tmp4_) : NULL; - mpris_playlists_get_ActivePlaylist (self->priv->_playlists, &_tmp5_); - _tmp6_ = _tmp5_; - playlists_menuitem_active_playlist_update (playlists_item, &_tmp6_.details); - active_playlist_container_destroy (&_tmp6_); + _tmp6_ = self->priv->_owner; + _tmp7_ = _tmp6_->custom_items; + _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); + playlists_item = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _tmp8_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _tmp8_)) : NULL; + _tmp9_ = self->priv->_playlists; + mpris_playlists_get_ActivePlaylist (_tmp9_, &_tmp10_); + _tmp11_ = _tmp10_; + _tmp12_ = _tmp11_; + _tmp13_ = _tmp12_.details; + playlists_menuitem_active_playlist_update (playlists_item, &_tmp13_); + active_playlist_container_destroy (&_tmp12_); result = FALSE; _g_object_unref0 (playlists_item); return result; @@ -1058,14 +1273,26 @@ void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* pa GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (path != NULL); - mpris_playlists_ActivatePlaylist (self->priv->_playlists, path, NULL, NULL); + { + MprisPlaylists* _tmp0_; + const char* _tmp1_; + _tmp0_ = self->priv->_playlists; + _tmp1_ = path; + mpris_playlists_ActivatePlaylist (_tmp0_, _tmp1_, NULL, NULL); + } goto __finally12; __catch12_g_io_error: { - GError * e; + GError* e = NULL; + const char* _tmp2_; + GError* _tmp3_; + const gchar* _tmp4_; e = _inner_error_; _inner_error_ = NULL; - g_warning ("mpris2-controller.vala:264: Could not activate playlist %s because %s", (const gchar*) path, e->message); + _tmp2_ = path; + _tmp3_ = e; + _tmp4_ = _tmp3_->message; + g_warning ("mpris2-controller.vala:265: Could not activate playlist %s because %s", (const gchar*) _tmp2_, _tmp4_); _g_error_free0 (e); } __finally12: @@ -1079,90 +1306,110 @@ void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* pa MprisRoot* mpris2_controller_get_mpris2_root (Mpris2Controller* self) { MprisRoot* result; + MprisRoot* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_mpris2_root; + _tmp0_ = self->priv->_mpris2_root; + result = _tmp0_; return result; } static void mpris2_controller_set_mpris2_root (Mpris2Controller* self, MprisRoot* value) { MprisRoot* _tmp0_; + MprisRoot* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = _g_object_ref0 (value); + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_mpris2_root); - self->priv->_mpris2_root = _tmp0_; + self->priv->_mpris2_root = _tmp1_; g_object_notify ((GObject *) self, "mpris2-root"); } MprisPlayer* mpris2_controller_get_player (Mpris2Controller* self) { MprisPlayer* result; + MprisPlayer* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_player; + _tmp0_ = self->priv->_player; + result = _tmp0_; return result; } static void mpris2_controller_set_player (Mpris2Controller* self, MprisPlayer* value) { MprisPlayer* _tmp0_; + MprisPlayer* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = _g_object_ref0 (value); + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_player); - self->priv->_player = _tmp0_; + self->priv->_player = _tmp1_; g_object_notify ((GObject *) self, "player"); } MprisPlaylists* mpris2_controller_get_playlists (Mpris2Controller* self) { MprisPlaylists* result; + MprisPlaylists* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_playlists; + _tmp0_ = self->priv->_playlists; + result = _tmp0_; return result; } static void mpris2_controller_set_playlists (Mpris2Controller* self, MprisPlaylists* value) { MprisPlaylists* _tmp0_; + MprisPlaylists* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = _g_object_ref0 (value); + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_playlists); - self->priv->_playlists = _tmp0_; + self->priv->_playlists = _tmp1_; g_object_notify ((GObject *) self, "playlists"); } FreeDesktopProperties* mpris2_controller_get_properties_interface (Mpris2Controller* self) { FreeDesktopProperties* result; + FreeDesktopProperties* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_properties_interface; + _tmp0_ = self->priv->_properties_interface; + result = _tmp0_; return result; } static void mpris2_controller_set_properties_interface (Mpris2Controller* self, FreeDesktopProperties* value) { FreeDesktopProperties* _tmp0_; + FreeDesktopProperties* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = _g_object_ref0 (value); + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_properties_interface); - self->priv->_properties_interface = _tmp0_; + self->priv->_properties_interface = _tmp1_; g_object_notify ((GObject *) self, "properties-interface"); } PlayerController* mpris2_controller_get_owner (Mpris2Controller* self) { PlayerController* result; + PlayerController* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_owner; + _tmp0_ = self->priv->_owner; + result = _tmp0_; return result; } static void mpris2_controller_set_owner (Mpris2Controller* self, PlayerController* value) { PlayerController* _tmp0_; + PlayerController* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = _g_object_ref0 (value); + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_owner); - self->priv->_owner = _tmp0_; + self->priv->_owner = _tmp1_; g_object_notify ((GObject *) self, "owner"); } @@ -1181,70 +1428,62 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr GObject * obj; GObjectClass * parent_class; Mpris2Controller * self; - const gchar* _tmp0_ = NULL; - MprisRoot* _tmp1_ = NULL; - MprisRoot* _tmp2_; - MprisRoot* _tmp3_; - const gchar* _tmp4_ = NULL; - MprisPlayer* _tmp5_ = NULL; - MprisPlayer* _tmp6_; - MprisPlayer* _tmp7_; - FreeDesktopProperties* _tmp8_ = NULL; - FreeDesktopProperties* _tmp9_; - FreeDesktopProperties* _tmp10_; - gboolean _tmp11_; GError * _inner_error_ = NULL; parent_class = G_OBJECT_CLASS (mpris2_controller_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = MPRIS2_CONTROLLER (obj); - _tmp0_ = player_controller_get_dbus_name (self->priv->_owner); - _tmp1_ = g_initable_new (TYPE_MPRIS_ROOT_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp0_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2", NULL); - _tmp2_ = (MprisRoot*) _tmp1_; - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_IO_ERROR) { - goto __catch13_g_io_error; - } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - _tmp3_ = _tmp2_; - mpris2_controller_set_mpris2_root (self, _tmp3_); - _g_object_unref0 (_tmp3_); - _tmp4_ = player_controller_get_dbus_name (self->priv->_owner); - _tmp5_ = g_initable_new (TYPE_MPRIS_PLAYER_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp4_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2.Player", NULL); - _tmp6_ = (MprisPlayer*) _tmp5_; - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_IO_ERROR) { - goto __catch13_g_io_error; + { + PlayerController* _tmp0_; + const gchar* _tmp1_; + const gchar* _tmp2_; + MprisRoot* _tmp3_ = NULL; + MprisRoot* _tmp4_; + MprisRoot* _tmp5_; + PlayerController* _tmp6_; + const gchar* _tmp7_; + const gchar* _tmp8_; + MprisPlayer* _tmp9_ = NULL; + MprisPlayer* _tmp10_; + MprisPlayer* _tmp11_; + FreeDesktopProperties* _tmp12_ = NULL; + FreeDesktopProperties* _tmp13_; + FreeDesktopProperties* _tmp14_; + FreeDesktopProperties* _tmp15_; + PlayerController* _tmp16_; + gboolean* _tmp17_; + gboolean _tmp18_; + _tmp0_ = self->priv->_owner; + _tmp1_ = player_controller_get_dbus_name (_tmp0_); + _tmp2_ = _tmp1_; + _tmp3_ = g_initable_new (TYPE_MPRIS_ROOT_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp2_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2", NULL); + _tmp4_ = (MprisRoot*) _tmp3_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_IO_ERROR) { + goto __catch13_g_io_error; + } + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - _tmp7_ = _tmp6_; - mpris2_controller_set_player (self, _tmp7_); - _g_object_unref0 (_tmp7_); - _tmp8_ = g_initable_new (TYPE_FREE_DESKTOP_PROPERTIES_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", "org.freedesktop.Properties.PropertiesChanged", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.freedesktop.DBus.Properties", NULL); - _tmp9_ = (FreeDesktopProperties*) _tmp8_; - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_IO_ERROR) { - goto __catch13_g_io_error; + _tmp5_ = _tmp4_; + mpris2_controller_set_mpris2_root (self, _tmp5_); + _g_object_unref0 (_tmp5_); + _tmp6_ = self->priv->_owner; + _tmp7_ = player_controller_get_dbus_name (_tmp6_); + _tmp8_ = _tmp7_; + _tmp9_ = g_initable_new (TYPE_MPRIS_PLAYER_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp8_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2.Player", NULL); + _tmp10_ = (MprisPlayer*) _tmp9_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_IO_ERROR) { + goto __catch13_g_io_error; + } + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - } - _tmp10_ = _tmp9_; - mpris2_controller_set_properties_interface (self, _tmp10_); - _g_object_unref0 (_tmp10_); - g_signal_connect_object (self->priv->_properties_interface, "properties-changed", (GCallback) _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed, self, 0); - _tmp11_ = TRUE; - if (_bool_equal (self->priv->_owner->use_playlists, &_tmp11_) == TRUE) { - const gchar* _tmp12_ = NULL; - MprisPlaylists* _tmp13_ = NULL; - MprisPlaylists* _tmp14_; - MprisPlaylists* _tmp15_; - _tmp12_ = player_controller_get_dbus_name (self->priv->_owner); - _tmp13_ = g_initable_new (TYPE_MPRIS_PLAYLISTS_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp12_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2.Playlists", NULL); - _tmp14_ = (MprisPlaylists*) _tmp13_; + _tmp11_ = _tmp10_; + mpris2_controller_set_player (self, _tmp11_); + _g_object_unref0 (_tmp11_); + _tmp12_ = g_initable_new (TYPE_FREE_DESKTOP_PROPERTIES_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", "org.freedesktop.Properties.PropertiesChanged", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.freedesktop.DBus.Properties", NULL); + _tmp13_ = (FreeDesktopProperties*) _tmp12_; if (_inner_error_ != NULL) { if (_inner_error_->domain == G_IO_ERROR) { goto __catch13_g_io_error; @@ -1252,18 +1491,52 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); } - _tmp15_ = _tmp14_; - mpris2_controller_set_playlists (self, _tmp15_); - _g_object_unref0 (_tmp15_); - g_signal_connect_object (self->priv->_playlists, "playlist-changed", (GCallback) _mpris2_controller_on_playlistdetails_changed_mpris_playlists_playlist_changed, self, 0); + _tmp14_ = _tmp13_; + mpris2_controller_set_properties_interface (self, _tmp14_); + _g_object_unref0 (_tmp14_); + _tmp15_ = self->priv->_properties_interface; + g_signal_connect_object (_tmp15_, "properties-changed", (GCallback) _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed, self, 0); + _tmp16_ = self->priv->_owner; + _tmp17_ = _tmp16_->use_playlists; + _tmp18_ = TRUE; + if (_bool_equal (_tmp17_, &_tmp18_) == TRUE) { + PlayerController* _tmp19_; + const gchar* _tmp20_; + const gchar* _tmp21_; + MprisPlaylists* _tmp22_ = NULL; + MprisPlaylists* _tmp23_; + MprisPlaylists* _tmp24_; + MprisPlaylists* _tmp25_; + _tmp19_ = self->priv->_owner; + _tmp20_ = player_controller_get_dbus_name (_tmp19_); + _tmp21_ = _tmp20_; + _tmp22_ = g_initable_new (TYPE_MPRIS_PLAYLISTS_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp21_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/mpris/MediaPlayer2", "g-interface-name", "org.mpris.MediaPlayer2.Playlists", NULL); + _tmp23_ = (MprisPlaylists*) _tmp22_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_IO_ERROR) { + goto __catch13_g_io_error; + } + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + } + _tmp24_ = _tmp23_; + mpris2_controller_set_playlists (self, _tmp24_); + _g_object_unref0 (_tmp24_); + _tmp25_ = self->priv->_playlists; + g_signal_connect_object (_tmp25_, "playlist-changed", (GCallback) _mpris2_controller_on_playlistdetails_changed_mpris_playlists_playlist_changed, self, 0); + } } goto __finally13; __catch13_g_io_error: { - GError * e; + GError* e = NULL; + GError* _tmp26_; + const gchar* _tmp27_; e = _inner_error_; _inner_error_ = NULL; - g_critical ("mpris2-controller.vala:56: Problems connecting to the session bus - %s", e->message); + _tmp26_ = e; + _tmp27_ = _tmp26_->message; + g_critical ("mpris2-controller.vala:57: Problems connecting to the session bus - %s", _tmp27_); _g_error_free0 (e); } __finally13: diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 8eeac08..ce35a06 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -21,11 +21,12 @@ using Transport; public class Mpris2Controller : GLib.Object { + public const int MAX_PLAYLIST_COUNT = 20; + public MprisRoot mpris2_root {get; construct;} public MprisPlayer player {get; construct;} public MprisPlaylists playlists {get; construct;} public FreeDesktopProperties properties_interface {get; construct;} - public PlayerController owner {get; construct;} public Mpris2Controller(PlayerController ctrl) @@ -226,7 +227,7 @@ public class Mpris2Controller : GLib.Object try{ current_playlists = yield this.playlists.GetPlaylists (0, - 10, + MAX_PLAYLIST_COUNT, "Alphabetical", false); } diff --git a/src/mpris2-interfaces.c b/src/mpris2-interfaces.c index b288a8f..1aebb6d 100644 --- a/src/mpris2-interfaces.c +++ b/src/mpris2-interfaces.c @@ -1,4 +1,4 @@ -/* mpris2-interfaces.c generated by valac 0.12.1, the Vala compiler +/* mpris2-interfaces.c generated by valac 0.14.0, the Vala compiler * generated from mpris2-interfaces.vala, do not modify */ /* @@ -382,51 +382,61 @@ void mpris_root_Raise_finish (MprisRoot* self, GAsyncResult* _res_, GError** err gboolean mpris_root_get_HasTracklist (MprisRoot* self) { + g_return_val_if_fail (self != NULL, FALSE); return MPRIS_ROOT_GET_INTERFACE (self)->get_HasTracklist (self); } void mpris_root_set_HasTracklist (MprisRoot* self, gboolean value) { + g_return_if_fail (self != NULL); MPRIS_ROOT_GET_INTERFACE (self)->set_HasTracklist (self, value); } gboolean mpris_root_get_CanQuit (MprisRoot* self) { + g_return_val_if_fail (self != NULL, FALSE); return MPRIS_ROOT_GET_INTERFACE (self)->get_CanQuit (self); } void mpris_root_set_CanQuit (MprisRoot* self, gboolean value) { + g_return_if_fail (self != NULL); MPRIS_ROOT_GET_INTERFACE (self)->set_CanQuit (self, value); } gboolean mpris_root_get_CanRaise (MprisRoot* self) { + g_return_val_if_fail (self != NULL, FALSE); return MPRIS_ROOT_GET_INTERFACE (self)->get_CanRaise (self); } void mpris_root_set_CanRaise (MprisRoot* self, gboolean value) { + g_return_if_fail (self != NULL); MPRIS_ROOT_GET_INTERFACE (self)->set_CanRaise (self, value); } gchar* mpris_root_get_Identity (MprisRoot* self) { + g_return_val_if_fail (self != NULL, NULL); return MPRIS_ROOT_GET_INTERFACE (self)->get_Identity (self); } void mpris_root_set_Identity (MprisRoot* self, const gchar* value) { + g_return_if_fail (self != NULL); MPRIS_ROOT_GET_INTERFACE (self)->set_Identity (self, value); } gchar* mpris_root_get_DesktopEntry (MprisRoot* self) { + g_return_val_if_fail (self != NULL, NULL); return MPRIS_ROOT_GET_INTERFACE (self)->get_DesktopEntry (self); } void mpris_root_set_DesktopEntry (MprisRoot* self, const gchar* value) { + g_return_if_fail (self != NULL); MPRIS_ROOT_GET_INTERFACE (self)->set_DesktopEntry (self, value); } @@ -875,7 +885,7 @@ static GVariant* _dbus_mpris_root_get_Identity (MprisRoot* self) { GVariant* _reply; result = mpris_root_get_Identity (self); _reply = g_variant_new_string (result); - _g_free0 ( result); + _g_free0 (result); return _reply; } @@ -885,7 +895,7 @@ static GVariant* _dbus_mpris_root_get_DesktopEntry (MprisRoot* self) { GVariant* _reply; result = mpris_root_get_DesktopEntry (self); _reply = g_variant_new_string (result); - _g_free0 ( result); + _g_free0 (result); return _reply; } @@ -1038,31 +1048,37 @@ void mpris_player_Seek_finish (MprisPlayer* self, GAsyncResult* _res_, GError** GHashTable* mpris_player_get_Metadata (MprisPlayer* self) { + g_return_val_if_fail (self != NULL, NULL); return MPRIS_PLAYER_GET_INTERFACE (self)->get_Metadata (self); } void mpris_player_set_Metadata (MprisPlayer* self, GHashTable* value) { + g_return_if_fail (self != NULL); MPRIS_PLAYER_GET_INTERFACE (self)->set_Metadata (self, value); } gint32 mpris_player_get_Position (MprisPlayer* self) { + g_return_val_if_fail (self != NULL, 0); return MPRIS_PLAYER_GET_INTERFACE (self)->get_Position (self); } void mpris_player_set_Position (MprisPlayer* self, gint32 value) { + g_return_if_fail (self != NULL); MPRIS_PLAYER_GET_INTERFACE (self)->set_Position (self, value); } gchar* mpris_player_get_PlaybackStatus (MprisPlayer* self) { + g_return_val_if_fail (self != NULL, NULL); return MPRIS_PLAYER_GET_INTERFACE (self)->get_PlaybackStatus (self); } void mpris_player_set_PlaybackStatus (MprisPlayer* self, const gchar* value) { + g_return_if_fail (self != NULL); MPRIS_PLAYER_GET_INTERFACE (self)->set_PlaybackStatus (self, value); } @@ -1071,7 +1087,8 @@ static void g_cclosure_user_marshal_VOID__INT64 (GClosure * closure, GValue * re typedef void (*GMarshalFunc_VOID__INT64) (gpointer data1, gint64 arg_1, gpointer data2); register GMarshalFunc_VOID__INT64 callback; register GCClosure * cc; - register gpointer data1, data2; + register gpointer data1; + register gpointer data2; cc = (GCClosure *) closure; g_return_if_fail (n_param_values == 2); if (G_CCLOSURE_SWAP_DATA (closure)) { @@ -1583,7 +1600,7 @@ static GVariant* _dbus_mpris_player_get_Metadata (MprisPlayer* self) { g_variant_builder_add (&_tmp10_, "{?*}", g_variant_new_string (_key), g_variant_new_variant (_value)); } _reply = g_variant_builder_end (&_tmp10_); - _g_hash_table_unref0 ( result); + _g_hash_table_unref0 (result); return _reply; } @@ -1602,7 +1619,7 @@ static GVariant* _dbus_mpris_player_get_PlaybackStatus (MprisPlayer* self) { GVariant* _reply; result = mpris_player_get_PlaybackStatus (self); _reply = g_variant_new_string (result); - _g_free0 ( result); + _g_free0 (result); return _reply; } @@ -1707,6 +1724,7 @@ guint mpris_player_register_object (gpointer object, GDBusConnection* connection static void _mpris_player_unregister_object (gpointer user_data) { gpointer* data; data = user_data; + g_signal_handlers_disconnect_by_func (data[0], _dbus_mpris_player_seeked, data); g_object_unref (data[0]); g_object_unref (data[1]); g_free (data[2]); @@ -1715,9 +1733,24 @@ static void _mpris_player_unregister_object (gpointer user_data) { void playlist_details_copy (const PlaylistDetails* self, PlaylistDetails* dest) { - dest->path = g_strdup (self->path); - dest->name = g_strdup (self->name); - dest->icon_path = g_strdup (self->icon_path); + const char* _tmp0_; + const char* _tmp1_; + const gchar* _tmp2_; + const gchar* _tmp3_; + const gchar* _tmp4_; + const gchar* _tmp5_; + _tmp0_ = (*self).path; + _tmp1_ = g_strdup (_tmp0_); + _g_free0 ((*dest).path); + (*dest).path = _tmp1_; + _tmp2_ = (*self).name; + _tmp3_ = g_strdup (_tmp2_); + _g_free0 ((*dest).name); + (*dest).name = _tmp3_; + _tmp4_ = (*self).icon_path; + _tmp5_ = g_strdup (_tmp4_); + _g_free0 ((*dest).icon_path); + (*dest).icon_path = _tmp5_; } @@ -1754,10 +1787,15 @@ GType playlist_details_get_type (void) { void active_playlist_container_copy (const ActivePlaylistContainer* self, ActivePlaylistContainer* dest) { - PlaylistDetails _tmp0_ = {0}; - dest->valid = self->valid; - playlist_details_copy (&self->details, &_tmp0_); - dest->details = _tmp0_; + gboolean _tmp0_; + PlaylistDetails _tmp1_; + PlaylistDetails _tmp2_ = {0}; + _tmp0_ = (*self).valid; + (*dest).valid = _tmp0_; + _tmp1_ = (*self).details; + playlist_details_copy (&_tmp1_, &_tmp2_); + playlist_details_destroy (&(*dest).details); + (*dest).details = _tmp2_; } @@ -1812,31 +1850,37 @@ PlaylistDetails* mpris_playlists_GetPlaylists_finish (MprisPlaylists* self, GAsy gchar** mpris_playlists_get_Orderings (MprisPlaylists* self, int* result_length1) { + g_return_val_if_fail (self != NULL, NULL); return MPRIS_PLAYLISTS_GET_INTERFACE (self)->get_Orderings (self, result_length1); } void mpris_playlists_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1) { + g_return_if_fail (self != NULL); MPRIS_PLAYLISTS_GET_INTERFACE (self)->set_Orderings (self, value, value_length1); } guint32 mpris_playlists_get_PlaylistCount (MprisPlaylists* self) { + g_return_val_if_fail (self != NULL, 0U); return MPRIS_PLAYLISTS_GET_INTERFACE (self)->get_PlaylistCount (self); } void mpris_playlists_set_PlaylistCount (MprisPlaylists* self, guint32 value) { + g_return_if_fail (self != NULL); MPRIS_PLAYLISTS_GET_INTERFACE (self)->set_PlaylistCount (self, value); } void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result) { + g_return_if_fail (self != NULL); MPRIS_PLAYLISTS_GET_INTERFACE (self)->get_ActivePlaylist (self, result); } void mpris_playlists_set_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* value) { + g_return_if_fail (self != NULL); MPRIS_PLAYLISTS_GET_INTERFACE (self)->set_ActivePlaylist (self, value); } @@ -1845,7 +1889,8 @@ static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * re typedef void (*GMarshalFunc_VOID__BOXED) (gpointer data1, gpointer arg_1, gpointer data2); register GMarshalFunc_VOID__BOXED callback; register GCClosure * cc; - register gpointer data1, data2; + register gpointer data1; + register gpointer data2; cc = (GCClosure *) closure; g_return_if_fail (n_param_values == 2); if (G_CCLOSURE_SWAP_DATA (closure)) { @@ -2357,7 +2402,7 @@ static void _dbus_mpris_playlists_GetPlaylists_ready (GObject * source_object, G _tmp55_++; } g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp56_)); - result = (_vala_PlaylistDetails_array_free ( result, result_length1), NULL); + result = (_vala_PlaylistDetails_array_free (result, result_length1), NULL); _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); @@ -2396,7 +2441,7 @@ static GVariant* _dbus_mpris_playlists_get_Orderings (MprisPlaylists* self) { _tmp59_++; } _reply = g_variant_builder_end (&_tmp60_); - result = (_vala_array_free ( result, result_length1, (GDestroyNotify) g_free), NULL); + result = (_vala_array_free (result, result_length1, (GDestroyNotify) g_free), NULL); return _reply; } @@ -2424,7 +2469,7 @@ static GVariant* _dbus_mpris_playlists_get_ActivePlaylist (MprisPlaylists* self) 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); + active_playlist_container_destroy (&result); return _reply; } @@ -2573,6 +2618,7 @@ guint mpris_playlists_register_object (gpointer object, GDBusConnection* connect static void _mpris_playlists_unregister_object (gpointer user_data) { gpointer* data; data = user_data; + g_signal_handlers_disconnect_by_func (data[0], _dbus_mpris_playlists_playlist_changed, data); g_object_unref (data[0]); g_object_unref (data[1]); g_free (data[2]); diff --git a/src/mpris2-watcher.c b/src/mpris2-watcher.c index 3b4c72d..9742166 100644 --- a/src/mpris2-watcher.c +++ b/src/mpris2-watcher.c @@ -1,4 +1,4 @@ -/* mpris2-watcher.c generated by valac 0.12.1, the Vala compiler +/* mpris2-watcher.c generated by valac 0.14.0, the Vala compiler * generated from mpris2-watcher.vala, do not modify */ /* @@ -120,24 +120,38 @@ struct _Mpris2WatcherCheckForActiveClientsData { gchar** interfaces; gint interfaces_length1; gint _interfaces_size_; - gint _tmp0_; - gchar** _tmp1_; + FreeDesktopObject* _tmp0_; + gint _tmp1_; gchar** _tmp2_; - gint _tmp2__length1; - gint __tmp2__size_; - GError * e; + gchar** _tmp3_; + gint _tmp3__length1; + gint __tmp3__size_; + GError* e; + GError* _tmp4_; + const gchar* _tmp5_; + gchar** _tmp6_; + gint _tmp6__length1; gchar** address_collection; - int address_collection_length1; - int address_it; - gchar* _tmp3_; + gint address_collection_length1; + gint _address_collection_size_; + gint address_it; + gchar* _tmp7_; gchar* address; - gboolean _tmp4_; - MprisRoot* _tmp5_; + const gchar* _tmp8_; + gboolean _tmp9_; + const gchar* _tmp10_; + MprisRoot* _tmp11_; MprisRoot* mpris2_root; - gboolean _tmp6_; + MprisRoot* _tmp12_; + const gchar* _tmp13_; + gboolean _tmp14_; gboolean use_playlists; - gchar* _tmp7_; - gchar* _tmp8_; + MprisRoot* _tmp15_; + gchar* _tmp16_; + gchar* _tmp17_; + gchar* _tmp18_; + const gchar* _tmp19_; + gboolean _tmp20_; GError * _inner_error_; }; @@ -162,7 +176,7 @@ Mpris2Watcher* mpris2_watcher_construct (GType object_type); static void mpris2_watcher_check_for_active_clients_data_free (gpointer _data); void mpris2_watcher_check_for_active_clients (Mpris2Watcher* self, GAsyncReadyCallback _callback_, gpointer _user_data_); void mpris2_watcher_check_for_active_clients_finish (Mpris2Watcher* self, GAsyncResult* _res_); -static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckForActiveClientsData* data); +static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckForActiveClientsData* _data_); void free_desktop_object_list_names (FreeDesktopObject* self, GAsyncReadyCallback _callback_, gpointer _user_data_); gchar** free_desktop_object_list_names_finish (FreeDesktopObject* self, GAsyncResult* _res_, int* result_length1, GError** error); static void mpris2_watcher_check_for_active_clients_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); @@ -203,10 +217,10 @@ Mpris2Watcher* mpris2_watcher_new (void) { static void mpris2_watcher_check_for_active_clients_data_free (gpointer _data) { - Mpris2WatcherCheckForActiveClientsData* data; - data = _data; - _g_object_unref0 (data->self); - g_slice_free (Mpris2WatcherCheckForActiveClientsData, data); + Mpris2WatcherCheckForActiveClientsData* _data_; + _data_ = _data; + _g_object_unref0 (_data_->self); + g_slice_free (Mpris2WatcherCheckForActiveClientsData, _data_); } @@ -217,10 +231,12 @@ static gpointer _g_object_ref0 (gpointer self) { void mpris2_watcher_check_for_active_clients (Mpris2Watcher* self, GAsyncReadyCallback _callback_, gpointer _user_data_) { Mpris2WatcherCheckForActiveClientsData* _data_; + Mpris2Watcher* _tmp0_; _data_ = g_slice_new0 (Mpris2WatcherCheckForActiveClientsData); _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, mpris2_watcher_check_for_active_clients); g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, mpris2_watcher_check_for_active_clients_data_free); - _data_->self = _g_object_ref0 (self); + _tmp0_ = _g_object_ref0 (self); + _data_->self = _tmp0_; mpris2_watcher_check_for_active_clients_co (_data_); } @@ -232,16 +248,16 @@ void mpris2_watcher_check_for_active_clients_finish (Mpris2Watcher* self, GAsync static void mpris2_watcher_check_for_active_clients_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) { - Mpris2WatcherCheckForActiveClientsData* data; - data = _user_data_; - data->_source_object_ = source_object; - data->_res_ = _res_; - mpris2_watcher_check_for_active_clients_co (data); + Mpris2WatcherCheckForActiveClientsData* _data_; + _data_ = _user_data_; + _data_->_source_object_ = source_object; + _data_->_res_ = _res_; + mpris2_watcher_check_for_active_clients_co (_data_); } -static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckForActiveClientsData* data) { - switch (data->_state_) { +static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckForActiveClientsData* _data_) { + switch (_data_->_state_) { case 0: goto _state_0; case 1: @@ -250,144 +266,196 @@ static gboolean mpris2_watcher_check_for_active_clients_co (Mpris2WatcherCheckFo g_assert_not_reached (); } _state_0: - data->interfaces_length1 = 0; - data->_interfaces_size_ = 0; - data->_state_ = 1; - free_desktop_object_list_names (data->self->priv->fdesktop_obj, mpris2_watcher_check_for_active_clients_ready, data); - return FALSE; - _state_1: - data->_tmp1_ = NULL; - data->_tmp1_ = free_desktop_object_list_names_finish (data->self->priv->fdesktop_obj, data->_res_, &data->_tmp0_, &data->_inner_error_); - data->_tmp2_ = data->_tmp1_; - data->_tmp2__length1 = data->_tmp0_; - data->__tmp2__size_ = data->_tmp0_; - if (data->_inner_error_ != NULL) { - if (data->_inner_error_->domain == G_IO_ERROR) { - goto __catch7_g_io_error; - } - data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), NULL); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); - g_clear_error (&data->_inner_error_); + _data_->interfaces_length1 = 0; + _data_->_interfaces_size_ = 0; + { + _data_->_tmp0_ = _data_->self->priv->fdesktop_obj; + _data_->_tmp1_ = 0; + _data_->_state_ = 1; + free_desktop_object_list_names (_data_->_tmp0_, mpris2_watcher_check_for_active_clients_ready, _data_); return FALSE; + _state_1: + _data_->_tmp2_ = NULL; + _data_->_tmp2_ = free_desktop_object_list_names_finish (_data_->_tmp0_, _data_->_res_, &_data_->_tmp1_, &_data_->_inner_error_); + _data_->_tmp3_ = _data_->_tmp2_; + _data_->_tmp3__length1 = _data_->_tmp1_; + _data_->__tmp3__size_ = _data_->_tmp3__length1; + if (_data_->_inner_error_ != NULL) { + if (_data_->_inner_error_->domain == G_IO_ERROR) { + goto __catch7_g_io_error; + } + _data_->interfaces = (_vala_array_free (_data_->interfaces, _data_->interfaces_length1, (GDestroyNotify) g_free), NULL); + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code); + g_clear_error (&_data_->_inner_error_); + return FALSE; + } + _data_->interfaces = (_vala_array_free (_data_->interfaces, _data_->interfaces_length1, (GDestroyNotify) g_free), NULL); + _data_->interfaces = _data_->_tmp3_; + _data_->interfaces_length1 = _data_->_tmp3__length1; + _data_->_interfaces_size_ = _data_->interfaces_length1; } - data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), NULL); - data->interfaces = data->_tmp2_; - data->interfaces_length1 = data->_tmp2__length1; - data->_interfaces_size_ = data->_tmp2__length1; goto __finally7; __catch7_g_io_error: { - data->e = data->_inner_error_; - data->_inner_error_ = NULL; + _data_->e = _data_->_inner_error_; + _data_->_inner_error_ = NULL; + _data_->_tmp4_ = _data_->e; + _data_->_tmp5_ = _data_->_tmp4_->message; g_warning ("mpris2-watcher.vala:60: Mpris2watcher could fetch active interfaces at" \ -" startup: %s", data->e->message); - _g_error_free0 (data->e); - data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), NULL); - if (data->_state_ == 0) { - g_simple_async_result_complete_in_idle (data->_async_result); +" startup: %s", _data_->_tmp5_); + _g_error_free0 (_data_->e); + _data_->interfaces = (_vala_array_free (_data_->interfaces, _data_->interfaces_length1, (GDestroyNotify) g_free), NULL); + if (_data_->_state_ == 0) { + g_simple_async_result_complete_in_idle (_data_->_async_result); } else { - g_simple_async_result_complete (data->_async_result); + g_simple_async_result_complete (_data_->_async_result); } - g_object_unref (data->_async_result); + g_object_unref (_data_->_async_result); return FALSE; } __finally7: - if (data->_inner_error_ != NULL) { - data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), NULL); - g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code); - g_clear_error (&data->_inner_error_); + if (_data_->_inner_error_ != NULL) { + _data_->interfaces = (_vala_array_free (_data_->interfaces, _data_->interfaces_length1, (GDestroyNotify) g_free), NULL); + g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code); + g_clear_error (&_data_->_inner_error_); return FALSE; } + _data_->_tmp6_ = _data_->interfaces; + _data_->_tmp6__length1 = _data_->interfaces_length1; { - data->address_collection = data->interfaces; - data->address_collection_length1 = data->interfaces_length1; - for (data->address_it = 0; data->address_it < data->interfaces_length1; data->address_it = data->address_it + 1) { - data->_tmp3_ = g_strdup (data->address_collection[data->address_it]); - data->address = data->_tmp3_; + _data_->address_collection_length1 = 0; + _data_->_address_collection_size_ = 0; + _data_->address_collection = _data_->_tmp6_; + _data_->address_collection_length1 = _data_->_tmp6__length1; + _data_->address_it = 0; + for (_data_->address_it = 0; _data_->address_it < _data_->_tmp6__length1; _data_->address_it = _data_->address_it + 1) { + _data_->_tmp7_ = g_strdup (_data_->address_collection[_data_->address_it]); + _data_->address = _data_->_tmp7_; { - data->_tmp4_ = g_str_has_prefix (data->address, MPRIS_PREFIX); - if (data->_tmp4_) { - data->_tmp5_ = NULL; - data->_tmp5_ = mpris2_watcher_create_mpris_root (data->self, data->address); - data->mpris2_root = data->_tmp5_; - if (data->mpris2_root == NULL) { - _g_object_unref0 (data->mpris2_root); - _g_free0 (data->address); - data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), NULL); - if (data->_state_ == 0) { - g_simple_async_result_complete_in_idle (data->_async_result); + _data_->_tmp8_ = _data_->address; + _data_->_tmp9_ = FALSE; + _data_->_tmp9_ = g_str_has_prefix (_data_->_tmp8_, MPRIS_PREFIX); + if (_data_->_tmp9_) { + _data_->_tmp10_ = _data_->address; + _data_->_tmp11_ = NULL; + _data_->_tmp11_ = mpris2_watcher_create_mpris_root (_data_->self, _data_->_tmp10_); + _data_->mpris2_root = _data_->_tmp11_; + _data_->_tmp12_ = _data_->mpris2_root; + if (_data_->_tmp12_ == NULL) { + _g_object_unref0 (_data_->mpris2_root); + _g_free0 (_data_->address); + _data_->interfaces = (_vala_array_free (_data_->interfaces, _data_->interfaces_length1, (GDestroyNotify) g_free), NULL); + if (_data_->_state_ == 0) { + g_simple_async_result_complete_in_idle (_data_->_async_result); } else { - g_simple_async_result_complete (data->_async_result); + g_simple_async_result_complete (_data_->_async_result); } - g_object_unref (data->_async_result); + g_object_unref (_data_->_async_result); return FALSE; } - data->_tmp6_ = mpris2_watcher_supports_playlists (data->self, data->address); - data->use_playlists = data->_tmp6_; - data->_tmp7_ = NULL; - data->_tmp7_ = mpris_root_get_DesktopEntry (data->mpris2_root); - data->_tmp8_ = data->_tmp7_; - g_signal_emit_by_name (data->self, "client-appeared", data->_tmp8_, data->address, data->use_playlists); - _g_free0 (data->_tmp8_); - _g_object_unref0 (data->mpris2_root); + _data_->_tmp13_ = _data_->address; + _data_->_tmp14_ = FALSE; + _data_->_tmp14_ = mpris2_watcher_supports_playlists (_data_->self, _data_->_tmp13_); + _data_->use_playlists = _data_->_tmp14_; + _data_->_tmp15_ = _data_->mpris2_root; + _data_->_tmp16_ = mpris_root_get_DesktopEntry (_data_->_tmp15_); + _data_->_tmp17_ = _data_->_tmp16_; + _data_->_tmp18_ = _data_->_tmp17_; + _data_->_tmp19_ = _data_->address; + _data_->_tmp20_ = _data_->use_playlists; + g_signal_emit_by_name (_data_->self, "client-appeared", _data_->_tmp18_, _data_->_tmp19_, _data_->_tmp20_); + _g_free0 (_data_->_tmp18_); + _g_object_unref0 (_data_->mpris2_root); } - _g_free0 (data->address); + _g_free0 (_data_->address); } } } - data->interfaces = (_vala_array_free (data->interfaces, data->interfaces_length1, (GDestroyNotify) g_free), NULL); - if (data->_state_ == 0) { - g_simple_async_result_complete_in_idle (data->_async_result); + _data_->interfaces = (_vala_array_free (_data_->interfaces, _data_->interfaces_length1, (GDestroyNotify) g_free), NULL); + if (_data_->_state_ == 0) { + g_simple_async_result_complete_in_idle (_data_->_async_result); } else { - g_simple_async_result_complete (data->_async_result); + g_simple_async_result_complete (_data_->_async_result); } - g_object_unref (data->_async_result); + g_object_unref (_data_->_async_result); return FALSE; } static void mpris2_watcher_name_changes_detected (Mpris2Watcher* self, FreeDesktopObject* dbus_obj, const gchar* name, const gchar* previous_owner, const gchar* current_owner) { - MprisRoot* _tmp0_ = NULL; + const gchar* _tmp0_; + MprisRoot* _tmp1_ = NULL; MprisRoot* mpris2_root; - gboolean _tmp1_ = FALSE; + MprisRoot* _tmp2_; + gboolean _tmp3_ = FALSE; + const gchar* _tmp4_; + gboolean _tmp6_; g_return_if_fail (self != NULL); g_return_if_fail (dbus_obj != NULL); g_return_if_fail (name != NULL); g_return_if_fail (previous_owner != NULL); g_return_if_fail (current_owner != NULL); - _tmp0_ = mpris2_watcher_create_mpris_root (self, name); - mpris2_root = _tmp0_; - if (mpris2_root == NULL) { + _tmp0_ = name; + _tmp1_ = mpris2_watcher_create_mpris_root (self, _tmp0_); + mpris2_root = _tmp1_; + _tmp2_ = mpris2_root; + if (_tmp2_ == NULL) { _g_object_unref0 (mpris2_root); return; } - if (g_strcmp0 (previous_owner, "") != 0) { - _tmp1_ = g_strcmp0 (current_owner, "") == 0; + _tmp4_ = previous_owner; + if (g_strcmp0 (_tmp4_, "") != 0) { + const gchar* _tmp5_; + _tmp5_ = current_owner; + _tmp3_ = g_strcmp0 (_tmp5_, "") == 0; } else { - _tmp1_ = FALSE; + _tmp3_ = FALSE; } - if (_tmp1_) { - g_debug ("mpris2-watcher.vala:84: Client '%s' gone down", name); - g_signal_emit_by_name (self, "client-disappeared", name); + _tmp6_ = _tmp3_; + if (_tmp6_) { + const gchar* _tmp7_; + const gchar* _tmp8_; + _tmp7_ = name; + g_debug ("mpris2-watcher.vala:84: Client '%s' gone down", _tmp7_); + _tmp8_ = name; + g_signal_emit_by_name (self, "client-disappeared", _tmp8_); } else { - gboolean _tmp2_ = FALSE; - if (g_strcmp0 (previous_owner, "") == 0) { - _tmp2_ = g_strcmp0 (current_owner, "") != 0; + gboolean _tmp9_ = FALSE; + const gchar* _tmp10_; + gboolean _tmp12_; + _tmp10_ = previous_owner; + if (g_strcmp0 (_tmp10_, "") == 0) { + const gchar* _tmp11_; + _tmp11_ = current_owner; + _tmp9_ = g_strcmp0 (_tmp11_, "") != 0; } else { - _tmp2_ = FALSE; + _tmp9_ = FALSE; } - if (_tmp2_) { - gboolean _tmp3_; + _tmp12_ = _tmp9_; + if (_tmp12_) { + const gchar* _tmp13_; + const gchar* _tmp14_; + gboolean _tmp15_ = FALSE; gboolean use_playlists; - gchar* _tmp4_ = NULL; - gchar* _tmp5_; - g_debug ("mpris2-watcher.vala:88: Client '%s' has appeared", name); - _tmp3_ = mpris2_watcher_supports_playlists (self, name); - use_playlists = _tmp3_; - _tmp4_ = mpris_root_get_DesktopEntry (mpris2_root); - _tmp5_ = _tmp4_; - g_signal_emit_by_name (self, "client-appeared", _tmp5_, name, use_playlists); - _g_free0 (_tmp5_); + MprisRoot* _tmp16_; + gchar* _tmp17_; + gchar* _tmp18_; + gchar* _tmp19_; + const gchar* _tmp20_; + gboolean _tmp21_; + _tmp13_ = name; + g_debug ("mpris2-watcher.vala:88: Client '%s' has appeared", _tmp13_); + _tmp14_ = name; + _tmp15_ = mpris2_watcher_supports_playlists (self, _tmp14_); + use_playlists = _tmp15_; + _tmp16_ = mpris2_root; + _tmp17_ = mpris_root_get_DesktopEntry (_tmp16_); + _tmp18_ = _tmp17_; + _tmp19_ = _tmp18_; + _tmp20_ = name; + _tmp21_ = use_playlists; + g_signal_emit_by_name (self, "client-appeared", _tmp19_, _tmp20_, _tmp21_); + _g_free0 (_tmp19_); } } _g_object_unref0 (mpris2_root); @@ -397,36 +465,46 @@ static void mpris2_watcher_name_changes_detected (Mpris2Watcher* self, FreeDeskt static MprisRoot* mpris2_watcher_create_mpris_root (Mpris2Watcher* self, const gchar* name) { MprisRoot* result = NULL; MprisRoot* mpris2_root; - gboolean _tmp0_; + const gchar* _tmp0_; + gboolean _tmp1_ = FALSE; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (name != NULL, NULL); mpris2_root = NULL; - _tmp0_ = g_str_has_prefix (name, MPRIS_PREFIX); - if (_tmp0_) { - MprisRoot* _tmp1_ = NULL; - MprisRoot* _tmp2_; - _tmp1_ = g_initable_new (TYPE_MPRIS_ROOT_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", name, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", MPRIS_MEDIA_PLAYER_PATH, "g-interface-name", "org.mpris.MediaPlayer2", NULL); - _tmp2_ = (MprisRoot*) _tmp1_; - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_IO_ERROR) { - goto __catch8_g_io_error; + _tmp0_ = name; + _tmp1_ = g_str_has_prefix (_tmp0_, MPRIS_PREFIX); + if (_tmp1_) { + { + const gchar* _tmp2_; + MprisRoot* _tmp3_ = NULL; + MprisRoot* _tmp4_; + _tmp2_ = name; + _tmp3_ = g_initable_new (TYPE_MPRIS_ROOT_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", _tmp2_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", MPRIS_MEDIA_PLAYER_PATH, "g-interface-name", "org.mpris.MediaPlayer2", NULL); + _tmp4_ = (MprisRoot*) _tmp3_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_IO_ERROR) { + goto __catch8_g_io_error; + } + _g_object_unref0 (mpris2_root); + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return NULL; } _g_object_unref0 (mpris2_root); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; + mpris2_root = _tmp4_; } - _g_object_unref0 (mpris2_root); - mpris2_root = _tmp2_; goto __finally8; __catch8_g_io_error: { - GError * e; + GError* e = NULL; + GError* _tmp5_; + const gchar* _tmp6_; e = _inner_error_; _inner_error_ = NULL; + _tmp5_ = e; + _tmp6_ = _tmp5_->message; g_warning ("mpris2-watcher.vala:103: Mpris2watcher could not create a root interfa" \ -"ce: %s", e->message); +"ce: %s", _tmp6_); _g_error_free0 (e); } __finally8: @@ -445,51 +523,62 @@ static MprisRoot* mpris2_watcher_create_mpris_root (Mpris2Watcher* self, const g static gboolean mpris2_watcher_supports_playlists (Mpris2Watcher* self, const gchar* name) { gboolean result = FALSE; FreeDesktopIntrospectable* introspectable = NULL; - FreeDesktopIntrospectable* _tmp0_ = NULL; - FreeDesktopIntrospectable* _tmp1_; - gchar* _tmp2_ = NULL; - gchar* results; - gboolean _tmp3_; GError * _inner_error_ = NULL; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (name != NULL, FALSE); - _tmp0_ = g_initable_new (TYPE_FREE_DESKTOP_INTROSPECTABLE_PROXY, NULL, &_inner_error_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", name, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", MPRIS_MEDIA_PLAYER_PATH, "g-interface-name", "org.freedesktop.DBus.Introspectable", NULL); - _tmp1_ = (FreeDesktopIntrospectable*) _tmp0_; - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_IO_ERROR) { - goto __catch9_g_io_error; + { + const gchar* _tmp0_; + FreeDesktopIntrospectable* _tmp1_ = NULL; + FreeDesktopIntrospectable* _tmp2_; + FreeDesktopIntrospectable* _tmp3_; + gchar* _tmp4_ = NULL; + gchar* results; + const gchar* _tmp5_; + gboolean _tmp6_ = FALSE; + _tmp0_ = name; + _tmp1_ = g_initable_new (TYPE_FREE_DESKTOP_INTROSPECTABLE_PROXY, NULL, &_inner_error_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", _tmp0_, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", MPRIS_MEDIA_PLAYER_PATH, "g-interface-name", "org.freedesktop.DBus.Introspectable", NULL); + _tmp2_ = (FreeDesktopIntrospectable*) _tmp1_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_IO_ERROR) { + goto __catch9_g_io_error; + } + _g_object_unref0 (introspectable); + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return FALSE; } _g_object_unref0 (introspectable); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; - } - _g_object_unref0 (introspectable); - introspectable = _tmp1_; - _tmp2_ = free_desktop_introspectable_Introspect (introspectable, &_inner_error_); - results = _tmp2_; - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_IO_ERROR) { - goto __catch9_g_io_error; + introspectable = _tmp2_; + _tmp3_ = introspectable; + _tmp4_ = free_desktop_introspectable_Introspect (_tmp3_, &_inner_error_); + results = _tmp4_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_IO_ERROR) { + goto __catch9_g_io_error; + } + _g_object_unref0 (introspectable); + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return FALSE; } + _tmp5_ = results; + _tmp6_ = mpris2_watcher_parse_interfaces (self, _tmp5_); + result = _tmp6_; + _g_free0 (results); _g_object_unref0 (introspectable); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return FALSE; + return result; } - _tmp3_ = mpris2_watcher_parse_interfaces (self, results); - result = _tmp3_; - _g_free0 (results); - _g_object_unref0 (introspectable); - return result; - _g_free0 (results); goto __finally9; __catch9_g_io_error: { - GError * e; + GError* e = NULL; + GError* _tmp7_; + const gchar* _tmp8_; e = _inner_error_; _inner_error_ = NULL; - g_warning ("mpris2-watcher.vala:131: Could not create an introspectable object: %s", e->message); + _tmp7_ = e; + _tmp8_ = _tmp7_->message; + g_warning ("mpris2-watcher.vala:131: Could not create an introspectable object: %s", _tmp8_); _g_error_free0 (e); } __finally9: @@ -508,69 +597,111 @@ static gboolean mpris2_watcher_supports_playlists (Mpris2Watcher* self, const gc static gboolean mpris2_watcher_parse_interfaces (Mpris2Watcher* self, const gchar* interface_info) { gboolean result = FALSE; gboolean _result_; - xmlDoc* _tmp0_ = NULL; + const gchar* _tmp0_; + xmlDoc* _tmp1_ = NULL; xmlDoc* xml_doc; - xmlNode* _tmp1_ = NULL; + xmlDoc* _tmp2_; + xmlDoc* _tmp3_; + xmlNode* _tmp4_ = NULL; xmlNode* root_node; + xmlNode* _tmp5_; + xmlDoc* _tmp27_; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (interface_info != NULL, FALSE); _result_ = FALSE; - _tmp0_ = xmlParseDoc (interface_info); - xml_doc = _tmp0_; - if (xml_doc == NULL) { + _tmp0_ = interface_info; + _tmp1_ = xmlParseDoc (_tmp0_); + xml_doc = _tmp1_; + _tmp2_ = xml_doc; + if (_tmp2_ == NULL) { g_warning ("mpris2-watcher.vala:143: Mpris2Watcher - parse-interfaces - failed to " \ "instantiate xml doc"); result = FALSE; return result; } - _tmp1_ = xmlDocGetRootElement (xml_doc); - root_node = _tmp1_; - if (root_node == NULL) { - xmlFreeDoc (xml_doc); + _tmp3_ = xml_doc; + _tmp4_ = xmlDocGetRootElement (_tmp3_); + root_node = _tmp4_; + _tmp5_ = root_node; + if (_tmp5_ == NULL) { + xmlDoc* _tmp6_; + _tmp6_ = xml_doc; + xmlFreeDoc (_tmp6_); g_warning ("mpris2-watcher.vala:151: Mpris2Watcher - the interface info xml is emp" \ "ty"); result = FALSE; return result; } { + xmlNode* _tmp7_; + xmlNode* _tmp8_; xmlNode* iter; - iter = root_node->children; + _tmp7_ = root_node; + _tmp8_ = _tmp7_->children; + iter = _tmp8_; { - gboolean _tmp2_; - _tmp2_ = TRUE; + gboolean _tmp9_; + _tmp9_ = TRUE; while (TRUE) { + gboolean _tmp10_; + xmlNode* _tmp13_; + xmlNode* _tmp14_; + xmlElementType _tmp15_; + xmlNode* _tmp16_; + xmlAttr* _tmp17_; xmlAttr* attributes; - gchar* _tmp3_; + xmlAttr* _tmp18_; + xmlNode* _tmp19_; + const gchar* _tmp20_; + gchar* _tmp21_; gchar* interface_name; - gchar* _tmp4_ = NULL; - gchar* _tmp5_; - gboolean _tmp6_; - if (!_tmp2_) { - iter = iter->next; + const gchar* _tmp22_; + const gchar* _tmp23_; + gchar* _tmp24_ = NULL; + gchar* _tmp25_; + gboolean _tmp26_; + _tmp10_ = _tmp9_; + if (!_tmp10_) { + xmlNode* _tmp11_; + xmlNode* _tmp12_; + _tmp11_ = iter; + _tmp12_ = _tmp11_->next; + iter = _tmp12_; } - _tmp2_ = FALSE; - if (!(iter != NULL)) { + _tmp9_ = FALSE; + _tmp13_ = iter; + if (!(_tmp13_ != NULL)) { break; } - if (iter->type != XML_ELEMENT_NODE) { + _tmp14_ = iter; + _tmp15_ = _tmp14_->type; + if (_tmp15_ != XML_ELEMENT_NODE) { continue; } - attributes = iter->properties; - _tmp3_ = g_strdup (attributes->children->content); - interface_name = _tmp3_; - g_debug ("mpris2-watcher.vala:163: this dbus object has interface %s ", interface_name); - _tmp4_ = g_strconcat (MPRIS_PREFIX, "Playlists", NULL); - _tmp5_ = _tmp4_; - _tmp6_ = g_strcmp0 (interface_name, _tmp5_) == 0; - _g_free0 (_tmp5_); - if (_tmp6_) { + _tmp16_ = iter; + _tmp17_ = _tmp16_->properties; + attributes = _tmp17_; + _tmp18_ = attributes; + _tmp19_ = _tmp18_->children; + _tmp20_ = _tmp19_->content; + _tmp21_ = g_strdup (_tmp20_); + interface_name = _tmp21_; + _tmp22_ = interface_name; + g_debug ("mpris2-watcher.vala:163: this dbus object has interface %s ", _tmp22_); + _tmp23_ = interface_name; + _tmp24_ = g_strconcat (MPRIS_PREFIX, "Playlists", NULL); + _tmp25_ = _tmp24_; + _tmp26_ = g_strcmp0 (_tmp23_, _tmp25_) == 0; + _g_free0 (_tmp25_); + if (_tmp26_) { _result_ = TRUE; } _g_free0 (interface_name); } } } - xmlFreeDoc (xml_doc); + _tmp27_ = xml_doc; + xmlFreeDoc (_tmp27_); result = _result_; return result; } @@ -580,7 +711,8 @@ static void g_cclosure_user_marshal_VOID__STRING_STRING_BOOLEAN (GClosure * clos typedef void (*GMarshalFunc_VOID__STRING_STRING_BOOLEAN) (gpointer data1, const char* arg_1, const char* arg_2, gboolean arg_3, gpointer data2); register GMarshalFunc_VOID__STRING_STRING_BOOLEAN callback; register GCClosure * cc; - register gpointer data1, data2; + register gpointer data1; + register gpointer data2; cc = (GCClosure *) closure; g_return_if_fail (n_param_values == 4); if (G_CCLOSURE_SWAP_DATA (closure)) { @@ -604,33 +736,41 @@ static GObject * mpris2_watcher_constructor (GType type, guint n_construct_prope GObject * obj; GObjectClass * parent_class; Mpris2Watcher * self; - FreeDesktopObject* _tmp0_ = NULL; - FreeDesktopObject* _tmp1_; GError * _inner_error_ = NULL; parent_class = G_OBJECT_CLASS (mpris2_watcher_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = MPRIS2_WATCHER (obj); - _tmp0_ = g_initable_new (TYPE_FREE_DESKTOP_OBJECT_PROXY, NULL, &_inner_error_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", FREEDESKTOP_SERVICE, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", FREEDESKTOP_OBJECT, "g-interface-name", "org.freedesktop.DBus", NULL); - _tmp1_ = (FreeDesktopObject*) _tmp0_; - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_IO_ERROR) { - goto __catch10_g_io_error; + { + FreeDesktopObject* _tmp0_ = NULL; + FreeDesktopObject* _tmp1_; + FreeDesktopObject* _tmp2_; + _tmp0_ = g_initable_new (TYPE_FREE_DESKTOP_OBJECT_PROXY, NULL, &_inner_error_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "g-name", FREEDESKTOP_SERVICE, "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", FREEDESKTOP_OBJECT, "g-interface-name", "org.freedesktop.DBus", NULL); + _tmp1_ = (FreeDesktopObject*) _tmp0_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_IO_ERROR) { + goto __catch10_g_io_error; + } + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); } - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); + _g_object_unref0 (self->priv->fdesktop_obj); + self->priv->fdesktop_obj = _tmp1_; + _tmp2_ = self->priv->fdesktop_obj; + g_signal_connect_object (_tmp2_, "name-owner-changed", (GCallback) _mpris2_watcher_name_changes_detected_free_desktop_object_name_owner_changed, self, 0); + mpris2_watcher_check_for_active_clients (self, NULL, NULL); } - _g_object_unref0 (self->priv->fdesktop_obj); - self->priv->fdesktop_obj = _tmp1_; - g_signal_connect_object (self->priv->fdesktop_obj, "name-owner-changed", (GCallback) _mpris2_watcher_name_changes_detected_free_desktop_object_name_owner_changed, self, 0); - mpris2_watcher_check_for_active_clients (self, NULL, NULL); goto __finally10; __catch10_g_io_error: { - GError * e; + GError* e = NULL; + GError* _tmp3_; + const gchar* _tmp4_; e = _inner_error_; _inner_error_ = NULL; + _tmp3_ = e; + _tmp4_ = _tmp3_->message; g_warning ("mpris2-watcher.vala:46: Mpris2watcher could not set up a watch for mpr" \ -"is clients appearing on the bus: %s", e->message); +"is clients appearing on the bus: %s", _tmp4_); _g_error_free0 (e); } __finally10: diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c index 73af633..8b4d2a5 100644 --- a/src/music-player-bridge.c +++ b/src/music-player-bridge.c @@ -1,4 +1,4 @@ -/* music-player-bridge.c generated by valac 0.12.1, the Vala compiler +/* music-player-bridge.c generated by valac 0.14.0, the Vala compiler * generated from music-player-bridge.vala, do not modify */ /* @@ -213,109 +213,170 @@ MusicPlayerBridge* music_player_bridge_new (void) { static void music_player_bridge_on_blacklist_update (MusicPlayerBridge* self, gchar** blacklist, int blacklist_length1) { + gchar** _tmp0_; + gint _tmp0__length1; + Mpris2Watcher* _tmp15_; g_return_if_fail (self != NULL); g_debug ("music-player-bridge.vala:45: some blacklist update"); + _tmp0_ = blacklist; + _tmp0__length1 = blacklist_length1; { - gchar** s_collection; - int s_collection_length1; - int s_it; - s_collection = blacklist; - s_collection_length1 = blacklist_length1; - for (s_it = 0; s_it < blacklist_length1; s_it = s_it + 1) { - gchar* _tmp0_; - gchar* s; - _tmp0_ = g_strdup (s_collection[s_it]); - s = _tmp0_; + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp0_; + s_collection_length1 = _tmp0__length1; + for (s_it = 0; s_it < _tmp0__length1; s_it = s_it + 1) { + gchar* _tmp1_; + gchar* s = NULL; + _tmp1_ = g_strdup (s_collection[s_it]); + s = _tmp1_; { - gchar* _tmp1_; - gchar* _tmp2_ = NULL; + const gchar* _tmp2_; + gchar* _tmp3_; + gchar* _tmp4_ = NULL; gchar* key; - gboolean _tmp3_; - _tmp1_ = g_strdup (s); - _tmp2_ = music_player_bridge_determine_key (_tmp1_); - key = _tmp2_; - _tmp3_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, key); - if (_tmp3_) { - gpointer _tmp4_ = NULL; - PlayerController* _tmp5_; + GeeHashMap* _tmp5_; + const gchar* _tmp6_; + gboolean _tmp7_ = FALSE; + _tmp2_ = s; + _tmp3_ = g_strdup (_tmp2_); + _tmp4_ = music_player_bridge_determine_key (_tmp3_); + key = _tmp4_; + _tmp5_ = self->priv->registered_clients; + _tmp6_ = key; + _tmp7_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp5_, _tmp6_); + if (_tmp7_) { + const gchar* _tmp8_; + GeeHashMap* _tmp9_; + const gchar* _tmp10_; + gpointer _tmp11_ = NULL; + PlayerController* _tmp12_; + GeeHashMap* _tmp13_; + const gchar* _tmp14_; + _tmp8_ = key; g_debug ("music-player-bridge.vala:50: Apparently %s is now blacklisted - remove" \ -" thy self", key); - _tmp4_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, key); - _tmp5_ = (PlayerController*) _tmp4_; - player_controller_remove_from_menu (_tmp5_); - _g_object_unref0 (_tmp5_); - gee_abstract_map_unset ((GeeAbstractMap*) self->priv->registered_clients, key, NULL); +" thy self", _tmp8_); + _tmp9_ = self->priv->registered_clients; + _tmp10_ = key; + _tmp11_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp9_, _tmp10_); + _tmp12_ = (PlayerController*) _tmp11_; + player_controller_remove_from_menu (_tmp12_); + _g_object_unref0 (_tmp12_); + _tmp13_ = self->priv->registered_clients; + _tmp14_ = key; + gee_abstract_map_unset ((GeeAbstractMap*) _tmp13_, _tmp14_, NULL); } _g_free0 (key); _g_free0 (s); } } } - mpris2_watcher_check_for_active_clients (self->priv->watcher, NULL, NULL); + _tmp15_ = self->priv->watcher; + mpris2_watcher_check_for_active_clients (_tmp15_, NULL, NULL); } static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self) { g_return_if_fail (self != NULL); { - GeeArrayList* _tmp0_ = NULL; + SettingsManager* _tmp0_; + GeeArrayList* _tmp1_ = NULL; GeeArrayList* _desktop_list; - gint _tmp1_; + GeeArrayList* _tmp2_; + gint _tmp3_; + gint _tmp4_; gint _desktop_size; gint _desktop_index; - _tmp0_ = settings_manager_fetch_interested (self->priv->settings_manager); - _desktop_list = _tmp0_; - _tmp1_ = gee_collection_get_size ((GeeCollection*) _desktop_list); - _desktop_size = _tmp1_; + _tmp0_ = self->priv->settings_manager; + _tmp1_ = settings_manager_fetch_interested (_tmp0_); + _desktop_list = _tmp1_; + _tmp2_ = _desktop_list; + _tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_); + _tmp4_ = _tmp3_; + _desktop_size = _tmp4_; _desktop_index = -1; while (TRUE) { - gpointer _tmp2_ = NULL; + gint _tmp5_; + gint _tmp6_; + gint _tmp7_; + GeeArrayList* _tmp8_; + gint _tmp9_; + gpointer _tmp10_ = NULL; gchar* desktop; - gchar* _tmp3_ = NULL; - gchar* _tmp4_; - GAppInfo* _tmp5_ = NULL; - GAppInfo* _tmp6_; + const gchar* _tmp11_; + const gchar* _tmp12_; + gchar* _tmp13_ = NULL; + gchar* _tmp14_; + GAppInfo* _tmp15_ = NULL; + GAppInfo* _tmp16_; GAppInfo* app_info; - gchar* _tmp7_; - gchar* _tmp8_ = NULL; + GAppInfo* _tmp17_; + const gchar* _tmp19_; + gchar* _tmp20_; + gchar* _tmp21_ = NULL; gchar* mpris_key; - gchar* _tmp9_ = NULL; - gchar* _tmp10_; - gint _tmp11_; - PlayerController* _tmp12_ = NULL; - PlayerController* _tmp13_; + DbusmenuMenuitem* _tmp22_; + GAppInfo* _tmp23_; + const gchar* _tmp24_; + gchar* _tmp25_ = NULL; + gchar* _tmp26_; + gint _tmp27_ = 0; + PlayerController* _tmp28_; + PlayerController* _tmp29_; PlayerController* ctrl; - _desktop_index = _desktop_index + 1; - if (!(_desktop_index < _desktop_size)) { + GeeHashMap* _tmp30_; + const gchar* _tmp31_; + PlayerController* _tmp32_; + _tmp5_ = _desktop_index; + _desktop_index = _tmp5_ + 1; + _tmp6_ = _desktop_index; + _tmp7_ = _desktop_size; + if (!(_tmp6_ < _tmp7_)) { break; } - _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) _desktop_list, _desktop_index); - desktop = (gchar*) _tmp2_; - g_debug ("music-player-bridge.vala:62: interested client found : %s", desktop); - _tmp3_ = g_strconcat (desktop, ".desktop", NULL); - _tmp4_ = _tmp3_; - _tmp5_ = music_player_bridge_create_app_info (_tmp4_); - _tmp6_ = _tmp5_; - _g_free0 (_tmp4_); - app_info = _tmp6_; - if (app_info == NULL) { + _tmp8_ = _desktop_list; + _tmp9_ = _desktop_index; + _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_); + desktop = (gchar*) _tmp10_; + _tmp11_ = desktop; + g_debug ("music-player-bridge.vala:62: interested client found : %s", _tmp11_); + _tmp12_ = desktop; + _tmp13_ = g_strconcat (_tmp12_, ".desktop", NULL); + _tmp14_ = _tmp13_; + _tmp15_ = music_player_bridge_create_app_info (_tmp14_); + _tmp16_ = _tmp15_; + _g_free0 (_tmp14_); + app_info = _tmp16_; + _tmp17_ = app_info; + if (_tmp17_ == NULL) { + const gchar* _tmp18_; + _tmp18_ = desktop; g_warning ("music-player-bridge.vala:65: Could not create app_info for path %s \n" \ -" Getting out of here ", desktop); +" Getting out of here ", _tmp18_); _g_object_unref0 (app_info); _g_free0 (desktop); continue; } - _tmp7_ = g_strdup (desktop); - _tmp8_ = music_player_bridge_determine_key (_tmp7_); - mpris_key = _tmp8_; - _tmp9_ = music_player_bridge_fetch_icon_name (desktop); - _tmp10_ = _tmp9_; - _tmp11_ = music_player_bridge_calculate_menu_position (self); - _tmp12_ = player_controller_new (self->priv->root_menu, app_info, NULL, _tmp10_, _tmp11_, NULL, PLAYER_CONTROLLER_STATE_OFFLINE); - _tmp13_ = _tmp12_; - _g_free0 (_tmp10_); - ctrl = _tmp13_; - gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, mpris_key, ctrl); + _tmp19_ = desktop; + _tmp20_ = g_strdup (_tmp19_); + _tmp21_ = music_player_bridge_determine_key (_tmp20_); + mpris_key = _tmp21_; + _tmp22_ = self->priv->root_menu; + _tmp23_ = app_info; + _tmp24_ = desktop; + _tmp25_ = music_player_bridge_fetch_icon_name (_tmp24_); + _tmp26_ = _tmp25_; + _tmp27_ = music_player_bridge_calculate_menu_position (self); + _tmp28_ = player_controller_new (_tmp22_, _tmp23_, NULL, _tmp26_, _tmp27_, NULL, PLAYER_CONTROLLER_STATE_OFFLINE); + _tmp29_ = _tmp28_; + _g_free0 (_tmp26_); + ctrl = _tmp29_; + _tmp30_ = self->priv->registered_clients; + _tmp31_ = mpris_key; + _tmp32_ = ctrl; + gee_abstract_map_set ((GeeAbstractMap*) _tmp30_, _tmp31_, _tmp32_); _g_object_unref0 (ctrl); _g_free0 (mpris_key); _g_object_unref0 (app_info); @@ -328,16 +389,24 @@ static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlaye static gint music_player_bridge_calculate_menu_position (MusicPlayerBridge* self) { gint result = 0; - gint _tmp0_; + GeeHashMap* _tmp0_; + gint _tmp1_; + gint _tmp2_; g_return_val_if_fail (self != NULL, 0); - _tmp0_ = gee_map_get_size ((GeeMap*) self->priv->registered_clients); - if (_tmp0_ == 0) { + _tmp0_ = self->priv->registered_clients; + _tmp1_ = gee_map_get_size ((GeeMap*) _tmp0_); + _tmp2_ = _tmp1_; + if (_tmp2_ == 0) { result = MUSIC_PLAYER_BRIDGE_DEVICE_ITEMS_COUNT; return result; } else { - gint _tmp1_; - _tmp1_ = gee_map_get_size ((GeeMap*) self->priv->registered_clients); - result = MUSIC_PLAYER_BRIDGE_DEVICE_ITEMS_COUNT + (_tmp1_ * PLAYER_CONTROLLER_WIDGET_QUANTITY); + GeeHashMap* _tmp3_; + gint _tmp4_; + gint _tmp5_; + _tmp3_ = self->priv->registered_clients; + _tmp4_ = gee_map_get_size ((GeeMap*) _tmp3_); + _tmp5_ = _tmp4_; + result = MUSIC_PLAYER_BRIDGE_DEVICE_ITEMS_COUNT + (_tmp5_ * PLAYER_CONTROLLER_WIDGET_QUANTITY); return result; } } @@ -367,108 +436,201 @@ static gpointer __bool_dup0 (gpointer self) { } +static gchar* bool_to_string (gboolean self) { + gchar* result = NULL; + if (self) { + gchar* _tmp0_; + _tmp0_ = g_strdup ("true"); + result = _tmp0_; + return result; + } else { + gchar* _tmp1_; + _tmp1_ = g_strdup ("false"); + result = _tmp1_; + return result; + } +} + + void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name, gboolean use_playlists) { gboolean _tmp0_ = FALSE; - gint _tmp1_; - gchar** _tmp2_ = NULL; - gchar** _tmp3_; - gint _tmp3__length1; - gboolean _tmp4_; - gchar* _tmp5_ = NULL; - gchar* _tmp6_; - GAppInfo* _tmp7_ = NULL; - GAppInfo* _tmp8_; + const gchar* _tmp1_; + gboolean _tmp3_; + const gchar* _tmp5_; + SettingsManager* _tmp6_; + gint _tmp7_ = 0; + gchar** _tmp8_ = NULL; + gchar** _tmp9_; + gint _tmp9__length1; + gboolean _tmp10_; + const gchar* _tmp12_; + const gchar* _tmp13_; + gchar* _tmp14_ = NULL; + gchar* _tmp15_; + GAppInfo* _tmp16_ = NULL; + GAppInfo* _tmp17_; GAppInfo* app_info; - gchar* _tmp9_; - gchar* _tmp10_ = NULL; + GAppInfo* _tmp18_; + const gchar* _tmp20_; + gchar* _tmp21_; + gchar* _tmp22_ = NULL; gchar* mpris_key; - gboolean _tmp11_; + GeeHashMap* _tmp23_; + const gchar* _tmp24_; + gboolean _tmp25_ = FALSE; g_return_if_fail (self != NULL); g_return_if_fail (desktop != NULL); g_return_if_fail (dbus_name != NULL); - if (desktop == NULL) { + _tmp1_ = desktop; + if (_tmp1_ == NULL) { _tmp0_ = TRUE; } else { - _tmp0_ = g_strcmp0 (desktop, "") == 0; + const gchar* _tmp2_; + _tmp2_ = desktop; + _tmp0_ = g_strcmp0 (_tmp2_, "") == 0; } - if (_tmp0_) { + _tmp3_ = _tmp0_; + if (_tmp3_) { + const gchar* _tmp4_; + _tmp4_ = dbus_name; g_warning ("music-player-bridge.vala:96: Client %s attempting to register without " \ -"desktop entry being set on the mpris root", dbus_name); +"desktop entry being set on the mpris root", _tmp4_); return; } - _tmp2_ = settings_manager_fetch_blacklist (self->priv->settings_manager, &_tmp1_); - _tmp3_ = _tmp2_; - _tmp3__length1 = _tmp1_; - _tmp4_ = _vala_string_array_contains (_tmp3_, _tmp1_, desktop); - _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL); - if (_tmp4_) { + _tmp5_ = desktop; + _tmp6_ = self->priv->settings_manager; + _tmp8_ = settings_manager_fetch_blacklist (_tmp6_, &_tmp7_); + _tmp9_ = _tmp8_; + _tmp9__length1 = _tmp7_; + _tmp10_ = _vala_string_array_contains (_tmp9_, _tmp7_, _tmp5_); + _tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL); + if (_tmp10_) { + const gchar* _tmp11_; + _tmp11_ = desktop; g_debug ("music-player-bridge.vala:101: Client %s attempting to register but I'm" \ -" afraid it is blacklisted", desktop); +" afraid it is blacklisted", _tmp11_); return; } - g_debug ("music-player-bridge.vala:106: client_has_become_available %s", desktop); - _tmp5_ = g_strconcat (desktop, ".desktop", NULL); - _tmp6_ = _tmp5_; - _tmp7_ = music_player_bridge_create_app_info (_tmp6_); - _tmp8_ = _tmp7_; - _g_free0 (_tmp6_); - app_info = _tmp8_; - if (app_info == NULL) { + _tmp12_ = desktop; + g_debug ("music-player-bridge.vala:106: client_has_become_available %s", _tmp12_); + _tmp13_ = desktop; + _tmp14_ = g_strconcat (_tmp13_, ".desktop", NULL); + _tmp15_ = _tmp14_; + _tmp16_ = music_player_bridge_create_app_info (_tmp15_); + _tmp17_ = _tmp16_; + _g_free0 (_tmp15_); + app_info = _tmp17_; + _tmp18_ = app_info; + if (_tmp18_ == NULL) { + const gchar* _tmp19_; + _tmp19_ = desktop; g_warning ("music-player-bridge.vala:109: Could not create app_info for path %s \n" \ -" Getting out of here ", desktop); +" Getting out of here ", _tmp19_); _g_object_unref0 (app_info); return; } - _tmp9_ = g_strdup (desktop); - _tmp10_ = music_player_bridge_determine_key (_tmp9_); - mpris_key = _tmp10_; - _tmp11_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); - if (_tmp11_ == FALSE) { - gchar* _tmp12_ = NULL; - gchar* _tmp13_; - gint _tmp14_; - PlayerController* _tmp15_ = NULL; - PlayerController* _tmp16_; + _tmp20_ = desktop; + _tmp21_ = g_strdup (_tmp20_); + _tmp22_ = music_player_bridge_determine_key (_tmp21_); + mpris_key = _tmp22_; + _tmp23_ = self->priv->registered_clients; + _tmp24_ = mpris_key; + _tmp25_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp23_, _tmp24_); + if (_tmp25_ == FALSE) { + const gchar* _tmp26_; + DbusmenuMenuitem* _tmp27_; + GAppInfo* _tmp28_; + const gchar* _tmp29_; + const gchar* _tmp30_; + gchar* _tmp31_ = NULL; + gchar* _tmp32_; + gint _tmp33_ = 0; + gboolean _tmp34_; + PlayerController* _tmp35_; + PlayerController* _tmp36_; PlayerController* ctrl; + GeeHashMap* _tmp37_; + const gchar* _tmp38_; + PlayerController* _tmp39_; + const gchar* _tmp40_; + SettingsManager* _tmp41_; + const gchar* _tmp42_; + _tmp26_ = dbus_name; g_debug ("music-player-bridge.vala:117: New client has registered that we have n" \ -"ot seen before: %s", dbus_name); - _tmp12_ = music_player_bridge_fetch_icon_name (desktop); - _tmp13_ = _tmp12_; - _tmp14_ = music_player_bridge_calculate_menu_position (self); - _tmp15_ = player_controller_new (self->priv->root_menu, app_info, dbus_name, _tmp13_, _tmp14_, &use_playlists, PLAYER_CONTROLLER_STATE_READY); - _tmp16_ = _tmp15_; - _g_free0 (_tmp13_); - ctrl = _tmp16_; - gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, mpris_key, ctrl); +"ot seen before: %s", _tmp26_); + _tmp27_ = self->priv->root_menu; + _tmp28_ = app_info; + _tmp29_ = dbus_name; + _tmp30_ = desktop; + _tmp31_ = music_player_bridge_fetch_icon_name (_tmp30_); + _tmp32_ = _tmp31_; + _tmp33_ = music_player_bridge_calculate_menu_position (self); + _tmp34_ = use_playlists; + _tmp35_ = player_controller_new (_tmp27_, _tmp28_, _tmp29_, _tmp32_, _tmp33_, &_tmp34_, PLAYER_CONTROLLER_STATE_READY); + _tmp36_ = _tmp35_; + _g_free0 (_tmp32_); + ctrl = _tmp36_; + _tmp37_ = self->priv->registered_clients; + _tmp38_ = mpris_key; + _tmp39_ = ctrl; + gee_abstract_map_set ((GeeAbstractMap*) _tmp37_, _tmp38_, _tmp39_); + _tmp40_ = desktop; g_debug ("music-player-bridge.vala:126: Have not seen this %s before, new contro" \ -"ller created.", desktop); - settings_manager_add_interested (self->priv->settings_manager, desktop); +"ller created.", _tmp40_); + _tmp41_ = self->priv->settings_manager; + _tmp42_ = desktop; + settings_manager_add_interested (_tmp41_, _tmp42_); g_debug ("music-player-bridge.vala:128: application added to the interested list"); _g_object_unref0 (ctrl); } else { - gpointer _tmp17_ = NULL; - PlayerController* _tmp18_; - gboolean* _tmp19_; - gpointer _tmp20_ = NULL; - PlayerController* _tmp21_; - gpointer _tmp22_ = NULL; - PlayerController* _tmp23_; - _tmp17_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); - _tmp18_ = (PlayerController*) _tmp17_; - _tmp19_ = __bool_dup0 (&use_playlists); - _g_free0 (_tmp18_->use_playlists); - _tmp18_->use_playlists = _tmp19_; - _g_object_unref0 (_tmp18_); - _tmp20_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); - _tmp21_ = (PlayerController*) _tmp20_; - player_controller_update_state (_tmp21_, PLAYER_CONTROLLER_STATE_READY); - _g_object_unref0 (_tmp21_); - _tmp22_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); - _tmp23_ = (PlayerController*) _tmp22_; - player_controller_activate (_tmp23_, dbus_name); - _g_object_unref0 (_tmp23_); + GeeHashMap* _tmp43_; + const gchar* _tmp44_; + gpointer _tmp45_ = NULL; + PlayerController* _tmp46_; + gboolean _tmp47_; + gboolean* _tmp48_; + GeeHashMap* _tmp49_; + const gchar* _tmp50_; + gpointer _tmp51_ = NULL; + PlayerController* _tmp52_; + GeeHashMap* _tmp53_; + const gchar* _tmp54_; + gpointer _tmp55_ = NULL; + PlayerController* _tmp56_; + const gchar* _tmp57_; + const gchar* _tmp58_; + gboolean _tmp59_; + gchar* _tmp60_ = NULL; + gchar* _tmp61_; + _tmp43_ = self->priv->registered_clients; + _tmp44_ = mpris_key; + _tmp45_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp43_, _tmp44_); + _tmp46_ = (PlayerController*) _tmp45_; + _tmp47_ = use_playlists; + _tmp48_ = __bool_dup0 (&_tmp47_); + _g_free0 (_tmp46_->use_playlists); + _tmp46_->use_playlists = _tmp48_; + _g_object_unref0 (_tmp46_); + _tmp49_ = self->priv->registered_clients; + _tmp50_ = mpris_key; + _tmp51_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp49_, _tmp50_); + _tmp52_ = (PlayerController*) _tmp51_; + player_controller_update_state (_tmp52_, PLAYER_CONTROLLER_STATE_READY); + _g_object_unref0 (_tmp52_); + _tmp53_ = self->priv->registered_clients; + _tmp54_ = mpris_key; + _tmp55_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp53_, _tmp54_); + _tmp56_ = (PlayerController*) _tmp55_; + _tmp57_ = dbus_name; + player_controller_activate (_tmp56_, _tmp57_); + _g_object_unref0 (_tmp56_); + _tmp58_ = dbus_name; + _tmp59_ = use_playlists; + _tmp60_ = bool_to_string (_tmp59_); + _tmp61_ = _tmp60_; g_debug ("music-player-bridge.vala:134: Application has already registered - awa" \ -"ken the hibernation: %s \n", dbus_name); +"ken the hibernation: %s with playlists %s \n", _tmp58_, _tmp61_); + _g_free0 (_tmp61_); } _g_free0 (mpris_key); _g_object_unref0 (app_info); @@ -476,34 +638,56 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gchar* mpris_root_interface) { + const gchar* _tmp0_; + DbusmenuMenuitem* _tmp1_; g_return_if_fail (self != NULL); g_return_if_fail (mpris_root_interface != NULL); + _tmp0_ = mpris_root_interface; g_debug ("music-player-bridge.vala:140: MusicPlayerBridge -> client with dbus in" \ -"terface %s has vanished", mpris_root_interface); - if (self->priv->root_menu != NULL) { - gchar* _tmp0_; - gchar* _tmp1_ = NULL; +"terface %s has vanished", _tmp0_); + _tmp1_ = self->priv->root_menu; + if (_tmp1_ != NULL) { + const gchar* _tmp2_; + const gchar* _tmp3_; + gchar* _tmp4_; + gchar* _tmp5_ = NULL; gchar* mpris_key; - gboolean _tmp2_ = FALSE; - g_debug ("music-player-bridge.vala:143: attempt to remove %s", mpris_root_interface); - _tmp0_ = g_strdup (mpris_root_interface); - _tmp1_ = music_player_bridge_determine_key (_tmp0_); - mpris_key = _tmp1_; - if (mpris_key != NULL) { - gboolean _tmp3_; - _tmp3_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); - _tmp2_ = _tmp3_; + gboolean _tmp6_ = FALSE; + const gchar* _tmp7_; + gboolean _tmp11_; + _tmp2_ = mpris_root_interface; + g_debug ("music-player-bridge.vala:143: attempt to remove %s", _tmp2_); + _tmp3_ = mpris_root_interface; + _tmp4_ = g_strdup (_tmp3_); + _tmp5_ = music_player_bridge_determine_key (_tmp4_); + mpris_key = _tmp5_; + _tmp7_ = mpris_key; + if (_tmp7_ != NULL) { + GeeHashMap* _tmp8_; + const gchar* _tmp9_; + gboolean _tmp10_ = FALSE; + _tmp8_ = self->priv->registered_clients; + _tmp9_ = mpris_key; + _tmp10_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp8_, _tmp9_); + _tmp6_ = _tmp10_; } else { - _tmp2_ = FALSE; + _tmp6_ = FALSE; } - if (_tmp2_) { - gpointer _tmp4_ = NULL; - PlayerController* _tmp5_; - _tmp4_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); - _tmp5_ = (PlayerController*) _tmp4_; - player_controller_hibernate (_tmp5_); - _g_object_unref0 (_tmp5_); - g_debug ("music-player-bridge.vala:147: Successively offlined client %s", mpris_key); + _tmp11_ = _tmp6_; + if (_tmp11_) { + GeeHashMap* _tmp12_; + const gchar* _tmp13_; + gpointer _tmp14_ = NULL; + PlayerController* _tmp15_; + const gchar* _tmp16_; + _tmp12_ = self->priv->registered_clients; + _tmp13_ = mpris_key; + _tmp14_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp12_, _tmp13_); + _tmp15_ = (PlayerController*) _tmp14_; + player_controller_hibernate (_tmp15_); + _g_object_unref0 (_tmp15_); + _tmp16_ = mpris_key; + g_debug ("music-player-bridge.vala:147: Successively offlined client %s", _tmp16_); } _g_free0 (mpris_key); } @@ -527,103 +711,147 @@ static void _music_player_bridge_client_has_vanished_mpris2_watcher_client_disap void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMenuitem* menu) { DbusmenuMenuitem* _tmp0_; - Mpris2Watcher* _tmp1_ = NULL; + DbusmenuMenuitem* _tmp1_; + Mpris2Watcher* _tmp2_; + Mpris2Watcher* _tmp3_; + Mpris2Watcher* _tmp4_; g_return_if_fail (self != NULL); g_return_if_fail (menu != NULL); - _tmp0_ = _g_object_ref0 (menu); + _tmp0_ = menu; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->root_menu); - self->priv->root_menu = _tmp0_; + self->priv->root_menu = _tmp1_; music_player_bridge_try_to_add_inactive_familiar_clients (self); - _tmp1_ = mpris2_watcher_new (); + _tmp2_ = mpris2_watcher_new (); _g_object_unref0 (self->priv->watcher); - self->priv->watcher = _tmp1_; - g_signal_connect_object (self->priv->watcher, "client-appeared", (GCallback) _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared, self, 0); - g_signal_connect_object (self->priv->watcher, "client-disappeared", (GCallback) _music_player_bridge_client_has_vanished_mpris2_watcher_client_disappeared, self, 0); + self->priv->watcher = _tmp2_; + _tmp3_ = self->priv->watcher; + g_signal_connect_object (_tmp3_, "client-appeared", (GCallback) _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared, self, 0); + _tmp4_ = self->priv->watcher; + g_signal_connect_object (_tmp4_, "client-disappeared", (GCallback) _music_player_bridge_client_has_vanished_mpris2_watcher_client_disappeared, self, 0); } void music_player_bridge_enable_player_specific_items_for_client (MusicPlayerBridge* self, const gchar* object_path, const gchar* desktop_id) { - gchar* _tmp0_; - gchar* _tmp1_ = NULL; + const gchar* _tmp0_; + gchar* _tmp1_; + gchar* _tmp2_ = NULL; gchar* mpris_key; - gboolean _tmp2_; - gpointer _tmp3_ = NULL; - PlayerController* _tmp4_; + GeeHashMap* _tmp3_; + const gchar* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeHashMap* _tmp7_; + const gchar* _tmp8_; + gpointer _tmp9_ = NULL; + PlayerController* _tmp10_; + const gchar* _tmp11_; g_return_if_fail (self != NULL); g_return_if_fail (object_path != NULL); g_return_if_fail (desktop_id != NULL); - _tmp0_ = g_strdup (desktop_id); - _tmp1_ = music_player_bridge_determine_key (_tmp0_); - mpris_key = _tmp1_; - _tmp2_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); - if (_tmp2_ == FALSE) { + _tmp0_ = desktop_id; + _tmp1_ = g_strdup (_tmp0_); + _tmp2_ = music_player_bridge_determine_key (_tmp1_); + mpris_key = _tmp2_; + _tmp3_ = self->priv->registered_clients; + _tmp4_ = mpris_key; + _tmp5_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp3_, _tmp4_); + if (_tmp5_ == FALSE) { + const gchar* _tmp6_; + _tmp6_ = desktop_id; g_warning ("music-player-bridge.vala:166: we don't have a client with desktop id %" \ -"s registered", desktop_id); +"s registered", _tmp6_); _g_free0 (mpris_key); return; } - _tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); - _tmp4_ = (PlayerController*) _tmp3_; - player_controller_enable_player_specific_items (_tmp4_, object_path); - _g_object_unref0 (_tmp4_); + _tmp7_ = self->priv->registered_clients; + _tmp8_ = mpris_key; + _tmp9_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp7_, _tmp8_); + _tmp10_ = (PlayerController*) _tmp9_; + _tmp11_ = object_path; + player_controller_enable_player_specific_items (_tmp10_, _tmp11_); + _g_object_unref0 (_tmp10_); _g_free0 (mpris_key); } void music_player_bridge_enable_track_specific_items_for_client (MusicPlayerBridge* self, const gchar* object_path, const gchar* desktop_id) { - gchar* _tmp0_; - gchar* _tmp1_ = NULL; + const gchar* _tmp0_; + gchar* _tmp1_; + gchar* _tmp2_ = NULL; gchar* mpris_key; - gboolean _tmp2_; - gpointer _tmp3_ = NULL; - PlayerController* _tmp4_; + GeeHashMap* _tmp3_; + const gchar* _tmp4_; + gboolean _tmp5_ = FALSE; + GeeHashMap* _tmp7_; + const gchar* _tmp8_; + gpointer _tmp9_ = NULL; + PlayerController* _tmp10_; + const gchar* _tmp11_; g_return_if_fail (self != NULL); g_return_if_fail (object_path != NULL); g_return_if_fail (desktop_id != NULL); - _tmp0_ = g_strdup (desktop_id); - _tmp1_ = music_player_bridge_determine_key (_tmp0_); - mpris_key = _tmp1_; - _tmp2_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); - if (_tmp2_ == FALSE) { + _tmp0_ = desktop_id; + _tmp1_ = g_strdup (_tmp0_); + _tmp2_ = music_player_bridge_determine_key (_tmp1_); + mpris_key = _tmp2_; + _tmp3_ = self->priv->registered_clients; + _tmp4_ = mpris_key; + _tmp5_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp3_, _tmp4_); + if (_tmp5_ == FALSE) { + const gchar* _tmp6_; + _tmp6_ = desktop_id; g_warning ("music-player-bridge.vala:177: we don't have a client with desktop id %" \ -"s registered", desktop_id); +"s registered", _tmp6_); _g_free0 (mpris_key); return; } - _tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); - _tmp4_ = (PlayerController*) _tmp3_; - player_controller_enable_track_specific_items (_tmp4_, object_path); - _g_object_unref0 (_tmp4_); + _tmp7_ = self->priv->registered_clients; + _tmp8_ = mpris_key; + _tmp9_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp7_, _tmp8_); + _tmp10_ = (PlayerController*) _tmp9_; + _tmp11_ = object_path; + player_controller_enable_track_specific_items (_tmp10_, _tmp11_); + _g_object_unref0 (_tmp10_); _g_free0 (mpris_key); } static GAppInfo* music_player_bridge_create_app_info (const gchar* desktop) { GAppInfo* result = NULL; - GDesktopAppInfo* _tmp0_ = NULL; + const gchar* _tmp0_; + GDesktopAppInfo* _tmp1_; GDesktopAppInfo* info; - gboolean _tmp1_ = FALSE; - GDesktopAppInfo* _tmp2_; - GAppInfo* _tmp3_; + gboolean _tmp2_ = FALSE; + const gchar* _tmp3_; + gboolean _tmp5_; + GDesktopAppInfo* _tmp7_; + GAppInfo* _tmp8_; GAppInfo* app_info; g_return_val_if_fail (desktop != NULL, NULL); - _tmp0_ = g_desktop_app_info_new (desktop); - info = _tmp0_; - if (desktop == NULL) { - _tmp1_ = TRUE; + _tmp0_ = desktop; + _tmp1_ = g_desktop_app_info_new (_tmp0_); + info = _tmp1_; + _tmp3_ = desktop; + if (_tmp3_ == NULL) { + _tmp2_ = TRUE; } else { - _tmp1_ = info == NULL; + GDesktopAppInfo* _tmp4_; + _tmp4_ = info; + _tmp2_ = _tmp4_ == NULL; } - if (_tmp1_) { + _tmp5_ = _tmp2_; + if (_tmp5_) { + const gchar* _tmp6_; + _tmp6_ = desktop; g_warning ("music-player-bridge.vala:187: Could not create a desktopappinfo instan" \ -"ce from app: %s", desktop); +"ce from app: %s", _tmp6_); result = NULL; _g_object_unref0 (info); return result; } - _tmp2_ = info; - _tmp3_ = _g_object_ref0 (G_IS_APP_INFO (_tmp2_) ? ((GAppInfo*) _tmp2_) : NULL); - app_info = _tmp3_; + _tmp7_ = info; + _tmp8_ = _g_object_ref0 (G_IS_APP_INFO (_tmp7_) ? ((GAppInfo*) _tmp7_) : NULL); + app_info = _tmp8_; result = app_info; _g_object_unref0 (info); return result; @@ -632,45 +860,51 @@ static GAppInfo* music_player_bridge_create_app_info (const gchar* desktop) { static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) { gchar* result = NULL; - gchar* _tmp0_ = NULL; - gchar* _tmp1_; - GDesktopAppInfo* _tmp2_ = NULL; + const gchar* _tmp0_; + gchar* _tmp1_ = NULL; + gchar* _tmp2_; GDesktopAppInfo* _tmp3_; + GDesktopAppInfo* _tmp4_; GDesktopAppInfo* info; - GKeyFile* _tmp4_ = NULL; + GKeyFile* _tmp5_; GKeyFile* desktop_keyfile; - const gchar* _tmp5_ = NULL; - gchar* _tmp6_ = NULL; - gchar* _tmp7_; GError * _inner_error_ = NULL; g_return_val_if_fail (desktop != NULL, NULL); - _tmp0_ = g_strconcat (desktop, ".desktop", NULL); - _tmp1_ = _tmp0_; - _tmp2_ = g_desktop_app_info_new (_tmp1_); - _tmp3_ = _tmp2_; - _g_free0 (_tmp1_); - info = _tmp3_; - _tmp4_ = g_key_file_new (); - desktop_keyfile = _tmp4_; - _tmp5_ = g_desktop_app_info_get_filename (info); - g_key_file_load_from_file (desktop_keyfile, _tmp5_, G_KEY_FILE_NONE, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_FILE_ERROR) { - goto __catch0_g_file_error; - } - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch0_g_key_file_error; + _tmp0_ = desktop; + _tmp1_ = g_strconcat (_tmp0_, ".desktop", NULL); + _tmp2_ = _tmp1_; + _tmp3_ = g_desktop_app_info_new (_tmp2_); + _tmp4_ = _tmp3_; + _g_free0 (_tmp2_); + info = _tmp4_; + _tmp5_ = g_key_file_new (); + desktop_keyfile = _tmp5_; + { + GKeyFile* _tmp6_; + GDesktopAppInfo* _tmp7_; + const gchar* _tmp8_ = NULL; + _tmp6_ = desktop_keyfile; + _tmp7_ = info; + _tmp8_ = g_desktop_app_info_get_filename (_tmp7_); + g_key_file_load_from_file (_tmp6_, _tmp8_, G_KEY_FILE_NONE, &_inner_error_); + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_FILE_ERROR) { + goto __catch0_g_file_error; + } + if (_inner_error_->domain == G_KEY_FILE_ERROR) { + goto __catch0_g_key_file_error; + } + _g_key_file_free0 (desktop_keyfile); + _g_object_unref0 (info); + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return NULL; } - _g_key_file_free0 (desktop_keyfile); - _g_object_unref0 (info); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; } goto __finally0; __catch0_g_file_error: { - GError * _error_; + GError* _error_ = NULL; _error_ = _inner_error_; _inner_error_ = NULL; g_warning ("music-player-bridge.vala:203: Error loading keyfile - FileError"); @@ -683,7 +917,7 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) { goto __finally0; __catch0_g_key_file_error: { - GError * _error_; + GError* _error_ = NULL; _error_ = _inner_error_; _inner_error_ = NULL; g_warning ("music-player-bridge.vala:207: Error loading keyfile - KeyFileError"); @@ -701,26 +935,32 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) { g_clear_error (&_inner_error_); return NULL; } - _tmp6_ = g_key_file_get_string (desktop_keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, &_inner_error_); - _tmp7_ = _tmp6_; - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch1_g_key_file_error; + { + GKeyFile* _tmp9_; + gchar* _tmp10_ = NULL; + gchar* _tmp11_; + _tmp9_ = desktop_keyfile; + _tmp10_ = g_key_file_get_string (_tmp9_, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, &_inner_error_); + _tmp11_ = _tmp10_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_KEY_FILE_ERROR) { + goto __catch1_g_key_file_error; + } + _g_key_file_free0 (desktop_keyfile); + _g_object_unref0 (info); + g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); + g_clear_error (&_inner_error_); + return NULL; } + result = _tmp11_; _g_key_file_free0 (desktop_keyfile); _g_object_unref0 (info); - g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); - g_clear_error (&_inner_error_); - return NULL; + return result; } - result = _tmp7_; - _g_key_file_free0 (desktop_keyfile); - _g_object_unref0 (info); - return result; goto __finally1; __catch1_g_key_file_error: { - GError * _error_; + GError* _error_ = NULL; _error_ = _inner_error_; _inner_error_ = NULL; g_warning ("music-player-bridge.vala:216: Error trying to fetch the icon name from" \ @@ -742,42 +982,74 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) { static gchar* music_player_bridge_determine_key (gchar* desktop_or_interface) { gchar* result = NULL; - gchar* _tmp0_; + const gchar* _tmp0_; + gchar* _tmp1_; gchar* _result_; - gchar** _tmp1_; - gchar** _tmp2_ = NULL; + const gchar* _tmp2_; + gchar** _tmp3_; + gchar** _tmp4_ = NULL; gchar** tokens; gint tokens_length1; gint _tokens_size_; - gchar** _tmp4_; - gchar** _tmp5_ = NULL; + gchar** _tmp5_; + gint _tmp5__length1; + const gchar* _tmp10_; + gchar** _tmp11_; + gchar** _tmp12_ = NULL; gchar** temp; gint temp_length1; gint _temp_size_; + gchar** _tmp13_; + gint _tmp13__length1; + const gchar* _tmp17_; g_return_val_if_fail (desktop_or_interface != NULL, NULL); - _tmp0_ = g_strdup (desktop_or_interface); - _result_ = _tmp0_; - _tmp2_ = _tmp1_ = g_strsplit (desktop_or_interface, ".", 0); - tokens = _tmp2_; - tokens_length1 = _vala_array_length (_tmp1_); - _tokens_size_ = _vala_array_length (_tmp1_); - if (tokens_length1 > 1) { - gchar* _tmp3_; - _tmp3_ = g_strdup (tokens[tokens_length1 - 1]); + _tmp0_ = desktop_or_interface; + _tmp1_ = g_strdup (_tmp0_); + _result_ = _tmp1_; + _tmp2_ = desktop_or_interface; + _tmp4_ = _tmp3_ = g_strsplit (_tmp2_, ".", 0); + tokens = _tmp4_; + tokens_length1 = _vala_array_length (_tmp3_); + _tokens_size_ = tokens_length1; + _tmp5_ = tokens; + _tmp5__length1 = tokens_length1; + if (_tmp5__length1 > 1) { + gchar** _tmp6_; + gint _tmp6__length1; + gchar** _tmp7_; + gint _tmp7__length1; + const gchar* _tmp8_; + gchar* _tmp9_; + _tmp6_ = tokens; + _tmp6__length1 = tokens_length1; + _tmp7_ = tokens; + _tmp7__length1 = tokens_length1; + _tmp8_ = _tmp6_[_tmp7__length1 - 1]; + _tmp9_ = g_strdup (_tmp8_); _g_free0 (_result_); - _result_ = _tmp3_; + _result_ = _tmp9_; } - _tmp5_ = _tmp4_ = g_strsplit (_result_, "-", 0); - temp = _tmp5_; - temp_length1 = _vala_array_length (_tmp4_); - _temp_size_ = _vala_array_length (_tmp4_); - if (temp_length1 > 1) { - gchar* _tmp6_; - _tmp6_ = g_strdup (temp[0]); + _tmp10_ = _result_; + _tmp12_ = _tmp11_ = g_strsplit (_tmp10_, "-", 0); + temp = _tmp12_; + temp_length1 = _vala_array_length (_tmp11_); + _temp_size_ = temp_length1; + _tmp13_ = temp; + _tmp13__length1 = temp_length1; + if (_tmp13__length1 > 1) { + gchar** _tmp14_; + gint _tmp14__length1; + const gchar* _tmp15_; + gchar* _tmp16_; + _tmp14_ = temp; + _tmp14__length1 = temp_length1; + _tmp15_ = _tmp14_[0]; + _tmp16_ = g_strdup (_tmp15_); _g_free0 (_result_); - _result_ = _tmp6_; + _result_ = _tmp16_; } - g_debug ("music-player-bridge.vala:239: determine key result = %s", _result_); + _tmp17_ = _result_; + g_debug ("music-player-bridge.vala:239: determine key result = %s", _tmp17_); result = _result_; temp = (_vala_array_free (temp, temp_length1, (GDestroyNotify) g_free), NULL); tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL); @@ -795,8 +1067,9 @@ static GObject * music_player_bridge_constructor (GType type, guint n_construct_ GObject * obj; GObjectClass * parent_class; MusicPlayerBridge * self; - GeeHashMap* _tmp0_ = NULL; - SettingsManager* _tmp1_ = NULL; + GeeHashMap* _tmp0_; + SettingsManager* _tmp1_; + SettingsManager* _tmp2_; parent_class = G_OBJECT_CLASS (music_player_bridge_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = MUSIC_PLAYER_BRIDGE (obj); @@ -806,7 +1079,8 @@ static GObject * music_player_bridge_constructor (GType type, guint n_construct_ _tmp1_ = settings_manager_new (); _g_object_unref0 (self->priv->settings_manager); self->priv->settings_manager = _tmp1_; - g_signal_connect_object (self->priv->settings_manager, "blacklist-updates", (GCallback) _music_player_bridge_on_blacklist_update_settings_manager_blacklist_updates, self, 0); + _tmp2_ = self->priv->settings_manager; + g_signal_connect_object (_tmp2_, "blacklist-updates", (GCallback) _music_player_bridge_on_blacklist_update_settings_manager_blacklist_updates, self, 0); return obj; } diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h index 7db0948..18404b3 100644 --- a/src/music-player-bridge.h +++ b/src/music-player-bridge.h @@ -1,4 +1,4 @@ -/* music-player-bridge.h generated by valac 0.12.1, the Vala compiler, do not modify */ +/* music-player-bridge.h generated by valac 0.14.0, the Vala compiler, do not modify */ #ifndef __MUSIC_PLAYER_BRIDGE_H__ @@ -539,6 +539,7 @@ Mpris2Watcher* mpris2_watcher_new (void); Mpris2Watcher* mpris2_watcher_construct (GType object_type); void mpris2_watcher_check_for_active_clients (Mpris2Watcher* self, GAsyncReadyCallback _callback_, gpointer _user_data_); void mpris2_watcher_check_for_active_clients_finish (Mpris2Watcher* self, GAsyncResult* _res_); +#define MPRIS2_CONTROLLER_MAX_PLAYLIST_COUNT 20 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); diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 72c9bdb..0c9cb10 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -131,7 +131,7 @@ public class MusicPlayerBridge : GLib.Object this.registered_clients[mpris_key].use_playlists = use_playlists; this.registered_clients[mpris_key].update_state ( PlayerController.state.READY ); this.registered_clients[mpris_key].activate ( dbus_name ); - debug("Application has already registered - awaken the hibernation: %s \n", dbus_name ); + debug("Application has already registered - awaken the hibernation: %s with playlists %s \n", dbus_name, use_playlists.to_string() ); } } diff --git a/src/player-controller.c b/src/player-controller.c index dbb5536..348ee4e 100644 --- a/src/player-controller.c +++ b/src/player-controller.c @@ -1,4 +1,4 @@ -/* player-controller.c generated by valac 0.12.1, the Vala compiler +/* player-controller.c generated by valac 0.14.0, the Vala compiler * generated from player-controller.vala, do not modify */ /* @@ -298,33 +298,51 @@ static gpointer _g_object_ref0 (gpointer self) { PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state) { PlayerController * self = NULL; gboolean* _tmp0_; - DbusmenuMenuitem* _tmp1_; - GeeArrayList* _tmp2_ = NULL; - const gchar* _tmp3_ = NULL; + gboolean* _tmp1_; + DbusmenuMenuitem* _tmp2_; + DbusmenuMenuitem* _tmp3_; + GAppInfo* _tmp4_; + const gchar* _tmp5_; + const gchar* _tmp6_; + GeeArrayList* _tmp7_; + PlayerControllerstate _tmp8_; + gint _tmp9_; + GAppInfo* _tmp10_; + const gchar* _tmp11_ = NULL; + const gchar* _tmp12_; g_return_val_if_fail (root != NULL, NULL); g_return_val_if_fail (app != NULL, NULL); g_return_val_if_fail (icon_name != NULL, NULL); self = (PlayerController*) g_object_new (object_type, NULL); - _tmp0_ = __bool_dup0 (use_playlists); + _tmp0_ = use_playlists; + _tmp1_ = __bool_dup0 (_tmp0_); _g_free0 (self->use_playlists); - self->use_playlists = _tmp0_; - _tmp1_ = _g_object_ref0 (root); + self->use_playlists = _tmp1_; + _tmp2_ = root; + _tmp3_ = _g_object_ref0 (_tmp2_); _g_object_unref0 (self->root_menu); - self->root_menu = _tmp1_; - player_controller_set_app_info (self, app); - player_controller_set_dbus_name (self, dbus_name); - player_controller_set_icon_name (self, icon_name); - _tmp2_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); + self->root_menu = _tmp3_; + _tmp4_ = app; + player_controller_set_app_info (self, _tmp4_); + _tmp5_ = dbus_name; + player_controller_set_dbus_name (self, _tmp5_); + _tmp6_ = icon_name; + player_controller_set_icon_name (self, _tmp6_); + _tmp7_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); _g_object_unref0 (self->custom_items); - self->custom_items = _tmp2_; - self->current_state = (gint) initial_state; - player_controller_set_menu_offset (self, offset); + self->custom_items = _tmp7_; + _tmp8_ = initial_state; + self->current_state = (gint) _tmp8_; + _tmp9_ = offset; + player_controller_set_menu_offset (self, _tmp9_); player_controller_construct_widgets (self); player_controller_establish_mpris_connection (self); player_controller_update_layout (self); - _tmp3_ = g_app_info_get_name (self->priv->_app_info); - g_debug ("player-controller.vala:74: New player controller for %s with icon nam" \ -"e %s", _tmp3_, self->priv->_icon_name); + _tmp10_ = self->priv->_app_info; + _tmp11_ = g_app_info_get_name (_tmp10_); + _tmp12_ = self->priv->_icon_name; + g_debug ("player-controller.vala:76: New player controller for %s with icon nam" \ +"e %s", _tmp11_, _tmp12_); return self; } @@ -335,45 +353,65 @@ PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state) { - const gchar* _tmp0_ = NULL; + GAppInfo* _tmp0_; + const gchar* _tmp1_ = NULL; + PlayerControllerstate _tmp2_; + PlayerControllerstate _tmp3_; g_return_if_fail (self != NULL); - _tmp0_ = g_app_info_get_name (self->priv->_app_info); - g_debug ("player-controller.vala:79: update_state - player controller %s : new s" \ -"tate %i", _tmp0_, (gint) new_state); - self->current_state = (gint) new_state; + _tmp0_ = self->priv->_app_info; + _tmp1_ = g_app_info_get_name (_tmp0_); + _tmp2_ = new_state; + g_debug ("player-controller.vala:81: update_state - player controller %s : new s" \ +"tate %i", _tmp1_, (gint) _tmp2_); + _tmp3_ = new_state; + self->current_state = (gint) _tmp3_; player_controller_update_layout (self); } void player_controller_activate (PlayerController* self, const gchar* dbus_name) { + const gchar* _tmp0_; g_return_if_fail (self != NULL); g_return_if_fail (dbus_name != NULL); - player_controller_set_dbus_name (self, dbus_name); + _tmp0_ = dbus_name; + player_controller_set_dbus_name (self, _tmp0_); player_controller_establish_mpris_connection (self); } void player_controller_instantiate (PlayerController* self) { - const gchar* _tmp0_ = NULL; + GAppInfo* _tmp0_; + const gchar* _tmp1_ = NULL; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - _tmp0_ = g_app_info_get_name (self->priv->_app_info); - g_debug ("player-controller.vala:99: instantiate in player controller for %s", _tmp0_); - g_app_info_launch (self->priv->_app_info, NULL, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch6_g_error; + _tmp0_ = self->priv->_app_info; + _tmp1_ = g_app_info_get_name (_tmp0_); + g_debug ("player-controller.vala:101: instantiate in player controller for %s", _tmp1_); + { + GAppInfo* _tmp2_; + _tmp2_ = self->priv->_app_info; + g_app_info_launch (_tmp2_, NULL, NULL, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch6_g_error; + } + player_controller_update_state (self, PLAYER_CONTROLLER_STATE_INSTANTIATING); } - player_controller_update_state (self, PLAYER_CONTROLLER_STATE_INSTANTIATING); goto __finally6; __catch6_g_error: { - GError * _error_; - const gchar* _tmp1_ = NULL; + GError* _error_ = NULL; + GAppInfo* _tmp3_; + const gchar* _tmp4_ = NULL; + GError* _tmp5_; + const gchar* _tmp6_; _error_ = _inner_error_; _inner_error_ = NULL; - _tmp1_ = g_app_info_get_name (self->priv->_app_info); - g_warning ("player-controller.vala:105: Failed to launch app %s with error message" \ -": %s", _tmp1_, _error_->message); + _tmp3_ = self->priv->_app_info; + _tmp4_ = g_app_info_get_name (_tmp3_); + _tmp5_ = _error_; + _tmp6_ = _tmp5_->message; + g_warning ("player-controller.vala:107: Failed to launch app %s with error message" \ +": %s", _tmp4_, _tmp6_); _g_error_free0 (_error_); } __finally6: @@ -386,41 +424,57 @@ void player_controller_instantiate (PlayerController* self) { void player_controller_enable_track_specific_items (PlayerController* self, const gchar* object_path) { + SpecificItemsManager* _tmp0_; g_return_if_fail (self != NULL); g_return_if_fail (object_path != NULL); - if (self->priv->track_specific_mgr == NULL) { - SpecificItemsManager* _tmp0_ = NULL; - _tmp0_ = specific_items_manager_new (self, object_path, SPECIFIC_ITEMS_MANAGER_CATEGORY_TRACK); + _tmp0_ = self->priv->track_specific_mgr; + if (_tmp0_ == NULL) { + const gchar* _tmp1_; + SpecificItemsManager* _tmp2_; + _tmp1_ = object_path; + _tmp2_ = specific_items_manager_new (self, _tmp1_, SPECIFIC_ITEMS_MANAGER_CATEGORY_TRACK); _g_object_unref0 (self->priv->track_specific_mgr); - self->priv->track_specific_mgr = _tmp0_; + self->priv->track_specific_mgr = _tmp2_; } } void player_controller_enable_player_specific_items (PlayerController* self, const gchar* object_path) { + SpecificItemsManager* _tmp0_; g_return_if_fail (self != NULL); g_return_if_fail (object_path != NULL); - if (self->priv->player_specific_mgr == NULL) { - SpecificItemsManager* _tmp0_ = NULL; - _tmp0_ = specific_items_manager_new (self, object_path, SPECIFIC_ITEMS_MANAGER_CATEGORY_PLAYER); + _tmp0_ = self->priv->player_specific_mgr; + if (_tmp0_ == NULL) { + const gchar* _tmp1_; + SpecificItemsManager* _tmp2_; + _tmp1_ = object_path; + _tmp2_ = specific_items_manager_new (self, _tmp1_, SPECIFIC_ITEMS_MANAGER_CATEGORY_PLAYER); _g_object_unref0 (self->priv->player_specific_mgr); - self->priv->player_specific_mgr = _tmp0_; + self->priv->player_specific_mgr = _tmp2_; } } gint player_controller_track_specific_count (PlayerController* self) { gint result = 0; - GeeArrayList* _tmp0_ = NULL; - gint _tmp1_; + SpecificItemsManager* _tmp0_; + SpecificItemsManager* _tmp1_; + GeeArrayList* _tmp2_; + GeeArrayList* _tmp3_; + gint _tmp4_; + gint _tmp5_; g_return_val_if_fail (self != NULL, 0); - if (self->priv->track_specific_mgr == NULL) { + _tmp0_ = self->priv->track_specific_mgr; + if (_tmp0_ == NULL) { result = 0; return result; } - _tmp0_ = specific_items_manager_get_proxy_items (self->priv->track_specific_mgr); - _tmp1_ = gee_collection_get_size ((GeeCollection*) _tmp0_); - result = _tmp1_; + _tmp1_ = self->priv->track_specific_mgr; + _tmp2_ = specific_items_manager_get_proxy_items (_tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + result = _tmp5_; return result; } @@ -443,28 +497,36 @@ static gchar* bool_to_string (gboolean self) { static void player_controller_establish_mpris_connection (PlayerController* self) { gboolean _tmp0_ = FALSE; - gchar* _tmp1_ = NULL; - gchar* _tmp2_; - Mpris2Controller* _tmp3_ = NULL; + gint _tmp1_; + gboolean _tmp3_; + gboolean* _tmp4_; + gchar* _tmp5_ = NULL; + gchar* _tmp6_; + Mpris2Controller* _tmp7_; g_return_if_fail (self != NULL); - if (self->current_state != PLAYER_CONTROLLER_STATE_READY) { + _tmp1_ = self->current_state; + if (_tmp1_ != ((gint) PLAYER_CONTROLLER_STATE_READY)) { _tmp0_ = TRUE; } else { - _tmp0_ = self->priv->_dbus_name == NULL; + const gchar* _tmp2_; + _tmp2_ = self->priv->_dbus_name; + _tmp0_ = _tmp2_ == NULL; } - if (_tmp0_) { - g_debug ("player-controller.vala:139: establish_mpris_connection - Not ready to " \ + _tmp3_ = _tmp0_; + if (_tmp3_) { + g_debug ("player-controller.vala:141: establish_mpris_connection - Not ready to " \ "connect"); return; } - _tmp1_ = bool_to_string (*self->use_playlists); - _tmp2_ = _tmp1_; - g_debug ("player-controller.vala:142: establish mpris connection - use playlist" \ -"s value = %s ", _tmp2_); - _g_free0 (_tmp2_); - _tmp3_ = mpris2_controller_new (self); + _tmp4_ = self->use_playlists; + _tmp5_ = bool_to_string (*_tmp4_); + _tmp6_ = _tmp5_; + g_debug ("player-controller.vala:144: establish mpris connection - use playlist" \ +"s value = %s ", _tmp6_); + _g_free0 (_tmp6_); + _tmp7_ = mpris2_controller_new (self); _g_object_unref0 (self->mpris_bridge); - self->mpris_bridge = _tmp3_; + self->mpris_bridge = _tmp7_; player_controller_determine_state (self); } @@ -484,74 +546,104 @@ static gboolean _bool_equal (const gboolean* s1, const gboolean* s2) { void player_controller_remove_from_menu (PlayerController* self) { - gboolean _tmp3_; + gboolean* _tmp13_; + gboolean _tmp14_; g_return_if_fail (self != NULL); { GeeArrayList* _tmp0_; + GeeArrayList* _tmp1_; GeeArrayList* _item_list; - gint _tmp1_; + GeeArrayList* _tmp2_; + gint _tmp3_; + gint _tmp4_; gint _item_size; gint _item_index; - _tmp0_ = _g_object_ref0 (self->custom_items); - _item_list = _tmp0_; - _tmp1_ = gee_collection_get_size ((GeeCollection*) _item_list); - _item_size = _tmp1_; + _tmp0_ = self->custom_items; + _tmp1_ = _g_object_ref0 (_tmp0_); + _item_list = _tmp1_; + _tmp2_ = _item_list; + _tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_); + _tmp4_ = _tmp3_; + _item_size = _tmp4_; _item_index = -1; while (TRUE) { - gpointer _tmp2_ = NULL; + gint _tmp5_; + gint _tmp6_; + gint _tmp7_; + GeeArrayList* _tmp8_; + gint _tmp9_; + gpointer _tmp10_ = NULL; PlayerItem* item; - _item_index = _item_index + 1; - if (!(_item_index < _item_size)) { + DbusmenuMenuitem* _tmp11_; + PlayerItem* _tmp12_; + _tmp5_ = _item_index; + _item_index = _tmp5_ + 1; + _tmp6_ = _item_index; + _tmp7_ = _item_size; + if (!(_tmp6_ < _tmp7_)) { break; } - _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) _item_list, _item_index); - item = (PlayerItem*) _tmp2_; - dbusmenu_menuitem_child_delete (self->root_menu, (DbusmenuMenuitem*) item); + _tmp8_ = _item_list; + _tmp9_ = _item_index; + _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_); + item = (PlayerItem*) _tmp10_; + _tmp11_ = self->root_menu; + _tmp12_ = item; + dbusmenu_menuitem_child_delete (_tmp11_, (DbusmenuMenuitem*) _tmp12_); _g_object_unref0 (item); } _g_object_unref0 (_item_list); } - _tmp3_ = TRUE; - if (_bool_equal (self->use_playlists, &_tmp3_) == TRUE) { - gpointer _tmp4_ = NULL; - PlayerItem* _tmp5_; + _tmp13_ = self->use_playlists; + _tmp14_ = TRUE; + if (_bool_equal (_tmp13_, &_tmp14_) == TRUE) { + GeeArrayList* _tmp15_; + gpointer _tmp16_ = NULL; PlaylistsMenuitem* playlists_menuitem; - _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); - _tmp5_ = (PlayerItem*) _tmp4_; - playlists_menuitem = IS_PLAYLISTS_MENUITEM (_tmp5_) ? ((PlaylistsMenuitem*) _tmp5_) : NULL; - dbusmenu_menuitem_child_delete (self->root_menu, playlists_menuitem->root_item); + DbusmenuMenuitem* _tmp17_; + PlaylistsMenuitem* _tmp18_; + DbusmenuMenuitem* _tmp19_; + _tmp15_ = self->custom_items; + _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) _tmp15_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); + playlists_menuitem = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _tmp16_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _tmp16_)) : NULL; + _tmp17_ = self->root_menu; + _tmp18_ = playlists_menuitem; + _tmp19_ = _tmp18_->root_item; + dbusmenu_menuitem_child_delete (_tmp17_, _tmp19_); _g_object_unref0 (playlists_menuitem); } } void player_controller_hibernate (PlayerController* self) { - gpointer _tmp0_ = NULL; - PlayerItem* _tmp1_; + GeeArrayList* _tmp0_; + gpointer _tmp1_ = NULL; TransportMenuitem* transport; - gpointer _tmp2_ = NULL; - PlayerItem* _tmp3_; - GeeHashSet* _tmp4_ = NULL; - GeeHashSet* _tmp5_; - gpointer _tmp6_ = NULL; - PlayerItem* _tmp7_; + GeeArrayList* _tmp2_; + gpointer _tmp3_ = NULL; + PlayerItem* _tmp4_; + GeeHashSet* _tmp5_ = NULL; + GeeHashSet* _tmp6_; + GeeArrayList* _tmp7_; + gpointer _tmp8_ = NULL; MetadataMenuitem* md; g_return_if_fail (self != NULL); player_controller_update_state (self, PLAYER_CONTROLLER_STATE_OFFLINE); - _tmp0_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); - _tmp1_ = (PlayerItem*) _tmp0_; - transport = IS_TRANSPORT_MENUITEM (_tmp1_) ? ((TransportMenuitem*) _tmp1_) : NULL; + _tmp0_ = self->custom_items; + _tmp1_ = gee_abstract_list_get ((GeeAbstractList*) _tmp0_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + transport = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp1_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp1_)) : NULL; transport_menuitem_change_play_state (transport, TRANSPORT_STATE_PAUSED); - _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp3_ = (PlayerItem*) _tmp2_; - _tmp4_ = metadata_menuitem_relevant_attributes_for_ui (); - _tmp5_ = _tmp4_; - player_item_reset (_tmp3_, _tmp5_); - _g_object_unref0 (_tmp5_); - _g_object_unref0 (_tmp3_); - _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp7_ = (PlayerItem*) _tmp6_; - md = IS_METADATA_MENUITEM (_tmp7_) ? ((MetadataMenuitem*) _tmp7_) : NULL; + _tmp2_ = self->custom_items; + _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + _tmp4_ = (PlayerItem*) _tmp3_; + _tmp5_ = metadata_menuitem_relevant_attributes_for_ui (); + _tmp6_ = _tmp5_; + player_item_reset (_tmp4_, _tmp6_); + _g_object_unref0 (_tmp6_); + _g_object_unref0 (_tmp4_); + _tmp7_ = self->custom_items; + _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp8_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp8_)) : NULL; metadata_menuitem_toggle_active_triangle (md, FALSE); _g_object_unref0 (self->mpris_bridge); self->mpris_bridge = NULL; @@ -561,133 +653,216 @@ void player_controller_hibernate (PlayerController* self) { void player_controller_update_layout (PlayerController* self) { - gpointer _tmp0_ = NULL; - PlayerItem* _tmp1_; + GeeArrayList* _tmp0_; + gpointer _tmp1_ = NULL; PlaylistsMenuitem* playlists_menuitem; - gpointer _tmp2_ = NULL; - PlayerItem* _tmp3_; + GeeArrayList* _tmp2_; + gpointer _tmp3_ = NULL; MetadataMenuitem* metadata_menuitem; - gpointer _tmp7_ = NULL; - PlayerItem* _tmp8_; - GeeHashSet* _tmp9_ = NULL; - GeeHashSet* _tmp10_; - gboolean _tmp11_; - const gchar* _tmp12_ = NULL; + gint _tmp4_; + MetadataMenuitem* _tmp13_; + GeeArrayList* _tmp14_; + gpointer _tmp15_ = NULL; + PlayerItem* _tmp16_; + GeeHashSet* _tmp17_ = NULL; + GeeHashSet* _tmp18_; + gboolean _tmp19_ = FALSE; + GAppInfo* _tmp20_; + const gchar* _tmp21_ = NULL; + PlaylistsMenuitem* _tmp28_; + DbusmenuMenuitem* _tmp29_; + gboolean* _tmp30_; g_return_if_fail (self != NULL); - g_debug ("player-controller.vala:172: a call to update layout"); - _tmp0_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); - _tmp1_ = (PlayerItem*) _tmp0_; - playlists_menuitem = IS_PLAYLISTS_MENUITEM (_tmp1_) ? ((PlaylistsMenuitem*) _tmp1_) : NULL; - _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp3_ = (PlayerItem*) _tmp2_; - metadata_menuitem = IS_METADATA_MENUITEM (_tmp3_) ? ((MetadataMenuitem*) _tmp3_) : NULL; - if (self->current_state != PLAYER_CONTROLLER_STATE_CONNECTED) { - gpointer _tmp4_ = NULL; - PlayerItem* _tmp5_; - const gchar* _tmp6_ = NULL; - metadata_menuitem_should_collapse (metadata_menuitem, TRUE); - dbusmenu_menuitem_property_set_bool (playlists_menuitem->root_item, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); - _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); - _tmp5_ = (PlayerItem*) _tmp4_; - _tmp6_ = g_app_info_get_id (self->priv->_app_info); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp5_, DBUSMENU_MENUITEM_PROP_VISIBLE, g_strcmp0 (_tmp6_, "banshee.desktop") == 0); - _g_object_unref0 (_tmp5_); + _tmp0_ = self->custom_items; + _tmp1_ = gee_abstract_list_get ((GeeAbstractList*) _tmp0_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); + playlists_menuitem = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _tmp1_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _tmp1_)) : NULL; + _tmp2_ = self->custom_items; + _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + metadata_menuitem = IS_METADATA_MENUITEM ((PlayerItem*) _tmp3_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp3_)) : NULL; + _tmp4_ = self->current_state; + if (_tmp4_ != ((gint) PLAYER_CONTROLLER_STATE_CONNECTED)) { + MetadataMenuitem* _tmp5_; + PlaylistsMenuitem* _tmp6_; + DbusmenuMenuitem* _tmp7_; + GeeArrayList* _tmp8_; + gpointer _tmp9_ = NULL; + PlayerItem* _tmp10_; + GAppInfo* _tmp11_; + const gchar* _tmp12_ = NULL; + _tmp5_ = metadata_menuitem; + metadata_menuitem_should_collapse (_tmp5_, TRUE); + _tmp6_ = playlists_menuitem; + _tmp7_ = _tmp6_->root_item; + dbusmenu_menuitem_property_set_bool (_tmp7_, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + _tmp8_ = self->custom_items; + _tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + _tmp10_ = (PlayerItem*) _tmp9_; + _tmp11_ = self->priv->_app_info; + _tmp12_ = g_app_info_get_id (_tmp11_); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp10_, DBUSMENU_MENUITEM_PROP_VISIBLE, g_strcmp0 (_tmp12_, "banshee.desktop") == 0); + _g_object_unref0 (_tmp10_); _g_object_unref0 (metadata_menuitem); _g_object_unref0 (playlists_menuitem); return; } - _tmp7_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp8_ = (PlayerItem*) _tmp7_; - _tmp9_ = metadata_menuitem_relevant_attributes_for_ui (); - _tmp10_ = _tmp9_; - _tmp11_ = player_item_populated (_tmp8_, _tmp10_); - metadata_menuitem_should_collapse (metadata_menuitem, !_tmp11_); - _g_object_unref0 (_tmp10_); - _g_object_unref0 (_tmp8_); - _tmp12_ = g_app_info_get_id (self->priv->_app_info); - if (g_strcmp0 (_tmp12_, "banshee.desktop") == 0) { - gpointer _tmp13_ = NULL; - PlayerItem* _tmp14_; + _tmp13_ = metadata_menuitem; + _tmp14_ = self->custom_items; + _tmp15_ = gee_abstract_list_get ((GeeAbstractList*) _tmp14_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + _tmp16_ = (PlayerItem*) _tmp15_; + _tmp17_ = metadata_menuitem_relevant_attributes_for_ui (); + _tmp18_ = _tmp17_; + _tmp19_ = player_item_populated (_tmp16_, _tmp18_); + metadata_menuitem_should_collapse (_tmp13_, !_tmp19_); + _g_object_unref0 (_tmp18_); + _g_object_unref0 (_tmp16_); + _tmp20_ = self->priv->_app_info; + _tmp21_ = g_app_info_get_id (_tmp20_); + if (g_strcmp0 (_tmp21_, "banshee.desktop") == 0) { + GeeArrayList* _tmp22_; + gpointer _tmp23_ = NULL; TransportMenuitem* transport; - _tmp13_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); - _tmp14_ = (PlayerItem*) _tmp13_; - transport = IS_TRANSPORT_MENUITEM (_tmp14_) ? ((TransportMenuitem*) _tmp14_) : NULL; - transport_menuitem_handle_cached_action (transport); + TransportMenuitem* _tmp24_; + _tmp22_ = self->custom_items; + _tmp23_ = gee_abstract_list_get ((GeeAbstractList*) _tmp22_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + transport = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp23_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp23_)) : NULL; + _tmp24_ = transport; + transport_menuitem_handle_cached_action (_tmp24_); _g_object_unref0 (transport); } else { - gpointer _tmp15_ = NULL; - PlayerItem* _tmp16_; - _tmp15_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); - _tmp16_ = (PlayerItem*) _tmp15_; - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp16_, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - _g_object_unref0 (_tmp16_); + GeeArrayList* _tmp25_; + gpointer _tmp26_ = NULL; + PlayerItem* _tmp27_; + _tmp25_ = self->custom_items; + _tmp26_ = gee_abstract_list_get ((GeeAbstractList*) _tmp25_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + _tmp27_ = (PlayerItem*) _tmp26_; + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp27_, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + _g_object_unref0 (_tmp27_); } - dbusmenu_menuitem_property_set_bool (playlists_menuitem->root_item, DBUSMENU_MENUITEM_PROP_VISIBLE, *self->use_playlists); + _tmp28_ = playlists_menuitem; + _tmp29_ = _tmp28_->root_item; + _tmp30_ = self->use_playlists; + dbusmenu_menuitem_property_set_bool (_tmp29_, DBUSMENU_MENUITEM_PROP_VISIBLE, *_tmp30_); _g_object_unref0 (metadata_menuitem); _g_object_unref0 (playlists_menuitem); } static void player_controller_construct_widgets (PlayerController* self) { - PlayerItem* _tmp0_ = NULL; + GeeArrayList* _tmp0_; PlayerItem* _tmp1_; - MetadataMenuitem* _tmp2_ = NULL; + PlayerItem* _tmp2_; + MetadataMenuitem* _tmp3_; MetadataMenuitem* metadata_item; - TransportMenuitem* _tmp3_ = NULL; + GeeArrayList* _tmp4_; + MetadataMenuitem* _tmp5_; + TransportMenuitem* _tmp6_; TransportMenuitem* transport_item; - PlaylistsMenuitem* _tmp4_ = NULL; + GeeArrayList* _tmp7_; + TransportMenuitem* _tmp8_; + PlaylistsMenuitem* _tmp9_; PlaylistsMenuitem* playlist_menuitem; + GeeArrayList* _tmp10_; + PlaylistsMenuitem* _tmp11_; g_return_if_fail (self != NULL); - _tmp0_ = player_item_new (DBUSMENU_CLIENT_TYPES_SEPARATOR); - _tmp1_ = _tmp0_; - gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, _tmp1_); - _g_object_unref0 (_tmp1_); - _tmp2_ = metadata_menuitem_new (self); - metadata_item = _tmp2_; - gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) metadata_item); - _tmp3_ = transport_menuitem_new (self); - transport_item = _tmp3_; - gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) transport_item); - _tmp4_ = playlists_menuitem_new (self); - playlist_menuitem = _tmp4_; - gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) playlist_menuitem); + _tmp0_ = self->custom_items; + _tmp1_ = player_item_new (DBUSMENU_CLIENT_TYPES_SEPARATOR); + _tmp2_ = _tmp1_; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp2_); + _g_object_unref0 (_tmp2_); + _tmp3_ = metadata_menuitem_new (self); + metadata_item = _tmp3_; + _tmp4_ = self->custom_items; + _tmp5_ = metadata_item; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp4_, (PlayerItem*) _tmp5_); + _tmp6_ = transport_menuitem_new (self); + transport_item = _tmp6_; + _tmp7_ = self->custom_items; + _tmp8_ = transport_item; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp7_, (PlayerItem*) _tmp8_); + _tmp9_ = playlists_menuitem_new (self); + playlist_menuitem = _tmp9_; + _tmp10_ = self->custom_items; + _tmp11_ = playlist_menuitem; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp10_, (PlayerItem*) _tmp11_); { - GeeArrayList* _tmp5_; + GeeArrayList* _tmp12_; + GeeArrayList* _tmp13_; GeeArrayList* _item_list; - gint _tmp6_; + GeeArrayList* _tmp14_; + gint _tmp15_; + gint _tmp16_; gint _item_size; gint _item_index; - _tmp5_ = _g_object_ref0 (self->custom_items); - _item_list = _tmp5_; - _tmp6_ = gee_collection_get_size ((GeeCollection*) _item_list); - _item_size = _tmp6_; + _tmp12_ = self->custom_items; + _tmp13_ = _g_object_ref0 (_tmp12_); + _item_list = _tmp13_; + _tmp14_ = _item_list; + _tmp15_ = gee_collection_get_size ((GeeCollection*) _tmp14_); + _tmp16_ = _tmp15_; + _item_size = _tmp16_; _item_index = -1; while (TRUE) { - gpointer _tmp7_ = NULL; + gint _tmp17_; + gint _tmp18_; + gint _tmp19_; + GeeArrayList* _tmp20_; + gint _tmp21_; + gpointer _tmp22_ = NULL; PlayerItem* item; - gint _tmp8_; - _item_index = _item_index + 1; - if (!(_item_index < _item_size)) { + GeeArrayList* _tmp23_; + PlayerItem* _tmp24_; + gint _tmp25_ = 0; + _tmp17_ = _item_index; + _item_index = _tmp17_ + 1; + _tmp18_ = _item_index; + _tmp19_ = _item_size; + if (!(_tmp18_ < _tmp19_)) { break; } - _tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _item_list, _item_index); - item = (PlayerItem*) _tmp7_; - _tmp8_ = gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item); - if (_tmp8_ == 4) { - PlayerItem* _tmp9_; - PlaylistsMenuitem* _tmp10_; + _tmp20_ = _item_list; + _tmp21_ = _item_index; + _tmp22_ = gee_abstract_list_get ((GeeAbstractList*) _tmp20_, _tmp21_); + item = (PlayerItem*) _tmp22_; + _tmp23_ = self->custom_items; + _tmp24_ = item; + _tmp25_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp23_, _tmp24_); + if (_tmp25_ == (PLAYER_CONTROLLER_WIDGET_QUANTITY - 1)) { + PlayerItem* _tmp26_; + PlaylistsMenuitem* _tmp27_; PlaylistsMenuitem* playlists_menuitem; - gint _tmp11_; - _tmp9_ = item; - _tmp10_ = _g_object_ref0 (IS_PLAYLISTS_MENUITEM (_tmp9_) ? ((PlaylistsMenuitem*) _tmp9_) : NULL); - playlists_menuitem = _tmp10_; - _tmp11_ = gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item); - dbusmenu_menuitem_child_add_position (self->root_menu, playlists_menuitem->root_item, (guint) (self->priv->_menu_offset + _tmp11_)); + DbusmenuMenuitem* _tmp28_; + PlaylistsMenuitem* _tmp29_; + DbusmenuMenuitem* _tmp30_; + gint _tmp31_; + GeeArrayList* _tmp32_; + PlayerItem* _tmp33_; + gint _tmp34_ = 0; + _tmp26_ = item; + _tmp27_ = _g_object_ref0 (IS_PLAYLISTS_MENUITEM (_tmp26_) ? ((PlaylistsMenuitem*) _tmp26_) : NULL); + playlists_menuitem = _tmp27_; + _tmp28_ = self->root_menu; + _tmp29_ = playlists_menuitem; + _tmp30_ = _tmp29_->root_item; + _tmp31_ = self->priv->_menu_offset; + _tmp32_ = self->custom_items; + _tmp33_ = item; + _tmp34_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp32_, _tmp33_); + dbusmenu_menuitem_child_add_position (_tmp28_, _tmp30_, (guint) (_tmp31_ + _tmp34_)); _g_object_unref0 (playlists_menuitem); } else { - gint _tmp12_; - _tmp12_ = gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item); - dbusmenu_menuitem_child_add_position (self->root_menu, (DbusmenuMenuitem*) item, (guint) (self->priv->_menu_offset + _tmp12_)); + DbusmenuMenuitem* _tmp35_; + PlayerItem* _tmp36_; + gint _tmp37_; + GeeArrayList* _tmp38_; + PlayerItem* _tmp39_; + gint _tmp40_ = 0; + _tmp35_ = self->root_menu; + _tmp36_ = item; + _tmp37_ = self->priv->_menu_offset; + _tmp38_ = self->custom_items; + _tmp39_ = item; + _tmp40_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp38_, _tmp39_); + dbusmenu_menuitem_child_add_position (_tmp35_, (DbusmenuMenuitem*) _tmp36_, (guint) (_tmp37_ + _tmp40_)); } _g_object_unref0 (item); } @@ -700,19 +875,25 @@ static void player_controller_construct_widgets (PlayerController* self) { static void player_controller_determine_state (PlayerController* self) { - gboolean _tmp0_; + Mpris2Controller* _tmp0_; + gboolean _tmp1_ = FALSE; g_return_if_fail (self != NULL); - _tmp0_ = mpris2_controller_connected (self->mpris_bridge); - if (_tmp0_ == TRUE) { - gpointer _tmp1_ = NULL; - PlayerItem* _tmp2_; + _tmp0_ = self->mpris_bridge; + _tmp1_ = mpris2_controller_connected (_tmp0_); + if (_tmp1_ == TRUE) { + GeeArrayList* _tmp2_; + gpointer _tmp3_ = NULL; MetadataMenuitem* md; + MetadataMenuitem* _tmp4_; + Mpris2Controller* _tmp5_; player_controller_update_state (self, PLAYER_CONTROLLER_STATE_CONNECTED); - _tmp1_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp2_ = (PlayerItem*) _tmp1_; - md = IS_METADATA_MENUITEM (_tmp2_) ? ((MetadataMenuitem*) _tmp2_) : NULL; - metadata_menuitem_toggle_active_triangle (md, TRUE); - mpris2_controller_initial_update (self->mpris_bridge); + _tmp2_ = self->custom_items; + _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp3_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp3_)) : NULL; + _tmp4_ = md; + metadata_menuitem_toggle_active_triangle (_tmp4_, TRUE); + _tmp5_ = self->mpris_bridge; + mpris2_controller_initial_update (_tmp5_); _g_object_unref0 (md); } else { player_controller_update_state (self, PLAYER_CONTROLLER_STATE_DISCONNECTED); @@ -722,69 +903,85 @@ static void player_controller_determine_state (PlayerController* self) { const gchar* player_controller_get_dbus_name (PlayerController* self) { const gchar* result; + const gchar* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_dbus_name; + _tmp0_ = self->priv->_dbus_name; + result = _tmp0_; return result; } void player_controller_set_dbus_name (PlayerController* self, const gchar* value) { - gchar* _tmp0_; + const gchar* _tmp0_; + gchar* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = g_strdup (value); + _tmp0_ = value; + _tmp1_ = g_strdup (_tmp0_); _g_free0 (self->priv->_dbus_name); - self->priv->_dbus_name = _tmp0_; + self->priv->_dbus_name = _tmp1_; g_object_notify ((GObject *) self, "dbus-name"); } GAppInfo* player_controller_get_app_info (PlayerController* self) { GAppInfo* result; + GAppInfo* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_app_info; + _tmp0_ = self->priv->_app_info; + result = _tmp0_; return result; } void player_controller_set_app_info (PlayerController* self, GAppInfo* value) { GAppInfo* _tmp0_; + GAppInfo* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = _g_object_ref0 (value); + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_app_info); - self->priv->_app_info = _tmp0_; + self->priv->_app_info = _tmp1_; g_object_notify ((GObject *) self, "app-info"); } gint player_controller_get_menu_offset (PlayerController* self) { gint result; + gint _tmp0_; g_return_val_if_fail (self != NULL, 0); - result = self->priv->_menu_offset; + _tmp0_ = self->priv->_menu_offset; + result = _tmp0_; return result; } void player_controller_set_menu_offset (PlayerController* self, gint value) { + gint _tmp0_; g_return_if_fail (self != NULL); - self->priv->_menu_offset = value; + _tmp0_ = value; + self->priv->_menu_offset = _tmp0_; g_object_notify ((GObject *) self, "menu-offset"); } const gchar* player_controller_get_icon_name (PlayerController* self) { const gchar* result; + const gchar* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_icon_name; + _tmp0_ = self->priv->_icon_name; + result = _tmp0_; return result; } void player_controller_set_icon_name (PlayerController* self, const gchar* value) { - gchar* _tmp0_; + const gchar* _tmp0_; + gchar* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = g_strdup (value); + _tmp0_ = value; + _tmp1_ = g_strdup (_tmp0_); _g_free0 (self->priv->_icon_name); - self->priv->_icon_name = _tmp0_; + self->priv->_icon_name = _tmp1_; g_object_notify ((GObject *) self, "icon-name"); } diff --git a/src/player-controller.vala b/src/player-controller.vala index ced7d96..04d0bf9 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -24,12 +24,14 @@ public class PlayerController : GLib.Object { public const int WIDGET_QUANTITY = 4; - public static enum widget_order{ + public enum widget_order{ SEPARATOR, METADATA, TRANSPORT, PLAYLISTS } + + public enum state{ OFFLINE, @@ -169,11 +171,9 @@ public class PlayerController : GLib.Object public void update_layout() { - debug ("a call to update layout"); PlaylistsMenuitem playlists_menuitem = this.custom_items[widget_order.PLAYLISTS] as PlaylistsMenuitem; MetadataMenuitem metadata_menuitem = this.custom_items[widget_order.METADATA] as MetadataMenuitem; if(this.current_state != state.CONNECTED){ - // TODO metadata_menuitem.should_collapse (true); playlists_menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, false ); @@ -212,7 +212,7 @@ public class PlayerController : GLib.Object this.custom_items.add(playlist_menuitem); foreach(PlayerItem item in this.custom_items){ - if (this.custom_items.index_of(item) == 4) { + if (this.custom_items.index_of(item) == WIDGET_QUANTITY-1) { PlaylistsMenuitem playlists_menuitem = item as PlaylistsMenuitem; root_menu.child_add_position(playlists_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item)); } diff --git a/src/player-item.c b/src/player-item.c index 89c291d..e9b7759 100644 --- a/src/player-item.c +++ b/src/player-item.c @@ -1,4 +1,4 @@ -/* player-item.c generated by valac 0.12.1, the Vala compiler +/* player-item.c generated by valac 0.14.0, the Vala compiler * generated from player-item.vala, do not modify */ /* @@ -116,8 +116,10 @@ static gint _vala_array_length (gpointer array); PlayerItem* player_item_construct (GType object_type, const gchar* type) { PlayerItem * self = NULL; + const gchar* _tmp0_; g_return_val_if_fail (type != NULL, NULL); - self = (PlayerItem*) g_object_new (object_type, "item-type", type, NULL); + _tmp0_ = type; + self = (PlayerItem*) g_object_new (object_type, "item-type", _tmp0_, NULL); return self; } @@ -131,21 +133,29 @@ void player_item_reset (PlayerItem* self, GeeHashSet* attrs) { g_return_if_fail (self != NULL); g_return_if_fail (attrs != NULL); { - GeeIterator* _tmp0_ = NULL; + GeeHashSet* _tmp0_; + GeeIterator* _tmp1_ = NULL; GeeIterator* _s_it; - _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) attrs); - _s_it = _tmp0_; + _tmp0_ = attrs; + _tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) _tmp0_); + _s_it = _tmp1_; while (TRUE) { - gboolean _tmp1_; - gpointer _tmp2_ = NULL; + GeeIterator* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeIterator* _tmp4_; + gpointer _tmp5_ = NULL; gchar* s; - _tmp1_ = gee_iterator_next (_s_it); - if (!_tmp1_) { + const gchar* _tmp6_; + _tmp2_ = _s_it; + _tmp3_ = gee_iterator_next (_tmp2_); + if (!_tmp3_) { break; } - _tmp2_ = gee_iterator_get (_s_it); - s = (gchar*) _tmp2_; - dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, s, PLAYER_ITEM_EMPTY); + _tmp4_ = _s_it; + _tmp5_ = gee_iterator_get (_tmp4_); + s = (gchar*) _tmp5_; + _tmp6_ = s; + dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, _tmp6_, PLAYER_ITEM_EMPTY); _g_free0 (s); } _g_object_unref0 (_s_it); @@ -168,10 +178,12 @@ static gchar* string_strip (const gchar* self) { gchar* result = NULL; gchar* _tmp0_ = NULL; gchar* _result_; + const gchar* _tmp1_; g_return_val_if_fail (self != NULL, NULL); _tmp0_ = g_strdup (self); _result_ = _tmp0_; - g_strstrip (_result_); + _tmp1_ = _result_; + g_strstrip (_tmp1_); result = _result_; return result; } @@ -179,11 +191,13 @@ static gchar* string_strip (const gchar* self) { static gboolean string_contains (const gchar* self, const gchar* needle) { gboolean result = FALSE; - gchar* _tmp0_ = NULL; + const gchar* _tmp0_; + gchar* _tmp1_ = NULL; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (needle != NULL, FALSE); - _tmp0_ = strstr ((gchar*) self, (gchar*) needle); - result = _tmp0_ != NULL; + _tmp0_ = needle; + _tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_); + result = _tmp1_ != NULL; return result; } @@ -194,74 +208,118 @@ static gpointer _g_object_ref0 (gpointer self) { void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes) { + GHashTable* _tmp0_; g_return_if_fail (self != NULL); g_return_if_fail (data != NULL); g_return_if_fail (attributes != NULL); - if (data == NULL) { + _tmp0_ = data; + if (_tmp0_ == NULL) { g_warning ("player-item.vala:54: PlayerItem::Update -> The hashtable was null - ju" \ "st leave it!"); return; } { - GeeIterator* _tmp0_ = NULL; + GeeHashSet* _tmp1_; + GeeIterator* _tmp2_ = NULL; GeeIterator* _property_it; - _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) attributes); - _property_it = _tmp0_; + _tmp1_ = attributes; + _tmp2_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) _tmp1_); + _property_it = _tmp2_; while (TRUE) { - gboolean _tmp1_; - gpointer _tmp2_ = NULL; + GeeIterator* _tmp3_; + gboolean _tmp4_ = FALSE; + GeeIterator* _tmp5_; + gpointer _tmp6_ = NULL; gchar* property; - gchar** _tmp3_; - gchar** _tmp4_ = NULL; + const gchar* _tmp7_; + gchar** _tmp8_; + gchar** _tmp9_ = NULL; gchar** input_keys; gint input_keys_length1; gint _input_keys_size_; - gchar* _tmp5_; + gchar** _tmp10_; + gint _tmp10__length1; + gchar** _tmp11_; + gint _tmp11__length1; + gchar** _tmp12_; + gint _tmp12__length1; + const gchar* _tmp13_; + gchar* _tmp14_; gchar* search_key; - gconstpointer _tmp6_ = NULL; - GVariant* _tmp7_; + GHashTable* _tmp15_; + const gchar* _tmp16_; + gconstpointer _tmp17_ = NULL; + GVariant* _tmp18_; GVariant* v; - gboolean _tmp8_; - _tmp1_ = gee_iterator_next (_property_it); - if (!_tmp1_) { + GVariant* _tmp19_; + GVariant* _tmp20_; + const GVariantType* _tmp21_; + gboolean _tmp22_ = FALSE; + _tmp3_ = _property_it; + _tmp4_ = gee_iterator_next (_tmp3_); + if (!_tmp4_) { break; } - _tmp2_ = gee_iterator_get (_property_it); - property = (gchar*) _tmp2_; - _tmp4_ = _tmp3_ = g_strsplit (property, "-", 0); - input_keys = _tmp4_; - input_keys_length1 = _vala_array_length (_tmp3_); - _input_keys_size_ = _vala_array_length (_tmp3_); - _tmp5_ = g_strdup ((input_keys + (input_keys_length1 - 1))[0]); - search_key = _tmp5_; - _tmp6_ = g_hash_table_lookup (data, search_key); - _tmp7_ = _g_variant_ref0 ((GVariant*) _tmp6_); - v = _tmp7_; - if (v == NULL) { + _tmp5_ = _property_it; + _tmp6_ = gee_iterator_get (_tmp5_); + property = (gchar*) _tmp6_; + _tmp7_ = property; + _tmp9_ = _tmp8_ = g_strsplit (_tmp7_, "-", 0); + input_keys = _tmp9_; + input_keys_length1 = _vala_array_length (_tmp8_); + _input_keys_size_ = input_keys_length1; + _tmp10_ = input_keys; + _tmp10__length1 = input_keys_length1; + _tmp11_ = input_keys; + _tmp11__length1 = input_keys_length1; + _tmp12_ = input_keys; + _tmp12__length1 = input_keys_length1; + _tmp13_ = (_tmp10_ + (_tmp11__length1 - 1))[0]; + _tmp14_ = g_strdup (_tmp13_); + search_key = _tmp14_; + _tmp15_ = data; + _tmp16_ = search_key; + _tmp17_ = g_hash_table_lookup (_tmp15_, _tmp16_); + _tmp18_ = _g_variant_ref0 ((GVariant*) _tmp17_); + v = _tmp18_; + _tmp19_ = v; + if (_tmp19_ == NULL) { _g_variant_unref0 (v); _g_free0 (search_key); input_keys = (_vala_array_free (input_keys, input_keys_length1, (GDestroyNotify) g_free), NULL); _g_free0 (property); continue; } - _tmp8_ = g_variant_is_of_type (v, G_VARIANT_TYPE_STRING); - if (_tmp8_) { - const gchar* _tmp9_ = NULL; - gchar* _tmp10_ = NULL; + _tmp20_ = v; + _tmp21_ = G_VARIANT_TYPE_STRING; + _tmp22_ = g_variant_is_of_type (_tmp20_, _tmp21_); + if (_tmp22_) { + GVariant* _tmp23_; + const gchar* _tmp24_ = NULL; + gchar* _tmp25_ = NULL; gchar* update; - gboolean _tmp11_; - _tmp9_ = g_variant_get_string (v, NULL); - _tmp10_ = string_strip (_tmp9_); - update = _tmp10_; - _tmp11_ = string_contains (property, "mpris:artUrl"); - if (_tmp11_) { - PlayerItem* _tmp12_; - MetadataMenuitem* _tmp13_; + const gchar* _tmp26_; + gboolean _tmp27_ = FALSE; + const gchar* _tmp32_; + const gchar* _tmp33_; + _tmp23_ = v; + _tmp24_ = g_variant_get_string (_tmp23_, NULL); + _tmp25_ = string_strip (_tmp24_); + update = _tmp25_; + _tmp26_ = property; + _tmp27_ = string_contains (_tmp26_, "mpris:artUrl"); + if (_tmp27_) { + MetadataMenuitem* _tmp28_; MetadataMenuitem* metadata; - _tmp12_ = self; - _tmp13_ = _g_object_ref0 (IS_METADATA_MENUITEM (_tmp12_) ? ((MetadataMenuitem*) _tmp12_) : NULL); - metadata = _tmp13_; - metadata_menuitem_fetch_art (metadata, update, property); + MetadataMenuitem* _tmp29_; + const gchar* _tmp30_; + const gchar* _tmp31_; + _tmp28_ = _g_object_ref0 (IS_METADATA_MENUITEM (self) ? ((MetadataMenuitem*) self) : NULL); + metadata = _tmp28_; + _tmp29_ = metadata; + _tmp30_ = update; + _tmp31_ = property; + metadata_menuitem_fetch_art (_tmp29_, _tmp30_, _tmp31_); _g_object_unref0 (metadata); _g_free0 (update); _g_variant_unref0 (v); @@ -270,29 +328,55 @@ void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attribu _g_free0 (property); continue; } - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, property, update); + _tmp32_ = property; + _tmp33_ = update; + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, _tmp32_, _tmp33_); _g_free0 (update); } else { - gboolean _tmp14_; - _tmp14_ = g_variant_is_of_type (v, G_VARIANT_TYPE_INT32); - if (_tmp14_) { - gint32 _tmp15_; - _tmp15_ = g_variant_get_int32 (v); - dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, (gint) _tmp15_); + GVariant* _tmp34_; + const GVariantType* _tmp35_; + gboolean _tmp36_ = FALSE; + _tmp34_ = v; + _tmp35_ = G_VARIANT_TYPE_INT32; + _tmp36_ = g_variant_is_of_type (_tmp34_, _tmp35_); + if (_tmp36_) { + const gchar* _tmp37_; + GVariant* _tmp38_; + gint32 _tmp39_ = 0; + _tmp37_ = property; + _tmp38_ = v; + _tmp39_ = g_variant_get_int32 (_tmp38_); + dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, _tmp37_, (gint) _tmp39_); } else { - gboolean _tmp16_; - _tmp16_ = g_variant_is_of_type (v, G_VARIANT_TYPE_INT64); - if (_tmp16_) { - gint64 _tmp17_; - _tmp17_ = g_variant_get_int64 (v); - dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, property, (gint) _tmp17_); + GVariant* _tmp40_; + const GVariantType* _tmp41_; + gboolean _tmp42_ = FALSE; + _tmp40_ = v; + _tmp41_ = G_VARIANT_TYPE_INT64; + _tmp42_ = g_variant_is_of_type (_tmp40_, _tmp41_); + if (_tmp42_) { + const gchar* _tmp43_; + GVariant* _tmp44_; + gint64 _tmp45_ = 0LL; + _tmp43_ = property; + _tmp44_ = v; + _tmp45_ = g_variant_get_int64 (_tmp44_); + dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, _tmp43_, (gint) _tmp45_); } else { - gboolean _tmp18_; - _tmp18_ = g_variant_is_of_type (v, G_VARIANT_TYPE_BOOLEAN); - if (_tmp18_) { - gboolean _tmp19_; - _tmp19_ = g_variant_get_boolean (v); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, property, _tmp19_); + GVariant* _tmp46_; + const GVariantType* _tmp47_; + gboolean _tmp48_ = FALSE; + _tmp46_ = v; + _tmp47_ = G_VARIANT_TYPE_BOOLEAN; + _tmp48_ = g_variant_is_of_type (_tmp46_, _tmp47_); + if (_tmp48_) { + const gchar* _tmp49_; + GVariant* _tmp50_; + gboolean _tmp51_ = FALSE; + _tmp49_ = property; + _tmp50_ = v; + _tmp51_ = g_variant_get_boolean (_tmp50_); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, _tmp49_, _tmp51_); } } } @@ -312,23 +396,31 @@ gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs) { g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (attrs != NULL, FALSE); { - GeeIterator* _tmp0_ = NULL; + GeeHashSet* _tmp0_; + GeeIterator* _tmp1_ = NULL; GeeIterator* _prop_it; - _tmp0_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) attrs); - _prop_it = _tmp0_; + _tmp0_ = attrs; + _tmp1_ = gee_abstract_collection_iterator ((GeeAbstractCollection*) _tmp0_); + _prop_it = _tmp1_; while (TRUE) { - gboolean _tmp1_; - gpointer _tmp2_ = NULL; + GeeIterator* _tmp2_; + gboolean _tmp3_ = FALSE; + GeeIterator* _tmp4_; + gpointer _tmp5_ = NULL; gchar* prop; - gint _tmp3_; - _tmp1_ = gee_iterator_next (_prop_it); - if (!_tmp1_) { + const gchar* _tmp6_; + gint _tmp7_ = 0; + _tmp2_ = _prop_it; + _tmp3_ = gee_iterator_next (_tmp2_); + if (!_tmp3_) { break; } - _tmp2_ = gee_iterator_get (_prop_it); - prop = (gchar*) _tmp2_; - _tmp3_ = dbusmenu_menuitem_property_get_int ((DbusmenuMenuitem*) self, prop); - if (_tmp3_ != PLAYER_ITEM_EMPTY) { + _tmp4_ = _prop_it; + _tmp5_ = gee_iterator_get (_tmp4_); + prop = (gchar*) _tmp5_; + _tmp6_ = prop; + _tmp7_ = dbusmenu_menuitem_property_get_int ((DbusmenuMenuitem*) self, _tmp6_); + if (_tmp7_ != PLAYER_ITEM_EMPTY) { result = TRUE; _g_free0 (prop); _g_object_unref0 (_prop_it); @@ -345,36 +437,44 @@ gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs) { PlayerController* player_item_get_owner (PlayerItem* self) { PlayerController* result; + PlayerController* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_owner; + _tmp0_ = self->priv->_owner; + result = _tmp0_; return result; } static void player_item_set_owner (PlayerItem* self, PlayerController* value) { PlayerController* _tmp0_; + PlayerController* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = _g_object_ref0 (value); + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_owner); - self->priv->_owner = _tmp0_; + self->priv->_owner = _tmp1_; g_object_notify ((GObject *) self, "owner"); } const gchar* player_item_get_item_type (PlayerItem* self) { const gchar* result; + const gchar* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_item_type; + _tmp0_ = self->priv->_item_type; + result = _tmp0_; return result; } static void player_item_set_item_type (PlayerItem* self, const gchar* value) { - gchar* _tmp0_; + const gchar* _tmp0_; + gchar* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = g_strdup (value); + _tmp0_ = value; + _tmp1_ = g_strdup (_tmp0_); _g_free0 (self->priv->_item_type); - self->priv->_item_type = _tmp0_; + self->priv->_item_type = _tmp1_; g_object_notify ((GObject *) self, "item-type"); } @@ -383,10 +483,12 @@ static GObject * player_item_constructor (GType type, guint n_construct_properti GObject * obj; GObjectClass * parent_class; PlayerItem * self; + const gchar* _tmp0_; parent_class = G_OBJECT_CLASS (player_item_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = PLAYER_ITEM (obj); - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_TYPE, self->priv->_item_type); + _tmp0_ = self->priv->_item_type; + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_TYPE, _tmp0_); return obj; } @@ -422,7 +524,7 @@ GType player_item_get_type (void) { if (g_once_init_enter (&player_item_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (PlayerItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) player_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PlayerItem), 0, (GInstanceInitFunc) player_item_instance_init, NULL }; GType player_item_type_id; - player_item_type_id = g_type_register_static (DBUSMENU_TYPE_MENUITEM, "PlayerItem", &g_define_type_info, 0); + player_item_type_id = g_type_register_static (dbusmenu_menuitem_get_type (), "PlayerItem", &g_define_type_info, 0); g_once_init_leave (&player_item_type_id__volatile, player_item_type_id); } return player_item_type_id__volatile; diff --git a/src/playlists-menu-item.c b/src/playlists-menu-item.c index fe673e1..fbef772 100644 --- a/src/playlists-menu-item.c +++ b/src/playlists-menu-item.c @@ -1,4 +1,4 @@ -/* playlists-menu-item.c generated by valac 0.12.1, the Vala compiler +/* playlists-menu-item.c generated by valac 0.14.0, the Vala compiler * generated from playlists-menu-item.vala, do not modify */ /* @@ -156,9 +156,9 @@ 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 gboolean playlists_menuitem_is_video_related (PlaylistsMenuitem* self, PlaylistDetails* new_detail); -static void _lambda1_ (Block1Data* _data1_); +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); +static void _____lambda1__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self); void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, PlaylistDetails* new_detail); void playlists_menuitem_active_playlist_update (PlaylistsMenuitem* self, PlaylistDetails* detail); PlayerController* player_item_get_owner (PlayerItem* self); @@ -171,8 +171,10 @@ static void playlists_menuitem_finalize (GObject* obj); PlaylistsMenuitem* playlists_menuitem_construct (GType object_type, PlayerController* parent) { PlaylistsMenuitem * self = NULL; + PlayerController* _tmp0_; g_return_val_if_fail (parent != NULL, NULL); - self = (PlaylistsMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_PLAYLISTS_MENUITEM_TYPE, "owner", parent, NULL); + _tmp0_ = parent; + self = (PlaylistsMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_PLAYLISTS_MENUITEM_TYPE, "owner", _tmp0_, NULL); return self; } @@ -197,69 +199,119 @@ static void block1_data_unref (Block1Data* _data1_) { } -static void _lambda1_ (Block1Data* _data1_) { +static void ____lambda1_ (Block1Data* _data1_) { PlaylistsMenuitem * self; - gint _tmp0_; + DbusmenuMenuitem* _tmp0_; + gint _tmp1_; + gint _tmp2_; self = _data1_->self; - _tmp0_ = dbusmenu_menuitem_get_id (_data1_->menuitem); - playlists_menuitem_submenu_item_activated (self, _tmp0_); + _tmp0_ = _data1_->menuitem; + _tmp1_ = dbusmenu_menuitem_get_id (_tmp0_); + _tmp2_ = _tmp1_; + playlists_menuitem_submenu_item_activated (self, _tmp2_); } -static void __lambda1__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint timestamp, gpointer self) { - _lambda1_ (self); +static void _____lambda1__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) { + ____lambda1_ (self); } void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1) { + PlaylistDetails* _tmp0_; + gint _tmp0__length1; g_return_if_fail (self != NULL); + _tmp0_ = playlists; + _tmp0__length1 = playlists_length1; { - PlaylistDetails* detail_collection; - int detail_collection_length1; - int detail_it; - detail_collection = playlists; - detail_collection_length1 = playlists_length1; - for (detail_it = 0; detail_it < playlists_length1; detail_it = detail_it + 1) { - PlaylistDetails _tmp0_; + PlaylistDetails* detail_collection = NULL; + gint detail_collection_length1 = 0; + gint _detail_collection_size_ = 0; + gint detail_it = 0; + detail_collection = _tmp0_; + detail_collection_length1 = _tmp0__length1; + for (detail_it = 0; detail_it < _tmp0__length1; detail_it = detail_it + 1) { PlaylistDetails _tmp1_ = {0}; - PlaylistDetails detail; + PlaylistDetails detail = {0}; playlist_details_copy (&detail_collection[detail_it], &_tmp1_); - _tmp0_ = _tmp1_; - detail = _tmp0_; + detail = _tmp1_; { Block1Data* _data1_; gboolean _tmp2_ = FALSE; - gboolean _tmp3_; - DbusmenuMenuitem* _tmp5_ = NULL; - gint _tmp6_; + PlaylistDetails _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp7_; + DbusmenuMenuitem* _tmp8_; + DbusmenuMenuitem* _tmp9_; + PlaylistDetails _tmp10_; + const gchar* _tmp11_; + DbusmenuMenuitem* _tmp12_; + DbusmenuMenuitem* _tmp13_; + PlaylistDetails _tmp14_; + const char* _tmp15_; + DbusmenuMenuitem* _tmp16_; + DbusmenuMenuitem* _tmp17_; + DbusmenuMenuitem* _tmp18_; + GeeHashMap* _tmp19_; + DbusmenuMenuitem* _tmp20_; + gint _tmp21_; + gint _tmp22_; + DbusmenuMenuitem* _tmp23_; + DbusmenuMenuitem* _tmp24_; + DbusmenuMenuitem* _tmp25_; + PlaylistDetails _tmp26_; + const gchar* _tmp27_; _data1_ = g_slice_new0 (Block1Data); _data1_->_ref_count_ = 1; _data1_->self = g_object_ref (self); - _tmp3_ = playlists_menuitem_already_observed (self, &detail); - if (_tmp3_) { + _tmp3_ = detail; + _tmp4_ = playlists_menuitem_already_observed (self, &_tmp3_); + if (_tmp4_) { _tmp2_ = TRUE; } else { - gboolean _tmp4_; - _tmp4_ = playlists_menuitem_is_video_related (self, &detail); - _tmp2_ = _tmp4_; + PlaylistDetails _tmp5_; + gboolean _tmp6_ = FALSE; + _tmp5_ = detail; + _tmp6_ = playlists_menuitem_is_video_related (self, &_tmp5_); + _tmp2_ = _tmp6_; } - if (_tmp2_) { + _tmp7_ = _tmp2_; + if (_tmp7_) { playlist_details_destroy (&detail); block1_data_unref (_data1_); _data1_ = NULL; continue; } - _tmp5_ = dbusmenu_menuitem_new (); - _data1_->menuitem = _tmp5_; - dbusmenu_menuitem_property_set (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_LABEL, detail.name); - dbusmenu_menuitem_property_set (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_ICON_NAME, "playlist-symbolic"); - 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); - _tmp6_ = dbusmenu_menuitem_get_id (_data1_->menuitem); - gee_abstract_map_set ((GeeAbstractMap*) self->priv->current_playlists, GINT_TO_POINTER (_tmp6_), _data1_->menuitem); - dbusmenu_menuitem_child_append (self->root_item, _data1_->menuitem); + _tmp8_ = dbusmenu_menuitem_new (); + _data1_->menuitem = _tmp8_; + _tmp9_ = _data1_->menuitem; + _tmp10_ = detail; + _tmp11_ = _tmp10_.name; + dbusmenu_menuitem_property_set (_tmp9_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp11_); + _tmp12_ = _data1_->menuitem; + dbusmenu_menuitem_property_set (_tmp12_, DBUSMENU_MENUITEM_PROP_ICON_NAME, "playlist-symbolic"); + _tmp13_ = _data1_->menuitem; + _tmp14_ = detail; + _tmp15_ = _tmp14_.path; + dbusmenu_menuitem_property_set (_tmp13_, DBUSMENU_PLAYLIST_MENUITEM_PATH, (const gchar*) _tmp15_); + _tmp16_ = _data1_->menuitem; + dbusmenu_menuitem_property_set_bool (_tmp16_, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + _tmp17_ = _data1_->menuitem; + dbusmenu_menuitem_property_set_bool (_tmp17_, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); + _tmp18_ = _data1_->menuitem; + g_signal_connect_data (_tmp18_, "item-activated", (GCallback) _____lambda1__dbusmenu_menuitem_item_activated, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0); + _tmp19_ = self->priv->current_playlists; + _tmp20_ = _data1_->menuitem; + _tmp21_ = dbusmenu_menuitem_get_id (_tmp20_); + _tmp22_ = _tmp21_; + _tmp23_ = _data1_->menuitem; + gee_abstract_map_set ((GeeAbstractMap*) _tmp19_, GINT_TO_POINTER (_tmp22_), _tmp23_); + _tmp24_ = self->root_item; + _tmp25_ = _data1_->menuitem; + dbusmenu_menuitem_child_append (_tmp24_, _tmp25_); + _tmp26_ = detail; + _tmp27_ = _tmp26_.name; + g_debug ("playlists-menu-item.vala:65: populating valid playlists %s", _tmp27_); playlist_details_destroy (&detail); block1_data_unref (_data1_); _data1_ = NULL; @@ -267,46 +319,64 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli } } { - GeeCollection* _tmp7_ = NULL; - GeeCollection* _tmp8_; - GeeIterator* _tmp9_ = NULL; - GeeIterator* _tmp10_; + GeeHashMap* _tmp28_; + GeeCollection* _tmp29_; + GeeCollection* _tmp30_; + GeeCollection* _tmp31_; + GeeIterator* _tmp32_ = NULL; + GeeIterator* _tmp33_; GeeIterator* _item_it; - _tmp7_ = gee_map_get_values ((GeeMap*) self->priv->current_playlists); - _tmp8_ = _tmp7_; - _tmp9_ = gee_iterable_iterator ((GeeIterable*) _tmp8_); - _tmp10_ = _tmp9_; - _g_object_unref0 (_tmp8_); - _item_it = _tmp10_; + _tmp28_ = self->priv->current_playlists; + _tmp29_ = gee_map_get_values ((GeeMap*) _tmp28_); + _tmp30_ = _tmp29_; + _tmp31_ = _tmp30_; + _tmp32_ = gee_iterable_iterator ((GeeIterable*) _tmp31_); + _tmp33_ = _tmp32_; + _g_object_unref0 (_tmp31_); + _item_it = _tmp33_; while (TRUE) { - gboolean _tmp11_; - gpointer _tmp12_ = NULL; + GeeIterator* _tmp34_; + gboolean _tmp35_ = FALSE; + GeeIterator* _tmp36_; + gpointer _tmp37_ = NULL; DbusmenuMenuitem* item; gboolean within; - _tmp11_ = gee_iterator_next (_item_it); - if (!_tmp11_) { + PlaylistDetails* _tmp38_; + gint _tmp38__length1; + gboolean _tmp44_; + _tmp34_ = _item_it; + _tmp35_ = gee_iterator_next (_tmp34_); + if (!_tmp35_) { break; } - _tmp12_ = gee_iterator_get (_item_it); - item = (DbusmenuMenuitem*) _tmp12_; + _tmp36_ = _item_it; + _tmp37_ = gee_iterator_get (_tmp36_); + item = (DbusmenuMenuitem*) _tmp37_; within = FALSE; + _tmp38_ = playlists; + _tmp38__length1 = playlists_length1; { - PlaylistDetails* detail_collection; - int detail_collection_length1; - int detail_it; - detail_collection = playlists; - detail_collection_length1 = playlists_length1; - for (detail_it = 0; detail_it < playlists_length1; detail_it = detail_it + 1) { - PlaylistDetails _tmp13_; - PlaylistDetails _tmp14_ = {0}; - PlaylistDetails detail; - playlist_details_copy (&detail_collection[detail_it], &_tmp14_); - _tmp13_ = _tmp14_; - detail = _tmp13_; + PlaylistDetails* detail_collection = NULL; + gint detail_collection_length1 = 0; + gint _detail_collection_size_ = 0; + gint detail_it = 0; + detail_collection = _tmp38_; + detail_collection_length1 = _tmp38__length1; + for (detail_it = 0; detail_it < _tmp38__length1; detail_it = detail_it + 1) { + PlaylistDetails _tmp39_ = {0}; + PlaylistDetails detail = {0}; + playlist_details_copy (&detail_collection[detail_it], &_tmp39_); + detail = _tmp39_; { - const gchar* _tmp15_ = NULL; - _tmp15_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH); - if (g_strcmp0 (detail.path, _tmp15_) == 0) { + PlaylistDetails _tmp40_; + const char* _tmp41_; + DbusmenuMenuitem* _tmp42_; + const gchar* _tmp43_ = NULL; + _tmp40_ = detail; + _tmp41_ = _tmp40_.path; + _tmp42_ = item; + _tmp43_ = dbusmenu_menuitem_property_get (_tmp42_, DBUSMENU_PLAYLIST_MENUITEM_PATH); + if (g_strcmp0 (_tmp41_, _tmp43_) == 0) { within = TRUE; playlist_details_destroy (&detail); break; @@ -315,17 +385,28 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli } } } - if (within == FALSE) { - const gchar* _tmp16_ = NULL; - const gchar* _tmp17_ = NULL; - _tmp16_ = dbusmenu_menuitem_property_get (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH); - _tmp17_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH); - if (g_strcmp0 (_tmp16_, _tmp17_) == 0) { - const gchar* _tmp18_ = NULL; - _tmp18_ = _ ("Choose Playlist"); - dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, _tmp18_); + _tmp44_ = within; + if (_tmp44_ == FALSE) { + DbusmenuMenuitem* _tmp45_; + const gchar* _tmp46_ = NULL; + DbusmenuMenuitem* _tmp47_; + const gchar* _tmp48_ = NULL; + DbusmenuMenuitem* _tmp51_; + DbusmenuMenuitem* _tmp52_; + _tmp45_ = self->root_item; + _tmp46_ = dbusmenu_menuitem_property_get (_tmp45_, DBUSMENU_PLAYLIST_MENUITEM_PATH); + _tmp47_ = item; + _tmp48_ = dbusmenu_menuitem_property_get (_tmp47_, DBUSMENU_PLAYLIST_MENUITEM_PATH); + if (g_strcmp0 (_tmp46_, _tmp48_) == 0) { + DbusmenuMenuitem* _tmp49_; + const gchar* _tmp50_ = NULL; + _tmp49_ = self->root_item; + _tmp50_ = _ ("Choose Playlist"); + dbusmenu_menuitem_property_set (_tmp49_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp50_); } - dbusmenu_menuitem_child_delete (self->root_item, item); + _tmp51_ = self->root_item; + _tmp52_ = item; + dbusmenu_menuitem_child_delete (_tmp51_, _tmp52_); } _g_object_unref0 (item); } @@ -335,42 +416,75 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, PlaylistDetails* new_detail) { - const gchar* _tmp7_ = NULL; + DbusmenuMenuitem* _tmp17_; + const gchar* _tmp18_ = NULL; + PlaylistDetails _tmp19_; + const char* _tmp20_; g_return_if_fail (self != NULL); + g_return_if_fail (new_detail != NULL); { - GeeCollection* _tmp0_ = NULL; + GeeHashMap* _tmp0_; GeeCollection* _tmp1_; - GeeIterator* _tmp2_ = NULL; - GeeIterator* _tmp3_; + GeeCollection* _tmp2_; + GeeCollection* _tmp3_; + GeeIterator* _tmp4_ = NULL; + GeeIterator* _tmp5_; GeeIterator* _item_it; - _tmp0_ = gee_map_get_values ((GeeMap*) self->priv->current_playlists); - _tmp1_ = _tmp0_; - _tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_); + _tmp0_ = self->priv->current_playlists; + _tmp1_ = gee_map_get_values ((GeeMap*) _tmp0_); + _tmp2_ = _tmp1_; _tmp3_ = _tmp2_; - _g_object_unref0 (_tmp1_); - _item_it = _tmp3_; + _tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_); + _tmp5_ = _tmp4_; + _g_object_unref0 (_tmp3_); + _item_it = _tmp5_; while (TRUE) { - gboolean _tmp4_; - gpointer _tmp5_ = NULL; + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; DbusmenuMenuitem* item; - const gchar* _tmp6_ = NULL; - _tmp4_ = gee_iterator_next (_item_it); - if (!_tmp4_) { + PlaylistDetails _tmp10_; + const char* _tmp11_; + DbusmenuMenuitem* _tmp12_; + const gchar* _tmp13_ = NULL; + _tmp6_ = _item_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { break; } - _tmp5_ = gee_iterator_get (_item_it); - item = (DbusmenuMenuitem*) _tmp5_; - _tmp6_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH); - if (g_strcmp0 ((*new_detail).path, _tmp6_) == 0) { - dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_LABEL, (*new_detail).name); + _tmp8_ = _item_it; + _tmp9_ = gee_iterator_get (_tmp8_); + item = (DbusmenuMenuitem*) _tmp9_; + _tmp10_ = *new_detail; + _tmp11_ = _tmp10_.path; + _tmp12_ = item; + _tmp13_ = dbusmenu_menuitem_property_get (_tmp12_, DBUSMENU_PLAYLIST_MENUITEM_PATH); + if (g_strcmp0 (_tmp11_, _tmp13_) == 0) { + DbusmenuMenuitem* _tmp14_; + PlaylistDetails _tmp15_; + const gchar* _tmp16_; + _tmp14_ = item; + _tmp15_ = *new_detail; + _tmp16_ = _tmp15_.name; + dbusmenu_menuitem_property_set (_tmp14_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp16_); } _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) { - dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, (*new_detail).name); + _tmp17_ = self->root_item; + _tmp18_ = dbusmenu_menuitem_property_get (_tmp17_, DBUSMENU_PLAYLIST_MENUITEM_PATH); + _tmp19_ = *new_detail; + _tmp20_ = _tmp19_.path; + if (g_strcmp0 (_tmp18_, _tmp20_) == 0) { + DbusmenuMenuitem* _tmp21_; + PlaylistDetails _tmp22_; + const gchar* _tmp23_; + _tmp21_ = self->root_item; + _tmp22_ = *new_detail; + _tmp23_ = _tmp22_.name; + dbusmenu_menuitem_property_set (_tmp21_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp23_); } } @@ -378,35 +492,52 @@ void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, Pla static gboolean playlists_menuitem_already_observed (PlaylistsMenuitem* self, PlaylistDetails* new_detail) { gboolean result = FALSE; g_return_val_if_fail (self != NULL, FALSE); + g_return_val_if_fail (new_detail != NULL, FALSE); { - GeeCollection* _tmp0_ = NULL; + GeeHashMap* _tmp0_; GeeCollection* _tmp1_; - GeeIterator* _tmp2_ = NULL; - GeeIterator* _tmp3_; + GeeCollection* _tmp2_; + GeeCollection* _tmp3_; + GeeIterator* _tmp4_ = NULL; + GeeIterator* _tmp5_; GeeIterator* _item_it; - _tmp0_ = gee_map_get_values ((GeeMap*) self->priv->current_playlists); - _tmp1_ = _tmp0_; - _tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_); + _tmp0_ = self->priv->current_playlists; + _tmp1_ = gee_map_get_values ((GeeMap*) _tmp0_); + _tmp2_ = _tmp1_; _tmp3_ = _tmp2_; - _g_object_unref0 (_tmp1_); - _item_it = _tmp3_; + _tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_); + _tmp5_ = _tmp4_; + _g_object_unref0 (_tmp3_); + _item_it = _tmp5_; while (TRUE) { - gboolean _tmp4_; - gpointer _tmp5_ = NULL; + GeeIterator* _tmp6_; + gboolean _tmp7_ = FALSE; + GeeIterator* _tmp8_; + gpointer _tmp9_ = NULL; DbusmenuMenuitem* item; - const gchar* _tmp6_ = NULL; - gchar* _tmp7_; + DbusmenuMenuitem* _tmp10_; + const gchar* _tmp11_ = NULL; + gchar* _tmp12_; gchar* path; - _tmp4_ = gee_iterator_next (_item_it); - if (!_tmp4_) { + PlaylistDetails _tmp13_; + const char* _tmp14_; + const gchar* _tmp15_; + _tmp6_ = _item_it; + _tmp7_ = gee_iterator_next (_tmp6_); + if (!_tmp7_) { break; } - _tmp5_ = gee_iterator_get (_item_it); - item = (DbusmenuMenuitem*) _tmp5_; - _tmp6_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH); - _tmp7_ = g_strdup (_tmp6_); - path = _tmp7_; - if (g_strcmp0 ((*new_detail).path, path) == 0) { + _tmp8_ = _item_it; + _tmp9_ = gee_iterator_get (_tmp8_); + item = (DbusmenuMenuitem*) _tmp9_; + _tmp10_ = item; + _tmp11_ = dbusmenu_menuitem_property_get (_tmp10_, DBUSMENU_PLAYLIST_MENUITEM_PATH); + _tmp12_ = g_strdup (_tmp11_); + path = _tmp12_; + _tmp13_ = *new_detail; + _tmp14_ = _tmp13_.path; + _tmp15_ = path; + if (g_strcmp0 (_tmp14_, _tmp15_) == 0) { result = TRUE; _g_free0 (path); _g_object_unref0 (item); @@ -425,25 +556,34 @@ static gboolean playlists_menuitem_already_observed (PlaylistsMenuitem* self, Pl static gboolean string_contains (const gchar* self, const gchar* needle) { gboolean result = FALSE; - gchar* _tmp0_ = NULL; + const gchar* _tmp0_; + gchar* _tmp1_ = NULL; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (needle != NULL, FALSE); - _tmp0_ = strstr ((gchar*) self, (gchar*) needle); - result = _tmp0_ != NULL; + _tmp0_ = needle; + _tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_); + result = _tmp1_ != NULL; return result; } static gboolean playlists_menuitem_is_video_related (PlaylistsMenuitem* self, PlaylistDetails* new_detail) { gboolean result = FALSE; - gchar* _tmp0_; + PlaylistDetails _tmp0_; + const char* _tmp1_; + gchar* _tmp2_; gchar* location; - gboolean _tmp1_; + const gchar* _tmp3_; + gboolean _tmp4_ = FALSE; g_return_val_if_fail (self != NULL, FALSE); - _tmp0_ = g_strdup ((const gchar*) (*new_detail).path); - location = _tmp0_; - _tmp1_ = string_contains (location, "/VideoLibrarySource/"); - if (_tmp1_) { + g_return_val_if_fail (new_detail != NULL, FALSE); + _tmp0_ = *new_detail; + _tmp1_ = _tmp0_.path; + _tmp2_ = g_strdup ((const gchar*) _tmp1_); + location = _tmp2_; + _tmp3_ = location; + _tmp4_ = string_contains (_tmp3_, "/VideoLibrarySource/"); + if (_tmp4_) { result = TRUE; _g_free0 (location); return result; @@ -455,50 +595,81 @@ static gboolean playlists_menuitem_is_video_related (PlaylistsMenuitem* self, Pl void playlists_menuitem_active_playlist_update (PlaylistsMenuitem* self, PlaylistDetails* detail) { - gchar* _tmp0_; + PlaylistDetails _tmp0_; + const gchar* _tmp1_; + gchar* _tmp2_; gchar* update; + const gchar* _tmp3_; + DbusmenuMenuitem* _tmp6_; + const gchar* _tmp7_; + DbusmenuMenuitem* _tmp8_; + PlaylistDetails _tmp9_; + const char* _tmp10_; g_return_if_fail (self != NULL); - _tmp0_ = g_strdup ((*detail).name); - update = _tmp0_; - if (g_strcmp0 (update, "") == 0) { - const gchar* _tmp1_ = NULL; - gchar* _tmp2_; - _tmp1_ = _ ("Choose Playlist"); - _tmp2_ = g_strdup (_tmp1_); + g_return_if_fail (detail != NULL); + _tmp0_ = *detail; + _tmp1_ = _tmp0_.name; + _tmp2_ = g_strdup (_tmp1_); + update = _tmp2_; + _tmp3_ = update; + if (g_strcmp0 (_tmp3_, "") == 0) { + const gchar* _tmp4_ = NULL; + gchar* _tmp5_; + _tmp4_ = _ ("Choose Playlist"); + _tmp5_ = g_strdup (_tmp4_); _g_free0 (update); - update = _tmp2_; + update = _tmp5_; } - dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, update); - dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH, (const gchar*) (*detail).path); + _tmp6_ = self->root_item; + _tmp7_ = update; + dbusmenu_menuitem_property_set (_tmp6_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp7_); + _tmp8_ = self->root_item; + _tmp9_ = *detail; + _tmp10_ = _tmp9_.path; + dbusmenu_menuitem_property_set (_tmp8_, DBUSMENU_PLAYLIST_MENUITEM_PATH, (const gchar*) _tmp10_); _g_free0 (update); } static void playlists_menuitem_submenu_item_activated (PlaylistsMenuitem* self, gint menu_item_id) { - gboolean _tmp0_; - PlayerController* _tmp1_ = NULL; - gpointer _tmp2_ = NULL; - DbusmenuMenuitem* _tmp3_; - const gchar* _tmp4_ = NULL; + GeeHashMap* _tmp0_; + gint _tmp1_; + gboolean _tmp2_ = FALSE; + PlayerController* _tmp4_; + PlayerController* _tmp5_; + Mpris2Controller* _tmp6_; + GeeHashMap* _tmp7_; + gint _tmp8_; + gpointer _tmp9_ = NULL; + DbusmenuMenuitem* _tmp10_; + const gchar* _tmp11_ = NULL; 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:124: item %i was activated but we don't have " \ -"a corresponding playlist", menu_item_id); + _tmp0_ = self->priv->current_playlists; + _tmp1_ = menu_item_id; + _tmp2_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, GINT_TO_POINTER (_tmp1_)); + if (!_tmp2_) { + gint _tmp3_; + _tmp3_ = menu_item_id; + g_warning ("playlists-menu-item.vala:125: item %i was activated but we don't have " \ +"a corresponding playlist", _tmp3_); return; } - _tmp1_ = player_item_get_owner ((PlayerItem*) self); - _tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->current_playlists, GINT_TO_POINTER (menu_item_id)); - _tmp3_ = (DbusmenuMenuitem*) _tmp2_; - _tmp4_ = dbusmenu_menuitem_property_get (_tmp3_, DBUSMENU_PLAYLIST_MENUITEM_PATH); - mpris2_controller_activate_playlist (_tmp1_->mpris_bridge, (const char*) _tmp4_); - _g_object_unref0 (_tmp3_); + _tmp4_ = player_item_get_owner ((PlayerItem*) self); + _tmp5_ = _tmp4_; + _tmp6_ = _tmp5_->mpris_bridge; + _tmp7_ = self->priv->current_playlists; + _tmp8_ = menu_item_id; + _tmp9_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp7_, GINT_TO_POINTER (_tmp8_)); + _tmp10_ = (DbusmenuMenuitem*) _tmp9_; + _tmp11_ = dbusmenu_menuitem_property_get (_tmp10_, DBUSMENU_PLAYLIST_MENUITEM_PATH); + mpris2_controller_activate_playlist (_tmp6_, (const char*) _tmp11_); + _g_object_unref0 (_tmp10_); } GeeHashSet* playlists_menuitem_attributes_format (void) { GeeHashSet* result = NULL; - GeeHashSet* _tmp0_ = NULL; + GeeHashSet* _tmp0_; GeeHashSet* attrs; _tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); attrs = _tmp0_; @@ -513,21 +684,25 @@ static GObject * playlists_menuitem_constructor (GType type, guint n_construct_p GObject * obj; GObjectClass * parent_class; PlaylistsMenuitem * self; - GeeHashMap* _tmp0_ = NULL; - DbusmenuMenuitem* _tmp1_ = NULL; - const gchar* _tmp2_ = NULL; + GeeHashMap* _tmp0_; + DbusmenuMenuitem* _tmp1_; + DbusmenuMenuitem* _tmp2_; + const gchar* _tmp3_ = NULL; + DbusmenuMenuitem* _tmp4_; parent_class = G_OBJECT_CLASS (playlists_menuitem_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = PLAYLISTS_MENUITEM (obj); - _tmp0_ = gee_hash_map_new (G_TYPE_INT, NULL, NULL, DBUSMENU_TYPE_MENUITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL); + _tmp0_ = gee_hash_map_new (G_TYPE_INT, NULL, NULL, dbusmenu_menuitem_get_type (), (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL, NULL, NULL); _g_object_unref0 (self->priv->current_playlists); self->priv->current_playlists = _tmp0_; _tmp1_ = dbusmenu_menuitem_new (); _g_object_unref0 (self->root_item); self->root_item = _tmp1_; - _tmp2_ = _ ("Choose Playlist"); - dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, _tmp2_); - dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH, ""); + _tmp2_ = self->root_item; + _tmp3_ = _ ("Choose Playlist"); + dbusmenu_menuitem_property_set (_tmp2_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp3_); + _tmp4_ = self->root_item; + dbusmenu_menuitem_property_set (_tmp4_, DBUSMENU_PLAYLIST_MENUITEM_PATH, ""); return obj; } diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index 452a586..9cb7ac7 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -62,6 +62,7 @@ public class PlaylistsMenuitem : PlayerItem ); this.current_playlists.set( menuitem.id, menuitem ); this.root_item.child_append( menuitem ); + debug ("populating valid playlists %s", detail.name); } // Finally remove any that might have been deleted foreach (Dbusmenu.Menuitem item in this.current_playlists.values) { diff --git a/src/settings-manager.c b/src/settings-manager.c index 748cffe..898e983 100644 --- a/src/settings-manager.c +++ b/src/settings-manager.c @@ -1,4 +1,4 @@ -/* settings-manager.c generated by valac 0.12.1, the Vala compiler +/* settings-manager.c generated by valac 0.14.0, the Vala compiler * generated from settings-manager.vala, do not modify */ /* @@ -94,16 +94,20 @@ SettingsManager* settings_manager_new (void) { gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_length1) { gchar** result = NULL; - gchar** _tmp0_; - gchar** _tmp1_ = NULL; - gchar** _tmp2_; + GSettings* _tmp0_; + gchar** _tmp1_; + gchar** _tmp2_ = NULL; + gchar** _tmp3_; + gint _tmp3__length1; g_return_val_if_fail (self != NULL, NULL); - _tmp1_ = _tmp0_ = g_settings_get_strv (self->priv->settings, "blacklisted-media-players"); - _tmp2_ = _tmp1_; + _tmp0_ = self->priv->settings; + _tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "blacklisted-media-players"); + _tmp3_ = _tmp2_; + _tmp3__length1 = _vala_array_length (_tmp1_); if (result_length1) { - *result_length1 = _vala_array_length (_tmp0_); + *result_length1 = _tmp3__length1; } - result = _tmp2_; + result = _tmp3_; return result; } @@ -121,58 +125,83 @@ static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gc GeeArrayList* settings_manager_fetch_interested (SettingsManager* self) { GeeArrayList* result = NULL; - gchar** _tmp0_; - gchar** _tmp1_ = NULL; + GSettings* _tmp0_; + gchar** _tmp1_; + gchar** _tmp2_ = NULL; gchar** blacklisted; gint blacklisted_length1; gint _blacklisted_size_; - gchar** _tmp2_; - gchar** _tmp3_ = NULL; + GSettings* _tmp3_; + gchar** _tmp4_; + gchar** _tmp5_ = NULL; gchar** interested; gint interested_length1; gint _interested_size_; - GeeArrayList* _tmp4_ = NULL; + GeeArrayList* _tmp6_; GeeArrayList* list; + gchar** _tmp7_; + gint _tmp7__length1; g_return_val_if_fail (self != NULL, NULL); - _tmp1_ = _tmp0_ = g_settings_get_strv (self->priv->settings, "blacklisted-media-players"); - blacklisted = _tmp1_; - blacklisted_length1 = _vala_array_length (_tmp0_); - _blacklisted_size_ = _vala_array_length (_tmp0_); - _tmp3_ = _tmp2_ = g_settings_get_strv (self->priv->settings, "interested-media-players"); - interested = _tmp3_; - interested_length1 = _vala_array_length (_tmp2_); - _interested_size_ = _vala_array_length (_tmp2_); - _tmp4_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); - list = _tmp4_; + _tmp0_ = self->priv->settings; + _tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "blacklisted-media-players"); + blacklisted = _tmp2_; + blacklisted_length1 = _vala_array_length (_tmp1_); + _blacklisted_size_ = blacklisted_length1; + _tmp3_ = self->priv->settings; + _tmp5_ = _tmp4_ = g_settings_get_strv (_tmp3_, "interested-media-players"); + interested = _tmp5_; + interested_length1 = _vala_array_length (_tmp4_); + _interested_size_ = interested_length1; + _tmp6_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + list = _tmp6_; + _tmp7_ = interested; + _tmp7__length1 = interested_length1; { - gchar** s_collection; - int s_collection_length1; - int s_it; - s_collection = interested; - s_collection_length1 = interested_length1; - for (s_it = 0; s_it < interested_length1; s_it = s_it + 1) { - gchar* _tmp5_; - gchar* s; - _tmp5_ = g_strdup (s_collection[s_it]); - s = _tmp5_; + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp7_; + s_collection_length1 = _tmp7__length1; + for (s_it = 0; s_it < _tmp7__length1; s_it = s_it + 1) { + gchar* _tmp8_; + gchar* s = NULL; + _tmp8_ = g_strdup (s_collection[s_it]); + s = _tmp8_; { - gboolean _tmp7_; - if (g_strcmp0 (s, "banshee-1") == 0) { - gchar* _tmp6_; - _tmp6_ = g_strdup ("banshee"); + const gchar* _tmp9_; + GeeArrayList* _tmp11_; + const gchar* _tmp12_; + gboolean _tmp13_ = FALSE; + const gchar* _tmp14_; + gchar** _tmp15_; + gint _tmp15__length1; + GeeArrayList* _tmp16_; + const gchar* _tmp17_; + _tmp9_ = s; + if (g_strcmp0 (_tmp9_, "banshee-1") == 0) { + gchar* _tmp10_; + _tmp10_ = g_strdup ("banshee"); _g_free0 (s); - s = _tmp6_; + s = _tmp10_; } - _tmp7_ = gee_abstract_collection_contains ((GeeAbstractCollection*) list, s); - if (_tmp7_) { + _tmp11_ = list; + _tmp12_ = s; + _tmp13_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp11_, _tmp12_); + if (_tmp13_) { _g_free0 (s); continue; } - if (_vala_string_array_contains (blacklisted, blacklisted_length1, s)) { + _tmp14_ = s; + _tmp15_ = blacklisted; + _tmp15__length1 = blacklisted_length1; + if (_vala_string_array_contains (_tmp15_, _tmp15__length1, _tmp14_)) { _g_free0 (s); continue; } - gee_abstract_collection_add ((GeeAbstractCollection*) list, s); + _tmp16_ = list; + _tmp17_ = s; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_); _g_free0 (s); } } @@ -185,8 +214,10 @@ GeeArrayList* settings_manager_fetch_interested (SettingsManager* self) { void settings_manager_clear_list (SettingsManager* self) { + GSettings* _tmp0_; g_return_if_fail (self != NULL); - g_settings_reset (self->priv->settings, "interested-media-players"); + _tmp0_ = self->priv->settings; + g_settings_reset (_tmp0_, "interested-media-players"); } @@ -201,31 +232,49 @@ static void _vala_array_add1 (gchar*** array, int* length, int* size, gchar* val void settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name) { - gchar** _tmp0_; - gchar** _tmp1_ = NULL; + GSettings* _tmp0_; + gchar** _tmp1_; + gchar** _tmp2_ = NULL; gchar** already_interested; gint already_interested_length1; gint _already_interested_size_; - gchar* _tmp3_; + gchar** _tmp3_; + gint _tmp3__length1; + gchar** _tmp7_; + gint _tmp7__length1; + const gchar* _tmp8_; + gchar* _tmp9_; + GSettings* _tmp10_; + gchar** _tmp11_; + gint _tmp11__length1; + GSettings* _tmp12_; g_return_if_fail (self != NULL); g_return_if_fail (app_desktop_name != NULL); - _tmp1_ = _tmp0_ = g_settings_get_strv (self->priv->settings, "interested-media-players"); - already_interested = _tmp1_; - already_interested_length1 = _vala_array_length (_tmp0_); - _already_interested_size_ = _vala_array_length (_tmp0_); + _tmp0_ = self->priv->settings; + _tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "interested-media-players"); + already_interested = _tmp2_; + already_interested_length1 = _vala_array_length (_tmp1_); + _already_interested_size_ = already_interested_length1; + _tmp3_ = already_interested; + _tmp3__length1 = already_interested_length1; { - gchar** s_collection; - int s_collection_length1; - int s_it; - s_collection = already_interested; - s_collection_length1 = already_interested_length1; - for (s_it = 0; s_it < already_interested_length1; s_it = s_it + 1) { - gchar* _tmp2_; - gchar* s; - _tmp2_ = g_strdup (s_collection[s_it]); - s = _tmp2_; + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp3_; + s_collection_length1 = _tmp3__length1; + for (s_it = 0; s_it < _tmp3__length1; s_it = s_it + 1) { + gchar* _tmp4_; + gchar* s = NULL; + _tmp4_ = g_strdup (s_collection[s_it]); + s = _tmp4_; { - if (g_strcmp0 (s, app_desktop_name) == 0) { + const gchar* _tmp5_; + const gchar* _tmp6_; + _tmp5_ = s; + _tmp6_ = app_desktop_name; + if (g_strcmp0 (_tmp5_, _tmp6_) == 0) { _g_free0 (s); already_interested = (_vala_array_free (already_interested, already_interested_length1, (GDestroyNotify) g_free), NULL); return; @@ -234,25 +283,34 @@ void settings_manager_add_interested (SettingsManager* self, const gchar* app_de } } } - _tmp3_ = g_strdup (app_desktop_name); - _vala_array_add1 (&already_interested, &already_interested_length1, &_already_interested_size_, _tmp3_); - g_settings_set_strv (self->priv->settings, "interested-media-players", already_interested); - g_settings_apply (self->priv->settings); + _tmp7_ = already_interested; + _tmp7__length1 = already_interested_length1; + _tmp8_ = app_desktop_name; + _tmp9_ = g_strdup (_tmp8_); + _vala_array_add1 (&already_interested, &already_interested_length1, &_already_interested_size_, _tmp9_); + _tmp10_ = self->priv->settings; + _tmp11_ = already_interested; + _tmp11__length1 = already_interested_length1; + g_settings_set_strv (_tmp10_, "interested-media-players", _tmp11_); + _tmp12_ = self->priv->settings; + g_settings_apply (_tmp12_); already_interested = (_vala_array_free (already_interested, already_interested_length1, (GDestroyNotify) g_free), NULL); } static void settings_manager_on_blacklist_event (SettingsManager* self) { - gchar** _tmp0_; - gchar** _tmp1_ = NULL; - gchar** _tmp2_; - gint _tmp2__length1; + GSettings* _tmp0_; + gchar** _tmp1_; + gchar** _tmp2_ = NULL; + gchar** _tmp3_; + gint _tmp3__length1; g_return_if_fail (self != NULL); - _tmp1_ = _tmp0_ = g_settings_get_strv (self->priv->settings, "blacklisted-media-players"); - _tmp2_ = _tmp1_; - _tmp2__length1 = _vala_array_length (_tmp0_); - g_signal_emit_by_name (self, "blacklist-updates", _tmp2_, _vala_array_length (_tmp0_)); - _tmp2_ = (_vala_array_free (_tmp2_, _tmp2__length1, (GDestroyNotify) g_free), NULL); + _tmp0_ = self->priv->settings; + _tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "blacklisted-media-players"); + _tmp3_ = _tmp2_; + _tmp3__length1 = _vala_array_length (_tmp1_); + g_signal_emit_by_name (self, "blacklist-updates", _tmp3_, _vala_array_length (_tmp1_)); + _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL); } @@ -260,7 +318,8 @@ static void g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure, GValue typedef void (*GMarshalFunc_VOID__BOXED_INT) (gpointer data1, gpointer arg_1, gint arg_2, gpointer data2); register GMarshalFunc_VOID__BOXED_INT callback; register GCClosure * cc; - register gpointer data1, data2; + register gpointer data1; + register gpointer data2; cc = (GCClosure *) closure; g_return_if_fail (n_param_values == 3); if (G_CCLOSURE_SWAP_DATA (closure)) { @@ -284,14 +343,16 @@ static GObject * settings_manager_constructor (GType type, guint n_construct_pro GObject * obj; GObjectClass * parent_class; SettingsManager * self; - GSettings* _tmp0_ = NULL; + GSettings* _tmp0_; + GSettings* _tmp1_; parent_class = G_OBJECT_CLASS (settings_manager_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = SETTINGS_MANAGER (obj); _tmp0_ = g_settings_new ("com.canonical.indicators.sound"); _g_object_unref0 (self->priv->settings); self->priv->settings = _tmp0_; - g_signal_connect_object (self->priv->settings, "changed::blacklisted-media-players", (GCallback) _settings_manager_on_blacklist_event_g_settings_changed, self, 0); + _tmp1_ = self->priv->settings; + g_signal_connect_object (_tmp1_, "changed::blacklisted-media-players", (GCallback) _settings_manager_on_blacklist_event_g_settings_changed, self, 0); return obj; } diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c index 8186fa3..165c3d5 100644 --- a/src/slider-menu-item.c +++ b/src/slider-menu-item.c @@ -113,7 +113,8 @@ handle_event (DbusmenuMenuitem * mi, */ slider_menu_item_update_volume (SLIDER_MENU_ITEM (mi), volume_input); - device_ensure_sink_is_unmuted (priv->a_sink); + if (volume_input > 0) + device_ensure_sink_is_unmuted (priv->a_sink); } diff --git a/src/specific-items-manager.c b/src/specific-items-manager.c index b01e8c1..f39e43d 100644 --- a/src/specific-items-manager.c +++ b/src/specific-items-manager.c @@ -1,4 +1,4 @@ -/* specific-items-manager.c generated by valac 0.12.1, the Vala compiler +/* specific-items-manager.c generated by valac 0.14.0, the Vala compiler * generated from specific-items-manager.vala, do not modify */ /* @@ -134,18 +134,19 @@ static void specific_items_manager_set_owner (SpecificItemsManager* self, Player static PlayerController* specific_items_manager_get_owner (SpecificItemsManager* self); const gchar* player_controller_get_dbus_name (PlayerController* self); static void specific_items_manager_on_root_changed (SpecificItemsManager* self, GObject* newroot); -static void _specific_items_manager_on_root_changed_dbusmenu_client_root_changed (DbusmenuClient* _sender, GObject* newroot, gpointer self); +static void _specific_items_manager_on_root_changed_dbusmenu_client_root_changed (DbusmenuClient* _sender, GObject* object, gpointer self); static gint specific_items_manager_figure_out_positioning (SpecificItemsManager* self); gint player_controller_get_menu_offset (PlayerController* self); +#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4 GeeArrayList* specific_items_manager_get_proxy_items (SpecificItemsManager* self); gint player_controller_track_specific_count (PlayerController* self); GType player_item_get_type (void) G_GNUC_CONST; GType mpris2_controller_get_type (void) G_GNUC_CONST; static gboolean _bool_equal (const gboolean* s1, const gboolean* s2); static void specific_items_manager_on_child_added (SpecificItemsManager* self, GObject* child, guint position); -static void _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added (DbusmenuMenuitem* _sender, GObject* child, guint position, gpointer self); +static void _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added (DbusmenuMenuitem* _sender, GObject* position, guint p0, gpointer self); static void specific_items_manager_on_child_removed (SpecificItemsManager* self, GObject* child); -static void _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed (DbusmenuMenuitem* _sender, GObject* child, gpointer self); +static void _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed (DbusmenuMenuitem* _sender, GObject* object, gpointer self); static void specific_items_manager_set_proxy_items (SpecificItemsManager* self, GeeArrayList* value); static GObject * specific_items_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void specific_items_manager_finalize (GObject* obj); @@ -165,29 +166,43 @@ GType specific_items_manager_category_get_type (void) { } -static void _specific_items_manager_on_root_changed_dbusmenu_client_root_changed (DbusmenuClient* _sender, GObject* newroot, gpointer self) { - specific_items_manager_on_root_changed (self, newroot); +static void _specific_items_manager_on_root_changed_dbusmenu_client_root_changed (DbusmenuClient* _sender, GObject* object, gpointer self) { + specific_items_manager_on_root_changed (self, object); } SpecificItemsManager* specific_items_manager_construct (GType object_type, PlayerController* controller, const gchar* path, SpecificItemsManagercategory which_type) { SpecificItemsManager * self = NULL; - gchar* _tmp0_; - const gchar* _tmp1_ = NULL; - DbusmenuClient* _tmp2_ = NULL; + SpecificItemsManagercategory _tmp0_; + PlayerController* _tmp1_; + const gchar* _tmp2_; + gchar* _tmp3_; + PlayerController* _tmp4_; + const gchar* _tmp5_; + const gchar* _tmp6_; + const gchar* _tmp7_; + DbusmenuClient* _tmp8_; + DbusmenuClient* _tmp9_; g_return_val_if_fail (controller != NULL, NULL); g_return_val_if_fail (path != NULL, NULL); self = (SpecificItemsManager*) g_object_new (object_type, NULL); - self->priv->of_type = (gint) which_type; - specific_items_manager_set_owner (self, controller); - _tmp0_ = g_strdup (path); + _tmp0_ = which_type; + self->priv->of_type = (gint) _tmp0_; + _tmp1_ = controller; + specific_items_manager_set_owner (self, _tmp1_); + _tmp2_ = path; + _tmp3_ = g_strdup (_tmp2_); _g_free0 (self->priv->dbus_path); - self->priv->dbus_path = _tmp0_; - _tmp1_ = player_controller_get_dbus_name (self->priv->_owner); - _tmp2_ = dbusmenu_client_new (_tmp1_, self->priv->dbus_path); + self->priv->dbus_path = _tmp3_; + _tmp4_ = self->priv->_owner; + _tmp5_ = player_controller_get_dbus_name (_tmp4_); + _tmp6_ = _tmp5_; + _tmp7_ = self->priv->dbus_path; + _tmp8_ = dbusmenu_client_new (_tmp6_, _tmp7_); _g_object_unref0 (self->priv->client); - self->priv->client = _tmp2_; - g_signal_connect_object (self->priv->client, "root-changed", (GCallback) _specific_items_manager_on_root_changed_dbusmenu_client_root_changed, self, 0); + self->priv->client = _tmp8_; + _tmp9_ = self->priv->client; + g_signal_connect_object (_tmp9_, "root-changed", (GCallback) _specific_items_manager_on_root_changed_dbusmenu_client_root_changed, self, 0); return self; } @@ -214,35 +229,71 @@ static gboolean _bool_equal (const gboolean* s1, const gboolean* s2) { static gint specific_items_manager_figure_out_positioning (SpecificItemsManager* self) { gint result = 0; gint _result_; + gint _tmp0_; + gint _tmp22_; + gint _tmp23_; g_return_val_if_fail (self != NULL, 0); _result_ = 0; - if (self->priv->of_type == SPECIFIC_ITEMS_MANAGER_CATEGORY_TRACK) { - gint _tmp0_; - gint _tmp1_; - _tmp0_ = player_controller_get_menu_offset (self->priv->_owner); - _tmp1_ = gee_collection_get_size ((GeeCollection*) self->priv->_proxy_items); - _result_ = (_tmp0_ + 4) + _tmp1_; + _tmp0_ = self->priv->of_type; + if (_tmp0_ == ((gint) SPECIFIC_ITEMS_MANAGER_CATEGORY_TRACK)) { + PlayerController* _tmp1_; + gint _tmp2_; + gint _tmp3_; + PlayerController* _tmp4_; + GeeArrayList* _tmp5_; + gint _tmp6_; + gint _tmp7_; + _tmp1_ = self->priv->_owner; + _tmp2_ = player_controller_get_menu_offset (_tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = self->priv->_owner; + _tmp5_ = self->priv->_proxy_items; + _tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_); + _tmp7_ = _tmp6_; + _result_ = (_tmp3_ + PLAYER_CONTROLLER_WIDGET_QUANTITY) + _tmp7_; } else { - if (self->priv->of_type == SPECIFIC_ITEMS_MANAGER_CATEGORY_PLAYER) { - gint _tmp2_; - gint _tmp3_; + gint _tmp8_; + _tmp8_ = self->priv->of_type; + if (_tmp8_ == ((gint) SPECIFIC_ITEMS_MANAGER_CATEGORY_PLAYER)) { + PlayerController* _tmp9_; + gint _tmp10_; + gint _tmp11_; + PlayerController* _tmp12_; + PlayerController* _tmp13_; + gint _tmp14_ = 0; gint pos; - gint _tmp4_ = 0; - gboolean _tmp5_; - _tmp2_ = player_controller_get_menu_offset (self->priv->_owner); - _tmp3_ = player_controller_track_specific_count (self->priv->_owner); - pos = (_tmp2_ + 4) + _tmp3_; - _tmp5_ = TRUE; - if (_bool_equal (self->priv->_owner->use_playlists, &_tmp5_) == TRUE) { - _tmp4_ = 1; + gint _tmp15_ = 0; + PlayerController* _tmp16_; + gboolean* _tmp17_; + gboolean _tmp18_; + gint _tmp19_; + gint _tmp20_; + gint _tmp21_; + _tmp9_ = self->priv->_owner; + _tmp10_ = player_controller_get_menu_offset (_tmp9_); + _tmp11_ = _tmp10_; + _tmp12_ = self->priv->_owner; + _tmp13_ = self->priv->_owner; + _tmp14_ = player_controller_track_specific_count (_tmp13_); + pos = (_tmp11_ + PLAYER_CONTROLLER_WIDGET_QUANTITY) + _tmp14_; + _tmp16_ = self->priv->_owner; + _tmp17_ = _tmp16_->use_playlists; + _tmp18_ = TRUE; + if (_bool_equal (_tmp17_, &_tmp18_) == TRUE) { + _tmp15_ = 1; } else { - _tmp4_ = 0; + _tmp15_ = 0; } - pos = pos + _tmp4_; - _result_ = pos; + _tmp19_ = pos; + _tmp20_ = _tmp15_; + pos = _tmp19_ + _tmp20_; + _tmp21_ = pos; + _result_ = _tmp21_; } } - g_debug ("specific-items-manager.vala:61: !!!!! Menu pos of type %i is = %i", self->priv->of_type, _result_); + _tmp22_ = self->priv->of_type; + _tmp23_ = _result_; + g_debug ("specific-items-manager.vala:63: !!!!! Menu pos of type %i is = %i", _tmp22_, _tmp23_); result = _result_; return result; } @@ -253,89 +304,147 @@ static gpointer _g_object_ref0 (gpointer self) { } -static void _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added (DbusmenuMenuitem* _sender, GObject* child, guint position, gpointer self) { - specific_items_manager_on_child_added (self, child, position); +static void _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added (DbusmenuMenuitem* _sender, GObject* position, guint p0, gpointer self) { + specific_items_manager_on_child_added (self, position, p0); } -static void _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed (DbusmenuMenuitem* _sender, GObject* child, gpointer self) { - specific_items_manager_on_child_removed (self, child); +static void _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed (DbusmenuMenuitem* _sender, GObject* object, gpointer self) { + specific_items_manager_on_child_removed (self, object); } static void specific_items_manager_on_root_changed (SpecificItemsManager* self, GObject* newroot) { - DbusmenuMenuitem* _tmp4_ = NULL; - DbusmenuMenuitem* _tmp5_; + GObject* _tmp0_; + DbusmenuClient* _tmp19_; + DbusmenuMenuitem* _tmp20_ = NULL; + DbusmenuMenuitem* _tmp21_; DbusmenuMenuitem* root; - GList* _tmp6_ = NULL; - GList* _tmp7_ = NULL; + DbusmenuMenuitem* _tmp22_; + DbusmenuMenuitem* _tmp23_; + DbusmenuMenuitem* _tmp24_; + GList* _tmp25_ = NULL; + GList* _tmp26_ = NULL; GList* children; + GList* _tmp27_; g_return_if_fail (self != NULL); - if (newroot == NULL) { - gint _tmp3_; - g_debug ("specific-items-manager.vala:68: root disappeared -remove proxyitems"); + _tmp0_ = newroot; + if (_tmp0_ == NULL) { + GeeArrayList* _tmp15_; + GeeArrayList* _tmp16_; + gint _tmp17_; + gint _tmp18_; + g_debug ("specific-items-manager.vala:70: root disappeared -remove proxyitems"); { - GeeArrayList* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* _tmp2_; GeeArrayList* _p_list; - gint _tmp1_; + GeeArrayList* _tmp3_; + gint _tmp4_; + gint _tmp5_; gint _p_size; gint _p_index; - _tmp0_ = _g_object_ref0 (self->priv->_proxy_items); - _p_list = _tmp0_; - _tmp1_ = gee_collection_get_size ((GeeCollection*) _p_list); - _p_size = _tmp1_; + _tmp1_ = self->priv->_proxy_items; + _tmp2_ = _g_object_ref0 (_tmp1_); + _p_list = _tmp2_; + _tmp3_ = _p_list; + _tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + _p_size = _tmp5_; _p_index = -1; while (TRUE) { - gpointer _tmp2_ = NULL; + gint _tmp6_; + gint _tmp7_; + gint _tmp8_; + GeeArrayList* _tmp9_; + gint _tmp10_; + gpointer _tmp11_ = NULL; DbusmenuMenuitemProxy* p; - _p_index = _p_index + 1; - if (!(_p_index < _p_size)) { + PlayerController* _tmp12_; + DbusmenuMenuitem* _tmp13_; + DbusmenuMenuitemProxy* _tmp14_; + _tmp6_ = _p_index; + _p_index = _tmp6_ + 1; + _tmp7_ = _p_index; + _tmp8_ = _p_size; + if (!(_tmp7_ < _tmp8_)) { break; } - _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) _p_list, _p_index); - p = (DbusmenuMenuitemProxy*) _tmp2_; - dbusmenu_menuitem_child_delete (self->priv->_owner->root_menu, (DbusmenuMenuitem*) p); + _tmp9_ = _p_list; + _tmp10_ = _p_index; + _tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _tmp10_); + p = (DbusmenuMenuitemProxy*) _tmp11_; + _tmp12_ = self->priv->_owner; + _tmp13_ = _tmp12_->root_menu; + _tmp14_ = p; + dbusmenu_menuitem_child_delete (_tmp13_, (DbusmenuMenuitem*) _tmp14_); _g_object_unref0 (p); } _g_object_unref0 (_p_list); } - gee_abstract_collection_clear ((GeeAbstractCollection*) self->priv->_proxy_items); - _tmp3_ = gee_collection_get_size ((GeeCollection*) self->priv->_proxy_items); - g_debug ("specific-items-manager.vala:73: array list size is now %i", _tmp3_); + _tmp15_ = self->priv->_proxy_items; + gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp15_); + _tmp16_ = self->priv->_proxy_items; + _tmp17_ = gee_collection_get_size ((GeeCollection*) _tmp16_); + _tmp18_ = _tmp17_; + g_debug ("specific-items-manager.vala:75: array list size is now %i", _tmp18_); return; } - _tmp4_ = dbusmenu_client_get_root (self->priv->client); - _tmp5_ = _g_object_ref0 (_tmp4_); - root = _tmp5_; - g_signal_connect_object (root, "child-added", (GCallback) _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added, self, 0); - g_signal_connect_object (root, "child-removed", (GCallback) _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed, self, 0); - _tmp6_ = dbusmenu_menuitem_get_children (root); - _tmp7_ = g_list_copy (_tmp6_); - children = _tmp7_; + _tmp19_ = self->priv->client; + _tmp20_ = dbusmenu_client_get_root (_tmp19_); + _tmp21_ = _g_object_ref0 (_tmp20_); + root = _tmp21_; + _tmp22_ = root; + g_signal_connect_object (_tmp22_, "child-added", (GCallback) _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added, self, 0); + _tmp23_ = root; + g_signal_connect_object (_tmp23_, "child-removed", (GCallback) _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed, self, 0); + _tmp24_ = root; + _tmp25_ = dbusmenu_menuitem_get_children (_tmp24_); + _tmp26_ = g_list_copy (_tmp25_); + children = _tmp26_; + _tmp27_ = children; { - GList* child_collection; - GList* child_it; - child_collection = children; + GList* child_collection = NULL; + GList* child_it = NULL; + child_collection = _tmp27_; for (child_it = child_collection; child_it != NULL; child_it = child_it->next) { - void* child; + void* child = NULL; child = child_it->data; { - gint _tmp8_; + gint _tmp28_ = 0; gint pos; + void* _tmp29_; DbusmenuMenuitem* item; - DbusmenuMenuitemProxy* _tmp9_ = NULL; + DbusmenuMenuitem* _tmp30_; + DbusmenuMenuitemProxy* _tmp31_; DbusmenuMenuitemProxy* proxy; - const gchar* _tmp10_ = NULL; - _tmp8_ = specific_items_manager_figure_out_positioning (self); - pos = _tmp8_; - item = DBUSMENU_MENUITEM (child); - _tmp9_ = dbusmenu_menuitem_proxy_new (item); - proxy = _tmp9_; - gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->_proxy_items, proxy); - _tmp10_ = dbusmenu_menuitem_property_get (item, DBUSMENU_MENUITEM_PROP_LABEL); - g_debug ("specific-items-manager.vala:90: Proxy item of label = %s added to coll" \ -"ection", _tmp10_); - dbusmenu_menuitem_child_add_position (self->priv->_owner->root_menu, (DbusmenuMenuitem*) proxy, (guint) pos); + GeeArrayList* _tmp32_; + DbusmenuMenuitemProxy* _tmp33_; + DbusmenuMenuitem* _tmp34_; + const gchar* _tmp35_ = NULL; + PlayerController* _tmp36_; + DbusmenuMenuitem* _tmp37_; + DbusmenuMenuitemProxy* _tmp38_; + gint _tmp39_; + _tmp28_ = specific_items_manager_figure_out_positioning (self); + pos = _tmp28_; + _tmp29_ = child; + item = DBUSMENU_MENUITEM (_tmp29_); + _tmp30_ = item; + _tmp31_ = dbusmenu_menuitem_proxy_new (_tmp30_); + proxy = _tmp31_; + _tmp32_ = self->priv->_proxy_items; + _tmp33_ = proxy; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp32_, _tmp33_); + _tmp34_ = item; + _tmp35_ = dbusmenu_menuitem_property_get (_tmp34_, DBUSMENU_MENUITEM_PROP_LABEL); + g_debug ("specific-items-manager.vala:92: Proxy item of label = %s added to coll" \ +"ection", _tmp35_); + _tmp36_ = self->priv->_owner; + _tmp37_ = _tmp36_->root_menu; + _tmp38_ = proxy; + _tmp39_ = pos; + dbusmenu_menuitem_child_add_position (_tmp37_, (DbusmenuMenuitem*) _tmp38_, (guint) _tmp39_); _g_object_unref0 (proxy); } } @@ -348,48 +457,56 @@ static void specific_items_manager_on_root_changed (SpecificItemsManager* self, static void specific_items_manager_on_child_added (SpecificItemsManager* self, GObject* child, guint position) { g_return_if_fail (self != NULL); g_return_if_fail (child != NULL); - g_debug ("specific-items-manager.vala:99: On child added Specific root node"); + g_debug ("specific-items-manager.vala:101: On child added Specific root node"); } static void specific_items_manager_on_child_removed (SpecificItemsManager* self, GObject* child) { g_return_if_fail (self != NULL); g_return_if_fail (child != NULL); - g_debug ("specific-items-manager.vala:104: On child removed Specific root node"); + g_debug ("specific-items-manager.vala:106: On child removed Specific root node"); } static PlayerController* specific_items_manager_get_owner (SpecificItemsManager* self) { PlayerController* result; + PlayerController* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_owner; + _tmp0_ = self->priv->_owner; + result = _tmp0_; return result; } static void specific_items_manager_set_owner (SpecificItemsManager* self, PlayerController* value) { PlayerController* _tmp0_; + PlayerController* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = _g_object_ref0 (value); + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_owner); - self->priv->_owner = _tmp0_; + self->priv->_owner = _tmp1_; } GeeArrayList* specific_items_manager_get_proxy_items (SpecificItemsManager* self) { GeeArrayList* result; + GeeArrayList* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_proxy_items; + _tmp0_ = self->priv->_proxy_items; + result = _tmp0_; return result; } static void specific_items_manager_set_proxy_items (SpecificItemsManager* self, GeeArrayList* value) { GeeArrayList* _tmp0_; + GeeArrayList* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = _g_object_ref0 (value); + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_proxy_items); - self->priv->_proxy_items = _tmp0_; + self->priv->_proxy_items = _tmp1_; g_object_notify ((GObject *) self, "proxy-items"); } @@ -398,12 +515,12 @@ static GObject * specific_items_manager_constructor (GType type, guint n_constru GObject * obj; GObjectClass * parent_class; SpecificItemsManager * self; - GeeArrayList* _tmp0_ = NULL; + GeeArrayList* _tmp0_; GeeArrayList* _tmp1_; parent_class = G_OBJECT_CLASS (specific_items_manager_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = SPECIFIC_ITEMS_MANAGER (obj); - _tmp0_ = gee_array_list_new (DBUSMENU_TYPE_MENUITEM_PROXY, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); + _tmp0_ = gee_array_list_new (dbusmenu_menuitem_proxy_get_type (), (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); _tmp1_ = _tmp0_; specific_items_manager_set_proxy_items (self, _tmp1_); _g_object_unref0 (_tmp1_); diff --git a/src/specific-items-manager.vala b/src/specific-items-manager.vala index d26199f..923cf3f 100644 --- a/src/specific-items-manager.vala +++ b/src/specific-items-manager.vala @@ -22,7 +22,7 @@ using Gee; public class SpecificItemsManager : GLib.Object { - public static enum category{ + public enum category{ TRACK, PLAYER } @@ -51,10 +51,12 @@ public class SpecificItemsManager : GLib.Object { int result = 0 ; if (this.of_type == category.TRACK){ - result = this.owner.menu_offset + 4 + this.proxy_items.size; + result = this.owner.menu_offset + this.owner.WIDGET_QUANTITY + this.proxy_items.size; } else if (this.of_type == category.PLAYER){ - int pos = this.owner.menu_offset + 4 + this.owner.track_specific_count(); + int pos = this.owner.menu_offset + this.owner.WIDGET_QUANTITY + this.owner.track_specific_count(); + //Surely the playlists item is there whether its visible or not ? + //TODO test playlists and player specific item positioning. pos += this.owner.use_playlists == true ? 1 : 0; result = pos; } diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c index 746efa7..e9ffed9 100644 --- a/src/transport-menu-item.c +++ b/src/transport-menu-item.c @@ -1,4 +1,4 @@ -/* transport-menu-item.c generated by valac 0.12.1, the Vala compiler +/* transport-menu-item.c generated by valac 0.14.0, the Vala compiler * generated from transport-menu-item.vala, do not modify */ /* @@ -157,8 +157,10 @@ static void _vala_transport_menuitem_get_property (GObject * object, guint prope TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent) { TransportMenuitem * self = NULL; + PlayerController* _tmp0_; g_return_val_if_fail (parent != NULL, NULL); - self = (TransportMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_TRANSPORT_MENUITEM_TYPE, "owner", parent, NULL); + _tmp0_ = parent; + self = (TransportMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_TRANSPORT_MENUITEM_TYPE, "owner", _tmp0_, NULL); return self; } @@ -180,8 +182,10 @@ static gboolean _transport_menuitem_send_cached_action_gsource_func (gpointer se void transport_menuitem_handle_cached_action (TransportMenuitem* self) { + TransportAction _tmp0_; g_return_if_fail (self != NULL); - if (self->priv->cached_action != TRANSPORT_ACTION_NO_ACTION) { + _tmp0_ = self->priv->cached_action; + if (_tmp0_ != TRANSPORT_ACTION_NO_ACTION) { g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 1, _transport_menuitem_send_cached_action_gsource_func, g_object_ref (self), g_object_unref); } } @@ -189,10 +193,16 @@ void transport_menuitem_handle_cached_action (TransportMenuitem* self) { static gboolean transport_menuitem_send_cached_action (TransportMenuitem* self) { gboolean result = FALSE; - PlayerController* _tmp0_ = NULL; + PlayerController* _tmp0_; + PlayerController* _tmp1_; + Mpris2Controller* _tmp2_; + TransportAction _tmp3_; g_return_val_if_fail (self != NULL, FALSE); _tmp0_ = player_item_get_owner ((PlayerItem*) self); - mpris2_controller_transport_update (_tmp0_->mpris_bridge, self->priv->cached_action); + _tmp1_ = _tmp0_; + _tmp2_ = _tmp1_->mpris_bridge; + _tmp3_ = self->priv->cached_action; + mpris2_controller_transport_update (_tmp2_, _tmp3_); self->priv->cached_action = TRANSPORT_ACTION_NO_ACTION; result = FALSE; return result; @@ -200,9 +210,11 @@ static gboolean transport_menuitem_send_cached_action (TransportMenuitem* self) void transport_menuitem_change_play_state (TransportMenuitem* self, TransportState update) { + TransportState _tmp0_; gint temp; g_return_if_fail (self != NULL); - temp = (gint) update; + _tmp0_ = update; + temp = (gint) _tmp0_; dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, temp); } @@ -215,35 +227,57 @@ static gpointer _g_variant_ref0 (gpointer self) { static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const gchar* name, GVariant* input_value, guint timestamp) { TransportMenuitem * self; GVariant* _tmp0_; + GVariant* _tmp1_; GVariant* v; - gboolean _tmp1_; - gint32 _tmp3_; + GVariant* _tmp2_; + const GVariantType* _tmp3_; + gboolean _tmp4_ = FALSE; + GVariant* _tmp7_; + gint32 _tmp8_ = 0; gint32 input; - gboolean _tmp4_; + gboolean _tmp9_; + gboolean _tmp10_; self = (TransportMenuitem*) base; g_return_if_fail (name != NULL); g_return_if_fail (input_value != NULL); - _tmp0_ = _g_variant_ref0 (input_value); - v = _tmp0_; - _tmp1_ = g_variant_is_of_type (input_value, G_VARIANT_TYPE_VARIANT); - if (_tmp1_) { - GVariant* _tmp2_ = NULL; - _tmp2_ = g_variant_get_variant (input_value); + _tmp0_ = input_value; + _tmp1_ = _g_variant_ref0 (_tmp0_); + v = _tmp1_; + _tmp2_ = input_value; + _tmp3_ = G_VARIANT_TYPE_VARIANT; + _tmp4_ = g_variant_is_of_type (_tmp2_, _tmp3_); + if (_tmp4_) { + GVariant* _tmp5_; + GVariant* _tmp6_ = NULL; + _tmp5_ = input_value; + _tmp6_ = g_variant_get_variant (_tmp5_); _g_variant_unref0 (v); - v = _tmp2_; + v = _tmp6_; } - _tmp3_ = g_variant_get_int32 (v); - input = _tmp3_; - _tmp4_ = transport_menuitem_get_running (self); - if (_tmp4_ == TRUE) { - PlayerController* _tmp5_ = NULL; - _tmp5_ = player_item_get_owner ((PlayerItem*) self); - mpris2_controller_transport_update (_tmp5_->mpris_bridge, (TransportAction) input); + _tmp7_ = v; + _tmp8_ = g_variant_get_int32 (_tmp7_); + input = _tmp8_; + _tmp9_ = transport_menuitem_get_running (self); + _tmp10_ = _tmp9_; + if (_tmp10_ == TRUE) { + PlayerController* _tmp11_; + PlayerController* _tmp12_; + Mpris2Controller* _tmp13_; + gint32 _tmp14_; + _tmp11_ = player_item_get_owner ((PlayerItem*) self); + _tmp12_ = _tmp11_; + _tmp13_ = _tmp12_->mpris_bridge; + _tmp14_ = input; + mpris2_controller_transport_update (_tmp13_, (TransportAction) _tmp14_); } else { - PlayerController* _tmp6_ = NULL; - self->priv->cached_action = (TransportAction) input; - _tmp6_ = player_item_get_owner ((PlayerItem*) self); - player_controller_instantiate (_tmp6_); + gint32 _tmp15_; + PlayerController* _tmp16_; + PlayerController* _tmp17_; + _tmp15_ = input; + self->priv->cached_action = (TransportAction) _tmp15_; + _tmp16_ = player_item_get_owner ((PlayerItem*) self); + _tmp17_ = _tmp16_; + player_controller_instantiate (_tmp17_); dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, (gint) TRANSPORT_STATE_LAUNCHING); } _g_variant_unref0 (v); @@ -252,7 +286,7 @@ static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const GeeHashSet* transport_menuitem_attributes_format (void) { GeeHashSet* result = NULL; - GeeHashSet* _tmp0_ = NULL; + GeeHashSet* _tmp0_; GeeHashSet* attrs; _tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL); attrs = _tmp0_; @@ -264,10 +298,14 @@ GeeHashSet* transport_menuitem_attributes_format (void) { static gboolean transport_menuitem_get_running (TransportMenuitem* self) { gboolean result; - PlayerController* _tmp0_ = NULL; + PlayerController* _tmp0_; + PlayerController* _tmp1_; + gint _tmp2_; g_return_val_if_fail (self != NULL, FALSE); _tmp0_ = player_item_get_owner ((PlayerItem*) self); - result = _tmp0_->current_state == PLAYER_CONTROLLER_STATE_CONNECTED; + _tmp1_ = _tmp0_; + _tmp2_ = _tmp1_->current_state; + result = _tmp2_ == ((gint) PLAYER_CONTROLLER_STATE_CONNECTED); return result; } diff --git a/src/transport-widget.c b/src/transport-widget.c index 22e3b2a..c535e00 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -181,10 +181,10 @@ transport_widget_init (TransportWidget *self) /* create widget path */ spinner_widget_path = gtk_widget_path_new(); - gtk_widget_path_iter_set_name (spinner_widget_path, -1 , "IndicatorSound"); gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_MENU); gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_MENU_ITEM); - gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_SPINNER); + gint pos = gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_SPINNER); + gtk_widget_path_iter_set_name (spinner_widget_path, pos, "IndicatorSoundSpinner"); /* create style context and append path */ spinner_style_context = gtk_style_context_new(); @@ -1800,8 +1800,8 @@ draw (GtkWidget* button, cairo_t *cr) #if GTK_CHECK_VERSION(3, 0, 0) else if(priv->current_state == TRANSPORT_STATE_LAUNCHING) { - - gtk_render_activity (spinner_style_context, cr, 106, 6 , 30, 30); + // the spinner is not aligned, why? because the play button has odd width/height numbers + gtk_render_activity (spinner_style_context, cr, 106, 6, 30, 30); } #endif return FALSE; |