[cheese] Show error dialogs when any of the file operations fail
- From: Yuvaraj Pandian <yuvipanda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese] Show error dialogs when any of the file operations fail
- Date: Sat, 7 Aug 2010 10:01:31 +0000 (UTC)
commit e0a0e7b7546d625c24d2d805986d098c0948580e
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date: Sat Aug 7 15:30:46 2010 +0530
Show error dialogs when any of the file operations fail
src/cheese-window.vala | 41 ++++++++++++++++++++++++++++++++++++-----
1 files changed, 36 insertions(+), 5 deletions(-)
---
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 6a53978..99821d4 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -157,10 +157,25 @@ public class Cheese.MainWindow : Gtk.Window
if (filename == null)
return; /* Nothing selected. */
- uri = GLib.Filename.to_uri (filename);
+ try
+ {
+ uri = GLib.Filename.to_uri (filename);
+ screen = this.get_screen ();
+ Gtk.show_uri (screen, uri, Gtk.get_current_event_time ());
+ }
+ 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 open %s",
+ filename);
- screen = this.get_screen ();
- Gtk.show_uri (screen, uri, Gtk.get_current_event_time ());
+ error_dialog.run ();
+ error_dialog.destroy ();
+ }
}
[CCode (instance_pos = -1)]
@@ -202,7 +217,23 @@ public class Cheese.MainWindow : Gtk.Window
return; /* Nothing selected. */
File file_to_trash = File.new_for_path (filename);
- file_to_trash.trash (null);
+ try
+ {
+ 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);
+
+ error_dialog.run ();
+ error_dialog.destroy ();
+ }
}
[CCode (instance_pos = -1)]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]