[gtk+] tool button: Add element names for tool item subclasses



commit 948e077f1c94f650fd3cc968682a15f90f8ea0e0
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Nov 5 15:41:37 2015 -0500

    tool button: Add element names for tool item subclasses
    
    Add the obvious names to the CSS nodes of GtkRadioToolButton,
    GtkToggleToolButton and GtkSeparatorToolItem.

 gtk/gtkradiotoolbutton.c   |   11 +++++++----
 gtk/gtkseparatortoolitem.c |   13 +++++++------
 gtk/gtktoggletoolbutton.c  |    7 +++++--
 3 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkradiotoolbutton.c b/gtk/gtkradiotoolbutton.c
index 860abd9..c7519c2 100644
--- a/gtk/gtkradiotoolbutton.c
+++ b/gtk/gtkradiotoolbutton.c
@@ -35,10 +35,13 @@
  * that is, a button that is part of a group of toggle buttons where only
  * one button can be active at a time.
  *
- * Use gtk_radio_tool_button_new() to create a new
- * #GtkRadioToolButton. Use gtk_radio_tool_button_new_from_widget() to
- * create a new #GtkRadioToolButton that is part of the same group as an
- * existing #GtkRadioToolButton.
+ * Use gtk_radio_tool_button_new() to create a new GtkRadioToolButton. Use
+ * gtk_radio_tool_button_new_from_widget() to create a new GtkRadioToolButton
+ * that is part of the same group as an existing GtkRadioToolButton.
+ *
+ * # CSS nodes
+ *
+ * GtkRadioToolButton has a single CSS node with name toolbutton.
  */
 
 
diff --git a/gtk/gtkseparatortoolitem.c b/gtk/gtkseparatortoolitem.c
index e92ed40..0873700 100644
--- a/gtk/gtkseparatortoolitem.c
+++ b/gtk/gtkseparatortoolitem.c
@@ -40,6 +40,10 @@
  * a “spring” that forces other items to the ends of the toolbar.
  *
  * Use gtk_separator_tool_item_new() to create a new #GtkSeparatorToolItem.
+ *
+ * # CSS nodes
+ *
+ * GtkSeparatorToolItem has a single CSS node with name separator.
  */
 
 #define MENU_ID "gtk-separator-tool-item-menu-id"
@@ -145,20 +149,17 @@ gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class)
                                                          P_("Whether the separator is drawn, or just blank"),
                                                          TRUE,
                                                          GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
+
+  gtk_widget_class_set_css_name (widget_class, "separator");
 }
 
 static void
 gtk_separator_tool_item_init (GtkSeparatorToolItem *separator_item)
 {
-  GtkStyleContext *context;
-
   separator_item->priv = gtk_separator_tool_item_get_instance_private (separator_item);
   separator_item->priv->draw = TRUE;
 
   gtk_widget_set_has_window (GTK_WIDGET (separator_item), FALSE);
-
-  context = gtk_widget_get_style_context (GTK_WIDGET (separator_item));
-  gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
 }
 
 static void
@@ -173,7 +174,7 @@ gtk_separator_tool_item_create_menu_proxy (GtkToolItem *item)
 {
   GtkWidget *menu_item = NULL;
   
-  menu_item = gtk_separator_menu_item_new();
+  menu_item = gtk_separator_menu_item_new ();
   
   gtk_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item);
   
diff --git a/gtk/gtktoggletoolbutton.c b/gtk/gtktoggletoolbutton.c
index 5cd0f88..9a3722c 100644
--- a/gtk/gtktoggletoolbutton.c
+++ b/gtk/gtktoggletoolbutton.c
@@ -39,8 +39,11 @@
  * A #GtkToggleToolButton is a #GtkToolItem that contains a toggle
  * button.
  *
- * Use gtk_toggle_tool_button_new() to create a new
- * #GtkToggleToolButton.
+ * Use gtk_toggle_tool_button_new() to create a new GtkToggleToolButton.
+ *
+ * # CSS nodes
+ *
+ * GtkToggleToolButton has a single CSS node with name togglebutton.
  */
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]