48 lines
1.4 KiB
Vala
48 lines
1.4 KiB
Vala
using Deskcandy.Candy;
|
|
|
|
namespace Deskcandy {
|
|
|
|
[GtkTemplate(ui = "/moe/solarpunk/Deskcandy/editor_page.ui")]
|
|
public class EditorPage : Gtk.Bin {
|
|
public signal void preset_type_changed(string type);
|
|
|
|
[GtkChild]
|
|
private unowned Gtk.Stack preset_type_stack;
|
|
|
|
private new unowned Window parent;
|
|
private ScreensaverForm screensaver_form;
|
|
private VideoForm video_form;
|
|
|
|
public EditorPage(Window parent) {
|
|
this.parent = parent;
|
|
|
|
this.screensaver_form = new ScreensaverForm();
|
|
this.preset_type_stack.add_titled(screensaver_form, "screensaver", "Screen Saver");
|
|
|
|
this.video_form = new VideoForm();
|
|
this.preset_type_stack.add_titled(video_form, "video", "Video");
|
|
}
|
|
|
|
public void on_initialized(BaseCandy[] candies) {
|
|
// TODO: clean this up
|
|
this.screensaver_form.on_initialized((XScreensaver)candies[0]);
|
|
this.video_form.on_initialized((Video)candies[1]);
|
|
}
|
|
|
|
[GtkCallback]
|
|
private void on_preset_type_stack_visible_child_name_notify(Object o, ParamSpec param) {
|
|
if (this.preset_type_stack.visible_child_name == null) {
|
|
return;
|
|
}
|
|
|
|
message(@"preset type: $(this.preset_type_stack.visible_child_name)");
|
|
preset_type_changed(this.preset_type_stack.visible_child_name);
|
|
}
|
|
|
|
[GtkCallback]
|
|
private void on_cancel_edit_preset_button_clicked(Gtk.Widget w) {
|
|
this.parent.main_stack.visible_child_name = "presets";
|
|
}
|
|
}
|
|
}
|