Source

lrc / src / gui / lrcResourceEditor.cxx

Diff from to

File src/gui/lrcResourceEditor.cxx

  */
 
 
-#include <libglademm/xml.h>
-#include <gtkmm/main.h>
+#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<Gnome::Glade::Xml> xmlRef;
+	Glib::RefPtr<Gtk::Application> mainApp;
+	Glib::RefPtr<Gtk::Builder> builder;
 	Gtk::Window *mainWin = nullptr;
 	MainWindow *mainWinTasks;
 
 
-	Gtk::Main mainPrg(argc, argv);
-
+	mainApp = Gtk::Application::create(argc, argv, "ch.blackmoon.lrcResEdit");
 	try {
-		xmlRef = Gnome::Glade::Xml::create("ResourceEditor.glade");
-	} catch (Gnome::Glade::XmlError &xmlErr) {
-		std::cout << "Loading the ResourceEditor.glade failed for the following reason: " << xmlErr.what() << std::endl;
+		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;
 	};
-	mainWin = xmlRef->get_widget("MainWindow", mainWin);
 
-	mainWinTasks = new MainWindow(mainWin, xmlRef);
+	builder->get_widget("MainWindow", mainWin);
+	mainWinTasks = new MainWindow(mainWin, builder);
 
-	mainPrg.run(*mainWin);
-	mainWin->hide_all();
+	mainApp->run(*mainWin);
 
 	delete mainWinTasks;
+	delete mainWin;
 
 	return 0;
 }