[gtk+/wip/no-more-gdk-threads: 2/4] Replace gdk_threads_add_timeout* with g_timeout_add()



commit 630ec75010f21def6197c54dbca5551689aa9ccf
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Feb 2 15:51:47 2018 +0100

    Replace gdk_threads_add_timeout* with g_timeout_add()
    
    The main GDK thread lock is not portable and deprecated.
    
    The only reason why gdk_threads_add_timeout() and
    gdk_threads_add_timeout_full() exist is to allow invoking a callback
    with the GDK lock held, in case 3rd party libraries still use the
    deprecated gdk_threads_enter()/gdk_threads_leave() API.
    
    Since we're removing the GDK lock, and we're releasing a new major API,
    such code cannot exist any more; this means we can use the GLib API for
    installing timeout callbacks.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=793124

 demos/gtk-demo/images.c                          |    4 +--
 gdk/gdkframeclockidle.c                          |   22 +++++++-------
 gdk/wayland/gdkdevice-wayland.c                  |    3 +-
 gdk/win32/gdkdnd-win32.c                         |    6 ++--
 gdk/win32/gdkselection-win32.c                   |    2 +-
 gdk/x11/gdkdnd-x11.c                             |    6 ++--
 gtk/gtkbutton.c                                  |    4 +--
 gtk/gtkcalendar.c                                |    8 ++--
 gtk/gtkcellrenderertext.c                        |    3 +-
 gtk/gtkdnd.c                                     |    4 +--
 gtk/gtkentry.c                                   |   31 ++++++++++---------
 gtk/gtkentrycompletion.c                         |    2 +-
 gtk/gtkexpander.c                                |    2 +-
 gtk/gtkfilechooserwidget.c                       |    2 +-
 gtk/gtkfilesystemmodel.c                         |    9 ++---
 gtk/gtkgesturelongpress.c                        |    2 +-
 gtk/gtkgesturemultipress.c                       |    4 +--
 gtk/gtkiconview.c                                |    6 +--
 gtk/gtkmenu.c                                    |   20 ++++++------
 gtk/gtkmenuitem.c                                |    4 +--
 gtk/gtknotebook.c                                |   20 ++++++-------
 gtk/gtkprintoperation-win32.c                    |    4 +-
 gtk/gtkprintoperation.c                          |    6 ++--
 gtk/gtkrange.c                                   |    8 +----
 gtk/gtkrecentmanager.c                           |    2 +-
 gtk/gtkscrolledwindow.c                          |    4 +-
 gtk/gtkspinbutton.c                              |    8 ++--
 gtk/gtkstackswitcher.c                           |    6 ++--
 gtk/gtktextview.c                                |   34 +++++++++------------
 gtk/gtktooltip.c                                 |   16 +++++-----
 gtk/gtktreeview.c                                |   29 +++++++++---------
 gtk/gtkwindow.c                                  |    2 +-
 gtk/inspector/misc-info.c                        |    2 +-
 gtk/inspector/statistics.c                       |    4 +--
 modules/printbackends/cups/gtkprintbackendcups.c |   20 +++---------
 tests/testassistant.c                            |    2 +-
 tests/testcombo.c                                |    2 +-
 tests/testcombochange.c                          |    2 +-
 tests/testdnd.c                                  |    6 ++--
 tests/testentrycompletion.c                      |    2 +-
 tests/testgtk.c                                  |    4 +--
 tests/testtoolbar.c                              |    4 +-
 tests/testtreeflow.c                             |    2 +-
 43 files changed, 148 insertions(+), 185 deletions(-)
---
diff --git a/demos/gtk-demo/images.c b/demos/gtk-demo/images.c
index b6393cf..c3f0f67 100644
--- a/demos/gtk-demo/images.c
+++ b/demos/gtk-demo/images.c
@@ -261,9 +261,7 @@ start_progressive_loading (GtkWidget *image)
    * The timeout simply simulates a slow data source by inserting
    * pauses in the reading process.
    */
-  load_timeout = gdk_threads_add_timeout (150,
-                                progressive_timeout,
-                                image);
+  load_timeout = g_timeout_add (150, progressive_timeout, image);
   g_source_set_name_by_id (load_timeout, "[gtk+] progressive_timeout");
 }
 
diff --git a/gdk/gdkframeclockidle.c b/gdk/gdkframeclockidle.c
index 3714502..ebb7efe 100644
--- a/gdk/gdkframeclockidle.c
+++ b/gdk/gdkframeclockidle.c
@@ -237,22 +237,22 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle)
 
       if (priv->flush_idle_id == 0 && RUN_FLUSH_IDLE (priv))
         {
-          priv->flush_idle_id = gdk_threads_add_timeout_full (GDK_PRIORITY_EVENTS + 1,
-                                                              min_interval,
-                                                              gdk_frame_clock_flush_idle,
-                                                              g_object_ref (clock_idle),
-                                                              (GDestroyNotify) g_object_unref);
+          priv->flush_idle_id = g_timeout_add_full (GDK_PRIORITY_EVENTS + 1,
+                                                    min_interval,
+                                                    gdk_frame_clock_flush_idle,
+                                                    g_object_ref (clock_idle),
+                                                    (GDestroyNotify) g_object_unref);
           g_source_set_name_by_id (priv->flush_idle_id, "[gtk+] gdk_frame_clock_flush_idle");
         }
 
       if (!priv->in_paint_idle &&
          priv->paint_idle_id == 0 && RUN_PAINT_IDLE (priv))
         {
-          priv->paint_idle_id = gdk_threads_add_timeout_full (GDK_PRIORITY_REDRAW,
-                                                              min_interval,
-                                                              gdk_frame_clock_paint_idle,
-                                                              g_object_ref (clock_idle),
-                                                              (GDestroyNotify) g_object_unref);
+          priv->paint_idle_id = g_timeout_add_full (GDK_PRIORITY_REDRAW,
+                                                    min_interval,
+                                                    gdk_frame_clock_paint_idle,
+                                                    g_object_ref (clock_idle),
+                                                    (GDestroyNotify) g_object_unref);
           g_source_set_name_by_id (priv->paint_idle_id, "[gtk+] gdk_frame_clock_paint_idle");
         }
     }
@@ -364,7 +364,7 @@ gdk_frame_clock_paint_idle (void *data)
               /* We are likely not getting precisely even callbacks in real
                * time, particularly if the event loop is busy.
                * This is a documented limitation in the precision of
-               * gdk_threads_add_timeout_full and g_timeout_add_full.
+               * g_timeout_add_full().
                *
                * In order to avoid this imprecision from compounding between
                * frames and affecting visual smoothness, we correct frame_time
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 4dde622..a17d531 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -2076,8 +2076,7 @@ deliver_key_event (GdkWaylandSeat *seat,
 
   timeout = (seat->repeat_deadline - now) / 1000L;
 
-  seat->repeat_timer =
-    gdk_threads_add_timeout (timeout, keyboard_repeat, seat);
+  seat->repeat_timer = g_timeout_add (timeout, keyboard_repeat, seat);
   g_source_set_name_by_id (seat->repeat_timer, "[gtk+] keyboard_repeat");
 }
 
diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c
index 067d757..190386c 100644
--- a/gdk/win32/gdkdnd-win32.c
+++ b/gdk/win32/gdkdnd-win32.c
@@ -2789,9 +2789,9 @@ gdk_win32_drag_context_drop_done (GdkDragContext *context,
   anim->frame_clock = gdk_window_get_frame_clock (win32_context->drag_window);
   anim->start_time = gdk_frame_clock_get_frame_time (anim->frame_clock);
 
-  id = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT, 17,
-                                     gdk_drag_anim_timeout, anim,
-                                     (GDestroyNotify) gdk_drag_anim_destroy);
+  id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
+                           gdk_drag_anim_timeout, anim,
+                           (GDestroyNotify) gdk_drag_anim_destroy);
   g_source_set_name_by_id (id, "[gtk+] gdk_drag_anim_timeout");
 }
 
diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c
index dc38463..d3b0948 100644
--- a/gdk/win32/gdkselection-win32.c
+++ b/gdk/win32/gdkselection-win32.c
@@ -2001,7 +2001,7 @@ queue_open_clipboard (GdkWin32ClipboardQueueAction  action,
   if (win32_sel->clipboard_opened_for == INVALID_HANDLE_VALUE &&
       clipboard_queue == NULL)
     {
-      id = gdk_threads_add_timeout_seconds (1, (GSourceFunc) open_clipboard_timeout, NULL);
+      id = g_timeout_add_seconds (1, (GSourceFunc) open_clipboard_timeout, NULL);
       g_source_set_name_by_id (id, "[gdk-win32] open_clipboard_timeout");
       GDK_NOTE (DND, g_print ("Started open clipboard timer\n"));
     }
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index 70585c3..3290716 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -2791,9 +2791,9 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context,
   anim->frame_clock = gdk_window_get_frame_clock (x11_context->drag_window);
   anim->start_time = gdk_frame_clock_get_frame_time (anim->frame_clock);
 
-  id = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT, 17,
-                                     gdk_drag_anim_timeout, anim,
-                                     (GDestroyNotify) gdk_drag_anim_destroy);
+  id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
+                           gdk_drag_anim_timeout, anim,
+                           (GDestroyNotify) gdk_drag_anim_destroy);
   g_source_set_name_by_id (id, "[gtk+] gdk_drag_anim_timeout");
 }
 
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index d43ecf5..6f46594 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -829,9 +829,7 @@ gtk_real_button_activate (GtkButton *button)
           priv->grab_keyboard = device;
        }
 
-      priv->activate_timeout = gdk_threads_add_timeout (ACTIVATE_TIMEOUT,
-                                               button_activate_timeout,
-                                               button);
+      priv->activate_timeout = g_timeout_add (ACTIVATE_TIMEOUT, button_activate_timeout, button);
       g_source_set_name_by_id (priv->activate_timeout, "[gtk+] button_activate_timeout");
       priv->button_down = TRUE;
       gtk_button_update_state (button);
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 0899748..2d03959 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -2486,10 +2486,10 @@ calendar_timer (gpointer data)
       if (priv->need_timer)
         {
           priv->need_timer = FALSE;
-          priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
+          priv->timer = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
                                             TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
                                             (GSourceFunc) calendar_timer,
-                                            (gpointer) calendar, NULL);
+                                            calendar, NULL);
           g_source_set_name_by_id (priv->timer, "[gtk+] calendar_timer");
         }
       else
@@ -2510,10 +2510,10 @@ calendar_start_spinning (GtkCalendar *calendar,
   if (!priv->timer)
     {
       priv->need_timer = TRUE;
-      priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
+      priv->timer = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
                                         TIMEOUT_INITIAL,
                                         (GSourceFunc) calendar_timer,
-                                        (gpointer) calendar, NULL);
+                                        calendar, NULL);
       g_source_set_name_by_id (priv->timer, "[gtk+] calendar_timer");
     }
 }
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index f0c7d07..5838d94 100644
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@ -1850,8 +1850,7 @@ gtk_cell_renderer_text_popup_unmap (GtkMenu *menu,
   if (priv->entry_menu_popdown_timeout)
     return;
 
-  priv->entry_menu_popdown_timeout = gdk_threads_add_timeout (500, popdown_timeout,
-                                                    data);
+  priv->entry_menu_popdown_timeout = g_timeout_add (500, popdown_timeout, data);
   g_source_set_name_by_id (priv->entry_menu_popdown_timeout, "[gtk+] popdown_timeout");
 }
 
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index f072239..571f69c 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -1349,9 +1349,7 @@ gtk_drag_drop (GtkDragSourceInfo *info,
   if (info->icon_window)
     gtk_widget_hide (info->icon_window);
 
-  info->drop_timeout = gdk_threads_add_timeout (DROP_ABORT_TIME,
-                                                gtk_drag_abort_timeout,
-                                                info);
+  info->drop_timeout = g_timeout_add (DROP_ABORT_TIME, gtk_drag_abort_timeout, info);
   g_source_set_name_by_id (info->drop_timeout, "[gtk+] gtk_drag_abort_timeout");
 }
 
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 0477091..f1bcf64 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -4741,8 +4741,9 @@ buffer_inserted_text (GtkEntryBuffer *buffer,
           password_hint->position = position;
           if (password_hint->source_id)
             g_source_remove (password_hint->source_id);
-          password_hint->source_id = gdk_threads_add_timeout (password_hint_timeout,
-                                                              (GSourceFunc)gtk_entry_remove_password_hint, 
entry);
+          password_hint->source_id = g_timeout_add (password_hint_timeout,
+                                                    (GSourceFunc)gtk_entry_remove_password_hint,
+                                                    entry);
           g_source_set_name_by_id (password_hint->source_id, "[gtk+] gtk_entry_remove_password_hint");
         }
     }
@@ -8808,7 +8809,7 @@ gtk_entry_selection_bubble_popup_set (GtkEntry *entry)
     g_source_remove (priv->selection_bubble_timeout_id);
 
   priv->selection_bubble_timeout_id =
-    gdk_threads_add_timeout (50, gtk_entry_selection_bubble_popup_show, entry);
+    g_timeout_add (50, gtk_entry_selection_bubble_popup_show, entry);
   g_source_set_name_by_id (priv->selection_bubble_timeout_id, "[gtk+] gtk_entry_selection_bubble_popup_cb");
 }
 
@@ -9223,18 +9224,18 @@ blink_cb (gpointer data)
   else if (priv->cursor_visible)
     {
       hide_cursor (entry);
-      priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_OFF_MULTIPLIER / 
CURSOR_DIVIDER,
-                                           blink_cb,
-                                           entry);
+      priv->blink_timeout = g_timeout_add (get_cursor_time (entry) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
+                                           blink_cb,
+                                           entry);
       g_source_set_name_by_id (priv->blink_timeout, "[gtk+] blink_cb");
     }
   else
     {
       show_cursor (entry);
       priv->blink_time += get_cursor_time (entry);
-      priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / 
CURSOR_DIVIDER,
-                                           blink_cb,
-                                           entry);
+      priv->blink_timeout = g_timeout_add (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
+                                           blink_cb,
+                                           entry);
       g_source_set_name_by_id (priv->blink_timeout, "[gtk+] blink_cb");
     }
 
@@ -9251,9 +9252,9 @@ gtk_entry_check_cursor_blink (GtkEntry *entry)
       if (!priv->blink_timeout)
        {
          show_cursor (entry);
-         priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / 
CURSOR_DIVIDER,
-                                               blink_cb,
-                                               entry);
+         priv->blink_timeout = g_timeout_add (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / 
CURSOR_DIVIDER,
+                                               blink_cb,
+                                               entry);
          g_source_set_name_by_id (priv->blink_timeout, "[gtk+] blink_cb");
        }
     }
@@ -9279,9 +9280,9 @@ gtk_entry_pend_cursor_blink (GtkEntry *entry)
       if (priv->blink_timeout != 0)
        g_source_remove (priv->blink_timeout);
 
-      priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_PEND_MULTIPLIER / 
CURSOR_DIVIDER,
-                                                     blink_cb,
-                                                     entry);
+      priv->blink_timeout = g_timeout_add (get_cursor_time (entry) * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
+                                           blink_cb,
+                                           entry);
       g_source_set_name_by_id (priv->blink_timeout, "[gtk+] blink_cb");
       show_cursor (entry);
     }
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c
index 7dcd7e5..ebb2fb1 100644
--- a/gtk/gtkentrycompletion.c
+++ b/gtk/gtkentrycompletion.c
@@ -2463,7 +2463,7 @@ gtk_entry_completion_changed (GtkWidget *widget,
     completion->priv->device = device;
 
   completion->priv->completion_timeout =
-    gdk_threads_add_timeout (COMPLETION_TIMEOUT,
+    g_timeout_add (COMPLETION_TIMEOUT,
                    gtk_entry_completion_timeout,
                    completion);
   g_source_set_name_by_id (completion->priv->completion_timeout, "[gtk+] gtk_entry_completion_timeout");
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index 33c2d13..763d401 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -584,7 +584,7 @@ gtk_expander_drag_motion (GtkWidget        *widget,
 
   if (!priv->expanded && !priv->expand_timer)
     {
-      priv->expand_timer = gdk_threads_add_timeout (TIMEOUT_EXPAND, (GSourceFunc) expand_timeout, expander);
+      priv->expand_timer = g_timeout_add (TIMEOUT_EXPAND, (GSourceFunc) expand_timeout, expander);
       g_source_set_name_by_id (priv->expand_timer, "[gtk+] expand_timeout");
     }
 
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 47cec72..a494a22 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -4280,7 +4280,7 @@ load_setup_timer (GtkFileChooserWidget *impl)
   g_assert (priv->load_timeout_id == 0);
   g_assert (priv->load_state != LOAD_PRELOAD);
 
-  priv->load_timeout_id = gdk_threads_add_timeout (MAX_LOADING_TIME, load_timeout_cb, impl);
+  priv->load_timeout_id = g_timeout_add (MAX_LOADING_TIME, load_timeout_cb, impl);
   g_source_set_name_by_id (priv->load_timeout_id, "[gtk+] load_timeout_cb");
   priv->load_state = LOAD_PRELOAD;
 }
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c
index 386188d..7350a4a 100644
--- a/gtk/gtkfilesystemmodel.c
+++ b/gtk/gtkfilesystemmodel.c
@@ -1146,11 +1146,10 @@ gtk_file_system_model_got_files (GObject *object, GAsyncResult *res, gpointer da
       if (model->dir_thaw_source == 0)
         {
           freeze_updates (model);
-          model->dir_thaw_source = gdk_threads_add_timeout_full (IO_PRIORITY + 1,
-                                                                 50,
-                                                                 thaw_func,
-                                                                 model,
-                                                                 NULL);
+          model->dir_thaw_source = g_timeout_add_full (IO_PRIORITY + 1, 50,
+                                                       thaw_func,
+                                                       model,
+                                                       NULL);
           g_source_set_name_by_id (model->dir_thaw_source, "[gtk+] thaw_func");
         }
 
diff --git a/gtk/gtkgesturelongpress.c b/gtk/gtkgesturelongpress.c
index 948b5de..2630c84 100644
--- a/gtk/gtkgesturelongpress.c
+++ b/gtk/gtkgesturelongpress.c
@@ -142,7 +142,7 @@ gtk_gesture_long_press_begin (GtkGesture       *gesture,
 
   gtk_gesture_get_point (gesture, sequence,
                          &priv->initial_x, &priv->initial_y);
-  priv->timeout_id = gdk_threads_add_timeout (delay, _gtk_gesture_long_press_timeout, gesture);
+  priv->timeout_id = g_timeout_add (delay, _gtk_gesture_long_press_timeout, gesture);
   g_source_set_name_by_id (priv->timeout_id, "[gtk+] _gtk_gesture_long_press_timeout");
 }
 
diff --git a/gtk/gtkgesturemultipress.c b/gtk/gtkgesturemultipress.c
index 1f4f0e5..ee925a0 100644
--- a/gtk/gtkgesturemultipress.c
+++ b/gtk/gtkgesturemultipress.c
@@ -151,9 +151,7 @@ _gtk_gesture_multi_press_update_timeout (GtkGestureMultiPress *gesture)
   settings = gtk_widget_get_settings (widget);
   g_object_get (settings, "gtk-double-click-time", &double_click_time, NULL);
 
-  priv->double_click_timeout_id = gdk_threads_add_timeout (double_click_time,
-                                                           _double_click_timeout_cb,
-                                                           gesture);
+  priv->double_click_timeout_id = g_timeout_add (double_click_time, _double_click_timeout_cb, gesture);
   g_source_set_name_by_id (priv->double_click_timeout_id, "[gtk+] _double_click_timeout_cb");
 }
 
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 0a7ed4b..9246f93 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1851,8 +1851,7 @@ gtk_icon_view_motion (GtkEventController *controller,
          icon_view->priv->event_last_y = icon_view->priv->mouse_x;
 
          if (icon_view->priv->scroll_timeout_id == 0) {
-           icon_view->priv->scroll_timeout_id = gdk_threads_add_timeout (30, rubberband_scroll_timeout, 
-                                                               icon_view);
+           icon_view->priv->scroll_timeout_id = g_timeout_add (30, rubberband_scroll_timeout, icon_view);
            g_source_set_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk+] rubberband_scroll_timeout");
          }
        }
@@ -6397,8 +6396,7 @@ gtk_icon_view_drag_motion (GtkWidget      *widget,
     {
       if (icon_view->priv->scroll_timeout_id == 0)
        {
-         icon_view->priv->scroll_timeout_id =
-           gdk_threads_add_timeout (50, drag_scroll_timeout, icon_view);
+         icon_view->priv->scroll_timeout_id = g_timeout_add (50, drag_scroll_timeout, icon_view);
          g_source_set_name_by_id (icon_view->priv->scroll_timeout_id, "[gtk+] drag_scroll_timeout");
        }
 
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index ffcaafd..9215926 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -3380,11 +3380,11 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
                                     ? -MENU_SCROLL_STEP2
                                     : -MENU_SCROLL_STEP1;
 
-              priv->scroll_timeout =
-                gdk_threads_add_timeout (scroll_fast
-                                           ? MENU_SCROLL_TIMEOUT2
-                                           : MENU_SCROLL_TIMEOUT1,
-                                         gtk_menu_scroll_timeout, menu);
+              priv->scroll_timeout = g_timeout_add (scroll_fast
+                                                      ? MENU_SCROLL_TIMEOUT2
+                                                      : MENU_SCROLL_TIMEOUT1,
+                                                    gtk_menu_scroll_timeout,
+                                                    menu);
               g_source_set_name_by_id (priv->scroll_timeout, "[gtk+] gtk_menu_scroll_timeout");
             }
           else if (!enter && !in_arrow && priv->upper_arrow_prelight)
@@ -3451,11 +3451,11 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
                                     ? MENU_SCROLL_STEP2
                                     : MENU_SCROLL_STEP1;
 
-              priv->scroll_timeout =
-                gdk_threads_add_timeout (scroll_fast
-                                           ? MENU_SCROLL_TIMEOUT2
-                                           : MENU_SCROLL_TIMEOUT1,
-                                         gtk_menu_scroll_timeout, menu);
+              priv->scroll_timeout = g_timeout_add (scroll_fast
+                                                      ? MENU_SCROLL_TIMEOUT2
+                                                      : MENU_SCROLL_TIMEOUT1,
+                                                    gtk_menu_scroll_timeout,
+                                                    menu);
               g_source_set_name_by_id (priv->scroll_timeout, "[gtk+] gtk_menu_scroll_timeout");
             }
           else if (!enter && !in_arrow && priv->lower_arrow_prelight)
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index e7bacd2..7dddb7a 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -1568,9 +1568,7 @@ _gtk_menu_item_popup_submenu (GtkWidget *widget,
           info->menu_item = menu_item;
           info->trigger_event = gtk_get_current_event ();
 
-          priv->timer = gdk_threads_add_timeout (popup_delay,
-                                                 gtk_menu_item_popup_timeout,
-                                                 info);
+          priv->timer = g_timeout_add (popup_delay, gtk_menu_item_popup_timeout, info);
           g_source_set_name_by_id (priv->timer, "[gtk+] gtk_menu_item_popup_timeout");
 
           return;
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 4e7e7de..b14449d 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2738,9 +2738,9 @@ gtk_notebook_motion (GtkEventController *controller,
           if (!priv->dnd_timer)
             {
               priv->has_scrolled = TRUE;
-              priv->dnd_timer = gdk_threads_add_timeout (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
+              priv->dnd_timer = g_timeout_add (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
                                                scroll_notebook_timer,
-                                               (gpointer) notebook);
+                                               notebook);
               g_source_set_name_by_id (priv->dnd_timer, "[gtk+] scroll_notebook_timer");
             }
         }
@@ -3138,9 +3138,7 @@ gtk_notebook_drag_motion (GtkWidget      *widget,
 
       if (!priv->switch_tab_timer)
         {
-          priv->switch_tab_timer = gdk_threads_add_timeout (TIMEOUT_EXPAND,
-                                                  gtk_notebook_switch_tab_timeout,
-                                                  widget);
+          priv->switch_tab_timer = g_timeout_add (TIMEOUT_EXPAND, gtk_notebook_switch_tab_timeout, widget);
           g_source_set_name_by_id (priv->switch_tab_timer, "[gtk+] gtk_notebook_switch_tab_timeout");
         }
     }
@@ -4127,9 +4125,9 @@ gtk_notebook_timer (GtkNotebook *notebook)
       if (priv->need_timer)
         {
           priv->need_timer = FALSE;
-          priv->timer = gdk_threads_add_timeout (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
-                                           (GSourceFunc) gtk_notebook_timer,
-                                           (gpointer) notebook);
+          priv->timer = g_timeout_add (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
+                                       (GSourceFunc) gtk_notebook_timer,
+                                       notebook);
           g_source_set_name_by_id (priv->timer, "[gtk+] gtk_notebook_timer");
         }
       else
@@ -4146,9 +4144,9 @@ gtk_notebook_set_scroll_timer (GtkNotebook *notebook)
 
   if (!priv->timer)
     {
-      priv->timer = gdk_threads_add_timeout (TIMEOUT_INITIAL,
-                                       (GSourceFunc) gtk_notebook_timer,
-                                       (gpointer) notebook);
+      priv->timer = g_timeout_add (TIMEOUT_INITIAL,
+                                   (GSourceFunc) gtk_notebook_timer,
+                                   notebook);
       g_source_set_name_by_id (priv->timer, "[gtk+] gtk_notebook_timer");
       priv->need_timer = TRUE;
     }
diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c
index 2d11bce..71c5688 100644
--- a/gtk/gtkprintoperation-win32.c
+++ b/gtk/gtkprintoperation-win32.c
@@ -517,7 +517,7 @@ win32_poll_status_timeout (GtkPrintOperation *op)
   win32_poll_status (op);
 
   if (!gtk_print_operation_is_finished (op)) {
-    op_win32->timeout_id = gdk_threads_add_timeout (STATUS_POLLING_TIME,
+    op_win32->timeout_id = g_timeout_add (STATUS_POLLING_TIME,
                                          (GSourceFunc)win32_poll_status_timeout,
                                          op);
     g_source_set_name_by_id (op_win32->timeout_id, "[gtk+] win32_poll_status_timeout");
@@ -561,7 +561,7 @@ win32_end_run (GtkPrintOperation *op,
     {
       op_win32->printerHandle = printerHandle;
       win32_poll_status (op);
-      op_win32->timeout_id = gdk_threads_add_timeout (STATUS_POLLING_TIME,
+      op_win32->timeout_id = g_timeout_add (STATUS_POLLING_TIME,
                                            (GSourceFunc)win32_poll_status_timeout,
                                            op);
       g_source_set_name_by_id (op_win32->timeout_id, "[gtk+] win32_poll_status_timeout");
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c
index cd2a082..68a2e15 100644
--- a/gtk/gtkprintoperation.c
+++ b/gtk/gtkprintoperation.c
@@ -3008,9 +3008,9 @@ print_pages (GtkPrintOperation       *op,
                        G_CALLBACK (handle_progress_response), op);
 
       priv->show_progress_timeout_id = 
-       gdk_threads_add_timeout (SHOW_PROGRESS_TIME, 
-                      (GSourceFunc)show_progress_timeout,
-                      data);
+       g_timeout_add (SHOW_PROGRESS_TIME,
+                       (GSourceFunc) show_progress_timeout,
+                       data);
       g_source_set_name_by_id (priv->show_progress_timeout_id, "[gtk+] show_progress_timeout");
 
       data->progress = progress;
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index d6464e3..54b4186 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -2890,9 +2890,7 @@ initial_timeout (gpointer data)
   GtkRange *range = GTK_RANGE (data);
   GtkRangePrivate *priv = range->priv;
 
-  priv->timer->timeout_id = gdk_threads_add_timeout (TIMEOUT_REPEAT,
-                                                     second_timeout,
-                                                     range);
+  priv->timer->timeout_id = g_timeout_add (TIMEOUT_REPEAT, second_timeout, range);
   g_source_set_name_by_id (priv->timer->timeout_id, "[gtk+] second_timeout");
   return G_SOURCE_REMOVE;
 }
@@ -2908,9 +2906,7 @@ gtk_range_add_step_timer (GtkRange      *range,
 
   priv->timer = g_new (GtkRangeStepTimer, 1);
 
-  priv->timer->timeout_id = gdk_threads_add_timeout (TIMEOUT_INITIAL,
-                                                     initial_timeout,
-                                                     range);
+  priv->timer->timeout_id = g_timeout_add (TIMEOUT_INITIAL, initial_timeout, range);
   g_source_set_name_by_id (priv->timer->timeout_id, "[gtk+] initial_timeout");
   priv->timer->step = step;
 
diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c
index b241ba2..d6806da 100644
--- a/gtk/gtkrecentmanager.c
+++ b/gtk/gtkrecentmanager.c
@@ -1422,7 +1422,7 @@ gtk_recent_manager_changed (GtkRecentManager *manager)
    */
   if (manager->priv->changed_timeout == 0)
     {
-      manager->priv->changed_timeout = gdk_threads_add_timeout (250, emit_manager_changed, manager);
+      manager->priv->changed_timeout = g_timeout_add (250, emit_manager_changed, manager);
       g_source_set_name_by_id (manager->priv->changed_timeout, "[gtk+] emit_manager_changed");
     }
   else
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 7936c8b..704d6c1 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1161,7 +1161,7 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
     indicator_set_over (indicator, TRUE);
   else if (indicator_close && !on_other_scrollbar)
     {
-      indicator->over_timeout_id = gdk_threads_add_timeout (30, enable_over_timeout_cb, indicator);
+      indicator->over_timeout_id = g_timeout_add (30, enable_over_timeout_cb, indicator);
       g_source_set_name_by_id (indicator->over_timeout_id, "[gtk+] enable_over_timeout_cb");
     }
   else
@@ -1381,7 +1381,7 @@ scroll_controller_scroll (GtkEventControllerScroll *scroll,
       _gtk_scrolled_window_get_overshoot (scrolled_window, NULL, NULL))
     {
       priv->scroll_events_overshoot_id =
-        gdk_threads_add_timeout (50, start_scroll_deceleration_cb, scrolled_window);
+        g_timeout_add (50, start_scroll_deceleration_cb, scrolled_window);
       g_source_set_name_by_id (priv->scroll_events_overshoot_id,
                                "[gtk+] start_scroll_deceleration_cb");
     }
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index af5784b..1f28cee 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -775,7 +775,7 @@ start_spinning (GtkSpinButton *spin,
     {
       priv->timer_step = step;
       priv->need_timer = TRUE;
-      priv->timer = gdk_threads_add_timeout (TIMEOUT_INITIAL,
+      priv->timer = g_timeout_add (TIMEOUT_INITIAL,
                                    (GSourceFunc) gtk_spin_button_timer,
                                    (gpointer) spin);
       g_source_set_name_by_id (priv->timer, "[gtk+] gtk_spin_button_timer");
@@ -1153,9 +1153,9 @@ gtk_spin_button_timer (GtkSpinButton *spin_button)
       if (priv->need_timer)
         {
           priv->need_timer = FALSE;
-          priv->timer = gdk_threads_add_timeout (TIMEOUT_REPEAT,
-                                              (GSourceFunc) gtk_spin_button_timer,
-                                              (gpointer) spin_button);
+          priv->timer = g_timeout_add (TIMEOUT_REPEAT,
+                                       (GSourceFunc) gtk_spin_button_timer,
+                                       spin_button);
           g_source_set_name_by_id (priv->timer, "[gtk+] gtk_spin_button_timer");
         }
       else
diff --git a/gtk/gtkstackswitcher.c b/gtk/gtkstackswitcher.c
index 36c2f2e..5495591 100644
--- a/gtk/gtkstackswitcher.c
+++ b/gtk/gtkstackswitcher.c
@@ -327,9 +327,9 @@ gtk_stack_switcher_drag_motion (GtkWidget      *widget,
 
   if (button && !priv->switch_timer)
     {
-      priv->switch_timer = gdk_threads_add_timeout (TIMEOUT_EXPAND,
-                                                    gtk_stack_switcher_switch_timeout,
-                                                    self);
+      priv->switch_timer = g_timeout_add (TIMEOUT_EXPAND,
+                                          gtk_stack_switcher_switch_timeout,
+                                          self);
       g_source_set_name_by_id (priv->switch_timer, "[gtk+] gtk_stack_switcher_switch_timeout");
     }
 
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 9dbfa52..171467c 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -5877,16 +5877,16 @@ blink_cb (gpointer data)
     } 
   else if (visible)
     {
-      priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / 
CURSOR_DIVIDER,
-                                                    blink_cb,
-                                                    text_view);
+      priv->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / 
CURSOR_DIVIDER,
+                                           blink_cb,
+                                           text_view);
       g_source_set_name_by_id (priv->blink_timeout, "[gtk+] blink_cb");
     }
   else 
     {
-      priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_ON_MULTIPLIER / 
CURSOR_DIVIDER,
-                                                    blink_cb,
-                                                    text_view);
+      priv->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_ON_MULTIPLIER / 
CURSOR_DIVIDER,
+                                           blink_cb,
+                                           text_view);
       g_source_set_name_by_id (priv->blink_timeout, "[gtk+] blink_cb");
       priv->blink_time += get_cursor_time (text_view);
     }
@@ -5935,9 +5935,9 @@ gtk_text_view_check_cursor_blink (GtkTextView *text_view)
            {
              gtk_text_layout_set_cursor_visible (priv->layout, TRUE);
              
-             priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * 
CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
-                                                            blink_cb,
-                                                            text_view);
+             priv->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / 
CURSOR_DIVIDER,
+                                                   blink_cb,
+                                                   text_view);
              g_source_set_name_by_id (priv->blink_timeout, "[gtk+] blink_cb");
            }
        }
@@ -5967,9 +5967,9 @@ gtk_text_view_pend_cursor_blink (GtkTextView *text_view)
       gtk_text_view_stop_cursor_blink (text_view);
       gtk_text_layout_set_cursor_visible (priv->layout, TRUE);
       
-      priv->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_PEND_MULTIPLIER / 
CURSOR_DIVIDER,
-                                                    blink_cb,
-                                                    text_view);
+      priv->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_PEND_MULTIPLIER / 
CURSOR_DIVIDER,
+                                           blink_cb,
+                                           text_view);
       g_source_set_name_by_id (priv->blink_timeout, "[gtk+] blink_cb");
     }
 }
@@ -7327,8 +7327,7 @@ gtk_text_view_drag_gesture_update (GtkGestureDrag *gesture,
   if (text_view->priv->scroll_timeout != 0) /* reset on every motion event */
     g_source_remove (text_view->priv->scroll_timeout);
 
-  text_view->priv->scroll_timeout =
-    gdk_threads_add_timeout (50, selection_scan_timeout, text_view);
+  text_view->priv->scroll_timeout = g_timeout_add (50, selection_scan_timeout, text_view);
   g_source_set_name_by_id (text_view->priv->scroll_timeout, "[gtk+] selection_scan_timeout");
 
   gtk_text_view_selection_bubble_popup_unset (text_view);
@@ -8021,8 +8020,7 @@ gtk_text_view_drag_motion (GtkWidget        *widget,
 
   if (!priv->scroll_timeout)
   {
-    priv->scroll_timeout =
-      gdk_threads_add_timeout (100, drag_scan_timeout, text_view);
+    priv->scroll_timeout = g_timeout_add (100, drag_scan_timeout, text_view);
     g_source_set_name_by_id (text_view->priv->scroll_timeout, "[gtk+] drag_scan_timeout");
   }
 
@@ -9086,9 +9084,7 @@ gtk_text_view_selection_bubble_popup_set (GtkTextView *text_view)
   if (priv->selection_bubble_timeout_id)
     g_source_remove (priv->selection_bubble_timeout_id);
 
-  priv->selection_bubble_timeout_id =
-    gdk_threads_add_timeout (50, gtk_text_view_selection_bubble_popup_show,
-                             text_view);
+  priv->selection_bubble_timeout_id = g_timeout_add (50, gtk_text_view_selection_bubble_popup_show, 
text_view);
   g_source_set_name_by_id (priv->selection_bubble_timeout_id, "[gtk+] 
gtk_text_view_selection_bubble_popup_cb");
 }
 
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index eed1a56..80b340a 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -965,10 +965,10 @@ gtk_tooltip_hide_tooltip (GtkTooltip *tooltip)
       if (!tooltip->browse_mode_timeout_id)
         {
          tooltip->browse_mode_timeout_id =
-           gdk_threads_add_timeout_full (0, timeout,
-                                         tooltip_browse_mode_expired,
-                                         g_object_ref (tooltip),
-                                         g_object_unref);
+           g_timeout_add_full (0, timeout,
+                                tooltip_browse_mode_expired,
+                                g_object_ref (tooltip),
+                                g_object_unref);
          g_source_set_name_by_id (tooltip->browse_mode_timeout_id, "[gtk+] tooltip_browse_mode_expired");
        }
     }
@@ -1029,10 +1029,10 @@ gtk_tooltip_start_delay (GdkDisplay *display)
   else
     timeout = HOVER_TIMEOUT;
 
-  tooltip->timeout_id = gdk_threads_add_timeout_full (0, timeout,
-                                                     tooltip_popup_timeout,
-                                                     g_object_ref (display),
-                                                     g_object_unref);
+  tooltip->timeout_id = g_timeout_add_full (0, timeout,
+                                            tooltip_popup_timeout,
+                                            g_object_ref (display),
+                                            g_object_unref);
   g_source_set_name_by_id (tooltip->timeout_id, "[gtk+] tooltip_popup_timeout");
 }
 
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 8571151..fb0c380 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -3486,7 +3486,7 @@ do_prelight (GtkTreeView *tree_view,
   if (tree_view->priv->hover_expand)
     {
       tree_view->priv->auto_expand_timeout = 
-       gdk_threads_add_timeout (AUTO_EXPAND_TIMEOUT, auto_expand_timeout, tree_view);
+       g_timeout_add (AUTO_EXPAND_TIMEOUT, auto_expand_timeout, tree_view);
       g_source_set_name_by_id (tree_view->priv->auto_expand_timeout, "[gtk+] auto_expand_timeout");
     }
 }
@@ -7122,8 +7122,7 @@ add_scroll_timeout (GtkTreeView *tree_view)
 {
   if (tree_view->priv->scroll_timeout == 0)
     {
-      tree_view->priv->scroll_timeout =
-       gdk_threads_add_timeout (150, scroll_row_timeout, tree_view);
+      tree_view->priv->scroll_timeout = g_timeout_add (150, scroll_row_timeout, tree_view);
       g_source_set_name_by_id (tree_view->priv->scroll_timeout, "[gtk+] scroll_row_timeout");
     }
 }
@@ -7687,7 +7686,7 @@ gtk_tree_view_drag_motion (GtkWidget        *widget,
            pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE))
         {
           tree_view->priv->open_dest_timeout =
-            gdk_threads_add_timeout (AUTO_EXPAND_TIMEOUT, open_row_timeout, tree_view);
+            g_timeout_add (AUTO_EXPAND_TIMEOUT, open_row_timeout, tree_view);
           g_source_set_name_by_id (tree_view->priv->open_dest_timeout, "[gtk+] open_row_timeout");
         }
       else
@@ -10811,9 +10810,9 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view,
     }
 
   tree_view->priv->typeselect_flush_timeout =
-    gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
-                  (GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
-                  tree_view);
+    g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+                   (GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
+                   tree_view);
   g_source_set_name_by_id (tree_view->priv->typeselect_flush_timeout, "[gtk+] 
gtk_tree_view_search_entry_flush_timeout");
 
   /* send focus-in event */
@@ -14383,8 +14382,8 @@ gtk_tree_view_search_preedit_changed (GtkIMContext *im_context,
     {
       g_source_remove (tree_view->priv->typeselect_flush_timeout);
       tree_view->priv->typeselect_flush_timeout =
-       gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
-                      (GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
+       g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+                       (GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
                       tree_view);
       g_source_set_name_by_id (tree_view->priv->typeselect_flush_timeout, "[gtk+] 
gtk_tree_view_search_entry_flush_timeout");
     }
@@ -14437,8 +14436,10 @@ static void
 gtk_tree_view_search_enable_popdown (GtkWidget *widget,
                                     gpointer   data)
 {
-  guint id;
-  id = gdk_threads_add_timeout_full (G_PRIORITY_HIGH, 200, gtk_tree_view_real_search_enable_popdown, 
g_object_ref (data), g_object_unref);
+  guint id = g_timeout_add_full (G_PRIORITY_HIGH, 200,
+                                 gtk_tree_view_real_search_enable_popdown,
+                                 g_object_ref (data),
+                                 g_object_unref);
   g_source_set_name_by_id (id, "[gtk+] gtk_tree_view_real_search_enable_popdown");
 }
 
@@ -14482,7 +14483,7 @@ gtk_tree_view_search_scroll_event (GtkWidget   *widget,
     {
       g_source_remove (tree_view->priv->typeselect_flush_timeout);
       tree_view->priv->typeselect_flush_timeout =
-       gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+       g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
                       (GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
                       tree_view);
       g_source_set_name_by_id (tree_view->priv->typeselect_flush_timeout, "[gtk+] 
gtk_tree_view_search_entry_flush_timeout");
@@ -14559,7 +14560,7 @@ gtk_tree_view_search_key_press_event (GtkWidget *widget,
     {
       g_source_remove (tree_view->priv->typeselect_flush_timeout);
       tree_view->priv->typeselect_flush_timeout =
-       gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+       g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
                       (GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
                       tree_view);
       g_source_set_name_by_id (tree_view->priv->typeselect_flush_timeout, "[gtk+] 
gtk_tree_view_search_entry_flush_timeout");
@@ -14812,7 +14813,7 @@ gtk_tree_view_search_init (GtkWidget   *entry,
     {
       g_source_remove (tree_view->priv->typeselect_flush_timeout);
       tree_view->priv->typeselect_flush_timeout =
-       gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+       g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
                       (GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
                       tree_view);
       g_source_set_name_by_id (tree_view->priv->typeselect_flush_timeout, "[gtk+] 
gtk_tree_view_search_entry_flush_timeout");
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 296aa5d..3e20ca8 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -10690,7 +10690,7 @@ _gtk_window_schedule_mnemonics_visible (GtkWindow *window)
     return;
 
   window->priv->mnemonics_display_timeout_id =
-    gdk_threads_add_timeout (MNEMONICS_DELAY, schedule_mnemonics_visible_cb, window);
+    g_timeout_add (MNEMONICS_DELAY, schedule_mnemonics_visible_cb, window);
   g_source_set_name_by_id (window->priv->mnemonics_display_timeout_id, "[gtk+] 
schedule_mnemonics_visible_cb");
 }
 
diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c
index 2c36418..6d7ddb2 100644
--- a/gtk/inspector/misc-info.c
+++ b/gtk/inspector/misc-info.c
@@ -542,7 +542,7 @@ map (GtkWidget *widget)
 
   GTK_WIDGET_CLASS (gtk_inspector_misc_info_parent_class)->map (widget);
 
-  sl->priv->update_source_id = gdk_threads_add_timeout_seconds (1, update_info, sl);
+  sl->priv->update_source_id = g_timeout_add_seconds (1, update_info, sl);
   update_info (sl);
 }
 
diff --git a/gtk/inspector/statistics.c b/gtk/inspector/statistics.c
index 5bf6e7c..bce187b 100644
--- a/gtk/inspector/statistics.c
+++ b/gtk/inspector/statistics.c
@@ -151,9 +151,7 @@ toggle_record (GtkToggleButton        *button,
 
   if (gtk_toggle_button_get_active (button))
     {
-      sl->priv->update_source_id = gdk_threads_add_timeout_seconds (1,
-                                                                    update_type_counts,
-                                                                    sl);
+      sl->priv->update_source_id = g_timeout_add_seconds (1, update_type_counts, sl);
       update_type_counts (sl);
     }
   else
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c 
b/modules/printbackends/cups/gtkprintbackendcups.c
index 3751b2d..4e6091e 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -3706,9 +3706,7 @@ cups_request_printer_list (GtkPrintBackendCups *cups_backend)
       cups_backend->list_printers_attempts = -1;
       if (cups_backend->list_printers_poll > 0)
         g_source_remove (cups_backend->list_printers_poll);
-      cups_backend->list_printers_poll = gdk_threads_add_timeout (200,
-                                           (GSourceFunc) cups_request_printer_list,
-                                           cups_backend);
+      cups_backend->list_printers_poll = g_timeout_add (200, (GSourceFunc) cups_request_printer_list, 
cups_backend);
       g_source_set_name_by_id (cups_backend->list_printers_poll, "[gtk+] cups_request_printer_list");
     }
   else if (cups_backend->list_printers_attempts != -1)
@@ -3757,9 +3755,7 @@ cups_get_printer_list (GtkPrintBackend *backend)
     {
       if (cups_request_printer_list (cups_backend))
         {
-          cups_backend->list_printers_poll = gdk_threads_add_timeout (50,
-                                               (GSourceFunc) cups_request_printer_list,
-                                               backend);
+          cups_backend->list_printers_poll = g_timeout_add (50, (GSourceFunc) cups_request_printer_list, 
backend);
           g_source_set_name_by_id (cups_backend->list_printers_poll, "[gtk+] cups_request_printer_list");
         }
 
@@ -3898,9 +3894,7 @@ cups_request_ppd (GtkPrinter *printer)
               cups_printer->get_remote_ppd_attempts = -1;
               if (cups_printer->get_remote_ppd_poll > 0)
                 g_source_remove (cups_printer->get_remote_ppd_poll);
-              cups_printer->get_remote_ppd_poll = gdk_threads_add_timeout (200,
-                                                    (GSourceFunc) cups_request_ppd,
-                                                    printer);
+              cups_printer->get_remote_ppd_poll = g_timeout_add (200, (GSourceFunc) cups_request_ppd, 
printer);
               g_source_set_name_by_id (cups_printer->get_remote_ppd_poll, "[gtk+] cups_request_ppd");
             }
           else if (cups_printer->get_remote_ppd_attempts != -1)
@@ -4164,9 +4158,7 @@ cups_get_default_printer (GtkPrintBackendCups *backend)
     {
       if (cups_request_default_printer (cups_backend))
         {
-          cups_backend->default_printer_poll = gdk_threads_add_timeout (200,
-                                                 (GSourceFunc) cups_request_default_printer,
-                                                 backend);
+          cups_backend->default_printer_poll = g_timeout_add (200, (GSourceFunc) 
cups_request_default_printer, backend);
           g_source_set_name_by_id (cups_backend->default_printer_poll, "[gtk+] 
cups_request_default_printer");
         }
     }
@@ -4306,9 +4298,7 @@ cups_printer_request_details (GtkPrinter *printer)
 
               if (cups_request_ppd (printer))
                 {
-                  cups_printer->get_remote_ppd_poll = gdk_threads_add_timeout (50,
-                                                      (GSourceFunc) cups_request_ppd,
-                                                      printer);
+                  cups_printer->get_remote_ppd_poll = g_timeout_add (50, (GSourceFunc) cups_request_ppd, 
printer);
                   g_source_set_name_by_id (cups_printer->get_remote_ppd_poll, "[gtk+] cups_request_ppd");
                 }
             }
diff --git a/tests/testassistant.c b/tests/testassistant.c
index d033107..6b2ae17 100644
--- a/tests/testassistant.c
+++ b/tests/testassistant.c
@@ -136,7 +136,7 @@ prepare_callback (GtkWidget *widget, GtkWidget *page)
     {
       gtk_assistant_set_page_complete (GTK_ASSISTANT (widget), page, FALSE);
       gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (page), 0.0);
-      gdk_threads_add_timeout (300, (GSourceFunc) progress_timeout, widget);
+      g_timeout_add (300, (GSourceFunc) progress_timeout, widget);
     }
   else
     g_print ("prepare: %d\n", gtk_assistant_get_current_page (GTK_ASSISTANT (widget)));
diff --git a/tests/testcombo.c b/tests/testcombo.c
index a56c3b9..e60e361 100644
--- a/tests/testcombo.c
+++ b/tests/testcombo.c
@@ -1347,7 +1347,7 @@ main (int argc, char **argv)
         gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
 
 #if 1
-       gdk_threads_add_timeout (1000, (GSourceFunc) capital_animation, model);
+       g_timeout_add (1000, (GSourceFunc) capital_animation, model);
 #endif
 
         /* Aligned Food */
diff --git a/tests/testcombochange.c b/tests/testcombochange.c
index 78d69e7..6b13d8d 100644
--- a/tests/testcombochange.c
+++ b/tests/testcombochange.c
@@ -215,7 +215,7 @@ on_animate (void)
 {
   n_animations += 20;
  
-  timer = gdk_threads_add_timeout (1000, (GSourceFunc) animation_timer, NULL);
+  timer = g_timeout_add (1000, (GSourceFunc) animation_timer, NULL);
 }
 
 int
diff --git a/tests/testdnd.c b/tests/testdnd.c
index cda048f..165ca76 100644
--- a/tests/testdnd.c
+++ b/tests/testdnd.c
@@ -469,7 +469,7 @@ popup_leave    (GtkWidget          *widget,
       if (!popdown_timer)
        {
          g_print ("added popdown\n");
-         popdown_timer = gdk_threads_add_timeout (500, popdown_cb, NULL);
+         popdown_timer = g_timeout_add (500, popdown_cb, NULL);
        }
     }
 }
@@ -519,7 +519,7 @@ popup_cb (gpointer data)
       popped_up = TRUE;
     }
 
-  popdown_timer = gdk_threads_add_timeout (500, popdown_cb, NULL);
+  popdown_timer = g_timeout_add (500, popdown_cb, NULL);
   g_print ("added popdown\n");
 
   popup_timer = FALSE;
@@ -535,7 +535,7 @@ popsite_motion         (GtkWidget          *widget,
                    guint               time)
 {
   if (!popup_timer)
-    popup_timer = gdk_threads_add_timeout (500, popup_cb, NULL);
+    popup_timer = g_timeout_add (500, popup_cb, NULL);
 
   return TRUE;
 }
diff --git a/tests/testentrycompletion.c b/tests/testentrycompletion.c
index 8d30b70..09a2b4d 100644
--- a/tests/testentrycompletion.c
+++ b/tests/testentrycompletion.c
@@ -389,7 +389,7 @@ main (int argc, char *argv[])
   gtk_entry_completion_set_text_column (completion, 0);
 
   /* Fill the completion dynamically */
-  gdk_threads_add_timeout (1000, (GSourceFunc) animation_timer, completion);
+  g_timeout_add (1000, (GSourceFunc) animation_timer, completion);
 
   /* Fourth entry */
   gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Model-less entry completion"));
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 11d7294..65d9b2c 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -2884,9 +2884,7 @@ entry_toggle_progress (GtkWidget *checkbutton,
 {
   if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton)))
     {
-      guint timeout = gdk_threads_add_timeout (100,
-                                               entry_progress_timeout,
-                                               entry);
+      guint timeout = g_timeout_add (100, entry_progress_timeout, entry);
       g_object_set_data_full (G_OBJECT (entry), "timeout-id",
                               GUINT_TO_POINTER (timeout),
                               entry_remove_timeout);
diff --git a/tests/testtoolbar.c b/tests/testtoolbar.c
index 8fbad8e..c370e55 100644
--- a/tests/testtoolbar.c
+++ b/tests/testtoolbar.c
@@ -513,7 +513,7 @@ main (gint argc, gchar **argv)
   gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Custom label");
   add_item_to_list (store, item, "New");
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
-  gdk_threads_add_timeout (3000, (GSourceFunc) timeout_cb, item);
+  g_timeout_add (3000, (GSourceFunc) timeout_cb, item);
   gtk_tool_item_set_expand (item, TRUE);
 
   menu = gtk_menu_new ();
@@ -533,7 +533,7 @@ main (gint argc, gchar **argv)
   gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (item), menu);
   add_item_to_list (store, item, "Open");
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
-  gdk_threads_add_timeout (3000, (GSourceFunc) timeout_cb1, item);
+  g_timeout_add (3000, (GSourceFunc) timeout_cb1, item);
  
   menu = gtk_menu_new ();
   for (i = 0; i < 20; i++)
diff --git a/tests/testtreeflow.c b/tests/testtreeflow.c
index 60d6ff7..6a6e4cc 100644
--- a/tests/testtreeflow.c
+++ b/tests/testtreeflow.c
@@ -165,7 +165,7 @@ main (int argc, char *argv[])
   g_signal_connect (button, "realize", G_CALLBACK (gtk_widget_grab_focus), NULL);
   gtk_window_set_default_size (GTK_WINDOW (window), 300, 400);
   gtk_widget_show (window);
-  gdk_threads_add_timeout (1000, (GSourceFunc) futz, NULL);
+  g_timeout_add (1000, (GSourceFunc) futz, NULL);
   gtk_main ();
   return 0;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]