/* Check for file existence. If file already exists, ask for an action (skip, overwrite or rename). Return 0 if skipped. */ int tiemu_file_check(const char *src, char **dst) { int ret; char buffer[256]; char *dirname; *dst = NULL; if (1) { if (access(src, F_OK) == 0) { sprintf(buffer, _("The file %s already exists.\nOverwrite ?"), src); ret = msg_box3(_("Warning"), buffer, _("Overwrite "), _("Rename "), _("Skip ")); switch (ret) { case BUTTON1: *dst = g_strdup(src); return !0; break; case BUTTON2: dirname = msg_entry(_("Rename the file"), _("New name: "), src); if (dirname == NULL) return 0; *dst = g_strdup(dirname); g_free(dirname); return !0; break; case BUTTON3: return 0; break; default: return 0; break; } } else { *dst = g_strdup(src); return !0; } } else { *dst = g_strdup(src); return !0; } return !0; }
// change folder TILP_EXPORT void on_button14_clicked(GtkButton* button, gpointer user_data) { gchar *folder; folder = msg_entry(_("Path"), _("Enter new path"), local.cwdir); if(folder != NULL) { if(g_file_test(folder, G_FILE_TEST_IS_DIR)) { tilp_file_chdir(folder); g_free(local.cwdir); local.cwdir = g_get_current_dir(); clist_refresh(); labels_refresh(); } g_free(folder); } }
void outside_msg_entry(const char *msg, unsigned len) { msg_entry(msg, len); }