newgui: Set a window title and icon

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2013-03-24 19:52:06 -04:00 committed by Anna Schumaker
parent 5eb24ee04f
commit 3c60dbdbae
5 changed files with 29 additions and 2 deletions

View File

@ -17,7 +17,7 @@ env.ParseConfig('pkg-config --cflags --libs gtkmm-2.4')
extra_files = [
("newgui.xml", "../lib/ocarina/newgui.xml", copy),
# ("images/random.png", "../lib/ocarina/random.png", copy),
# ("images/ocarina.png", "../lib/ocarina/ocarina.png", copy),
("images/newgui.png", "../lib/ocarina/newgui.png", copy),
# ("images/thumbs_up.png", "../lib/ocarina/thumbs_up.png", copy),
# ("images/thumbs_down.png", "../lib/ocarina/thumbs_down.png", copy),
# ("scripts/ocarina", "../bin/ocarina", script),

BIN
newgui/images/newgui.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -27,13 +27,20 @@ string lib_file(const string &file)
return res;
}
void init(int argc, char **argv)
Glib::RefPtr<Gtk::Builder> get_builder()
{
return builder;
}
static void init(int argc, char **argv)
{
Gtk::Window *window;
Gtk::Main app(argc, argv);
builder = Gtk::Builder::create_from_file(lib_file("newgui.xml"));
builder->get_widget("Ocarina", window);
init_window();
gtk_builder_connect_signals(builder->gobj(), NULL);
Gtk::Main::run(*window);

View File

@ -1,6 +1,14 @@
// Copyright (c) 2013 Bryan Schumaker
#ifndef OCARINA_H
#define OCARINA_H
#include <gtkmm.h>
// ocarina.cpp
string lib_file(const string &);
Glib::RefPtr<Gtk::Builder> get_builder();
// window.cpp
void init_window();
#endif

12
newgui/window.cpp Normal file
View File

@ -0,0 +1,12 @@
// Copyright (c) 2013 Bryan Schumaker
#include <version.h>
#include "ocarina.h"
void init_window()
{
Gtk::Window *window;
get_builder()->get_widget("Ocarina", window);
window->set_title("Ocarina " + vers_str());
window->set_icon_from_file(lib_file("newgui.png"));
}