--- geany/doc/geany.1.in.josef	2007-01-24 07:50:48.000000000 -0500
+++ geany/doc/geany.1.in	2007-01-24 07:51:02.000000000 -0500
@@ -38,10 +38,6 @@ Don't load the previous session's files
 Don't load terminal support. Use this option, if you don't want to load the virtual terminal
 emulator widget at startup. If you don't have libvte.so.4 installed, then terminal-support is
 automatically disabled. Only available if Geany was compiled with support for VTE.
-.IP "\fB\fP           \fB\-\-vte-lib\fP         " 10
-Specify explicitly the path including filename or only the filename to the VTE library, e.g.
-/usr/lib/libvte.so or libvte.so. This option is only needed, when the autodetection doesn't
-work. Only available if Geany was compiled with support for VTE.
 .IP "\fB-v\fP           \fB\-\-version\fP         " 10
 Show version information and exit.
 .IP "\fB-?\fP           \fB\-\-help\fP         " 10
--- geany/configure.in.josef	2007-01-24 07:41:10.000000000 -0500
+++ geany/configure.in	2007-01-23 17:31:07.000000000 -0500
@@ -84,14 +84,13 @@ fi
 AC_ARG_ENABLE(vte, AC_HELP_STRING([--enable-vte],[enable if you want virtual termninal support [[default=yes]]]),
  [want_vte="$enableval"], [want_vte="yes"])
 
-# if test "$want_vte" = "yes"; then
-#   PKG_CHECK_MODULES(VTE, [vte],
-#                     [AC_DEFINE(HAVE_VTE, 1, [Define if you want VTE support])],
-#                     [AC_MSG_ERROR([VTE support enabled, but VTE not found])])
-#	  AC_CHECK_LIB(vte, vte_terminal_new,
-#					[AC_DEFINE(HAVE_VTE, 1, [Define if you want VTE support])],
-#					[AC_MSG_ERROR([VTE support enabled, but VTE not found])], [])
-# fi
+if test "$want_vte" = "yes"; then
+	PKG_CHECK_MODULES([VTE],[vte],
+                     [AC_DEFINE(HAVE_VTE, 1, [Define if you want VTE support])],
+                     [AC_MSG_ERROR([VTE support enabled, but VTE not found])])
+	AC_SUBST([VTE_LIBS])
+	AC_SUBST([VTE_CFLAGS])
+fi
 
 # Check for random number paths (skip when cross compiling)
 if test "x$build" = "x$target"; then
--- geany/src/vte.c.josef	2007-01-24 07:40:43.000000000 -0500
+++ geany/src/vte.c	2007-01-24 07:43:15.000000000 -0500
@@ -41,8 +41,6 @@ VteInfo vte_info;
 
 extern gchar **environ;
 static pid_t pid;
-static GModule *module = NULL;
-static struct VteFunctions *vf;
 static gboolean popup_menu_created = FALSE;
 static gchar *gtk_menu_key_accel = NULL;
 static gint vte_prefs_tab_num = -1;
@@ -52,12 +50,11 @@ static const gchar VTE_WORDCHARS[] = "-A
 
 
 #define VTE_TERMINAL(obj) (GTK_CHECK_CAST((obj), VTE_TYPE_TERMINAL, VteTerminal))
-#define VTE_TYPE_TERMINAL (vf->vte_terminal_get_type())
+#define VTE_TYPE_TERMINAL (vte_terminal_get_type())
 
 static void vte_start(GtkWidget *widget);
 static gboolean vte_button_pressed(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
 static gboolean vte_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data);
-static void vte_register_symbols(GModule *module);
 static void vte_popup_menu_clicked(GtkMenuItem *menuitem, gpointer user_data);
 static GtkWidget *vte_create_popup_menu(void);
 
@@ -128,33 +125,8 @@ void vte_init(void)
 		return;
 	}
 
-	if (vte_info.lib_vte && strlen(vte_info.lib_vte))
-	{
-		module = g_module_open(vte_info.lib_vte, G_MODULE_BIND_LAZY);
-	}
-	else
-	{
-		module = g_module_open("libvte.so", G_MODULE_BIND_LAZY);
-		// try to fallback to different versions of libvte.so.x
-		if (module == NULL) module = g_module_open("libvte.so.4", G_MODULE_BIND_LAZY);
-		else if (module == NULL) module = g_module_open("libvte.so.8", G_MODULE_BIND_LAZY);
-		else if (module == NULL) module = g_module_open("libvte.so.9", G_MODULE_BIND_LAZY);
-	}
-
-	if (module == NULL)
-	{
-		vte_info.have_vte = FALSE;
-		geany_debug("Could not load libvte.so, terminal support disabled");
-		return;
-	}
-	else
-	{
-		vte_info.have_vte = TRUE;
-		vf = g_new0(struct VteFunctions, 1);
-		vte_register_symbols(module);
-	}
-
-	vte = vf->vte_terminal_new();
+	vte = vte_terminal_new();
+	vte_info.have_vte = TRUE;
 	vc->vte = vte;
 	scrollbar = gtk_vscrollbar_new(GTK_ADJUSTMENT(VTE_TERMINAL(vte)->adjustment));
 	GTK_WIDGET_UNSET_FLAGS(scrollbar, GTK_CAN_FOCUS);
@@ -169,11 +141,11 @@ void vte_init(void)
 	/* set the default widget size first to prevent VTE expanding too much,
 	 * sometimes causing the hscrollbar to be too big or out of view. */
 	gtk_widget_set_size_request(GTK_WIDGET(vte), 10, 10);
-	vf->vte_terminal_set_size(VTE_TERMINAL(vte), 30, 1);
+	vte_terminal_set_size(VTE_TERMINAL(vte), 30, 1);
 
-	//vf->vte_terminal_set_encoding(VTE_TERMINAL(vte), "UTF-8");
-	vf->vte_terminal_set_mouse_autohide(VTE_TERMINAL(vte), TRUE);
-	vf->vte_terminal_set_word_chars(VTE_TERMINAL(vte), VTE_WORDCHARS);
+	//vte_terminal_set_encoding(VTE_TERMINAL(vte), "UTF-8");
+	vte_terminal_set_mouse_autohide(VTE_TERMINAL(vte), TRUE);
+	vte_terminal_set_word_chars(VTE_TERMINAL(vte), VTE_WORDCHARS);
 
 	g_signal_connect(G_OBJECT(vte), "child-exited", G_CALLBACK(vte_start), NULL);
 	g_signal_connect(G_OBJECT(vte), "button-press-event", G_CALLBACK(vte_button_pressed), NULL);
@@ -196,7 +168,6 @@ void vte_init(void)
 
 void vte_close(void)
 {
-	g_free(vf);
 	/* free the vte widget before unloading vte module
 	 * this prevents a segfault on X close window if the message window is hidden */
 	gtk_widget_destroy(vc->vte);
@@ -228,7 +199,7 @@ static gboolean vte_keypress(GtkWidget *
 
 		kill(pid, SIGINT);
 		pid = 0;
-		vf->vte_terminal_reset(VTE_TERMINAL(widget), TRUE, TRUE);
+		vte_terminal_reset(VTE_TERMINAL(widget), TRUE, TRUE);
 		vte_start(widget);
 
 		return TRUE;
@@ -244,7 +215,7 @@ static void vte_start(GtkWidget *widget)
 	gchar **env;
 
 	env = vte_get_child_environment();
-	pid = vf->vte_terminal_fork_command(VTE_TERMINAL(vte), vc->shell, NULL, env,
+	pid = vte_terminal_fork_command(VTE_TERMINAL(vte), vc->shell, NULL, env,
 												vte_info.dir, TRUE, TRUE, TRUE);
 	g_strfreev(env);
 }
@@ -257,7 +228,7 @@ static gboolean vte_button_pressed(GtkWi
 		if (! popup_menu_created)
 		{
 			vc->menu = vte_create_popup_menu();
-			vf->vte_terminal_im_append_menuitems(VTE_TERMINAL(vc->vte), GTK_MENU_SHELL(vc->im_submenu));
+			vte_terminal_im_append_menuitems(VTE_TERMINAL(vc->vte), GTK_MENU_SHELL(vc->im_submenu));
 			popup_menu_created = TRUE;
 		}
 
@@ -267,44 +238,17 @@ static gboolean vte_button_pressed(GtkWi
 	return FALSE;
 }
 
-
-static void vte_register_symbols(GModule *mod)
-{
-	g_module_symbol(mod, "vte_terminal_new", (void*)&vf->vte_terminal_new);
-	g_module_symbol(mod, "vte_terminal_set_size", (void*)&vf->vte_terminal_set_size);
-	g_module_symbol(mod, "vte_terminal_fork_command", (void*)&vf->vte_terminal_fork_command);
-	g_module_symbol(mod, "vte_terminal_set_word_chars", (void*)&vf->vte_terminal_set_word_chars);
-	g_module_symbol(mod, "vte_terminal_set_mouse_autohide", (void*)&vf->vte_terminal_set_mouse_autohide);
-	g_module_symbol(mod, "vte_terminal_set_encoding", (void*)&vf->vte_terminal_set_encoding);
-	g_module_symbol(mod, "vte_terminal_reset", (void*)&vf->vte_terminal_reset);
-	g_module_symbol(mod, "vte_terminal_set_cursor_blinks", (void*)&vf->vte_terminal_set_cursor_blinks);
-	g_module_symbol(mod, "vte_terminal_get_type", (void*)&vf->vte_terminal_get_type);
-	g_module_symbol(mod, "vte_terminal_set_scroll_on_output", (void*)&vf->vte_terminal_set_scroll_on_output);
-	g_module_symbol(mod, "vte_terminal_set_scroll_on_keystroke", (void*)&vf->vte_terminal_set_scroll_on_keystroke);
-	g_module_symbol(mod, "vte_terminal_set_font_from_string", (void*)&vf->vte_terminal_set_font_from_string);
-	g_module_symbol(mod, "vte_terminal_set_scrollback_lines", (void*)&vf->vte_terminal_set_scrollback_lines);
-	g_module_symbol(mod, "vte_terminal_get_has_selection", (void*)&vf->vte_terminal_get_has_selection);
-	g_module_symbol(mod, "vte_terminal_copy_clipboard", (void*)&vf->vte_terminal_copy_clipboard);
-	g_module_symbol(mod, "vte_terminal_paste_clipboard", (void*)&vf->vte_terminal_paste_clipboard);
-	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);
-	g_module_symbol(mod, "vte_terminal_im_append_menuitems", (void*)&vf->vte_terminal_im_append_menuitems);
-}
-
-
 void vte_apply_user_settings(void)
 {
 	if (! app->msgwindow_visible) return;
 	//if (! GTK_WIDGET_REALIZED(vc->vte)) gtk_widget_realize(vc->vte);
-	vf->vte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->vte), vc->scrollback_lines);
-	vf->vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(vc->vte), vc->scroll_on_key);
-	vf->vte_terminal_set_scroll_on_output(VTE_TERMINAL(vc->vte), vc->scroll_on_out);
-	vf->vte_terminal_set_emulation(VTE_TERMINAL(vc->vte), vc->emulation);
-	vf->vte_terminal_set_font_from_string(VTE_TERMINAL(vc->vte), vc->font);
-	vf->vte_terminal_set_color_foreground(VTE_TERMINAL(vc->vte), vc->colour_fore);
-	vf->vte_terminal_set_color_background(VTE_TERMINAL(vc->vte), vc->colour_back);
+	vte_terminal_set_scrollback_lines(VTE_TERMINAL(vc->vte), vc->scrollback_lines);
+	vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(vc->vte), vc->scroll_on_key);
+	vte_terminal_set_scroll_on_output(VTE_TERMINAL(vc->vte), vc->scroll_on_out);
+	vte_terminal_set_emulation(VTE_TERMINAL(vc->vte), vc->emulation);
+	vte_terminal_set_font_from_string(VTE_TERMINAL(vc->vte), vc->font);
+	vte_terminal_set_color_foreground(VTE_TERMINAL(vc->vte), vc->colour_fore);
+	vte_terminal_set_color_background(VTE_TERMINAL(vc->vte), vc->colour_back);
 
 	override_menu_key();
 }
@@ -316,13 +260,13 @@ static void vte_popup_menu_clicked(GtkMe
 	{
 		case 0:
 		{
-			if (vf->vte_terminal_get_has_selection(VTE_TERMINAL(vc->vte)))
-				vf->vte_terminal_copy_clipboard(VTE_TERMINAL(vc->vte));
+			if (vte_terminal_get_has_selection(VTE_TERMINAL(vc->vte)))
+				vte_terminal_copy_clipboard(VTE_TERMINAL(vc->vte));
 			break;
 		}
 		case 1:
 		{
-			vf->vte_terminal_paste_clipboard(VTE_TERMINAL(vc->vte));
+			vte_terminal_paste_clipboard(VTE_TERMINAL(vc->vte));
 			break;
 		}
 		case 2:
@@ -385,7 +329,7 @@ static GtkWidget *vte_create_popup_menu(
 
 void vte_send_cmd(const gchar *cmd)
 {
-	vf->vte_terminal_feed_child(VTE_TERMINAL(vc->vte), cmd, strlen(cmd));
+	vte_terminal_feed_child(VTE_TERMINAL(vc->vte), cmd, strlen(cmd));
 }
 
 
--- geany/src/vte.h.josef	2007-01-24 07:40:35.000000000 -0500
+++ geany/src/vte.h	2007-01-24 07:33:27.000000000 -0500
@@ -31,7 +31,7 @@
  * in stdlib.h, on FreeBSD in unistd.h */
 #include <stdlib.h>
 #include <unistd.h>
-
+#include <vte/vte.h>
 
 typedef struct
 {
@@ -86,53 +86,6 @@ gboolean vte_drag_drop(GtkWidget *widget
 					   gpointer user_data);
 */
 
-/* taken from original vte.h to make my life easier ;-) */
-
-typedef struct _VteTerminalPrivate VteTerminalPrivate;
-
-typedef struct _VteTerminal VteTerminal;
-struct _VteTerminal
-{
-	GtkWidget widget;
-	GtkAdjustment *adjustment;
-	glong char_width, char_height;
-	glong char_ascent, char_descent;
-	glong row_count, column_count;
-	gchar *window_title;
-	gchar *icon_title;
-	VteTerminalPrivate *pvt;
-};
-
-
-/* store function pointers in a struct to avoid a strange segfault if they are stored directly
- * if accessed directly, gdb says the segfault arrives at old_tab_width(prefs.c), don't ask me */
-struct VteFunctions
-{
-	GtkWidget* (*vte_terminal_new) (void);
-	pid_t (*vte_terminal_fork_command) (VteTerminal *terminal, const char *command, char **argv,
-										char **envv, const char *directory, gboolean lastlog,
-										gboolean utmp, gboolean wtmp);
-	void (*vte_terminal_set_size) (VteTerminal *terminal, glong columns, glong rows);
-	void (*vte_terminal_set_word_chars) (VteTerminal *terminal, const char *spec);
-	void (*vte_terminal_set_mouse_autohide) (VteTerminal *terminal, gboolean setting);
-	void (*vte_terminal_reset) (VteTerminal *terminal, gboolean full, gboolean clear_history);
-	void (*vte_terminal_set_encoding) (VteTerminal *terminal, const char *codeset);
-	void (*vte_terminal_set_cursor_blinks) (VteTerminal *terminal, gboolean blink);
-	GtkType (*vte_terminal_get_type) (void);
-	void (*vte_terminal_set_scroll_on_output) (VteTerminal *terminal, gboolean scroll);
-	void (*vte_terminal_set_scroll_on_keystroke) (VteTerminal *terminal, gboolean scroll);
-	void (*vte_terminal_set_font_from_string) (VteTerminal *terminal, const char *name);
-	void (*vte_terminal_set_scrollback_lines) (VteTerminal *terminal, glong lines);
-	gboolean (*vte_terminal_get_has_selection) (VteTerminal *terminal);
-	void (*vte_terminal_copy_clipboard) (VteTerminal *terminal);
-	void (*vte_terminal_paste_clipboard) (VteTerminal *terminal);
-	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);
-	void (*vte_terminal_im_append_menuitems) (VteTerminal *terminal, GtkMenuShell *menushell);
-};
-
 #endif
 
 #endif
--- geany/src/Makefile.am.josef	2007-01-24 07:40:55.000000000 -0500
+++ geany/src/Makefile.am	2007-01-23 17:23:03.000000000 -0500
@@ -41,7 +41,7 @@ if MINGW
 WINDRES = /usr/local/cross-tools/bin/i386-mingw32msvc-windres
 
 geany_SOURCES = $(SRCS) win32.c win32.h
-geany_LDADD = ../scintilla/libscintilla.a ../tagmanager/libtagmanager.a -lstdc++ @PACKAGE_LIBS@ \
+geany_LDADD = ../scintilla/libscintilla.a ../tagmanager/libtagmanager.a -lstdc++ @PACKAGE_LIBS@ @VTE_LIBS@ \
 			$(INTLLIBS) -lgdi32 -limm32 -lshell32 -lole32 -luuid -liberty -lcomdlg32 -lcomctl32 \
 			geany_private.res
 AM_CFLAGS = -DGEANY_DEBUG -Wall -pipe -mms-bitfields
@@ -49,7 +49,7 @@ AM_CFLAGS = -DGEANY_DEBUG -Wall -pipe -m
 geany_LDFLAGS =	-mwindows
 
 INCLUDES = -I../scintilla/include -I../tagmanager/include -DENABLE_NLS \
-           -I/usr/local/cross-tools/include @PACKAGE_CFLAGS@
+           -I/usr/local/cross-tools/include @PACKAGE_CFLAGS@ @VTE_CFLAGS@
 
 geany_windres.res:
 	$(WINDRES) -i ../geany_private.rc --input-format=rc -o geany_private.res -O coff;
@@ -62,11 +62,11 @@ else
 AM_CFLAGS = -DGEANY_DEBUG -Wall -pipe
 #AM_CFLAGS = -DGEANY_DEBUG -Wall -pipe -g -O0
 geany_SOURCES = $(SRCS) vte.c vte.h
-geany_LDADD = ../scintilla/libscintilla.a ../tagmanager/libtagmanager.a @PACKAGE_LIBS@ -lstdc++ $(INTLLIBS)
+geany_LDADD = ../scintilla/libscintilla.a ../tagmanager/libtagmanager.a @PACKAGE_LIBS@ @VTE_LIBS@ -lstdc++ $(INTLLIBS)
 
 INCLUDES = \
 	-DPACKAGE_DATA_DIR=\""$(datadir)"\" -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-	-I../scintilla/include -I../tagmanager/include @PACKAGE_CFLAGS@
+	-I../scintilla/include -I../tagmanager/include @PACKAGE_CFLAGS@ @VTE_CFLAGS@
 
 clean-local:
 
--- geany/src/main.c.josef	2007-01-24 07:48:29.000000000 -0500
+++ geany/src/main.c	2007-01-24 07:45:59.000000000 -0500
@@ -77,7 +77,6 @@ static gboolean show_version = FALSE;
 static gchar *alternate_config = NULL;
 #ifdef HAVE_VTE
 static gboolean no_vte = FALSE;
-static gchar *lib_vte = NULL;
 #endif
 #ifdef HAVE_SOCKET
 static gboolean ignore_socket = FALSE;
@@ -98,7 +97,6 @@ static GOptionEntry entries[] =
 	{ "no-session", 's', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &cl_options.load_session, N_("don't load the previous session's files"), NULL },
 #ifdef HAVE_VTE
 	{ "no-terminal", 't', 0, G_OPTION_ARG_NONE, &no_vte, N_("don't load terminal support"), NULL },
-	{ "vte-lib", 0, 0, G_OPTION_ARG_FILENAME, &lib_vte, N_("filename of libvte.so"), NULL },
 #endif
 	{ "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, N_("show version and exit"), NULL },
 	{ NULL, 0, 0, 0, NULL, NULL, NULL }
@@ -434,9 +432,6 @@ static void parse_command_line_options(g
 #ifdef HAVE_SOCKET
 	socket_info.ignore_socket = ignore_socket;
 #endif
-#ifdef HAVE_VTE
-	vte_info.lib_vte = lib_vte;
-#endif
 	app->ignore_global_tags = ignore_global_tags;
 }
 
@@ -737,7 +732,6 @@ void main_quit()
 	scintilla_release_resources();
 #ifdef HAVE_VTE
 	if (vte_info.have_vte) vte_close();
-	g_free(vte_info.lib_vte);
 	g_free(vte_info.dir);
 #endif
 	gtk_widget_destroy(app->window);
