GtkFontChooserDialog: Select when a list item is activated

This is the expected behavior.
This commit is contained in:
Matthias Clasen
2011-08-24 00:49:59 -04:00
parent f7bf35052e
commit 5c09061e0f

View File

@@ -86,6 +86,16 @@ gtk_font_chooser_dialog_class_init (GtkFontChooserDialogClass *klass)
g_type_class_add_private (klass, sizeof (GtkFontChooserDialogPrivate));
}
static void
font_activated_cb (GtkFontChooser *fontchooser,
const gchar *fontname,
gpointer user_data)
{
GtkDialog *dialog = user_data;
gtk_dialog_response (dialog, GTK_RESPONSE_OK);
}
static void
gtk_font_chooser_dialog_init (GtkFontChooserDialog *fontchooserdiag)
{
@@ -117,6 +127,9 @@ gtk_font_chooser_dialog_init (GtkFontChooserDialog *fontchooserdiag)
gtk_box_pack_start (GTK_BOX (content_area),
priv->fontchooser, TRUE, TRUE, 0);
g_signal_connect (priv->fontchooser, "font-activated",
G_CALLBACK (font_activated_cb), dialog);
/* Create the action area */
priv->cancel_button = gtk_dialog_add_button (dialog,
GTK_STOCK_CANCEL,
@@ -127,17 +140,16 @@ gtk_font_chooser_dialog_init (GtkFontChooserDialog *fontchooserdiag)
gtk_widget_grab_default (priv->select_button);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (fontchooserdiag),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_window_set_title (GTK_WINDOW (fontchooserdiag), _("Font Selection"));
gtk_widget_pop_composite_child ();
}
/**
* gtk_font_chooser_dialog_new:
/** gtk_font_chooser_dialog_new:
* @title: (allow-none): Title of the dialog, or %NULL
* @parent: (allow-none): Trasient parent of the dialog, or %NULL
*