[gtk/wip/otte/css: 3142/3150] cssnode: Remove ability to set GType as fallback name



commit 606fa7d5ef205d9494a92a152ff49422af693e96
Author: Benjamin Otte <otte redhat com>
Date:   Thu Jan 23 02:22:30 2020 +0100

    cssnode: Remove ability to set GType as fallback name

 gtk/gtkcssnode.c                   | 31 -------------------------------
 gtk/gtkcssnodedeclaration.c        | 29 ++---------------------------
 gtk/gtkcssnodedeclarationprivate.h |  3 ---
 gtk/gtkcssnodeprivate.h            |  3 ---
 gtk/gtkwidget.c                    |  1 -
 5 files changed, 2 insertions(+), 65 deletions(-)
---
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 9c0c20c9c9..1b45366f38 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -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)
diff --git a/gtk/gtkcssnodedeclaration.c b/gtk/gtkcssnodedeclaration.c
index 49b2820e6b..8757268367 100644
--- a/gtk/gtkcssnodedeclaration.c
+++ b/gtk/gtkcssnodedeclaration.c
@@ -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;
 
@@ -444,7 +419,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)
     {
diff --git a/gtk/gtkcssnodedeclarationprivate.h b/gtk/gtkcssnodedeclarationprivate.h
index de79209052..8609e4cac3 100644
--- a/gtk/gtkcssnodedeclarationprivate.h
+++ b/gtk/gtkcssnodedeclarationprivate.h
@@ -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);
diff --git a/gtk/gtkcssnodeprivate.h b/gtk/gtkcssnodeprivate.h
index 680189813f..ae8597c796 100644
--- a/gtk/gtkcssnodeprivate.h
+++ b/gtk/gtkcssnodeprivate.h
@@ -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;
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index e1a3fe1a8e..44e70c3945 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -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;


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