A gc control and a chat control in the same window is realized.
This commit is contained in:
parent
311288907a
commit
5464701cda
4 changed files with 44 additions and 14 deletions
|
@ -24,6 +24,24 @@ from chat_control import ChatControl
|
||||||
from chat_control import ChatControlBase
|
from chat_control import ChatControlBase
|
||||||
from conversation_textview import ConversationTextview
|
from conversation_textview import ConversationTextview
|
||||||
from message_textview import MessageTextView
|
from message_textview import MessageTextView
|
||||||
|
from gettext import ngettext
|
||||||
|
from common import i18n
|
||||||
|
|
||||||
|
_ = i18n._
|
||||||
|
Q_ = i18n.Q_
|
||||||
|
APP = i18n.APP
|
||||||
|
gtk.glade.bindtextdomain(APP, i18n.DIR)
|
||||||
|
gtk.glade.textdomain(APP)
|
||||||
|
|
||||||
|
GTKGUI_GLADE = 'gtkgui.glade'
|
||||||
|
|
||||||
|
#(status_image, type, nick, shown_nick)
|
||||||
|
(
|
||||||
|
C_IMG, # image to show state (online, new message etc)
|
||||||
|
C_TYPE, # type of the row ('contact' or 'group')
|
||||||
|
C_NICK, # contact nickame or group name
|
||||||
|
C_TEXT, # text shown in the cellrenderer
|
||||||
|
) = range(4)
|
||||||
|
|
||||||
class PrivateChatControl(ChatControl):
|
class PrivateChatControl(ChatControl):
|
||||||
TYPE_ID = message_control.TYPE_PM
|
TYPE_ID = message_control.TYPE_PM
|
||||||
|
@ -40,6 +58,9 @@ class GroupchatControl(ChatControlBase):
|
||||||
ChatControlBase.__init__(self, self.TYPE_ID, parent_win,
|
ChatControlBase.__init__(self, self.TYPE_ID, parent_win,
|
||||||
'muc_child_vbox', _('Group Chat'), contact, acct);
|
'muc_child_vbox', _('Group Chat'), contact, acct);
|
||||||
self.compact_view_always = gajim.config.get('always_compact_view_gc')
|
self.compact_view_always = gajim.config.get('always_compact_view_gc')
|
||||||
|
# alphanum sorted
|
||||||
|
self.muc_cmds = ['ban', 'chat', 'query', 'clear', 'close', 'compact', 'help', 'invite',
|
||||||
|
'join', 'kick', 'leave', 'me', 'msg', 'nick', 'part', 'say', 'topic']
|
||||||
# muc attention states (when we are mentioned in a muc)
|
# muc attention states (when we are mentioned in a muc)
|
||||||
# if the room jid is in the list, the room has mentioned us
|
# if the room jid is in the list, the room has mentioned us
|
||||||
self.muc_attentions = []
|
self.muc_attentions = []
|
||||||
|
@ -57,7 +78,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
|
|
||||||
num_unread = self.nb_unread
|
num_unread = self.nb_unread
|
||||||
|
|
||||||
has_focus = self.parent_win.get_property('has-toplevel-focus')
|
has_focus = self.parent_win.window.get_property('has-toplevel-focus')
|
||||||
current_tab = self.parent_win.get_active_control() == self
|
current_tab = self.parent_win.get_active_control() == self
|
||||||
color = None
|
color = None
|
||||||
theme = gajim.config.get('roster_theme')
|
theme = gajim.config.get('roster_theme')
|
||||||
|
|
|
@ -19769,7 +19769,7 @@ Status message</property>
|
||||||
<signal name="button_press_event" handler="on_banner_eventbox_button_press_event" last_modification_time="Mon, 08 Aug 2005 15:32:39 GMT"/>
|
<signal name="button_press_event" handler="on_banner_eventbox_button_press_event" last_modification_time="Mon, 08 Aug 2005 15:32:39 GMT"/>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label375">
|
<widget class="GtkLabel" id="banner_name_label">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label"><span weight="heavy" size="large">room jid</span>
|
<property name="label"><span weight="heavy" size="large">room jid</span>
|
||||||
topic</property>
|
topic</property>
|
||||||
|
@ -19820,7 +19820,7 @@ topic</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow46">
|
<widget class="GtkScrolledWindow" id="conversation_scrolledwindow">
|
||||||
<property name="width_request">200</property>
|
<property name="width_request">200</property>
|
||||||
<property name="height_request">60</property>
|
<property name="height_request">60</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -19842,7 +19842,7 @@ topic</property>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow47">
|
<widget class="GtkScrolledWindow" id="message_scrolledwindow">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
|
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
|
||||||
|
|
|
@ -267,10 +267,16 @@ class MessageWindow:
|
||||||
num_unread = ctl.nb_unread
|
num_unread = ctl.nb_unread
|
||||||
# Set tab image (always 16x16); unread messages show the 'message' image
|
# Set tab image (always 16x16); unread messages show the 'message' image
|
||||||
img_16 = gajim.interface.roster.get_appropriate_state_images(contact.jid)
|
img_16 = gajim.interface.roster.get_appropriate_state_images(contact.jid)
|
||||||
|
tab_img = None
|
||||||
|
if ctl.type_id == message_control.TYPE_CHAT:
|
||||||
if num_unread and gajim.config.get('show_unread_tab_icon'):
|
if num_unread and gajim.config.get('show_unread_tab_icon'):
|
||||||
tab_img = img_16['message']
|
tab_img = img_16['message']
|
||||||
else:
|
else:
|
||||||
tab_img = img_16[contact.show]
|
tab_img = img_16[contact.show]
|
||||||
|
elif ctl.type_id == message_control.TYPE_GC:
|
||||||
|
# FIXME: muc_active muc_inactive
|
||||||
|
pass
|
||||||
|
if tab_img:
|
||||||
if tab_img.get_storage_type() == gtk.IMAGE_ANIMATION:
|
if tab_img.get_storage_type() == gtk.IMAGE_ANIMATION:
|
||||||
status_img.set_from_animation(tab_img.get_animation())
|
status_img.set_from_animation(tab_img.get_animation())
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -46,6 +46,7 @@ from common import i18n
|
||||||
from message_window import MessageWindowMgr
|
from message_window import MessageWindowMgr
|
||||||
from chat_control import ChatControl
|
from chat_control import ChatControl
|
||||||
from groupchat_control import GroupchatControl
|
from groupchat_control import GroupchatControl
|
||||||
|
from groupchat_control import PrivateChatControl
|
||||||
|
|
||||||
_ = i18n._
|
_ = i18n._
|
||||||
APP = i18n.APP
|
APP = i18n.APP
|
||||||
|
@ -1697,14 +1698,16 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
mw.set_active_tab(jid)
|
mw.set_active_tab(jid)
|
||||||
mw.window.present()
|
mw.window.present()
|
||||||
|
|
||||||
def new_room(self, jid, nick, account):
|
def new_room(self, room_jid, nick, account):
|
||||||
|
print "new_room"
|
||||||
# FIXME: Not contact. Use jid and nick
|
# FIXME: Not contact. Use jid and nick
|
||||||
# Get target window, create a control, and associate it with the window
|
# Get target window, create a control, and associate it with the window
|
||||||
|
contact = gajim.contacts.create_contact(jid = room_jid)
|
||||||
mw = gajim.interface.msg_win_mgr.get_window(contact.jid)
|
mw = gajim.interface.msg_win_mgr.get_window(contact.jid)
|
||||||
if not mw:
|
if not mw:
|
||||||
mw = gajim.interface.msg_win_mgr.create_window(contact, account,
|
mw = gajim.interface.msg_win_mgr.create_window(contact, account,
|
||||||
GroupchatControl.TYPE_ID)
|
GroupchatControl.TYPE_ID)
|
||||||
gc_control = ChatControl(mw, contact, account)
|
gc_control = GroupchatControl(mw, contact, account)
|
||||||
mw.new_tab(gc_control)
|
mw.new_tab(gc_control)
|
||||||
|
|
||||||
def on_message(self, jid, msg, tim, account, encrypted = False,
|
def on_message(self, jid, msg, tim, account, encrypted = False,
|
||||||
|
|
Loading…
Add table
Reference in a new issue