diff options
author | rbuj <[email protected]> | 2021-10-24 12:19:27 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2022-01-09 14:24:00 +0100 |
commit | b7fd397eb4a7a17a671b29e818b63718ab618b63 (patch) | |
tree | 1fb37aeff930bf1a185ead5e3e196d72286e17fc /libmisc | |
parent | e25ac2b7fe574063881d12beadc7fc6b52ad0779 (diff) | |
download | atril-b7fd397eb4a7a17a671b29e818b63718ab618b63.tar.bz2 atril-b7fd397eb4a7a17a671b29e818b63718ab618b63.tar.xz |
Use GLib's new g_clear_signal_handler() function to simplify code
Diffstat (limited to 'libmisc')
-rw-r--r-- | libmisc/ev-page-action-widget.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libmisc/ev-page-action-widget.c b/libmisc/ev-page-action-widget.c index c24d9b97..30654d19 100644 --- a/libmisc/ev-page-action-widget.c +++ b/libmisc/ev-page-action-widget.c @@ -202,11 +202,16 @@ ev_page_action_widget_document_changed_cb (EvDocumentModel *model, g_object_unref (action_widget->document); action_widget->document = document; +#if GLIB_CHECK_VERSION(2,62,0) + g_clear_signal_handler (&action_widget->signal_id, + action_widget->doc_model); +#else if (action_widget->signal_id > 0) { g_signal_handler_disconnect (action_widget->doc_model, action_widget->signal_id); action_widget->signal_id = 0; } +#endif action_widget->signal_id = g_signal_connect_object (action_widget->doc_model, "page-changed", @@ -240,6 +245,13 @@ ev_page_action_widget_finalize (GObject *object) EvPageActionWidget *action_widget = EV_PAGE_ACTION_WIDGET (object); if (action_widget->doc_model != NULL) { +#if GLIB_CHECK_VERSION(2,62,0) + if ((action_widget->signal_id != 0) && + (g_signal_handler_is_connected (action_widget->doc_model, + action_widget->signal_id))) + g_clear_signal_handler (&action_widget->signal_id, + action_widget->doc_model); +#else if (action_widget->signal_id > 0) { if (g_signal_handler_is_connected(action_widget->doc_model, action_widget->signal_id)) @@ -247,6 +259,7 @@ ev_page_action_widget_finalize (GObject *object) action_widget->signal_id); action_widget->signal_id = 0; } +#endif g_object_remove_weak_pointer (G_OBJECT (action_widget->doc_model), (gpointer)&action_widget->doc_model); action_widget->doc_model = NULL; |