Commit 5f675181 authored by Matthias Clasen's avatar Matthias Clasen

font chooser dialog: Improve sensitivity handling

Enable the select button when a font is selected, as it should be.
parent e10f6160
......@@ -159,6 +159,20 @@ gtk_font_chooser_dialog_class_init (GtkFontChooserDialogClass *klass)
gtk_widget_class_bind_template_callback (widget_class, font_activated_cb);
}
static void
update_button (GtkFontChooserDialog *dialog)
{
GtkFontChooserDialogPrivate *priv = dialog->priv;
PangoFontDescription *desc;
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (priv->fontchooser));
gtk_widget_set_sensitive (priv->select_button, desc != NULL);
if (desc)
pango_font_description_free (desc);
}
static void
gtk_font_chooser_dialog_init (GtkFontChooserDialog *fontchooserdiag)
{
......@@ -182,6 +196,10 @@ G_GNUC_END_IGNORE_DEPRECATIONS
_gtk_font_chooser_set_delegate (GTK_FONT_CHOOSER (fontchooserdiag),
GTK_FONT_CHOOSER (priv->fontchooser));
g_signal_connect_swapped (priv->fontchooser, "notify::font-desc",
G_CALLBACK (update_button), fontchooserdiag);
update_button (fontchooserdiag);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment