~teejee2008/timeshift/trunk

« back to all changes in this revision

Viewing changes to src/Gtk/RestoreDeviceBox.vala

  • Committer: Tony George
  • Date: 2016-08-31 16:11:26 UTC
  • Revision ID: tony.george.kol@gmail.com-20160831161126-ls37s4yldjzwoop2
Added option to keep additional mount paths on root device;

Show diffs side-by-side

added added

removed removed

Lines of Context:
159
159
                        combo.get_active_iter (out iter);
160
160
                        combo.model.get (iter, 0, out dev, -1);
161
161
                        
162
 
                        //tooltip.set_icon(get_shared_icon_pixbuf("drive-harddisk", "drive-harddisk", 256)); 
163
 
                        tooltip.set_markup(dev.tooltip_text());
 
162
                        //tooltip.set_icon(get_shared_icon_pixbuf("drive-harddisk", "drive-harddisk", 256));
 
163
                        if (dev != null){
 
164
                                tooltip.set_markup(dev.tooltip_text());
 
165
                        }
 
166
                        else{
 
167
                                tooltip.set_markup(_("Keep this mount path on the root filesystem"));
 
168
                        }
 
169
                        
164
170
                        return true;
165
171
                });
166
172
 
168
174
                        Device dev;
169
175
                        model.get (iter, 0, out dev, -1);
170
176
 
171
 
                        (cell as Gtk.CellRendererText).markup = dev.description_formatted();
 
177
                        if (dev != null){
 
178
                                (cell as Gtk.CellRendererText).markup = dev.description_formatted();
 
179
                        }
 
180
                        else{
 
181
                                (cell as Gtk.CellRendererText).markup = _("Keep on Root Device");
 
182
                        }
172
183
                });
173
184
                
174
185
                // populate combo
175
186
                var model = new Gtk.ListStore(2, typeof(Device), typeof(MountEntry));
176
187
                combo.model = model;
177
 
 
 
188
                
178
189
                var active = 0;
179
 
                var index = 0;
 
190
                var index = -1;
180
191
                TreeIter iter;
 
192
 
 
193
                if (entry.mount_point != "/"){
 
194
                        index++;
 
195
                        model.append(out iter);
 
196
                        model.set (iter, 0, null);
 
197
                        model.set (iter, 1, entry);
 
198
                }
 
199
        
181
200
                foreach(var dev in App.partitions){
182
201
                        // skip disk and loop devices
183
202
                        if ((dev.type == "disk")||(dev.type == "loop")){
191
210
                                }
192
211
                        }
193
212
 
 
213
                        index++;
194
214
                        model.append(out iter);
195
215
                        model.set (iter, 0, dev);
196
216
                        model.set (iter, 1, entry);
198
218
                        if ((entry.device != null) && (dev.uuid == entry.device.uuid)){
199
219
                                active = index;
200
220
                        }
201
 
 
202
 
                        index++;
203
221
                }
204
222
 
205
223
                combo.active = active;
210
228
                        TreeIter iter_active;
211
229
                        combo.get_active_iter (out iter_active);
212
230
                        combo.model.get(iter_active, 0, out current_dev, 1, out current_entry, -1);
213
 
                        
214
 
                        foreach(var item in App.mount_list){
215
 
                                if (item.mount_point == current_entry.mount_point){
216
 
                                        current_entry.device = current_dev;
217
 
                                        break;
218
 
                                }
219
 
                        }
 
231
 
 
232
                        current_entry.device = current_dev;
220
233
                });
221
234
 
222
235
                return combo;
273
286
                                        "<b>%s (MBR)</b>".printf(dev.description_formatted());
274
287
                        }
275
288
                        else{
276
 
                                (cell as Gtk.CellRendererText).text = "   " + dev.description();
 
289
                                (cell as Gtk.CellRendererText).text = dev.description();
277
290
                        }
278
291
                });
279
292