[gtk+] Add a way to add aliases for css properties
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add a way to add aliases for css properties
- Date: Sat, 21 Nov 2015 01:35:56 +0000 (UTC)
commit 7c95f50ee297cd727215e41c3bdfbe25d25d5d21
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Nov 20 20:20:00 2015 -0500
Add a way to add aliases for css properties
This will be used to rename some properties in a more
systematic way without breaking all users of the old name.
gtk/gtkstyleproperty.c | 20 ++++++++++++++++++++
gtk/gtkstylepropertyprivate.h | 3 +++
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c
index f0f07b6..9639ae4 100644
--- a/gtk/gtkstyleproperty.c
+++ b/gtk/gtkstyleproperty.c
@@ -233,6 +233,26 @@ _gtk_style_property_init_properties (void)
_gtk_css_shorthand_property_init_properties ();
}
+void
+_gtk_style_property_add_alias (const gchar *name,
+ const gchar *alias)
+{
+ GtkStylePropertyClass *klass;
+ GtkStyleProperty *property;
+
+ g_return_if_fail (name != NULL);
+ g_return_if_fail (alias != NULL);
+
+ klass = g_type_class_peek (GTK_TYPE_STYLE_PROPERTY);
+
+ property = g_hash_table_lookup (klass->properties, name);
+
+ g_assert (property != NULL);
+ g_assert (g_hash_table_lookup (klass->properties, alias) == NULL);
+
+ g_hash_table_insert (klass->properties, (gpointer)alias, property);
+}
+
/**
* _gtk_style_property_lookup:
* @name: name of the property to lookup
diff --git a/gtk/gtkstylepropertyprivate.h b/gtk/gtkstylepropertyprivate.h
index a92afdc..59b281f 100644
--- a/gtk/gtkstylepropertyprivate.h
+++ b/gtk/gtkstylepropertyprivate.h
@@ -67,6 +67,9 @@ GType _gtk_style_property_get_type (void) G_GNUC_CONST
void _gtk_style_property_init_properties (void);
+void _gtk_style_property_add_alias (const gchar *name,
+ const gchar *alias);
+
GtkStyleProperty * _gtk_style_property_lookup (const char *name);
const char * _gtk_style_property_get_name (GtkStyleProperty *property);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]