~ubuntu-branches/ubuntu/raring/baobab/raring-proposed

« back to all changes in this revision

Viewing changes to src/baobab-location-list.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-09-17 23:15:17 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20120917231517-j1piymfhj5uye3fy
Tags: 3.5.92-0ubuntu1
New upstream bugfix release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
static void baobab_location_list_real_child_activated (EggListBox* base, GtkWidget* widget);
109
109
GType baobab_location_widget_get_type (void) G_GNUC_CONST;
110
110
BaobabLocation* baobab_location_widget_get_location (BaobabLocationWidget* self);
 
111
static gboolean baobab_location_list_already_present (BaobabLocationList* self, GFile* file);
 
112
GFile* baobab_location_get_file (BaobabLocation* self);
111
113
static void baobab_location_list_volume_changed (BaobabLocationList* self, GVolume* volume);
112
114
void baobab_location_list_update (BaobabLocationList* self);
113
115
static void baobab_location_list_volume_removed (BaobabLocationList* self, GVolume* volume);
122
124
BaobabLocation* baobab_location_new_from_mount (GMount* mount_);
123
125
BaobabLocation* baobab_location_construct_from_mount (GType object_type, GMount* mount_);
124
126
void baobab_location_update (BaobabLocation* self);
125
 
static gboolean baobab_location_list_already_present (BaobabLocationList* self, GFile* file);
126
 
GFile* baobab_location_get_file (BaobabLocation* self);
127
127
static void baobab_location_list_populate (BaobabLocationList* self);
128
128
BaobabLocation* baobab_location_new_for_main_volume (void);
129
129
BaobabLocation* baobab_location_construct_for_main_volume (GType object_type);
232
232
}
233
233
 
234
234
 
235
 
static void baobab_location_list_volume_changed (BaobabLocationList* self, GVolume* volume) {
236
 
        g_return_if_fail (self != NULL);
237
 
        g_return_if_fail (volume != NULL);
238
 
        baobab_location_list_update (self);
239
 
}
240
 
 
241
 
 
242
235
static gpointer _baobab_location_ref0 (gpointer self) {
243
236
        return self ? baobab_location_ref (self) : NULL;
244
237
}
245
238
 
246
239
 
 
240
static gboolean baobab_location_list_already_present (BaobabLocationList* self, GFile* file) {
 
241
        gboolean result = FALSE;
 
242
        GList* _tmp0_;
 
243
        g_return_val_if_fail (self != NULL, FALSE);
 
244
        g_return_val_if_fail (file != NULL, FALSE);
 
245
        _tmp0_ = self->priv->locations;
 
246
        {
 
247
                GList* l_collection = NULL;
 
248
                GList* l_it = NULL;
 
249
                l_collection = _tmp0_;
 
250
                for (l_it = l_collection; l_it != NULL; l_it = l_it->next) {
 
251
                        BaobabLocation* _tmp1_;
 
252
                        BaobabLocation* l = NULL;
 
253
                        _tmp1_ = _baobab_location_ref0 ((BaobabLocation*) l_it->data);
 
254
                        l = _tmp1_;
 
255
                        {
 
256
                                gboolean _tmp2_ = FALSE;
 
257
                                BaobabLocation* _tmp3_;
 
258
                                GFile* _tmp4_;
 
259
                                GFile* _tmp5_;
 
260
                                gboolean _tmp11_;
 
261
                                _tmp3_ = l;
 
262
                                _tmp4_ = baobab_location_get_file (_tmp3_);
 
263
                                _tmp5_ = _tmp4_;
 
264
                                if (_tmp5_ != NULL) {
 
265
                                        BaobabLocation* _tmp6_;
 
266
                                        GFile* _tmp7_;
 
267
                                        GFile* _tmp8_;
 
268
                                        GFile* _tmp9_;
 
269
                                        gboolean _tmp10_ = FALSE;
 
270
                                        _tmp6_ = l;
 
271
                                        _tmp7_ = baobab_location_get_file (_tmp6_);
 
272
                                        _tmp8_ = _tmp7_;
 
273
                                        _tmp9_ = file;
 
274
                                        _tmp10_ = g_file_equal (_tmp8_, _tmp9_);
 
275
                                        _tmp2_ = _tmp10_;
 
276
                                } else {
 
277
                                        _tmp2_ = FALSE;
 
278
                                }
 
279
                                _tmp11_ = _tmp2_;
 
280
                                if (_tmp11_) {
 
281
                                        result = TRUE;
 
282
                                        _baobab_location_unref0 (l);
 
283
                                        return result;
 
284
                                }
 
285
                                _baobab_location_unref0 (l);
 
286
                        }
 
287
                }
 
288
        }
 
289
        result = FALSE;
 
290
        return result;
 
291
}
 
292
 
 
293
 
 
294
static void baobab_location_list_volume_changed (BaobabLocationList* self, GVolume* volume) {
 
295
        g_return_if_fail (self != NULL);
 
296
        g_return_if_fail (volume != NULL);
 
297
        baobab_location_list_update (self);
 
298
}
 
299
 
 
300
 
247
301
static void baobab_location_list_volume_removed (BaobabLocationList* self, GVolume* volume) {
248
302
        GList* _tmp0_;
249
303
        g_return_if_fail (self != NULL);
351
405
        _tmp2_ = volume;
352
406
        if (_tmp2_ == NULL) {
353
407
                GMount* _tmp3_;
354
 
                BaobabLocation* _tmp4_;
 
408
                GFile* _tmp4_ = NULL;
 
409
                GFile* _tmp5_;
 
410
                gboolean _tmp6_ = FALSE;
 
411
                gboolean _tmp7_;
355
412
                _tmp3_ = mount;
356
 
                _tmp4_ = baobab_location_new_from_mount (_tmp3_);
357
 
                self->priv->locations = g_list_append (self->priv->locations, _tmp4_);
 
413
                _tmp4_ = g_mount_get_root (_tmp3_);
 
414
                _tmp5_ = _tmp4_;
 
415
                _tmp6_ = baobab_location_list_already_present (self, _tmp5_);
 
416
                _tmp7_ = !_tmp6_;
 
417
                _g_object_unref0 (_tmp5_);
 
418
                if (_tmp7_) {
 
419
                        GMount* _tmp8_;
 
420
                        BaobabLocation* _tmp9_;
 
421
                        _tmp8_ = mount;
 
422
                        _tmp9_ = baobab_location_new_from_mount (_tmp8_);
 
423
                        self->priv->locations = g_list_append (self->priv->locations, _tmp9_);
 
424
                }
358
425
        } else {
359
 
                GList* _tmp5_;
360
 
                _tmp5_ = self->priv->locations;
 
426
                GList* _tmp10_;
 
427
                _tmp10_ = self->priv->locations;
361
428
                {
362
429
                        GList* location_collection = NULL;
363
430
                        GList* location_it = NULL;
364
 
                        location_collection = _tmp5_;
 
431
                        location_collection = _tmp10_;
365
432
                        for (location_it = location_collection; location_it != NULL; location_it = location_it->next) {
366
 
                                BaobabLocation* _tmp6_;
 
433
                                BaobabLocation* _tmp11_;
367
434
                                BaobabLocation* location = NULL;
368
 
                                _tmp6_ = _baobab_location_ref0 ((BaobabLocation*) location_it->data);
369
 
                                location = _tmp6_;
 
435
                                _tmp11_ = _baobab_location_ref0 ((BaobabLocation*) location_it->data);
 
436
                                location = _tmp11_;
370
437
                                {
371
 
                                        BaobabLocation* _tmp7_;
372
 
                                        GVolume* _tmp8_;
373
 
                                        GVolume* _tmp9_;
374
 
                                        GVolume* _tmp10_;
375
 
                                        _tmp7_ = location;
376
 
                                        _tmp8_ = baobab_location_get_volume (_tmp7_);
377
 
                                        _tmp9_ = _tmp8_;
378
 
                                        _tmp10_ = volume;
379
 
                                        if (_tmp9_ == _tmp10_) {
380
 
                                                BaobabLocation* _tmp11_;
381
 
                                                _tmp11_ = location;
382
 
                                                baobab_location_update (_tmp11_);
 
438
                                        BaobabLocation* _tmp12_;
 
439
                                        GVolume* _tmp13_;
 
440
                                        GVolume* _tmp14_;
 
441
                                        GVolume* _tmp15_;
 
442
                                        _tmp12_ = location;
 
443
                                        _tmp13_ = baobab_location_get_volume (_tmp12_);
 
444
                                        _tmp14_ = _tmp13_;
 
445
                                        _tmp15_ = volume;
 
446
                                        if (_tmp14_ == _tmp15_) {
 
447
                                                BaobabLocation* _tmp16_;
 
448
                                                _tmp16_ = location;
 
449
                                                baobab_location_update (_tmp16_);
383
450
                                                _baobab_location_unref0 (location);
384
451
                                                break;
385
452
                                        }
393
460
}
394
461
 
395
462
 
396
 
static gboolean baobab_location_list_already_present (BaobabLocationList* self, GFile* file) {
397
 
        gboolean result = FALSE;
398
 
        GList* _tmp0_;
399
 
        g_return_val_if_fail (self != NULL, FALSE);
400
 
        g_return_val_if_fail (file != NULL, FALSE);
401
 
        _tmp0_ = self->priv->locations;
402
 
        {
403
 
                GList* l_collection = NULL;
404
 
                GList* l_it = NULL;
405
 
                l_collection = _tmp0_;
406
 
                for (l_it = l_collection; l_it != NULL; l_it = l_it->next) {
407
 
                        BaobabLocation* _tmp1_;
408
 
                        BaobabLocation* l = NULL;
409
 
                        _tmp1_ = _baobab_location_ref0 ((BaobabLocation*) l_it->data);
410
 
                        l = _tmp1_;
411
 
                        {
412
 
                                gboolean _tmp2_ = FALSE;
413
 
                                BaobabLocation* _tmp3_;
414
 
                                GFile* _tmp4_;
415
 
                                GFile* _tmp5_;
416
 
                                gboolean _tmp11_;
417
 
                                _tmp3_ = l;
418
 
                                _tmp4_ = baobab_location_get_file (_tmp3_);
419
 
                                _tmp5_ = _tmp4_;
420
 
                                if (_tmp5_ != NULL) {
421
 
                                        BaobabLocation* _tmp6_;
422
 
                                        GFile* _tmp7_;
423
 
                                        GFile* _tmp8_;
424
 
                                        GFile* _tmp9_;
425
 
                                        gboolean _tmp10_ = FALSE;
426
 
                                        _tmp6_ = l;
427
 
                                        _tmp7_ = baobab_location_get_file (_tmp6_);
428
 
                                        _tmp8_ = _tmp7_;
429
 
                                        _tmp9_ = file;
430
 
                                        _tmp10_ = g_file_equal (_tmp8_, _tmp9_);
431
 
                                        _tmp2_ = _tmp10_;
432
 
                                } else {
433
 
                                        _tmp2_ = FALSE;
434
 
                                }
435
 
                                _tmp11_ = _tmp2_;
436
 
                                if (_tmp11_) {
437
 
                                        result = TRUE;
438
 
                                        _baobab_location_unref0 (l);
439
 
                                        return result;
440
 
                                }
441
 
                                _baobab_location_unref0 (l);
442
 
                        }
443
 
                }
444
 
        }
445
 
        result = FALSE;
446
 
        return result;
447
 
}
448
 
 
449
 
 
450
463
static void _g_object_unref0_ (gpointer var) {
451
464
        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
452
465
}