changeset 37571844b8f6 in /home/hg/repos/gajim
author: Yann Leboulanger <asterix(a)lagaule.org>
branches:
details:http://hg.gajim.org/gajim?cmd=changeset;node=37571844b8f6
description: print timestamp as invisible in history window when we don't want to see it so we can search for it. See #3939
diffstat:
src/history_window.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (35 lines):
diff -r 835e31812849 -r 37571844b8f6 src/history_window.py
--- a/src/history_window.py Sun Apr 03 21:32:53 2016 +0200
+++ b/src/history_window.py Sun Apr 17 20:31:19 2016 +0200
@@ -74,6 +74,7 @@
scrolledwindow.add(self.history_textview.tv)
self.history_buffer = self.history_textview.tv.get_buffer()
self.history_buffer.create_tag('highlight', background = 'yellow')
+ self.history_buffer.create_tag('invisible', invisible=True)
self.checkbutton = xml.get_object('log_history_checkbutton')
self.checkbutton.connect('toggled',
self.on_log_history_checkbutton_toggled)
@@ -429,6 +430,12 @@
tim = time.strftime('%X ', time.localtime(float(tim)))
buf.insert_with_tags_by_name(end_iter, tim + '\n',
'time_sometimes')
+ else: # don't print time. So we print it as invisible to be able to
+ # search for it
+ timestamp_str = gajim.config.get('time_stamp')
+ timestamp_str = helpers.from_one_line(timestamp_str)
+ tim = time.strftime(timestamp_str, time.localtime(float(tim)))
+ buf.insert_with_tags_by_name(end_iter, tim, 'invisible')
tag_name = ''
tag_msg = ''
@@ -605,8 +612,8 @@
timestamp_str = gajim.config.get('time_stamp')
timestamp_str = helpers.from_one_line(timestamp_str)
tim = time.strftime(timestamp_str, local_time)
- result = start_iter.forward_search(tim, Gtk.TextSearchFlags.VISIBLE_ONLY,
- None)
+ result = start_iter.forward_search(tim, Gtk.TextSearchFlags.TEXT_ONLY,
+ None)
if result is not None:
match_start_iter, match_end_iter = result
match_start_iter.backward_char() # include '[' or other character before time