Example #1
0
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;
}
Example #2
0
void on_recovery_infobar_response (GtkInfoBar* bar, gint res, gpointer filename) {
    gchar* prev_workfile = iofunctions_get_swapfile (filename);

    if (res == GTK_RESPONSE_YES) {
        tabmanager_set_content (A_LOAD_OPT, filename, prev_workfile);
    }
    else { // NO
        tabmanager_set_content (A_LOAD, filename, NULL);
    }
    gui_recovery_mode_disable (bar);
}
Example #3
0
void gui_recovery_mode_enable (GuTabContext* tab, const gchar* filename) {
    gchar* prev_workfile = iofunctions_get_swapfile (filename);

    slog (L_WARNING, "Swap file `%s' found.\n", prev_workfile);
    gchar* msg = g_strdup_printf (_("Swap file exists for %s, "
				"do you want to recover from it?"), filename);
    gtk_label_set_text (GTK_LABEL (tab->page->barlabel), msg);
    g_free (msg);

    gchar* data = g_strconcat (filename, NULL);
    tab->page->infosignal =
        g_signal_connect (g_active_tab->page->infobar, "response",
        G_CALLBACK (on_recovery_infobar_response), (gpointer)data);

    gtk_widget_set_sensitive (GTK_WIDGET (tab->editor->view), FALSE);
    gtk_widget_show (tab->page->infobar);
}