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
This commit is contained in:
Emmanuele Bassi 2018-02-02 15:51:47 +01:00
parent 334acbfc39
commit c655759cef
43 changed files with 148 additions and 185 deletions

View File

@ -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");
}

View File

@ -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

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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"));
}

View File

@ -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");
}

View File

@ -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);

View File

@ -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");
}
}

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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);
}

View File

@ -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");

View File

@ -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");
}

View File

@ -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;
}

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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)

View File

@ -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;

View File

@ -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;
}

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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");
}

View File

@ -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

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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");
}

View File

@ -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");

View File

@ -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");
}

View File

@ -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);
}

View File

@ -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

View File

@ -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");
}
}

View File

@ -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)));

View File

@ -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 */

View File

@ -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

View File

@ -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;
}

View File

@ -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"));

View File

@ -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);

View File

@ -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++)

View File

@ -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;
}