App.vala 849 B

12345678910111213141516171819202122232425262728293031323334
  1. using Gtk;
  2. namespace PpubViewer {
  3. public class PpubViewerApplication : Adw.Application {
  4. public PpubViewerApplication() {
  5. Object(application_id: "com.pcthingz.ppub.viewer", flags: GLib.ApplicationFlags.HANDLES_OPEN);
  6. }
  7. protected override void activate () {
  8. var window = new ViewerWindow(this);
  9. window.present ();
  10. }
  11. protected override void open (File[] files, string hint) {
  12. foreach (var file in files) {
  13. var window = new ViewerWindow(this);
  14. window.present ();
  15. window.load_ppub (file);
  16. }
  17. }
  18. }
  19. int main (string[] argv) {
  20. // Create a new application
  21. Gst.init (ref argv);
  22. var app = new PpubViewerApplication();
  23. return app.run (argv);
  24. }
  25. }