~teejee2008/timeshift/trunk

« back to all changes in this revision

Viewing changes to src/Gtk/RestoreDeviceBox.vala

  • Committer: Tony George
  • Date: 2016-11-01 12:07:45 UTC
  • Revision ID: tony.george.kol@gmail.com-20161101120745-rqdl2p6125cgp428
RestoreWindow: Fixed some issues in device selection logic; Comboboxes would remain unselected in some scenarios; User will be prompted to unlock default devices before the restore window is displayed;

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
 
125
125
    public void refresh(bool reset_device_selections = true){
126
126
                log_debug("RestoreDeviceBox: refresh()");
 
127
                App.update_partitions();
127
128
                create_device_selection_options(reset_device_selections);
128
129
                refresh_cmb_grub_dev();
129
130
                log_debug("RestoreDeviceBox: refresh(): exit");
130
131
        }
131
132
 
132
133
        private void create_device_selection_options(bool reset_device_selections){
133
 
 
 
134
                
134
135
                if (reset_device_selections){
135
136
                        App.init_mount_list();
136
137
                }
285
286
                        model.append(out iter);
286
287
                        model.set (iter, 0, dev);
287
288
                        model.set (iter, 1, entry);
288
 
 
289
 
                        if ((entry.device != null) && (dev.uuid == entry.device.uuid)){
290
 
                                active = index;
 
289
                
 
290
                        if (entry.device != null){
 
291
                                if (dev.uuid == entry.device.uuid){
 
292
                                        active = index;
 
293
                                }
 
294
                                else if (dev.has_parent() && (dev.parent.uuid == entry.device.uuid)){
 
295
                                        active = index;
 
296
                                }
 
297
                                else if (dev.has_children() && (dev.children[0].uuid == entry.device.uuid)){
 
298
                                        // this will not occur since we are skipping parent devices in this loop
 
299
                                        active = index;
 
300
                                }
291
301
                        }
292
302
                }
293
303
 
294
304
                if ((active == -1) && (entry.mount_point != "/")){
295
305
                        active = 0; // keep on root device
296
306
                }
 
307
 
 
308
                combo.active = active;
297
309
                
298
310
                combo.changed.connect((path) => {
299
311
 
362
374
                                        current_entry.device = luks_unlocked;
363
375
 
364
376
                                        // refresh devices
365
 
                                        
366
 
                                        App.update_partitions();
 
377
 
367
378
                                        refresh(false); // do not reset selections
368
379
                                        return; // no need to continue
369
380
                                }
393
404
                        current_entry.device = current_dev;
394
405
                });
395
406
 
396
 
                combo.active = active;
397
 
 
398
407
                return combo;
399
408
        }
400
409