PROP_NAME,
PROP_STATE,
PROP_VISIBLE,
- PROP_WIDGET_TYPE,
NUM_PROPERTIES
};
g_value_set_boolean (value, gtk_css_node_get_visible (cssnode));
break;
- case PROP_WIDGET_TYPE:
- g_value_set_gtype (value, gtk_css_node_get_widget_type (cssnode));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
gtk_css_node_set_visible (cssnode, g_value_get_boolean (value));
break;
- case PROP_WIDGET_TYPE:
- gtk_css_node_set_widget_type (cssnode, g_value_get_gtype (value));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
TRUE,
G_PARAM_READWRITE
| G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
- cssnode_properties[PROP_WIDGET_TYPE] =
- g_param_spec_gtype ("widget-type", P_("Widget type"), P_("GType of the widget"),
- G_TYPE_NONE,
- G_PARAM_READWRITE
- | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, NUM_PROPERTIES, cssnode_properties);
return gtk_css_node_declaration_get_name (cssnode->decl);
}
-void
-gtk_css_node_set_widget_type (GtkCssNode *cssnode,
- GType widget_type)
-{
- if (gtk_css_node_declaration_set_type (&cssnode->decl, widget_type))
- {
- gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_NAME);
- g_object_notify_by_pspec (G_OBJECT (cssnode), cssnode_properties[PROP_WIDGET_TYPE]);
- }
-}
-
-GType
-gtk_css_node_get_widget_type (GtkCssNode *cssnode)
-{
- return gtk_css_node_declaration_get_type (cssnode->decl);
-}
-
void
gtk_css_node_set_id (GtkCssNode *cssnode,
/* interned */ const char *id)
struct _GtkCssNodeDeclaration {
guint refcount;
- GType type;
const /* interned */ char *name;
const /* interned */ char *id;
GtkStateFlags state;
{
static GtkCssNodeDeclaration empty = {
1, /* need to own a ref ourselves so the copy-on-write path kicks in when people change things */
- 0,
NULL,
NULL,
0,
g_free (decl);
}
-gboolean
-gtk_css_node_declaration_set_type (GtkCssNodeDeclaration **decl,
- GType type)
-{
- if ((*decl)->type == type)
- return FALSE;
-
- gtk_css_node_declaration_make_writable (decl);
- (*decl)->type = type;
-
- return TRUE;
-}
-
-GType
-gtk_css_node_declaration_get_type (const GtkCssNodeDeclaration *decl)
-{
- return decl->type;
-}
-
gboolean
gtk_css_node_declaration_set_name (GtkCssNodeDeclaration **decl,
/*interned*/ const char *name)
GQuark *classes;
guint hash, i;
- hash = (guint) decl->type;
- hash ^= GPOINTER_TO_UINT (decl->name);
+ hash = GPOINTER_TO_UINT (decl->name);
hash <<= 5;
hash ^= GPOINTER_TO_UINT (decl->id);
if (decl1 == decl2)
return TRUE;
- if (decl1->type != decl2->type)
- return FALSE;
-
if (decl1->name != decl2->name)
return FALSE;
if (decl->name)
g_string_append (string, decl->name);
else
- g_string_append (string, g_type_name (decl->type));
+ g_string_append (string, "*");
if (decl->id)
{
GtkCssNodeDeclaration * gtk_css_node_declaration_ref (GtkCssNodeDeclaration *decl);
void gtk_css_node_declaration_unref (GtkCssNodeDeclaration *decl);
-gboolean gtk_css_node_declaration_set_type (GtkCssNodeDeclaration **decl,
- GType type);
-GType gtk_css_node_declaration_get_type (const GtkCssNodeDeclaration *decl);
gboolean gtk_css_node_declaration_set_name (GtkCssNodeDeclaration **decl,
/*interned*/ const char *name);
/*interned*/ const char*gtk_css_node_declaration_get_name (const GtkCssNodeDeclaration *decl);
void gtk_css_node_set_name (GtkCssNode *cssnode,
/*interned*/const char*name);
/*interned*/const char *gtk_css_node_get_name (GtkCssNode *cssnode) G_GNUC_PURE;
-void gtk_css_node_set_widget_type (GtkCssNode *cssnode,
- GType widget_type);
-GType gtk_css_node_get_widget_type (GtkCssNode *cssnode) G_GNUC_PURE;
void gtk_css_node_set_id (GtkCssNode *cssnode,
/*interned*/const char*id);
/*interned*/const char *gtk_css_node_get_id (GtkCssNode *cssnode) G_GNUC_PURE;
gtk_css_node_set_visible (priv->cssnode, priv->visible);
/* need to set correct name here, and only class has the correct type here */
gtk_css_node_set_name (priv->cssnode, GTK_WIDGET_CLASS (g_class)->priv->css_name);
- gtk_css_node_set_widget_type (priv->cssnode, G_TYPE_FROM_CLASS (g_class));
if (g_type_is_a (G_TYPE_FROM_CLASS (g_class), GTK_TYPE_ROOT))
priv->root = (GtkRoot *) widget;