summaryrefslogtreecommitdiffhomepage
path: root/mixgtk/mixgtk_fontsel.c
diff options
context:
space:
mode:
Diffstat (limited to 'mixgtk/mixgtk_fontsel.c')
-rw-r--r--mixgtk/mixgtk_fontsel.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/mixgtk/mixgtk_fontsel.c b/mixgtk/mixgtk_fontsel.c
index b3233b2..16b6ba1 100644
--- a/mixgtk/mixgtk_fontsel.c
+++ b/mixgtk/mixgtk_fontsel.c
@@ -55,14 +55,22 @@ static const gchar *keys_[] = {
static winfo infos_[WIDGET_NO_];
+/* initialise the font selection dialog */
+static void
+init_fontsel_ (void)
+{
+ fontsel_dialog_ = mixgtk_widget_factory_get_dialog (MIXGTK_FONTSEL_DIALOG);
+ g_assert (fontsel_dialog_ != NULL);
+}
+
void
change_font_ (mixgtk_widget_id_t widget)
{
- winfo *info = (winfo *) g_hash_table_lookup (winfo_,
- GINT_TO_POINTER (widget));
+ winfo *info;
+ if (!fontsel_dialog_) init_fontsel_ ();
+ info = (winfo *) g_hash_table_lookup (winfo_, GINT_TO_POINTER (widget));
g_assert (info);
widget_ = widget;
-
if (info->font)
gtk_font_selection_dialog_set_font_name
(GTK_FONT_SELECTION_DIALOG (fontsel_dialog_), info->font);
@@ -71,19 +79,15 @@ change_font_ (mixgtk_widget_id_t widget)
}
-
-/* initialise the font selection dialog */
-gboolean
-mixgtk_fontsel_init (void)
+void
+mixgtk_fontsel_load_defaults (void)
{
int i;
- fontsel_dialog_ = mixgtk_widget_factory_get (MIXGTK_WIDGET_FONTSEL_DIALOG);
- g_return_val_if_fail (fontsel_dialog_ != NULL, FALSE);
winfo_ = g_hash_table_new (NULL, NULL);
for (i = 0; i < WIDGET_NO_; ++i)
{
infos_[i].widget = mixgtk_widget_factory_get (widget_ids_[i]);
- g_return_val_if_fail (infos_[i].widget != NULL, FALSE);
+ g_assert (infos_[i].widget != NULL);
infos_[i].style = gtk_style_copy
(gtk_widget_get_style (infos_[i].widget));
gtk_widget_set_style (infos_[i].widget, infos_[i].style);
@@ -103,7 +107,6 @@ mixgtk_fontsel_init (void)
mixgtk_fontsel_set (widget_ids_[i], infos_[i].font);
}
}
- return TRUE;
}
void