[cheese/three-point-oh] File Delete implemented.
- From: Yuvaraj Pandian <yuvipanda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/three-point-oh] File Delete implemented.
- Date: Sun, 11 Jul 2010 21:51:51 +0000 (UTC)
commit c13c7975d372e3e7b4f787d772136c645cc4a168
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date: Mon Jul 12 01:44:31 2010 +0530
File Delete implemented.
Only hotkey (shift+del) works. Need to implement popup menu.
Assumes user doesn't have stupid file perms on photo/video storage folder, so delete always possible
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 2915e08..6cb324c 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -101,6 +101,35 @@ public class Cheese.MainWindow : Gtk.Window
}
[CCode (instance_pos = -1)]
+ internal void on_file_delete (Gtk.Action action)
+ {
+ string filename, basename;
+ MessageDialog confirmation_dialog;
+ int response;
+
+ filename = thumb_view.get_selected_image ();
+ if (filename == null)
+ return; /* Nothing selected. */
+
+ basename = GLib.Filename.display_basename (filename);
+ confirmation_dialog = new MessageDialog.with_markup (this,
+ Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
+ Gtk.MessageType.WARNING,
+ Gtk.ButtonsType.NONE,
+ "Are you sure you want to permanently delete the file \"%s\"?",
+ basename);
+ confirmation_dialog.add_button (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL);
+ confirmation_dialog.add_button (Gtk.STOCK_DELETE, Gtk.ResponseType.ACCEPT);
+ confirmation_dialog.format_secondary_text ("%s", "If you delete an item, it will be permanently lost");
+ response = confirmation_dialog.run ();
+ confirmation_dialog.destroy ();
+ if (response == Gtk.ResponseType.ACCEPT)
+ {
+ GLib.FileUtils.remove (filename);
+ }
+ }
+
+ [CCode (instance_pos = -1)]
internal void on_help_contents (Gtk.Action action)
{
Gdk.Screen screen;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]