summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/copy-theme-dialog.c4
-rw-r--r--src/gs-grab-x11.c4
-rw-r--r--src/gs-job.c4
-rw-r--r--src/gs-lock-plug.c37
-rw-r--r--src/gs-window-x11.c100
-rw-r--r--src/mate-screensaver-dialog.c4
-rw-r--r--src/mate-screensaver-preferences.c6
7 files changed, 30 insertions, 129 deletions
diff --git a/src/copy-theme-dialog.c b/src/copy-theme-dialog.c
index 045674e..b594966 100644
--- a/src/copy-theme-dialog.c
+++ b/src/copy-theme-dialog.c
@@ -201,11 +201,7 @@ copy_theme_dialog_init (CopyThemeDialog *dlg)
dlg->priv->cancellable = g_cancellable_new ();
/* GUI settings */
-#if GTK_CHECK_VERSION (3, 0, 0)
dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (dlg));
-#else
- dialog_vbox = GTK_DIALOG (dlg)->vbox;
-#endif
gtk_container_set_border_width (GTK_CONTAINER (dialog_vbox),
4);
diff --git a/src/gs-grab-x11.c b/src/gs-grab-x11.c
index 003df3b..72809d5 100644
--- a/src/gs-grab-x11.c
+++ b/src/gs-grab-x11.c
@@ -589,11 +589,7 @@ gs_grab_grab_offscreen (GSGrab *grab,
gs_debug ("Grabbing an offscreen window");
screen = gtk_invisible_get_screen (GTK_INVISIBLE (grab->priv->invisible));
-#if GTK_CHECK_VERSION (3, 0, 0)
res = gs_grab_grab_window (grab, gtk_widget_get_window (GTK_WIDGET (grab->priv->invisible)), screen, hide_cursor);
-#else
- res = gs_grab_grab_window (grab, grab->priv->invisible->window, screen, hide_cursor);
-#endif
return res;
}
diff --git a/src/gs-job.c b/src/gs-job.c
index af77442..4296f64 100644
--- a/src/gs-job.c
+++ b/src/gs-job.c
@@ -80,11 +80,7 @@ widget_get_id_string (GtkWidget *widget)
g_return_val_if_fail (widget != NULL, NULL);
id = g_strdup_printf ("0x%X",
-#if GTK_CHECK_VERSION (3, 0, 0)
(guint32)GDK_WINDOW_XID (gtk_widget_get_window (widget)));
-#else
- (guint32)GDK_WINDOW_XID (widget->window));
-#endif
return id;
}
diff --git a/src/gs-lock-plug.c b/src/gs-lock-plug.c
index 9292cbf..37ab29b 100644
--- a/src/gs-lock-plug.c
+++ b/src/gs-lock-plug.c
@@ -43,9 +43,6 @@
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <libmate-desktop/mate-desktop-utils.h>
#define gdk_spawn_command_line_on_screen mate_gdk_spawn_command_line_on_screen
-#define GTK_WIDGET_VISIBLE gtk_widget_get_visible
-#define GTK_WIDGET_IS_SENSITIVE gtk_widget_is_sensitive
-#define GTK_WIDGET_HAS_FOCUS gtk_widget_has_focus
#endif
#ifdef WITH_KBD_LAYOUT_INDICATOR
@@ -581,17 +578,13 @@ gs_lock_plug_run (GSLockPlug *plug)
g_object_ref (plug);
-#if GTK_CHECK_VERSION (3, 0, 0)
was_modal = gtk_window_get_modal (GTK_WINDOW (plug));
-#else
- was_modal = GTK_WINDOW (plug)->modal;
-#endif
if (!was_modal)
{
gtk_window_set_modal (GTK_WINDOW (plug), TRUE);
}
- if (!GTK_WIDGET_VISIBLE (plug))
+ if (!gtk_widget_get_visible (GTK_WIDGET (plug)))
{
gtk_widget_show (GTK_WIDGET (plug));
}
@@ -920,8 +913,8 @@ image_set_from_pixbuf (GtkImage *image,
radius = w / 10;
- pixmap = gdk_pixmap_new (GTK_WIDGET (image)->window, w, h, -1);
- bitmask = gdk_pixmap_new (GTK_WIDGET (image)->window, w, h, 1);
+ 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);
@@ -936,7 +929,7 @@ image_set_from_pixbuf (GtkImage *image,
cairo_set_source_rgb (cr_mask, 1, 1, 1);
cairo_fill (cr_mask);
- color = GTK_WIDGET (image)->style->bg [GTK_STATE_NORMAL];
+ 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;
@@ -1351,11 +1344,7 @@ gs_lock_plug_close (GSLockPlug *plug)
GdkEvent *event;
event = gdk_event_new (GDK_DELETE);
-#if GTK_CHECK_VERSION (3, 0, 0)
event->any.window = g_object_ref (gtk_widget_get_window(widget));
-#else
- event->any.window = g_object_ref (widget->window);
-#endif
event->any.send_event = TRUE;
gtk_main_do_event (event);
@@ -1565,11 +1554,7 @@ gs_lock_plug_set_busy (GSLockPlug *plug)
cursor = gdk_cursor_new (GDK_WATCH);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_set_cursor (gtk_widget_get_window (top_level), cursor);
-#else
- gdk_window_set_cursor (top_level->window, cursor);
-#endif
gdk_cursor_unref (cursor);
}
@@ -1582,11 +1567,7 @@ gs_lock_plug_set_ready (GSLockPlug *plug)
top_level = gtk_widget_get_toplevel (GTK_WIDGET (plug));
cursor = gdk_cursor_new (GDK_LEFT_PTR);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_set_cursor (gtk_widget_get_window (top_level), cursor);
-#else
- gdk_window_set_cursor (top_level->window, cursor);
-#endif
gdk_cursor_unref (cursor);
}
@@ -1608,7 +1589,7 @@ gs_lock_plug_enable_prompt (GSLockPlug *plug,
gtk_widget_set_sensitive (plug->priv->auth_prompt_entry, TRUE);
gtk_widget_show (plug->priv->auth_prompt_entry);
- if (! GTK_WIDGET_HAS_FOCUS (plug->priv->auth_prompt_entry))
+ if (! gtk_widget_has_focus (plug->priv->auth_prompt_entry))
{
gtk_widget_grab_focus (plug->priv->auth_prompt_entry);
}
@@ -1667,8 +1648,8 @@ entry_key_press (GtkWidget *widget,
/* if the input widget is visible and ready for input
* then just carry on as usual
*/
- if (GTK_WIDGET_VISIBLE (plug->priv->auth_prompt_entry) &&
- GTK_WIDGET_IS_SENSITIVE (plug->priv->auth_prompt_entry))
+ if (gtk_widget_get_visible (plug->priv->auth_prompt_entry) &&
+ gtk_widget_is_sensitive (plug->priv->auth_prompt_entry))
{
return FALSE;
}
@@ -1696,11 +1677,7 @@ gs_lock_plug_add_button (GSLockPlug *plug,
button = gtk_button_new_from_stock (button_text);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_can_default (button, TRUE);
-#else
- GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
-#endif
gtk_widget_show (button);
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index 6756780..458db44 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -32,9 +32,6 @@
#include <gdk/gdkkeysyms.h>
#if GTK_CHECK_VERSION (3, 0, 0)
#include <gtk/gtkx.h>
-#define GTK_WIDGET_IS_SENSITIVE gtk_widget_get_sensitive
-#define GTK_WIDGET_VISIBLE gtk_widget_get_visible
-#define GTK_WIDGET_REALIZED gtk_widget_get_realized
#endif
#include "gs-window.h"
@@ -216,18 +213,10 @@ gs_window_override_user_time (GSWindow *window)
* NOTE: Last resort for D-BUS or other non-interactive
* openings. Causes roundtrip to server. Lame.
*/
-#if GTK_CHECK_VERSION (3, 0, 0)
ev_time = gdk_x11_get_server_time (gtk_widget_get_window (GTK_WIDGET (window)));
-#else
- ev_time = gdk_x11_get_server_time (GTK_WIDGET (window)->window);
-#endif
}
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_x11_window_set_user_time (gtk_widget_get_window (GTK_WIDGET (window)), ev_time);
-#else
- gdk_x11_window_set_user_time (GTK_WIDGET (window)->window, ev_time);
-#endif
}
static void
@@ -305,7 +294,7 @@ widget_clear_all_children (GtkWidget *widget)
gdk_error_trap_push ();
- w = widget->window;
+ w = gtk_widget_get_window (widget);
clear_children (GDK_WINDOW_XID (w));
@@ -358,7 +347,7 @@ gs_window_set_background_pixmap (GSWindow *window,
if (pixmap != NULL)
{
window->priv->background_pixmap = g_object_ref (pixmap);
- gdk_window_set_back_pixmap (GTK_WIDGET (window)->window,
+ gdk_window_set_back_pixmap (gtk_widget_get_window (GTK_WIDGET (window)),
pixmap,
FALSE);
}
@@ -379,7 +368,7 @@ gs_window_clear_to_background_pixmap (GSWindow *window)
g_return_if_fail (GS_IS_WINDOW (window));
- if (! GTK_WIDGET_VISIBLE (GTK_WIDGET (window)))
+ if (! gtk_widget_get_visible (GTK_WIDGET (window)))
{
return;
}
@@ -399,10 +388,10 @@ gs_window_clear_to_background_pixmap (GSWindow *window)
#if GTK_CHECK_VERSION (3, 0, 0)
gs_window_reset_background_surface (window);
#else
- style = gtk_style_copy (GTK_WIDGET (window)->style);
+ style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (window)));
state = (GtkStateType) 0;
- while (state < (GtkStateType) G_N_ELEMENTS (GTK_WIDGET (window)->style->bg_pixmap))
+ while (state < (GtkStateType) G_N_ELEMENTS (gtk_widget_get_style (GTK_WIDGET (window))->bg_pixmap))
{
if (style->bg_pixmap[state] != NULL)
@@ -419,12 +408,12 @@ gs_window_clear_to_background_pixmap (GSWindow *window)
if (window->priv->background_pixmap != NULL)
{
- gdk_window_set_back_pixmap (GTK_WIDGET (window)->window,
+ gdk_window_set_back_pixmap (gtk_widget_get_window (GTK_WIDGET (window)),
window->priv->background_pixmap,
FALSE);
}
- gdk_window_clear (GTK_WIDGET (window)->window);
+ gdk_window_clear (gtk_widget_get_window (GTK_WIDGET (window)));
gdk_flush ();
#endif
@@ -453,7 +442,7 @@ clear_widget (GtkWidget *widget)
gtk_widget_override_background_color (widget, GTK_STATE_FLAG_NORMAL, &rgba);
gtk_widget_queue_draw (GTK_WIDGET (widget));
#else
- if (! GTK_WIDGET_VISIBLE (widget))
+ if (! gtk_widget_get_visible (widget))
{
return;
}
@@ -461,16 +450,16 @@ clear_widget (GtkWidget *widget)
gs_debug ("Clearing widget");
state = (GtkStateType) 0;
- while (state < (GtkStateType) G_N_ELEMENTS (widget->style->bg))
+ while (state < (GtkStateType) G_N_ELEMENTS (gtk_widget_get_style (widget)->bg))
{
gtk_widget_modify_bg (widget, state, &color);
state++;
}
- style = gtk_style_copy (widget->style);
+ style = gtk_style_copy (gtk_widget_get_style (widget));
state = (GtkStateType) 0;
- while (state < (GtkStateType) G_N_ELEMENTS (widget->style->bg_pixmap))
+ while (state < (GtkStateType) G_N_ELEMENTS (gtk_widget_get_style (widget)->bg_pixmap))
{
if (style->bg_pixmap[state] != NULL)
@@ -482,14 +471,14 @@ clear_widget (GtkWidget *widget)
state++;
}
- 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_set_background (gtk_widget_get_window (widget), &color);
gtk_widget_set_style (widget, style);
g_object_unref (style);
- gdk_window_clear (widget->window);
+ gdk_window_clear (gtk_widget_get_window (widget));
/* If a screensaver theme adds child windows we need to clear them too */
widget_clear_all_children (widget);
@@ -542,7 +531,7 @@ get_outside_region (GSWindow *window)
rectangle.height = geometry.height;
cairo_region_union_rectangle (region, &rectangle);
#else
- gdk_screen_get_monitor_geometry (GTK_WINDOW (window)->screen,
+ gdk_screen_get_monitor_geometry (gtk_window_get_screen (GTK_WINDOW (window)),
i, &geometry);
gdk_region_union_with_rect (region, &geometry);
#endif
@@ -565,11 +554,7 @@ update_geometry (GSWindow *window)
outside_region = get_outside_region (window);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_screen_get_monitor_geometry (gtk_widget_get_screen (GTK_WIDGET (window)),
-#else
- gdk_screen_get_monitor_geometry (GTK_WINDOW (window)->screen,
-#endif
window->priv->monitor,
&geometry);
gs_debug ("got geometry for monitor %d: x=%d y=%d w=%d h=%d",
@@ -627,13 +612,9 @@ gs_window_move_resize_window (GSWindow *window,
GdkWindow *gdkwindow;
widget = GTK_WIDGET (window);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdkwindow = gtk_widget_get_window (GTK_WIDGET (window));
-#else
- gdkwindow = widget->window;
-#endif
- g_assert (GTK_WIDGET_REALIZED (widget));
+ g_assert (gtk_widget_get_realized (widget));
gs_debug ("Move and/or resize window on monitor %d: x=%d y=%d w=%d h=%d",
window->priv->monitor,
@@ -888,11 +869,7 @@ watchdog_timer (GSWindow *window)
{
GtkWidget *widget = GTK_WIDGET (window);
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_focus (gtk_widget_get_window (widget), GDK_CURRENT_TIME);
-#else
- gdk_window_focus (widget->window, GDK_CURRENT_TIME);
-#endif
return TRUE;
}
@@ -955,11 +932,7 @@ gs_window_raise (GSWindow *window)
gs_debug ("Raising screensaver window");
-#if GTK_CHECK_VERSION (3, 0, 0)
win = gtk_widget_get_window (GTK_WIDGET (window));
-#else
- win = GTK_WIDGET (window)->window;
-#endif
gdk_window_raise (win);
}
@@ -972,11 +945,7 @@ x11_window_is_ours (Window window)
ret = FALSE;
-#if GTK_CHECK_VERSION (3, 0, 0)
gwindow = gdk_x11_window_lookup_for_display (gdk_display_get_default (), window);
-#else
- gwindow = gdk_window_lookup (window);
-#endif
if (gwindow && (window != GDK_ROOT_WINDOW ()))
{
ret = TRUE;
@@ -989,11 +958,7 @@ x11_window_is_ours (Window window)
static void
unshape_window (GSWindow *window)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_window_shape_combine_region (gtk_widget_get_window (GTK_WIDGET (window)),
-#else
- gdk_window_shape_combine_region (GTK_WIDGET (window)->window,
-#endif
NULL,
0,
0);
@@ -1117,11 +1082,7 @@ gs_window_real_show (GtkWidget *widget)
gs_window_clear (GS_WINDOW (widget));
-#if GTK_CHECK_VERSION (3, 0, 0)
set_invisible_cursor (gtk_widget_get_window (widget), TRUE);
-#else
- set_invisible_cursor (widget->window, TRUE);
-#endif
window = GS_WINDOW (widget);
if (window->priv->timer)
@@ -1271,11 +1232,7 @@ gs_window_get_gdk_window (GSWindow *window)
{
g_return_val_if_fail (GS_IS_WINDOW (window), NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
return gtk_widget_get_window (GTK_WIDGET (window));
-#else
- return GTK_WIDGET (window)->window;
-#endif
}
GtkWidget *
@@ -1379,7 +1336,7 @@ spawn_on_window (GSWindow *window,
&standard_error,
&error);
#else
- result = gdk_spawn_on_screen_with_pipes (GTK_WINDOW (window)->screen,
+ result = gdk_spawn_on_screen_with_pipes (gtk_window_get_screen (GTK_WINDOW (window)),
NULL,
argv,
NULL,
@@ -1854,11 +1811,7 @@ popdown_dialog (GSWindow *window)
gtk_widget_show (window->priv->drawing_area);
gs_window_clear (window);
-#if GTK_CHECK_VERSION (3, 0, 0)
set_invisible_cursor (gtk_widget_get_window (GTK_WIDGET (window)), TRUE);
-#else
- set_invisible_cursor (GTK_WIDGET (window)->window, TRUE);
-#endif
window_set_dialog_up (window, FALSE);
@@ -2046,11 +1999,10 @@ popup_dialog (GSWindow *window)
#if GTK_CHECK_VERSION (3, 0, 0)
gs_window_clear_to_background_surface (window);
- set_invisible_cursor (gtk_widget_get_window (GTK_WIDGET (window)), FALSE);
#else
gs_window_clear_to_background_pixmap (window);
- set_invisible_cursor (GTK_WIDGET (window)->window, FALSE);
#endif
+ set_invisible_cursor (gtk_widget_get_window (GTK_WIDGET (window)), FALSE);
window->priv->dialog_quit_requested = FALSE;
window->priv->dialog_shake_in_progress = FALSE;
@@ -2086,7 +2038,7 @@ gs_window_request_unlock (GSWindow *window)
gs_debug ("Requesting unlock");
- if (! GTK_WIDGET_VISIBLE (GTK_WIDGET (window)))
+ if (! gtk_widget_get_visible (GTK_WIDGET (window)))
{
gs_debug ("Request unlock but window is not visible!");
return;
@@ -2155,11 +2107,7 @@ gs_window_get_screen (GSWindow *window)
{
g_return_val_if_fail (GS_IS_WINDOW (window), NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
return gtk_widget_get_screen (GTK_WIDGET (window));
-#else
- return GTK_WINDOW (window)->screen;
-#endif
}
void
@@ -2403,7 +2351,7 @@ maybe_handle_activity (GSWindow *window)
/* if we already have a socket then don't bother */
if (! window->priv->lock_socket
- && GTK_WIDGET_IS_SENSITIVE (GTK_WIDGET (window)))
+ && gtk_widget_get_sensitive (GTK_WIDGET (window)))
{
g_signal_emit (window, signals [ACTIVITY], 0, &handled);
}
@@ -2512,13 +2460,9 @@ gs_window_real_size_request (GtkWidget *widget,
window = GS_WINDOW (widget);
bin = GTK_BIN (widget);
-#if GTK_CHECK_VERSION (3, 0, 0)
child = gtk_bin_get_child (bin);
-#else
- child = bin->child;
-#endif
- if (child && GTK_WIDGET_VISIBLE (child))
+ if (child && gtk_widget_get_visible (child))
{
gtk_widget_size_request (child, requisition);
}
@@ -2530,7 +2474,7 @@ gs_window_real_size_request (GtkWidget *widget,
requisition->width = window->priv->geometry.width;
requisition->height = window->priv->geometry.height;
- if (! GTK_WIDGET_REALIZED (widget))
+ if (! gtk_widget_get_realized (widget))
{
return;
}
diff --git a/src/mate-screensaver-dialog.c b/src/mate-screensaver-dialog.c
index 79be649..1ed3a3f 100644
--- a/src/mate-screensaver-dialog.c
+++ b/src/mate-screensaver-dialog.c
@@ -73,11 +73,7 @@ static char* get_id_string(GtkWidget* widget)
g_return_val_if_fail(widget != NULL, NULL);
g_return_val_if_fail(GTK_IS_WIDGET(widget), NULL);
-#if GTK_CHECK_VERSION (3, 0, 0)
id = g_strdup_printf("%" G_GUINT32_FORMAT, (guint32) GDK_WINDOW_XID(gtk_widget_get_window(widget)));
-#else
- id = g_strdup_printf("%" G_GUINT32_FORMAT, (guint32) GDK_WINDOW_XID(widget->window));
-#endif
return id;
}
diff --git a/src/mate-screensaver-preferences.c b/src/mate-screensaver-preferences.c
index 08ea293..b719f38 100644
--- a/src/mate-screensaver-preferences.c
+++ b/src/mate-screensaver-preferences.c
@@ -307,7 +307,7 @@ preview_clear (GtkWidget *widget)
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_queue_draw (widget);
#else
- gdk_window_clear (widget->window);
+ gdk_window_clear (gtk_widget_get_window (widget));
#endif
}
@@ -918,11 +918,7 @@ drag_data_received_cb (GtkWidget *widget,
if (!(info == TARGET_URI_LIST || info == TARGET_NS_URL))
return;
-#if GTK_CHECK_VERSION (3, 0, 0)
files = uri_list_parse ((char *) gtk_selection_data_get_data (selection_data));
-#else
- files = uri_list_parse ((char *) selection_data->data);
-#endif
if (files != NULL)
{
GtkWidget *prefs_dialog;