diff --git a/thunar/thunar-icon-factory.c b/thunar/thunar-icon-factory.c index 4ec16c9c7..6bc08477d 100644 --- a/thunar/thunar-icon-factory.c +++ b/thunar/thunar-icon-factory.c @@ -35,6 +35,7 @@ #include #include #include +#include @@ -332,12 +333,12 @@ thunar_icon_factory_sweep_timer (gpointer user_data) _thunar_return_val_if_fail (THUNAR_IS_ICON_FACTORY (factory), FALSE); - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* ditch all icons whose ref_count is 1 */ g_hash_table_foreach_remove (factory->icon_cache, (GHRFunc) thunar_icon_check_sweep, factory); - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return FALSE; } diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c index f6d434e3e..8fed3edf1 100644 --- a/thunar/thunar-launcher.c +++ b/thunar/thunar-launcher.c @@ -42,6 +42,7 @@ #include #include #include +#include #include @@ -783,7 +784,7 @@ thunar_launcher_update_idle (gpointer data) if (G_UNLIKELY (launcher->ui_manager == NULL)) return FALSE; - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* drop the previous addons ui controls from the UI manager */ if (G_LIKELY (launcher->ui_addons_merge_id != 0)) @@ -1095,7 +1096,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS launcher, thunar_launcher_sendto_idle_destroy); } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return FALSE; } @@ -1739,7 +1740,7 @@ thunar_launcher_sendto_idle (gpointer user_data) if (launcher->ui_manager == NULL) return FALSE; - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* determine the number of selected files and check whether atleast one of these * files is located in the trash (to en-/disable the "sendto-desktop" action). @@ -1877,7 +1878,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS } } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return FALSE; } diff --git a/thunar/thunar-path-entry.c b/thunar/thunar-path-entry.c index 0d5d959a2..ca7323414 100644 --- a/thunar/thunar-path-entry.c +++ b/thunar/thunar-path-entry.c @@ -1092,7 +1092,7 @@ thunar_path_entry_check_completion_idle (gpointer user_data) ThunarPathEntry *path_entry = THUNAR_PATH_ENTRY (user_data); const gchar *text; - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* check if the user entered at least part of a filename */ text = gtk_entry_get_text (GTK_ENTRY (path_entry)); @@ -1102,7 +1102,7 @@ thunar_path_entry_check_completion_idle (gpointer user_data) thunar_path_entry_common_prefix_append (path_entry, TRUE); } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return FALSE; } diff --git a/thunar/thunar-renamer-model.c b/thunar/thunar-renamer-model.c index e8fd4cff1..82f12a4ff 100644 --- a/thunar/thunar-renamer-model.c +++ b/thunar/thunar-renamer-model.c @@ -899,7 +899,7 @@ thunar_renamer_model_update_idle (gpointer user_data) gchar *name; GList *lp; - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* don't do anything if the model is frozen */ if (G_LIKELY (!renamer_model->frozen)) @@ -961,7 +961,7 @@ thunar_renamer_model_update_idle (gpointer user_data) } } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE /* keep the idle source as long as any item changed */ return changed; diff --git a/thunar/thunar-renamer-progress.c b/thunar/thunar-renamer-progress.c index 4bcdac274..ef628b3e0 100644 --- a/thunar/thunar-renamer-progress.c +++ b/thunar/thunar-renamer-progress.c @@ -23,6 +23,7 @@ #include #include +#include @@ -143,7 +144,7 @@ thunar_renamer_progress_next_idle (gpointer user_data) guint n_total; GList *first; - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* check if we have still pairs to go */ if (G_LIKELY (renamer_progress->pairs_todo != NULL)) @@ -266,7 +267,7 @@ thunar_renamer_progress_next_idle (gpointer user_data) if (G_UNLIKELY (renamer_progress->pairs_todo == NULL)) g_main_loop_quit (renamer_progress->next_idle_loop); - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE /* keep the idle source alive as long as we have anything to do */ return (renamer_progress->pairs_todo != NULL); diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c index 07c25c46f..514d15e47 100644 --- a/thunar/thunar-shortcuts-model.c +++ b/thunar/thunar-shortcuts-model.c @@ -1296,7 +1296,7 @@ thunar_shortcuts_model_load (gpointer data) _thunar_return_val_if_fail (THUNAR_IS_SHORTCUTS_MODEL (model), FALSE); - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* parse the bookmarks */ thunar_util_load_bookmarks (model->bookmarks_file, @@ -1306,7 +1306,7 @@ thunar_shortcuts_model_load (gpointer data) /* update the visibility */ thunar_shortcuts_model_header_visibility (model); - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE model->bookmarks_idle_id = 0; @@ -1326,7 +1326,7 @@ thunar_shortcuts_model_reload (gpointer data) _thunar_return_val_if_fail (THUNAR_IS_SHORTCUTS_MODEL (model), FALSE); - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* drop all existing user-defined shortcuts from the model */ for (idx = 0, lp = model->shortcuts; lp != NULL; ) @@ -1357,7 +1357,7 @@ thunar_shortcuts_model_reload (gpointer data) } } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE /* load new bookmarks */ return thunar_shortcuts_model_load (data); diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c index 49fd16304..3a9c5fa85 100644 --- a/thunar/thunar-standard-view.c +++ b/thunar/thunar-standard-view.c @@ -2133,7 +2133,7 @@ thunar_standard_view_update_statusbar_text_idle (gpointer data) _thunar_return_val_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view), FALSE); - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* clear the current status text (will be recalculated on-demand) */ g_free (standard_view->priv->statusbar_text); @@ -2144,7 +2144,7 @@ thunar_standard_view_update_statusbar_text_idle (gpointer data) /* tell everybody that the statusbar text may have changed */ g_object_notify_by_pspec (G_OBJECT (standard_view), standard_view_props[PROP_STATUSBAR_TEXT]); - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return FALSE; } @@ -3957,7 +3957,7 @@ thunar_standard_view_drag_scroll_timer (gpointer user_data) gint y, x; gint w, h; - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* verify that we are realized */ if (G_LIKELY (gtk_widget_get_realized (GTK_WIDGET (standard_view)))) @@ -4007,7 +4007,7 @@ thunar_standard_view_drag_scroll_timer (gpointer user_data) } } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return TRUE; } @@ -4028,9 +4028,9 @@ thunar_standard_view_drag_timer (gpointer user_data) ThunarStandardView *standard_view = THUNAR_STANDARD_VIEW (user_data); /* fire up the context menu */ - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER thunar_standard_view_context_menu (standard_view); - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return FALSE; } diff --git a/thunar/thunar-tree-model.c b/thunar/thunar-tree-model.c index fc4a5c1b5..52f4fe829 100644 --- a/thunar/thunar-tree-model.c +++ b/thunar/thunar-tree-model.c @@ -37,6 +37,7 @@ #include #include #include +#include @@ -918,13 +919,13 @@ thunar_tree_model_cleanup_idle (gpointer user_data) { ThunarTreeModel *model = THUNAR_TREE_MODEL (user_data); - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* walk through the tree and release all the nodes with a ref count of 0 */ g_node_traverse (model->root, G_PRE_ORDER, G_TRAVERSE_ALL, -1, thunar_tree_model_node_traverse_cleanup, model); - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return FALSE; } @@ -1434,7 +1435,7 @@ thunar_tree_model_item_load_idle (gpointer user_data) _thunar_return_val_if_fail (node->children == NULL || G_NODE_HAS_DUMMY (node), FALSE); #endif - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* check if we don't have a file yet and this is a mounted volume */ if (item->file == NULL && item->device != NULL && thunar_device_is_mounted (item->device)) @@ -1471,7 +1472,7 @@ thunar_tree_model_item_load_idle (gpointer user_data) } } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return FALSE; } diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c index b11f4a83f..2abcb7df3 100644 --- a/thunar/thunar-tree-view.c +++ b/thunar/thunar-tree-view.c @@ -44,6 +44,7 @@ #include #include #include +#include @@ -2535,7 +2536,7 @@ thunar_tree_view_cursor_idle (gpointer user_data) ThunarFile *file; gboolean done = TRUE; - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* for easier navigation, we sometimes want to force/keep selection of a certain path */ if (view->select_path != NULL) @@ -2610,7 +2611,7 @@ thunar_tree_view_cursor_idle (gpointer user_data) gtk_tree_path_free (path); } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return !done; } @@ -2640,7 +2641,7 @@ thunar_tree_view_drag_scroll_timer (gpointer user_data) gint offset; gint y, h; - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* verify that we are realized */ if (gtk_widget_get_realized (GTK_WIDGET (view))) @@ -2711,7 +2712,7 @@ thunar_tree_view_drag_scroll_timer (gpointer user_data) } } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return TRUE; } @@ -2732,7 +2733,7 @@ thunar_tree_view_expand_timer (gpointer user_data) ThunarTreeView *view = THUNAR_TREE_VIEW (user_data); GtkTreePath *path; - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* cancel the drag autoscroll timer when expanding a row */ if (G_UNLIKELY (view->drag_scroll_timer_id != 0)) @@ -2747,7 +2748,7 @@ thunar_tree_view_expand_timer (gpointer user_data) gtk_tree_path_free (path); } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return FALSE; } diff --git a/thunar/thunar-user.c b/thunar/thunar-user.c index 78add29fe..ceba7b0dc 100644 --- a/thunar/thunar-user.c +++ b/thunar/thunar-user.c @@ -51,6 +51,7 @@ #include #include +#include @@ -558,7 +559,7 @@ thunar_user_manager_flush_timer (gpointer user_data) ThunarUserManager *manager = THUNAR_USER_MANAGER (user_data); guint size = 0; - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* drop all cached groups */ size += g_hash_table_foreach_remove (manager->groups, (GHRFunc) gtk_true, NULL); @@ -581,7 +582,7 @@ thunar_user_manager_flush_timer (gpointer user_data) #endif } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return TRUE; } diff --git a/thunar/thunar-util.h b/thunar/thunar-util.h index 5449f0c3d..d0f277c66 100644 --- a/thunar/thunar-util.h +++ b/thunar/thunar-util.h @@ -24,6 +24,16 @@ #include +#define THUNAR_THREADS_ENTER \ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + gdk_threads_enter(); \ +G_GNUC_END_IGNORE_DEPRECATIONS + +#define THUNAR_THREADS_LEAVE \ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + gdk_threads_leave (); \ +G_GNUC_END_IGNORE_DEPRECATIONS + G_BEGIN_DECLS; typedef void (*ThunarBookmarksFunc) (GFile *file, diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index e0d0cf9f9..153c11478 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -2185,7 +2185,7 @@ thunar_window_bookmark_merge (gpointer user_data) _thunar_return_val_if_fail (THUNAR_IS_WINDOW (window), FALSE); - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* remove old actions */ if (window->bookmark_items_actions_merge_id != 0) @@ -2233,7 +2233,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS window->bookmark_reload_idle_id = 0; - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return FALSE; } @@ -3627,10 +3627,10 @@ thunar_window_merge_idle (gpointer user_data) ThunarWindow *window = THUNAR_WINDOW (user_data); /* merge custom preferences from the providers */ - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER thunar_window_merge_custom_preferences (window); thunar_window_merge_go_actions (window); - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE thunar_window_bookmark_merge (window); @@ -3670,7 +3670,7 @@ thunar_window_save_geometry_timer (gpointer user_data) gint width; gint height; - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* check if we should remember the window geometry */ g_object_get (G_OBJECT (window->preferences), "misc-remember-geometry", &remember_geometry, NULL); @@ -3700,7 +3700,7 @@ thunar_window_save_geometry_timer (gpointer user_data) } } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return FALSE; } diff --git a/thunarx/thunarx-private.h b/thunarx/thunarx-private.h index 1f9d714fe..d0658cc51 100644 --- a/thunarx/thunarx-private.h +++ b/thunarx/thunarx-private.h @@ -27,6 +27,16 @@ #include +#define THUNAR_THREADS_ENTER \ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + gdk_threads_enter(); \ +G_GNUC_END_IGNORE_DEPRECATIONS + +#define THUNAR_THREADS_LEAVE \ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + gdk_threads_leave (); \ +G_GNUC_END_IGNORE_DEPRECATIONS + G_BEGIN_DECLS #define I_(string) (g_intern_static_string ((string))) diff --git a/thunarx/thunarx-provider-factory.c b/thunarx/thunarx-provider-factory.c index 7764b55fb..94b115450 100644 --- a/thunarx/thunarx-provider-factory.c +++ b/thunarx/thunarx-provider-factory.c @@ -214,7 +214,7 @@ thunarx_provider_factory_timer (gpointer user_data) ThunarxProviderInfo *info; gint n; - GDK_THREADS_ENTER (); +THUNAR_THREADS_ENTER /* drop all providers for which only we keep a reference */ for (n = factory->n_infos; --n >= 0; ) @@ -227,7 +227,7 @@ thunarx_provider_factory_timer (gpointer user_data) } } - GDK_THREADS_LEAVE (); +THUNAR_THREADS_LEAVE return TRUE; }