aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2013-06-13 15:15:20 -0400
committerLars Uebernickel <lars.uebernickel@canonical.com>2013-06-13 15:15:20 -0400
commitf7ff900fadff1277be47f0d772c6a84cfaa185a2 (patch)
treea37a5ad5fb266a111c4b7ccf5603e9d1f1243aac /src
parent911f43fa48dd296006963ee5e5e956cbfd509ffc (diff)
downloadayatana-indicator-sound-f7ff900fadff1277be47f0d772c6a84cfaa185a2.tar.gz
ayatana-indicator-sound-f7ff900fadff1277be47f0d772c6a84cfaa185a2.tar.bz2
ayatana-indicator-sound-f7ff900fadff1277be47f0d772c6a84cfaa185a2.zip
Give players their own section in the menu
Diffstat (limited to 'src')
-rw-r--r--src/service.vala15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/service.vala b/src/service.vala
index 945dc6f..22f77c3 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -195,10 +195,14 @@ public class IndicatorSound.Service {
}
void player_added (MediaPlayer player) {
- var item = new MenuItem (player.name, "indicator." + player.id);
- item.set_attribute ("x-canonical-type", "s", "com.canonical.unity.media-player");
- item.set_attribute_value ("icon", g_icon_serialize (player.icon));
- this.menu.insert_item (this.menu.get_n_items () -1, item);
+ 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));
+
+ var section = new Menu ();
+ section.append_item (player_item);
+
+ this.menu.insert_section (this.menu.get_n_items () -1, null, section);
SimpleAction action = new SimpleAction.stateful (player.id, null, this.action_state_for_player (player));
action.activate.connect ( () => { player.launch (); });
@@ -214,8 +218,9 @@ public class IndicatorSound.Service {
int n = this.menu.get_n_items ();
for (int i = 0; i < n; i++) {
+ var section = this.menu.get_item_link (i, Menu.LINK_SECTION);
string action;
- this.menu.get_item_attribute (i, "action", "s", out action);
+ section.get_item_attribute (0, "action", "s", out action);
if (action == player.id) {
this.menu.remove (i);
break;