Skip to content

Commit

Permalink
Silence gdk_threads_* deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Miranda committed Jun 2, 2018
1 parent a80821b commit c5d6c68
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 42 deletions.
5 changes: 3 additions & 2 deletions thunar/thunar-icon-factory.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <thunar/thunar-preferences.h>
#include <thunar/thunar-private.h>
#include <thunar/thunar-thumbnail-frame.h>
#include <thunar/thunar-util.h>



Expand Down Expand Up @@ -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;
}
Expand Down
9 changes: 5 additions & 4 deletions thunar/thunar-launcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <thunar/thunar-sendto-model.h>
#include <thunar/thunar-stock.h>
#include <thunar/thunar-device-monitor.h>
#include <thunar/thunar-util.h>
#include <thunar/thunar-window.h>


Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -1095,7 +1096,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
launcher, thunar_launcher_sendto_idle_destroy);
}

GDK_THREADS_LEAVE ();
THUNAR_THREADS_LEAVE

return FALSE;
}
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -1877,7 +1878,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
}
}

GDK_THREADS_LEAVE ();
THUNAR_THREADS_LEAVE

return FALSE;
}
Expand Down
4 changes: 2 additions & 2 deletions thunar/thunar-path-entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions thunar/thunar-renamer-model.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions thunar/thunar-renamer-progress.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <thunar/thunar-private.h>
#include <thunar/thunar-renamer-progress.h>
#include <thunar/thunar-util.h>



Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions thunar/thunar-shortcuts-model.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;

Expand All @@ -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; )
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions thunar/thunar-standard-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down Expand Up @@ -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))))
Expand Down Expand Up @@ -4007,7 +4007,7 @@ thunar_standard_view_drag_scroll_timer (gpointer user_data)
}
}

GDK_THREADS_LEAVE ();
THUNAR_THREADS_LEAVE

return TRUE;
}
Expand All @@ -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;
}
Expand Down
9 changes: 5 additions & 4 deletions thunar/thunar-tree-model.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <thunar/thunar-private.h>
#include <thunar/thunar-tree-model.h>
#include <thunar/thunar-device-monitor.h>
#include <thunar/thunar-util.h>



Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -1471,7 +1472,7 @@ thunar_tree_model_item_load_idle (gpointer user_data)
}
}

GDK_THREADS_LEAVE ();
THUNAR_THREADS_LEAVE

return FALSE;
}
Expand Down
13 changes: 7 additions & 6 deletions thunar/thunar-tree-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <thunar/thunar-simple-job.h>
#include <thunar/thunar-tree-model.h>
#include <thunar/thunar-tree-view.h>
#include <thunar/thunar-util.h>



Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)))
Expand Down Expand Up @@ -2711,7 +2712,7 @@ thunar_tree_view_drag_scroll_timer (gpointer user_data)
}
}

GDK_THREADS_LEAVE ();
THUNAR_THREADS_LEAVE

return TRUE;
}
Expand All @@ -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))
Expand All @@ -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;
}
Expand Down
5 changes: 3 additions & 2 deletions thunar/thunar-user.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <exo/exo.h>

#include <thunar/thunar-user.h>
#include <thunar/thunar-util.h>



Expand Down Expand Up @@ -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);
Expand All @@ -581,7 +582,7 @@ thunar_user_manager_flush_timer (gpointer user_data)
#endif
}

GDK_THREADS_LEAVE ();
THUNAR_THREADS_LEAVE

return TRUE;
}
Expand Down
10 changes: 10 additions & 0 deletions thunar/thunar-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@

#include <thunar/thunar-enum-types.h>

#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,
Expand Down
Loading

0 comments on commit c5d6c68

Please sign in to comment.