[gtk+] font button: Add an element name
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] font button: Add an element name
- Date: Fri, 30 Oct 2015 21:18:36 +0000 (UTC)
commit bd456ac67b16f3a637b2ef84143de316887442b6
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 30 17:09:59 2015 -0400
font button: Add an element name
Give this GtkButton subclass element name button and style class .font.
gtk/gtkfontbutton.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c
index 98620c1..f067bfb 100644
--- a/gtk/gtkfontbutton.c
+++ b/gtk/gtkfontbutton.c
@@ -55,6 +55,10 @@
* The #GtkFontButton is a button which displays the currently selected
* font an allows to open a font chooser dialog to change the font.
* It is suitable widget for selecting a font in a preference dialog.
+ *
+ * # CSS nodes
+ *
+ * GtkFontButton has a single CSS node with name button and style class .font.
*/
@@ -582,11 +586,15 @@ gtk_font_button_class_init (GtkFontButtonClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkFontButton, font_label);
gtk_widget_class_bind_template_child_private (widget_class, GtkFontButton, size_label);
gtk_widget_class_bind_template_child_private (widget_class, GtkFontButton, font_size_box);
+
+ gtk_widget_class_set_css_name (widget_class, "button");
}
static void
gtk_font_button_init (GtkFontButton *font_button)
{
+ GtkStyleContext *context;
+
font_button->priv = gtk_font_button_get_instance_private (font_button);
/* Initialize fields */
@@ -604,6 +612,9 @@ gtk_font_button_init (GtkFontButton *font_button)
gtk_widget_init_template (GTK_WIDGET (font_button));
gtk_font_button_take_font_desc (font_button, NULL);
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (font_button));
+ gtk_style_context_add_class (context, "font");
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]