aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-04-22 10:17:03 -0500
committerTed Gould <ted@gould.cx>2014-04-22 10:17:03 -0500
commitd038c85495317daee3d036a48d519acc9ceb2727 (patch)
treeb666797e7568e71a9df1bf0b4961945c9caf8479 /src
parentc61f3dc9e934b75b234c49e5ac892bcda2ffac75 (diff)
downloadayatana-indicator-sound-d038c85495317daee3d036a48d519acc9ceb2727.tar.gz
ayatana-indicator-sound-d038c85495317daee3d036a48d519acc9ceb2727.tar.bz2
ayatana-indicator-sound-d038c85495317daee3d036a48d519acc9ceb2727.zip
Unroll one more level of if statement
Diffstat (limited to 'src')
-rw-r--r--src/accounts-service-user.vala21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala
index 194beb0..04c38cc 100644
--- a/src/accounts-service-user.vala
+++ b/src/accounts-service-user.vala
@@ -58,20 +58,19 @@ public class AccountsServiceUser : Object {
} else {
this.proxy.timestamp = GLib.get_monotonic_time();
this.proxy.player_name = this._player.name;
- if (this._player.icon == null) {
- var icon = new ThemedIcon.with_default_fallbacks ("application-default-icon");
- this.proxy.player_icon = icon.serialize();
- } else {
- var serialization = this._player.icon.serialize();
- if (serialization == null) {
- var icon = new ThemedIcon.with_default_fallbacks ("application-default-icon");
- serialization = icon.serialize();
- }
-
- this.proxy.player_icon = serialization;
+ /* Serialize the icon if it exits, if it doesn't or errors then
+ we need to use the application default icon */
+ GLib.Variant? icon_serialization = null;
+ if (this._player.icon != null)
+ icon_serialization = this._player.icon.serialize();
+ if (icon_serialization == null) {
+ var icon = new ThemedIcon.with_default_fallbacks ("application-default-icon");
+ icon_serialization = icon.serialize();
}
+ this.proxy.player_icon = icon_serialization;
+ /* Set state of the player */
this.proxy.running = this._player.is_running;
this.proxy.state = this._player.state;