aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac6
-rw-r--r--src/indicator-sound.c29
-rw-r--r--src/metadata-menu-item.c2
-rw-r--r--src/mpris2-controller.c7
-rw-r--r--src/mpris2-controller.vala6
-rw-r--r--src/music-player-bridge.c2
-rw-r--r--src/music-player-bridge.h4
-rw-r--r--src/player-controller.c2
-rw-r--r--src/player-item.c2
-rw-r--r--src/playlists-menu-item.c77
-rw-r--r--src/playlists-menu-item.vala33
-rw-r--r--src/pulseaudio-mgr.c74
-rw-r--r--src/sound-service-dbus.c2
-rw-r--r--src/title-menu-item.c2
-rw-r--r--src/title-widget.c14
-rw-r--r--src/transport-menu-item.c2
17 files changed, 200 insertions, 84 deletions
diff --git a/configure b/configure
index eec8227..283289a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for indicator-sound 0.6.1.
+# Generated by GNU Autoconf 2.67 for indicator-sound 0.6.2.
#
# Report bugs to <conor.curran@canonical.com>.
#
@@ -761,8 +761,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='indicator-sound'
PACKAGE_TARNAME='indicator-sound'
-PACKAGE_VERSION='0.6.1'
-PACKAGE_STRING='indicator-sound 0.6.1'
+PACKAGE_VERSION='0.6.2'
+PACKAGE_STRING='indicator-sound 0.6.2'
PACKAGE_BUGREPORT='conor.curran@canonical.com'
PACKAGE_URL=''
@@ -1564,7 +1564,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures indicator-sound 0.6.1 to adapt to many kinds of systems.
+\`configure' configures indicator-sound 0.6.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1634,7 +1634,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of indicator-sound 0.6.1:";;
+ short | recursive ) echo "Configuration of indicator-sound 0.6.2:";;
esac
cat <<\_ACEOF
@@ -1767,7 +1767,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-indicator-sound configure 0.6.1
+indicator-sound configure 0.6.2
generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2136,7 +2136,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by indicator-sound $as_me 0.6.1, which was
+It was created by indicator-sound $as_me 0.6.2, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
@@ -2956,7 +2956,7 @@ fi
# Define the identity of the package.
PACKAGE=indicator-sound
- VERSION=0.6.1
+ VERSION=0.6.2
cat >>confdefs.h <<_ACEOF
@@ -14349,7 +14349,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by indicator-sound $as_me 0.6.1, which was
+This file was extended by indicator-sound $as_me 0.6.2, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14415,7 +14415,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-indicator-sound config.status 0.6.1
+indicator-sound config.status 0.6.2
configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 064a581..4446e2b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
-AC_INIT(indicator-sound, 0.6.1, conor.curran@canonical.com)
+AC_INIT(indicator-sound, 0.6.2, conor.curran@canonical.com)
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-sound, 0.6.1)
+AM_INIT_AUTOMAKE(indicator-sound, 0.6.2)
AM_MAINTAINER_MODE
@@ -25,7 +25,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
###########################
# Dependencies
-###########################
+###########################
GTK_REQUIRED_VERSION=2.12
INDICATOR_REQUIRED_VERSION=0.3.19
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index 4980ab8..6e1acc9 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -443,28 +443,15 @@ new_voip_slider_widget (DbusmenuMenuitem * newitem,
{
g_debug("indicator-sound: new_voip_slider_widget");
GtkWidget* voip_widget = NULL;
- //IndicatorObject *io = NULL;
g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE);
g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE);
voip_widget = voip_input_widget_new (newitem);
-/*
- / io = g_object_get_data (G_OBJECT (client), "indicator");
-*/
- //IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io));
- //priv->volume_widget = volume_widget;
GtkWidget* ido_slider_widget = voip_input_widget_get_ido_slider(VOIP_INPUT_WIDGET(voip_widget));
gtk_widget_show_all(ido_slider_widget);
- // register the style callback on this widget with state manager's style change
- // handler (needs to remake the blocking animation for each style).
-/*
- g_signal_connect (ido_slider_widget, "style-set",
- G_CALLBACK(sound_state_manager_style_changed_cb),
- priv->state_manager);
-*/
GtkMenuItem *menu_volume_item = GTK_MENU_ITEM(ido_slider_widget);
dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client),
@@ -509,23 +496,11 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data)
switch (event->keyval) {
case GDK_Right:
digested = TRUE;
-/*
- if (event->state & GDK_CONTROL_MASK) {
- new_value = 100;
- } else {
-*/
- new_value = current_value + five_percent;
- //}
+ new_value = current_value + five_percent;
break;
case GDK_Left:
digested = TRUE;
-/*
- if (event->state & GDK_CONTROL_MASK) {
- new_value = 0;
- } else {
-*/
- new_value = current_value - five_percent;
- //}
+ new_value = current_value - five_percent;
break;
case GDK_plus:
digested = TRUE;
diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c
index aa93700..08231ca 100644
--- a/src/metadata-menu-item.c
+++ b/src/metadata-menu-item.c
@@ -24,9 +24,11 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib-object.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/dbusmenu-glib.h>
+#include <libdbusmenu-glib/enum-types.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/types.h>
#include <stdlib.h>
#include <string.h>
#include <common-defs.h>
diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c
index aabbfb7..4b8e59f 100644
--- a/src/mpris2-controller.c
+++ b/src/mpris2-controller.c
@@ -28,9 +28,11 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <gee.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/dbusmenu-glib.h>
+#include <libdbusmenu-glib/enum-types.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/types.h>
#define TYPE_MPRIS2_CONTROLLER (mpris2_controller_get_type ())
@@ -384,7 +386,7 @@ static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array
void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1);
static gboolean* _bool_dup (gboolean* self);
void mpris_playlists_get_ActivePlaylist (MprisPlaylists* self, ActivePlaylistContainer* result);
-void playlists_menuitem_update_active_playlist (PlaylistsMenuitem* self, PlaylistDetails* detail);
+void playlists_menuitem_active_playlist_update (PlaylistsMenuitem* self, PlaylistDetails* detail);
void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path);
void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_);
void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error);
@@ -985,6 +987,7 @@ static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlayl
return FALSE;
}
if (data->current_playlists != NULL) {
+ g_debug ("mpris2-controller.vala:225: Size of the playlist array = %i", data->current_playlists_length1);
data->_tmp4_ = NULL;
data->_tmp4_ = gee_abstract_list_get ((GeeAbstractList*) data->self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
data->playlists_item = (data->_tmp5_ = (PlayerItem*) data->_tmp4_, IS_PLAYLISTS_MENUITEM (data->_tmp5_) ? ((PlaylistsMenuitem*) data->_tmp5_) : NULL);
@@ -1029,7 +1032,7 @@ static gboolean mpris2_controller_fetch_active_playlist (Mpris2Controller* self)
playlists_item = (_tmp4_ = (PlayerItem*) _tmp3_, IS_PLAYLISTS_MENUITEM (_tmp4_) ? ((PlaylistsMenuitem*) _tmp4_) : NULL);
mpris_playlists_get_ActivePlaylist (self->priv->_playlists, &_tmp5_);
_tmp6_ = _tmp5_;
- playlists_menuitem_update_active_playlist (playlists_item, &_tmp6_.details);
+ playlists_menuitem_active_playlist_update (playlists_item, &_tmp6_.details);
active_playlist_container_destroy (&_tmp6_);
result = FALSE;
_g_object_unref0 (playlists_item);
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index bf930fc..c7305f4 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -222,7 +222,7 @@ public class Mpris2Controller : GLib.Object
}
if( current_playlists != null ){
- //debug( "Size of the playlist array = %i", current_playlists.length );
+ debug( "Size of the playlist array = %i", current_playlists.length );
PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
playlists_item.update(current_playlists);
}
@@ -238,7 +238,7 @@ public class Mpris2Controller : GLib.Object
debug(" We don't have an active playlist");
}
PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
- playlists_item.update_active_playlist ( this.playlists.ActivePlaylist.details );
+ playlists_item.active_playlist_update ( this.playlists.ActivePlaylist.details );
return false;
}
@@ -251,4 +251,4 @@ public class Mpris2Controller : GLib.Object
debug("Could not activate playlist %s because %s", (string)path, e.message);
}
}
-} \ No newline at end of file
+}
diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c
index 0e5585c..dc04230 100644
--- a/src/music-player-bridge.c
+++ b/src/music-player-bridge.c
@@ -24,9 +24,11 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib-object.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/dbusmenu-glib.h>
+#include <libdbusmenu-glib/enum-types.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/types.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h
index dd0f816..075d169 100644
--- a/src/music-player-bridge.h
+++ b/src/music-player-bridge.h
@@ -10,9 +10,11 @@
#include <string.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/dbusmenu-glib.h>
+#include <libdbusmenu-glib/enum-types.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/types.h>
#include <gee.h>
#include <gio/gio.h>
@@ -570,7 +572,7 @@ PlaylistsMenuitem* playlists_menuitem_new (PlayerController* parent);
PlaylistsMenuitem* playlists_menuitem_construct (GType object_type, PlayerController* parent);
void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1);
void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, PlaylistDetails* new_detail);
-void playlists_menuitem_update_active_playlist (PlaylistsMenuitem* self, PlaylistDetails* detail);
+void playlists_menuitem_active_playlist_update (PlaylistsMenuitem* self, PlaylistDetails* detail);
GeeHashSet* playlists_menuitem_attributes_format (void);
GType free_desktop_object_proxy_get_type (void) G_GNUC_CONST;
guint free_desktop_object_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
diff --git a/src/player-controller.c b/src/player-controller.c
index 9b1e7bb..f0d5d60 100644
--- a/src/player-controller.c
+++ b/src/player-controller.c
@@ -26,9 +26,11 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <gee.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/dbusmenu-glib.h>
+#include <libdbusmenu-glib/enum-types.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/types.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
diff --git a/src/player-item.c b/src/player-item.c
index c9f0e74..01286a7 100644
--- a/src/player-item.c
+++ b/src/player-item.c
@@ -24,9 +24,11 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib-object.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/dbusmenu-glib.h>
+#include <libdbusmenu-glib/enum-types.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/types.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
diff --git a/src/playlists-menu-item.c b/src/playlists-menu-item.c
index a465a8d..d5d6888 100644
--- a/src/playlists-menu-item.c
+++ b/src/playlists-menu-item.c
@@ -24,9 +24,11 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib-object.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/dbusmenu-glib.h>
+#include <libdbusmenu-glib/enum-types.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/types.h>
#include <gee.h>
#include <common-defs.h>
#include <stdlib.h>
@@ -155,7 +157,7 @@ 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);
void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, PlaylistDetails* new_detail);
-void playlists_menuitem_update_active_playlist (PlaylistsMenuitem* self, PlaylistDetails* detail);
+void playlists_menuitem_active_playlist_update (PlaylistsMenuitem* self, PlaylistDetails* detail);
PlayerController* player_item_get_owner (PlayerItem* self);
GType mpris2_controller_get_type (void) G_GNUC_CONST;
void mpris2_controller_activate_playlist (Mpris2Controller* self, const char* path);
@@ -252,10 +254,71 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli
}
}
}
+ {
+ GeeCollection* _tmp5_ = NULL;
+ GeeCollection* _tmp6_;
+ GeeIterator* _tmp7_ = NULL;
+ GeeIterator* _tmp8_;
+ GeeIterator* _item_it;
+ _tmp5_ = gee_map_get_values ((GeeMap*) self->priv->current_playlists);
+ _tmp6_ = _tmp5_;
+ _tmp7_ = gee_iterable_iterator ((GeeIterable*) _tmp6_);
+ _item_it = (_tmp8_ = _tmp7_, _g_object_unref0 (_tmp6_), _tmp8_);
+ while (TRUE) {
+ gboolean _tmp9_;
+ gpointer _tmp10_ = NULL;
+ DbusmenuMenuitem* item;
+ gboolean within;
+ _tmp9_ = gee_iterator_next (_item_it);
+ if (!_tmp9_) {
+ break;
+ }
+ _tmp10_ = gee_iterator_get (_item_it);
+ item = (DbusmenuMenuitem*) _tmp10_;
+ within = FALSE;
+ {
+ 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 _tmp11_;
+ PlaylistDetails _tmp12_ = {0};
+ PlaylistDetails detail;
+ _tmp11_ = (playlist_details_copy (&detail_collection[detail_it], &_tmp12_), _tmp12_);
+ detail = _tmp11_;
+ {
+ const gchar* _tmp13_ = NULL;
+ _tmp13_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ if (g_strcmp0 (detail.path, _tmp13_) == 0) {
+ within = TRUE;
+ playlist_details_destroy (&detail);
+ break;
+ }
+ playlist_details_destroy (&detail);
+ }
+ }
+ }
+ if (within == FALSE) {
+ const gchar* _tmp14_ = NULL;
+ const gchar* _tmp15_ = NULL;
+ _tmp14_ = dbusmenu_menuitem_property_get (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ _tmp15_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ if (g_strcmp0 (_tmp14_, _tmp15_) == 0) {
+ dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, "Choose Playlist");
+ }
+ dbusmenu_menuitem_child_delete (self->root_item, item);
+ }
+ _g_object_unref0 (item);
+ }
+ _g_object_unref0 (_item_it);
+ }
}
void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, PlaylistDetails* new_detail) {
+ const gchar* _tmp7_ = NULL;
g_return_if_fail (self != NULL);
{
GeeCollection* _tmp0_ = NULL;
@@ -287,6 +350,10 @@ void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, Pla
}
_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);
+ }
}
@@ -336,7 +403,7 @@ static gboolean playlists_menuitem_already_observed (PlaylistsMenuitem* self, Pl
}
-void playlists_menuitem_update_active_playlist (PlaylistsMenuitem* self, PlaylistDetails* detail) {
+void playlists_menuitem_active_playlist_update (PlaylistsMenuitem* self, PlaylistDetails* detail) {
gchar* _tmp0_;
gchar* update;
g_return_if_fail (self != NULL);
@@ -351,6 +418,7 @@ void playlists_menuitem_update_active_playlist (PlaylistsMenuitem* self, Playlis
update = _tmp2_;
}
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);
_g_free0 (update);
}
@@ -364,8 +432,8 @@ static void playlists_menuitem_submenu_item_activated (PlaylistsMenuitem* self,
g_return_if_fail (self != NULL);
_tmp0_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->current_playlists, GINT_TO_POINTER (menu_item_id));
if (!_tmp0_) {
- g_warning ("playlists-menu-item.vala:89: item %i was activated but we don't have a" \
-" corresponding playlist", menu_item_id);
+ g_warning ("playlists-menu-item.vala:114: item %i was activated but we don't have " \
+"a corresponding playlist", menu_item_id);
return;
}
_tmp1_ = player_item_get_owner ((PlayerItem*) self);
@@ -410,6 +478,7 @@ static GObject * playlists_menuitem_constructor (GType type, guint n_construct_p
_g_object_unref0 (self->root_item);
self->root_item = _tmp3_;
dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, "Choose Playlist");
+ dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH, "");
return obj;
}
diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala
index 8a2ccac..f4d7233 100644
--- a/src/playlists-menu-item.vala
+++ b/src/playlists-menu-item.vala
@@ -34,7 +34,9 @@ public class PlaylistsMenuitem : PlayerItem
construct{
this.current_playlists = new HashMap<int, Dbusmenu.Menuitem>();
this.root_item = new Menuitem();
+
this.root_item.property_set ( MENUITEM_PROP_LABEL, "Choose Playlist" );
+ this.root_item.property_set ( MENUITEM_PATH, "" );
}
public new void update (PlaylistDetails[] playlists)
@@ -51,10 +53,28 @@ public class PlaylistsMenuitem : PlayerItem
menuitem.property_set_bool (MENUITEM_PROP_ENABLED, true);
menuitem.item_activated.connect(() => {
- submenu_item_activated (menuitem.id );});
- this.current_playlists.set( menuitem.id, menuitem );
+ submenu_item_activated (menuitem.id );
+ }
+ );
+ this.current_playlists.set( menuitem.id, menuitem );
this.root_item.child_append( menuitem );
}
+ // Finally remove any that might have been deleted
+ foreach (Dbusmenu.Menuitem item in this.current_playlists.values) {
+ bool within = false;
+ foreach (PlaylistDetails detail in playlists){
+ if (detail.path == item.property_get (MENUITEM_PATH)) {
+ within = true;
+ break;
+ }
+ }
+ if (within == false){
+ if (this.root_item.property_get (MENUITEM_PATH) == item.property_get (MENUITEM_PATH)){
+ this.root_item.property_set (MENUITEM_PROP_LABEL, "Choose Playlist");
+ }
+ this.root_item.child_delete (item);
+ }
+ }
}
public void update_individual_playlist (PlaylistDetails new_detail)
@@ -65,6 +85,10 @@ public class PlaylistsMenuitem : PlayerItem
item.property_set (MENUITEM_PROP_ICON_NAME, new_detail.icon_path);
}
}
+ // If its active make sure the name is updated on the root item.
+ if (this.root_item.property_get (MENUITEM_PATH) == new_detail.path) {
+ this.root_item.property_set (MENUITEM_PROP_LABEL, new_detail.name);
+ }
}
private bool already_observed (PlaylistDetails new_detail)
@@ -76,11 +100,12 @@ public class PlaylistsMenuitem : PlayerItem
return false;
}
- public void update_active_playlist(PlaylistDetails detail)
+ public void active_playlist_update (PlaylistDetails detail)
{
var update = detail.name;
if ( update == "" ) update = "Choose Playlist";
- this.root_item.property_set ( MENUITEM_PROP_LABEL, update );
+ this.root_item.property_set (MENUITEM_PROP_LABEL, update);
+ this.root_item.property_set (MENUITEM_PATH, detail.path);
}
private void submenu_item_activated (int menu_item_id)
diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c
index 76102e4..6d11221 100644
--- a/src/pulseaudio-mgr.c
+++ b/src/pulseaudio-mgr.c
@@ -31,6 +31,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <pulse/error.h>
#include "pulseaudio-mgr.h"
+#include "config.h"
#define RECONNECT_DELAY 5
@@ -116,24 +117,44 @@ Method which connects to the pulse server and is used to track reconnects.
static gboolean
reconnect_to_pulse (gpointer user_data)
{
- g_debug("Attempt to reconnect to pulse");
+ g_debug("Attempt a pulse connection");
// reset
+ g_return_val_if_fail (IS_ACTIVE_SINK (user_data), FALSE);
+
connection_attempts += 1;
if (pulse_context != NULL) {
pa_context_unref(pulse_context);
pulse_context = NULL;
}
- pulse_context = pa_context_new( pa_glib_mainloop_get_api( pa_main_loop ),
- "com.canonical.indicators.sound" );
+ pa_proplist *proplist;
+
+ proplist = pa_proplist_new ();
+ pa_proplist_sets (proplist,
+ PA_PROP_APPLICATION_NAME,
+ "Indicator Sound");
+ pa_proplist_sets (proplist,
+ PA_PROP_APPLICATION_ID,
+ "com.canonical.indicators.sound");
+ pa_proplist_sets (proplist,
+ PA_PROP_APPLICATION_ICON_NAME,
+ "multimedia-volume-control");
+ pa_proplist_sets (proplist,
+ PA_PROP_APPLICATION_VERSION,
+ PACKAGE_VERSION);
+
+ pulse_context = pa_context_new_with_proplist (pa_glib_mainloop_get_api( pa_main_loop ),
+ NULL,
+ proplist);
+ pa_proplist_free (proplist);
g_assert(pulse_context);
pa_context_set_state_callback (pulse_context,
pm_context_state_callback,
user_data);
int result = pa_context_connect (pulse_context,
NULL,
- PA_CONTEXT_NOFAIL,
- user_data);
+ (pa_context_flags_t)PA_CONTEXT_NOFAIL,
+ NULL);
if (result < 0) {
g_warning ("Failed to connect context: %s",
@@ -220,11 +241,12 @@ pm_subscribed_events_callback (pa_context *c,
}
break;
case PA_SUBSCRIPTION_EVENT_SOURCE:
- g_debug ("Looks like source event of some description");
+ g_debug ("Looks like source event of some description - index = %i", index);
// We don't care about any other sink other than the active one.
if (index != active_sink_get_source_index (sink))
return;
if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
+ g_debug ("Source removal event - index = %i", index);
active_sink_deactivate_voip_source (sink, FALSE);
}
else{
@@ -279,8 +301,10 @@ pm_context_state_callback (pa_context *c, void *userdata)
g_debug("connecting - waiting for the server to become available");
break;
case PA_CONTEXT_AUTHORIZING:
+ g_debug ("Authorizing");
break;
case PA_CONTEXT_SETTING_NAME:
+ g_debug ("Setting name");
break;
case PA_CONTEXT_FAILED:
g_warning("PA_CONTEXT_FAILED - Is PulseAudio Daemon running ?");
@@ -288,10 +312,11 @@ pm_context_state_callback (pa_context *c, void *userdata)
if (reconnect_idle_id == 0){
reconnect_idle_id = g_timeout_add_seconds (RECONNECT_DELAY,
reconnect_to_pulse,
- userdata);
+ (gpointer)userdata);
}
break;
case PA_CONTEXT_TERMINATED:
+ g_debug ("Terminated");
break;
case PA_CONTEXT_READY:
connection_attempts = 0;
@@ -396,8 +421,8 @@ pm_sink_info_callback (pa_context *c,
return;
}
else {
- if (IS_ACTIVE_SINK (userdata) == FALSE){
- g_warning ("sink info callback - our user data is not what we think it should be");
+ if (IS_ACTIVE_SINK (userdata) == FALSE || sink == NULL){
+ g_warning ("sink info callback - our user data is not what we think it should be or the sink parameter is null");
return;
}
ActiveSink* a_sink = ACTIVE_SINK (userdata);
@@ -418,8 +443,8 @@ pm_default_sink_info_callback (pa_context *c,
return;
}
else {
- if (IS_ACTIVE_SINK (userdata) == FALSE){
- g_warning ("Default sink info callback - our user data is not what we think it should be");
+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
+ g_warning ("Default sink info callback - our user data is not what we think it should be or the info parameter is null");
return;
}
// Only repopulate if there is a change with regards the index
@@ -441,9 +466,8 @@ pm_sink_input_info_callback (pa_context *c,
return;
}
else {
- if (info == NULL) {
- // TODO: watch this carefully - PA async api should not be doing this . . .
- g_warning("\n Sink input info callback : SINK INPUT INFO IS NULL BUT EOL was not POSITIVE!!!");
+ if (info == NULL || IS_ACTIVE_SINK (userdata) == FALSE) {
+ g_warning("Sink input info callback : SINK INPUT INFO IS NULL or our user_data is not what we think it should be");
return;
}
@@ -486,8 +510,8 @@ pm_update_active_sink (pa_context *c,
return;
}
else{
- if (IS_ACTIVE_SINK (userdata) == FALSE){
- g_warning ("update_active_sink - our user data is not what we think it should be");
+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
+ g_warning ("update_active_sink - our user data is not what we think it should be or the info parameter is null");
return;
}
active_sink_update (ACTIVE_SINK(userdata), info);
@@ -504,6 +528,10 @@ pm_toggle_mute_for_every_sink_callback (pa_context *c,
return;
}
else {
+ if (sink == NULL) {
+ g_warning ("toggle_mute cb - sink parameter is null - why ?");
+ return;
+ }
pa_operation_unref (pa_context_set_sink_mute_by_index (c,
sink->index,
GPOINTER_TO_INT(userdata),
@@ -523,8 +551,8 @@ pm_default_source_info_callback (pa_context *c,
return;
}
else {
- if (IS_ACTIVE_SINK (userdata) == FALSE){
- g_warning ("Default sink info callback - our user data is not what we think it should be");
+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
+ g_warning ("Default source info callback - our user data is not what we think it should be or the source info parameter is null");
return;
}
// If there is an index change we need to change our cached source
@@ -546,8 +574,8 @@ pm_source_info_callback (pa_context *c,
return;
}
else {
- if (IS_ACTIVE_SINK (userdata) == FALSE){
- g_warning ("Default sink info callback - our user data is not what we think it should be");
+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL){
+ g_warning ("source info callback - our user data is not what we think it should be or the source info parameter is null");
return;
}
// For now we will take the first available
@@ -567,11 +595,11 @@ pm_update_source_info_callback (pa_context *c,
return;
}
else {
- if (IS_ACTIVE_SINK (userdata) == FALSE){
- g_warning ("Default sink info callback - our user data is not what we think it should be");
+ if (IS_ACTIVE_SINK (userdata) == FALSE || info == NULL ){
+ g_warning ("source info update callback - our user data is not what we think it should be or the source info paramter is null");
return;
}
g_debug ("Got a source update for %s , index %i", info->name, info->index);
active_sink_update_voip_input_source (ACTIVE_SINK (userdata), info);
}
-} \ No newline at end of file
+}
diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c
index 9be39c7..b493ce8 100644
--- a/src/sound-service-dbus.c
+++ b/src/sound-service-dbus.c
@@ -295,6 +295,8 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self,
gchar* player_name,
gboolean blacklist)
{
+ g_return_val_if_fail (player_name != NULL, FALSE);
+
gboolean result = FALSE;
GSettings* our_settings = NULL;
our_settings = g_settings_new ("com.canonical.indicators.sound");
diff --git a/src/title-menu-item.c b/src/title-menu-item.c
index 2d6a7e8..702fa24 100644
--- a/src/title-menu-item.c
+++ b/src/title-menu-item.c
@@ -24,9 +24,11 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib-object.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/dbusmenu-glib.h>
+#include <libdbusmenu-glib/enum-types.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/types.h>
#include <common-defs.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/title-widget.c b/src/title-widget.c
index 675c59f..b8058b8 100644
--- a/src/title-widget.c
+++ b/src/title-widget.c
@@ -44,8 +44,8 @@ static void title_widget_dispose (GObject *object);
static void title_widget_finalize (GObject *object);
// keyevent consumers
-static gboolean title_widget_button_press_event (GtkWidget *menuitem,
- GdkEventButton *event);
+static gboolean title_widget_button_release_event (GtkWidget *menuitem,
+ GdkEventButton *event);
// Dbusmenuitem properties update callback
static void title_widget_property_update(DbusmenuMenuitem* item, gchar* property,
@@ -64,7 +64,7 @@ title_widget_class_init (TitleWidgetClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- widget_class->button_press_event = title_widget_button_press_event;
+ widget_class->button_release_event = title_widget_button_release_event;
g_type_class_add_private (klass, sizeof (TitleWidgetPrivate));
@@ -132,8 +132,8 @@ title_widget_finalize (GObject *object)
/* Suppress/consume keyevents */
static gboolean
-title_widget_button_press_event (GtkWidget *menuitem,
- GdkEventButton *event)
+title_widget_button_release_event (GtkWidget *menuitem,
+ GdkEventButton *event)
{
//g_debug("TitleWidget::menu_press_event");
TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(menuitem);
@@ -147,8 +147,8 @@ title_widget_button_press_event (GtkWidget *menuitem,
}
static void
-title_widget_property_update(DbusmenuMenuitem* item, gchar* property,
- GVariant* value, gpointer userdata)
+title_widget_property_update (DbusmenuMenuitem* item, gchar* property,
+ GVariant* value, gpointer userdata)
{
g_return_if_fail (IS_TITLE_WIDGET (userdata));
TitleWidget* mitem = TITLE_WIDGET(userdata);
diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c
index 036b5d4..a04f269 100644
--- a/src/transport-menu-item.c
+++ b/src/transport-menu-item.c
@@ -24,9 +24,11 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib-object.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/dbusmenu-glib.h>
+#include <libdbusmenu-glib/enum-types.h>
#include <libdbusmenu-glib/menuitem-proxy.h>
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-glib/server.h>
+#include <libdbusmenu-glib/types.h>
#include <common-defs.h>
#include <stdlib.h>
#include <string.h>