[Xfce4-commits] <mousepad:master> * mousepad/mousepad-window.c: Jump to active file when opening a new document.
Nick Schermer
noreply at xfce.org
Sat May 5 21:30:33 CEST 2012
Updating branch refs/heads/master
to d2c3c1f88384b617269bcd129f6cce6a86b5efa2 (commit)
from 23c7b01c285078e6346e1b65afcb611273ce3c2f (commit)
commit d2c3c1f88384b617269bcd129f6cce6a86b5efa2
Author: Nick Schermer <nick at xfce.org>
Date: Sat May 12 15:41:04 2007 +0000
* mousepad/mousepad-window.c: Jump to active file when
opening a new document.
(Old svn revision: 25707)
ChangeLog | 5 +++++
mousepad/mousepad-window.c | 18 +++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f82103a..d2260c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index d981df2..df6ce1f 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -2142,9 +2142,10 @@ static void
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 @@ mousepad_window_action_open_file (GtkAction *action,
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