cssnode: Remove ability to set GType as fallback name

This commit is contained in:
Benjamin Otte 2020-01-23 02:22:30 +01:00
parent 49b47c9133
commit 98eeee5bce
5 changed files with 2 additions and 65 deletions

View File

@ -110,7 +110,6 @@ enum {
PROP_NAME,
PROP_STATE,
PROP_VISIBLE,
PROP_WIDGET_TYPE,
NUM_PROPERTIES
};
@ -187,10 +186,6 @@ gtk_css_node_get_property (GObject *object,
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);
}
@ -226,10 +221,6 @@ gtk_css_node_set_property (GObject *object,
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);
}
@ -655,11 +646,6 @@ gtk_css_node_class_init (GtkCssNodeClass *klass)
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);
@ -1121,23 +1107,6 @@ gtk_css_node_get_name (GtkCssNode *cssnode)
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)

View File

@ -23,7 +23,6 @@
struct _GtkCssNodeDeclaration {
guint refcount;
GType type;
const /* interned */ char *name;
const /* interned */ char *id;
GtkStateFlags state;
@ -98,7 +97,6 @@ gtk_css_node_declaration_new (void)
{
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,
@ -126,25 +124,6 @@ gtk_css_node_declaration_unref (GtkCssNodeDeclaration *decl)
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)
@ -351,8 +330,7 @@ gtk_css_node_declaration_hash (gconstpointer elem)
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);
@ -380,9 +358,6 @@ gtk_css_node_declaration_equal (gconstpointer elem1,
if (decl1 == decl2)
return TRUE;
if (decl1->type != decl2->type)
return FALSE;
if (decl1->name != decl2->name)
return FALSE;
@ -429,7 +404,7 @@ gtk_css_node_declaration_print (const GtkCssNodeDeclaration *decl,
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)
{

View File

@ -27,9 +27,6 @@ GtkCssNodeDeclaration * gtk_css_node_declaration_new (void);
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);

View File

@ -118,9 +118,6 @@ gboolean gtk_css_node_get_visible (GtkCssNode *
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;

View File

@ -2441,7 +2441,6 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
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;