diff options
author | Xavi Garcia Mena <xavi.garcia.mena@canonical.com> | 2016-02-04 14:49:30 +0100 |
---|---|---|
committer | Xavi Garcia Mena <xavi.garcia.mena@canonical.com> | 2016-02-04 14:49:30 +0100 |
commit | 028e56ca8e6fa0c45f163d2ec0923053f71deb33 (patch) | |
tree | 8550d337f95ba2d2af863a8a575450c7ca40afbf /src | |
parent | 46f1c75cfbceb69a4f948e935e8661a904b0cf2e (diff) | |
download | ayatana-indicator-sound-028e56ca8e6fa0c45f163d2ec0923053f71deb33.tar.gz ayatana-indicator-sound-028e56ca8e6fa0c45f163d2ec0923053f71deb33.tar.bz2 ayatana-indicator-sound-028e56ca8e6fa0c45f163d2ec0923053f71deb33.zip |
Added Charles suggestions
Diffstat (limited to 'src')
-rw-r--r-- | src/sound-menu.vala | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/sound-menu.vala b/src/sound-menu.vala index 896b7d2..669e83d 100644 --- a/src/sound-menu.vala +++ b/src/sound-menu.vala @@ -29,7 +29,7 @@ public class SoundMenu: Object HIDE_INACTIVE_PLAYERS_PLAY_CONTROLS = 32 } - public enum PlayerSectionPosistion { + public enum PlayerSectionPosition { LABEL = 0, PLAYER_CONTROLS = 1, PLAYLIST = 2 @@ -182,21 +182,12 @@ public class SoundMenu: Object if (index == -1) { this.insert_player_section (player); } - else { - update_player_section (player, index); - } number_of_running_players++; } else { number_of_running_players--; if (this.hide_inactive) this.remove_player_section (player); - else { - if (index != -1) { - // just update to verify if we must hide the player controls - update_player_section (player, index); - } - } } this.update_playlists (player); @@ -307,7 +298,7 @@ public class SoundMenu: Object MenuItem create_playback_menu_item (MediaPlayer player) { var playback_item = new MenuItem (null, null); - playback_item.set_attribute ("x-canonical-type", "s", "com.canonical.unity.playback-item"); + playback_item.set_attribute ("x-canonical-type", "s", PLAYBACK_ITEM_TYPE); if (player.is_running) { if (player.can_do_play) { playback_item.set_attribute ("x-canonical-play-action", "s", "indicator.play." + player.id); @@ -345,9 +336,9 @@ public class SoundMenu: Object player_item.set_attribute_value ("icon", icon.serialize ()); section.append_item (player_item); - var playback_item = create_playback_menu_item (player); if (player.is_running|| !this.hide_inactive_player_controls) { - section.insert_item (PlayerSectionPosistion.PLAYER_CONTROLS, playback_item); + var playback_item = create_playback_menu_item (player); + section.insert_item (PlayerSectionPosition.PLAYER_CONTROLS, playback_item); } /* Add new players to the end of the player sections, just before the settings */ @@ -374,14 +365,14 @@ public class SoundMenu: Object if (player.is_running || !this.hide_inactive_player_controls) { MenuItem playback_item = create_playback_menu_item (player); if (play_control_index != -1) { - player_section.remove (PlayerSectionPosistion.PLAYER_CONTROLS); + player_section.remove (PlayerSectionPosition.PLAYER_CONTROLS); } - player_section.insert_item (PlayerSectionPosistion.PLAYER_CONTROLS, playback_item); + player_section.insert_item (PlayerSectionPosition.PLAYER_CONTROLS, playback_item); } else { if (play_control_index != -1 && number_of_running_players >= 1) { // remove both, playlist and play controls - player_section.remove (PlayerSectionPosistion.PLAYLIST); - player_section.remove (PlayerSectionPosistion.PLAYER_CONTROLS); + player_section.remove (PlayerSectionPosition.PLAYLIST); + player_section.remove (PlayerSectionPosition.PLAYER_CONTROLS); } } } |