117
137
static BaobabLocation* baobab_location_home_location;
118
138
static BaobabLocation* baobab_location_home_location = NULL;
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);
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);
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};
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);
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);
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);
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);
265
static void baobab_hostname_iface_base_init (BaobabHostnameIfaceIface * iface) {
266
static gboolean initialized = FALSE;
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);
285
return baobab_hostname_iface_type_id__volatile;
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;
295
static void baobab_hostname_iface_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
299
static void baobab_hostname_iface_proxy_init (BaobabHostnameIfaceProxy* self) {
303
static gchar* baobab_hostname_iface_dbus_proxy_get_pretty_hostname (BaobabHostnameIface* self) {
304
GVariant *_inner_reply;
306
_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "PrettyHostname");
308
GVariant *_arguments;
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);
319
g_variant_get (_reply, "(v)", &_inner_reply);
320
g_variant_unref (_reply);
322
_result = g_variant_dup_string (_inner_reply, NULL);
323
g_variant_unref (_inner_reply);
328
static void baobab_hostname_iface_dbus_proxy_set_pretty_hostname (BaobabHostnameIface* self, const gchar* value) {
329
GVariant *_arguments;
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);
343
g_variant_unref (_reply);
347
static gchar* baobab_hostname_iface_dbus_proxy_get_hostname (BaobabHostnameIface* self) {
348
GVariant *_inner_reply;
350
_inner_reply = g_dbus_proxy_get_cached_property ((GDBusProxy *) self, "Hostname");
352
GVariant *_arguments;
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);
363
g_variant_get (_reply, "(v)", &_inner_reply);
364
g_variant_unref (_reply);
366
_result = g_variant_dup_string (_inner_reply, NULL);
367
g_variant_unref (_inner_reply);
372
static void baobab_hostname_iface_dbus_proxy_set_hostname (BaobabHostnameIface* self, const gchar* value) {
373
GVariant *_arguments;
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);
387
g_variant_unref (_reply);
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;
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) {
404
g_object_unref (invocation);
408
static GVariant* _dbus_baobab_hostname_iface_get_pretty_hostname (BaobabHostnameIface* self) {
411
result = baobab_hostname_iface_get_pretty_hostname (self);
412
_reply = g_variant_new_string (result);
418
static GVariant* _dbus_baobab_hostname_iface_get_hostname (BaobabHostnameIface* self) {
421
result = baobab_hostname_iface_get_hostname (self);
422
_reply = g_variant_new_string (result);
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) {
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);
442
static void _dbus_baobab_hostname_iface_set_pretty_hostname (BaobabHostnameIface* self, GVariant* _value) {
444
value = g_variant_dup_string (_value, NULL);
445
baobab_hostname_iface_set_pretty_hostname (self, value);
450
static void _dbus_baobab_hostname_iface_set_hostname (BaobabHostnameIface* self, GVariant* _value) {
452
value = g_variant_dup_string (_value, NULL);
453
baobab_hostname_iface_set_hostname (self, value);
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) {
463
if (strcmp (property_name, "PrettyHostname") == 0) {
464
_dbus_baobab_hostname_iface_set_pretty_hostname (object, value);
466
} else if (strcmp (property_name, "Hostname") == 0) {
467
_dbus_baobab_hostname_iface_set_hostname (object, value);
474
guint baobab_hostname_iface_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
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);
489
static void _baobab_hostname_iface_unregister_object (gpointer user_data) {
492
g_object_unref (data[0]);
493
g_object_unref (data[1]);
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_;
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);
518
_g_object_unref0 (hostname_iface);
519
hostname_iface = _tmp1_;
520
_tmp2_ = hostname_iface;
521
_tmp3_ = baobab_hostname_iface_get_pretty_hostname (_tmp2_);
523
pretty_name = _tmp4_;
524
_tmp5_ = pretty_name;
525
if (g_strcmp0 (_tmp5_, "") != 0) {
526
result = pretty_name;
527
_g_object_unref0 (hostname_iface);
530
BaobabHostnameIface* _tmp6_;
533
_tmp6_ = hostname_iface;
534
_tmp7_ = baobab_hostname_iface_get_hostname (_tmp6_);
537
_g_free0 (pretty_name);
538
_g_object_unref0 (hostname_iface);
541
_g_free0 (pretty_name);
542
_g_object_unref0 (hostname_iface);
191
546
static gpointer _baobab_location_ref0 (gpointer self) {
192
547
return self ? baobab_location_ref (self) : NULL;
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;
670
GFile* _tmp4_ = NULL;
321
BaobabScanner* _tmp6_;
322
BaobabScanner* _tmp7_;
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 ("/");
328
baobab_location_set_file (self, _tmp2_);
329
_g_object_unref0 (_tmp2_);
680
gchar* _tmp0_ = NULL;
683
_tmp0_ = baobab_location_get_hostname (self, &_inner_error_);
685
if (_inner_error_ != NULL) {
686
goto __catch4_g_error;
689
baobab_location_set_name (self, _tmp2_);
696
const gchar* _tmp3_ = NULL;
698
_inner_error_ = NULL;
699
_tmp3_ = _ ("Main volume");
700
baobab_location_set_name (self, _tmp3_);
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_);
709
_tmp4_ = g_file_new_for_path ("/");
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");
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");
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);
722
baobab_location_set_scanner (self, _tmp10_);
723
_g_object_unref0 (_tmp10_);