diff options
author | Bruno Coudoin <bruno.coudoin@free.fr> | 2009-10-25 20:34:20 (GMT) |
---|---|---|
committer | Bruno Coudoin <bruno.coudoin@free.fr> | 2009-10-25 20:34:20 (GMT) |
commit | 5bbcc313789989c8d32ab05ac15007de9c6a1547 (patch) | |
tree | 63682c8576f3b26ce55b89bfaf68eb317f40ea1b | |
parent | 560b6233377cc6e59812d284a61474fb1d7ba1b1 (diff) |
Fixed file selector, now passes the file type properly in load.
-rw-r--r-- | src/gcompris/file_selector.c | 19 | ||||
-rw-r--r-- | src/wordprocessor-activity/wordprocessor.c | 8 |
2 files changed, 22 insertions, 5 deletions
diff --git a/src/gcompris/file_selector.c b/src/gcompris/file_selector.c index 44f6b13..7b15344 100644 --- a/src/gcompris/file_selector.c +++ b/src/gcompris/file_selector.c @@ -67,6 +67,7 @@ static GtkWidget *gtk_combo_filetypes = NULL; static gchar *current_rootdir = NULL; static void *current_user_context = NULL; static GtkWidget *widget_entry = NULL; +static gchar *current_extension = NULL; /* Represent the limits of control area */ static guint32 control_area_x1; @@ -138,6 +139,10 @@ gc_selector_file_stop () gc_bar_hide(FALSE); file_selector_displayed = FALSE; + + // if (current_extension) + // g_free(current_extension); + current_extension = NULL; } @@ -599,12 +604,14 @@ item_event_file_selector (GooCanvasItem *item, gtk_tree_model_get (model, &iter, 0, &file_type, -1); } + else + file_type = g_strdup(current_extension); result = g_strdup_printf("%s/%s%s", current_rootdir, gtk_entry_get_text(GTK_ENTRY(widget_entry)), (file_type ? file_type : "") ); - + printf("result=%s\n", result); /* Callback with the proper params */ fileSelectorCallBack(result, file_type, current_user_context); @@ -636,6 +643,16 @@ item_event_file_selector (GooCanvasItem *item, gtk_entry_set_text(GTK_ENTRY(widget_entry), g_path_get_basename(file_wo_ext)); g_free(file_wo_ext); + + + if (current_extension && ext) + { + g_free(current_extension); + current_extension = g_strdup(ext); + } + else if ( ext ) + current_extension = g_strdup(ext); + } break; default: diff --git a/src/wordprocessor-activity/wordprocessor.c b/src/wordprocessor-activity/wordprocessor.c index 172e858..2264c1e 100644 --- a/src/wordprocessor-activity/wordprocessor.c +++ b/src/wordprocessor-activity/wordprocessor.c @@ -857,7 +857,7 @@ escape(char *input) } static void -save_buffer(gchar *file, gchar *file_type) +save_buffer(gchar *file, gchar *file_type, void *unused) { GtkTextIter iter_start, iter_end; GSList *tags = NULL, *tagp = NULL; @@ -998,13 +998,13 @@ save_event (GooCanvasItem *item, gc_selector_file_save(gcomprisBoard, "wordprocessor", ".xhtml", - save_buffer); + save_buffer, NULL); return FALSE; } static void -load_buffer(gchar *file, gchar *file_type) +load_buffer(gchar *file, gchar *file_type, void *unused) { GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); xmlDocPtr doc; @@ -1131,7 +1131,7 @@ load_event (GooCanvasItem *item, gc_selector_file_load(gcomprisBoard, "wordprocessor", ".xhtml", - load_buffer); + load_buffer, NULL); return FALSE; } |