SF.net SVN: geany: [508] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Jun 29 23:51:39 UTC 2006


Revision: 508
Author:   eht16
Date:     2006-06-29 16:51:32 -0700 (Thu, 29 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=508&view=rev

Log Message:
-----------
Change the path in the VTE widget when switching between files according to the path of the current file.
Process the switch_page callback only once.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/vte.c
    trunk/src/vte.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-06-29 19:08:21 UTC (rev 507)
+++ trunk/ChangeLog	2006-06-29 23:51:32 UTC (rev 508)
@@ -1,3 +1,11 @@
+2006-06-30  Enrico Tröger  <enrico.troeger at uvena.de>
+
+ * src/vte.c, src/callbacks.c:
+   Change the path in the VTE widget when switching between files
+   according to the path of the current file.
+   Process the switch_page callback only once.
+
+
 2006-06-29  Nick Treleaven  <nick.treleaven at btinternet.com>
 
  * src/utils.c, src/utils.h, src/win32.c, src/callbacks.c,

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2006-06-29 19:08:21 UTC (rev 507)
+++ trunk/src/callbacks.c	2006-06-29 23:51:32 UTC (rev 508)
@@ -709,7 +709,14 @@
                                         gpointer         user_data)
 {
 	gint idx;
+	static gboolean state = FALSE;
 
+	// this function is called two times when switching notebook pages, I really don't know why
+	// so, skip one call (workaround)
+	state= ! state;
+	if (state) return;
+
+
 	if (closing_all) return;
 
 	// guint == -1 seems useless, but it isn't!
@@ -751,7 +758,13 @@
                                         gpointer         user_data)
 {
 	gint idx;
+	static gboolean state = FALSE;
 
+	// this function is called two times when switching notebook pages, I really don't know why
+	// so, skip one call (workaround)
+	state= ! state;
+	if (state) return;
+
 	if (closing_all) return;
 
 	// guint == -1 seems useless, but it isn't!
@@ -764,6 +777,21 @@
 	{
 		utils_check_disk_status(idx);
 	}
+
+#ifdef HAVE_VTE
+		gchar *path;
+		gchar *cmd;
+
+		if (doc_list[idx].file_name != NULL)
+		{
+			path = g_path_get_dirname(doc_list[idx].file_name);
+			cmd = g_strconcat("cd ", path, "\n", "clear\n", NULL);
+			vte_send_cmd(cmd);
+			g_free(path);
+			g_free(cmd);
+		}
+#endif
+
 }
 
 

Modified: trunk/src/vte.c
===================================================================
--- trunk/src/vte.c	2006-06-29 19:08:21 UTC (rev 507)
+++ trunk/src/vte.c	2006-06-29 23:51:32 UTC (rev 508)
@@ -200,9 +200,11 @@
 	{
 		kill(pid, SIGINT);
 		pid = 0;
+		vf->vte_terminal_reset(VTE_TERMINAL(widget), TRUE, TRUE);
 		vte_start(widget);
 		return TRUE;
 	}
+
 	return FALSE;
 }
 
@@ -265,6 +267,7 @@
 	g_module_symbol(mod, "vte_terminal_set_emulation", (void*)&vf->vte_terminal_set_emulation);
 	g_module_symbol(mod, "vte_terminal_set_color_foreground", (void*)&vf->vte_terminal_set_color_foreground);
 	g_module_symbol(mod, "vte_terminal_set_color_background", (void*)&vf->vte_terminal_set_color_background);
+	g_module_symbol(mod, "vte_terminal_feed_child", (void*)&vf->vte_terminal_feed_child);
 }
 
 
@@ -363,9 +366,12 @@
 }
 
 
+void vte_send_cmd(const gchar *cmd)
+{
+	vf->vte_terminal_feed_child(VTE_TERMINAL(vc->vte), cmd, strlen(cmd));
+}
 
 
-
 /*
 void vte_drag_data_received(GtkWidget *widget, GdkDragContext  *drag_context, gint x, gint y,
 							GtkSelectionData *data, guint info, guint time)

Modified: trunk/src/vte.h
===================================================================
--- trunk/src/vte.h	2006-06-29 19:08:21 UTC (rev 507)
+++ trunk/src/vte.h	2006-06-29 23:51:32 UTC (rev 508)
@@ -36,6 +36,8 @@
 
 void vte_apply_user_settings(void);
 
+void vte_send_cmd(const gchar *cmd);
+
 /*
 void vte_drag_data_received(GtkWidget *widget, GdkDragContext  *drag_context, gint x, gint y,
 							GtkSelectionData *data, guint info, guint time);
@@ -102,6 +104,7 @@
 	void (*vte_terminal_set_emulation) (VteTerminal *terminal, const gchar *emulation);
 	void (*vte_terminal_set_color_foreground) (VteTerminal *terminal, const GdkColor *foreground);
 	void (*vte_terminal_set_color_background) (VteTerminal *terminal, const GdkColor *background);
+	void (*vte_terminal_feed_child) (VteTerminal *terminal, const char *data, glong length);
 };
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list