Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
- /*
- * main.c
- * Copyright (C) Taylor Copeland 2011 <taylor@taylorcopeland.com>
- *
- open-imagination-vala 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.
- *
- * open-imagination-vala 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 <http://www.gnu.org/licenses/>.
- */
- using GLib;
- using Gtk;
- public class Main : Object
- {
- /*
- * Uncomment this line when you are done testing and building a tarball
- * or installing
- */
- //const string UI_FILE = Config.PACKAGE_DATA_DIR + "/" + "open_imagination_vala.ui";
- //const string UI_FILE = "src/open_imagination_vala.ui";
- public Main ()
- {
- /*try
- {
- var builder = new Builder ();
- builder.add_from_file (UI_FILE);
- builder.connect_signals (this);
- var window = builder.get_object ("window") as Window;
- window.show_all ();
- }
- catch (Error e) {
- stderr.printf ("Could not load UI: %s\n", e.message);
- }*/
- var window = new Gtk.Window ();
- window.set_size_request (320, 256);
- window.title = "Open Imagination";
- window.destroy.connect (Gtk.main_quit);
- var mainMenuBar = new Gtk.MenuBar ();
- var fileMenu = new Gtk.Menu ();
- var open_item = new Gtk.MenuItem.with_mnemonic ("_Open");
- var quit_item = new Gtk.MenuItem.with_mnemonic ("_Quit");
- fileMenu.append (open_item);
- fileMenu.append (quit_item);
- quit_item.select.connect (Gtk.main_quit);
- var file_launcher = new MenuItem.with_mnemonic ("_File");
- file_launcher.set_submenu (fileMenu);
- mainMenuBar.append (file_launcher);
- var mainToolbar = new Gtk.Toolbar ();
- var quitToolButton = new Gtk.ToolButton (new Gtk.Label ("Quit"), "Quit");
- quitToolButton.clicked.connect (Gtk.main_quit);
- mainToolbar.add (quitToolButton);
- window.add (mainMenuBar);
- window.add (mainToolbar);
- window.show_all ();
- }
- [CCode (instance_pos = -1)]
- public void on_destroy (Widget window)
- {
- Gtk.main_quit();
- }
- static int main (string[] args)
- {
- Gtk.init (ref args);
- var app = new Main ();
- Gtk.main ();
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement