[Xfce4-commits] r25707 - in mousepad/branches/nick_0_3: . mousepad

Nick Schermer nick at xfce.org
Sat May 12 17:41:04 CEST 2007


Author: nick
Date: 2007-05-12 15:41:04 +0000 (Sat, 12 May 2007)
New Revision: 25707

Modified:
   mousepad/branches/nick_0_3/ChangeLog
   mousepad/branches/nick_0_3/mousepad/mousepad-window.c
Log:
	* mousepad/mousepad-window.c: Jump to active file when
	  opening a new document.

Modified: mousepad/branches/nick_0_3/ChangeLog
===================================================================
--- mousepad/branches/nick_0_3/ChangeLog	2007-05-11 14:08:43 UTC (rev 25706)
+++ mousepad/branches/nick_0_3/ChangeLog	2007-05-12 15:41:04 UTC (rev 25707)
@@ -1,3 +1,8 @@
+2007-05-12	Nick Schermer <nick at xfce.org>
+	* mousepad/mousepad-window.c: Jump to active file when
+	  opening a new document.
+
+
 2007-05-10	Nick Schermer <nick at xfce.org>
 	* mousepad/mousepad-undo.c: Don't store a string (or even
 	  prepend it in a GString) when the user is inserting text.

Modified: mousepad/branches/nick_0_3/mousepad/mousepad-window.c
===================================================================
--- mousepad/branches/nick_0_3/mousepad/mousepad-window.c	2007-05-11 14:08:43 UTC (rev 25706)
+++ mousepad/branches/nick_0_3/mousepad/mousepad-window.c	2007-05-12 15:41:04 UTC (rev 25707)
@@ -2142,9 +2142,10 @@
 mousepad_window_action_open_file (GtkAction      *action,
                                   MousepadWindow *window)
 {
-  GtkWidget *chooser;
-  gchar     *filename;
-  GSList    *filenames, *li;
+  GtkWidget   *chooser;
+  gchar       *filename;
+  const gchar *active_filename;
+  GSList      *filenames, *li;
 
   /* create new chooser dialog */
   chooser = gtk_file_chooser_dialog_new (_("Open File"),
@@ -2157,6 +2158,17 @@
   gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (chooser), TRUE);
   gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), TRUE);
 
+  /* open the folder of the currently opened file */
+  if (window->active)
+    {
+      /* get the filename of the active document */
+      active_filename = mousepad_document_get_filename (window->active);
+
+      /* set the current filename, if there is one */
+      if (active_filename)
+        gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (chooser), active_filename);
+    }
+
   /* run the dialog */
   if (G_LIKELY (gtk_dialog_run (GTK_DIALOG (chooser)) == GTK_RESPONSE_ACCEPT))
     {



More information about the Xfce4-commits mailing list