Accessors instead of widget flag macros in Katze

This commit is contained in:
Christian Dywan 2010-02-19 17:05:54 +01:00
parent cd855b7cde
commit fa66334289
3 changed files with 17 additions and 4 deletions

View file

@ -28,6 +28,12 @@
#if !GTK_CHECK_VERSION (2, 18, 0) #if !GTK_CHECK_VERSION (2, 18, 0)
#define gtk_widget_set_window(wdgt, wndw) wdgt->window = wndw #define gtk_widget_set_window(wdgt, wndw) wdgt->window = wndw
#define gtk_widget_get_allocation (wdgt, alloc) *alloc = wdgt->allocation #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 #endif
#define DEFAULT_INTERVAL 50 #define DEFAULT_INTERVAL 50
@ -277,7 +283,7 @@ on_expose_event (GtkWidget* widget,
KatzeScrolledPrivate* priv = scrolled->priv; KatzeScrolledPrivate* priv = scrolled->priv;
gboolean ret = FALSE; gboolean ret = FALSE;
if (GTK_WIDGET_DRAWABLE (widget)) if (gtk_widget_is_drawable (widget))
{ {
if (event->window == priv->horizontal_scrollbar_window) if (event->window == priv->horizontal_scrollbar_window)
{ {
@ -904,7 +910,7 @@ katze_scrolled_realize (GtkWidget* widget)
color.red = color.green = color.blue = 0x6666; color.red = color.green = color.blue = 0x6666;
gdk_gc_set_rgb_fg_color (priv->shadow_gc, &color); 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 static void

View file

@ -18,6 +18,9 @@
#if !GTK_CHECK_VERSION (2, 18, 0) #if !GTK_CHECK_VERSION (2, 18, 0)
#define gtk_widget_get_allocation (wdgt, alloc) *alloc = wdgt->allocation #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 #endif
struct _KatzeThrobber struct _KatzeThrobber
@ -202,7 +205,7 @@ katze_throbber_class_init (KatzeThrobberClass* class)
static void static void
katze_throbber_init (KatzeThrobber *throbber) 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; throbber->timer_id = -1;
} }

View file

@ -29,6 +29,10 @@
#include <hildon/hildon.h> #include <hildon/hildon.h>
#endif #endif
#if !GTK_CHECK_VERSION (2, 18, 0)
#define gtk_widget_get_has_window(wdgt) !GTK_WIDGET_NO_WINDOW (wdgt)
#endif
static void static void
proxy_toggle_button_toggled_cb (GtkToggleButton* button, proxy_toggle_button_toggled_cb (GtkToggleButton* button,
GObject* object) GObject* object)
@ -923,7 +927,7 @@ katze_widget_popup_position_menu (GtkMenu* menu,
gint widget_height; gint widget_height;
/* Retrieve size and position of both widget and menu */ /* 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); gdk_window_get_position (widget->window, &wx, &wy);
wx += widget->allocation.x; wx += widget->allocation.x;