summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-11-20 23:35:35 +0300
committermonsta <[email protected]>2016-11-20 23:35:35 +0300
commit030632057c5c65a46d218c9ed2ffed5277513c6e (patch)
tree5c642707d54df4c9fef0dd20d7e77e6dea41fd35 /src
parentcceaaea0b336b9d288ac9399979427f5fd78b74d (diff)
downloadmate-screensaver-030632057c5c65a46d218c9ed2ffed5277513c6e.tar.bz2
mate-screensaver-030632057c5c65a46d218c9ed2ffed5277513c6e.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require libmatekbd and libmate-desktop >= 1.17
Diffstat (limited to 'src')
-rw-r--r--src/copy-theme-dialog.c35
-rw-r--r--src/gs-fade.c184
-rw-r--r--src/gs-fade.h2
-rw-r--r--src/gs-grab-x11.c28
-rw-r--r--src/gs-job.c16
-rw-r--r--src/gs-listener-dbus.h2
-rw-r--r--src/gs-lock-plug.c191
-rw-r--r--src/gs-lock-plug.h2
-rw-r--r--src/gs-manager.c64
-rw-r--r--src/gs-monitor.h2
-rw-r--r--src/gs-prefs.h2
-rw-r--r--src/gs-theme-manager.h2
-rw-r--r--src/gs-visual-gl.c8
-rw-r--r--src/gs-watcher-x11.c1
-rw-r--r--src/gs-watcher.h2
-rw-r--r--src/gs-window-x11.c329
-rw-r--r--src/gs-window.h5
-rw-r--r--src/mate-screensaver-dialog.c2
-rw-r--r--src/mate-screensaver-preferences.c105
-rw-r--r--src/mate-screensaver.h2
-rw-r--r--src/setuid.h2
-rw-r--r--src/subprocs.h1
22 files changed, 25 insertions, 962 deletions
diff --git a/src/copy-theme-dialog.c b/src/copy-theme-dialog.c
index d096237..820bde0 100644
--- a/src/copy-theme-dialog.c
+++ b/src/copy-theme-dialog.c
@@ -207,11 +207,7 @@ copy_theme_dialog_init (CopyThemeDialog *dlg)
4);
gtk_box_set_spacing (GTK_BOX (dialog_vbox), 4);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-#else
- vbox = gtk_vbox_new (FALSE, 6);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_box_pack_start (GTK_BOX (dialog_vbox), vbox, TRUE, TRUE, 0);
@@ -220,20 +216,11 @@ copy_theme_dialog_init (CopyThemeDialog *dlg)
gtk_label_set_markup (GTK_LABEL (dlg->priv->status), markup);
g_free (markup);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (dlg->priv->status, GTK_ALIGN_START);
gtk_widget_set_valign (dlg->priv->status, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (dlg->priv->status), 0.0, 0.0);
-#endif
-
gtk_box_pack_start (GTK_BOX (vbox), dlg->priv->status, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- hbox = gtk_hbox_new (FALSE, 0);
-#endif
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
table = gtk_table_new (2, 2, FALSE);
@@ -251,11 +238,7 @@ copy_theme_dialog_init (CopyThemeDialog *dlg)
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
progress_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- progress_vbox = gtk_vbox_new (FALSE, 0);
-#endif
gtk_box_set_homogeneous (GTK_BOX (progress_vbox), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), progress_vbox, FALSE, FALSE, 0);
@@ -266,11 +249,7 @@ copy_theme_dialog_init (CopyThemeDialog *dlg)
dlg->priv->current = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (progress_vbox),
dlg->priv->current, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (dlg->priv->current, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (dlg->priv->current), 0.0, 0.5);
-#endif
gtk_dialog_add_button (GTK_DIALOG (dlg),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
@@ -535,12 +514,7 @@ eel_gtk_label_make_bold (GtkLabel *label)
* theme or user prefs, since the font desc only has the
* weight flag turned on.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_override_font (GTK_WIDGET (label), font_desc);
-#else
- gtk_widget_modify_font (GTK_WIDGET (label), font_desc);
-#endif
-
pango_font_description_free (font_desc);
}
@@ -553,12 +527,9 @@ create_titled_label (GtkTable *table,
{
*title_widget = gtk_label_new ("");
eel_gtk_label_make_bold (GTK_LABEL (*title_widget));
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (*title_widget, GTK_ALIGN_END);
gtk_widget_set_valign (*title_widget, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (*title_widget), 1, 0);
-#endif
+
gtk_table_attach (table, *title_widget,
0, 1,
row, row + 1,
@@ -574,10 +545,6 @@ create_titled_label (GtkTable *table,
GTK_FILL | GTK_EXPAND, 0,
0, 0);
gtk_widget_show (*label_text_widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (*label_text_widget, GTK_ALIGN_START);
gtk_widget_set_valign (*label_text_widget, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (*label_text_widget), 0, 0);
-#endif
}
diff --git a/src/gs-fade.c b/src/gs-fade.c
index c037718..d775918 100644
--- a/src/gs-fade.c
+++ b/src/gs-fade.c
@@ -82,20 +82,10 @@ struct GSFadeScreenPrivate
/* one per screen also */
XF86VidModeGamma vmg;
#endif /* HAVE_XF86VMODE_GAMMA */
-#if GTK_CHECK_VERSION(3, 10, 0)
gboolean (*fade_setup) (GSFade *fade);
gboolean (*fade_set_alpha_gamma) (GSFade *fade,
gdouble alpha);
void (*fade_finish) (GSFade *fade);
-#else
- gboolean (*fade_setup) (GSFade *fade,
- int screen);
- gboolean (*fade_set_alpha_gamma) (GSFade *fade,
- int screen,
- gdouble alpha);
- void (*fade_finish) (GSFade *fade,
- int screen);
-#endif
};
struct GSFadePrivate
@@ -112,13 +102,7 @@ struct GSFadePrivate
gdouble alpha_per_iter;
gdouble current_alpha;
-#if GTK_CHECK_VERSION(3, 10, 0)
struct GSFadeScreenPrivate screen_priv;
-#else
- int num_screens;
-
- struct GSFadeScreenPrivate *screen_priv;
-#endif
};
enum
@@ -297,20 +281,12 @@ gs_fade_set_enabled (GSFade *fade,
#ifdef HAVE_XF86VMODE_GAMMA
static gboolean
-#if GTK_CHECK_VERSION(3, 10, 0)
gamma_fade_setup (GSFade *fade)
-#else
-gamma_fade_setup (GSFade *fade, int screen_idx)
-#endif
{
gboolean res;
struct GSFadeScreenPrivate *screen_priv;
-#if GTK_CHECK_VERSION(3, 10, 0)
screen_priv = &fade->priv->screen_priv;
-#else
- screen_priv = &fade->priv->screen_priv[screen_idx];
-#endif
if (screen_priv->info)
return TRUE;
@@ -334,11 +310,7 @@ gamma_fade_setup (GSFade *fade, int screen_idx)
res = XF86VidModeGetGammaRampSize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
-#if GTK_CHECK_VERSION(3, 10, 0)
gdk_screen_get_number (gdk_screen_get_default ()),
-#else
- screen_idx,
-#endif
&screen_priv->info->size);
if (!res || screen_priv->info->size <= 0)
{
@@ -357,11 +329,7 @@ gamma_fade_setup (GSFade *fade, int screen_idx)
}
res = XF86VidModeGetGammaRamp (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
-#if GTK_CHECK_VERSION(3, 10, 0)
gdk_screen_get_number (gdk_screen_get_default ()),
-#else
- screen_idx,
-#endif
screen_priv->info->size,
screen_priv->info->r,
screen_priv->info->g,
@@ -381,11 +349,7 @@ test_number:
/* only have gamma parameter, not ramps. */
res = XF86VidModeGetGamma (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
-#if GTK_CHECK_VERSION(3, 10, 0)
gdk_screen_get_number (gdk_screen_get_default ()),
-#else
- screen_idx,
-#endif
&screen_priv->vmg);
if (! res)
{
@@ -412,19 +376,11 @@ FAIL:
#endif /* HAVE_XF86VMODE_GAMMA */
static void
-#if GTK_CHECK_VERSION(3, 10, 0)
screen_fade_finish (GSFade *fade)
-#else
-screen_fade_finish (GSFade *fade, int screen_idx)
-#endif
{
struct GSFadeScreenPrivate *screen_priv;
int i;
-#if GTK_CHECK_VERSION(3, 10, 0)
screen_priv = &fade->priv->screen_priv;
-#else
- screen_priv = &fade->priv->screen_priv[screen_idx];
-#endif
if (!screen_priv->info)
return;
@@ -447,33 +403,20 @@ screen_fade_finish (GSFade *fade, int screen_idx)
#ifdef HAVE_XF86VMODE_GAMMA
static gboolean
gamma_fade_set_alpha_gamma (GSFade *fade,
-#if !GTK_CHECK_VERSION(3, 10, 0)
- int screen_idx,
-#endif
gdouble alpha)
{
struct GSFadeScreenPrivate *screen_priv;
-#if GTK_CHECK_VERSION(3, 10, 0)
int screen_idx = gdk_screen_get_number (gdk_screen_get_default ());
screen_priv = &fade->priv->screen_priv;
xf86_whack_gamma (screen_idx, screen_priv, alpha);
-#else
-
- screen_priv = &fade->priv->screen_priv[screen_idx];
- xf86_whack_gamma (screen_idx, screen_priv, alpha);
-#endif
return TRUE;
}
#endif /* HAVE_XF86VMODE_GAMMA */
static void
-#if GTK_CHECK_VERSION(3, 10, 0)
check_gamma_extension (GSFade *fade)
-#else
-check_gamma_extension (GSFade *fade, int screen_idx)
-#endif
{
struct GSFadeScreenPrivate *screen_priv;
#ifdef HAVE_XF86VMODE_GAMMA
@@ -484,11 +427,7 @@ check_gamma_extension (GSFade *fade, int screen_idx)
gboolean res;
#endif /* HAVE_XF86VMODE_GAMMA */
-#if GTK_CHECK_VERSION(3, 10, 0)
screen_priv = &fade->priv->screen_priv;
-#else
- screen_priv = &fade->priv->screen_priv[screen_idx];
-#endif
#ifdef HAVE_XF86VMODE_GAMMA
res = XF86VidModeQueryExtension (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &event, &error);
@@ -526,11 +465,7 @@ fade_none:
/* Xrandr support */
-#if GTK_CHECK_VERSION(3, 10, 0)
static gboolean xrandr_fade_setup (GSFade *fade)
-#else
-static gboolean xrandr_fade_setup (GSFade *fade, int screen_idx)
-#endif
{
struct GSFadeScreenPrivate *screen_priv;
MateRRCrtc *crtc;
@@ -539,11 +474,7 @@ static gboolean xrandr_fade_setup (GSFade *fade, int screen_idx)
struct GSGammaInfo *info;
gboolean res;
-#if GTK_CHECK_VERSION(3, 10, 0)
screen_priv = &fade->priv->screen_priv;
-#else
- screen_priv = &fade->priv->screen_priv[screen_idx];
-#endif
if (screen_priv->info)
return TRUE;
@@ -632,9 +563,6 @@ static void xrandr_crtc_whack_gamma (MateRRCrtc *crtc,
}
static gboolean xrandr_fade_set_alpha_gamma (GSFade *fade,
-#if !GTK_CHECK_VERSION(3, 10, 0)
- int screen_idx,
-#endif
gdouble alpha)
{
struct GSFadeScreenPrivate *screen_priv;
@@ -642,11 +570,7 @@ static gboolean xrandr_fade_set_alpha_gamma (GSFade *fade,
MateRRCrtc **crtcs;
int i;
-#if GTK_CHECK_VERSION(3, 10, 0)
screen_priv = &fade->priv->screen_priv;
-#else
- screen_priv = &fade->priv->screen_priv[screen_idx];
-#endif
if (!screen_priv->info)
return FALSE;
@@ -665,25 +589,13 @@ static gboolean xrandr_fade_set_alpha_gamma (GSFade *fade,
}
static void
-#if GTK_CHECK_VERSION(3, 10, 0)
check_randr_extension (GSFade *fade)
-#else
-check_randr_extension (GSFade *fade, int screen_idx)
-#endif
{
GdkDisplay *display = gdk_display_get_default ();
-#if GTK_CHECK_VERSION(3, 10, 0)
GdkScreen *screen = gdk_display_get_default_screen (display);
-#else
- GdkScreen *screen = gdk_display_get_screen (display, screen_idx);
-#endif
struct GSFadeScreenPrivate *screen_priv;
-#if GTK_CHECK_VERSION(3, 10, 0)
screen_priv = &fade->priv->screen_priv;
-#else
- screen_priv = &fade->priv->screen_priv[screen_idx];
-#endif
screen_priv->rrscreen = mate_rr_screen_new (screen,
NULL);
@@ -704,7 +616,6 @@ gs_fade_set_alpha (GSFade *fade,
gdouble alpha)
{
gboolean ret = FALSE;
-#if GTK_CHECK_VERSION (3, 10, 0)
switch (fade->priv->screen_priv.fade_type)
{
@@ -721,28 +632,7 @@ gs_fade_set_alpha (GSFade *fade,
ret = FALSE;
break;
}
-#else
- int i;
- for (i = 0; i < fade->priv->num_screens; i++)
- {
- switch (fade->priv->screen_priv[i].fade_type)
- {
- case FADE_TYPE_GAMMA_RAMP:
- case FADE_TYPE_GAMMA_NUMBER:
- case FADE_TYPE_XRANDR:
- ret = fade->priv->screen_priv[i].fade_set_alpha_gamma (fade, i, alpha);
- break;
- case FADE_TYPE_NONE:
- ret = FALSE;
- break;
- default:
- g_warning ("Unknown fade type");
- ret = FALSE;
- break;
- }
- }
-#endif
return ret;
}
@@ -835,33 +725,16 @@ gs_fade_start (GSFade *fade,
{
guint steps_per_sec = 60;
guint msecs_per_step;
-#if !GTK_CHECK_VERSION (3, 10, 0)
- struct GSFadeScreenPrivate *screen_priv;
- int i;
-#endif
gboolean active_fade, res;
g_return_if_fail (GS_IS_FADE (fade));
-#if GTK_CHECK_VERSION (3, 10, 0)
if (fade->priv->screen_priv.fade_type != FADE_TYPE_NONE)
{
res = fade->priv->screen_priv.fade_setup (fade);
if (res == FALSE)
return;
}
-#else
- for (i = 0; i < fade->priv->num_screens; i++)
- {
- screen_priv = &fade->priv->screen_priv[i];
- if (screen_priv->fade_type != FADE_TYPE_NONE)
- {
- res = screen_priv->fade_setup (fade, i);
- if (res == FALSE)
- return;
- }
- }
-#endif
if (fade->priv->timer_id > 0)
{
@@ -873,17 +746,8 @@ gs_fade_start (GSFade *fade,
gs_fade_set_timeout (fade, timeout);
active_fade = FALSE;
-#if GTK_CHECK_VERSION (3, 10, 0)
if (fade->priv->screen_priv.fade_type != FADE_TYPE_NONE)
active_fade = TRUE;
-#else
- for (i = 0; i < fade->priv->num_screens; i++)
- {
- screen_priv = &fade->priv->screen_priv[i];
- if (screen_priv->fade_type != FADE_TYPE_NONE)
- active_fade = TRUE;
- }
-#endif
if (active_fade)
{
@@ -992,9 +856,6 @@ gs_fade_sync (GSFade *fade,
void
gs_fade_reset (GSFade *fade)
{
-#if !GTK_CHECK_VERSION(3, 10, 0)
- int i;
-#endif
g_return_if_fail (GS_IS_FADE (fade));
gs_debug ("Resetting fade");
@@ -1008,14 +869,8 @@ gs_fade_reset (GSFade *fade)
gs_fade_set_alpha (fade, fade->priv->current_alpha);
-#if GTK_CHECK_VERSION (3, 10, 0)
if (fade->priv->screen_priv.fade_type != FADE_TYPE_NONE)
fade->priv->screen_priv.fade_finish (fade);
-#else
- for (i = 0; i < fade->priv->num_screens; i++)
- if (fade->priv->screen_priv[i].fade_type != FADE_TYPE_NONE)
- fade->priv->screen_priv[i].fade_finish (fade, i);
-#endif
}
static void
@@ -1042,42 +897,21 @@ gs_fade_class_init (GSFadeClass *klass)
static void
gs_fade_init (GSFade *fade)
{
-#if !GTK_CHECK_VERSION (3, 10, 0)
- int i;
-#endif
-
fade->priv = GS_FADE_GET_PRIVATE (fade);
fade->priv->timeout = 1000;
fade->priv->current_alpha = 1.0;
-#if GTK_CHECK_VERSION (3, 10, 0)
check_randr_extension (fade);
if (!fade->priv->screen_priv.fade_type)
check_gamma_extension (fade);
gs_debug ("Fade type: %d", fade->priv->screen_priv.fade_type);
-#else
- fade->priv->num_screens = gdk_display_get_n_screens (gdk_display_get_default ());
-
- fade->priv->screen_priv = g_new0 (struct GSFadeScreenPrivate, fade->priv->num_screens);
-
- for (i = 0; i < fade->priv->num_screens; i++)
- {
- check_randr_extension (fade, i);
- if (!fade->priv->screen_priv[i].fade_type)
- check_gamma_extension (fade, i);
- gs_debug ("Fade type: %d", fade->priv->screen_priv[i].fade_type);
- }
-#endif
}
static void
gs_fade_finalize (GObject *object)
{
GSFade *fade;
-#if !GTK_CHECK_VERSION (3, 10, 0)
- int i;
-#endif
g_return_if_fail (object != NULL);
g_return_if_fail (GS_IS_FADE (object));
@@ -1086,29 +920,11 @@ gs_fade_finalize (GObject *object)
g_return_if_fail (fade->priv != NULL);
-#if GTK_CHECK_VERSION (3, 10, 0)
fade->priv->screen_priv.fade_finish(fade);
if (fade->priv->screen_priv.rrscreen)
g_object_unref (fade->priv->screen_priv.rrscreen);
fade->priv->screen_priv.rrscreen = NULL;
-#else
- for (i = 0; i < fade->priv->num_screens; i++)
- fade->priv->screen_priv[i].fade_finish(fade, i);
-
- if (fade->priv->screen_priv)
- {
- for (i = 0; i < fade->priv->num_screens; i++)
- {
- if (!fade->priv->screen_priv[i].rrscreen)
- continue;
- g_object_unref (fade->priv->screen_priv[i].rrscreen);
- }
-
- g_free (fade->priv->screen_priv);
- fade->priv->screen_priv = NULL;
- }
-#endif
G_OBJECT_CLASS (gs_fade_parent_class)->finalize (object);
}
diff --git a/src/gs-fade.h b/src/gs-fade.h
index 4d3df66..83a8f4a 100644
--- a/src/gs-fade.h
+++ b/src/gs-fade.h
@@ -23,6 +23,8 @@
#ifndef __GS_FADE_H
#define __GS_FADE_H
+#include <glib.h>
+
G_BEGIN_DECLS
#define GS_TYPE_FADE (gs_fade_get_type ())
diff --git a/src/gs-grab-x11.c b/src/gs-grab-x11.c
index 4fe4901..5163995 100644
--- a/src/gs-grab-x11.c
+++ b/src/gs-grab-x11.c
@@ -125,11 +125,7 @@ xorg_lock_smasher_set_active (GSGrab *grab,
status = XF86MiscSetGrabKeysState (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), active);
gdk_display_sync (gdk_display_get_default ());
-#if GTK_CHECK_VERSION (3, 0, 0)
error = gdk_error_trap_pop ();
-#else
- gdk_error_trap_pop ();
-#endif
if (active && status == MiscExtGrabStateAlready)
{
@@ -137,7 +133,6 @@ xorg_lock_smasher_set_active (GSGrab *grab,
status = MiscExtGrabStateSuccess;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
if (error == Success) {
gs_debug ("XF86MiscSetGrabKeysState(%s) returned %s\n",
active ? "on" : "off",
@@ -149,14 +144,6 @@ xorg_lock_smasher_set_active (GSGrab *grab,
gs_debug ("XF86MiscSetGrabKeysState(%s) failed with error code %d\n",
active ? "on" : "off", error);
}
-#else
- gs_debug ("XF86MiscSetGrabKeysState(%s) returned %s\n",
- active ? "on" : "off",
- (status == MiscExtGrabStateSuccess ? "MiscExtGrabStateSuccess" :
- status == MiscExtGrabStateLocked ? "MiscExtGrabStateLocked" :
- status == MiscExtGrabStateAlready ? "MiscExtGrabStateAlready" :
- "unknown value"));
-#endif
}
#else
static void
@@ -244,11 +231,7 @@ gs_grab_get_mouse (GSGrab *grab,
grab->priv->mouse_hide_cursor = hide_cursor;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (G_OBJECT (cursor));
-#else
- gdk_cursor_unref (cursor);
-#endif
return status;
}
@@ -451,12 +434,7 @@ gs_grab_nuke_focus (void)
XGetInputFocus (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &focus, &rev);
XSetInputFocus (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), None, RevertToNone, CurrentTime);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_display_sync (gdk_display_get_default ());
- gdk_error_trap_pop ();
-#endif
}
void
@@ -573,24 +551,18 @@ gs_grab_grab_root (GSGrab *grab,
GdkDisplay *display;
GdkWindow *root;
GdkScreen *screen;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDevice *device;
-#endif
gboolean res;
gs_debug ("Grabbing the root window");
display = gdk_display_get_default ();
-#if GTK_CHECK_VERSION (3, 0, 0)
#if GTK_CHECK_VERSION (3, 20, 0)
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
#else
device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
#endif
gdk_device_get_position (device, &screen, NULL, NULL);
-#else
- gdk_display_get_pointer (display, &screen, NULL, NULL, NULL);
-#endif
root = gdk_screen_get_root_window (screen);
res = gs_grab_grab_window (grab, root, screen, hide_cursor);
diff --git a/src/gs-job.c b/src/gs-job.c
index 4296f64..009de4d 100644
--- a/src/gs-job.c
+++ b/src/gs-job.c
@@ -339,7 +339,6 @@ spawn_on_widget (GtkWidget *widget,
env = get_env_vars (widget);
error = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
result = g_spawn_async_with_pipes (NULL,
argv,
(char **)env->pdata,
@@ -351,20 +350,7 @@ spawn_on_widget (GtkWidget *widget,
NULL,
&standard_error,
&error);
-#else
- result = gdk_spawn_on_screen_with_pipes (gtk_widget_get_screen (widget),
- NULL,
- argv,
- (char **)env->pdata,
- G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
- NULL,
- NULL,
- &child_pid,
- NULL,
- NULL,
- &standard_error,
- &error);
-#endif
+
for (i = 0; i < env->len; i++)
{
g_free (g_ptr_array_index (env, i));
diff --git a/src/gs-listener-dbus.h b/src/gs-listener-dbus.h
index a7cd04f..f86e75e 100644
--- a/src/gs-listener-dbus.h
+++ b/src/gs-listener-dbus.h
@@ -23,6 +23,8 @@
#ifndef __GS_LISTENER_H
#define __GS_LISTENER_H
+#include <glib.h>
+
G_BEGIN_DECLS
#define GS_TYPE_LISTENER (gs_listener_get_type ())
diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c
index 09aa05c..99fc547 100644
--- a/src/gs-lock-plug.c
+++ b/src/gs-lock-plug.c
@@ -36,15 +36,12 @@
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
+#include <gtk/gtkx.h>
#include <gio/gio.h>
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <libmate-desktop/mate-desktop-utils.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
-#include <gtk/gtkx.h>
-#endif
-
#ifdef WITH_KBD_LAYOUT_INDICATOR
#include <libmatekbd/matekbd-indicator.h>
#endif
@@ -627,13 +624,7 @@ gs_lock_plug_run (GSLockPlug *plug)
ri.loop = g_main_loop_new (NULL, FALSE);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GDK_THREADS_LEAVE ();
-#endif
g_main_loop_run (ri.loop);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GDK_THREADS_ENTER ();
-#endif
g_main_loop_unref (ri.loop);
@@ -720,7 +711,6 @@ rounded_rectangle (cairo_t *cr,
cairo_close_path (cr);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
/* copied from gnome-screensaver 3.x */
/**
@@ -895,83 +885,6 @@ image_set_from_pixbuf (GtkImage *image,
gtk_image_set_from_pixbuf (image, pixbuf);
g_object_unref (pixbuf);
}
-#else
-static void
-image_set_from_pixbuf (GtkImage *image,
- GdkPixbuf *source)
-{
- cairo_t *cr;
- cairo_t *cr_mask;
- cairo_surface_t *surface;
- GdkPixmap *pixmap;
- GdkPixmap *bitmask;
- int w;
- int h;
- int frame_width;
- double radius;
- GdkColor color;
- double r;
- double g;
- double b;
-
- frame_width = 5;
-
- w = gdk_pixbuf_get_width (source) + frame_width * 2;
- h = gdk_pixbuf_get_height (source) + frame_width * 2;
-
- radius = w / 10;
-
- pixmap = gdk_pixmap_new (gtk_widget_get_window (GTK_WIDGET (image)), w, h, -1);
- bitmask = gdk_pixmap_new (gtk_widget_get_window (GTK_WIDGET (image)), w, h, 1);
-
- cr = gdk_cairo_create (pixmap);
- cr_mask = gdk_cairo_create (bitmask);
-
- /* setup mask */
- cairo_rectangle (cr_mask, 0, 0, w, h);
- cairo_set_operator (cr_mask, CAIRO_OPERATOR_CLEAR);
- cairo_fill (cr_mask);
-
- rounded_rectangle (cr_mask, 1.0, 0.5, 0.5, radius, w - 1, h - 1);
- cairo_set_operator (cr_mask, CAIRO_OPERATOR_OVER);
- cairo_set_source_rgb (cr_mask, 1, 1, 1);
- cairo_fill (cr_mask);
-
- color = gtk_widget_get_style (GTK_WIDGET (image))->bg [GTK_STATE_NORMAL];
- r = (float)color.red / 65535.0;
- g = (float)color.green / 65535.0;
- b = (float)color.blue / 65535.0;
-
- /* set up image */
- cairo_rectangle (cr, 0, 0, w, h);
- cairo_set_source_rgb (cr, r, g, b);
- cairo_fill (cr);
-
- rounded_rectangle (cr,
- 1.0,
- frame_width + 0.5,
- frame_width + 0.5,
- radius,
- w - frame_width * 2 - 1,
- h - frame_width * 2 - 1);
- cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.3);
- cairo_fill_preserve (cr);
-
- surface = surface_from_pixbuf (source);
- cairo_set_source_surface (cr, surface, frame_width, frame_width);
- cairo_fill (cr);
-
- gtk_image_set_from_pixmap (image, pixmap, bitmask);
-
- cairo_surface_destroy (surface);
-
- g_object_unref (bitmask);
- g_object_unref (pixmap);
-
- cairo_destroy (cr_mask);
- cairo_destroy (cr);
-}
-#endif
static gboolean
check_user_file (const gchar *filename,
@@ -1129,41 +1042,6 @@ forward_key_events (GSLockPlug *plug)
}
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static void
-gs_lock_plug_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GSLockPlug *plug = GS_LOCK_PLUG (widget);
- int mod_width;
- int mod_height;
-
- if (GTK_WIDGET_CLASS (gs_lock_plug_parent_class)->size_request)
- {
- GTK_WIDGET_CLASS (gs_lock_plug_parent_class)->size_request (widget, requisition);
- }
-
- /* don't constrain size when themed */
- if (plug->priv->vbox == NULL)
- {
- return;
- }
-
- mod_width = requisition->height * 1.3;
- mod_height = requisition->width / 1.6;
- if (requisition->width < mod_width)
- {
- /* if the dialog is tall fill out the width */
- requisition->width = mod_width;
- }
- else if (requisition->height < mod_height)
- {
- /* if the dialog is wide fill out the height */
- requisition->height = mod_height;
- }
-}
-#endif
-
static void
gs_lock_plug_set_logout_enabled (GSLockPlug *plug,
gboolean logout_enabled)
@@ -1373,9 +1251,6 @@ gs_lock_plug_class_init (GSLockPlugClass *klass)
widget_class->style_set = gs_lock_plug_style_set;
widget_class->show = gs_lock_plug_show;
widget_class->hide = gs_lock_plug_hide;
-#if !GTK_CHECK_VERSION (3, 0, 0)
- widget_class->size_request = gs_lock_plug_size_request;
-#endif
klass->close = gs_lock_plug_close;
@@ -1571,11 +1446,7 @@ gs_lock_plug_set_busy (GSLockPlug *plug)
#endif
gdk_window_set_cursor (gtk_widget_get_window (top_level), cursor);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (cursor);
-#else
- gdk_cursor_unref (cursor);
-#endif
}
void
@@ -1596,11 +1467,7 @@ gs_lock_plug_set_ready (GSLockPlug *plug)
cursor = gdk_cursor_new (GDK_LEFT_PTR);
#endif
gdk_window_set_cursor (gtk_widget_get_window (top_level), cursor);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (cursor);
-#else
- gdk_cursor_unref (cursor);
-#endif
}
void
@@ -1942,34 +1809,18 @@ create_page_one (GSLockPlug *plug)
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *hbox;
-#if !GTK_CHECK_VERSION(3, 0, 0)
- GtkWidget *align;
-#endif
char *str;
gs_profile_start ("page one");
-#if GTK_CHECK_VERSION(3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
gtk_widget_set_halign (GTK_WIDGET (vbox),
GTK_ALIGN_CENTER);
gtk_widget_set_valign (GTK_WIDGET (vbox),
GTK_ALIGN_CENTER);
-
gtk_notebook_append_page (GTK_NOTEBOOK (plug->priv->notebook), vbox, NULL);
-#else
- align = gtk_alignment_new (0.5, 0.5, 1, 1);
- gtk_notebook_append_page (GTK_NOTEBOOK (plug->priv->notebook), align, NULL);
- vbox = gtk_vbox_new (FALSE, 12);
- gtk_container_add (GTK_CONTAINER (align), vbox);
-#endif
-
-#if GTK_CHECK_VERSION(3, 0, 0)
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- vbox2 = gtk_vbox_new (FALSE, 0);
-#endif
gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
str = g_strdup ("<span size=\"xx-large\" weight=\"ultrabold\">%s</span>");
@@ -1998,18 +1849,10 @@ create_page_one (GSLockPlug *plug)
plug->priv->auth_face_image = gtk_image_new ();
gtk_box_pack_start (GTK_BOX (vbox), plug->priv->auth_face_image, TRUE, TRUE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (plug->priv->auth_face_image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (plug->priv->auth_face_image, GTK_ALIGN_END);
-#else
- gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_face_image), 0.5, 1.0);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- vbox2 = gtk_vbox_new (FALSE, 0);
-#endif
gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
str = g_strdup ("<span size=\"x-large\">%R</span>");
@@ -2039,18 +1882,10 @@ create_page_one (GSLockPlug *plug)
gtk_label_set_use_markup (GTK_LABEL (plug->priv->auth_username_label), TRUE);
gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_username_label, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- vbox2 = gtk_vbox_new (FALSE, 0);
-#endif
gtk_box_pack_start (GTK_BOX (vbox), vbox2, TRUE, TRUE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-#else
- hbox = gtk_hbox_new (FALSE, 6);
-#endif
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
plug->priv->auth_prompt_label = gtk_label_new_with_mnemonic (_("_Password:"));
@@ -2083,11 +1918,7 @@ create_page_one (GSLockPlug *plug)
gtk_box_pack_start (GTK_BOX (vbox), plug->priv->auth_message_label,
FALSE, FALSE, 0);
/* Buttons */
-#if GTK_CHECK_VERSION(3, 0, 0)
plug->priv->auth_action_area = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
-#else
- plug->priv->auth_action_area = gtk_hbutton_box_new ();
-#endif
gtk_button_box_set_layout (GTK_BUTTON_BOX (plug->priv->auth_action_area),
GTK_BUTTONBOX_END);
@@ -2172,7 +2003,6 @@ load_theme (GSLockPlug *plug)
return FALSE;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
filename = g_strdup_printf ("lock-dialog-%s.css", theme);
g_free (theme);
@@ -2184,20 +2014,8 @@ load_theme (GSLockPlug *plug)
gtk_css_provider_load_from_path (style_provider, css, NULL);
}
g_free (css);
-#else
- filename = g_strdup_printf ("lock-dialog-%s.gtkrc", theme);
- g_free (theme);
- css = g_build_filename (GTKBUILDERDIR, filename, NULL);
- g_free (filename);
- if (g_file_test (css, G_FILE_TEST_IS_REGULAR))
- {
- gtk_rc_parse (css);
- }
- g_free (css);
-#endif
builder = gtk_builder_new();
-
if (!gtk_builder_add_from_file (builder,gtkbuilder,&error))
{
g_warning ("Couldn't load builder file '%s': %s", gtkbuilder, error->message);
@@ -2294,23 +2112,16 @@ gs_lock_plug_init (GSLockPlug *plug)
plug->priv->leave_note_enabled = FALSE;
#endif
-#if GTK_CHECK_VERSION(3, 0, 0)
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (plug));
gtk_style_context_add_class (context, "lock-dialog");
-#endif
if (! load_theme (plug))
{
gs_debug ("Unable to load theme!");
-#if GTK_CHECK_VERSION (3, 0, 0)
plug->priv->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- plug->priv->vbox = gtk_vbox_new (FALSE, 0);
-#endif
-
gtk_container_add (GTK_CONTAINER (plug), plug->priv->vbox);
/* Notebook */
diff --git a/src/gs-lock-plug.h b/src/gs-lock-plug.h
index bbbfaf8..818c8e6 100644
--- a/src/gs-lock-plug.h
+++ b/src/gs-lock-plug.h
@@ -23,6 +23,8 @@
#ifndef __GS_LOCK_PLUG_H
#define __GS_LOCK_PLUG_H
+#include <glib.h>
+
G_BEGIN_DECLS
typedef enum
diff --git a/src/gs-manager.c b/src/gs-manager.c
index 2c7490b..0f346ee 100644
--- a/src/gs-manager.c
+++ b/src/gs-manager.c
@@ -1103,9 +1103,7 @@ find_window_at_pointer (GSManager *manager)
{
GdkDisplay *display;
GdkScreen *screen;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDevice *device;
-#endif
int monitor;
int x, y;
GSWindow *window;
@@ -1114,16 +1112,12 @@ find_window_at_pointer (GSManager *manager)
display = gdk_display_get_default ();
-#if GTK_CHECK_VERSION (3, 0, 0)
#if GTK_CHECK_VERSION (3, 20, 0)
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
#else
device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
#endif
gdk_device_get_position (device, &screen, &x, &y);
-#else
- gdk_display_get_pointer (display, &screen, &x, &y, NULL);
-#endif
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
screen_num = gdk_screen_get_number (screen);
@@ -1176,24 +1170,18 @@ manager_maybe_grab_window (GSManager *manager,
{
GdkDisplay *display;
GdkScreen *screen;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDevice *device;
-#endif
int monitor;
int x, y;
gboolean grabbed;
display = gdk_display_get_default ();
-#if GTK_CHECK_VERSION (3, 0, 0)
#if GTK_CHECK_VERSION (3, 20, 0)
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
#else
device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
#endif
gdk_device_get_position (device, &screen, &x, &y);
-#else
- gdk_display_get_pointer (display, &screen, &x, &y, NULL);
-#endif
monitor = gdk_screen_get_monitor_at_point (screen, x, y);
gdk_flush ();
@@ -1277,11 +1265,7 @@ static void
apply_background_to_window (GSManager *manager,
GSWindow *window)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_surface_t *surface;
-#else
- GdkPixmap *pixmap;
-#endif
GdkScreen *screen;
int width;
int height;
@@ -1289,18 +1273,13 @@ apply_background_to_window (GSManager *manager,
if (manager->priv->bg == NULL)
{
gs_debug ("No background available");
-#if GTK_CHECK_VERSION (3, 0, 0)
gs_window_set_background_surface (window, NULL);
-#else
- gs_window_set_background_pixmap (window, NULL);
-#endif
}
screen = gs_window_get_screen (window);
width = gdk_screen_get_width (screen);
height = gdk_screen_get_height (screen);
gs_debug ("Creating background w:%d h:%d", width, height);
-#if GTK_CHECK_VERSION (3, 0, 0)
surface = mate_bg_create_surface (manager->priv->bg,
gs_window_get_gdk_window (window),
width,
@@ -1308,15 +1287,6 @@ apply_background_to_window (GSManager *manager,
FALSE);
gs_window_set_background_surface (window, surface);
cairo_surface_destroy (surface);
-#else
- pixmap = mate_bg_create_pixmap (manager->priv->bg,
- gs_window_get_gdk_window (window),
- width,
- height,
- FALSE);
- gs_window_set_background_pixmap (window, pixmap);
- g_object_unref (pixmap);
-#endif
}
static void
@@ -1666,10 +1636,6 @@ gs_manager_destroy_windows (GSManager *manager)
{
GdkDisplay *display;
GSList *l;
-#if !GTK_CHECK_VERSION (3, 10, 0)
- int n_screens;
- int i;
-#endif
g_return_if_fail (manager != NULL);
g_return_if_fail (GS_IS_MANAGER (manager));
@@ -1681,20 +1647,9 @@ gs_manager_destroy_windows (GSManager *manager)
display = gdk_display_get_default ();
-#if GTK_CHECK_VERSION (3, 10, 0)
g_signal_handlers_disconnect_by_func (gdk_display_get_default_screen (display),
on_screen_monitors_changed,
manager);
-#else
- n_screens = gdk_display_get_n_screens (display);
-
- for (i = 0; i < n_screens; i++)
- {
- g_signal_handlers_disconnect_by_func (gdk_display_get_screen (display, i),
- on_screen_monitors_changed,
- manager);
- }
-#endif
for (l = manager->priv->windows; l; l = l->next)
{
@@ -1777,10 +1732,6 @@ static void
gs_manager_create_windows (GSManager *manager)
{
GdkDisplay *display;
-#if !GTK_CHECK_VERSION (3, 10, 0)
- int n_screens;
- int i;
-#endif
g_return_if_fail (manager != NULL);
g_return_if_fail (GS_IS_MANAGER (manager));
@@ -1788,7 +1739,6 @@ gs_manager_create_windows (GSManager *manager)
g_assert (manager->priv->windows == NULL);
display = gdk_display_get_default ();
-#if GTK_CHECK_VERSION (3, 10, 0)
g_signal_connect (gdk_display_get_default_screen (display),
"monitors-changed",
G_CALLBACK (on_screen_monitors_changed),
@@ -1796,20 +1746,6 @@ gs_manager_create_windows (GSManager *manager)
gs_manager_create_windows_for_screen (manager,
gdk_display_get_default_screen (display));
-#else
- n_screens = gdk_display_get_n_screens (display);
-
- for (i = 0; i < n_screens; i++)
- {
- g_signal_connect (gdk_display_get_screen (display, i),
- "monitors-changed",
- G_CALLBACK (on_screen_monitors_changed),
- manager);
-
- gs_manager_create_windows_for_screen (manager,
- gdk_display_get_screen (display, i));
- }
-#endif
}
GSManager *
diff --git a/src/gs-monitor.h b/src/gs-monitor.h
index 75c2212..de8053e 100644
--- a/src/gs-monitor.h
+++ b/src/gs-monitor.h
@@ -23,6 +23,8 @@
#ifndef __GS_MONITOR_H
#define __GS_MONITOR_H
+#include <glib.h>
+
G_BEGIN_DECLS
#define GS_TYPE_MONITOR (gs_monitor_get_type ())
diff --git a/src/gs-prefs.h b/src/gs-prefs.h
index fd4cf73..3b5957d 100644
--- a/src/gs-prefs.h
+++ b/src/gs-prefs.h
@@ -23,6 +23,8 @@
#ifndef __GS_PREFS_H
#define __GS_PREFS_H
+#include <glib.h>
+
G_BEGIN_DECLS
#define GS_TYPE_PREFS (gs_prefs_get_type ())
diff --git a/src/gs-theme-manager.h b/src/gs-theme-manager.h
index aaaf532..5c03189 100644
--- a/src/gs-theme-manager.h
+++ b/src/gs-theme-manager.h
@@ -23,6 +23,8 @@
#ifndef __GS_THEME_MANAGER_H
#define __GS_THEME_MANAGER_H
+#include <glib.h>
+
G_BEGIN_DECLS
#define GS_TYPE_THEME_MANAGER (gs_theme_manager_get_type ())
diff --git a/src/gs-visual-gl.c b/src/gs-visual-gl.c
index 670859a..7dfe165 100644
--- a/src/gs-visual-gl.c
+++ b/src/gs-visual-gl.c
@@ -28,7 +28,6 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
-#include <gtk/gtk.h>
#ifdef HAVE_LIBGL
#include <GL/gl.h>
@@ -104,16 +103,9 @@ gs_visual_gl_get_best_for_screen (GdkScreen *screen)
}
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
#else
- gdk_display_sync (display);
- gdk_error_trap_pop ();
-#endif
-
-#else
visual = NULL;
-
#endif /* HAVE_LIBGL */
return visual;
diff --git a/src/gs-watcher-x11.c b/src/gs-watcher-x11.c
index c3c8f72..3d63863 100644
--- a/src/gs-watcher-x11.c
+++ b/src/gs-watcher-x11.c
@@ -28,7 +28,6 @@
#include <errno.h>
#include <string.h>
-#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <dbus/dbus.h>
diff --git a/src/gs-watcher.h b/src/gs-watcher.h
index 9c88723..e844fe1 100644
--- a/src/gs-watcher.h
+++ b/src/gs-watcher.h
@@ -23,6 +23,8 @@
#ifndef __GS_WATCHER_H
#define __GS_WATCHER_H
+#include <glib.h>
+
G_BEGIN_DECLS
#define GS_TYPE_WATCHER (gs_watcher_get_type ())
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index 41adbb6..87eac00 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -27,12 +27,10 @@
#include <sys/wait.h>
#include <string.h>
-#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
+#include <gtk/gtk.h>
#include <gtk/gtkx.h>
-#endif
#include "gs-window.h"
#include "gs-marshal.h"
@@ -88,11 +86,7 @@ struct GSWindowPrivate
GtkWidget *info_bar;
GtkWidget *info_content;
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_surface_t *background_surface;
-#else
- GdkPixmap *background_pixmap;
-#endif
guint popup_dialog_idle_id;
@@ -174,11 +168,7 @@ set_invisible_cursor (GdkWindow *window,
if (cursor)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
g_object_unref (cursor);
-#else
- gdk_cursor_unref (cursor);
-#endif
}
}
@@ -258,15 +248,9 @@ widget_clear_all_children (GtkWidget *widget)
clear_children (GDK_WINDOW_XID (w));
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_display_sync (gtk_widget_get_display (widget));
- gdk_error_trap_pop ();
-#endif
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
gs_window_reset_background_surface (GSWindow *window)
{
@@ -277,47 +261,13 @@ gs_window_reset_background_surface (GSWindow *window)
cairo_pattern_destroy (pattern);
gtk_widget_queue_draw (GTK_WIDGET (window));
}
-#else
-static void
-force_no_pixmap_background (GtkWidget *widget)
-{
- static gboolean first_time = TRUE;
-
- if (first_time)
- {
- gtk_rc_parse_string ("\n"
- " style \"gs-theme-engine-style\"\n"
- " {\n"
- " bg_pixmap[NORMAL] = \"<none>\"\n"
- " bg_pixmap[INSENSITIVE] = \"<none>\"\n"
- " bg_pixmap[ACTIVE] = \"<none>\"\n"
- " bg_pixmap[PRELIGHT] = \"<none>\"\n"
- " bg[NORMAL] = { 0.0, 0.0, 0.0 }\n"
- " bg[INSENSITIVE] = { 0.0, 0.0, 0.0 }\n"
- " bg[ACTIVE] = { 0.0, 0.0, 0.0 }\n"
- " bg[PRELIGHT] = { 0.0, 0.0, 0.0 }\n"
- " }\n"
- " widget \"gs-window-drawing-area*\" style : highest \"gs-theme-engine-style\"\n"
- "\n");
- first_time = FALSE;
- }
-
- gtk_widget_set_name (widget, "gs-window-drawing-area");
-}
-#endif
void
-#if GTK_CHECK_VERSION (3, 0, 0)
gs_window_set_background_surface (GSWindow *window,
cairo_surface_t *surface)
-#else
-gs_window_set_background_pixmap (GSWindow *window,
- GdkPixmap *pixmap)
-#endif
{
g_return_if_fail (GS_IS_WINDOW (window));
-#if GTK_CHECK_VERSION (3, 0, 0)
if (window->priv->background_surface != NULL)
{
cairo_surface_destroy (window->priv->background_surface);
@@ -328,34 +278,11 @@ gs_window_set_background_pixmap (GSWindow *window,
window->priv->background_surface = cairo_surface_reference (surface);
gs_window_reset_background_surface (window);
}
-#else
- if (window->priv->background_pixmap != NULL)
- {
- g_object_unref (window->priv->background_pixmap);
- }
-
- if (pixmap != NULL)
- {
- window->priv->background_pixmap = g_object_ref (pixmap);
- gdk_window_set_back_pixmap (gtk_widget_get_window (GTK_WIDGET (window)),
- pixmap,
- FALSE);
- }
-#endif
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
gs_window_clear_to_background_surface (GSWindow *window)
-#else
-gs_window_clear_to_background_pixmap (GSWindow *window)
-#endif
{
-#if !GTK_CHECK_VERSION (3, 0, 0)
- GtkStateType state;
- GtkStyle *style;
-#endif
-
g_return_if_fail (GS_IS_WINDOW (window));
if (! gtk_widget_get_visible (GTK_WIDGET (window)))
@@ -363,66 +290,23 @@ gs_window_clear_to_background_pixmap (GSWindow *window)
return;
}
-#if GTK_CHECK_VERSION (3, 0, 0)
if (window->priv->background_surface == NULL)
-#else
- if (window->priv->background_pixmap == NULL)
-#endif
{
- /* don't allow null pixmaps */
+ /* don't allow null surfaces */
return;
}
gs_debug ("Clearing window to background pixmap");
-#if GTK_CHECK_VERSION (3, 0, 0)
gs_window_reset_background_surface (window);
-#else
- style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (window)));
-
- state = (GtkStateType) 0;
- while (state < (GtkStateType) G_N_ELEMENTS (gtk_widget_get_style (GTK_WIDGET (window))->bg_pixmap))
- {
-
- if (style->bg_pixmap[state] != NULL)
- {
- g_object_unref (style->bg_pixmap[state]);
- }
-
- style->bg_pixmap[state] = g_object_ref (window->priv->background_pixmap);
- state++;
- }
-
- gtk_widget_set_style (GTK_WIDGET (window), style);
- g_object_unref (style);
-
- if (window->priv->background_pixmap != NULL)
- {
- gdk_window_set_back_pixmap (gtk_widget_get_window (GTK_WIDGET (window)),
- window->priv->background_pixmap,
- FALSE);
- }
-
- gdk_window_clear (gtk_widget_get_window (GTK_WIDGET (window)));
-
- gdk_flush ();
-#endif
}
static void
clear_widget (GtkWidget *widget)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA rgba = { 0.0, 0.0, 0.0, 1.0 };
GtkStateFlags state;
-#else
- GdkColormap *colormap;
- GdkColor color = { 0, 0x0000, 0x0000, 0x0000 };
- GtkStateType state;
- GtkStyle *style;
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
if (!gtk_widget_get_realized (widget))
{
return;
@@ -434,45 +318,6 @@ clear_widget (GtkWidget *widget)
gtk_widget_override_background_color (widget, state, &rgba);
gdk_window_set_background_rgba (gtk_widget_get_window (widget), &rgba);
gtk_widget_queue_draw (GTK_WIDGET (widget));
-#else
- if (!gtk_widget_get_visible (widget))
- {
- return;
- }
-
- gs_debug ("Clearing widget");
-
- state = (GtkStateType) 0;
- while (state < (GtkStateType) G_N_ELEMENTS (gtk_widget_get_style (widget)->bg))
- {
- gtk_widget_modify_bg (widget, state, &color);
- state++;
- }
-
- style = gtk_style_copy (gtk_widget_get_style (widget));
-
- state = (GtkStateType) 0;
- while (state < (GtkStateType) G_N_ELEMENTS (gtk_widget_get_style (widget)->bg_pixmap))
- {
-
- if (style->bg_pixmap[state] != NULL)
- {
- g_object_unref (style->bg_pixmap[state]);
- }
-
- style->bg_pixmap[state] = NULL;
- state++;
- }
-
- colormap = gdk_drawable_get_colormap (gtk_widget_get_window (widget));
- gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE);
- gdk_window_set_background (gtk_widget_get_window (widget), &color);
-
- gtk_widget_set_style (widget, style);
- g_object_unref (style);
-
- gdk_window_clear (gtk_widget_get_window (widget));
-#endif
/* If a screensaver theme adds child windows we need to clear them too */
widget_clear_all_children (widget);
@@ -489,33 +334,19 @@ gs_window_clear (GSWindow *window)
clear_widget (window->priv->drawing_area);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static cairo_region_t *
-#else
-static GdkRegion *
-#endif
get_outside_region (GSWindow *window)
{
int i;
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_region_t *region;
-#else
- GdkRegion *region;
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
region = cairo_region_create ();
-#else
- region = gdk_region_new ();
-#endif
+
for (i = 0; i < window->priv->monitor; i++)
{
GdkRectangle geometry;
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_rectangle_int_t rectangle;
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_screen_get_monitor_geometry (gtk_widget_get_screen (GTK_WIDGET (window)),
i, &geometry);
rectangle.x = geometry.x;
@@ -523,11 +354,6 @@ get_outside_region (GSWindow *window)
rectangle.width = geometry.width;
rectangle.height = geometry.height;
cairo_region_union_rectangle (region, &rectangle);
-#else
- gdk_screen_get_monitor_geometry (gtk_window_get_screen (GTK_WINDOW (window)),
- i, &geometry);
- gdk_region_union_with_rect (region, &geometry);
-#endif
}
return region;
@@ -537,13 +363,8 @@ static void
update_geometry (GSWindow *window)
{
GdkRectangle geometry;
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_region_t *outside_region;
cairo_region_t *monitor_region;
-#else
- GdkRegion *outside_region;
- GdkRegion *monitor_region;
-#endif
outside_region = get_outside_region (window);
@@ -556,23 +377,12 @@ update_geometry (GSWindow *window)
geometry.y,
geometry.width,
geometry.height);
-#if GTK_CHECK_VERSION (3, 0, 0)
monitor_region = cairo_region_create_rectangle ((const cairo_rectangle_int_t *)&geometry);
cairo_region_subtract (monitor_region, outside_region);
cairo_region_destroy (outside_region);
-#else
- monitor_region = gdk_region_rectangle (&geometry);
- gdk_region_subtract (monitor_region, outside_region);
- gdk_region_destroy (outside_region);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_region_get_extents (monitor_region, (cairo_rectangle_int_t *)&geometry);
cairo_region_destroy (monitor_region);
-#else
- gdk_region_get_clipbox (monitor_region, &geometry);
- gdk_region_destroy (monitor_region);
-#endif
gs_debug ("using geometry for monitor %d: x=%d y=%d w=%d h=%d",
window->priv->monitor,
@@ -780,7 +590,6 @@ out:
return g_object_ref (visual);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
widget_set_best_visual (GtkWidget *widget)
{
@@ -795,50 +604,11 @@ widget_set_best_visual (GtkWidget *widget)
g_object_unref (visual);
}
}
-#else
-static GdkColormap *
-get_best_colormap_for_screen (GdkScreen *screen)
-{
- GdkColormap *colormap;
- GdkVisual *visual;
-
- g_return_val_if_fail (screen != NULL, NULL);
-
- visual = get_best_visual_for_screen (screen);
-
- colormap = NULL;
- if (visual != NULL)
- {
- colormap = gdk_colormap_new (visual, FALSE);
- }
-
- return colormap;
-}
-
-static void
-widget_set_best_colormap (GtkWidget *widget)
-{
- GdkColormap *colormap;
-
- g_return_if_fail (widget != NULL);
-
- colormap = get_best_colormap_for_screen (gtk_widget_get_screen (widget));
- if (colormap != NULL)
- {
- gtk_widget_set_colormap (widget, colormap);
- g_object_unref (colormap);
- }
-}
-#endif
static void
gs_window_real_realize (GtkWidget *widget)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_set_best_visual (widget);
-#else
- widget_set_best_colormap (widget);
-#endif
if (GTK_WIDGET_CLASS (gs_window_parent_class)->realize)
{
@@ -1040,12 +810,7 @@ select_popup_events (void)
events = SubstructureNotifyMask | attr.your_event_mask;
XSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_ROOT_WINDOW (), events);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_display_sync (gdk_display_get_default ());
- gdk_error_trap_pop ();
-#endif
}
static void
@@ -1062,12 +827,7 @@ window_select_shape_events (GSWindow *window)
XShapeSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window))), events);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
-#else
- gdk_display_sync (gdk_display_get_default ());
- gdk_error_trap_pop ();
-#endif
#endif
}
@@ -1115,27 +875,15 @@ set_info_text_and_icon (GSWindow *window,
GtkWidget *primary_label;
GtkWidget *secondary_label;
-#if GTK_CHECK_VERSION (3, 0, 0)
hbox_content = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
-#else
- hbox_content = gtk_hbox_new (FALSE, 8);
-#endif
gtk_widget_show (hbox_content);
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG);
gtk_widget_show (image);
gtk_box_pack_start (GTK_BOX (hbox_content), image, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_valign (image, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-#else
- vbox = gtk_vbox_new (FALSE, 6);
-#endif
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (hbox_content), vbox, FALSE, FALSE, 0);
@@ -1146,11 +894,7 @@ set_info_text_and_icon (GSWindow *window,
gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0);
gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (primary_label, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
-#endif
if (secondary_text != NULL)
{
@@ -1162,11 +906,7 @@ set_info_text_and_icon (GSWindow *window,
gtk_box_pack_start (GTK_BOX (vbox), secondary_label, TRUE, TRUE, 0);
gtk_label_set_use_markup (GTK_LABEL (secondary_label), TRUE);
gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (secondary_label, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (secondary_label), 0, 0.5);
-#endif
}
/* remove old content */
@@ -1323,9 +1063,7 @@ spawn_on_window (GSWindow *window,
{
int argc;
char **argv;
-#if GTK_CHECK_VERSION (3, 0, 0)
char **envp;
-#endif
GError *error;
gboolean result;
GIOChannel *channel;
@@ -1343,7 +1081,6 @@ spawn_on_window (GSWindow *window,
}
error = NULL;
-#if GTK_CHECK_VERSION (3, 0, 0)
envp = spawn_make_environment_for_screen (gtk_window_get_screen (GTK_WINDOW (window)), NULL);
result = g_spawn_async_with_pipes (NULL,
argv,
@@ -1356,20 +1093,6 @@ spawn_on_window (GSWindow *window,
&standard_output,
&standard_error,
&error);
-#else
- result = gdk_spawn_on_screen_with_pipes (gtk_window_get_screen (GTK_WINDOW (window)),
- NULL,
- argv,
- NULL,
- G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
- NULL,
- NULL,
- &child_pid,
- NULL,
- &standard_output,
- &standard_error,
- &error);
-#endif
if (! result)
{
@@ -1417,9 +1140,7 @@ spawn_on_window (GSWindow *window,
g_io_channel_unref (channel);
g_strfreev (argv);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_strfreev (envp);
-#endif
return result;
}
@@ -1703,15 +1424,11 @@ create_lock_socket (GSWindow *window,
guint32 id)
{
window->priv->lock_socket = gtk_socket_new ();
-#if GTK_CHECK_VERSION(3, 12, 0)
window->priv->lock_box = gtk_grid_new ();
gtk_widget_set_halign (GTK_WIDGET (window->priv->lock_box),
GTK_ALIGN_CENTER);
gtk_widget_set_valign (GTK_WIDGET (window->priv->lock_box),
GTK_ALIGN_CENTER);
-#else
- window->priv->lock_box = gtk_alignment_new (0.5, 0.5, 0, 0);
-#endif
gtk_widget_show (window->priv->lock_box);
gtk_box_pack_start (GTK_BOX (window->priv->vbox), window->priv->lock_box, TRUE, TRUE, 0);
@@ -1797,16 +1514,10 @@ shake_dialog (GSWindow *window)
break;
}
-#if GTK_CHECK_VERSION(3, 12, 0)
gtk_widget_set_margin_start (GTK_WIDGET (window->priv->lock_box),
start);
gtk_widget_set_margin_end (GTK_WIDGET (window->priv->lock_box),
end);
-#else
- gtk_alignment_set_padding (GTK_ALIGNMENT (window->priv->lock_box),
- 0, 0,
- start, end);
-#endif
while (gtk_events_pending ())
{
@@ -2027,11 +1738,7 @@ popup_dialog (GSWindow *window)
gtk_widget_hide (window->priv->drawing_area);
-#if GTK_CHECK_VERSION (3, 0, 0)
gs_window_clear_to_background_surface (window);
-#else
- gs_window_clear_to_background_pixmap (window);
-#endif
set_invisible_cursor (gtk_widget_get_window (GTK_WIDGET (window)), FALSE);
window->priv->dialog_quit_requested = FALSE;
@@ -2494,11 +2201,7 @@ gs_window_real_size_request (GtkWidget *widget,
if (child && gtk_widget_get_visible (child))
{
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_get_preferred_size (child, requisition, NULL);
-#else
- gtk_widget_size_request (child, requisition);
-#endif
}
old_geometry = window->priv->geometry;
@@ -2528,7 +2231,6 @@ gs_window_real_size_request (GtkWidget *widget,
gs_window_move_resize_window (window, position_changed, size_changed);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
gs_window_real_get_preferred_width (GtkWidget *widget,
gint *minimal_width,
@@ -2548,7 +2250,6 @@ gs_window_real_get_preferred_height (GtkWidget *widget,
gs_window_real_size_request (widget, &requisition);
*minimal_height = *natural_height = requisition.height;
}
-#endif
static gboolean
gs_window_real_grab_broken (GtkWidget *widget,
@@ -2639,12 +2340,8 @@ gs_window_class_init (GSWindowClass *klass)
widget_class->motion_notify_event = gs_window_real_motion_notify_event;
widget_class->button_press_event = gs_window_real_button_press_event;
widget_class->scroll_event = gs_window_real_scroll_event;
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_class->get_preferred_width = gs_window_real_get_preferred_width;
widget_class->get_preferred_height = gs_window_real_get_preferred_height;
-#else
- widget_class->size_request = gs_window_real_size_request;
-#endif
widget_class->grab_broken_event = gs_window_real_grab_broken;
widget_class->visibility_notify_event = gs_window_real_visibility_notify_event;
@@ -2757,7 +2454,6 @@ create_info_bar (GSWindow *window)
gtk_box_pack_end (GTK_BOX (window->priv->vbox), window->priv->info_bar, FALSE, FALSE, 0);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
on_drawing_area_realized (GtkWidget *drawing_area)
{
@@ -2766,7 +2462,6 @@ on_drawing_area_realized (GtkWidget *drawing_area)
gdk_window_set_background_rgba (gtk_widget_get_window (drawing_area),
&black);
}
-#endif
static void
gs_window_init (GSWindow *window)
@@ -2802,31 +2497,20 @@ gs_window_init (GSWindow *window)
| GDK_ENTER_NOTIFY_MASK
| GDK_LEAVE_NOTIFY_MASK);
-#if GTK_CHECK_VERSION (3, 0, 0)
window->priv->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-#else
- window->priv->vbox = gtk_vbox_new (FALSE, 12);
-#endif
gtk_widget_show (window->priv->vbox);
gtk_container_add (GTK_CONTAINER (window), window->priv->vbox);
window->priv->drawing_area = gtk_drawing_area_new ();
gtk_widget_show (window->priv->drawing_area);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_app_paintable (window->priv->drawing_area, TRUE);
-#endif
gtk_box_pack_start (GTK_BOX (window->priv->vbox), window->priv->drawing_area, TRUE, TRUE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect (window->priv->drawing_area,
"realize",
G_CALLBACK (on_drawing_area_realized),
NULL);
-#endif
create_info_bar (window);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- force_no_pixmap_background (window->priv->drawing_area);
-#endif
}
static void
@@ -2879,17 +2563,10 @@ gs_window_finalize (GObject *object)
gs_window_dialog_finish (window);
-#if GTK_CHECK_VERSION (3, 0, 0)
if (window->priv->background_surface)
{
cairo_surface_destroy (window->priv->background_surface);
}
-#else
- if (window->priv->background_pixmap)
- {
- g_object_unref (window->priv->background_pixmap);
- }
-#endif
G_OBJECT_CLASS (gs_window_parent_class)->finalize (object);
}
diff --git a/src/gs-window.h b/src/gs-window.h
index 22f9274..9cd64eb 100644
--- a/src/gs-window.h
+++ b/src/gs-window.h
@@ -66,13 +66,8 @@ void gs_window_set_monitor (GSWindow *window,
int monitor);
int gs_window_get_monitor (GSWindow *window);
-#if GTK_CHECK_VERSION (3, 0, 0)
void gs_window_set_background_surface (GSWindow *window,
cairo_surface_t *surface);
-#else
-void gs_window_set_background_pixmap (GSWindow *window,
- GdkPixmap *pixmap);
-#endif
void gs_window_set_lock_enabled (GSWindow *window,
gboolean lock_enabled);
void gs_window_set_logout_enabled (GSWindow *window,
diff --git a/src/mate-screensaver-dialog.c b/src/mate-screensaver-dialog.c
index 1ed3a3f..62daa98 100644
--- a/src/mate-screensaver-dialog.c
+++ b/src/mate-screensaver-dialog.c
@@ -34,9 +34,7 @@
#include <glib/gi18n.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
#include <gtk/gtkx.h>
-#endif
#include "gs-lock-plug.h"
diff --git a/src/mate-screensaver-preferences.c b/src/mate-screensaver-preferences.c
index 5dd0757..0de7d59 100644
--- a/src/mate-screensaver-preferences.c
+++ b/src/mate-screensaver-preferences.c
@@ -39,9 +39,7 @@
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <libmate-desktop/mate-desktop-utils.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
#include "gs-debug.h"
-#endif
#include "copy-theme-dialog.h"
@@ -301,17 +299,10 @@ config_set_lock (gboolean lock)
static void
preview_clear (GtkWidget *widget)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
gdk_window_set_background_rgba (gtk_widget_get_window (widget), &black);
gtk_widget_queue_draw (widget);
-#else
- GdkColor black = { 0, 0x0000, 0x0000, 0x0000 };
-
- gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &black);
- gdk_window_clear (gtk_widget_get_window (widget));
-#endif
}
static void
@@ -1215,12 +1206,7 @@ constrain_list_size (GtkWidget *widget,
/* constrain height to be the tree height up to a max */
max_height = (gdk_screen_get_height (gtk_widget_get_screen (widget))) / 4;
-#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_get_preferred_size (to_size, &req, NULL);
-#else
- gtk_widget_size_request (to_size, &req);
-#endif
-
allocation->height = MIN (req.height, max_height);
}
@@ -1274,58 +1260,6 @@ setup_for_root_user (void)
gtk_widget_show (label);
}
-static GdkVisual *
-get_best_visual (void)
-{
- char *command;
- char *std_output;
- int exit_status;
- GError *error;
- unsigned long v;
- char c;
- GdkVisual *visual;
- gboolean res;
-
- visual = NULL;
-
- command = g_build_filename (LIBEXECDIR, "mate-screensaver-gl-helper", NULL);
-
- error = NULL;
- res = g_spawn_command_line_sync (command,
- &std_output,
- NULL,
- &exit_status,
- &error);
-
- if (! res)
- {
- g_debug ("Could not run command '%s': %s", command, error->message);
- g_error_free (error);
- goto out;
- }
-
- if (1 == sscanf (std_output, "0x%lx %c", &v, &c))
- {
- if (v != 0)
- {
- VisualID visual_id;
-
- visual_id = (VisualID) v;
- visual = gdk_x11_screen_lookup_visual (gdk_screen_get_default (), visual_id);
-
- g_debug ("Found best visual for GL: 0x%x",
- (unsigned int) visual_id);
- }
- }
-
-out:
- g_free (std_output);
- g_free (command);
-
- return visual;
-}
-
-#if GTK_CHECK_VERSION (3, 0, 0)
/* copied from gs-window-x11.c */
extern char **environ;
@@ -1471,41 +1405,6 @@ widget_set_best_visual (GtkWidget *widget)
g_object_unref (visual);
}
}
-#else
-static GdkColormap *
-get_best_colormap_for_screen (GdkScreen *screen)
-{
- GdkColormap *colormap;
- GdkVisual *visual;
-
- g_return_val_if_fail (screen != NULL, NULL);
-
- visual = get_best_visual ();
-
- colormap = NULL;
- if (visual != NULL)
- {
- colormap = gdk_colormap_new (visual, FALSE);
- }
-
- return colormap;
-}
-
-static void
-widget_set_best_colormap (GtkWidget *widget)
-{
- GdkColormap *colormap;
-
- g_return_if_fail (widget != NULL);
-
- colormap = get_best_colormap_for_screen (gtk_widget_get_screen (widget));
- if (colormap != NULL)
- {
- gtk_widget_set_colormap (widget, colormap);
- g_object_unref (colormap);
- }
-}
-#endif
static gboolean
setup_treeview_idle (gpointer data)
@@ -1612,11 +1511,7 @@ init_capplet (void)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), treeview);
gtk_widget_set_no_show_all (root_warning_label, TRUE);
-#if GTK_CHECK_VERSION (3, 0, 0)
widget_set_best_visual (preview);
-#else
- widget_set_best_colormap (preview);
-#endif
if (! is_program_in_path (GPM_COMMAND))
{
diff --git a/src/mate-screensaver.h b/src/mate-screensaver.h
index 8a73d3a..2a5830a 100644
--- a/src/mate-screensaver.h
+++ b/src/mate-screensaver.h
@@ -23,6 +23,8 @@
#ifndef __MATE_SCREENSAVER_H
#define __MATE_SCREENSAVER_H
+#include <glib.h>
+
G_BEGIN_DECLS
void mate_screensaver_quit(void);
diff --git a/src/setuid.h b/src/setuid.h
index ffb490d..89b0b8e 100644
--- a/src/setuid.h
+++ b/src/setuid.h
@@ -14,6 +14,8 @@
#ifndef __GS_SETUID_H
#define __GS_SETUID_H
+#include <glib.h>
+
G_BEGIN_DECLS
gboolean hack_uid (char **nolock_reason,
diff --git a/src/subprocs.h b/src/subprocs.h
index 95744cd..a3acf22 100644
--- a/src/subprocs.h
+++ b/src/subprocs.h
@@ -17,6 +17,7 @@
#define __GS_SUBPROCS_H
#include <signal.h>
+#include <glib.h>
G_BEGIN_DECLS