almost finishing patch of delmonico

This commit is contained in:
Nikos Kouremenos 2005-06-11 16:15:01 +00:00
parent 8109c28fed
commit 3eab7400af
5 changed files with 31 additions and 28 deletions

View File

@ -1635,8 +1635,8 @@ class ServiceRegistrationWindow:
#---------- ManageEmoticonsWindow class -------------#
class ManageEmoticonsWindow:
def __init__(self, plugin):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'add_remove_emoticons_window', APP)
self.window = self.xml.get_widget('add_remove_emoticons_window')
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'manage_emoticons_window', APP)
self.window = self.xml.get_widget('manage_emoticons_window')
self.plugin = plugin
#emoticons
@ -2272,7 +2272,7 @@ class ManageBookmarksWindow:
None, None, None])
for bookmark in gajim.connections[account].bookmarks:
if bookmark['name']=="":
if bookmark['name'] == '':
#No name was given for this bookmark.
#Use the first part of JID instead...
name = bookmark['jid'].split("@")[0]
@ -2376,12 +2376,6 @@ class ManageBookmarksWindow:
bmdict = { 'name': bm[1], 'jid': bm[2], 'autojoin': autojoin,
'password': bm[4], 'nick': bm[5] }
#FIXME: shouldnt this be .connected?
#However we don't even list not-connected accounts now, so
#i think this can just go away?
#if gajim.connections[account[1]].status > 1: #if we're connected
#gajim.connections[account[1]].bookmarks.append(bmdict)
gajim.connections[account[1]].store_bookmarks()
self.window.destroy()

View File

@ -578,13 +578,7 @@ class Interface:
#Open GC window if neccessary
if bm['autojoin'] == '1':
jid = bm['jid']
self.roster.new_room(jid, bm['nick'], account)
self.windows[account]['gc'][jid].set_active_tab(jid)
self.windows[account]['gc'][jid].window.present()
##FIXME: Add a menuitem
self.roster.join_gc_room(account, bm)
def read_sleepy(self):
'''Check if we are idle'''

View File

@ -303,9 +303,10 @@ class GroupchatWindow(chat.Chat):
for bookmark in gajim.connections[self.account].bookmarks:
if bookmark['jid'] == bm['jid']:
room_name = bm['jid'].split('@')[0]
dialogs.ErrorDialog(
_('Bookmark already set'),
_('The bookmark is already in your roster.')).get_response()
_('Room "%s" is already in your bookmarks.') %bm['jid']).get_response()
return
gajim.connections[self.account].bookmarks.append(bm)

View File

@ -2862,7 +2862,7 @@
<widget class="GtkButton" id="add_remove_emoticons_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Add/Remove Emoticons...</property>
<property name="label" translatable="yes">Manage...</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@ -11090,9 +11090,9 @@ send a chat message to</property>
</child>
</widget>
<widget class="GtkWindow" id="add_remove_emoticons_window">
<widget class="GtkWindow" id="manage_emoticons_window">
<property name="border_width">6</property>
<property name="title" translatable="yes">Add/Remove Emoticons</property>
<property name="title" translatable="yes">Manage Emoticons</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@ -11179,7 +11179,7 @@ send a chat message to</property>
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Set Image</property>
<property name="label" translatable="yes">Set Image...</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>

View File

@ -241,6 +241,15 @@ class RosterWindow:
model.set_value(iter, 0, img)
model.set_value(iter, 1, name)
def join_gc_room(self, account, bm):
jid = bm['jid']
self.new_room(jid, bm['nick'], account)
self.plugin.windows[account]['gc'][jid].set_active_tab(jid)
self.plugin.windows[account]['gc'][jid].window.present()
def on_bm_header_changed_state(self, widget, event):
widget.set_state(gtk.STATE_NORMAL) #do not allow selected_state
def make_menu(self):
'''create the main_window's menus'''
new_message_menuitem = self.xml.get_widget('new_message_menuitem')
@ -285,13 +294,11 @@ class RosterWindow:
sub_menu = gtk.Menu()
join_gc_menuitem.set_submenu(sub_menu)
for account in gajim.connections:
our_jid = gajim.config.get_per('accounts', account, 'name') + '@' +\
gajim.config.get_per('accounts', account, 'hostname')
label = gtk.Label()
label.set_markup('<b>' + account +'</b>')
label.set_markup('<u>' + account.upper() +'</u>')
item = gtk.MenuItem()
item.add(label)
item.connect('state-changed', self.on_bm_header_changed_state)
sub_menu.append(item)
item = gtk.MenuItem(_('New Room'))
@ -299,6 +306,13 @@ class RosterWindow:
item.connect('activate', self.on_join_gc_activate, account)
#FIXME: delmonico hack here [get bookmakrs and add them]
if gajim.connections[account].connected <= 1:
continue
for bookmark in gajim.connections[account].bookmarks:
print bookmark['name']
item = gtk.MenuItem(bookmark['name'])
sub_menu.append(item)
item.connect('activate', self.join_gc_room, account, bookmark)
newitem = gtk.MenuItem() # seperator
sub_menu.append(newitem)