diff --git a/src/application.vala b/src/application.vala
index e8c9e40..98c6528 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -2,7 +2,7 @@ using Deskcandy.Candy;
namespace Deskcandy {
public class Application : Gtk.Application {
- public signal void initialized(BaseCandy candy);
+ public signal void initialized(BaseCandy[] candies);
private Gtk.Window window;
private Gtk.Window desktop_window;
@@ -23,10 +23,14 @@ namespace Deskcandy {
private async void initialize_async() {
foreach (var candy in this._candies) {
- yield candy.initialize();
+ try {
+ yield candy.initialize();
+ } catch (Error e) {
+ error(@"Failed to load candy: $(e.message)");
+ }
}
- initialized(this._candies[1]);
+ initialized(this._candies);
}
private void on_toggle_enabled() {
diff --git a/src/candy/base.vala b/src/candy/base.vala
index 37335c6..fa5ef46 100644
--- a/src/candy/base.vala
+++ b/src/candy/base.vala
@@ -5,6 +5,6 @@ namespace Deskcandy.Candy {
public abstract async void initialize() throws Error;
- public abstract Subprocess launch(uint socket_id) throws Error;
+ public abstract Subprocess launch(uint socket_id, string path) throws Error;
}
}
diff --git a/src/candy/video.vala b/src/candy/video.vala
index 28335f1..2c18f47 100644
--- a/src/candy/video.vala
+++ b/src/candy/video.vala
@@ -6,9 +6,9 @@ namespace Deskcandy.Candy {
public override async void initialize() throws Error {
}
- public override Subprocess launch(uint socket_id) throws Error {
+ public override Subprocess launch(uint socket_id, string path) throws Error {
message("Launching mpv video...");
- return new Subprocess(SubprocessFlags.NONE, "mpv", @"--wid=$socket_id", "--no-audio", "--video-unscaled=downscale-big", "--video-zoom=20", "/home/vv/Videos/Spring_-_Blender_Open_Movie.webm");
+ return new Subprocess(SubprocessFlags.NONE, "mpv", @"--wid=$socket_id", "--no-audio", "--video-unscaled=downscale-big", "--video-zoom=20", path);
}
}
}
diff --git a/src/candy/xscreensaver.vala b/src/candy/xscreensaver.vala
index 3491ee1..ccc62a7 100644
--- a/src/candy/xscreensaver.vala
+++ b/src/candy/xscreensaver.vala
@@ -17,20 +17,20 @@ namespace Deskcandy.Candy {
FileInfo info;
message(@"Parsing configs in $(this.config_path)");
while ((info = enumerator.next_file()) != null) {
- if (!info.get_name().has_suffix(".xml")) {
+ var name = info.get_name();
+ if (!name.has_suffix(".xml")) {
continue;
}
- var name = info.get_name();
- var config = new XScreensaverConfig(config_dir.resolve_relative_path(info.get_name()));
+ var config = yield new XScreensaverConfig(config_dir.resolve_relative_path(name));
this.configs.append(config);
}
message(@"Found $(this.configs.length()) screensavers.");
}
- public override Subprocess launch(uint socket_id) throws Error {
+ public override Subprocess launch(uint socket_id, string saver) throws Error {
message("Launching XScreensaver...");
- return new Subprocess(SubprocessFlags.NONE, @"$(this.saver_path)/abstractile", "-window-id", socket_id.to_string());
+ return new Subprocess(SubprocessFlags.NONE, @"$(this.saver_path)/$saver", "-window-id", socket_id.to_string());
}
private async void hacky_determine_directories() {
diff --git a/src/candy/xscreensaver_config.vala b/src/candy/xscreensaver_config.vala
index 39fe3ad..222802c 100644
--- a/src/candy/xscreensaver_config.vala
+++ b/src/candy/xscreensaver_config.vala
@@ -9,22 +9,24 @@ namespace Deskcandy.Candy {
[Description(nick="::gl")]
public string gl { get; set; }
+ public string description { get; set; }
public string arg { get; set;}
- [Description(nick="::_description")]
- public string description { get; set; }
-
- public XScreensaverConfig(File file) throws Error {
+ public async XScreensaverConfig(File file) throws Error {
this.initialize("screensaver");
- this.read_from_file(file);
+
+ yield this.read_from_file_async(file);
var tag = this.get_child("command");
this.arg = tag.get_attribute("arg");
- debug(@"Loaded $this");
+
+ tag = this.get_child("_description");
+ this.description = tag.text_content.strip();
+ message(@"Loaded $this");
}
public string to_string() {
- return @"Screensaver: $(this.label) [$(this.name) $(this.arg)]";
+ return @"Screensaver: $(this.label) [$(this.name)]";
}
}
}
diff --git a/src/desktop_window.vala b/src/desktop_window.vala
index b131dbb..3f7151d 100644
--- a/src/desktop_window.vala
+++ b/src/desktop_window.vala
@@ -27,15 +27,15 @@ namespace Deskcandy {
this.add(this.socket);
try {
- this.proc = candy.launch((uint)this.socket.get_id());
+ this.proc = candy.launch((uint)this.socket.get_id(), "abstractile");
} catch (Error e) {
error(e.message);
}
}
- private void on_initialized(BaseCandy candy) {
+ private void on_initialized(BaseCandy[] candies) {
this.present();
- this.refresh_socket(candy);
+ //this.refresh_socket(candy);
}
}
}
diff --git a/src/window.ui b/src/window.ui
index cdf26bd..0b2e74d 100644
--- a/src/window.ui
+++ b/src/window.ui
@@ -214,15 +214,18 @@
@@ -271,55 +274,59 @@
-