Commit d4fc3f4b authored by nkour's avatar nkour

better popup

parent 423240e3
......@@ -420,8 +420,6 @@ class Chat:
self.plugin.launch_browser_mailer(kind, word)
def detect_and_print_special_text(self, otext, jid, other_tag, print_all_special):
# nk 2 yann: when doing this in GC you have to pass sth and looks for
# xmls[Other-key-here] I believe :D
conversation_textview = self.xmls[jid].get_widget('conversation_textview')
conversation_buffer = conversation_textview.get_buffer()
......@@ -462,7 +460,6 @@ class Chat:
#it's an emoticon
tag = None
emot_ascii = possible_emot_ascii_caps
print 'emoticon:', emot_ascii
end_iter = conversation_buffer.get_end_iter()
conversation_buffer.insert_pixbuf(end_iter, \
self.plugin.emoticons[emot_ascii])
......
......@@ -3,8 +3,8 @@
## Gajim Team:
## - Yann Le Boulanger <asterix@lagaule.org>
## - Vincent Hanquez <tab@snarc.org>
## - Nikos Kouremenos <nkour@jabber.org>
## - Alex Podaras <bigpod@jabber.org>
## - Nikos Kouremenos <nkour@jabber.org>
## - Alex Podaras <bigpod@jabber.org>
##
## Copyright (C) 2003-2005 Gajim Team
##
......@@ -519,6 +519,7 @@ class Information_dialog:
gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, label)
dialog.connect('response', self.on_response)
dialog.show()
#dialog.run() #IT freezes WHY? also if you do a lot of stuff all together it freezes
class Error_dialog:
"""Class for error dialog"""
......
......@@ -8985,4 +8985,74 @@ send a chat message to</property>
</child>
</widget>
<widget class="GtkMenu" id="menu1">
<child>
<widget class="GtkMenuItem" id="status_menu">
<property name="visible">True</property>
<property name="label" translatable="yes">Status</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="status_menu_menu">
<child>
<widget class="GtkMenuItem" id="online1">
<property name="visible">True</property>
<property name="label" translatable="yes">Online</property>
<property name="use_underline">True</property>
<signal name="activate" handler="set_cb" last_modification_time="Mon, 14 Mar 2005 16:14:43 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="away1">
<property name="visible">True</property>
<property name="label" translatable="yes">Away</property>
<property name="use_underline">True</property>
<signal name="activate" handler="set_cb" last_modification_time="Mon, 14 Mar 2005 16:14:43 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="xa1">
<property name="visible">True</property>
<property name="label" translatable="yes">XA</property>
<property name="use_underline">True</property>
<signal name="activate" handler="set_cb" last_modification_time="Mon, 14 Mar 2005 16:14:43 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="dnd1">
<property name="visible">True</property>
<property name="label" translatable="yes">DND</property>
<property name="use_underline">True</property>
<signal name="activate" handler="set_cb" last_modification_time="Mon, 14 Mar 2005 16:14:43 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="invisible1">
<property name="visible">True</property>
<property name="label" translatable="yes">Invisible</property>
<property name="use_underline">True</property>
<signal name="activate" handler="set_cb" last_modification_time="Mon, 14 Mar 2005 16:14:43 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="offline1">
<property name="visible">True</property>
<property name="label" translatable="yes">Offline</property>
<property name="use_underline">True</property>
<signal name="activate" handler="set_cb" last_modification_time="Mon, 14 Mar 2005 16:14:43 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</glade-interface>
......@@ -849,7 +849,7 @@ class plugin:
self.config['autoxatime']*60)
self.systray_visible = 0
try:
import egg.trayicon as trayicon # use gnomepythonextras traycion
import egg.trayicon as trayicon # use gnomepythonextras trayicon
except:
try:
import trayicon # use yann's
......
......@@ -219,7 +219,7 @@ class roster_window:
sub_menu = gtk.Menu()
add_contact_menuitem.set_submenu(sub_menu)
for account in self.plugin.accounts.keys():
item = gtk.MenuItem('using ' + account + ' account')
item = gtk.MenuItem(_('using ') + account + _(' account'))
sub_menu.append(item)
item.connect("activate", self.on_add_contact, account)
sub_menu.show_all()
......@@ -227,15 +227,15 @@ class roster_window:
sub_menu = gtk.Menu()
browse_agents_menuitem.set_submenu(sub_menu)
for account in self.plugin.accounts.keys():
item = gtk.MenuItem('using ' + account + ' account')
item = gtk.MenuItem(_('using ') + account + _(' account'))
sub_menu.append(item)
item.connect("activate", self.on_browse_agents, account)
item.connect('activate', self.on_browse_agents, account)
sub_menu.show_all()
#join gc
sub_menu = gtk.Menu()
join_gc_menuitem.set_submenu(sub_menu)
for account in self.plugin.accounts.keys():
item = gtk.MenuItem('using ' + account + ' account')
item = gtk.MenuItem(_('using ') + account + _(' account'))
sub_menu.append(item)
item.connect("activate", self.on_join_gc, account)
sub_menu.show_all()
......@@ -243,7 +243,7 @@ class roster_window:
sub_menu = gtk.Menu()
new_message_menuitem.set_submenu(sub_menu)
for account in self.plugin.accounts.keys():
item = gtk.MenuItem('using ' + account + ' account')
item = gtk.MenuItem(_('using ') + account + _(' account'))
sub_menu.append(item)
item.connect("activate", self.on_new_message_menuitem_activate, account)
sub_menu.show_all()
......@@ -259,7 +259,7 @@ class roster_window:
#join_gc
if not self.join_gc_handler_id:
self.join_gc_handler_id = join_gc_menuitem.connect(\
"activate", self.on_join_gc, self.plugin.accounts.keys()[0])
'activate', self.on_join_gc, self.plugin.accounts.keys()[0])
if not self.new_message_menuitem_handler_id:
self.new_message_menuitem_handler_id = new_message_menuitem.connect(\
'activate', self.on_new_message_menuitem_activate, self.plugin.accounts.keys()[0])
......@@ -1195,10 +1195,10 @@ class roster_window:
self.tree = self.xml.get_widget('roster_treeview')
self.plugin = plugin
self.nb_unread = 0
self.add_contact_handler_id = 0
self.browse_agents_handler_id = 0
self.join_gc_handler_id = 0
self.new_message_menuitem_handler_id = 0
self.add_contact_handler_id = False
self.browse_agents_handler_id = False
self.join_gc_handler_id = False
self.new_message_menuitem_handler_id = False
self.regroup = 0
if self.plugin.config.has_key('mergeaccounts'):
self.regroup = self.plugin.config['mergeaccounts']
......
......@@ -92,7 +92,7 @@ class systray:
New_message_dialog(self.plugin, account)
def make_menu(self, event):
"""create the browse agents, add contact & join groupchat sub menus"""
"""create chat with and new message (sub) menus/menuitems"""
menu = gtk.Menu()
item = gtk.MenuItem(_("Status"))
......@@ -120,7 +120,7 @@ class systray:
sub_menu.append(item)
item.connect("activate", self.set_cb, 'offline')
chat_with_menuitem = gtk.MenuItem(_("Chat with"))
chat_with_menuitem = gtk.MenuItem(_('Chat with'))
menu.append(chat_with_menuitem)
new_message_menuitem = gtk.MenuItem(_('New Message'))
menu.append(new_message_menuitem)
......@@ -133,39 +133,31 @@ class systray:
new_message_menuitem.set_sensitive(False)
if len(self.plugin.accounts.keys()) >= 2: # 2 or more accounts? make submenus
menu_account = gtk.Menu()
chat_with_menuitem.set_submenu(menu_account)
account_menu_for_chat_with = gtk.Menu()
chat_with_menuitem.set_submenu(account_menu_for_chat_with)
account_menu_for_new_message = gtk.Menu()
new_message_menuitem.set_submenu(account_menu_for_new_message)
for account in self.plugin.accounts.keys():
#for chat_with
menu_account = gtk.Menu()
chat_with_menuitem.set_submenu(menu_account)
for account in self.plugin.accounts.keys():
item = gtk.MenuItem('using ' + account + ' account')
menu_account.append(item)
menu_group = gtk.Menu()
item.set_submenu(menu_group)
for group in self.plugin.roster.groups[account].keys():
if group == 'Agents':
continue
item = gtk.MenuItem(group)
menu_group.append(item)
menu_user = gtk.Menu()
item.set_submenu(menu_user)
for users in self.plugin.roster.contacts[account].values():
user = users[0]
if group in user.groups and user.show != 'offline' and \
user.show != 'error':
item = gtk.MenuItem(user.name.replace('_', '__'))
menu_user.append(item)
item.connect("activate", self.start_chat, account,\
user.jid)
item = gtk.MenuItem(_('using ') + account + _(' account'))
account_menu_for_chat_with.append(item)
group_menu = self.make_groups_submenus_for_chat_with(account)
item.set_submenu(group_menu)
#for new_message
item = gtk.MenuItem(_('using ') + account + _(' account'))
item.connect('activate',\
self.on_new_message_menuitem_activate, account)
account_menu_for_new_message.append(item)
elif len(self.plugin.accounts.keys()) == 1: # one account
#one account, no need to show 'using foo account'
#for chat_with
menu_account = gtk.Menu()
chat_with_menuitem.set_submenu(menu_account)
if not self.chat_with_handler_id:
self.chat_with_handler_id = chat_with_menuitem.connect(\
'activate', self.start_chat, self.plugin.accounts.keys()[0])
account = self.plugin.accounts.keys()[0]
group_menu = self.make_groups_submenus_for_chat_with(account)
chat_with_menuitem.set_submenu(group_menu)
#for new message
self.new_message_handler_id = new_message_menuitem.connect(\
......@@ -174,13 +166,44 @@ class systray:
item = gtk.MenuItem() # seperator
menu.append(item)
item = gtk.MenuItem(_("Quit"))
item = gtk.MenuItem(_('Quit'))
menu.append(item)
item.connect("activate", self.plugin.roster.on_quit_menuitem_activate)
item.connect('activate', self.plugin.roster.on_quit_menuitem_activate)
menu.popup(None, None, None, event.button, event.time)
menu.show_all()
menu.reposition()
def make_groups_submenus_for_chat_with(self, account):
groups_menu = gtk.Menu()
for group in self.plugin.roster.groups[account].keys():
if group == 'Agents':
continue
# at least one not offline or with errors in this group
at_least_one = False
item = gtk.MenuItem(group)
groups_menu.append(item)
contacts_menu = gtk.Menu()
item.set_submenu(contacts_menu)
for users in self.plugin.roster.contacts[account].values():
user = users[0]
if group in user.groups and user.show != 'offline' and \
user.show != 'error':
at_least_one = True
s = user.name.replace('_', '__') + ' (' + user.show + ')'
item = gtk.MenuItem(s)
item.connect('activate', self.start_chat, account,\
user.jid)
contacts_menu.append(item)
if not at_least_one:
message = _('All contacts in this group are offline or have errors')
item = gtk.MenuItem(message)
item.set_sensitive(False)
contacts_menu.append(item)
return groups_menu
def on_clicked(self, widget, event):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
......@@ -232,11 +255,8 @@ class systray:
self.t = None
self.img_tray = gtk.Image()
self.status = 'offline'
self.chat_with_handler_id = None
self.new_message_handler_id = None
global trayicon
try:
import egg.trayicon as trayicon # gnomepythonextras trayicon
except:
import trayicon # yann's trayicon
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment