[gtksourceview] Implement method to open a file.



commit 53732133d6696f5301c992edf6e3855ed369ff2a
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Tue Jun 22 20:01:49 2010 +0200

    Implement method to open a file.

 tests/test-widget.py |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/tests/test-widget.py b/tests/test-widget.py
index 9463247..27dd73f 100644
--- a/tests/test-widget.py
+++ b/tests/test-widget.py
@@ -282,7 +282,18 @@ class Window(Gtk.Window):
     def open_file_cb(self, action):
         chooser = Gtk.FileChooserDialog("Open File...", None,
                                         Gtk.FileChooserAction.OPEN,
-                                        Gtk.STOCK_CANCEL)
+                                        (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+                                         Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
+
+        response = chooser.run()
+
+        if response == Gtk.ResponseType.OK:
+            filename = chooser.get_filename()
+
+            if filename:
+                self.open_file(filename)
+
+        chooser.destroy()
 
     def print_file_cb(self, action):
         compositor = GtkSource.PrintCompositor.new_from_view (self._view)



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