deskcandy/src/desktop_window.vala

44 lines
1.1 KiB
Vala

using Deskcandy.Candy;
namespace Deskcandy {
[GtkTemplate(ui = "/moe/solarpunk/Deskcandy/desktop_window.ui")]
public class DesktopWindow : Gtk.Window {
private Gtk.Socket socket;
private Subprocess proc;
public DesktopWindow(Application app) {
Object(application: app);
Gdk.Rectangle rect = this.get_display().get_primary_monitor().get_geometry();
this.set_default_size(rect.width, rect.height);
this.set_keep_below(true);
app.initialized.connect(this.on_initialized);
}
public void refresh_socket(BaseCandy candy) {
if (this.socket != null) {
this.remove(this.socket);
this.proc.send_signal(15);
}
this.socket = new Gtk.Socket();
this.add(this.socket);
this.socket.visible = true;
this.visible = true;
try {
//this.proc = candy.launch((uint)this.socket.get_id());
} catch (Error e) {
error(e.message);
}
}
private void on_initialized(BaseCandy[] candies) {
this.present();
this.refresh_socket(candies[0]);
}
}
}