[nautilus] files-view: Remove custom signal handler disconnection
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] files-view: Remove custom signal handler disconnection
- Date: Thu, 9 Jul 2020 10:04:33 +0000 (UTC)
commit b0f53527bf789baad0239e3fde2b6bac09e60185
Author: Joshua Lee <lee son wai gmail com>
Date: Tue Jun 16 19:02:33 2020 +0100
files-view: Remove custom signal handler disconnection
GLib's new g_clear_signal_handler() allows us to concisely disconnect signal
handlers, negating the need for custom functions to do the same.
Fixes: #1522
src/nautilus-files-view.c | 53 +++++++++--------------------------------------
1 file changed, 10 insertions(+), 43 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 75ed250b8..2d8439283 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -190,11 +190,11 @@ typedef struct
guint update_interval;
guint64 last_queued;
- guint files_added_handler_id;
- guint files_changed_handler_id;
- guint load_error_handler_id;
- guint done_loading_handler_id;
- guint file_changed_handler_id;
+ gulong files_added_handler_id;
+ gulong files_changed_handler_id;
+ gulong load_error_handler_id;
+ gulong done_loading_handler_id;
+ gulong file_changed_handler_id;
/* Containers with FileAndDirectory* elements */
GList *new_added_files;
@@ -8713,39 +8713,6 @@ metadata_for_files_in_directory_ready_callback (NautilusDirectory *directory,
nautilus_profile_end (NULL);
}
-static void
-disconnect_handler (GObject *object,
- guint *id)
-{
- if (*id != 0)
- {
- g_signal_handler_disconnect (object, *id);
- *id = 0;
- }
-}
-
-static void
-disconnect_directory_handler (NautilusFilesView *view,
- guint *id)
-{
- NautilusFilesViewPrivate *priv;
-
- priv = nautilus_files_view_get_instance_private (view);
-
- disconnect_handler (G_OBJECT (priv->model), id);
-}
-
-static void
-disconnect_directory_as_file_handler (NautilusFilesView *view,
- guint *id)
-{
- NautilusFilesViewPrivate *priv;
-
- priv = nautilus_files_view_get_instance_private (view);
-
- disconnect_handler (G_OBJECT (priv->directory_as_file), id);
-}
-
static void
disconnect_model_handlers (NautilusFilesView *view)
{
@@ -8757,11 +8724,11 @@ disconnect_model_handlers (NautilusFilesView *view)
{
return;
}
- disconnect_directory_handler (view, &priv->files_added_handler_id);
- disconnect_directory_handler (view, &priv->files_changed_handler_id);
- disconnect_directory_handler (view, &priv->done_loading_handler_id);
- disconnect_directory_handler (view, &priv->load_error_handler_id);
- disconnect_directory_as_file_handler (view, &priv->file_changed_handler_id);
+ g_clear_signal_handler (&priv->files_added_handler_id, priv->model);
+ g_clear_signal_handler (&priv->files_changed_handler_id, priv->model);
+ g_clear_signal_handler (&priv->done_loading_handler_id, priv->model);
+ g_clear_signal_handler (&priv->load_error_handler_id, priv->model);
+ g_clear_signal_handler (&priv->file_changed_handler_id, priv->directory_as_file);
nautilus_file_cancel_call_when_ready (priv->directory_as_file,
metadata_for_directory_as_file_ready_callback,
view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]