[gnumeric] Conf: closer, but not close, to compiling again.



commit 7f99a4e687e388978d24d98e10a9154478565d0c
Author: Morten Welinder <terra gnome org>
Date:   Sat Jun 27 20:17:27 2009 -0400

    Conf: closer, but not close, to compiling again.

 src/application.c                  |   19 ++----
 src/application.h                  |    9 ---
 src/commands.c                     |   16 ++---
 src/dialogs/dialog-preferences.c   |   27 ++++----
 src/dialogs/dialog-printer-setup.c |    8 +-
 src/file-autoft.c                  |   13 ++--
 src/gnm-pane.c                     |   12 ++--
 src/gnm-plugin.c                   |   12 ++--
 src/gnumeric-gconf.h               |   11 ++-
 src/gui-clipboard.c                |    2 +-
 src/gui-file.c                     |    4 +-
 src/libgnumeric.c                  |    3 +-
 src/mstyle.c                       |    8 +-
 src/print-info.c                   |  126 ++++++++++++++++++++----------------
 src/ranges.c                       |    6 +-
 src/sheet-control-gui.c            |    3 +-
 src/sheet-view.c                   |    2 +-
 src/sheet.c                        |    2 +-
 src/style.c                        |    4 +-
 src/wbc-gtk.c                      |    4 +-
 src/workbook-view.c                |    5 +-
 src/workbook.c                     |    4 +-
 tools/handle-conf-options          |    7 ++
 23 files changed, 159 insertions(+), 148 deletions(-)
---
diff --git a/src/application.c b/src/application.c
index 3143131..af812e5 100644
--- a/src/application.c
+++ b/src/application.c
@@ -446,14 +446,16 @@ gnm_app_workbook_get_by_index (int i)
 double
 gnm_app_display_dpi_get (gboolean horizontal)
 {
-	return horizontal ? gnm_app_prefs->horizontal_dpi : gnm_app_prefs->vertical_dpi;
+	return horizontal
+		? gnm_conf_get_core_gui_screen_horizontaldpi ()
+		: gnm_conf_get_core_gui_screen_verticaldpi ();
 }
 
 double
 gnm_app_dpi_to_pixels (void)
 {
-	return MIN (gnm_app_prefs->horizontal_dpi,
-		    gnm_app_prefs->vertical_dpi) / 72.;
+	return MIN (gnm_app_display_dpi_get (TRUE),
+		    gnm_app_display_dpi_get (FALSE)) / 72.;
 }
 
 /* GtkFileFilter */
@@ -641,17 +643,6 @@ gnm_app_history_add (char const *uri, const char *mimetype)
 	g_object_notify (G_OBJECT (app), "file-history-list");
 }
 
-int	 gnm_app_enter_moves_dir	(void) { return gnm_app_prefs->enter_moves_dir; }
-gboolean gnm_app_use_auto_complete	(void) { return gnm_app_prefs->auto_complete; }
-gboolean gnm_app_live_scrolling		(void) { return gnm_app_prefs->live_scrolling; }
-gboolean gnm_app_detachable_toolbars    (void) { return gnm_app_prefs->detachable_toolbars; }
-int	 gnm_app_auto_expr_recalc_lag	(void) { return gnm_app_prefs->recalc_lag; }
-gboolean gnm_app_use_transition_keys	(void) { return gnm_app_prefs->transition_keys; }
-void     gnm_app_set_transition_keys	(gboolean state)
-{
-	((GnmAppPrefs *)gnm_app_prefs)->transition_keys = state;
-}
-
 static void
 cb_recent_changed (G_GNUC_UNUSED GtkRecentManager *recent, GnmApp *app)
 {
diff --git a/src/application.h b/src/application.h
index 919680f..b16aff9 100644
--- a/src/application.h
+++ b/src/application.h
@@ -33,15 +33,6 @@ void         gnm_app_recalc_finish         (void);
 /* GtkFileFilter */
 void        *gnm_app_create_opener_filter (void);
 
-/* Prefs */
-int	     gnm_app_enter_moves_dir	  (void);
-gboolean     gnm_app_use_auto_complete    (void);
-gboolean     gnm_app_use_transition_keys  (void);
-void         gnm_app_set_transition_keys  (gboolean);
-gboolean     gnm_app_live_scrolling	  (void);
-int	     gnm_app_auto_expr_recalc_lag (void);
-gboolean     gnm_app_detachable_toolbars  (void);
-
 double	     gnm_app_display_dpi_get	  (gboolean horizontal);
 double	     gnm_app_dpi_to_pixels	  (void);
 
diff --git a/src/commands.c b/src/commands.c
index d5c11d8..0c292f9 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -136,19 +136,13 @@ gnm_command_finalize (GObject *obj)
 
 /******************************************************************/
 
-static guint
-max_descriptor_width (void)
-{
-	return gnm_app_prefs->max_descriptor_width;
-}
-
 static char *
 make_undo_text (char const *src, gboolean *truncated)
 {
 	char *dst = g_strdup (src);
 	char *p;
 	int len;
-	int max_len = max_descriptor_width ();
+	int max_len = gnm_conf_get_undo_max_descriptor_width ();
 	*truncated = FALSE;
 	for (len = 0, p = dst;
 	     *p;
@@ -570,8 +564,8 @@ truncate_undo_info (Workbook *wb)
 	int ok_count;
 	GSList *l, *prev;
 
-	size_left = gnm_app_prefs->undo_size;
-	max_num   = gnm_app_prefs->undo_max_number;
+	size_left = gnm_conf_get_undo_size ();
+	max_num   = gnm_conf_get_undo_maxnum ();
 
 #ifdef DEBUG_TRUNCATE_UNDO
 	g_printerr ("Undo sizes:");
@@ -1938,7 +1932,7 @@ cmd_resize_colrow (WorkbookControl *wbc, Sheet *sheet,
 
 	list = colrow_index_list_to_string (selection, is_cols, &is_single);
 	/* Make sure the string doesn't get overly wide */
-	max_width = max_descriptor_width ();
+	max_width = gnm_conf_get_undo_max_descriptor_width ();
 	if (strlen (list->str) > max_width) {
 		g_string_truncate (list, max_width - 3);
 		g_string_append (list, "...");
@@ -4348,7 +4342,7 @@ cmd_zoom (WorkbookControl *wbc, GSList *sheets, double factor)
 	}
 
 	/* Make sure the string doesn't get overly wide */
-	max_width = max_descriptor_width ();
+	max_width = gnm_conf_get_undo_max_descriptor_width ();
 	if (strlen (namelist->str) > max_width) {
 		g_string_truncate (namelist, max_width - 3);
 		g_string_append (namelist, "...");
diff --git a/src/dialogs/dialog-preferences.c b/src/dialogs/dialog-preferences.c
index 4d4a912..c0df56f 100644
--- a/src/dialogs/dialog-preferences.c
+++ b/src/dialogs/dialog-preferences.c
@@ -306,18 +306,21 @@ int_pref_create_widget (GOConfNode *node, char const *key, GtkWidget *table,
 			gint row, gint val, gint from, gint to, gint step, 
 			gint_conf_setter_t setter, char const *default_label)
 {
-	GtkWidget *w = gtk_spin_button_new (GTK_ADJUSTMENT (
-		gtk_adjustment_new (val, from, to, step, step, 0)),
-		1, 0);
+	GtkAdjustment *adj = GTK_ADJUSTMENT
+		(gtk_adjustment_new (val, from, to, step, step, 0));
+	GtkWidget *w = gtk_spin_button_new (adj, 1, 0);
+
 	int_pref_conf_to_widget (node, key, GTK_SPIN_BUTTON (w));
 	gtk_table_attach (GTK_TABLE (table), w,
 		1, 2, row, row + 1,
 		GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_SHRINK, 5, 2);
 
 	g_signal_connect (G_OBJECT (w), "value-changed",
-		G_CALLBACK (int_pref_widget_to_conf), (gpointer) setter);
+			  G_CALLBACK (int_pref_widget_to_conf),
+			  (gpointer) setter);
 	connect_notification (node, key,
-		(GOConfMonitorFunc)int_pref_conf_to_widget, w, table);
+			      (GOConfMonitorFunc)int_pref_conf_to_widget,
+			      w, table);
 
 	pref_create_label (node, key, table, row, default_label, w);
 	set_tip (node, key, w);
@@ -419,17 +422,17 @@ cb_pref_font_has_changed (G_GNUC_UNUSED FontSelector *fs,
 			  GnmStyle *mstyle, PrefState *state)
 {
 	if (gnm_style_is_element_set (mstyle, MSTYLE_FONT_SIZE))
-		gnm_conf_set_core_defaultfont_size 
+		gnm_conf_set_core_defaultfont_size
 			(gnm_style_get_font_size (mstyle));
 	if (gnm_style_is_element_set (mstyle, MSTYLE_FONT_NAME))
-		gnm_conf_set_core_defaultfont_name (
-			gnm_style_get_font_name (mstyle));
+		gnm_conf_set_core_defaultfont_name
+			(gnm_style_get_font_name (mstyle));
 	if (gnm_style_is_element_set (mstyle, MSTYLE_FONT_BOLD))
-		gnm_conf_set_core_defaultfont_bold (
-			gnm_style_get_font_bold (mstyle));
+		gnm_conf_set_core_defaultfont_bold
+			(gnm_style_get_font_bold (mstyle));
 	if (gnm_style_is_element_set (mstyle, MSTYLE_FONT_ITALIC))
-		gnm_conf_set_core_defaultfont_italic (
-			gnm_style_get_font_italic (mstyle));
+		gnm_conf_set_core_defaultfont_italic
+			(gnm_style_get_font_italic (mstyle));
 	return TRUE;
 }
 
diff --git a/src/dialogs/dialog-printer-setup.c b/src/dialogs/dialog-printer-setup.c
index 1253613..ab2e53d 100644
--- a/src/dialogs/dialog-printer-setup.c
+++ b/src/dialogs/dialog-printer-setup.c
@@ -1900,7 +1900,7 @@ create_hf_preview_canvas (PrinterSetupState *state, gboolean header)
 		"fill-color",	"white",
 		NULL);
 
-	style = gnm_style_dup (gnm_app_prefs->printer_decoration_font);
+	style = gnm_style_dup (gnm_conf_get_printer_decoration_font ());
 	font_desc = pango_font_description_new ();
 	pango_font_description_set_family (font_desc, gnm_style_get_font_name (style));
 	pango_font_description_set_style 
@@ -2436,7 +2436,7 @@ print_setup_get_sheet (PrinterSetupState *state)
 	GtkWidget *w = glade_xml_get_widget (state->gui, "apply-to-all");
 	gboolean apply_all_sheets = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
 
-	gnm_gconf_set_all_sheets (apply_all_sheets);
+	gnm_conf_set_printsetup_all_sheets (apply_all_sheets);
 
 	if (apply_all_sheets)
 		return NULL;
@@ -2547,11 +2547,11 @@ do_setup_sheet_selector (PrinterSetupState *state)
 		"toggled",
 		G_CALLBACK (cb_do_sheet_selector_toggled), state);
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
-				      gnm_app_prefs->print_all_sheets);
+				      gnm_conf_get_printsetup_all_sheets ());
 	cb_do_sheet_selector_toggled (GTK_TOGGLE_BUTTON (w), state);
 	w = glade_xml_get_widget (state->gui, "apply-to-selected");
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
-				      !gnm_app_prefs->print_all_sheets);
+				      !gnm_conf_get_printsetup_all_sheets ());
 	gtk_widget_show_all (table);
 }
 
diff --git a/src/file-autoft.c b/src/file-autoft.c
index 22a5dfc..9c68be7 100644
--- a/src/file-autoft.c
+++ b/src/file-autoft.c
@@ -200,12 +200,14 @@ category_group_list_get (void)
 	GList *categories, *l;
 	FormatTemplateCategoryGroup *current_group;
 
-	dir_list = go_slist_create (gnm_app_prefs->autoformat.sys_dir,
-				     gnm_app_prefs->autoformat.usr_dir,
-				     NULL);
-	dir_list = g_slist_concat (dir_list,
-		g_slist_copy ((GSList *)gnm_app_prefs->autoformat.extra_dirs));
+	dir_list = go_slist_create ((char *)gnm_conf_get_autoformat_sys_dir (),
+				    (char *)gnm_conf_get_autoformat_usr_dir (),
+				    NULL);
+	dir_list = g_slist_concat
+		(dir_list,
+		 g_slist_copy (gnm_conf_get_autoformat_extra_dirs ()));
 	categories = category_list_get_from_dir_list (dir_list);
+	g_slist_free (dir_list); /* we do not own the strings here */
 
 	categories = g_list_sort (categories, category_compare_name_and_dir);
 
@@ -230,7 +232,6 @@ category_group_list_get (void)
 		category_groups = g_list_prepend (category_groups, current_group);
 
 	g_list_free (categories);
-	g_slist_free (dir_list); /* strings are owned by the gnm_app_prefs */
 
 	return category_groups;
 }
diff --git a/src/gnm-pane.c b/src/gnm-pane.c
index 74b118f..7ba4a23 100644
--- a/src/gnm-pane.c
+++ b/src/gnm-pane.c
@@ -39,6 +39,7 @@
 #include "item-cursor.h"
 #include "item-edit.h"
 #include "item-grid.h"
+#include "gnumeric-gconf.h"
 
 #include <goffice/goffice.h>
 #include <goffice/cut-n-paste/foocanvas/foo-canvas-line.h>
@@ -177,7 +178,7 @@ gnm_pane_key_mode_sheet (GnmPane *pane, GdkEventKey *event,
 	int state = gnumeric_filter_modifiers (event->state);
 	void (*movefn) (SheetControlGUI *, int n, gboolean jump, gboolean horiz);
 
-	gboolean transition_keys = gnm_app_use_transition_keys();
+	gboolean transition_keys = gnm_conf_get_core_gui_editing_transitionkeys ();
 	gboolean const end_mode = wbcg->last_key_was_end;
 
 	/* Update end-mode for magic end key stuff. */
@@ -402,6 +403,7 @@ gnm_pane_key_mode_sheet (GnmPane *pane, GdkEventKey *event,
 			sheet = wbcg->editing_sheet;
 
 		if (wbcg_edit_finish (wbcg, WBC_EDIT_ACCEPT, NULL)) {
+			GODirection dir = gnm_conf_get_core_gui_editing_enter_moves_dir ();
 			if ((event->state & GDK_MOD1_MASK) &&
 			    (event->state & GDK_CONTROL_MASK) &&
 			    !is_enter) {
@@ -409,14 +411,12 @@ gnm_pane_key_mode_sheet (GnmPane *pane, GdkEventKey *event,
 					workbook_cmd_dec_indent (sc->wbc);
 				else
 					workbook_cmd_inc_indent	(sc->wbc);
-			} else if (gnm_app_enter_moves_dir () != GO_DIRECTION_NONE) {
+			} else if (dir != GO_DIRECTION_NONE) {
 				gboolean forward = TRUE;
 				gboolean horizontal = TRUE;
 				if (is_enter) {
-					horizontal = go_direction_is_horizontal (
-						gnm_app_enter_moves_dir ());
-					forward = go_direction_is_forward (
-						gnm_app_enter_moves_dir ());
+					horizontal = go_direction_is_horizontal (dir);
+					forward = go_direction_is_forward (dir);
 				}
 
 				if (event->state & GDK_SHIFT_MASK)
diff --git a/src/gnm-plugin.c b/src/gnm-plugin.c
index 6a248fc..fdb3dfe 100644
--- a/src/gnm-plugin.c
+++ b/src/gnm-plugin.c
@@ -653,16 +653,16 @@ gnm_plugins_init (GOCmdContext *context)
 			g_build_filename (gnm_usr_dir (), PLUGIN_SUBDIR, NULL)),
 		NULL);
 	dir_list = g_slist_concat (dir_list,
-		go_string_slist_copy (gnm_app_prefs->plugin_extra_dirs));
+				   go_string_slist_copy (gnm_conf_get_plugins_extra_dirs ()));
 
 	env_var = g_getenv ("GNUMERIC_PLUGIN_PATH");
 	if (env_var != NULL)
 		GO_SLIST_CONCAT (dir_list, go_strsplit_to_slist (env_var, G_SEARCHPATH_SEPARATOR));
 
 	go_plugins_init (GO_CMD_CONTEXT (context),
-		gnm_app_prefs->plugin_file_states,
-		gnm_app_prefs->active_plugins,
-		dir_list,
-		gnm_app_prefs->activate_new_plugins,
-		gnm_plugin_loader_module_get_type ());
+			 gnm_conf_get_plugins_file_states (),
+			 gnm_conf_get_plugins_active (),
+			 dir_list,
+			 gnm_conf_get_plugins_activate_new (),
+			 gnm_plugin_loader_module_get_type ());
 }
diff --git a/src/gnumeric-gconf.h b/src/gnumeric-gconf.h
index d4da674..777a923 100644
--- a/src/gnumeric-gconf.h
+++ b/src/gnumeric-gconf.h
@@ -2,7 +2,7 @@
 #ifndef _GNM_GCONF_H_
 # define _GNM_GCONF_H_
 
-#include <goffice/goffice.h>
+#include "gnumeric.h"
 
 G_BEGIN_DECLS
 
@@ -10,6 +10,11 @@ void     gnm_conf_init (gboolean fast);
 void     gnm_conf_shutdown (void);
 GOConfNode *gnm_conf_get_root (void);
 
+GtkPageSetup *gnm_gconf_get_page_setup (void);
+void gnm_gconf_set_page_setup (GtkPageSetup *setup);
+
+GnmStyle *gnm_conf_get_printer_decoration_font (void);
+
 const char *gnm_conf_get_toolbar_style (void);
 void gnm_conf_set_toolbar_style (const char *);
 
@@ -229,8 +234,8 @@ void gnm_conf_set_printsetup_paper (const char *);
 int gnm_conf_get_printsetup_paper_orientation (void);
 void gnm_conf_set_printsetup_paper_orientation (int);
 
-const char *gnm_conf_get_printsetup_preferred_unit (void);
-void gnm_conf_set_printsetup_preferred_unit (const char *);
+GtkUnit gnm_conf_get_printsetup_preferred_unit (void);
+void gnm_conf_set_printsetup_preferred_unit (GtkUnit);
 
 gboolean gnm_conf_get_printsetup_print_black_n_white (void);
 void gnm_conf_set_printsetup_print_black_n_white (gboolean);
diff --git a/src/gui-clipboard.c b/src/gui-clipboard.c
index 23a0d62..cde4f3e 100644
--- a/src/gui-clipboard.c
+++ b/src/gui-clipboard.c
@@ -838,7 +838,7 @@ x_request_clipboard (WBCGtk *wbcg, GnmPasteTarget const *pt)
 	GtkClipboard *clipboard =
 		gtk_clipboard_get_for_display
 		(display,
-		 gnm_app_prefs->prefer_clipboard_selection
+		 gnm_conf_get_cut_and_paste_prefer_clipboard ()
 		 ? GDK_SELECTION_CLIPBOARD
 		 : GDK_SELECTION_PRIMARY);
 
diff --git a/src/gui-file.c b/src/gui-file.c
index c165e7b..90d15e4 100644
--- a/src/gui-file.c
+++ b/src/gui-file.c
@@ -382,7 +382,7 @@ check_multiple_sheet_support_if_needed (GOFileSaver *fs,
 	gboolean ret_val = TRUE;
 
 	if (go_file_saver_get_save_scope (fs) != FILE_SAVE_WORKBOOK &&
-	    gnm_app_prefs->file_ask_single_sheet_save) {
+	    gnm_conf_get_core_file_save_single_sheet ()) {
 		Workbook *wb = wb_view_get_workbook (wb_view);
 		gchar *msg = _("Selected file format doesn't support "
 			       "saving multiple sheets in one file.\n"
@@ -544,7 +544,7 @@ gui_file_save_as (WBCGtk *wbcg, WorkbookView *wb_view)
 		uri = uri2;
 
 		if (go_gtk_url_is_writeable (GTK_WINDOW (fsel), uri,
-					     gnm_app_prefs->file_overwrite_default_answer))
+					     gnm_conf_get_core_file_save_def_overwrite ()))
 			break;
 
 		g_free (uri);
diff --git a/src/libgnumeric.c b/src/libgnumeric.c
index bc9288c..4e214d8 100644
--- a/src/libgnumeric.c
+++ b/src/libgnumeric.c
@@ -315,7 +315,8 @@ gnm_shutdown (void)
 
 	plugin_states = go_plugins_shutdown ();
 	if (NULL != plugin_states) {
-		gnm_gconf_set_plugin_file_states (plugin_states);
+		gnm_conf_set_plugins_file_states (plugin_states);
+		go_slist_free_custom (plugin_states, g_free);
 		go_conf_sync (NULL);
 	}
 
diff --git a/src/mstyle.c b/src/mstyle.c
index 8a8c9e4..ab6d762 100644
--- a/src/mstyle.c
+++ b/src/mstyle.c
@@ -536,10 +536,10 @@ gnm_style_new_default (void)
 	GnmStyle *new_style = gnm_style_new ();
 	int i;
 
-	gnm_style_set_font_name	  (new_style, gnm_app_prefs->default_font.name);
-	gnm_style_set_font_size	  (new_style, gnm_app_prefs->default_font.size);
-	gnm_style_set_font_bold	  (new_style, gnm_app_prefs->default_font.is_bold);
-	gnm_style_set_font_italic (new_style, gnm_app_prefs->default_font.is_italic);
+	gnm_style_set_font_name	  (new_style, gnm_conf_get_core_defaultfont_name ());
+	gnm_style_set_font_size	  (new_style, gnm_conf_get_core_defaultfont_size ());
+	gnm_style_set_font_bold	  (new_style, gnm_conf_get_core_defaultfont_bold ());
+	gnm_style_set_font_italic (new_style, gnm_conf_get_core_defaultfont_italic ());
 
 	gnm_style_set_format      (new_style, go_format_general ());
 	gnm_style_set_align_v     (new_style, VALIGN_BOTTOM);
diff --git a/src/print-info.c b/src/print-info.c
index d84f782..c2b712c 100644
--- a/src/print-info.c
+++ b/src/print-info.c
@@ -191,9 +191,9 @@ load_formats (void)
 		GSList const *middle;
 		GSList const *right;
 
-		left = gnm_app_prefs->printer_header_formats_left;
-		middle = gnm_app_prefs->printer_header_formats_middle;
-		right = gnm_app_prefs->printer_header_formats_right;
+		left = gnm_conf_get_printsetup_hf_left ();
+		middle = gnm_conf_get_printsetup_hf_middle ();
+		right = gnm_conf_get_printsetup_hf_right ();
 
 		while (left != NULL && middle != NULL && right != NULL)
 		{
@@ -234,39 +234,39 @@ print_info_load_defaults (PrintInformation *res)
 
 	res->page_setup = gtk_page_setup_copy (gnm_gconf_get_page_setup ());
 
-	res->scaling.type = gnm_app_prefs->print_scale_percentage
-		? PRINT_SCALE_PERCENTAGE : PRINT_SCALE_FIT_PAGES;
+	res->scaling.type = gnm_conf_get_printsetup_scale_percentage ()
+		? PRINT_SCALE_PERCENTAGE
+		: PRINT_SCALE_FIT_PAGES;
 	res->scaling.percentage.x = res->scaling.percentage.y
-		= gnm_app_prefs->print_scale_percentage_value;
-	res->scaling.dim.cols = gnm_app_prefs->print_scale_width;
-	res->scaling.dim.rows = gnm_app_prefs->print_scale_height;
-	res->edge_to_below_header = gnm_app_prefs->print_margin_top;
-	res->edge_to_above_footer = gnm_app_prefs->print_margin_bottom;
-	res->desired_display.top = gnm_app_prefs->desired_display;
-	res->desired_display.bottom = gnm_app_prefs->desired_display;
-	res->desired_display.left = gnm_app_prefs->desired_display;
-	res->desired_display.right = gnm_app_prefs->desired_display;
-	res->desired_display.footer = gnm_app_prefs->desired_display;
-	res->desired_display.header = gnm_app_prefs->desired_display;
-	res->repeat_top            = g_strdup (gnm_app_prefs->print_repeat_top);
-	res->repeat_left           = g_strdup (gnm_app_prefs->print_repeat_left);
-	res->center_vertically     = gnm_app_prefs->print_center_vertically;
-	res->center_horizontally   = gnm_app_prefs->print_center_horizontally;
-	res->print_grid_lines      = gnm_app_prefs->print_grid_lines;
-	res->print_titles          = gnm_app_prefs->print_titles;
-	res->print_black_and_white = gnm_app_prefs->print_black_and_white;
-	res->print_even_if_only_styles
-		= gnm_app_prefs->print_even_if_only_styles;
-
-	res->print_across_then_down = gnm_app_prefs->print_order_across_then_down;
-
-	list = (GSList *) gnm_app_prefs->printer_header;
+		= gnm_conf_get_printsetup_scale_percentage_value ();
+	res->scaling.dim.cols = gnm_conf_get_printsetup_scale_width ();
+	res->scaling.dim.rows = gnm_conf_get_printsetup_scale_height ();
+	res->edge_to_below_header = gnm_conf_get_printsetup_margin_top ();
+	res->edge_to_above_footer = gnm_conf_get_printsetup_margin_bottom ();
+	res->desired_display.top = gnm_conf_get_printsetup_preferred_unit ();
+	res->desired_display.bottom = gnm_conf_get_printsetup_preferred_unit ();
+	res->desired_display.left = gnm_conf_get_printsetup_preferred_unit ();
+	res->desired_display.right = gnm_conf_get_printsetup_preferred_unit ();
+	res->desired_display.footer = gnm_conf_get_printsetup_preferred_unit ();
+	res->desired_display.header = gnm_conf_get_printsetup_preferred_unit ();
+	res->repeat_top = g_strdup (gnm_conf_get_printsetup_repeat_top ());
+	res->repeat_left = g_strdup (gnm_conf_get_printsetup_repeat_left ());
+	res->center_vertically = gnm_conf_get_printsetup_center_vertically ();
+	res->center_horizontally = gnm_conf_get_printsetup_center_horizontally ();
+	res->print_grid_lines = gnm_conf_get_printsetup_print_grid_lines ();
+	res->print_titles = gnm_conf_get_printsetup_print_titles ();
+	res->print_black_and_white = gnm_conf_get_printsetup_print_black_n_white ();
+	res->print_even_if_only_styles = gnm_conf_get_printsetup_print_even_if_only_styles ();
+	res->print_across_then_down = gnm_conf_get_printsetup_across_then_down ();
+
+	list = gnm_conf_get_printsetup_header ();
 	res->header = list ?
 		print_hf_new (g_slist_nth_data (list, 0),
 			      g_slist_nth_data (list, 1),
 			      g_slist_nth_data (list, 2)) :
 		print_hf_new ("", _("&[TAB]"), "");
-	list = (GSList *) gnm_app_prefs->printer_footer;
+
+	list = gnm_conf_get_printsetup_footer ();
 	res->footer = list ?
 		print_hf_new (g_slist_nth_data (list, 0),
 			      g_slist_nth_data (list, 1),
@@ -334,56 +334,72 @@ save_formats (void)
 		GO_SLIST_PREPEND (right, g_strdup(hf->right_format));
 	}
 	GO_SLIST_REVERSE(left);
+	gnm_conf_set_printsetup_hf_left (left);
+	go_slist_free_custom (left, g_free);
+
 	GO_SLIST_REVERSE(middle);
-	GO_SLIST_REVERSE(right);
+	gnm_conf_set_printsetup_hf_middle (middle);
+	go_slist_free_custom (middle, g_free);
 
-	gnm_gconf_set_print_header_formats (left, middle, right);
+	GO_SLIST_REVERSE(right);
+	gnm_conf_set_printsetup_hf_right (right);
+	go_slist_free_custom (right, g_free);
 }
 
 static void
 destroy_formats (void)
 {
-	while (hf_formats) {
-		print_hf_free (hf_formats->data);
-		hf_formats = g_list_remove (hf_formats,
-					    hf_formats->data);
-	}
+	go_list_free_custom (hf_formats, (GFreeFunc)print_hf_free);
 	hf_formats = NULL;
 }
 
+static GSList *
+make_triple (const PrintHF *hf)
+{
+	GSList *l = NULL;
+
+	GO_SLIST_PREPEND (l, hf->left_format ? hf->left_format : NULL);
+	GO_SLIST_PREPEND (l, hf->middle_format ? hf->middle_format : NULL);
+	GO_SLIST_PREPEND (l, hf->right_format ? hf->right_format : NULL);
+
+	return l;
+}
+
 void
 print_info_save (PrintInformation *pi)
 {
 	GOConfNode *node = go_conf_get_node (gnm_conf_get_root (), PRINTSETUP_GCONF_DIR);
+	GSList *l;
 
-	gnm_gconf_set_print_scale_percentage (pi->scaling.type == PRINT_SCALE_PERCENTAGE);
-	gnm_gconf_set_print_scale_percentage_value (pi->scaling.percentage.x);
+	gnm_conf_set_printsetup_scale_percentage (pi->scaling.type == PRINT_SCALE_PERCENTAGE);
+	gnm_conf_set_printsetup_scale_percentage_value (pi->scaling.percentage.x);
 	go_conf_set_int (node, PRINTSETUP_GCONF_SCALE_WIDTH,  pi->scaling.dim.cols);
 	go_conf_set_int (node, PRINTSETUP_GCONF_SCALE_HEIGHT, pi->scaling.dim.rows);
 
-	gnm_gconf_set_print_tb_margins (pi->edge_to_below_header,
-					pi->edge_to_above_footer,
-					pi->desired_display.top);
+	gnm_conf_set_printsetup_margin_top (pi->edge_to_below_header);
+	gnm_conf_set_printsetup_margin_bottom (pi->edge_to_above_footer);
+	gnm_conf_set_printsetup_preferred_unit (pi->desired_display.top);
 
-	gnm_gconf_set_print_center_horizontally (pi->center_horizontally);
-	gnm_gconf_set_print_center_vertically (pi->center_vertically);
-	gnm_gconf_set_print_grid_lines (pi->print_grid_lines);
-	gnm_gconf_set_print_titles (pi->print_titles);
-	gnm_gconf_set_print_even_if_only_styles (pi->print_even_if_only_styles);
-	gnm_gconf_set_print_black_and_white (pi->print_black_and_white);
-	gnm_gconf_set_print_order_across_then_down (pi->print_across_then_down);
+	gnm_conf_set_printsetup_center_horizontally (pi->center_horizontally);
+	gnm_conf_set_printsetup_center_vertically (pi->center_vertically);
+	gnm_conf_set_printsetup_print_grid_lines (pi->print_grid_lines);
+	gnm_conf_set_printsetup_print_titles (pi->print_titles);
+	gnm_conf_set_printsetup_print_even_if_only_styles (pi->print_even_if_only_styles);
+	gnm_conf_set_printsetup_print_black_n_white (pi->print_black_and_white);
+	gnm_conf_set_printsetup_across_then_down (pi->print_across_then_down);
 
 	go_conf_set_string (node, PRINTSETUP_GCONF_REPEAT_TOP, pi->repeat_top);
 	go_conf_set_string (node, PRINTSETUP_GCONF_REPEAT_LEFT, pi->repeat_left);
 
 	save_formats ();
 
-	gnm_gconf_set_printer_header (pi->header->left_format,
-				      pi->header->middle_format,
-				      pi->header->right_format);
-	gnm_gconf_set_printer_footer (pi->footer->left_format,
-				      pi->footer->middle_format,
-				      pi->footer->right_format);
+	l = make_triple (pi->header);
+	gnm_conf_set_printsetup_header (l);
+	g_slist_free (l);
+
+	l = make_triple (pi->footer);
+	gnm_conf_set_printsetup_footer (l);
+	g_slist_free (l);
 
 	gnm_gconf_set_page_setup (pi->page_setup);
 
diff --git a/src/ranges.c b/src/ranges.c
index 62898e9..f432db8 100644
--- a/src/ranges.c
+++ b/src/ranges.c
@@ -899,7 +899,7 @@ global_range_name (Sheet const *sheet, GnmRange const *r)
 static guint
 max_range_name_width (void)
 {
-	guint max_width = gnm_app_prefs->max_descriptor_width;
+	guint max_width = gnm_conf_get_undo_max_descriptor_width ();
 
 	return (max_width > 23 ? max_width - 20 : 3);
 }
@@ -934,7 +934,7 @@ undo_range_name (Sheet const *sheet, GnmRange const *r)
 
 	max_width = max_range_name_width ();
 
-	if (sheet != NULL && gnm_app_prefs->show_sheet_name) {
+	if (sheet != NULL && gnm_conf_get_undo_show_sheet_name ()) {
 		char *n = g_strdup_printf ("%s!%s", sheet->name_quoted, the_range_name);
 
 		if (strlen (n) <= max_width)
@@ -1015,7 +1015,7 @@ undo_range_list_name (Sheet const *sheet, GSList const *ranges)
 	names = g_string_new (NULL);
 
 	/* With the sheet name. */
-	if (sheet != NULL && gnm_app_prefs->show_sheet_name) {
+	if (sheet != NULL && gnm_conf_get_undo_show_sheet_name ()) {
 		if (range_list_name_try (names, sheet, ranges, max_width)) {
 			/* We have reached the end, return the data from names. */
 			return g_string_free (names, FALSE);
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index 50f6040..21e18e3 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -55,6 +55,7 @@
 #include "xml-sax.h"
 #include "xml-io.h"
 #include "style-color.h"
+#include "gnumeric-gconf.h"
 
 #include "gnm-pane-impl.h"
 #include "item-bar.h"
@@ -1454,7 +1455,7 @@ sheet_control_gui_new (SheetView *sv, WBCGtk *wbcg)
 	gtk_widget_show_all (GTK_WIDGET (scg->inner_table));
 
 	/* Scroll bars and their adjustments */
-	scroll_update_policy = gnm_app_live_scrolling ()
+	scroll_update_policy = gnm_conf_get_core_gui_editing_livescrolling ()
 		? GTK_UPDATE_CONTINUOUS : GTK_UPDATE_DELAYED;
 	scg->va = (GtkAdjustment *)gtk_adjustment_new (0., 0., 1, 1., 1., 1.);
 	scg->vs = g_object_new (GTK_TYPE_VSCROLLBAR,
diff --git a/src/sheet-view.c b/src/sheet-view.c
index 1da5c29..6a66855 100644
--- a/src/sheet-view.c
+++ b/src/sheet-view.c
@@ -643,7 +643,7 @@ sv_update (SheetView *sv)
 	}
 
 	if (sv->selection_content_changed) {
-		int const lag = gnm_app_auto_expr_recalc_lag ();
+		int const lag = gnm_conf_get_core_gui_editing_recalclag ();
 		sv->selection_content_changed = FALSE;
 		if (sv->auto_expr_timer == 0 || lag < 0) {
 			auto_expr_timer_clear (sv);
diff --git a/src/sheet.c b/src/sheet.c
index f01b402..8170cd2 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -1301,7 +1301,7 @@ sheet_new_with_type (Workbook *wb, char const *name, GnmSheetType type,
 			      "columns", columns,
 			      "rows", rows,
 			      "name", name,
-			      "zoom-factor", (double)gnm_app_prefs->zoom,
+			      "zoom-factor", gnm_conf_get_core_gui_window_zoom (),
 			      NULL);
 
 	return sheet;
diff --git a/src/style.c b/src/style.c
index 91d0a69..db76530 100644
--- a/src/style.c
+++ b/src/style.c
@@ -318,8 +318,8 @@ gnm_font_init (void)
 	style_font_negative_hash = g_hash_table_new (
 		gnm_font_hash, gnm_font_equal);
 
-	gnumeric_default_font_name = g_strdup (gnm_app_prefs->default_font.name);
-	gnumeric_default_font_size = gnm_app_prefs->default_font.size;
+	gnumeric_default_font_name = g_strdup (gnm_conf_get_core_defaultfont_name ());
+	gnumeric_default_font_size = gnm_conf_get_core_defaultfont_size ();
 
 	context = gnm_pango_context_get ();
 	if (gnumeric_default_font_name && gnumeric_default_font_size >= 1)
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index d77bbdf..ae05ccf 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -2074,8 +2074,8 @@ show_gui (WBCGtk *wbcg)
 	sx = MAX (rect.width, 600);
 	sy = MAX (rect.height, 200);
 
-	fx = gnm_app_prefs->horizontal_window_fraction;
-	fy = gnm_app_prefs->vertical_window_fraction;
+	fx = gnm_conf_get_core_gui_window_x ();
+	fy = gnm_conf_get_core_gui_window_y ();
 
 	/* Successfully parsed geometry string and urged WM to comply */
 	if (NULL != wbcg->preferred_geometry && NULL != wbcg->toplevel &&
diff --git a/src/workbook-view.c b/src/workbook-view.c
index aea74d0..12bf4d3 100644
--- a/src/workbook-view.c
+++ b/src/workbook-view.c
@@ -49,6 +49,7 @@
 #include "command-context.h"
 #include "auto-format.h"
 #include "sheet-object.h"
+#include "gnumeric-gconf.h"
 
 #include <goffice/goffice.h>
 #include <gsf/gsf.h>
@@ -872,7 +873,7 @@ workbook_view_class_init (GObjectClass *gobject_class)
 		 g_param_spec_boolean ("do-auto-completion",
 				       _("Do auto completion"),
 				       _("Auto-complete text"),
-				       gnm_app_use_auto_complete (),
+				       gnm_conf_get_core_gui_editing_autocomplete (),
 				       GSF_PARAM_STATIC |
 				       G_PARAM_READWRITE));
         g_object_class_install_property
@@ -926,7 +927,7 @@ workbook_view_new (Workbook *wb)
 	wbv->show_horizontal_scrollbar = TRUE;
 	wbv->show_vertical_scrollbar = TRUE;
 	wbv->show_notebook_tabs = TRUE;
-	wbv->do_auto_completion = gnm_app_use_auto_complete ();
+	wbv->do_auto_completion = gnm_conf_get_core_gui_editing_autocomplete ();
 	wbv->is_protected = FALSE;
 
 	wbv->current_style      = NULL;
diff --git a/src/workbook.c b/src/workbook.c
index 61a5a87..a07c824 100644
--- a/src/workbook.c
+++ b/src/workbook.c
@@ -358,8 +358,8 @@ Workbook *
 workbook_new_with_sheets (int sheet_count)
 {
 	Workbook *wb = workbook_new ();
-	int cols = gnm_app_prefs->col_number;
-	int rows = gnm_app_prefs->row_number;
+	int cols = gnm_conf_get_core_workbook_n_cols ();
+	int rows = gnm_conf_get_core_workbook_n_rows ();
 	if (!gnm_sheet_valid_size (cols, rows))
 		gnm_sheet_suggest_size (&cols, &rows);
 	while (sheet_count-- > 0)
diff --git a/tools/handle-conf-options b/tools/handle-conf-options
index a3c2d39..4b4f5cd 100644
--- a/tools/handle-conf-options
+++ b/tools/handle-conf-options
@@ -38,11 +38,18 @@ my %type_to_ctype =
      'string' => 'const char *',
      'list:string' => 'GSList *',
      'GO_TYPE_DIRECTION' => 'GODirection',
+     'GTK_TYPE_UNIT' => 'GtkUnit',
     );
 
 my %extra_attributes =
     ('/apps/gnumeric/core/gui/editing/enter_moves_dir' => {
 	'gtype' => 'GO_TYPE_DIRECTION',
+	'default' => 'GO_DIRECTION_DOWN',  # Should match schema
+     },
+
+     '/apps/gnumeric/printsetup/preferred-unit' => {
+	 'gtype' => 'GTK_TYPE_UNIT',
+	 'default' => 'GTK_UNIT_MM',  # Should match schema
      },
 
      '/apps/gnumeric/core/gui/editing/recalclag' => {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]