ProjectDialog.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using Gtk;
  3. namespace starter
  4. {
  5. public partial class ProjectDialog : Gtk.Dialog
  6. {
  7. MainWindow win;
  8. public ProjectDialog (MainWindow win)
  9. {
  10. this.Build ();
  11. this.win = win;
  12. }
  13. protected void OnProjectDialogOkClicked (object sender, EventArgs e)
  14. {
  15. win.project_name = name_entry.Text;
  16. win.source_path = source_entry.Text;
  17. win.destination_path = destination_entry.Text;
  18. }
  19. protected void OnSourceButtonClicked (object sender, EventArgs e)
  20. {
  21. Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the file to open",
  22. this.win,
  23. FileChooserAction.SelectFolder,
  24. "Cancel", ResponseType.Cancel,
  25. "Open", ResponseType.Accept);
  26. if (fc.Run () == (int)ResponseType.Accept)
  27. {
  28. source_entry.Text = fc.Filename;
  29. }
  30. fc.Destroy ();
  31. }
  32. protected void OnDestinationButtonClicked (object sender, EventArgs e)
  33. {
  34. Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the file to open",
  35. this,
  36. FileChooserAction.SelectFolder,
  37. "Cancel", ResponseType.Cancel,
  38. "Open", ResponseType.Accept);
  39. if (fc.Run () == (int)ResponseType.Accept)
  40. {
  41. destination_entry.Text = fc.Filename;
  42. }
  43. fc.Destroy ();
  44. }
  45. }
  46. }