mirror of
https://github.com/linuxmint/timeshift.git
synced 2024-08-16 20:10:39 +03:00
Use an unsafe cast (#200)
This approach resolves warnings like this: Access to possible `null'. Perform a check or use an unsafe cast.
This commit is contained in:
parent
bd4d2b5b5c
commit
a31bfe628e
@ -133,7 +133,7 @@ class BackupDeviceBox : Gtk.Box{
|
|||||||
Device dev;
|
Device dev;
|
||||||
model.get (iter, 0, out dev, -1);
|
model.get (iter, 0, out dev, -1);
|
||||||
|
|
||||||
(cell as Gtk.CellRendererPixbuf).visible = (dev.type == "disk");
|
((Gtk.CellRendererPixbuf)cell).visible = (dev.type == "disk");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -144,9 +144,9 @@ class BackupDeviceBox : Gtk.Box{
|
|||||||
bool selected;
|
bool selected;
|
||||||
model.get (iter, 0, out dev, 3, out selected, -1);
|
model.get (iter, 0, out dev, 3, out selected, -1);
|
||||||
|
|
||||||
(cell as Gtk.CellRendererToggle).active = selected;
|
((Gtk.CellRendererToggle)cell).active = selected;
|
||||||
|
|
||||||
(cell as Gtk.CellRendererToggle).visible =
|
((Gtk.CellRendererToggle)cell).visible =
|
||||||
(dev.size_bytes > 10 * KB) && (dev.type != "disk") && (dev.children.size == 0);
|
(dev.size_bytes > 10 * KB) && (dev.type != "disk") && (dev.children.size == 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -175,10 +175,10 @@ class BackupDeviceBox : Gtk.Box{
|
|||||||
if (txt.length == 0){
|
if (txt.length == 0){
|
||||||
txt = "%s Disk".printf(format_file_size(dev.size_bytes));
|
txt = "%s Disk".printf(format_file_size(dev.size_bytes));
|
||||||
}
|
}
|
||||||
(cell as Gtk.CellRendererText).text = txt.strip();
|
((Gtk.CellRendererText)cell).text = txt.strip();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(cell as Gtk.CellRendererText).text = dev.kname;
|
((Gtk.CellRendererText)cell).text = dev.kname;
|
||||||
}
|
}
|
||||||
|
|
||||||
//(cell as Gtk.CellRendererText).sensitive = (dev.type != "disk");
|
//(cell as Gtk.CellRendererText).sensitive = (dev.type != "disk");
|
||||||
@ -192,7 +192,7 @@ class BackupDeviceBox : Gtk.Box{
|
|||||||
col.set_cell_data_func(cell_text, (cell_layout, cell, model, iter)=>{
|
col.set_cell_data_func(cell_text, (cell_layout, cell, model, iter)=>{
|
||||||
Device dev;
|
Device dev;
|
||||||
model.get (iter, 0, out dev, -1);
|
model.get (iter, 0, out dev, -1);
|
||||||
(cell as Gtk.CellRendererText).text = dev.fstype;
|
((Gtk.CellRendererText)cell).text = dev.fstype;
|
||||||
|
|
||||||
//(cell as Gtk.CellRendererText).sensitive = (dev.type != "disk");
|
//(cell as Gtk.CellRendererText).sensitive = (dev.type != "disk");
|
||||||
});
|
});
|
||||||
@ -206,7 +206,7 @@ class BackupDeviceBox : Gtk.Box{
|
|||||||
Device dev;
|
Device dev;
|
||||||
model.get (iter, 0, out dev, -1);
|
model.get (iter, 0, out dev, -1);
|
||||||
|
|
||||||
(cell as Gtk.CellRendererText).text =
|
((Gtk.CellRendererText)cell).text =
|
||||||
(dev.size_bytes > 0) ? format_file_size(dev.size_bytes, false, "", true, 0) : "";
|
(dev.size_bytes > 0) ? format_file_size(dev.size_bytes, false, "", true, 0) : "";
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -220,14 +220,14 @@ class BackupDeviceBox : Gtk.Box{
|
|||||||
model.get (iter, 0, out dev, -1);
|
model.get (iter, 0, out dev, -1);
|
||||||
|
|
||||||
if (dev.type == "disk"){
|
if (dev.type == "disk"){
|
||||||
(cell as Gtk.CellRendererText).text = "";
|
((Gtk.CellRendererText)cell).text = "";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
(cell as Gtk.CellRendererText).text =
|
((Gtk.CellRendererText)cell).text =
|
||||||
(dev.free_bytes > 0) ? format_file_size(dev.free_bytes, false, "", true, 0) : "";
|
(dev.free_bytes > 0) ? format_file_size(dev.free_bytes, false, "", true, 0) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
(cell as Gtk.CellRendererText).sensitive = (dev.type != "disk");
|
((Gtk.CellRendererText)cell).sensitive = (dev.type != "disk");
|
||||||
});
|
});
|
||||||
|
|
||||||
// name
|
// name
|
||||||
@ -240,13 +240,13 @@ class BackupDeviceBox : Gtk.Box{
|
|||||||
model.get (iter, 0, out dev, -1);
|
model.get (iter, 0, out dev, -1);
|
||||||
|
|
||||||
if (dev.type == "disk"){
|
if (dev.type == "disk"){
|
||||||
(cell as Gtk.CellRendererText).text = "";
|
((Gtk.CellRendererText)cell).text = "";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
(cell as Gtk.CellRendererText).text = dev.partlabel;
|
((Gtk.CellRendererText)cell).text = dev.partlabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
(cell as Gtk.CellRendererText).sensitive = (dev.type != "disk");
|
((Gtk.CellRendererText)cell).sensitive = (dev.type != "disk");
|
||||||
});
|
});
|
||||||
|
|
||||||
// label
|
// label
|
||||||
@ -259,13 +259,13 @@ class BackupDeviceBox : Gtk.Box{
|
|||||||
model.get (iter, 0, out dev, -1);
|
model.get (iter, 0, out dev, -1);
|
||||||
|
|
||||||
if (dev.type == "disk"){
|
if (dev.type == "disk"){
|
||||||
(cell as Gtk.CellRendererText).text = "";
|
((Gtk.CellRendererText)cell).text = "";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
(cell as Gtk.CellRendererText).text = dev.label;
|
((Gtk.CellRendererText)cell).text = dev.label;
|
||||||
}
|
}
|
||||||
|
|
||||||
(cell as Gtk.CellRendererText).sensitive = (dev.type != "disk");
|
((Gtk.CellRendererText)cell).sensitive = (dev.type != "disk");
|
||||||
});
|
});
|
||||||
|
|
||||||
// buffer
|
// buffer
|
||||||
|
@ -91,11 +91,11 @@ class BootOptionsBox : Gtk.Box{
|
|||||||
|
|
||||||
if (dev.type == "disk"){
|
if (dev.type == "disk"){
|
||||||
//log_msg("desc:" + dev.description());
|
//log_msg("desc:" + dev.description());
|
||||||
(cell as Gtk.CellRendererText).markup =
|
((Gtk.CellRendererText)cell).markup =
|
||||||
"<b>%s (MBR)</b>".printf(dev.description_formatted());
|
"<b>%s (MBR)</b>".printf(dev.description_formatted());
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
(cell as Gtk.CellRendererText).text = dev.description();
|
((Gtk.CellRendererText)cell).text = dev.description();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class ExcludeAppsBox : Gtk.Box{
|
|||||||
col.set_cell_data_func(cell_toggle, (cell_layout, cell, model, iter)=>{
|
col.set_cell_data_func(cell_toggle, (cell_layout, cell, model, iter)=>{
|
||||||
AppExcludeEntry entry;
|
AppExcludeEntry entry;
|
||||||
model.get (iter, 0, out entry, -1);
|
model.get (iter, 0, out entry, -1);
|
||||||
(cell as Gtk.CellRendererToggle).active = entry.enabled;
|
((Gtk.CellRendererToggle)cell).active = entry.enabled;
|
||||||
});
|
});
|
||||||
|
|
||||||
cell_toggle.toggled.connect ((cell_toggle, path) => {
|
cell_toggle.toggled.connect ((cell_toggle, path) => {
|
||||||
@ -124,7 +124,7 @@ class ExcludeAppsBox : Gtk.Box{
|
|||||||
|
|
||||||
AppExcludeEntry entry;
|
AppExcludeEntry entry;
|
||||||
model.get (iter, 0, out entry, -1);
|
model.get (iter, 0, out entry, -1);
|
||||||
(cell as Gtk.CellRendererText).text = entry.name;
|
((Gtk.CellRendererText)cell).text = entry.name;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ class ExcludeBox : Gtk.Box{
|
|||||||
col.set_cell_data_func (cell_text, (cell_layout, cell, model, iter)=>{
|
col.set_cell_data_func (cell_text, (cell_layout, cell, model, iter)=>{
|
||||||
string pattern;
|
string pattern;
|
||||||
model.get (iter, 0, out pattern, -1);
|
model.get (iter, 0, out pattern, -1);
|
||||||
(cell as Gtk.CellRendererText).text =
|
((Gtk.CellRendererText)cell).text =
|
||||||
pattern.has_prefix("+ ") ? pattern[2:pattern.length] : pattern;
|
pattern.has_prefix("+ ") ? pattern[2:pattern.length] : pattern;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -489,7 +489,7 @@ class ExcludeBox : Gtk.Box{
|
|||||||
model.set (iter, 2, include);
|
model.set (iter, 2, include);
|
||||||
model.set (iter, 3, !include);
|
model.set (iter, 3, !include);
|
||||||
|
|
||||||
var adj = (treeview as Gtk.Scrollable).get_hadjustment();
|
var adj = ((Gtk.Scrollable)treeview).get_hadjustment();
|
||||||
adj.value = adj.upper;
|
adj.value = adj.upper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ public class ExcludeMessageWindow : Gtk.Dialog{
|
|||||||
|
|
||||||
string pattern;
|
string pattern;
|
||||||
model.get (iter, 0, out pattern, -1);
|
model.get (iter, 0, out pattern, -1);
|
||||||
(cell as Gtk.CellRendererText).text = pattern.has_prefix("+ ") ? pattern[2:pattern.length] : pattern;
|
((Gtk.CellRendererText)cell).text = pattern.has_prefix("+ ") ? pattern[2:pattern.length] : pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tv_exclude_add_item(string path){
|
private void tv_exclude_add_item(string path){
|
||||||
@ -175,7 +175,7 @@ public class ExcludeMessageWindow : Gtk.Dialog{
|
|||||||
|
|
||||||
model.set (iter, 0, path, 1, icon_name);
|
model.set (iter, 0, path, 1, icon_name);
|
||||||
|
|
||||||
Adjustment adj = (tv_exclude as Gtk.Scrollable).get_hadjustment();
|
Adjustment adj = ((Gtk.Scrollable)tv_exclude).get_hadjustment();
|
||||||
adj.value = adj.upper;
|
adj.value = adj.upper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class MiscBox : Gtk.Box{
|
|||||||
string txt;
|
string txt;
|
||||||
model.get (iter, 0, out txt, -1);
|
model.get (iter, 0, out txt, -1);
|
||||||
|
|
||||||
(cell as Gtk.CellRendererText).text = (txt.length == 0) ? _("Custom") : now.format(txt);
|
((Gtk.CellRendererText)cell).text = (txt.length == 0) ? _("Custom") : now.format(txt);
|
||||||
});
|
});
|
||||||
|
|
||||||
// populate combo
|
// populate combo
|
||||||
|
@ -200,11 +200,11 @@ class RestoreDeviceBox : Gtk.Box{
|
|||||||
if (dev != null){
|
if (dev != null){
|
||||||
|
|
||||||
if (dev.type == "disk"){
|
if (dev.type == "disk"){
|
||||||
(cell as Gtk.CellRendererPixbuf).icon_name = IconManager.ICON_HARDDRIVE;
|
((Gtk.CellRendererPixbuf)cell).icon_name = IconManager.ICON_HARDDRIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
(cell as Gtk.CellRendererPixbuf).sensitive = (dev.type != "disk");
|
((Gtk.CellRendererPixbuf)cell).sensitive = (dev.type != "disk");
|
||||||
(cell as Gtk.CellRendererPixbuf).visible = (dev.type == "disk");
|
((Gtk.CellRendererPixbuf)cell).visible = (dev.type == "disk");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -237,11 +237,11 @@ class RestoreDeviceBox : Gtk.Box{
|
|||||||
model.get (iter, 0, out dev, -1);
|
model.get (iter, 0, out dev, -1);
|
||||||
|
|
||||||
if (dev != null){
|
if (dev != null){
|
||||||
(cell as Gtk.CellRendererText).markup = dev.description_simple_formatted();
|
((Gtk.CellRendererText)cell).markup = dev.description_simple_formatted();
|
||||||
(cell as Gtk.CellRendererText).sensitive = (dev.type != "disk");
|
((Gtk.CellRendererText)cell).sensitive = (dev.type != "disk");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
(cell as Gtk.CellRendererText).markup = _("Keep on Root Device");
|
((Gtk.CellRendererText)cell).markup = _("Keep on Root Device");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ public class RsyncLogBox : Gtk.Box {
|
|||||||
combo.set_cell_data_func(cell_text, (cell_layout, cell, model, iter)=>{
|
combo.set_cell_data_func(cell_text, (cell_layout, cell, model, iter)=>{
|
||||||
string val;
|
string val;
|
||||||
model.get (iter, 1, out val, -1);
|
model.get (iter, 1, out val, -1);
|
||||||
(cell as Gtk.CellRendererText).text = val;
|
((Gtk.CellRendererText)cell).text = val;
|
||||||
});
|
});
|
||||||
|
|
||||||
//populate combo
|
//populate combo
|
||||||
|
@ -108,7 +108,7 @@ class UsersBox : Gtk.Box{
|
|||||||
col.set_cell_data_func (cell_text, (cell_layout, cell, model, iter)=>{
|
col.set_cell_data_func (cell_text, (cell_layout, cell, model, iter)=>{
|
||||||
SystemUser user;
|
SystemUser user;
|
||||||
model.get(iter, 0, out user);
|
model.get(iter, 0, out user);
|
||||||
(cell as Gtk.CellRendererText).text = user.name;
|
((Gtk.CellRendererText)cell).text = user.name;
|
||||||
});
|
});
|
||||||
|
|
||||||
// column
|
// column
|
||||||
@ -123,7 +123,7 @@ class UsersBox : Gtk.Box{
|
|||||||
col.set_cell_data_func (cell_text, (cell_layout, cell, model, iter)=>{
|
col.set_cell_data_func (cell_text, (cell_layout, cell, model, iter)=>{
|
||||||
SystemUser user;
|
SystemUser user;
|
||||||
model.get(iter, 0, out user);
|
model.get(iter, 0, out user);
|
||||||
(cell as Gtk.CellRendererText).text = user.home_path;
|
((Gtk.CellRendererText)cell).text = user.home_path;
|
||||||
});
|
});
|
||||||
|
|
||||||
// column -------------------------------------------------
|
// column -------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user