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.
This commit is contained in:
Sven Neumann 2004-11-16 13:37:36 +00:00 committed by Sven Neumann
parent 8d4803c72c
commit d4bf381c20
7 changed files with 46 additions and 46 deletions

View File

@ -1,3 +1,13 @@
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).

View File

@ -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));
}

View File

@ -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 &&

View File

@ -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);
}
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);
if (set_uri_and_proc)
{
gimp_image_set_uri (gimage, uri);
gimp_image_set_save_proc (gimage, file_proc);
}
gimp_imagefile_save_thumbnail (imagefile, file_proc->mime_type, gimage);
gimp_recent_list_add_uri (uri, file_proc->mime_type);

View File

@ -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);

View File

@ -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);

View File

@ -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