diff options
author | rbuj <[email protected]> | 2021-10-24 13:28:21 +0200 |
---|---|---|
committer | Robert Antoni Buj Gelonch <[email protected]> | 2022-01-01 11:53:51 +0100 |
commit | 450596ee1c1a41be3e19aeadbbf86f06925a2dd0 (patch) | |
tree | 400d39e5ba85af06a1baa393b7d40c5c83cdd2b8 | |
parent | da404d7db23cdb62ae1bb6096031a06d712993d1 (diff) | |
download | pluma-450596ee1c1a41be3e19aeadbbf86f06925a2dd0.tar.bz2 pluma-450596ee1c1a41be3e19aeadbbf86f06925a2dd0.tar.xz |
pluma: use GLib's new g_clear_signal_handler() function
-rw-r--r-- | pluma/pluma-notebook.c | 5 | ||||
-rw-r--r-- | pluma/pluma-view.c | 5 | ||||
-rw-r--r-- | pluma/pluma-window.c | 29 |
3 files changed, 39 insertions, 0 deletions
diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c index 910506b5..1662690d 100644 --- a/pluma/pluma-notebook.c +++ b/pluma/pluma-notebook.c @@ -445,12 +445,17 @@ drag_stop (PlumaNotebook *notebook) } notebook->priv->drag_in_progress = FALSE; +#if GLIB_CHECK_VERSION(2,62,0) + g_clear_signal_handler (¬ebook->priv->motion_notify_handler_id, + notebook); +#else if (notebook->priv->motion_notify_handler_id != 0) { g_signal_handler_disconnect (G_OBJECT (notebook), notebook->priv->motion_notify_handler_id); notebook->priv->motion_notify_handler_id = 0; } +#endif } /* This function is only called during dnd, we don't need to emit TABS_REORDERED diff --git a/pluma/pluma-view.c b/pluma/pluma-view.c index 672cca83..88385c54 100644 --- a/pluma/pluma-view.c +++ b/pluma/pluma-view.c @@ -1226,12 +1226,17 @@ hide_search_window (PlumaView *view, gboolean cancel) if (view->priv->disable_popdown) return; +#if GLIB_CHECK_VERSION(2,62,0) + g_clear_signal_handler (&view->priv->search_entry_changed_id, + view->priv->search_entry); +#else if (view->priv->search_entry_changed_id != 0) { g_signal_handler_disconnect (view->priv->search_entry, view->priv->search_entry_changed_id); view->priv->search_entry_changed_id = 0; } +#endif if (view->priv->typeselect_flush_timeout != 0) { diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c index 1ca50ec9..b225a49b 100644 --- a/pluma/pluma-window.c +++ b/pluma/pluma-window.c @@ -170,12 +170,17 @@ pluma_window_dispose (GObject *object) /* Stop tracking removal of panes otherwise we always * end up with thinking we had no pane active, since they * should all be removed below */ +#if GLIB_CHECK_VERSION(2,62,0) + g_clear_signal_handler (&window->priv->bottom_panel_item_removed_handler_id, + window->priv->bottom_panel); +#else if (window->priv->bottom_panel_item_removed_handler_id != 0) { g_signal_handler_disconnect (window->priv->bottom_panel, window->priv->bottom_panel_item_removed_handler_id); window->priv->bottom_panel_item_removed_handler_id = 0; } +#endif /* First of all, force collection so that plugins * really drop some of the references. @@ -215,9 +220,14 @@ pluma_window_dispose (GObject *object) GtkRecentManager *recent_manager; recent_manager = gtk_recent_manager_get_default (); +#if GLIB_CHECK_VERSION(2,62,0) + g_clear_signal_handler (&window->priv->recents_handler_id, + recent_manager); +#else g_signal_handler_disconnect (recent_manager, window->priv->recents_handler_id); window->priv->recents_handler_id = 0; +#endif } if (window->priv->manager != NULL) @@ -2423,6 +2433,15 @@ notebook_switch_page (GtkNotebook *book, if (window->priv->active_tab) { +#if GLIB_CHECK_VERSION(2,62,0) + PlumaView *active_tab_view; + + active_tab_view = pluma_tab_get_view (window->priv->active_tab); + g_clear_signal_handler (&window->priv->tab_width_id, + active_tab_view); + g_clear_signal_handler (&window->priv->spaces_instead_of_tabs_id, + active_tab_view); +#else if (window->priv->tab_width_id) { g_signal_handler_disconnect (pluma_tab_get_view (window->priv->active_tab), @@ -2438,6 +2457,7 @@ notebook_switch_page (GtkNotebook *book, window->priv->spaces_instead_of_tabs_id = 0; } +#endif } /* set the active tab */ @@ -3324,6 +3344,14 @@ notebook_tab_removed (PlumaNotebook *notebook, G_CALLBACK (drop_uris_cb), NULL); +#if GLIB_CHECK_VERSION(2,62,0) + if (tab == pluma_window_get_active_tab (window)) + { + g_clear_signal_handler (&window->priv->tab_width_id, view); + g_clear_signal_handler (&window->priv->spaces_instead_of_tabs_id, view); + g_clear_signal_handler (&window->priv->language_changed_id, doc); + } +#else if (window->priv->tab_width_id && tab == pluma_window_get_active_tab (window)) { g_signal_handler_disconnect (view, window->priv->tab_width_id); @@ -3341,6 +3369,7 @@ notebook_tab_removed (PlumaNotebook *notebook, g_signal_handler_disconnect (doc, window->priv->language_changed_id); window->priv->language_changed_id = 0; } +#endif g_return_if_fail (window->priv->num_tabs >= 0); if (window->priv->num_tabs == 0) |