Replies: 2 comments 3 replies
-
|
The reason you have to specify it is because it conflicts between gio.application and gtk.application right? So you should be able to do something like this if you want to create an alias for it: import gio.application : ApplicationGio = Application; |
Beta Was this translation helpful? Give feedback.
-
|
@dejlek I just committed a re-write of the SignalWriter to generate signal connect templates which use constraints. This allows for the ability to use derived object types in callbacks and I also made it to where all callback arguments are optional. So if you don't need any of them, because all of the needed variables are available in the delegate context, you can just have no parameters. Or as many parameters in sequence as are useful. For this reason it seems like it was a good idea to have the object parameter be the last one, since it is rarely needed. Here is an example of using a variable number of callback arguments: columnView.connectActivate(&onColumnViewActivate);
columnView.connectActivate((uint pos) { writeln("pos: ", pos); });
columnView.connectActivate(() { writeln("activate!"); });
private void onColumnViewActivate(uint position, ColumnView columnView)
{
/* ... */
}Here is an example of using a child derived type (though the import std.stdio;
import gio.types; // ApplicationFlags
import gtk.application_window;
import gtk.label; // Label
import gtk.box;
import gtk.types; // Orientation
import adw.application; // Application
int main() {
auto app = new Application("org.lekic.gid-examples.adw1.Mini", ApplicationFlags.DefaultFlags);
app.connectActivate((Application appArg) {
auto label = new Label("Hello World!");
auto box = new Box(Orientation.Vertical, 4);
box.append(label);
with (new ApplicationWindow(appArg)) {
setTitle("Hello");
setDefaultSize(200, 200);
setChild(box);
self.present;
}
});
return app.run();
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
After the 0.9.4 i had to modify all handlers and explicitly use gio.application.Application type in them. Example:
void onActivate(gio.application.Application app)even though it is a method of gtk.application.Application! I wonder what can we do to reduce writing this boilerplate?Luckily it is not many that need this, so I can live with that for now. :)
Beta Was this translation helpful? Give feedback.
All reactions