[TheCurse] single-clicking ability. fixes #2072

This commit is contained in:
Yann Leboulanger 2007-04-26 16:44:00 +00:00
parent 798fd0e25a
commit 3545dd3b90
4 changed files with 69 additions and 38 deletions

View File

@ -124,6 +124,8 @@ status_before_autoaway = {}
# be online
transport_avatar = {} # {transport_jid: [jid_list]}
# Is Gnome configured to activate on single click ?
single_click = False
SHOW_LIST = ['offline', 'connecting', 'online', 'chat', 'away', 'xa', 'dnd',
'invisible', 'error']

View File

@ -2146,7 +2146,17 @@ class Interface:
if os.name != 'nt' and gajim.config.get('check_if_gajim_is_default'):
gtkgui_helpers.possibly_set_gajim_as_xmpp_handler()
#add default status messages if there is not in the config file
# Is gnome configured to activate row on single click ?
try:
import gconf
client = gconf.client_get_default()
click_policy = client.get_string(
'/apps/nautilus/preferences/click_policy')
if click_policy == 'single':
gajim.single_click = True
except:
pass
# add default status messages if there is not in the config file
if len(gajim.config.get_per('statusmsg')) == 0:
for msg in gajim.config.statusmsg_default:
gajim.config.add_per('statusmsg', msg)

View File

@ -1757,8 +1757,9 @@ class GroupchatControl(ChatControlBase):
win.set_active_tab(nick_jid, self.account)
win.window.present()
def on_list_treeview_row_activated(self, widget, path, col = 0):
'''When an iter is double clicked: open the chat window'''
def on_row_activated(self, widget, path):
'''When an iter is activated (dubblick or single click if gnome is set
this way'''
model = widget.get_model()
if len(path) == 1: # It's a group
if (widget.row_expanded(path)):
@ -1769,6 +1770,11 @@ class GroupchatControl(ChatControlBase):
nick = model[path][C_NICK].decode('utf-8')
self._start_private_message(nick)
def on_list_treeview_row_activated(self, widget, path, col = 0):
'''When an iter is double clicked: open the chat window'''
if not gajim.single_click:
self.on_row_activated(widget, path)
def on_list_treeview_button_press_event(self, widget, event):
'''popup user's group's or agent menu'''
if event.button == 3: # right click
@ -1808,6 +1814,10 @@ class GroupchatControl(ChatControlBase):
widget.get_selection().unselect_all()
return
if gajim.single_click:
self.on_row_activated(widget, path)
return True
else:
model = widget.get_model()
iter = model.get_iter(path)
nick = model[iter][C_NICK].decode('utf-8')

View File

@ -2883,6 +2883,9 @@ class RosterWindow:
elif event.button == 1: # Left click
model = self.tree.get_model()
type_ = model[path][C_TYPE]
if gajim.single_click:
self.on_row_activated(widget, path)
else:
if type_ == 'group' and x < 27:
# first cell in 1st column (the arrow SINGLE clicked)
if (self.tree.row_expanded(path)):
@ -3785,8 +3788,9 @@ class RosterWindow:
win.window.present()
def on_roster_treeview_row_activated(self, widget, path, col = 0):
'''When an iter is double clicked: open the first event window'''
def on_row_activated(self, widget, path):
'''When an iter is activated (dubblick or single click if gnome is set
this way'''
model = self.tree.get_model()
account = model[path][C_ACCOUNT].decode('utf-8')
type_ = model[path][C_TYPE]
@ -3830,6 +3834,11 @@ class RosterWindow:
resource = c.resource
self.on_open_chat_window(widget, c, account, resource = resource)
def on_roster_treeview_row_activated(self, widget, path, col = 0):
'''When an iter is double clicked: open the first event window'''
if not gajim.single_click:
self.on_row_activated(widget, path)
def on_roster_treeview_row_expanded(self, widget, iter, path):
'''When a row is expanded change the icon of the arrow'''
model = self.tree.get_model()