Clarify menuitem new chat code : message->chat . Correct actions->chat behaviour
This commit is contained in:
parent
1a3a987556
commit
365d9d4eb6
|
@ -988,7 +988,7 @@ _('You can not join a group chat unless you are connected.'))
|
||||||
|
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
class NewMessageDialog:
|
class NewChatDialog:
|
||||||
def __init__(self, account):
|
def __init__(self, account):
|
||||||
self.account = account
|
self.account = account
|
||||||
|
|
||||||
|
@ -998,9 +998,9 @@ class NewMessageDialog:
|
||||||
title = _('Start Chat')
|
title = _('Start Chat')
|
||||||
prompt_text = _('Fill in the contact ID of the contact you would like\nto send a chat message to:')
|
prompt_text = _('Fill in the contact ID of the contact you would like\nto send a chat message to:')
|
||||||
|
|
||||||
InputDialog(title, prompt_text, is_modal = False, ok_handler = self.new_message_response)
|
InputDialog(title, prompt_text, is_modal = False, ok_handler = self.new_chat_response)
|
||||||
|
|
||||||
def new_message_response(self, jid):
|
def new_chat_response(self, jid):
|
||||||
''' called when ok button is clicked '''
|
''' called when ok button is clicked '''
|
||||||
if gajim.connections[self.account].connected <= 1:
|
if gajim.connections[self.account].connected <= 1:
|
||||||
#if offline or connecting
|
#if offline or connecting
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
<widget class="GtkMenu" id="actions_menu_menu">
|
<widget class="GtkMenu" id="actions_menu_menu">
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImageMenuItem" id="new_message_menuitem">
|
<widget class="GtkImageMenuItem" id="new_chat_menuitem">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">_Start Chat</property>
|
<property name="label" translatable="yes">_Start Chat</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
|
|
|
@ -652,7 +652,7 @@ class RosterWindow:
|
||||||
'''create the main window's menus'''
|
'''create the main window's menus'''
|
||||||
if not self.actions_menu_needs_rebuild:
|
if not self.actions_menu_needs_rebuild:
|
||||||
return
|
return
|
||||||
new_message_menuitem = self.xml.get_widget('new_message_menuitem')
|
new_chat_menuitem = self.xml.get_widget('new_chat_menuitem')
|
||||||
join_gc_menuitem = self.xml.get_widget('join_gc_menuitem')
|
join_gc_menuitem = self.xml.get_widget('join_gc_menuitem')
|
||||||
add_new_contact_menuitem = self.xml.get_widget('add_new_contact_menuitem')
|
add_new_contact_menuitem = self.xml.get_widget('add_new_contact_menuitem')
|
||||||
service_disco_menuitem = self.xml.get_widget('service_disco_menuitem')
|
service_disco_menuitem = self.xml.get_widget('service_disco_menuitem')
|
||||||
|
@ -678,10 +678,10 @@ class RosterWindow:
|
||||||
self.service_disco_handler_id)
|
self.service_disco_handler_id)
|
||||||
self.service_disco_handler_id = None
|
self.service_disco_handler_id = None
|
||||||
|
|
||||||
if self.new_message_menuitem_handler_id:
|
if self.new_chat_menuitem_handler_id:
|
||||||
new_message_menuitem.handler_disconnect(
|
new_chat_menuitem.handler_disconnect(
|
||||||
self.new_message_menuitem_handler_id)
|
self.new_chat_menuitem_handler_id)
|
||||||
self.new_message_menuitem_handler_id = None
|
self.new_chat_menuitem_handler_id = None
|
||||||
|
|
||||||
if self.profile_avatar_menuitem_handler_id:
|
if self.profile_avatar_menuitem_handler_id:
|
||||||
profile_avatar_menuitem.handler_disconnect(
|
profile_avatar_menuitem.handler_disconnect(
|
||||||
|
@ -693,16 +693,16 @@ class RosterWindow:
|
||||||
add_new_contact_menuitem.remove_submenu()
|
add_new_contact_menuitem.remove_submenu()
|
||||||
service_disco_menuitem.remove_submenu()
|
service_disco_menuitem.remove_submenu()
|
||||||
join_gc_menuitem.remove_submenu()
|
join_gc_menuitem.remove_submenu()
|
||||||
new_message_menuitem.remove_submenu()
|
new_chat_menuitem.remove_submenu()
|
||||||
advanced_menuitem.remove_submenu()
|
advanced_menuitem.remove_submenu()
|
||||||
profile_avatar_menuitem.remove_submenu()
|
profile_avatar_menuitem.remove_submenu()
|
||||||
|
|
||||||
# remove the existing accelerator
|
# remove the existing accelerator
|
||||||
if self.have_new_message_accel:
|
if self.have_new_chat_accel:
|
||||||
ag = gtk.accel_groups_from_object(self.window)[0]
|
ag = gtk.accel_groups_from_object(self.window)[0]
|
||||||
new_message_menuitem.remove_accelerator(ag, gtk.keysyms.n,
|
new_chat_menuitem.remove_accelerator(ag, gtk.keysyms.n,
|
||||||
gtk.gdk.CONTROL_MASK)
|
gtk.gdk.CONTROL_MASK)
|
||||||
self.have_new_message_accel = False
|
self.have_new_chat_accel = False
|
||||||
|
|
||||||
gc_sub_menu = gtk.Menu() # gc is always a submenu
|
gc_sub_menu = gtk.Menu() # gc is always a submenu
|
||||||
join_gc_menuitem.set_submenu(gc_sub_menu)
|
join_gc_menuitem.set_submenu(gc_sub_menu)
|
||||||
|
@ -711,7 +711,7 @@ class RosterWindow:
|
||||||
if connected_accounts > 1: # 2 or more accounts? make submenus
|
if connected_accounts > 1: # 2 or more accounts? make submenus
|
||||||
add_sub_menu = gtk.Menu()
|
add_sub_menu = gtk.Menu()
|
||||||
disco_sub_menu = gtk.Menu()
|
disco_sub_menu = gtk.Menu()
|
||||||
new_message_sub_menu = gtk.Menu()
|
new_chat_sub_menu = gtk.Menu()
|
||||||
profile_avatar_sub_menu = gtk.Menu()
|
profile_avatar_sub_menu = gtk.Menu()
|
||||||
|
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
|
@ -748,14 +748,14 @@ class RosterWindow:
|
||||||
service_disco_menuitem.set_submenu(disco_sub_menu)
|
service_disco_menuitem.set_submenu(disco_sub_menu)
|
||||||
disco_sub_menu.show_all()
|
disco_sub_menu.show_all()
|
||||||
|
|
||||||
# new message
|
# new chat
|
||||||
new_message_item = gtk.MenuItem(_('using account %s') % account,
|
new_chat_item = gtk.MenuItem(_('using account %s') % account,
|
||||||
False)
|
False)
|
||||||
new_message_sub_menu.append(new_message_item)
|
new_chat_sub_menu.append(new_chat_item)
|
||||||
new_message_item.connect('activate',
|
new_chat_item.connect('activate',
|
||||||
self.on_new_message_menuitem_activate, account)
|
self.on_new_chat_menuitem_activate, account)
|
||||||
new_message_menuitem.set_submenu(new_message_sub_menu)
|
new_chat_menuitem.set_submenu(new_chat_sub_menu)
|
||||||
new_message_sub_menu.show_all()
|
new_chat_sub_menu.show_all()
|
||||||
|
|
||||||
# profile, avatar
|
# profile, avatar
|
||||||
profile_avatar_item = gtk.MenuItem(_('of account %s') % account,
|
profile_avatar_item = gtk.MenuItem(_('of account %s') % account,
|
||||||
|
@ -780,17 +780,17 @@ class RosterWindow:
|
||||||
if not self.service_disco_handler_id:
|
if not self.service_disco_handler_id:
|
||||||
self.service_disco_handler_id = service_disco_menuitem.connect(
|
self.service_disco_handler_id = service_disco_menuitem.connect(
|
||||||
'activate', self.on_service_disco_menuitem_activate, account)
|
'activate', self.on_service_disco_menuitem_activate, account)
|
||||||
# new msg
|
# new chat
|
||||||
if not self.new_message_menuitem_handler_id:
|
if not self.new_chat_menuitem_handler_id:
|
||||||
self.new_message_menuitem_handler_id = new_message_menuitem.\
|
self.new_chat_menuitem_handler_id = new_chat_menuitem.\
|
||||||
connect('activate', self.on_new_message_menuitem_activate,
|
connect('activate', self.on_new_chat_menuitem_activate,
|
||||||
account)
|
account)
|
||||||
# new msg accel
|
# new chat accel
|
||||||
if not self.have_new_message_accel:
|
if not self.have_new_chat_accel:
|
||||||
ag = gtk.accel_groups_from_object(self.window)[0]
|
ag = gtk.accel_groups_from_object(self.window)[0]
|
||||||
new_message_menuitem.add_accelerator('activate', ag,
|
new_chat_menuitem.add_accelerator('activate', ag,
|
||||||
gtk.keysyms.n, gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
|
gtk.keysyms.n, gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
|
||||||
self.have_new_message_accel = True
|
self.have_new_chat_accel = True
|
||||||
|
|
||||||
# profile, avatar
|
# profile, avatar
|
||||||
if not self.profile_avatar_menuitem_handler_id:
|
if not self.profile_avatar_menuitem_handler_id:
|
||||||
|
@ -802,13 +802,13 @@ class RosterWindow:
|
||||||
|
|
||||||
if connected_accounts == 0:
|
if connected_accounts == 0:
|
||||||
# no connected accounts, make the menuitems insensitive
|
# no connected accounts, make the menuitems insensitive
|
||||||
new_message_menuitem.set_sensitive(False)
|
new_chat_menuitem.set_sensitive(False)
|
||||||
join_gc_menuitem.set_sensitive(False)
|
join_gc_menuitem.set_sensitive(False)
|
||||||
add_new_contact_menuitem.set_sensitive(False)
|
add_new_contact_menuitem.set_sensitive(False)
|
||||||
service_disco_menuitem.set_sensitive(False)
|
service_disco_menuitem.set_sensitive(False)
|
||||||
profile_avatar_menuitem.set_sensitive(False)
|
profile_avatar_menuitem.set_sensitive(False)
|
||||||
else: # we have one or more connected accounts
|
else: # we have one or more connected accounts
|
||||||
new_message_menuitem.set_sensitive(True)
|
new_chat_menuitem.set_sensitive(True)
|
||||||
join_gc_menuitem.set_sensitive(True)
|
join_gc_menuitem.set_sensitive(True)
|
||||||
add_new_contact_menuitem.set_sensitive(True)
|
add_new_contact_menuitem.set_sensitive(True)
|
||||||
service_disco_menuitem.set_sensitive(True)
|
service_disco_menuitem.set_sensitive(True)
|
||||||
|
@ -2277,6 +2277,9 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
def on_new_message_menuitem_activate(self, widget, account):
|
def on_new_message_menuitem_activate(self, widget, account):
|
||||||
dialogs.SingleMessageWindow(account, action = 'send')
|
dialogs.SingleMessageWindow(account, action = 'send')
|
||||||
|
|
||||||
|
def on_new_chat_menuitem_activate(self, widget, account):
|
||||||
|
dialogs.NewChatDialog(account)
|
||||||
|
|
||||||
def on_contents_menuitem_activate(self, widget):
|
def on_contents_menuitem_activate(self, widget):
|
||||||
helpers.launch_browser_mailer('url', 'http://trac.gajim.org/wiki')
|
helpers.launch_browser_mailer('url', 'http://trac.gajim.org/wiki')
|
||||||
|
|
||||||
|
@ -3281,7 +3284,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
self.editing_path = None # path of row with cell in edit mode
|
self.editing_path = None # path of row with cell in edit mode
|
||||||
self.add_new_contact_handler_id = False
|
self.add_new_contact_handler_id = False
|
||||||
self.service_disco_handler_id = False
|
self.service_disco_handler_id = False
|
||||||
self.new_message_menuitem_handler_id = False
|
self.new_chat_menuitem_handler_id = False
|
||||||
self.profile_avatar_menuitem_handler_id = False
|
self.profile_avatar_menuitem_handler_id = False
|
||||||
self.actions_menu_needs_rebuild = True
|
self.actions_menu_needs_rebuild = True
|
||||||
self.regroup = gajim.config.get('mergeaccounts')
|
self.regroup = gajim.config.get('mergeaccounts')
|
||||||
|
@ -3289,7 +3292,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
self.regroup = False
|
self.regroup = False
|
||||||
#FIXME: When list_accel_closures will be wrapped in pygtk
|
#FIXME: When list_accel_closures will be wrapped in pygtk
|
||||||
# no need of this variable
|
# no need of this variable
|
||||||
self.have_new_message_accel = False # Is the "Ctrl+N" shown ?
|
self.have_new_chat_accel = False # Is the "Ctrl+N" shown ?
|
||||||
if gajim.config.get('saveposition'):
|
if gajim.config.get('saveposition'):
|
||||||
gtkgui_helpers.move_window(self.window,
|
gtkgui_helpers.move_window(self.window,
|
||||||
gajim.config.get('roster_x-position'),
|
gajim.config.get('roster_x-position'),
|
||||||
|
|
Loading…
Reference in New Issue