tooltip: Use an element name

This will allow us to drop hardcoded type names in the theme.
This commit is contained in:
Matthias Clasen 2015-10-27 15:10:39 -04:00
parent 1760ada1ff
commit efc8dc63e3

View File

@ -36,6 +36,8 @@
#include "gtkstylecontext.h"
#include "gtkwindowprivate.h"
#include "gtkaccessible.h"
#include "gtkcssnodeprivate.h"
#include "gtkwidgetprivate.h"
#ifdef GDK_WINDOWING_WAYLAND
@ -85,6 +87,10 @@
* gtk_widget_get_tooltip_window() and manipulate as you wish. The semantics of
* the return value are exactly as before, return %TRUE to show the window,
* %FALSE to not show it.
*
* # CSS nodes
*
* The toplevel used for tooltips has a single CSS node with name tooltip.
*/
@ -169,12 +175,12 @@ gtk_tooltip_class_init (GtkTooltipClass *klass)
static void
gtk_tooltip_init (GtkTooltip *tooltip)
{
GtkStyleContext *context;
GtkWidget *window;
GtkWidget *box;
GtkWidget *image;
GtkWidget *label;
AtkObject *atk_obj;
GtkCssNode *cssnode;
tooltip->timeout_id = 0;
tooltip->browse_mode_timeout_id = 0;
@ -197,8 +203,8 @@ gtk_tooltip_init (GtkTooltip *tooltip)
G_CALLBACK (gtk_tooltip_window_hide), tooltip);
_gtk_window_request_csd (GTK_WINDOW (window));
context = gtk_widget_get_style_context (window);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOOLTIP);
cssnode = gtk_widget_get_css_node (window);
gtk_css_node_set_name (cssnode, I_("tooltip"));
atk_obj = gtk_widget_get_accessible (window);
if (GTK_IS_ACCESSIBLE (atk_obj))