[gtksourceview] Add tooltip func.



commit a4db3c209663e84194430703a72b78dac727276d
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sun Jun 20 17:05:27 2010 +0200

    Add tooltip func.

 tests/test-widget.py |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/tests/test-widget.py b/tests/test-widget.py
index 310c604..f27e717 100644
--- a/tests/test-widget.py
+++ b/tests/test-widget.py
@@ -212,6 +212,9 @@ class Window(Gtk.Window):
 
         self._view.set_mark_category_icon_from_stock(self.MARK_TYPE_1, Gtk.STOCK_YES)
         self._view.set_mark_category_priority(self.MARK_TYPE_1, 1)
+        self._view.set_mark_category_tooltip_markup_func(self.MARK_TYPE_1,
+                                                         self.mark_tooltip_func,
+                                                         None)
 
         parsed, color = Gdk.color_parse("pink")
         if parsed:
@@ -219,6 +222,19 @@ class Window(Gtk.Window):
 
         self._view.set_mark_category_icon_from_stock(self.MARK_TYPE_2, Gtk.STOCK_NO)
         self._view.set_mark_category_priority(self.MARK_TYPE_2, 2)
+        self._view.set_mark_category_tooltip_markup_func(self.MARK_TYPE_2,
+                                                         self.mark_tooltip_func,
+                                                         None)
+
+    def mark_tooltip_func(self, mark, user_data):
+        i = self._buf.get_iter_at_mark(mark)
+        line = i.get_line() + 1
+        column = i.get_line_offset()
+
+        if mark.get_category() == self.MARK_TYPE_1:
+            return "Line: %d, Column: %d" % (line, column)
+        else:
+            return "<b>Line</b>: %d\n<i>Column</i>: %d" % (line, column)
 
     def update_cursor_position(self):
         i = self._buf.get_iter_at_mark(self._buf.get_insert())



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