~jbicha/unity-settings-daemon/drop-updates-plugin

« back to all changes in this revision

Viewing changes to plugins/updates/gsd-updates-refresh.c

  • Committer: Jeremy Bicha
  • Date: 2017-03-22 16:11:54 UTC
  • Revision ID: jbicha@ubuntu.com-20170322161154-r6ygbqyi5wdr4uly
updates: Remove the updates plugin

The functionality now lives in gnome-software that has its own session
service for update polling.

https://git.gnome.org/browse/gnome-settings-daemon/commit/?id=fc22a8100

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2
 
 *
3
 
 * Copyright (C) 2007-2011 Richard Hughes <richard@hughsie.com>
4
 
 *
5
 
 * Licensed under the GNU General Public License Version 2
6
 
 *
7
 
 * This program is free software; you can redistribute it and/or modify
8
 
 * it under the terms of the GNU General Public License as published by
9
 
 * the Free Software Foundation; either version 2 of the License, or
10
 
 * (at your option) any later version.
11
 
 *
12
 
 * This program is distributed in the hope that it will be useful,
13
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
 * GNU General Public License for more details.
16
 
 *
17
 
 * You should have received a copy of the GNU General Public License
18
 
 * along with this program; if not, write to the Free Software
19
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
 
 */
21
 
 
22
 
#include "config.h"
23
 
 
24
 
#include <glib/gi18n.h>
25
 
#include <packagekit-glib2/packagekit.h>
26
 
#include <libupower-glib/upower.h>
27
 
 
28
 
#include "gnome-settings-bus.h"
29
 
 
30
 
#include "gsd-updates-common.h"
31
 
#include "gsd-updates-refresh.h"
32
 
 
33
 
static void     gsd_updates_refresh_finalize    (GObject            *object);
34
 
 
35
 
#define GSD_UPDATES_REFRESH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_UPDATES_REFRESH, GsdUpdatesRefreshPrivate))
36
 
 
37
 
#define PERIODIC_CHECK_TIME     60*60   /* poke PackageKit every hour */
38
 
#define LOGIN_TIMEOUT           3       /* seconds */
39
 
#define SESSION_STARTUP_TIMEOUT 10      /* seconds */
40
 
 
41
 
enum {
42
 
        PRESENCE_STATUS_AVAILABLE = 0,
43
 
        PRESENCE_STATUS_INVISIBLE,
44
 
        PRESENCE_STATUS_BUSY,
45
 
        PRESENCE_STATUS_IDLE,
46
 
        PRESENCE_STATUS_UNKNOWN
47
 
};
48
 
 
49
 
/*
50
 
 * at startup, after a small delay, force a GetUpdates call
51
 
 * every hour (or any event) check:
52
 
   - if we are online, idle and on AC power, it's been more than a day
53
 
     since we refreshed then RefreshCache
54
 
   - if we are online and it's been longer than the timeout since
55
 
     getting the updates period then GetUpdates
56
 
*/
57
 
 
58
 
struct GsdUpdatesRefreshPrivate
59
 
{
60
 
        gboolean                 session_idle;
61
 
        gboolean                 on_battery;
62
 
        gboolean                 network_active;
63
 
        guint                    timeout_id;
64
 
        guint                    periodic_id;
65
 
        UpClient                *client;
66
 
        GSettings               *settings;
67
 
        GsdSessionManager       *proxy_session;
68
 
        PkControl               *control;
69
 
};
70
 
 
71
 
enum {
72
 
        REFRESH_CACHE,
73
 
        GET_UPDATES,
74
 
        GET_UPGRADES,
75
 
        LAST_SIGNAL
76
 
};
77
 
 
78
 
static guint signals [LAST_SIGNAL] = { 0 };
79
 
 
80
 
G_DEFINE_TYPE (GsdUpdatesRefresh, gsd_updates_refresh, G_TYPE_OBJECT)
81
 
 
82
 
static void
83
 
gsd_updates_refresh_class_init (GsdUpdatesRefreshClass *klass)
84
 
{
85
 
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
86
 
        object_class->finalize = gsd_updates_refresh_finalize;
87
 
        g_type_class_add_private (klass, sizeof (GsdUpdatesRefreshPrivate));
88
 
        signals [REFRESH_CACHE] =
89
 
                g_signal_new ("refresh-cache",
90
 
                              G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
91
 
                              0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
92
 
                              G_TYPE_NONE, 0);
93
 
        signals [GET_UPDATES] =
94
 
                g_signal_new ("get-updates",
95
 
                              G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
96
 
                              0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
97
 
                              G_TYPE_NONE, 0);
98
 
        signals [GET_UPGRADES] =
99
 
                g_signal_new ("get-upgrades",
100
 
                              G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
101
 
                              0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
102
 
                              G_TYPE_NONE, 0);
103
 
}
104
 
 
105
 
static void
106
 
get_time_refresh_cache_cb (GObject *object,
107
 
                           GAsyncResult *res,
108
 
                           GsdUpdatesRefresh *refresh)
109
 
{
110
 
        PkControl *control = PK_CONTROL (object);
111
 
        GError *error = NULL;
112
 
        guint seconds;
113
 
        guint thresh;
114
 
 
115
 
        /* get the result */
116
 
        seconds = pk_control_get_time_since_action_finish (control, res, &error);
117
 
        if (seconds == 0) {
118
 
                g_warning ("failed to get time: %s", error->message);
119
 
                g_error_free (error);
120
 
                return;
121
 
        }
122
 
 
123
 
        /* have we passed the timout? */
124
 
        thresh = g_settings_get_int (refresh->priv->settings,
125
 
                                     GSD_SETTINGS_FREQUENCY_GET_UPDATES);
126
 
        if (seconds < thresh) {
127
 
                g_debug ("not before timeout, thresh=%u, now=%u", thresh, seconds);
128
 
                return;
129
 
        }
130
 
 
131
 
        /* send signal */
132
 
        g_debug ("emitting refresh-cache");
133
 
        g_signal_emit (refresh, signals [REFRESH_CACHE], 0);
134
 
}
135
 
 
136
 
static void
137
 
maybe_refresh_cache (GsdUpdatesRefresh *refresh)
138
 
{
139
 
        guint thresh;
140
 
 
141
 
        g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh));
142
 
 
143
 
        /* if we don't want to auto check for updates, don't do this either */
144
 
        thresh = g_settings_get_int (refresh->priv->settings,
145
 
                                     GSD_SETTINGS_FREQUENCY_GET_UPDATES);
146
 
        if (thresh == 0) {
147
 
                g_debug ("not when policy is set to never");
148
 
                return;
149
 
        }
150
 
 
151
 
        /* only do the refresh cache when the user is idle */
152
 
        if (!refresh->priv->session_idle) {
153
 
                g_debug ("not when session active");
154
 
                return;
155
 
        }
156
 
 
157
 
        /* get this each time, as it may have changed behind out back */
158
 
        thresh = g_settings_get_int (refresh->priv->settings,
159
 
                                     GSD_SETTINGS_FREQUENCY_REFRESH_CACHE);
160
 
        if (thresh == 0) {
161
 
                g_debug ("not when policy is set to never");
162
 
                return;
163
 
        }
164
 
 
165
 
        /* get the time since the last refresh */
166
 
        pk_control_get_time_since_action_async (refresh->priv->control,
167
 
                                                PK_ROLE_ENUM_REFRESH_CACHE,
168
 
                                                NULL,
169
 
                                                (GAsyncReadyCallback) get_time_refresh_cache_cb,
170
 
                                                refresh);
171
 
}
172
 
 
173
 
static void
174
 
get_time_get_updates_cb (GObject *object, GAsyncResult *res, GsdUpdatesRefresh *refresh)
175
 
{
176
 
        PkControl *control = PK_CONTROL (object);
177
 
        GError *error = NULL;
178
 
        guint seconds;
179
 
        guint thresh;
180
 
 
181
 
        /* get the result */
182
 
        seconds = pk_control_get_time_since_action_finish (control, res, &error);
183
 
        if (seconds == 0) {
184
 
                g_warning ("failed to get time: %s", error->message);
185
 
                g_error_free (error);
186
 
                return;
187
 
        }
188
 
 
189
 
        /* have we passed the timout? */
190
 
        thresh = g_settings_get_int (refresh->priv->settings,
191
 
                                     GSD_SETTINGS_FREQUENCY_GET_UPDATES);
192
 
        if (seconds < thresh) {
193
 
                g_debug ("not before timeout, thresh=%u, now=%u", thresh, seconds);
194
 
                return;
195
 
        }
196
 
 
197
 
        /* send signal */
198
 
        g_debug ("emitting get-updates");
199
 
        g_signal_emit (refresh, signals [GET_UPDATES], 0);
200
 
}
201
 
 
202
 
static void
203
 
maybe_get_updates (GsdUpdatesRefresh *refresh)
204
 
{
205
 
        guint thresh;
206
 
 
207
 
        g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh));
208
 
 
209
 
        /* if we don't want to auto check for updates, don't do this either */
210
 
        thresh = g_settings_get_int (refresh->priv->settings,
211
 
                                     GSD_SETTINGS_FREQUENCY_GET_UPDATES);
212
 
        if (thresh == 0) {
213
 
                g_debug ("not when policy is set to never");
214
 
                return;
215
 
        }
216
 
 
217
 
        /* get the time since the last refresh */
218
 
        pk_control_get_time_since_action_async (refresh->priv->control,
219
 
                                                PK_ROLE_ENUM_GET_UPDATES,
220
 
                                                NULL,
221
 
                                                (GAsyncReadyCallback) get_time_get_updates_cb,
222
 
                                                refresh);
223
 
}
224
 
 
225
 
static void
226
 
get_time_get_upgrades_cb (GObject *object,
227
 
                          GAsyncResult *res,
228
 
                          GsdUpdatesRefresh *refresh)
229
 
{
230
 
        PkControl *control = PK_CONTROL (object);
231
 
        GError *error = NULL;
232
 
        guint seconds;
233
 
        guint thresh;
234
 
 
235
 
        /* get the result */
236
 
        seconds = pk_control_get_time_since_action_finish (control, res, &error);
237
 
        if (seconds == 0) {
238
 
                g_warning ("failed to get time: %s", error->message);
239
 
                g_error_free (error);
240
 
                return;
241
 
        }
242
 
 
243
 
        /* have we passed the timout? */
244
 
        thresh = g_settings_get_int (refresh->priv->settings,
245
 
                                     GSD_SETTINGS_FREQUENCY_GET_UPDATES);
246
 
        if (seconds < thresh) {
247
 
                g_debug ("not before timeout, thresh=%u, now=%u",
248
 
                         thresh, seconds);
249
 
                return;
250
 
        }
251
 
 
252
 
        /* send signal */
253
 
        g_debug ("emitting get-upgrades");
254
 
        g_signal_emit (refresh, signals [GET_UPGRADES], 0);
255
 
}
256
 
 
257
 
static void
258
 
maybe_get_upgrades (GsdUpdatesRefresh *refresh)
259
 
{
260
 
        guint thresh;
261
 
 
262
 
        g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh));
263
 
 
264
 
        /* get this each time, as it may have changed behind out back */
265
 
        thresh = g_settings_get_int (refresh->priv->settings,
266
 
                                     GSD_SETTINGS_FREQUENCY_GET_UPGRADES);
267
 
        if (thresh == 0) {
268
 
                g_debug ("not when policy is set to never");
269
 
                return;
270
 
        }
271
 
 
272
 
        /* get the time since the last refresh */
273
 
        pk_control_get_time_since_action_async (refresh->priv->control,
274
 
                                                PK_ROLE_ENUM_GET_DISTRO_UPGRADES,
275
 
                                                NULL,
276
 
                                                (GAsyncReadyCallback) get_time_get_upgrades_cb,
277
 
                                                refresh);
278
 
}
279
 
 
280
 
static gboolean
281
 
change_state_cb (GsdUpdatesRefresh *refresh)
282
 
{
283
 
        /* check all actions */
284
 
        maybe_refresh_cache (refresh);
285
 
        maybe_get_updates (refresh);
286
 
        maybe_get_upgrades (refresh);
287
 
        return FALSE;
288
 
}
289
 
 
290
 
static gboolean
291
 
change_state (GsdUpdatesRefresh *refresh)
292
 
{
293
 
        gboolean ret;
294
 
 
295
 
        g_return_val_if_fail (GSD_IS_UPDATES_REFRESH (refresh), FALSE);
296
 
 
297
 
        /* no point continuing if we have no network */
298
 
        if (!refresh->priv->network_active) {
299
 
                g_debug ("not when no network");
300
 
                return FALSE;
301
 
        }
302
 
 
303
 
        /* not on battery unless overridden */
304
 
        ret = g_settings_get_boolean (refresh->priv->settings,
305
 
                                      GSD_SETTINGS_UPDATE_BATTERY);
306
 
        if (!ret && refresh->priv->on_battery) {
307
 
                g_debug ("not when on battery");
308
 
                return FALSE;
309
 
        }
310
 
 
311
 
        /* wait a little time for things to settle down */
312
 
        if (refresh->priv->timeout_id != 0)
313
 
                g_source_remove (refresh->priv->timeout_id);
314
 
        g_debug ("defering action for %i seconds",
315
 
                 SESSION_STARTUP_TIMEOUT);
316
 
        refresh->priv->timeout_id =
317
 
                g_timeout_add_seconds (SESSION_STARTUP_TIMEOUT,
318
 
                                       (GSourceFunc) change_state_cb,
319
 
                                       refresh);
320
 
        g_source_set_name_by_id (refresh->priv->timeout_id,
321
 
                                 "[GsdUpdatesRefresh] change-state");
322
 
 
323
 
        return TRUE;
324
 
}
325
 
 
326
 
static void
327
 
settings_key_changed_cb (GSettings *client,
328
 
                         const gchar *key,
329
 
                         GsdUpdatesRefresh *refresh)
330
 
{
331
 
        g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh));
332
 
        if (g_strcmp0 (key, GSD_SETTINGS_FREQUENCY_GET_UPDATES) == 0 ||
333
 
            g_strcmp0 (key, GSD_SETTINGS_FREQUENCY_GET_UPGRADES) == 0 ||
334
 
            g_strcmp0 (key, GSD_SETTINGS_FREQUENCY_REFRESH_CACHE) == 0 ||
335
 
            g_strcmp0 (key, GSD_SETTINGS_UPDATE_BATTERY) == 0)
336
 
                change_state (refresh);
337
 
}
338
 
 
339
 
static gboolean
340
 
convert_network_state (GsdUpdatesRefresh *refresh, PkNetworkEnum state)
341
 
{
342
 
        /* offline */
343
 
        if (state == PK_NETWORK_ENUM_OFFLINE)
344
 
                return FALSE;
345
 
 
346
 
        /* online */
347
 
        if (state == PK_NETWORK_ENUM_ONLINE ||
348
 
            state == PK_NETWORK_ENUM_WIFI ||
349
 
            state == PK_NETWORK_ENUM_WIRED)
350
 
                return TRUE;
351
 
 
352
 
        /* check policy */
353
 
        if (state == PK_NETWORK_ENUM_MOBILE)
354
 
                return g_settings_get_boolean (refresh->priv->settings,
355
 
                                               GSD_SETTINGS_CONNECTION_USE_MOBILE);
356
 
 
357
 
        /* not recognised */
358
 
        g_warning ("state unknown: %i", state);
359
 
        return TRUE;
360
 
}
361
 
 
362
 
static void
363
 
notify_network_state_cb (PkControl *control,
364
 
                         GParamSpec *pspec,
365
 
                         GsdUpdatesRefresh *refresh)
366
 
{
367
 
        PkNetworkEnum state;
368
 
 
369
 
        g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh));
370
 
 
371
 
        g_object_get (control, "network-state", &state, NULL);
372
 
        refresh->priv->network_active = convert_network_state (refresh, state);
373
 
        g_debug ("setting online %i", refresh->priv->network_active);
374
 
        if (refresh->priv->network_active)
375
 
                change_state (refresh);
376
 
}
377
 
 
378
 
static gboolean
379
 
periodic_timeout_cb (gpointer user_data)
380
 
{
381
 
        GsdUpdatesRefresh *refresh = GSD_UPDATES_REFRESH (user_data);
382
 
 
383
 
        g_return_val_if_fail (GSD_IS_UPDATES_REFRESH (refresh), FALSE);
384
 
 
385
 
        /* debug so we can catch polling */
386
 
        g_debug ("polling check");
387
 
 
388
 
        /* triggered once an hour */
389
 
        change_state (refresh);
390
 
 
391
 
        /* always return */
392
 
        return TRUE;
393
 
}
394
 
 
395
 
static void
396
 
gsd_updates_refresh_client_changed_cb (UpClient *client,
397
 
                                       GsdUpdatesRefresh *refresh)
398
 
{
399
 
        gboolean on_battery;
400
 
 
401
 
        g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh));
402
 
 
403
 
        /* get the on-battery state */
404
 
        on_battery = up_client_get_on_battery (refresh->priv->client);
405
 
        if (on_battery == refresh->priv->on_battery) {
406
 
                g_debug ("same state as before, ignoring");
407
 
                return;
408
 
        }
409
 
 
410
 
        /* save in local cache */
411
 
        g_debug ("setting on_battery %i", on_battery);
412
 
        refresh->priv->on_battery = on_battery;
413
 
        if (!on_battery)
414
 
                change_state (refresh);
415
 
}
416
 
 
417
 
static void
418
 
get_properties_cb (GObject *object,
419
 
                   GAsyncResult *res,
420
 
                   GsdUpdatesRefresh *refresh)
421
 
{
422
 
        PkNetworkEnum state;
423
 
        GError *error = NULL;
424
 
        PkControl *control = PK_CONTROL(object);
425
 
        gboolean ret;
426
 
 
427
 
        /* get the result */
428
 
        ret = pk_control_get_properties_finish (control, res, &error);
429
 
        if (!ret) {
430
 
                /* TRANSLATORS: backend is broken, and won't tell us what it supports */
431
 
                g_warning ("could not get properties");
432
 
                g_error_free (error);
433
 
                goto out;
434
 
        }
435
 
 
436
 
        /* get values */
437
 
        g_object_get (control,
438
 
                      "network-state", &state,
439
 
                      NULL);
440
 
        refresh->priv->network_active = convert_network_state (refresh, state);
441
 
out:
442
 
        return;
443
 
}
444
 
 
445
 
static void
446
 
session_presence_signal_cb (GDBusProxy *proxy,
447
 
                            gchar *sender_name,
448
 
                            gchar *signal_name,
449
 
                            GVariant *parameters,
450
 
                            GsdUpdatesRefresh *refresh)
451
 
{
452
 
        guint status;
453
 
 
454
 
        g_return_if_fail (GSD_IS_UPDATES_REFRESH (refresh));
455
 
 
456
 
        if (g_strcmp0 (signal_name, "StatusChanged") != 0)
457
 
                return;
458
 
 
459
 
        /* map status code into boolean */
460
 
        g_variant_get (parameters, "(u)", &status);
461
 
        refresh->priv->session_idle = (status == PRESENCE_STATUS_IDLE);
462
 
        g_debug ("setting is_idle %i",
463
 
                 refresh->priv->session_idle);
464
 
        if (refresh->priv->session_idle)
465
 
                change_state (refresh);
466
 
 
467
 
}
468
 
 
469
 
static void
470
 
gsd_updates_refresh_init (GsdUpdatesRefresh *refresh)
471
 
{
472
 
        GVariant *status;
473
 
        guint status_code;
474
 
 
475
 
        refresh->priv = GSD_UPDATES_REFRESH_GET_PRIVATE (refresh);
476
 
        refresh->priv->on_battery = FALSE;
477
 
        refresh->priv->network_active = FALSE;
478
 
        refresh->priv->timeout_id = 0;
479
 
        refresh->priv->periodic_id = 0;
480
 
 
481
 
        /* we need to know the updates frequency */
482
 
        refresh->priv->settings = g_settings_new (GSD_SETTINGS_SCHEMA);
483
 
        g_signal_connect (refresh->priv->settings, "changed",
484
 
                          G_CALLBACK (settings_key_changed_cb), refresh);
485
 
 
486
 
        /* we need to query the last cache refresh time */
487
 
        refresh->priv->control = pk_control_new ();
488
 
        g_signal_connect (refresh->priv->control, "notify::network-state",
489
 
                          G_CALLBACK (notify_network_state_cb),
490
 
                          refresh);
491
 
 
492
 
        /* get network state */
493
 
        pk_control_get_properties_async (refresh->priv->control,
494
 
                                         NULL,
495
 
                                         (GAsyncReadyCallback) get_properties_cb,
496
 
                                         refresh);
497
 
 
498
 
        /* use a UpClient */
499
 
        refresh->priv->client = up_client_new ();
500
 
        g_signal_connect (refresh->priv->client, "changed",
501
 
                          G_CALLBACK (gsd_updates_refresh_client_changed_cb), refresh);
502
 
 
503
 
        /* get the battery state */
504
 
        refresh->priv->on_battery = up_client_get_on_battery (refresh->priv->client);
505
 
        g_debug ("setting on battery %i", refresh->priv->on_battery);
506
 
 
507
 
        /* use gnome-session for the idle detection */
508
 
        refresh->priv->proxy_session =
509
 
                gnome_settings_bus_get_session_proxy ();
510
 
        if (refresh->priv->proxy_session != NULL) {
511
 
                g_signal_connect (G_DBUS_PROXY (refresh->priv->proxy_session),
512
 
                                  "g-signal",
513
 
                                  G_CALLBACK (session_presence_signal_cb),
514
 
                                  refresh);
515
 
                status = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (refresh->priv->proxy_session),
516
 
                                                           "status");
517
 
                if (status) {
518
 
                        g_variant_get (status, "u", &status_code);
519
 
                        refresh->priv->session_idle = (status_code == PRESENCE_STATUS_IDLE);
520
 
                        g_variant_unref (status);
521
 
                }
522
 
                else {
523
 
                        refresh->priv->session_idle = FALSE;
524
 
                }
525
 
        }
526
 
 
527
 
        /* we check this in case we miss one of the async signals */
528
 
        refresh->priv->periodic_id =
529
 
                g_timeout_add_seconds (PERIODIC_CHECK_TIME,
530
 
                                       periodic_timeout_cb, refresh);
531
 
        g_source_set_name_by_id (refresh->priv->periodic_id,
532
 
                                 "[GsdUpdatesRefresh] periodic check");
533
 
 
534
 
        /* check system state */
535
 
        change_state (refresh);
536
 
}
537
 
 
538
 
static void
539
 
gsd_updates_refresh_finalize (GObject *object)
540
 
{
541
 
        GsdUpdatesRefresh *refresh;
542
 
 
543
 
        g_return_if_fail (GSD_IS_UPDATES_REFRESH (object));
544
 
 
545
 
        refresh = GSD_UPDATES_REFRESH (object);
546
 
        g_return_if_fail (refresh->priv != NULL);
547
 
 
548
 
        if (refresh->priv->timeout_id != 0)
549
 
                g_source_remove (refresh->priv->timeout_id);
550
 
        if (refresh->priv->periodic_id != 0)
551
 
                g_source_remove (refresh->priv->periodic_id);
552
 
 
553
 
        g_signal_handlers_disconnect_by_data (refresh->priv->client, refresh);
554
 
        g_signal_handlers_disconnect_by_data (refresh->priv->proxy_session, refresh);
555
 
 
556
 
        g_object_unref (refresh->priv->control);
557
 
        g_object_unref (refresh->priv->settings);
558
 
        g_object_unref (refresh->priv->client);
559
 
        if (refresh->priv->proxy_session != NULL)
560
 
                g_object_unref (refresh->priv->proxy_session);
561
 
 
562
 
        G_OBJECT_CLASS (gsd_updates_refresh_parent_class)->finalize (object);
563
 
}
564
 
 
565
 
GsdUpdatesRefresh *
566
 
gsd_updates_refresh_new (void)
567
 
{
568
 
        GsdUpdatesRefresh *refresh;
569
 
        refresh = g_object_new (GSD_TYPE_UPDATES_REFRESH, NULL);
570
 
        return GSD_UPDATES_REFRESH (refresh);
571
 
}
572