r23602 - gnucash/trunk/src - Fix some warnings while creating a new book
Geert Janssens
gjanssens at code.gnucash.org
Mon Dec 23 15:33:03 EST 2013
Author: gjanssens
Date: 2013-12-23 15:33:02 -0500 (Mon, 23 Dec 2013)
New Revision: 23602
Trac: http://svn.gnucash.org/trac/changeset/23602
Modified:
gnucash/trunk/src/gnome-utils/dialog-options.c
gnucash/trunk/src/gnome/top-level.c
Log:
Fix some warnings while creating a new book
Modified: gnucash/trunk/src/gnome/top-level.c
===================================================================
--- gnucash/trunk/src/gnome/top-level.c 2013-12-23 20:32:58 UTC (rev 23601)
+++ gnucash/trunk/src/gnome/top-level.c 2013-12-23 20:33:02 UTC (rev 23602)
@@ -259,6 +259,15 @@
/* If no state file was found, keyfile will be empty
* In that case, let's load the default state */
+ if (!g_key_file_has_group (keyfile, STATE_FILE_TOP))
+ {
+ gnc_main_window_restore_default_state(NULL);
+ LEAVE("no state file");
+ goto cleanup;
+ }
+
+ /* report any other keyfile read error as a warning
+ * but still load default state */
file_guid = g_key_file_get_string(keyfile, STATE_FILE_TOP,
STATE_FILE_BOOK_GUID, &error);
if (error)
Modified: gnucash/trunk/src/gnome-utils/dialog-options.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-options.c 2013-12-23 20:32:58 UTC (rev 23601)
+++ gnucash/trunk/src/gnome-utils/dialog-options.c 2013-12-23 20:33:02 UTC (rev 23602)
@@ -2522,9 +2522,6 @@
GNCOption *option, gboolean use_default, GtkWidget *widget, SCM value)
{
GncBudget *bgt;
- GtkComboBox *cb;
- GtkTreeModel *tm;
- GtkTreeIter iter;
// if (!scm_is_null(value)) {
if (value != SCM_BOOL_F)
@@ -2534,10 +2531,14 @@
"Option Value not a wcp.", value);
bgt = SWIG_MustGetPtr(value, SWIG_TypeQuery("GncBudget *"), 4, 0);
- cb = GTK_COMBO_BOX(widget);
- tm = gtk_combo_box_get_model(cb);
- if (gnc_tree_model_budget_get_iter_for_budget(tm, &iter, bgt))
- gtk_combo_box_set_active_iter(cb, &iter);
+ if (bgt)
+ {
+ GtkComboBox *cb = GTK_COMBO_BOX(widget);
+ GtkTreeModel *tm = gtk_combo_box_get_model(cb);
+ GtkTreeIter iter;
+ if (gnc_tree_model_budget_get_iter_for_budget(tm, &iter, bgt))
+ gtk_combo_box_set_active_iter(cb, &iter);
+ }
}
More information about the gnucash-changes
mailing list