Commit 9f00effd authored by Guido Gunther's avatar Guido Gunther Committed by Guido Gunther
Browse files

Use g_clear_signal_handler



We can rely on glib 2.62 now.
Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
parent 5fdc69ef
Pipeline #67351 passed with stages
in 41 minutes and 12 seconds
......@@ -121,8 +121,8 @@ phosh_app_grid_button_finalize (GObject *object)
g_clear_object (&priv->actions);
g_clear_object (&priv->action_map);
phosh_clear_handler (&priv->favorite_changed_watcher,
phosh_favorite_list_model_get_default ());
g_clear_signal_handler (&priv->favorite_changed_watcher,
phosh_favorite_list_model_get_default ());
G_OBJECT_CLASS (phosh_app_grid_button_parent_class)->finalize (object);
}
......@@ -468,7 +468,7 @@ phosh_app_grid_button_set_app_info (PhoshAppGridButton *self,
list = phosh_favorite_list_model_get_default ();
phosh_clear_handler (&priv->favorite_changed_watcher, list);
g_clear_signal_handler (&priv->favorite_changed_watcher, list);
if (info) {
priv->info = g_object_ref (info);
......
......@@ -52,8 +52,8 @@ G_DEFINE_TYPE (PhoshNotificationBanner, phosh_notification_banner, PHOSH_TYPE_LA
static void
clear_handler (PhoshNotificationBanner *self)
{
phosh_clear_handler (&self->handler_expired, self->notification);
phosh_clear_handler (&self->handler_closed, self->notification);
g_clear_signal_handler (&self->handler_expired, self->notification);
g_clear_signal_handler (&self->handler_closed, self->notification);
}
......
......@@ -57,7 +57,7 @@ phosh_notification_frame_finalize (GObject *object)
/* Don't clear bindings, they're already unref'd before here */
phosh_clear_handler (&self->model_watch, self->model);
g_clear_signal_handler (&self->model_watch, self->model);
g_clear_object (&self->model);
......
......@@ -39,28 +39,6 @@ phosh_fix_app_id (const char *app_id)
return g_strdup (app_id);
}
/**
* phosh_clear_handler:
* @handler: the signal handler to disconnect
* @object: the #GObject to remove the handler from
*
* Emulates g_clear_signal_handler for pre-2.62 GLib
*
* @handler is zerod when removed, can be called on a zerod @handler
*/
void
phosh_clear_handler (gulong *handler, gpointer object)
{
g_return_if_fail (handler);
g_return_if_fail (G_IS_OBJECT (object));
if (*handler > 0) {
g_signal_handler_disconnect (object, *handler);
*handler = 0;
}
}
/**
* phosh_munge_app_id:
* @app_id: the app_id
......
......@@ -13,6 +13,5 @@
void phosh_cp_widget_destroy (void *widget);
char *phosh_fix_app_id (const char *app_id);
void phosh_clear_handler (gulong *handler, gpointer object);
gchar *phosh_munge_app_id (const gchar *app_id);
gboolean phosh_find_systemd_session (char **session_id);
......@@ -338,13 +338,13 @@ static void
phosh_wwan_mm_destroy_modem (PhoshWWanMM *self)
{
if (self->proxy) {
phosh_clear_handler (&self->proxy_props_signal_id, self->proxy);
g_clear_signal_handler (&self->proxy_props_signal_id, self->proxy);
g_clear_object (&self->proxy);
}
if (self->proxy_3gpp) {
phosh_clear_handler (&self->proxy_3gpp_props_signal_id, self->proxy_3gpp);
g_clear_signal_handler (&self->proxy_3gpp_props_signal_id, self->proxy_3gpp);
g_clear_object (&self->proxy_3gpp);
}
......@@ -555,10 +555,10 @@ phosh_wwan_mm_dispose (GObject *object)
phosh_wwan_mm_destroy_modem (self);
if (self->manager) {
phosh_clear_handler (&self->manager_object_added_signal_id,
self->manager);
phosh_clear_handler (&self->manager_object_removed_signal_id,
self->manager);
g_clear_signal_handler (&self->manager_object_added_signal_id,
self->manager);
g_clear_signal_handler (&self->manager_object_removed_signal_id,
self->manager);
g_clear_object (&self->manager);
}
......
......@@ -276,13 +276,13 @@ phosh_wwan_ofono_destroy_modem (PhoshWWanOfono *self)
g_debug ("destroying modem '%p'", self);
if (self->proxy_netreg) {
phosh_clear_handler (&self->proxy_netreg_props_signal_id,
self->proxy_netreg);
g_clear_signal_handler (&self->proxy_netreg_props_signal_id,
self->proxy_netreg);
g_clear_object (&self->proxy_netreg);
}
if (self->proxy_sim) {
phosh_clear_handler (&self->proxy_sim_props_signal_id, self->proxy_sim);
g_clear_signal_handler (&self->proxy_sim_props_signal_id, self->proxy_sim);
g_clear_object (&self->proxy_sim);
}
......@@ -585,10 +585,10 @@ phosh_wwan_ofono_dispose (GObject *object)
phosh_wwan_ofono_destroy_modem (self);
if (self->proxy_manager) {
phosh_clear_handler (&self->manager_object_added_signal_id,
self->proxy_manager);
phosh_clear_handler (&self->manager_object_removed_signal_id,
self->proxy_manager);
g_clear_signal_handler (&self->manager_object_added_signal_id,
self->proxy_manager);
g_clear_signal_handler (&self->manager_object_removed_signal_id,
self->proxy_manager);
g_clear_object (&self->proxy_manager);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment