fix opening join groupchat dialog. Fixes #7861

This commit is contained in:
Yann Leboulanger 2014-11-09 17:32:20 +01:00
parent eb6fa81854
commit 9ff5c310bd
2 changed files with 108 additions and 135 deletions

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<requires lib="gtk+" version="3.10"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -19,32 +20,85 @@
<signal name="destroy" handler="on_join_groupchat_window_destroy" swapped="no"/>
<signal name="key-press-event" handler="on_join_groupchat_window_key_press_event" swapped="no"/>
<child>
<object class="GtkVBox" id="vbox28">
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkTable" id="table15">
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</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>
<property name="column_spacing">12</property>
<child>
<object class="GtkEntry" id="room_jid_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="activates_default">True</property>
<signal name="changed" handler="on_required_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="account_label">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Account</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="account_combobox">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<signal name="changed" handler="on_account_combobox_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label225">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Recently:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="recently_combobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="changed" handler="on_recently_combobox_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label142">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Nickname:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
@ -56,10 +110,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -70,53 +121,20 @@
<property name="label" translatable="yes">Room:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="label142">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Nickname:</property>
<property name="label" translatable="yes">Server:</property>
</object>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="label225">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Recently:</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkComboBox" id="recently_combobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="changed" handler="on_recently_combobox_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
@ -127,10 +145,8 @@
<property name="label" translatable="yes">Password:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -142,54 +158,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"/>
</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="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="account_label">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Account</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkComboBox" id="account_combobox">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<signal name="changed" handler="on_account_combobox_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
@ -204,32 +173,49 @@
<signal name="toggled" handler="on_bookmark_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="right_attach">2</property>
<property name="left_attach">0</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 name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<object class="GtkCheckButton" id="auto_join_checkbutton">
<property name="label" translatable="yes">Join this room _automatically when I connect</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Server:</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<placeholder/>
<object class="GtkComboBoxText" id="server_comboboxtext">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxtext-entry">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="browse_rooms_button">
@ -242,7 +228,7 @@
<signal name="clicked" handler="on_browse_rooms_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
@ -251,10 +237,7 @@
</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>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
</object>
@ -265,7 +248,7 @@
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="hbuttonbox12">
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
@ -308,7 +291,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>

View File

@ -2428,6 +2428,7 @@ class JoinGroupchatWindow:
self._room_jid_entry = self.xml.get_object('room_jid_entry')
self._nickname_entry = self.xml.get_object('nickname_entry')
self._password_entry = self.xml.get_object('password_entry')
self.server_comboboxtext = self.xml.get_object('server_comboboxtext')
self._nickname_entry.set_text(nick)
if password:
@ -2443,16 +2444,6 @@ class JoinGroupchatWindow:
title = _('Join Group Chat')
self.window.set_title(title)
self.server_model = Gtk.ListStore(str)
self.server_comboboxentry = Gtk.ComboBox.new_with_model_and_entry(
self.server_model)
self.server_comboboxentry.set_entry_text_column(0)
hbox1 = self.xml.get_object('hbox1')
hbox1.pack_start(self.server_comboboxentry, False, False, 0)
entry = self.server_comboboxentry.child
entry.connect('changed', self.on_server_entry_changed)
self.browse_button = self.xml.get_object('browse_rooms_button')
self.browse_button.set_sensitive(False)
@ -2482,7 +2473,7 @@ class JoinGroupchatWindow:
server_list.append(server)
for s in server_list:
self.server_model.append([s])
self.server_comboboxtext.append_text(s)
self._set_room_jid(room_jid)
@ -2544,8 +2535,8 @@ class JoinGroupchatWindow:
room_jid, server = text.split('@', 1)
self._room_jid_entry.set_text(room_jid)
if server:
self.server_comboboxentry.get_child().set_text(server)
self.server_comboboxentry.grab_focus()
self.server_comboboxtext.get_child().set_text(server)
self.server_comboboxtext.grab_focus()
def on_account_combobox_changed(self, widget):
model = widget.get_model()
@ -2557,8 +2548,8 @@ class JoinGroupchatWindow:
room_jid, nick = gajim.get_room_and_nick_from_fjid(full_jid)
room, server = gajim.get_name_and_server_from_jid(room_jid)
self._room_jid_entry.set_text(room)
model = self.server_comboboxentry.get_model()
self.server_comboboxentry.get_child().set_text(server)
model = self.server_comboboxtext.get_model()
self.server_comboboxtext.get_child().set_text(server)
if nick:
self._nickname_entry.set_text(nick)
@ -2569,7 +2560,7 @@ class JoinGroupchatWindow:
self._set_room_jid(full_jid)
def on_browse_rooms_button_clicked(self, widget):
server = self.server_comboboxentry.get_child().get_text()
server = self.server_comboboxtext.get_child().get_text()
self.requested_jid = server
gajim.connections[self.account].discoverInfo(server)
@ -2636,7 +2627,7 @@ class JoinGroupchatWindow:
'groupchat.'))
return
nickname = self._nickname_entry.get_text()
server = self.server_comboboxentry.get_child().get_text()
server = self.server_comboboxtext.get_child().get_text()
room = self._room_jid_entry.get_text().strip()
room_jid = room + '@' + server
password = self._password_entry.get_text()