[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 # be online
transport_avatar = {} # {transport_jid: [jid_list]} 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', SHOW_LIST = ['offline', 'connecting', 'online', 'chat', 'away', 'xa', 'dnd',
'invisible', 'error'] 'invisible', 'error']

View File

@ -2146,6 +2146,16 @@ class Interface:
if os.name != 'nt' and gajim.config.get('check_if_gajim_is_default'): if os.name != 'nt' and gajim.config.get('check_if_gajim_is_default'):
gtkgui_helpers.possibly_set_gajim_as_xmpp_handler() gtkgui_helpers.possibly_set_gajim_as_xmpp_handler()
# 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 # add default status messages if there is not in the config file
if len(gajim.config.get_per('statusmsg')) == 0: if len(gajim.config.get_per('statusmsg')) == 0:
for msg in gajim.config.statusmsg_default: for msg in gajim.config.statusmsg_default:

View File

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

View File

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