diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-06-07 19:25:31 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-06-07 19:25:31 +0200 |
commit | 50c9ef3ffc739bdb6d0b437a495928ea57728550 (patch) | |
tree | 2bd722937ac52bc93eec0dff9dc83e8c3dee1334 /src/format-selection.c | |
parent | d3ffe1e4a1b7a26e88ee7979dee9f1e698fa8a53 (diff) | |
download | experiment-player-50c9ef3ffc739bdb6d0b437a495928ea57728550.tar.gz |
format-file related transcript widget methods return a GError which is used to display meaningful error messages
* also cleaned up return value confusion: in GLib world, TRUE means successful
Diffstat (limited to 'src/format-selection.c')
-rw-r--r-- | src/format-selection.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/format-selection.c b/src/format-selection.c index d61b381..bd024e1 100644 --- a/src/format-selection.c +++ b/src/format-selection.c @@ -109,6 +109,8 @@ generic_transcript_combo_changed_cb(gpointer user_data, GtkComboBox *combo) GtkTreeIter iter; gchar *filename = NULL; + GError *error = NULL; + if (gtk_combo_box_get_active_iter(combo, &iter)) gtk_tree_model_get(model, &iter, COL_FILENAME, &filename, -1); @@ -116,7 +118,12 @@ generic_transcript_combo_changed_cb(gpointer user_data, GtkComboBox *combo) * filename may be empty (null-entry) in which case any active format * will be reset */ - gtk_experiment_transcript_load_formats(trans, filename); + if (!gtk_experiment_transcript_load_formats(trans, filename, &error)) { + show_message_dialog_gerror(error); + g_error_free(error); + + gtk_combo_box_set_active_iter(combo, NULL); + } g_free(filename); #if 0 @@ -142,12 +149,12 @@ generic_transcript_entry_changed_cb(gpointer user_data, GtkEditable *editable) isMarkup = gtk_toggle_button_get_active(toggle); res = gtk_experiment_transcript_set_interactive_format(trans, text, - isMarkup); + isMarkup, NULL); gtk_entry_set_icon_from_stock(GTK_ENTRY(editable), GTK_ENTRY_ICON_PRIMARY, - res ? GTK_STOCK_DIALOG_ERROR - : GTK_STOCK_APPLY); + res ? GTK_STOCK_APPLY + : GTK_STOCK_DIALOG_ERROR); gtk_entry_set_icon_sensitive(GTK_ENTRY(editable), GTK_ENTRY_ICON_PRIMARY, text != NULL && *text); |