Disable forward button if there are no entries in store

This commit is contained in:
Robert Fewell 2018-11-26 15:37:58 +00:00
parent 4abbd86d0d
commit 5201fe5f34

View File

@ -211,6 +211,24 @@ void csv_import_hrows_cb (GtkWidget *spin, gpointer user_data)
}
/*******************************************************
* csv_import_assistant_enable_account_forward
*
* enaable forward button on account_page if store has rows
*******************************************************/
static void csv_import_assistant_enable_account_forward (CsvImportInfo *info)
{
GtkAssistant *assistant = GTK_ASSISTANT(info->assistant);
gboolean store_has_rows = TRUE;
/* if the store is empty, disable forward button */
if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL(info->store), NULL) == 0)
store_has_rows = FALSE;
gtk_assistant_set_page_complete (assistant, info->account_page, store_has_rows);
}
/*******************************************************
* csv_import_sep_cb
*
@ -257,6 +275,9 @@ void csv_import_sep_cb (GtkWidget *radio, gpointer user_data)
gtk_spin_button_set_value (GTK_SPIN_BUTTON(info->header_row_spin), 1); // set header spin to 1
else
gtk_spin_button_set_value (GTK_SPIN_BUTTON(info->header_row_spin), 0); //reset header spin to 0
/* if the store has rows, enable forward button */
csv_import_assistant_enable_account_forward (info);
}
@ -411,6 +432,9 @@ csv_import_assistant_account_page_prepare (GtkAssistant *assistant,
gtk_spin_button_set_value (GTK_SPIN_BUTTON(info->header_row_spin), 1); // set header spin to 1
else
gtk_spin_button_set_value (GTK_SPIN_BUTTON(info->header_row_spin), 0); //reset header spin to 0
/* if the store has rows, enable forward button */
csv_import_assistant_enable_account_forward (info);
}