From 385e8575dd1f9219fb0e3f7fa26ffe4c24d2fdbb Mon Sep 17 00:00:00 2001
From: Paul Cornett <paulcor@bullseye.com>
Date: Mon, 28 Mar 2011 06:27:49 +0000
Subject: [PATCH] avoid deprecated functions and direct struct access

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67326 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 include/wx/gtk/mdi.h                 |  1 -
 include/wx/gtk/private/gtk2-compat.h | 53 +++++++++++++++++
 include/wx/gtk/scrolbar.h            | 12 ----
 include/wx/gtk/textctrl.h            |  1 +
 include/wx/gtk/treeentry_gtk.h       |  8 +--
 src/aui/dockart.cpp                  |  2 +-
 src/aui/framemanager.cpp             |  3 +-
 src/common/popupcmn.cpp              |  3 +-
 src/generic/statusbr.cpp             |  2 +-
 src/gtk/aboutdlg.cpp                 |  2 +-
 src/gtk/artgtk.cpp                   |  4 +-
 src/gtk/bmpcbox.cpp                  |  4 +-
 src/gtk/button.cpp                   | 25 ++++----
 src/gtk/checkbox.cpp                 |  2 +-
 src/gtk/choice.cpp                   |  4 +-
 src/gtk/clipbrd.cpp                  | 51 ++++++++++-------
 src/gtk/collpane.cpp                 |  4 +-
 src/gtk/colordlg.cpp                 | 15 +++--
 src/gtk/combobox.cpp                 | 14 ++---
 src/gtk/cursor.cpp                   | 19 +++++--
 src/gtk/dataview.cpp                 | 58 +++++++++++--------
 src/gtk/dnd.cpp                      | 15 +++--
 src/gtk/fontdlg.cpp                  |  4 +-
 src/gtk/frame.cpp                    |  2 +-
 src/gtk/listbox.cpp                  |  2 +-
 src/gtk/mdi.cpp                      | 24 +++-----
 src/gtk/menu.cpp                     |  9 ++-
 src/gtk/minifram.cpp                 | 39 ++++++-------
 src/gtk/nativewin.cpp                |  5 +-
 src/gtk/notebook.cpp                 | 22 ++++---
 src/gtk/popupwin.cpp                 |  2 +-
 src/gtk/radiobox.cpp                 | 20 +++----
 src/gtk/radiobut.cpp                 | 10 ++--
 src/gtk/renderer.cpp                 | 38 ++++++-------
 src/gtk/scrolbar.cpp                 | 33 +++++------
 src/gtk/scrolwin.cpp                 | 18 +++---
 src/gtk/settings.cpp                 | 17 +++---
 src/gtk/slider.cpp                   | 29 ++++++----
 src/gtk/sockgtk.cpp                  | 29 +++++-----
 src/gtk/spinctrl.cpp                 | 14 +++--
 src/gtk/statbox.cpp                  | 12 ++--
 src/gtk/taskbar.cpp                  | 21 +++++--
 src/gtk/textctrl.cpp                 | 64 ++++++++++++++++-----
 src/gtk/textentry.cpp                | 12 +++-
 src/gtk/tglbtn.cpp                   | 12 ++--
 src/gtk/toolbar.cpp                  | 40 ++++++++-----
 src/gtk/tooltip.cpp                  | 14 ++++-
 src/gtk/toplevel.cpp                 | 85 +++++++++++++++++-----------
 src/gtk/treeentry_gtk.c              |  7 +--
 src/gtk/utilsgtk.cpp                 | 22 +++----
 50 files changed, 534 insertions(+), 374 deletions(-)

diff --git a/include/wx/gtk/mdi.h b/include/wx/gtk/mdi.h
index a10f42fb22..d4d65c0439 100644
--- a/include/wx/gtk/mdi.h
+++ b/include/wx/gtk/mdi.h
@@ -120,7 +120,6 @@ public:
     void OnMenuHighlight( wxMenuEvent& event );
 
     wxMenuBar         *m_menuBar;
-    GtkNotebookPage   *m_page;
     bool               m_justInserted;
 
 private:
diff --git a/include/wx/gtk/private/gtk2-compat.h b/include/wx/gtk/private/gtk2-compat.h
index 051f9360d1..10203d05d5 100644
--- a/include/wx/gtk/private/gtk2-compat.h
+++ b/include/wx/gtk/private/gtk2-compat.h
@@ -54,6 +54,15 @@ static inline gpointer wx_g_object_ref_sink(gpointer object)
 }
 #define g_object_ref_sink wx_g_object_ref_sink
 
+// ----------------------------------------------------------------------------
+// the following were introduced in GTK+ 2.12
+
+static inline void wx_gtk_about_dialog_set_program_name(GtkAboutDialog* about, const gchar* name)
+{
+    gtk_about_dialog_set_name(about, name);
+}
+#define gtk_about_dialog_set_program_name wx_gtk_about_dialog_set_program_name
+
 // ----------------------------------------------------------------------------
 // the following were introduced in GTK+ 2.14
 
@@ -87,6 +96,12 @@ static inline gdouble wx_gtk_adjustment_get_upper(GtkAdjustment* adjustment)
 }
 #define gtk_adjustment_get_upper wx_gtk_adjustment_get_upper
 
+static inline void wx_gtk_adjustment_set_page_size(GtkAdjustment* adjustment, gdouble page_size)
+{
+    adjustment->page_size = page_size;
+}
+#define gtk_adjustment_set_page_size wx_gtk_adjustment_set_page_size
+
 static inline GtkWidget* wx_gtk_color_selection_dialog_get_color_selection(GtkColorSelectionDialog* csd)
 {
     return csd->colorsel;
@@ -105,6 +120,12 @@ static inline GtkWidget* wx_gtk_dialog_get_action_area(GtkDialog* dialog)
 }
 #define gtk_dialog_get_action_area wx_gtk_dialog_get_action_area
 
+static inline guint16 wx_gtk_entry_get_text_length(GtkEntry* entry)
+{
+    return entry->text_length;
+}
+#define gtk_entry_get_text_length wx_gtk_entry_get_text_length
+
 static inline GtkWidget* wx_gtk_font_selection_dialog_get_cancel_button(GtkFontSelectionDialog* fsd)
 {
     return fsd->cancel_button;
@@ -117,6 +138,12 @@ static inline GtkWidget* wx_gtk_font_selection_dialog_get_ok_button(GtkFontSelec
 }
 #define gtk_font_selection_dialog_get_ok_button wx_gtk_font_selection_dialog_get_ok_button
 
+static inline const guchar* wx_gtk_selection_data_get_data(GtkSelectionData* selection_data)
+{
+    return selection_data->data;
+}
+#define gtk_selection_data_get_data wx_gtk_selection_data_get_data
+
 static inline GdkAtom wx_gtk_selection_data_get_data_type(GtkSelectionData* selection_data)
 {
     return selection_data->type;
@@ -147,6 +174,12 @@ static inline GdkWindow* wx_gtk_widget_get_window(GtkWidget* widget)
 }
 #define gtk_widget_get_window wx_gtk_widget_get_window
 
+static inline GtkWidget* wx_gtk_window_get_default_widget(GtkWindow* window)
+{
+    return window->default_widget;
+}
+#define gtk_window_get_default_widget wx_gtk_window_get_default_widget
+
 // ----------------------------------------------------------------------------
 // the following were introduced in GTK+ 2.16
 
@@ -159,6 +192,20 @@ static inline GdkAtom wx_gtk_selection_data_get_selection(GtkSelectionData* sele
 // ----------------------------------------------------------------------------
 // the following were introduced in GTK+ 2.18
 
+static inline void wx_gtk_cell_renderer_get_alignment(GtkCellRenderer* cell, gfloat* xalign, gfloat* yalign)
+{
+    *xalign = cell->xalign;
+    *yalign = cell->yalign;
+}
+#define gtk_cell_renderer_get_alignment wx_gtk_cell_renderer_get_alignment
+
+static inline void wx_gtk_cell_renderer_get_padding(GtkCellRenderer* cell, gint* xpad, gint* ypad)
+{
+    *xpad = cell->xpad;
+    *ypad = cell->ypad;
+}
+#define gtk_cell_renderer_get_padding wx_gtk_cell_renderer_get_padding
+
 static inline void wx_gtk_widget_get_allocation(GtkWidget* widget, GtkAllocation* allocation)
 {
     *allocation = widget->allocation;
@@ -280,6 +327,12 @@ inline gboolean wx_gtk_widget_get_mapped(GtkWidget *widget)
 }
 #define gtk_widget_get_mapped wx_gtk_widget_get_mapped
 
+static inline void wx_gtk_widget_get_requisition(GtkWidget* widget, GtkRequisition* requisition)
+{
+    *requisition = widget->requisition;
+}
+#define gtk_widget_get_requisition wx_gtk_widget_get_requisition
+
 static inline GdkWindow* wx_gtk_entry_get_text_window(GtkEntry* entry)
 {
     return entry->text_area;
diff --git a/include/wx/gtk/scrolbar.h b/include/wx/gtk/scrolbar.h
index 9f909f17aa..fb9ab1bc9f 100644
--- a/include/wx/gtk/scrolbar.h
+++ b/include/wx/gtk/scrolbar.h
@@ -10,14 +10,6 @@
 #ifndef _WX_GTK_SCROLLBAR_H_
 #define _WX_GTK_SCROLLBAR_H_
 
-#include "wx/defs.h"
-
-//-----------------------------------------------------------------------------
-// classes
-//-----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_FWD_CORE wxScrollBar;
-
 //-----------------------------------------------------------------------------
 // wxScrollBar
 //-----------------------------------------------------------------------------
@@ -57,10 +49,6 @@ public:
     static wxVisualAttributes
     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
-protected:
-    virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
-
-private:
     DECLARE_DYNAMIC_CLASS(wxScrollBar)
 };
 
diff --git a/include/wx/gtk/textctrl.h b/include/wx/gtk/textctrl.h
index d17eade894..9db822c90b 100644
--- a/include/wx/gtk/textctrl.h
+++ b/include/wx/gtk/textctrl.h
@@ -214,6 +214,7 @@ private:
     GtkTextBuffer *m_buffer;
 
     GtkTextMark* m_showPositionOnThaw;
+    GSList* m_anonymousMarkList;
 
     // For wxTE_AUTO_URL
     void OnUrlMouseEvent(wxMouseEvent&);
diff --git a/include/wx/gtk/treeentry_gtk.h b/include/wx/gtk/treeentry_gtk.h
index 95127e89ab..2bd15dc5af 100644
--- a/include/wx/gtk/treeentry_gtk.h
+++ b/include/wx/gtk/treeentry_gtk.h
@@ -19,9 +19,9 @@ extern "C" {
 #include "wx/dlimpexp.h"
 
 #define GTK_TYPE_TREE_ENTRY          (gtk_tree_entry_get_type())
-#define GTK_TREE_ENTRY(obj)          (GTK_CHECK_CAST (obj, gtk_tree_entry_get_type (), GtkTreeEntry))
-#define GTK_TREE_ENTRY_CLASS(klass)  (GTK_CHECK_CLASS_CAST (klass, gtk_tree_entry_get_type (), GtkTreeEntryClass))
-#define GTK_IS_TREE_ENTRY(obj)       (GTK_CHECK_TYPE (obj, gtk_tree_entry_get_type ()))
+#define GTK_TREE_ENTRY(obj)          (G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_tree_entry_get_type (), GtkTreeEntry))
+#define GTK_TREE_ENTRY_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST (klass, gtk_tree_entry_get_type (), GtkTreeEntryClass))
+#define GTK_IS_TREE_ENTRY(obj)       (G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_tree_entry_get_type ()))
 
 typedef struct _GtkTreeEntry        GtkTreeEntry;
 typedef struct _GtkTreeEntryClass   GtkTreeEntryClass;
@@ -47,7 +47,7 @@ WXDLLIMPEXP_CORE
 GtkTreeEntry* gtk_tree_entry_new        (void);
 
 WXDLLIMPEXP_CORE
-GtkType    gtk_tree_entry_get_type      (void);
+GType    gtk_tree_entry_get_type      (void);
 
 WXDLLIMPEXP_CORE
 gchar*     gtk_tree_entry_get_collate_key     (GtkTreeEntry* entry);
diff --git a/src/aui/dockart.cpp b/src/aui/dockart.cpp
index 3c88ed6b96..326f6e9c14 100644
--- a/src/aui/dockart.cpp
+++ b/src/aui/dockart.cpp
@@ -414,7 +414,7 @@ void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation,
 
     gtk_paint_handle
     (
-        window->m_wxwindow->style,
+        gtk_widget_get_style(window->m_wxwindow),
         window->GTKGetDrawingWindow(),
         // flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
         GTK_STATE_NORMAL,
diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp
index 6988854125..40a3a14490 100644
--- a/src/aui/framemanager.cpp
+++ b/src/aui/framemanager.cpp
@@ -223,6 +223,7 @@ END_EVENT_TABLE()
   // __WXGTK20__
 
 #include <gtk/gtk.h>
+#include "wx/gtk/private/gtk2-compat.h"
 
 static void
 gtk_pseudo_window_realized_callback( GtkWidget *m_widget, void *WXUNUSED(win) )
@@ -237,7 +238,7 @@ gtk_pseudo_window_realized_callback( GtkWidget *m_widget, void *WXUNUSED(win) )
                     if ((j*16+8)<amount)
                         region.Union(0, y, disp.x, 1);
                 }
-        gdk_window_shape_combine_region(m_widget->window, region.GetRegion(), 0, 0);
+        gdk_window_shape_combine_region(gtk_widget_get_window(m_widget), region.GetRegion(), 0, 0);
 }
 
 
diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp
index fdcc5a8870..9bad6ac633 100644
--- a/src/common/popupcmn.cpp
+++ b/src/common/popupcmn.cpp
@@ -44,6 +44,7 @@
 
 #ifdef __WXGTK__
     #include <gtk/gtk.h>
+    #include "wx/gtk/private/gtk2-compat.h"
 #elif defined(__WXMSW__)
     #include "wx/msw/private.h"
 #elif defined(__WXX11__)
@@ -343,7 +344,7 @@ bool wxPopupTransientWindow::Show( bool show )
     {
         gtk_grab_add( m_widget );
 
-        gdk_pointer_grab( m_widget->window, TRUE,
+        gdk_pointer_grab( gtk_widget_get_window(m_widget), true,
                           (GdkEventMask)
                             (GDK_BUTTON_PRESS_MASK |
                              GDK_BUTTON_RELEASE_MASK |
diff --git a/src/generic/statusbr.cpp b/src/generic/statusbr.cpp
index 4273049a9d..3fdc2d8bc8 100644
--- a/src/generic/statusbr.cpp
+++ b/src/generic/statusbr.cpp
@@ -414,7 +414,7 @@ void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
         GdkWindowEdge edge =
             GetLayoutDirection() == wxLayout_RightToLeft ? GDK_WINDOW_EDGE_SOUTH_WEST :
                                                            GDK_WINDOW_EDGE_SOUTH_EAST;
-        gtk_paint_resize_grip( m_widget->style,
+        gtk_paint_resize_grip(gtk_widget_get_style(m_widget),
                             GTKGetDrawingWindow(),
                             gtk_widget_get_state(m_widget),
                             NULL,
diff --git a/src/gtk/aboutdlg.cpp b/src/gtk/aboutdlg.cpp
index ea4c4ac317..6728f212a8 100644
--- a/src/gtk/aboutdlg.cpp
+++ b/src/gtk/aboutdlg.cpp
@@ -126,7 +126,7 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* WXUNUSED(parent))
             gs_aboutDialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new());
 
         GtkAboutDialog * const dlg = gs_aboutDialog;
-        gtk_about_dialog_set_name(dlg, wxGTK_CONV_SYS(info.GetName()));
+        gtk_about_dialog_set_program_name(dlg, wxGTK_CONV_SYS(info.GetName()));
         if ( info.HasVersion() )
             gtk_about_dialog_set_version(dlg, wxGTK_CONV_SYS(info.GetVersion()));
         else
diff --git a/src/gtk/artgtk.cpp b/src/gtk/artgtk.cpp
index 99142b5f15..88c32a4cac 100644
--- a/src/gtk/artgtk.cpp
+++ b/src/gtk/artgtk.cpp
@@ -203,7 +203,7 @@ GdkPixbuf *CreateStockIcon(const char *stockid, GtkIconSize size)
     //        with "stock-id" representation (in addition to pixmap and pixbuf
     //        ones) and would convert it to pixbuf when rendered.
 
-    GtkStyle* style = wxGTKPrivate::GetButtonWidget()->style;
+    GtkStyle* style = gtk_widget_get_style(wxGTKPrivate::GetButtonWidget());
     GtkIconSet* iconset = gtk_style_lookup_icon_set(style, stockid);
 
     if (!iconset)
@@ -310,7 +310,7 @@ wxGTK2ArtProvider::CreateIconBundle(const wxArtID& id,
     const wxString stockid = wxArtIDToStock(id);
 
     // try to load the bundle as stock icon first
-    GtkStyle* style = wxGTKPrivate::GetButtonWidget()->style;
+    GtkStyle* style = gtk_widget_get_style(wxGTKPrivate::GetButtonWidget());
     GtkIconSet* iconset = gtk_style_lookup_icon_set(style, stockid.utf8_str());
     if ( iconset )
     {
diff --git a/src/gtk/bmpcbox.cpp b/src/gtk/bmpcbox.cpp
index 0a5f75fbe3..b625542b10 100644
--- a/src/gtk/bmpcbox.cpp
+++ b/src/gtk/bmpcbox.cpp
@@ -122,8 +122,8 @@ void wxBitmapComboBox::GTKCreateComboBoxWidget()
     else
     {
         m_widget = gtk_combo_box_entry_new_with_model( GTK_TREE_MODEL(store), m_stringCellIndex );
-        m_entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
-        gtk_entry_set_editable( m_entry, TRUE );
+        m_entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(m_widget)));
+        gtk_editable_set_editable(GTK_EDITABLE(m_entry), true);
     }
     g_object_ref(m_widget);
 
diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp
index 68ae2b0eca..2d83f10cbf 100644
--- a/src/gtk/button.cpp
+++ b/src/gtk/button.cpp
@@ -287,7 +287,7 @@ bool wxButton::Enable( bool enable )
     if (!base_type::Enable(enable))
         return false;
 
-    gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
+    gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(m_widget)), enable);
 
     if (enable)
         GTKFixSensitivity();
@@ -304,18 +304,21 @@ GdkWindow *wxButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
 
 GtkLabel *wxButton::GTKGetLabel() const
 {
-    GtkWidget *child = GTK_BIN(m_widget)->child;
+    GtkWidget* child = gtk_bin_get_child(GTK_BIN(m_widget));
     if ( GTK_IS_ALIGNMENT(child) )
     {
-        GtkWidget *box = GTK_BIN(child)->child;
-        for (GList* item = GTK_BOX(box)->children; item; item = item->next)
+        GtkWidget* box = gtk_bin_get_child(GTK_BIN(child));
+        GtkLabel* label = NULL;
+        GList* list = gtk_container_get_children(GTK_CONTAINER(box));
+        for (GList* item = list; item; item = item->next)
         {
             GtkBoxChild* boxChild = static_cast<GtkBoxChild*>(item->data);
             if ( GTK_IS_LABEL(boxChild->widget) )
-                return GTK_LABEL(boxChild->widget);
+                label = GTK_LABEL(boxChild->widget);
         }
+        g_list_free(list);
 
-        return NULL;
+        return label;
     }
 
     return GTK_LABEL(child);
@@ -324,21 +327,23 @@ GtkLabel *wxButton::GTKGetLabel() const
 void wxButton::DoApplyWidgetStyle(GtkRcStyle *style)
 {
     gtk_widget_modify_style(m_widget, style);
-    GtkWidget *child = GTK_BIN(m_widget)->child;
+    GtkWidget* child = gtk_bin_get_child(GTK_BIN(m_widget));
     gtk_widget_modify_style(child, style);
 
     // for buttons with images, the path to the label is (at least in 2.12)
     // GtkButton -> GtkAlignment -> GtkHBox -> GtkLabel
     if ( GTK_IS_ALIGNMENT(child) )
     {
-        GtkWidget *box = GTK_BIN(child)->child;
+        GtkWidget* box = gtk_bin_get_child(GTK_BIN(child));
         if ( GTK_IS_BOX(box) )
         {
-            for (GList* item = GTK_BOX(box)->children; item; item = item->next)
+            GList* list = gtk_container_get_children(GTK_CONTAINER(box));
+            for (GList* item = list; item; item = item->next)
             {
                 GtkBoxChild* boxChild = static_cast<GtkBoxChild*>(item->data);
                 gtk_widget_modify_style(boxChild->widget, style);
             }
+            g_list_free(list);
         }
     }
 }
@@ -460,7 +465,7 @@ void wxButton::GTKDoShowBitmap(const wxBitmap& bitmap)
     GtkWidget *image;
     if ( DontShowLabel() )
     {
-        image = GTK_BIN(m_widget)->child;
+        image = gtk_bin_get_child(GTK_BIN(m_widget));
     }
     else // have both label and bitmap
     {
diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp
index 415b5c4e64..f7dc166843 100644
--- a/src/gtk/checkbox.cpp
+++ b/src/gtk/checkbox.cpp
@@ -131,7 +131,7 @@ bool wxCheckBox::Create(wxWindow *parent,
     else
     {
         m_widgetCheckbox = gtk_check_button_new_with_label("");
-        m_widgetLabel = GTK_BIN(m_widgetCheckbox)->child;
+        m_widgetLabel = gtk_bin_get_child(GTK_BIN(m_widgetCheckbox));
         m_widget = m_widgetCheckbox;
     }
     g_object_ref(m_widget);
diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp
index 00170f2950..d9fc4408c7 100644
--- a/src/gtk/choice.cpp
+++ b/src/gtk/choice.cpp
@@ -334,7 +334,7 @@ void wxChoice::GTKEnableEvents()
 
 GdkWindow *wxChoice::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
 {
-    return m_widget->window;
+    return gtk_widget_get_window(m_widget);
 }
 
 // Notice that this method shouldn't be necessary, because GTK calculates
@@ -371,7 +371,7 @@ wxSize wxChoice::DoGetBestSize() const
 void wxChoice::DoApplyWidgetStyle(GtkRcStyle *style)
 {
     gtk_widget_modify_style(m_widget, style);
-    gtk_widget_modify_style(GTK_BIN(m_widget)->child, style);
+    gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(m_widget)), style);
 }
 
 
diff --git a/src/gtk/clipbrd.cpp b/src/gtk/clipbrd.cpp
index f963bdd6ae..6e02151f4b 100644
--- a/src/gtk/clipbrd.cpp
+++ b/src/gtk/clipbrd.cpp
@@ -133,11 +133,15 @@ targets_selection_received( GtkWidget *WXUNUSED(widget),
 
     wxON_BLOCK_EXIT1(wxClipboardSync::OnDone, clipboard);
 
-    if ( !selection_data || selection_data->length <= 0 )
+    if (!selection_data)
+        return;
+
+    const int selection_data_length = gtk_selection_data_get_length(selection_data);
+    if (selection_data_length <= 0)
         return;
 
     // make sure we got the data in the correct form
-    GdkAtom type = selection_data->type;
+    GdkAtom type = gtk_selection_data_get_data_type(selection_data);
     if ( type != GDK_SELECTION_TYPE_ATOM )
     {
         if ( strcmp(wxGtkString(gdk_atom_name(type)), "TARGETS") != 0 )
@@ -151,14 +155,14 @@ targets_selection_received( GtkWidget *WXUNUSED(widget),
 
     // it's not really a format, of course, but we can reuse its GetId() method
     // to format this atom as string
-    wxDataFormat clip(selection_data->selection);
+    wxDataFormat clip(gtk_selection_data_get_selection(selection_data));
     wxLogTrace( TRACE_CLIPBOARD,
                 wxT("Received available formats for clipboard %s"),
                 clip.GetId().c_str() );
 
     // the atoms we received, holding a list of targets (= formats)
-    const GdkAtom * const atoms = (GdkAtom *)selection_data->data;
-    for ( size_t i = 0; i < selection_data->length/sizeof(GdkAtom); i++ )
+    const GdkAtom* const atoms = (GdkAtom*)gtk_selection_data_get_data(selection_data);
+    for (size_t i = 0; i < selection_data_length / sizeof(GdkAtom); i++)
     {
         const wxDataFormat format(atoms[i]);
 
@@ -195,7 +199,7 @@ selection_received( GtkWidget *WXUNUSED(widget),
 
     wxON_BLOCK_EXIT1(wxClipboardSync::OnDone, clipboard);
 
-    if ( !selection_data || selection_data->length <= 0 )
+    if (!selection_data || gtk_selection_data_get_length(selection_data) <= 0)
         return;
 
     clipboard->GTKOnSelectionReceived(*selection_data);
@@ -262,7 +266,8 @@ selection_handler( GtkWidget *WXUNUSED(widget),
     if ( !clipboard )
         return;
 
-    wxDataObject * const data = clipboard->GTKGetDataObject(selection_data->selection);
+    wxDataObject * const data = clipboard->GTKGetDataObject(
+        gtk_selection_data_get_selection(selection_data));
     if ( !data )
         return;
 
@@ -270,7 +275,7 @@ selection_handler( GtkWidget *WXUNUSED(widget),
     // In particular, it satisfies Klipper, which polls
     // TIMESTAMP to see if the clipboards content has changed.
     // It shall return the time which was used to set the data.
-    if (selection_data->target == g_timestampAtom)
+    if (gtk_selection_data_get_target(selection_data) == g_timestampAtom)
     {
         guint timestamp = GPOINTER_TO_UINT (signal_data);
         gtk_selection_data_set(selection_data,
@@ -284,14 +289,14 @@ selection_handler( GtkWidget *WXUNUSED(widget),
         return;
     }
 
-    wxDataFormat format( selection_data->target );
+    wxDataFormat format(gtk_selection_data_get_target(selection_data));
 
     wxLogTrace(TRACE_CLIPBOARD,
                wxT("clipboard data in format %s, GtkSelectionData is target=%s type=%s selection=%s timestamp=%u"),
                format.GetId().c_str(),
-               wxString::FromAscii(wxGtkString(gdk_atom_name(selection_data->target))).c_str(),
-               wxString::FromAscii(wxGtkString(gdk_atom_name(selection_data->type))).c_str(),
-               wxString::FromAscii(wxGtkString(gdk_atom_name(selection_data->selection))).c_str(),
+               wxString::FromAscii(wxGtkString(gdk_atom_name(gtk_selection_data_get_target(selection_data)))).c_str(),
+               wxString::FromAscii(wxGtkString(gdk_atom_name(gtk_selection_data_get_data_type(selection_data)))).c_str(),
+               wxString::FromAscii(wxGtkString(gdk_atom_name(gtk_selection_data_get_selection(selection_data)))).c_str(),
                GPOINTER_TO_UINT( signal_data )
                );
 
@@ -335,14 +340,16 @@ void wxClipboard::GTKOnSelectionReceived(const GtkSelectionData& sel)
 {
     wxCHECK_RET( m_receivedData, wxT("should be inside GetData()") );
 
-    const wxDataFormat format(sel.target);
+    const wxDataFormat format(gtk_selection_data_get_target(const_cast<GtkSelectionData*>(&sel)));
     wxLogTrace(TRACE_CLIPBOARD, wxT("Received selection %s"),
                format.GetId().c_str());
 
     if ( !m_receivedData->IsSupportedFormat(format) )
         return;
 
-    m_receivedData->SetData(format, sel.length, sel.data);
+    m_receivedData->SetData(format,
+        gtk_selection_data_get_length(const_cast<GtkSelectionData*>(&sel)),
+        gtk_selection_data_get_data(const_cast<GtkSelectionData*>(&sel)));
     m_formatSupported = true;
 }
 
@@ -366,7 +373,11 @@ async_targets_selection_received( GtkWidget *WXUNUSED(widget),
     wxClipboardEvent *event = new wxClipboardEvent(wxEVT_CLIPBOARD_CHANGED);
     event->SetEventObject( clipboard );
 
-    if ( !selection_data || selection_data->length <= 0 )
+    int selection_data_length = 0;
+    if (selection_data)
+        selection_data_length = gtk_selection_data_get_length(selection_data);
+
+    if (selection_data_length <= 0)
     {
         clipboard->m_sink->QueueEvent( event );
         clipboard->m_sink.Release();
@@ -374,7 +385,7 @@ async_targets_selection_received( GtkWidget *WXUNUSED(widget),
     }
 
     // make sure we got the data in the correct form
-    GdkAtom type = selection_data->type;
+    GdkAtom type = gtk_selection_data_get_data_type(selection_data);
     if ( type != GDK_SELECTION_TYPE_ATOM )
     {
         if ( strcmp(wxGtkString(gdk_atom_name(type)), "TARGETS") != 0 )
@@ -390,14 +401,14 @@ async_targets_selection_received( GtkWidget *WXUNUSED(widget),
 
     // it's not really a format, of course, but we can reuse its GetId() method
     // to format this atom as string
-    wxDataFormat clip(selection_data->selection);
+    wxDataFormat clip(gtk_selection_data_get_selection(selection_data));
     wxLogTrace( TRACE_CLIPBOARD,
                 wxT("Received available formats for clipboard %s"),
                 clip.GetId().c_str() );
 
     // the atoms we received, holding a list of targets (= formats)
-    const GdkAtom * const atoms = (GdkAtom *)selection_data->data;
-    for ( size_t i = 0; i < selection_data->length/sizeof(GdkAtom); i++ )
+    const GdkAtom* const atoms = (GdkAtom*)gtk_selection_data_get_data(selection_data);
+    for (size_t i = 0; i < selection_data_length / sizeof(GdkAtom); i++)
     {
         const wxDataFormat format(atoms[i]);
 
@@ -568,7 +579,7 @@ void wxClipboard::Clear()
     gtk_selection_clear_targets( m_clipboardWidget, GTKGetClipboardAtom() );
 
     if ( gdk_selection_owner_get(GTKGetClipboardAtom()) ==
-            m_clipboardWidget->window )
+            gtk_widget_get_window(m_clipboardWidget) )
     {
         wxClipboardSync sync(*this);
 
diff --git a/src/gtk/collpane.cpp b/src/gtk/collpane.cpp
index 87b4a42488..e81789300e 100644
--- a/src/gtk/collpane.cpp
+++ b/src/gtk/collpane.cpp
@@ -281,8 +281,8 @@ void wxCollapsiblePane::OnSize(wxSizeEvent &ev)
 GdkWindow *wxCollapsiblePane::GTKGetWindow(wxArrayGdkWindows& windows) const
 {
     GtkWidget *label = gtk_expander_get_label_widget( GTK_EXPANDER(m_widget) );
-    windows.Add( label->window );
-    windows.Add( m_widget->window );
+    windows.Add(gtk_widget_get_window(label));
+    windows.Add(gtk_widget_get_window(m_widget));
 
     return NULL;
 }
diff --git a/src/gtk/colordlg.cpp b/src/gtk/colordlg.cpp
index 981d8527e3..ca9e536a65 100644
--- a/src/gtk/colordlg.cpp
+++ b/src/gtk/colordlg.cpp
@@ -69,8 +69,9 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
     }
 
 #if !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2
-    GtkColorSelection *sel =
-        GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(m_widget)->colorsel);
+    GtkColorSelection* sel = GTK_COLOR_SELECTION(
+        gtk_color_selection_dialog_get_color_selection(
+        GTK_COLOR_SELECTION_DIALOG(m_widget)));
     gtk_color_selection_set_has_palette(sel, true);
 #endif // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2
 
@@ -123,8 +124,9 @@ void wxColourDialog::ColourDataToDialog()
 
     hildon_color_chooser_dialog_set_color((HildonColorChooserDialog *)m_widget, &clr);
 #else // !wxUSE_LIBHILDON2/!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2
-    GtkColorSelection *sel =
-        GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(m_widget)->colorsel);
+    GtkColorSelection* sel = GTK_COLOR_SELECTION(
+        gtk_color_selection_dialog_get_color_selection(
+        GTK_COLOR_SELECTION_DIALOG(m_widget)));
 
     if ( col )
         gtk_color_selection_set_current_color(sel, col);
@@ -176,8 +178,9 @@ void wxColourDialog::DialogToColourData()
     m_data.SetColour(new_color);
 #else // !wxUSE_LIBHILDON2
 
-    GtkColorSelection *sel =
-        GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(m_widget)->colorsel);
+    GtkColorSelection* sel = GTK_COLOR_SELECTION(
+        gtk_color_selection_dialog_get_color_selection(
+        GTK_COLOR_SELECTION_DIALOG(m_widget)));
 
     GdkColor clr;
     gtk_color_selection_get_current_color(sel, &clr);
diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp
index 23f4becc49..045c6166ba 100644
--- a/src/gtk/combobox.cpp
+++ b/src/gtk/combobox.cpp
@@ -134,7 +134,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
         gtk_entry_set_activates_default( entry,
                                          !HasFlag(wxTE_PROCESS_ENTER) );
 
-        gtk_entry_set_editable( entry, TRUE );
+        gtk_editable_set_editable(GTK_EDITABLE(entry), true);
     }
 
     Append(n, choices);
@@ -155,7 +155,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
             // wxMSW and also because it doesn't make sense to have a string
             // which is not a possible choice in a read-only combobox)
             SetStringSelection(value);
-            gtk_entry_set_editable( entry, FALSE );
+            gtk_editable_set_editable(GTK_EDITABLE(entry), false);
         }
         else // editable combobox
         {
@@ -186,12 +186,12 @@ void wxComboBox::GTKCreateComboBoxWidget()
     m_widget = gtk_combo_box_entry_new_text();
     g_object_ref(m_widget);
 
-    m_entry = GTK_ENTRY(GTK_BIN(m_widget)->child);
+    m_entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(m_widget)));
 }
 
 GtkEditable *wxComboBox::GetEditable() const
 {
-    return GTK_EDITABLE( GTK_BIN(m_widget)->child );
+    return GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(m_widget)));
 }
 
 void wxComboBox::OnChar( wxKeyEvent &event )
@@ -227,12 +227,12 @@ void wxComboBox::EnableTextChangedEvents(bool enable)
 
     if ( enable )
     {
-        g_signal_handlers_unblock_by_func(GTK_BIN(m_widget)->child,
+        g_signal_handlers_unblock_by_func(gtk_bin_get_child(GTK_BIN(m_widget)),
             (gpointer)gtkcombobox_text_changed_callback, this);
     }
     else // disable
     {
-        g_signal_handlers_block_by_func(GTK_BIN(m_widget)->child,
+        g_signal_handlers_block_by_func(gtk_bin_get_child(GTK_BIN(m_widget)),
             (gpointer)gtkcombobox_text_changed_callback, this);
     }
 }
@@ -264,7 +264,7 @@ GtkWidget* wxComboBox::GetConnectWidget()
 
 GdkWindow* wxComboBox::GTKGetWindow(wxArrayGdkWindows& /* windows */) const
 {
-    return GetEntry()->text_area;
+    return gtk_entry_get_text_window(GetEntry());
 }
 
 // static
diff --git a/src/gtk/cursor.cpp b/src/gtk/cursor.cpp
index 3ebc5e1a4f..73983f1351 100644
--- a/src/gtk/cursor.cpp
+++ b/src/gtk/cursor.cpp
@@ -22,6 +22,7 @@
 
 #include <gtk/gtk.h>
 #include "wx/gtk/private/object.h"
+#include "wx/gtk/private/gtk2-compat.h"
 
 //-----------------------------------------------------------------------------
 // wxCursorRefData
@@ -109,8 +110,10 @@ wxCursor::wxCursor(const char bits[], int width, int height,
     if (hotSpotY < 0 || hotSpotY >= height)
         hotSpotY = 0;
 
-    GdkBitmap *data = gdk_bitmap_create_from_data( wxGetRootWindow()->window, (gchar *) bits, width, height );
-    GdkBitmap *mask = gdk_bitmap_create_from_data( wxGetRootWindow()->window, (gchar *) maskBits, width, height);
+    GdkBitmap* data = gdk_bitmap_create_from_data(
+        gtk_widget_get_window(wxGetRootWindow()), const_cast<char*>(bits), width, height);
+    GdkBitmap* mask = gdk_bitmap_create_from_data(
+        gtk_widget_get_window(wxGetRootWindow()), const_cast<char*>(maskBits), width, height);
 
     m_refData = new wxCursorRefData;
     M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixmap(
@@ -221,7 +224,7 @@ void wxCursor::InitFromImage( const wxImage & image )
     m_refData = new wxCursorRefData;
     wxImage image_copy(image);
 
-    GdkDisplay* display = gdk_drawable_get_display(wxGetRootWindow()->window);
+    GdkDisplay* display = gdk_drawable_get_display(gtk_widget_get_window(wxGetRootWindow()));
     if (gdk_display_supports_cursor_color(display))
     {
         if (!image.HasAlpha())
@@ -257,7 +260,7 @@ void wxCursor::InitFromImage( const wxImage & image )
             char* bits = new char[size];
             memset(bits, 0xff, size);
             maskRaw = gdk_bitmap_create_from_data(
-                wxGetRootWindow()->window, bits, w, h);
+                gtk_widget_get_window(wxGetRootWindow()), bits, w, h);
             delete[] bits;
         }
 
@@ -393,8 +396,12 @@ static void UpdateCursors(const wxWindowList& list, GdkDisplay*& display)
     for (size_t n = list.size(); n--; ++i)
     {
         wxWindow* win = *i;
-        if (display == NULL && win->m_widget && win->m_widget->window)
-            display = gdk_drawable_get_display(win->m_widget->window);
+        if (display == NULL && win->m_widget)
+        {
+            GdkWindow* w = gtk_widget_get_window(win->m_widget);
+            if (w)
+                display = gdk_drawable_get_display(w);
+        }
         win->GTKUpdateCursor(true, false);
         UpdateCursors(win->GetChildren(), display);
     }
diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp
index dcb66b9c9c..a07d7a659f 100644
--- a/src/gtk/dataview.cpp
+++ b/src/gtk/dataview.cpp
@@ -493,11 +493,11 @@ static void     wxgtk_tree_model_set_sort_func         (GtkTreeSortable       *s
                                                         gint                   sort_column_id,
                                                         GtkTreeIterCompareFunc func,
                                                         gpointer               data,
-                                                        GtkDestroyNotify       destroy);
+                                                        GDestroyNotify       destroy);
 static void     wxgtk_tree_model_set_default_sort_func (GtkTreeSortable       *sortable,
                                                         GtkTreeIterCompareFunc func,
                                                         gpointer               data,
-                                                        GtkDestroyNotify       destroy);
+                                                        GDestroyNotify       destroy);
 static gboolean wxgtk_tree_model_has_default_sort_func (GtkTreeSortable       *sortable);
 
 /* drag'n'drop */
@@ -966,7 +966,7 @@ wxgtk_tree_model_set_sort_func (GtkTreeSortable        *sortable,
                                 gint                    WXUNUSED(sort_column_id),
                                 GtkTreeIterCompareFunc  func,
                                 gpointer                WXUNUSED(data),
-                                GtkDestroyNotify        WXUNUSED(destroy))
+                                GDestroyNotify        WXUNUSED(destroy))
 {
     g_return_if_fail (GTK_IS_WX_TREE_MODEL (sortable) );
     g_return_if_fail (func != NULL);
@@ -976,7 +976,7 @@ static void
 wxgtk_tree_model_set_default_sort_func (GtkTreeSortable          *sortable,
                                         GtkTreeIterCompareFunc    func,
                                         gpointer                  WXUNUSED(data),
-                                        GtkDestroyNotify          WXUNUSED(destroy))
+                                        GDestroyNotify          WXUNUSED(destroy))
 {
     g_return_if_fail (GTK_IS_WX_TREE_MODEL (sortable) );
     g_return_if_fail (func != NULL);
@@ -1333,8 +1333,10 @@ gtk_wx_cell_renderer_get_size (GtkCellRenderer *renderer,
 
     wxSize size = cell->GetSize();
 
-    gint calc_width  = (gint) renderer->xpad * 2 + size.x;
-    gint calc_height = (gint) renderer->ypad * 2 + size.y;
+    int xpad, ypad;
+    gtk_cell_renderer_get_padding(renderer, &xpad, &ypad);
+    int calc_width  = xpad * 2 + size.x;
+    int calc_height = ypad * 2 + size.y;
 
     if (x_offset)
         *x_offset = 0;
@@ -1343,17 +1345,17 @@ gtk_wx_cell_renderer_get_size (GtkCellRenderer *renderer,
 
     if (cell_area && size.x > 0 && size.y > 0)
     {
+        float xalign, yalign;
+        gtk_cell_renderer_get_alignment(renderer, &xalign, &yalign);
         if (x_offset)
         {
-            *x_offset = (gint)((renderer->xalign *
-                               (cell_area->width - calc_width - 2 * renderer->xpad)));
-            *x_offset = MAX (*x_offset, 0) + renderer->xpad;
+            *x_offset = int(xalign * (cell_area->width - calc_width - 2 * xpad));
+            *x_offset = MAX(*x_offset, 0) + xpad;
         }
         if (y_offset)
         {
-            *y_offset = (gint)((renderer->yalign *
-                               (cell_area->height - calc_height - 2 * renderer->ypad)));
-            *y_offset = MAX (*y_offset, 0) + renderer->ypad;
+            *y_offset = int(yalign * (cell_area->height - calc_height - 2 * ypad));
+            *y_offset = MAX(*y_offset, 0) + ypad;
         }
     }
 
@@ -1381,7 +1383,9 @@ gtk_wx_cell_renderer_render (GtkCellRenderer      *renderer,
                                background_area, expose_area, flags);
 
     wxRect rect(wxRectFromGDKRect(cell_area));
-    rect = rect.Deflate(renderer->xpad, renderer->ypad);
+    int xpad, ypad;
+    gtk_cell_renderer_get_padding(renderer, &xpad, &ypad);
+    rect = rect.Deflate(xpad, ypad);
 
     wxWindowDC* dc = (wxWindowDC*) cell->GetDC();
     wxWindowDCImpl *impl = (wxWindowDCImpl *) dc->GetImpl();
@@ -1431,8 +1435,10 @@ gtk_wx_cell_renderer_activate(
 
     rect.x += cell_area->x;
     rect.y += cell_area->y;
-    rect.width  -= renderer->xpad * 2;
-    rect.height -= renderer->ypad * 2;
+    int xpad, ypad;
+    gtk_cell_renderer_get_padding(renderer, &xpad, &ypad);
+    rect.width  -= xpad * 2;
+    rect.height -= ypad * 2;
 
     wxRect renderrect(wxRectFromGDKRect(&rect));
 
@@ -2303,7 +2309,7 @@ public:
 
         m_context = window->GTKGetPangoDefaultContext();
         m_layout = pango_layout_new( m_context );
-        m_fontdesc = pango_font_description_copy( widget->style->font_desc );
+        m_fontdesc = pango_font_description_copy(gtk_widget_get_style(widget)->font_desc);
 
         m_cmap = gtk_widget_get_colormap( widget ? widget : window->m_widget );
 
@@ -2349,6 +2355,7 @@ GtkCellRendererText *wxDataViewCustomRenderer::GtkGetTextRenderer() const
         // we create it on demand so need to do it even from a const function
         const_cast<wxDataViewCustomRenderer *>(this)->
         m_text_renderer = GTK_CELL_RENDERER_TEXT(gtk_cell_renderer_text_new());
+        g_object_ref_sink(m_text_renderer);
     }
 
     return m_text_renderer;
@@ -2406,7 +2413,7 @@ wxDataViewCustomRenderer::~wxDataViewCustomRenderer()
         delete m_dc;
 
     if (m_text_renderer)
-        gtk_object_sink( GTK_OBJECT(m_text_renderer) );
+        g_object_unref(m_text_renderer);
 }
 
 wxDC *wxDataViewCustomRenderer::GetDC()
@@ -3565,21 +3572,22 @@ gboolean wxDataViewCtrlInternal::drag_data_get( GtkTreeDragSource *WXUNUSED(drag
     if ( !item )
         return FALSE;
 
-    if (!m_dragDataObject->IsSupported( selection_data->target ))
+    GdkAtom target = gtk_selection_data_get_target(selection_data);
+    if (!m_dragDataObject->IsSupported(target))
         return FALSE;
 
-    size_t size = m_dragDataObject->GetDataSize( selection_data->target );
+    size_t size = m_dragDataObject->GetDataSize(target);
     if (size == 0)
         return FALSE;
 
     void *buf = malloc( size );
 
     gboolean res = FALSE;
-    if (m_dragDataObject->GetDataHere( selection_data->target, buf ))
+    if (m_dragDataObject->GetDataHere(target, buf))
     {
         res = TRUE;
 
-        gtk_selection_data_set( selection_data, selection_data->target,
+        gtk_selection_data_set(selection_data, target,
             8, (const guchar*) buf, size );
     }
 
@@ -3601,9 +3609,9 @@ wxDataViewCtrlInternal::drag_data_received(GtkTreeDragDest *WXUNUSED(drag_dest),
     event.SetEventObject( m_owner );
     event.SetItem( item );
     event.SetModel( m_wx_model );
-    event.SetDataFormat( selection_data->target );
-    event.SetDataSize( selection_data->length );
-    event.SetDataBuffer( selection_data->data );
+    event.SetDataFormat(gtk_selection_data_get_target(selection_data));
+    event.SetDataSize(gtk_selection_data_get_length(selection_data));
+    event.SetDataBuffer(const_cast<guchar*>(gtk_selection_data_get_data(selection_data)));
     if (!m_owner->HandleWindowEvent( event ))
         return FALSE;
 
@@ -3626,7 +3634,7 @@ wxDataViewCtrlInternal::row_drop_possible(GtkTreeDragDest *WXUNUSED(drag_dest),
     event.SetEventObject( m_owner );
     event.SetItem( item );
     event.SetModel( m_wx_model );
-    event.SetDataFormat( selection_data->target );
+    event.SetDataFormat(gtk_selection_data_get_target(selection_data));
     if (!m_owner->HandleWindowEvent( event ))
         return FALSE;
 
diff --git a/src/gtk/dnd.cpp b/src/gtk/dnd.cpp
index 08adfeb885..88e4402a80 100644
--- a/src/gtk/dnd.cpp
+++ b/src/gtk/dnd.cpp
@@ -26,6 +26,7 @@
 #include "wx/scopeguard.h"
 
 #include <gtk/gtk.h>
+#include "wx/gtk/private/gtk2-compat.h"
 
 //----------------------------------------------------------------------------
 // global data
@@ -363,7 +364,7 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
     /* Owen Taylor: "call gtk_drag_finish() with
        success == TRUE" */
 
-    if ((data->length <= 0) || (data->format != 8))
+    if (gtk_selection_data_get_length(data) <= 0 || gtk_selection_data_get_format(data) != 8)
     {
         /* negative data length and non 8-bit data format
            qualifies for junk */
@@ -533,12 +534,14 @@ bool wxDropTarget::GetData()
     if (!m_dataObject)
         return false;
 
-    wxDataFormat dragFormat( m_dragData->target );
+    wxDataFormat dragFormat(gtk_selection_data_get_target(m_dragData));
 
     if (!m_dataObject->IsSupportedFormat( dragFormat ))
         return false;
 
-    m_dataObject->SetData( dragFormat, (size_t)m_dragData->length, (const void*)m_dragData->data );
+    m_dataObject->SetData(dragFormat,
+        (size_t)gtk_selection_data_get_length(m_dragData),
+        (const void*)gtk_selection_data_get_data(m_dragData));
 
     return true;
 }
@@ -605,7 +608,7 @@ source_drag_data_get  (GtkWidget          *WXUNUSED(widget),
                        guint               WXUNUSED(time),
                        wxDropSource       *drop_source )
 {
-    wxDataFormat format( selection_data->target );
+    wxDataFormat format(gtk_selection_data_get_target(selection_data));
 
     wxLogTrace(TRACE_DND, wxT("Drop source: format requested: %s"),
                format.GetId().c_str());
@@ -647,7 +650,7 @@ source_drag_data_get  (GtkWidget          *WXUNUSED(widget),
     drop_source->m_retValue = ConvertFromGTK( context->action );
 
     gtk_selection_data_set( selection_data,
-                            selection_data->target,
+                            gtk_selection_data_get_target(selection_data),
                             8,   // 8-bit
                             d,
                             size );
@@ -783,7 +786,7 @@ void wxDropSource::PrepareIcon( int action, GdkDragContext *context )
     g_signal_connect (m_iconWindow, "configure_event",
                       G_CALLBACK (gtk_dnd_window_configure_callback), this);
 
-    gdk_window_set_back_pixmap (m_iconWindow->window, pixmap, FALSE);
+    gdk_window_set_back_pixmap(gtk_widget_get_window(m_iconWindow), pixmap, false);
 
     if (mask)
         gtk_widget_shape_combine_mask (m_iconWindow, mask, 0, 0);
diff --git a/src/gtk/fontdlg.cpp b/src/gtk/fontdlg.cpp
index 8ad18f9eca..d50f46bfc5 100644
--- a/src/gtk/fontdlg.cpp
+++ b/src/gtk/fontdlg.cpp
@@ -106,10 +106,10 @@ bool wxFontDialog::DoCreate(wxWindow *parent)
 
     GtkFontSelectionDialog *sel = GTK_FONT_SELECTION_DIALOG(m_widget);
 
-    g_signal_connect (sel->ok_button, "clicked",
+    g_signal_connect (gtk_font_selection_dialog_get_ok_button(sel), "clicked",
                       G_CALLBACK (gtk_fontdialog_ok_callback), this);
 
-    g_signal_connect (sel->cancel_button, "clicked",
+    g_signal_connect (gtk_font_selection_dialog_get_cancel_button(sel), "clicked",
                       G_CALLBACK (gtk_fontdialog_cancel_callback), this);
 
     g_signal_connect (m_widget, "delete_event",
diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp
index 2110f36629..37272e7b0b 100644
--- a/src/gtk/frame.cpp
+++ b/src/gtk/frame.cpp
@@ -332,7 +332,7 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
         {
             // Vertical toolbar and m_wxwindow go into an hbox, inside the
             // vbox (m_mainWidget). hbox is created on demand.
-            GtkWidget* hbox = m_wxwindow->parent;
+            GtkWidget* hbox = gtk_widget_get_parent(m_wxwindow);
             if (!GTK_IS_HBOX(hbox))
             {
                 hbox = gtk_hbox_new(false, 0);
diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp
index b17d1a32c6..09b0b4a12a 100644
--- a/src/gtk/listbox.cpp
+++ b/src/gtk/listbox.cpp
@@ -433,7 +433,7 @@ void wxListBox::Update()
     wxWindow::Update();
 
     if (m_treeview)
-        gdk_window_process_updates(GTK_WIDGET(m_treeview)->window, TRUE);
+        gdk_window_process_updates(gtk_widget_get_window(GTK_WIDGET(m_treeview)), true);
 }
 
 // ----------------------------------------------------------------------------
diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp
index 1a3c3f570d..760a4ac4ef 100644
--- a/src/gtk/mdi.cpp
+++ b/src/gtk/mdi.cpp
@@ -27,10 +27,7 @@
 
 extern "C" {
 static void
-gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
-                              GtkNotebookPage *page,
-                              gint WXUNUSED(page_num),
-                              wxMDIParentFrame *parent )
+switch_page(GtkNotebook* widget, GtkNotebookPage*, guint page_num, wxMDIParentFrame* parent)
 {
     // send deactivate event to old child
 
@@ -49,6 +46,7 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
         return;
 
     child = NULL;
+    GtkWidget* page = gtk_notebook_get_nth_page(widget, page_num);
 
     wxWindowList::compatibility_iterator node = client_window->GetChildren().GetFirst();
     while ( node )
@@ -58,7 +56,7 @@ gtk_mdi_page_change_callback( GtkNotebook *WXUNUSED(widget),
         // child_frame can be NULL when this is called from dtor, probably
         // because g_signal_connect (m_widget, "switch_page", (see below)
         // isn't deleted early enough
-        if ( child_frame && child_frame->m_page == page )
+        if (child_frame && child_frame->m_widget == page)
         {
             child = child_frame;
             break;
@@ -114,7 +112,7 @@ void wxMDIParentFrame::OnInternalIdle()
     if (m_justInserted)
     {
         GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget);
-        gtk_notebook_set_current_page( notebook, g_list_length( notebook->children ) - 1 );
+        gtk_notebook_set_current_page(notebook, -1);
 
         /* need to set the menubar of the child */
         wxMDIChildFrame *active_child_frame = GetActiveChild();
@@ -220,7 +218,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
     gint i = gtk_notebook_get_current_page( notebook );
     if (i < 0) return NULL;
 
-    GtkNotebookPage* page = (GtkNotebookPage*) (g_list_nth(notebook->children,i)->data);
+    GtkWidget* page = gtk_notebook_get_nth_page(notebook, i);
     if (!page) return NULL;
 
     wxWindowList::compatibility_iterator node = m_clientWindow->GetChildren().GetFirst();
@@ -234,7 +232,7 @@ wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
         if (!child_frame)
             return NULL;
 
-        if (child_frame->m_page == page)
+        if (child_frame->m_widget == page)
             return child_frame;
 
         node = node->GetNext();
@@ -269,7 +267,6 @@ END_EVENT_TABLE()
 void wxMDIChildFrame::Init()
 {
     m_menuBar = NULL;
-    m_page = NULL;
 }
 
 bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
@@ -391,9 +388,7 @@ wxMDIClientWindow::~wxMDIClientWindow()
     // a call to gtk_mdi_page_change_callback with an invalid parent
     // (because gtk_mdi_page_change_callback expects a wxMDIClientWindow but
     //  at that point of the dtor chain we are a simple wxWindow!)
-    g_signal_handlers_disconnect_by_func(m_widget,
-                                         (gpointer)gtk_mdi_page_change_callback,
-                                         GetParent());
+    g_signal_handlers_disconnect_by_func(m_widget, (void*)switch_page, GetParent());
 }
 
 bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
@@ -409,8 +404,7 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
     m_widget = gtk_notebook_new();
     g_object_ref(m_widget);
 
-    g_signal_connect (m_widget, "switch_page",
-                      G_CALLBACK (gtk_mdi_page_change_callback), parent);
+    g_signal_connect(m_widget, "switch_page", G_CALLBACK(switch_page), parent);
 
     gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
 
@@ -437,8 +431,6 @@ void wxMDIClientWindow::AddChildGTK(wxWindowGTK* child)
 
     gtk_notebook_append_page( notebook, child->m_widget, label_widget );
 
-    child_frame->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data);
-
     wxMDIParentFrame* parent_frame = static_cast<wxMDIParentFrame*>(GetParent());
     parent_frame->m_justInserted = true;
 }
diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp
index 66f3785fa6..9fa6934e87 100644
--- a/src/gtk/menu.cpp
+++ b/src/gtk/menu.cpp
@@ -440,7 +440,7 @@ void wxMenuBar::SetMenuLabel( size_t pos, const wxString& label )
     menu->SetTitle( str );
 
     if (menu->m_owner)
-        gtk_label_set_text_with_mnemonic( GTK_LABEL( GTK_BIN(menu->m_owner)->child), wxGTK_CONV(str) );
+        gtk_label_set_text_with_mnemonic(GTK_LABEL(gtk_bin_get_child(GTK_BIN(menu->m_owner))), wxGTK_CONV(str));
 }
 
 //-----------------------------------------------------------------------------
@@ -581,7 +581,7 @@ void wxMenuItem::SetItemLabel( const wxString& str )
 void wxMenuItem::SetGtkLabel()
 {
     const wxString text = wxConvertMnemonicsToGTK(m_text.BeforeFirst('\t'));
-    GtkLabel* label = GTK_LABEL(GTK_BIN(m_menuItem)->child);
+    GtkLabel* label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_menuItem)));
     gtk_label_set_text_with_mnemonic(label, wxGTK_CONV_SYS(text));
 #if wxUSE_ACCEL
     guint accel_key;
@@ -640,7 +640,7 @@ bool wxMenuItem::IsChecked() const
     wxCHECK_MSG( IsCheckable(), false,
                  wxT("can't get state of uncheckable item!") );
 
-    return ((GtkCheckMenuItem*)m_menuItem)->active != 0;
+    return gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(m_menuItem)) != 0;
 }
 
 //-----------------------------------------------------------------------------
@@ -682,8 +682,7 @@ void wxMenu::Init()
     m_menu = gtk_menu_new();
     // NB: keep reference to the menu so that it is not destroyed behind
     //     our back by GTK+ e.g. when it is removed from menubar:
-    g_object_ref(m_menu);
-    gtk_object_sink(GTK_OBJECT(m_menu));
+    g_object_ref_sink(m_menu);
 
     m_owner = NULL;
 
diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp
index 1e4d289f8a..e7b8f70cb3 100644
--- a/src/gtk/minifram.cpp
+++ b/src/gtk/minifram.cpp
@@ -23,6 +23,7 @@
 #include "wx/gtk/dcclient.h"
 
 #include <gtk/gtk.h>
+#include "wx/gtk/private/gtk2-compat.h"
 
 //-----------------------------------------------------------------------------
 // data
@@ -61,13 +62,13 @@ extern "C" {
 static gboolean gtk_window_own_expose_callback(GtkWidget* widget, GdkEventExpose* gdk_event, wxMiniFrame* win)
 {
     if (!win->m_hasVMT || gdk_event->count > 0 ||
-        gdk_event->window != widget->window)
+        gdk_event->window != gtk_widget_get_window(widget))
     {
         return false;
     }
 
-    gtk_paint_shadow (widget->style,
-                      widget->window,
+    gtk_paint_shadow (gtk_widget_get_style(widget),
+                      gtk_widget_get_window(widget),
                       GTK_STATE_NORMAL,
                       GTK_SHADOW_OUT,
                       NULL, NULL, NULL, // FIXME: No clipping?
@@ -80,7 +81,7 @@ static gboolean gtk_window_own_expose_callback(GtkWidget* widget, GdkEventExpose
 
     wxDCImpl *impl = dc.GetImpl();
     wxClientDCImpl *gtk_impl = wxDynamicCast( impl, wxClientDCImpl );
-    gtk_impl->m_gdkwindow = widget->window; // Hack alert
+    gtk_impl->m_gdkwindow = gtk_widget_get_window(widget); // Hack alert
 
     if (style & wxRESIZE_BORDER)
     {
@@ -120,7 +121,7 @@ extern "C" {
 static gboolean
 gtk_window_button_press_callback(GtkWidget* widget, GdkEventButton* gdk_event, wxMiniFrame* win)
 {
-    if (!win->m_hasVMT || gdk_event->window != widget->window)
+    if (!win->m_hasVMT || gdk_event->window != gtk_widget_get_window(widget))
         return false;
     if (g_blockEventsOnDrag) return TRUE;
     if (g_blockEventsOnScroll) return TRUE;
@@ -137,7 +138,7 @@ gtk_window_button_press_callback(GtkWidget* widget, GdkEventButton* gdk_event, w
     {
         GtkWidget *ancestor = gtk_widget_get_toplevel( widget );
 
-        GdkWindow *source = widget->window;
+        GdkWindow *source = gtk_widget_get_window(widget);
 
         int org_x = 0;
         int org_y = 0;
@@ -165,9 +166,9 @@ gtk_window_button_press_callback(GtkWidget* widget, GdkEventButton* gdk_event, w
     if (y >= win->m_miniEdge + win->m_miniTitle)
         return true;
 
-    gdk_window_raise( win->m_widget->window );
+    gdk_window_raise(gtk_widget_get_window(win->m_widget));
 
-    gdk_pointer_grab( widget->window, FALSE,
+    gdk_pointer_grab( gtk_widget_get_window(widget), false,
                       (GdkEventMask)
                          (GDK_BUTTON_PRESS_MASK |
                           GDK_BUTTON_RELEASE_MASK |
@@ -198,7 +199,7 @@ extern "C" {
 static gboolean
 gtk_window_button_release_callback(GtkWidget* widget, GdkEventButton* gdk_event, wxMiniFrame* win)
 {
-    if (!win->m_hasVMT || gdk_event->window != widget->window)
+    if (!win->m_hasVMT || gdk_event->window != gtk_widget_get_window(widget))
         return false;
     if (g_blockEventsOnDrag) return TRUE;
     if (g_blockEventsOnScroll) return TRUE;
@@ -212,7 +213,7 @@ gtk_window_button_release_callback(GtkWidget* widget, GdkEventButton* gdk_event,
     gdk_pointer_ungrab ( (guint32)GDK_CURRENT_TIME );
     int org_x = 0;
     int org_y = 0;
-    gdk_window_get_origin( widget->window, &org_x, &org_y );
+    gdk_window_get_origin(gtk_widget_get_window(widget), &org_x, &org_y);
     x += org_x - win->m_diffX;
     y += org_y - win->m_diffY;
     win->m_x = x;
@@ -235,10 +236,10 @@ gtk_window_leave_callback(GtkWidget *widget,
 {
     if (!win->m_hasVMT) return FALSE;
     if (g_blockEventsOnDrag) return FALSE;
-    if (gdk_event->window != widget->window)
+    if (gdk_event->window != gtk_widget_get_window(widget))
         return false;
 
-    gdk_window_set_cursor( widget->window, NULL );
+    gdk_window_set_cursor(gtk_widget_get_window(widget), NULL);
 
     return FALSE;
 }
@@ -252,7 +253,7 @@ extern "C" {
 static gboolean
 gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxMiniFrame *win )
 {
-    if (!win->m_hasVMT || gdk_event->window != widget->window)
+    if (!win->m_hasVMT || gdk_event->window != gtk_widget_get_window(widget))
         return false;
     if (g_blockEventsOnDrag) return TRUE;
     if (g_blockEventsOnScroll) return TRUE;
@@ -278,9 +279,9 @@ gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event,
         if (style & wxRESIZE_BORDER)
         {
             if ((x > win->m_width-14) && (y > win->m_height-14))
-               gdk_window_set_cursor( widget->window, gdk_cursor_new( GDK_BOTTOM_RIGHT_CORNER ) );
+               gdk_window_set_cursor(gtk_widget_get_window(widget), gdk_cursor_new(GDK_BOTTOM_RIGHT_CORNER));
             else
-               gdk_window_set_cursor( widget->window, NULL );
+               gdk_window_set_cursor(gtk_widget_get_window(widget), NULL);
             win->GTKUpdateCursor(false);
         }
         return TRUE;
@@ -291,7 +292,7 @@ gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event,
 
     int org_x = 0;
     int org_y = 0;
-    gdk_window_get_origin( widget->window, &org_x, &org_y );
+    gdk_window_get_origin(gtk_widget_get_window(widget), &org_x, &org_y);
     x += org_x - win->m_diffX;
     y += org_y - win->m_diffY;
     win->m_x = x;
@@ -423,9 +424,9 @@ void wxMiniFrame::SetTitle( const wxString &title )
 {
     wxFrame::SetTitle( title );
 
-    GtkWidget* widget = GTK_BIN(m_widget)->child;
-    if (widget->window)
-        gdk_window_invalidate_rect(widget->window, NULL, false);
+    GdkWindow* window = gtk_widget_get_window(gtk_bin_get_child(GTK_BIN(m_widget)));
+    if (window)
+        gdk_window_invalidate_rect(window, NULL, false);
 }
 
 #endif // wxUSE_MINIFRAME
diff --git a/src/gtk/nativewin.cpp b/src/gtk/nativewin.cpp
index 8647cc0aca..4ed6675a70 100644
--- a/src/gtk/nativewin.cpp
+++ b/src/gtk/nativewin.cpp
@@ -29,6 +29,7 @@
 #include "wx/nativewin.h"
 
 #include <gtk/gtk.h>
+#include "wx/gtk/private/gtk2-compat.h"
 
 #ifdef GDK_WINDOWING_X11
     #include <X11/Xlib.h>
@@ -71,7 +72,7 @@ bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle win)
 
     // we need to realize the window first before reparenting it
     gtk_widget_realize(m_widget);
-    gdk_window_reparent(m_widget->window, win, 0, 0);
+    gdk_window_reparent(gtk_widget_get_window(m_widget), win, 0, 0);
 
 #ifdef GDK_WINDOWING_X11
     // if the native window is destroyed, our own window will be destroyed too
@@ -79,7 +80,7 @@ bool wxNativeContainerWindow::Create(wxNativeContainerWindowHandle win)
     // destroyed" GdkWindow, so intercept to DestroyNotify ourselves to fix
     // this and also destroy the associated C++ object when its window is
     // destroyed
-    gdk_window_add_filter(m_widget->window, wxNativeContainerWindowFilter, this);
+    gdk_window_add_filter(gtk_widget_get_window(m_widget), wxNativeContainerWindowFilter, this);
 #endif // GDK_WINDOWING_X11
 
     // we should be initially visible as we suppose that the native window we
diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp
index 1185f59526..3b61cd153e 100644
--- a/src/gtk/notebook.cpp
+++ b/src/gtk/notebook.cpp
@@ -434,7 +434,7 @@ bool wxNotebook::InsertPage( size_t position,
     if ( style )
     {
         gtk_widget_modify_style(pageData->m_label, style);
-        gtk_rc_style_unref(style);
+        g_object_unref(style);
     }
 
     if (select && GetPageCount() > 1)
@@ -453,24 +453,30 @@ static bool
 IsPointInsideWidget(const wxPoint& pt, GtkWidget *w,
                     gint x, gint y, gint border = 0)
 {
+    GtkAllocation a;
+    gtk_widget_get_allocation(w, &a);
     return
-        (pt.x >= w->allocation.x - x - border) &&
-        (pt.x <= w->allocation.x - x + border + w->allocation.width) &&
-        (pt.y >= w->allocation.y - y - border) &&
-        (pt.y <= w->allocation.y - y + border + w->allocation.height);
+        (pt.x >= a.x - x - border) &&
+        (pt.x <= a.x - x + border + a.width) &&
+        (pt.y >= a.y - y - border) &&
+        (pt.y <= a.y - y + border + a.height);
 }
 
 int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
 {
-    const gint x = m_widget->allocation.x;
-    const gint y = m_widget->allocation.y;
+    GtkAllocation a;
+    gtk_widget_get_allocation(m_widget, &a);
+    const int x = a.x;
+    const int y = a.y;
 
     const size_t count = GetPageCount();
     size_t i = 0;
 
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GSEAL_ENABLE)
     GtkNotebook * notebook = GTK_NOTEBOOK(m_widget);
     if (gtk_notebook_get_scrollable(notebook))
         i = g_list_position( notebook->children, notebook->first_tab );
+#endif
 
     for ( ; i < count; i++ )
     {
@@ -556,7 +562,7 @@ void wxNotebook::DoApplyWidgetStyle(GtkRcStyle *style)
 
 GdkWindow *wxNotebook::GTKGetWindow(wxArrayGdkWindows& windows) const
 {
-    windows.push_back(m_widget->window);
+    windows.push_back(gtk_widget_get_window(m_widget));
     windows.push_back(GTK_NOTEBOOK(m_widget)->event_window);
 
     return NULL;
diff --git a/src/gtk/popupwin.cpp b/src/gtk/popupwin.cpp
index d7a664893d..32e440006b 100644
--- a/src/gtk/popupwin.cpp
+++ b/src/gtk/popupwin.cpp
@@ -46,7 +46,7 @@ static gint gtk_popup_button_press (GtkWidget *widget, GdkEvent *gdk_event, wxPo
         {
             if (child == widget)
                 return FALSE;
-            child = child->parent;
+            child = gtk_widget_get_parent(child);
         }
     }
 
diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp
index 96323121c8..5e6baa844f 100644
--- a/src/gtk/radiobox.cpp
+++ b/src/gtk/radiobox.cpp
@@ -59,7 +59,7 @@ static void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioBo
     if (!rb->m_hasVMT) return;
     if (g_blockEventsOnDrag) return;
 
-    if (!button->active) return;
+    if (!gtk_toggle_button_get_active(button)) return;
 
     wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
     event.SetInt( rb->GetSelection() );
@@ -379,7 +379,7 @@ int wxRadioBox::GetSelection(void) const
     while (node)
     {
         GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->GetData()->button );
-        if (button->active) return count;
+        if (gtk_toggle_button_get_active(button)) return count;
         count++;
         node = node->GetNext();
     }
@@ -397,7 +397,7 @@ wxString wxRadioBox::GetString(unsigned int n) const
 
     wxCHECK_MSG( node, wxEmptyString, wxT("radiobox wrong index") );
 
-    GtkLabel *label = GTK_LABEL(GTK_BIN(node->GetData()->button)->child);
+    GtkLabel* label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(node->GetData()->button)));
 
     wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
 
@@ -419,7 +419,7 @@ void wxRadioBox::SetString(unsigned int item, const wxString& label)
 
     wxCHECK_RET( node, wxT("radiobox wrong index") );
 
-    GtkLabel *g_label = GTK_LABEL(GTK_BIN(node->GetData()->button)->child);
+    GtkLabel* g_label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(node->GetData()->button)));
 
     gtk_label_set_text( g_label, wxGTK_CONV( label ) );
 }
@@ -433,7 +433,7 @@ bool wxRadioBox::Enable( bool enable )
     while (node)
     {
         GtkButton *button = GTK_BUTTON( node->GetData()->button );
-        GtkLabel *label = GTK_LABEL(GTK_BIN(button)->child);
+        GtkLabel *label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(button)));
 
         gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
         gtk_widget_set_sensitive( GTK_WIDGET(label), enable );
@@ -455,7 +455,7 @@ bool wxRadioBox::Enable(unsigned int item, bool enable)
     wxCHECK_MSG( node, false, wxT("radiobox wrong index") );
 
     GtkButton *button = GTK_BUTTON( node->GetData()->button );
-    GtkLabel *label = GTK_LABEL(GTK_BIN(button)->child);
+    GtkLabel *label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(button)));
 
     gtk_widget_set_sensitive( GTK_WIDGET(button), enable );
     gtk_widget_set_sensitive( GTK_WIDGET(label), enable );
@@ -548,7 +548,7 @@ void wxRadioBox::DoApplyWidgetStyle(GtkRcStyle *style)
         GtkWidget *widget = GTK_WIDGET( node->GetData()->button );
 
         gtk_widget_modify_style( widget, style );
-        gtk_widget_modify_style(GTK_BIN(widget)->child, style);
+        gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(widget)), style);
 
         node = node->GetNext();
     }
@@ -595,7 +595,7 @@ void wxRadioBox::DoSetItemToolTip(unsigned int n, wxToolTip *tooltip)
 
 GdkWindow *wxRadioBox::GTKGetWindow(wxArrayGdkWindows& windows) const
 {
-    windows.push_back(m_widget->window);
+    windows.push_back(gtk_widget_get_window(m_widget));
 
     wxRadioBoxButtonsInfoList::compatibility_iterator node = m_buttonsInfo.GetFirst();
     while (node)
@@ -603,8 +603,8 @@ GdkWindow *wxRadioBox::GTKGetWindow(wxArrayGdkWindows& windows) const
         GtkWidget *button = GTK_WIDGET( node->GetData()->button );
 
         // don't put NULL pointers in the 'windows' array!
-        if (button->window)
-            windows.push_back(button->window);
+        if (gtk_widget_get_window(button))
+            windows.push_back(gtk_widget_get_window(button));
 
         node = node->GetNext();
     }
diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp
index d5c28e4574..a8c0a8b8a6 100644
--- a/src/gtk/radiobut.cpp
+++ b/src/gtk/radiobut.cpp
@@ -34,7 +34,7 @@ void gtk_radiobutton_clicked_callback( GtkToggleButton *button, wxRadioButton *r
 
     if (g_blockEventsOnDrag) return;
 
-    if (!button->active) return;
+    if (!gtk_toggle_button_get_active(button)) return;
 
     wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId());
     event.SetInt( rb->GetValue() );
@@ -102,7 +102,7 @@ void wxRadioButton::SetLabel( const wxString& label )
     // save the original label
     wxControlBase::SetLabel(label);
 
-    GTKSetLabelForLabel(GTK_LABEL(GTK_BIN(m_widget)->child), label);
+    GTKSetLabelForLabel(GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_widget))), label);
 }
 
 void wxRadioButton::SetValue( bool val )
@@ -134,7 +134,7 @@ bool wxRadioButton::GetValue() const
 {
     wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobutton") );
 
-    return GTK_TOGGLE_BUTTON(m_widget)->active;
+    return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widget)) != 0;
 }
 
 bool wxRadioButton::Enable( bool enable )
@@ -142,7 +142,7 @@ bool wxRadioButton::Enable( bool enable )
     if (!base_type::Enable(enable))
         return false;
 
-    gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
+    gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(m_widget)), enable);
 
     if (enable)
         GTKFixSensitivity();
@@ -153,7 +153,7 @@ bool wxRadioButton::Enable( bool enable )
 void wxRadioButton::DoApplyWidgetStyle(GtkRcStyle *style)
 {
     gtk_widget_modify_style(m_widget, style);
-    gtk_widget_modify_style(GTK_BIN(m_widget)->child, style);
+    gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(m_widget)), style);
 }
 
 GdkWindow *
diff --git a/src/gtk/renderer.cpp b/src/gtk/renderer.cpp
index 87cb564e8f..7834a39047 100644
--- a/src/gtk/renderer.cpp
+++ b/src/gtk/renderer.cpp
@@ -205,7 +205,7 @@ wxRendererGTK::DrawHeaderButton(wxWindow *win,
 
     gtk_paint_box
     (
-        button->style,
+        gtk_widget_get_style(button),
         gdk_window,
         state,
         GTK_SHADOW_OUT,
@@ -260,7 +260,7 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win,
     //     in the given rectangle, +2/3 below is just what looks good here...
     gtk_paint_expander
     (
-        tree->style,
+        gtk_widget_get_style(tree),
         gdk_window,
         state,
         NULL,
@@ -315,7 +315,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win,
                                 wxOrientation orient,
                                 int flags)
 {
-    if ( !win->m_wxwindow->window )
+    if (gtk_widget_get_window(win->m_wxwindow) == NULL)
     {
         // window not realized yet
         return;
@@ -353,7 +353,7 @@ wxRendererGTK::DrawSplitterSash(wxWindow* win,
 
     gtk_paint_handle
     (
-        win->m_wxwindow->style,
+        gtk_widget_get_style(win->m_wxwindow),
         gdk_window,
         flags & wxCONTROL_CURRENT ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
         GTK_SHADOW_NONE,
@@ -409,7 +409,7 @@ wxRendererGTK::DrawDropArrow(wxWindow* win,
     // draw arrow on button
     gtk_paint_arrow
     (
-        button->style,
+        gtk_widget_get_style(button),
         gdk_window,
         state,
         flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
@@ -488,7 +488,7 @@ wxRendererGTK::DrawCheckBox(wxWindow* win,
 
     gtk_paint_check
     (
-        button->style,
+        gtk_widget_get_style(button),
         gdk_window,
         state,
         shadow_type,
@@ -527,7 +527,7 @@ wxRendererGTK::DrawPushButton(wxWindow* win,
 
     gtk_paint_box
     (
-        button->style,
+        gtk_widget_get_style(button),
         gdk_window,
         state,
         flags & wxCONTROL_PRESSED ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
@@ -559,7 +559,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow* win,
 
         // the wxCONTROL_FOCUSED state is deduced
         // directly from the m_wxwindow by GTK+
-        gtk_paint_flat_box(wxGTKPrivate::GetTreeWidget()->style,
+        gtk_paint_flat_box(gtk_widget_get_style(wxGTKPrivate::GetTreeWidget()),
                         gdk_window,
                         GTK_STATE_SELECTED,
                         GTK_SHADOW_NONE,
@@ -588,7 +588,7 @@ void wxRendererGTK::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, i
     else
         state = GTK_STATE_NORMAL;
 
-    gtk_paint_focus( win->m_widget->style,
+    gtk_paint_focus( gtk_widget_get_style(win->m_widget),
                      gdk_window,
                      state,
                      NULL,
@@ -611,14 +611,11 @@ void wxRendererGTK::DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, in
     if ( flags & wxCONTROL_DISABLED )
         state = GTK_STATE_INSENSITIVE;
 
-    if (flags & wxCONTROL_CURRENT )
-        GTK_WIDGET_SET_FLAGS( entry, GTK_HAS_FOCUS );
-    else
-        GTK_WIDGET_UNSET_FLAGS( entry, GTK_HAS_FOCUS );
+    gtk_widget_set_can_focus(entry, (flags & wxCONTROL_CURRENT) != 0);
 
     gtk_paint_shadow
     (
-        entry->style,
+        gtk_widget_get_style(entry),
         gdk_window,
         state,
         GTK_SHADOW_OUT,
@@ -643,14 +640,11 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in
     if ( flags & wxCONTROL_DISABLED )
        state = GTK_STATE_INSENSITIVE;
 
-    if (flags & wxCONTROL_CURRENT )
-        GTK_WIDGET_SET_FLAGS( combo, GTK_HAS_FOCUS );
-    else
-        GTK_WIDGET_UNSET_FLAGS( combo, GTK_HAS_FOCUS );
+    gtk_widget_set_can_focus(combo, (flags & wxCONTROL_CURRENT) != 0);
 
     gtk_paint_shadow
     (
-        combo->style,
+        gtk_widget_get_style(combo),
         gdk_window,
         state,
         GTK_SHADOW_OUT,
@@ -672,7 +666,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in
 
     gtk_paint_arrow
     (
-        combo->style,
+        gtk_widget_get_style(combo),
         gdk_window,
         state,
         GTK_SHADOW_OUT,
@@ -693,7 +687,7 @@ void wxRendererGTK::DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, in
 
     gtk_paint_box
     (
-        combo->style,
+        gtk_widget_get_style(combo),
         gdk_window,
         state,
         GTK_SHADOW_ETCHED_OUT,
@@ -740,7 +734,7 @@ void wxRendererGTK::DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect,
 
     gtk_paint_option
     (
-        button->style,
+        gtk_widget_get_style(button),
         gdk_window,
         state,
         shadow_type,
diff --git a/src/gtk/scrolbar.cpp b/src/gtk/scrolbar.cpp
index 3ffb6eb2b7..2ef064b3fa 100644
--- a/src/gtk/scrolbar.cpp
+++ b/src/gtk/scrolbar.cpp
@@ -167,26 +167,25 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
 
 int wxScrollBar::GetThumbPosition() const
 {
-    GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment;
-    return int(adj->value + 0.5);
+    return wxRound(gtk_range_get_value(GTK_RANGE(m_widget)));
 }
 
 int wxScrollBar::GetThumbSize() const
 {
-    GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment;
-    return int(adj->page_size);
+    GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_widget));
+    return int(gtk_adjustment_get_page_size(adj));
 }
 
 int wxScrollBar::GetPageSize() const
 {
-    GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment;
-    return int(adj->page_increment);
+    GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_widget));
+    return int(gtk_adjustment_get_page_increment(adj));
 }
 
 int wxScrollBar::GetRange() const
 {
-    GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment;
-    return int(adj->upper);
+    GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_widget));
+    return int(gtk_adjustment_get_upper(adj));
 }
 
 void wxScrollBar::SetThumbPosition( int viewStart )
@@ -212,14 +211,13 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS
         range =
         thumbSize = 1;
     }
-    GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment;
-    adj->step_increment = 1;
-    adj->page_increment = pageSize;
-    adj->page_size = thumbSize;
-    adj->value = position;
     g_signal_handlers_block_by_func(m_widget, (void*)gtk_value_changed, this);
-    gtk_range_set_range((GtkRange*)m_widget, 0, range);
-    m_scrollPos[0] = adj->value;
+    GtkRange* widget = GTK_RANGE(m_widget);
+    gtk_adjustment_set_page_size(gtk_range_get_adjustment(widget), thumbSize);
+    gtk_range_set_increments(widget, 1, pageSize);
+    gtk_range_set_range(widget, 0, range);
+    gtk_range_set_value(widget, position);
+    m_scrollPos[0] = gtk_range_get_value(widget);
     g_signal_handlers_unblock_by_func(m_widget, (void*)gtk_value_changed, this);
 }
 
@@ -233,11 +231,6 @@ void wxScrollBar::SetRange(int range)
     SetScrollbar(GetThumbPosition(), GetThumbSize(), range, GetPageSize());
 }
 
-GdkWindow *wxScrollBar::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
-{
-    return m_widget->window;
-}
-
 // static
 wxVisualAttributes
 wxScrollBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp
index 486545f115..291b30a49d 100644
--- a/src/gtk/scrolwin.cpp
+++ b/src/gtk/scrolwin.cpp
@@ -20,6 +20,7 @@
 #include "wx/scrolwin.h"
 
 #include <gtk/gtk.h>
+#include "wx/gtk/private/gtk2-compat.h"
 
 // ----------------------------------------------------------------------------
 // wxScrollHelper implementation
@@ -30,12 +31,15 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
                                    int xPos, int yPos,
                                    bool noRefresh)
 {
-    m_win->m_scrollPos[wxWindow::ScrollDir_Horz] =
-    m_win->m_scrollBar[wxWindow::ScrollDir_Horz]->adjustment->value = xPos;
-    m_win->m_scrollPos[wxWindow::ScrollDir_Vert] =
-    m_win->m_scrollBar[wxWindow::ScrollDir_Vert]->adjustment->value = yPos;
     base_type::SetScrollbars(
         pixelsPerUnitX, pixelsPerUnitY, noUnitsX, noUnitsY, xPos, yPos, noRefresh);
+
+    gtk_range_set_value(m_win->m_scrollBar[wxWindow::ScrollDir_Horz], m_xScrollPosition);
+    gtk_range_set_value(m_win->m_scrollBar[wxWindow::ScrollDir_Vert], m_yScrollPosition);
+    m_win->m_scrollPos[wxWindow::ScrollDir_Horz] =
+        gtk_range_get_value(m_win->m_scrollBar[wxWindow::ScrollDir_Horz]);
+    m_win->m_scrollPos[wxWindow::ScrollDir_Vert] =
+        gtk_range_get_value(m_win->m_scrollBar[wxWindow::ScrollDir_Vert]);
 }
 
 void wxScrollHelper::DoAdjustScrollbar(GtkRange* range,
@@ -68,10 +72,8 @@ void wxScrollHelper::DoAdjustScrollbar(GtkRange* range,
         *linesPerPage = 0;
     }
 
-    GtkAdjustment* adj = range->adjustment;
-    adj->step_increment = 1;
-    adj->page_increment =
-    adj->page_size = page_size;
+    gtk_range_set_increments(range, 1, page_size);
+    gtk_adjustment_set_page_size(gtk_range_get_adjustment(range), page_size);
     gtk_range_set_range(range, 0, upper);
 
     // ensure that the scroll position is always in valid range
diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp
index f05a5f947d..51f5a3eb08 100644
--- a/src/gtk/settings.cpp
+++ b/src/gtk/settings.cpp
@@ -22,6 +22,7 @@
 
 #include <gtk/gtk.h>
 #include "wx/gtk/private/win_gtk.h"
+#include "wx/gtk/private/gtk2-compat.h"
 
 bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int* bottom);
 
@@ -60,7 +61,7 @@ static const GtkStyle* ButtonStyle()
         gtk_widget_ensure_style(s_widget);
         g_signal_connect(s_widget, "style_set", G_CALLBACK(style_set), NULL);
     }
-    return s_widget->style;
+    return gtk_widget_get_style(s_widget);
 }
 
 static const GtkStyle* ListStyle()
@@ -73,7 +74,7 @@ static const GtkStyle* ListStyle()
         gtk_container_add(ContainerWidget(), s_widget);
         gtk_widget_ensure_style(s_widget);
     }
-    return s_widget->style;
+    return gtk_widget_get_style(s_widget);
 }
 
 static const GtkStyle* TextCtrlStyle()
@@ -85,7 +86,7 @@ static const GtkStyle* TextCtrlStyle()
         gtk_container_add(ContainerWidget(), s_widget);
         gtk_widget_ensure_style(s_widget);
     }
-    return s_widget->style;
+    return gtk_widget_get_style(s_widget);
 }
 
 static const GtkStyle* MenuItemStyle()
@@ -97,7 +98,7 @@ static const GtkStyle* MenuItemStyle()
         gtk_container_add(ContainerWidget(), s_widget);
         gtk_widget_ensure_style(s_widget);
     }
-    return s_widget->style;
+    return gtk_widget_get_style(s_widget);
 }
 
 static const GtkStyle* MenuBarStyle()
@@ -109,7 +110,7 @@ static const GtkStyle* MenuBarStyle()
         gtk_container_add(ContainerWidget(), s_widget);
         gtk_widget_ensure_style(s_widget);
     }
-    return s_widget->style;
+    return gtk_widget_get_style(s_widget);
 }
 
 static const GtkStyle* ToolTipStyle()
@@ -124,7 +125,7 @@ static const GtkStyle* ToolTipStyle()
         gtk_widget_set_name(s_widget, name);
         gtk_widget_ensure_style(s_widget);
     }
-    return s_widget->style;
+    return gtk_widget_get_style(s_widget);
 }
 
 wxColour wxSystemSettingsNative::GetColour( wxSystemColour index )
@@ -316,8 +317,8 @@ static int GetBorderWidth(wxSystemMetric index, wxWindow* win)
 int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
 {
     GdkWindow *window = NULL;
-    if(win && gtk_widget_get_realized(win->GetHandle()))
-        window = win->GetHandle()->window;
+    if (win)
+        window = gtk_widget_get_window(win->GetHandle());
 
     switch (index)
     {
diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp
index 7ded117773..a5ed7f8e33 100644
--- a/src/gtk/slider.cpp
+++ b/src/gtk/slider.cpp
@@ -20,6 +20,7 @@
 #endif
 
 #include <gtk/gtk.h>
+#include "wx/gtk/private/gtk2-compat.h"
 
 //-----------------------------------------------------------------------------
 // data
@@ -124,10 +125,9 @@ extern "C" {
 static void
 gtk_value_changed(GtkRange* range, wxSlider* win)
 {
-    GtkAdjustment* adj = gtk_range_get_adjustment (range);
-    const int pos = wxRound(adj->value);
+    const double value = gtk_range_get_value(range);
     const double oldPos = win->m_pos;
-    win->m_pos = adj->value;
+    win->m_pos = value;
 
     if (!win->m_hasVMT || g_blockEventsOnDrag)
         return;
@@ -151,18 +151,19 @@ gtk_value_changed(GtkRange* range, wxSlider* win)
     else if (win->m_mouseButtonDown)
     {
         // Difference from last change event
-        const double diff = adj->value - oldPos;
+        const double diff = value - oldPos;
         const bool isDown = diff > 0;
 
-        if (IsScrollIncrement(adj->page_increment, diff))
+        GtkAdjustment* adj = gtk_range_get_adjustment(range);
+        if (IsScrollIncrement(gtk_adjustment_get_page_increment(adj), diff))
         {
             eventType = isDown ? wxEVT_SCROLL_PAGEDOWN : wxEVT_SCROLL_PAGEUP;
         }
-        else if (wxIsSameDouble(adj->value, 0))
+        else if (wxIsSameDouble(value, 0))
         {
             eventType = wxEVT_SCROLL_PAGEUP;
         }
-        else if (wxIsSameDouble(adj->value, adj->upper))
+        else if (wxIsSameDouble(value, gtk_adjustment_get_upper(adj)))
         {
             eventType = wxEVT_SCROLL_PAGEDOWN;
         }
@@ -178,7 +179,7 @@ gtk_value_changed(GtkRange* range, wxSlider* win)
     win->m_scrollEventType = GTK_SCROLL_NONE;
 
     // If integral position has changed
-    if (wxRound(oldPos) != pos)
+    if (wxRound(oldPos) != wxRound(value))
     {
         ProcessScrollEvent(win, eventType);
         win->m_needThumbRelease = eventType == wxEVT_SCROLL_THUMBTRACK;
@@ -471,12 +472,14 @@ void wxSlider::SetRange( int minValue, int maxValue )
 
 int wxSlider::GetMin() const
 {
-    return int(gtk_range_get_adjustment (GTK_RANGE (m_scale))->lower);
+    GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_scale));
+    return int(gtk_adjustment_get_lower(adj));
 }
 
 int wxSlider::GetMax() const
 {
-    return int(gtk_range_get_adjustment (GTK_RANGE (m_scale))->upper);
+    GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_scale));
+    return int(gtk_adjustment_get_upper(adj));
 }
 
 void wxSlider::SetPageSize( int pageSize )
@@ -488,7 +491,8 @@ void wxSlider::SetPageSize( int pageSize )
 
 int wxSlider::GetPageSize() const
 {
-    return int(gtk_range_get_adjustment (GTK_RANGE (m_scale))->page_increment);
+    GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_scale));
+    return int(gtk_adjustment_get_page_increment(adj));
 }
 
 // GTK does not support changing the size of the slider
@@ -510,7 +514,8 @@ void wxSlider::SetLineSize( int lineSize )
 
 int wxSlider::GetLineSize() const
 {
-    return int(gtk_range_get_adjustment (GTK_RANGE (m_scale))->step_increment);
+    GtkAdjustment* adj = gtk_range_get_adjustment(GTK_RANGE(m_scale));
+    return int(gtk_adjustment_get_step_increment(adj));
 }
 
 GdkWindow *wxSlider::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
diff --git a/src/gtk/sockgtk.cpp b/src/gtk/sockgtk.cpp
index 544ca1d3c5..1d42a36482 100644
--- a/src/gtk/sockgtk.cpp
+++ b/src/gtk/sockgtk.cpp
@@ -17,17 +17,14 @@
 #include "wx/apptrait.h"
 #include "wx/private/fdiomanager.h"
 
-#include <gdk/gdk.h>
+#include <glib.h>
 
 extern "C" {
-static
-void wxSocket_GDK_Input(gpointer data,
-                        gint WXUNUSED(source),
-                        GdkInputCondition condition)
+static gboolean wxSocket_Input(GIOChannel*, GIOCondition condition, gpointer data)
 {
     wxFDIOHandler * const handler = static_cast<wxFDIOHandler *>(data);
 
-    if ( condition & GDK_INPUT_READ )
+    if (condition & G_IO_IN)
     {
         handler->OnReadWaiting();
 
@@ -35,11 +32,13 @@ void wxSocket_GDK_Input(gpointer data,
         // shouldn't call OnWriteWaiting() as the socket is now closed and it
         // would assert
         if ( !handler->IsOk() )
-            return;
+            return true;
     }
 
-    if ( condition & GDK_INPUT_WRITE )
+    if (condition & G_IO_OUT)
         handler->OnWriteWaiting();
+
+    return true;
 }
 }
 
@@ -48,19 +47,17 @@ class GTKFDIOManager : public wxFDIOManager
 public:
     virtual int AddInput(wxFDIOHandler *handler, int fd, Direction d)
     {
-        return gdk_input_add
-               (
-                    fd,
-                    d == OUTPUT ? GDK_INPUT_WRITE : GDK_INPUT_READ,
-                    wxSocket_GDK_Input,
-                    handler
-               );
+        return g_io_add_watch(
+            g_io_channel_unix_new(fd),
+            d == OUTPUT ? G_IO_OUT : G_IO_IN,
+            wxSocket_Input,
+            handler);
     }
 
     virtual void
     RemoveInput(wxFDIOHandler* WXUNUSED(handler), int fd, Direction WXUNUSED(d))
     {
-        gdk_input_remove(fd);
+        g_source_remove(fd);
     }
 };
 
diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp
index a6d21769e5..f35eca8445 100644
--- a/src/gtk/spinctrl.cpp
+++ b/src/gtk/spinctrl.cpp
@@ -152,12 +152,14 @@ double wxSpinCtrlGTKBase::DoGetValue() const
     g_signal_emit(m_widget, sig_id, 0, &value, &handled);
     if (!handled)
         value = g_strtod(gtk_entry_get_text(GTK_ENTRY(m_widget)), NULL);
-    const GtkAdjustment* adj =
+    GtkAdjustment* adj =
         gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(m_widget));
-    if (value < adj->lower)
-        value = adj->lower;
-    else if (value > adj->upper)
-        value = adj->upper;
+    const double lower = gtk_adjustment_get_lower(adj);
+    const double upper = gtk_adjustment_get_upper(adj);
+    if (value < lower)
+        value = lower;
+    else if (value > upper)
+        value = upper;
 
     return value;
 }
@@ -297,7 +299,7 @@ void wxSpinCtrlGTKBase::OnChar( wxKeyEvent &event )
             GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
             if ( window )
             {
-                GtkWidget *widgetDef = window->default_widget;
+                GtkWidget* widgetDef = gtk_window_get_default_widget(window);
 
                 if ( widgetDef )
                 {
diff --git a/src/gtk/statbox.cpp b/src/gtk/statbox.cpp
index 06c577699d..56cd02327b 100644
--- a/src/gtk/statbox.cpp
+++ b/src/gtk/statbox.cpp
@@ -16,6 +16,7 @@
 #include "wx/gtk/private/win_gtk.h"     // for wxPizza
 
 #include <gtk/gtk.h>
+#include "wx/gtk/private/gtk2-compat.h"
 
 // constants taken from GTK sources
 #define LABEL_PAD 1
@@ -31,15 +32,16 @@ static void size_allocate(GtkWidget* widget, GtkAllocation* alloc, void*)
     // clip label as GTK >= 2.12 does
     GtkWidget* label_widget = gtk_frame_get_label_widget(GTK_FRAME(widget));
     int w = alloc->width -
-        2 * widget->style->xthickness - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD;
+        2 * gtk_widget_get_style(widget)->xthickness - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD;
     if (w < 0)
         w = 0;
 
-    if (label_widget->allocation.width > w)
+    GtkAllocation a;
+    gtk_widget_get_allocation(label_widget, &a);
+    if (a.width > w)
     {
-        GtkAllocation alloc2 = label_widget->allocation;
-        alloc2.width = w;
-        gtk_widget_size_allocate(label_widget, &alloc2);
+        a.width = w;
+        gtk_widget_size_allocate(label_widget, &a);
     }
 }
 }
diff --git a/src/gtk/taskbar.cpp b/src/gtk/taskbar.cpp
index 8a25c000fd..cea57e9794 100644
--- a/src/gtk/taskbar.cpp
+++ b/src/gtk/taskbar.cpp
@@ -180,7 +180,7 @@ void wxTaskBarIcon::Private::SetIcon()
         m_size = 0;
         if (m_eggTrayIcon)
         {
-            GtkWidget* image = GTK_BIN(m_eggTrayIcon)->child;
+            GtkWidget* image = gtk_bin_get_child(GTK_BIN(m_eggTrayIcon));
             gtk_image_set_from_pixbuf(GTK_IMAGE(image), m_bitmap.GetPixbuf());
         }
         else
@@ -207,10 +207,22 @@ void wxTaskBarIcon::Private::SetIcon()
 
 #if GTK_CHECK_VERSION(2,10,0)
     if (m_statusIcon)
-        gtk_status_icon_set_tooltip(m_statusIcon, tip_text);
-    else
+    {
+#if GTK_CHECK_VERSION(2,16,0)
+        if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,16,0) == NULL)
+            gtk_status_icon_set_tooltip_text(m_statusIcon, tip_text);
+        else
+#endif
+        {
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
+            gtk_status_icon_set_tooltip(m_statusIcon, tip_text);
 #endif
+        }
+    }
+    else
+#endif // GTK_CHECK_VERSION(2,10,0)
     {
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
         if (tip_text && m_tooltips == NULL)
         {
             m_tooltips = gtk_tooltips_new();
@@ -219,6 +231,7 @@ void wxTaskBarIcon::Private::SetIcon()
         }
         if (m_tooltips)
             gtk_tooltips_set_tip(m_tooltips, m_eggTrayIcon, tip_text, "");
+#endif
     }
 #endif // wxUSE_TOOLTIPS
 }
@@ -240,7 +253,7 @@ void wxTaskBarIcon::Private::size_allocate(int width, int height)
         if (h > size) h = size;
         GdkPixbuf* pixbuf =
             gdk_pixbuf_scale_simple(m_bitmap.GetPixbuf(), w, h, GDK_INTERP_BILINEAR);
-        GtkImage* image = GTK_IMAGE(GTK_BIN(m_eggTrayIcon)->child);
+        GtkImage* image = GTK_IMAGE(gtk_bin_get_child(GTK_BIN(m_eggTrayIcon)));
         gtk_image_set_from_pixbuf(image, pixbuf);
         g_object_unref(pixbuf);
     }
diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp
index 57107f12d3..59111db0c4 100644
--- a/src/gtk/textctrl.cpp
+++ b/src/gtk/textctrl.cpp
@@ -579,6 +579,18 @@ gtk_paste_clipboard_callback( GtkWidget *widget, wxTextCtrl *win )
 }
 }
 
+//-----------------------------------------------------------------------------
+//  "mark_set"
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void mark_set(GtkTextBuffer*, GtkTextIter*, GtkTextMark* mark, GSList** markList)
+{
+    if (gtk_text_mark_get_name(mark) == NULL)
+        *markList = g_slist_prepend(*markList, mark);
+}
+}
+
 //-----------------------------------------------------------------------------
 //  wxTextCtrl
 //-----------------------------------------------------------------------------
@@ -620,10 +632,13 @@ void wxTextCtrl::Init()
 
     m_text = NULL;
     m_showPositionOnThaw = NULL;
+    m_anonymousMarkList = NULL;
 }
 
 wxTextCtrl::~wxTextCtrl()
 {
+    if (m_anonymousMarkList)
+        g_slist_free(m_anonymousMarkList);
 }
 
 wxTextCtrl::wxTextCtrl( wxWindow *parent,
@@ -660,10 +675,13 @@ bool wxTextCtrl::Create( wxWindow *parent,
 
     if (multi_line)
     {
+        m_buffer = gtk_text_buffer_new(NULL);
+        gulong sig_id = g_signal_connect(m_buffer, "mark_set", G_CALLBACK(mark_set), &m_anonymousMarkList);
         // Create view
-        m_text = gtk_text_view_new();
-
-        m_buffer = gtk_text_view_get_buffer( GTK_TEXT_VIEW(m_text) );
+        m_text = gtk_text_view_new_with_buffer(m_buffer);
+        // gtk_text_view_set_buffer adds its own reference
+        g_object_unref(m_buffer);
+        g_signal_handler_disconnect(m_buffer, sig_id);
 
         // create "ShowPosition" marker
         GtkTextIter iter;
@@ -678,7 +696,7 @@ bool wxTextCtrl::Create( wxWindow *parent,
                                             ? GTK_POLICY_NEVER
                                             : GTK_POLICY_AUTOMATIC );
         // for ScrollLines/Pages
-        m_scrollBar[1] = (GtkRange*)((GtkScrolledWindow*)m_widget)->vscrollbar;
+        m_scrollBar[1] = GTK_RANGE(gtk_scrolled_window_get_vscrollbar(GTK_SCROLLED_WINDOW(m_widget)));
 
         // Insert view into scrolled window
         gtk_container_add( GTK_CONTAINER(m_widget), m_text );
@@ -1082,13 +1100,19 @@ void wxTextCtrl::WriteText( const wxString &text )
     // Insert the text
     wxGtkTextInsert( m_text, m_buffer, m_defaultStyle, buffer );
 
-    GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment( GTK_SCROLLED_WINDOW(m_widget) );
     // Scroll to cursor, but only if scrollbar thumb is at the very bottom
     // won't work when frozen, text view is not using m_buffer then
-    if (!IsFrozen() && wxIsSameDouble(adj->value, adj->upper - adj->page_size))
+    if (!IsFrozen())
     {
-        gtk_text_view_scroll_to_mark( GTK_TEXT_VIEW(m_text),
-                gtk_text_buffer_get_insert( m_buffer ), 0.0, FALSE, 0.0, 1.0 );
+        GtkAdjustment* adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(m_widget));
+        const double value = gtk_adjustment_get_value(adj);
+        const double upper = gtk_adjustment_get_upper(adj);
+        const double page_size = gtk_adjustment_get_page_size(adj);
+        if (wxIsSameDouble(value, upper - page_size))
+        {
+            gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(m_text),
+                gtk_text_buffer_get_insert(m_buffer), 0, false, 0, 1);
+        }
     }
 }
 
@@ -1141,7 +1165,7 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
     }
     else // single line control
     {
-        if ( pos <= GTK_ENTRY(m_text)->text_length )
+        if (pos <= gtk_entry_get_text_length(GTK_ENTRY(m_text)))
         {
             if ( y )
                 *y = 0;
@@ -1578,7 +1602,7 @@ GdkWindow *wxTextCtrl::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
     }
     else
     {
-        return GTK_ENTRY(m_text)->text_area;
+        return gtk_entry_get_text_window(GTK_ENTRY(m_text));
     }
 }
 
@@ -1804,16 +1828,24 @@ void wxTextCtrl::DoFreeze()
         // removing buffer dramatically speeds up insertion:
         g_object_ref(m_buffer);
         GtkTextBuffer* buf_new = gtk_text_buffer_new(NULL);
-        GtkTextMark* mark = GTK_TEXT_VIEW(m_text)->first_para_mark;
         gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), buf_new);
         // gtk_text_view_set_buffer adds its own reference
         g_object_unref(buf_new);
-        // This mark should be deleted when the buffer is changed,
-        // but it's not (in GTK+ up to at least 2.10.6).
+        // These marks should be deleted when the buffer is changed,
+        // but they are not (in GTK+ up to at least 3.0.1).
         // Otherwise these anonymous marks start to build up in the buffer,
         // and Freeze takes longer and longer each time it is called.
-        if (GTK_IS_TEXT_MARK(mark) && !gtk_text_mark_get_deleted(mark))
-            gtk_text_buffer_delete_mark(m_buffer, mark);
+        if (m_anonymousMarkList)
+        {
+            for (GSList* item = m_anonymousMarkList; item; item = item->next)
+            {
+                GtkTextMark* mark = static_cast<GtkTextMark*>(item->data);
+                if (GTK_IS_TEXT_MARK(mark) && !gtk_text_mark_get_deleted(mark))
+                    gtk_text_buffer_delete_mark(m_buffer, mark);
+            }
+            g_slist_free(m_anonymousMarkList);
+            m_anonymousMarkList = NULL;
+        }
     }
 }
 
@@ -1822,8 +1854,10 @@ void wxTextCtrl::DoThaw()
     if ( HasFlag(wxTE_MULTILINE) )
     {
         // reattach buffer:
+        gulong sig_id = g_signal_connect(m_buffer, "mark_set", G_CALLBACK(mark_set), &m_anonymousMarkList);
         gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), m_buffer);
         g_object_unref(m_buffer);
+        g_signal_handler_disconnect(m_buffer, sig_id);
 
         if (m_showPositionOnThaw != NULL)
         {
diff --git a/src/gtk/textentry.cpp b/src/gtk/textentry.cpp
index 0bf2b128e9..60ddcda95f 100644
--- a/src/gtk/textentry.cpp
+++ b/src/gtk/textentry.cpp
@@ -52,13 +52,19 @@ wx_gtk_insert_text_callback(GtkEditable *editable,
     // we should only be called if we have a max len limit at all
     GtkEntry *entry = GTK_ENTRY (editable);
 
-    wxCHECK_RET( entry->text_max_length, wxT("shouldn't be called") );
+    const int text_length = gtk_entry_get_text_length(entry);
+#if GTK_CHECK_VERSION(3,0,0) || defined(GSEAL_ENABLE)
+    const int text_max_length = gtk_entry_buffer_get_max_length(gtk_entry_get_buffer(entry));
+#else
+    const int text_max_length = entry->text_max_length;
+#endif
+    wxCHECK_RET(text_max_length, "shouldn't be called");
 
     // check that we don't overflow the max length limit
     //
     // FIXME: this doesn't work when we paste a string which is going to be
     //        truncated
-    if ( entry->text_length == entry->text_max_length )
+    if (text_length == text_max_length)
     {
         // we don't need to run the base class version at all
         g_signal_stop_emission_by_name (editable, "insert_text");
@@ -179,7 +185,7 @@ long wxTextEntry::GetLastPosition() const
     // GtkEntries
     GtkEntry * const entry = GTK_ENTRY(GetEditable());
 
-    return entry ? entry->text_length : - 1;
+    return entry ? gtk_entry_get_text_length(entry) : -1;
 }
 
 // ----------------------------------------------------------------------------
diff --git a/src/gtk/tglbtn.cpp b/src/gtk/tglbtn.cpp
index e0bfe0e372..3880012995 100644
--- a/src/gtk/tglbtn.cpp
+++ b/src/gtk/tglbtn.cpp
@@ -132,7 +132,7 @@ void wxBitmapToggleButton::OnSetBitmap()
 {
     if (!m_bitmap.Ok()) return;
 
-    GtkWidget* image = ((GtkBin*)m_widget)->child;
+    GtkWidget* image = gtk_bin_get_child(GTK_BIN(m_widget));
     if (image == NULL)
     {
         image = gtk_image_new();
@@ -151,7 +151,7 @@ bool wxBitmapToggleButton::Enable(bool enable /*=true*/)
     if (!wxControl::Enable(enable))
         return false;
 
-    gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
+    gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(m_widget)), enable);
 
     if (!isEnabled && enable)
     {
@@ -164,7 +164,7 @@ bool wxBitmapToggleButton::Enable(bool enable /*=true*/)
 void wxBitmapToggleButton::DoApplyWidgetStyle(GtkRcStyle *style)
 {
     gtk_widget_modify_style(m_widget, style);
-    gtk_widget_modify_style(GTK_BIN(m_widget)->child, style);
+    gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(m_widget)), style);
 }
 
 GdkWindow *
@@ -267,7 +267,7 @@ bool wxToggleButton::GetValue() const
 {
     wxCHECK_MSG(m_widget != NULL, false, wxT("invalid toggle button"));
 
-    return GTK_TOGGLE_BUTTON(m_widget)->active;
+    return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_widget)) != 0;
 }
 
 void wxToggleButton::SetLabel(const wxString& label)
@@ -288,7 +288,7 @@ bool wxToggleButton::Enable(bool enable /*=true*/)
     if (!base_type::Enable(enable))
         return false;
 
-    gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable);
+    gtk_widget_set_sensitive(gtk_bin_get_child(GTK_BIN(m_widget)), enable);
 
     if (enable)
         GTKFixSensitivity();
@@ -299,7 +299,7 @@ bool wxToggleButton::Enable(bool enable /*=true*/)
 void wxToggleButton::DoApplyWidgetStyle(GtkRcStyle *style)
 {
     gtk_widget_modify_style(m_widget, style);
-    gtk_widget_modify_style(GTK_BIN(m_widget)->child, style);
+    gtk_widget_modify_style(gtk_bin_get_child(GTK_BIN(m_widget)), style);
 }
 
 GdkWindow *
diff --git a/src/gtk/toolbar.cpp b/src/gtk/toolbar.cpp
index f883bc0801..2c2e60441b 100644
--- a/src/gtk/toolbar.cpp
+++ b/src/gtk/toolbar.cpp
@@ -195,12 +195,15 @@ image_expose_event(GtkWidget* widget, GdkEventExpose*, wxToolBarTool* tool)
         return false;
 
     // draw disabled bitmap ourselves, GtkImage has no way to specify it
-    const GtkAllocation& alloc = widget->allocation;
+    GtkAllocation alloc;
+    gtk_widget_get_allocation(widget, &alloc);
+    GtkRequisition req;
+    gtk_widget_get_requisition(widget, &req);
     gdk_draw_pixbuf(
-        widget->window, widget->style->black_gc, bitmap.GetPixbuf(),
+        gtk_widget_get_window(widget), gtk_widget_get_style(widget)->black_gc, bitmap.GetPixbuf(),
         0, 0,
-        alloc.x + (alloc.width - widget->requisition.width) / 2,
-        alloc.y + (alloc.height - widget->requisition.height) / 2,
+        alloc.x + (alloc.width - req.width) / 2,
+        alloc.y + (alloc.height - req.height) / 2,
         -1, -1, GDK_RGB_DITHER_NORMAL, 0, 0);
     return true;
 }
@@ -250,7 +253,7 @@ void wxToolBar::AddChildGTK(wxWindowGTK* child)
     GtkToolItem* item = gtk_tool_item_new();
     gtk_container_add(GTK_CONTAINER(item), align);
     // position will be corrected in DoInsertTool if necessary
-    gtk_toolbar_insert(GTK_TOOLBAR(GTK_BIN(m_widget)->child), item, -1);
+    gtk_toolbar_insert(GTK_TOOLBAR(gtk_bin_get_child(GTK_BIN(m_widget))), item, -1);
 }
 
 // ----------------------------------------------------------------------------
@@ -284,7 +287,7 @@ void wxToolBarTool::CreateDropDown()
         box = gtk_hbox_new(false, 0);
         arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
     }
-    GtkWidget* tool_button = GTK_BIN(m_item)->child;
+    GtkWidget* tool_button = gtk_bin_get_child(GTK_BIN(m_item));
     gtk_widget_reparent(tool_button, box);
     GtkWidget* arrow_button = gtk_toggle_button_new();
     gtk_button_set_relief(GTK_BUTTON(arrow_button),
@@ -308,7 +311,8 @@ void wxToolBarTool::ShowDropdown(GtkToggleButton* button)
         wxMenu* menu = GetDropdownMenu();
         if (menu)
         {
-            const GtkAllocation& alloc = GTK_WIDGET(button)->allocation;
+            GtkAllocation alloc;
+            gtk_widget_set_allocation(GTK_WIDGET(button), &alloc);
             int x = alloc.x;
             int y = alloc.y;
             if (toolbar->HasFlag(wxTB_LEFT | wxTB_RIGHT))
@@ -376,12 +380,14 @@ bool wxToolBar::Create( wxWindow *parent,
     FixupStyle();
 
     m_toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
     if (gtk_check_version(2, 12, 0))
     {
         m_tooltips = gtk_tooltips_new();
         g_object_ref(m_tooltips);
         gtk_object_sink(GTK_OBJECT(m_tooltips));
     }
+#endif
     GtkSetStyle();
 
     if (style & wxTB_DOCKABLE)
@@ -417,7 +423,7 @@ bool wxToolBar::Create( wxWindow *parent,
 
 GdkWindow *wxToolBar::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
 {
-    return GTK_WIDGET(m_toolbar)->window;
+    return gtk_widget_get_window(GTK_WIDGET(m_toolbar));
 }
 
 void wxToolBar::GtkSetStyle()
@@ -436,7 +442,11 @@ void wxToolBar::GtkSetStyle()
             style = GTK_TOOLBAR_BOTH_HORIZ;
     }
 
+#if GTK_CHECK_VERSION(3,0,0) || defined(GTK_DISABLE_DEPRECATED)
+    gtk_orientable_set_orientation(GTK_ORIENTABLE(m_toolbar), orient);
+#else
     gtk_toolbar_set_orientation(m_toolbar, orient);
+#endif
     gtk_toolbar_set_style(m_toolbar, style);
 }
 
@@ -533,7 +543,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
             if (!HasFlag(wxTB_NO_TOOLTIPS) && !tool->GetShortHelp().empty())
             {
 #if GTK_CHECK_VERSION(2, 12, 0)
-                if (!gtk_check_version(2, 12, 0))
+                if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL)
                 {
                     gtk_tool_item_set_tooltip_text(tool->m_item,
                         wxGTK_CONV(tool->GetShortHelp()));
@@ -541,8 +551,10 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
                 else
 #endif
                 {
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
                     gtk_tool_item_set_tooltip(tool->m_item,
                         m_tooltips, wxGTK_CONV(tool->GetShortHelp()), "");
+#endif
                 }
             }
             bin_child = gtk_bin_get_child(GTK_BIN(tool->m_item));
@@ -574,9 +586,9 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
 
         case wxTOOL_STYLE_CONTROL:
             wxWindow* control = tool->GetControl();
-            if (control->m_widget->parent == NULL)
+            if (gtk_widget_get_parent(control->m_widget) == NULL)
                 AddChildGTK(control);
-            tool->m_item = GTK_TOOL_ITEM(control->m_widget->parent->parent);
+            tool->m_item = GTK_TOOL_ITEM(gtk_widget_get_parent(gtk_widget_get_parent(control->m_widget)));
             if (gtk_toolbar_get_item_index(m_toolbar, tool->m_item) != int(pos))
             {
                 g_object_ref(tool->m_item);
@@ -611,7 +623,7 @@ bool wxToolBar::DoDeleteTool(size_t /* pos */, wxToolBarToolBase* toolBase)
         // while if we're called from DeleteTool() the control will
         // be destroyed when wxToolBarToolBase itself is deleted
         GtkWidget* widget = tool->GetControl()->m_widget;
-        gtk_container_remove(GTK_CONTAINER(widget->parent), widget);
+        gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(widget)), widget);
     }
     gtk_object_destroy(GTK_OBJECT(tool->m_item));
     tool->m_item = NULL;
@@ -711,7 +723,7 @@ void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
         if (tool->m_item)
         {
 #if GTK_CHECK_VERSION(2, 12, 0)
-            if (!gtk_check_version(2, 12, 0))
+            if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL)
             {
                 gtk_tool_item_set_tooltip_text(tool->m_item,
                     wxGTK_CONV(helpString));
@@ -719,8 +731,10 @@ void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
             else
 #endif
             {
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
                 gtk_tool_item_set_tooltip(tool->m_item,
                     m_tooltips, wxGTK_CONV(helpString), "");
+#endif
             }
         }
     }
diff --git a/src/gtk/tooltip.cpp b/src/gtk/tooltip.cpp
index ffcb59d4c1..6004fcc066 100644
--- a/src/gtk/tooltip.cpp
+++ b/src/gtk/tooltip.cpp
@@ -24,7 +24,9 @@
 // global data
 //-----------------------------------------------------------------------------
 
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
 static GtkTooltips *gs_tooltips = NULL;
+#endif
 
 //-----------------------------------------------------------------------------
 // wxToolTip
@@ -56,22 +58,24 @@ void wxToolTip::GTKSetWindow(wxWindow* win)
 void wxToolTip::GTKApply(GtkWidget* widget, const char* tip)
 {
 #if GTK_CHECK_VERSION(2, 12, 0)
-    if (!gtk_check_version(2, 12, 0))
+    if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL)
         gtk_widget_set_tooltip_text(widget, tip);
     else
 #endif
     {
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
         if ( !gs_tooltips )
             gs_tooltips = gtk_tooltips_new();
 
         gtk_tooltips_set_tip(gs_tooltips, widget, tip, NULL);
+#endif
     }
 }
 
 void wxToolTip::Enable( bool flag )
 {
 #if GTK_CHECK_VERSION(2, 12, 0)
-    if (!gtk_check_version(2, 12, 0))
+    if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL)
     {
         GtkSettings* settings = gtk_settings_get_default();
         if (settings)
@@ -80,6 +84,7 @@ void wxToolTip::Enable( bool flag )
     else
 #endif
     {
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
         if (!gs_tooltips)
             gs_tooltips = gtk_tooltips_new();
 
@@ -87,13 +92,14 @@ void wxToolTip::Enable( bool flag )
             gtk_tooltips_enable( gs_tooltips );
         else
             gtk_tooltips_disable( gs_tooltips );
+#endif
     }
 }
 
 void wxToolTip::SetDelay( long msecs )
 {
 #if GTK_CHECK_VERSION(2, 12, 0)
-    if (!gtk_check_version(2, 12, 0))
+    if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL)
     {
         GtkSettings* settings = gtk_settings_get_default();
         if (settings)
@@ -102,10 +108,12 @@ void wxToolTip::SetDelay( long msecs )
     else
 #endif
     {
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
         if (!gs_tooltips)
             gs_tooltips = gtk_tooltips_new();
 
         gtk_tooltips_set_delay( gs_tooltips, (int)msecs );
+#endif
     }
 }
 
diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp
index fb3696031c..608b343e98 100644
--- a/src/gtk/toplevel.cpp
+++ b/src/gtk/toplevel.cpp
@@ -80,9 +80,8 @@ extern "C" {
 static void wxgtk_window_set_urgency_hint (GtkWindow *win,
                                            gboolean setting)
 {
-    wxASSERT_MSG( gtk_widget_get_realized(GTK_WIDGET(win)),
-                  wxT("wxgtk_window_set_urgency_hint: GdkWindow not realized") );
-    GdkWindow *window = GTK_WIDGET(win)->window;
+    GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(win));
+    wxASSERT_MSG(window, "wxgtk_window_set_urgency_hint: GdkWindow not realized");
     XWMHints *wm_hints;
 
     wm_hints = XGetWMHints(GDK_WINDOW_XDISPLAY(window), GDK_WINDOW_XWINDOW(window));
@@ -219,8 +218,9 @@ size_allocate(GtkWidget*, GtkAllocation* alloc, wxTopLevelWindowGTK* win)
         win->m_oldClientWidth  = alloc->width;
         win->m_oldClientHeight = alloc->height;
 
-        wxSize size(win->m_widget->allocation.width,
-                    win->m_widget->allocation.height);
+        GtkAllocation a;
+        gtk_widget_get_allocation(win->m_widget, &a);
+        wxSize size(a.width, a.height);
         size += win->m_decorSize;
         win->m_width  = size.x;
         win->m_height = size.y;
@@ -309,16 +309,18 @@ static void
 gtk_frame_realized_callback( GtkWidget * WXUNUSED(widget),
                              wxTopLevelWindowGTK *win )
 {
-    gdk_window_set_decorations(win->m_widget->window,
+    gdk_window_set_decorations(gtk_widget_get_window(win->m_widget),
                                (GdkWMDecoration)win->m_gdkDecor);
-    gdk_window_set_functions(win->m_widget->window,
+    gdk_window_set_functions(gtk_widget_get_window(win->m_widget),
                                (GdkWMFunction)win->m_gdkFunc);
 
     // GTK's shrinking/growing policy
     if ( !(win->m_gdkFunc & GDK_FUNC_RESIZE) )
         gtk_window_set_resizable(GTK_WINDOW(win->m_widget), FALSE);
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
     else
         gtk_window_set_policy(GTK_WINDOW(win->m_widget), 1, 1, 1);
+#endif
 
     const wxIconBundle& icons = win->GetIcons();
     if (icons.GetIconCount())
@@ -565,7 +567,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
 #endif
 
     gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) );
-    GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
+    gtk_widget_set_can_focus(m_widget, false);
 
     g_signal_connect (m_widget, "delete_event",
                       G_CALLBACK (gtk_frame_delete_callback), this);
@@ -573,7 +575,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
     // m_mainWidget is a GtkVBox, holding the bars and client area (m_wxwindow)
     m_mainWidget = gtk_vbox_new(false, 0);
     gtk_widget_show( m_mainWidget );
-    GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS );
+    gtk_widget_set_can_focus(m_mainWidget, false);
     gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget );
 
     // m_wxwindow is the client area
@@ -583,7 +585,7 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
 
     // we donm't allow the frame to get the focus as otherwise
     // the frame will grab it at arbitrary focus changes
-    GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
+    gtk_widget_set_can_focus(m_wxwindow, false);
 
     if (m_parent) m_parent->AddChild( this );
 
@@ -594,8 +596,10 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
                       G_CALLBACK (wxgtk_tlw_size_request_callback), this);
     PostCreation();
 
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
     if ((m_x != -1) || (m_y != -1))
         gtk_widget_set_uposition( m_widget, m_x, m_y );
+#endif
 
     //  we cannot set MWM hints and icons before the widget has
     //  been realized, so we do this directly after realization
@@ -714,8 +718,9 @@ bool wxTopLevelWindowGTK::EnableCloseButton( bool enable )
     else
         m_gdkFunc &= ~GDK_FUNC_CLOSE;
 
-    if (gtk_widget_get_realized(m_widget) && (m_widget->window))
-        gdk_window_set_functions( m_widget->window, (GdkWMFunction)m_gdkFunc );
+    GdkWindow* window = gtk_widget_get_window(m_widget);
+    if (window)
+        gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc);
 
     return true;
 }
@@ -744,7 +749,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long)
     }
     else
     {
-        GdkWindow *window = m_widget->window;
+        GdkWindow* window = gtk_widget_get_window(m_widget);
 
         if (show)
         {
@@ -763,12 +768,11 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long)
             gdk_window_set_decorations(window, (GdkWMDecoration)0);
             gdk_window_set_functions(window, (GdkWMFunction)0);
 
-            gdk_window_get_origin (m_widget->window, &root_x, &root_y);
-            gdk_window_get_geometry (m_widget->window, &client_x, &client_y,
-                         &width, &height, NULL);
+            gdk_window_get_origin(window, &root_x, &root_y);
+            gdk_window_get_geometry(window, &client_x, &client_y, &width, &height, NULL);
 
-            gdk_window_move_resize (m_widget->window, -client_x, -client_y,
-                        screen_width + 1, screen_height + 1);
+            gdk_window_move_resize(
+                window, -client_x, -client_y, screen_width + 1, screen_height + 1);
 
             wxSetFullScreenStateX11((WXDisplay*)GDK_DISPLAY(),
                                     (WXWindow)GDK_ROOT_WINDOW(),
@@ -810,8 +814,11 @@ void wxTopLevelWindowGTK::Refresh( bool WXUNUSED(eraseBackground), const wxRect
 
     gtk_widget_queue_draw( m_widget );
 
-    if (m_wxwindow && m_wxwindow->window)
-        gdk_window_invalidate_rect( m_wxwindow->window, NULL, TRUE );
+    GdkWindow* window = NULL;
+    if (m_wxwindow)
+        window = gtk_widget_get_window(m_wxwindow);
+    if (window)
+        gdk_window_invalidate_rect(window, NULL, true);
 }
 
 bool wxTopLevelWindowGTK::Show( bool show )
@@ -864,23 +871,32 @@ bool wxTopLevelWindowGTK::Show( bool show )
         // causes the widget tree to be size_allocated, which generates size
         // events in the wrong order. However, the size_allocates will not be
         // done if the allocation is not the default (1,1).
-        const int alloc_width = m_widget->allocation.width;
+        GtkAllocation alloc;
+        gtk_widget_get_allocation(m_widget, &alloc);
+        const int alloc_width = alloc.width;
         if (alloc_width == 1)
-            m_widget->allocation.width = 2;
+        {
+            alloc.width = 2;
+            gtk_widget_set_allocation(m_widget, &alloc);
+        }
         gtk_widget_realize(m_widget);
         if (alloc_width == 1)
-            m_widget->allocation.width = 1;
+        {
+            alloc.width = 1;
+            gtk_widget_set_allocation(m_widget, &alloc);
+        }
 
         // send _NET_REQUEST_FRAME_EXTENTS
         XClientMessageEvent xevent;
         memset(&xevent, 0, sizeof(xevent));
         xevent.type = ClientMessage;
-        xevent.window = gdk_x11_drawable_get_xid(m_widget->window);
+        GdkWindow* window = gtk_widget_get_window(m_widget);
+        xevent.window = gdk_x11_drawable_get_xid(window);
         xevent.message_type = gdk_x11_atom_to_xatom_for_display(
-            gdk_drawable_get_display(m_widget->window),
+            gdk_drawable_get_display(window),
             gdk_atom_intern("_NET_REQUEST_FRAME_EXTENTS", false));
         xevent.format = 32;
-        Display* display = gdk_x11_drawable_get_xdisplay(m_widget->window);
+        Display* display = gdk_x11_drawable_get_xdisplay(window);
         XSendEvent(display, DefaultRootWindow(display), false,
             SubstructureNotifyMask | SubstructureRedirectMask,
             (XEvent*)&xevent);
@@ -1219,8 +1235,8 @@ void wxTopLevelWindowGTK::Maximize(bool maximize)
 
 bool wxTopLevelWindowGTK::IsMaximized() const
 {
-    return m_widget->window &&
-        (gdk_window_get_state(m_widget->window) & GDK_WINDOW_STATE_MAXIMIZED);
+    GdkWindow* window = gtk_widget_get_window(m_widget);
+    return window && (gdk_window_get_state(window) & GDK_WINDOW_STATE_MAXIMIZED);
 }
 
 void wxTopLevelWindowGTK::Restore()
@@ -1299,9 +1315,9 @@ bool wxTopLevelWindowGTK::SetShape(const wxRegion& region)
     if ( gtk_widget_get_realized(m_widget) )
     {
         if ( m_wxwindow )
-            do_shape_combine_region(m_wxwindow->window, region);
+            do_shape_combine_region(gtk_widget_get_window(m_wxwindow), region);
 
-        return do_shape_combine_region(m_widget->window, region);
+        return do_shape_combine_region(gtk_widget_get_window(m_widget), region);
     }
     else // not realized yet
     {
@@ -1403,14 +1419,17 @@ static Window wxGetTopmostWindowX11(Display *dpy, Window child)
 
 bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha)
 {
-    if (!m_widget || !m_widget->window)
+    GdkWindow* window = NULL;
+    if (m_widget)
+        window = gtk_widget_get_window(m_widget);
+    if (window == NULL)
         return false;
 
-    Display* dpy = GDK_WINDOW_XDISPLAY (m_widget->window);
+    Display* dpy = GDK_WINDOW_XDISPLAY(window);
     // We need to get the X Window that has the root window as the immediate parent
     // and m_widget->window as a child. This should be the X Window that the WM manages and
     // from which the opacity property is checked from.
-    Window win = wxGetTopmostWindowX11(dpy, GDK_WINDOW_XID (m_widget->window));
+    Window win = wxGetTopmostWindowX11(dpy, GDK_WINDOW_XID(window));
 
 
     // Using pure Xlib to not have a GTK version check mess due to gtk2.0 not having GdkDisplay
diff --git a/src/gtk/treeentry_gtk.c b/src/gtk/treeentry_gtk.c
index f25a7aaf73..a9aed08458 100644
--- a/src/gtk/treeentry_gtk.c
+++ b/src/gtk/treeentry_gtk.c
@@ -9,9 +9,6 @@
 
 #ifdef __VMS
 #include <types.h>
-typedef pid_t GPid;
-#define G_GNUC_INTERNAL 
-#define GSEAL(x) x
 #endif
 
 #include "wx/gtk/treeentry_gtk.h"
@@ -46,10 +43,10 @@ gtk_tree_entry_new()
     return GTK_TREE_ENTRY(g_object_new(GTK_TYPE_TREE_ENTRY, NULL));
 }
 
-GtkType
+GType
 gtk_tree_entry_get_type ()
 {
-    static GtkType tree_entry_type = 0;
+    static GType tree_entry_type = 0;
 
     if (!tree_entry_type)
     {
diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp
index 0850010f6e..774358195e 100644
--- a/src/gtk/utilsgtk.cpp
+++ b/src/gtk/utilsgtk.cpp
@@ -100,7 +100,7 @@ bool wxColourDisplay()
 
 int wxDisplayDepth()
 {
-    return gdk_drawable_get_visual( wxGetRootWindow()->window )->depth;
+    return gtk_widget_get_visual(wxGetRootWindow())->depth;
 }
 
 wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
@@ -186,31 +186,25 @@ const gchar *wx_pango_version_check (int major, int minor, int micro)
 // ----------------------------------------------------------------------------
 
 extern "C" {
-static
-void GTK_EndProcessDetector(gpointer data, gint source,
-                            GdkInputCondition WXUNUSED(condition))
+static gboolean EndProcessDetector(GIOChannel* source, GIOCondition, void* data)
 {
     wxEndProcessData * const
         proc_data = static_cast<wxEndProcessData *>(data);
 
     // child exited, end waiting
-    close(source);
-
-    // don't call us again!
-    gdk_input_remove(proc_data->tag);
+    close(g_io_channel_unix_get_fd(source));
 
     wxHandleProcessTermination(proc_data);
+
+    // don't call us again!
+    return false;
 }
 }
 
 int wxGUIAppTraits::AddProcessCallback(wxEndProcessData *proc_data, int fd)
 {
-    int tag = gdk_input_add(fd,
-                            GDK_INPUT_READ,
-                            GTK_EndProcessDetector,
-                            (gpointer)proc_data);
-
-    return tag;
+    return g_io_add_watch(
+        g_io_channel_unix_new(fd), G_IO_IN, EndProcessDetector, proc_data);
 }
 
 
-- 
2.47.2