From 2308be7ebf91ccfc3e7a231e38d0970a9dc03034 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 21 Oct 2011 19:10:38 +0100 Subject: fixed offset so as the player icon and triangle stay stationary when the player is active fixes lp:#874454 --- src/metadata-widget.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/metadata-widget.c b/src/metadata-widget.c index 8ab7d1d..96d55ab 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -331,7 +331,7 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget, x = allocation.x; y = 0; - gint offset = (allocation.height - gdk_pixbuf_get_height (priv->icon_buf)) / 2; + gint offset = gdk_pixbuf_get_height (priv->icon_buf) / 3; // Draw player icon if (priv->icon_buf != NULL){ @@ -345,7 +345,8 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget, // Draw triangle but only if the player is running. if (dbusmenu_menuitem_property_get_bool (priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING)){ - y += allocation.height/2.0 - (double)arrow_height/2.0; + y += gdk_pixbuf_get_height (priv->icon_buf) / 3 + 3; + //allocation.height/2.0 - (double)arrow_height/2.0; cairo_set_line_width (cr, 1.0); //g_debug ("triangle drawing"); -- cgit v1.2.3 From 158255cc844121972a7985a310719acd6d9e31ae Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 21 Oct 2011 20:03:54 +0100 Subject: increase the max playlist count to 100 --- src/mpris2-controller.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index ce35a06..cc80a86 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -21,7 +21,7 @@ using Transport; public class Mpris2Controller : GLib.Object { - public const int MAX_PLAYLIST_COUNT = 20; + public const int MAX_PLAYLIST_COUNT = 100; public MprisRoot mpris2_root {get; construct;} public MprisPlayer player {get; construct;} -- cgit v1.2.3 From 617c08b80f214285f1049e4e118c0054e849cead Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Sun, 23 Oct 2011 16:18:41 +0100 Subject: truncate playlist label if needs be --- src/playlists-menu-item.vala | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index 9cb7ac7..4666a50 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -49,7 +49,8 @@ public class PlaylistsMenuitem : PlayerItem continue; Dbusmenu.Menuitem menuitem = new Menuitem(); - menuitem.property_set (MENUITEM_PROP_LABEL, detail.name); + menuitem.property_set (MENUITEM_PROP_LABEL, + truncate_item_label_if_needs_be (detail.name)); menuitem.property_set (MENUITEM_PROP_ICON_NAME, "playlist-symbolic"); menuitem.property_set (MENUITEM_PATH, (string)detail.path); @@ -86,12 +87,14 @@ public class PlaylistsMenuitem : PlayerItem { foreach ( Dbusmenu.Menuitem item in this.current_playlists.values ){ if (new_detail.path == item.property_get (MENUITEM_PATH)){ - item.property_set (MENUITEM_PROP_LABEL, new_detail.name); + item.property_set (MENUITEM_PROP_LABEL, + truncate_item_label_if_needs_be (new_detail.name)); } } // 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); + this.root_item.property_set (MENUITEM_PROP_LABEL, + truncate_item_label_if_needs_be (new_detail.name)); } } @@ -115,7 +118,8 @@ public class PlaylistsMenuitem : PlayerItem { 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, + truncate_item_label_if_needs_be(update)); this.root_item.property_set (MENUITEM_PATH, detail.path); } @@ -129,6 +133,16 @@ public class PlaylistsMenuitem : PlayerItem this.owner.mpris_bridge.activate_playlist ( (GLib.ObjectPath)this.current_playlists[menu_item_id].property_get (MENUITEM_PATH) ); } + private string truncate_item_label_if_needs_be(string item_label) + { + var result = item_label; + if (item_label.char_count(-1) > 17){ + result = item_label.slice ((long)0, (long)15); + result += "…"; + } + return result; + } + public static HashSet attributes_format() { HashSet attrs = new HashSet(); -- cgit v1.2.3 From bfc485869ee1c8d27f194f5fe0b053d1550b03b5 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 26 Oct 2011 11:07:46 -0400 Subject: protect pulse manager from rogue null pulse contexts i.e. when pulse randomly dies --- src/pulseaudio-mgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c index 1da8ce1..ad6d34f 100644 --- a/src/pulseaudio-mgr.c +++ b/src/pulseaudio-mgr.c @@ -175,7 +175,7 @@ void pm_update_volume (gint sink_index, pa_cvolume new_volume) { // LP: #850662 - if (sink_index < 0){ + if (sink_index < 0 || pulse_context == NULL){ return; } pa_operation_unref (pa_context_set_sink_volume_by_index (pulse_context, @@ -197,7 +197,7 @@ void pm_update_mic_gain (gint source_index, pa_cvolume new_gain) { // LP: #850662 - if (source_index < 0){ + if (source_index < 0 || pulse_context == NULL){ return; } pa_operation_unref (pa_context_set_source_volume_by_index (pulse_context, -- cgit v1.2.3 From 8bde3f5a65575a9df08e06c7d14cc00ba86cc731 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 26 Oct 2011 12:28:59 -0400 Subject: protect against rogue mpris or desktop name keys --- src/music-player-bridge.vala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 0c9cb10..e7bc1fb 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -229,14 +229,13 @@ public class MusicPlayerBridge : GLib.Object { var result = desktop_or_interface; var tokens = desktop_or_interface.split( "." ); - if ( tokens.length > 1 ){ + if (tokens != null && tokens.length > 1){ result = tokens[tokens.length - 1]; } var temp = result.split("-"); - if (temp.length > 1){ + if (temp != null && temp.length > 1){ result = temp[0]; } - debug("determine key result = %s", result); return result; } -- cgit v1.2.3