history button is gone. we now have actions button. to do that. TC needs the code for that. we also have history in GC occupants contact now

This commit is contained in:
Nikos Kouremenos 2005-08-04 14:30:41 +00:00
parent a423ab0045
commit a7f5b83735
5 changed files with 63 additions and 191 deletions

View File

@ -171,9 +171,10 @@ class Chat:
"""When close button is pressed: close a tab"""
self.remove_tab(jid)
def on_history_button_clicked(self, widget):
"""When history button is pressed: call history window"""
jid = self.get_active_jid()
def on_history_menuitem_clicked(self, widget = None, jid = None):
"""When history menuitem is pressed: call history window"""
if jid is None:
jid = self.get_active_jid()
if self.plugin.windows['logs'].has_key(jid):
self.plugin.windows['logs'][jid].window.present()
else:
@ -233,7 +234,6 @@ class Chat:
if self.widget_name == 'groupchat_window':
menu = self.gc_popup_menu
childs = menu.get_children()
childs[0].show() # history_menuitem
# compact_view_menuitem
childs[5].set_active(self.compact_view_current_state)
elif self.widget_name == 'tabbed_chat_window':

View File

@ -66,12 +66,6 @@ status_before_autoaway = {}
socks5quue = None
def get_fjid_from_nick(room_jid, nick):
# fake jid is the jid for a contact in a room
# gaim@conference.jabber.org/nick
fjid = room_jid + '/' + nick
return fjid
def get_nick_from_jid(jid):
pos = jid.find('@')
return jid[:pos]
@ -113,7 +107,11 @@ def get_jid_without_resource(jid):
def construct_fjid(room_jid, nick):
''' nick is in utf8 (taken from treeview); room_jid is in unicode'''
return room_jid + '/' + unicode(nick, 'utf-8')
# fake jid is the jid for a contact in a room
# gaim@conference.jabber.org/nick
if type(nick) is str:
nick = unicode(nick, 'utf-8')
return room_jid + '/' + nick
def get_resource_from_jid(jid):
return jid.split('/', 1)[1] # abc@doremi.org/res/res-continued

View File

@ -26,6 +26,7 @@ import dialogs
import chat
import cell_renderer_image
import gtkgui_helpers
import history_window
from gajim import Contact
from common import gajim
@ -658,7 +659,7 @@ class GroupchatWindow(chat.Chat):
# reason is optional so accept just nick
nick_to_ban = splitted_text_after_msg_command[0]
if nick_to_ban in nicks:
fjid = get_fjid_from_nick(room_jid, nick_to_ban)
fjid = gajim.construct_fjid(room_jid, nick_to_ban)
gajim.connections[self.account].gc_set_affiliation(room_jid,
fjid, 'outcast')
elif len(splitted_text_after_ban_command) >= 2:
@ -666,7 +667,7 @@ class GroupchatWindow(chat.Chat):
nick_to_ban = splitted_text_after_msg_command[0]
if nick_to_ban in nicks:
reason = splitted_text_after_msg_command[1:]
fjid = get_fjid_from_nick(room_jid, nick_to_ban)
fjid = gajim.construct_fjid(room_jid, nick_to_ban)
gajim.connections[self.account].gc_set_affiliation(room_jid,
fjid, 'outcast', reason)
return # don't print the command
@ -771,7 +772,8 @@ class GroupchatWindow(chat.Chat):
def on_info(self, widget, room_jid, nick):
"""Call vcard_information_window class to display user's information"""
c = gajim.gc_contacts[self.account][room_jid][nick]
if c.jid and c.resource: # on GC, we know resource only if we're mod and up
if c.jid and c.resource:
# on GC, we know resource only if we're mod and up
jid = c.jid
fjid = c.jid + '/' + c.resource
else:
@ -787,6 +789,17 @@ class GroupchatWindow(chat.Chat):
self.plugin.windows[self.account]['infos'][jid] = \
dialogs.VcardWindow(c2, self.plugin, self.account, False)
def on_history(self, widget, room_jid, nick):
c = gajim.gc_contacts[self.account][room_jid][nick]
if c.jid and c.resource:
# on GC, we know resource only if we're mod and up
jid = c.jid
fjid = c.jid + '/' + c.resource
else:
fjid = gajim.construct_fjid(room_jid, nick)
jid = fjid
self.on_history_menuitem_clicked(jid = jid)
def on_add_to_roster(self, widget, jid):
dialogs.AddNewContactWindow(self.plugin, self.account, jid)
@ -913,6 +926,9 @@ class GroupchatWindow(chat.Chat):
item = xml.get_widget('information_menuitem')
item.connect('activate', self.on_info, room_jid, nick)
item = xml.get_widget('history_menuitem')
item.connect('activate', self.on_history, room_jid, nick)
item = xml.get_widget('add_to_roster_menuitem')
if not jid:
@ -995,8 +1011,6 @@ class GroupchatWindow(chat.Chat):
xm = gtk.glade.XML(GTKGUI_GLADE, 'gc_popup_menu', APP)
xm.signal_autoconnect(self)
self.gc_popup_menu = xm.get_widget('gc_popup_menu')
# don't show history_menuitem on show_all()
self.gc_popup_menu.get_children()[0].set_no_show_all(True)
#status_image, nickname, shown_nick
store = gtk.TreeStore(gtk.Image, str, str)
@ -1024,13 +1038,13 @@ class GroupchatWindow(chat.Chat):
self.list_treeview[room_jid].set_expander_column(column)
# set the position of the current hpaned
self.hpaneds[room_jid] = self.xmls[room_jid].get_widget(
'hpaned')
self.hpaneds[room_jid] = self.xmls[room_jid].get_widget('hpaned')
self.hpaneds[room_jid].set_position(self.hpaned_position)
self.redraw_tab(room_jid)
self.show_title()
self.set_subject(room_jid, '') # Set an empty subject to show the room_jid
# set an empty subject to show the room_jid
self.set_subject(room_jid, '')
self.got_disconnected(room_jid) #init some variables
conversation_textview.grab_focus()
self.childs[room_jid].show_all()
@ -1053,7 +1067,9 @@ class GroupchatWindow(chat.Chat):
def on_actions_button_clicked(self, widget):
"""popup action menu"""
menu = self.gc_popup_menu
menu.get_children()[0].hide() # hide history_menuitem
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()

View File

@ -8923,82 +8923,6 @@ Custom</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="history_button">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Click to see past conversation in this room</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_history_button_clicked" last_modification_time="Mon, 13 Jun 2005 10:57:54 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment75">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox2975">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image659">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label329">
<property name="visible">True</property>
<property name="label" translatable="yes">_History</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkVSeparator" id="vseparator2">
<property name="visible">True</property>
@ -10458,81 +10382,6 @@ Status message</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="history_button">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Click to see past conversations with this contact</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">False</property>
<signal name="clicked" handler="on_history_button_clicked" last_modification_time="Wed, 02 Mar 2005 17:03:17 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment47">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox2924">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image412">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">4</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label205">
<property name="visible">True</property>
<property name="label" translatable="yes">_History</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkVSeparator" id="vseparator1">
<property name="visible">True</property>
@ -14791,7 +14640,6 @@ the Jabber network.</property>
<widget class="GtkWindow" id="gajim_themes_window">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Gajim Themes Customization</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
@ -15356,12 +15204,13 @@ the Jabber network.</property>
<child>
<widget class="GtkImageMenuItem" id="history_menuitem">
<property name="tooltip" translatable="yes">Click to see past conversation in this room</property>
<property name="label" translatable="yes">_History</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_history_button_clicked" last_modification_time="Wed, 03 Aug 2005 10:37:51 GMT"/>
<signal name="activate" handler="on_history_menuitem_clicked" last_modification_time="Thu, 04 Aug 2005 13:57:24 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image947">
<widget class="GtkImage" id="image1053">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
@ -15381,7 +15230,7 @@ the Jabber network.</property>
<signal name="activate" handler="on_configure_room_menuitem_activate" last_modification_time="Mon, 13 Jun 2005 11:04:55 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image948">
<widget class="GtkImage" id="image1054">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@ -15401,7 +15250,7 @@ the Jabber network.</property>
<signal name="activate" handler="on_change_subject_menuitem_activate" last_modification_time="Mon, 13 Jun 2005 11:05:10 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image949">
<widget class="GtkImage" id="image1055">
<property name="visible">True</property>
<property name="stock">gtk-edit</property>
<property name="icon_size">1</property>
@ -15421,7 +15270,7 @@ the Jabber network.</property>
<signal name="activate" handler="on_change_nick_menuitem_activate" last_modification_time="Sat, 18 Jun 2005 20:23:46 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image950">
<widget class="GtkImage" id="image1056">
<property name="visible">True</property>
<property name="stock">gtk-redo</property>
<property name="icon_size">1</property>
@ -15441,7 +15290,7 @@ the Jabber network.</property>
<signal name="activate" handler="on_bookmark_room_menuitem_activate" last_modification_time="Mon, 13 Jun 2005 12:43:29 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image951">
<widget class="GtkImage" id="image1057">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -15469,12 +15318,13 @@ the Jabber network.</property>
<child>
<widget class="GtkImageMenuItem" id="history_menuitem">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Click to see past conversations with this contact</property>
<property name="label" translatable="yes">_History</property>
<property name="use_underline">True</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_menuitem_clicked" last_modification_time="Thu, 04 Aug 2005 13:53:23 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1029">
<widget class="GtkImage" id="image1050">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
@ -15504,7 +15354,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"/>
<child internal-child="image">
<widget class="GtkImage" id="image1030">
<widget class="GtkImage" id="image1051">
<property name="visible">True</property>
<property name="stock">gtk-file</property>
<property name="icon_size">1</property>
@ -15545,7 +15395,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"/>
<child internal-child="image">
<widget class="GtkImage" id="image1031">
<widget class="GtkImage" id="image1052">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -16327,11 +16177,19 @@ the Jabber network.</property>
<child>
<widget class="GtkImageMenuItem" id="information_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">_Information</property>
<property name="label">gtk-dialog-info</property>
<property name="use_stock">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="history_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">_History</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image849">
<widget class="GtkImage" id="image1047">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
@ -16351,7 +16209,7 @@ the Jabber network.</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image850">
<widget class="GtkImage" id="image1048">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -16371,7 +16229,7 @@ the Jabber network.</property>
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image851">
<widget class="GtkImage" id="image1049">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>

View File

@ -767,13 +767,13 @@ class RosterWindow:
dlg = dialogs.EditGroupsDialog(user, account, self.plugin)
dlg.run()
def on_history(self, widget, user, account):
def on_history(self, widget, contact, account):
'''When history menuitem is activated: call log window'''
if self.plugin.windows['logs'].has_key(user.jid):
self.plugin.windows['logs'][user.jid].window.present()
if self.plugin.windows['logs'].has_key(contact.jid):
self.plugin.windows['logs'][contact.jid].window.present()
else:
self.plugin.windows['logs'][user.jid] = history_window.\
HistoryWindow(self.plugin, user.jid, account)
self.plugin.windows['logs'][contact.jid] = history_window.\
HistoryWindow(self.plugin, contact.jid, account)
def on_send_single_message_menuitem_activate(self, wiget, account, contact):
dialogs.SingleMessageWindow(self, account, contact, 'send')