mirror of https://github.com/GNOME/gimp.git
app/gui/file-open-dialog.c merged some small fixes/changes from my HEAD
2004-02-27 Michael Natterer <mitch@gimp.org> * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c: merged some small fixes/changes from my HEAD tree so the file chooser patch becomes smaller.
This commit is contained in:
parent
0ca4fe757f
commit
babcd868bf
|
@ -1,3 +1,9 @@
|
|||
2004-02-27 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/gui/file-open-dialog.c
|
||||
* app/gui/file-save-dialog.c: merged some small fixes/changes
|
||||
from my HEAD tree so the file chooser patch becomes smaller.
|
||||
|
||||
2004-02-27 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimpimagefile.c (gimp_imagefile_save_thumb): peek the
|
||||
|
|
|
@ -57,13 +57,15 @@ static GtkWidget * file_open_dialog_create (Gimp *gimp,
|
|||
static void file_open_dialog_response (GtkWidget *open_dialog,
|
||||
gint response_id,
|
||||
Gimp *gimp);
|
||||
static void file_open_dialog_open_image (GtkWidget *open_dialog,
|
||||
static gboolean file_open_dialog_open_image (GtkWidget *open_dialog,
|
||||
Gimp *gimp,
|
||||
const gchar *uri,
|
||||
const gchar *entered_filename,
|
||||
PlugInProcDef *load_proc);
|
||||
|
||||
|
||||
/* private variables */
|
||||
|
||||
static GtkWidget *fileload = NULL;
|
||||
|
||||
|
||||
|
@ -81,6 +83,7 @@ file_open_dialog_show (Gimp *gimp,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (gimage == NULL || 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 (! fileload)
|
||||
fileload = file_open_dialog_create (gimp, menu_factory);
|
||||
|
@ -210,11 +213,14 @@ file_open_dialog_response (GtkWidget *open_dialog,
|
|||
|
||||
gtk_widget_set_sensitive (open_dialog, FALSE);
|
||||
|
||||
file_open_dialog_open_image (open_dialog,
|
||||
gimp,
|
||||
uri,
|
||||
entered_filename,
|
||||
GIMP_FILE_DIALOG (open_dialog)->file_proc);
|
||||
if (file_open_dialog_open_image (open_dialog,
|
||||
gimp,
|
||||
uri,
|
||||
entered_filename,
|
||||
GIMP_FILE_DIALOG (open_dialog)->file_proc))
|
||||
{
|
||||
file_dialog_hide (open_dialog);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
|
||||
|
@ -228,11 +234,14 @@ file_open_dialog_response (GtkWidget *open_dialog,
|
|||
{
|
||||
uri = g_filename_to_uri (selections[i], NULL, NULL);
|
||||
|
||||
file_open_dialog_open_image (open_dialog,
|
||||
gimp,
|
||||
uri,
|
||||
uri,
|
||||
GIMP_FILE_DIALOG (open_dialog)->file_proc);
|
||||
if (file_open_dialog_open_image (open_dialog,
|
||||
gimp,
|
||||
uri,
|
||||
uri,
|
||||
GIMP_FILE_DIALOG (open_dialog)->file_proc))
|
||||
{
|
||||
file_dialog_hide (open_dialog);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
@ -243,7 +252,7 @@ file_open_dialog_response (GtkWidget *open_dialog,
|
|||
gtk_widget_set_sensitive (open_dialog, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
file_open_dialog_open_image (GtkWidget *open_dialog,
|
||||
Gimp *gimp,
|
||||
const gchar *uri,
|
||||
|
@ -263,13 +272,11 @@ file_open_dialog_open_image (GtkWidget *open_dialog,
|
|||
|
||||
if (gimage)
|
||||
{
|
||||
file_dialog_hide (open_dialog);
|
||||
return TRUE;
|
||||
}
|
||||
else if (status != GIMP_PDB_CANCEL)
|
||||
{
|
||||
gchar *filename;
|
||||
|
||||
filename = file_utils_uri_to_utf8_filename (uri);
|
||||
gchar *filename = file_utils_uri_to_utf8_filename (uri);
|
||||
|
||||
g_message (_("Opening '%s' failed:\n\n%s"),
|
||||
filename, error->message);
|
||||
|
@ -277,4 +284,6 @@ file_open_dialog_open_image (GtkWidget *open_dialog,
|
|||
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
static GtkWidget * file_save_dialog_create (Gimp *gimp,
|
||||
GimpMenuFactory *menu_factory);
|
||||
static void file_save_response_callback (GtkWidget *save_dialog,
|
||||
static void file_save_dialog_response (GtkWidget *save_dialog,
|
||||
gint response_id,
|
||||
Gimp *gimp);
|
||||
static void file_save_overwrite (GtkWidget *save_dialog,
|
||||
|
@ -71,6 +71,8 @@ static void file_save_dialog_save_image (GtkWidget *save_dialog,
|
|||
gboolean set_image_clean);
|
||||
|
||||
|
||||
/* private variables */
|
||||
|
||||
static GtkWidget *filesave = NULL;
|
||||
|
||||
|
||||
|
@ -85,6 +87,7 @@ file_save_dialog_show (GimpImage *gimage,
|
|||
|
||||
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;
|
||||
|
@ -190,16 +193,16 @@ file_save_dialog_create (Gimp *gimp,
|
|||
save_dialog);
|
||||
|
||||
g_signal_connect (save_dialog, "response",
|
||||
G_CALLBACK (file_save_response_callback),
|
||||
G_CALLBACK (file_save_dialog_response),
|
||||
gimp);
|
||||
|
||||
return save_dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
file_save_response_callback (GtkWidget *save_dialog,
|
||||
gint response_id,
|
||||
Gimp *gimp)
|
||||
file_save_dialog_response (GtkWidget *save_dialog,
|
||||
gint response_id,
|
||||
Gimp *gimp)
|
||||
{
|
||||
GtkFileSelection *fs;
|
||||
const gchar *filename;
|
||||
|
@ -287,27 +290,25 @@ file_save_overwrite (GtkWidget *save_dialog,
|
|||
overwrite_data->raw_filename = g_strdup (raw_filename);
|
||||
|
||||
filename = file_utils_uri_to_utf8_filename (uri);
|
||||
|
||||
message = g_strdup_printf (_("File '%s' exists.\n"
|
||||
"Overwrite it?"), filename);
|
||||
|
||||
g_free (filename);
|
||||
|
||||
query_box = gimp_query_boolean_box (_("File Exists!"),
|
||||
save_dialog,
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_FILE_SAVE_OVERWRITE,
|
||||
GIMP_STOCK_QUESTION,
|
||||
message,
|
||||
GTK_STOCK_YES, GTK_STOCK_NO,
|
||||
NULL, NULL,
|
||||
file_save_overwrite_callback,
|
||||
overwrite_data);
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_FILE_SAVE_OVERWRITE,
|
||||
GIMP_STOCK_QUESTION,
|
||||
message,
|
||||
GTK_STOCK_YES, GTK_STOCK_NO,
|
||||
NULL, NULL,
|
||||
file_save_overwrite_callback,
|
||||
overwrite_data);
|
||||
|
||||
g_free (message);
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (query_box),
|
||||
GTK_WINDOW (save_dialog));
|
||||
GTK_WINDOW (save_dialog));
|
||||
|
||||
gtk_widget_set_sensitive (save_dialog, FALSE);
|
||||
|
||||
|
@ -365,9 +366,7 @@ file_save_dialog_save_image (GtkWidget *save_dialog,
|
|||
if (status != GIMP_PDB_SUCCESS &&
|
||||
status != GIMP_PDB_CANCEL)
|
||||
{
|
||||
gchar *filename;
|
||||
|
||||
filename = file_utils_uri_to_utf8_filename (uri);
|
||||
gchar *filename = file_utils_uri_to_utf8_filename (uri);
|
||||
|
||||
g_message (_("Saving '%s' failed:\n\n%s"),
|
||||
filename, error->message);
|
||||
|
|
|
@ -57,13 +57,15 @@ static GtkWidget * file_open_dialog_create (Gimp *gimp,
|
|||
static void file_open_dialog_response (GtkWidget *open_dialog,
|
||||
gint response_id,
|
||||
Gimp *gimp);
|
||||
static void file_open_dialog_open_image (GtkWidget *open_dialog,
|
||||
static gboolean file_open_dialog_open_image (GtkWidget *open_dialog,
|
||||
Gimp *gimp,
|
||||
const gchar *uri,
|
||||
const gchar *entered_filename,
|
||||
PlugInProcDef *load_proc);
|
||||
|
||||
|
||||
/* private variables */
|
||||
|
||||
static GtkWidget *fileload = NULL;
|
||||
|
||||
|
||||
|
@ -81,6 +83,7 @@ file_open_dialog_show (Gimp *gimp,
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (gimage == NULL || 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 (! fileload)
|
||||
fileload = file_open_dialog_create (gimp, menu_factory);
|
||||
|
@ -210,11 +213,14 @@ file_open_dialog_response (GtkWidget *open_dialog,
|
|||
|
||||
gtk_widget_set_sensitive (open_dialog, FALSE);
|
||||
|
||||
file_open_dialog_open_image (open_dialog,
|
||||
gimp,
|
||||
uri,
|
||||
entered_filename,
|
||||
GIMP_FILE_DIALOG (open_dialog)->file_proc);
|
||||
if (file_open_dialog_open_image (open_dialog,
|
||||
gimp,
|
||||
uri,
|
||||
entered_filename,
|
||||
GIMP_FILE_DIALOG (open_dialog)->file_proc))
|
||||
{
|
||||
file_dialog_hide (open_dialog);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
|
||||
|
@ -228,11 +234,14 @@ file_open_dialog_response (GtkWidget *open_dialog,
|
|||
{
|
||||
uri = g_filename_to_uri (selections[i], NULL, NULL);
|
||||
|
||||
file_open_dialog_open_image (open_dialog,
|
||||
gimp,
|
||||
uri,
|
||||
uri,
|
||||
GIMP_FILE_DIALOG (open_dialog)->file_proc);
|
||||
if (file_open_dialog_open_image (open_dialog,
|
||||
gimp,
|
||||
uri,
|
||||
uri,
|
||||
GIMP_FILE_DIALOG (open_dialog)->file_proc))
|
||||
{
|
||||
file_dialog_hide (open_dialog);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
|
@ -243,7 +252,7 @@ file_open_dialog_response (GtkWidget *open_dialog,
|
|||
gtk_widget_set_sensitive (open_dialog, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
file_open_dialog_open_image (GtkWidget *open_dialog,
|
||||
Gimp *gimp,
|
||||
const gchar *uri,
|
||||
|
@ -263,13 +272,11 @@ file_open_dialog_open_image (GtkWidget *open_dialog,
|
|||
|
||||
if (gimage)
|
||||
{
|
||||
file_dialog_hide (open_dialog);
|
||||
return TRUE;
|
||||
}
|
||||
else if (status != GIMP_PDB_CANCEL)
|
||||
{
|
||||
gchar *filename;
|
||||
|
||||
filename = file_utils_uri_to_utf8_filename (uri);
|
||||
gchar *filename = file_utils_uri_to_utf8_filename (uri);
|
||||
|
||||
g_message (_("Opening '%s' failed:\n\n%s"),
|
||||
filename, error->message);
|
||||
|
@ -277,4 +284,6 @@ file_open_dialog_open_image (GtkWidget *open_dialog,
|
|||
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
static GtkWidget * file_save_dialog_create (Gimp *gimp,
|
||||
GimpMenuFactory *menu_factory);
|
||||
static void file_save_response_callback (GtkWidget *save_dialog,
|
||||
static void file_save_dialog_response (GtkWidget *save_dialog,
|
||||
gint response_id,
|
||||
Gimp *gimp);
|
||||
static void file_save_overwrite (GtkWidget *save_dialog,
|
||||
|
@ -71,6 +71,8 @@ static void file_save_dialog_save_image (GtkWidget *save_dialog,
|
|||
gboolean set_image_clean);
|
||||
|
||||
|
||||
/* private variables */
|
||||
|
||||
static GtkWidget *filesave = NULL;
|
||||
|
||||
|
||||
|
@ -85,6 +87,7 @@ file_save_dialog_show (GimpImage *gimage,
|
|||
|
||||
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;
|
||||
|
@ -190,16 +193,16 @@ file_save_dialog_create (Gimp *gimp,
|
|||
save_dialog);
|
||||
|
||||
g_signal_connect (save_dialog, "response",
|
||||
G_CALLBACK (file_save_response_callback),
|
||||
G_CALLBACK (file_save_dialog_response),
|
||||
gimp);
|
||||
|
||||
return save_dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
file_save_response_callback (GtkWidget *save_dialog,
|
||||
gint response_id,
|
||||
Gimp *gimp)
|
||||
file_save_dialog_response (GtkWidget *save_dialog,
|
||||
gint response_id,
|
||||
Gimp *gimp)
|
||||
{
|
||||
GtkFileSelection *fs;
|
||||
const gchar *filename;
|
||||
|
@ -287,27 +290,25 @@ file_save_overwrite (GtkWidget *save_dialog,
|
|||
overwrite_data->raw_filename = g_strdup (raw_filename);
|
||||
|
||||
filename = file_utils_uri_to_utf8_filename (uri);
|
||||
|
||||
message = g_strdup_printf (_("File '%s' exists.\n"
|
||||
"Overwrite it?"), filename);
|
||||
|
||||
g_free (filename);
|
||||
|
||||
query_box = gimp_query_boolean_box (_("File Exists!"),
|
||||
save_dialog,
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_FILE_SAVE_OVERWRITE,
|
||||
GIMP_STOCK_QUESTION,
|
||||
message,
|
||||
GTK_STOCK_YES, GTK_STOCK_NO,
|
||||
NULL, NULL,
|
||||
file_save_overwrite_callback,
|
||||
overwrite_data);
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_FILE_SAVE_OVERWRITE,
|
||||
GIMP_STOCK_QUESTION,
|
||||
message,
|
||||
GTK_STOCK_YES, GTK_STOCK_NO,
|
||||
NULL, NULL,
|
||||
file_save_overwrite_callback,
|
||||
overwrite_data);
|
||||
|
||||
g_free (message);
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (query_box),
|
||||
GTK_WINDOW (save_dialog));
|
||||
GTK_WINDOW (save_dialog));
|
||||
|
||||
gtk_widget_set_sensitive (save_dialog, FALSE);
|
||||
|
||||
|
@ -365,9 +366,7 @@ file_save_dialog_save_image (GtkWidget *save_dialog,
|
|||
if (status != GIMP_PDB_SUCCESS &&
|
||||
status != GIMP_PDB_CANCEL)
|
||||
{
|
||||
gchar *filename;
|
||||
|
||||
filename = file_utils_uri_to_utf8_filename (uri);
|
||||
gchar *filename = file_utils_uri_to_utf8_filename (uri);
|
||||
|
||||
g_message (_("Saving '%s' failed:\n\n%s"),
|
||||
filename, error->message);
|
||||
|
|
Loading…
Reference in New Issue