void latex_export_pdffile(GuLatex* lc, GuEditor* ec, const gchar* path, gboolean prompt_overrite) { gchar* savepath = NULL; GError* err = NULL; gint ret = 0; if (!STR_EQU(path + strlen(path) - 4, ".pdf")) savepath = g_strdup_printf("%s.pdf", path); else savepath = g_strdup(path); if (prompt_overrite && utils_path_exists(savepath)) { ret = utils_yes_no_dialog(_("The file already exists. Overwrite?")); if (GTK_RESPONSE_YES != ret) { g_free(savepath); return; } } if (!utils_copy_file(ec->pdffile, savepath, &err)) { slog(L_G_ERROR, _("Unable to export PDF file.\n\n%s"), err->message); g_error_free(err); } g_free(savepath); }
G_MODULE_EXPORT void on_menu_recent_activate(GtkWidget *widget, void *user) { const gchar* name = gtk_menu_item_get_label(GTK_MENU_ITEM(widget)); gchar* tstr; gint index = name[0] - '0' - 1; if (utils_path_exists(gui->recent_list[index])) { gui_open_file(gui->recent_list[index]); } else { tstr = g_strdup_printf(_("Error loading recent file: %s"), gui->recent_list[index]); slog(L_ERROR, "%s\n", tstr); slog(L_G_ERROR, "Could not find the file %s.\n", gui->recent_list[index]); statusbar_set_message(tstr); g_free(tstr); g_free(gui->recent_list[index]); gui->recent_list[index] = NULL; while (index < RECENT_FILES_NUM - 1) { gui->recent_list[index] = gui->recent_list[index + 1]; ++index; } gui->recent_list[RECENT_FILES_NUM - 1] = g_strdup("__NULL__"); } display_recent_files(gui); }
gboolean iofunctions_has_swapfile (const gchar* filename) { if (filename == NULL) return FALSE; gchar* swapfile = iofunctions_get_swapfile (filename); if (utils_path_exists (swapfile)) { return TRUE; } return FALSE; }