new message dialog fix for title and add to accounts shouldn't list not in the roster. plz see my fixme comment
This commit is contained in:
parent
d80325510b
commit
72e212731c
3 changed files with 42 additions and 36 deletions
|
@ -404,8 +404,8 @@ class Change_status_message_dialog:
|
|||
message_comboboxentry.append_text(val)
|
||||
self.xml.signal_autoconnect(self)
|
||||
|
||||
class Add_contact_window:
|
||||
"""Class for add_contact_window"""
|
||||
class Add_new_contact_window:
|
||||
"""Class for Add_new_contact_window"""
|
||||
def on_cancel_button_clicked(self, widget):
|
||||
"""When Cancel button is clicked"""
|
||||
widget.get_toplevel().destroy()
|
||||
|
@ -480,8 +480,8 @@ class Add_contact_window:
|
|||
return
|
||||
self.plugin = plugin
|
||||
self.account = account
|
||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'add_contact_window', APP)
|
||||
self.window = self.xml.get_widget('add_contact_window')
|
||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'add_new_contact_window', APP)
|
||||
self.window = self.xml.get_widget('add_new_contact_window')
|
||||
self.old_uid_value = ''
|
||||
liststore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
|
||||
liststore.append(['Jabber', ''])
|
||||
|
@ -519,7 +519,10 @@ class Add_contact_window:
|
|||
liststore = gtk.ListStore(str)
|
||||
self.group_comboboxentry.set_model(liststore)
|
||||
for g in self.plugin.roster.groups[account].keys():
|
||||
self.group_comboboxentry.append_text(g)
|
||||
if g != 'not in the roster': #FIXME: nk 2 yann. it seems that the empty groups are NOT deleted!
|
||||
#NO MATTER WHAT LEAVE THAT HIS, because even if we delete empty groups, not in roster can have one
|
||||
#and we don't want the user to choose to add more
|
||||
self.group_comboboxentry.append_text(g)
|
||||
|
||||
self.xml.signal_autoconnect(self)
|
||||
|
||||
|
@ -584,7 +587,6 @@ 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"""
|
||||
|
@ -610,7 +612,7 @@ class subscription_request_window:
|
|||
self.plugin.send('AUTH', self.account, self.jid)
|
||||
widget.get_toplevel().destroy()
|
||||
if not self.plugin.roster.contacts[self.account].has_key(self.jid):
|
||||
Add_contact_window(self.plugin, self.account, self.jid)
|
||||
Add_new_contact_window(self.plugin, self.account, self.jid)
|
||||
|
||||
def on_deny_button_clicked(self, widget):
|
||||
"""refuse the request"""
|
||||
|
@ -702,12 +704,16 @@ class New_message_dialog:
|
|||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'new_message_dialog', APP)
|
||||
self.window = self.xml.get_widget('new_message_dialog')
|
||||
self.jid_entry = self.xml.get_widget('jid_entry')
|
||||
self.xml.signal_autoconnect(self)
|
||||
|
||||
our_jid = self.plugin.accounts[account]['name'] + '@' +\
|
||||
self.plugin.accounts[account]['hostname']
|
||||
if len(self.plugin.accounts) > 1:
|
||||
title = 'New Message as %s' % self.plugin.accounts[account]['jid']
|
||||
title = 'New Message as ' + our_jid
|
||||
else:
|
||||
title = 'New Message'
|
||||
self.window.set_title(title)
|
||||
|
||||
self.xml.signal_autoconnect(self)
|
||||
|
||||
class Change_password_dialog:
|
||||
def run(self):
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image481">
|
||||
<widget class="GtkImage" id="image488">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-new</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -68,7 +68,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image482">
|
||||
<widget class="GtkImage" id="image489">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-connect</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -88,13 +88,13 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="add_contact_menuitem">
|
||||
<widget class="GtkImageMenuItem" id="add_new_contact_menuitem">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Add _Contact</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image483">
|
||||
<widget class="GtkImage" id="image490">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -132,7 +132,7 @@
|
|||
<signal name="activate" handler="on_about_menuitem_activate" last_modification_time="Tue, 01 Mar 2005 22:56:45 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image484">
|
||||
<widget class="GtkImage" id="image491">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-about</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -160,7 +160,7 @@
|
|||
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image485">
|
||||
<widget class="GtkImage" id="image492">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-quit</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -195,7 +195,7 @@
|
|||
<accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image486">
|
||||
<widget class="GtkImage" id="image493">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-select-color</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -215,7 +215,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image487">
|
||||
<widget class="GtkImage" id="image494">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-find</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -243,7 +243,7 @@
|
|||
<accelerator key="P" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image488">
|
||||
<widget class="GtkImage" id="image495">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-preferences</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -1666,7 +1666,7 @@
|
|||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkWindow" id="add_contact_window">
|
||||
<widget class="GtkWindow" id="add_new_contact_window">
|
||||
<property name="border_width">4</property>
|
||||
<property name="width_request">317</property>
|
||||
<property name="height_request">277</property>
|
||||
|
|
|
@ -211,11 +211,11 @@ class Roster_window:
|
|||
# try to avoid WIDGET_REALIZED_FOR_EVENT failed which freezes gajim
|
||||
new_message_menuitem = self.xml.get_widget('new_message_menuitem')
|
||||
join_gc_menuitem = self.xml.get_widget('join_gc_menuitem')
|
||||
add_contact_menuitem = self.xml.get_widget('add_contact_menuitem')
|
||||
add_new_contact_menuitem = self.xml.get_widget('add_new_contact_menuitem')
|
||||
service_disco_menuitem = self.xml.get_widget('service_disco_menuitem')
|
||||
if self.add_contact_handler_id:
|
||||
add_contact_menuitem.handler_disconnect(self.add_contact_handler_id)
|
||||
self.add_contact_handler_id = None
|
||||
if self.add_new_contact_handler_id:
|
||||
add_new_contact_menuitem.handler_disconnect(self.add_new_contact_handler_id)
|
||||
self.add_new_contact_handler_id = None
|
||||
if self.service_disco_handler_id:
|
||||
service_disco_menuitem.handler_disconnect(\
|
||||
self.service_disco_handler_id)
|
||||
|
@ -228,8 +228,8 @@ class Roster_window:
|
|||
self.new_message_menuitem_handler_id)
|
||||
self.new_message_menuitem_handler_id = None
|
||||
#remove the existing submenus
|
||||
if add_contact_menuitem.get_submenu():
|
||||
add_contact_menuitem.remove_submenu()
|
||||
if add_new_contact_menuitem.get_submenu():
|
||||
add_new_contact_menuitem.remove_submenu()
|
||||
if service_disco_menuitem.get_submenu():
|
||||
service_disco_menuitem.remove_submenu()
|
||||
if join_gc_menuitem.get_submenu():
|
||||
|
@ -239,21 +239,21 @@ class Roster_window:
|
|||
if len(self.plugin.accounts.keys()) > 0:
|
||||
new_message_menuitem.set_sensitive(True)
|
||||
join_gc_menuitem.set_sensitive(True)
|
||||
add_contact_menuitem.set_sensitive(True)
|
||||
add_new_contact_menuitem.set_sensitive(True)
|
||||
service_disco_menuitem.set_sensitive(True)
|
||||
else:
|
||||
new_message_menuitem.set_sensitive(False)
|
||||
join_gc_menuitem.set_sensitive(False)
|
||||
add_contact_menuitem.set_sensitive(False)
|
||||
add_new_contact_menuitem.set_sensitive(False)
|
||||
service_disco_menuitem.set_sensitive(False)
|
||||
if len(self.plugin.accounts.keys()) >= 2: # 2 or more accounts? make submenus
|
||||
#add
|
||||
sub_menu = gtk.Menu()
|
||||
add_contact_menuitem.set_submenu(sub_menu)
|
||||
add_new_contact_menuitem.set_submenu(sub_menu)
|
||||
for account in self.plugin.accounts.keys():
|
||||
item = gtk.MenuItem(_('to ') + account + _(' account'))
|
||||
sub_menu.append(item)
|
||||
item.connect("activate", self.on_add_contact, account)
|
||||
item.connect("activate", self.on_add_new_contact, account)
|
||||
sub_menu.show_all()
|
||||
#disco
|
||||
sub_menu = gtk.Menu()
|
||||
|
@ -287,9 +287,9 @@ class Roster_window:
|
|||
sub_menu.show_all()
|
||||
elif len(self.plugin.accounts.keys()) == 1: # one account
|
||||
#add
|
||||
if not self.add_contact_handler_id:
|
||||
self.add_contact_handler_id = add_contact_menuitem.connect(\
|
||||
'activate', self.on_add_contact, self.plugin.accounts.keys()[0])
|
||||
if not self.add_new_contact_handler_id:
|
||||
self.add_new_contact_handler_id = add_new_contact_menuitem.connect(\
|
||||
'activate', self.on_add_new_contact, self.plugin.accounts.keys()[0])
|
||||
#disco
|
||||
if not self.service_disco_handler_id:
|
||||
self.service_disco_handler_id = service_disco_menuitem.connect(\
|
||||
|
@ -574,7 +574,7 @@ class Roster_window:
|
|||
item.connect('activate', self.on_service_disco_menuitem_activate, account)
|
||||
item = gtk.MenuItem(_('_Add contact'))
|
||||
menu.append(item)
|
||||
item.connect('activate', self.on_add_contact, account)
|
||||
item.connect('activate', self.on_add_new_contact, account)
|
||||
item = gtk.MenuItem(_('Join _groupchat'))
|
||||
menu.append(item)
|
||||
item.connect('activate', self.on_join_gc_activate, account)
|
||||
|
@ -906,8 +906,8 @@ class Roster_window:
|
|||
else:
|
||||
self.plugin.windows['preferences'].window.show_all()
|
||||
|
||||
def on_add_contact(self, widget, account):
|
||||
Add_contact_window(self.plugin, account)
|
||||
def on_add_new_contact(self, widget, account):
|
||||
Add_new_contact_window(self.plugin, account)
|
||||
|
||||
def on_join_gc_activate(self, widget, account):
|
||||
Join_groupchat_window(self.plugin, account)
|
||||
|
@ -1255,7 +1255,7 @@ class Roster_window:
|
|||
self.tree = self.xml.get_widget('roster_treeview')
|
||||
self.plugin = plugin
|
||||
self.nb_unread = 0
|
||||
self.add_contact_handler_id = False
|
||||
self.add_new_contact_handler_id = False
|
||||
self.service_disco_handler_id = False
|
||||
self.join_gc_handler_id = False
|
||||
self.new_message_menuitem_handler_id = False
|
||||
|
|
Loading…
Add table
Reference in a new issue