notebook: Use the element name notebook

Switch GtkNotebook from using the .notebook style class to
using the element name notebook for its main css node.
This commit is contained in:
Matthias Clasen 2015-10-24 10:10:33 -04:00
parent e2bfe9e95a
commit f194b9608a

View File

@ -1165,13 +1165,13 @@ gtk_notebook_class_init (GtkNotebookClass *class)
add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD); add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_NOTEBOOK_ACCESSIBLE); gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_NOTEBOOK_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, "notebook");
} }
static void static void
gtk_notebook_init (GtkNotebook *notebook) gtk_notebook_init (GtkNotebook *notebook)
{ {
GtkNotebookPrivate *priv; GtkNotebookPrivate *priv;
GtkStyleContext *context;
GtkCssNode *widget_node; GtkCssNode *widget_node;
gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE); gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE);
@ -1220,9 +1220,6 @@ gtk_notebook_init (GtkNotebook *notebook)
gtk_drag_dest_set_track_motion (GTK_WIDGET (notebook), TRUE); gtk_drag_dest_set_track_motion (GTK_WIDGET (notebook), TRUE);
context = gtk_widget_get_style_context (GTK_WIDGET (notebook));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_NOTEBOOK);
widget_node = gtk_widget_get_css_node (GTK_WIDGET (notebook)); widget_node = gtk_widget_get_css_node (GTK_WIDGET (notebook));
priv->tabs_node = gtk_css_node_new (); priv->tabs_node = gtk_css_node_new ();
gtk_css_node_set_name (priv->tabs_node, I_("tabs")); gtk_css_node_set_name (priv->tabs_node, I_("tabs"));
@ -7411,14 +7408,11 @@ gtk_notebook_set_show_tabs (GtkNotebook *notebook,
else else
gtk_widget_hide (page->tab_label); gtk_widget_hide (page->tab_label);
} }
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_NOTEBOOK);
} }
else else
{ {
gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE); gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE);
gtk_notebook_update_labels (notebook); gtk_notebook_update_labels (notebook);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_NOTEBOOK);
} }
for (i = 0; i < N_ACTION_WIDGETS; i++) for (i = 0; i < N_ACTION_WIDGETS; i++)