[gimp] app: Show "Overwrite <filename>" in File menu



commit 8a1e826d99361434f31d3ec01da1d877b671dcd6
Author: Martin Nordholts <martinn src gnome org>
Date:   Thu Jul 2 21:20:51 2009 +0200

    app: Show "Overwrite <filename>" in File menu
    
    With no export target but with an import source, show
    "Overwrite <filename>" in the File menu. This also means we can't set
    GIMP_FILE_EXPORT_TO_URI_KEY along with import source any longer.

 app/actions/file-actions.c |   17 ++++++++++++++---
 app/file/file-open.c       |    4 ----
 2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c
index b5cabe5..694067d 100644
--- a/app/actions/file-actions.c
+++ b/app/actions/file-actions.c
@@ -242,12 +242,15 @@ file_actions_update (GimpActionGroup *group,
 {
   GimpImage    *image     = action_data_get_image (data);
   GimpDrawable *drawable  = NULL;
+  const gchar  *source    = NULL;
   const gchar  *export_to = NULL;
   gchar        *label     = NULL;
 
   if (image)
     {
       drawable  = gimp_image_get_active_drawable (image);
+      source    = g_object_get_data (G_OBJECT (image),
+                                     GIMP_FILE_IMPORT_SOURCE_URI_KEY);
       export_to = g_object_get_data (G_OBJECT (image),
                                      GIMP_FILE_EXPORT_TO_URI_KEY);
     }
@@ -258,12 +261,20 @@ file_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("file-save",            image && drawable);
   SET_SENSITIVE ("file-save-as",         image && drawable);
   SET_SENSITIVE ("file-save-a-copy",     image && drawable);
-  SET_SENSITIVE ("file-revert",          image && (GIMP_OBJECT (image)->name || export_to));
+  SET_SENSITIVE ("file-revert",          image && (GIMP_OBJECT (image)->name || source));
   SET_SENSITIVE ("file-export",          image && drawable);
-  SET_SENSITIVE ("file-export-to",       export_to);
+  SET_SENSITIVE ("file-export-to",       source || export_to);
   SET_SENSITIVE ("file-create-template", image);
 
-  if (export_to)
+  if (source && ! export_to)
+    {
+      /*  Update file-export-to label */
+      label = g_strdup_printf (_("Overwrite %s"),
+                               file_utils_uri_display_basename (source));
+      gimp_action_group_set_action_label (group, "file-export-to", label);
+      g_free (label);
+    }
+  else if (export_to)
     {
       /*  Update file-export-to label */
       label = g_strdup_printf (_("Export to %s"),
diff --git a/app/file/file-open.c b/app/file/file-open.c
index 63cdcf1..0f52510 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -209,10 +209,6 @@ file_open_image (Gimp                *gimp,
           g_object_set_data_full (G_OBJECT (image), GIMP_FILE_IMPORT_SOURCE_URI_KEY,
                                   g_strdup (uri), (GDestroyNotify) g_free);
 
-          /* Set 'Export to' target to import source */
-          g_object_set_data_full (G_OBJECT (image), GIMP_FILE_EXPORT_TO_URI_KEY,
-                                  g_strdup (uri), (GDestroyNotify) g_free);
-
           /* We shall treat this file as an Untitled file */
           gimp_object_set_name (GIMP_OBJECT (image), NULL);
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]