mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 14:30:15 +00:00
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:
parent
a70f8f44b4
commit
3eb2430a98
@ -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));
|
||||
}
|
||||
|
@ -4,55 +4,13 @@
|
||||
<template class="GtkFontChooserDialog" parent="GtkDialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Font Selection</property>
|
||||
<property name="title" translatable="yes">Select Font</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="cancel_button">
|
||||
<property name="label" translatable="yes">_Cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="select_button">
|
||||
<property name="label" translatable="yes">_Select</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontChooserWidget" id="fontchooser">
|
||||
<property name="visible">True</property>
|
||||
@ -70,9 +28,5 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-6">cancel_button</action-widget>
|
||||
<action-widget response="-5">select_button</action-widget>
|
||||
</action-widgets>
|
||||
</template>
|
||||
</interface>
|
||||
|
@ -1,3 +1 @@
|
||||
N_("Font Selection");
|
||||
N_("_Cancel");
|
||||
N_("_Select");
|
||||
N_("Select Font");
|
||||
|
Loading…
Reference in New Issue
Block a user