action button in TC now is functional

This commit is contained in:
Nikos Kouremenos 2005-08-04 14:57:36 +00:00
parent a7f5b83735
commit ecb476d796
3 changed files with 36 additions and 32 deletions

View File

@ -178,8 +178,8 @@ class Chat:
if self.plugin.windows['logs'].has_key(jid): if self.plugin.windows['logs'].has_key(jid):
self.plugin.windows['logs'][jid].window.present() self.plugin.windows['logs'][jid].window.present()
else: else:
self.plugin.windows['logs'][jid] = history_window.\ self.plugin.windows['logs'][jid] = history_window.HistoryWindow(
HistoryWindow(self.plugin, jid, self.account) self.plugin, jid, self.account)
def on_chat_window_focus_in_event(self, widget, event): def on_chat_window_focus_in_event(self, widget, event):
"""When window gets focus""" """When window gets focus"""
@ -202,6 +202,12 @@ class Chat:
isactive = widget.get_active() isactive = widget.get_active()
self.set_compact_view(isactive) self.set_compact_view(isactive)
def on_actions_button_clicked(self, widget):
'''popup action menu'''
menu = self.prepare_context_menu()
menu.popup(None, None, None, 1, 0)
menu.show_all()
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()
@ -228,9 +234,10 @@ class Chat:
return menu return menu
def on_chat_window_button_press_event(self, widget, event): def prepare_context_menu(self):
'''If right-clicked, show popup''' '''sets compact view menuitem active state
if event.button == 3: # right click sets active and sensitivity state for toggle_gpg_menuitem
and remove possible 'Switch to' menuitems'''
if self.widget_name == 'groupchat_window': if self.widget_name == 'groupchat_window':
menu = self.gc_popup_menu menu = self.gc_popup_menu
childs = menu.get_children() childs = menu.get_children()
@ -250,6 +257,12 @@ class Chat:
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)
return menu
def on_chat_window_button_press_event(self, widget, event):
'''If right-clicked, show popup'''
if event.button == 3: # right click
menu = self.prepare_context_menu()
# common menuitems (tab switches) # common menuitems (tab switches)
if len(self.xmls) > 1: # if there is more than one tab if len(self.xmls) > 1: # if there is more than one tab
menu.append(gtk.MenuItem()) # seperator menu.append(gtk.MenuItem()) # seperator
@ -1132,7 +1145,7 @@ class Chat:
self.paint_banner(jid) self.paint_banner(jid)
def set_compact_view(self, state): def set_compact_view(self, state):
'''Toggle compact view''' '''Toggle compact view. state is bool'''
self.compact_view_current_state = state self.compact_view_current_state = state
for jid in self.xmls: for jid in self.xmls:

View File

@ -1064,16 +1064,6 @@ class GroupchatWindow(chat.Chat):
bgcolor = gajim.config.get_per('themes', theme, 'groupbgcolor') bgcolor = gajim.config.get_per('themes', theme, 'groupbgcolor')
renderer.set_property('cell-background', bgcolor) renderer.set_property('cell-background', bgcolor)
def on_actions_button_clicked(self, widget):
"""popup action menu"""
menu = self.gc_popup_menu
childs = menu.get_children()
# compact_view_menuitem
childs[5].set_active(self.compact_view_current_state)
menu = self.remove_possible_switch_to_menuitems(menu)
menu.popup(None, None, None, 1, 0)
menu.show_all()
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"""
room_jid = self.get_active_jid() room_jid = self.get_active_jid()

View File

@ -17095,6 +17095,7 @@ Maybe I'll refactor later</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property> <property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property> <property name="modal">False</property>
<property name="default_height">480</property>
<property name="resizable">True</property> <property name="resizable">True</property>
<property name="destroy_with_parent">False</property> <property name="destroy_with_parent">False</property>
<property name="decorated">True</property> <property name="decorated">True</property>