Merge master into gtk3.
[pspp] / src / ui / gui / psppire-data-editor.c
index e79bd4f47038b8824b2ca69ba601b30ffd0a2cc9..09729bc42510353fbca895a62ad1a26d7d96b245 100644 (file)
@@ -32,6 +32,7 @@
 #include "ui/gui/psppire-value-entry.h"
 #include "ui/gui/psppire-var-sheet.h"
 #include "ui/gui/psppire.h"
+#include "ui/gui/psppire-conf.h"
 
 #include <gettext.h>
 #define _(msgid) gettext (msgid)
@@ -224,10 +225,10 @@ psppire_data_editor_get_property (GObject         *object,
 
 static void
 psppire_data_editor_switch_page (GtkNotebook     *notebook,
-                                 GtkNotebookPage *page,
+                                GtkWidget *w,
                                  guint            page_num)
 {
-  GTK_NOTEBOOK_CLASS (parent_class)->switch_page (notebook, page, page_num);
+  GTK_NOTEBOOK_CLASS (parent_class)->switch_page (notebook, w, page_num);
   psppire_data_editor_update_ui_manager (PSPPIRE_DATA_EDITOR (notebook));
 }
 
@@ -339,7 +340,7 @@ on_var_sheet_var_double_clicked (PsppireVarSheet *var_sheet, gint dict_index,
                                  PSPPIRE_DATA_EDITOR_DATA_VIEW);
 
   data_sheet = psppire_data_editor_get_active_data_sheet (de);
-  psppire_data_sheet_show_variable (data_sheet, dict_index);
+  psppire_data_sheet_goto_variable (data_sheet, dict_index);
 
   return TRUE;
 }
@@ -693,11 +694,14 @@ make_split_datasheet (PsppireDataEditor *de, GtkTreeViewGridLines grid_lines,
   return GTK_WIDGET (xpaned);
 }
 
+static void set_font_recursively (GtkWidget *w, gpointer data);
+
 static void
 psppire_data_editor_init (PsppireDataEditor *de)
 {
   GtkWidget *var_sheet_scroller;
   GtkWidget *hbox;
+  gchar *fontname = NULL;
 
   de->font = NULL;
   de->ui_manager = NULL;
@@ -747,6 +751,15 @@ psppire_data_editor_init (PsppireDataEditor *de)
 
   g_object_set (de, "can-focus", FALSE, NULL);
 
+  if (psppire_conf_get_string (psppire_conf_new (),
+                          "Data Editor", "font",
+                               &fontname) )
+    {
+      de->font = pango_font_description_from_string (fontname);
+      g_free (fontname);
+      set_font_recursively (GTK_WIDGET (de), de->font);
+    }
+
   psppire_data_editor_update_ui_manager (de);
 }
 
@@ -798,11 +811,18 @@ set_font_recursively (GtkWidget *w, gpointer data)
 void
 psppire_data_editor_set_font (PsppireDataEditor *de, PangoFontDescription *font_desc)
 {
+  gchar *font_name;
   set_font_recursively (GTK_WIDGET (de), font_desc);
 
   if (de->font)
     pango_font_description_free (de->font);
   de->font = pango_font_description_copy (font_desc);
+  font_name = pango_font_description_to_string (de->font);
+
+  psppire_conf_set_string (psppire_conf_new (),
+                          "Data Editor", "font",
+                          font_name);
+
 }
 
 /* If SPLIT is TRUE, splits DE's data sheet into four panes.
@@ -862,7 +882,7 @@ psppire_data_editor_goto_variable (PsppireDataEditor *de, gint dict_index)
     {
     case PSPPIRE_DATA_EDITOR_DATA_VIEW:
       data_sheet = psppire_data_editor_get_active_data_sheet (de);
-      psppire_data_sheet_show_variable (data_sheet, dict_index);
+      psppire_data_sheet_goto_variable (data_sheet, dict_index);
       break;
 
     case PSPPIRE_DATA_EDITOR_VARIABLE_VIEW: