aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2013-10-02 20:37:13 +0000
committerTarmac <Unknown>2013-10-02 20:37:13 +0000
commit1d2097423fd909485172b4e206fd3eaeabf2d5ce (patch)
tree468dc1f1dde38b8257adcf6304e1b15602d8ef52
parent6972629d012620a9f962035a371c963dac028266 (diff)
parentef6e7a7243e9d86087f4357eb9522feb9667a308 (diff)
downloadayatana-indicator-sound-1d2097423fd909485172b4e206fd3eaeabf2d5ce.tar.gz
ayatana-indicator-sound-1d2097423fd909485172b4e206fd3eaeabf2d5ce.tar.bz2
ayatana-indicator-sound-1d2097423fd909485172b4e206fd3eaeabf2d5ce.zip
Add a desktop_greeter menu without settings.
Approved by PS Jenkins bot, Lars Uebernickel.
-rw-r--r--data/com.canonical.indicator.sound2
-rw-r--r--src/service.vala1
-rw-r--r--src/sound-menu.vala15
3 files changed, 14 insertions, 4 deletions
diff --git a/data/com.canonical.indicator.sound b/data/com.canonical.indicator.sound
index adefae9..213be0b 100644
--- a/data/com.canonical.indicator.sound
+++ b/data/com.canonical.indicator.sound
@@ -10,4 +10,4 @@ ObjectPath=/com/canonical/indicator/sound/desktop
ObjectPath=/com/canonical/indicator/sound/phone
[desktop_greeter]
-ObjectPath=/com/canonical/indicator/sound/desktop
+ObjectPath=/com/canonical/indicator/sound/desktop_greeter
diff --git a/src/service.vala b/src/service.vala
index 0d028ac..1611608 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -34,6 +34,7 @@ public class IndicatorSound.Service {
this.actions.add_action (this.create_mic_volume_action ());
this.menus = new HashTable<string, SoundMenu> (str_hash, str_equal);
+ this.menus.insert ("desktop_greeter", new SoundMenu (true, null));
this.menus.insert ("desktop", new SoundMenu (true, "indicator.desktop-settings"));
this.menus.insert ("phone", new SoundMenu (false, "indicator.phone-settings"));
diff --git a/src/sound-menu.vala b/src/sound-menu.vala
index fe61cdf..9d0c521 100644
--- a/src/sound-menu.vala
+++ b/src/sound-menu.vala
@@ -22,7 +22,7 @@ extern Variant? g_icon_serialize (Icon icon);
class SoundMenu: Object
{
- public SoundMenu (bool show_mute, string settings_action) {
+ public SoundMenu (bool show_mute, string? settings_action) {
/* A sound menu always has at least two sections: the volume section (this.volume_section)
* at the start of the menu, and the settings section at the end. Between those two,
* it has a dynamic amount of player sections, one for each registered player.
@@ -37,7 +37,11 @@ class SoundMenu: Object
this.menu = new Menu ();
this.menu.append_section (null, volume_section);
- this.menu.append (_("Sound Settingsā€¦"), settings_action);
+
+ if (settings_action != null) {
+ settings_shown = true;
+ this.menu.append (_("Sound Settingsā€¦"), settings_action);
+ }
var root_item = new MenuItem (null, "indicator.root");
root_item.set_attribute ("x-canonical-type", "s", "com.canonical.indicator.root");
@@ -96,7 +100,11 @@ class SoundMenu: Object
player.notify["is-running"].connect ( () => this.update_playlists (player) );
update_playlists (player);
- this.menu.insert_section (this.menu.get_n_items () -1, null, section);
+ if (settings_shown) {
+ this.menu.insert_section (this.menu.get_n_items () -1, null, section);
+ } else {
+ this.menu.append_section (null, section);
+ }
}
public void remove_player (MediaPlayer player) {
@@ -109,6 +117,7 @@ class SoundMenu: Object
Menu menu;
Menu volume_section;
bool mic_volume_shown;
+ bool settings_shown = false;
/* returns the position in this.menu of the section that's associated with @player */
int find_player_section (MediaPlayer player) {