From 07be2453e059c1cf0a5a2f8f7883e7de84411e97 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 5 Aug 2012 20:59:18 -0400 Subject: Remove all GDK threads usage. According to [1], we don't need to worry about GDK's global lock since we don't call gdk_threads_init() or gdk_threads_set_lock_functions(). The GDK threads API is being aggressively deprecated by GTK+ developers so let's just abandon it entirely. I've never really understood when you're supposed to use it or not use it anyway, so it's good to be rid of this confusion. [1] https://mail.gnome.org/archives/desktop-devel-list/2012-August/msg00005.html --- calendar/gui/e-day-view.c | 4 ---- calendar/gui/e-meeting-time-sel.c | 11 ++--------- e-util/e-selection.c | 15 +++------------ e-util/e-util.c | 2 +- libgnomecanvas/gnome-canvas.c | 4 ---- plugins/publish-calendar/publish-calendar.c | 2 -- smclient/eggsmclient-win32.c | 6 ------ smclient/eggsmclient-xsmp.c | 7 ------- widgets/misc/e-calendar-item.c | 3 --- widgets/misc/e-calendar.c | 7 ------- widgets/misc/e-canvas.c | 4 ---- widgets/misc/e-mail-identity-combo-box.c | 2 +- widgets/misc/e-mail-signature-combo-box.c | 2 +- widgets/misc/e-mail-signature-tree-view.c | 2 +- widgets/misc/e-map.c | 2 +- 15 files changed, 10 insertions(+), 63 deletions(-) diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 620b664f11..c2b7fc78fd 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -7131,11 +7131,8 @@ e_day_view_auto_scroll_handler (gpointer data) day_view = E_DAY_VIEW (data); - GDK_THREADS_ENTER (); - if (day_view->auto_scroll_delay > 0) { day_view->auto_scroll_delay--; - GDK_THREADS_LEAVE (); return TRUE; } @@ -7189,7 +7186,6 @@ e_day_view_auto_scroll_handler (gpointer data) } } - GDK_THREADS_LEAVE (); return TRUE; } diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index 79acc1887a..eb7a1fc67e 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -2794,13 +2794,9 @@ e_meeting_time_selector_timeout_handler (gpointer data) mts = E_MEETING_TIME_SELECTOR (data); - GDK_THREADS_ENTER (); - /* Return if we don't need to scroll yet. */ - if (mts->scroll_count-- > 0) { - GDK_THREADS_LEAVE (); + if (mts->scroll_count-- > 0) return TRUE; - } /* Get the x coords of visible part of the canvas. */ gnome_canvas_get_scroll_offsets (GNOME_CANVAS (mts->display_main), @@ -2871,10 +2867,8 @@ e_meeting_time_selector_timeout_handler (gpointer data) time_to_set = &mts->meeting_end_time; /* If the time is unchanged, just return. */ - if (e_meeting_time_compare_times (time_to_set, &drag_time) == 0) { - GDK_THREADS_LEAVE (); + if (e_meeting_time_compare_times (time_to_set, &drag_time) == 0) goto scroll; - } /* Don't let an empty occur for all day events */ if (mts->all_day @@ -2929,7 +2923,6 @@ e_meeting_time_selector_timeout_handler (gpointer data) gnome_canvas_scroll_to (GNOME_CANVAS (mts->display_top), scroll_x, scroll_y); - GDK_THREADS_LEAVE (); return TRUE; } diff --git a/e-util/e-selection.c b/e-util/e-selection.c index 1c5d11b6e4..041b30c4f2 100644 --- a/e-util/e-selection.c +++ b/e-util/e-selection.c @@ -704,11 +704,8 @@ e_clipboard_wait_for_calendar (GtkClipboard *clipboard) clipboard, (GtkClipboardTextReceivedFunc) clipboard_wait_for_text_cb, &results); - if (g_main_loop_is_running (results.loop)) { - GDK_THREADS_LEAVE (); + if (g_main_loop_is_running (results.loop)) g_main_loop_run (results.loop); - GDK_THREADS_ENTER (); - } g_main_loop_unref (results.loop); @@ -729,11 +726,8 @@ e_clipboard_wait_for_directory (GtkClipboard *clipboard) clipboard, (GtkClipboardTextReceivedFunc) clipboard_wait_for_text_cb, &results); - if (g_main_loop_is_running (results.loop)) { - GDK_THREADS_LEAVE (); + if (g_main_loop_is_running (results.loop)) g_main_loop_run (results.loop); - GDK_THREADS_ENTER (); - } g_main_loop_unref (results.loop); @@ -754,11 +748,8 @@ e_clipboard_wait_for_html (GtkClipboard *clipboard) clipboard, (GtkClipboardTextReceivedFunc) clipboard_wait_for_text_cb, &results); - if (g_main_loop_is_running (results.loop)) { - GDK_THREADS_LEAVE (); + if (g_main_loop_is_running (results.loop)) g_main_loop_run (results.loop); - GDK_THREADS_ENTER (); - } g_main_loop_unref (results.loop); diff --git a/e-util/e-util.c b/e-util/e-util.c index a2221a332a..4f9983cfcc 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -129,7 +129,7 @@ window_configure_event_cb (GtkWindow *window, if (data->timeout_id > 0) g_source_remove (data->timeout_id); - data->timeout_id = gdk_threads_add_timeout_seconds ( + data->timeout_id = g_timeout_add_seconds ( 1, (GSourceFunc) window_update_settings, data); return FALSE; diff --git a/libgnomecanvas/gnome-canvas.c b/libgnomecanvas/gnome-canvas.c index 62cc77268a..24d44e0af9 100644 --- a/libgnomecanvas/gnome-canvas.c +++ b/libgnomecanvas/gnome-canvas.c @@ -2788,8 +2788,6 @@ idle_handler (gpointer data) { GnomeCanvas *canvas; - GDK_THREADS_ENTER (); - canvas = GNOME_CANVAS (data); do_update (canvas); @@ -2797,8 +2795,6 @@ idle_handler (gpointer data) /* Reset idle id */ canvas->idle_id = 0; - GDK_THREADS_LEAVE (); - return FALSE; } diff --git a/plugins/publish-calendar/publish-calendar.c b/plugins/publish-calendar/publish-calendar.c index 681b1fbe7a..30f376036f 100644 --- a/plugins/publish-calendar/publish-calendar.c +++ b/plugins/publish-calendar/publish-calendar.c @@ -377,7 +377,6 @@ ask_question (GMountOperation *op, primary = g_strndup (message, strlen (message) - strlen (primary)); } - gdk_threads_enter (); dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", primary); @@ -409,7 +408,6 @@ ask_question (GMountOperation *op, } gtk_widget_destroy (GTK_WIDGET (dialog)); - gdk_threads_leave (); } static void diff --git a/smclient/eggsmclient-win32.c b/smclient/eggsmclient-win32.c index b404a490cc..5176a6c592 100644 --- a/smclient/eggsmclient-win32.c +++ b/smclient/eggsmclient-win32.c @@ -182,9 +182,7 @@ sm_client_win32_end_session (EggSMClient *client, static gboolean emit_quit_requested (gpointer smclient) { - gdk_threads_enter (); egg_sm_client_quit_requested (smclient); - gdk_threads_leave (); return FALSE; } @@ -194,9 +192,7 @@ emit_quit (gpointer smclient) { EggSMClientWin32 *win32 = smclient; - gdk_threads_enter (); egg_sm_client_quit (smclient); - gdk_threads_leave (); SetEvent (win32->response_event); return FALSE; @@ -207,9 +203,7 @@ emit_quit_cancelled (gpointer smclient) { EggSMClientWin32 *win32 = smclient; - gdk_threads_enter (); egg_sm_client_quit_cancelled (smclient); - gdk_threads_leave (); SetEvent (win32->response_event); return FALSE; diff --git a/smclient/eggsmclient-xsmp.c b/smclient/eggsmclient-xsmp.c index 3622d95d89..dcaa574690 100644 --- a/smclient/eggsmclient-xsmp.c +++ b/smclient/eggsmclient-xsmp.c @@ -379,9 +379,7 @@ sm_client_xsmp_startup (EggSMClient *client, xsmp->client_id = g_strdup (ret_client_id); free (ret_client_id); - gdk_threads_enter (); gdk_x11_set_sm_client_id (xsmp->client_id); - gdk_threads_leave (); g_debug ("Got client ID \"%s\"", xsmp->client_id); } @@ -552,8 +550,6 @@ idle_do_pending_events (gpointer data) EggSMClientXSMP *xsmp = data; EggSMClient *client = data; - gdk_threads_enter (); - xsmp->idle = 0; if (xsmp->waiting_to_emit_quit) @@ -577,7 +573,6 @@ idle_do_pending_events (gpointer data) } out: - gdk_threads_leave (); return FALSE; } @@ -1308,9 +1303,7 @@ process_ice_messages (IceConn ice_conn) { IceProcessMessagesStatus status; - gdk_threads_enter (); status = IceProcessMessages (ice_conn, NULL, NULL); - gdk_threads_leave (); switch (status) { diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c index 4e821e740b..87c25370d0 100644 --- a/widgets/misc/e-calendar-item.c +++ b/widgets/misc/e-calendar-item.c @@ -3623,8 +3623,6 @@ e_calendar_item_signal_emission_idle_cb (gpointer data) g_return_val_if_fail (E_IS_CALENDAR_ITEM (data), FALSE); - GDK_THREADS_ENTER (); - calitem = E_CALENDAR_ITEM (data); calitem->signal_emission_idle_id = 0; @@ -3645,7 +3643,6 @@ e_calendar_item_signal_emission_idle_cb (gpointer data) g_object_unref ((calitem)); - GDK_THREADS_LEAVE (); return FALSE; } diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c index a03c855971..fcad4edb4b 100644 --- a/widgets/misc/e-calendar.c +++ b/widgets/misc/e-calendar.c @@ -598,8 +598,6 @@ e_calendar_auto_move_year_handler (gpointer data) cal = E_CALENDAR (data); calitem = cal->calitem; - GDK_THREADS_ENTER (); - if (cal->timeout_delay > 0) { cal->timeout_delay--; } else { @@ -608,8 +606,6 @@ e_calendar_auto_move_year_handler (gpointer data) calitem->month + offset); } - GDK_THREADS_LEAVE (); - return TRUE; } @@ -625,8 +621,6 @@ e_calendar_auto_move_handler (gpointer data) cal = E_CALENDAR (data); calitem = cal->calitem; - GDK_THREADS_ENTER (); - if (cal->timeout_delay > 0) { cal->timeout_delay--; } else { @@ -635,7 +629,6 @@ e_calendar_auto_move_handler (gpointer data) calitem->month + offset); } - GDK_THREADS_LEAVE (); return TRUE; } diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index db6f12a150..00c069525b 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -732,8 +732,6 @@ idle_handler (gpointer data) { ECanvas *canvas; - GDK_THREADS_ENTER (); - canvas = E_CANVAS (data); do_reflow (canvas); @@ -742,8 +740,6 @@ idle_handler (gpointer data) g_signal_emit (canvas, signals[REFLOW], 0); - GDK_THREADS_LEAVE (); - return FALSE; } diff --git a/widgets/misc/e-mail-identity-combo-box.c b/widgets/misc/e-mail-identity-combo-box.c index cfd04b4eda..465ef3502f 100644 --- a/widgets/misc/e-mail-identity-combo-box.c +++ b/widgets/misc/e-mail-identity-combo-box.c @@ -71,7 +71,7 @@ mail_identity_combo_box_registry_changed (ESourceRegistry *registry, if (combo_box->priv->refresh_idle_id > 0) return; - combo_box->priv->refresh_idle_id = gdk_threads_add_idle ( + combo_box->priv->refresh_idle_id = g_idle_add ( (GSourceFunc) mail_identity_combo_box_refresh_idle_cb, combo_box); } diff --git a/widgets/misc/e-mail-signature-combo-box.c b/widgets/misc/e-mail-signature-combo-box.c index d7a7039344..26f87b95eb 100644 --- a/widgets/misc/e-mail-signature-combo-box.c +++ b/widgets/misc/e-mail-signature-combo-box.c @@ -76,7 +76,7 @@ mail_signature_combo_box_registry_changed (ESourceRegistry *registry, if (combo_box->priv->refresh_idle_id > 0) return; - combo_box->priv->refresh_idle_id = gdk_threads_add_idle ( + combo_box->priv->refresh_idle_id = g_idle_add ( (GSourceFunc) mail_signature_combo_box_refresh_idle_cb, combo_box); } diff --git a/widgets/misc/e-mail-signature-tree-view.c b/widgets/misc/e-mail-signature-tree-view.c index f1d5d03753..05a2580d78 100644 --- a/widgets/misc/e-mail-signature-tree-view.c +++ b/widgets/misc/e-mail-signature-tree-view.c @@ -72,7 +72,7 @@ mail_signature_tree_view_registry_changed (ESourceRegistry *registry, if (tree_view->priv->refresh_idle_id > 0) return; - tree_view->priv->refresh_idle_id = gdk_threads_add_idle ( + tree_view->priv->refresh_idle_id = g_idle_add ( (GSourceFunc) mail_signature_tree_view_refresh_idle_cb, tree_view); } diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c index 1d114d0c07..7732626760 100644 --- a/widgets/misc/e-map.c +++ b/widgets/misc/e-map.c @@ -204,7 +204,7 @@ e_map_start_tweening (EMap *map) map->priv->timer = g_timer_new (); map->priv->timer_current_ms = 0; - map->priv->tween_id = gdk_threads_add_timeout ( + map->priv->tween_id = g_timeout_add ( E_MAP_TWEEN_TIMEOUT_MSECS, e_map_do_tween_cb, map); g_timer_start (map->priv->timer); } -- cgit