add to roster menuitem in context menu of banner is now visible and only when needed. switch to removal was rewritten to remove position of childs
This commit is contained in:
parent
1b1d56d4cb
commit
cf260d18b2
51
src/chat.py
51
src/chat.py
|
@ -196,12 +196,6 @@ class Chat:
|
||||||
self.show_title()
|
self.show_title()
|
||||||
if self.plugin.systray_enabled:
|
if self.plugin.systray_enabled:
|
||||||
self.plugin.systray.remove_jid(jid, self.account)
|
self.plugin.systray.remove_jid(jid, self.account)
|
||||||
|
|
||||||
def on_send_file_menuitem_activate(self, widget):
|
|
||||||
jid = self.get_active_jid()
|
|
||||||
contact = gajim.get_first_contact_instance_from_jid(self.account, jid)
|
|
||||||
self.plugin.windows['file_transfers'].show_file_send_request(
|
|
||||||
self.account, contact)
|
|
||||||
|
|
||||||
def on_compact_view_menuitem_activate(self, widget):
|
def on_compact_view_menuitem_activate(self, widget):
|
||||||
isactive = widget.get_active()
|
isactive = widget.get_active()
|
||||||
|
@ -210,22 +204,27 @@ class Chat:
|
||||||
def remove_possible_switch_to_menuitems(self, menu):
|
def remove_possible_switch_to_menuitems(self, menu):
|
||||||
''' remove duplicate 'Switch to' if they exist and return clean menu'''
|
''' remove duplicate 'Switch to' if they exist and return clean menu'''
|
||||||
childs = menu.get_children()
|
childs = menu.get_children()
|
||||||
childs_no = len(childs)
|
|
||||||
if self.widget_name == 'groupchat_window':
|
if self.widget_name == 'tabbed_chat_window':
|
||||||
no_more_than = 6
|
jid = self.get_active_jid()
|
||||||
elif self.widget_name == 'tabbed_chat_window':
|
c = gajim.get_first_contact_instance_from_jid(self.account, jid)
|
||||||
no_more_than = 5
|
if _('not in the roster') in c.groups: # for add_to_roster_menuitem
|
||||||
# FIXME: that is 7 for contact not in the roster..
|
childs[5].show()
|
||||||
# so loop in all open tabs find if one is 'not in the roster'
|
childs[5].set_no_show_all(False)
|
||||||
# etc..
|
else:
|
||||||
|
childs[5].hide()
|
||||||
if childs_no > no_more_than:
|
childs[5].set_no_show_all(True)
|
||||||
# we have switch to which we should remove
|
|
||||||
how_many = childs_no - no_more_than # how many to remove
|
for child in childs[5:]: # start looping after Add to roster
|
||||||
for child_cnt in range(how_many):
|
grandchilds = child.get_children()
|
||||||
real_pos = child_cnt + no_more_than
|
# check because seperator menuitem doesn't have childs
|
||||||
menu.remove(childs[real_pos])
|
if len(grandchilds):
|
||||||
|
accel_label = grandchilds[0]
|
||||||
|
if accel_label.get_text().startswith(_('Switch to')):
|
||||||
|
menu.remove(child)
|
||||||
|
else: # remove the seperator
|
||||||
|
menu.remove(child)
|
||||||
|
|
||||||
return menu
|
return menu
|
||||||
|
|
||||||
def on_chat_window_button_press_event(self, widget, event):
|
def on_chat_window_button_press_event(self, widget, event):
|
||||||
|
@ -240,7 +239,13 @@ class Chat:
|
||||||
elif self.widget_name == 'tabbed_chat_window':
|
elif self.widget_name == 'tabbed_chat_window':
|
||||||
menu = self.tabbed_chat_popup_menu
|
menu = self.tabbed_chat_popup_menu
|
||||||
childs = menu.get_children()
|
childs = menu.get_children()
|
||||||
#FIXME: check if gpg capabitlies or else make gpg toggle insensitive it's childs[3]
|
# check if gpg capabitlies or else make gpg toggle insensitive
|
||||||
|
jid = self.get_active_jid()
|
||||||
|
gpg_btn = self.xmls[jid].get_widget('gpg_togglebutton')
|
||||||
|
isactive = gpg_btn.get_active()
|
||||||
|
issensitive = gpg_btn.get_property('sensitive')
|
||||||
|
childs[3].set_active(isactive)
|
||||||
|
childs[3].set_property('sensitive', issensitive)
|
||||||
# compact_view_menuitem
|
# compact_view_menuitem
|
||||||
childs[4].set_active(self.compact_view_current_state)
|
childs[4].set_active(self.compact_view_current_state)
|
||||||
menu = self.remove_possible_switch_to_menuitems(menu)
|
menu = self.remove_possible_switch_to_menuitems(menu)
|
||||||
|
|
|
@ -15474,7 +15474,7 @@ the Jabber network.</property>
|
||||||
<signal name="activate" handler="on_history_button_clicked" last_modification_time="Thu, 30 Jun 2005 10:23:04 GMT"/>
|
<signal name="activate" handler="on_history_button_clicked" last_modification_time="Thu, 30 Jun 2005 10:23:04 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image1007">
|
<widget class="GtkImage" id="image1029">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-justify-fill</property>
|
<property name="stock">gtk-justify-fill</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
|
@ -15504,7 +15504,7 @@ the Jabber network.</property>
|
||||||
<signal name="activate" handler="on_send_file_menuitem_activate" last_modification_time="Wed, 03 Aug 2005 15:21:47 GMT"/>
|
<signal name="activate" handler="on_send_file_menuitem_activate" last_modification_time="Wed, 03 Aug 2005 15:21:47 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image1008">
|
<widget class="GtkImage" id="image1030">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-file</property>
|
<property name="stock">gtk-file</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
|
@ -15537,12 +15537,6 @@ the Jabber network.</property>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSeparatorMenuItem" id="separator10">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkImageMenuItem" id="add_to_roster_menuitem">
|
<widget class="GtkImageMenuItem" id="add_to_roster_menuitem">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -15551,7 +15545,7 @@ the Jabber network.</property>
|
||||||
<signal name="activate" handler="on_add_to_roster_menuitem_activate" last_modification_time="Thu, 21 Jul 2005 22:46:10 GMT"/>
|
<signal name="activate" handler="on_add_to_roster_menuitem_activate" last_modification_time="Thu, 21 Jul 2005 22:46:10 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image1009">
|
<widget class="GtkImage" id="image1031">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-add</property>
|
<property name="stock">gtk-add</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
|
|
|
@ -284,6 +284,16 @@ class TabbedChatWindow(chat.Chat):
|
||||||
def on_chat_notebook_key_press_event(self, widget, event):
|
def on_chat_notebook_key_press_event(self, widget, event):
|
||||||
chat.Chat.on_chat_notebook_key_press_event(self, widget, event)
|
chat.Chat.on_chat_notebook_key_press_event(self, widget, event)
|
||||||
|
|
||||||
|
def on_send_file_menuitem_activate(self, widget):
|
||||||
|
jid = self.get_active_jid()
|
||||||
|
contact = gajim.get_first_contact_instance_from_jid(self.account, jid)
|
||||||
|
self.plugin.windows['file_transfers'].show_file_send_request(
|
||||||
|
self.account, contact)
|
||||||
|
|
||||||
|
def on_add_to_roster_menuitem_activate(self, widget):
|
||||||
|
jid = self.get_active_jid()
|
||||||
|
dialogs.AddNewContactWindow(self.plugin, self.account, jid)
|
||||||
|
|
||||||
def on_send_button_clicked(self, widget):
|
def on_send_button_clicked(self, widget):
|
||||||
"""When send button is pressed: send the current message"""
|
"""When send button is pressed: send the current message"""
|
||||||
jid = self.get_active_jid()
|
jid = self.get_active_jid()
|
||||||
|
|
Loading…
Reference in New Issue