This is how the window is constructed:
namespace App {
public class Window : Gtk.ApplicationWindow {
private Granite.ModeSwitch stick_switch;
public Window (Gtk.Application app) {
Object (
application: app,
icon_name: Constants.APP_ICON,
resizable: false
);
// There is more code below this
I want to access this window in another class. How do I do it??
When I initialize it within the constructor of another class using this: var main_window = new App.Window ();
, an error is displayed saying that it is missing arguments.
What and how do I need to provide the argument?
You have to pass an Gtk.Application to the construcor:
var main_window = new App.Window(new Gtk.Application("foo.your.app.name", Gtk.ApplicationFlags.FLAGS_NONE);
"foo.your.app.name" is the application ID.
Gtk.ApplicationFlags.FLAGS_NONE are some flags to specify the behavior of the application link, e.g. whether this application is a service or a launcher,....