Commit ca2f7f88 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

new function which configures the dialog to save an image.

2004-03-01  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpfiledialog.[ch] (gimp_file_dialog_set_image):
	new function which configures the dialog to save an image.

	* app/gui/file-save-dialog.c: use it.

	* app/gui/file-open-dialog.c
	* app/gui/file-save-dialog.c: removed useless #inlcudes.
parent 705114f0
2004-03-01 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpfiledialog.[ch] (gimp_file_dialog_set_image):
new function which configures the dialog to save an image.
* app/gui/file-save-dialog.c: use it.
* app/gui/file-open-dialog.c
* app/gui/file-save-dialog.c: removed useless #inlcudes.
2004-03-01 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpfiledialog.[ch] (gimp_file_dialog_new): added
......@@ -27,13 +27,8 @@
#include "gui-types.h"
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimpimagefile.h"
#include "plug-in/plug-in-proc.h"
#include "file/file-open.h"
#include "file/file-utils.h"
......
......@@ -30,9 +30,6 @@
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "plug-in/plug-in-proc.h"
#include "plug-in/plug-in-run.h"
#include "file/file-save.h"
#include "file/file-utils.h"
......@@ -83,8 +80,6 @@ file_save_dialog_show (GimpImage *gimage,
GimpMenuFactory *menu_factory,
GtkWidget *parent)
{
gchar *filename;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory));
g_return_if_fail (parent == NULL || GTK_IS_WIDGET (parent));
......@@ -95,10 +90,6 @@ file_save_dialog_show (GimpImage *gimage,
if (! filesave)
filesave = file_save_dialog_create (gimage->gimp, menu_factory);
GIMP_FILE_DIALOG (filesave)->gimage = gimage;
GIMP_FILE_DIALOG (filesave)->set_uri_and_proc = TRUE;
GIMP_FILE_DIALOG (filesave)->set_image_clean = TRUE;
gtk_widget_set_sensitive (GTK_WIDGET (filesave), TRUE);
if (GTK_WIDGET_VISIBLE (filesave))
......@@ -109,17 +100,8 @@ file_save_dialog_show (GimpImage *gimage,
gtk_window_set_title (GTK_WINDOW (filesave), _("Save Image"));
filename = gimp_image_get_filename (gimage);
gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesave),
filename ?
filename :
"." G_DIR_SEPARATOR_S);
g_free (filename);
gimp_item_factory_update (GIMP_FILE_DIALOG (filesave)->item_factory,
gimp_image_active_drawable (gimage));
gimp_file_dialog_set_image (GIMP_FILE_DIALOG (filesave),
gimage, TRUE, TRUE);
file_dialog_show (filesave, parent);
}
......@@ -129,27 +111,16 @@ file_save_a_copy_dialog_show (GimpImage *gimage,
GimpMenuFactory *menu_factory,
GtkWidget *parent)
{
const gchar *uri;
gchar *filename = NULL;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory));
g_return_if_fail (parent == NULL || GTK_IS_WIDGET (parent));
if (! gimp_image_active_drawable (gimage))
return;
uri = gimp_object_get_name (GIMP_OBJECT (gimage));
if (uri)
filename = g_filename_from_uri (uri, NULL, NULL);
if (! filesave)
filesave = file_save_dialog_create (gimage->gimp, menu_factory);
GIMP_FILE_DIALOG (filesave)->gimage = gimage;
GIMP_FILE_DIALOG (filesave)->set_uri_and_proc = FALSE;
GIMP_FILE_DIALOG (filesave)->set_image_clean = FALSE;
gtk_widget_set_sensitive (GTK_WIDGET (filesave), TRUE);
if (GTK_WIDGET_VISIBLE (filesave))
......@@ -160,15 +131,8 @@ file_save_a_copy_dialog_show (GimpImage *gimage,
gtk_window_set_title (GTK_WINDOW (filesave), _("Save a Copy of the Image"));
gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesave),
filename ?
filename :
"." G_DIR_SEPARATOR_S);
g_free (filename);
gimp_item_factory_update (GIMP_FILE_DIALOG (filesave)->item_factory,
gimp_image_active_drawable (gimage));
gimp_file_dialog_set_image (GIMP_FILE_DIALOG (filesave),
gimage, FALSE, FALSE);
file_dialog_show (filesave, parent);
}
......
......@@ -27,13 +27,8 @@
#include "gui-types.h"
#include "config/gimpcoreconfig.h"
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "core/gimpimagefile.h"
#include "plug-in/plug-in-proc.h"
#include "file/file-open.h"
#include "file/file-utils.h"
......
......@@ -30,9 +30,6 @@
#include "core/gimp.h"
#include "core/gimpimage.h"
#include "plug-in/plug-in-proc.h"
#include "plug-in/plug-in-run.h"
#include "file/file-save.h"
#include "file/file-utils.h"
......@@ -83,8 +80,6 @@ file_save_dialog_show (GimpImage *gimage,
GimpMenuFactory *menu_factory,
GtkWidget *parent)
{
gchar *filename;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory));
g_return_if_fail (parent == NULL || GTK_IS_WIDGET (parent));
......@@ -95,10 +90,6 @@ file_save_dialog_show (GimpImage *gimage,
if (! filesave)
filesave = file_save_dialog_create (gimage->gimp, menu_factory);
GIMP_FILE_DIALOG (filesave)->gimage = gimage;
GIMP_FILE_DIALOG (filesave)->set_uri_and_proc = TRUE;
GIMP_FILE_DIALOG (filesave)->set_image_clean = TRUE;
gtk_widget_set_sensitive (GTK_WIDGET (filesave), TRUE);
if (GTK_WIDGET_VISIBLE (filesave))
......@@ -109,17 +100,8 @@ file_save_dialog_show (GimpImage *gimage,
gtk_window_set_title (GTK_WINDOW (filesave), _("Save Image"));
filename = gimp_image_get_filename (gimage);
gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesave),
filename ?
filename :
"." G_DIR_SEPARATOR_S);
g_free (filename);
gimp_item_factory_update (GIMP_FILE_DIALOG (filesave)->item_factory,
gimp_image_active_drawable (gimage));
gimp_file_dialog_set_image (GIMP_FILE_DIALOG (filesave),
gimage, TRUE, TRUE);
file_dialog_show (filesave, parent);
}
......@@ -129,27 +111,16 @@ file_save_a_copy_dialog_show (GimpImage *gimage,
GimpMenuFactory *menu_factory,
GtkWidget *parent)
{
const gchar *uri;
gchar *filename = NULL;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory));
g_return_if_fail (parent == NULL || GTK_IS_WIDGET (parent));
if (! gimp_image_active_drawable (gimage))
return;
uri = gimp_object_get_name (GIMP_OBJECT (gimage));
if (uri)
filename = g_filename_from_uri (uri, NULL, NULL);
if (! filesave)
filesave = file_save_dialog_create (gimage->gimp, menu_factory);
GIMP_FILE_DIALOG (filesave)->gimage = gimage;
GIMP_FILE_DIALOG (filesave)->set_uri_and_proc = FALSE;
GIMP_FILE_DIALOG (filesave)->set_image_clean = FALSE;
gtk_widget_set_sensitive (GTK_WIDGET (filesave), TRUE);
if (GTK_WIDGET_VISIBLE (filesave))
......@@ -160,15 +131,8 @@ file_save_a_copy_dialog_show (GimpImage *gimage,
gtk_window_set_title (GTK_WINDOW (filesave), _("Save a Copy of the Image"));
gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesave),
filename ?
filename :
"." G_DIR_SEPARATOR_S);
g_free (filename);
gimp_item_factory_update (GIMP_FILE_DIALOG (filesave)->item_factory,
gimp_image_active_drawable (gimage));
gimp_file_dialog_set_image (GIMP_FILE_DIALOG (filesave),
gimage, FALSE, FALSE);
file_dialog_show (filesave, parent);
}
......
......@@ -39,6 +39,7 @@
#include "plug-in/plug-in-proc.h"
#include "gimpfiledialog.h"
#include "gimpitemfactory.h"
#include "gimpmenufactory.h"
#include "gimpthumbbox.h"
......@@ -252,6 +253,34 @@ gimp_file_dialog_set_file_proc (GimpFileDialog *dialog,
}
}
void
gimp_file_dialog_set_image (GimpFileDialog *dialog,
GimpImage *gimage,
gboolean set_uri_and_proc,
gboolean set_image_clean)
{
gchar *filename;
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;
filename = gimp_image_get_filename (gimage);
gtk_file_selection_set_filename (GTK_FILE_SELECTION (dialog),
filename ?
filename :
"." G_DIR_SEPARATOR_S);
g_free (filename);
gimp_item_factory_update (dialog->item_factory,
gimp_image_active_drawable (gimage));
}
/* private functions */
......
......@@ -70,6 +70,11 @@ GtkWidget * gimp_file_dialog_new (Gimp *gimp,
void gimp_file_dialog_set_file_proc (GimpFileDialog *dialog,
PlugInProcDef *file_proc);
void gimp_file_dialog_set_image (GimpFileDialog *dialog,
GimpImage *gimage,
gboolean set_uri_and_proc,
gboolean set_image_clean);
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