summaryrefslogtreecommitdiff
path: root/src/gs-lock-plug.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 /src/gs-lock-plug.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 'src/gs-lock-plug.c')
-rw-r--r--src/gs-lock-plug.c37
1 files changed, 7 insertions, 30 deletions
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);