app/widgets/gimpfontselection-dialog.c connect the dialog to the font

2003-02-20  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpfontselection-dialog.c
	* app/widgets/gimpfontselection.c: connect the dialog to the font
	selection widget and block the signal handler when the font is
	changed from the dialog. Fixes weird behaviour noted by Jimmac.
This commit is contained in:
Sven Neumann 2003-02-20 17:56:18 +00:00 committed by Sven Neumann
parent e105077033
commit 0f59cb4040
3 changed files with 33 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2003-02-20 Sven Neumann <sven@gimp.org>
* app/widgets/gimpfontselection-dialog.c
* app/widgets/gimpfontselection.c: connect the dialog to the font
selection widget and block the signal handler when the font is
changed from the dialog. Fixes weird behaviour noted by Jimmac.
2003-02-20 Sven Neumann <sven@gimp.org>
* app/tools/gimptexttool.c: always start with an empty text.

View file

@ -78,6 +78,9 @@ struct _GimpFontSelectionDialog
};
static void gimp_font_selection_dialog_font_changed (GimpFontSelection *fontsel,
GimpFontSelectionDialog *dialog);
static void gimp_font_selection_dialog_ok (GtkWidget *widget,
gpointer data);
static void gimp_font_selection_dialog_apply (GtkWidget *widget,
@ -117,6 +120,7 @@ gimp_font_selection_dialog_new (GimpFontSelection *fontsel)
GtkWidget *table;
GtkWidget *label;
GtkWidget *frame;
GClosure *closure;
g_return_val_if_fail (GIMP_IS_FONT_SELECTION (fontsel), NULL);
@ -275,6 +279,11 @@ gimp_font_selection_dialog_new (GimpFontSelection *fontsel)
gimp_font_selection_dialog_set_font_desc (dialog, fontsel->font_desc);
closure = g_cclosure_new (G_CALLBACK (gimp_font_selection_dialog_font_changed),
dialog, NULL);
g_object_watch_closure (G_OBJECT (dialog->dialog), closure);
g_signal_connect_closure (fontsel, "font_changed", closure, FALSE);
return dialog;
}
@ -297,6 +306,14 @@ gimp_font_selection_dialog_show (GimpFontSelectionDialog *dialog)
gtk_window_present (GTK_WINDOW (dialog->dialog));
}
static void
gimp_font_selection_dialog_font_changed (GimpFontSelection *fontsel,
GimpFontSelectionDialog *dialog)
{
gimp_font_selection_dialog_set_font_desc (dialog,
gimp_font_selection_get_font_desc (fontsel));
}
static void
scroll_to_selection (GtkTreeView *tree_view)
{
@ -414,7 +431,16 @@ gimp_font_selection_dialog_apply (GtkWidget *widget,
{
font_desc = pango_font_face_describe (dialog->face);
g_signal_handlers_block_by_func (dialog->fontsel,
G_CALLBACK (gimp_font_selection_dialog_font_changed),
dialog);
gimp_font_selection_set_font_desc (dialog->fontsel, font_desc);
g_signal_handlers_unblock_by_func (dialog->fontsel,
G_CALLBACK (gimp_font_selection_dialog_font_changed),
dialog);
pango_font_description_free (font_desc);
}
}

View file

@ -247,10 +247,6 @@ gimp_font_selection_real_font_changed (GimpFontSelection *fontsel)
g_free (name);
}
if (fontsel->dialog)
gimp_font_selection_dialog_set_font_desc (fontsel->dialog,
fontsel->font_desc);
}
/**