Add some (more) error handling to gtk code.

This explains why out of tree builds currently do not work for the gtk version.
This commit is contained in:
Arthur Moore 2015-01-07 15:12:45 -05:00
parent 8b46072ca3
commit 8cfce58fa0
1 changed files with 16 additions and 10 deletions

View File

@ -16,6 +16,8 @@
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <exception>
#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <gtkmm/messagedialog.h>
@ -27,6 +29,13 @@
#include "window.h"
#include "intl.h"
template<typename T>
void showErrorDialoge(T& e)
{
Gtk::MessageDialog oDialog(e.what(),false,Gtk::MESSAGE_ERROR,Gtk::BUTTONS_OK);
oDialog.run();
}
int main(int argc, char * argv[])
{
bool bShowVersion = false;
@ -68,11 +77,7 @@ int main(int argc, char * argv[])
}
catch (const Glib::Error& e)
{
Gtk::MessageDialog oDialog(e.what(),
false,
Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_OK);
oDialog.run();
showErrorDialoge(e);
return 1;
}
@ -95,11 +100,12 @@ int main(int argc, char * argv[])
}
catch (const Gtk::BuilderError & e)
{
Gtk::MessageDialog oDialog(e.what(),
false,
Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_OK);
oDialog.run();
showErrorDialoge(e);
return 1;
}
catch (const Glib::FileError & e)
{
showErrorDialoge(e);
return 1;
}