summaryrefslogtreecommitdiff
path: root/savers
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
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')
-rw-r--r--savers/floaters.c10
-rw-r--r--savers/gs-theme-engine.c34
-rw-r--r--savers/gs-theme-window.c12
-rw-r--r--savers/gste-popsquares.c8
-rw-r--r--savers/gste-slideshow.c8
5 files changed, 14 insertions, 58 deletions
diff --git a/savers/floaters.c b/savers/floaters.c
index b693ed5..c2f4bc4 100644
--- a/savers/floaters.c
+++ b/savers/floaters.c
@@ -41,10 +41,6 @@
#include "gs-theme-window.h"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define GTK_WIDGET_REALIZED gtk_widget_get_realized
-#endif
-
#ifndef trunc
#define trunc(x) (((x) > 0.0) ? floor((x)) : -floor(-(x)))
#endif
@@ -1042,7 +1038,7 @@ screen_saver_on_expose_event (ScreenSaver *screen_saver,
screen_saver_create_floaters (screen_saver);
#if !GTK_CHECK_VERSION (3, 0, 0)
- context = gdk_cairo_create (screen_saver->drawing_area->window);
+ context = gdk_cairo_create (gtk_widget_get_window (screen_saver->drawing_area));
cairo_rectangle (context,
(double) event->area.x,
@@ -1107,7 +1103,7 @@ screen_saver_update_state (ScreenSaver *screen_saver,
screen_saver_floater_update_state (screen_saver, floater, time);
- if (GTK_WIDGET_REALIZED (screen_saver->drawing_area)
+ if (gtk_widget_get_realized (screen_saver->drawing_area)
&& (floater->bounds.width > 0) && (floater->bounds.height > 0))
{
gint size;
@@ -1282,7 +1278,7 @@ main (int argc,
gtk_widget_override_background_color (drawing_area, 0, &bg);
gtk_widget_override_color (drawing_area, 0, &fg);
#else
- style = drawing_area->style;
+ style = gtk_widget_get_style (drawing_area);
state = (GtkStateType) 0;
while (state < (GtkStateType) G_N_ELEMENTS (style->bg))
{
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
}
diff --git a/savers/gs-theme-window.c b/savers/gs-theme-window.c
index aa35476..089a7f2 100644
--- a/savers/gs-theme-window.c
+++ b/savers/gs-theme-window.c
@@ -178,27 +178,15 @@ gs_theme_window_real_realize (GtkWidget *widget)
return;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_style_set_background (gtk_widget_get_style (widget),
-#else
- gtk_style_set_background (widget->style,
-#endif
window,
GTK_STATE_NORMAL);
gdk_window_set_decorations (window, (GdkWMDecoration) 0);
gdk_window_set_events (window, gdk_window_get_events (window) | event_mask);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_window (widget, window);
-#else
- widget->window = window;
-#endif
gdk_window_set_user_data (window, widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_realized (widget, TRUE);
-#else
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-#endif
#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_get_geometry (window, &x, &y, &width, &height);
diff --git a/savers/gste-popsquares.c b/savers/gste-popsquares.c
index 200c8ad..db7c36f 100644
--- a/savers/gste-popsquares.c
+++ b/savers/gste-popsquares.c
@@ -323,19 +323,11 @@ set_colors (GdkWindow *window,
widget = gtk_invisible_new ();
-#if GTK_CHECK_VERSION (3, 0, 0)
color = gtk_widget_get_style (widget)->dark [GTK_STATE_SELECTED];
-#else
- color = widget->style->dark [GTK_STATE_SELECTED];
-#endif
fg->red = color.red;
fg->green = color.green;
fg->blue = color.blue;
-#if GTK_CHECK_VERSION (3, 0, 0)
color = gtk_widget_get_style (widget)->bg [GTK_STATE_SELECTED];
-#else
- color = widget->style->bg [GTK_STATE_SELECTED];
-#endif
bg->red = color.red;
bg->green = color.green;
bg->blue = color.blue;
diff --git a/savers/gste-slideshow.c b/savers/gste-slideshow.c
index 4bc5dbb..72ca87b 100644
--- a/savers/gste-slideshow.c
+++ b/savers/gste-slideshow.c
@@ -194,7 +194,7 @@ start_fade (GSTESlideshow *show,
gdk_pixbuf_get_height (colored),
pixbuf, 0, 0);
#else
- pixmap = gdk_pixmap_new (NULL, ph, pw, gdk_visual_get_system ()->depth);
+ pixmap = gdk_pixmap_new (NULL, ph, pw, gdk_visual_get_depth (gdk_visual_get_system ()));
gdk_draw_pixbuf (pixmap, NULL, colored, 0, 0, 0, 0, -1, -1, GDK_RGB_DITHER_MAX, 0, 0);
gdk_pixbuf_get_from_drawable (pixbuf, pixmap, NULL, 0, 0, 0, 0, -1, -1);
@@ -339,7 +339,7 @@ update_display (GSTESlideshow *show)
gtk_widget_queue_draw (GTK_WIDGET (show));
#else
/* paint the image buffer into the window */
- cr = gdk_cairo_create (GTK_WIDGET (show)->window);
+ cr = gdk_cairo_create (gtk_widget_get_window (GTK_WIDGET (show)));
cairo_set_source_surface (cr, show->priv->surf, 0, 0);
@@ -951,11 +951,7 @@ gste_slideshow_real_configure (GtkWidget *widget,
cairo_surface_destroy (show->priv->surf);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
cr = gdk_cairo_create (gtk_widget_get_window (widget));
-#else
- cr = gdk_cairo_create (widget->window);
-#endif
show->priv->surf = cairo_surface_create_similar (cairo_get_target (cr),
CAIRO_CONTENT_COLOR,
show->priv->window_width,