mirror of
https://github.com/alexkay/spek.git
synced 2025-04-22 11:20:31 +03:00
Add toolbar to the main window.
This commit is contained in:
parent
6f41cc29e2
commit
e86cd8b111
@ -1,7 +1,8 @@
|
||||
bin_PROGRAMS = spek
|
||||
|
||||
spek_SOURCES = \
|
||||
spek.vala
|
||||
spek.vala \
|
||||
spek-window.vala
|
||||
|
||||
INCLUDES = \
|
||||
-include config.h \
|
||||
|
35
src/spek-window.vala
Normal file
35
src/spek-window.vala
Normal file
@ -0,0 +1,35 @@
|
||||
using Gtk;
|
||||
|
||||
namespace Spek {
|
||||
public class Window : Gtk.Window {
|
||||
|
||||
public Window () {
|
||||
this.title = "Spek";
|
||||
this.set_default_size (300, 200);
|
||||
|
||||
var toolbar = new Toolbar ();
|
||||
var open = new ToolButton.from_stock (STOCK_OPEN);
|
||||
open.clicked.connect (on_open_clicked);
|
||||
toolbar.insert (open, -1);
|
||||
var quit = new ToolButton.from_stock (STOCK_QUIT);
|
||||
quit.clicked.connect (s => this.destroy());
|
||||
toolbar.insert (quit, -1);
|
||||
|
||||
var vbox = new VBox (false, 0);
|
||||
vbox.pack_start (toolbar, false, true, 0);
|
||||
this.add (vbox);
|
||||
this.show_all ();
|
||||
}
|
||||
|
||||
private void on_open_clicked () {
|
||||
var chooser = new FileChooserDialog (
|
||||
_ ("Open File"), this, FileChooserAction.OPEN,
|
||||
STOCK_CANCEL, ResponseType.CANCEL,
|
||||
STOCK_OPEN, ResponseType.ACCEPT, null);
|
||||
if (chooser.run () == ResponseType.ACCEPT) {
|
||||
// TODO
|
||||
}
|
||||
chooser.destroy ();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,15 @@
|
||||
public class Main {
|
||||
public static int main (string[] args) {
|
||||
Intl.bindtextdomain( Config.GETTEXT_PACKAGE, Config.LOCALEDIR );
|
||||
Intl.bind_textdomain_codeset( Config.GETTEXT_PACKAGE, "UTF-8" );
|
||||
Intl.textdomain( Config.GETTEXT_PACKAGE );
|
||||
using Spek;
|
||||
|
||||
Gtk.init (ref args);
|
||||
int main (string[] args) {
|
||||
Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
|
||||
Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
|
||||
Intl.textdomain (Config.GETTEXT_PACKAGE);
|
||||
|
||||
var window = new Gtk.Window (Gtk.WindowType.TOPLEVEL);
|
||||
window.set_default_size (300, 200);
|
||||
window.destroy += Gtk.main_quit;
|
||||
window.add (new Gtk.Label ("Hello World!"));
|
||||
window.show_all ();
|
||||
Gtk.init (ref args);
|
||||
|
||||
Gtk.main ();
|
||||
return 0;
|
||||
}
|
||||
var window = new Spek.Window ();
|
||||
window.destroy.connect (Gtk.main_quit);
|
||||
|
||||
Gtk.main ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user