Commit d4bf381c authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/actions/file-commands.c app/dialogs/file-save-dialog.c

2004-11-16  Sven Neumann  <sven@gimp.org>

	* app/actions/file-commands.c
	* app/dialogs/file-save-dialog.c
	* app/file/file-save.[ch]
	* app/widgets/gimpfiledialog.[ch]: combined "set_uri_and_proc" and
	"set_image_clean" parameters into a single "save_a_copy"
	parameter.  When saving a copy, attach the used URI to the image and
	let the "Save a Copy" file chooser default to the last used value.
parent 8d4803c7
2004-11-16 Sven Neumann <sven@gimp.org>
* app/actions/file-commands.c
* app/dialogs/file-save-dialog.c
* app/file/file-save.[ch]
* app/widgets/gimpfiledialog.[ch]: combined "set_uri_and_proc" and
"set_image_clean" parameters into a single "save_a_copy"
parameter. When saving a copy, attach the used URI to the image and
let the "Save a Copy" file chooser default to the last used value.
2004-11-16 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/scripts/glossy.scm: fixed typo (bug #158425).
......
......@@ -67,8 +67,7 @@ static void file_open_dialog_show (GtkWidget *parent,
static void file_save_dialog_show (GimpImage *gimage,
GtkWidget *parent,
const gchar *title,
gboolean set_uri_and_proc,
gboolean set_image_clean);
gboolean save_a_copy);
static void file_save_dialog_destroyed (GtkWidget *dialog,
GimpImage *gimage);
static void file_new_template_callback (GtkWidget *widget,
......@@ -228,8 +227,8 @@ file_save_as_cmd_callback (GtkAction *action,
if (! gimp_image_active_drawable (gdisp->gimage))
return;
file_save_dialog_show (gdisp->gimage, widget, _("Save Image"),
TRUE, TRUE);
file_save_dialog_show (gdisp->gimage, widget,
_("Save Image"), FALSE);
}
void
......@@ -244,8 +243,8 @@ file_save_a_copy_cmd_callback (GtkAction *action,
if (! gimp_image_active_drawable (gdisp->gimage))
return;
file_save_dialog_show (gdisp->gimage, widget, _("Save a Copy of the Image"),
FALSE, FALSE);
file_save_dialog_show (gdisp->gimage, widget,
_("Save a Copy of the Image"), TRUE);
}
void
......@@ -387,8 +386,7 @@ static void
file_save_dialog_show (GimpImage *gimage,
GtkWidget *parent,
const gchar *title,
gboolean set_uri_and_proc,
gboolean set_image_clean)
gboolean save_a_copy)
{
GtkWidget *dialog;
......@@ -417,8 +415,8 @@ file_save_dialog_show (GimpImage *gimage,
{
gtk_window_set_title (GTK_WINDOW (dialog), title);
gimp_file_dialog_set_image (GIMP_FILE_DIALOG (dialog), gimage,
set_uri_and_proc, set_image_clean);
gimp_file_dialog_set_image (GIMP_FILE_DIALOG (dialog),
gimage, save_a_copy);
gtk_window_present (GTK_WINDOW (dialog));
}
......
......@@ -60,8 +60,7 @@ static gboolean file_save_dialog_save_image (GtkWidget *save_dialog,
const gchar *uri,
const gchar *raw_filename,
PlugInProcDef *save_proc,
gboolean set_uri_and_proc,
gboolean set_image_clean);
gboolean save_a_copy);
/* public functions */
......@@ -123,8 +122,7 @@ file_save_dialog_response (GtkWidget *save_dialog,
uri,
uri,
dialog->file_proc,
dialog->set_uri_and_proc,
dialog->set_image_clean))
dialog->save_a_copy))
{
gtk_widget_hide (save_dialog);
}
......@@ -209,8 +207,7 @@ file_save_overwrite_response (GtkWidget *dialog,
overwrite_data->uri,
overwrite_data->raw_filename,
save_dialog->file_proc,
save_dialog->set_uri_and_proc,
save_dialog->set_image_clean))
save_dialog->save_a_copy))
{
gtk_widget_hide (overwrite_data->save_dialog);
}
......@@ -229,8 +226,7 @@ file_save_dialog_save_image (GtkWidget *save_dialog,
const gchar *uri,
const gchar *raw_filename,
PlugInProcDef *save_proc,
gboolean set_uri_and_proc,
gboolean set_image_clean)
gboolean save_a_copy)
{
GimpPDBStatusType status;
GError *error = NULL;
......@@ -242,8 +238,7 @@ file_save_dialog_save_image (GtkWidget *save_dialog,
raw_filename,
save_proc,
GIMP_RUN_INTERACTIVE,
set_uri_and_proc,
set_image_clean,
save_a_copy,
&error);
if (status != GIMP_PDB_SUCCESS &&
......
......@@ -90,8 +90,7 @@ file_save (GimpImage *gimage,
file_proc = gimp_image_get_save_proc (gimage);
return file_save_as (gimage, context, progress,
uri, uri, file_proc, run_mode,
FALSE, TRUE, error);
uri, uri, file_proc, run_mode, FALSE, error);
}
GimpPDBStatusType
......@@ -102,8 +101,7 @@ file_save_as (GimpImage *gimage,
const gchar *raw_filename,
PlugInProcDef *file_proc,
GimpRunMode run_mode,
gboolean set_uri_and_proc,
gboolean set_image_clean,
gboolean save_a_copy,
GError **error)
{
const ProcRecord *proc;
......@@ -189,22 +187,22 @@ file_save_as (GimpImage *gimage,
GimpDocumentList *documents;
GimpImagefile *imagefile;
if (set_image_clean)
if (save_a_copy)
{
/* set this image to clean */
gimp_image_clean_all (gimage);
g_object_set_data_full (G_OBJECT (gimage), "gimp-image-save-a-copy",
g_strdup (uri), (GDestroyNotify) g_free);
}
documents = GIMP_DOCUMENT_LIST (gimage->gimp->documents);
imagefile = gimp_document_list_add_uri (documents,
uri, file_proc->mime_type);
if (set_uri_and_proc)
else
{
gimp_image_set_uri (gimage, uri);
gimp_image_set_save_proc (gimage, file_proc);
gimp_image_clean_all (gimage);
}
documents = GIMP_DOCUMENT_LIST (gimage->gimp->documents);
imagefile = gimp_document_list_add_uri (documents,
uri, file_proc->mime_type);
gimp_imagefile_save_thumbnail (imagefile, file_proc->mime_type, gimage);
gimp_recent_list_add_uri (uri, file_proc->mime_type);
......
......@@ -34,8 +34,7 @@ GimpPDBStatusType file_save_as (GimpImage *gimage,
const gchar *raw_filename,
PlugInProcDef *file_proc,
GimpRunMode run_mode,
gboolean set_uri_and_proc,
gboolean set_image_clean,
gboolean save_a_copy,
GError **error);
......
......@@ -428,20 +428,22 @@ gimp_file_dialog_set_uri (GimpFileDialog *dialog,
void
gimp_file_dialog_set_image (GimpFileDialog *dialog,
GimpImage *gimage,
gboolean set_uri_and_proc,
gboolean set_image_clean)
gboolean save_a_copy)
{
const gchar *uri;
const gchar *uri = NULL;
gboolean uri_set = FALSE;
g_return_if_fail (GIMP_IS_FILE_DIALOG (dialog));
g_return_if_fail (GIMP_IS_IMAGE (gimage));
dialog->gimage = gimage;
dialog->set_uri_and_proc = set_uri_and_proc;
dialog->set_image_clean = set_image_clean;
dialog->gimage = gimage;
dialog->save_a_copy = save_a_copy;
uri = gimp_object_get_name (GIMP_OBJECT (gimage));
if (save_a_copy)
uri = g_object_get_data (G_OBJECT (gimage), "gimp-image-save-a-copy");
if (! uri)
uri = gimp_object_get_name (GIMP_OBJECT (gimage));
if (uri)
uri_set = gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (dialog), uri);
......
......@@ -42,8 +42,7 @@ struct _GimpFileDialog
PlugInProcDef *file_proc;
GimpImage *gimage;
gboolean set_uri_and_proc;
gboolean set_image_clean;
gboolean save_a_copy;
GtkWidget *thumb_box;
GtkWidget *proc_expander;
......@@ -83,8 +82,7 @@ void gimp_file_dialog_set_uri (GimpFileDialog *dialog,
const gchar *uri);
void gimp_file_dialog_set_image (GimpFileDialog *dialog,
GimpImage *gimage,
gboolean set_uri_and_proc,
gboolean set_image_clean);
gboolean save_a_copy);
G_END_DECLS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment