[gtk+] Improve GTK_WIDGET_FLAGS() deprecation documentation



commit 2c043d33c2271aaf8db2e216325c7e855f048e00
Author: Javier Jardón <jjardon gnome org>
Date:   Fri Mar 5 19:22:12 2010 +0100

    Improve GTK_WIDGET_FLAGS() deprecation documentation
    
    Also, use GTK_OBJECT_FLAGS() instead.
    Note that some internal code still uses GTK_WIDGET_FLAGS().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=69872

 gtk/gtkwidget.c |   28 ++++++++++++++--------------
 gtk/gtkwidget.h |   10 +++++++++-
 2 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 57cf079..94d78af 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2767,7 +2767,7 @@ gtk_widget_get_property (GObject         *object,
       g_value_set_boolean (value, (gtk_widget_get_receives_default (widget) != FALSE));
       break;
     case PROP_COMPOSITE_CHILD:
-      g_value_set_boolean (value, (GTK_WIDGET_FLAGS (widget) & GTK_COMPOSITE_CHILD) != 0 );
+      g_value_set_boolean (value, (GTK_OBJECT_FLAGS (widget) & GTK_COMPOSITE_CHILD) != 0 );
       break;
     case PROP_STYLE:
       g_value_set_object (value, gtk_widget_get_style (widget));
@@ -5484,7 +5484,7 @@ gtk_widget_get_can_focus (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_WIDGET_FLAGS (widget) & GTK_CAN_FOCUS) != 0;
+  return (GTK_OBJECT_FLAGS (widget) & GTK_CAN_FOCUS) != 0;
 }
 
 /**
@@ -5578,7 +5578,7 @@ gtk_widget_get_can_default (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_WIDGET_FLAGS (widget) & GTK_CAN_DEFAULT) != 0;
+  return (GTK_OBJECT_FLAGS (widget) & GTK_CAN_DEFAULT) != 0;
 }
 
 /**
@@ -5598,7 +5598,7 @@ gtk_widget_has_default (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_WIDGET_FLAGS (widget) & GTK_HAS_DEFAULT) != 0;
+  return (GTK_OBJECT_FLAGS (widget) & GTK_HAS_DEFAULT) != 0;
 }
 
 /**
@@ -5679,7 +5679,7 @@ gtk_widget_get_receives_default (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_WIDGET_FLAGS (widget) & GTK_RECEIVES_DEFAULT) != 0;
+  return (GTK_OBJECT_FLAGS (widget) & GTK_RECEIVES_DEFAULT) != 0;
 }
 
 /**
@@ -5700,7 +5700,7 @@ gtk_widget_has_grab (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_WIDGET_FLAGS (widget) & GTK_HAS_GRAB) != 0;
+  return (GTK_OBJECT_FLAGS (widget) & GTK_HAS_GRAB) != 0;
 }
 
 /**
@@ -5929,7 +5929,7 @@ gtk_widget_is_toplevel (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_WIDGET_FLAGS (widget) & GTK_TOPLEVEL) != 0;
+  return (GTK_OBJECT_FLAGS (widget) & GTK_TOPLEVEL) != 0;
 }
 
 /**
@@ -5948,8 +5948,8 @@ gtk_widget_is_drawable (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return ((GTK_WIDGET_FLAGS (widget) & GTK_VISIBLE) != 0 &&
-          (GTK_WIDGET_FLAGS (widget) & GTK_MAPPED) != 0);
+  return (gtk_widget_get_visible (widget) &&
+          gtk_widget_get_mapped (widget));
 }
 
 /**
@@ -6100,7 +6100,7 @@ gtk_widget_get_app_paintable (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_WIDGET_FLAGS (widget) & GTK_APP_PAINTABLE) != 0;
+  return (GTK_OBJECT_FLAGS (widget) & GTK_APP_PAINTABLE) != 0;
 }
 
 /**
@@ -6163,7 +6163,7 @@ gtk_widget_get_double_buffered (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  return (GTK_WIDGET_FLAGS (widget) & GTK_DOUBLE_BUFFERED) != 0;
+  return (GTK_OBJECT_FLAGS (widget) & GTK_DOUBLE_BUFFERED) != 0;
 }
 
 /**
@@ -6425,7 +6425,7 @@ 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;
+  return (GTK_OBJECT_FLAGS (widget) & GTK_RC_STYLE) != 0;
 }
 
 /**
@@ -8386,7 +8386,7 @@ gtk_widget_set_composite_name (GtkWidget   *widget,
 			       const gchar *name)
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail ((GTK_WIDGET_FLAGS (widget) & GTK_COMPOSITE_CHILD) != 0);
+  g_return_if_fail ((GTK_OBJECT_FLAGS (widget) & GTK_COMPOSITE_CHILD) != 0);
   g_return_if_fail (name != NULL);
 
   if (!quark_composite_name)
@@ -8413,7 +8413,7 @@ gtk_widget_get_composite_name (GtkWidget *widget)
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
 
-  if (((GTK_WIDGET_FLAGS (widget) & GTK_COMPOSITE_CHILD) != 0) && widget->parent)
+  if (((GTK_OBJECT_FLAGS (widget) & GTK_COMPOSITE_CHILD) != 0) && widget->parent)
     return _gtk_container_child_composite_name (GTK_CONTAINER (widget->parent),
 					       widget);
   else
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index eae1038..1320799 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -189,7 +189,15 @@ typedef enum
  *
  * Returns the widget flags from @wid.
  *
- * Deprecated: 2.20: Do not use it.
+ * Deprecated: 2.20: Use the proper function to test individual states:
+ * gtk_widget_get_app_paintable(), gtk_widget_get_can_default(),
+ * gtk_widget_get_can_focus(), gtk_widget_get_double_buffered(),
+ * gtk_widget_has_default(), gtk_widget_is_drawable(),
+ * gtk_widget_has_focus(), gtk_widget_has_grab(), gtk_widget_get_mapped(),
+ * gtk_widget_get_has_window(), gtk_widget_has_rc_style(),
+ * gtk_widget_get_realized(), gtk_widget_get_receives_default(),
+ * gtk_widget_get_sensitive(), gtk_widget_is_sensitive(),
+ * gtk_widget_is_toplevel() or gtk_widget_get_visible().
  */
 #define GTK_WIDGET_FLAGS(wid)		  (GTK_OBJECT_FLAGS (wid))
 /* FIXME: Deprecating GTK_WIDGET_FLAGS requires fixing GTK internals. */



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