2020-08-31 14:02:41 +00:00
|
|
|
/*
|
|
|
|
buypeeb - a program to track yahoo jp auctions of peebus.
|
|
|
|
Copyright (C) 2020 lynnesbian
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2020-08-28 16:04:37 +00:00
|
|
|
using System;
|
|
|
|
using Gtk;
|
|
|
|
using UI = Gtk.Builder.ObjectAttribute;
|
|
|
|
|
|
|
|
namespace Buypeeb {
|
2020-08-31 14:20:56 +00:00
|
|
|
enum ItemColumns {
|
|
|
|
Name,
|
|
|
|
PriceYen,
|
|
|
|
PriceAUD,
|
|
|
|
Ending,
|
|
|
|
Id
|
|
|
|
}
|
|
|
|
|
2020-08-28 16:04:37 +00:00
|
|
|
class MainWindow : Window {
|
2020-08-31 14:20:56 +00:00
|
|
|
|
|
|
|
private ListStore Items;
|
|
|
|
|
2020-08-28 16:04:37 +00:00
|
|
|
public MainWindow() : this(new Builder("ui.glade")) { }
|
|
|
|
|
|
|
|
private MainWindow(Builder builder) : base(builder.GetObject("wndMain").Handle) {
|
2020-08-31 14:20:56 +00:00
|
|
|
this.Title = "Buypeeb";
|
2020-08-28 16:04:37 +00:00
|
|
|
builder.Autoconnect(this);
|
2020-08-31 14:20:56 +00:00
|
|
|
this.Items = (ListStore)builder.GetObject("ListItems");
|
|
|
|
foreach (object[] row in this.Items) {
|
|
|
|
Console.WriteLine(row[(int)ItemColumns.Name]);
|
|
|
|
}
|
2020-08-28 16:04:37 +00:00
|
|
|
DeleteEvent += Window_Shutdown;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Window_Shutdown(object sender, DeleteEventArgs args) {
|
|
|
|
Application.Quit();
|
|
|
|
}
|
|
|
|
|
2020-08-28 16:58:14 +00:00
|
|
|
// convenience functions
|
|
|
|
|
|
|
|
private (Boolean accepted, string response) EntryDialogue(string title = "Buypeeb", string message = "Hi there!") {
|
|
|
|
Dialog ed = new Dialog(title, null, Gtk.DialogFlags.DestroyWithParent, "Cancel", ResponseType.Cancel, "OK", ResponseType.Ok);
|
2020-08-31 14:34:31 +00:00
|
|
|
ed.DefaultResponse = ResponseType.Ok;
|
2020-08-28 16:58:14 +00:00
|
|
|
|
|
|
|
Label edLabel = new Label(message);
|
|
|
|
Entry edEntry = new Entry();
|
2020-08-31 14:34:31 +00:00
|
|
|
edEntry.ActivatesDefault = true;
|
2020-08-28 16:58:14 +00:00
|
|
|
|
|
|
|
ed.ContentArea.PackStart(edLabel, true, true, 2);
|
|
|
|
edLabel.Show();
|
|
|
|
ed.ContentArea.PackStart(edEntry, true, true, 10);
|
|
|
|
edEntry.Show();
|
|
|
|
|
|
|
|
// TODO: pressing enter should submit the form
|
|
|
|
|
|
|
|
ResponseType accepted = (ResponseType)ed.Run();
|
|
|
|
string response = edEntry.Text;
|
|
|
|
ed.Destroy();
|
|
|
|
return (accepted == ResponseType.Ok, response);
|
|
|
|
}
|
|
|
|
|
2020-08-28 16:04:37 +00:00
|
|
|
// button handlers
|
|
|
|
|
|
|
|
private void ButtonAddClicked(object sender, EventArgs a) {
|
|
|
|
Console.WriteLine("ButtonAddClicked");
|
2020-08-28 16:58:14 +00:00
|
|
|
var EntryResponse = EntryDialogue();
|
|
|
|
Console.WriteLine(EntryResponse.response);
|
2020-08-28 16:04:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void ButtonUpdateAllClicked(object sender, EventArgs a) {
|
|
|
|
Console.WriteLine("ButtonUpdateAllClicked");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ButtonClearEndedClicked(object sender, EventArgs a) {
|
|
|
|
Console.WriteLine("ButtonClearEndedClicked");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ButtonClearAllClicked(object sender, EventArgs a) {
|
|
|
|
Console.WriteLine("ButtonClearAllClicked");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ButtonSaveClicked(object sender, EventArgs a) {
|
|
|
|
Console.WriteLine("ButtonSaveClicked");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ButtonQuitClicked(object sender, EventArgs a) {
|
|
|
|
MessageDialog md = new MessageDialog(null, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.OkCancel, "Are you sure you want to quit?");
|
|
|
|
ResponseType response = (ResponseType)md.Run();
|
|
|
|
md.Destroy();
|
|
|
|
if (response == ResponseType.Ok) {
|
|
|
|
Application.Quit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void tveItemsSelectionChanged(object sender, EventArgs a) {
|
|
|
|
Console.WriteLine("tveItemsSelectionChanged");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ButtonViewBuyeeClicked(object sender, EventArgs a) {
|
|
|
|
Console.WriteLine("ButtonViewBuyeeClicked");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ButtonViewYahooClicked(object sender, EventArgs a) {
|
|
|
|
Console.WriteLine("ButtonViewYahooClicked");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ButtonSelectedRemoveClicked(object sender, EventArgs a) {
|
|
|
|
Console.WriteLine("ButtonSelectedRemoveClicked");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ButtonSelectedRenameClicked(object sender, EventArgs a) {
|
|
|
|
Console.WriteLine("ButtonSelectedRenameClicked");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|