Using Glade files in Gnumeric

Currently Gnumeric has very simple function (gnumeric_glade_xml_new) reading
Glade file and displaying an error if file can't be found or recognized.
There are, however, additional problems. Every gnumeric_glade_xml_new() call
is followed by at least one call to glade_xml_get_widget() function. There's
no convenient way to check for errors in this case (missing widgets and/or
invalid types of some widgets). Some authors ignore such errors, others put
assertions here and there or abort an action (sometimes printing error
message to stdout/stderr).
Here's my proposal:
 - use new function (gnumeric_glade_get_widgets) to get widgets from
   GladeXML object and check their types,
 - always handle such errors (when the function returns FALSE) in a clean
   way - in most cases it means "don't display a dialog, destroy some
   objects, return from a function").

Attached patch contains the mentioned function and modifies two files
(dialog-plugin-manager.c, dialog-cell-sort.c) to use this function.
Converting most files in src/dialogs directory should be a trival task (it
would take some time, however). I could take care of this.

What do you think about this idea?


Attachment: gnumeric-glade-widgets.diff
Description: Text document

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]