X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-data-editor.c;h=18fd5e8e8d81d294f0557ecb8de1b6cb2b852ed0;hb=26e92e49540c1f3f01b56aa4adeb8140c66a6f95;hp=70086b500070d1b557eee74928b5231df83863b9;hpb=b6493cbb201307a2a5d1ff840a8347d75548cb85;p=pspp diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index 70086b5000..18fd5e8e8d 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -31,7 +31,7 @@ #include "ui/gui/psppire-data-store.h" #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 #define _(msgid) gettext (msgid) @@ -224,10 +224,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)); } @@ -693,11 +693,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; @@ -707,13 +710,13 @@ psppire_data_editor_init (PsppireDataEditor *de) de->cell_ref_label = gtk_label_new (""); gtk_label_set_width_chars (GTK_LABEL (de->cell_ref_label), 25); - gtk_misc_set_alignment (GTK_MISC (de->cell_ref_label), 0.0, 0.5); + gtk_widget_set_valign (de->cell_ref_label, GTK_ALIGN_CENTER); de->datum_entry = psppire_value_entry_new (); g_signal_connect (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (de->datum_entry))), "activate", G_CALLBACK (on_datum_entry_activate), de); - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (hbox), de->cell_ref_label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), de->datum_entry, TRUE, TRUE, 0); @@ -721,7 +724,7 @@ psppire_data_editor_init (PsppireDataEditor *de) de->datasheet_vbox_widget = make_single_datasheet (de, GTK_TREE_VIEW_GRID_LINES_BOTH, FALSE); - de->vbox = gtk_vbox_new (FALSE, 0); + de->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start (GTK_BOX (de->vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (de->vbox), de->datasheet_vbox_widget, TRUE, TRUE, 0); @@ -747,6 +750,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); } @@ -783,12 +795,8 @@ static void set_font_recursively (GtkWidget *w, gpointer data) { PangoFontDescription *font_desc = data; - GtkRcStyle *style = gtk_widget_get_modifier_style (w); - pango_font_description_free (style->font_desc); - style->font_desc = pango_font_description_copy (font_desc); - - gtk_widget_modify_style (w, style); + gtk_widget_override_font (w, font_desc); if ( GTK_IS_CONTAINER (w)) gtk_container_foreach (GTK_CONTAINER (w), set_font_recursively, font_desc); @@ -798,11 +806,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.