[gimp] app: don't call gimp_ui_manager_update() directly



commit 6742ebc94965af3e07fd713aa1cb602e6d3ee1fd
Author: Sven Neumann <sven gimp org>
Date:   Sun May 17 11:02:31 2009 +0200

    app: don't call gimp_ui_manager_update() directly
    
    gimp_ui_manager_update() should not be called directly. Instead call
    gimp_image_flush() after doing changes that need to be reflected in
    the menus.
---
 app/dialogs/file-save-dialog.c     |    5 ++++-
 app/display/gimpdisplay-handlers.c |   23 ++++-------------------
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c
index 6603d6d..29fa157 100644
--- a/app/dialogs/file-save-dialog.c
+++ b/app/dialogs/file-save-dialog.c
@@ -233,7 +233,10 @@ file_save_dialog_response (GtkWidget *save_dialog,
           g_object_set_data_full (G_OBJECT (dialog->image->gimp),
                                   GIMP_FILE_SAVE_LAST_URI_KEY,
                                   g_strdup (uri), (GDestroyNotify) g_free);
-          
+
+          /*  make sure the menus are updated with the keys we've just set  */
+          gimp_image_flush (dialog->image);
+
           /* Handle close-after-saing */
           if (dialog)
             {
diff --git a/app/display/gimpdisplay-handlers.c b/app/display/gimpdisplay-handlers.c
index 592323a..3605466 100644
--- a/app/display/gimpdisplay-handlers.c
+++ b/app/display/gimpdisplay-handlers.c
@@ -28,8 +28,6 @@
 
 #include "file/file-utils.h"
 
-#include "widgets/gimpuimanager.h"
-
 #include "gimpdisplay.h"
 #include "gimpdisplay-handlers.h"
 #include "gimpdisplayshell.h"
@@ -168,22 +166,11 @@ gimp_display_saved_handler (GimpImage   *image,
   gchar     *filename  = file_utils_uri_display_name (uri);
 
   gimp_statusbar_push_temp (GIMP_STATUSBAR (statusbar), GIMP_MESSAGE_INFO,
-                            GTK_STOCK_SAVE, _("Image saved to '%s'"), filename);
+                            GTK_STOCK_SAVE, _("Image saved to '%s'"),
+                            filename);
   g_free (filename);
 }
 
-static gboolean
-gimp_display_update_ui_manager_idle (GimpDisplay *display)
-{
-  if (! display || ! display->shell)
-    return FALSE;
-
-  /* Update the File/Export to label */
-  gimp_ui_manager_update (GIMP_DISPLAY_SHELL (display->shell)->menubar_manager, display);
-
-  return FALSE;
-}
-
 static void
 gimp_display_exported_handler (GimpImage   *image,
                                const gchar *uri,
@@ -193,10 +180,8 @@ gimp_display_exported_handler (GimpImage   *image,
   gchar     *filename  = file_utils_uri_display_name (uri);
 
   gimp_statusbar_push_temp (GIMP_STATUSBAR (statusbar), GIMP_MESSAGE_INFO,
-                            GTK_STOCK_SAVE, _("Image exported to '%s'"), filename);
+                            GTK_STOCK_SAVE, _("Image exported to '%s'"),
+                            filename);
   g_free (filename);
-
-  /* Schedule updating of the 'Export to' label */
-  g_idle_add ((GSourceFunc) gimp_display_update_ui_manager_idle, display);
 }
 



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