From 5ac54873ead90d61cb09feb1427b28b0a8bc6b4c Mon Sep 17 00:00:00 2001 From: Lynnesbian Date: Sun, 24 Oct 2021 03:35:20 +1000 Subject: [PATCH] work about window, hoorey --- AboutDialogue.cs | 15 +++++++++++++++ MainWindow.cs | 34 +++++++++++++++++----------------- SettingsWindow.cs | 9 +++++++-- buypeeb.csproj | 17 +++++++++++++---- ui/about.glade | 44 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 96 insertions(+), 23 deletions(-) create mode 100644 AboutDialogue.cs create mode 100644 ui/about.glade diff --git a/AboutDialogue.cs b/AboutDialogue.cs new file mode 100644 index 0000000..3838953 --- /dev/null +++ b/AboutDialogue.cs @@ -0,0 +1,15 @@ +using Gtk; + +namespace Buypeeb { + public class AboutDialogue : AboutDialog { + public AboutDialogue() : this(new Builder("about.glade")) { } + + private AboutDialogue(Builder builder) : base(builder.GetObject("DialogueAbout").Handle) { + builder.Autoconnect(this); + } + + public void ButtonCloseClicked(object sender, Gtk.ResponseArgs args) { + Dispose(); + } + } +} diff --git a/MainWindow.cs b/MainWindow.cs index 93bc5d5..3bf7c74 100755 --- a/MainWindow.cs +++ b/MainWindow.cs @@ -416,11 +416,11 @@ namespace Buypeeb { /// private MessageDialog MsgBox(string message, ButtonsType buttonsType = ButtonsType.OkCancel) { var md = new MessageDialog( - parent_window: this, - flags: DialogFlags.DestroyWithParent | DialogFlags.Modal, - type: MessageType.Question, - bt: buttonsType, - format: message + this, + DialogFlags.DestroyWithParent | DialogFlags.Modal, + MessageType.Question, + buttonsType, + message ) {KeepAbove = true, Resizable = false, FocusOnMap = true, Title = "Buypeeb"}; return md; @@ -437,9 +437,9 @@ namespace Buypeeb { string title = "Buypeeb", string message = "Hi there!", string prefill = null ) { var ed = new Dialog( - title: title, - parent: this, - flags: DialogFlags.DestroyWithParent | DialogFlags.Modal, + title, + this, + DialogFlags.DestroyWithParent | DialogFlags.Modal, /* button_data: */ "Cancel", ResponseType.Cancel, "OK", ResponseType.Ok ) {DefaultResponse = ResponseType.Ok, KeepAbove = true}; @@ -597,9 +597,9 @@ namespace Buypeeb { private void ButtonOpenClicked(object sender, EventArgs a) { var od = new FileChooserDialog( - title: "Open userdata.json", - parent: this, - action: FileChooserAction.Open, + "Open userdata.json", + this, + FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept ); @@ -631,9 +631,9 @@ namespace Buypeeb { private void ButtonSaveAsClicked(object sender, EventArgs a) { var sd = new FileChooserDialog( - title: "Save userdata.json", - parent: this, - action: FileChooserAction.Save, + "Save userdata.json", + this, + FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Accept ) {CurrentName = "userdata.json"}; @@ -670,9 +670,9 @@ namespace Buypeeb { } var sd = new FileChooserDialog( - title: "Export watchlist as CSV", - parent: this, - action: FileChooserAction.Save, + "Export watchlist as CSV", + this, + FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Accept ) {CurrentName = "buypeeb.csv"}; diff --git a/SettingsWindow.cs b/SettingsWindow.cs index cc23989..3bde04f 100644 --- a/SettingsWindow.cs +++ b/SettingsWindow.cs @@ -19,8 +19,7 @@ namespace Buypeeb { private readonly List updateIntervalEntryNames = new() {"UpdateInterval", "UpdateIntervalCritical", "FavouriteUpdateInterval", "FavouriteUpdateIntervalCritical"}; - public SettingsWindow(Settings settings) : this(new Builder("settings.glade"), settings) { - } + public SettingsWindow(Settings settings) : this(new Builder("settings.glade"), settings) { } private SettingsWindow(Builder builder, Settings settings) : base(builder.GetObject("WindowSettings").Handle) { Title = "Buypeeb - Settings"; @@ -94,5 +93,11 @@ namespace Buypeeb { private void ButtonCancelClicked(object sender, EventArgs args) { Dispose(); } + + private void ButtonAboutClicked(object sender, EventArgs args) { + var win = new AboutDialogue(); + Application.AddWindow(win); + win.Show(); + } } } diff --git a/buypeeb.csproj b/buypeeb.csproj index 9d2d54c..63ea2e1 100755 --- a/buypeeb.csproj +++ b/buypeeb.csproj @@ -7,16 +7,25 @@ - + %(Filename)%(Extension) - + + + + + - - + + + + + + + diff --git a/ui/about.glade b/ui/about.glade new file mode 100644 index 0000000..07bb1bf --- /dev/null +++ b/ui/about.glade @@ -0,0 +1,44 @@ + + + + + + False + About Buypeeb + True + center-on-parent + True + dialog + Buypeeb + 1.0 + https://git.bune.city/lynnesbian/buypeeb-cs + Lynnesbian + image-loading + gpl-3-0-only + + + + -1 + False + center + center + vertical + 2 + + + False + end + + + False + False + 0 + + + + + + + + +