[gtksourceview] Added optional user data to callbacks in python test widget



commit 3d8fccbc4833be385032110efa3cd4973f3c957b
Author: Garrett Regier <alias301 gmail com>
Date:   Sat Jul 3 04:35:02 2010 -0700

    Added optional user data to callbacks in python test widget

 tests/test-widget.py |   42 ++++++++++++++++++++----------------------
 1 files changed, 20 insertions(+), 22 deletions(-)
---
diff --git a/tests/test-widget.py b/tests/test-widget.py
index 6914b46..4bc7342 100644
--- a/tests/test-widget.py
+++ b/tests/test-widget.py
@@ -336,7 +336,7 @@ class Window(Gtk.Window):
         self._pos_label.set_text(msg)
 
     # Callbacks
-    def open_file_cb(self, action):
+    def open_file_cb(self, action, user_data=None):
         chooser = Gtk.FileChooserDialog("Open File...", None,
                                         Gtk.FileChooserAction.OPEN,
                                         (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
@@ -352,7 +352,7 @@ class Window(Gtk.Window):
 
         chooser.destroy()
 
-    def print_file_cb(self, action):
+    def print_file_cb(self, action, user_data=None):
         compositor = GtkSource.PrintCompositor.new_from_view (self._view)
         operation = Gtk.PrintOperation ()
         operation.set_job_name (os.path.basename(self._filepath))
@@ -364,7 +364,7 @@ class Window(Gtk.Window):
 
         operation.run (Gtk.PrintOperationAction.PRINT_DIALOG, None)
 
-    def find_cb(self, action):
+    def find_cb(self, action, user_data=None):
         dialog = SearchDialog(self, False, None, None)
 
         if dialog.is_case_sensitive:
@@ -388,7 +388,7 @@ class Window(Gtk.Window):
                 if searched:
                     self._buf.select_range(start, end)
 
-    def replace_cb(self, action):
+    def replace_cb(self, action, user_data=None):
         dialog = SearchDialog(self, False, None, None)
 
         if dialog.is_case_sensitive:
@@ -409,32 +409,32 @@ class Window(Gtk.Window):
             self._buf.insert(start, dialog.get_replace_text())
             i = start
 
-    def quit_cb(self, action):
+    def quit_cb(self, action, user_data=None):
         _quit()
 
-    def new_view_cb(self, action):
+    def new_view_cb(self, action, user_data=None):
         window = Window()
         window.show_all()
 
-    def hl_syntax_toggled_cb(self, action):
+    def hl_syntax_toggled_cb(self, action, user_data=None):
         self._buf.set_highlight_syntax(action.get_active())
 
-    def hl_bracket_toggled_cb(self, action):
+    def hl_bracket_toggled_cb(self, action, user_data=None):
         self._buf.set_highlight_matching_brackets(action.get_active())
 
-    def numbers_toggled_cb(self, action):
+    def numbers_toggled_cb(self, action, user_data=None):
         self._view.set_show_line_numbers(action.get_active())
 
-    def marks_toggled_cb(self, action):
+    def marks_toggled_cb(self, action, user_data=None):
         self._view.set_show_line_marks(action.get_active())
 
-    def margin_toggled_cb(self, action):
+    def margin_toggled_cb(self, action, user_data=None):
         self._view.set_show_right_margin(action.get_active())
 
-    def hl_line_toggled_cb(self, action):
+    def hl_line_toggled_cb(self, action, user_data=None):
         self._view.set_highlight_current_line(action.get_active())
 
-    def draw_spaces_toggled_cb(self, action):
+    def draw_spaces_toggled_cb(self, action, user_data=None):
 
         if (action.get_active()):
             draw_spaces = GtkSource.DrawSpacesFlags.ALL
@@ -442,7 +442,7 @@ class Window(Gtk.Window):
             draw_spaces = 0
         self._view.set_draw_spaces(draw_spaces)
 
-    def wrap_lines_toggled_cb(self, action):
+    def wrap_lines_toggled_cb(self, action, user_data=None):
 
         if (action.get_active()):
             wrap_mode = Gtk.WrapMode.WORD
@@ -450,13 +450,13 @@ class Window(Gtk.Window):
             wrap_mode = Gtk.WrapMode.NONE
         self._view.set_wrap_mode(wrap_mode)
 
-    def auto_indent_toggled_cb(self, action):
+    def auto_indent_toggled_cb(self, action, user_data=None):
         self._view.set_auto_indent(action.get_active())
 
-    def insert_spaces_toggled_cb(self, action):
+    def insert_spaces_toggled_cb(self, action, user_data=None):
         self._view.set_insert_spaces_instead_of_tabs(action.get_active())
 
-    def forward_string_cb(self, action):
+    def forward_string_cb(self, action, user_data=None):
         insert = self._buf.get_insert()
 
         it = self._buf.get_iter_at_mark(insert)
@@ -465,7 +465,7 @@ class Window(Gtk.Window):
             self._buf.place_cursor(it)
             self._view.scroll_mark_onscreen(insert)
 
-    def backward_string_cb(self, action):
+    def backward_string_cb(self, action, user_data=None):
         insert = self._buf.get_insert()
 
         it = self._buf.get_iter_at_mark(insert)
@@ -474,7 +474,7 @@ class Window(Gtk.Window):
             self._buf.place_cursor(it)
             self._view.scroll_mark_onscreen(insert)
 
-    def tabs_toggled_cb(self, action, current):
+    def tabs_toggled_cb(self, action, current, user_data=None):
         self._view.set_tab_width(current.get_current_value())
 
     def indent_toggled_cb(self, action, current):
@@ -483,7 +483,7 @@ class Window(Gtk.Window):
     def smart_home_end_toggled_cb(self, action, current):
         self._view.set_smart_home_end(current.get_current_value())
 
-    def about_cb(self, action):
+    def about_cb(self, action, user_data=None):
         about = AboutDialog(self)
         about.show()
 
@@ -522,8 +522,6 @@ class Window(Gtk.Window):
         mgr = GtkSource.LanguageManager.get_default()
         language = mgr.guess_language(filename, content_type)
 
-        print language
-
         self.remove_all_marks()
         self._buf.set_language(language)
         self._buf.set_highlight_syntax(True)



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