diff --git a/src/gtk/main.cpp b/src/gtk/main.cpp index cb078e39..b5c92689 100644 --- a/src/gtk/main.cpp +++ b/src/gtk/main.cpp @@ -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 + #include #include #include @@ -27,6 +29,13 @@ #include "window.h" #include "intl.h" +template +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; }