work about window, hoorey

This commit is contained in:
Lynne Megido 2021-10-24 03:35:20 +10:00
parent 5298a97c18
commit 5ac54873ea
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
5 changed files with 96 additions and 23 deletions

15
AboutDialogue.cs Normal file
View file

@ -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();
}
}
}

View file

@ -416,11 +416,11 @@ namespace Buypeeb {
/// <returns></returns> /// <returns></returns>
private MessageDialog MsgBox(string message, ButtonsType buttonsType = ButtonsType.OkCancel) { private MessageDialog MsgBox(string message, ButtonsType buttonsType = ButtonsType.OkCancel) {
var md = new MessageDialog( var md = new MessageDialog(
parent_window: this, this,
flags: DialogFlags.DestroyWithParent | DialogFlags.Modal, DialogFlags.DestroyWithParent | DialogFlags.Modal,
type: MessageType.Question, MessageType.Question,
bt: buttonsType, buttonsType,
format: message message
) {KeepAbove = true, Resizable = false, FocusOnMap = true, Title = "Buypeeb"}; ) {KeepAbove = true, Resizable = false, FocusOnMap = true, Title = "Buypeeb"};
return md; return md;
@ -437,9 +437,9 @@ namespace Buypeeb {
string title = "Buypeeb", string message = "Hi there!", string prefill = null string title = "Buypeeb", string message = "Hi there!", string prefill = null
) { ) {
var ed = new Dialog( var ed = new Dialog(
title: title, title,
parent: this, this,
flags: DialogFlags.DestroyWithParent | DialogFlags.Modal, DialogFlags.DestroyWithParent | DialogFlags.Modal,
/* button_data: */ "Cancel", ResponseType.Cancel, "OK", ResponseType.Ok /* button_data: */ "Cancel", ResponseType.Cancel, "OK", ResponseType.Ok
) {DefaultResponse = ResponseType.Ok, KeepAbove = true}; ) {DefaultResponse = ResponseType.Ok, KeepAbove = true};
@ -597,9 +597,9 @@ namespace Buypeeb {
private void ButtonOpenClicked(object sender, EventArgs a) { private void ButtonOpenClicked(object sender, EventArgs a) {
var od = new FileChooserDialog( var od = new FileChooserDialog(
title: "Open userdata.json", "Open userdata.json",
parent: this, this,
action: FileChooserAction.Open, FileChooserAction.Open,
"Cancel", ResponseType.Cancel, "Open", ResponseType.Accept "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept
); );
@ -631,9 +631,9 @@ namespace Buypeeb {
private void ButtonSaveAsClicked(object sender, EventArgs a) { private void ButtonSaveAsClicked(object sender, EventArgs a) {
var sd = new FileChooserDialog( var sd = new FileChooserDialog(
title: "Save userdata.json", "Save userdata.json",
parent: this, this,
action: FileChooserAction.Save, FileChooserAction.Save,
"Cancel", ResponseType.Cancel, "Save", ResponseType.Accept "Cancel", ResponseType.Cancel, "Save", ResponseType.Accept
) {CurrentName = "userdata.json"}; ) {CurrentName = "userdata.json"};
@ -670,9 +670,9 @@ namespace Buypeeb {
} }
var sd = new FileChooserDialog( var sd = new FileChooserDialog(
title: "Export watchlist as CSV", "Export watchlist as CSV",
parent: this, this,
action: FileChooserAction.Save, FileChooserAction.Save,
"Cancel", ResponseType.Cancel, "Save", ResponseType.Accept "Cancel", ResponseType.Cancel, "Save", ResponseType.Accept
) {CurrentName = "buypeeb.csv"}; ) {CurrentName = "buypeeb.csv"};

View file

@ -19,8 +19,7 @@ namespace Buypeeb {
private readonly List<string> updateIntervalEntryNames = new() private readonly List<string> updateIntervalEntryNames = new()
{"UpdateInterval", "UpdateIntervalCritical", "FavouriteUpdateInterval", "FavouriteUpdateIntervalCritical"}; {"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) { private SettingsWindow(Builder builder, Settings settings) : base(builder.GetObject("WindowSettings").Handle) {
Title = "Buypeeb - Settings"; Title = "Buypeeb - Settings";
@ -94,5 +93,11 @@ namespace Buypeeb {
private void ButtonCancelClicked(object sender, EventArgs args) { private void ButtonCancelClicked(object sender, EventArgs args) {
Dispose(); Dispose();
} }
private void ButtonAboutClicked(object sender, EventArgs args) {
var win = new AboutDialogue();
Application.AddWindow(win);
win.Show();
}
} }
} }

View file

@ -12,6 +12,10 @@
<LogicalName>%(Filename)%(Extension)</LogicalName> <LogicalName>%(Filename)%(Extension)</LogicalName>
</EmbeddedResource> </EmbeddedResource>
<None Remove="yahoo.html" /> <None Remove="yahoo.html" />
<EmbeddedResource Remove="obj\**" />
<None Remove="obj\**" />
<EmbeddedResource Remove="out\**" />
<None Remove="out\**" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -19,4 +23,9 @@
<PackageReference Include="GtkSharp" Version="3.24.24.34" /> <PackageReference Include="GtkSharp" Version="3.24.24.34" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Remove="obj\**" />
<Compile Remove="out\**" />
</ItemGroup>
</Project> </Project>

44
ui/about.glade Normal file
View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkAboutDialog" id="DialogueAbout">
<property name="can-focus">False</property>
<property name="title" translatable="yes">About Buypeeb</property>
<property name="modal">True</property>
<property name="window-position">center-on-parent</property>
<property name="destroy-with-parent">True</property>
<property name="type-hint">dialog</property>
<property name="program-name">Buypeeb</property>
<property name="version">1.0</property>
<property name="website">https://git.bune.city/lynnesbian/buypeeb-cs</property>
<property name="authors">Lynnesbian</property>
<property name="logo-icon-name">image-loading</property>
<property name="license-type">gpl-3-0-only</property>
<signal name="response" handler="ButtonCloseClicked" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox">
<property name="width-request">-1</property>
<property name="can-focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</interface>