[cheese] allow multiple items moved to trash at once



commit b48344d10112d595ff45aa265984cc5be0e2fa2c
Author: daniel g. siegel <dgsiegel gnome org>
Date:   Sun Dec 5 18:16:18 2010 +0100

    allow multiple items moved to trash at once

 src/cheese-window.vala            |   42 +++++++++++---------
 src/vapi/cheese-common.vapi       |   34 ++++++++--------
 src/vapi/cheese-thumbview.vapi    |    7 ++-
 src/vapi/clutter-tablelayout.vapi |   80 ++++++++++++++++++------------------
 4 files changed, 84 insertions(+), 79 deletions(-)
---
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index ae65e01..a970ffd 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -215,29 +215,33 @@ public class Cheese.MainWindow : Gtk.Window
   [CCode (instance_pos = -1)]
   public void on_file_move_to_trash (Gtk.Action action)
   {
-    string filename;
+    File file;
 
-    filename = thumb_view.get_selected_image ();
-    if (filename == null)
-      return;                    /* Nothing selected. */
+    GLib.List<GLib.File> files = thumb_view.get_selected_images_list ();
 
-    File file_to_trash = File.new_for_path (filename);
-    try
+    for (int i = 0; i < files.length (); i++)
     {
-      file_to_trash.trash (null);
-    }
-    catch (Error err)
-    {
-      MessageDialog error_dialog = new MessageDialog (this,
-                                                      Gtk.DialogFlags.MODAL |
-                                                      Gtk.DialogFlags.DESTROY_WITH_PARENT,
-                                                      Gtk.MessageType.ERROR,
-                                                      Gtk.ButtonsType.OK,
-                                                      "Could not move %s to trash",
-                                                      filename);
+      file = files<GLib.File>.nth (i).data;
+      if (file == null)
+        return;
 
-      error_dialog.run ();
-      error_dialog.destroy ();
+      try
+      {
+        file.trash (null);
+      }
+      catch (Error err)
+      {
+        MessageDialog error_dialog = new MessageDialog (this,
+                                                        Gtk.DialogFlags.MODAL |
+                                                        Gtk.DialogFlags.DESTROY_WITH_PARENT,
+                                                        Gtk.MessageType.ERROR,
+                                                        Gtk.ButtonsType.OK,
+                                                        "Could not move %s to trash",
+                                                        file.get_path());
+
+        error_dialog.run ();
+        error_dialog.destroy ();
+      }
     }
   }
 
diff --git a/src/vapi/cheese-common.vapi b/src/vapi/cheese-common.vapi
index eee8cdc..c17260b 100644
--- a/src/vapi/cheese-common.vapi
+++ b/src/vapi/cheese-common.vapi
@@ -3,22 +3,22 @@
 [CCode (cprefix = "Cheese", lower_case_cprefix = "cheese_")]
 namespace Cheese
 {
-	[CCode (cheader_filename = "cheese-effect.h")]
-	public class Effect : GLib.Object
-	{
-		[CCode (has_construct_function = false)]
-		public Effect ();
-		[NoAccessorMethod]
-		public string name {owned get; set;}
-		[NoAccessorMethod]
-		public string pipeline_desc {owned get; set;}
-		[NoAccessorMethod]
-		public Gst.Element control_valve {get; set;}
+  [CCode (cheader_filename = "cheese-effect.h")]
+  public class Effect : GLib.Object
+  {
+    [CCode (has_construct_function = false)]
+    public Effect ();
+    [NoAccessorMethod]
+    public string name {owned get; set;}
+    [NoAccessorMethod]
+    public string pipeline_desc {owned get; set;}
+    [NoAccessorMethod]
+    public Gst.Element control_valve {get; set;}
 
-		public void enable_preview();
-		public void disable_preview();
-		public bool is_preview_connected();
-	}
+    public void enable_preview();
+    public void disable_preview();
+    public bool is_preview_connected();
+  }
 
   [CCode (cheader_filename = "cheese-camera.h")]
   public class Camera : GLib.Object
@@ -37,8 +37,8 @@ namespace Cheese
     public void                        set_device_by_dev_file (string file);
     public void                        set_device_by_dev_udi (string udi);
     public void                        set_effect (Cheese.Effect effect);
-	public void                        toggle_effects_pipeline (bool active);
-	public void                        connect_effect_texture (Cheese.Effect effect, Clutter.Texture texture);
+    public void                        toggle_effects_pipeline (bool active);
+    public void                        connect_effect_texture (Cheese.Effect effect, Clutter.Texture texture);
     public void                        set_video_format (Cheese.VideoFormat format);
     public void                        setup (string udi) throws GLib.Error;
     public void                        start_video_recording (string filename);
diff --git a/src/vapi/cheese-thumbview.vapi b/src/vapi/cheese-thumbview.vapi
index 29309c8..50d2bd5 100644
--- a/src/vapi/cheese-thumbview.vapi
+++ b/src/vapi/cheese-thumbview.vapi
@@ -5,8 +5,9 @@ namespace Cheese
   public class ThumbView : Gtk.IconView
   {
     public ThumbView ();
-    public string get_selected_image ();
-    public int    get_n_selected ();
-    public void   remove_item (GLib.File file);
+    public string          get_selected_image ();
+    public List<GLib.File> get_selected_images_list ();
+    public int             get_n_selected ();
+    public void            remove_item (GLib.File file);
   }
 }
diff --git a/src/vapi/clutter-tablelayout.vapi b/src/vapi/clutter-tablelayout.vapi
index 70e4079..c9147d0 100644
--- a/src/vapi/clutter-tablelayout.vapi
+++ b/src/vapi/clutter-tablelayout.vapi
@@ -3,43 +3,43 @@ using Clutter;
 [CCode (cprefix = "Clutter", lower_case_cprefix = "clutter_", gir_namespace = "Clutter", gir_version = "1.0")]
 namespace Clutter {
 
-	
-	[CCode (cprefix = "CLUTTER_TABLE_ALIGNMENT_", cheader_filename = "clutter/clutter.h")]
-	public enum TableAlignment {
-		START,
-		CENTER,
-		END
-	}
-	
-	[CCode (cheader_filename = "clutter/clutter.h")]
-	public class TableLayout : Clutter.LayoutManager {
-		[CCode (type = "ClutterLayoutManager*", has_construct_function = false)]
-		public TableLayout ();
-		public void get_alignment (Clutter.Actor actor, Clutter.TableAlignment x_align, Clutter.TableAlignment y_align);
-		public int get_column_count ();
-		public uint get_column_spacing ();
-		public uint get_easing_duration ();
-		public ulong get_easing_mode ();
-		public void get_expand (Clutter.Actor actor, bool x_expand, bool y_expand);
-		public void get_fill (Clutter.Actor actor, bool x_fill, bool y_fill);
-		public int get_row_count ();
-		public uint get_row_spacing ();
-		public void get_span (Clutter.Actor actor, int column_span, int row_span);
-		public bool get_use_animations ();
-		public void pack (Clutter.Actor actor, int column, int row);
-		public void set_alignment (Clutter.Actor actor, Clutter.TableAlignment x_align, Clutter.TableAlignment y_align);
-		public void set_column_spacing (uint spacing);
-		public void set_easing_duration (uint msecs);
-		public void set_easing_mode (ulong mode);
-		public void set_expand (Clutter.Actor actor, bool x_expand, bool y_expand);
-		public void set_fill (Clutter.Actor actor, bool x_fill, bool y_fill);
-		public void set_row_spacing (uint spacing);
-		public void set_span (Clutter.Actor actor, int column_span, int row_span);
-		public void set_use_animations (bool animate);
-		public uint column_spacing { get; set; }
-		public uint easing_duration { get; set; }
-		public ulong easing_mode { get; set; }
-		public uint row_spacing { get; set; }
-		public bool use_animations { get; set; }
-	}
-}
\ No newline at end of file
+
+  [CCode (cprefix = "CLUTTER_TABLE_ALIGNMENT_", cheader_filename = "clutter/clutter.h")]
+  public enum TableAlignment {
+    START,
+    CENTER,
+    END
+  }
+
+  [CCode (cheader_filename = "clutter/clutter.h")]
+  public class TableLayout : Clutter.LayoutManager {
+    [CCode (type = "ClutterLayoutManager*", has_construct_function = false)]
+    public TableLayout ();
+    public void  get_alignment (Clutter.Actor actor, Clutter.TableAlignment x_align, Clutter.TableAlignment y_align);
+    public int   get_column_count ();
+    public uint  get_column_spacing ();
+    public uint  get_easing_duration ();
+    public ulong get_easing_mode ();
+    public void  get_expand (Clutter.Actor actor, bool x_expand, bool y_expand);
+    public void  get_fill (Clutter.Actor actor, bool x_fill, bool y_fill);
+    public int   get_row_count ();
+    public uint  get_row_spacing ();
+    public void  get_span (Clutter.Actor actor, int column_span, int row_span);
+    public bool  get_use_animations ();
+    public void  pack (Clutter.Actor actor, int column, int row);
+    public void  set_alignment (Clutter.Actor actor, Clutter.TableAlignment x_align, Clutter.TableAlignment y_align);
+    public void  set_column_spacing (uint spacing);
+    public void  set_easing_duration (uint msecs);
+    public void  set_easing_mode (ulong mode);
+    public void  set_expand (Clutter.Actor actor, bool x_expand, bool y_expand);
+    public void  set_fill (Clutter.Actor actor, bool x_fill, bool y_fill);
+    public void  set_row_spacing (uint spacing);
+    public void  set_span (Clutter.Actor actor, int column_span, int row_span);
+    public void  set_use_animations (bool animate);
+    public uint  column_spacing { get; set; }
+    public uint  easing_duration { get; set; }
+    public ulong easing_mode { get; set; }
+    public uint  row_spacing { get; set; }
+    public bool  use_animations { get; set; }
+  }
+}



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