summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-10-24 12:19:27 +0200
committerraveit65 <[email protected]>2022-01-09 14:24:00 +0100
commitb7fd397eb4a7a17a671b29e818b63718ab618b63 (patch)
tree1fb37aeff930bf1a185ead5e3e196d72286e17fc
parente25ac2b7fe574063881d12beadc7fc6b52ad0779 (diff)
downloadatril-b7fd397eb4a7a17a671b29e818b63718ab618b63.tar.bz2
atril-b7fd397eb4a7a17a671b29e818b63718ab618b63.tar.xz
Use GLib's new g_clear_signal_handler() function to simplify code
-rw-r--r--cut-n-paste/toolbar-editor/egg-toolbar-editor.c6
-rw-r--r--libmisc/ev-page-action-widget.c13
2 files changed, 19 insertions, 0 deletions
diff --git a/cut-n-paste/toolbar-editor/egg-toolbar-editor.c b/cut-n-paste/toolbar-editor/egg-toolbar-editor.c
index 551bbde3..cb07011f 100644
--- a/cut-n-paste/toolbar-editor/egg-toolbar-editor.c
+++ b/cut-n-paste/toolbar-editor/egg-toolbar-editor.c
@@ -149,6 +149,11 @@ egg_toolbar_editor_disconnect_model (EggToolbarEditor *t)
{
handler = priv->sig_handlers[i];
+#if GLIB_CHECK_VERSION(2,62,0)
+ if ((handler == 0) || !g_signal_handler_is_connected (model, handler))
+ continue;
+ g_clear_signal_handler (&handler, model);
+#else
if (handler != 0)
{
if (g_signal_handler_is_connected (model, handler))
@@ -158,6 +163,7 @@ egg_toolbar_editor_disconnect_model (EggToolbarEditor *t)
priv->sig_handlers[i] = 0;
}
+#endif
}
}
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;