gimp r26339 - in trunk: . app/actions app/dialogs



Author: neo
Date: Wed Jul 30 14:53:09 2008
New Revision: 26339
URL: http://svn.gnome.org/viewvc/gimp?rev=26339&view=rev

Log:
2008-07-30  Sven Neumann  <sven gimp org>

	* app/dialogs/file-open-dialog.c (file_open_dialog_response):
	attach the URI of the last opened image to the Gimp object.

	* app/actions/file-commands.c (file_open_dialog_show): use the
	last opened URI as a fallback for initializing the dialog.



Modified:
   trunk/ChangeLog
   trunk/app/actions/file-commands.c
   trunk/app/dialogs/file-open-dialog.c

Modified: trunk/app/actions/file-commands.c
==============================================================================
--- trunk/app/actions/file-commands.c	(original)
+++ trunk/app/actions/file-commands.c	Wed Jul 30 14:53:09 2008
@@ -65,6 +65,7 @@
 /*  local function prototypes  */
 
 static void   file_open_dialog_show        (GtkWidget   *parent,
+                                            Gimp        *gimp,
                                             GimpImage   *image,
                                             const gchar *uri,
                                             gboolean     open_as_layers);
@@ -90,9 +91,11 @@
 file_open_cmd_callback (GtkAction *action,
                         gpointer   data)
 {
+  Gimp        *gimp;
   GimpImage   *image;
   GtkWidget   *widget;
   const gchar *uri = NULL;
+  return_if_no_gimp (gimp, data);
   return_if_no_widget (widget, data);
 
   image = action_data_get_image (data);
@@ -100,24 +103,26 @@
   if (image)
     uri = gimp_object_get_name (GIMP_OBJECT (image));
 
-  file_open_dialog_show (widget, NULL, uri, FALSE);
+  file_open_dialog_show (widget, gimp, NULL, uri, FALSE);
 }
 
 void
 file_open_as_layers_cmd_callback (GtkAction *action,
                                   gpointer   data)
 {
+  Gimp        *gimp;
   GimpDisplay *display;
   GtkWidget   *widget;
   GimpImage   *image;
   const gchar *uri;
+  return_if_no_gimp (gimp, data);
   return_if_no_display (display, data);
   return_if_no_widget (widget, data);
 
   image = display->image;
   uri = gimp_object_get_name (GIMP_OBJECT (image));
 
-  file_open_dialog_show (widget, image, uri, TRUE);
+  file_open_dialog_show (widget, gimp, image, uri, TRUE);
 }
 
 void
@@ -436,7 +441,7 @@
                        const gchar *uri,
                        GtkWidget   *parent)
 {
-  file_open_dialog_show (parent, NULL, uri, FALSE);
+  file_open_dialog_show (parent, gimp, NULL, uri, FALSE);
 }
 
 
@@ -444,6 +449,7 @@
 
 static void
 file_open_dialog_show (GtkWidget   *parent,
+                       Gimp        *gimp,
                        GimpImage   *image,
                        const gchar *uri,
                        gboolean     open_as_layers)
@@ -456,6 +462,9 @@
 
   if (dialog)
     {
+      if (! uri)
+        uri = g_object_get_data (G_OBJECT (gimp), "gimp-file-open-last-uri");
+
       if (uri)
         gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (dialog), uri);
 

Modified: trunk/app/dialogs/file-open-dialog.c
==============================================================================
--- trunk/app/dialogs/file-open-dialog.c	(original)
+++ trunk/app/dialogs/file-open-dialog.c	Wed Jul 30 14:53:09 2008
@@ -118,6 +118,10 @@
 
   uris = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (open_dialog));
 
+  if (uris)
+    g_object_set_data_full (G_OBJECT (gimp), "gimp-file-open-last-uri",
+                            g_strdup (uris->data), (GDestroyNotify) g_free);
+
   gimp_file_dialog_set_sensitive (dialog, FALSE);
 
   for (list = uris; list; list = g_slist_next (list))



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