SF.net SVN: geany: [1815] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Aug 23 11:34:07 UTC 2007


Revision: 1815
          http://geany.svn.sourceforge.net/geany/?rev=1815&view=rev
Author:   ntrel
Date:     2007-08-23 04:34:06 -0700 (Thu, 23 Aug 2007)

Log Message:
-----------
Rename MyApp -> GeanyApp.
Move most GeanyApp fields into:
GeanyPrefs for (most) Preferences dialog fields;
UIPrefs for non-Prefs dialog visual settings;
UIWidgets for less commonly used widgets such as menuitems and
dialogs;
GeanyStatus for various states the application can be in.
Move some GeanyApp fields into EditorPrefs (and one into each of
CommandLineOptions and SidebarTreeviews).
Add plugin API prefs field.
Move disabling build widgets on Windows to build_init().
Make build callbacks static.
Add treeviews_init() to prepare popup menus and open files treeview.
Replace treeviews_find_node() with treeviews_select_openfiles_item().
Make utils_isbrace() and utils_is_opening_brace() take an
'include_angles' argument (to separate from editor_prefs).
Make 'Goto matching brace' keybinding include <> angle brackets.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/plugins/export.c
    trunk/src/build.c
    trunk/src/build.h
    trunk/src/callbacks.c
    trunk/src/dialogs.c
    trunk/src/document.c
    trunk/src/editor.c
    trunk/src/editor.h
    trunk/src/geany.h
    trunk/src/highlighting.c
    trunk/src/keybindings.c
    trunk/src/keyfile.c
    trunk/src/main.c
    trunk/src/main.h
    trunk/src/msgwindow.c
    trunk/src/navqueue.c
    trunk/src/notebook.c
    trunk/src/plugindata.h
    trunk/src/plugins.c
    trunk/src/prefs.c
    trunk/src/prefs.h
    trunk/src/project.c
    trunk/src/search.c
    trunk/src/symbols.c
    trunk/src/templates.c
    trunk/src/tools.c
    trunk/src/treeviews.c
    trunk/src/treeviews.h
    trunk/src/ui_utils.c
    trunk/src/ui_utils.h
    trunk/src/utils.c
    trunk/src/utils.h
    trunk/src/vte.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/ChangeLog	2007-08-23 11:34:06 UTC (rev 1815)
@@ -1,3 +1,32 @@
+2007-08-23  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * plugins/export.c, src/templates.c, src/build.c, src/utils.c,
+   src/ui_utils.h, src/build.h, src/utils.h, src/highlighting.c,
+   src/keybindings.c, src/tools.c, src/prefs.c, src/dialogs.c,
+   src/prefs.h, src/navqueue.c, src/plugindata.h, src/geany.h,
+   src/treeviews.c, src/msgwindow.c, src/callbacks.c, src/notebook.c,
+   src/treeviews.h, src/keyfile.c, src/vte.c, src/search.c,
+   src/document.c, src/plugins.c, src/main.c, src/editor.c,
+   src/symbols.c, src/main.h, src/editor.h, src/ui_utils.c:
+   Rename MyApp -> GeanyApp.
+   Move most GeanyApp fields into:
+   GeanyPrefs for (most) Preferences dialog fields;
+   UIPrefs for non-Prefs dialog visual settings;
+   UIWidgets for less commonly used widgets such as menuitems and
+   dialogs;
+   GeanyStatus for various states the application can be in.
+   Move some GeanyApp fields into EditorPrefs (and one into each of
+   CommandLineOptions and SidebarTreeviews).
+   Add plugin API prefs field.
+   Move disabling build widgets on Windows to build_init().
+   Make build callbacks static.
+   Add treeviews_init() to prepare popup menus and open files treeview.
+   Replace treeviews_find_node() with treeviews_select_openfiles_item().
+   Make utils_isbrace() and utils_is_opening_brace() take an
+   'include_angles' argument (to separate from editor_prefs).
+   Make 'Goto matching brace' keybinding include <> angle brackets.
+
+
 2007-08-22  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * plugins/export.c:

Modified: trunk/plugins/export.c
===================================================================
--- trunk/plugins/export.c	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/plugins/export.c	2007-08-23 11:34:06 UTC (rev 1815)
@@ -29,6 +29,8 @@
 #include "plugindata.h"
 #include "editor.h"
 #include "document.h"
+#include "prefs.h"
+#include "utils.h"
 #include <ctype.h>
 
 
@@ -226,21 +228,18 @@
 	}
 	else
 	{
+		const gchar *default_open_path = geany_data->prefs->default_open_path;
 		gchar *fname = g_strconcat(GEANY_STRING_UNTITLED, extension, NULL);
 
 		gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(dialog));
 		gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), fname);
 
 		// use default startup directory(if set) if no files are open
-		if (geany_data->app->default_open_path != NULL &&
-			*(geany_data->app->default_open_path) != '\0')
+		if (NZV(default_open_path) && g_path_is_absolute(default_open_path))
 		{
-			if (g_path_is_absolute(geany_data->app->default_open_path))
-			{
-				gchar *def_path = utils->get_locale_from_utf8(geany_data->app->default_open_path);
-				gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), def_path);
-				g_free(def_path);
-			}
+			gchar *locale_path = utils->get_locale_from_utf8(default_open_path);
+			gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), locale_path);
+			g_free(locale_path);
 		}
 		g_free(fname);
 	}
@@ -568,7 +567,7 @@
 	}
 
 	// read Geany's font and font size
-	font_desc = pango_font_description_from_string(geany_data->app->editor_font);
+	font_desc = pango_font_description_from_string(geany_data->prefs->editor_font);
 	font_name = pango_font_description_get_family(font_desc);
 	//font_size = pango_font_description_get_size(font_desc) / PANGO_SCALE;
 	// take the zoom level also into account

Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/src/build.c	2007-08-23 11:34:06 UTC (rev 1815)
@@ -41,6 +41,7 @@
 # include <signal.h>
 #endif
 
+#include "prefs.h"
 #include "support.h"
 #include "utils.h"
 #include "ui_utils.h"
@@ -82,6 +83,14 @@
 	{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
 
 
+static struct
+{
+	GtkWidget	*run_button;
+	GtkWidget	*compile_button;
+}
+widgets;
+
+
 static gboolean build_iofunc(GIOChannel *ioc, GIOCondition cond, gpointer data);
 static gboolean build_create_shellscript(const gchar *fname, const gchar *cmd, gboolean autoclose);
 static GPid build_spawn_cmd(gint idx, const gchar *cmd, const gchar *dir);
@@ -92,6 +101,14 @@
 static void run_exit_cb(GPid child_pid, gint status, gpointer user_data);
 static void on_build_arguments_activate(GtkMenuItem *menuitem, gpointer user_data);
 
+static void on_build_compile_activate(GtkMenuItem *menuitem, gpointer user_data);
+static void on_build_tex_activate(GtkMenuItem *menuitem, gpointer user_data);
+static void on_build_build_activate(GtkMenuItem *menuitem, gpointer user_data);
+static void on_build_make_activate(GtkMenuItem *menuitem, gpointer user_data);
+static void on_build_execute_activate(GtkMenuItem *menuitem, gpointer user_data);
+static void on_build_next_error(GtkMenuItem *menuitem, gpointer user_data);
+
+
 #ifndef G_OS_WIN32
 static void kill_process(GPid *pid);
 #endif
@@ -173,7 +190,7 @@
 	locale_cmd_string = utils_get_locale_from_utf8(cmd_string);
 
 	/* get the terminal path */
-	locale_term_cmd = utils_get_locale_from_utf8(app->tools_term_cmd);
+	locale_term_cmd = utils_get_locale_from_utf8(prefs.tools_term_cmd);
 	// split the term_cmd, so arguments will work too
 	term_argv = g_strsplit(locale_term_cmd, " ", -1);
 	term_argv_len = g_strv_length(term_argv);
@@ -190,7 +207,7 @@
 	{
 		msgwin_status_add(
 			_("Could not find terminal '%s' "
-				"(check path for Terminal tool setting in Preferences)"), app->tools_term_cmd);
+				"(check path for Terminal tool setting in Preferences)"), prefs.tools_term_cmd);
 
 		utils_free_pointers(executable, view_file, locale_filename, cmd_string, locale_cmd_string,
 										locale_term_cmd, NULL);
@@ -286,7 +303,7 @@
 
 	if (idx < 0 || doc_list[idx].file_name == NULL) return (GPid) 1;
 
-	cmdstr = g_string_new(app->tools_make_cmd);
+	cmdstr = g_string_new(prefs.tools_make_cmd);
 	g_string_append_c(cmdstr, ' ');
 
 	if (build_opts == GBO_MAKE_OBJECT)
@@ -710,7 +727,7 @@
 		gchar  **argv = NULL;
 
 		/* get the terminal path */
-		locale_term_cmd = utils_get_locale_from_utf8(app->tools_term_cmd);
+		locale_term_cmd = utils_get_locale_from_utf8(prefs.tools_term_cmd);
 		// split the term_cmd, so arguments will work too
 		term_argv = g_strsplit(locale_term_cmd, " ", -1);
 		term_argv_len = g_strv_length(term_argv);
@@ -727,7 +744,7 @@
 		{
 			msgwin_status_add(
 				_("Could not find terminal '%s' "
-					"(check path for Terminal tool setting in Preferences)"), app->tools_term_cmd);
+					"(check path for Terminal tool setting in Preferences)"), prefs.tools_term_cmd);
 			run_info.pid = (GPid) 1;
 			goto free_strings;
 		}
@@ -871,7 +888,7 @@
 		msg = _("Compilation failed.");
 		msgwin_compiler_add(COLOR_DARK_RED, msg);
 		// If msgwindow is hidden, user will want to display it to see the error
-		if (! app->msgwindow_visible)
+		if (! ui_prefs.msgwindow_visible)
 		{
 			gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER);
 			msgwin_show_hide(TRUE);
@@ -884,7 +901,7 @@
 	{
 		msg = _("Compilation finished successfully.");
 		msgwin_compiler_add(COLOR_BLUE, msg);
-		if (! app->msgwindow_visible ||
+		if (! ui_prefs.msgwindow_visible ||
 			gtk_notebook_get_current_page(GTK_NOTEBOOK(msgwindow.notebook)) != MSG_COMPILER)
 				ui_set_statusbar("%s", msg);
 	}
@@ -1602,8 +1619,8 @@
 	{
 		gtk_widget_set_sensitive(lookup_widget(app->window, "menu_build1"), FALSE);
 		gtk_menu_item_remove_submenu(GTK_MENU_ITEM(lookup_widget(app->window, "menu_build1")));
-		gtk_widget_set_sensitive(app->compile_button, FALSE);
-		gtk_widget_set_sensitive(app->run_button, FALSE);
+		gtk_widget_set_sensitive(widgets.compile_button, FALSE);
+		gtk_widget_set_sensitive(widgets.run_button, FALSE);
 		return;
 	}
 	else
@@ -1668,8 +1685,8 @@
 	if (menu_items->item_set_args)
 		gtk_widget_set_sensitive(menu_items->item_set_args, can_set_args);
 
-	gtk_widget_set_sensitive(app->compile_button, can_build && ft->actions->can_compile);
-	gtk_widget_set_sensitive(app->run_button, can_run || can_stop);
+	gtk_widget_set_sensitive(widgets.compile_button, can_build && ft->actions->can_compile);
+	gtk_widget_set_sensitive(widgets.run_button, can_run || can_stop);
 
 	// show the stop command if a program is running, otherwise show run command
 	set_stop_button(can_stop);
@@ -1690,14 +1707,14 @@
 		build_get_menu_items(run_info.file_type_id)->item_exec;
 
 	if (stop && utils_str_equal(
-		gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(app->run_button)), "gtk-stop")) return;
+		gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(widgets.run_button)), "gtk-stop")) return;
 	if (! stop && utils_str_equal(
-		gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(app->run_button)), "gtk-execute")) return;
+		gtk_tool_button_get_stock_id(GTK_TOOL_BUTTON(widgets.run_button)), "gtk-execute")) return;
 
 	// use the run button also as stop button
 	if (stop)
 	{
-		gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(app->run_button), "gtk-stop");
+		gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(widgets.run_button), "gtk-stop");
 
 		if (menuitem != NULL)
 		{
@@ -1710,7 +1727,7 @@
 	}
 	else
 	{
-		gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(app->run_button), "gtk-execute");
+		gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(widgets.run_button), "gtk-execute");
 
 		if (menuitem != NULL)
 		{
@@ -1768,7 +1785,7 @@
 }
 
 
-void
+static void
 on_build_compile_activate              (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
@@ -1785,7 +1802,7 @@
 }
 
 
-void
+static void
 on_build_tex_activate                  (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
@@ -1805,7 +1822,7 @@
 }
 
 
-void
+static void
 on_build_build_activate                (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
@@ -1822,7 +1839,7 @@
 }
 
 
-void
+static void
 on_build_make_activate                 (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
@@ -1855,7 +1872,7 @@
 }
 
 
-void
+static void
 on_build_execute_activate              (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
@@ -1952,7 +1969,7 @@
 #endif
 
 
-void
+static void
 on_build_next_error                    (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
@@ -1966,3 +1983,19 @@
 }
 
 
+void build_init()
+{
+	widgets.compile_button = lookup_widget(app->window, "toolbutton13");
+	widgets.run_button = lookup_widget(app->window, "toolbutton26");
+
+#ifdef G_OS_WIN32
+	// hide build support items, at least until they are available for Windows
+	gtk_widget_hide(widgets.compile_button);
+	{
+		GtkWidget *compiler_tab;
+		compiler_tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(msgwindow.notebook),
+			gtk_notebook_get_nth_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER));
+		gtk_widget_set_sensitive(compiler_tab, FALSE);
+	}
+#endif
+}

Modified: trunk/src/build.h
===================================================================
--- trunk/src/build.h	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/src/build.h	2007-08-23 11:34:06 UTC (rev 1815)
@@ -61,8 +61,11 @@
 
 
 
+void build_init();
+
 void build_finalize();
 
+
 gboolean build_parse_make_dir(const gchar *string, gchar **prefix);
 
 void build_menu_update(gint idx);
@@ -70,28 +73,4 @@
 BuildMenuItems *build_get_menu_items(gint filetype_idx);
 
 
-void
-on_build_compile_activate              (GtkMenuItem     *menuitem,
-                                        gpointer         user_data);
-
-void
-on_build_tex_activate                  (GtkMenuItem     *menuitem,
-                                        gpointer         user_data);
-
-void
-on_build_build_activate                (GtkMenuItem     *menuitem,
-                                        gpointer         user_data);
-
-void
-on_build_make_activate                 (GtkMenuItem     *menuitem,
-                                        gpointer         user_data);
-
-void
-on_build_execute_activate              (GtkMenuItem     *menuitem,
-                                        gpointer         user_data);
-
-void
-on_build_next_error                    (GtkMenuItem     *menuitem,
-                                        gpointer         user_data);
-
 #endif

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/src/callbacks.c	2007-08-23 11:34:06 UTC (rev 1815)
@@ -159,7 +159,7 @@
 gboolean
 on_exit_clicked                        (GtkWidget *widget, gpointer gdata)
 {
-	app->quitting = TRUE;
+	main_status.quitting = TRUE;
 
 	if (! check_no_unsaved())
 	{
@@ -170,7 +170,7 @@
 		}
 	}
 	else
-	if (! app->pref_main_confirm_exit ||
+	if (! prefs.confirm_exit ||
 		dialogs_show_question_full(NULL, GTK_STOCK_QUIT, GTK_STOCK_CANCEL, NULL,
 			_("Do you really want to quit?")))
 	{
@@ -178,7 +178,7 @@
 		return FALSE;
 	}
 
-	app->quitting = FALSE;
+	main_status.quitting = FALSE;
 	return TRUE;
 }
 
@@ -284,8 +284,8 @@
 on_file1_activate                      (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
-	gtk_widget_set_sensitive(app->recent_files_menuitem,
-						g_queue_get_length(app->recent_queue) > 0);
+	gtk_widget_set_sensitive(ui_widgets.recent_files_menuitem,
+						g_queue_get_length(ui_prefs.recent_queue) > 0);
 }
 
 
@@ -507,7 +507,7 @@
 	if (ignore_toolbar_toggle) return;
 
 	gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), GTK_TOOLBAR_BOTH);
-	app->toolbar_icon_style = GTK_TOOLBAR_BOTH;
+	prefs.toolbar_icon_style = GTK_TOOLBAR_BOTH;
 }
 
 
@@ -518,7 +518,7 @@
 	if (ignore_toolbar_toggle) return;
 
 	gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), GTK_TOOLBAR_ICONS);
-	app->toolbar_icon_style = GTK_TOOLBAR_ICONS;
+	prefs.toolbar_icon_style = GTK_TOOLBAR_ICONS;
 }
 
 
@@ -529,7 +529,7 @@
 	if (ignore_toolbar_toggle) return;
 
 	gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), GTK_TOOLBAR_TEXT);
-	app->toolbar_icon_style = GTK_TOOLBAR_TEXT;
+	prefs.toolbar_icon_style = GTK_TOOLBAR_TEXT;
 }
 
 
@@ -660,7 +660,7 @@
 {
 	if (ignore_toolbar_toggle) return;
 
-	app->toolbar_icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
+	prefs.toolbar_icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
 	ui_update_toolbar_icons(GTK_ICON_SIZE_LARGE_TOOLBAR);
 }
 
@@ -671,7 +671,7 @@
 {
 	if (ignore_toolbar_toggle) return;
 
-	app->toolbar_icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR;
+	prefs.toolbar_icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR;
 	ui_update_toolbar_icons(GTK_ICON_SIZE_SMALL_TOOLBAR);
 }
 
@@ -696,7 +696,7 @@
 
 	if (idx >= 0 && doc_list[idx].is_valid)
 	{
-		if (done++ % 3 == 0) sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin,
+		if (done++ % 3 == 0) sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin,
 				(sci_get_zoom(doc_list[idx].sci) / 2));
 		sci_zoom_in(doc_list[idx].sci);
 	}
@@ -711,7 +711,7 @@
 	if (idx >= 0 && doc_list[idx].is_valid)
 	{
 		if (sci_get_zoom(doc_list[idx].sci) == 0)
-			sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
+			sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin, 0);
 		sci_zoom_out(doc_list[idx].sci);
 	}
 }
@@ -725,7 +725,7 @@
 	if (idx >= 0 && doc_list[idx].is_valid)
 	{
 		sci_zoom_off(doc_list[idx].sci);
-		sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
+		sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin, 0);
 	}
 }
 
@@ -767,10 +767,9 @@
 	else
 		idx = document_get_n_idx(page_num);
 
-	if (idx >= 0 && app->opening_session_files == FALSE)
+	if (idx >= 0 && main_status.opening_session_files == FALSE)
 	{
-		gtk_tree_model_foreach(GTK_TREE_MODEL(tv.store_openfiles), treeviews_find_node, GINT_TO_POINTER(idx));
-
+		treeviews_select_openfiles_item(idx);
 		document_set_text_changed(idx);	// also sets window title and status bar
 		ui_update_popup_reundo_items(idx);
 		ui_document_show_hide(idx); // update the document menu
@@ -859,25 +858,25 @@
 
 		ignore_toolbar_toggle = TRUE;
 
-		switch (app->toolbar_icon_style)
+		switch (prefs.toolbar_icon_style)
 		{
-			case 0: w = lookup_widget(app->toolbar_menu, "images_only2"); break;
-			case 1: w = lookup_widget(app->toolbar_menu, "text_only2"); break;
-			default: w = lookup_widget(app->toolbar_menu, "images_and_text2"); break;
+			case 0: w = lookup_widget(ui_widgets.toolbar_menu, "images_only2"); break;
+			case 1: w = lookup_widget(ui_widgets.toolbar_menu, "text_only2"); break;
+			default: w = lookup_widget(ui_widgets.toolbar_menu, "images_and_text2"); break;
 		}
 		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w), TRUE);
 
-		switch (app->toolbar_icon_size)
+		switch (prefs.toolbar_icon_size)
 		{
 			case GTK_ICON_SIZE_LARGE_TOOLBAR:
-					widget = lookup_widget(app->toolbar_menu, "large_icons1"); break;
-			default: widget = lookup_widget(app->toolbar_menu, "small_icons1"); break;
+					widget = lookup_widget(ui_widgets.toolbar_menu, "large_icons1"); break;
+			default: widget = lookup_widget(ui_widgets.toolbar_menu, "small_icons1"); break;
 		}
 		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w), TRUE);
 
 		ignore_toolbar_toggle = FALSE;
 
-		gtk_menu_popup(GTK_MENU(app->toolbar_menu), NULL, NULL, NULL, NULL, event->button, event->time);
+		gtk_menu_popup(GTK_MENU(ui_widgets.toolbar_menu), NULL, NULL, NULL, NULL, event->button, event->time);
 
 		return TRUE;
 	}
@@ -915,8 +914,8 @@
 {
 	if (app->ignore_callback) return;
 
-	app->toolbar_visible = (app->toolbar_visible) ? FALSE : TRUE;;
-	ui_widget_show_hide(GTK_WIDGET(app->toolbar), app->toolbar_visible);
+	prefs.toolbar_visible = (prefs.toolbar_visible) ? FALSE : TRUE;;
+	ui_widget_show_hide(GTK_WIDGET(app->toolbar), prefs.toolbar_visible);
 }
 
 
@@ -924,7 +923,7 @@
 on_fullscreen1_toggled                 (GtkCheckMenuItem *checkmenuitem,
                                         gpointer         user_data)
 {
-	app->fullscreen = (app->fullscreen) ? FALSE : TRUE;
+	ui_prefs.fullscreen = (ui_prefs.fullscreen) ? FALSE : TRUE;
 	ui_set_fullscreen();
 }
 
@@ -935,8 +934,8 @@
 {
 	if (app->ignore_callback) return;
 
-	app->msgwindow_visible = (app->msgwindow_visible) ? FALSE : TRUE;
-	ui_widget_show_hide(lookup_widget(app->window, "scrolledwindow1"), app->msgwindow_visible);
+	ui_prefs.msgwindow_visible = (ui_prefs.msgwindow_visible) ? FALSE : TRUE;
+	ui_widget_show_hide(lookup_widget(app->window, "scrolledwindow1"), ui_prefs.msgwindow_visible);
 }
 
 
@@ -944,7 +943,7 @@
 on_markers_margin1_toggled             (GtkCheckMenuItem *checkmenuitem,
                                         gpointer         user_data)
 {
-	app->show_markers_margin = (app->show_markers_margin) ? FALSE : TRUE;
+	editor_prefs.show_markers_margin = (editor_prefs.show_markers_margin) ? FALSE : TRUE;
 	ui_show_markers_margin();
 }
 
@@ -953,7 +952,7 @@
 on_show_line_numbers1_toggled          (GtkCheckMenuItem *checkmenuitem,
                                         gpointer         user_data)
 {
-	app->show_linenumber_margin = (app->show_linenumber_margin) ? FALSE : TRUE;
+	editor_prefs.show_linenumber_margin = (editor_prefs.show_linenumber_margin) ? FALSE : TRUE;
 	ui_show_linenumber_margin();
 }
 
@@ -1098,7 +1097,7 @@
 on_compile_button_clicked              (GtkToolButton   *toolbutton,
                                         gpointer         user_data)
 {
-	on_build_compile_activate(NULL, NULL);
+	keybindings_cmd(GEANY_KEYS_BUILD_COMPILE);
 }
 
 
@@ -1385,7 +1384,7 @@
 	sci_insert_text(doc_list[idx].sci, 0, text);
 	// sets the cursor to the right position to type the changelog text,
 	// the template has 21 chars + length of name and email
-	sci_goto_pos(doc_list[idx].sci, 21 + strlen(app->pref_template_developer) + strlen(app->pref_template_mail), TRUE);
+	sci_goto_pos(doc_list[idx].sci, 21 + strlen(prefs.template_developer) + strlen(prefs.template_mail), TRUE);
 
 	g_free(text);
 }
@@ -1419,8 +1418,8 @@
 {
 	if (response == GTK_RESPONSE_ACCEPT)
 	{
-		g_free(app->custom_date_format);
-		app->custom_date_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_data)));
+		g_free(ui_prefs.custom_date_format);
+		ui_prefs.custom_date_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_data)));
 	}
 	gtk_widget_destroy(GTK_WIDGET(dialog));
 }
@@ -1460,19 +1459,19 @@
 	else if (utils_str_equal(_("yyyy/mm/dd hh:mm:ss"), (gchar*) user_data))
 		format = "%Y/%m/%d %H:%M:%S";
 	else if (utils_str_equal(_("Use Custom Date Format"), (gchar*) user_data))
-		format = app->custom_date_format;
+		format = ui_prefs.custom_date_format;
 	else
 	{
 		// set default value
-		if (utils_str_equal("", app->custom_date_format))
+		if (utils_str_equal("", ui_prefs.custom_date_format))
 		{
-			g_free(app->custom_date_format);
-			app->custom_date_format = g_strdup("%d.%m.%Y");
+			g_free(ui_prefs.custom_date_format);
+			ui_prefs.custom_date_format = g_strdup("%d.%m.%Y");
 		}
 
 		dialogs_show_input(_("Custom Date Format"),
 			_("Enter here a custom date and time format. You can use any conversion specifiers which can be used with the ANSI C strftime function. See \"man strftime\" for more information."),
-			app->custom_date_format,
+			ui_prefs.custom_date_format,
 			G_CALLBACK(on_custom_date_dialog_response),
 			G_CALLBACK(on_custom_date_entry_activate));
 		return;
@@ -1558,7 +1557,7 @@
 on_run_button_clicked                  (GtkToolButton   *toolbutton,
                                         gpointer         user_data)
 {
-	on_build_execute_activate(NULL, NULL);
+	keybindings_cmd(GEANY_KEYS_BUILD_RUN);
 }
 
 
@@ -1634,19 +1633,19 @@
 
 	if (app->ignore_callback) return;
 
-	if (app->sidebar_visible)
+	if (ui_prefs.sidebar_visible)
 	{
 		// to remember the active page because GTK (e.g. 2.8.18) doesn't do it and shows always
 		// the last page (for unknown reason, with GTK 2.6.4 it works)
 		active_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->treeview_notebook));
 	}
 
-	app->sidebar_visible = ! app->sidebar_visible;
+	ui_prefs.sidebar_visible = ! ui_prefs.sidebar_visible;
 
-	if ((! app->sidebar_openfiles_visible && ! app->sidebar_symbol_visible))
+	if ((! prefs.sidebar_openfiles_visible && ! prefs.sidebar_symbol_visible))
 	{
-		app->sidebar_openfiles_visible = TRUE;
-		app->sidebar_symbol_visible = TRUE;
+		prefs.sidebar_openfiles_visible = TRUE;
+		prefs.sidebar_symbol_visible = TRUE;
 	}
 
 	ui_treeviews_show_hide(TRUE);
@@ -1998,7 +1997,7 @@
 	}
 	else
 	{
-		command = g_strdup(app->context_action_cmd);
+		command = g_strdup(prefs.context_action_cmd);
 	}
 
 	// substitute the wildcard %s and run the command if it is non empty
@@ -2030,7 +2029,7 @@
 	if (hide_all == -1)
 	{
 		if (! gtk_check_menu_item_get_active(msgw) &&
-			! app->show_notebook_tabs &&
+			! prefs.show_notebook_tabs &&
 			! gtk_check_menu_item_get_active(toolbari))
 		{
 			hide_all = TRUE;
@@ -2046,8 +2045,8 @@
 		if (gtk_check_menu_item_get_active(msgw))
 			gtk_check_menu_item_set_active(msgw, ! gtk_check_menu_item_get_active(msgw));
 
-		app->show_notebook_tabs = FALSE;
-		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), app->show_notebook_tabs);
+		prefs.show_notebook_tabs = FALSE;
+		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), prefs.show_notebook_tabs);
 
 		ui_statusbar_showhide(FALSE);
 
@@ -2060,8 +2059,8 @@
 		if (! gtk_check_menu_item_get_active(msgw))
 			gtk_check_menu_item_set_active(msgw, ! gtk_check_menu_item_get_active(msgw));
 
-		app->show_notebook_tabs = TRUE;
-		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), app->show_notebook_tabs);
+		prefs.show_notebook_tabs = TRUE;
+		gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), prefs.show_notebook_tabs);
 
 		ui_statusbar_showhide(TRUE);
 
@@ -2089,7 +2088,7 @@
 
 gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
 {
-	if (app->auto_focus && ! GTK_WIDGET_HAS_FOCUS(widget))
+	if (prefs.auto_focus && ! GTK_WIDGET_HAS_FOCUS(widget))
 		gtk_widget_grab_focus(widget);
 
 	return FALSE;

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/src/dialogs.c	2007-08-23 11:34:06 UTC (rev 1815)
@@ -43,6 +43,7 @@
 
 #include "dialogs.h"
 
+#include "prefs.h"
 #include "callbacks.h"
 #include "document.h"
 #include "filetypes.h"
@@ -67,7 +68,7 @@
                                         gint response,
                                         gpointer user_data)
 {
-	gtk_widget_hide(app->open_filesel);
+	gtk_widget_hide(ui_widgets.open_filesel);
 
 	if (response == GTK_RESPONSE_ACCEPT || response == GTK_RESPONSE_APPLY)
 	{
@@ -84,7 +85,7 @@
 		if (encoding_idx >= 0 && encoding_idx < GEANY_ENCODINGS_MAX)
 			charset = encodings[encoding_idx].charset;
 
-		filelist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(app->open_filesel));
+		filelist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(ui_widgets.open_filesel));
 		if (filelist != NULL)
 		{
 			document_open_files(filelist, ro, ft, charset);
@@ -106,12 +107,12 @@
 
 	if (g_file_test(locale_filename, G_FILE_TEST_IS_DIR))
 	{
-		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(app->open_filesel), locale_filename);
+		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(ui_widgets.open_filesel), locale_filename);
 	}
 	else if (g_file_test(locale_filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))
 	{
-		gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(app->open_filesel), locale_filename);
-		on_file_open_dialog_response(GTK_DIALOG(app->open_filesel), GTK_RESPONSE_ACCEPT, NULL);
+		gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(ui_widgets.open_filesel), locale_filename);
+		on_file_open_dialog_response(GTK_DIALOG(ui_widgets.open_filesel), GTK_RESPONSE_ACCEPT, NULL);
 	}
 
 	g_free(locale_filename);
@@ -151,7 +152,7 @@
 {
 	gboolean is_on = gtk_toggle_button_get_active(togglebutton);
 
-	gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(app->open_filesel), is_on);
+	gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(ui_widgets.open_filesel), is_on);
 }
 #endif
 
@@ -166,7 +167,7 @@
 
 	/* We use the same file selection widget each time, so first
 		of all we create it if it hasn't already been created. */
-	if (app->open_filesel == NULL)
+	if (ui_widgets.open_filesel == NULL)
 	{
 		GtkWidget *filetype_combo, *encoding_combo;
 		GtkWidget *viewbtn;
@@ -174,53 +175,53 @@
 		gint i;
 		gchar *encoding_string;
 
-		app->open_filesel = gtk_file_chooser_dialog_new(_("Open File"), GTK_WINDOW(app->window),
+		ui_widgets.open_filesel = gtk_file_chooser_dialog_new(_("Open File"), GTK_WINDOW(app->window),
 				GTK_FILE_CHOOSER_ACTION_OPEN, NULL, NULL);
-		gtk_widget_set_name(app->open_filesel, "GeanyDialog");
+		gtk_widget_set_name(ui_widgets.open_filesel, "GeanyDialog");
 
 		viewbtn = gtk_button_new_with_mnemonic(_("_View"));
 		gtk_tooltips_set_tip(tooltips, viewbtn,
 			_("Opens the file in read-only mode. If you choose more than one file to open, all files will be opened read-only."), NULL);
 		gtk_widget_show(viewbtn);
-		gtk_dialog_add_action_widget(GTK_DIALOG(app->open_filesel),
+		gtk_dialog_add_action_widget(GTK_DIALOG(ui_widgets.open_filesel),
 			viewbtn, GTK_RESPONSE_APPLY);
 
-		gtk_dialog_add_buttons(GTK_DIALOG(app->open_filesel),
+		gtk_dialog_add_buttons(GTK_DIALOG(ui_widgets.open_filesel),
 			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 			GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
-		gtk_dialog_set_default_response(GTK_DIALOG(app->open_filesel),
+		gtk_dialog_set_default_response(GTK_DIALOG(ui_widgets.open_filesel),
 			GTK_RESPONSE_ACCEPT);
 
-		gtk_widget_set_size_request(app->open_filesel, -1, 460);
-		gtk_window_set_modal(GTK_WINDOW(app->open_filesel), TRUE);
-		gtk_window_set_destroy_with_parent(GTK_WINDOW(app->open_filesel), TRUE);
-		gtk_window_set_skip_taskbar_hint(GTK_WINDOW(app->open_filesel), TRUE);
-		gtk_window_set_type_hint(GTK_WINDOW(app->open_filesel), GDK_WINDOW_TYPE_HINT_DIALOG);
-		gtk_window_set_transient_for(GTK_WINDOW(app->open_filesel), GTK_WINDOW(app->window));
-		gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(app->open_filesel), TRUE);
+		gtk_widget_set_size_request(ui_widgets.open_filesel, -1, 460);
+		gtk_window_set_modal(GTK_WINDOW(ui_widgets.open_filesel), TRUE);
+		gtk_window_set_destroy_with_parent(GTK_WINDOW(ui_widgets.open_filesel), TRUE);
+		gtk_window_set_skip_taskbar_hint(GTK_WINDOW(ui_widgets.open_filesel), TRUE);
+		gtk_window_set_type_hint(GTK_WINDOW(ui_widgets.open_filesel), GDK_WINDOW_TYPE_HINT_DIALOG);
+		gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.open_filesel), GTK_WINDOW(app->window));
+		gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(ui_widgets.open_filesel), TRUE);
 
 		// add checkboxes and filename entry
-		gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(app->open_filesel),
+		gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(ui_widgets.open_filesel),
 			add_file_open_extra_widget());
-		filetype_combo = lookup_widget(app->open_filesel, "filetype_combo");
+		filetype_combo = lookup_widget(ui_widgets.open_filesel, "filetype_combo");
 
 		// add FileFilters(start with "All Files")
-		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(app->open_filesel),
+		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(ui_widgets.open_filesel),
 					filetypes_create_file_filter(filetypes[GEANY_FILETYPES_ALL]));
 		// now create meta filter "All Source"
-		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(app->open_filesel),
+		gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(ui_widgets.open_filesel),
 					filetypes_create_file_filter_all_source());
 		for (i = 0; i < GEANY_MAX_FILE_TYPES - 1; i++)
 		{
 			gtk_combo_box_append_text(GTK_COMBO_BOX(filetype_combo), filetypes[i]->title);
-			gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(app->open_filesel),
+			gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(ui_widgets.open_filesel),
 					filetypes_create_file_filter(filetypes[i]));
 		}
 		gtk_combo_box_append_text(GTK_COMBO_BOX(filetype_combo), _("Detect by file extension"));
 		gtk_combo_box_set_active(GTK_COMBO_BOX(filetype_combo), GEANY_MAX_FILE_TYPES - 1);
 
 		// fill encoding combo box
-		encoding_combo = lookup_widget(app->open_filesel, "encoding_combo");
+		encoding_combo = lookup_widget(ui_widgets.open_filesel, "encoding_combo");
 		for (i = 0; i < GEANY_ENCODINGS_MAX; i++)
 		{
 			encoding_string = encodings_to_string(&encodings[i]);
@@ -230,11 +231,11 @@
 		gtk_combo_box_append_text(GTK_COMBO_BOX(encoding_combo), _("Detect from file"));
 		gtk_combo_box_set_active(GTK_COMBO_BOX(encoding_combo), GEANY_ENCODINGS_MAX);
 
-		g_signal_connect((gpointer) app->open_filesel, "selection-changed",
+		g_signal_connect((gpointer) ui_widgets.open_filesel, "selection-changed",
 					G_CALLBACK(on_file_open_selection_changed), NULL);
-		g_signal_connect ((gpointer) app->open_filesel, "delete_event",
+		g_signal_connect ((gpointer) ui_widgets.open_filesel, "delete_event",
 					G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-		g_signal_connect((gpointer) app->open_filesel, "response",
+		g_signal_connect((gpointer) ui_widgets.open_filesel, "response",
 					G_CALLBACK(on_file_open_dialog_response), NULL);
 	}
 
@@ -248,22 +249,22 @@
 
 		if (g_path_is_absolute(locale_filename))
 			gtk_file_chooser_set_current_folder(
-				GTK_FILE_CHOOSER(app->open_filesel), locale_filename);
+				GTK_FILE_CHOOSER(ui_widgets.open_filesel), locale_filename);
 
 		g_free(initdir);
 		g_free(locale_filename);
 	}
 	// use default startup directory(if set) if no files are open
 	/// TODO should it only be used when initally open the dialog and not on every show?
-	else if (app->default_open_path != NULL && *app->default_open_path != '\0')
+	else if (prefs.default_open_path != NULL && *prefs.default_open_path != '\0')
 	{
-		if (g_path_is_absolute(app->default_open_path))
+		if (g_path_is_absolute(prefs.default_open_path))
 			gtk_file_chooser_set_current_folder(
-				GTK_FILE_CHOOSER(app->open_filesel), app->default_open_path);
+				GTK_FILE_CHOOSER(ui_widgets.open_filesel), prefs.default_open_path);
 	}
 
-	gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(app->open_filesel));
-	gtk_widget_show(app->open_filesel);
+	gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(ui_widgets.open_filesel));
+	gtk_widget_show(ui_widgets.open_filesel);
 #endif
 }
 
@@ -347,13 +348,13 @@
 	g_signal_connect((gpointer) check_hidden, "toggled",
 				G_CALLBACK(on_file_open_check_hidden_toggled), NULL);
 
-	g_object_set_data_full(G_OBJECT(app->open_filesel), "file_entry",
+	g_object_set_data_full(G_OBJECT(ui_widgets.open_filesel), "file_entry",
 				gtk_widget_ref(file_entry), (GDestroyNotify)gtk_widget_unref);
-	g_object_set_data_full(G_OBJECT(app->open_filesel), "check_hidden",
+	g_object_set_data_full(G_OBJECT(ui_widgets.open_filesel), "check_hidden",
 				gtk_widget_ref(check_hidden), (GDestroyNotify)gtk_widget_unref);
-	g_object_set_data_full(G_OBJECT(app->open_filesel), "filetype_combo",
+	g_object_set_data_full(G_OBJECT(ui_widgets.open_filesel), "filetype_combo",
 				gtk_widget_ref(filetype_combo), (GDestroyNotify)gtk_widget_unref);
-	g_object_set_data_full(G_OBJECT(app->open_filesel), "encoding_combo",
+	g_object_set_data_full(G_OBJECT(ui_widgets.open_filesel), "encoding_combo",
 				gtk_widget_ref(encoding_combo), (GDestroyNotify)gtk_widget_unref);
 
 	return vbox;
@@ -387,10 +388,10 @@
 		case GTK_RESPONSE_ACCEPT:
 		{
 			gint idx = document_get_cur_idx();
-			gchar *new_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(app->save_filesel));
+			gchar *new_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(ui_widgets.save_filesel));
 			gchar *utf8_filename;
 			gboolean open_new_tab = gtk_toggle_button_get_active(
-					GTK_TOGGLE_BUTTON(lookup_widget(app->save_filesel, "check_open_new_tab")));
+					GTK_TOGGLE_BUTTON(lookup_widget(ui_widgets.save_filesel, "check_open_new_tab")));
 
 #ifdef G_OS_WIN32
 			utf8_filename = g_strdup(new_filename);
@@ -445,7 +446,7 @@
 			g_free(new_filename);
 		}
 	}
-	gtk_widget_hide(app->save_filesel);
+	gtk_widget_hide(ui_widgets.save_filesel);
 }
 #endif
 
@@ -459,30 +460,30 @@
 #else
 	gint idx = document_get_cur_idx(), resp;
 
-	if (app->save_filesel == NULL)
+	if (ui_widgets.save_filesel == NULL)
 	{
 		GtkWidget *vbox, *check_open_new_tab, *rename_btn;
 		GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
 
-		app->save_filesel = gtk_file_chooser_dialog_new(_("Save File"), GTK_WINDOW(app->window),
+		ui_widgets.save_filesel = gtk_file_chooser_dialog_new(_("Save File"), GTK_WINDOW(app->window),
 					GTK_FILE_CHOOSER_ACTION_SAVE, NULL, NULL);
-		gtk_window_set_modal(GTK_WINDOW(app->save_filesel), TRUE);
-		gtk_window_set_destroy_with_parent(GTK_WINDOW(app->save_filesel), TRUE);
-		gtk_window_set_skip_taskbar_hint(GTK_WINDOW(app->save_filesel), TRUE);
-		gtk_window_set_type_hint(GTK_WINDOW(app->save_filesel), GDK_WINDOW_TYPE_HINT_DIALOG);
-		gtk_widget_set_name(app->save_filesel, "GeanyDialog");
+		gtk_window_set_modal(GTK_WINDOW(ui_widgets.save_filesel), TRUE);
+		gtk_window_set_destroy_with_parent(GTK_WINDOW(ui_widgets.save_filesel), TRUE);
+		gtk_window_set_skip_taskbar_hint(GTK_WINDOW(ui_widgets.save_filesel), TRUE);
+		gtk_window_set_type_hint(GTK_WINDOW(ui_widgets.save_filesel), GDK_WINDOW_TYPE_HINT_DIALOG);
+		gtk_widget_set_name(ui_widgets.save_filesel, "GeanyDialog");
 
 		rename_btn = gtk_button_new_with_mnemonic(_("R_ename"));
 		gtk_tooltips_set_tip(tooltips, rename_btn,
 			_("Save the file and rename it."), NULL);
 		gtk_widget_show(rename_btn);
-		gtk_dialog_add_action_widget(GTK_DIALOG(app->save_filesel),
+		gtk_dialog_add_action_widget(GTK_DIALOG(ui_widgets.save_filesel),
 			rename_btn, GTK_RESPONSE_APPLY);
 
-		gtk_dialog_add_buttons(GTK_DIALOG(app->save_filesel),
+		gtk_dialog_add_buttons(GTK_DIALOG(ui_widgets.save_filesel),
 			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 			GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL);
-		gtk_dialog_set_default_response(GTK_DIALOG(app->save_filesel), GTK_RESPONSE_ACCEPT);
+		gtk_dialog_set_default_response(GTK_DIALOG(ui_widgets.save_filesel), GTK_RESPONSE_ACCEPT);
 
 		vbox = gtk_vbox_new(FALSE, 0);
 		check_open_new_tab = gtk_check_button_new_with_mnemonic(_("_Open file in a new tab"));
@@ -491,20 +492,20 @@
 			" and open the newly saved file in a new tab."), NULL);
 		gtk_box_pack_start(GTK_BOX(vbox), check_open_new_tab, FALSE, FALSE, 0);
 		gtk_widget_show_all(vbox);
-		gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(app->save_filesel), vbox);
+		gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(ui_widgets.save_filesel), vbox);
 
 		g_signal_connect(check_open_new_tab, "toggled",
 					G_CALLBACK(on_save_as_new_tab_toggled), rename_btn);
 
-		g_object_set_data_full(G_OBJECT(app->save_filesel), "check_open_new_tab",
+		g_object_set_data_full(G_OBJECT(ui_widgets.save_filesel), "check_open_new_tab",
 					gtk_widget_ref(check_open_new_tab), (GDestroyNotify) gtk_widget_unref);
 
-		g_signal_connect((gpointer) app->save_filesel, "delete_event",
+		g_signal_connect((gpointer) ui_widgets.save_filesel, "delete_event",
 			G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-		g_signal_connect((gpointer) app->save_filesel, "response",
+		g_signal_connect((gpointer) ui_widgets.save_filesel, "response",
 			G_CALLBACK(on_file_save_dialog_response), NULL);
 
-		gtk_window_set_transient_for(GTK_WINDOW(app->save_filesel), GTK_WINDOW(app->window));
+		gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.save_filesel), GTK_WINDOW(app->window));
 	}
 
 	// If the current document has a filename we use that as the default.
@@ -516,9 +517,9 @@
 		gchar *locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
 #endif
 		if (g_path_is_absolute(locale_filename))
-			gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(app->save_filesel), locale_filename);
+			gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(ui_widgets.save_filesel), locale_filename);
 		else
-			gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(app->save_filesel),
+			gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(ui_widgets.save_filesel),
 				doc_list[idx].file_name);
 #ifndef G_OS_WIN32
 		g_free(locale_filename);
@@ -535,20 +536,20 @@
 		else
 			fname = g_strdup(GEANY_STRING_UNTITLED);
 
-		gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(app->save_filesel));
-		gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(app->save_filesel), fname);
+		gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(ui_widgets.save_filesel));
+		gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(ui_widgets.save_filesel), fname);
 
 		// use default startup directory(if set) if no files are open
-		if (app->default_open_path != NULL && *app->default_open_path != '\0')
+		if (prefs.default_open_path != NULL && *prefs.default_open_path != '\0')
 		{
-			if (g_path_is_absolute(app->default_open_path))
+			if (g_path_is_absolute(prefs.default_open_path))
 			{
 #ifdef G_OS_WIN32
 				gtk_file_chooser_set_current_folder(
-					GTK_FILE_CHOOSER(app->save_filesel), app->default_open_path);
+					GTK_FILE_CHOOSER(ui_widgets.save_filesel), prefs.default_open_path);
 #else
-				gchar *def_path = utils_get_locale_from_utf8(app->default_open_path);
-				gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(app->save_filesel), def_path);
+				gchar *def_path = utils_get_locale_from_utf8(prefs.default_open_path);
+				gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(ui_widgets.save_filesel), def_path);
 				g_free(def_path);
 #endif
 			}
@@ -557,7 +558,7 @@
 	}
 
 	// Run the dialog synchronously, pausing this function call
-	resp = gtk_dialog_run(GTK_DIALOG(app->save_filesel));
+	resp = gtk_dialog_run(GTK_DIALOG(ui_widgets.save_filesel));
 	return (resp == GTK_RESPONSE_ACCEPT);
 #endif
 }
@@ -662,7 +663,7 @@
 	gchar *fontname;
 
 	fontname = gtk_font_selection_dialog_get_font_name(
-		GTK_FONT_SELECTION_DIALOG(app->open_fontsel));
+		GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel));
 	ui_set_editor_font(fontname);
 	g_free(fontname);
 }
@@ -674,7 +675,7 @@
 {
 	// We do the same thing as apply, but we close the dialog after.
 	on_font_apply_button_clicked(button, NULL);
-	gtk_widget_hide(app->open_fontsel);
+	gtk_widget_hide(ui_widgets.open_fontsel);
 }
 
 
@@ -682,7 +683,7 @@
 on_font_cancel_button_clicked         (GtkButton       *button,
                                         gpointer         user_data)
 {
-	gtk_widget_hide(app->open_fontsel);
+	gtk_widget_hide(ui_widgets.open_fontsel);
 }
 #endif
 
@@ -694,33 +695,33 @@
 	win32_show_font_dialog();
 #else
 
-	if (app->open_fontsel == NULL)
+	if (ui_widgets.open_fontsel == NULL)
 	{
-		app->open_fontsel = gtk_font_selection_dialog_new(_("Choose font"));;
-		gtk_container_set_border_width(GTK_CONTAINER(app->open_fontsel), 4);
-		gtk_window_set_modal(GTK_WINDOW(app->open_fontsel), TRUE);
-		gtk_window_set_destroy_with_parent(GTK_WINDOW(app->open_fontsel), TRUE);
-		gtk_window_set_skip_taskbar_hint(GTK_WINDOW(app->open_fontsel), TRUE);
-		gtk_window_set_type_hint(GTK_WINDOW(app->open_fontsel), GDK_WINDOW_TYPE_HINT_DIALOG);
-		gtk_widget_set_name(app->open_fontsel, "GeanyDialog");
+		ui_widgets.open_fontsel = gtk_font_selection_dialog_new(_("Choose font"));;
+		gtk_container_set_border_width(GTK_CONTAINER(ui_widgets.open_fontsel), 4);
+		gtk_window_set_modal(GTK_WINDOW(ui_widgets.open_fontsel), TRUE);
+		gtk_window_set_destroy_with_parent(GTK_WINDOW(ui_widgets.open_fontsel), TRUE);
+		gtk_window_set_skip_taskbar_hint(GTK_WINDOW(ui_widgets.open_fontsel), TRUE);
+		gtk_window_set_type_hint(GTK_WINDOW(ui_widgets.open_fontsel), GDK_WINDOW_TYPE_HINT_DIALOG);
+		gtk_widget_set_name(ui_widgets.open_fontsel, "GeanyDialog");
 
-		gtk_widget_show(GTK_FONT_SELECTION_DIALOG(app->open_fontsel)->apply_button);
+		gtk_widget_show(GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel)->apply_button);
 
-		g_signal_connect((gpointer) app->open_fontsel,
+		g_signal_connect((gpointer) ui_widgets.open_fontsel,
 					"delete_event", G_CALLBACK(gtk_widget_hide_on_delete), NULL);
-		g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(app->open_fontsel)->ok_button,
+		g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel)->ok_button,
 					"clicked", G_CALLBACK(on_font_ok_button_clicked), NULL);
-		g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(app->open_fontsel)->cancel_button,
+		g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel)->cancel_button,
 					"clicked", G_CALLBACK(on_font_cancel_button_clicked), NULL);
-		g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(app->open_fontsel)->apply_button,
+		g_signal_connect((gpointer) GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel)->apply_button,
 					"clicked", G_CALLBACK(on_font_apply_button_clicked), NULL);
 
 		gtk_font_selection_dialog_set_font_name(
-			GTK_FONT_SELECTION_DIALOG(app->open_fontsel), app->editor_font);
-		gtk_window_set_transient_for(GTK_WINDOW(app->open_fontsel), GTK_WINDOW(app->window));
+			GTK_FONT_SELECTION_DIALOG(ui_widgets.open_fontsel), prefs.editor_font);
+		gtk_window_set_transient_for(GTK_WINDOW(ui_widgets.open_fontsel), GTK_WINDOW(app->window));
 	}
 	/* We make sure the dialog is visible. */
-	gtk_window_present(GTK_WINDOW(app->open_fontsel));
+	gtk_window_present(GTK_WINDOW(ui_widgets.open_fontsel));
 #endif
 }
 

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/src/document.c	2007-08-23 11:34:06 UTC (rev 1815)
@@ -51,6 +51,7 @@
 #include <glib/gstdio.h>
 
 #include "document.h"
+#include "prefs.h"
 #include "filetypes.h"
 #include "support.h"
 #include "sciwrappers.h"
@@ -187,7 +188,7 @@
 
 void document_set_text_changed(gint idx)
 {
-	if (DOC_IDX_VALID(idx) && ! app->quitting)
+	if (DOC_IDX_VALID(idx) && ! main_status.quitting)
 	{
 		ui_update_tab_status(idx);
 		ui_save_buttons_toggle(doc_list[idx].changed);
@@ -201,7 +202,7 @@
 void document_apply_update_prefs(gint idx)
 {
 	ScintillaObject *sci = doc_list[idx].sci;
-	sci_set_mark_long_lines(sci, app->long_line_type, app->long_line_column, app->long_line_color);
+	sci_set_mark_long_lines(sci, editor_prefs.long_line_type, editor_prefs.long_line_column, editor_prefs.long_line_color);
 
 	sci_set_tab_width(sci, editor_prefs.tab_width);
 
@@ -209,7 +210,7 @@
 	// remove indent spaces on backspace, if using spaces to indent
 	SSM(sci, SCI_SETBACKSPACEUNINDENTS, ! editor_prefs.use_tabs, 0);
 
-	sci_set_autoc_max_height(sci, app->autocompletion_max_height);
+	sci_set_autoc_max_height(sci, editor_prefs.autocompletion_max_height);
 
 	sci_set_indentation_guides(sci, editor_prefs.show_indent_guide);
 	sci_set_visible_white_spaces(sci, editor_prefs.show_white_space);
@@ -327,9 +328,9 @@
 
 	document_apply_update_prefs(new_idx);
 
-	sci_set_tab_indents(sci, app->use_tab_to_indent);
-	sci_set_symbol_margin(sci, app->show_markers_margin);
-	sci_set_line_numbers(sci, app->show_linenumber_margin, 0);
+	sci_set_tab_indents(sci, editor_prefs.use_tab_to_indent);
+	sci_set_symbol_margin(sci, editor_prefs.show_markers_margin);
+	sci_set_line_numbers(sci, editor_prefs.show_linenumber_margin, 0);
 	sci_set_lines_wrapped(sci, editor_prefs.line_breaking);
 	sci_set_scrollbar_mode(sci, editor_prefs.show_scrollbars);
 	sci_set_caret_policy_x(sci, CARET_JUMPS | CARET_EVEN, 0);
@@ -343,7 +344,7 @@
 					G_CALLBACK(on_editor_button_press_event), GINT_TO_POINTER(new_idx));
 	g_signal_connect(G_OBJECT(sci), "motion-notify-event", G_CALLBACK(on_motion_event), NULL);
 
-	pfd = pango_font_description_from_string(app->editor_font);
+	pfd = pango_font_description_from_string(prefs.editor_font);
 	fname = g_strdup_printf("!%s", pango_font_description_get_family(pfd));
 	document_set_font(new_idx, fname, pango_font_description_get_size(pfd) / PANGO_SCALE);
 	pango_font_description_free(pfd);
@@ -486,7 +487,7 @@
 	document_set_text_changed(idx);
 	ui_document_show_hide(idx); // update the document menu
 
-	sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
+	sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin, 0);
 	sci_goto_pos(doc_list[idx].sci, 0, TRUE);
 
 	// "the" SCI signal (connect after initial setup(i.e. adding text))
@@ -686,7 +687,7 @@
 				"This can occur if the file contains a NULL byte. "
 				"Be aware that saving it can cause data loss.\nThe file was set to read-only.");
 
-		if (app->main_window_realized)
+		if (main_status.main_window_realized)
 			dialogs_show_msgbox(GTK_MESSAGE_WARNING, warn_msg, utf8_filename);
 
 		msgwin_status_add(warn_msg, utf8_filename);
@@ -851,7 +852,7 @@
 	sci_set_readonly(doc_list[idx].sci, doc_list[idx].readonly);
 
 	// update line number margin width
-	sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
+	sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin, 0);
 
 	// set the cursor position according to pos, cl_options.goto_line and cl_options.goto_column
 	set_cursor_position(idx, pos);
@@ -876,7 +877,7 @@
 	ui_document_show_hide(idx);	// update the document menu
 
 	// finally add current file to recent files menu, but not the files from the last session
-	if (! app->opening_session_files)
+	if (! main_status.opening_session_files)
 		ui_add_recent_file(utf8_filename);
 
 	if (! reload && geany_object)
@@ -1107,13 +1108,13 @@
 	store_saved_encoding(idx);
 
 	// ignore the following things if we are quitting
-	if (! app->quitting)
+	if (! main_status.quitting)
 	{
 		gchar *base_name = g_path_get_basename(doc_list[idx].file_name);
 
 		// set line numbers again, to reset the margin width, if
 		// there are more lines than before
-		sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
+		sci_set_line_numbers(doc_list[idx].sci, editor_prefs.show_linenumber_margin, 0);
 		sci_set_savepoint(doc_list[idx].sci);
 
 		/* stat the file to get the timestamp, otherwise on Windows the actual
@@ -1245,7 +1246,7 @@
 		}
 
 		// we searched only part of the document, so ask whether to wraparound.
-		if (app->pref_main_suppress_search_dialogs ||
+		if (prefs.suppress_search_dialogs ||
 			dialogs_show_question_full(parent, GTK_STOCK_FIND, GTK_STOCK_CANCEL,
 				_("Wrap search and find again?"), _("\"%s\" was not found."), text))
 		{
@@ -1847,7 +1848,7 @@
 	if (! DOC_IDX_VALID(idx) || doc_list[idx].file_name == NULL)
 		return;
 
-	cmdline = g_strdup(app->tools_print_cmd);
+	cmdline = g_strdup(prefs.tools_print_cmd);
 	cmdline = utils_str_replace(cmdline, "%f", doc_list[idx].file_name);
 
 	if (dialogs_show_question(
@@ -2030,7 +2031,7 @@
 	doc_list[idx].redo_actions = NULL;
 
 	doc_list[idx].changed = FALSE;
-	if (! app->quitting) document_set_text_changed(idx);
+	if (! main_status.quitting) document_set_text_changed(idx);
 
 	//geany_debug("%s: new undo stack height: %d, new redo stack height: %d", __func__,
 				//g_trash_stack_height(&doc_list[idx].undo_actions), g_trash_stack_height(&doc_list[idx].redo_actions));

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/src/editor.c	2007-08-23 11:34:06 UTC (rev 1815)
@@ -556,7 +556,7 @@
 
 	styBrace = sci_get_style_at(sci, pos);
 
-	if (utils_is_opening_brace(chBrace))
+	if (utils_is_opening_brace(chBrace, editor_prefs.brace_match_ltgt))
 		direction = 1;
 
 	pos = pos + direction;
@@ -690,7 +690,8 @@
 	{
 		c = SSM(sci, SCI_GETCHARAT, pos, 0);
 		pos--;
-		if (utils_is_opening_brace(c)) return pos;
+		if (utils_is_opening_brace(c, editor_prefs.brace_match_ltgt))
+			return pos;
 	}
 	return -1;
 }
@@ -1908,10 +1909,10 @@
 	gint brace_pos = cur_pos - 1;
 	gint end_pos;
 
-	if (! utils_isbrace(sci_get_char_at(sci, brace_pos)))
+	if (! utils_isbrace(sci_get_char_at(sci, brace_pos), editor_prefs.brace_match_ltgt))
 	{
 		brace_pos++;
-		if (! utils_isbrace(sci_get_char_at(sci, brace_pos)))
+		if (! utils_isbrace(sci_get_char_at(sci, brace_pos), editor_prefs.brace_match_ltgt))
 		{
 			SSM(sci, SCI_BRACEBADLIGHT, -1, 0);
 			return;

Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/src/editor.h	2007-08-23 11:34:06 UTC (rev 1815)
@@ -65,6 +65,14 @@
 	gboolean	disable_dnd;
 	gboolean	smart_home_key;
 	GHashTable	*auto_completions;
+	gboolean	brace_match_ltgt;	// whether to highlight < and > chars
+	gboolean	use_tab_to_indent;
+	gint		autocompletion_max_height;
+	gint		long_line_type;
+	gint		long_line_column;
+	gchar		*long_line_color;
+	gboolean	show_markers_margin;
+	gboolean	show_linenumber_margin;
 } EditorPrefs;
 
 extern EditorPrefs editor_prefs;
@@ -72,8 +80,8 @@
 
 typedef struct
 {
-	gchar *current_word;	// holds word under the mouse or keyboard cursor
-	gint click_pos;			// text position where the mouse was clicked
+	gchar	*current_word;	// holds word under the mouse or keyboard cursor
+	gint	click_pos;		// text position where the mouse was clicked
 } EditorInfo;
 
 extern EditorInfo editor_info;
@@ -81,12 +89,9 @@
 
 
 
-gboolean
-on_editor_button_press_event           (GtkWidget *widget,
-                                        GdkEventButton *event,
-                                        gpointer user_data);
+gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton *event,
+	gpointer user_data);
 
-// callback func called by all editors when a signal arises
 void on_editor_notification(GtkWidget* editor, gint scn, gpointer lscn, gpointer user_data);
 
 gboolean editor_start_auto_complete(gint idx, gint pos, gboolean force);
@@ -99,12 +104,8 @@
 
 void editor_show_macro_list(ScintillaObject *sci);
 
-/* Reads the word at given cursor position and writes it into the given buffer. The buffer will be
- * NULL terminated in any case, even when the word is truncated because wordlen is too small.
- * position can be -1, then the current position is used.
- * wc are the wordchars to use, if NULL, GEANY_WORDCHARS will be used */
 void editor_find_current_word(ScintillaObject *sci, gint pos, gchar *word, size_t wordlen,
-							  const gchar *wc);
+	const gchar *wc);
 
 gboolean editor_show_calltip(gint idx, gint pos);
 

Modified: trunk/src/geany.h
===================================================================
--- trunk/src/geany.h	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/src/geany.h	2007-08-23 11:34:06 UTC (rev 1815)
@@ -21,6 +21,9 @@
  * $Id$
  */
 
+/* Main header - should be included first in all source files.
+ * externs and function prototypes are implemented in main.c. */
+
 #ifndef GEANY_H
 #define GEANY_H
 
@@ -80,114 +83,29 @@
 typedef struct _GeanyProject GeanyProject;
 
 
-/* store some pointers and variables for frequently used widgets  */
-typedef struct MyApp
+/* Commonly used items.
+ * Remember to increment abi_version in plugindata.h when changing items. */
+typedef struct GeanyApp
 {
-	gint			 	 toolbar_icon_style;
-	// 0:x, 1:y, 2:width, 3:height, flag for maximized state
-	gint				 geometry[5];
-	gboolean			 debug_mode;
-	// represents the state at startup while opening session files
-	gboolean			 opening_session_files;
-	// represents the state when Geany is quitting completely
-	gboolean			 quitting;
-	gboolean			 ignore_callback;
-	gboolean			 ignore_global_tags;
-	gboolean			 toolbar_visible;
-	gboolean			 sidebar_symbol_visible;
-	gboolean			 sidebar_openfiles_visible;
-	gboolean			 sidebar_visible;
-	gboolean			 statusbar_visible;
-	gboolean			 msgwindow_visible;
-	gboolean			 fullscreen;
-	gboolean			 beep_on_errors;
-	gboolean			 switch_msgwin_pages;
-	gboolean			 auto_focus;
-	gboolean			 show_notebook_tabs;
-	gboolean			 tab_order_ltr;
-	gboolean			 show_markers_margin;
-	gboolean			 show_linenumber_margin;
-	gboolean			 brace_match_ltgt;
-	gboolean			 use_tab_to_indent;
-	gboolean			 main_window_realized;
-	gboolean			 pref_main_load_session;
-	gboolean			 pref_main_save_winpos;
-	gboolean			 pref_main_confirm_exit;
-	gboolean			 pref_main_suppress_search_dialogs;
-	gboolean			 pref_main_suppress_status_messages;
-	gboolean			 pref_toolbar_show_search;
-	gboolean			 pref_toolbar_show_goto;
-	gboolean			 pref_toolbar_show_undo;
-	gboolean			 pref_toolbar_show_navigation;
-	gboolean			 pref_toolbar_show_compile;
-	gboolean			 pref_toolbar_show_zoom;
-	gboolean			 pref_toolbar_show_colour;
-	gboolean			 pref_toolbar_show_fileops;
-	gboolean			 pref_toolbar_show_quit;
-	gint				 tab_pos_editor;
-	gint				 tab_pos_msgwin;
-	gint				 tab_pos_sidebar;
-	guint				 mru_length;
-	gint				 autocompletion_max_height;
-	gint				 long_line_type;
-	gint				 long_line_column;
-	gchar				*long_line_color;
-	gchar				*context_action_cmd;
-	gchar				*pref_template_developer;
-	gchar				*pref_template_company;
-	gchar				*pref_template_mail;
-	gchar				*pref_template_initial;
-	gchar				*pref_template_version;
-	gchar				*editor_font;
-	gchar				*tagbar_font;
-	gchar				*msgwin_font;
+	gboolean			debug_mode;
 	gchar				*configdir;
 	gchar				*datadir;
 	gchar				*docdir;
-	gchar				*default_open_path;
-	gchar				*custom_date_format;
-	gchar				**custom_commands;
-	gchar				*tools_browser_cmd;
-	gchar				*tools_make_cmd;
-	gchar				*tools_term_cmd;
-	gchar				*tools_print_cmd;
-	gchar				*tools_grep_cmd;
-	GtkIconSize			 toolbar_icon_size;
+	const TMWorkspace	*tm_workspace;
+	GeanyProject		*project;	// currently active project or NULL if none is open
+	gboolean			ignore_callback;	// should not be used in new code (use clicked instead of toggled signal)
+
+	/* Important widgets */
+	GtkWidget			*window;
 	GtkWidget			*toolbar;
-	GtkWidget			*run_button;
-	GtkWidget			*compile_button;
-	GtkWidget			*compile_button_image;
-	GtkWidget			*tagbar;
 	GtkWidget			*treeview_notebook;
 	GtkWidget			*notebook;
-	GtkWidget			*statusbar;
-	GtkWidget			*window;
+	GtkWidget			*statusbar;	// use ui_set_statusbar() or msgwin_status_add() to set
 	GtkWidget			*popup_menu;
-	GtkWidget			*toolbar_menu;
-	GtkWidget			*new_file_menu;
-	GtkWidget			*recent_files_menuitem;
-	GtkWidget			*recent_files_menubar;
-	GtkWidget			*recent_files_toolbar;
-	GtkWidget			*menu_insert_include_item[2];
-	GtkWidget			*popup_goto_items[3];
-	GtkWidget			*popup_items[5];
-	GtkWidget			*menu_copy_items[5];
-	GtkWidget			*redo_items[3];
-	GtkWidget			*undo_items[3];
-	GtkWidget			*save_buttons[4];
-	GtkWidget			*navigation_buttons[2];
-	GtkWidget			*open_colorsel;
-	GtkWidget			*open_fontsel;
-	GtkWidget			*open_filesel;
-	GtkWidget			*save_filesel;
-	GtkWidget			*prefs_dialog;
-	GtkWidget			*default_tag_tree;
-	const TMWorkspace	*tm_workspace;
-	GQueue				*recent_queue;
-	GeanyProject		*project; // currently active project or NULL if none is open
-} MyApp;
+}
+GeanyApp;
 
-extern MyApp *app;
+extern GeanyApp *app;
 
 
 enum
@@ -221,7 +139,7 @@
 #endif
 
 
-// implementation in main.c; prototype is here so that all files can use it.
+// prototype is here so that all files can use it.
 void geany_debug(gchar const *format, ...) G_GNUC_PRINTF (1, 2);
 
 #endif

Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/src/highlighting.c	2007-08-23 11:34:06 UTC (rev 1815)
@@ -619,7 +619,7 @@
 	// have to set whitespace after setting wordchars
 	SSM(sci, SCI_SETWHITESPACECHARS, 0, (sptr_t) whitespace_chars);
 
-	SSM(sci, SCI_AUTOCSETMAXHEIGHT, app->autocompletion_max_height, 0);
+	SSM(sci, SCI_AUTOCSETMAXHEIGHT, editor_prefs.autocompletion_max_height, 0);
 }
 
 

Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/src/keybindings.c	2007-08-23 11:34:06 UTC (rev 1815)
@@ -579,10 +579,10 @@
 
 		prefs_show_dialog();
 		// select the KB page
-		wid = lookup_widget(app->prefs_dialog, "frame22");
+		wid = lookup_widget(ui_widgets.prefs_dialog, "frame22");
 		if (wid != NULL)
 		{
-			GtkNotebook *nb = GTK_NOTEBOOK(lookup_widget(app->prefs_dialog, "notebook2"));
+			GtkNotebook *nb = GTK_NOTEBOOK(lookup_widget(ui_widgets.prefs_dialog, "notebook2"));
 
 			if (nb != NULL)
 				gtk_notebook_set_current_page(nb, gtk_notebook_page_num(nb, wid));
@@ -605,7 +605,7 @@
 		if (event->keyval == GDK_0)
 			page = npages - 1;
 		// invert the order if tabs are added on the other side
-		if (swap_alt_tab_order && ! app->tab_order_ltr)
+		if (swap_alt_tab_order && ! prefs.tab_order_ltr)
 			page = (npages - 1) - page;
 
 		gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), page);
@@ -973,7 +973,7 @@
 
 static void cb_func_switch_search_bar(G_GNUC_UNUSED guint key_id)
 {
-	if (app->toolbar_visible && app->pref_toolbar_show_search)
+	if (prefs.toolbar_visible && prefs.toolbar_show_search)
 		gtk_widget_grab_focus(lookup_widget(app->window, "entry1"));
 }
 
@@ -1028,7 +1028,7 @@
 	if (! DOC_IDX_VALID(idx)) return;
 
 	pos = sci_get_current_position(doc_list[idx].sci);
-	if (! utils_isbrace(sci_get_char_at(doc_list[idx].sci, pos)))
+	if (! utils_isbrace(sci_get_char_at(doc_list[idx].sci, pos), TRUE))
 		pos--; // set pos to the brace
 
 	new_pos = sci_find_bracematch(doc_list[idx].sci, pos);
@@ -1187,16 +1187,16 @@
 			on_to_upper_case1_activate(NULL, NULL);
 			break;
 		case GEANY_KEYS_EDIT_SENDTOCMD1:
-			if (app->custom_commands && g_strv_length(app->custom_commands) > 0)
-				tools_execute_custom_command(idx, app->custom_commands[0]);
+			if (ui_prefs.custom_commands && g_strv_length(ui_prefs.custom_commands) > 0)
+				tools_execute_custom_command(idx, ui_prefs.custom_commands[0]);
 			break;
 		case GEANY_KEYS_EDIT_SENDTOCMD2:
-			if (app->custom_commands && g_strv_length(app->custom_commands) > 1)
-				tools_execute_custom_command(idx, app->custom_commands[1]);
+			if (ui_prefs.custom_commands && g_strv_length(ui_prefs.custom_commands) > 1)
+				tools_execute_custom_command(idx, ui_prefs.custom_commands[1]);
 			break;
 		case GEANY_KEYS_EDIT_SENDTOCMD3:
-			if (app->custom_commands && g_strv_length(app->custom_commands) > 2)
-				tools_execute_custom_command(idx, app->custom_commands[2]);
+			if (ui_prefs.custom_commands && g_strv_length(ui_prefs.custom_commands) > 2)
+				tools_execute_custom_command(idx, ui_prefs.custom_commands[2]);
 			break;
 	}
 }

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/src/keyfile.c	2007-08-23 11:34:06 UTC (rev 1815)
@@ -38,6 +38,7 @@
 
 #include "support.h"
 #include "keyfile.h"
+#include "prefs.h"
 #include "ui_utils.h"
 #include "utils.h"
 #include "document.h"
@@ -60,16 +61,16 @@
 
 static void save_recent_files(GKeyFile *config)
 {
-	gchar **recent_files = g_new0(gchar*, app->mru_length + 1);
+	gchar **recent_files = g_new0(gchar*, prefs.mru_length + 1);
 	guint i;
 
-	for (i = 0; i < app->mru_length; i++)
+	for (i = 0; i < prefs.mru_length; i++)
 	{
-		if (! g_queue_is_empty(app->recent_queue))
+		if (! g_queue_is_empty(ui_prefs.recent_queue))
 		{
 			// copy the values, this is necessary when this function is called from the
 			// preferences dialog or when quitting is canceled to keep the queue intact
-			recent_files[i] = g_strdup(g_queue_peek_nth(app->recent_queue, i));
+			recent_files[i] = g_strdup(g_queue_peek_nth(ui_prefs.recent_queue, i));
 		}
 		else
 		{
@@ -78,9 +79,9 @@
 		}
 	}
 	// There is a bug in GTK2.6 g_key_file_set_string_list, we must NULL terminate.
-	recent_files[app->mru_length] = NULL;
+	recent_files[prefs.mru_length] = NULL;
 	g_key_file_set_string_list(config, "files", "recent_files",
-				(const gchar**)recent_files, app->mru_length);
+				(const gchar**)recent_files, prefs.mru_length);
 	g_strfreev(recent_files);
 }
 
@@ -154,7 +155,7 @@
 	scribble_text = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
 
 	// store basic settings
-	if (app->pref_main_save_winpos)
+	if (prefs.save_winpos)
 	{
 		g_key_file_set_integer(config, PACKAGE, "treeview_position",
 				gtk_paned_get_position(GTK_PANED(lookup_widget(app->window, "hpaned1"))));
@@ -162,38 +163,38 @@
 				gtk_paned_get_position(GTK_PANED(lookup_widget(app->window, "vpaned1"))));
 	}
 
-	g_key_file_set_integer(config, PACKAGE, "mru_length", app->mru_length);
-	g_key_file_set_integer(config, PACKAGE, "long_line_type", app->long_line_type);
-	g_key_file_set_integer(config, PACKAGE, "tab_pos_editor", app->tab_pos_editor);
-	g_key_file_set_integer(config, PACKAGE, "tab_pos_msgwin", app->tab_pos_msgwin);
-	g_key_file_set_integer(config, PACKAGE, "tab_pos_sidebar", app->tab_pos_sidebar);
-	g_key_file_set_integer(config, PACKAGE, "autocompletion_max_height", app->autocompletion_max_height);
-	g_key_file_set_integer(config, PACKAGE, "long_line_column", app->long_line_column);
-	g_key_file_set_string(config, PACKAGE, "long_line_color", app->long_line_color);
-	g_key_file_set_boolean(config, PACKAGE, "beep_on_errors", app->beep_on_errors);
-	g_key_file_set_boolean(config, PACKAGE, "sidebar_symbol_visible", app->sidebar_symbol_visible);
-	g_key_file_set_boolean(config, PACKAGE, "sidebar_openfiles_visible", app->sidebar_openfiles_visible);
-	g_key_file_set_boolean(config, PACKAGE, "sidebar_visible", app->sidebar_visible);
-	g_key_file_set_boolean(config, PACKAGE, "statusbar_visible", app->statusbar_visible);
-	g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", app->msgwindow_visible);
+	g_key_file_set_integer(config, PACKAGE, "mru_length", prefs.mru_length);
+	g_key_file_set_integer(config, PACKAGE, "long_line_type", editor_prefs.long_line_type);
+	g_key_file_set_integer(config, PACKAGE, "tab_pos_editor", prefs.tab_pos_editor);
+	g_key_file_set_integer(config, PACKAGE, "tab_pos_msgwin", prefs.tab_pos_msgwin);
+	g_key_file_set_integer(config, PACKAGE, "tab_pos_sidebar", prefs.tab_pos_sidebar);
+	g_key_file_set_integer(config, PACKAGE, "autocompletion_max_height", editor_prefs.autocompletion_max_height);
+	g_key_file_set_integer(config, PACKAGE, "long_line_column", editor_prefs.long_line_column);
+	g_key_file_set_string(config, PACKAGE, "long_line_color", editor_prefs.long_line_color);
+	g_key_file_set_boolean(config, PACKAGE, "beep_on_errors", prefs.beep_on_errors);
+	g_key_file_set_boolean(config, PACKAGE, "sidebar_symbol_visible", prefs.sidebar_symbol_visible);
+	g_key_file_set_boolean(config, PACKAGE, "sidebar_openfiles_visible", prefs.sidebar_openfiles_visible);
+	g_key_file_set_boolean(config, PACKAGE, "sidebar_visible", ui_prefs.sidebar_visible);
+	g_key_file_set_boolean(config, PACKAGE, "statusbar_visible", prefs.statusbar_visible);
+	g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", ui_prefs.msgwindow_visible);
 	g_key_file_set_boolean(config, PACKAGE, "use_folding", editor_prefs.folding);
 	g_key_file_set_boolean(config, PACKAGE, "unfold_all_children", editor_prefs.unfold_all_children);
 	g_key_file_set_boolean(config, PACKAGE, "show_editor_scrollbars", editor_prefs.show_scrollbars);
 	g_key_file_set_integer(config, PACKAGE, "indent_mode", editor_prefs.indent_mode);
-	g_key_file_set_boolean(config, PACKAGE, "use_tab_to_indent", app->use_tab_to_indent);
+	g_key_file_set_boolean(config, PACKAGE, "use_tab_to_indent", editor_prefs.use_tab_to_indent);
 	g_key_file_set_boolean(config, PACKAGE, "use_indicators", editor_prefs.use_indicators);
 	g_key_file_set_boolean(config, PACKAGE, "show_indent_guide", editor_prefs.show_indent_guide);
 	g_key_file_set_boolean(config, PACKAGE, "show_white_space", editor_prefs.show_white_space);
-	g_key_file_set_boolean(config, PACKAGE, "show_markers_margin", app->show_markers_margin);
-	g_key_file_set_boolean(config, PACKAGE, "show_linenumber_margin", app->show_linenumber_margin);
+	g_key_file_set_boolean(config, PACKAGE, "show_markers_margin", editor_prefs.show_markers_margin);
+	g_key_file_set_boolean(config, PACKAGE, "show_linenumber_margin", editor_prefs.show_linenumber_margin);
 	g_key_file_set_boolean(config, PACKAGE, "line_breaking", editor_prefs.line_breaking);
 	g_key_file_set_boolean(config, PACKAGE, "show_line_endings", editor_prefs.show_line_endings);
-	g_key_file_set_boolean(config, PACKAGE, "fullscreen", app->fullscreen);
-	g_key_file_set_boolean(config, PACKAGE, "tab_order_ltr", app->tab_order_ltr);
-	g_key_file_set_boolean(config, PACKAGE, "show_notebook_tabs", app->show_notebook_tabs);
-	g_key_file_set_boolean(config, PACKAGE, "brace_match_ltgt", app->brace_match_ltgt);
-	g_key_file_set_boolean(config, PACKAGE, "switch_msgwin_pages", app->switch_msgwin_pages);
-	g_key_file_set_boolean(config, PACKAGE, "auto_focus", app->auto_focus);
+	g_key_file_set_boolean(config, PACKAGE, "fullscreen", ui_prefs.fullscreen);
+	g_key_file_set_boolean(config, PACKAGE, "tab_order_ltr", prefs.tab_order_ltr);
+	g_key_file_set_boolean(config, PACKAGE, "show_notebook_tabs", prefs.show_notebook_tabs);
+	g_key_file_set_boolean(config, PACKAGE, "brace_match_ltgt", editor_prefs.brace_match_ltgt);
+	g_key_file_set_boolean(config, PACKAGE, "switch_msgwin_pages", prefs.switch_msgwin_pages);
+	g_key_file_set_boolean(config, PACKAGE, "auto_focus", prefs.auto_focus);
 	g_key_file_set_boolean(config, PACKAGE, "auto_close_xml_tags", editor_prefs.auto_close_xml_tags);
 	g_key_file_set_boolean(config, PACKAGE, "auto_complete_constructs", editor_prefs.auto_complete_constructs);
 	g_key_file_set_boolean(config, PACKAGE, "auto_complete_symbols", editor_prefs.auto_complete_symbols);
@@ -223,49 +224,49 @@
 		g_key_file_set_string(config, "VTE", "last_dir", vte_info.dir);
 	}
 #endif
-	g_key_file_set_string(config, PACKAGE, "default_open_path", app->default_open_path);
-	g_key_file_set_string(config, PACKAGE, "custom_date_format", app->custom_date_format);
-	g_key_file_set_string(config, PACKAGE, "context_action_cmd", app->context_action_cmd);
-	if (app->custom_commands != NULL)
+	g_key_file_set_string(config, PACKAGE, "default_open_path", prefs.default_open_path);
+	g_key_file_set_string(config, PACKAGE, "custom_date_format", ui_prefs.custom_date_format);
+	g_key_file_set_string(config, PACKAGE, "context_action_cmd", prefs.context_action_cmd);
+	if (ui_prefs.custom_commands != NULL)
 	{
 		g_key_file_set_string_list(config, PACKAGE, "custom_commands",
-				(const gchar**) app->custom_commands, g_strv_length(app->custom_commands));
+				(const gchar**) ui_prefs.custom_commands, g_strv_length(ui_prefs.custom_commands));
 	}
 
-	g_key_file_set_string(config, PACKAGE, "editor_font", app->editor_font);
-	g_key_file_set_string(config, PACKAGE, "tagbar_font", app->tagbar_font);
-	g_key_file_set_string(config, PACKAGE, "msgwin_font", app->msgwin_font);
+	g_key_file_set_string(config, PACKAGE, "editor_font", prefs.editor_font);
+	g_key_file_set_string(config, PACKAGE, "tagbar_font", prefs.tagbar_font);
+	g_key_file_set_string(config, PACKAGE, "msgwin_font", prefs.msgwin_font);
 	g_key_file_set_string(config, PACKAGE, "scribble_text", scribble_text);
-	if (app->pref_main_save_winpos && ! app->fullscreen)
+	if (prefs.save_winpos && ! ui_prefs.fullscreen)
 	{
-		gtk_window_get_position(GTK_WINDOW(app->window), &app->geometry[0], &app->geometry[1]);
-		gtk_window_get_size(GTK_WINDOW(app->window), &app->geometry[2], &app->geometry[3]);
+		gtk_window_get_position(GTK_WINDOW(app->window), &ui_prefs.geometry[0], &ui_prefs.geometry[1]);
+		gtk_window_get_size(GTK_WINDOW(app->window), &ui_prefs.geometry[2], &ui_prefs.geometry[3]);
 		if (gdk_window_get_state(app->window->window) & GDK_WINDOW_STATE_MAXIMIZED)
-			app->geometry[4] = 1;
+			ui_prefs.geometry[4] = 1;
 		else
-			app->geometry[4] = 0;
+			ui_prefs.geometry[4] = 0;
 
-		g_key_file_set_integer_list(config, PACKAGE, "geometry", app->geometry, 5);
+		g_key_file_set_integer_list(config, PACKAGE, "geometry", ui_prefs.geometry, 5);
 	}
 	g_key_file_set_integer(config, PACKAGE, "pref_editor_tab_width", editor_prefs.tab_width);
 	g_key_file_set_boolean(config, PACKAGE, "pref_editor_use_tabs", editor_prefs.use_tabs);
-	g_key_file_set_boolean(config, PACKAGE, "pref_main_confirm_exit", app->pref_main_confirm_exit);
-	g_key_file_set_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", app->pref_main_suppress_search_dialogs);
-	g_key_file_set_boolean(config, PACKAGE, "pref_main_suppress_status_messages", app->pref_main_suppress_status_messages);
-	g_key_file_set_boolean(config, PACKAGE, "pref_main_load_session", app->pref_main_load_session);
-	g_key_file_set_boolean(config, PACKAGE, "pref_main_save_winpos", app->pref_main_save_winpos);
-	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show", app->toolbar_visible);
-	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_search", app->pref_toolbar_show_search);
-	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_goto", app->pref_toolbar_show_goto);
-	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_zoom", app->pref_toolbar_show_zoom);
-	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_undo", app->pref_toolbar_show_undo);
-	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_navigation", app->pref_toolbar_show_navigation);
-	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_compile", app->pref_toolbar_show_compile);
-	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_colour", app->pref_toolbar_show_colour);
-	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_fileops", app->pref_toolbar_show_fileops);
-	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_quit", app->pref_toolbar_show_quit);
-	g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_style", app->toolbar_icon_style);
-	g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_size", app->toolbar_icon_size);
+	g_key_file_set_boolean(config, PACKAGE, "pref_main_confirm_exit", prefs.confirm_exit);
+	g_key_file_set_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", prefs.suppress_search_dialogs);
+	g_key_file_set_boolean(config, PACKAGE, "pref_main_suppress_status_messages", prefs.suppress_status_messages);
+	g_key_file_set_boolean(config, PACKAGE, "pref_main_load_session", prefs.load_session);
+	g_key_file_set_boolean(config, PACKAGE, "pref_main_save_winpos", prefs.save_winpos);
+	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show", prefs.toolbar_visible);
+	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_search", prefs.toolbar_show_search);
+	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_goto", prefs.toolbar_show_goto);
+	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_zoom", prefs.toolbar_show_zoom);
+	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_undo", prefs.toolbar_show_undo);
+	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_navigation", prefs.toolbar_show_navigation);
+	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_compile", prefs.toolbar_show_compile);
+	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_colour", prefs.toolbar_show_colour);
+	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_fileops", prefs.toolbar_show_fileops);
+	g_key_file_set_boolean(config, PACKAGE, "pref_toolbar_show_quit", prefs.toolbar_show_quit);
+	g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_style", prefs.toolbar_icon_style);
+	g_key_file_set_integer(config, PACKAGE, "pref_toolbar_icon_size", prefs.toolbar_icon_size);
 	g_key_file_set_boolean(config, PACKAGE, "pref_editor_new_line", editor_prefs.new_line);
 	g_key_file_set_boolean(config, PACKAGE, "pref_editor_replace_tabs", editor_prefs.replace_tabs);
 	g_key_file_set_boolean(config, PACKAGE, "pref_editor_trail_space", editor_prefs.trail_space);
@@ -276,24 +277,24 @@
 		g_key_file_set_string(config, PACKAGE, "pref_editor_default_open_encoding", "none");
 	else
 		g_key_file_set_string(config, PACKAGE, "pref_editor_default_open_encoding", encodings[editor_prefs.default_open_encoding].charset);
-	g_key_file_set_string(config, PACKAGE, "pref_template_developer", app->pref_template_developer);
-	g_key_file_set_string(config, PACKAGE, "pref_template_company", app->pref_template_company);
-	g_key_file_set_string(config, PACKAGE, "pref_template_mail", app->pref_template_mail);
-	g_key_file_set_string(config, PACKAGE, "pref_template_initial", app->pref_template_initial);
-	g_key_file_set_string(config, PACKAGE, "pref_template_version", app->pref_template_version);
+	g_key_file_set_string(config, PACKAGE, "pref_template_developer", prefs.template_developer);
+	g_key_file_set_string(config, PACKAGE, "pref_template_company", prefs.template_company);
+	g_key_file_set_string(config, PACKAGE, "pref_template_mail", prefs.template_mail);
+	g_key_file_set_string(config, PACKAGE, "pref_template_initial", prefs.template_initial);
+	g_key_file_set_string(config, PACKAGE, "pref_template_version", prefs.template_version);
 
 	// store tools settings
-	g_key_file_set_string(config, "tools", "make_cmd", app->tools_make_cmd ? app->tools_make_cmd : "");
-	g_key_file_set_string(config, "tools", "term_cmd", app->tools_term_cmd ? app->tools_term_cmd : "");
-	g_key_file_set_string(config, "tools", "browser_cmd", app->tools_browser_cmd ? app->tools_browser_cmd : "");
-	g_key_file_set_string(config, "tools", "print_cmd", app->tools_print_cmd ? app->tools_print_cmd : "");
-	g_key_file_set_string(config, "tools", "grep_cmd", app->tools_grep_cmd ? app->tools_grep_cmd : "");
+	g_key_file_set_string(config, "tools", "make_cmd", prefs.tools_make_cmd ? prefs.tools_make_cmd : "");
+	g_key_file_set_string(config, "tools", "term_cmd", prefs.tools_term_cmd ? prefs.tools_term_cmd : "");
+	g_key_file_set_string(config, "tools", "browser_cmd", prefs.tools_browser_cmd ? prefs.tools_browser_cmd : "");
+	g_key_file_set_string(config, "tools", "print_cmd", prefs.tools_print_cmd ? prefs.tools_print_cmd : "");
+	g_key_file_set_string(config, "tools", "grep_cmd", prefs.tools_grep_cmd ? prefs.tools_grep_cmd : "");
 
 	// search
 	g_key_file_set_string(config, "search", "fif_extra_options", search_prefs.fif_extra_options ? search_prefs.fif_extra_options : "");
 
 	// startup
-	g_key_file_set_boolean(config, "startup", "load_plugins", main_prefs.load_plugins);
+	g_key_file_set_boolean(config, "startup", "load_plugins", prefs.load_plugins);
 
 	project_save_prefs(config);	// save project filename, etc.
 	save_recent_files(config);
@@ -323,10 +324,10 @@
 	recent_files = g_key_file_get_string_list(config, "files", "recent_files", &len, NULL);
 	if (recent_files != NULL)
 	{
-		for (i = 0; (i < len) && (i < app->mru_length); i++)
+		for (i = 0; (i < len) && (i < prefs.mru_length); i++)
 		{
 			gchar *filename = g_strdup(recent_files[i]);
-			g_queue_push_tail(app->recent_queue, filename);
+			g_queue_push_tail(ui_prefs.recent_queue, filename);
 		}
 	}
 	g_strfreev(recent_files);
@@ -377,32 +378,32 @@
 
 	g_key_file_load_from_file(config, configfile, G_KEY_FILE_NONE, NULL);
 
-	app->toolbar_visible = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show", TRUE);
+	prefs.toolbar_visible = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show", TRUE);
 	{
 		GtkIconSize tb_iconsize;
 		GtkToolbarStyle tb_style;
 		GEANY_GET_SETTING("gtk-toolbar-style", tb_style, GTK_TOOLBAR_ICONS);
 		GEANY_GET_SETTING("gtk-toolbar-icon-size", tb_iconsize, GTK_ICON_SIZE_LARGE_TOOLBAR);
-		app->toolbar_icon_style = utils_get_setting_integer(config, PACKAGE, "pref_toolbar_icon_style", tb_style);
-		app->toolbar_icon_size = utils_get_setting_integer(config, PACKAGE, "pref_toolbar_icon_size", tb_iconsize);
+		prefs.toolbar_icon_style = utils_get_setting_integer(config, PACKAGE, "pref_toolbar_icon_style", tb_style);
+		prefs.toolbar_icon_size = utils_get_setting_integer(config, PACKAGE, "pref_toolbar_icon_size", tb_iconsize);
 	}
-	app->beep_on_errors = utils_get_setting_boolean(config, PACKAGE, "beep_on_errors", TRUE);
-	app->mru_length = utils_get_setting_integer(config, PACKAGE, "mru_length", GEANY_DEFAULT_MRU_LENGTH);
-	app->long_line_type = utils_get_setting_integer(config, PACKAGE, "long_line_type", 0);
-	app->long_line_color = utils_get_setting_string(config, PACKAGE, "long_line_color", "#C2EBC2");
-	app->long_line_column = utils_get_setting_integer(config, PACKAGE, "long_line_column", 72);
-	app->autocompletion_max_height = utils_get_setting_integer(config, PACKAGE, "autocompletion_max_height", GEANY_MAX_AUTOCOMPLETE_HEIGHT);
-	app->tab_pos_editor = utils_get_setting_integer(config, PACKAGE, "tab_pos_editor", GTK_POS_TOP);
-	app->tab_pos_msgwin = utils_get_setting_integer(config, PACKAGE, "tab_pos_msgwin",GTK_POS_LEFT);
-	app->tab_pos_sidebar = utils_get_setting_integer(config, PACKAGE, "tab_pos_sidebar", GTK_POS_TOP);
-	app->sidebar_symbol_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_symbol_visible", TRUE);
-	app->sidebar_openfiles_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_openfiles_visible", TRUE);
-	app->sidebar_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_visible", TRUE);
-	app->statusbar_visible = utils_get_setting_boolean(config, PACKAGE, "statusbar_visible", TRUE);
-	app->msgwindow_visible = utils_get_setting_boolean(config, PACKAGE, "msgwindow_visible", TRUE);
+	prefs.beep_on_errors = utils_get_setting_boolean(config, PACKAGE, "beep_on_errors", TRUE);
+	prefs.mru_length = utils_get_setting_integer(config, PACKAGE, "mru_length", GEANY_DEFAULT_MRU_LENGTH);
+	editor_prefs.long_line_type = utils_get_setting_integer(config, PACKAGE, "long_line_type", 0);
+	editor_prefs.long_line_color = utils_get_setting_string(config, PACKAGE, "long_line_color", "#C2EBC2");
+	editor_prefs.long_line_column = utils_get_setting_integer(config, PACKAGE, "long_line_column", 72);
+	editor_prefs.autocompletion_max_height = utils_get_setting_integer(config, PACKAGE, "autocompletion_max_height", GEANY_MAX_AUTOCOMPLETE_HEIGHT);
+	prefs.tab_pos_editor = utils_get_setting_integer(config, PACKAGE, "tab_pos_editor", GTK_POS_TOP);
+	prefs.tab_pos_msgwin = utils_get_setting_integer(config, PACKAGE, "tab_pos_msgwin",GTK_POS_LEFT);
+	prefs.tab_pos_sidebar = utils_get_setting_integer(config, PACKAGE, "tab_pos_sidebar", GTK_POS_TOP);
+	prefs.sidebar_symbol_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_symbol_visible", TRUE);
+	prefs.sidebar_openfiles_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_openfiles_visible", TRUE);
+	ui_prefs.sidebar_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_visible", TRUE);
+	prefs.statusbar_visible = utils_get_setting_boolean(config, PACKAGE, "statusbar_visible", TRUE);
+	ui_prefs.msgwindow_visible = utils_get_setting_boolean(config, PACKAGE, "msgwindow_visible", TRUE);
 	editor_prefs.line_breaking = utils_get_setting_boolean(config, PACKAGE, "line_breaking", FALSE); //default is off for better performance
 	editor_prefs.indent_mode = utils_get_setting_integer(config, PACKAGE, "indent_mode", INDENT_ADVANCED);
-	app->use_tab_to_indent = utils_get_setting_boolean(config, PACKAGE, "use_tab_to_indent", FALSE);
+	editor_prefs.use_tab_to_indent = utils_get_setting_boolean(config, PACKAGE, "use_tab_to_indent", FALSE);
 	editor_prefs.use_indicators = utils_get_setting_boolean(config, PACKAGE, "use_indicators", TRUE);
 	editor_prefs.show_indent_guide = utils_get_setting_boolean(config, PACKAGE, "show_indent_guide", FALSE);
 	editor_prefs.show_white_space = utils_get_setting_boolean(config, PACKAGE, "show_white_space", FALSE);
@@ -413,38 +414,38 @@
 	editor_prefs.folding = utils_get_setting_boolean(config, PACKAGE, "use_folding", TRUE);
 	editor_prefs.unfold_all_children = utils_get_setting_boolean(config, PACKAGE, "unfold_all_children", FALSE);
 	editor_prefs.show_scrollbars = utils_get_setting_boolean(config, PACKAGE, "show_editor_scrollbars", TRUE);
-	app->show_markers_margin = utils_get_setting_boolean(config, PACKAGE, "show_markers_margin", TRUE);
-	app->show_linenumber_margin = utils_get_setting_boolean(config, PACKAGE, "show_linenumber_margin", TRUE);
-	app->fullscreen = utils_get_setting_boolean(config, PACKAGE, "fullscreen", FALSE);
-	app->tab_order_ltr = utils_get_setting_boolean(config, PACKAGE, "tab_order_ltr", TRUE);
-	app->show_notebook_tabs = utils_get_setting_boolean(config, PACKAGE, "show_notebook_tabs", TRUE);
-	app->brace_match_ltgt = utils_get_setting_boolean(config, PACKAGE, "brace_match_ltgt", FALSE);
-	app->switch_msgwin_pages = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", FALSE);
-	app->auto_focus = utils_get_setting_boolean(config, PACKAGE, "auto_focus", FALSE);
-	app->custom_date_format = utils_get_setting_string(config, PACKAGE, "custom_date_format", "");
-	app->context_action_cmd = utils_get_setting_string(config, PACKAGE, "context_action_cmd", "");
-	app->default_open_path = utils_get_setting_string(config, PACKAGE, "default_open_path", "");
-	app->custom_commands = g_key_file_get_string_list(config, PACKAGE, "custom_commands", NULL, NULL);
-	app->editor_font = utils_get_setting_string(config, PACKAGE, "editor_font", GEANY_DEFAULT_FONT_EDITOR);
-	app->tagbar_font = utils_get_setting_string(config, PACKAGE, "tagbar_font", GEANY_DEFAULT_FONT_SYMBOL_LIST);
-	app->msgwin_font = utils_get_setting_string(config, PACKAGE, "msgwin_font", GEANY_DEFAULT_FONT_MSG_WINDOW);
+	editor_prefs.show_markers_margin = utils_get_setting_boolean(config, PACKAGE, "show_markers_margin", TRUE);
+	editor_prefs.show_linenumber_margin = utils_get_setting_boolean(config, PACKAGE, "show_linenumber_margin", TRUE);
+	ui_prefs.fullscreen = utils_get_setting_boolean(config, PACKAGE, "fullscreen", FALSE);
+	prefs.tab_order_ltr = utils_get_setting_boolean(config, PACKAGE, "tab_order_ltr", TRUE);
+	prefs.show_notebook_tabs = utils_get_setting_boolean(config, PACKAGE, "show_notebook_tabs", TRUE);
+	editor_prefs.brace_match_ltgt = utils_get_setting_boolean(config, PACKAGE, "brace_match_ltgt", FALSE);
+	prefs.switch_msgwin_pages = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", FALSE);
+	prefs.auto_focus = utils_get_setting_boolean(config, PACKAGE, "auto_focus", FALSE);
+	ui_prefs.custom_date_format = utils_get_setting_string(config, PACKAGE, "custom_date_format", "");
+	prefs.context_action_cmd = utils_get_setting_string(config, PACKAGE, "context_action_cmd", "");
+	prefs.default_open_path = utils_get_setting_string(config, PACKAGE, "default_open_path", "");
+	ui_prefs.custom_commands = g_key_file_get_string_list(config, PACKAGE, "custom_commands", NULL, NULL);
+	prefs.editor_font = utils_get_setting_string(config, PACKAGE, "editor_font", GEANY_DEFAULT_FONT_EDITOR);
+	prefs.tagbar_font = utils_get_setting_string(config, PACKAGE, "tagbar_font", GEANY_DEFAULT_FONT_SYMBOL_LIST);
+	prefs.msgwin_font = utils_get_setting_string(config, PACKAGE, "msgwin_font", GEANY_DEFAULT_FONT_MSG_WINDOW);
 	scribble_text = utils_get_setting_string(config, PACKAGE, "scribble_text",
 				_("Type here what you want, use it as a notice/scratch board"));
 
 	geo = g_key_file_get_integer_list(config, PACKAGE, "geometry", NULL, &error);
 	if (error)
 	{
-		app->geometry[0] = -1;
+		ui_prefs.geometry[0] = -1;
 		g_error_free(error);
 		error = NULL;
 	}
 	else
 	{
-		app->geometry[0] = geo[0];
-		app->geometry[1] = geo[1];
-		app->geometry[2] = geo[2];
-		app->geometry[3] = geo[3];
-		app->geometry[4] = geo[4];
+		ui_prefs.geometry[0] = geo[0];
+		ui_prefs.geometry[1] = geo[1];
+		ui_prefs.geometry[2] = geo[2];
+		ui_prefs.geometry[3] = geo[3];
+		ui_prefs.geometry[4] = geo[4];
 	}
 	hpan_position = utils_get_setting_integer(config, PACKAGE, "treeview_position", 156);
 	vpan_position = utils_get_setting_integer(config, PACKAGE, "msgwindow_position", (geo) ?
@@ -479,20 +480,20 @@
 
 		g_free(tmp_string);
 	}
-	app->pref_main_confirm_exit = utils_get_setting_boolean(config, PACKAGE, "pref_main_confirm_exit", FALSE);
-	app->pref_main_suppress_search_dialogs = utils_get_setting_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", FALSE);
-	app->pref_main_suppress_status_messages = utils_get_setting_boolean(config, PACKAGE, "pref_main_suppress_status_messages", FALSE);
-	app->pref_main_load_session = utils_get_setting_boolean(config, PACKAGE, "pref_main_load_session", TRUE);
-	app->pref_main_save_winpos = utils_get_setting_boolean(config, PACKAGE, "pref_main_save_winpos", TRUE);
-	app->pref_toolbar_show_search = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_search", TRUE);
-	app->pref_toolbar_show_goto = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_goto", TRUE);
-	app->pref_toolbar_show_zoom = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_zoom", FALSE);
-	app->pref_toolbar_show_compile = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_compile", TRUE);
-	app->pref_toolbar_show_undo = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_undo", FALSE);
-	app->pref_toolbar_show_navigation = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_navigation", TRUE);
-	app->pref_toolbar_show_colour = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_colour", TRUE);
-	app->pref_toolbar_show_fileops = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_fileops", TRUE);
-	app->pref_toolbar_show_quit = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_quit", TRUE);
+	prefs.confirm_exit = utils_get_setting_boolean(config, PACKAGE, "pref_main_confirm_exit", FALSE);
+	prefs.suppress_search_dialogs = utils_get_setting_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", FALSE);
+	prefs.suppress_status_messages = utils_get_setting_boolean(config, PACKAGE, "pref_main_suppress_status_messages", FALSE);
+	prefs.load_session = utils_get_setting_boolean(config, PACKAGE, "pref_main_load_session", TRUE);
+	prefs.save_winpos = utils_get_setting_boolean(config, PACKAGE, "pref_main_save_winpos", TRUE);
+	prefs.toolbar_show_search = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_search", TRUE);
+	prefs.toolbar_show_goto = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_goto", TRUE);
+	prefs.toolbar_show_zoom = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_zoom", FALSE);
+	prefs.toolbar_show_compile = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_compile", TRUE);
+	prefs.toolbar_show_undo = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_undo", FALSE);
+	prefs.toolbar_show_navigation = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_navigation", TRUE);
+	prefs.toolbar_show_colour = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_colour", TRUE);
+	prefs.toolbar_show_fileops = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_fileops", TRUE);
+	prefs.toolbar_show_quit = utils_get_setting_boolean(config, PACKAGE, "pref_toolbar_show_quit", TRUE);
 #ifdef HAVE_VTE
 	vte_info.load_vte = utils_get_setting_boolean(config, "VTE", "load_vte", TRUE);
 	if (vte_info.load_vte)
@@ -528,17 +529,17 @@
 		g_free(tmp_string);
 	}
 #endif
-	app->pref_template_developer = utils_get_setting_string(config, PACKAGE, "pref_template_developer", g_get_real_name());
-	app->pref_template_company = utils_get_setting_string(config, PACKAGE, "pref_template_company", "");
-	tmp_string = utils_get_initials(app->pref_template_developer);
-	app->pref_template_initial = utils_get_setting_string(config, PACKAGE, "pref_template_initial", tmp_string);
+	prefs.template_developer = utils_get_setting_string(config, PACKAGE, "pref_template_developer", g_get_real_name());
+	prefs.template_company = utils_get_setting_string(config, PACKAGE, "pref_template_company", "");
+	tmp_string = utils_get_initials(prefs.template_developer);
+	prefs.template_initial = utils_get_setting_string(config, PACKAGE, "pref_template_initial", tmp_string);
 	g_free(tmp_string);
 
-	app->pref_template_version = utils_get_setting_string(config, PACKAGE, "pref_template_version", "1.0");
+	prefs.template_version = utils_get_setting_string(config, PACKAGE, "pref_template_version", "1.0");
 
 	tmp_string2 = utils_get_hostname();
 	tmp_string = g_strdup_printf("%s@%s", g_get_user_name(), tmp_string2);
-	app->pref_template_mail = utils_get_setting_string(config, PACKAGE, "pref_template_mail", tmp_string);
+	prefs.template_mail = utils_get_setting_string(config, PACKAGE, "pref_template_mail", tmp_string);
 	g_free(tmp_string);
 	g_free(tmp_string2);
 
@@ -549,15 +550,15 @@
 	editor_prefs.smart_home_key = utils_get_setting_boolean(config, PACKAGE, "pref_editor_smart_home_key", TRUE);
 
 	tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_MAKE);
-	app->tools_make_cmd = utils_get_setting_string(config, "tools", "make_cmd", tmp_string);
+	prefs.tools_make_cmd = utils_get_setting_string(config, "tools", "make_cmd", tmp_string);
 	g_free(tmp_string);
 
 	tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_TERMINAL);
-	app->tools_term_cmd = utils_get_setting_string(config, "tools", "term_cmd", tmp_string);
+	prefs.tools_term_cmd = utils_get_setting_string(config, "tools", "term_cmd", tmp_string);
 	g_free(tmp_string);
 
 	tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_BROWSER);
-	app->tools_browser_cmd = utils_get_setting_string(config, "tools", "browser_cmd", tmp_string);
+	prefs.tools_browser_cmd = utils_get_setting_string(config, "tools", "browser_cmd", tmp_string);
 	g_free(tmp_string);
 
 	tmp_string2 = g_find_program_in_path(GEANY_DEFAULT_TOOLS_PRINTCMD);
@@ -567,19 +568,19 @@
 #else
 	tmp_string = g_strconcat(tmp_string2, " %f", NULL);
 #endif
-	app->tools_print_cmd = utils_get_setting_string(config, "tools", "print_cmd", tmp_string);
+	prefs.tools_print_cmd = utils_get_setting_string(config, "tools", "print_cmd", tmp_string);
 	g_free(tmp_string);
 	g_free(tmp_string2);
 
 	tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_GREP);
-	app->tools_grep_cmd = utils_get_setting_string(config, "tools", "grep_cmd", tmp_string);
+	prefs.tools_grep_cmd = utils_get_setting_string(config, "tools", "grep_cmd", tmp_string);
 	g_free(tmp_string);
 
 	// search
 	search_prefs.fif_extra_options = utils_get_setting_string(config, "search", "fif_extra_options", "");
 
 	// startup
-	main_prefs.load_plugins = utils_get_setting_boolean(config, "startup", "load_plugins", TRUE);
+	prefs.load_plugins = utils_get_setting_boolean(config, "startup", "load_plugins", TRUE);
 
 	project_load_prefs(config);
 	load_file_lists(config);
@@ -599,7 +600,7 @@
 
 	document_delay_colourise();
 
-	i = app->tab_order_ltr ? 0 : (session_files->len - 1);
+	i = prefs.tab_order_ltr ? 0 : (session_files->len - 1);
 	while (TRUE)
 	{
 		gchar *tmp = g_ptr_array_index(session_files, i);
@@ -648,7 +649,7 @@
 		}
 		g_free(tmp);
 
-		if (app->tab_order_ltr)
+		if (prefs.tab_order_ltr)
 		{
 			i++;
 			if (i >= (gint)session_files->len) break;
@@ -681,7 +682,7 @@
 	g_free(scribble_text);
 
 	// set the position of the hpaned and vpaned
-	if (app->pref_main_save_winpos)
+	if (prefs.save_winpos)
 	{
 		gtk_paned_set_position(GTK_PANED(lookup_widget(app->window, "hpaned1")), hpan_position);
 		gtk_paned_set_position(GTK_PANED(lookup_widget(app->window, "vpaned1")), vpan_position);
@@ -689,10 +690,10 @@
 
 	// set fullscreen after initial draw so that returning to normal view is the right size.
 	// fullscreen mode is disabled by default, so act only if it is true
-	if (app->fullscreen)
+	if (ui_prefs.fullscreen)
 	{
 		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_fullscreen1")), TRUE);
-		app->fullscreen = TRUE;
+		ui_prefs.fullscreen = TRUE;
 		ui_set_fullscreen();
 	}
 }

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2007-08-22 18:04:37 UTC (rev 1814)
+++ trunk/src/main.c	2007-08-23 11:34:06 UTC (rev 1815)
@@ -40,6 +40,7 @@
 #endif
 
 #include "main.h"
+#include "prefs.h"
 #include "interface.h"
 #include "support.h"
 #include "callbacks.h"
@@ -80,11 +81,11 @@
 #endif
 
 
-MyApp *app;
+GeanyApp *app;
 
+GeanyStatus	 main_status;
 CommandLineOptions cl_options;	// fields initialised in parse_command_line_options
 
-MainPrefs main_prefs;
 
 static gboolean want_plugins;
 
@@ -155,21 +156,21 @@
 	ui_update_fold_items();
 
 	// toolbar, message window and sidebar are by default visible, so don't change it if it is true
-	if (! app->toolbar_visible)
+	if (! prefs.toolbar_visible)
 	{
 		app->ignore_callback = TRUE;
 		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_toolbar1")), FALSE);
 		gtk_widget_hide(app->toolbar);
 		app->ignore_callback = FALSE;
 	}
-	if (! app->msgwindow_visible)
+	if (! ui_prefs.msgwindow_visible)
 	{
 		app->ignore_callback = TRUE;
 		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_messages_window1")), FALSE);
 		gtk_widget_hide(lookup_widget(app->window, "scrolledwindow1"));
 		app->ignore_callback = FALSE;
 	}
-	if (! app->sidebar_visible)
+	if (! ui_prefs.sidebar_visible)
 	{
 		app->ignore_callback = TRUE;
 		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_show_sidebar1")), FALSE);
@@ -177,60 +178,60 @@
 	}
 	ui_treeviews_show_hide(TRUE);
 	// sets the icon style of the toolbar
-	switch (app->toolbar_icon_style)
+	switch (prefs.toolbar_icon_style)
 	{
 		case GTK_TOOLBAR_BOTH:
 		{
 			//gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "images_and_text1")), TRUE);
-			gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->toolbar_menu, "images_and_text2")), TRUE);
+			gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(ui_widgets.toolbar_menu, "images_and_text2")), TRUE);
 			break;
 		}
 		case GTK_TOOLBAR_ICONS:
 		{
 			//gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "images_only1")), TRUE);
-			gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->toolbar_menu, "images_only2")), TRUE);
+			gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(ui_widgets.toolbar_menu, "images_only2")), TRUE);
 			break;
 		}
 		case GTK_TOOLBAR_TEXT:
 		{
 			//gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "text_only1")), TRUE);
-			gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->toolbar_menu, "text_only2")), TRUE);
+			gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(ui_widgets.toolbar_menu, "text_only2")), TRUE);
 			break;
 		}
 	}
-	gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), app->toolbar_icon_style);
+	gtk_toolbar_set_style(GTK_TOOLBAR(app->toolbar), prefs.toolbar_icon_style);
 
 	// sets the icon size of the toolbar, use user preferences (.gtkrc) if not set
-	if (app->toolbar_icon_size == GTK_ICON_SIZE_SMALL_TOOLBAR ||
-		app->toolbar_icon_size == GTK_ICON_SIZE_LARGE_TOOLBAR)
+	if (prefs.toolbar_icon_size == GTK_ICON_SIZE_SMALL_TOOLBAR ||
+		prefs.toolbar_icon_size == GTK_ICON_SIZE_LARGE_TOOLBAR)
 	{
-		gtk_toolbar_set_icon_size(GTK_TOOLBAR(app->toolbar), app->toolbar_icon_size);
+		gtk_toolbar_set_icon_size(GTK_TOOLBAR(app->toolbar), prefs.toolbar_icon_size);
 	}
-	ui_update_toolbar_icons(app->toolbar_icon_size);
+	ui_update_toolbar_icons(prefs.toolbar_icon_size);
 
 	// line number and markers margin are by default enabled
-	if (! app->show_markers_margin)
+	if (! editor_prefs.show_markers_margin)
 	{
 		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_markers_margin1")), FALSE);
-		app->show_markers_margin = FALSE;
+		editor_prefs.show_markers_margin = FALSE;
 	}
-	if (! app->show_linenumber_margin)
+	if (! editor_prefs.show_linenumber_margin)
 	{
 		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(lookup_widget(app->window, "menu_linenumber_margin1")), FALSE);
-		app->show_linenumber_margin = FALSE;
+		editor_prefs.show_linenumber_margin = FALSE;
 	}
 
 	// interprets the saved window geometry
-	if (app->pref_main_save_winpos && app->geometry[0] != -1)
+	if (prefs.save_winpos && ui_prefs.geometry[0] != -1)
 	{
-		gtk_window_move(GTK_WINDOW(app->window), app->geometry[0], app->geometry[1]);
-		gtk_window_set_default_size(GTK_WINDOW(app->window), app->geometry[2], app->geometry[3]);
-		if (app->geometry[4] == 1)
+		gtk_window_move(GTK_WINDOW(app->window), ui_prefs.geometry[0], ui_prefs.geometry[1]);
+		gtk_window_set_default_size(GTK_WINDOW(app->window), ui_prefs.geometry[2], ui_prefs.geometry[3]);
+		if (ui_prefs.geometry[4] == 1)
 			gtk_window_maximize(GTK_WINDOW(app->window));
 	}
 
 	// hide statusbar if desired
-	if (! app->statusbar_visible)
+	if (! prefs.statusbar_visible)
 	{
 		gtk_widget_hide(app->statusbar);
 	}
@@ -245,17 +246,17 @@
 
 	// connect the toolbar dropdown menu for the new button
 	gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(
-			lookup_widget(app->window, "menutoolbutton1")), app->new_file_menu);
+			lookup_widget(app->window, "menutoolbutton1")), ui_widgets.new_file_menu);
 
 	// set the tab placements of the notebooks
-	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->notebook), app->tab_pos_editor);
-	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), app->tab_pos_msgwin);
-	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->treeview_notebook), app->tab_pos_sidebar);
+	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->notebook), prefs.tab_pos_editor);
+	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(msgwindow.notebook), prefs.tab_pos_msgwin);
+	gtk_notebook_set_tab_pos(GTK_NOTEBOOK(app->treeview_notebook), prefs.tab_pos_sidebar);
 
 	ui_update_toolbar_items();
 
 	// whether to show notebook tabs or not
-	gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), app->show_notebook_tabs);
+	gtk_notebook_set_show_tabs(GTK_NOTEBOOK(app->notebook), prefs.show_notebook_tabs);
 }
 
 
@@ -264,71 +265,66 @@
 	// inits
 	app->window				= NULL;
 	app->project			= NULL;
-	app->open_fontsel		= NULL;
-	app->open_colorsel		= NULL;
-	app->open_filesel		= NULL;
-	app->save_filesel		= NULL;
-	app->prefs_dialog		= NULL;
-	app->default_tag_tree	= NULL;
-	app->main_window_realized= FALSE;
-	app->tab_order_ltr		= FALSE;
-	app->quitting			= FALSE;
+	ui_widgets.open_fontsel		= NULL;
+	ui_widgets.open_colorsel		= NULL;
+	ui_widgets.open_filesel		= NULL;
+	ui_widgets.save_filesel		= NULL;
+	ui_widgets.prefs_dialog		= NULL;
+	tv.default_tag_tree	= NULL;
+	main_status.main_window_realized= FALSE;
+	prefs.tab_order_ltr		= FALSE;
+	main_status.quitting			= FALSE;
 	app->ignore_callback	= FALSE;
 	app->tm_workspace				= tm_get_workspace();
-	app->recent_queue				= g_queue_new();
-	app->opening_session_files		= FALSE;
+	ui_prefs.recent_queue				= g_queue_new();
+	main_status.opening_session_files		= FALSE;
 
 	app->window = create_window1();
-	app->new_file_menu = gtk_menu_new();
-	app->recent_files_toolbar = gtk_menu_new();
-	app->recent_files_menuitem = lookup_widget(app->window, "recent_files1");
-	app->recent_files_menubar = gtk_menu_new();
-	gtk_menu_item_set_submenu(GTK_MENU_ITEM(app->recent_files_menuitem),
-							app->recent_files_menubar);
+	ui_widgets.new_file_menu = gtk_menu_new();
+	ui_widgets.recent_files_toolbar = gtk_menu_new();
+	ui_widgets.recent_files_menuitem = lookup_widget(app->window, "recent_files1");
+	ui_widgets.recent_files_menubar = gtk_menu_new();
+	gtk_menu_item_set_submenu(GTK_MENU_ITEM(ui_widgets.recent_files_menuitem),
+							ui_widgets.recent_files_menubar);
 
-	// store important pointers in the MyApp structure
+	// store important pointers in the GeanyApp structure
 	app->toolbar = lookup_widget(app->window, "toolbar1");
-	app->tagbar = lookup_widget(app->window, "scrolledwindow2");
 	app->treeview_notebook = lookup_widget(app->window, "notebook3");
 	app->notebook = lookup_widget(app->window, "notebook1");
 	app->statusbar = lookup_widget(app->window, "statusbar");
 	app->popup_menu = create_edit_menu1();
-	app->toolbar_menu = create_toolbar_popup_menu1();
-	app->compile_button = lookup_widget(app->window, "toolbutton13");

@@ Diff output truncated at 100000 characters. @@

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