merge in from git
This commit is contained in:
50
gotr/ui.py
50
gotr/ui.py
@@ -24,12 +24,11 @@ from common import gajim
|
||||
from plugins.gui import GajimPluginConfigDialog
|
||||
|
||||
import otrmodule
|
||||
HAS_PORT = True
|
||||
try:
|
||||
import potr
|
||||
import potr.proto
|
||||
except:
|
||||
HAS_POTR = False
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
class OtrPluginConfigDialog(GajimPluginConfigDialog):
|
||||
@@ -49,9 +48,9 @@ class OtrPluginConfigDialog(GajimPluginConfigDialog):
|
||||
for account in sorted(gajim.contacts.get_accounts()):
|
||||
self.otr_account_store.append(row=(account,))
|
||||
|
||||
fpr_view = self.B.get_object('fingerprint_view')
|
||||
fpr_view.set_model(self.fpr_model)
|
||||
fpr_view.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
|
||||
self.fpr_view = self.B.get_object('fingerprint_view')
|
||||
self.fpr_view.set_model(self.fpr_model)
|
||||
self.fpr_view.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
|
||||
|
||||
if len(self.otr_account_store) > 0:
|
||||
self.B.get_object('account_combobox').set_active(0)
|
||||
@@ -74,6 +73,38 @@ class OtrPluginConfigDialog(GajimPluginConfigDialog):
|
||||
self.plugin.update_context_list()
|
||||
self.account_combobox_changed_cb(self.B.get_object('account_combobox'))
|
||||
|
||||
def fpr_button_pressed_cb(self, tw, event):
|
||||
if event.button == 3:
|
||||
pthinfo = tw.get_path_at_pos(int(event.x), int(event.y))
|
||||
|
||||
if pthinfo is None:
|
||||
# only show the popup when we right clicked on list content
|
||||
# ie. don't show it when we click at empty rows
|
||||
return False
|
||||
|
||||
# if the row under the mouse is already selected, we keep the
|
||||
# selection, otherwise we only select the new item
|
||||
keep_selection = tw.get_selection().path_is_selected(pthinfo[0])
|
||||
|
||||
pop = self.B.get_object('fprclipboard_menu')
|
||||
pop.popup(None, None, None, event.button, event.time)
|
||||
|
||||
# keep_selection=True -> no further processing of click event
|
||||
# keep_selection=False-> further processing -> GTK usually selects
|
||||
# the item below the cursor
|
||||
return keep_selection
|
||||
|
||||
def clipboard_button_cb(self, menuitem):
|
||||
mod, paths = self.fpr_view.get_selection().get_selected_rows()
|
||||
|
||||
fprs = []
|
||||
for path in paths:
|
||||
it = mod.get_iter(path)
|
||||
jid, fpr = mod.get(it, 0, 6)
|
||||
fprs.append('%s: %s' % (jid, potr.human_hash(fpr)))
|
||||
gtk.Clipboard().set_text('\n'.join(fprs))
|
||||
gtk.Clipboard(selection='PRIMARY').set_text('\n'.join(fprs))
|
||||
|
||||
def flags_toggled_cb(self, button):
|
||||
if button == self.B.get_object('enable_check'):
|
||||
new_status = button.get_active()
|
||||
@@ -127,9 +158,8 @@ class OtrPluginConfigDialog(GajimPluginConfigDialog):
|
||||
for acc in gajim.connections.iterkeys():
|
||||
accounts[gajim.get_jid_from_account(acc)] = acc
|
||||
|
||||
tw = self.B.get_object('fingerprint_view')
|
||||
|
||||
mod, paths = tw.get_selection().get_selected_rows()
|
||||
mod, paths = self.fpr_view.get_selection().get_selected_rows()
|
||||
|
||||
for path in paths:
|
||||
it = mod.get_iter(path)
|
||||
@@ -161,9 +191,7 @@ class OtrPluginConfigDialog(GajimPluginConfigDialog):
|
||||
for acc in gajim.connections.iterkeys():
|
||||
accounts[gajim.get_jid_from_account(acc)] = acc
|
||||
|
||||
tw = self.B.get_object('fingerprint_view')
|
||||
|
||||
mod, paths = tw.get_selection().get_selected_rows()
|
||||
mod, paths = self.fpr_view.get_selection().get_selected_rows()
|
||||
|
||||
# open the window for the first selected row
|
||||
for path in paths[0:1]:
|
||||
|
||||
Reference in New Issue
Block a user