Source

lrc / src / gui / lrcResourceEditor.cxx

/*
 * lrcResourceEditor.cxx
 *
 * Copyright 2012 Andreas Tscharner <andy@vis.ethz.ch>
 *
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */


#include <gtkmm/application.h>
#include <gtkmm/builder.h>
#include <gtkmm/window.h>
#include <glibmm/fileutils.h>
#include <glibmm/markup.h>
#include <iostream>
#include "MainWindow.hxx"

int main(int argc, char **argv)
{
	Glib::RefPtr<Gtk::Application> mainApp;
	Glib::RefPtr<Gtk::Builder> builder;
	Gtk::Window *mainWin = nullptr;
	MainWindow *mainWinTasks;


	mainApp = Gtk::Application::create(argc, argv, "ch.blackmoon.lrcResEdit");
	try {
		builder = Gtk::Builder::create_from_file("ResourceEditor.glade");
	} catch (const Glib::FileError &fErr) {
		std::cout << "Loading the ResourceEditor.glade failed with a FileError: " << fErr.what() << std::endl;
		return -1;
	} catch (const Glib::MarkupError &mErr) {
		std::cout << "Loading the ResourceEditor.glade failed with a MarkupError: " << mErr.what() << std::endl;
		return -1;
	} catch (const Gtk::BuilderError &bErr) {
		std::cout << "Loading the ResourceEditor.glade failed with a BuilderError: " << bErr.what() << std::endl;
		return -1;
	};

	builder->get_widget("MainWindow", mainWin);
	mainWinTasks = new MainWindow(mainWin, builder);

	mainApp->run(*mainWin);

	delete mainWinTasks;
	delete mainWin;

	return 0;
}