Rework JoinGroupchat Dialog
This commit is contained in:
parent
15bcd80e19
commit
4fa4484dfd
|
@ -389,6 +389,19 @@ def get_connected_accounts():
|
|||
account_list.append(account)
|
||||
return account_list
|
||||
|
||||
def get_enabled_accounts_with_labels(exclude_local=True):
|
||||
"""
|
||||
Returns a list with [account, account_label] entries.
|
||||
Order by account_label
|
||||
"""
|
||||
accounts = []
|
||||
for acc in connections:
|
||||
if not exclude_local or acc != 'Local':
|
||||
acc_label = config.get_per('accounts', acc, 'account_label')
|
||||
accounts.append([acc, acc_label])
|
||||
accounts.sort(key=lambda xs: str.lower(xs[1]))
|
||||
return accounts
|
||||
|
||||
def account_is_connected(account):
|
||||
if account not in connections:
|
||||
return False
|
||||
|
|
|
@ -1,102 +1,189 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.20.1 -->
|
||||
<!-- Generated with glade 3.22.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<object class="GtkListStore" id="account_liststore">
|
||||
<columns>
|
||||
<!-- column-name id -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name label -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkListStore" id="recently_liststorex">
|
||||
<columns>
|
||||
<!-- column-name server -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name room -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name nickname -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name label -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkPopoverMenu" id="recently_popover">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="margin_left">6</property>
|
||||
<property name="margin_right">6</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="margin_bottom">6</property>
|
||||
<property name="max_content_width">300</property>
|
||||
<property name="max_content_height">300</property>
|
||||
<property name="propagate_natural_width">True</property>
|
||||
<property name="propagate_natural_height">True</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="recently_treeview">
|
||||
<property name="name">recently_treeview</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">recently_liststorex</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="enable_search">False</property>
|
||||
<property name="hover_selection">True</property>
|
||||
<property name="show_expanders">False</property>
|
||||
<property name="activate_on_single_click">True</property>
|
||||
<signal name="row-activated" handler="_on_recent_selected" swapped="no"/>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="title" translatable="yes">column</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">3</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="popover_treeview"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="submenu">main</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkBox" id="main_box">
|
||||
<property name="width_request">400</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">18</property>
|
||||
<property name="margin_right">18</property>
|
||||
<property name="margin_top">18</property>
|
||||
<property name="margin_bottom">18</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">18</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="jid_label">
|
||||
<object class="GtkSwitch" id="autojoin_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Join group chat every time Gajim is started</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">9</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Autojoin</property>
|
||||
<property name="justify">right</property>
|
||||
<style>
|
||||
<class name="bold16"/>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">9</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="account_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="yes">Account</property>
|
||||
<property name="justify">right</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="bookmark_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Bookmark this Groupchat</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="notify::active" handler="_on_bookmark_activate" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="autojoin_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Join this Groupchat every time Gajim is started</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="active">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<object class="GtkLabel" id="room_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin_top">6</property>
|
||||
<property name="label" translatable="yes">Bookmark</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="yes">Room</property>
|
||||
<property name="justify">right</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<object class="GtkLabel" id="server_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Autojoin</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="yes">Server</property>
|
||||
<property name="justify">right</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">8</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="account_combo">
|
||||
<object class="GtkLabel" id="password_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="valign">center</property>
|
||||
<signal name="changed" handler="_on_account_combo_changed" swapped="no"/>
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="yes">Password</property>
|
||||
<property name="justify">right</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">2</property>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -104,19 +191,100 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="activates_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="width">2</property>
|
||||
<property name="top_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="account_label">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="label" translatable="yes">Nickname</property>
|
||||
<property name="justify">right</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="height_request">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="height_request">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="bookmark_switch">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Bookmark group chat</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Account</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="active">True</property>
|
||||
<signal name="notify::active" handler="_on_bookmark_activate" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">8</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Bookmark</property>
|
||||
<property name="justify">right</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">8</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="height_request">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
|
@ -124,47 +292,142 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<object class="GtkComboBox" id="account_combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Nickname</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<property name="model">account_liststore</property>
|
||||
<property name="id_column">0</property>
|
||||
<signal name="changed" handler="_on_account_combo_changed" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkLabel" id="password_label">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Password</property>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">1</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="password_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="activates_default">True</property>
|
||||
<property name="input_purpose">password</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="width">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="room_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="activates_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="recently_button">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Recently used channels</property>
|
||||
<property name="popover">recently_popover</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">document-open-recent-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="search_button">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Search the rooms on this server</property>
|
||||
<signal name="clicked" handler="_on_search_clicked" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">system-search-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="server_combo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="has_entry">True</property>
|
||||
<child internal-child="entry">
|
||||
<object class="GtkEntry">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="caps_lock_warning">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButtonBox" id="button_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="margin_top">18</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="spacing">12</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
|
@ -201,140 +464,9 @@
|
|||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">9</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="server_label">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Server</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="room_label">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Room</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="recent_label">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Recently</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="room_entry">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="no_show_all">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="recent_combo">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<signal name="changed" handler="_on_recent_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="server_combo">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="has_entry">True</property>
|
||||
<child internal-child="entry">
|
||||
<object class="GtkEntry">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="caps_lock_warning">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="search_button">
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="no_show_all">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Search the rooms on this server</property>
|
||||
<signal name="clicked" handler="_on_search_clicked" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">system-search-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkHeaderBar" id="headerbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Join Groupchat</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="_on_cancel_clicked" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_Join</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<signal name="clicked" handler="_on_join_clicked" swapped="no"/>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -90,6 +90,11 @@ popover#EmoticonPopover flowboxchild { padding-top: 5px; padding-bottom: 5px; }
|
|||
#StartChatListBox > row { padding: 10px 20px 10px 10px; }
|
||||
#StartChatListBox > row:not(.activatable) label { color: @insensitive_fg_color }
|
||||
|
||||
/* Popover Treeview */
|
||||
.popover_treeview { border-radius: 3px; background-color: @theme_bg_color; }
|
||||
.popover_treeview { padding: 6px; }
|
||||
.popover_treeview :hover { background-color: @theme_selected_bg_color; }
|
||||
|
||||
/* Text style */
|
||||
|
||||
.bold16 { font-size: 16px; font-weight: bold; }
|
||||
|
|
149
gajim/dialogs.py
149
gajim/dialogs.py
|
@ -2300,7 +2300,7 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
|
|||
self.set_show_menubar(False)
|
||||
self.set_resizable(False)
|
||||
self.set_position(Gtk.WindowPosition.CENTER)
|
||||
self.set_title(_('Join Groupchat'))
|
||||
self.set_title(_('Join Group Chat'))
|
||||
if transient_for:
|
||||
self.set_transient_for(transient_for)
|
||||
|
||||
|
@ -2309,93 +2309,86 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
|
|||
self.requested_jid = None
|
||||
self.room_jid = room_jid
|
||||
self.account = account
|
||||
self.minimal_mode = 0 # 2: very mini, 1: with room, 0: show all
|
||||
if room_jid is not None:
|
||||
if '@' in room_jid:
|
||||
self.minimal_mode = 2
|
||||
|
||||
if self.room_jid is None:
|
||||
self.minimal_mode = False
|
||||
else:
|
||||
self.minimal_mode = 1
|
||||
self.minimal_mode = True
|
||||
|
||||
glade_objects = ['grid', 'nick_entry', 'account_combo', 'jid_label',
|
||||
'bookmark_switch', 'autojoin_switch', 'headerbar',
|
||||
'account_label', 'password_entry', 'password_label',
|
||||
'join_button', 'button_box', 'server_label',
|
||||
'server_combo', 'recent_label', 'recent_combo',
|
||||
'room_label', 'room_entry', 'search_button']
|
||||
glade_objects = ['main_box', 'account_label', 'account_combo',
|
||||
'server_label', 'server_combo', 'room_entry',
|
||||
'recently_button', 'recently_popover',
|
||||
'recently_treeview', 'search_button', 'password_label',
|
||||
'password_entry', 'nick_entry', 'bookmark_switch',
|
||||
'autojoin_switch']
|
||||
|
||||
minimal_widgets = ['jid_label']
|
||||
room_widgets = ['room_label', 'room_entry']
|
||||
|
||||
extended_widgets = ['server_label', 'server_combo', 'recent_label',
|
||||
'recent_combo', 'room_label', 'room_entry',
|
||||
'search_button']
|
||||
self.builder = gtkgui_helpers.get_gtk_builder(
|
||||
'join_groupchat_window.ui')
|
||||
for obj in glade_objects:
|
||||
setattr(self, obj, self.builder.get_object(obj))
|
||||
|
||||
self.add(self.grid)
|
||||
|
||||
if os.environ.get('GTK_CSD', '1') == '1':
|
||||
self.set_titlebar(self.headerbar)
|
||||
else:
|
||||
self.button_box.show()
|
||||
self.add(self.main_box)
|
||||
|
||||
# Show widgets depending on the mode the window is in
|
||||
if self.minimal_mode > 0:
|
||||
for widget in minimal_widgets:
|
||||
getattr(self, widget).show()
|
||||
if self.minimal_mode == 1:
|
||||
for widget in room_widgets:
|
||||
getattr(self, widget).show()
|
||||
self.jid_label.set_text(room_jid)
|
||||
else:
|
||||
for widget in extended_widgets:
|
||||
getattr(self, widget).show()
|
||||
if not self.minimal_mode:
|
||||
self.recently_button.show()
|
||||
self.search_button.show()
|
||||
|
||||
if account is None:
|
||||
connected_accounts = app.get_connected_accounts()
|
||||
account = connected_accounts[0]
|
||||
for acc in connected_accounts:
|
||||
self.account_combo.append_text(acc)
|
||||
else:
|
||||
connected_accounts = [account]
|
||||
self.account_combo.append_text(account)
|
||||
accounts = app.get_enabled_accounts_with_labels()
|
||||
account_liststore = self.account_combo.get_model()
|
||||
for acc in accounts:
|
||||
account_liststore.append(acc)
|
||||
|
||||
if not accounts:
|
||||
return
|
||||
|
||||
if not self.account:
|
||||
self.account = accounts[0][0]
|
||||
|
||||
self.builder.connect_signals(self)
|
||||
self.connect('key-press-event', self._on_key_press_event)
|
||||
self.connect('destroy', self._on_destroy)
|
||||
|
||||
if self.minimal_mode == 0:
|
||||
if not self.minimal_mode:
|
||||
app.ged.register_event_handler('agent-info-received', ged.GUI1,
|
||||
self._nec_agent_info_received)
|
||||
app.ged.register_event_handler('agent-info-error-received', ged.GUI1,
|
||||
self._nec_agent_info_error_received)
|
||||
|
||||
# Show account combobox if there is more than one account
|
||||
if len(connected_accounts) > 1:
|
||||
if len(accounts) > 1:
|
||||
self.account_combo.show()
|
||||
self.account_label.show()
|
||||
|
||||
# Select first account
|
||||
self.account_combo.set_active(0)
|
||||
self.account_combo.set_active_id(self.account)
|
||||
|
||||
if self.minimal_mode:
|
||||
if '@' in self.room_jid:
|
||||
(room, server) = self.room_jid.split('@')
|
||||
self.room_entry.set_text(room)
|
||||
if not muc_caps_cache.supports(
|
||||
self.room_jid, 'muc_passwordprotected'):
|
||||
self.password_entry.hide()
|
||||
self.password_label.hide()
|
||||
self.nick_entry.grab_focus()
|
||||
else:
|
||||
self.password_entry.grab_focus()
|
||||
else:
|
||||
server = self.room_jid
|
||||
self.room_entry.grab_focus()
|
||||
|
||||
self.server_combo.insert_text(0, server)
|
||||
self.server_combo.set_active(0)
|
||||
|
||||
if self.password is not None:
|
||||
self.password_entry.set_text(self.password)
|
||||
|
||||
# Set bookmark switch sensitive if server supports bookmarks
|
||||
acc = self.account_combo.get_active_text()
|
||||
acc = self.account_combo.get_active_id()
|
||||
if not app.connections[acc].private_storage_supported:
|
||||
self.bookmark_switch.set_sensitive(False)
|
||||
self.autojoin_switch.set_sensitive(False)
|
||||
|
||||
# Show password field if we are in extended mode or
|
||||
# The MUC is passwordprotected
|
||||
if self.minimal_mode == 0 or muc_caps_cache.supports(
|
||||
room_jid, 'muc_passwordprotected'):
|
||||
self.password_entry.show()
|
||||
self.password_label.show()
|
||||
|
||||
self.show_all()
|
||||
|
||||
def set_room(self, room_jid):
|
||||
|
@ -2404,16 +2397,18 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
|
|||
self.server_combo.get_child().set_text(server)
|
||||
|
||||
def _fill_recent_and_servers(self, account):
|
||||
self.recent_combo.remove_all()
|
||||
recently_liststore = self.recently_treeview.get_model()
|
||||
recently_liststore.clear()
|
||||
self.server_combo.remove_all()
|
||||
recent = app.get_recent_groupchats(account)
|
||||
servers = []
|
||||
for groupchat in recent:
|
||||
text = '%s on %s@%s' % (groupchat.nickname,
|
||||
groupchat.room,
|
||||
groupchat.server)
|
||||
label = '%s@%s' % (groupchat.room, groupchat.server)
|
||||
|
||||
self.recent_combo.append_text(text)
|
||||
recently_liststore.append([groupchat.server,
|
||||
groupchat.room,
|
||||
groupchat.nickname,
|
||||
label])
|
||||
servers.append(groupchat.server)
|
||||
|
||||
for server in set(servers):
|
||||
|
@ -2424,24 +2419,18 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
|
|||
if muc_domain is not None:
|
||||
self.server_combo.insert_text(0, muc_domain)
|
||||
|
||||
def _on_recent_changed(self, combo):
|
||||
text = combo.get_active_text()
|
||||
if text is None:
|
||||
self.server_combo.set_active(0)
|
||||
return
|
||||
nickname, _, room_jid = text.split()
|
||||
room, server = app.get_name_and_server_from_jid(room_jid)
|
||||
self.room_entry.set_text(room)
|
||||
self.nick_entry.set_text(nickname)
|
||||
self.server_combo.get_child().set_text(server)
|
||||
def _on_recent_selected(self, treeview, *args):
|
||||
(model, iter_) = treeview.get_selection().get_selected()
|
||||
self.server_combo.get_child().set_text(model[iter_][0])
|
||||
self.room_entry.set_text(model[iter_][1])
|
||||
self.nick_entry.set_text(model[iter_][2])
|
||||
self.recently_popover.popdown()
|
||||
|
||||
def _on_account_combo_changed(self, combo):
|
||||
account = combo.get_active_text()
|
||||
account = combo.get_active_id()
|
||||
self.account = account
|
||||
self.nick_entry.set_text(app.nicks[account])
|
||||
if self.minimal_mode == 0:
|
||||
self._fill_recent_and_servers(account)
|
||||
self.recent_combo.set_active(0)
|
||||
|
||||
def _on_key_press_event(self, widget, event):
|
||||
if event.keyval == Gdk.KEY_Escape:
|
||||
|
@ -2451,7 +2440,7 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
|
|||
return True
|
||||
|
||||
def _on_join_clicked(self, *args):
|
||||
account = self.account_combo.get_active_text()
|
||||
account = self.account_combo.get_active_id()
|
||||
nickname = self.nick_entry.get_text()
|
||||
|
||||
invisible_show = app.SHOW_LIST.index('invisible')
|
||||
|
@ -2459,18 +2448,15 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
|
|||
app.interface.raise_dialog('join-while-invisible')
|
||||
return
|
||||
|
||||
if self.minimal_mode < 2:
|
||||
if self.minimal_mode == 0:
|
||||
server = self.server_combo.get_active_text()
|
||||
else: # mode 1
|
||||
server = self.room_jid
|
||||
room = self.room_entry.get_text()
|
||||
|
||||
if room == '':
|
||||
ErrorDialog(_('Invalid Room'),
|
||||
_('Please choose a room'), transient_for=self)
|
||||
return
|
||||
self.room_jid = '%s@%s' % (room, server)
|
||||
|
||||
self.room_jid = '%s@%s' % (room, server)
|
||||
self.room_jid = self.room_jid.lower()
|
||||
|
||||
if app.in_groupchat(account, self.room_jid):
|
||||
|
@ -2518,7 +2504,10 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
|
|||
self.destroy()
|
||||
|
||||
def _on_bookmark_activate(self, switch, param):
|
||||
self.autojoin_switch.set_sensitive(switch.get_active())
|
||||
bookmark_state = switch.get_active()
|
||||
self.autojoin_switch.set_sensitive(bookmark_state)
|
||||
if not bookmark_state:
|
||||
self.autojoin_switch.set_active(False)
|
||||
|
||||
def _add_bookmark(self, account, nickname, password):
|
||||
con = app.connections[account]
|
||||
|
@ -2537,7 +2526,7 @@ class JoinGroupchatWindow(Gtk.ApplicationWindow):
|
|||
name, self.room_jid, autojoin, 1, password, nickname)
|
||||
|
||||
def _on_destroy(self, *args):
|
||||
if self.minimal_mode == 0:
|
||||
if not self.minimal_mode:
|
||||
app.ged.remove_event_handler('agent-info-received', ged.GUI1,
|
||||
self._nec_agent_info_received)
|
||||
app.ged.remove_event_handler('agent-info-error-received', ged.GUI1,
|
||||
|
|
Loading…
Reference in New Issue