From 80e963508a3f4a24b218a54c553ed472b9d1fabb Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 29 Apr 2001 20:40:41 +0000 Subject: config file handling added --- mixgtk/mixgtk_fontsel.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'mixgtk/mixgtk_fontsel.c') diff --git a/mixgtk/mixgtk_fontsel.c b/mixgtk/mixgtk_fontsel.c index 3119825..5f24776 100644 --- a/mixgtk/mixgtk_fontsel.c +++ b/mixgtk/mixgtk_fontsel.c @@ -1,7 +1,7 @@ /* -*-c-*- -------------- mixgtk_fontsel.c : * Implementation of the functions declared in mixgtk_fontsel.h * ------------------------------------------------------------------ - * Last change: Time-stamp: "2001-04-28 23:44:18 jao" + * Last change: Time-stamp: "2001-04-29 16:40:33 jao" * ------------------------------------------------------------------ * Copyright (C) 2001 Free Software Foundation, Inc. * @@ -23,6 +23,7 @@ #include #include "mixgtk_widgets.h" +#include "mixgtk_config.h" #include "mixgtk_fontsel.h" static GtkWidget *fontsel_dialog_ = NULL; @@ -33,7 +34,8 @@ typedef struct winfo { GtkWidget *widget; GtkStyle *style; - gchar *font; + const gchar *font; + const gchar *key; } winfo; static mixgtk_widget_id_t widget_ids_[] = { @@ -43,6 +45,11 @@ static mixgtk_widget_id_t widget_ids_[] = { MIXGTK_WIDGET_MIXAL, }; +static const gchar *keys_[] = { + "MIX.font", "Prompt.font", "Log.font", "MIXAL.font" +}; + + #define WIDGET_NO_ (sizeof (widget_ids_) / sizeof (widget_ids_[0])) static winfo infos_[WIDGET_NO_]; @@ -77,9 +84,14 @@ mixgtk_fontsel_init (void) gtk_widget_set_style (mixgtk_widget_factory_get (k), infos_[i].style); } - infos_[i].font = NULL; + infos_[i].key = keys_[i]; + infos_[i].font = mixgtk_config_get (keys_[i]); g_hash_table_insert (winfo_, GINT_TO_POINTER (widget_ids_[i]), (gpointer)(infos_ + i)); + if (infos_[i].font) + { + mixgtk_fontsel_set (widget_ids_[i], infos_[i].font); + } } return TRUE; } @@ -96,8 +108,7 @@ mixgtk_fontsel_set (mixgtk_widget_id_t widget, const gchar *font) { gdk_font_unref (w->style->font); w->style->font = f; - if (w->font != NULL) g_free (w->font); - w->font = g_strdup (font); + w->font = font; gtk_widget_draw (w->widget, NULL); if (widget == MIXGTK_WIDGET_MIXVM) @@ -107,6 +118,7 @@ mixgtk_fontsel_set (mixgtk_widget_id_t widget, const gchar *font) gtk_widget_draw (mixgtk_widget_factory_get (k), NULL); } } + mixgtk_config_update (w->key, w->font); } } -- cgit v1.2.3