aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-07-14 23:36:29 +0100
committerConor Curran <conor.curran@canonical.com>2010-07-14 23:36:29 +0100
commit4823b3c35b8e8c1334ad947286abf0d88b6de701 (patch)
tree9b5115bcc4e50e744467afa4f497f6199634730b
parentbf4f73249f5b6bf4c9196f251382c5a6cec9634f (diff)
downloadayatana-indicator-sound-4823b3c35b8e8c1334ad947286abf0d88b6de701.tar.gz
ayatana-indicator-sound-4823b3c35b8e8c1334ad947286abf0d88b6de701.tar.bz2
ayatana-indicator-sound-4823b3c35b8e8c1334ad947286abf0d88b6de701.zip
positionset now working - tested with vlc
-rw-r--r--src/familiar-players-db.vala18
-rw-r--r--src/mpris-controller.vala11
-rw-r--r--src/sound-service.c4
3 files changed, 17 insertions, 16 deletions
diff --git a/src/familiar-players-db.vala b/src/familiar-players-db.vala
index b83caa3..2bc0a3c 100644
--- a/src/familiar-players-db.vala
+++ b/src/familiar-players-db.vala
@@ -51,18 +51,20 @@ public class FamiliarPlayersDB : GLib.Object
}
private bool create_key_file(){
+ bool result = false;
if (test(this.file_name, GLib.FileTest.EXISTS)) {
this.key_file = new KeyFile();
try{
- if (this.key_file.load_from_file(this.file_name, KeyFileFlags.NONE) == true) {
- return true;
- }
+ result = this.key_file.load_from_file(this.file_name, KeyFileFlags.NONE);
}
- catch(FileError e){
- warning("FamiliarPlayersDB - error trying to load KeyFile");
+ catch(GLib.KeyFileError e){
+ warning("FamiliarPlayersDB::create_key_file() - KeyFileError");
}
+ catch(GLib.FileError e){
+ warning("FamiliarPlayersDB::create_key_file() - FileError");
+ }
}
- return false;
+ return result;
}
private bool check_for_keys(){
@@ -87,7 +89,7 @@ public class FamiliarPlayersDB : GLib.Object
}
return true;
}
- catch(FileError error){
+ catch(GLib.KeyFileError error){
warning("Error loading the Desktop string list");
return false;
}
@@ -108,7 +110,7 @@ public class FamiliarPlayersDB : GLib.Object
try{
data = keyfile.to_data(out data_length);
}
- catch(Error e){
+ catch(GLib.KeyFileError e){
warning("Problems dumping keyfile to a string");
return false;
}
diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala
index afe9190..f40614c 100644
--- a/src/mpris-controller.vala
+++ b/src/mpris-controller.vala
@@ -26,8 +26,6 @@ public class MprisController : GLib.Object
public dynamic DBus.Object mpris_player{get; construct;}
public PlayerController owner {get; construct;}
public string mpris_interface {get; construct;}
- private string name;
-
struct status {
public int32 playback;
@@ -99,17 +97,18 @@ public class MprisController : GLib.Object
public void set_position(double position)
{
- debug("Set position with pos (0-100) %f", position);
+ //debug("Set position with pos (0-100) %f", position);
HashTable<string, Value?> data = this.mpris_player.GetMetadata();
Value? time_value = data.lookup("time");
if(time_value == null){
warning("Can't fetch the duration of the track therefore cant set the position");
return;
}
- uint32 total_time = time_value.get_uint32();
- debug("total time of track = %i", (int)total_time);
+ uint32 total_time = time_value.get_uint();
+ //debug("total time of track = %i", (int)total_time);
double new_time_position = total_time * position/100.0;
- this.mpris_player.SetPosition((int)(new_time_position * 1000));
+ //debug("new position = %f", (new_time_position * 1000));
+ this.mpris_player.PositionSet((int32)(new_time_position * 1000));
}
public bool connected()
diff --git a/src/sound-service.c b/src/sound-service.c
index a5f3941..8f4e941 100644
--- a/src/sound-service.c
+++ b/src/sound-service.c
@@ -43,8 +43,8 @@ service_shutdown (IndicatorService *service, gpointer user_data)
if (mainloop != NULL) {
g_debug("Service shutdown !");
// TODO: uncomment for release !!
- //close_pulse_activites();
- //g_main_loop_quit(mainloop);
+ close_pulse_activites();
+ g_main_loop_quit(mainloop);
}
return;
}