font dialog: Use headerbar

Make the font chooser dialog use a headerbar
when desired.

https://bugzilla.gnome.org/show_bug.cgi?id=720059
This commit is contained in:
William Jon McCann
2013-12-08 15:09:46 +01:00
committed by Matthias Clasen
parent a70f8f44b4
commit 3eb2430a98
3 changed files with 14 additions and 53 deletions

View File

@ -34,6 +34,8 @@
#include "gtkbuildable.h"
#include "gtkprivate.h"
#include "gtkwidget.h"
#include "gtksettings.h"
#include "gtkdialogprivate.h"
struct _GtkFontChooserDialogPrivate
{
@ -56,7 +58,7 @@ struct _GtkFontChooserDialogPrivate
* <title>GtkFontChooserDialog as GtkBuildable</title>
* The GtkFontChooserDialog implementation of the GtkBuildable interface
* exposes the buttons with the names
* "select_button" and "cancel_button.
* "select_button" and "cancel_button".
* </refsect2>
*
* Since: 3.2
@ -137,8 +139,6 @@ gtk_font_chooser_dialog_class_init (GtkFontChooserDialogClass *klass)
"/org/gtk/libgtk/gtkfontchooserdialog.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserDialog, fontchooser);
gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserDialog, select_button);
gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserDialog, cancel_button);
gtk_widget_class_bind_template_callback (widget_class, font_activated_cb);
}
@ -151,6 +151,12 @@ gtk_font_chooser_dialog_init (GtkFontChooserDialog *fontchooserdiag)
priv = fontchooserdiag->priv;
gtk_widget_init_template (GTK_WIDGET (fontchooserdiag));
gtk_dialog_set_use_header_bar_from_setting (GTK_DIALOG (fontchooserdiag));
gtk_dialog_add_buttons (GTK_DIALOG (fontchooserdiag),
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Select"), GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (fontchooserdiag), GTK_RESPONSE_OK);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_dialog_set_alternative_button_order (GTK_DIALOG (fontchooserdiag),
GTK_RESPONSE_OK,
@ -158,6 +164,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-1);
G_GNUC_END_IGNORE_DEPRECATIONS
priv->select_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (fontchooserdiag), GTK_RESPONSE_OK);
priv->cancel_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (fontchooserdiag), GTK_RESPONSE_CANCEL);
_gtk_font_chooser_set_delegate (GTK_FONT_CHOOSER (fontchooserdiag),
GTK_FONT_CHOOSER (priv->fontchooser));
}