Main.vala 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Gtk;
  2. using GLib;
  3. namespace Debins {
  4. public class App : Gtk.Application {
  5. public App() {
  6. Object(
  7. application_id: "com.eminfedar.debins",
  8. flags: ApplicationFlags.HANDLES_OPEN
  9. );
  10. }
  11. protected override void activate() {
  12. var window = new MainWindow(this, null);
  13. window.show_all();
  14. }
  15. protected override void open(File[] files, string hint) {
  16. if( files.length == 1 && files[0].query_exists() ) {
  17. string[] tagSplit = files[0].get_basename().split(".");
  18. string tag = tagSplit[tagSplit.length-1];
  19. if ( tag == "kur" ) {
  20. var packageManager = new PackageManager(files[0]);
  21. //if (packageManager.isValid) {
  22. var window = new MainWindow(this, packageManager);
  23. window.show_all();
  24. //}
  25. } else {
  26. stderr.printf("Sadece .kur dosyası.\n");
  27. Process.exit(1);
  28. }
  29. }
  30. }
  31. }
  32. public static int main(string[] args) {
  33. var app = new App();
  34. return app.run(args);
  35. }
  36. }