[cheese/three-point-oh] add move all to trash functionality



commit 1a1142b210ef72f734d19f63a1342e995f1d4279
Author: daniel g. siegel <dgsiegel gnome org>
Date:   Tue Jul 13 22:07:50 2010 +0200

    add move all to trash functionality

 src/cheese-window.vala |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index e3d94e2..6bbda81 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -182,6 +182,35 @@ public class Cheese.MainWindow : Gtk.Window
   }
 
   [CCode (instance_pos = -1)]
+  internal void on_file_move_to_trash_all (Gtk.Action action)
+  {
+    try {
+        File file_to_trash;
+        FileInfo file_info;
+        var directory = File.new_for_path (fileutil.get_photo_path ());
+        var enumerator = directory.enumerate_children (FILE_ATTRIBUTE_STANDARD_NAME, 0, null);
+
+        while ((file_info = enumerator.next_file (null)) != null) {
+          file_to_trash = File.new_for_path (fileutil.get_photo_path () + GLib.Path.DIR_SEPARATOR_S + file_info.get_name ());
+          file_to_trash.trash (null);
+        }
+
+        directory = File.new_for_path (fileutil.get_video_path ());
+        enumerator = directory.enumerate_children (FILE_ATTRIBUTE_STANDARD_NAME, 0, null);
+
+        while ((file_info = enumerator.next_file (null)) != null) {
+          file_to_trash = File.new_for_path (fileutil.get_photo_path () + GLib.Path.DIR_SEPARATOR_S + file_info.get_name ());
+          file_to_trash.trash (null);
+        }
+
+    } catch (Error e) {
+        warning ("Error: %s\n", e.message);
+        return;
+    }
+
+  }
+
+  [CCode (instance_pos = -1)]
   internal void on_file_save_as (Gtk.Action action)
   {
     string            filename, basename;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]