ManageProxies GUI update

This commit is contained in:
Daniel Brötzmann 2018-10-31 17:42:37 +01:00
parent ea2f76f24e
commit d106c0d316
3 changed files with 388 additions and 371 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<requires lib="gtk+" version="3.20"/>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name item -->
@ -20,385 +20,92 @@
</data>
</object>
<object class="GtkWindow" id="manage_proxies_window">
<property name="width_request">500</property>
<property name="height_request">440</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="border_width">18</property>
<property name="title" translatable="yes">Manage Proxy Profiles</property>
<property name="resizable">False</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">500</property>
<property name="default_height">440</property>
<property name="type_hint">dialog</property>
<signal name="destroy" handler="on_manage_proxies_window_destroy" swapped="no"/>
<child>
<object class="GtkBox" id="vbox87">
<placeholder/>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox" id="hbox2966">
<object class="GtkBox">
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="vbox89">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">6</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow38">
<object class="GtkTreeView" id="proxies_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="proxies_treeview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<signal name="cursor-changed" handler="on_proxies_treeview_cursor_changed" swapped="no"/>
<signal name="key-press-event" handler="on_proxies_treeview_key_press_event" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</object>
<property name="headers_visible">False</property>
<signal name="cursor-changed" handler="on_proxies_treeview_cursor_changed" swapped="no"/>
<signal name="key-press-event" handler="on_proxies_treeview_key_press_event" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="hbuttonbox21">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="layout_style">center</property>
<child>
<object class="GtkButton" id="add_proxy_button">
<property name="label">gtk-add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_add_proxy_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="remove_proxy_button">
<property name="label">gtk-remove</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_remove_proxy_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="vbox90">
<object class="GtkToolbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="toolbar_style">icons</property>
<property name="show_arrow">False</property>
<property name="icon_size">1</property>
<child>
<object class="GtkFrame" id="frame34">
<object class="GtkToolButton" id="add_proxy_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="border_width">6</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="label320">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">_Name:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label321">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Type:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="proxyname_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_proxyname_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="proxytype_combobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">liststore1</property>
<signal name="changed" handler="on_proxytype_combobox_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label319">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Properties&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
<property name="tooltip_text" translatable="yes">Add Proxy</property>
<property name="use_underline">True</property>
<property name="icon_name">list-add-symbolic</property>
<signal name="clicked" handler="on_add_proxy_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame23">
<object class="GtkToolButton" id="remove_proxy_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkGrid" id="proxy_table">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="border_width">6</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="boshuri_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_BOSH URL:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="boshuri_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_boshuri_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label135">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Proxy _Host:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="boshuseproxy_checkbutton">
<property name="label" translatable="yes">Use HTTP prox_y</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="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_boshuseproxy_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label136">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Proxy _Port:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="useauth_checkbutton">
<property name="label" translatable="yes">Use proxy auth_entication</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="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_useauth_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label253">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Username:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label254">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Pass_word:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="proxyhost_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_proxyhost_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="proxyport_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_proxyport_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="proxyuser_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_proxyuser_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="proxypass_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
<signal name="changed" handler="on_proxypass_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label216">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;b&gt;Settings&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
<property name="tooltip_text" translatable="yes">Remove Proxy</property>
<property name="use_underline">True</property>
<property name="icon_name">list-remove-symbolic</property>
<signal name="clicked" handler="on_remove_proxy_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="homogeneous">True</property>
</packing>
</child>
<style>
<class name="inline-toolbar"/>
</style>
</object>
<packing>
<property name="expand">False</property>
@ -414,28 +121,313 @@
</packing>
</child>
<child>
<object class="GtkButtonBox" id="hbuttonbox22">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_right">6</property>
<property name="spacing">12</property>
<property name="layout_style">end</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="close_button">
<property name="label">gtk-close</property>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_close_button_clicked" swapped="no"/>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Properties</property>
<property name="use_markup">True</property>
<style>
<class name="bold"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</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="label" translatable="yes">_Name</property>
<property name="use_underline">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</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="label" translatable="yes">_Type</property>
<property name="use_underline">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="proxyname_entry">
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_proxyname_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="proxytype_combobox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">6</property>
<property name="model">liststore1</property>
<signal name="changed" handler="on_proxytype_combobox_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="proxy_table">
<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="boshuri_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">_BOSH URL</property>
<property name="use_underline">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="boshuri_entry">
<property name="width_request">200</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_boshuri_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="boshuseproxy_checkbutton">
<property name="label" translatable="yes">Use HTTP prox_y</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_boshuseproxy_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</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="label" translatable="yes">Proxy _Host</property>
<property name="use_underline">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="proxyhost_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_proxyhost_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</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="label" translatable="yes">Proxy _Port</property>
<property name="use_underline">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="proxyport_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_proxyport_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</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="label" translatable="yes">_Username</property>
<property name="use_underline">True</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="GtkCheckButton" id="useauth_checkbutton">
<property name="label" translatable="yes">Use proxy auth_entication</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_useauth_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="proxyuser_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_proxyuser_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</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="label" translatable="yes">Pass_word</property>
<property name="use_underline">True</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="proxypass_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="visibility">False</property>
<signal name="changed" handler="on_proxypass_entry_changed" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">7</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="label" translatable="yes">Settings</property>
<property name="use_markup">True</property>
<style>
<class name="bold"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</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">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>

View File

@ -492,14 +492,14 @@ class Preferences(Gtk.ApplicationWindow):
return val
def on_checkbutton_toggled(self, widget, config_name,
change_sensitivity_widgets=None):
change_sensitivity_widgets=None):
app.config.set(config_name, widget.get_active())
if change_sensitivity_widgets:
for w in change_sensitivity_widgets:
w.set_sensitive(widget.get_active())
def on_per_account_checkbutton_toggled(self, widget, config_name,
change_sensitivity_widgets=None):
change_sensitivity_widgets=None):
for account in app.connections:
app.config.set_per('accounts', account, config_name,
widget.get_active())
@ -1014,6 +1014,8 @@ class Preferences(Gtk.ApplicationWindow):
# Proxies
def on_proxies_combobox_changed(self, widget):
active = widget.get_active()
if active == -1:
return
proxy = widget.get_model()[active][0]
if proxy == _('None'):
proxy = ''
@ -1037,6 +1039,8 @@ class Preferences(Gtk.ApplicationWindow):
model.append([proxy])
if our_proxy == proxy:
self._ui.proxies_combobox.set_active(index)
if not our_proxy in proxies:
self._ui.proxies_combobox.set_active(0)
# Log status changes of contacts
def on_log_show_changes_checkbutton_toggled(self, widget):

View File

@ -24,26 +24,32 @@ from gajim.gtk.util import get_builder
class ManageProxies:
def __init__(self, transient_for=None):
self._ui = get_builder('manage_proxies_window.ui')
self.window = self._ui.manage_proxies_window
self.window.set_transient_for(transient_for)
self._ui.manage_proxies_window.set_transient_for(transient_for)
self.init_list()
self.block_signal = False
self._ui.connect_signals(self)
self.window.show_all()
self._ui.manage_proxies_window.connect('destroy', self._on_destroy)
self._ui.manage_proxies_window.show_all()
# hide the BOSH fields by default
self.show_bosh_fields()
self._ui.boshuri_entry.hide()
self._ui.boshuri_label.hide()
self._ui.boshuseproxy_checkbutton.hide()
def show_bosh_fields(self, show=True):
if show:
self._ui.boshuri_entry.show()
self._ui.boshuri_label.show()
self._ui.boshuseproxy_checkbutton.show()
act = self._ui.boshuseproxy_checkbutton.get_active()
self._ui.proxyhost_entry.set_sensitive(act)
self._ui.proxyport_entry.set_sensitive(act)
else:
cb = self._ui.boshuseproxy_checkbutton
cb.hide()
cb.set_active(True)
self.on_boshuseproxy_checkbutton_toggled(cb)
self._ui.boshuseproxy_checkbutton.hide()
self._ui.boshuseproxy_checkbutton.set_active(True)
self.on_boshuseproxy_checkbutton_toggled(
self._ui.boshuseproxy_checkbutton)
self._ui.boshuri_entry.hide()
self._ui.boshuri_label.hide()
@ -102,9 +108,6 @@ class ManageProxies:
self.on_proxies_treeview_cursor_changed(self._ui.proxies_treeview)
self.block_signal = False
def on_close_button_clicked(self, _widget):
self.window.destroy()
def on_useauth_checkbutton_toggled(self, widget):
if self.block_signal:
return
@ -152,6 +155,7 @@ class ManageProxies:
if proxy == _('None'): # special proxy None
self.show_bosh_fields(False)
self._ui.proxyname_entry.set_editable(False)
self._ui.proxyname_entry.set_sensitive(False)
self._ui.remove_proxy_button.set_sensitive(False)
self._ui.proxytype_combobox.set_sensitive(False)
self._ui.proxy_table.set_sensitive(False)
@ -161,9 +165,20 @@ class ManageProxies:
self.show_bosh_fields(proxytype == 'bosh')
self._ui.proxyname_entry.set_editable(True)
self._ui.proxyname_entry.set_sensitive(True)
self._ui.remove_proxy_button.set_sensitive(True)
self._ui.proxytype_combobox.set_sensitive(True)
self._ui.proxy_table.set_sensitive(True)
self._ui.boshuri_entry.set_text(
app.config.get_per('proxies', proxy, 'bosh_uri'))
self._ui.boshuseproxy_checkbutton.set_active(
app.config.get_per('proxies', proxy, 'bosh_useproxy'))
if proxytype == 'bosh':
act = self._ui.boshuseproxy_checkbutton.get_active()
self._ui.proxyhost_entry.set_sensitive(act)
self._ui.proxyport_entry.set_sensitive(act)
self._ui.proxyhost_entry.set_text(
app.config.get_per('proxies', proxy, 'host'))
self._ui.proxyport_entry.set_text(
@ -172,14 +187,15 @@ class ManageProxies:
app.config.get_per('proxies', proxy, 'user'))
self._ui.proxypass_entry.set_text(
app.config.get_per('proxies', proxy, 'pass'))
self._ui.boshuri_entry.set_text(
app.config.get_per('proxies', proxy, 'bosh_uri'))
types = ['http', 'socks5', 'bosh']
self._ui.proxytype_combobox.set_active(types.index(proxytype))
self._ui.boshuseproxy_checkbutton.set_active(
app.config.get_per('proxies', proxy, 'bosh_useproxy'))
self._ui.useauth_checkbutton.set_active(
app.config.get_per('proxies', proxy, 'useauth'))
act = self._ui.useauth_checkbutton.get_active()
self._ui.proxyuser_entry.set_sensitive(act)
self._ui.proxypass_entry.set_sensitive(act)
self.block_signal = False
def on_proxies_treeview_key_press_event(self, widget, event):
@ -217,6 +233,13 @@ class ManageProxies:
proxy = self._ui.proxyname_entry.get_text()
app.config.set_per('proxies', proxy, 'type', types[type_])
def on_boshuri_entry_changed(self, widget):
if self.block_signal:
return
value = widget.get_text()
proxy = self._ui.proxyname_entry.get_text()
app.config.set_per('proxies', proxy, 'bosh_uri', value)
def on_proxyhost_entry_changed(self, widget):
if self.block_signal:
return
@ -238,16 +261,14 @@ class ManageProxies:
proxy = self._ui.proxyname_entry.get_text()
app.config.set_per('proxies', proxy, 'user', value)
def on_boshuri_entry_changed(self, widget):
if self.block_signal:
return
value = widget.get_text()
proxy = self._ui.proxyname_entry.get_text()
app.config.set_per('proxies', proxy, 'bosh_uri', value)
def on_proxypass_entry_changed(self, widget):
if self.block_signal:
return
value = widget.get_text()
proxy = self._ui.proxyname_entry.get_text()
app.config.set_per('proxies', proxy, 'pass', value)
def _on_destroy(self, *args):
window = app.get_app_window('Preferences')
if window is not None:
window.update_proxy_list()