fix history window usage. Fixes #5571
This commit is contained in:
parent
b19ced6846
commit
ac535f708c
2 changed files with 9 additions and 14 deletions
|
@ -4,7 +4,7 @@
|
|||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
<!-- column-name item text -->
|
||||
<!-- column-name item -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
<data>
|
||||
|
@ -48,13 +48,8 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="model">liststore1</property>
|
||||
<property name="text_column">0</property>
|
||||
<signal name="changed" handler="on_query_combobox_changed"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
|
|
|
@ -66,7 +66,6 @@ class HistoryWindow:
|
|||
def __init__(self, jid = None, account = None):
|
||||
xml = gtkgui_helpers.get_gtk_builder('history_window.ui')
|
||||
self.window = xml.get_object('history_window')
|
||||
self.jid_entry = xml.get_object('jid_entry')
|
||||
self.calendar = xml.get_object('calendar')
|
||||
scrolledwindow = xml.get_object('scrolledwindow')
|
||||
self.history_textview = conversation_textview.ConversationTextview(
|
||||
|
@ -79,6 +78,8 @@ class HistoryWindow:
|
|||
self.on_log_history_checkbutton_toggled)
|
||||
self.query_entry = xml.get_object('query_entry')
|
||||
self.query_combobox = xml.get_object('query_combobox')
|
||||
self.jid_entry = self.query_combobox.child
|
||||
self.jid_entry.connect('activate', self.on_jid_entry_activate)
|
||||
self.query_combobox.set_active(0)
|
||||
self.results_treeview = xml.get_object('results_treeview')
|
||||
self.results_window = xml.get_object('results_scrolledwindow')
|
||||
|
@ -148,21 +149,20 @@ class HistoryWindow:
|
|||
|
||||
# Add all jids in logs.db:
|
||||
db_jids = gajim.logger.get_jids_in_db()
|
||||
self.completion_dict = dict.fromkeys(db_jids)
|
||||
completion_dict = dict.fromkeys(db_jids)
|
||||
|
||||
self.accounts_seen_online = gajim.contacts.get_accounts()[:]
|
||||
|
||||
# Enhance contacts of online accounts with contact. Needed for mapping below
|
||||
for account in self.accounts_seen_online:
|
||||
self.completion_dict.update(
|
||||
helpers.get_contact_dict_for_account(account))
|
||||
completion_dict.update(helpers.get_contact_dict_for_account(account))
|
||||
|
||||
muc_active_img = gtkgui_helpers.load_icon('muc_active')
|
||||
contact_img = gajim.interface.jabber_state_images['16']['online']
|
||||
muc_active_pix = muc_active_img.get_pixbuf()
|
||||
contact_pix = contact_img.get_pixbuf()
|
||||
|
||||
keys = self.completion_dict.keys()
|
||||
keys = completion_dict.keys()
|
||||
# Move the actual jid at first so we load history faster
|
||||
actual_jid = self.jid_entry.get_text().decode('utf-8')
|
||||
if actual_jid in keys:
|
||||
|
@ -174,7 +174,7 @@ class HistoryWindow:
|
|||
# Warning : This for is time critical with big DB
|
||||
for key in keys:
|
||||
completed = key
|
||||
contact = self.completion_dict[completed]
|
||||
contact = completion_dict[completed]
|
||||
if contact:
|
||||
info_name = contact.get_shown_name()
|
||||
info_completion = info_name
|
||||
|
@ -251,7 +251,7 @@ class HistoryWindow:
|
|||
def on_jid_entry_focus(self, widget, event):
|
||||
widget.select_region(0, -1) # select text
|
||||
|
||||
def _load_history(self, jid_or_name, account = None):
|
||||
def _load_history(self, jid_or_name, account=None):
|
||||
"""
|
||||
Load history for the given jid/name and show it
|
||||
"""
|
||||
|
|
Loading…
Add table
Reference in a new issue