summaryrefslogtreecommitdiff
path: root/panels/search
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2018-05-31 10:16:54 +1200
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-06-01 21:03:19 +0000
commita64ef75ad7002d1c7fae302ece399caa05e9e16f (patch)
tree1dca9e0a6d253a6704e57aded8bbb078ed75a1cc /panels/search
parentdd61d98ec50604925cf1f00545899c090f87e2a9 (diff)
downloadgnome-control-center-a64ef75ad7002d1c7fae302ece399caa05e9e16f.tar.gz
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
Diffstat (limited to 'panels/search')
-rw-r--r--panels/search/cc-search-locations-dialog.c7
-rw-r--r--panels/search/cc-search-panel.c3
2 files changed, 3 insertions, 7 deletions
diff --git a/panels/search/cc-search-locations-dialog.c b/panels/search/cc-search-locations-dialog.c
index 820de2bc7..7afbe0e02 100644
--- a/panels/search/cc-search-locations-dialog.c
+++ b/panels/search/cc-search-locations-dialog.c
@@ -75,11 +75,8 @@ cc_search_locations_dialog_init (CcSearchLocationsDialog *self)
static void
place_free (Place * p)
{
- if (p->cancellable != NULL)
- {
- g_cancellable_cancel (p->cancellable);
- g_object_unref (p->cancellable);
- }
+ g_cancellable_cancel (p->cancellable);
+ g_clear_object (&p->cancellable);
g_object_unref (p->location);
g_free (p->display_name);
diff --git a/panels/search/cc-search-panel.c b/panels/search/cc-search-panel.c
index 77a6e2637..fa70770b3 100644
--- a/panels/search/cc-search-panel.c
+++ b/panels/search/cc-search-panel.c
@@ -663,8 +663,7 @@ cc_search_panel_dispose (GObject *object)
{
CcSearchPanel *self = CC_SEARCH_PANEL (object);
- if (self->load_cancellable != NULL)
- g_cancellable_cancel (self->load_cancellable);
+ g_cancellable_cancel (self->load_cancellable);
g_clear_object (&self->load_cancellable);
G_OBJECT_CLASS (cc_search_panel_parent_class)->dispose (object);