diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-11-02 13:15:05 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-11-02 13:56:25 -0500 |
commit | d229ea3de163fa92a94bc921f5eb6db11939e9e8 (patch) | |
tree | 1c8820a37b5823cf6257ae7f120f7aa3595e4dcc /gtk/gtkcombobox.c | |
parent | e56bb49407534297fa74c194783301d8fc1bb844 (diff) | |
download | gtk+-d229ea3de163fa92a94bc921f5eb6db11939e9e8.tar.gz |
combobox: Use element names
Use combobox as the element name for the main CSS nodes of
GtkComboBox and GtkComboBoxText. Add the .combo style class
to the button and entry. in a GtkComboBox or GtkComboBoxText.
Diffstat (limited to 'gtk/gtkcombobox.c')
-rw-r--r-- | gtk/gtkcombobox.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 39339e0948..008cd3795d 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -87,6 +87,11 @@ * can be a bit overwhelming. In this case, #GtkComboBoxText offers a * simple alternative. Both GtkComboBox and #GtkComboBoxText can contain * an entry. + * + * # CSS nodes + * + * GtkComboBox has a single CSS node with name combobox. It adds the + * .combo style class to the button (and entry) that it contains. */ @@ -1066,6 +1071,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) gtk_widget_class_bind_template_callback (widget_class, gtk_combo_box_button_toggled); gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_COMBO_BOX_ACCESSIBLE); + gtk_widget_class_set_css_name (widget_class, "combobox"); } static void @@ -1094,6 +1100,7 @@ static void gtk_combo_box_init (GtkComboBox *combo_box) { GtkComboBoxPrivate *priv; + GtkStyleContext *context; combo_box->priv = gtk_combo_box_get_instance_private (combo_box); priv = combo_box->priv; @@ -1123,6 +1130,10 @@ gtk_combo_box_init (GtkComboBox *combo_box) gtk_widget_init_template (GTK_WIDGET (combo_box)); gtk_widget_add_events (priv->button, GDK_SCROLL_MASK); + + context = gtk_widget_get_style_context (priv->button); + gtk_style_context_remove_class (context, "toggle"); + gtk_style_context_add_class (context, "combo"); } static void @@ -4400,8 +4411,11 @@ gtk_combo_box_constructed (GObject *object) gtk_widget_show (entry); gtk_container_add (GTK_CONTAINER (combo_box), entry); + context = gtk_widget_get_style_context (GTK_WIDGET (entry)); + gtk_style_context_add_class (context, "combo"); + context = gtk_widget_get_style_context (GTK_WIDGET (combo_box)); - gtk_style_context_add_class (context, GTK_STYLE_CLASS_COMBOBOX_ENTRY); + gtk_style_context_add_class (context, "linked"); priv->text_renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), |