make the "Save EXIF data" toggle insensitive when no EXIF data is present

2004-09-13  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/jpeg.c (save_dialog): make the "Save EXIF data"
	toggle insensitive when no EXIF data is present (bug #140042).

	* app/display/gimpdisplayshell-close.c: as suggested by the HIG,
	ask the user to save the image when the last display is being
	closed. Addresses some issues raised in bug #106726.
This commit is contained in:
Sven Neumann 2004-09-13 21:58:27 +00:00 committed by Sven Neumann
parent 359303a796
commit e2d8f7e48d
10 changed files with 105 additions and 25 deletions

View File

@ -1,3 +1,12 @@
2004-09-13 Sven Neumann <sven@gimp.org>
* plug-ins/common/jpeg.c (save_dialog): make the "Save EXIF data"
toggle insensitive when no EXIF data is present (bug #140042).
* app/display/gimpdisplayshell-close.c: as suggested by the HIG,
ask the user to save the image when the last display is being
closed. Addresses some issues raised in bug #106726.
2004-09-13 Michael Natterer <mitch@gimp.org>
* app/app_procs.c (app_run): install the message handler for the

View File

@ -33,6 +33,7 @@
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpmessagebox.h"
#include "widgets/gimpuimanager.h"
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
@ -43,11 +44,13 @@
/* local function prototypes */
static void gimp_display_shell_close_dialog (GimpDisplayShell *shell,
GimpImage *gimage);
static void gimp_display_shell_close_response (GtkWidget *widget,
gboolean close,
GimpDisplayShell *shell);
static void gimp_display_shell_close_dialog (GimpDisplayShell *shell,
GimpImage *gimage);
static void gimp_display_shell_close_name_changed (GimpImage *image,
GtkWidget *dialog);
static void gimp_display_shell_close_response (GtkWidget *widget,
gboolean close,
GimpDisplayShell *shell);
/* public functions */
@ -88,6 +91,9 @@ gimp_display_shell_close (GimpDisplayShell *shell,
/* private functions */
#define RESPONSE_SAVE 1
static void
gimp_display_shell_close_dialog (GimpDisplayShell *shell,
GimpImage *gimage)
@ -105,7 +111,8 @@ gimp_display_shell_close_dialog (GimpDisplayShell *shell,
name = file_utils_uri_to_utf8_basename (gimp_image_get_uri (gimage));
title = g_strdup_printf (_("Close %s?"), name);
title = g_strdup_printf (_("Close %s"), name);
g_free (name);
shell->close_dialog =
dialog = gimp_dialog_new (title,
@ -114,13 +121,16 @@ gimp_display_shell_close_dialog (GimpDisplayShell *shell,
gimp_standard_help_func,
GIMP_HELP_FILE_CLOSE_CONFIRM,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Discard changes"), GTK_RESPONSE_OK,
_("_Close without Saving"), GTK_RESPONSE_CLOSE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, RESPONSE_SAVE,
NULL);
g_free (title);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), RESPONSE_SAVE);
g_signal_connect (dialog, "destroy",
G_CALLBACK (gtk_widget_destroyed),
&shell->close_dialog);
@ -134,17 +144,41 @@ gimp_display_shell_close_dialog (GimpDisplayShell *shell,
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), box);
gtk_widget_show (box);
gimp_message_box_set_primary_text (GIMP_MESSAGE_BOX (box),
_("Changes were made to '%s'."), name);
g_object_set_data (G_OBJECT (dialog), "message-box", box);
g_free (name);
g_signal_connect_object (gimage, "name_changed",
G_CALLBACK (gimp_display_shell_close_name_changed),
dialog, 0);
gimp_display_shell_close_name_changed (gimage, dialog);
gimp_message_box_set_text (GIMP_MESSAGE_BOX (box),
_("Unsaved changes will be lost."));
_("If you don't save the image, "
"changes will be lost."));
gtk_widget_show (dialog);
}
static void
gimp_display_shell_close_name_changed (GimpImage *image,
GtkWidget *dialog)
{
GtkWidget *box = g_object_get_data (G_OBJECT (dialog), "message-box");
gchar *name;
gchar *title;
name = file_utils_uri_to_utf8_basename (gimp_image_get_uri (image));
title = g_strdup_printf (_("Close %s"), name);
gtk_window_set_title (GTK_WINDOW (dialog), title);
g_free (title);
gimp_message_box_set_primary_text (GIMP_MESSAGE_BOX (box),
_("Save the changes to image '%s' "
"before closing?"), name);
g_free (name);
}
static void
gimp_display_shell_close_response (GtkWidget *widget,
gint response_id,
@ -152,6 +186,31 @@ gimp_display_shell_close_response (GtkWidget *widget,
{
gtk_widget_destroy (widget);
if (response_id == GTK_RESPONSE_OK)
gimp_display_delete (shell->gdisp);
switch (response_id)
{
case GTK_RESPONSE_CLOSE:
gimp_display_delete (shell->gdisp);
break;
case RESPONSE_SAVE:
{
GimpActionGroup *group;
GtkAction *action;
group = gimp_ui_manager_get_action_group (shell->menubar_manager,
"file");
action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
"file-save");
g_return_if_fail (action != NULL);
gtk_action_activate (action);
if (! shell->gdisp->gimage->dirty)
gimp_display_delete (shell->gdisp);
}
break;
default:
break;
}
}

View File

@ -31,8 +31,8 @@ The communication protocol between GIMP and it's plug-ins.
@tile_width:
@tile_height:
@shm_ID:
@gimp_reserved_1:
@gimp_reserved_2:
@check_size:
@check_type:
@gimp_reserved_3:
@gimp_reserved_4:
@gimp_reserved_5:
@ -41,8 +41,6 @@ The communication protocol between GIMP and it's plug-ins.
@gimp_reserved_8:
@install_cmap:
@show_tool_tips:
@check_size:
@check_type:
@min_colors:
@gdisp_ID:
@app_name:

View File

@ -1913,7 +1913,9 @@ save_dialog (void)
&jsvals.save_exif);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (exif_toggle),
jsvals.save_exif);
jsvals.save_exif && exif_data);
gtk_widget_set_sensitive (exif_toggle, exif_data != NULL);
#endif
/* Subsampling */

View File

@ -1913,7 +1913,9 @@ save_dialog (void)
&jsvals.save_exif);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (exif_toggle),
jsvals.save_exif);
jsvals.save_exif && exif_data);
gtk_widget_set_sensitive (exif_toggle, exif_data != NULL);
#endif
/* Subsampling */

View File

@ -1913,7 +1913,9 @@ save_dialog (void)
&jsvals.save_exif);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (exif_toggle),
jsvals.save_exif);
jsvals.save_exif && exif_data);
gtk_widget_set_sensitive (exif_toggle, exif_data != NULL);
#endif
/* Subsampling */

View File

@ -1913,7 +1913,9 @@ save_dialog (void)
&jsvals.save_exif);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (exif_toggle),
jsvals.save_exif);
jsvals.save_exif && exif_data);
gtk_widget_set_sensitive (exif_toggle, exif_data != NULL);
#endif
/* Subsampling */

View File

@ -1913,7 +1913,9 @@ save_dialog (void)
&jsvals.save_exif);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (exif_toggle),
jsvals.save_exif);
jsvals.save_exif && exif_data);
gtk_widget_set_sensitive (exif_toggle, exif_data != NULL);
#endif
/* Subsampling */

View File

@ -1913,7 +1913,9 @@ save_dialog (void)
&jsvals.save_exif);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (exif_toggle),
jsvals.save_exif);
jsvals.save_exif && exif_data);
gtk_widget_set_sensitive (exif_toggle, exif_data != NULL);
#endif
/* Subsampling */

View File

@ -1913,7 +1913,9 @@ save_dialog (void)
&jsvals.save_exif);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (exif_toggle),
jsvals.save_exif);
jsvals.save_exif && exif_data);
gtk_widget_set_sensitive (exif_toggle, exif_data != NULL);
#endif
/* Subsampling */