[gtk+] stylecontext: Deprecate regions
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] stylecontext: Deprecate regions
- Date: Thu, 19 Jun 2014 20:31:38 +0000 (UTC)
commit d80bf0790d0903ba2825f306b6f7435529f922e2
Author: Benjamin Otte <otte redhat com>
Date: Thu Jun 19 20:00:16 2014 +0200
stylecontext: Deprecate regions
Regions are done in a very non-css way. They don't fit the DOM in that
they don't integrate into the CSS tree and they have very weird matching
behavior in selectors.
So I'm deprecating them now. GtkNotebook and GtkTreeview will continue
to use them and as long as they do, we can't remove the code for it.
But once those are ported it might be safe to remove the code as it will
clean up lots of places in the code by quite a bit.
gtk/gtknotebook.c | 2 ++
gtk/gtkstylecontext.c | 16 ++++++++++++++--
gtk/gtkstylecontext.h | 8 ++++----
gtk/gtkthemingengine.c | 4 ++++
gtk/gtkthemingengine.h | 2 +-
gtk/gtktreeview.c | 6 ++++++
6 files changed, 31 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 4cc472c..7361671 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2035,7 +2035,9 @@ notebook_tab_prepare_style_context (GtkNotebook *notebook,
if (use_flags && (page != NULL))
flags = _gtk_notebook_get_tab_flags (notebook, page);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_add_region (context, GTK_STYLE_REGION_TAB, flags);
+G_GNUC_END_IGNORE_DEPRECATIONS
add_tab_position_style_class (context, tab_pos);
return state;
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 80c176e..45fcb9c 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -79,14 +79,18 @@
* #GtkSettings:gtk-theme-name setting or a hierarchy change in the rendered
* widget.
*
- * # Style Classes and Regions # {#gtkstylecontext-classes}
+ * # Style Classes # {#gtkstylecontext-classes}
*
* Widgets can add style classes to their context, which can be used
* to associate different styles by class
* (see [Selectors][gtkcssprovider-selectors]).
* Theme engines can also use style classes to vary their rendering.
*
- * Widgets can also add regions with flags to their context.
+ * # Style Regions
+ *
+ * Widgets can also add regions with flags to their context. This feature is
+ * deprecated and will be removed in a future GTK+ update. Please use style
+ * classes instead.
*
* The regions used by GTK+ widgets are:
*
@@ -1823,6 +1827,8 @@ gtk_style_context_list_classes (GtkStyleContext *context)
* itself with g_list_free() when you are done with it.
*
* Since: 3.0
+ *
+ * Deprecated: 3.14
**/
GList *
gtk_style_context_list_regions (GtkStyleContext *context)
@@ -1902,6 +1908,8 @@ _gtk_style_context_check_region_name (const gchar *str)
* and “-”, starting always with a lowercase letter.
*
* Since: 3.0
+ *
+ * Deprecated: 3.14
**/
void
gtk_style_context_add_region (GtkStyleContext *context,
@@ -1943,6 +1951,8 @@ gtk_style_context_add_region (GtkStyleContext *context,
* Removes a region from @context.
*
* Since: 3.0
+ *
+ * Deprecated: 3.14
**/
void
gtk_style_context_remove_region (GtkStyleContext *context,
@@ -1986,6 +1996,8 @@ gtk_style_context_remove_region (GtkStyleContext *context,
* Returns: %TRUE if region is defined
*
* Since: 3.0
+ *
+ * Deprecated: 3.14
**/
gboolean
gtk_style_context_has_region (GtkStyleContext *context,
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 4967d45..22182b3 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -939,17 +939,17 @@ GDK_AVAILABLE_IN_ALL
gboolean gtk_style_context_has_class (GtkStyleContext *context,
const gchar *class_name);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_14
GList * gtk_style_context_list_regions (GtkStyleContext *context);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_14
void gtk_style_context_add_region (GtkStyleContext *context,
const gchar *region_name,
GtkRegionFlags flags);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_14
void gtk_style_context_remove_region (GtkStyleContext *context,
const gchar *region_name);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_14
gboolean gtk_style_context_has_region (GtkStyleContext *context,
const gchar *region_name,
GtkRegionFlags *flags_return);
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 4cc9832..402634d 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -648,6 +648,8 @@ gtk_theming_engine_has_class (GtkThemingEngine *engine,
* Returns: %TRUE if region is defined
*
* Since: 3.0
+ *
+ * Deprecated: 3.14
**/
gboolean
gtk_theming_engine_has_region (GtkThemingEngine *engine,
@@ -662,7 +664,9 @@ gtk_theming_engine_has_region (GtkThemingEngine *engine,
g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), FALSE);
priv = engine->priv;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
return gtk_style_context_has_region (priv->context, style_region, flags);
+G_GNUC_END_IGNORE_DEPRECATIONS
}
/**
diff --git a/gtk/gtkthemingengine.h b/gtk/gtkthemingengine.h
index a606774..7e75b1b 100644
--- a/gtk/gtkthemingengine.h
+++ b/gtk/gtkthemingengine.h
@@ -232,7 +232,7 @@ const GtkWidgetPath * gtk_theming_engine_get_path (GtkThemingEngine *engine);
GDK_AVAILABLE_IN_ALL
gboolean gtk_theming_engine_has_class (GtkThemingEngine *engine,
const gchar *style_class);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_14
gboolean gtk_theming_engine_has_region (GtkThemingEngine *engine,
const gchar *style_region,
GtkRegionFlags *flags);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 825279f..83537c9 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -5188,8 +5188,10 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
gtk_style_context_set_state (context, state);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_CELL);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_add_region (context, GTK_STYLE_REGION_ROW, row_flags);
gtk_style_context_add_region (context, GTK_STYLE_REGION_COLUMN, column_flags);
+G_GNUC_END_IGNORE_DEPRECATIONS
if (node == tree_view->priv->cursor_node && has_can_focus_cell
&& ((column == tree_view->priv->focus_column
@@ -14574,7 +14576,9 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_add_region (context, GTK_STYLE_REGION_COLUMN, 0);
+G_GNUC_END_IGNORE_DEPRECATIONS
gtk_widget_style_get (widget,
"allow-rules", &allow_rules,
@@ -14589,7 +14593,9 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
else
row_flags = GTK_REGION_EVEN;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_style_context_add_region (context, GTK_STYLE_REGION_ROW, row_flags);
+G_GNUC_END_IGNORE_DEPRECATIONS
}
is_separator = row_is_separator (tree_view, &iter, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]