Fix some warnings while creating a new book

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23602 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2013-12-23 20:33:02 +00:00
parent f94b27f915
commit e20d5c8d1c
2 changed files with 17 additions and 7 deletions

View File

@ -2522,9 +2522,6 @@ static gboolean gnc_option_set_ui_value_budget(
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 @@ static gboolean gnc_option_set_ui_value_budget(
"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);
}
}

View File

@ -259,6 +259,15 @@ gnc_restore_all_state (gpointer session, gpointer unused)
/* 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)