aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--src/indicator-sound.c1
-rw-r--r--src/mpris2-controller.vala25
-rw-r--r--src/mpris2-interfaces.vala8
-rw-r--r--src/music-player-bridge.vala4
-rw-r--r--src/mute-menu-item.c30
-rw-r--r--src/mute-menu-item.h4
-rw-r--r--src/player-controller.vala14
-rw-r--r--src/pulse-manager.c2
-rw-r--r--src/pulse-manager.h2
-rw-r--r--src/slider-menu-item.c9
-rw-r--r--src/sound-service-dbus.c60
-rw-r--r--src/sound-service.xml1
-rw-r--r--src/sound-state-manager.c3
-rw-r--r--src/transport-widget.c6
15 files changed, 95 insertions, 78 deletions
diff --git a/configure.ac b/configure.ac
index 2abe1c4..a50950c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
-AC_INIT(indicator-sound, 0.5.6, conor.curran@canonical.com)
+AC_INIT(indicator-sound, 0.5.7, conor.curran@canonical.com)
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-sound, 0.5.6)
+AM_INIT_AUTOMAKE(indicator-sound, 0.5.7)
AM_MAINTAINER_MODE
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index 3c65a90..42560c8 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -278,7 +278,6 @@ static void create_connection_to_service (GObject *source_object,
g_error_free(error);
return;
}
- g_debug ("Connection to dbus seemed to work fine from the indicator side");
sound_state_manager_connect_to_dbus (priv->state_manager,
priv->dbus_proxy);
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index a7b3de1..03571e6 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -95,12 +95,12 @@ public class Mpris2Controller : GLib.Object
}
Variant? playlist_count_v = changed_properties.lookup("PlaylistCount");
if ( playlist_count_v != null && this.owner.use_playlists == true ){
- this.fetch_playlists();
+ this.fetch_playlists.begin();
this.fetch_active_playlist();
}
Variant? playlist_orderings_v = changed_properties.lookup("Orderings");
if ( playlist_orderings_v != null && this.owner.use_playlists == true ){
- this.fetch_playlists();
+ this.fetch_playlists.begin();
this.fetch_active_playlist();
}
}
@@ -156,7 +156,7 @@ public class Mpris2Controller : GLib.Object
MetadataMenuitem.attributes_format());
if ( this.owner.use_playlists == true ){
- this.fetch_playlists();
+ this.fetch_playlists.begin();
this.fetch_active_playlist();
}
}
@@ -188,12 +188,21 @@ public class Mpris2Controller : GLib.Object
}
}
- public void fetch_playlists()
+ public async void fetch_playlists()
{
- PlaylistDetails[] current_playlists = this.playlists.GetPlaylists(0,
- 10,
- "Alphabetical",
- false);
+ PlaylistDetails[] current_playlists = null;
+
+ try{
+ current_playlists = yield this.playlists.GetPlaylists (0,
+ 10,
+ "Alphabetical",
+ false);
+ }
+ catch (IOError e){
+ debug("Could not fetch playlists because %s", e.message);
+ return;
+ }
+
if( current_playlists != null ){
debug( "Size of the playlist array = %i", current_playlists.length );
PlaylistsMenuitem playlists_item = this.owner.custom_items[PlayerController.widget_order.PLAYLISTS] as PlaylistsMenuitem;
diff --git a/src/mpris2-interfaces.vala b/src/mpris2-interfaces.vala
index 9d0b8c9..0a0909f 100644
--- a/src/mpris2-interfaces.vala
+++ b/src/mpris2-interfaces.vala
@@ -68,8 +68,8 @@ public interface MprisPlaylists : Object {
//methods
public abstract async void ActivatePlaylist(ObjectPath playlist_id) throws IOError;
- public abstract PlaylistDetails[] GetPlaylists ( uint32 index,
- uint32 max_count,
- string order,
- bool reverse_order ) throws IOError;
+ public abstract async PlaylistDetails[] GetPlaylists ( uint32 index,
+ uint32 max_count,
+ string order,
+ bool reverse_order ) throws IOError;
} \ No newline at end of file
diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala
index 7587684..c167e08 100644
--- a/src/music-player-bridge.vala
+++ b/src/music-player-bridge.vala
@@ -141,8 +141,8 @@ public class MusicPlayerBridge : GLib.Object
this.root_menu = menu;
this.try_to_add_inactive_familiar_clients();
this.watcher = new Mpris2Watcher ();
- this.watcher.client_appeared += this.client_has_become_available;
- this.watcher.client_disappeared += this.client_has_vanished;
+ this.watcher.client_appeared.connect (this.client_has_become_available);
+ this.watcher.client_disappeared.connect (this.client_has_vanished);
}
private static AppInfo? create_app_info ( string desktop )
diff --git a/src/mute-menu-item.c b/src/mute-menu-item.c
index 2f40177..f7f3824 100644
--- a/src/mute-menu-item.c
+++ b/src/mute-menu-item.c
@@ -43,7 +43,8 @@ static void mute_menu_item_set_global_mute_from_ui (gpointer user_data);
G_DEFINE_TYPE (MuteMenuItem, mute_menu_item, G_TYPE_OBJECT);
-static void mute_menu_item_class_init (MuteMenuItemClass *klass)
+static void
+mute_menu_item_class_init (MuteMenuItemClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -55,7 +56,8 @@ static void mute_menu_item_class_init (MuteMenuItemClass *klass)
return;
}
-static void mute_menu_item_init (MuteMenuItem *self)
+static void
+mute_menu_item_init (MuteMenuItem *self)
{
g_debug("Building new Mute Menu Item");
MuteMenuItemPrivate* priv = MUTE_MENU_ITEM_GET_PRIVATE(self);
@@ -68,7 +70,8 @@ static void mute_menu_item_init (MuteMenuItem *self)
return;
}
-static void mute_menu_item_dispose (GObject *object)
+static void
+mute_menu_item_dispose (GObject *object)
{
G_OBJECT_CLASS (mute_menu_item_parent_class)->dispose (object);
return;
@@ -93,8 +96,8 @@ mute_menu_item_set_global_mute_from_ui (gpointer user_data)
toggle_global_mute (new_value);
}
-
-void mute_menu_item_update(MuteMenuItem* item, gboolean value_update)
+void
+mute_menu_item_update (MuteMenuItem* item, gboolean value_update)
{
MuteMenuItemPrivate* priv = MUTE_MENU_ITEM_GET_PRIVATE (item);
@@ -106,7 +109,8 @@ void mute_menu_item_update(MuteMenuItem* item, gboolean value_update)
value_update == FALSE ? _("Mute") : _("Unmute"));
}
-void mute_menu_item_enable(MuteMenuItem* item, gboolean active)
+void
+mute_menu_item_enable (MuteMenuItem* item, gboolean active)
{
MuteMenuItemPrivate* priv = MUTE_MENU_ITEM_GET_PRIVATE (item);
@@ -115,13 +119,23 @@ void mute_menu_item_enable(MuteMenuItem* item, gboolean active)
active);
}
-DbusmenuMenuitem* mute_menu_item_get_button (MuteMenuItem* item)
+DbusmenuMenuitem*
+mute_menu_item_get_button (MuteMenuItem* item)
{
MuteMenuItemPrivate* priv = MUTE_MENU_ITEM_GET_PRIVATE (item);
return priv->button;
}
-MuteMenuItem* mute_menu_item_new (gboolean initial_update, gboolean enabled)
+gboolean
+mute_menu_item_is_muted (MuteMenuItem* item)
+{
+ MuteMenuItemPrivate* priv = MUTE_MENU_ITEM_GET_PRIVATE (item);
+ return dbusmenu_menuitem_property_get_bool (priv->button,
+ DBUSMENU_MUTE_MENUITEM_VALUE);
+}
+
+MuteMenuItem*
+mute_menu_item_new (gboolean initial_update, gboolean enabled)
{
MuteMenuItem *self = g_object_new (MUTE_MENU_ITEM_TYPE, NULL);
mute_menu_item_update (self, initial_update);
diff --git a/src/mute-menu-item.h b/src/mute-menu-item.h
index 8240441..81a4b33 100644
--- a/src/mute-menu-item.h
+++ b/src/mute-menu-item.h
@@ -50,10 +50,10 @@ MuteMenuItem* mute_menu_item_new ();
void mute_menu_item_update (MuteMenuItem* item, gboolean update);
void mute_menu_item_enable (MuteMenuItem* item, gboolean active);
+gboolean mute_menu_item_is_muted (MuteMenuItem* item);
DbusmenuMenuitem* mute_menu_item_get_button (MuteMenuItem* item);
G_END_DECLS
-#endif
-
+#endif \ No newline at end of file
diff --git a/src/player-controller.vala b/src/player-controller.vala
index adefb65..024b88b 100644
--- a/src/player-controller.vala
+++ b/src/player-controller.vala
@@ -189,20 +189,6 @@ public class PlayerController : GLib.Object
}
}
- private static string format_player_name(owned string app_info_name)
- {
- string result = app_info_name.down().strip();
- var tokens = result.split(" ");
- if(tokens.length > 1){
- result = tokens[0];
- }
- if(result.length > 1){
- result = result.up(1).concat(result.slice(1, result.length));
- }
- debug("PlayerController->format_player_name - : %s", result);
- return result;
- }
-
private void determine_state()
{
if(this.mpris_bridge.connected() == true){
diff --git a/src/pulse-manager.c b/src/pulse-manager.c
index ca008a7..457992b 100644
--- a/src/pulse-manager.c
+++ b/src/pulse-manager.c
@@ -183,7 +183,7 @@ static gboolean determine_sink_availability()
return available;
}
-static gboolean default_sink_is_muted()
+gboolean default_sink_is_muted()
{
if (DEFAULT_SINK_INDEX < 0)
return FALSE;
diff --git a/src/pulse-manager.h b/src/pulse-manager.h
index dfe1256..5895aeb 100644
--- a/src/pulse-manager.h
+++ b/src/pulse-manager.h
@@ -40,6 +40,6 @@ void establish_pulse_activities(SoundServiceDbus *service);
void set_sink_volume(gdouble percent);
void toggle_global_mute(gboolean mute_value);
void close_pulse_activites();
-
+gboolean default_sink_is_muted();
#endif
diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c
index 64db277..a20bb00 100644
--- a/src/slider-menu-item.c
+++ b/src/slider-menu-item.c
@@ -81,12 +81,8 @@ handle_event (DbusmenuMenuitem * mi,
GVariant * value,
guint timestamp)
{
- /*g_debug ( "handle-event in the slider at the backend, input is of type %s",
- g_variant_get_type_string(value));*/
-
GVariant* input = NULL;
input = value;
- // Please note: Subject to change in future DBusmenu revisions
if (g_variant_is_of_type(value, G_VARIANT_TYPE_VARIANT) == TRUE) {
input = g_variant_get_variant(value);
}
@@ -94,6 +90,11 @@ handle_event (DbusmenuMenuitem * mi,
gboolean volume_input = g_variant_get_double(input);
if (value != NULL){
set_sink_volume(volume_input);
+ // TODO -when the ACTIVESINK instance exists this will be handled nicely
+ // PA MANAGER will be refactored first.
+ if (default_sink_is_muted () == TRUE){
+ toggle_global_mute (FALSE);
+ }
}
}
diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c
index b444a91..a532c0e 100644
--- a/src/sound-service-dbus.c
+++ b/src/sound-service-dbus.c
@@ -35,6 +35,7 @@
#include "pulse-manager.h"
#include "slider-menu-item.h"
#include "mute-menu-item.h"
+#include "pulse-manager.h"
// DBUS methods
static void bus_method_call (GDBusConnection * connection,
@@ -153,7 +154,8 @@ sound_service_dbus_init (SoundServiceDbus *self)
}
}
-DbusmenuMenuitem* sound_service_dbus_create_root_item (SoundServiceDbus* self)
+DbusmenuMenuitem*
+sound_service_dbus_create_root_item (SoundServiceDbus* self)
{
SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self);
priv->root_menuitem = dbusmenu_menuitem_new();
@@ -165,10 +167,11 @@ DbusmenuMenuitem* sound_service_dbus_create_root_item (SoundServiceDbus* self)
return priv->root_menuitem;
}
-static void sound_service_dbus_build_sound_menu ( SoundServiceDbus* self,
- gboolean mute_update,
- gboolean availability,
- gdouble volume )
+static void
+sound_service_dbus_build_sound_menu ( SoundServiceDbus* self,
+ gboolean mute_update,
+ gboolean availability,
+ gdouble volume )
{
SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self);
@@ -209,8 +212,9 @@ static void sound_service_dbus_build_sound_menu ( SoundServiceDbus* self,
show_sound_settings_dialog:
Bring up the gnome volume preferences dialog
**/
-static void show_sound_settings_dialog (DbusmenuMenuitem *mi,
- gpointer user_data)
+static void
+show_sound_settings_dialog (DbusmenuMenuitem *mi,
+ gpointer user_data)
{
GError * error = NULL;
if (!g_spawn_command_line_async("gnome-volume-control --page=applications", &error) &&
@@ -221,10 +225,11 @@ static void show_sound_settings_dialog (DbusmenuMenuitem *mi,
}
}
-void sound_service_dbus_update_pa_state ( SoundServiceDbus* self,
- gboolean availability,
- gboolean mute_update,
- gdouble volume )
+void
+sound_service_dbus_update_pa_state ( SoundServiceDbus* self,
+ gboolean availability,
+ gboolean mute_update,
+ gdouble volume )
{
g_debug("update pa state with availability of %i, mute value of %i and a volume percent is %f", availability, mute_update, volume);
SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self);
@@ -265,8 +270,11 @@ sound_service_dbus_finalize (GObject *object)
return;
}
-void sound_service_dbus_update_volume(SoundServiceDbus* self,
- gdouble volume)
+// UNTIL PA-MANAGER IS REFACTORED AND THE ACTIVESINK CLASS IS CREATED LEAVE
+// THE UI ELEMENTS SEPARATELY HANDLED LIKE THIS.
+void
+sound_service_dbus_update_volume (SoundServiceDbus* self,
+ gdouble volume)
{
SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self);
slider_menu_item_update (priv->volume_slider_menuitem, volume);
@@ -274,8 +282,9 @@ void sound_service_dbus_update_volume(SoundServiceDbus* self,
sound_service_dbus_get_state_from_volume (self));
}
-void sound_service_dbus_update_sink_mute(SoundServiceDbus* self,
- gboolean mute_update)
+void
+sound_service_dbus_update_sink_mute (SoundServiceDbus* self,
+ gboolean mute_update)
{
SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self);
mute_menu_item_update (priv->mute_menuitem, mute_update);
@@ -286,7 +295,9 @@ void sound_service_dbus_update_sink_mute(SoundServiceDbus* self,
sound_service_dbus_update_sound_state (self, state);
}
-static SoundState sound_service_dbus_get_state_from_volume (SoundServiceDbus* self)
+/*------- State calculators ------------------*/
+static SoundState
+sound_service_dbus_get_state_from_volume (SoundServiceDbus* self)
{
SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self);
GVariant* v = dbusmenu_menuitem_property_get_variant (DBUSMENU_MENUITEM(priv->volume_slider_menuitem),
@@ -310,10 +321,11 @@ static SoundState sound_service_dbus_get_state_from_volume (SoundServiceDbus* se
return state;
}
-static void sound_service_dbus_determine_state (SoundServiceDbus* self,
- gboolean availability,
- gboolean mute,
- gdouble volume)
+static void
+sound_service_dbus_determine_state (SoundServiceDbus* self,
+ gboolean availability,
+ gboolean mute,
+ gdouble volume)
{
SoundState update;
if (availability == FALSE) {
@@ -333,15 +345,15 @@ static void sound_service_dbus_determine_state (SoundServiceDbus* self,
// TODO: this will be a bit messy until the pa_manager is sorted.
// And we figure out all of the edge cases.
-void sound_service_dbus_update_sound_state (SoundServiceDbus* self,
- SoundState new_state)
+void
+sound_service_dbus_update_sound_state (SoundServiceDbus* self,
+ SoundState new_state)
{
SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self);
SoundState update = new_state;
// Ensure that after it has become available update the state with the current volume level
if (new_state == AVAILABLE &&
- dbusmenu_menuitem_property_get_bool ( DBUSMENU_MENUITEM(priv->mute_menuitem),
- DBUSMENU_MUTE_MENUITEM_VALUE) == FALSE ){
+ mute_menu_item_is_muted (priv->mute_menuitem) == FALSE){
update = sound_service_dbus_get_state_from_volume (self);
}
if (update != BLOCKED){
diff --git a/src/sound-service.xml b/src/sound-service.xml
index 07c9c3d..18e47fc 100644
--- a/src/sound-service.xml
+++ b/src/sound-service.xml
@@ -4,6 +4,7 @@
<method name = "BlacklistMediaPlayer">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="sound_service_dbus_blacklist_media_player"/>
<arg type='s' name='player_desktop_name' direction="in"/>
+ <arg type='b' name='blacklist' direction="in"/>
</method>
<method name = "GetSoundState">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="sound_service_dbus_get_sink_state"/>
diff --git a/src/sound-state-manager.c b/src/sound-state-manager.c
index 2ea9b1a..e8865d8 100644
--- a/src/sound-state-manager.c
+++ b/src/sound-state-manager.c
@@ -193,7 +193,6 @@ sound_state_manager_connect_to_dbus (SoundStateManager* self, GDBusProxy* proxy)
{
SoundStateManagerPrivate* priv = SOUND_STATE_MANAGER_GET_PRIVATE(self);
priv->dbus_proxy = proxy;
- g_debug (" here about to register for signal callback on %s", g_dbus_proxy_get_name (priv->dbus_proxy));
g_signal_connect (priv->dbus_proxy, "g-signal",
G_CALLBACK (sound_state_signal_cb), self);
@@ -223,7 +222,7 @@ sound_state_manager_get_state_cb (GObject *object,
&error );
if (error != NULL) {
- g_debug("get_sound_state call failed: %s", error->message);
+ g_warning("get_sound_state call failed: %s", error->message);
g_error_free(error);
return;
}
diff --git a/src/transport-widget.c b/src/transport-widget.c
index a276a31..6ddd4bc 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -289,11 +289,7 @@ transport_widget_motion_notify_event (GtkWidget *menuitem,
event);
priv->motion_event = result;
- cairo_t *cr;
- cr = gdk_cairo_create (menuitem->window);
- draw ( menuitem, cr );
- cairo_destroy ( cr );
-
+ gtk_widget_queue_draw (menuitem);
return TRUE;
}