summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2014-10-02 18:31:51 +0300
committerYakov Goldberg <yakov.g@samsung.com>2014-10-06 11:20:07 +0300
commit783bf34ed57d6125fc8b3ae4d65203becd9e19ad (patch)
tree6af7572f57ffac8a0adc6146786493e9231cf1d2
parent5d07e157815c7d70b43345c9bb62211ec617417b (diff)
Save fileselector: use current_name_set() for default filename
Required Elementary update.
-rw-r--r--src/bin/egui_gui/egui_logic.c34
1 files changed, 4 insertions, 30 deletions
diff --git a/src/bin/egui_gui/egui_logic.c b/src/bin/egui_gui/egui_logic.c
index 5d5825a..0d45df3 100644
--- a/src/bin/egui_gui/egui_logic.c
+++ b/src/bin/egui_gui/egui_logic.c
@@ -313,38 +313,12 @@ _fs_mode_open(int fs_mode)
313 } 313 }
314 314
315 if (!fs_path) fs_path = getenv("HOME"); 315 if (!fs_path) fs_path = getenv("HOME");
316 eo_do(fs_win->fileselector, elm_interface_fileselector_path_set(fs_path));
316 317
317 /* if both path and file (for save or export mode) are exist, show default name in fileselector*/ 318 /* filename (for save or export mode) are exist, show it as default in fileselector*/
318 if (fs_path && fs_file) 319 if (fs_file)
319 { 320 {
320 char full_path[PATH_MAX] = {0}; 321 eo_do(fs_win->fileselector, elm_interface_fileselector_current_name_set(fs_file));
321 sprintf(full_path, "%s/%s", fs_path, fs_file);
322
323 if (ecore_file_exists(full_path))
324 {
325 eo_do(fs_win->fileselector, elm_interface_fileselector_selected_set(full_path));
326 }
327 else
328 {
329 /* FIXME: Hack here. Nice-to-have, set initial string into filename field in Filesector.
330 * But meanwhile, need to create temp file in order to set it as initial.*/
331 if (fs_mode == ITEM_EXPORT)
332 {
333 char full_path2[PATH_MAX] = {0};
334 sprintf(full_path2, "%s/%s.c", fs_path, fs_file);
335 if (ecore_file_exists(full_path2))
336 {
337 ecore_file_cp(full_path2, full_path);
338 Eina_Bool res = eo_do(fs_win->fileselector, elm_interface_fileselector_selected_set(full_path));
339 if (res)
340 ecore_file_remove(full_path);
341 }
342 }
343 }
344 }
345 else
346 {
347 eo_do(fs_win->fileselector, elm_interface_fileselector_path_set(fs_path));
348 } 322 }
349 evas_object_smart_callback_add(fs_win->fileselector, "done", _on_fs_done, (void *)(intptr_t) fs_mode); 323 evas_object_smart_callback_add(fs_win->fileselector, "done", _on_fs_done, (void *)(intptr_t) fs_mode);
350} 324}