summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2018-02-02 15:51:47 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2018-02-03 12:06:58 +0100
commitc655759cefa56efdb0cb943bb5dada3ff75a963c (patch)
treeef945ea7131b6419d00828fa8661d86691563d83 /tests
parent334acbfc39cc08869932ec046e4d13e6c4b64be6 (diff)
downloadgtk+-c655759cefa56efdb0cb943bb5dada3ff75a963c.tar.gz
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
Diffstat (limited to 'tests')
-rw-r--r--tests/testassistant.c2
-rw-r--r--tests/testcombo.c2
-rw-r--r--tests/testcombochange.c2
-rw-r--r--tests/testdnd.c6
-rw-r--r--tests/testentrycompletion.c2
-rw-r--r--tests/testgtk.c4
-rw-r--r--tests/testtoolbar.c4
-rw-r--r--tests/testtreeflow.c2
8 files changed, 11 insertions, 13 deletions
diff --git a/tests/testassistant.c b/tests/testassistant.c
index d0331071c5..6b2ae17c04 100644
--- a/tests/testassistant.c
+++ b/tests/testassistant.c
@@ -136,7 +136,7 @@ prepare_callback (GtkWidget *widget, GtkWidget *page)
{
gtk_assistant_set_page_complete (GTK_ASSISTANT (widget), page, FALSE);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (page), 0.0);
- gdk_threads_add_timeout (300, (GSourceFunc) progress_timeout, widget);
+ g_timeout_add (300, (GSourceFunc) progress_timeout, widget);
}
else
g_print ("prepare: %d\n", gtk_assistant_get_current_page (GTK_ASSISTANT (widget)));
diff --git a/tests/testcombo.c b/tests/testcombo.c
index a56c3b98c3..e60e361d06 100644
--- a/tests/testcombo.c
+++ b/tests/testcombo.c
@@ -1347,7 +1347,7 @@ main (int argc, char **argv)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
#if 1
- gdk_threads_add_timeout (1000, (GSourceFunc) capital_animation, model);
+ g_timeout_add (1000, (GSourceFunc) capital_animation, model);
#endif
/* Aligned Food */
diff --git a/tests/testcombochange.c b/tests/testcombochange.c
index 78d69e70e0..6b13d8d163 100644
--- a/tests/testcombochange.c
+++ b/tests/testcombochange.c
@@ -215,7 +215,7 @@ on_animate (void)
{
n_animations += 20;
- timer = gdk_threads_add_timeout (1000, (GSourceFunc) animation_timer, NULL);
+ timer = g_timeout_add (1000, (GSourceFunc) animation_timer, NULL);
}
int
diff --git a/tests/testdnd.c b/tests/testdnd.c
index cda048f4b3..165ca76e50 100644
--- a/tests/testdnd.c
+++ b/tests/testdnd.c
@@ -469,7 +469,7 @@ popup_leave (GtkWidget *widget,
if (!popdown_timer)
{
g_print ("added popdown\n");
- popdown_timer = gdk_threads_add_timeout (500, popdown_cb, NULL);
+ popdown_timer = g_timeout_add (500, popdown_cb, NULL);
}
}
}
@@ -519,7 +519,7 @@ popup_cb (gpointer data)
popped_up = TRUE;
}
- popdown_timer = gdk_threads_add_timeout (500, popdown_cb, NULL);
+ popdown_timer = g_timeout_add (500, popdown_cb, NULL);
g_print ("added popdown\n");
popup_timer = FALSE;
@@ -535,7 +535,7 @@ popsite_motion (GtkWidget *widget,
guint time)
{
if (!popup_timer)
- popup_timer = gdk_threads_add_timeout (500, popup_cb, NULL);
+ popup_timer = g_timeout_add (500, popup_cb, NULL);
return TRUE;
}
diff --git a/tests/testentrycompletion.c b/tests/testentrycompletion.c
index 8d30b70d09..09a2b4dbab 100644
--- a/tests/testentrycompletion.c
+++ b/tests/testentrycompletion.c
@@ -389,7 +389,7 @@ main (int argc, char *argv[])
gtk_entry_completion_set_text_column (completion, 0);
/* Fill the completion dynamically */
- gdk_threads_add_timeout (1000, (GSourceFunc) animation_timer, completion);
+ g_timeout_add (1000, (GSourceFunc) animation_timer, completion);
/* Fourth entry */
gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new ("Model-less entry completion"));
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 11d72949e7..65d9b2cabf 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -2884,9 +2884,7 @@ entry_toggle_progress (GtkWidget *checkbutton,
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton)))
{
- guint timeout = gdk_threads_add_timeout (100,
- entry_progress_timeout,
- entry);
+ guint timeout = g_timeout_add (100, entry_progress_timeout, entry);
g_object_set_data_full (G_OBJECT (entry), "timeout-id",
GUINT_TO_POINTER (timeout),
entry_remove_timeout);
diff --git a/tests/testtoolbar.c b/tests/testtoolbar.c
index 8fbad8e186..c370e5550c 100644
--- a/tests/testtoolbar.c
+++ b/tests/testtoolbar.c
@@ -513,7 +513,7 @@ main (gint argc, gchar **argv)
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), "Custom label");
add_item_to_list (store, item, "New");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
- gdk_threads_add_timeout (3000, (GSourceFunc) timeout_cb, item);
+ g_timeout_add (3000, (GSourceFunc) timeout_cb, item);
gtk_tool_item_set_expand (item, TRUE);
menu = gtk_menu_new ();
@@ -533,7 +533,7 @@ main (gint argc, gchar **argv)
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (item), menu);
add_item_to_list (store, item, "Open");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
- gdk_threads_add_timeout (3000, (GSourceFunc) timeout_cb1, item);
+ g_timeout_add (3000, (GSourceFunc) timeout_cb1, item);
menu = gtk_menu_new ();
for (i = 0; i < 20; i++)
diff --git a/tests/testtreeflow.c b/tests/testtreeflow.c
index 60d6ff7bef..6a6e4cca96 100644
--- a/tests/testtreeflow.c
+++ b/tests/testtreeflow.c
@@ -165,7 +165,7 @@ main (int argc, char *argv[])
g_signal_connect (button, "realize", G_CALLBACK (gtk_widget_grab_focus), NULL);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 400);
gtk_widget_show (window);
- gdk_threads_add_timeout (1000, (GSourceFunc) futz, NULL);
+ g_timeout_add (1000, (GSourceFunc) futz, NULL);
gtk_main ();
return 0;
}