[geany/geany] f7a036: VTE: Switch directory on startup when following current document's path

Colomban Wendling git-noreply at xxxxx
Sat Jun 20 18:05:39 UTC 2015


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 20 Jun 2015 18:05:39 UTC
Commit:      f7a036aab8f022195ba017895a4b77283a6da65c
             https://github.com/geany/geany/commit/f7a036aab8f022195ba017895a4b77283a6da65c

Log Message:
-----------
VTE: Switch directory on startup when following current document's path


Modified Paths:
--------------
    src/vte.c

Modified: src/vte.c
12 lines changed, 12 insertions(+), 0 deletions(-)
===================================================================
@@ -33,6 +33,7 @@
 
 #include "callbacks.h"
 #include "document.h"
+#include "geanyobject.h"
 #include "msgwindow.h"
 #include "prefs.h"
 #include "sciwrappers.h"
@@ -184,6 +185,15 @@ static void override_menu_key(void)
 }
 
 
+static void on_startup_complete(G_GNUC_UNUSED GObject *dummy)
+{
+	GeanyDocument *doc = document_get_current();
+
+	if (doc)
+		vte_cwd((doc->real_path != NULL) ? doc->real_path : doc->file_name, FALSE);
+}
+
+
 void vte_init(void)
 {
 	if (vte_info.have_vte == FALSE)
@@ -247,6 +257,8 @@ void vte_init(void)
 
 	/* setup the F10 menu override (so it works before the widget is first realised). */
 	override_menu_key();
+
+	g_signal_connect(geany_object, "geany-startup-complete", G_CALLBACK(on_startup_complete), NULL);
 }
 
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list