~ubuntu-branches/ubuntu/wily/baobab/wily-proposed

« back to all changes in this revision

Viewing changes to src/baobab-location.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2012-11-05 18:19:47 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20121105181947-a5c9utsx2buosfmy
Tags: 3.6.2-0ubuntu1
* New upstream version:
  - Minor tweaks to the UI
* debian/patches/baobab_about_segfault.patch: 
  - don't segfault when opening the about dialog (lp: #1020810)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* baobab-location.c generated by valac 0.17.4.2-5a035, the Vala compiler
2
2
 * generated from baobab-location.vala, do not modify */
3
3
 
4
 
/* -*- indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 
4
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
5
5
/* Baobab - disk usage analyzer
6
6
 *
7
7
 * Copyright (C) 2012  Paolo Borelli <pborelli@gnome.org>
32
32
#include <gobject/gvaluecollector.h>
33
33
 
34
34
 
 
35
#define BAOBAB_TYPE_HOSTNAME_IFACE (baobab_hostname_iface_get_type ())
 
36
#define BAOBAB_HOSTNAME_IFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAOBAB_TYPE_HOSTNAME_IFACE, BaobabHostnameIface))
 
37
#define BAOBAB_IS_HOSTNAME_IFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAOBAB_TYPE_HOSTNAME_IFACE))
 
38
#define BAOBAB_HOSTNAME_IFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BAOBAB_TYPE_HOSTNAME_IFACE, BaobabHostnameIfaceIface))
 
39
 
 
40
typedef struct _BaobabHostnameIface BaobabHostnameIface;
 
41
typedef struct _BaobabHostnameIfaceIface BaobabHostnameIfaceIface;
 
42
 
 
43
#define BAOBAB_TYPE_HOSTNAME_IFACE_PROXY (baobab_hostname_iface_proxy_get_type ())
 
44
typedef GDBusProxy BaobabHostnameIfaceProxy;
 
45
typedef GDBusProxyClass BaobabHostnameIfaceProxyClass;
 
46
#define _g_free0(var) (var = (g_free (var), NULL))
 
47
 
35
48
#define BAOBAB_TYPE_LOCATION (baobab_location_get_type ())
36
49
#define BAOBAB_LOCATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAOBAB_TYPE_LOCATION, BaobabLocation))
37
50
#define BAOBAB_LOCATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BAOBAB_TYPE_LOCATION, BaobabLocationClass))
52
65
 
53
66
typedef struct _BaobabScanner BaobabScanner;
54
67
typedef struct _BaobabScannerClass BaobabScannerClass;
55
 
#define _g_free0(var) (var = (g_free (var), NULL))
56
68
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
57
69
#define _baobab_location_unref0(var) ((var == NULL) ? NULL : (var = (baobab_location_unref (var), NULL)))
58
70
 
61
73
typedef struct _BaobabLocationMountVolumeData BaobabLocationMountVolumeData;
62
74
typedef struct _BaobabParamSpecLocation BaobabParamSpecLocation;
63
75
 
 
76
struct _BaobabHostnameIfaceIface {
 
77
        GTypeInterface parent_iface;
 
78
        gchar* (*get_pretty_hostname) (BaobabHostnameIface* self);
 
79
        void (*set_pretty_hostname) (BaobabHostnameIface* self, const gchar* value);
 
80
        gchar* (*get_hostname) (BaobabHostnameIface* self);
 
81
        void (*set_hostname) (BaobabHostnameIface* self, const gchar* value);
 
82
};
 
83
 
64
84
struct _BaobabLocation {
65
85
        GTypeInstance parent_instance;
66
86
        volatile int ref_count;
117
137
static BaobabLocation* baobab_location_home_location;
118
138
static BaobabLocation* baobab_location_home_location = NULL;
119
139
 
 
140
GType baobab_hostname_iface_get_type (void) G_GNUC_CONST;
 
141
GType baobab_hostname_iface_proxy_get_type (void) G_GNUC_CONST;
 
142
guint baobab_hostname_iface_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
 
143
gchar* baobab_hostname_iface_get_pretty_hostname (BaobabHostnameIface* self);
 
144
void baobab_hostname_iface_set_pretty_hostname (BaobabHostnameIface* self, const gchar* value);
 
145
gchar* baobab_hostname_iface_get_hostname (BaobabHostnameIface* self);
 
146
void baobab_hostname_iface_set_hostname (BaobabHostnameIface* self, const gchar* value);
 
147
static void baobab_hostname_iface_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
 
148
static gchar* baobab_hostname_iface_dbus_proxy_get_pretty_hostname (BaobabHostnameIface* self);
 
149
static void baobab_hostname_iface_dbus_proxy_set_pretty_hostname (BaobabHostnameIface* self, const gchar* value);
 
150
static gchar* baobab_hostname_iface_dbus_proxy_get_hostname (BaobabHostnameIface* self);
 
151
static void baobab_hostname_iface_dbus_proxy_set_hostname (BaobabHostnameIface* self, const gchar* value);
 
152
static void baobab_hostname_iface_proxy_baobab_hostname_iface_interface_init (BaobabHostnameIfaceIface* iface);
 
153
static void baobab_hostname_iface_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
 
154
static GVariant* baobab_hostname_iface_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
 
155
static GVariant* _dbus_baobab_hostname_iface_get_pretty_hostname (BaobabHostnameIface* self);
 
156
static GVariant* _dbus_baobab_hostname_iface_get_hostname (BaobabHostnameIface* self);
 
157
static gboolean baobab_hostname_iface_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
 
158
static void _dbus_baobab_hostname_iface_set_pretty_hostname (BaobabHostnameIface* self, GVariant* _value);
 
159
static void _dbus_baobab_hostname_iface_set_hostname (BaobabHostnameIface* self, GVariant* _value);
 
160
static void _baobab_hostname_iface_unregister_object (gpointer user_data);
120
161
gpointer baobab_location_ref (gpointer instance);
121
162
void baobab_location_unref (gpointer instance);
122
163
GParamSpec* baobab_param_spec_location (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
131
172
};
132
173
#define BAOBAB_LOCATION_FS_ATTRIBUTES G_FILE_ATTRIBUTE_FILESYSTEM_SIZE "," G_FILE_ATTRIBUTE_FILESYSTEM_USED
133
174
#define BAOBAB_LOCATION_FILE_ATTRIBUTES G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," G_FILE_ATTRIBUTE_STANDARD_ICON "," G_FILE_ATTRIBUTE_STANDARD_TYPE
 
175
static gchar* baobab_location_get_hostname (BaobabLocation* self, GError** error);
134
176
static void baobab_location_make_this_home_location (BaobabLocation* self);
135
177
static void baobab_location_set_name (BaobabLocation* self, const gchar* value);
136
178
static void baobab_location_set_icon (BaobabLocation* self, GIcon* value);
185
227
guint64* baobab_location_get_reserved (BaobabLocation* self);
186
228
GIcon* baobab_location_get_icon (BaobabLocation* self);
187
229
BaobabScanner* baobab_location_get_scanner (BaobabLocation* self);
 
230
gboolean baobab_location_get_is_home (BaobabLocation* self);
188
231
static void baobab_location_finalize (BaobabLocation* obj);
189
232
 
 
233
static const GDBusMethodInfo * const _baobab_hostname_iface_dbus_method_info[] = {NULL};
 
234
static const GDBusSignalInfo * const _baobab_hostname_iface_dbus_signal_info[] = {NULL};
 
235
static const GDBusPropertyInfo _baobab_hostname_iface_dbus_property_info_pretty_hostname = {-1, "PrettyHostname", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
 
236
static const GDBusPropertyInfo _baobab_hostname_iface_dbus_property_info_hostname = {-1, "Hostname", "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE};
 
237
static const GDBusPropertyInfo * const _baobab_hostname_iface_dbus_property_info[] = {&_baobab_hostname_iface_dbus_property_info_pretty_hostname, &_baobab_hostname_iface_dbus_property_info_hostname, NULL};
 
238
static const GDBusInterfaceInfo _baobab_hostname_iface_dbus_interface_info = {-1, "org.freedesktop.hostname1", (GDBusMethodInfo **) (&_baobab_hostname_iface_dbus_method_info), (GDBusSignalInfo **) (&_baobab_hostname_iface_dbus_signal_info), (GDBusPropertyInfo **) (&_baobab_hostname_iface_dbus_property_info)};
 
239
static const GDBusInterfaceVTable _baobab_hostname_iface_dbus_interface_vtable = {baobab_hostname_iface_dbus_interface_method_call, baobab_hostname_iface_dbus_interface_get_property, baobab_hostname_iface_dbus_interface_set_property};
 
240
 
 
241
gchar* baobab_hostname_iface_get_pretty_hostname (BaobabHostnameIface* self) {
 
242
        g_return_val_if_fail (self != NULL, NULL);
 
243
        return BAOBAB_HOSTNAME_IFACE_GET_INTERFACE (self)->get_pretty_hostname (self);
 
244
}
 
245
 
 
246
 
 
247
void baobab_hostname_iface_set_pretty_hostname (BaobabHostnameIface* self, const gchar* value) {
 
248
        g_return_if_fail (self != NULL);
 
249
        BAOBAB_HOSTNAME_IFACE_GET_INTERFACE (self)->set_pretty_hostname (self, value);
 
250
}
 
251
 
 
252
 
 
253
gchar* baobab_hostname_iface_get_hostname (BaobabHostnameIface* self) {
 
254
        g_return_val_if_fail (self != NULL, NULL);
 
255
        return BAOBAB_HOSTNAME_IFACE_GET_INTERFACE (self)->get_hostname (self);
 
256
}
 
257
 
 
258
 
 
259
void baobab_hostname_iface_set_hostname (BaobabHostnameIface* self, const gchar* value) {
 
260
        g_return_if_fail (self != NULL);
 
261
        BAOBAB_HOSTNAME_IFACE_GET_INTERFACE (self)->set_hostname (self, value);
 
262
}
 
263
 
 
264
 
 
265
static void baobab_hostname_iface_base_init (BaobabHostnameIfaceIface * iface) {
 
266
        static gboolean initialized = FALSE;
 
267
        if (!initialized) {
 
268
                initialized = TRUE;
 
269
        }
 
270
}
 
271
 
 
272
 
 
273
GType baobab_hostname_iface_get_type (void) {
 
274
        static volatile gsize baobab_hostname_iface_type_id__volatile = 0;
 
275
        if (g_once_init_enter (&baobab_hostname_iface_type_id__volatile)) {
 
276
                static const GTypeInfo g_define_type_info = { sizeof (BaobabHostnameIfaceIface), (GBaseInitFunc) baobab_hostname_iface_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
 
277
                GType baobab_hostname_iface_type_id;
 
278
                baobab_hostname_iface_type_id = g_type_register_static (G_TYPE_INTERFACE, "BaobabHostnameIface", &g_define_type_info, 0);
 
279
                g_type_interface_add_prerequisite (baobab_hostname_iface_type_id, G_TYPE_OBJECT);
 
280
                g_type_set_qdata (baobab_hostname_iface_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) baobab_hostname_iface_proxy_get_type);
 
281
                g_type_set_qdata (baobab_hostname_iface_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.freedesktop.hostname1");
 
282
                g_type_set_qdata (baobab_hostname_iface_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) baobab_hostname_iface_register_object);
 
283
                g_once_init_leave (&baobab_hostname_iface_type_id__volatile, baobab_hostname_iface_type_id);
 
284
        }
 
285
        return baobab_hostname_iface_type_id__volatile;
 
286
}
 
287
 
 
288
 
 
289
G_DEFINE_TYPE_EXTENDED (BaobabHostnameIfaceProxy, baobab_hostname_iface_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (BAOBAB_TYPE_HOSTNAME_IFACE, baobab_hostname_iface_proxy_baobab_hostname_iface_interface_init) )
 
290
static void baobab_hostname_iface_proxy_class_init (BaobabHostnameIfaceProxyClass* klass) {
 
291
        G_DBUS_PROXY_CLASS (klass)->g_signal = baobab_hostname_iface_proxy_g_signal;
 
292
}
 
293
 
 
294
 
 
295
static void baobab_hostname_iface_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
 
296
}
 
297
 
 
298
 
 
299
static void baobab_hostname_iface_proxy_init (BaobabHostnameIfaceProxy* self) {
 
300
}
 
301
 
 
302
 
 
303
static gchar* baobab_hostname_iface_dbus_proxy_get_pretty_hostname (BaobabHostnameIface* self) {
 
304
        GVariant *_inner_reply;
 
305
        gchar* _result;
 
306
        _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "PrettyHostname");
 
307
        if (!_inner_reply) {
 
308
                GVariant *_arguments;
 
309
                GVariant *_reply;
 
310
                GVariantBuilder _arguments_builder;
 
311
                g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
312
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.freedesktop.hostname1"));
 
313
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("PrettyHostname"));
 
314
                _arguments = g_variant_builder_end (&_arguments_builder);
 
315
                _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
 
316
                if (!_reply) {
 
317
                        return NULL;
 
318
                }
 
319
                g_variant_get (_reply, "(v)", &_inner_reply);
 
320
                g_variant_unref (_reply);
 
321
        }
 
322
        _result = g_variant_dup_string (_inner_reply, NULL);
 
323
        g_variant_unref (_inner_reply);
 
324
        return _result;
 
325
}
 
326
 
 
327
 
 
328
static void baobab_hostname_iface_dbus_proxy_set_pretty_hostname (BaobabHostnameIface* self, const gchar* value) {
 
329
        GVariant *_arguments;
 
330
        GVariant *_reply;
 
331
        GVariantBuilder _arguments_builder;
 
332
        g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
333
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.freedesktop.hostname1"));
 
334
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("PrettyHostname"));
 
335
        g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
 
336
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (value));
 
337
        g_variant_builder_close (&_arguments_builder);
 
338
        _arguments = g_variant_builder_end (&_arguments_builder);
 
339
        _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
 
340
        if (!_reply) {
 
341
                return;
 
342
        }
 
343
        g_variant_unref (_reply);
 
344
}
 
345
 
 
346
 
 
347
static gchar* baobab_hostname_iface_dbus_proxy_get_hostname (BaobabHostnameIface* self) {
 
348
        GVariant *_inner_reply;
 
349
        gchar* _result;
 
350
        _inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Hostname");
 
351
        if (!_inner_reply) {
 
352
                GVariant *_arguments;
 
353
                GVariant *_reply;
 
354
                GVariantBuilder _arguments_builder;
 
355
                g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
356
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.freedesktop.hostname1"));
 
357
                g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Hostname"));
 
358
                _arguments = g_variant_builder_end (&_arguments_builder);
 
359
                _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Get", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
 
360
                if (!_reply) {
 
361
                        return NULL;
 
362
                }
 
363
                g_variant_get (_reply, "(v)", &_inner_reply);
 
364
                g_variant_unref (_reply);
 
365
        }
 
366
        _result = g_variant_dup_string (_inner_reply, NULL);
 
367
        g_variant_unref (_inner_reply);
 
368
        return _result;
 
369
}
 
370
 
 
371
 
 
372
static void baobab_hostname_iface_dbus_proxy_set_hostname (BaobabHostnameIface* self, const gchar* value) {
 
373
        GVariant *_arguments;
 
374
        GVariant *_reply;
 
375
        GVariantBuilder _arguments_builder;
 
376
        g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
 
377
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("org.freedesktop.hostname1"));
 
378
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string ("Hostname"));
 
379
        g_variant_builder_open (&_arguments_builder, G_VARIANT_TYPE_VARIANT);
 
380
        g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (value));
 
381
        g_variant_builder_close (&_arguments_builder);
 
382
        _arguments = g_variant_builder_end (&_arguments_builder);
 
383
        _reply = g_dbus_proxy_call_sync ((GDBusProxy *) self, "org.freedesktop.DBus.Properties.Set", _arguments, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
 
384
        if (!_reply) {
 
385
                return;
 
386
        }
 
387
        g_variant_unref (_reply);
 
388
}
 
389
 
 
390
 
 
391
static void baobab_hostname_iface_proxy_baobab_hostname_iface_interface_init (BaobabHostnameIfaceIface* iface) {
 
392
        iface->get_pretty_hostname = baobab_hostname_iface_dbus_proxy_get_pretty_hostname;
 
393
        iface->set_pretty_hostname = baobab_hostname_iface_dbus_proxy_set_pretty_hostname;
 
394
        iface->get_hostname = baobab_hostname_iface_dbus_proxy_get_hostname;
 
395
        iface->set_hostname = baobab_hostname_iface_dbus_proxy_set_hostname;
 
396
}
 
397
 
 
398
 
 
399
static void baobab_hostname_iface_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
 
400
        gpointer* data;
 
401
        gpointer object;
 
402
        data = user_data;
 
403
        object = data[0];
 
404
        g_object_unref (invocation);
 
405
}
 
406
 
 
407
 
 
408
static GVariant* _dbus_baobab_hostname_iface_get_pretty_hostname (BaobabHostnameIface* self) {
 
409
        gchar* result;
 
410
        GVariant* _reply;
 
411
        result = baobab_hostname_iface_get_pretty_hostname (self);
 
412
        _reply = g_variant_new_string (result);
 
413
        _g_free0 (result);
 
414
        return _reply;
 
415
}
 
416
 
 
417
 
 
418
static GVariant* _dbus_baobab_hostname_iface_get_hostname (BaobabHostnameIface* self) {
 
419
        gchar* result;
 
420
        GVariant* _reply;
 
421
        result = baobab_hostname_iface_get_hostname (self);
 
422
        _reply = g_variant_new_string (result);
 
423
        _g_free0 (result);
 
424
        return _reply;
 
425
}
 
426
 
 
427
 
 
428
static GVariant* baobab_hostname_iface_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
 
429
        gpointer* data;
 
430
        gpointer object;
 
431
        data = user_data;
 
432
        object = data[0];
 
433
        if (strcmp (property_name, "PrettyHostname") == 0) {
 
434
                return _dbus_baobab_hostname_iface_get_pretty_hostname (object);
 
435
        } else if (strcmp (property_name, "Hostname") == 0) {
 
436
                return _dbus_baobab_hostname_iface_get_hostname (object);
 
437
        }
 
438
        return NULL;
 
439
}
 
440
 
 
441
 
 
442
static void _dbus_baobab_hostname_iface_set_pretty_hostname (BaobabHostnameIface* self, GVariant* _value) {
 
443
        gchar* value = NULL;
 
444
        value = g_variant_dup_string (_value, NULL);
 
445
        baobab_hostname_iface_set_pretty_hostname (self, value);
 
446
        _g_free0 (value);
 
447
}
 
448
 
 
449
 
 
450
static void _dbus_baobab_hostname_iface_set_hostname (BaobabHostnameIface* self, GVariant* _value) {
 
451
        gchar* value = NULL;
 
452
        value = g_variant_dup_string (_value, NULL);
 
453
        baobab_hostname_iface_set_hostname (self, value);
 
454
        _g_free0 (value);
 
455
}
 
456
 
 
457
 
 
458
static gboolean baobab_hostname_iface_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
 
459
        gpointer* data;
 
460
        gpointer object;
 
461
        data = user_data;
 
462
        object = data[0];
 
463
        if (strcmp (property_name, "PrettyHostname") == 0) {
 
464
                _dbus_baobab_hostname_iface_set_pretty_hostname (object, value);
 
465
                return TRUE;
 
466
        } else if (strcmp (property_name, "Hostname") == 0) {
 
467
                _dbus_baobab_hostname_iface_set_hostname (object, value);
 
468
                return TRUE;
 
469
        }
 
470
        return FALSE;
 
471
}
 
472
 
 
473
 
 
474
guint baobab_hostname_iface_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
 
475
        guint result;
 
476
        gpointer *data;
 
477
        data = g_new (gpointer, 3);
 
478
        data[0] = g_object_ref (object);
 
479
        data[1] = g_object_ref (connection);
 
480
        data[2] = g_strdup (path);
 
481
        result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_baobab_hostname_iface_dbus_interface_info), &_baobab_hostname_iface_dbus_interface_vtable, data, _baobab_hostname_iface_unregister_object, error);
 
482
        if (!result) {
 
483
                return 0;
 
484
        }
 
485
        return result;
 
486
}
 
487
 
 
488
 
 
489
static void _baobab_hostname_iface_unregister_object (gpointer user_data) {
 
490
        gpointer* data;
 
491
        data = user_data;
 
492
        g_object_unref (data[0]);
 
493
        g_object_unref (data[1]);
 
494
        g_free (data[2]);
 
495
        g_free (data);
 
496
}
 
497
 
 
498
 
 
499
static gchar* baobab_location_get_hostname (BaobabLocation* self, GError** error) {
 
500
        gchar* result = NULL;
 
501
        BaobabHostnameIface* hostname_iface = NULL;
 
502
        BaobabHostnameIface* _tmp0_ = NULL;
 
503
        BaobabHostnameIface* _tmp1_;
 
504
        BaobabHostnameIface* _tmp2_;
 
505
        gchar* _tmp3_;
 
506
        gchar* _tmp4_;
 
507
        gchar* pretty_name;
 
508
        const gchar* _tmp5_;
 
509
        GError * _inner_error_ = NULL;
 
510
        g_return_val_if_fail (self != NULL, NULL);
 
511
        _tmp0_ = g_initable_new (BAOBAB_TYPE_HOSTNAME_IFACE_PROXY, NULL, &_inner_error_, "g-flags", 0, "g-name", "org.freedesktop.hostname1", "g-bus-type", G_BUS_TYPE_SYSTEM, "g-object-path", "/org/freedesktop/hostname1", "g-interface-name", "org.freedesktop.hostname1", NULL);
 
512
        _tmp1_ = (BaobabHostnameIface*) _tmp0_;
 
513
        if (_inner_error_ != NULL) {
 
514
                g_propagate_error (error, _inner_error_);
 
515
                _g_object_unref0 (hostname_iface);
 
516
                return NULL;
 
517
        }
 
518
        _g_object_unref0 (hostname_iface);
 
519
        hostname_iface = _tmp1_;
 
520
        _tmp2_ = hostname_iface;
 
521
        _tmp3_ = baobab_hostname_iface_get_pretty_hostname (_tmp2_);
 
522
        _tmp4_ = _tmp3_;
 
523
        pretty_name = _tmp4_;
 
524
        _tmp5_ = pretty_name;
 
525
        if (g_strcmp0 (_tmp5_, "") != 0) {
 
526
                result = pretty_name;
 
527
                _g_object_unref0 (hostname_iface);
 
528
                return result;
 
529
        } else {
 
530
                BaobabHostnameIface* _tmp6_;
 
531
                gchar* _tmp7_;
 
532
                gchar* _tmp8_;
 
533
                _tmp6_ = hostname_iface;
 
534
                _tmp7_ = baobab_hostname_iface_get_hostname (_tmp6_);
 
535
                _tmp8_ = _tmp7_;
 
536
                result = _tmp8_;
 
537
                _g_free0 (pretty_name);
 
538
                _g_object_unref0 (hostname_iface);
 
539
                return result;
 
540
        }
 
541
        _g_free0 (pretty_name);
 
542
        _g_object_unref0 (hostname_iface);
 
543
}
 
544
 
190
545
 
191
546
static gpointer _baobab_location_ref0 (gpointer self) {
192
547
        return self ? baobab_location_ref (self) : NULL;
312
667
 
313
668
BaobabLocation* baobab_location_construct_for_main_volume (GType object_type) {
314
669
        BaobabLocation* self = NULL;
315
 
        const gchar* _tmp0_ = NULL;
316
 
        GFile* _tmp1_ = NULL;
317
 
        GFile* _tmp2_;
318
 
        GThemedIcon* _tmp3_;
319
 
        GThemedIcon* _tmp4_;
 
670
        GFile* _tmp4_ = NULL;
320
671
        GFile* _tmp5_;
321
 
        BaobabScanner* _tmp6_;
322
 
        BaobabScanner* _tmp7_;
 
672
        GThemedIcon* _tmp6_;
 
673
        GThemedIcon* _tmp7_;
 
674
        GFile* _tmp8_;
 
675
        BaobabScanner* _tmp9_;
 
676
        BaobabScanner* _tmp10_;
 
677
        GError * _inner_error_ = NULL;
323
678
        self = (BaobabLocation*) g_type_create_instance (object_type);
324
 
        _tmp0_ = _ ("Main volume");
325
 
        baobab_location_set_name (self, _tmp0_);
326
 
        _tmp1_ = g_file_new_for_path ("/");
327
 
        _tmp2_ = _tmp1_;
328
 
        baobab_location_set_file (self, _tmp2_);
329
 
        _g_object_unref0 (_tmp2_);
 
679
        {
 
680
                gchar* _tmp0_ = NULL;
 
681
                gchar* _tmp1_;
 
682
                gchar* _tmp2_;
 
683
                _tmp0_ = baobab_location_get_hostname (self, &_inner_error_);
 
684
                _tmp1_ = _tmp0_;
 
685
                if (_inner_error_ != NULL) {
 
686
                        goto __catch4_g_error;
 
687
                }
 
688
                _tmp2_ = _tmp1_;
 
689
                baobab_location_set_name (self, _tmp2_);
 
690
                _g_free0 (_tmp2_);
 
691
        }
 
692
        goto __finally4;
 
693
        __catch4_g_error:
 
694
        {
 
695
                GError* e = NULL;
 
696
                const gchar* _tmp3_ = NULL;
 
697
                e = _inner_error_;
 
698
                _inner_error_ = NULL;
 
699
                _tmp3_ = _ ("Main volume");
 
700
                baobab_location_set_name (self, _tmp3_);
 
701
                _g_error_free0 (e);
 
702
        }
 
703
        __finally4:
 
704
        if (_inner_error_ != NULL) {
 
705
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
706
                g_clear_error (&_inner_error_);
 
707
                return NULL;
 
708
        }
 
709
        _tmp4_ = g_file_new_for_path ("/");
 
710
        _tmp5_ = _tmp4_;
 
711
        baobab_location_set_file (self, _tmp5_);
 
712
        _g_object_unref0 (_tmp5_);
330
713
        baobab_location_get_file_info (self);
331
 
        _tmp3_ = (GThemedIcon*) g_themed_icon_new ("drive-harddisk-system");
332
 
        _tmp4_ = _tmp3_;
333
 
        baobab_location_set_icon (self, (GIcon*) _tmp4_);
334
 
        _g_object_unref0 (_tmp4_);
335
 
        baobab_location_get_fs_usage (self);
336
 
        _tmp5_ = self->priv->_file;
337
 
        _tmp6_ = baobab_scanner_new (_tmp5_, BAOBAB_SCAN_FLAGS_EXCLUDE_MOUNTS);
 
714
        _tmp6_ = (GThemedIcon*) g_themed_icon_new ("drive-harddisk-system");
338
715
        _tmp7_ = _tmp6_;
339
 
        baobab_location_set_scanner (self, _tmp7_);
 
716
        baobab_location_set_icon (self, (GIcon*) _tmp7_);
340
717
        _g_object_unref0 (_tmp7_);
 
718
        baobab_location_get_fs_usage (self);
 
719
        _tmp8_ = self->priv->_file;
 
720
        _tmp9_ = baobab_scanner_new (_tmp8_, BAOBAB_SCAN_FLAGS_EXCLUDE_MOUNTS);
 
721
        _tmp10_ = _tmp9_;
 
722
        baobab_location_set_scanner (self, _tmp10_);
 
723
        _g_object_unref0 (_tmp10_);
341
724
        return self;
342
725
}
343
726
 
474
857
                GVolume* _tmp7_;
475
858
                GIcon* _tmp8_ = NULL;
476
859
                GIcon* _tmp9_;
477
 
                guint64 _tmp10_;
478
 
                guint64 _tmp11_;
479
860
                _tmp4_ = self->priv->_volume;
480
861
                _tmp5_ = g_volume_get_name (_tmp4_);
481
862
                _tmp6_ = _tmp5_;
488
869
                _g_object_unref0 (_tmp9_);
489
870
                baobab_location_set_file (self, NULL);
490
871
                baobab_location_set_info (self, NULL);
491
 
                _tmp10_ = (guint64) 0;
492
 
                baobab_location_set_size (self, &_tmp10_);
493
 
                _tmp11_ = (guint64) 0;
494
 
                baobab_location_set_used (self, &_tmp11_);
 
872
                baobab_location_set_size (self, NULL);
 
873
                baobab_location_set_used (self, NULL);
495
874
                baobab_location_set_scanner (self, NULL);
496
875
        }
497
876
}
572
951
                _tmp1_ = g_file_query_info (_tmp0_, BAOBAB_LOCATION_FILE_ATTRIBUTES, G_FILE_QUERY_INFO_NONE, NULL, &_inner_error_);
573
952
                _tmp2_ = _tmp1_;
574
953
                if (_inner_error_ != NULL) {
575
 
                        goto __catch4_g_error;
 
954
                        goto __catch5_g_error;
576
955
                }
577
956
                _tmp3_ = _tmp2_;
578
957
                baobab_location_set_info (self, _tmp3_);
579
958
                _g_object_unref0 (_tmp3_);
580
959
        }
581
 
        goto __finally4;
582
 
        __catch4_g_error:
 
960
        goto __finally5;
 
961
        __catch5_g_error:
583
962
        {
584
963
                GError* e = NULL;
585
964
                e = _inner_error_;
587
966
                baobab_location_set_info (self, NULL);
588
967
                _g_error_free0 (e);
589
968
        }
590
 
        __finally4:
 
969
        __finally5:
591
970
        if (_inner_error_ != NULL) {
592
971
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
593
972
                g_clear_error (&_inner_error_);
617
996
                _tmp1_ = g_file_query_filesystem_info (_tmp0_, BAOBAB_LOCATION_FS_ATTRIBUTES, NULL, &_inner_error_);
618
997
                info = _tmp1_;
619
998
                if (_inner_error_ != NULL) {
620
 
                        goto __catch5_g_error;
 
999
                        goto __catch6_g_error;
621
1000
                }
622
1001
                _tmp2_ = g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE);
623
1002
                if (_tmp2_) {
665
1044
                }
666
1045
                _g_object_unref0 (info);
667
1046
        }
668
 
        goto __finally5;
669
 
        __catch5_g_error:
 
1047
        goto __finally6;
 
1048
        __catch6_g_error:
670
1049
        {
671
1050
                GError* e = NULL;
672
1051
                e = _inner_error_;
673
1052
                _inner_error_ = NULL;
674
1053
                _g_error_free0 (e);
675
1054
        }
676
 
        __finally5:
 
1055
        __finally6:
677
1056
        if (_inner_error_ != NULL) {
678
1057
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
679
1058
                g_clear_error (&_inner_error_);
1038
1417
}
1039
1418
 
1040
1419
 
 
1420
gboolean baobab_location_get_is_home (BaobabLocation* self) {
 
1421
        gboolean result;
 
1422
        BaobabLocation* _tmp0_;
 
1423
        g_return_val_if_fail (self != NULL, FALSE);
 
1424
        _tmp0_ = baobab_location_home_location;
 
1425
        result = _tmp0_ == self;
 
1426
        return result;
 
1427
}
 
1428
 
 
1429
 
1041
1430
static void baobab_value_location_init (GValue* value) {
1042
1431
        value->data[0].v_pointer = NULL;
1043
1432
}