Skip to content

Commit d9f5ca7

Browse files
ygerlachmtwebster
authored andcommitted
remove unused code; fix compiler warnings; only update control file if changed
1 parent e7aa902 commit d9f5ca7

12 files changed

+39
-271
lines changed

src/Gtk/BootOptionsWindow.vala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,9 @@ using TeeJee.Misc;
3535
class BootOptionsWindow : Gtk.Window{
3636

3737
private Gtk.Box vbox_main;
38-
private Gtk.ButtonBox bbox_action;
3938
private BootOptionsBox boot_options_box;
4039

4140
private uint tmr_init;
42-
private int def_width = 450;
43-
private int def_height = 500;
4441

4542
public BootOptionsWindow() {
4643

src/Gtk/ExcludeBox.vala

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -370,44 +370,6 @@ class ExcludeBox : Gtk.Box{
370370
save_changes();
371371
}
372372

373-
private void add_folder_contents_clicked(){
374-
375-
var list = browse_folder();
376-
377-
if (list.length() > 0){
378-
foreach(string item in list){
379-
380-
string pattern = item;
381-
382-
if (!pattern.has_suffix("/**")){
383-
pattern = "%s/**".printf(pattern);
384-
}
385-
386-
/*
387-
NOTE:
388-
389-
+ <dir>/** will include the directory along with the contents
390-
+ <dir>/ will include only the directory without the contents
391-
392-
<dir>/** will exclude the directory contents but include the empty directory
393-
<dir>/ will exclude the directory along with the contents
394-
*/
395-
396-
if (!App.exclude_list_user.contains(pattern)){
397-
App.exclude_list_user.add(pattern);
398-
treeview_add_item(treeview, pattern);
399-
log_debug("contents: %s".printf(pattern));
400-
Main.first_snapshot_size = 0; //re-calculate
401-
}
402-
else{
403-
log_debug("exclude_list_user contains: %s".printf(pattern));
404-
}
405-
}
406-
}
407-
408-
save_changes();
409-
}
410-
411373
private SList<string> browse_files(){
412374

413375
var list = new SList<string>();
@@ -506,25 +468,6 @@ class ExcludeBox : Gtk.Box{
506468
model.set (iter, 3, !include);
507469
}
508470

509-
private void cell_exclude_text_edited(string path, string new_text) {
510-
511-
string old_pattern;
512-
string new_pattern;
513-
514-
TreeIter iter;
515-
var model = (Gtk.ListStore) treeview.model;
516-
model.get_iter_from_string (out iter, path);
517-
model.get (iter, 0, out old_pattern, -1);
518-
519-
if (old_pattern.has_prefix("+ ")){
520-
new_pattern = "+ " + new_text;
521-
}
522-
else{
523-
new_pattern = new_text;
524-
}
525-
model.set (iter, 0, new_pattern);
526-
}
527-
528471
public void save_changes(){
529472

530473
App.exclude_list_user.clear();
@@ -540,7 +483,7 @@ class ExcludeBox : Gtk.Box{
540483
if (!App.exclude_list_user.contains(pattern)
541484
&& !App.exclude_list_default.contains(pattern)
542485
&& !App.exclude_list_home.contains(pattern)){
543-
486+
544487
App.exclude_list_user.add(pattern);
545488
}
546489

src/Gtk/MainWindow.vala

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -405,19 +405,6 @@ class MainWindow : Gtk.Window{
405405

406406
return menu_item;
407407
}
408-
409-
private Gtk.MenuItem create_menu_item_separator(){
410-
411-
var menu_item = new Gtk.MenuItem();
412-
menu_item.sensitive = false;
413-
414-
var box = new Gtk.Box(Orientation.HORIZONTAL, 3);
415-
menu_item.add(box);
416-
417-
box.add(new Gtk.Separator(Gtk.Orientation.HORIZONTAL));
418-
419-
return menu_item;
420-
}
421408

422409
private bool refresh_all(){
423410

@@ -463,9 +450,7 @@ class MainWindow : Gtk.Window{
463450
var msg = _("Select another device?");
464451

465452
var type = Gtk.MessageType.ERROR;
466-
var buttons_type = Gtk.ButtonsType.YES_NO;
467-
468-
var dlg = new CustomMessageDialog(title, msg, type, this, buttons_type);
453+
var dlg = new CustomMessageDialog(title, msg, type, this, Gtk.ButtonsType.YES_NO);
469454
var response = dlg.run();
470455
dlg.destroy();
471456

@@ -748,16 +733,6 @@ class MainWindow : Gtk.Window{
748733
restore();
749734
}
750735

751-
private void btn_clone_clicked(){
752-
753-
if (check_if_deletion_running()){
754-
return;
755-
}
756-
757-
App.mirror_system = true;
758-
restore();
759-
}
760-
761736
private bool check_if_deletion_running(){
762737

763738
if (App.thread_delete_running){

src/Gtk/MiscBox.vala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,6 @@ class MiscBox : Gtk.Box{
131131
bool selected = combo.get_active_iter(out iter_active);
132132
if (!selected){ return; }
133133

134-
TreeIter iter_combo;
135-
var store = (Gtk.ListStore) combo.model;
136-
137134
string txt;
138135
model.get (iter_active, 0, out txt, -1);
139136

src/Gtk/RestoreExcludeBox.vala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,4 @@ class RestoreExcludeBox : Gtk.Box{
131131
chk_web.toggled();
132132
chk_torrent.toggled();
133133
}
134-
135-
public bool show_all_apps(){
136-
137-
return chk_other.active;
138-
}
139134
}

src/Gtk/RestoreWindow.vala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,8 @@ class RestoreWindow : Gtk.Window{
230230
var title = _("Cancel restore?");
231231

232232
var msg = _("Cancelling the restore process will leave the target system in an inconsistent state. The system may fail to boot or you may run into various issues. After cancelling, you need to restore another snapshot, to bring the system to a consistent state. Click Yes to confirm.");
233-
234-
var type = Gtk.MessageType.ERROR;
235-
var buttons_type = Gtk.ButtonsType.YES_NO;
236-
237-
var dlg = new CustomMessageDialog(title, msg, type, this, buttons_type);
233+
234+
var dlg = new CustomMessageDialog(title, msg, Gtk.MessageType.ERROR, this, Gtk.ButtonsType.YES_NO);
238235
var response = dlg.run();
239236
dlg.destroy();
240237

src/Gtk/RsyncLogBox.vala

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -667,48 +667,4 @@ public class RsyncLogBox : Gtk.Box {
667667
return (item.file_status == status_filter);
668668
}
669669
}
670-
671-
private void exclude_selected_items(){
672-
var list = new Gee.ArrayList<string>();
673-
foreach(var pattern in App.exclude_list_user){
674-
list.add(pattern);
675-
}
676-
App.exclude_list_user.clear();
677-
678-
// TODO: medium: exclude selected items: not working
679-
680-
// add include list
681-
TreeIter iter;
682-
var store = (Gtk.ListStore) treeview.model;
683-
bool iterExists = store.get_iter_first (out iter);
684-
while (iterExists) {
685-
FileItem item;
686-
store.get (iter, 0, out item);
687-
688-
string pattern = item.file_path;
689-
690-
if (item.file_type == FileType.DIRECTORY){
691-
pattern = "%s/***".printf(pattern);
692-
}
693-
else{
694-
//pattern = "%s/***".printf(pattern);
695-
}
696-
697-
if (!App.exclude_list_user.contains(pattern)
698-
&& !App.exclude_list_default.contains(pattern)
699-
&& !App.exclude_list_home.contains(pattern)){
700-
701-
list.add(pattern);
702-
}
703-
704-
iterExists = store.iter_next (ref iter);
705-
}
706-
707-
App.exclude_list_user = list;
708-
709-
log_debug("exclude_selected_items()");
710-
foreach(var item in App.exclude_list_user){
711-
log_debug(item);
712-
}
713-
}
714670
}

src/Gtk/SnapshotListBox.vala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,10 @@ class SnapshotListBox : Gtk.Box{
237237
var model = (Gtk.ListStore) treeview.model;
238238
model.get_iter_from_string (out iter, path);
239239
model.get (iter, 0, out bak, -1);
240-
bak.description = new_text;
241-
bak.update_control_file();
240+
if (bak.description != new_text) {
241+
bak.description = new_text;
242+
bak.update_control_file();
243+
}
242244
});
243245

244246
var col_buffer = new TreeViewColumn();

src/Gtk/UsersBox.vala

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -427,33 +427,4 @@ class UsersBox : Gtk.Box{
427427

428428
exclude_box.refresh_treeview();
429429
}
430-
431-
public void save_changes(){
432-
433-
//App.exclude_list_user.clear();
434-
435-
// add include patterns from treeview
436-
/*TreeIter iter;
437-
var store = (Gtk.ListStore) treeview.model;
438-
bool iterExists = store.get_iter_first (out iter);
439-
while (iterExists) {
440-
string pattern;
441-
store.get(iter, 0, out pattern);
442-
443-
if (!App.exclude_list_user.contains(pattern)
444-
&& !App.exclude_list_default.contains(pattern)
445-
&& !App.exclude_list_home.contains(pattern)){
446-
447-
App.exclude_list_user.add(pattern);
448-
}
449-
450-
iterExists = store.iter_next(ref iter);
451-
}*/
452-
453-
log_debug("save_changes(): exclude_list_user:");
454-
foreach(var item in App.exclude_list_user){
455-
log_debug(item);
456-
}
457-
log_debug("");
458-
}
459430
}

src/Utility/Gtk/CustomMessageDialog.vala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,19 @@ public class CustomMessageDialog : Gtk.Dialog {
143143
// actions -------------------------
144144

145145
switch(buttons_type){
146+
case Gtk.ButtonsType.NONE: break;
146147
case Gtk.ButtonsType.OK:
147148
btn_ok = (Gtk.Button) add_button (_("OK"), Gtk.ResponseType.OK);
148149
btn_ok.grab_focus();
149150
break;
151+
case Gtk.ButtonsType.CLOSE:
152+
btn_cancel = (Gtk.Button) add_button (_("Close"), Gtk.ResponseType.CLOSE);
153+
btn_cancel.grab_focus();
154+
break;
155+
case Gtk.ButtonsType.CANCEL:
156+
btn_cancel = (Gtk.Button) add_button (_("Cancel"), Gtk.ResponseType.CANCEL);
157+
btn_cancel.grab_focus();
158+
break;
150159
case Gtk.ButtonsType.OK_CANCEL:
151160
btn_ok = (Gtk.Button) add_button (_("OK"), Gtk.ResponseType.OK);
152161
btn_cancel = (Gtk.Button) add_button (_("Cancel"), Gtk.ResponseType.CANCEL);
@@ -157,7 +166,6 @@ public class CustomMessageDialog : Gtk.Dialog {
157166
btn_no = (Gtk.Button) add_button (_("No"), Gtk.ResponseType.NO);
158167
btn_yes.grab_focus();
159168
break;
160-
161169
}
162170
}
163171
}

0 commit comments

Comments
 (0)