aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharles kerr <charlesk@canonical.com>2015-12-31 14:49:42 -0600
committercharles kerr <charlesk@canonical.com>2015-12-31 14:49:42 -0600
commitb474814000dae6fcb23ac28dd9ed813b5e6d19b1 (patch)
tree12538a4e1b3c0baa4f40e365e4e91051664dc513
parentcbdeea528675b55b634aa9b15f94e64d36c99924 (diff)
downloadayatana-indicator-sound-b474814000dae6fcb23ac28dd9ed813b5e6d19b1.tar.gz
ayatana-indicator-sound-b474814000dae6fcb23ac28dd9ed813b5e6d19b1.tar.bz2
ayatana-indicator-sound-b474814000dae6fcb23ac28dd9ed813b5e6d19b1.zip
use predefined VariantTypes instead of reinventing the wheel
-rw-r--r--src/accounts-service-user.vala4
-rw-r--r--src/media-player-mpris.vala2
-rw-r--r--src/service.vala4
-rw-r--r--src/volume-control-pulse.vala6
4 files changed, 8 insertions, 8 deletions
diff --git a/src/accounts-service-user.vala b/src/accounts-service-user.vala
index e8db7c4..1f9dcce 100644
--- a/src/accounts-service-user.vala
+++ b/src/accounts-service-user.vala
@@ -185,7 +185,7 @@ public class AccountsServiceUser : Object {
this.privacyproxy = Bus.get_proxy.end (res);
(this.privacyproxy as DBusProxy).g_properties_changed.connect((proxy, changed, invalid) => {
- var welcomeval = changed.lookup_value("MessagesWelcomeScreen", new VariantType("b"));
+ var welcomeval = changed.lookup_value("MessagesWelcomeScreen", VariantType.BOOLEAN);
if (welcomeval != null) {
debug("Messages on welcome screen changed");
this.showDataOnGreeter = welcomeval.get_boolean();
@@ -204,7 +204,7 @@ public class AccountsServiceUser : Object {
this.syssoundproxy = Bus.get_proxy.end (res);
(this.syssoundproxy as DBusProxy).g_properties_changed.connect((proxy, changed, invalid) => {
- var silentvar = changed.lookup_value("SilentMode", new VariantType("b"));
+ var silentvar = changed.lookup_value("SilentMode", VariantType.BOOLEAN);
if (silentvar != null) {
debug("Silent Mode changed");
this._silentMode = silentvar.get_boolean();
diff --git a/src/media-player-mpris.vala b/src/media-player-mpris.vala
index 148a30a..93ce34e 100644
--- a/src/media-player-mpris.vala
+++ b/src/media-player-mpris.vala
@@ -295,7 +295,7 @@ public class MediaPlayerMpris: MediaPlayer {
this.playbackstatus_changed ();
}
- var metadata = changed_properties.lookup_value ("Metadata", new VariantType ("a{sv}"));
+ var metadata = changed_properties.lookup_value ("Metadata", VariantType.VARDICT);
if (metadata != null)
this.update_current_track (metadata);
}
diff --git a/src/service.vala b/src/service.vala
index cd016c1..8615386 100644
--- a/src/service.vala
+++ b/src/service.vala
@@ -266,7 +266,7 @@ public class IndicatorSound.Service: Object {
}
var root_action = actions.lookup_action ("root") as SimpleAction;
- var builder = new VariantBuilder (new VariantType ("a{sv}"));
+ var builder = new VariantBuilder (VariantType.VARDICT);
builder.add ("{sv}", "title", new Variant.string (_("Sound")));
builder.add ("{sv}", "accessible-desc", new Variant.string (accessible_name));
builder.add ("{sv}", "icon", serialize_themed_icon (icon));
@@ -619,7 +619,7 @@ public class IndicatorSound.Service: Object {
uint export_actions = 0;
Variant action_state_for_player (MediaPlayer player, bool show_track = true) {
- var builder = new VariantBuilder (new VariantType ("a{sv}"));
+ var builder = new VariantBuilder (VariantType.VARDICT);
builder.add ("{sv}", "running", new Variant ("b", player.is_running));
builder.add ("{sv}", "state", new Variant ("s", player.state));
if (player.current_track != null && show_track) {
diff --git a/src/volume-control-pulse.vala b/src/volume-control-pulse.vala
index 74ef015..d50056b 100644
--- a/src/volume-control-pulse.vala
+++ b/src/volume-control-pulse.vala
@@ -335,7 +335,7 @@ public class VolumeControlPulse : VolumeControl
/* Listen for role volume changes from pulse itself (external clients) */
try {
- var builder = new VariantBuilder (new VariantType ("ao"));
+ var builder = new VariantBuilder (VariantType.OBJECT_PATH_ARRAY);
builder.add ("o", sink_input_objp);
yield _pconn.call ("org.PulseAudio.Core1", "/org/pulseaudio/core1",
@@ -775,7 +775,7 @@ public class VolumeControlPulse : VolumeControl
/* AccountsService operations */
private void accountsservice_props_changed_cb (DBusProxy proxy, Variant changed_properties, string[]? invalidated_properties)
{
- Variant volume_variant = changed_properties.lookup_value ("Volume", new VariantType ("d"));
+ Variant volume_variant = changed_properties.lookup_value ("Volume", VariantType.DOUBLE);
if (volume_variant != null) {
var volume = volume_variant.get_double ();
if (volume >= 0) {
@@ -785,7 +785,7 @@ public class VolumeControlPulse : VolumeControl
}
}
- Variant mute_variant = changed_properties.lookup_value ("Muted", new VariantType ("b"));
+ Variant mute_variant = changed_properties.lookup_value ("Muted", VariantType.BOOLEAN);
if (mute_variant != null) {
var mute = mute_variant.get_boolean ();
set_mute_internal (mute);