summaryrefslogtreecommitdiff
path: root/panels/search
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2020-01-31 10:30:10 +1300
committerRobert Ancell <robert.ancell@canonical.com>2020-02-03 09:36:24 +1300
commit93b14a43394680d4f13b69da4381ef8f43974159 (patch)
treec76ec553fa24fc445d1708b56ff9ea2460bcfbd3 /panels/search
parent0aad22079f4fe381b5320bb14099f444d5a9ac61 (diff)
downloadgnome-control-center-93b14a43394680d4f13b69da4381ef8f43974159.tar.gz
panel: Move shared GCancellable code into panel class
Make the panel class provide a cancellable that will be cancelled when the panel is destroyed. Panel implementations can use this and not have to mangage the cancellable themselves. Consolidate cases where panels had multiple cancellables that were all being used for this behaviour.
Diffstat (limited to 'panels/search')
-rw-r--r--panels/search/cc-search-panel.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/panels/search/cc-search-panel.c b/panels/search/cc-search-panel.c
index e7095d8cb..b0d4d42d6 100644
--- a/panels/search/cc-search-panel.c
+++ b/panels/search/cc-search-panel.c
@@ -37,7 +37,6 @@ struct _CcSearchPanel
GtkWidget *settings_button;
CcSearchPanelRow *selected_row;
- GCancellable *load_cancellable;
GSettings *search_settings;
GHashTable *sort_order;
@@ -511,8 +510,6 @@ search_providers_discover_ready (GObject *source,
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
return;
- g_clear_object (&self->load_cancellable);
-
if (providers == NULL)
{
search_panel_set_no_providers (self);
@@ -608,24 +605,12 @@ populate_search_providers (CcSearchPanel *self)
{
g_autoptr(GTask) task = NULL;
- self->load_cancellable = g_cancellable_new ();
- task = g_task_new (self, self->load_cancellable,
+ task = g_task_new (self, cc_panel_get_cancellable (CC_PANEL (self)),
search_providers_discover_ready, self);
g_task_run_in_thread (task, search_providers_discover_thread);
}
static void
-cc_search_panel_dispose (GObject *object)
-{
- CcSearchPanel *self = CC_SEARCH_PANEL (object);
-
- g_cancellable_cancel (self->load_cancellable);
- g_clear_object (&self->load_cancellable);
-
- G_OBJECT_CLASS (cc_search_panel_parent_class)->dispose (object);
-}
-
-static void
cc_search_panel_finalize (GObject *object)
{
CcSearchPanel *self = CC_SEARCH_PANEL (object);
@@ -700,7 +685,6 @@ cc_search_panel_class_init (CcSearchPanelClass *klass)
GObjectClass *oclass = G_OBJECT_CLASS (klass);
oclass->constructed = cc_search_panel_constructed;
- oclass->dispose = cc_search_panel_dispose;
oclass->finalize = cc_search_panel_finalize;
gtk_widget_class_set_template_from_resource (widget_class,