mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 17:59:37 +00:00
app: Support File -> Revert of imported images
If a file has not been saved yet but was imported from some other image, revert to that image.
This commit is contained in:
parent
88e1064ed3
commit
e3f57fbd38
1 changed files with 19 additions and 3 deletions
|
@ -312,16 +312,24 @@ file_revert_cmd_callback (GtkAction *action,
|
||||||
GimpDisplay *display;
|
GimpDisplay *display;
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
const gchar *uri;
|
const gchar *uri = NULL;
|
||||||
|
const gchar *source = NULL;
|
||||||
return_if_no_display (display, data);
|
return_if_no_display (display, data);
|
||||||
|
|
||||||
image = display->image;
|
image = display->image;
|
||||||
|
|
||||||
uri = gimp_object_get_name (GIMP_OBJECT (image));
|
uri = gimp_object_get_name (GIMP_OBJECT (image));
|
||||||
|
|
||||||
|
if (! uri)
|
||||||
|
{
|
||||||
|
uri = g_object_get_data (G_OBJECT (image),
|
||||||
|
GIMP_FILE_IMPORT_SOURCE_URI_KEY);
|
||||||
|
source = uri;
|
||||||
|
}
|
||||||
|
|
||||||
dialog = g_object_get_data (G_OBJECT (image), REVERT_DATA_KEY);
|
dialog = g_object_get_data (G_OBJECT (image), REVERT_DATA_KEY);
|
||||||
|
|
||||||
if (! uri)
|
if (! uri && ! source)
|
||||||
{
|
{
|
||||||
gimp_message_literal (image->gimp,
|
gimp_message_literal (image->gimp,
|
||||||
G_OBJECT (display), GIMP_MESSAGE_ERROR,
|
G_OBJECT (display), GIMP_MESSAGE_ERROR,
|
||||||
|
@ -360,7 +368,11 @@ file_revert_cmd_callback (GtkAction *action,
|
||||||
G_CALLBACK (file_revert_confirm_response),
|
G_CALLBACK (file_revert_confirm_response),
|
||||||
display);
|
display);
|
||||||
|
|
||||||
|
if (! source)
|
||||||
basename = file_utils_uri_display_basename (uri);
|
basename = file_utils_uri_display_basename (uri);
|
||||||
|
else
|
||||||
|
basename = g_strdup (gimp_image_get_uri (image));
|
||||||
|
|
||||||
filename = file_utils_uri_display_name (uri);
|
filename = file_utils_uri_display_name (uri);
|
||||||
|
|
||||||
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
|
gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
|
||||||
|
@ -556,6 +568,10 @@ file_revert_confirm_response (GtkWidget *dialog,
|
||||||
|
|
||||||
uri = gimp_object_get_name (GIMP_OBJECT (old_image));
|
uri = gimp_object_get_name (GIMP_OBJECT (old_image));
|
||||||
|
|
||||||
|
if (! uri)
|
||||||
|
uri = g_object_get_data (G_OBJECT (old_image),
|
||||||
|
GIMP_FILE_IMPORT_SOURCE_URI_KEY);
|
||||||
|
|
||||||
new_image = file_open_image (gimp, gimp_get_user_context (gimp),
|
new_image = file_open_image (gimp, gimp_get_user_context (gimp),
|
||||||
GIMP_PROGRESS (display),
|
GIMP_PROGRESS (display),
|
||||||
uri, uri, FALSE, NULL,
|
uri, uri, FALSE, NULL,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue