summaryrefslogtreecommitdiff
path: root/savers/gs-theme-engine.c
diff options
context:
space:
mode:
authorinfirit <[email protected]>2015-07-09 12:08:18 +0200
committerinfirit <[email protected]>2015-07-09 12:15:32 +0200
commit72dd61aa3a3a98bf38c2cc3aa7e36f99b620be24 (patch)
tree4e76ed8e327a98bb4a89876a5747b1ea375fda07 /savers/gs-theme-engine.c
parenta3c426e1e81dc56f4fdd56f8c736125798fec26b (diff)
downloadmate-screensaver-72dd61aa3a3a98bf38c2cc3aa7e36f99b620be24.tar.bz2
mate-screensaver-72dd61aa3a3a98bf38c2cc3aa7e36f99b620be24.tar.xz
Use accessor functions instead of direct access
Make Gtk2 build with GSEAL_ENABLE And cut down on ifdef hell.
Diffstat (limited to 'savers/gs-theme-engine.c')
-rw-r--r--savers/gs-theme-engine.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/savers/gs-theme-engine.c b/savers/gs-theme-engine.c
index 18ebfad..900d95d 100644
--- a/savers/gs-theme-engine.c
+++ b/savers/gs-theme-engine.c
@@ -31,10 +31,6 @@
#include "gs-theme-engine.h"
#include "gs-theme-engine-marshal.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define GTK_WIDGET_VISIBLE gtk_widget_get_visible
-#endif
-
static void gs_theme_engine_class_init (GSThemeEngineClass *klass);
static void gs_theme_engine_init (GSThemeEngine *engine);
static void gs_theme_engine_finalize (GObject *object);
@@ -126,17 +122,13 @@ gs_theme_engine_clear (GtkWidget *widget)
g_return_if_fail (GS_IS_THEME_ENGINE (widget));
- if (! GTK_WIDGET_VISIBLE (widget))
+ if (! gtk_widget_get_visible (widget))
{
return;
}
state = (GtkStateType) 0;
-#if GTK_CHECK_VERSION (3, 0, 0)
while (state < (GtkStateType) G_N_ELEMENTS (gtk_widget_get_style (widget)->bg))
-#else
- while (state < (GtkStateType) G_N_ELEMENTS (widget->style->bg))
-#endif
{
gtk_widget_modify_bg (widget, state, &color);
state++;
@@ -145,10 +137,10 @@ gs_theme_engine_clear (GtkWidget *widget)
#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_set_background (gtk_widget_get_window (widget), &color);
#else
- colormap = gdk_drawable_get_colormap (widget->window);
+ colormap = gdk_drawable_get_colormap (gtk_widget_get_window (widget));
gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE);
- gdk_window_set_background (widget->window, &color);
- gdk_window_clear (widget->window);
+ gdk_window_set_background (gtk_widget_get_window (widget), &color);
+ gdk_window_clear (gtk_widget_get_window (widget));
#endif
gdk_flush ();
}
@@ -218,24 +210,20 @@ gs_theme_engine_get_window_size (GSThemeEngine *engine,
g_return_if_fail (GS_IS_THEME_ENGINE (engine));
- if (! GTK_WIDGET_VISIBLE (GTK_WIDGET (engine)))
+ if (! gtk_widget_get_visible (GTK_WIDGET (engine)))
{
return;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_get_geometry (gtk_widget_get_window (GTK_WIDGET (engine)),
NULL,
NULL,
width,
- height);
-#else
- gdk_window_get_geometry (GTK_WIDGET (engine)->window,
- NULL,
- NULL,
- width,
+#if !GTK_CHECK_VERSION (3, 0, 0)
height,
- NULL);
+ NULL);
+#else
+ height);
#endif
}
@@ -244,9 +232,5 @@ gs_theme_engine_get_window (GSThemeEngine *engine)
{
g_return_val_if_fail (GS_IS_THEME_ENGINE (engine), NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
return gtk_widget_get_window (GTK_WIDGET (engine));
-#else
- return GTK_WIDGET (engine)->window;
-#endif
}