From 4823b3c35b8e8c1334ad947286abf0d88b6de701 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 14 Jul 2010 23:36:29 +0100 Subject: positionset now working - tested with vlc --- src/familiar-players-db.vala | 18 ++++++++++-------- src/mpris-controller.vala | 11 +++++------ src/sound-service.c | 4 ++-- 3 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src') 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 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; } -- cgit v1.2.3