summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--demos/gtk-demo/images.c2
-rw-r--r--demos/gtk-demo/pixbufs.c2
-rw-r--r--demos/pixbuf-demo.c2
-rw-r--r--demos/testanimation.c2
-rw-r--r--demos/testpixbuf.c2
-rw-r--r--docs/tools/widgets.c2
-rw-r--r--examples/gtkdial/gtkdial.c4
-rw-r--r--examples/progressbar/progressbar.c2
-rw-r--r--gdk/directfb/gdkwindow-directfb.c4
-rw-r--r--gdk/gdk.h17
-rw-r--r--gdk/gdkwindow.c4
-rw-r--r--gdk/win32/gdkinput-win32.c2
-rw-r--r--gtk/gtkbutton.c6
-rw-r--r--gtk/gtkcalendar.c8
-rw-r--r--gtk/gtkcellrenderertext.c6
-rw-r--r--gtk/gtkclipboard.c4
-rw-r--r--gtk/gtkclist.c12
-rw-r--r--gtk/gtkcombo.c3
-rw-r--r--gtk/gtkcombobox.c24
-rw-r--r--gtk/gtkcontainer.c6
-rw-r--r--gtk/gtkdnd.c18
-rw-r--r--gtk/gtkentry.c30
-rw-r--r--gtk/gtkexpander.c8
-rw-r--r--gtk/gtkfilechooserdefault.c6
-rw-r--r--gtk/gtkfilesystemunix.c25
-rw-r--r--gtk/gtkfilesystemwin32.c31
-rw-r--r--gtk/gtkicontheme.c6
-rw-r--r--gtk/gtkiconview.c24
-rw-r--r--gtk/gtkimage.c8
-rw-r--r--gtk/gtklist.c12
-rw-r--r--gtk/gtkmenu.c22
-rw-r--r--gtk/gtkmenuitem.c6
-rw-r--r--gtk/gtknotebook.c26
-rw-r--r--gtk/gtkpathbar.c8
-rw-r--r--gtk/gtkprintoperation-unix.c3
-rw-r--r--gtk/gtkprintoperation-win32.c4
-rw-r--r--gtk/gtkprintoperation.c40
-rw-r--r--gtk/gtkprintunixdialog.c2
-rw-r--r--gtk/gtkrange.c13
-rw-r--r--gtk/gtkrecentchooserdefault.c12
-rw-r--r--gtk/gtkrecentchoosermenu.c6
-rw-r--r--gtk/gtkrecentmanager.c4
-rw-r--r--gtk/gtkselection.c19
-rw-r--r--gtk/gtkspinbutton.c10
-rwxr-xr-xgtk/gtkstatusicon.c2
-rw-r--r--gtk/gtktext.c6
-rw-r--r--gtk/gtktextview.c38
-rw-r--r--gtk/gtktoolbar.c5
-rw-r--r--gtk/gtktooltips.c8
-rw-r--r--gtk/gtktreeview.c77
-rw-r--r--gtk/gtkuimanager.c5
-rw-r--r--gtk/gtkwindow.c4
-rw-r--r--modules/printbackends/cups/gtkprintbackendcups.c7
-rw-r--r--perf/gtkwidgetprofiler.c2
-rw-r--r--tests/autotestfilechooser.c6
-rw-r--r--tests/autotestfilesystem.c2
-rw-r--r--tests/stresstest-toolbar.c2
-rw-r--r--tests/testassistant.c2
-rw-r--r--tests/testcombo.c2
-rw-r--r--tests/testcombochange.c2
-rw-r--r--tests/testdnd.c8
-rw-r--r--tests/testentrycompletion.c2
-rw-r--r--tests/testmenus.c2
-rw-r--r--tests/testmerge.c2
-rw-r--r--tests/testsocket_common.c2
-rwxr-xr-xtests/teststatusicon.c4
-rw-r--r--tests/testtext.c2
-rw-r--r--tests/testtoolbar.c4
-rw-r--r--tests/testtreeflow.c2
70 files changed, 197 insertions, 461 deletions
diff --git a/ChangeLog b/ChangeLog
index f7afb996ff..05cc5c5a8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2006-12-22 Matthias Clasen <mclasen@redhat.com>
+ * *.c: Replace a lot of idle and timeout calls by
+ the new gdk_threads api.
+
* gdk/gdk.symbols:
* gdk/gdk.h:
* gdk/gdk.c: Add functions to allow threadsafe handling
diff --git a/demos/gtk-demo/images.c b/demos/gtk-demo/images.c
index 7fc1fa7c14..ce22eb56aa 100644
--- a/demos/gtk-demo/images.c
+++ b/demos/gtk-demo/images.c
@@ -255,7 +255,7 @@ start_progressive_loading (GtkWidget *image)
* The timeout simply simulates a slow data source by inserting
* pauses in the reading process.
*/
- load_timeout = g_timeout_add (150,
+ load_timeout = gdk_threads_add_timeout (150,
progressive_timeout,
image);
}
diff --git a/demos/gtk-demo/pixbufs.c b/demos/gtk-demo/pixbufs.c
index 18dd1ff816..5fad5aa7f7 100644
--- a/demos/gtk-demo/pixbufs.c
+++ b/demos/gtk-demo/pixbufs.c
@@ -187,7 +187,9 @@ timeout (gpointer data)
: MAX (127, fabs (255 * cos (f * 2.0 * G_PI)))));
}
+ GDK_THREADS_ENTER ();
gtk_widget_queue_draw (da);
+ GDK_THREADS_LEAVE ();
frame_num++;
return TRUE;
diff --git a/demos/pixbuf-demo.c b/demos/pixbuf-demo.c
index eaacf83f59..dd6923bbcc 100644
--- a/demos/pixbuf-demo.c
+++ b/demos/pixbuf-demo.c
@@ -225,7 +225,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (window), da);
- timeout_id = g_timeout_add (FRAME_DELAY, timeout, NULL);
+ timeout_id = gdk_threads_add_timeout (FRAME_DELAY, timeout, NULL);
gtk_widget_show_all (window);
gtk_main ();
diff --git a/demos/testanimation.c b/demos/testanimation.c
index 5b2da4a228..029f69c9b7 100644
--- a/demos/testanimation.c
+++ b/demos/testanimation.c
@@ -301,7 +301,7 @@ start_progressive_loading (GtkWidget *image)
* The timeout simply simulates a slow data source by inserting
* pauses in the reading process.
*/
- lc->load_timeout = g_timeout_add (100,
+ lc->load_timeout = gdk_threads_add_timeout (100,
progressive_timeout,
image);
}
diff --git a/demos/testpixbuf.c b/demos/testpixbuf.c
index 676171bb43..84011004a9 100644
--- a/demos/testpixbuf.c
+++ b/demos/testpixbuf.c
@@ -628,7 +628,7 @@ main (int argc, char **argv)
status.readlen = readlen;
- status.timeout = g_timeout_add (100, update_timeout, &status);
+ status.timeout = gdk_threads_add_timeout (100, update_timeout, &status);
}
#endif
}
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
index 2675632b63..dc90b86cf0 100644
--- a/docs/tools/widgets.c
+++ b/docs/tools/widgets.c
@@ -90,7 +90,7 @@ static void
realize_callback (GtkWidget *widget,
WidgetInfo *info)
{
- g_timeout_add (500, (GSourceFunc)adjust_size_callback, info);
+ gdk_threads_add_timeout (500, (GSourceFunc)adjust_size_callback, info);
}
static WidgetInfo *
diff --git a/examples/gtkdial/gtkdial.c b/examples/gtkdial/gtkdial.c
index 5ea5962614..5749e92ad8 100644
--- a/examples/gtkdial/gtkdial.c
+++ b/examples/gtkdial/gtkdial.c
@@ -585,8 +585,8 @@ gtk_dial_update_mouse( GtkDial *dial, gint x, gint y )
if (dial->timer)
g_source_remove (dial->timer);
- dial->timer = g_timeout_add (SCROLL_DELAY_LENGTH,
- (GtkFunction) gtk_dial_timer,
+ dial->timer = gdk_threads_add_timeout (SCROLL_DELAY_LENGTH,
+ (GSourceFunc) gtk_dial_timer,
(gpointer) dial);
}
}
diff --git a/examples/progressbar/progressbar.c b/examples/progressbar/progressbar.c
index aefebab3b4..fb219d0b82 100644
--- a/examples/progressbar/progressbar.c
+++ b/examples/progressbar/progressbar.c
@@ -134,7 +134,7 @@ int main( int argc,
gtk_widget_show (pdata->pbar);
/* Add a timer callback to update the value of the progress bar */
- pdata->timer = g_timeout_add (100, progress_timeout, pdata);
+ pdata->timer = gdk_threads_add_timeout (100, progress_timeout, pdata);
separator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0);
diff --git a/gdk/directfb/gdkwindow-directfb.c b/gdk/directfb/gdkwindow-directfb.c
index ffa11e9838..0a683de033 100644
--- a/gdk/directfb/gdkwindow-directfb.c
+++ b/gdk/directfb/gdkwindow-directfb.c
@@ -100,9 +100,7 @@ gdk_window_directfb_process_all_updates (void)
static gboolean
gdk_window_update_idle (gpointer data)
{
- GDK_THREADS_ENTER ();
gdk_window_directfb_process_all_updates ();
- GDK_THREADS_LEAVE ();
return FALSE;
}
@@ -115,7 +113,7 @@ gdk_window_schedule_update (GdkWindow *window)
if (!update_idle)
{
- update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
+ update_idle = gdk_threads_add_idle (GDK_PRIORITY_REDRAW,
gdk_window_update_idle, NULL, NULL);
}
}
diff --git a/gdk/gdk.h b/gdk/gdk.h
index 861198d474..016b590540 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -209,6 +209,23 @@ guint gdk_threads_add_timeout (guint interval,
gpointer data);
+guint gdk_threads_add_idle_full (gint priority,
+ GSourceFunc function,
+ gpointer data,
+ GDestroyNotify notify);
+guint gdk_threads_add_idle (GSourceFunc function,
+ gpointer data);
+
+guint gdk_threads_add_timeout_full (gint priority,
+ guint interval,
+ GSourceFunc function,
+ gpointer data,
+ GDestroyNotify notify);
+guint gdk_threads_add_timeout (guint interval,
+ GSourceFunc function,
+ gpointer data);
+
+
#ifdef G_THREADS_ENABLED
# define GDK_THREADS_ENTER() G_STMT_START { \
if (gdk_threads_lock) \
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index e3201c45b2..66428f5478 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -2240,9 +2240,7 @@ static gboolean debug_updates = FALSE;
static gboolean
gdk_window_update_idle (gpointer data)
{
- GDK_THREADS_ENTER ();
gdk_window_process_all_updates ();
- GDK_THREADS_LEAVE ();
return FALSE;
}
@@ -2255,7 +2253,7 @@ gdk_window_schedule_update (GdkWindow *window)
if (!update_idle)
{
- update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
+ update_idle = gdk_threads_add_idle_full (GDK_PRIORITY_REDRAW,
gdk_window_update_idle, NULL, NULL);
}
}
diff --git a/gdk/win32/gdkinput-win32.c b/gdk/win32/gdkinput-win32.c
index c7bb9a3aa6..357037577d 100644
--- a/gdk/win32/gdkinput-win32.c
+++ b/gdk/win32/gdkinput-win32.c
@@ -690,7 +690,7 @@ set_ignore_core (gboolean ignore)
}
else
if (!ignore_core_timer)
- ignore_core_timer = g_timeout_add (PROXIMITY_OUT_DELAY,
+ ignore_core_timer = gdk_threads_add_timeout (PROXIMITY_OUT_DELAY,
ignore_core_timefunc, NULL);
}
#endif /* HAVE_WINTAB */
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 4c51a47d68..471d73887d 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -1490,12 +1490,8 @@ gtk_real_button_released (GtkButton *button)
static gboolean
button_activate_timeout (gpointer data)
{
- GDK_THREADS_ENTER ();
-
gtk_button_finish_activate (data, TRUE);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -1520,7 +1516,7 @@ gtk_real_button_activate (GtkButton *button)
gtk_grab_add (widget);
- button->activate_timeout = g_timeout_add (ACTIVATE_TIMEOUT,
+ button->activate_timeout = gdk_threads_add_timeout (ACTIVATE_TIMEOUT,
button_activate_timeout,
button);
button->button_down = TRUE;
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index ca862424f4..5e9f6cada8 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -2374,8 +2374,6 @@ calendar_timer (gpointer data)
GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (calendar);
gboolean retval = FALSE;
- GDK_THREADS_ENTER ();
-
if (priv->timer)
{
calendar_arrow_action (calendar, priv->click_child);
@@ -2389,7 +2387,7 @@ calendar_timer (gpointer data)
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
priv->need_timer = FALSE;
- priv->timer = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
+ priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
timeout * SCROLL_DELAY_FACTOR,
(GSourceFunc) calendar_timer,
(gpointer) calendar, NULL);
@@ -2398,8 +2396,6 @@ calendar_timer (gpointer data)
retval = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
@@ -2420,7 +2416,7 @@ calendar_start_spinning (GtkCalendar *calendar,
g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
priv->need_timer = TRUE;
- priv->timer = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
+ priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
timeout,
(GSourceFunc) calendar_timer,
(gpointer) calendar, NULL);
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index 70b6f732ee..0b8de55d24 100644
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@ -1741,8 +1741,6 @@ popdown_timeout (gpointer data)
{
GtkCellRendererTextPrivate *priv;
- GDK_THREADS_ENTER ();
-
priv = GTK_CELL_RENDERER_TEXT_GET_PRIVATE (data);
priv->entry_menu_popdown_timeout = 0;
@@ -1750,8 +1748,6 @@ popdown_timeout (gpointer data)
if (!GTK_WIDGET_HAS_FOCUS (priv->entry))
gtk_cell_renderer_text_editing_done (GTK_CELL_EDITABLE (priv->entry), data);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -1768,7 +1764,7 @@ gtk_cell_renderer_text_popup_unmap (GtkMenu *menu,
if (priv->entry_menu_popdown_timeout)
return;
- priv->entry_menu_popdown_timeout = g_timeout_add (500, popdown_timeout,
+ priv->entry_menu_popdown_timeout = gdk_threads_add_timeout (500, popdown_timeout,
data);
}
diff --git a/gtk/gtkclipboard.c b/gtk/gtkclipboard.c
index 96ebea5bce..a2f0fcb765 100644
--- a/gtk/gtkclipboard.c
+++ b/gtk/gtkclipboard.c
@@ -1862,6 +1862,8 @@ gtk_clipboard_store (GtkClipboard *clipboard)
if (!gdk_display_supports_clipboard_persistence (clipboard->display))
return;
+ g_object_ref (clipboard);
+
clipboard_widget = get_clipboard_widget (clipboard->display);
clipboard->notify_signal_id = g_signal_connect (clipboard_widget, "selection_notify_event",
G_CALLBACK (gtk_clipboard_selection_notify), clipboard);
@@ -1893,6 +1895,8 @@ gtk_clipboard_store (GtkClipboard *clipboard)
clipboard->notify_signal_id = 0;
clipboard->storing_selection = FALSE;
+
+ g_object_unref (clipboard);
}
/* Stores all clipboard selections on all displays, called from
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 22129cd3b7..652c2e9ff9 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -5264,7 +5264,7 @@ gtk_clist_motion (GtkWidget *widget,
if (clist->htimer)
return FALSE;
- clist->htimer = g_timeout_add
+ clist->htimer = gdk_threads_add_timeout
(SCROLL_TIME, (GSourceFunc) horizontal_timeout, clist);
if (!((x < 0 && clist->hadjustment->value == 0) ||
@@ -5296,7 +5296,7 @@ gtk_clist_motion (GtkWidget *widget,
if (clist->vtimer)
return FALSE;
- clist->vtimer = g_timeout_add (SCROLL_TIME,
+ clist->vtimer = gdk_threads_add_timeout (SCROLL_TIME,
(GSourceFunc) vertical_timeout, clist);
if (clist->drag_button &&
@@ -7039,26 +7039,18 @@ do_fake_motion (GtkWidget *widget)
static gint
horizontal_timeout (GtkCList *clist)
{
- GDK_THREADS_ENTER ();
-
clist->htimer = 0;
do_fake_motion (GTK_WIDGET (clist));
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
static gint
vertical_timeout (GtkCList *clist)
{
- GDK_THREADS_ENTER ();
-
clist->vtimer = 0;
do_fake_motion (GTK_WIDGET (clist));
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c
index 5dd45e470c..10d10b2991 100644
--- a/gtk/gtkcombo.c
+++ b/gtk/gtkcombo.c
@@ -69,7 +69,7 @@ static void gtk_combo_unrealize (GtkWidget *widget);
static void gtk_combo_destroy (GtkObject *combo);
static GtkListItem *gtk_combo_find (GtkCombo *combo);
static gchar * gtk_combo_func (GtkListItem *li);
-static gint gtk_combo_focus_idle (GtkCombo *combo);
+static gboolean gtk_combo_focus_idle (GtkCombo *combo);
static gint gtk_combo_entry_focus_out (GtkEntry *entry,
GdkEventFocus *event,
GtkCombo *combo);
@@ -411,6 +411,7 @@ gtk_combo_entry_focus_out (GtkEntry * entry, GdkEventFocus * event, GtkCombo * c
g_cclosure_new_object (G_CALLBACK (gtk_combo_focus_idle),
G_OBJECT (combo)));
g_source_attach (focus_idle, NULL);
+ g_source_unref (focus_idle);
/*g_signal_stop_emission_by_name (entry, "focus_out_event"); */
return TRUE;
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 900b931b45..dfa61facdb 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -3032,8 +3032,6 @@ list_popup_resize_idle (gpointer user_data)
GtkComboBox *combo_box;
gint x, y, width, height;
- GDK_THREADS_ENTER ();
-
combo_box = GTK_COMBO_BOX (user_data);
if (combo_box->priv->tree_view &&
@@ -3047,8 +3045,6 @@ list_popup_resize_idle (gpointer user_data)
combo_box->priv->resize_idle_id = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -3057,7 +3053,7 @@ gtk_combo_box_list_popup_resize (GtkComboBox *combo_box)
{
if (!combo_box->priv->resize_idle_id)
combo_box->priv->resize_idle_id =
- g_idle_add (list_popup_resize_idle, combo_box);
+ gdk_threads_add_idle (list_popup_resize_idle, combo_box);
}
static void
@@ -3582,7 +3578,7 @@ gtk_combo_box_list_button_pressed (GtkWidget *widget,
combo_box->priv->auto_scroll = FALSE;
if (combo_box->priv->scroll_timer == 0)
- combo_box->priv->scroll_timer = g_timeout_add (SCROLL_TIME,
+ combo_box->priv->scroll_timer = gdk_threads_add_timeout (SCROLL_TIME,
(GSourceFunc) gtk_combo_box_list_scroll_timeout,
combo_box);
@@ -3776,8 +3772,6 @@ gtk_combo_box_list_scroll_timeout (GtkComboBox *combo_box)
{
gint x, y;
- GDK_THREADS_ENTER ();
-
if (combo_box->priv->auto_scroll)
{
gdk_window_get_pointer (combo_box->priv->tree_view->window,
@@ -3785,8 +3779,6 @@ gtk_combo_box_list_scroll_timeout (GtkComboBox *combo_box)
gtk_combo_box_list_auto_scroll (combo_box, x, y);
}
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
@@ -5175,8 +5167,6 @@ popdown_idle (gpointer data)
{
GtkComboBox *combo_box;
- GDK_THREADS_ENTER ();
-
combo_box = GTK_COMBO_BOX (data);
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (combo_box));
@@ -5184,8 +5174,6 @@ popdown_idle (gpointer data)
g_object_unref (combo_box);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -5193,7 +5181,7 @@ static void
popdown_handler (GtkWidget *widget,
gpointer data)
{
- g_idle_add (popdown_idle, g_object_ref (data));
+ gdk_threads_add_idle (popdown_idle, g_object_ref (data));
}
static gboolean
@@ -5201,8 +5189,6 @@ popup_idle (gpointer data)
{
GtkComboBox *combo_box;
- GDK_THREADS_ENTER ();
-
combo_box = GTK_COMBO_BOX (data);
if (GTK_IS_MENU (combo_box->priv->popup_widget) &&
@@ -5217,8 +5203,6 @@ popup_idle (gpointer data)
combo_box->priv->popup_idle_id = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -5253,7 +5237,7 @@ gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
*/
if (combo_box->priv->is_cell_renderer &&
combo_box->priv->cell_view && !combo_box->priv->tree_view)
- combo_box->priv->popup_idle_id = g_idle_add (popup_idle, combo_box);
+ combo_box->priv->popup_idle_id = gdk_threads_add_idle (popup_idle, combo_box);
}
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 1d9181626f..b7ced4e359 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1088,8 +1088,6 @@ gtk_container_get_resize_container (GtkContainer *container)
static gboolean
gtk_container_idle_sizer (gpointer data)
{
- GDK_THREADS_ENTER ();
-
/* we may be invoked with a container_resize_queue of NULL, because
* queue_resize could have been adding an extra idle function while
* the queue still got processed. we better just ignore such case
@@ -1112,8 +1110,6 @@ gtk_container_idle_sizer (gpointer data)
gdk_window_process_all_updates ();
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -1151,7 +1147,7 @@ _gtk_container_queue_resize (GtkContainer *container)
{
GTK_PRIVATE_SET_FLAG (resize_container, GTK_RESIZE_PENDING);
if (container_resize_queue == NULL)
- g_idle_add_full (GTK_PRIORITY_RESIZE,
+ gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE,
gtk_container_idle_sizer,
NULL, NULL);
container_resize_queue = g_slist_prepend (container_resize_queue, resize_container);
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index a3559137e0..939f5f2cde 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -3453,7 +3453,7 @@ gtk_drag_drop_finished (GtkDragSourceInfo *info,
* to respond really late, we still are OK.
*/
gtk_drag_clear_source_info (info->context);
- g_timeout_add (ANIM_STEP_TIME, gtk_drag_anim_timeout, anim);
+ gdk_threads_add_timeout (ANIM_STEP_TIME, gtk_drag_anim_timeout, anim);
}
}
}
@@ -3531,7 +3531,7 @@ gtk_drag_drop (GtkDragSourceInfo *info,
gtk_widget_hide (info->icon_window);
gdk_drag_drop (info->context, time);
- info->drop_timeout = g_timeout_add (DROP_ABORT_TIME,
+ info->drop_timeout = gdk_threads_add_timeout (DROP_ABORT_TIME,
gtk_drag_abort_timeout,
info);
}
@@ -3680,8 +3680,6 @@ gtk_drag_anim_timeout (gpointer data)
gint x, y;
gboolean retval;
- GDK_THREADS_ENTER ();
-
if (anim->step == anim->n_steps)
{
gtk_drag_source_info_destroy (anim->info);
@@ -3711,8 +3709,6 @@ gtk_drag_anim_timeout (gpointer data)
retval = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
@@ -3812,8 +3808,6 @@ gtk_drag_update_idle (gpointer data)
GdkDragAction possible_actions;
guint32 time;
- GDK_THREADS_ENTER ();
-
info->update_idle = 0;
if (info->last_event)
@@ -3847,8 +3841,6 @@ gtk_drag_update_idle (gpointer data)
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -3859,7 +3851,7 @@ gtk_drag_add_update_idle (GtkDragSourceInfo *info)
* from the last move can catch up before we move again.
*/
if (!info->update_idle)
- info->update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW + 5,
+ info->update_idle = gdk_threads_add_idle_full (GDK_PRIORITY_REDRAW + 5,
gtk_drag_update_idle,
info,
NULL);
@@ -4185,16 +4177,12 @@ gtk_drag_abort_timeout (gpointer data)
GtkDragSourceInfo *info = data;
guint32 time = GDK_CURRENT_TIME;
- GDK_THREADS_ENTER ();
-
if (info->proxy_dest)
time = info->proxy_dest->proxy_drop_time;
info->drop_timeout = 0;
gtk_drag_drop_finished (info, FALSE, time);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 2656a316c4..011ee01ba1 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3072,8 +3072,6 @@ recompute_idle_func (gpointer data)
{
GtkEntry *entry;
- GDK_THREADS_ENTER ();
-
entry = GTK_ENTRY (data);
entry->recompute_idle = 0;
@@ -3086,8 +3084,6 @@ recompute_idle_func (gpointer data)
update_im_cursor_location (entry);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -3099,7 +3095,7 @@ gtk_entry_recompute (GtkEntry *entry)
if (!entry->recompute_idle)
{
- entry->recompute_idle = g_idle_add_full (G_PRIORITY_HIGH_IDLE + 15, /* between resize and redraw */
+ entry->recompute_idle = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 15, /* between resize and redraw */
recompute_idle_func, entry, NULL);
}
}
@@ -3126,13 +3122,9 @@ append_char (GString *str,
static gboolean
gtk_entry_remove_password_hint (gpointer data)
{
- GDK_THREADS_ENTER();
-
/* Force the string to be redrawn, but now without a visible character */
gtk_entry_recompute (GTK_ENTRY (data));
- GDK_THREADS_LEAVE();
-
return FALSE;
}
@@ -3299,7 +3291,7 @@ gtk_entry_create_layout (GtkEntry *entry,
password_hint->password_hint_length = 0;
password_hint->password_hint_timeout_id =
- g_timeout_add (password_hint_timeout,
+ gdk_threads_add_timeout (password_hint_timeout,
(GSourceFunc) gtk_entry_remove_password_hint,
entry);
}
@@ -5325,8 +5317,6 @@ blink_cb (gpointer data)
GtkEntryPrivate *priv;
gint blink_timeout;
- GDK_THREADS_ENTER ();
-
entry = GTK_ENTRY (data);
priv = GTK_ENTRY_GET_PRIVATE (entry);
@@ -5351,7 +5341,7 @@ blink_cb (gpointer data)
else if (entry->cursor_visible)
{
hide_cursor (entry);
- entry->blink_timeout = g_timeout_add (get_cursor_time (entry) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
+ entry->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
entry);
}
@@ -5359,13 +5349,11 @@ blink_cb (gpointer data)
{
show_cursor (entry);
priv->blink_time += get_cursor_time (entry);
- entry->blink_timeout = g_timeout_add (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
+ entry->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
entry);
}
- GDK_THREADS_LEAVE ();
-
/* Remove ourselves */
return FALSE;
}
@@ -5382,7 +5370,7 @@ gtk_entry_check_cursor_blink (GtkEntry *entry)
if (!entry->blink_timeout)
{
show_cursor (entry);
- entry->blink_timeout = g_timeout_add (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
+ entry->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
entry);
}
@@ -5408,7 +5396,7 @@ gtk_entry_pend_cursor_blink (GtkEntry *entry)
if (entry->blink_timeout != 0)
g_source_remove (entry->blink_timeout);
- entry->blink_timeout = g_timeout_add (get_cursor_time (entry) * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
+ entry->blink_timeout = gdk_threads_add_timeout (get_cursor_time (entry) * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
entry);
show_cursor (entry);
@@ -5432,8 +5420,6 @@ gtk_entry_completion_timeout (gpointer data)
{
GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (data);
- GDK_THREADS_ENTER ();
-
completion->priv->completion_timeout = 0;
if (completion->priv->filter_model &&
@@ -5470,8 +5456,6 @@ gtk_entry_completion_timeout (gpointer data)
else if (GTK_WIDGET_VISIBLE (completion->priv->popup_window))
_gtk_entry_completion_popdown (completion);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -5698,7 +5682,7 @@ gtk_entry_completion_changed (GtkWidget *entry,
}
completion->priv->completion_timeout =
- g_timeout_add (COMPLETION_TIMEOUT,
+ gdk_threads_add_timeout (COMPLETION_TIMEOUT,
gtk_entry_completion_timeout,
completion);
}
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index 33333d5f12..e078da7e8b 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -1004,7 +1004,7 @@ gtk_expander_drag_motion (GtkWidget *widget,
settings = gtk_widget_get_settings (widget);
g_object_get (settings, "gtk-timeout-expand", &timeout, NULL);
- priv->expand_timer = g_timeout_add (timeout, (GSourceFunc) expand_timeout, expander);
+ priv->expand_timer = gdk_threads_add_timeout (timeout, (GSourceFunc) expand_timeout, expander);
}
return TRUE;
@@ -1276,8 +1276,6 @@ gtk_expander_animation_timeout (GtkExpander *expander)
GdkRectangle area;
gboolean finish = FALSE;
- GDK_THREADS_ENTER();
-
if (GTK_WIDGET_REALIZED (expander))
{
get_expander_bounds (expander, &area);
@@ -1317,8 +1315,6 @@ gtk_expander_animation_timeout (GtkExpander *expander)
gtk_widget_queue_resize (GTK_WIDGET (expander));
}
- GDK_THREADS_LEAVE();
-
return !finish;
}
@@ -1331,7 +1327,7 @@ gtk_expander_start_animation (GtkExpander *expander)
g_source_remove (priv->animation_timeout);
priv->animation_timeout =
- g_timeout_add (50,
+ gdk_threads_add_timeout (50,
(GSourceFunc) gtk_expander_animation_timeout,
expander);
}
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index d1ca6306a8..d2abc315e2 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -5709,8 +5709,6 @@ load_timeout_cb (gpointer data)
profile_start ("start", NULL);
- GDK_THREADS_ENTER ();
-
impl = GTK_FILE_CHOOSER_DEFAULT (data);
g_assert (impl->load_state == LOAD_PRELOAD);
g_assert (impl->load_timeout_id != 0);
@@ -5721,8 +5719,6 @@ load_timeout_cb (gpointer data)
load_set_model (impl);
- GDK_THREADS_LEAVE ();
-
profile_end ("end", NULL);
return FALSE;
@@ -5735,7 +5731,7 @@ load_setup_timer (GtkFileChooserDefault *impl)
g_assert (impl->load_timeout_id == 0);
g_assert (impl->load_state != LOAD_PRELOAD);
- impl->load_timeout_id = g_timeout_add (MAX_LOADING_TIME, load_timeout_cb, impl);
+ impl->load_timeout_id = gdk_threads_add_timeout (MAX_LOADING_TIME, load_timeout_cb, impl);
impl->load_state = LOAD_PRELOAD;
}
diff --git a/gtk/gtkfilesystemunix.c b/gtk/gtkfilesystemunix.c
index 2496c56f1a..43ebe05550 100644
--- a/gtk/gtkfilesystemunix.c
+++ b/gtk/gtkfilesystemunix.c
@@ -254,8 +254,7 @@ static GtkFileInfo *create_file_info (GtkFileFolderUnix *folder_uni
struct stat *statbuf,
const char *mime_type);
-static gboolean execute_callbacks_idle (gpointer data);
-static void execute_callbacks (gpointer data);
+static gboolean execute_callbacks (gpointer data);
static gboolean fill_in_names (GtkFileFolderUnix *folder_unix,
GError **error);
@@ -700,7 +699,7 @@ struct callback_info
-static void
+static gboolean
execute_callbacks (gpointer data)
{
GSList *l;
@@ -747,18 +746,6 @@ execute_callbacks (gpointer data)
system_unix->execute_callbacks_idle_id = 0;
}
-static gboolean
-execute_callbacks_idle (gpointer data)
-{
- GDK_THREADS_ENTER ();
-
- execute_callbacks(data);
-
- GDK_THREADS_LEAVE ();
-
- return FALSE;
-}
-
static void
queue_callback (GtkFileSystemUnix *system_unix,
enum callback_types type,
@@ -791,7 +778,7 @@ queue_callback (GtkFileSystemUnix *system_unix,
system_unix->callbacks = g_slist_append (system_unix->callbacks, info);
if (!system_unix->execute_callbacks_idle_id)
- system_unix->execute_callbacks_idle_id = g_idle_add (execute_callbacks_idle, system_unix);
+ system_unix->execute_callbacks_idle_id = gdk_threads_add_idle (execute_callbacks, system_unix);
}
static GtkFileSystemHandle *
@@ -865,8 +852,6 @@ load_folder (gpointer data)
GtkFileFolderUnix *folder_unix = data;
GSList *children;
- GDK_THREADS_ENTER ();
-
if ((folder_unix->types & STAT_NEEDED_MASK) != 0)
fill_in_stats (folder_unix);
@@ -884,8 +869,6 @@ load_folder (gpointer data)
g_signal_emit_by_name (folder_unix, "finished-loading", 0);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -1020,7 +1003,7 @@ gtk_file_system_unix_get_folder (GtkFileSystem *file_system,
/* Start loading the folder contents in an idle */
if (!folder_unix->load_folder_id)
folder_unix->load_folder_id =
- g_idle_add ((GSourceFunc) load_folder, folder_unix);
+ gdk_threads_add_idle ((GSourceFunc) load_folder, folder_unix);
return handle;
}
diff --git a/gtk/gtkfilesystemwin32.c b/gtk/gtkfilesystemwin32.c
index 167f56c9bd..3128406a98 100644
--- a/gtk/gtkfilesystemwin32.c
+++ b/gtk/gtkfilesystemwin32.c
@@ -239,8 +239,7 @@ static GtkFileInfo *create_file_info (GtkFileFolderWin32 *folder_wi
WIN32_FILE_ATTRIBUTE_DATA *wfad,
const char *mime_type);
-static gboolean execute_callbacks_idle (gpointer data);
-static void execute_callbacks (gpointer data);
+static gboolean execute_callbacks (gpointer data);
static gboolean fill_in_names (GtkFileFolderWin32 *folder_win32,
GError **error);
@@ -336,7 +335,9 @@ check_volumes (gpointer data)
g_return_val_if_fail (system_win32, FALSE);
if (system_win32->drives != GetLogicalDrives())
- g_signal_emit_by_name (system_win32, "volumes-changed", 0);
+ {
+ g_signal_emit_by_name (system_win32, "volumes-changed", 0);
+ }
return TRUE;
}
@@ -370,7 +371,7 @@ gtk_file_system_win32_init (GtkFileSystemWin32 *system_win32)
/* Set up an idle handler for volume changes. Once a second should
* be enough.
*/
- system_win32->timeout = g_timeout_add_full (0, 1000, check_volumes, system_win32, NULL);
+ system_win32->timeout = gdk_threads_add_timeout_full (0, 1000, check_volumes, system_win32, NULL);
system_win32->handles = g_hash_table_new (g_direct_hash, g_direct_equal);
@@ -809,7 +810,7 @@ struct callback_info
-static void
+static gboolean
execute_callbacks (gpointer data)
{
GSList *l;
@@ -854,18 +855,8 @@ execute_callbacks (gpointer data)
g_object_unref (system_win32);
system_win32->execute_callbacks_idle_id = 0;
-}
-static gboolean
-execute_callbacks_idle (gpointer data)
-{
- GDK_THREADS_ENTER ();
-
- execute_callbacks(data);
-
- GDK_THREADS_LEAVE ();
-
- return FALSE;
+ return FALSE:
}
static void
@@ -900,7 +891,7 @@ queue_callback (GtkFileSystemWin32 *system_win32,
system_win32->callbacks = g_slist_append (system_win32->callbacks, info);
if (!system_win32->execute_callbacks_idle_id)
- system_win32->execute_callbacks_idle_id = g_idle_add (execute_callbacks_idle, system_win32);
+ system_win32->execute_callbacks_idle_id = gdk_threads_add_idle (execute_callbacks, system_win32);
}
static GtkFileSystemHandle *
@@ -1007,8 +998,6 @@ load_folder (gpointer data)
GtkFileFolderWin32 *folder_win32 = data;
GSList *children;
- GDK_THREADS_ENTER ();
-
if ((folder_win32->types & STAT_NEEDED_MASK) != 0)
fill_in_stats (folder_win32);
@@ -1026,8 +1015,6 @@ load_folder (gpointer data)
g_signal_emit_by_name (folder_win32, "finished-loading", 0);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -1136,7 +1123,7 @@ gtk_file_system_win32_get_folder (GtkFileSystem *file_system,
/* Start loading the folder contents in an idle */
if (!folder_win32->load_folder_id)
folder_win32->load_folder_id =
- g_idle_add ((GSourceFunc) load_folder, folder_win32);
+ gdk_threads_add_idle ((GSourceFunc) load_folder, folder_win32);
return handle;
}
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index f04fa73a8f..e986b40061 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -591,8 +591,6 @@ reset_styles_idle (gpointer user_data)
GtkIconTheme *icon_theme;
GtkIconThemePrivate *priv;
- GDK_THREADS_ENTER ();
-
icon_theme = GTK_ICON_THEME (user_data);
priv = icon_theme->priv;
@@ -604,8 +602,6 @@ reset_styles_idle (gpointer user_data)
priv->reset_styles_idle = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -621,7 +617,7 @@ do_theme_change (GtkIconTheme *icon_theme)
if (!priv->reset_styles_idle)
priv->reset_styles_idle =
- g_idle_add_full (GTK_PRIORITY_RESIZE - 2,
+ gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE - 2,
reset_styles_idle, icon_theme, NULL);
}
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index f3f55c6c0b..45280f63c4 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1461,8 +1461,6 @@ rubberband_scroll_timeout (gpointer data)
GtkIconView *icon_view;
gdouble value;
- GDK_THREADS_ENTER ();
-
icon_view = data;
value = MIN (icon_view->priv->vadjustment->value +
@@ -1474,8 +1472,6 @@ rubberband_scroll_timeout (gpointer data)
gtk_icon_view_update_rubberband (icon_view);
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
@@ -1510,7 +1506,7 @@ gtk_icon_view_motion (GtkWidget *widget,
icon_view->priv->event_last_y = event->y;
if (icon_view->priv->scroll_timeout_id == 0)
- icon_view->priv->scroll_timeout_id = g_timeout_add (30, rubberband_scroll_timeout,
+ icon_view->priv->scroll_timeout_id = gdk_threads_add_timeout (30, rubberband_scroll_timeout,
icon_view);
}
else
@@ -3067,16 +3063,12 @@ layout_callback (gpointer user_data)
{
GtkIconView *icon_view;
- GDK_THREADS_ENTER ();
-
icon_view = GTK_ICON_VIEW (user_data);
icon_view->priv->layout_idle_id = 0;
gtk_icon_view_layout (icon_view);
- GDK_THREADS_LEAVE();
-
return FALSE;
}
@@ -3086,7 +3078,7 @@ gtk_icon_view_queue_layout (GtkIconView *icon_view)
if (icon_view->priv->layout_idle_id != 0)
return;
- icon_view->priv->layout_idle_id = g_idle_add (layout_callback, icon_view);
+ icon_view->priv->layout_idle_id = gdk_threads_add_idle (layout_callback, icon_view);
}
static void
@@ -5868,12 +5860,8 @@ drag_scroll_timeout (gpointer data)
{
GtkIconView *icon_view = GTK_ICON_VIEW (data);
- GDK_THREADS_ENTER ();
-
gtk_icon_view_autoscroll (icon_view);
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
@@ -6270,7 +6258,7 @@ gtk_icon_view_drag_motion (GtkWidget *widget,
if (icon_view->priv->scroll_timeout_id == 0)
{
icon_view->priv->scroll_timeout_id =
- g_timeout_add (50, drag_scroll_timeout, icon_view);
+ gdk_threads_add_timeout (50, drag_scroll_timeout, icon_view);
}
if (target == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
@@ -6911,8 +6899,6 @@ gtk_icon_view_item_accessible_idle_do_action (gpointer data)
GtkIconView *icon_view;
GtkTreePath *path;
- GDK_THREADS_ENTER ();
-
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (data);
item->action_idle_handler = 0;
@@ -6924,8 +6910,6 @@ gtk_icon_view_item_accessible_idle_do_action (gpointer data)
gtk_tree_path_free (path);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -6950,7 +6934,7 @@ gtk_icon_view_item_accessible_action_do_action (AtkAction *action,
{
case ACTION_ACTIVATE:
if (!item->action_idle_handler)
- item->action_idle_handler = g_idle_add (gtk_icon_view_item_accessible_idle_do_action, item);
+ item->action_idle_handler = gdk_threads_add_idle (gtk_icon_view_item_accessible_idle_do_action, item);
break;
default:
g_assert_not_reached ();
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 6e5509e9af..b20f34cdcc 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -1356,8 +1356,6 @@ animation_timeout (gpointer data)
{
GtkImage *image;
- GDK_THREADS_ENTER ();
-
image = GTK_IMAGE (data);
image->data.anim.frame_timeout = 0;
@@ -1366,7 +1364,7 @@ animation_timeout (gpointer data)
if (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter) >= 0)
image->data.anim.frame_timeout =
- g_timeout_add (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter),
+ gdk_threads_add_timeout (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter),
animation_timeout,
image);
@@ -1375,8 +1373,6 @@ animation_timeout (gpointer data)
if (GTK_WIDGET_DRAWABLE (image))
gdk_window_process_updates (GTK_WIDGET (image)->window, TRUE);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -1677,7 +1673,7 @@ gtk_image_expose (GtkWidget *widget,
if (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter) >= 0)
image->data.anim.frame_timeout =
- g_timeout_add (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter),
+ gdk_threads_add_timeout (gdk_pixbuf_animation_iter_get_delay_time (image->data.anim.iter),
animation_timeout,
image);
}
diff --git a/gtk/gtklist.c b/gtk/gtklist.c
index 4c97eeb142..c53c378da0 100644
--- a/gtk/gtklist.c
+++ b/gtk/gtklist.c
@@ -557,7 +557,7 @@ gtk_list_motion_notify (GtkWidget *widget,
{
if (list->htimer == 0)
{
- list->htimer = g_timeout_add
+ list->htimer = gdk_threads_add_timeout
(SCROLL_TIME, (GSourceFunc) gtk_list_horizontal_timeout, widget);
if (!((x < adj->value && adj->value <= 0) ||
@@ -605,7 +605,7 @@ gtk_list_motion_notify (GtkWidget *widget,
if (!((y < 0 && focus_row == 0) ||
(y > widget->allocation.height && focus_row >= length - 1)))
- list->vtimer = g_timeout_add (SCROLL_TIME,
+ list->vtimer = gdk_threads_add_timeout (SCROLL_TIME,
(GSourceFunc) gtk_list_vertical_timeout,
list);
@@ -2338,26 +2338,18 @@ do_fake_motion (GtkWidget *list)
static gint
gtk_list_horizontal_timeout (GtkWidget *list)
{
- GDK_THREADS_ENTER ();
-
GTK_LIST (list)->htimer = 0;
do_fake_motion (list);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
static gint
gtk_list_vertical_timeout (GtkWidget *list)
{
- GDK_THREADS_ENTER ();
-
GTK_LIST (list)->vtimer = 0;
do_fake_motion (list);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 7460061231..70f9f9b4ed 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -3022,8 +3022,6 @@ gtk_menu_scroll_timeout (gpointer data)
GtkSettings *settings;
gboolean touchscreen_mode;
- GDK_THREADS_ENTER ();
-
menu = GTK_MENU (data);
settings = gtk_widget_get_settings (GTK_WIDGET (menu));
@@ -3033,8 +3031,6 @@ gtk_menu_scroll_timeout (gpointer data)
gtk_menu_do_timeout_scroll (menu, touchscreen_mode);
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
@@ -3046,8 +3042,6 @@ gtk_menu_scroll_timeout_initial (gpointer data)
guint timeout;
gboolean touchscreen_mode;
- GDK_THREADS_ENTER ();
-
menu = GTK_MENU (data);
settings = gtk_widget_get_settings (GTK_WIDGET (menu));
@@ -3060,9 +3054,7 @@ gtk_menu_scroll_timeout_initial (gpointer data)
gtk_menu_remove_scroll_timeout (menu);
- menu->timeout_id = g_timeout_add (timeout, gtk_menu_scroll_timeout, menu);
-
- GDK_THREADS_LEAVE ();
+ menu->timeout_id = gdk_threads_add_timeout (timeout, gtk_menu_scroll_timeout, menu);
return FALSE;
}
@@ -3082,7 +3074,7 @@ gtk_menu_start_scrolling (GtkMenu *menu)
gtk_menu_do_timeout_scroll (menu, touchscreen_mode);
- menu->timeout_id = g_timeout_add (timeout, gtk_menu_scroll_timeout_initial,
+ menu->timeout_id = gdk_threads_add_timeout (timeout, gtk_menu_scroll_timeout_initial,
menu);
}
@@ -3228,7 +3220,7 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
-MENU_SCROLL_STEP2 : -MENU_SCROLL_STEP1;
menu->timeout_id =
- g_timeout_add (scroll_fast ?
+ gdk_threads_add_timeout (scroll_fast ?
MENU_SCROLL_TIMEOUT2 : MENU_SCROLL_TIMEOUT1,
gtk_menu_scroll_timeout, menu);
}
@@ -3322,7 +3314,7 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
MENU_SCROLL_STEP2 : MENU_SCROLL_STEP1;
menu->timeout_id =
- g_timeout_add (scroll_fast ?
+ gdk_threads_add_timeout (scroll_fast ?
MENU_SCROLL_TIMEOUT2 : MENU_SCROLL_TIMEOUT1,
gtk_menu_scroll_timeout, menu);
}
@@ -3485,8 +3477,6 @@ gtk_menu_stop_navigating_submenu_cb (gpointer user_data)
GtkMenu *menu = user_data;
GdkWindow *child_window;
- GDK_THREADS_ENTER ();
-
gtk_menu_stop_navigating_submenu (menu);
if (GTK_WIDGET_REALIZED (menu))
@@ -3507,8 +3497,6 @@ gtk_menu_stop_navigating_submenu_cb (gpointer user_data)
}
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -3682,7 +3670,7 @@ gtk_menu_set_submenu_navigation_region (GtkMenu *menu,
"gtk-menu-popdown-delay", &popdown_delay,
NULL);
- menu->navigation_timeout = g_timeout_add (popdown_delay,
+ menu->navigation_timeout = gdk_threads_add_timeout (popdown_delay,
gtk_menu_stop_navigating_submenu_cb, menu);
#ifdef DRAW_STAY_UP_TRIANGLE
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index ae87c05304..35e5bff58a 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -902,7 +902,7 @@ gtk_real_menu_item_select (GtkItem *item)
{
GdkEvent *event = gtk_get_current_event ();
- menu_item->timer = g_timeout_add (popup_delay,
+ menu_item->timer = gdk_threads_add_timeout (popup_delay,
gtk_menu_item_select_timeout,
menu_item);
if (event &&
@@ -1018,8 +1018,6 @@ gtk_menu_item_select_timeout (gpointer data)
GtkMenuItem *menu_item;
GtkWidget *parent;
- GDK_THREADS_ENTER ();
-
menu_item = GTK_MENU_ITEM (data);
parent = GTK_WIDGET (menu_item)->parent;
@@ -1032,8 +1030,6 @@ gtk_menu_item_select_timeout (gpointer data)
GTK_MENU_SHELL (menu_item->submenu)->ignore_enter = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 19a584c618..1448a52073 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2744,8 +2744,6 @@ scroll_notebook_timer (gpointer data)
GtkNotebookPointerPosition pointer_position;
GList *element, *first_tab;
- GDK_THREADS_ENTER ();
-
priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
pointer_position = get_pointer_position (notebook);
@@ -2767,8 +2765,6 @@ scroll_notebook_timer (gpointer data)
gdk_window_raise (priv->drag_window);
}
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
@@ -2875,8 +2871,8 @@ gtk_notebook_motion_notify (GtkWidget *widget,
settings = gtk_widget_get_settings (GTK_WIDGET (notebook));
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
- priv->dnd_timer = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
- (GSourceFunc) scroll_notebook_timer,
+ priv->dnd_timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
+ scroll_notebook_timer,
(gpointer) notebook);
}
}
@@ -3090,8 +3086,6 @@ gtk_notebook_switch_tab_timeout (gpointer data)
GList *tab;
gint x, y;
- GDK_THREADS_ENTER ();
-
notebook = GTK_NOTEBOOK (data);
priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
@@ -3108,8 +3102,6 @@ gtk_notebook_switch_tab_timeout (gpointer data)
gtk_notebook_switch_focus_tab (notebook, tab);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -3189,8 +3181,8 @@ gtk_notebook_drag_motion (GtkWidget *widget,
settings = gtk_widget_get_settings (widget);
g_object_get (settings, "gtk-timeout-expand", &timeout, NULL);
- priv->switch_tab_timer = g_timeout_add (timeout,
- (GSourceFunc) gtk_notebook_switch_tab_timeout,
+ priv->switch_tab_timer = gdk_threads_add_timeout (timeout,
+ gtk_notebook_switch_tab_timeout,
widget);
}
}
@@ -4076,13 +4068,11 @@ gtk_notebook_redraw_arrows (GtkNotebook *notebook)
}
}
-static gint
+static gboolean
gtk_notebook_timer (GtkNotebook *notebook)
{
gboolean retval = FALSE;
- GDK_THREADS_ENTER ();
-
if (notebook->timer)
{
gtk_notebook_do_arrow (notebook, notebook->click_child);
@@ -4096,7 +4086,7 @@ gtk_notebook_timer (GtkNotebook *notebook)
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
notebook->need_timer = FALSE;
- notebook->timer = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
+ notebook->timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
(GSourceFunc) gtk_notebook_timer,
(gpointer) notebook);
}
@@ -4104,8 +4094,6 @@ gtk_notebook_timer (GtkNotebook *notebook)
retval = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
@@ -4121,7 +4109,7 @@ gtk_notebook_set_scroll_timer (GtkNotebook *notebook)
g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
- notebook->timer = g_timeout_add (timeout,
+ notebook->timer = gdk_threads_add_timeout (timeout,
(GSourceFunc) gtk_notebook_timer,
(gpointer) notebook);
notebook->need_timer = TRUE;
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index c695ba5b04..8be9848f9d 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -755,8 +755,6 @@ gtk_path_bar_scroll_timeout (GtkPathBar *path_bar)
{
gboolean retval = FALSE;
- GDK_THREADS_ENTER ();
-
if (path_bar->timer)
{
if (path_bar->scrolling_up)
@@ -773,7 +771,7 @@ gtk_path_bar_scroll_timeout (GtkPathBar *path_bar)
path_bar->need_timer = FALSE;
- path_bar->timer = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
+ path_bar->timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
(GSourceFunc)gtk_path_bar_scroll_timeout,
path_bar);
}
@@ -781,8 +779,6 @@ gtk_path_bar_scroll_timeout (GtkPathBar *path_bar)
retval = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
@@ -828,7 +824,7 @@ gtk_path_bar_slider_button_press (GtkWidget *widget,
g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
path_bar->need_timer = TRUE;
- path_bar->timer = g_timeout_add (timeout,
+ path_bar->timer = gdk_threads_add_timeout (timeout,
(GSourceFunc)gtk_path_bar_scroll_timeout,
path_bar);
}
diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c
index 2739f1de5f..4c72940c56 100644
--- a/gtk/gtkprintoperation-unix.c
+++ b/gtk/gtkprintoperation-unix.c
@@ -310,6 +310,7 @@ unix_end_run (GtkPrintOperation *op,
if (wait)
{
+ g_object_ref (op);
if (!op_unix->data_sent)
{
GDK_THREADS_LEAVE ();
@@ -317,6 +318,8 @@ unix_end_run (GtkPrintOperation *op,
GDK_THREADS_ENTER ();
}
g_main_loop_unref (op_unix->loop);
+ op_unix->loop = NULL;
+ g_object_unref (op);
}
}
diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c
index 159ed6d2ed..5df99a9ee9 100644
--- a/gtk/gtkprintoperation-win32.c
+++ b/gtk/gtkprintoperation-win32.c
@@ -469,7 +469,7 @@ win32_poll_status_timeout (GtkPrintOperation *op)
win32_poll_status (op);
if (!gtk_print_operation_is_finished (op))
- op_win32->timeout_id = g_timeout_add (STATUS_POLLING_TIME,
+ op_win32->timeout_id = gdk_threads_add_timeout (STATUS_POLLING_TIME,
(GSourceFunc)win32_poll_status_timeout,
op);
g_object_unref (op);
@@ -510,7 +510,7 @@ win32_end_run (GtkPrintOperation *op,
{
op_win32->printerHandle = printerHandle;
win32_poll_status (op);
- op_win32->timeout_id = g_timeout_add (STATUS_POLLING_TIME,
+ op_win32->timeout_id = gdk_threads_add_timeout (STATUS_POLLING_TIME,
(GSourceFunc)win32_poll_status_timeout,
op);
}
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c
index 943223a20e..bf634e77af 100644
--- a/gtk/gtkprintoperation.c
+++ b/gtk/gtkprintoperation.c
@@ -383,8 +383,6 @@ preview_print_idle_done (gpointer data)
GtkPrintOperation *op;
PreviewOp *pop = (PreviewOp *) data;
- GDK_THREADS_ENTER ();
-
op = GTK_PRINT_OPERATION (pop->preview);
cairo_surface_finish (pop->surface);
@@ -398,8 +396,6 @@ preview_print_idle_done (gpointer data)
gtk_print_operation_preview_end_preview (pop->preview);
g_free (pop);
-
- GDK_THREADS_LEAVE ();
}
static gboolean
@@ -410,8 +406,6 @@ preview_print_idle (gpointer data)
gboolean retval = TRUE;
cairo_t *cr;
- GDK_THREADS_ENTER ();
-
pop = (PreviewOp *) data;
op = GTK_PRINT_OPERATION (pop->preview);
@@ -425,8 +419,6 @@ preview_print_idle (gpointer data)
if (op->priv->nr_of_pages <= pop->page_nr)
retval = FALSE;
- GDK_THREADS_LEAVE ();
-
return retval;
}
@@ -454,10 +446,10 @@ preview_ready (GtkPrintOperationPreview *preview,
pop->page_nr = 0;
pop->print_context = context;
- g_idle_add_full (G_PRIORITY_DEFAULT_IDLE + 10,
- preview_print_idle,
- pop,
- preview_print_idle_done);
+ gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE + 10,
+ preview_print_idle,
+ pop,
+ preview_print_idle_done);
}
@@ -1918,8 +1910,6 @@ print_pages_idle_done (gpointer user_data)
PrintPagesData *data;
GtkPrintOperationPrivate *priv;
- GDK_THREADS_ENTER ();
-
data = (PrintPagesData*)user_data;
priv = data->op->priv;
@@ -1946,8 +1936,6 @@ print_pages_idle_done (gpointer user_data)
g_object_unref (data->op);
g_free (data);
-
- GDK_THREADS_LEAVE ();
}
static void
@@ -2030,8 +2018,6 @@ print_pages_idle (gpointer user_data)
GtkPageSetup *page_setup;
gboolean done = FALSE;
- GDK_THREADS_ENTER ();
-
data = (PrintPagesData*)user_data;
priv = data->op->priv;
@@ -2162,8 +2148,6 @@ print_pages_idle (gpointer user_data)
update_progress (data);
- GDK_THREADS_LEAVE ();
-
return !done;
}
@@ -2181,14 +2165,10 @@ handle_progress_response (GtkWidget *dialog,
static gboolean
show_progress_timeout (PrintPagesData *data)
{
- GDK_THREADS_ENTER ();
-
gtk_window_present (GTK_WINDOW (data->progress));
data->op->priv->show_progress_timeout_id = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -2226,7 +2206,7 @@ print_pages (GtkPrintOperation *op,
G_CALLBACK (handle_progress_response), op);
priv->show_progress_timeout_id =
- g_timeout_add (SHOW_PROGRESS_TIME,
+ gdk_threads_add_timeout (SHOW_PROGRESS_TIME,
(GSourceFunc)show_progress_timeout,
data);
@@ -2265,22 +2245,24 @@ print_pages (GtkPrintOperation *op,
priv->manual_orientation = TRUE;
}
- priv->print_pages_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE + 10,
- print_pages_idle,
- data,
- print_pages_idle_done);
+ priv->print_pages_idle_id = gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE + 10,
+ print_pages_idle,
+ data,
+ print_pages_idle_done);
/* Recursive main loop to make sure we don't exit on sync operations */
if (priv->is_sync)
{
priv->rloop = g_main_loop_new (NULL, FALSE);
+ g_object_ref (op);
GDK_THREADS_LEAVE ();
g_main_loop_run (priv->rloop);
GDK_THREADS_ENTER ();
g_main_loop_unref (priv->rloop);
priv->rloop = NULL;
+ g_object_unref (op);
}
}
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 41338de145..b0ec3a0e40 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -1125,7 +1125,7 @@ schedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog)
if (priv->mark_conflicts_id != 0)
return;
- priv->mark_conflicts_id = g_idle_add (mark_conflicts_callback,
+ priv->mark_conflicts_id = gdk_threads_add_idle (mark_conflicts_callback,
dialog);
}
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index c6c6e56dda..696198a1be 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -3297,10 +3297,8 @@ second_timeout (gpointer data)
{
GtkRange *range;
- GDK_THREADS_ENTER ();
range = GTK_RANGE (data);
gtk_range_scroll (range, range->timer->step);
- GDK_THREADS_LEAVE ();
return TRUE;
}
@@ -3312,16 +3310,13 @@ initial_timeout (gpointer data)
GtkSettings *settings;
guint timeout;
- GDK_THREADS_ENTER ();
settings = gtk_widget_get_settings (GTK_WIDGET (data));
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
range = GTK_RANGE (data);
- range->timer->timeout_id = g_timeout_add (timeout * SCROLL_DELAY_FACTOR,
+ range->timer->timeout_id = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
second_timeout,
range);
- GDK_THREADS_LEAVE ();
-
/* remove self */
return FALSE;
}
@@ -3341,7 +3336,7 @@ gtk_range_add_step_timer (GtkRange *range,
range->timer = g_new (GtkRangeStepTimer, 1);
- range->timer->timeout_id = g_timeout_add (timeout,
+ range->timer->timeout_id = gdk_threads_add_timeout (timeout,
initial_timeout,
range);
range->timer->step = step;
@@ -3368,11 +3363,9 @@ update_timeout (gpointer data)
{
GtkRange *range;
- GDK_THREADS_ENTER ();
range = GTK_RANGE (data);
gtk_range_update_value (range);
range->update_timeout_id = 0;
- GDK_THREADS_LEAVE ();
/* self-remove */
return FALSE;
@@ -3383,7 +3376,7 @@ gtk_range_reset_update_timer (GtkRange *range)
{
gtk_range_remove_update_timer (range);
- range->update_timeout_id = g_timeout_add (UPDATE_DELAY,
+ range->update_timeout_id = gdk_threads_add_timeout (UPDATE_DELAY,
update_timeout,
range);
}
diff --git a/gtk/gtkrecentchooserdefault.c b/gtk/gtkrecentchooserdefault.c
index 9a64f80d13..df8a70c564 100644
--- a/gtk/gtkrecentchooserdefault.c
+++ b/gtk/gtkrecentchooserdefault.c
@@ -754,8 +754,6 @@ load_recent_items (gpointer user_data)
const gchar *uri, *name;
gboolean retval;
- GDK_THREADS_ENTER ();
-
impl = GTK_RECENT_CHOOSER_DEFAULT (user_data);
g_assert ((impl->load_state == LOAD_EMPTY) ||
@@ -767,8 +765,6 @@ load_recent_items (gpointer user_data)
impl->recent_items = gtk_recent_chooser_get_items (GTK_RECENT_CHOOSER (impl));
if (!impl->recent_items)
{
- GDK_THREADS_LEAVE ();
-
impl->load_state = LOAD_FINISHED;
return FALSE;
@@ -831,8 +827,6 @@ load_recent_items (gpointer user_data)
retval = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
@@ -841,8 +835,6 @@ cleanup_after_load (gpointer user_data)
{
GtkRecentChooserDefault *impl;
- GDK_THREADS_ENTER ();
-
impl = GTK_RECENT_CHOOSER_DEFAULT (user_data);
if (impl->load_id != 0)
@@ -864,8 +856,6 @@ cleanup_after_load (gpointer user_data)
(impl->load_state == LOAD_FINISHED));
set_busy_cursor (impl, FALSE);
-
- GDK_THREADS_LEAVE ();
}
/* clears the current model and reloads the recently used resources */
@@ -888,7 +878,7 @@ reload_recent_items (GtkRecentChooserDefault *impl)
set_busy_cursor (impl, TRUE);
impl->load_state = LOAD_EMPTY;
- impl->load_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE + 30,
+ impl->load_id = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 30,
load_recent_items,
impl,
cleanup_after_load);
diff --git a/gtk/gtkrecentchoosermenu.c b/gtk/gtkrecentchoosermenu.c
index 7dbd7999db..eba0068872 100644
--- a/gtk/gtkrecentchoosermenu.c
+++ b/gtk/gtkrecentchoosermenu.c
@@ -969,8 +969,6 @@ idle_populate_func (gpointer data)
gboolean retval;
GtkWidget *item;
- GDK_THREADS_ENTER ();
-
pdata = (MenuPopulateData *) data;
priv = pdata->menu->priv;
@@ -1076,8 +1074,6 @@ check_and_return:
else
retval = TRUE;
- GDK_THREADS_LEAVE ();
-
return retval;
}
@@ -1106,7 +1102,7 @@ gtk_recent_chooser_menu_populate (GtkRecentChooserMenu *menu)
/* dispose our menu items first */
gtk_recent_chooser_menu_dispose_items (menu);
- menu->priv->populate_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE + 30,
+ menu->priv->populate_id = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 30,
idle_populate_func,
pdata,
idle_populate_clean_up);
diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c
index d99aefd38b..b991f7d6b0 100644
--- a/gtk/gtkrecentmanager.c
+++ b/gtk/gtkrecentmanager.c
@@ -296,7 +296,7 @@ gtk_recent_manager_init (GtkRecentManager *manager)
priv->filename = g_build_filename (g_get_home_dir (),
GTK_RECENTLY_USED_FILE,
NULL);
- priv->poll_timeout = g_timeout_add (POLL_DELTA,
+ priv->poll_timeout = gdk_threads_add_timeout (POLL_DELTA,
gtk_recent_manager_poll_timeout,
manager);
@@ -508,7 +508,7 @@ gtk_recent_manager_set_filename (GtkRecentManager *manager,
}
priv->filename = g_strdup (filename);
- priv->poll_timeout = g_timeout_add (POLL_DELTA,
+ priv->poll_timeout = gdk_threads_add_timeout (POLL_DELTA,
gtk_recent_manager_poll_timeout,
manager);
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index 451e5d860e..5a88069aab 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -152,8 +152,8 @@ struct _GtkRetrievalInfo
/* Local Functions */
static void gtk_selection_init (void);
-static gint gtk_selection_incr_timeout (GtkIncrInfo *info);
-static gint gtk_selection_retrieval_timeout (GtkRetrievalInfo *info);
+static gboolean gtk_selection_incr_timeout (GtkIncrInfo *info);
+static gboolean gtk_selection_retrieval_timeout (GtkRetrievalInfo *info);
static void gtk_selection_retrieval_report (GtkRetrievalInfo *info,
GdkAtom type,
gint format,
@@ -1090,7 +1090,8 @@ gtk_selection_convert (GtkWidget *widget,
current_retrievals = g_list_append (current_retrievals, info);
gdk_selection_convert (widget->window, selection, target, time_);
- g_timeout_add (1000, (GSourceFunc) gtk_selection_retrieval_timeout, info);
+ gdk_threads_add_timeout (1000,
+ (GSourceFunc) gtk_selection_retrieval_timeout, info);
return TRUE;
}
@@ -2260,7 +2261,7 @@ _gtk_selection_request (GtkWidget *widget,
gdk_window_get_events (info->requestor) |
GDK_PROPERTY_CHANGE_MASK);
current_incrs = g_list_append (current_incrs, info);
- g_timeout_add (1000, (GSourceFunc) gtk_selection_incr_timeout, info);
+ gdk_threads_add_timeout (1000, (GSourceFunc) gtk_selection_incr_timeout, info);
}
/* If it was a MULTIPLE request, set the property to indicate which
@@ -2449,8 +2450,6 @@ gtk_selection_incr_timeout (GtkIncrInfo *info)
GList *tmp_list;
gboolean retval;
- GDK_THREADS_ENTER ();
-
/* Determine if retrieval has finished by checking if it still in
list of pending retrievals */
@@ -2486,8 +2485,6 @@ gtk_selection_incr_timeout (GtkIncrInfo *info)
retval = TRUE; /* timeout will happen again */
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
@@ -2693,14 +2690,12 @@ _gtk_selection_property_notify (GtkWidget *widget,
* results:
*************************************************************/
-static gint
+static gboolean
gtk_selection_retrieval_timeout (GtkRetrievalInfo *info)
{
GList *tmp_list;
gboolean retval;
- GDK_THREADS_ENTER ();
-
/* Determine if retrieval has finished by checking if it still in
list of pending retrievals */
@@ -2734,8 +2729,6 @@ gtk_selection_retrieval_timeout (GtkRetrievalInfo *info)
retval = TRUE; /* timeout will happen again */
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index bcd360bbc4..741924551e 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -112,7 +112,7 @@ static void gtk_spin_button_state_changed (GtkWidget *widget,
GtkStateType previous_state);
static void gtk_spin_button_draw_arrow (GtkSpinButton *spin_button,
GtkArrowType arrow_type);
-static gint gtk_spin_button_timer (GtkSpinButton *spin_button);
+static gboolean gtk_spin_button_timer (GtkSpinButton *spin_button);
static void gtk_spin_button_stop_spinning (GtkSpinButton *spin);
static void gtk_spin_button_value_changed (GtkAdjustment *adjustment,
GtkSpinButton *spin_button);
@@ -1036,7 +1036,7 @@ start_spinning (GtkSpinButton *spin,
spin->timer_step = step;
spin->need_timer = TRUE;
- spin->timer = g_timeout_add (timeout,
+ spin->timer = gdk_threads_add_timeout (timeout,
(GSourceFunc) gtk_spin_button_timer,
(gpointer) spin);
}
@@ -1176,8 +1176,6 @@ gtk_spin_button_timer (GtkSpinButton *spin_button)
{
gboolean retval = FALSE;
- GDK_THREADS_ENTER ();
-
if (spin_button->timer)
{
if (spin_button->click_child == GTK_ARROW_UP)
@@ -1193,7 +1191,7 @@ gtk_spin_button_timer (GtkSpinButton *spin_button)
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
spin_button->need_timer = FALSE;
- spin_button->timer = g_timeout_add (timeout,
+ spin_button->timer = gdk_threads_add_timeout (timeout,
(GSourceFunc) gtk_spin_button_timer,
(gpointer) spin_button);
}
@@ -1214,8 +1212,6 @@ gtk_spin_button_timer (GtkSpinButton *spin_button)
}
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c
index f9d5215f70..43fcdf46ca 100755
--- a/gtk/gtkstatusicon.c
+++ b/gtk/gtkstatusicon.c
@@ -1574,7 +1574,7 @@ gtk_status_icon_enable_blinking (GtkStatusIcon *status_icon)
gtk_status_icon_blinker (status_icon);
priv->blinking_timeout =
- g_timeout_add (BLINK_TIMEOUT,
+ gdk_threads_add_timeout (BLINK_TIMEOUT,
(GSourceFunc) gtk_status_icon_blinker,
status_icon);
}
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 6070b617dd..eda58aad6f 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -1580,8 +1580,6 @@ gtk_text_scroll_timeout (gpointer data)
gint x, y;
GdkModifierType mask;
- GDK_THREADS_ENTER ();
-
text = GTK_TEXT (data);
text->timer = 0;
@@ -1601,8 +1599,6 @@ gtk_text_scroll_timeout (gpointer data)
gdk_event_free (event);
}
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -1803,7 +1799,7 @@ gtk_text_motion_notify (GtkWidget *widget,
{
if (text->timer == 0)
{
- text->timer = g_timeout_add (SCROLL_TIME,
+ text->timer = gdk_threads_add_timeout (SCROLL_TIME,
gtk_text_scroll_timeout,
text);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 3a88622631..d5664a8510 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -3240,8 +3240,6 @@ first_validate_callback (gpointer data)
{
GtkTextView *text_view = data;
- GDK_THREADS_ENTER ();
-
/* Note that some of this code is duplicated at the end of size_allocate,
* keep in sync with that.
*/
@@ -3250,8 +3248,6 @@ first_validate_callback (gpointer data)
gtk_text_view_flush_first_validate (text_view);
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -3261,8 +3257,6 @@ incremental_validate_callback (gpointer data)
GtkTextView *text_view = data;
gboolean result = TRUE;
- GDK_THREADS_ENTER ();
-
DV(g_print(G_STRLOC"\n"));
gtk_text_layout_validate (text_view->layout, 2000);
@@ -3275,8 +3269,6 @@ incremental_validate_callback (gpointer data)
result = FALSE;
}
- GDK_THREADS_LEAVE ();
-
return result;
}
@@ -3294,14 +3286,14 @@ gtk_text_view_invalidate (GtkTextView *text_view)
if (!text_view->first_validate_idle)
{
- text_view->first_validate_idle = g_idle_add_full (GTK_PRIORITY_RESIZE - 2, first_validate_callback, text_view, NULL);
+ text_view->first_validate_idle = gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE - 2, first_validate_callback, text_view, NULL);
DV (g_print (G_STRLOC": adding first validate idle %d\n",
text_view->first_validate_idle));
}
if (!text_view->incremental_validate_idle)
{
- text_view->incremental_validate_idle = g_idle_add_full (GTK_TEXT_VIEW_PRIORITY_VALIDATE, incremental_validate_callback, text_view, NULL);
+ text_view->incremental_validate_idle = gdk_threads_add_idle_full (GTK_TEXT_VIEW_PRIORITY_VALIDATE, incremental_validate_callback, text_view, NULL);
DV (g_print (G_STRLOC": adding incremental validate idle %d\n",
text_view->incremental_validate_idle));
}
@@ -4513,8 +4505,6 @@ blink_cb (gpointer data)
gboolean visible;
gint blink_timeout;
- GDK_THREADS_ENTER ();
-
text_view = GTK_TEXT_VIEW (data);
priv = GTK_TEXT_VIEW_GET_PRIVATE (text_view);
@@ -4540,12 +4530,12 @@ blink_cb (gpointer data)
text_view->blink_timeout = 0;
}
else if (visible)
- text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
+ text_view->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
text_view);
else
{
- text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
+ text_view->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_ON_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
text_view);
priv->blink_time += get_cursor_time (text_view);
@@ -4565,8 +4555,6 @@ blink_cb (gpointer data)
text_window_invalidate_cursors (text_view->text_window);
- GDK_THREADS_LEAVE ();
-
/* Remove ourselves */
return FALSE;
}
@@ -4595,7 +4583,7 @@ gtk_text_view_check_cursor_blink (GtkTextView *text_view)
{
gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
- text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
+ text_view->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_OFF_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
text_view);
}
@@ -4624,7 +4612,7 @@ gtk_text_view_pend_cursor_blink (GtkTextView *text_view)
gtk_text_view_stop_cursor_blink (text_view);
gtk_text_layout_set_cursor_visible (text_view->layout, TRUE);
- text_view->blink_timeout = g_timeout_add (get_cursor_time (text_view) * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
+ text_view->blink_timeout = gdk_threads_add_timeout (get_cursor_time (text_view) * CURSOR_PEND_MULTIPLIER / CURSOR_DIVIDER,
blink_cb,
text_view);
}
@@ -5558,13 +5546,11 @@ move_mark_to_pointer_and_scroll (GtkTextView *text_view,
G_STRLOC, text_view->first_validate_idle));
}
-static gint
+static gboolean
selection_scan_timeout (gpointer data)
{
GtkTextView *text_view;
- GDK_THREADS_ENTER ();
-
text_view = GTK_TEXT_VIEW (data);
DV(g_print (G_STRLOC": calling move_mark_to_pointer_and_scroll\n"));
@@ -5572,8 +5558,6 @@ selection_scan_timeout (gpointer data)
gtk_text_buffer_get_mark (get_buffer (text_view),
"insert"));
- GDK_THREADS_LEAVE ();
-
return TRUE; /* remain installed. */
}
@@ -5585,8 +5569,6 @@ drag_scan_timeout (gpointer data)
GtkTextView *text_view;
GtkTextIter newplace;
- GDK_THREADS_ENTER ();
-
text_view = GTK_TEXT_VIEW (data);
get_iter_at_pointer (text_view, &newplace);
@@ -5600,8 +5582,6 @@ drag_scan_timeout (gpointer data)
text_view->dnd_mark,
DND_SCROLL_MARGIN, FALSE, 0.0, 0.0);
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
@@ -5753,7 +5733,7 @@ selection_motion_event_handler (GtkTextView *text_view,
g_source_remove (text_view->scroll_timeout);
text_view->scroll_timeout =
- g_timeout_add (50, selection_scan_timeout, text_view);
+ gdk_threads_add_timeout (50, selection_scan_timeout, text_view);
return TRUE;
}
@@ -6335,7 +6315,7 @@ gtk_text_view_drag_motion (GtkWidget *widget,
g_source_remove (text_view->scroll_timeout);
text_view->scroll_timeout =
- g_timeout_add (50, drag_scan_timeout, text_view);
+ gdk_threads_add_timeout (50, drag_scan_timeout, text_view);
/* TRUE return means don't propagate the drag motion to parent
* widgets that may also be drop sites.
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 0dd959d9a5..c2032e9fb2 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -1116,8 +1116,6 @@ slide_idle_handler (gpointer data)
GtkToolbarPrivate *priv;
GList *list;
- GDK_THREADS_ENTER ();
-
priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
if (priv->need_sync)
@@ -1193,7 +1191,6 @@ slide_idle_handler (gpointer data)
priv->is_sliding = FALSE;
priv->idle_id = 0;
- GDK_THREADS_LEAVE();
return FALSE;
}
@@ -1230,7 +1227,7 @@ gtk_toolbar_begin_sliding (GtkToolbar *toolbar)
priv->is_sliding = TRUE;
if (!priv->idle_id)
- priv->idle_id = g_idle_add (slide_idle_handler, toolbar);
+ priv->idle_id = gdk_threads_add_idle (slide_idle_handler, toolbar);
rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
vertical = (toolbar->orientation == GTK_ORIENTATION_VERTICAL);
diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c
index d203082d7c..458f9e4109 100644
--- a/gtk/gtktooltips.c
+++ b/gtk/gtktooltips.c
@@ -446,21 +446,17 @@ gtk_tooltips_draw_tips (GtkTooltips *tooltips)
gtk_widget_show (tooltips->tip_window);
}
-static gint
+static gboolean
gtk_tooltips_timeout (gpointer data)
{
GtkTooltips *tooltips = (GtkTooltips *) data;
- GDK_THREADS_ENTER ();
-
if (tooltips->active_tips_data != NULL &&
GTK_WIDGET_DRAWABLE (tooltips->active_tips_data->widget))
gtk_tooltips_draw_tips (tooltips);
tooltips->timer_tag = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -620,7 +616,7 @@ gtk_tooltips_start_delay (GtkTooltips *tooltips,
delay = STICKY_DELAY;
else
delay = tooltips->delay;
- tooltips->timer_tag = g_timeout_add (delay,
+ tooltips->timer_tag = gdk_threads_add_timeout (delay,
gtk_tooltips_timeout,
(gpointer) tooltips);
}
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 53580419ff..c50119a554 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -459,7 +459,7 @@ static void gtk_tree_view_tree_window_to_tree_coords (GtkTreeView *tree_view,
gint *tx,
gint *ty);
-static gint scroll_row_timeout (gpointer data);
+static gboolean scroll_row_timeout (gpointer data);
static void remove_scroll_timeout (GtkTreeView *tree_view);
static guint tree_view_signals [LAST_SIGNAL] = { 0 };
@@ -2980,8 +2980,6 @@ auto_expand_timeout (gpointer data)
GtkTreeView *tree_view = GTK_TREE_VIEW (data);
GtkTreePath *path;
- GDK_THREADS_ENTER ();
-
if (tree_view->priv->prelight_node)
{
path = _gtk_tree_view_find_path (tree_view,
@@ -2998,8 +2996,6 @@ auto_expand_timeout (gpointer data)
tree_view->priv->auto_expand_timeout = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -3105,7 +3101,7 @@ do_prelight (GtkTreeView *tree_view,
if (tree_view->priv->hover_expand)
{
tree_view->priv->auto_expand_timeout =
- g_timeout_add (AUTO_EXPAND_TIMEOUT, auto_expand_timeout, tree_view);
+ gdk_threads_add_timeout (AUTO_EXPAND_TIMEOUT, auto_expand_timeout, tree_view);
}
}
@@ -3920,7 +3916,7 @@ gtk_tree_view_motion_bin_window (GtkWidget *widget,
if (tree_view->priv->scroll_timeout == 0)
{
- tree_view->priv->scroll_timeout = g_timeout_add (150, scroll_row_timeout, tree_view);
+ tree_view->priv->scroll_timeout = gdk_threads_add_timeout (150, scroll_row_timeout, tree_view);
}
}
@@ -6190,8 +6186,6 @@ validate_rows_handler (GtkTreeView *tree_view)
{
gboolean retval;
- GDK_THREADS_ENTER ();
-
retval = do_validate_rows (tree_view, TRUE);
if (! retval && tree_view->priv->validate_rows_timer)
{
@@ -6199,8 +6193,6 @@ validate_rows_handler (GtkTreeView *tree_view)
tree_view->priv->validate_rows_timer = 0;
}
- GDK_THREADS_LEAVE ();
-
return retval;
}
@@ -6235,12 +6227,8 @@ do_presize_handler (GtkTreeView *tree_view)
static gboolean
presize_handler_callback (gpointer data)
{
- GDK_THREADS_ENTER ();
-
do_presize_handler (GTK_TREE_VIEW (data));
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -6253,21 +6241,18 @@ install_presize_handler (GtkTreeView *tree_view)
if (! tree_view->priv->presize_handler_timer)
{
tree_view->priv->presize_handler_timer =
- g_idle_add_full (GTK_PRIORITY_RESIZE - 2, presize_handler_callback, tree_view, NULL);
+ gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE - 2, presize_handler_callback, tree_view, NULL);
}
if (! tree_view->priv->validate_rows_timer)
{
tree_view->priv->validate_rows_timer =
- g_idle_add_full (GTK_TREE_VIEW_PRIORITY_VALIDATE, (GSourceFunc) validate_rows_handler, tree_view, NULL);
+ gdk_threads_add_idle_full (GTK_TREE_VIEW_PRIORITY_VALIDATE, (GSourceFunc) validate_rows_handler, tree_view, NULL);
}
}
static gboolean
scroll_sync_handler (GtkTreeView *tree_view)
{
-
- GDK_THREADS_ENTER ();
-
if (tree_view->priv->height <= tree_view->priv->vadjustment->page_size)
gtk_adjustment_set_value (GTK_ADJUSTMENT (tree_view->priv->vadjustment), 0);
else if (gtk_tree_row_reference_valid (tree_view->priv->top_row))
@@ -6277,8 +6262,6 @@ scroll_sync_handler (GtkTreeView *tree_view)
tree_view->priv->scroll_sync_timer = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -6291,7 +6274,7 @@ install_scroll_sync_handler (GtkTreeView *tree_view)
if (!tree_view->priv->scroll_sync_timer)
{
tree_view->priv->scroll_sync_timer =
- g_idle_add_full (GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC, (GSourceFunc) scroll_sync_handler, tree_view, NULL);
+ gdk_threads_add_idle_full (GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC, (GSourceFunc) scroll_sync_handler, tree_view, NULL);
}
}
@@ -6689,8 +6672,6 @@ open_row_timeout (gpointer data)
GtkTreeViewDropPosition pos;
gboolean result = FALSE;
- GDK_THREADS_ENTER ();
-
gtk_tree_view_get_drag_dest_row (tree_view,
&dest_path,
&pos);
@@ -6712,25 +6693,19 @@ open_row_timeout (gpointer data)
result = TRUE;
}
- GDK_THREADS_LEAVE ();
-
return result;
}
-static gint
+static gboolean
scroll_row_timeout (gpointer data)
{
GtkTreeView *tree_view = data;
- GDK_THREADS_ENTER ();
-
gtk_tree_view_vertical_autoscroll (tree_view);
if (tree_view->priv->rubber_band_status == RUBBER_BAND_ACTIVE)
gtk_tree_view_update_rubber_band (tree_view);
- GDK_THREADS_LEAVE ();
-
return TRUE;
}
@@ -7180,12 +7155,12 @@ gtk_tree_view_drag_motion (GtkWidget *widget,
pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE))
{
tree_view->priv->open_dest_timeout =
- g_timeout_add (AUTO_EXPAND_TIMEOUT, open_row_timeout, tree_view);
+ gdk_threads_add_timeout (AUTO_EXPAND_TIMEOUT, open_row_timeout, tree_view);
}
else if (tree_view->priv->scroll_timeout == 0)
{
tree_view->priv->scroll_timeout =
- g_timeout_add (150, scroll_row_timeout, tree_view);
+ gdk_threads_add_timeout (150, scroll_row_timeout, tree_view);
}
if (target == gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW"))
@@ -10053,13 +10028,9 @@ gtk_tree_view_real_select_cursor_parent (GtkTreeView *tree_view)
static gboolean
gtk_tree_view_search_entry_flush_timeout (GtkTreeView *tree_view)
{
- GDK_THREADS_ENTER ();
-
gtk_tree_view_search_dialog_hide (tree_view->priv->search_window, tree_view);
tree_view->priv->typeselect_flush_timeout = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -10225,7 +10196,7 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view,
}
tree_view->priv->typeselect_flush_timeout =
- g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+ gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
@@ -11602,15 +11573,7 @@ gtk_tree_view_expand_all (GtkTreeView *tree_view)
static gboolean
expand_collapse_timeout (gpointer data)
{
- gboolean retval;
-
- GDK_THREADS_ENTER ();
-
- retval = do_expand_collapse (data);
-
- GDK_THREADS_LEAVE ();
-
- return retval;
+ return do_expand_collapse (data);
}
static gboolean
@@ -11851,7 +11814,7 @@ gtk_tree_view_real_expand_row (GtkTreeView *tree_view,
if (animate)
{
- tree_view->priv->expand_collapse_timeout = g_timeout_add (50, expand_collapse_timeout, tree_view);
+ tree_view->priv->expand_collapse_timeout = gdk_threads_add_timeout (50, expand_collapse_timeout, tree_view);
tree_view->priv->expanded_collapsed_node = node;
tree_view->priv->expanded_collapsed_tree = tree;
@@ -12055,7 +12018,7 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
if (animate)
{
- tree_view->priv->expand_collapse_timeout = g_timeout_add (50, expand_collapse_timeout, tree_view);
+ tree_view->priv->expand_collapse_timeout = gdk_threads_add_timeout (50, expand_collapse_timeout, tree_view);
tree_view->priv->expanded_collapsed_node = node;
tree_view->priv->expanded_collapsed_tree = tree;
@@ -13827,7 +13790,7 @@ gtk_tree_view_search_preedit_changed (GtkIMContext *im_context,
{
g_source_remove (tree_view->priv->typeselect_flush_timeout);
tree_view->priv->typeselect_flush_timeout =
- g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+ gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
}
@@ -13865,12 +13828,8 @@ gtk_tree_view_real_search_enable_popdown (gpointer data)
{
GtkTreeView *tree_view = (GtkTreeView *)data;
- GDK_THREADS_ENTER ();
-
tree_view->priv->disable_popdown = 0;
- GDK_THREADS_LEAVE ();
-
return FALSE;
}
@@ -13878,7 +13837,7 @@ static void
gtk_tree_view_search_enable_popdown (GtkWidget *widget,
gpointer data)
{
- g_timeout_add (200, gtk_tree_view_real_search_enable_popdown, data);
+ gdk_threads_add_timeout_full (G_PRIORITY_HIGH, 200, gtk_tree_view_real_search_enable_popdown, g_object_ref (data), g_object_unref);
}
static gboolean
@@ -13932,7 +13891,7 @@ gtk_tree_view_search_scroll_event (GtkWidget *widget,
{
g_source_remove (tree_view->priv->typeselect_flush_timeout);
tree_view->priv->typeselect_flush_timeout =
- g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+ gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
}
@@ -14003,7 +13962,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 =
- g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+ gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
}
@@ -14261,7 +14220,7 @@ gtk_tree_view_search_init (GtkWidget *entry,
{
g_source_remove (tree_view->priv->typeselect_flush_timeout);
tree_view->priv->typeselect_flush_timeout =
- g_timeout_add (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
+ gdk_threads_add_timeout (GTK_TREE_VIEW_SEARCH_DIALOG_TIMEOUT,
(GSourceFunc) gtk_tree_view_search_entry_flush_timeout,
tree_view);
}
diff --git a/gtk/gtkuimanager.c b/gtk/gtkuimanager.c
index 8a3685f76e..9e241c946a 100644
--- a/gtk/gtkuimanager.c
+++ b/gtk/gtkuimanager.c
@@ -2620,9 +2620,7 @@ do_updates (GtkUIManager *self)
static gboolean
do_updates_idle (GtkUIManager *self)
{
- GDK_THREADS_ENTER ();
do_updates (self);
- GDK_THREADS_LEAVE ();
return FALSE;
}
@@ -2633,7 +2631,8 @@ queue_update (GtkUIManager *self)
if (self->private_data->update_tag != 0)
return;
- self->private_data->update_tag = g_idle_add ((GSourceFunc)do_updates_idle,
+ self->private_data->update_tag = gdk_threads_add_idle (
+ (GSourceFunc)do_updates_idle,
self);
}
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 1da30202ee..c12dc6a151 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1360,7 +1360,6 @@ handle_keys_changed (gpointer data)
{
GtkWindow *window;
- GDK_THREADS_ENTER ();
window = GTK_WINDOW (data);
if (window->keys_changed_handler)
@@ -1370,7 +1369,6 @@ handle_keys_changed (gpointer data)
}
g_signal_emit (window, window_signals[KEYS_CHANGED], 0);
- GDK_THREADS_LEAVE ();
return FALSE;
}
@@ -1379,7 +1377,7 @@ static void
gtk_window_notify_keys_changed (GtkWindow *window)
{
if (!window->keys_changed_handler)
- window->keys_changed_handler = g_idle_add (handle_keys_changed, window);
+ window->keys_changed_handler = gdk_threads_add_idle (handle_keys_changed, window);
}
/**
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c b/modules/printbackends/cups/gtkprintbackendcups.c
index 12288710d2..5aab327f47 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -1158,6 +1158,9 @@ cups_request_printer_list (GtkPrintBackendCups *cups_backend)
!cups_backend->got_default_printer)
return TRUE;
+ g_object_ref (cups_backend);
+ GDK_THREADS_LEAVE ();
+
cups_backend->list_printers_pending = TRUE;
request = gtk_cups_request_new (NULL,
@@ -1176,6 +1179,8 @@ cups_request_printer_list (GtkPrintBackendCups *cups_backend)
(GtkPrintCupsResponseCallbackFunc) cups_request_printer_list_cb,
request,
NULL);
+ GDK_THREADS_ENTER ();
+ g_object_unref (cups_backend);
return TRUE;
}
@@ -1189,7 +1194,7 @@ cups_get_printer_list (GtkPrintBackend *backend)
if (cups_backend->list_printers_poll == 0)
{
cups_request_printer_list (cups_backend);
- cups_backend->list_printers_poll = g_timeout_add (3000,
+ cups_backend->list_printers_poll = gdk_threads_add_timeout (3000,
(GSourceFunc) cups_request_printer_list,
backend);
}
diff --git a/perf/gtkwidgetprofiler.c b/perf/gtkwidgetprofiler.c
index 3fd9f858df..17be09cd3c 100644
--- a/perf/gtkwidgetprofiler.c
+++ b/perf/gtkwidgetprofiler.c
@@ -223,7 +223,7 @@ toplevel_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer dat
profiler = GTK_WIDGET_PROFILER (data);
- g_idle_add_full (G_PRIORITY_HIGH, toplevel_idle_after_expose_cb, profiler, NULL);
+ gdk_threads_add_idle_full (G_PRIORITY_HIGH, toplevel_idle_after_expose_cb, profiler, NULL);
return FALSE;
}
diff --git a/tests/autotestfilechooser.c b/tests/autotestfilechooser.c
index e7aa8de685..2706d9d522 100644
--- a/tests/autotestfilechooser.c
+++ b/tests/autotestfilechooser.c
@@ -122,7 +122,7 @@ test_set_filename (GtkFileChooserAction action,
(* set_filename_fn) (GTK_FILE_CHOOSER (chooser), data);
- g_timeout_add (2000, set_filename_timeout_cb, &closure);
+ gdk_threads_add_timeout (2000, set_filename_timeout_cb, &closure);
gtk_dialog_run (GTK_DIALOG (chooser));
retval = (* compare_filename_fn) (GTK_FILE_CHOOSER (chooser), data);
@@ -332,7 +332,7 @@ test_confirm_overwrite_for_path (const char *path)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (closure.chooser), path);
- g_timeout_add (2000, confirm_overwrite_timeout_cb, &closure);
+ gdk_threads_add_timeout (2000, confirm_overwrite_timeout_cb, &closure);
gtk_dialog_run (GTK_DIALOG (closure.chooser));
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (closure.chooser));
@@ -899,7 +899,7 @@ sleep_timeout_cb (gpointer data)
static void
sleep_in_main_loop (int milliseconds)
{
- g_timeout_add (milliseconds, sleep_timeout_cb, NULL);
+ gdk_threads_add_timeout (milliseconds, sleep_timeout_cb, NULL);
gtk_main ();
}
diff --git a/tests/autotestfilesystem.c b/tests/autotestfilesystem.c
index 33bd6ba4b0..9738fc63a7 100644
--- a/tests/autotestfilesystem.c
+++ b/tests/autotestfilesystem.c
@@ -105,7 +105,7 @@ timeout_cb (gpointer data)
static void
wait_for_callback (TestCallbackClosure *closure)
{
- g_timeout_add (CALLBACK_TIMEOUT_MS, timeout_cb, closure);
+ gdk_threads_add_timeout (CALLBACK_TIMEOUT_MS, timeout_cb, closure);
gtk_main ();
}
diff --git a/tests/stresstest-toolbar.c b/tests/stresstest-toolbar.c
index 74fbcbf470..17a59f2464 100644
--- a/tests/stresstest-toolbar.c
+++ b/tests/stresstest-toolbar.c
@@ -137,7 +137,7 @@ main (gint argc, gchar **argv)
gtk_widget_show (GTK_WIDGET (info.window));
- g_idle_add (stress_test_old_api, &info);
+ gdk_threads_add_idle (stress_test_old_api, &info);
gtk_widget_show_all (GTK_WIDGET (info.window));
diff --git a/tests/testassistant.c b/tests/testassistant.c
index 826bb85028..3eff2cdf5d 100644
--- a/tests/testassistant.c
+++ b/tests/testassistant.c
@@ -143,7 +143,7 @@ prepare_callback (GtkWidget *widget, GtkWidget *page)
progress = GTK_BIN (page)->child;
gtk_assistant_set_page_complete (GTK_ASSISTANT (widget), page, FALSE);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), 0.0);
- g_timeout_add (300, (GSourceFunc) progress_timeout, widget);
+ gdk_threads_add_timeout (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 12d8de3447..c27cc005fb 100644
--- a/tests/testcombo.c
+++ b/tests/testcombo.c
@@ -1332,7 +1332,7 @@ main (int argc, char **argv)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
#if 1
- g_timeout_add (1000, (GSourceFunc) capital_animation, model);
+ gdk_threads_add_timeout (1000, (GSourceFunc) capital_animation, model);
#endif
gtk_widget_show_all (window);
diff --git a/tests/testcombochange.c b/tests/testcombochange.c
index b67b0f50fe..7e42cbca14 100644
--- a/tests/testcombochange.c
+++ b/tests/testcombochange.c
@@ -228,7 +228,7 @@ on_animate (void)
{
n_animations += 20;
- timer = g_timeout_add (1000, (GSourceFunc) animation_timer, NULL);
+ timer = gdk_threads_add_timeout (1000, (GSourceFunc) animation_timer, NULL);
}
int
diff --git a/tests/testdnd.c b/tests/testdnd.c
index d2e9a5c488..608cfc8693 100644
--- a/tests/testdnd.c
+++ b/tests/testdnd.c
@@ -485,12 +485,12 @@ popup_leave (GtkWidget *widget,
if (!popdown_timer)
{
g_print ("added popdown\n");
- popdown_timer = g_timeout_add (500, popdown_cb, NULL);
+ popdown_timer = gdk_threads_add_timeout (500, popdown_cb, NULL);
}
}
}
-gint
+gboolean
popup_cb (gpointer data)
{
if (!popped_up)
@@ -534,7 +534,7 @@ popup_cb (gpointer data)
popped_up = TRUE;
}
- popdown_timer = g_timeout_add (500, popdown_cb, NULL);
+ popdown_timer = gdk_threads_add_timeout (500, popdown_cb, NULL);
g_print ("added popdown\n");
popup_timer = FALSE;
@@ -550,7 +550,7 @@ popsite_motion (GtkWidget *widget,
guint time)
{
if (!popup_timer)
- popup_timer = g_timeout_add (500, popup_cb, NULL);
+ popup_timer = gdk_threads_add_timeout (500, popup_cb, NULL);
return TRUE;
}
diff --git a/tests/testentrycompletion.c b/tests/testentrycompletion.c
index a0cf7d7752..483010b1f9 100644
--- a/tests/testentrycompletion.c
+++ b/tests/testentrycompletion.c
@@ -417,7 +417,7 @@ main (int argc, char *argv[])
gtk_entry_completion_set_text_column (completion, 0);
/* Fill the completion dynamically */
- g_timeout_add (1000, (GSourceFunc) animation_timer, completion);
+ gdk_threads_add_timeout (1000, (GSourceFunc) animation_timer, completion);
/* Fourth entry */
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Model-less entry completion"), FALSE, FALSE, 0);
diff --git a/tests/testmenus.c b/tests/testmenus.c
index 81c1964203..86eda4bc46 100644
--- a/tests/testmenus.c
+++ b/tests/testmenus.c
@@ -151,7 +151,7 @@ main (int argc, char **argv)
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_widget_show (menuitem);
- g_timeout_add (250, change_item, submenu);
+ gdk_threads_add_timeout (250, change_item, submenu);
menuitem = gtk_menu_item_new_with_label ("bar");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4, TRUE));
diff --git a/tests/testmerge.c b/tests/testmerge.c
index 6832f759d6..8aa5002d5e 100644
--- a/tests/testmerge.c
+++ b/tests/testmerge.c
@@ -140,7 +140,7 @@ static void
toggle_dynamic (GtkWidget *button,
GtkUIManager *merge)
{
- g_timeout_add (2000, (GSourceFunc)delayed_toggle_dynamic, merge);
+ gdk_threads_add_timeout (2000, (GSourceFunc)delayed_toggle_dynamic, merge);
}
static void
diff --git a/tests/testsocket_common.c b/tests/testsocket_common.c
index a4760893da..0879865c8d 100644
--- a/tests/testsocket_common.c
+++ b/tests/testsocket_common.c
@@ -97,7 +97,7 @@ blink (GtkWidget *widget,
if (!blink_timeout)
{
- blink_timeout = g_timeout_add (1000, blink_cb, window);
+ blink_timeout = gdk_threads_add_timeout (1000, blink_cb, window);
gtk_widget_hide (window);
g_object_set_data (G_OBJECT (window), "blink", GUINT_TO_POINTER (blink_timeout));
diff --git a/tests/teststatusicon.c b/tests/teststatusicon.c
index 9a27492519..1256152e97 100755
--- a/tests/teststatusicon.c
+++ b/tests/teststatusicon.c
@@ -126,7 +126,7 @@ timeout_toggle_toggled (GtkToggleButton *toggle)
}
else
{
- timeout = g_timeout_add (2000, timeout_handler, NULL);
+ timeout = gdk_threads_add_timeout (2000, timeout_handler, NULL);
}
}
@@ -301,7 +301,7 @@ main (int argc, char **argv)
icons = g_slist_append (icons, icon);
- timeout = g_timeout_add (2000, timeout_handler, icon);
+ timeout = gdk_threads_add_timeout (2000, timeout_handler, icon);
}
gtk_main ();
diff --git a/tests/testtext.c b/tests/testtext.c
index 5ad9304bca..b1f6f532a0 100644
--- a/tests/testtext.c
+++ b/tests/testtext.c
@@ -2460,7 +2460,7 @@ buffer_set_colors (Buffer *buffer,
gdouble hue = 0.0;
if (enabled && buffer->color_cycle_timeout == 0)
- buffer->color_cycle_timeout = g_timeout_add (200, color_cycle_timeout, buffer);
+ buffer->color_cycle_timeout = gdk_threads_add_timeout (200, color_cycle_timeout, buffer);
else if (!enabled && buffer->color_cycle_timeout != 0)
{
g_source_remove (buffer->color_cycle_timeout);
diff --git a/tests/testtoolbar.c b/tests/testtoolbar.c
index 0818c5dcea..1e4985f8f6 100644
--- a/tests/testtoolbar.c
+++ b/tests/testtoolbar.c
@@ -608,7 +608,7 @@ main (gint argc, gchar **argv)
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), NULL);
add_item_to_list (store, item, "New");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
- g_timeout_add (3000, (GSourceFunc) timeout_cb, item);
+ gdk_threads_add_timeout (3000, (GSourceFunc) timeout_cb, item);
gtk_tool_item_set_expand (item, TRUE);
menu = gtk_menu_new ();
@@ -626,7 +626,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);
- g_timeout_add (3000, (GSourceFunc) timeout_cb1, item);
+ gdk_threads_add_timeout (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 1af0b6e72c..e5ebacd899 100644
--- a/tests/testtreeflow.c
+++ b/tests/testtreeflow.c
@@ -168,7 +168,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_all (window);
- g_timeout_add (1000, (GSourceFunc) futz, NULL);
+ gdk_threads_add_timeout (1000, (GSourceFunc) futz, NULL);
gtk_main ();
return 0;
}