diff --git a/ChangeLog b/ChangeLog index 96b20259c..f5f6c9004 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-09-19 Mike Blumenkrantz + + * Fix bug where new files could not be created repeatedly + 2013-08-30 Mike Blumenkrantz * Navigate menu item now opens $HOME diff --git a/NEWS b/NEWS index 7dd663992..0a26fe4a6 100644 --- a/NEWS +++ b/NEWS @@ -229,3 +229,4 @@ Fixes: * fixed crash when multiple windows shared a remember * fixed bug where double clicking filemanager windows would not correctly autosize * fixed bug where setting min size on a gadget would not be passed to desktop gadgets + * fixed bug where new files could not be created repeatedly diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 67bce15ca..8544402a8 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -84,6 +84,7 @@ struct _E_Fm2_Smart_Data { Ecore_Thread *thread; const char *filename; + Eina_Bool done : 1; } new_file; E_Fm2_Icon *last_selected; @@ -4892,6 +4893,19 @@ _e_fm2_icon_realize(E_Fm2_Icon *ic) if (ic->info.removable) _e_fm2_icon_removable_update(ic); + if (ic->sd->new_file.thread && (!ic->sd->new_file.filename)) + { + /* we got the file through the scanner :/ */ + const char *file = ecore_thread_global_data_find("efm_pending_filename"); + + if (!e_util_strcmp(ic->info.file, file)) + { + _e_fm2_file_rename(ic, NULL, NULL); + ic->sd->new_file.done = 1; + } + if (file) + ecore_thread_global_data_del("efm_pending_filename"); + } if (ic->sd->new_file.filename) { if (ic->info.file == ic->sd->new_file.filename) @@ -9658,10 +9672,13 @@ _e_fm2_new_dir_notify(void *data, Ecore_Thread *eth __UNUSED__, char *filename) { E_Fm2_Smart_Data *sd = data; - if (filename) - sd->new_file.filename = eina_stringshare_add(ecore_file_file_get(filename)); - else - e_util_dialog_internal(_("Error"), _("Could not create a directory!")); + if (!sd->new_file.done) + { + if (filename) + sd->new_file.filename = eina_stringshare_add(ecore_file_file_get(filename)); + else + e_util_dialog_internal(_("Error"), _("Could not create a directory!")); + } free(filename); } @@ -9670,10 +9687,13 @@ _e_fm2_new_file_notify(void *data, Ecore_Thread *eth __UNUSED__, char *filename) { E_Fm2_Smart_Data *sd = data; - if (filename) - sd->new_file.filename = eina_stringshare_add(ecore_file_file_get(filename)); - else - e_util_dialog_internal(_("Error"), _("Could not create a file!")); + if (!sd->new_file.done) + { + if (filename) + sd->new_file.filename = eina_stringshare_add(ecore_file_file_get(filename)); + else + e_util_dialog_internal(_("Error"), _("Could not create a file!")); + } free(filename); } @@ -9696,6 +9716,7 @@ _e_fm2_new_thread_helper(Ecore_Thread *eth, Eina_Bool dir) { if (ecore_file_mkdir(buf)) { + ecore_thread_global_data_set("efm_pending_filename", strdup(buf), free); ecore_thread_feedback(eth, strdup(buf)); return; } @@ -9714,6 +9735,7 @@ _e_fm2_new_thread_helper(Ecore_Thread *eth, Eina_Bool dir) perror("write"); } close(fd); + ecore_thread_global_data_set("efm_pending_filename", strdup(buf), free); ecore_thread_feedback(eth, strdup(buf)); return; } @@ -9732,6 +9754,7 @@ _e_fm2_new_thread_helper(Ecore_Thread *eth, Eina_Bool dir) { if (ecore_file_mkdir(buf)) { + ecore_thread_global_data_set("efm_pending_filename", strdup(buf), free); ecore_thread_feedback(eth, strdup(buf)); return; } @@ -9750,6 +9773,7 @@ _e_fm2_new_thread_helper(Ecore_Thread *eth, Eina_Bool dir) perror("write"); } close(fd); + ecore_thread_global_data_set("efm_pending_filename", strdup(buf), free); ecore_thread_feedback(eth, strdup(buf)); return; }