Simplify use of GCancellable

g_cancellable_cancell can be called without checking for a NULL value.
Use g_clear_object instead of g_object_unref
This commit is contained in:
Robert Ancell 2018-05-31 10:16:54 +12:00 committed by Georges Basile Stavracas Neto
parent dd61d98ec5
commit a64ef75ad7
9 changed files with 23 additions and 54 deletions

View file

@ -1573,11 +1573,8 @@ search_for_remote_printers (THostSearchData *data)
{
PpNewPrinterDialogPrivate *priv = data->dialog->priv;
if (priv->remote_host_cancellable != NULL)
{
g_cancellable_cancel (priv->remote_host_cancellable);
g_clear_object (&priv->remote_host_cancellable);
}
g_cancellable_cancel (priv->remote_host_cancellable);
g_clear_object (&priv->remote_host_cancellable);
priv->remote_host_cancellable = g_cancellable_new ();