[gtk+] Deprecate some widget flags
- From: Javier Jardón <jjardon src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] Deprecate some widget flags
- Date: Thu, 7 Jan 2010 09:14:37 +0000 (UTC)
commit 51e0dd9a82270ebfe8d4f5da0b3674c3c9ad0d57
Author: Javier Jardón <jjardon gnome org>
Date: Mon Jan 4 03:07:11 2010 +0100
Deprecate some widget flags
Deprecate the following:
GTK_WIDGET_APP_PAINTABLE
GTK_WIDGET_CAN_DEFAULT
GTK_WIDGET_DOUBLE_BUFFERED
GTK_WIDGET_HAS_DEFAULT
GTK_WIDGET_HAS_GRAB
GTK_WIDGET_RECEIVES_DEFAULT
https://bugzilla.gnome.org/show_bug.cgi?id=69872
docs/reference/gtk/drawing-model.xml | 2 +-
gtk/gtkbutton.c | 8 ++++----
gtk/gtkeventbox.c | 2 +-
gtk/gtkmain.c | 8 ++++----
gtk/gtkscalebutton.c | 2 +-
gtk/gtkwidget.c | 24 ++++++++++++------------
gtk/gtkwidget.h | 24 ++++++++++++++++++++++++
gtk/gtkwindow.c | 30 +++++++++++++++---------------
gtk/tests/builder.c | 2 +-
modules/engines/ms-windows/msw_style.c | 2 +-
modules/other/gail/gail.c | 2 +-
modules/other/gail/gailwidget.c | 2 +-
12 files changed, 66 insertions(+), 42 deletions(-)
---
diff --git a/docs/reference/gtk/drawing-model.xml b/docs/reference/gtk/drawing-model.xml
index 22307ce..4d697f2 100644
--- a/docs/reference/gtk/drawing-model.xml
+++ b/docs/reference/gtk/drawing-model.xml
@@ -507,7 +507,7 @@ static gint
gtk_window_expose (GtkWidget *widget,
GdkEventExpose *event)
{
- if (!GTK_WIDGET_APP_PAINTABLE (widget))
+ if (!gtk_widget_get_app_paintable (widget))
gtk_paint_flat_box (widget->style, widget->window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE, event->area, widget, "base", 0, 0, -1, -1);
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 2f8b98f..37370c6 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1354,7 +1354,7 @@ gtk_button_size_request (GtkWidget *widget,
GTK_WIDGET (widget)->style->ythickness) * 2 +
inner_border.top + inner_border.bottom);
- if (GTK_WIDGET_CAN_DEFAULT (widget))
+ if (gtk_widget_get_can_default (widget))
{
requisition->width += default_border.left + default_border.right;
requisition->height += default_border.top + default_border.bottom;
@@ -1421,7 +1421,7 @@ gtk_button_size_allocate (GtkWidget *widget,
inner_border.bottom -
border_width * 2);
- if (GTK_WIDGET_CAN_DEFAULT (button))
+ if (gtk_widget_get_can_default (GTK_WIDGET (button)))
{
child_allocation.x += default_border.left;
child_allocation.y += default_border.top;
@@ -1488,7 +1488,7 @@ _gtk_button_paint (GtkButton *button,
width = widget->allocation.width - border_width * 2;
height = widget->allocation.height - border_width * 2;
- if (GTK_WIDGET_HAS_DEFAULT (widget) &&
+ if (gtk_widget_has_default (widget) &&
GTK_BUTTON (widget)->relief == GTK_RELIEF_NORMAL)
{
gtk_paint_box (widget->style, widget->window,
@@ -1501,7 +1501,7 @@ _gtk_button_paint (GtkButton *button,
width -= default_border.left + default_border.right;
height -= default_border.top + default_border.bottom;
}
- else if (GTK_WIDGET_CAN_DEFAULT (widget))
+ else if (gtk_widget_get_can_default (widget))
{
x += default_outside_border.left;
y += default_outside_border.top;
diff --git a/gtk/gtkeventbox.c b/gtk/gtkeventbox.c
index 435c1f3..b1a5035 100644
--- a/gtk/gtkeventbox.c
+++ b/gtk/gtkeventbox.c
@@ -549,7 +549,7 @@ static void
gtk_event_box_paint (GtkWidget *widget,
GdkRectangle *area)
{
- if (!GTK_WIDGET_APP_PAINTABLE (widget))
+ if (!gtk_widget_get_app_paintable (widget))
gtk_paint_flat_box (widget->style, widget->window,
widget->state, GTK_SHADOW_NONE,
area, widget, "eventbox",
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index dfd517a..b150bf3 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1566,7 +1566,7 @@ gtk_main_do_event (GdkEvent *event)
break;
case GDK_EXPOSE:
- if (event->any.window && GTK_WIDGET_DOUBLE_BUFFERED (event_widget))
+ if (event->any.window && gtk_widget_get_double_buffered (event_widget))
{
gdk_window_begin_paint_region (event->any.window, event->expose.region);
gtk_widget_send_expose (event_widget, event);
@@ -1827,7 +1827,7 @@ gtk_grab_add (GtkWidget *widget)
g_return_if_fail (widget != NULL);
- if (!GTK_WIDGET_HAS_GRAB (widget) && GTK_WIDGET_IS_SENSITIVE (widget))
+ if (!gtk_widget_has_grab (widget) && GTK_WIDGET_IS_SENSITIVE (widget))
{
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_GRAB);
@@ -1865,7 +1865,7 @@ gtk_grab_remove (GtkWidget *widget)
g_return_if_fail (widget != NULL);
- if (GTK_WIDGET_HAS_GRAB (widget))
+ if (gtk_widget_has_grab (widget))
{
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_GRAB);
@@ -2404,7 +2404,7 @@ gtk_propagate_event (GtkWidget *widget,
/* If there is a grab within the window, give the grab widget
* a first crack at the key event
*/
- if (widget != window && GTK_WIDGET_HAS_GRAB (widget))
+ if (widget != window && gtk_widget_has_grab (widget))
handled_event = gtk_widget_event (widget, event);
if (!handled_event)
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index f61ee9a..b1c7a90 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -1133,7 +1133,7 @@ gtk_scale_button_grab_notify (GtkScaleButton *button,
priv = button->priv;
- if (!GTK_WIDGET_HAS_GRAB (priv->dock))
+ if (!gtk_widget_has_grab (priv->dock))
return;
if (gtk_widget_is_ancestor (gtk_grab_get_current (), priv->dock))
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index e76a1d5..acd4458 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2743,7 +2743,7 @@ gtk_widget_get_property (GObject *object,
g_value_set_boolean (value, (GTK_WIDGET_SENSITIVE (widget) != FALSE));
break;
case PROP_APP_PAINTABLE:
- g_value_set_boolean (value, (GTK_WIDGET_APP_PAINTABLE (widget) != FALSE));
+ g_value_set_boolean (value, (gtk_widget_get_app_paintable (widget) != FALSE));
break;
case PROP_CAN_FOCUS:
g_value_set_boolean (value, (GTK_WIDGET_CAN_FOCUS (widget) != FALSE));
@@ -2755,13 +2755,13 @@ gtk_widget_get_property (GObject *object,
g_value_set_boolean (value, (gtk_widget_is_focus (widget)));
break;
case PROP_CAN_DEFAULT:
- g_value_set_boolean (value, (GTK_WIDGET_CAN_DEFAULT (widget) != FALSE));
+ g_value_set_boolean (value, (gtk_widget_get_can_default (widget) != FALSE));
break;
case PROP_HAS_DEFAULT:
- g_value_set_boolean (value, (GTK_WIDGET_HAS_DEFAULT (widget) != FALSE));
+ g_value_set_boolean (value, (gtk_widget_has_default (widget) != FALSE));
break;
case PROP_RECEIVES_DEFAULT:
- g_value_set_boolean (value, (GTK_WIDGET_RECEIVES_DEFAULT (widget) != FALSE));
+ 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 );
@@ -5545,7 +5545,7 @@ gtk_widget_set_can_default (GtkWidget *widget,
{
g_return_if_fail (GTK_IS_WIDGET (widget));
- if (can_default != GTK_WIDGET_CAN_DEFAULT (widget))
+ if (can_default != gtk_widget_get_can_default (widget))
{
if (can_default)
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_DEFAULT);
@@ -5573,7 +5573,7 @@ gtk_widget_get_can_default (GtkWidget *widget)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
- return GTK_WIDGET_CAN_DEFAULT (widget);
+ return (GTK_WIDGET_FLAGS (widget) & GTK_CAN_DEFAULT) != 0;
}
/**
@@ -5593,7 +5593,7 @@ gtk_widget_has_default (GtkWidget *widget)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
- return GTK_WIDGET_HAS_DEFAULT (widget);
+ return (GTK_WIDGET_FLAGS (widget) & GTK_HAS_DEFAULT) != 0;
}
/**
@@ -5613,7 +5613,7 @@ gtk_widget_grab_default (GtkWidget *widget)
GtkWidget *window;
g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (GTK_WIDGET_CAN_DEFAULT (widget));
+ g_return_if_fail (gtk_widget_get_can_default (widget));
window = gtk_widget_get_toplevel (widget);
@@ -5979,7 +5979,7 @@ gtk_widget_set_app_paintable (GtkWidget *widget,
app_paintable = (app_paintable != FALSE);
- if (GTK_WIDGET_APP_PAINTABLE (widget) != app_paintable)
+ if (gtk_widget_get_app_paintable (widget) != app_paintable)
{
if (app_paintable)
GTK_WIDGET_SET_FLAGS (widget, GTK_APP_PAINTABLE);
@@ -6044,7 +6044,7 @@ gtk_widget_set_double_buffered (GtkWidget *widget,
{
g_return_if_fail (GTK_IS_WIDGET (widget));
- if (double_buffered != GTK_WIDGET_DOUBLE_BUFFERED (widget))
+ if (double_buffered != gtk_widget_get_double_buffered (widget))
{
if (double_buffered)
GTK_WIDGET_SET_FLAGS (widget, GTK_DOUBLE_BUFFERED);
@@ -9067,7 +9067,7 @@ gtk_widget_propagate_state (GtkWidget *widget,
{
g_object_ref (widget);
- if (!GTK_WIDGET_IS_SENSITIVE (widget) && GTK_WIDGET_HAS_GRAB (widget))
+ if (!GTK_WIDGET_IS_SENSITIVE (widget) && gtk_widget_has_grab (widget))
gtk_grab_remove (widget);
g_signal_emit (widget, widget_signals[STATE_CHANGED], 0, old_state);
@@ -9338,7 +9338,7 @@ expose_window (GdkWindow *window)
gdk_window_get_user_data (window, &user_data);
if (user_data)
- is_double_buffered = GTK_WIDGET_DOUBLE_BUFFERED (GTK_WIDGET (user_data));
+ is_double_buffered = gtk_widget_get_double_buffered (GTK_WIDGET (user_data));
else
is_double_buffered = FALSE;
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index e5e8031..d27b05e 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -289,31 +289,43 @@ typedef enum
*/
#define GTK_WIDGET_HAS_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0)
+#ifndef GTK_DISABLE_DEPRECATED
/**
* GTK_WIDGET_CAN_DEFAULT:
* @wid: a #GtkWidget.
*
* Evaluates to %TRUE if the widget is allowed to receive the default action
* via gtk_widget_grab_default().
+ *
+ * Deprecated: 2.20: Use gtk_widget_get_can_default() instead.
*/
#define GTK_WIDGET_CAN_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) != 0)
+#endif
+#ifndef GTK_DISABLE_DEPRECATED
/**
* GTK_WIDGET_HAS_DEFAULT:
* @wid: a #GtkWidget.
*
* Evaluates to %TRUE if the widget currently is receiving the default action.
+ *
+ * Deprecated: 2.20: Use gtk_widget_has_default() instead.
*/
#define GTK_WIDGET_HAS_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) != 0)
+#endif
+#ifndef GTK_DISABLE_DEPRECATED
/**
* GTK_WIDGET_HAS_GRAB:
* @wid: a #GtkWidget.
*
* Evaluates to %TRUE if the widget is in the grab_widgets stack, and will be
* the preferred one for receiving events other than ones of cosmetic value.
+ *
+ * Deprecated: 2.20: Use gtk_widget_has_grab() instead.
*/
#define GTK_WIDGET_HAS_GRAB(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
+#endif
/**
* GTK_WIDGET_RC_STYLE:
@@ -335,30 +347,42 @@ typedef enum
#define GTK_WIDGET_COMPOSITE_CHILD(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0)
#endif
+#ifndef GTK_DISABLE_DEPRECATED
/**
* GTK_WIDGET_APP_PAINTABLE:
* @wid: a #GtkWidget.
*
* Evaluates to %TRUE if the #GTK_APP_PAINTABLE flag has been set on the widget.
+ *
+ * Deprecated: 2.20: Use gtk_widget_get_app_paintable() instead.
*/
#define GTK_WIDGET_APP_PAINTABLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_APP_PAINTABLE) != 0)
+#endif
+#ifndef GTK_DISABLE_DEPRECATED
/**
* GTK_WIDGET_RECEIVES_DEFAULT:
* @wid: a #GtkWidget.
*
* Evaluates to %TRUE if the widget when focused will receive the default action
* even if there is a different widget set as default.
+ *
+ * Deprecated: 2.20: Use gtk_widget_get_receives_default() instead.
*/
#define GTK_WIDGET_RECEIVES_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RECEIVES_DEFAULT) != 0)
+#endif
+#ifndef GTK_DISABLE_DEPRECATED
/**
* GTK_WIDGET_DOUBLE_BUFFERED:
* @wid: a #GtkWidget.
*
* Evaluates to %TRUE if the #GTK_DOUBLE_BUFFERED flag has been set on the widget.
+ *
+ * Deprecated: 2.20: Use gtk_widget_get_double_buffered() instead.
*/
#define GTK_WIDGET_DOUBLE_BUFFERED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_DOUBLE_BUFFERED) != 0)
+#endif
/* Macros for setting and clearing widget flags.
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 0043389..efb29b8 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1646,7 +1646,7 @@ gtk_window_set_default (GtkWindow *window,
g_return_if_fail (GTK_IS_WINDOW (window));
if (default_widget)
- g_return_if_fail (GTK_WIDGET_CAN_DEFAULT (default_widget));
+ g_return_if_fail (gtk_widget_get_can_default (default_widget));
if (window->default_widget != default_widget)
{
@@ -1660,7 +1660,7 @@ gtk_window_set_default (GtkWindow *window,
old_default_widget = window->default_widget;
if (window->focus_widget != window->default_widget ||
- !GTK_WIDGET_RECEIVES_DEFAULT (window->default_widget))
+ !gtk_widget_get_receives_default (window->default_widget))
GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
gtk_widget_queue_draw (window->default_widget);
}
@@ -1670,7 +1670,7 @@ gtk_window_set_default (GtkWindow *window,
if (window->default_widget)
{
if (window->focus_widget == NULL ||
- !GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget))
+ !gtk_widget_get_receives_default (window->focus_widget))
GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
gtk_widget_queue_draw (window->default_widget);
}
@@ -2000,7 +2000,7 @@ gtk_window_get_focus (GtkWindow *window)
*
* Activates the default widget for the window, unless the current
* focused widget has been configured to receive the default action
- * (see #GTK_RECEIVES_DEFAULT in #GtkWidgetFlags), in which case the
+ * (see gtk_widget_set_receives_default()), in which case the
* focused widget is activated.
*
* Return value: %TRUE if a widget got activated.
@@ -2011,7 +2011,7 @@ gtk_window_activate_default (GtkWindow *window)
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
if (window->default_widget && GTK_WIDGET_IS_SENSITIVE (window->default_widget) &&
- (!window->focus_widget || !GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget)))
+ (!window->focus_widget || !gtk_widget_get_receives_default (window->focus_widget)))
return gtk_widget_activate (window->default_widget);
else if (window->focus_widget && GTK_WIDGET_IS_SENSITIVE (window->focus_widget))
return gtk_widget_activate (window->focus_widget);
@@ -5468,21 +5468,21 @@ gtk_window_real_set_focus (GtkWindow *window,
{
g_object_ref (old_focus);
g_object_freeze_notify (G_OBJECT (old_focus));
- old_focus_had_default = GTK_WIDGET_HAS_DEFAULT (old_focus);
+ old_focus_had_default = gtk_widget_has_default (old_focus);
}
if (focus)
{
g_object_ref (focus);
g_object_freeze_notify (G_OBJECT (focus));
- focus_had_default = GTK_WIDGET_HAS_DEFAULT (focus);
+ focus_had_default = gtk_widget_has_default (focus);
}
if (window->default_widget)
- had_default = GTK_WIDGET_HAS_DEFAULT (window->default_widget);
+ had_default = gtk_widget_has_default (window->default_widget);
if (window->focus_widget)
{
- if (GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget) &&
+ if (gtk_widget_get_receives_default (window->focus_widget) &&
(window->focus_widget != window->default_widget))
{
GTK_WIDGET_UNSET_FLAGS (window->focus_widget, GTK_HAS_DEFAULT);
@@ -5507,10 +5507,10 @@ gtk_window_real_set_focus (GtkWindow *window,
{
window->focus_widget = focus;
- if (GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget) &&
+ if (gtk_widget_get_receives_default (window->focus_widget) &&
(window->focus_widget != window->default_widget))
{
- if (GTK_WIDGET_CAN_DEFAULT (window->focus_widget))
+ if (gtk_widget_get_can_default (window->focus_widget))
GTK_WIDGET_SET_FLAGS (window->focus_widget, GTK_HAS_DEFAULT);
if (window->default_widget)
@@ -5530,12 +5530,12 @@ gtk_window_real_set_focus (GtkWindow *window,
* is harmless.
*/
if (window->default_widget &&
- (had_default != GTK_WIDGET_HAS_DEFAULT (window->default_widget)))
+ (had_default != gtk_widget_has_default (window->default_widget)))
gtk_widget_queue_draw (window->default_widget);
if (old_focus)
{
- if (old_focus_had_default != GTK_WIDGET_HAS_DEFAULT (old_focus))
+ if (old_focus_had_default != gtk_widget_has_default (old_focus))
gtk_widget_queue_draw (old_focus);
g_object_thaw_notify (G_OBJECT (old_focus));
@@ -5543,7 +5543,7 @@ gtk_window_real_set_focus (GtkWindow *window,
}
if (focus)
{
- if (focus_had_default != GTK_WIDGET_HAS_DEFAULT (focus))
+ if (focus_had_default != gtk_widget_has_default (focus))
gtk_widget_queue_draw (focus);
g_object_thaw_notify (G_OBJECT (focus));
@@ -6619,7 +6619,7 @@ static gint
gtk_window_expose (GtkWidget *widget,
GdkEventExpose *event)
{
- if (!GTK_WIDGET_APP_PAINTABLE (widget))
+ if (!gtk_widget_get_app_paintable (widget))
gtk_window_paint (widget, &event->area);
if (GTK_WIDGET_CLASS (gtk_window_parent_class)->expose_event)
diff --git a/gtk/tests/builder.c b/gtk/tests/builder.c
index be24c36..8163a7c 100644
--- a/gtk/tests/builder.c
+++ b/gtk/tests/builder.c
@@ -1624,7 +1624,7 @@ test_widget (void)
builder = builder_new_from_string (buffer2, -1, NULL);
button1 = gtk_builder_get_object (builder, "button1");
- g_assert (GTK_WIDGET_RECEIVES_DEFAULT (GTK_WIDGET (button1)));
+ g_assert (gtk_widget_get_receives_default (GTK_WIDGET (button1)));
g_object_unref (builder);
diff --git a/modules/engines/ms-windows/msw_style.c b/modules/engines/ms-windows/msw_style.c
index 27f8594..b561a1d 100755
--- a/modules/engines/ms-windows/msw_style.c
+++ b/modules/engines/ms-windows/msw_style.c
@@ -2057,7 +2057,7 @@ draw_box (GtkStyle *style,
}
else
{
- gboolean is_default = GTK_WIDGET_HAS_DEFAULT (widget);
+ gboolean is_default = gtk_widget_has_default (widget);
if (xp_theme_draw
(window,
is_default ? XP_THEME_ELEMENT_DEFAULT_BUTTON :
diff --git a/modules/other/gail/gail.c b/modules/other/gail/gail.c
index 37e948d..2167216 100644
--- a/modules/other/gail/gail.c
+++ b/modules/other/gail/gail.c
@@ -263,7 +263,7 @@ gail_focus_watcher (GSignalInvocationHint *ihint,
{
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
- if (GTK_IS_WIDGET (child) && GTK_WIDGET_HAS_GRAB (child))
+ if (GTK_IS_WIDGET (child) && gtk_widget_has_grab (child))
{
if (GTK_IS_MENU_SHELL (child))
{
diff --git a/modules/other/gail/gailwidget.c b/modules/other/gail/gailwidget.c
index 10e5cb5..892e452 100644
--- a/modules/other/gail/gailwidget.c
+++ b/modules/other/gail/gailwidget.c
@@ -529,7 +529,7 @@ gail_widget_ref_state_set (AtkObject *accessible)
if (focus_obj == NULL)
atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
}
- if (GTK_WIDGET_HAS_DEFAULT(widget))
+ if (gtk_widget_has_default (widget))
{
atk_state_set_add_state (state_set, ATK_STATE_DEFAULT);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]