Split room jid field in join groupchat dialog. Fixes #5528
Add browse rooms button in join groupchat dialog. Fixes #3546
This commit is contained in:
parent
ce039ff2eb
commit
e552333b85
|
@ -15,7 +15,7 @@
|
|||
<child>
|
||||
<object class="GtkTable" id="table15">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">7</property>
|
||||
<property name="n_rows">8</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<property name="row_spacing">6</property>
|
||||
|
@ -110,8 +110,8 @@
|
|||
<property name="label" translatable="yes">Password:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
|
@ -126,14 +126,14 @@
|
|||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="auto_join_checkbutton">
|
||||
<property name="label" translatable="yes">Join this room automatically when I connect</property>
|
||||
<property name="label" translatable="yes">Join this room _automatically when I connect</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
@ -143,8 +143,8 @@
|
|||
</object>
|
||||
<packing>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
|
@ -174,21 +174,69 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="bookmark_checkbutton">
|
||||
<property name="label" translatable="yes">Bookmark this room</property>
|
||||
<property name="label" translatable="yes">_Bookmark this room</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_bookmark_checkbutton_toggled"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="bottom_attach">7</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Server:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkComboBoxEntry" id="server_comboboxentry">
|
||||
<property name="visible">True</property>
|
||||
<property name="model">liststore1</property>
|
||||
<property name="text_column">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="browse_rooms_button">
|
||||
<property name="label" translatable="yes">Bro_wse Rooms</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">image1</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="clicked" handler="on_browse_rooms_button_clicked"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
|
@ -275,4 +323,14 @@
|
|||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
<!-- column-name gchararray1 -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-find</property>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
<!-- column-name item text -->
|
||||
<!-- column-name item -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
|
@ -71,7 +71,6 @@ Agent JID - node</property>
|
|||
<property name="visible">True</property>
|
||||
<property name="model">liststore1</property>
|
||||
<signal name="changed" handler="on_address_comboboxentry_changed"/>
|
||||
<signal name="key_press_event" handler="on_address_comboboxentry_key_press_event"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
||||
<attributes>
|
||||
|
|
|
@ -38,6 +38,7 @@ import vcard
|
|||
import conversation_textview
|
||||
import message_control
|
||||
import dataforms_widget
|
||||
import disco
|
||||
|
||||
from random import randrange
|
||||
from common import pep
|
||||
|
@ -2156,7 +2157,6 @@ class JoinGroupchatWindow:
|
|||
self._nickname_entry = self.xml.get_object('nickname_entry')
|
||||
self._password_entry = self.xml.get_object('password_entry')
|
||||
|
||||
self._room_jid_entry.set_text(room_jid)
|
||||
self._nickname_entry.set_text(nick)
|
||||
if password:
|
||||
self._password_entry.set_text(password)
|
||||
|
@ -2171,6 +2171,13 @@ class JoinGroupchatWindow:
|
|||
title = _('Join Group Chat')
|
||||
self.window.set_title(title)
|
||||
|
||||
self.server_comboboxentry = self.xml.get_object('server_comboboxentry')
|
||||
self.server_model = self.server_comboboxentry.get_model()
|
||||
server_list = []
|
||||
# get the muc server of our server
|
||||
if 'jabber' in gajim.connections[account].muc_jid:
|
||||
server_list.append(gajim.connections[account].muc_jid['jabber'])
|
||||
|
||||
self.recently_combobox = self.xml.get_object('recently_combobox')
|
||||
liststore = gtk.ListStore(str)
|
||||
self.recently_combobox.set_model(liststore)
|
||||
|
@ -2180,6 +2187,16 @@ class JoinGroupchatWindow:
|
|||
self.recently_groupchat = gajim.config.get('recently_groupchat').split()
|
||||
for g in self.recently_groupchat:
|
||||
self.recently_combobox.append_text(g)
|
||||
server = gajim.get_server_from_jid(g)
|
||||
if server not in server_list and not server.startswith('irc'):
|
||||
server_list.append(server)
|
||||
|
||||
for s in server_list:
|
||||
self.server_model.append([s])
|
||||
self.server_comboboxentry.set_active(0)
|
||||
|
||||
self._set_room_jid(room_jid)
|
||||
|
||||
if len(self.recently_groupchat) == 0:
|
||||
self.recently_combobox.set_sensitive(False)
|
||||
elif room_jid == '':
|
||||
|
@ -2229,11 +2246,39 @@ class JoinGroupchatWindow:
|
|||
self.account = model[iter_][0].decode('utf-8')
|
||||
self.on_required_entry_changed(self._nickname_entry)
|
||||
|
||||
def _select_server(self, server):
|
||||
i = 0
|
||||
for s in self.server_model:
|
||||
if s[0] == server:
|
||||
self.server_comboboxentry.set_active(i)
|
||||
break
|
||||
i += 1
|
||||
|
||||
def _set_room_jid(self, room_jid):
|
||||
room, server = gajim.get_name_and_server_from_jid(room_jid)
|
||||
self._select_server(server)
|
||||
self._room_jid_entry.set_text(room)
|
||||
|
||||
def on_recently_combobox_changed(self, widget):
|
||||
model = widget.get_model()
|
||||
iter_ = widget.get_active_iter()
|
||||
room_jid = model[iter_][0].decode('utf-8')
|
||||
self._room_jid_entry.set_text(room_jid)
|
||||
self._set_room_jid(room_jid)
|
||||
|
||||
def on_browse_rooms_button_clicked(self, widget):
|
||||
server = self.server_model[self.server_comboboxentry.get_active()][0].\
|
||||
decode('utf-8')
|
||||
if server in gajim.interface.instances[self.account]['disco']:
|
||||
gajim.interface.instances[self.account]['disco'][server].window.\
|
||||
present()
|
||||
else:
|
||||
try:
|
||||
# Object will add itself to the window dict
|
||||
disco.ServiceDiscoveryWindow(self.account, server,
|
||||
initial_identities=[{'category': 'conference',
|
||||
'type': 'text'}])
|
||||
except GajimGeneralException:
|
||||
pass
|
||||
|
||||
def on_cancel_button_clicked(self, widget):
|
||||
"""
|
||||
|
@ -2258,7 +2303,10 @@ class JoinGroupchatWindow:
|
|||
'groupchat.'))
|
||||
return
|
||||
nickname = self._nickname_entry.get_text().decode('utf-8')
|
||||
room_jid = self._room_jid_entry.get_text().decode('utf-8')
|
||||
server = self.server_model[self.server_comboboxentry.get_active()][0].\
|
||||
decode('utf-8')
|
||||
room = self._room_jid_entry.get_text().decode('utf-8')
|
||||
room_jid = room + '@' + server
|
||||
password = self._password_entry.get_text().decode('utf-8')
|
||||
try:
|
||||
nickname = helpers.parse_resource(nickname)
|
||||
|
|
|
@ -492,8 +492,8 @@ class ServiceDiscoveryWindow(object):
|
|||
Class that represents the Services Discovery window
|
||||
"""
|
||||
|
||||
def __init__(self, account, jid = '', node = '',
|
||||
address_entry = False, parent = None):
|
||||
def __init__(self, account, jid='', node='', address_entry=False,
|
||||
parent=None, initial_identities=None):
|
||||
self.account = account
|
||||
self.parent = parent
|
||||
if not jid:
|
||||
|
@ -519,6 +519,9 @@ _('Without a connection, you can not browse available services'))
|
|||
self.cache = ServicesCache(account)
|
||||
gajim.connections[account].services_cache = self.cache
|
||||
|
||||
if initial_identities:
|
||||
self.cache.agent_info(account, (jid, node, initial_identities, [],
|
||||
None))
|
||||
self.xml = gtkgui_helpers.get_gtk_builder('service_discovery_window.ui')
|
||||
self.window = self.xml.get_object('service_discovery_window')
|
||||
self.services_treeview = self.xml.get_object('services_treeview')
|
||||
|
|
Loading…
Reference in New Issue