Ejemplo n.º 1
0
void save_cb(GtkButton *button, GtkWindow *window)
{
	GtkWidget *dialog;
	int result;

	if (get_num_pages() == 0)
		return;

	if (is_new_file() == FALSE) {
		save_current_file();
		return;
	}

	dialog = gtk_file_chooser_dialog_new("Save File", window,
					     GTK_FILE_CHOOSER_ACTION_SAVE,
					     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
					     GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
					     NULL);

	result = gtk_dialog_run(GTK_DIALOG(dialog));
	if (result == GTK_RESPONSE_ACCEPT) {
		char *chosen_file_path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
		if (chosen_file_path != NULL)
			save_new_file(chosen_file_path);
	}

	gtk_widget_destroy(dialog);
}
Ejemplo n.º 2
0
static void
save_files (GthImageSaveData *data,
	    GthFileDataFunc   ready_func,
	    gpointer          ready_data)
{
	SaveData *save_data;

	save_data = g_new0 (SaveData, 1);
	save_data->data = data;
	save_data->ready_func = ready_func;
	save_data->ready_data = ready_data;

	save_data->current = save_data->data->files;
	save_current_file (save_data);
}
Ejemplo n.º 3
0
static void
file_saved_cb (void     **buffer,
	       gsize      count,
	       GError    *error,
	       gpointer   user_data)
{
	SaveData *save_data = user_data;

	*buffer = NULL; /* do not free the buffer, it's owned by file->buffer */

	if (error != NULL) {
		save_data->data->error = &error;
		save_completed (save_data);
		return;
	}

	save_data->current = save_data->current->next;
	save_current_file (save_data);
}