[glom] Glade utils: More error-checking.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Glade utils: More error-checking.
- Date: Wed, 14 Apr 2010 08:23:07 +0000 (UTC)
commit bf4130319b5833c4e51c30b11ba4ab35691429bc
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Apr 14 10:05:51 2010 +0200
Glade utils: More error-checking.
* glom/glade_utils.h: helper_get_glade_widget_derived_with_warning():
Catch the other 2 exception types that we now know that
Gtk::Builder::create*() can throw.
* glom/frame_glom.cc: create_database(): Use get_glade_widget_with_warning()
to simplify the code. Our utility functions are now used everywhere.
ChangeLog | 44 +++++++++++++++++++++++++++-----------------
glom/frame_glom.cc | 19 +++++--------------
glom/glade_utils.h | 21 ++++++++++++++++++---
3 files changed, 50 insertions(+), 34 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9926e9f..5cb0d3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,37 +1,47 @@
+2010-04-14 Murray Cumming <murrayc murrayc com>
+
+ Glade utils: More error-checking.
+
+ * glom/glade_utils.h: helper_get_glade_widget_derived_with_warning():
+ Catch the other 2 exception types that we now know that
+ Gtk::Builder::create*() can throw.
+ * glom/frame_glom.cc: create_database(): Use get_glade_widget_with_warning()
+ to simplify the code. Our utility functions are now used everywhere.
+
2010-04-13 Murray Cumming <murrayc murrayc com>
Remove useless translatable strings.
-
- * glom/glom_developer.glade: Remove placeholder text from labels that will
- actually have their text set at runtime, so there's need actual need to have
+
+ * glom/glom_developer.glade: Remove placeholder text from labels that will
+ actually have their text set at runtime, so there's need actual need to have
it in the glade file. They were even marked as translatable.
Bug #615656 (Gianluca Ferri)
2010-04-12 Murray Cumming <murrayc murrayc com>
Python calculations and scripts: Fix regression in use of date and time fields.
-
+
* glom/libglom/python_embed/py_glom_record.[h|cc]:
- Change PyGlomRecord_SetFields() to a member set_fields() method, and making
+ Change PyGlomRecord_SetFields() to a member set_fields() method, and making
more of the class private, finishing our conversion to boost::python.
- * glom/libglom/python_embed/py_glom_related.[h|cc]:
+ * glom/libglom/python_embed/py_glom_related.[h|cc]:
Change PyGlomRelated_SetRelationships() to a set_relationships methods.
* glom/libglom/python_embed/py_glom_relatedrecord.[h|cc]:
Changed PyGlomRelatedRecord_SetRelationship() to a set_relationship() method.
-
+
* glom/python_embed/glom_python.cc: glom_pygda_value_from_pyobject():
- Handle date, time, timestamp, geometric point values, whose code had been
+ Handle date, time, timestamp, geometric point values, whose code had been
commented out since the port to boost::python.
- This fixes the test added in the previous commit, so glom calculations and
- scripts can again (it broke in unstable Glom 1.13) use date and time field
+ This fixes the test added in the previous commit, so glom calculations and
+ scripts can again (it broke in unstable Glom 1.13) use date and time field
values from the record.
2010-04-12 Murray Cumming <murrayc murrayc com>
Added test showing problem with date fields in python calculations.
-
- * tests/test_python_execute_func_date.cc: Added a test of dates as input
- values for record fields. This currently fails with this error from python,
+
+ * tests/test_python_execute_func_date.cc: Added a test of dates as input
+ values for record fields. This currently fails with this error from python,
so I need to fix it in Glom:
AttributeError: 'NoneType' object has no attribute 'year'
@@ -67,17 +77,17 @@
2010-04-12 Murray Cumming <murrayc murrayc com>
Fix glade loading.
-
- * glom/glade_utils.h: get_glade_widget_derived_with_warning(): Fix silly
+
+ * glom/glade_utils.h: get_glade_widget_derived_with_warning(): Fix silly
but fatal typo.
2010-04-11 Murray Cumming <murrayc murrayc com>
Simplify setting of the icon for windows.
-
+
* glom/glade_utils.h: get_glade_widget_derived_with_warning():
Call set_icon_name() on windows.
- * Several *.cc files: Don't bother calling set_icon_name() after calling
+ * Several *.cc files: Don't bother calling set_icon_name() after calling
get_glade_widget_derived_with_warning().
2010-04-10 Murray Cumming <murrayc murrayc-x61>
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index 50b74f8..a50c95e 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -2539,21 +2539,12 @@ bool Frame_Glom::create_database(const Glib::ustring& database_name, const Glib:
//Tell the user:
Gtk::Dialog* dialog = 0;
- try
- {
- // TODO: Tell the user what has gone wrong (ex.what())
- Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path("glom_developer.glade"), "dialog_error_create_database");
- refXml->get_widget("dialog_error_create_database", dialog);
- dialog->set_transient_for(*pWindowApp);
- Glom::Utils::dialog_run_with_help(dialog, "dialog_error_create_database");
- delete dialog;
- }
- catch(const Gtk::BuilderError& ex)
- {
- std::cerr << ex.what() << std::endl;
- }
+ Utils::get_glade_widget_with_warning("glom_developer.glade", "dialog_error_create_database", dialog);
+ dialog->set_transient_for(*pWindowApp);
+ Glom::Utils::dialog_run_with_help(dialog, "dialog_error_create_database");
+ delete dialog;
- return false;
+ return false;
}
//Connect to the actual database:
diff --git a/glom/glade_utils.h b/glom/glade_utils.h
index 4520c10..cf0742d 100644
--- a/glom/glade_utils.h
+++ b/glom/glade_utils.h
@@ -57,6 +57,14 @@ void helper_get_glade_widget_derived_with_warning(const std::string& filename, c
{
std::cerr << ex.what() << std::endl;
}
+ catch(const Glib::MarkupError& ex)
+ {
+ std::cerr << ex.what() << std::endl;
+ }
+ catch(const Glib::FileError& ex)
+ {
+ std::cerr << ex.what() << std::endl;
+ }
#else
std::auto_ptr<Glib::Error> error;
refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path(filename), id, error);
@@ -84,7 +92,7 @@ template<class T_Widget>
void get_glade_widget_derived_with_warning(T_Widget*& widget)
{
widget = 0;
-
+
if(T_Widget::glade_developer)
helper_get_glade_widget_derived_with_warning("glom_developer.glade", T_Widget::glade_id, widget);
else
@@ -102,7 +110,15 @@ void get_glade_widget_with_warning(const std::string& filename, const Glib::ustr
{
refXml = Gtk::Builder::create_from_file(Utils::get_glade_file_path(filename), id);
}
- catch(const Glib::Error& ex)
+ catch(const Gtk::BuilderError& ex)
+ {
+ std::cerr << ex.what() << std::endl;
+ }
+ catch(const Glib::MarkupError& ex)
+ {
+ std::cerr << ex.what() << std::endl;
+ }
+ catch(const Glib::FileError& ex)
{
std::cerr << ex.what() << std::endl;
}
@@ -135,4 +151,3 @@ Dialog_ProgressCreating* get_and_show_pulse_dialog(const Glib::ustring& message,
} //namespace Glom
#endif //GLOM_GLADE_UTILS_H
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]