← Back to team overview

deja-dup-team team mailing list archive

[Merge] lp:~throughnothing/deja-dup/include_exclude_files into lp:deja-dup

 

throughnothing has proposed merging lp:~throughnothing/deja-dup/include_exclude_files into lp:deja-dup.

Requested reviews:
  Michael Terry (mterry)

For more details, see:
https://code.launchpad.net/~throughnothing/deja-dup/include_exclude_files/+merge/51916

Oops...apparently I did my last merge request backwards....sorry this is my first time doing a merge request in launchpad and with bzr.

This is my first time working with vala, and my first time poking around with deja-dup, so I'm sure this change is far from perfect (and maybe not the best way to do this?), but It essentially just replaces the "Add" buttons on the "Files" tab of the preferences dialog with "Add File" and "Add Folder" buttons for both the include and exclude ConfigLists.

I realized this would work when I saw that it was already just adding an --include and --exclude flag for each item in the list, so files or folders would pass through just fine.

Of course, I'm not sure if this is the best UI for this, as it does add an extra button, and thus some added complexity.

Let me know your thoughts, any comments/suggestions greatly appreciated. I look forward to doing more with deja-dup in the future :)
-- 
https://code.launchpad.net/~throughnothing/deja-dup/include_exclude_files/+merge/51916
Your team Déjà Dup Maintainers is subscribed to branch lp:deja-dup.
=== modified file 'widgets/ConfigList.vala'
--- widgets/ConfigList.vala	2011-01-15 19:24:30 +0000
+++ widgets/ConfigList.vala	2011-03-02 16:08:56 +0000
@@ -31,7 +31,8 @@
   }
   
   Gtk.TreeView tree;
-  Gtk.Button add_button;
+  Gtk.Button add_folder_button;
+  Gtk.Button add_file_button;
   Gtk.Button remove_button;
   construct {
     var model = new Gtk.ListStore(3, typeof(string), typeof(string), typeof(Icon));
@@ -45,15 +46,19 @@
     var renderer = new Gtk.CellRendererText();
     tree.insert_column_with_attributes(-1, null, renderer,
                                        "text", 1);
+
+    add_file_button = new Gtk.Button.with_label("Add File");
+    add_file_button.clicked.connect(handle_add_file);
     
-    add_button = new Gtk.Button.from_stock(Gtk.Stock.ADD);
-    add_button.clicked.connect(handle_add);
+    add_folder_button = new Gtk.Button.with_label("Add Folder");
+    add_folder_button.clicked.connect(handle_add_folder);
     
     remove_button = new Gtk.Button.from_stock(Gtk.Stock.REMOVE);
     remove_button.clicked.connect(handle_remove);
 
     if (size_group != null) {
-      size_group.add_widget(add_button);
+      size_group.add_widget(add_file_button);
+      size_group.add_widget(add_folder_button);
       size_group.add_widget(remove_button);
     }
 
@@ -64,7 +69,8 @@
     var hbox = new Gtk.HBox(false, 6);
     var vbox = new Gtk.VBox(false, 6);
     
-    vbox.pack_start(add_button, false, false, 0);
+    vbox.pack_start(add_file_button, false, false, 0);
+    vbox.pack_start(add_folder_button, false, false, 0);
     vbox.pack_start(remove_button, false, false, 0);
     scroll.add(tree);
     hbox.add(scroll);
@@ -153,14 +159,9 @@
     var empty = sel.count_selected_rows() == 0;
     remove_button.set_sensitive(!empty);
   }
-  
-  void handle_add()
+
+  void handle_add(Gtk.FileChooserDialog dlg)
   {
-    var dlg = new Gtk.FileChooserDialog(_("Choose folders"),
-                                        get_ancestor(typeof(Gtk.Window)) as Gtk.Window,
-                                        Gtk.FileChooserAction.SELECT_FOLDER,
-                                        Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
-                          				      Gtk.Stock.OPEN, Gtk.ResponseType.ACCEPT);
     dlg.select_multiple = true;
     
     if (dlg.run() != Gtk.ResponseType.ACCEPT) {
@@ -192,6 +193,26 @@
     settings.set_value(key, new Variant.strv(slist));
   }
   
+  void handle_add_file()
+  {
+    var dlg = new Gtk.FileChooserDialog(_("Choose folders"),
+                                        get_ancestor(typeof(Gtk.Window)) as Gtk.Window,
+                                        Gtk.FileChooserAction.OPEN,
+                                        Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
+                          				      Gtk.Stock.OPEN, Gtk.ResponseType.ACCEPT);
+    handle_add(dlg);
+  }
+
+  void handle_add_folder()
+  {
+    var dlg = new Gtk.FileChooserDialog(_("Choose folders"),
+                                        get_ancestor(typeof(Gtk.Window)) as Gtk.Window,
+                                        Gtk.FileChooserAction.SELECT_FOLDER,
+                                        Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
+                          				      Gtk.Stock.OPEN, Gtk.ResponseType.ACCEPT);
+    handle_add(dlg);
+  }
+  
   void handle_remove()
   {
     var sel = tree.get_selection();


Follow ups