fix join gc dialog

This commit is contained in:
Denis Fomin 2013-01-02 13:32:17 +04:00
parent f67f063769
commit e55985b498
5 changed files with 43 additions and 31 deletions

View File

@ -33,7 +33,7 @@
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -48,7 +48,7 @@
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -61,7 +61,7 @@
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -74,7 +74,7 @@
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -87,7 +87,7 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -114,7 +114,7 @@
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -129,7 +129,7 @@
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -147,7 +147,7 @@
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -158,7 +158,7 @@
</object>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -188,7 +188,7 @@
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_options"/>
</packing>
</child>
<child>
@ -207,10 +207,9 @@
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkComboBoxEntry" id="server_comboboxentry">
<object class="GtkComboBox" 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>

View File

@ -570,7 +570,7 @@ class SingleForm(Gtk.Table, object):
pixbuf_l = GdkPixbuf.PixbufLoader()
pixbuf_l.write(img_data)
pixbuf_l.close()
media = Gtk.image_new_from_pixbuf(pixbuf_l.\
media = Gtk.Image.new_from_pixbuf(pixbuf_l.\
get_pixbuf())
except Exception:
media = Gtk.Label(label=_('Unable to load image'))

View File

@ -1643,7 +1643,7 @@ class YesNoDialog(HigDialog):
label = Gtk.Label(label=text_label)
self.vbox.pack_start(label, False, True, 0)
buff = Gtk.TextBuffer()
self.textview = Gtk.TextView(buff)
self.textview = Gtk.TextView.new_with_buffer(buff)
frame = Gtk.Frame()
frame.set_shadow_type(Gtk.ShadowType.IN)
frame.add(self.textview)
@ -2341,7 +2341,7 @@ class JoinGroupchatWindow:
liststore = Gtk.ListStore(str)
account_combobox.set_model(liststore)
cell = Gtk.CellRendererText()
account_combobox.pack_start(cell, True, True, 0)
account_combobox.pack_start(cell, True)
account_combobox.add_attribute(cell, 'text', 0)
account_combobox.set_active(-1)
@ -2350,7 +2350,7 @@ class JoinGroupchatWindow:
gajim.account_is_connected(a)]:
if gajim.connections[acct].is_zeroconf:
continue
account_combobox.append_text(acct)
liststore.append([acct])
if account and account == acct:
account_combobox.set_active(liststore.iter_n_children(None)-1)
@ -2379,7 +2379,13 @@ class JoinGroupchatWindow:
self.window.set_title(title)
self.server_comboboxentry = self.xml.get_object('server_comboboxentry')
self.server_model = self.server_comboboxentry.get_model()
liststore = Gtk.ListStore(str)
self.server_comboboxentry.set_model(liststore)
cell = Gtk.CellRendererText()
self.server_comboboxentry.pack_start(cell, True)
self.server_comboboxentry.add_attribute(cell, 'text', 0)
self.server_comboboxentry.set_active(-1)
self.server_model = liststore#self.server_comboboxentry.get_model()
server_list = []
# get the muc server of our server
if 'jabber' in gajim.connections[account].muc_jid:
@ -2389,11 +2395,11 @@ class JoinGroupchatWindow:
liststore = Gtk.ListStore(str)
self.recently_combobox.set_model(liststore)
cell = Gtk.CellRendererText()
self.recently_combobox.pack_start(cell, True, True, 0)
self.recently_combobox.pack_start(cell, True)
self.recently_combobox.add_attribute(cell, 'text', 0)
self.recently_groupchat = gajim.config.get('recently_groupchat').split()
for g in self.recently_groupchat:
self.recently_combobox.append_text(g)
liststore.append([g])
server = gajim.get_server_from_jid(g)
if server not in server_list and not server.startswith('irc'):
server_list.append(server)
@ -2463,7 +2469,9 @@ class JoinGroupchatWindow:
def _set_room_jid(self, room_jid):
room, server = gajim.get_name_and_server_from_jid(room_jid)
self._room_jid_entry.set_text(room)
self.server_comboboxentry.get_child().set_text(server)
model = self.server_comboboxentry.get_model()
model.append([server])
#self.server_comboboxentry.set_active(0)
def on_recently_combobox_changed(self, widget):
model = widget.get_model()
@ -2509,8 +2517,9 @@ class JoinGroupchatWindow:
'groupchat.'))
return
nickname = self._nickname_entry.get_text().decode('utf-8')
server = self.server_comboboxentry.get_child().get_text().decode('utf-8').\
strip()
row = self.server_comboboxentry.get_child().get_displayed_row()
model = self.server_comboboxentry.get_model()
server = model[row][0].decode('utf-8').strip()
room = self._room_jid_entry.get_text().decode('utf-8').strip()
room_jid = room + '@' + server
password = self._password_entry.get_text().decode('utf-8')

View File

@ -470,7 +470,7 @@ class GroupchatControl(ChatControlBase):
# workaround to avoid gtk arrows to be shown
column = Gtk.TreeViewColumn() # 2nd COLUMN
renderer = Gtk.CellRendererPixbuf()
column.pack_start(renderer, False, True, 0)
column.pack_start(renderer, False)
self.list_treeview.append_column(column)
column.set_visible(False)
self.list_treeview.set_expander_column(column)
@ -508,7 +508,7 @@ class GroupchatControl(ChatControlBase):
def fill_column(self, col):
for rend in self.renderers_list:
col.pack_start(rend[1], rend[2], True, 0)
col.pack_start(rend[1], rend[2])
col.add_attribute(rend[1], rend[3], rend[4])
col.set_cell_data_func(rend[1], rend[5], rend[6])
# set renderers propertys
@ -594,8 +594,9 @@ class GroupchatControl(ChatControlBase):
"""
The MUC treeview has resized. Move the hpaned in all tabs to match
"""
if gparamspec.name != 'position':
return
# print pane, dir(pane)
#if gparamspec.name != 'position':
#return
if self.resize_from_another_muc:
# Don't send the event to other MUC
return
@ -1430,7 +1431,7 @@ class GroupchatControl(ChatControlBase):
gc_contact.affiliation != 'none' and gajim.config.get(
'show_affiliation_in_groupchat'):
pixbuf1 = image.get_pixbuf().copy()
pixbuf2 = GdkPixbuf.Pixbuf(GdkPixbuf.Colorspace.RGB, True, 8, 4, 4)
pixbuf2 = GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, 4, 4)
if gc_contact.affiliation == 'owner':
pixbuf2.fill(0xff0000ff) # Red
elif gc_contact.affiliation == 'admin':
@ -1440,7 +1441,7 @@ class GroupchatControl(ChatControlBase):
pixbuf2.composite(pixbuf1, 12, 12, pixbuf2.get_property('width'),
pixbuf2.get_property('height'), 0, 0, 1.0, 1.0,
GdkPixbuf.InterpType.HYPER, 127)
image = Gtk.image_new_from_pixbuf(pixbuf1)
image = Gtk.Image.new_from_pixbuf(pixbuf1)
self.model[iter_][C_IMG] = image
self.model[iter_][C_TEXT] = name
@ -1453,7 +1454,7 @@ class GroupchatControl(ChatControlBase):
fake_jid = self.room_jid + '/' + nick
pixbuf = gtkgui_helpers.get_avatar_pixbuf_from_cache(fake_jid)
if pixbuf in ('ask', None):
scaled_pixbuf = None
scaled_pixbuf = ''
else:
scaled_pixbuf = gtkgui_helpers.get_scaled_pixbuf(pixbuf, 'roster')
self.model[iter_][C_AVATAR] = scaled_pixbuf

View File

@ -1489,7 +1489,10 @@ class RosterWindow:
# do not change selection while DND'ing
return
# Expand his parent, so this path is visible, don't expand it.
self.tree.expand_to_path(path[:-1])
path_ = str(path.get_indices()[:-1])[1:-1]
path_ = path_.replace(', ', ':')
path = path.new_from_string(path_)
self.tree.expand_to_path(path)
self.tree.scroll_to_cell(path)
self.tree.set_cursor(path)
@ -2395,7 +2398,7 @@ class RosterWindow:
if isinstance(w, dict):
self.close_all_from_dict(w)
else:
w.window().destroy()
w.window.destroy()
def close_all(self, account, force=False):
"""