From d1c735417327b2914536eecdce06365076e12fe7 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 25 Oct 2013 11:08:20 -0500 Subject: test that player.icon isn't null before we serialize it. --- src/sound-menu.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sound-menu.vala b/src/sound-menu.vala index e1c5c1f..af808b5 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -144,7 +144,8 @@ class SoundMenu: Object var player_item = new MenuItem (player.name, "indicator." + player.id); player_item.set_attribute ("x-canonical-type", "s", "com.canonical.unity.media-player"); - player_item.set_attribute_value ("icon", g_icon_serialize (player.icon)); + if (player.icon != null) + player_item.set_attribute_value ("icon", g_icon_serialize (player.icon)); section.append_item (player_item); var playback_item = new MenuItem (null, null); -- cgit v1.2.3 From 05d587408fa3b64ff569329d334c82c46eb64829 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 28 Oct 2013 11:43:22 -0700 Subject: use 'application-default-icon' as the fallback media player icon --- src/sound-menu.vala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sound-menu.vala b/src/sound-menu.vala index af808b5..4c62b38 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -141,11 +141,15 @@ class SoundMenu: Object void insert_player_section (MediaPlayer player) { var section = new Menu (); + Icon icon; + + icon = player.icon; + if (icon == null) + icon = new ThemedIcon.with_default_fallbacks ("application-default-icon"); var player_item = new MenuItem (player.name, "indicator." + player.id); player_item.set_attribute ("x-canonical-type", "s", "com.canonical.unity.media-player"); - if (player.icon != null) - player_item.set_attribute_value ("icon", g_icon_serialize (player.icon)); + player_item.set_attribute_value ("icon", g_icon_serialize (player.icon)); section.append_item (player_item); var playback_item = new MenuItem (null, null); -- cgit v1.2.3 From 9ebfd4a45a13d55f8f926f3a97a6479cd8e4671c Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 28 Oct 2013 12:08:05 -0700 Subject: add the null safeguard back for the pathological case of 'application-default-icon' also failing --- src/sound-menu.vala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sound-menu.vala b/src/sound-menu.vala index 4c62b38..f3f4fd9 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -149,7 +149,8 @@ class SoundMenu: Object var player_item = new MenuItem (player.name, "indicator." + player.id); player_item.set_attribute ("x-canonical-type", "s", "com.canonical.unity.media-player"); - player_item.set_attribute_value ("icon", g_icon_serialize (player.icon)); + if (icon != null) + player_item.set_attribute_value ("icon", g_icon_serialize (icon)); section.append_item (player_item); var playback_item = new MenuItem (null, null); -- cgit v1.2.3