[gtk+/native-layout] Add gtk_widget_has_rc_style() accessor
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/native-layout] Add gtk_widget_has_rc_style() accessor
- Date: Sun, 4 Apr 2010 02:19:42 +0000 (UTC)
commit ef3dc5fd42f094923cd11b70ca4cab75bb404909
Author: Javier Jardón <jjardon gnome org>
Date: Mon Jan 18 17:12:42 2010 +0100
Add gtk_widget_has_rc_style() accessor
Add gtk_widget_has_rc_style() as accessor for sealed
GTK_WIDGET_RC_STYLE widget flag.
https://bugzilla.gnome.org/show_bug.cgi?id=69872
docs/reference/gtk/gtk-sections.txt | 1 +
gtk/gtk.symbols | 1 +
gtk/gtkwidget.c | 31 +++++++++++++++++++++++++------
gtk/gtkwidget.h | 6 ++++++
4 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt
index 781f3d1..1369c72 100644
--- a/docs/reference/gtk/gtk-sections.txt
+++ b/docs/reference/gtk/gtk-sections.txt
@@ -5733,6 +5733,7 @@ gtk_widget_set_visible
gtk_widget_has_default
gtk_widget_has_focus
gtk_widget_has_grab
+gtk_widget_has_rc_style
gtk_widget_is_drawable
gtk_widget_is_toplevel
gtk_widget_set_window
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 25cac31..ffbab48 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -5143,6 +5143,7 @@ gtk_widget_grab_focus
gtk_widget_has_default
gtk_widget_has_focus
gtk_widget_has_grab
+gtk_widget_has_rc_style
gtk_widget_has_screen
gtk_widget_hide
gtk_widget_hide_all
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 8f277f7..4e0da7c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5741,7 +5741,7 @@ gtk_widget_set_name (GtkWidget *widget,
g_free (widget->name);
widget->name = new_name;
- if (GTK_WIDGET_RC_STYLE (widget))
+ if (gtk_widget_has_rc_style (widget))
gtk_widget_reset_rc_style (widget);
g_object_notify (G_OBJECT (widget), "name");
@@ -6309,6 +6309,25 @@ gtk_widget_get_parent (GtkWidget *widget)
*****************************************/
/**
+ * gtk_widget_has_rc_style:
+ * @widget: a #GtkWidget
+ *
+ * Determines if the widget style has been looked up through the rc mechanism.
+ *
+ * Returns: %TRUE if the widget has been looked up through the rc
+ * mechanism, %FALSE otherwise.
+ *
+ * Since: 2.20
+ **/
+gboolean
+gtk_widget_has_rc_style (GtkWidget *widget)
+{
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
+
+ return (GTK_WIDGET_FLAGS (widget) & GTK_RC_STYLE) != 0;
+}
+
+/**
* gtk_widget_set_style:
* @widget: a #GtkWidget
* @style: (allow-none): a #GtkStyle, or %NULL to remove the effect of a previous
@@ -6329,7 +6348,7 @@ gtk_widget_set_style (GtkWidget *widget,
{
gboolean initial_emission;
- initial_emission = !GTK_WIDGET_RC_STYLE (widget) && !GTK_WIDGET_USER_STYLE (widget);
+ initial_emission = !gtk_widget_has_rc_style (widget) && !GTK_WIDGET_USER_STYLE (widget);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_RC_STYLE);
GTK_PRIVATE_SET_FLAG (widget, GTK_USER_STYLE);
@@ -6358,7 +6377,7 @@ gtk_widget_ensure_style (GtkWidget *widget)
g_return_if_fail (GTK_IS_WIDGET (widget));
if (!GTK_WIDGET_USER_STYLE (widget) &&
- !GTK_WIDGET_RC_STYLE (widget))
+ !gtk_widget_has_rc_style (widget))
gtk_widget_reset_rc_style (widget);
}
@@ -6371,7 +6390,7 @@ gtk_widget_reset_rc_style (GtkWidget *widget)
GtkStyle *new_style = NULL;
gboolean initial_emission;
- initial_emission = !GTK_WIDGET_RC_STYLE (widget) && !GTK_WIDGET_USER_STYLE (widget);
+ initial_emission = !gtk_widget_has_rc_style (widget) && !GTK_WIDGET_USER_STYLE (widget);
GTK_PRIVATE_UNSET_FLAG (widget, GTK_USER_STYLE);
GTK_WIDGET_SET_FLAGS (widget, GTK_RC_STYLE);
@@ -6440,7 +6459,7 @@ gtk_widget_modify_style (GtkWidget *widget,
* modifier style and the only reference was our own.
*/
- if (GTK_WIDGET_RC_STYLE (widget))
+ if (gtk_widget_has_rc_style (widget))
gtk_widget_reset_rc_style (widget);
}
@@ -6979,7 +6998,7 @@ _gtk_widget_propagate_screen_changed (GtkWidget *widget,
static void
reset_rc_styles_recurse (GtkWidget *widget, gpointer data)
{
- if (GTK_WIDGET_RC_STYLE (widget))
+ if (gtk_widget_has_rc_style (widget))
gtk_widget_reset_rc_style (widget);
if (GTK_IS_CONTAINER (widget))
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 548fd43..6f4f8f8 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -332,14 +332,19 @@ typedef enum
#define GTK_WIDGET_HAS_GRAB(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
#endif
+#ifndef GTK_DISABLE_DEPRECATED
/**
* GTK_WIDGET_RC_STYLE:
* @wid: a #GtkWidget.
*
* Evaluates to %TRUE if the widget's style has been looked up through the rc
* mechanism.
+ *
+ * Deprecated: 2.20: Use gtk_widget_has_rc_style() instead.
*/
#define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
+#endif
+
#ifndef GTK_DISABLE_DEPRECATED
/**
* GTK_WIDGET_COMPOSITE_CHILD:
@@ -1064,6 +1069,7 @@ gboolean gtk_widget_hide_on_delete (GtkWidget *widget);
/* Widget styles.
*/
+gboolean gtk_widget_has_rc_style (GtkWidget *widget);
void gtk_widget_set_style (GtkWidget *widget,
GtkStyle *style);
void gtk_widget_ensure_style (GtkWidget *widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]