From fa66334289fe9281dcfa75255686ca909231b15b Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 19 Feb 2010 17:05:54 +0100 Subject: [PATCH] Accessors instead of widget flag macros in Katze --- katze/katze-scrolled.c | 10 ++++++++-- katze/katze-throbber.c | 5 ++++- katze/katze-utils.c | 6 +++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/katze/katze-scrolled.c b/katze/katze-scrolled.c index 3fc64f52..54cdc792 100644 --- a/katze/katze-scrolled.c +++ b/katze/katze-scrolled.c @@ -28,6 +28,12 @@ #if !GTK_CHECK_VERSION (2, 18, 0) #define gtk_widget_set_window(wdgt, wndw) wdgt->window = wndw #define gtk_widget_get_allocation (wdgt, alloc) *alloc = wdgt->allocation + #define gtk_widget_is_drawable GTK_WIDGET_DRAWABLE +#endif +#if !GTK_CHECK_VERSION (2, 20, 0) + #define gtk_widget_set_realized(wdgt, real) \ + if (real) GTK_WIDGET_SET_FLAGS (wdgt, GTK_REALIZED); \ + else GTK_WIDGET_UNSET_FLAGS (wdgt, GTK_REALIZED) #endif #define DEFAULT_INTERVAL 50 @@ -277,7 +283,7 @@ on_expose_event (GtkWidget* widget, KatzeScrolledPrivate* priv = scrolled->priv; gboolean ret = FALSE; - if (GTK_WIDGET_DRAWABLE (widget)) + if (gtk_widget_is_drawable (widget)) { if (event->window == priv->horizontal_scrollbar_window) { @@ -904,7 +910,7 @@ katze_scrolled_realize (GtkWidget* widget) color.red = color.green = color.blue = 0x6666; gdk_gc_set_rgb_fg_color (priv->shadow_gc, &color); - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); + gtk_widget_set_realized (widget, TRUE); } static void diff --git a/katze/katze-throbber.c b/katze/katze-throbber.c index 28466259..99563353 100644 --- a/katze/katze-throbber.c +++ b/katze/katze-throbber.c @@ -18,6 +18,9 @@ #if !GTK_CHECK_VERSION (2, 18, 0) #define gtk_widget_get_allocation (wdgt, alloc) *alloc = wdgt->allocation + #define gtk_widget_set_has_window(wdgt, wnd) \ + if (wnd) GTK_WIDGET_UNSET_FLAGS (wdgt, GTK_NO_WINDOW); \ + else GTK_WIDGET_SET_FLAGS (wdgt, GTK_NO_WINDOW) #endif struct _KatzeThrobber @@ -202,7 +205,7 @@ katze_throbber_class_init (KatzeThrobberClass* class) static void katze_throbber_init (KatzeThrobber *throbber) { - GTK_WIDGET_SET_FLAGS (throbber, GTK_NO_WINDOW); + gtk_widget_set_has_window (GTK_WIDGET (throbber), FALSE); throbber->timer_id = -1; } diff --git a/katze/katze-utils.c b/katze/katze-utils.c index 63c69e48..65b07631 100644 --- a/katze/katze-utils.c +++ b/katze/katze-utils.c @@ -29,6 +29,10 @@ #include #endif +#if !GTK_CHECK_VERSION (2, 18, 0) + #define gtk_widget_get_has_window(wdgt) !GTK_WIDGET_NO_WINDOW (wdgt) +#endif + static void proxy_toggle_button_toggled_cb (GtkToggleButton* button, GObject* object) @@ -923,7 +927,7 @@ katze_widget_popup_position_menu (GtkMenu* menu, gint widget_height; /* Retrieve size and position of both widget and menu */ - if (GTK_WIDGET_NO_WINDOW (widget)) + if (!gtk_widget_get_has_window (widget)) { gdk_window_get_position (widget->window, &wx, &wy); wx += widget->allocation.x;