diff options
author | Marcos Pinto <markybob@dipconsultants.com> | 2007-11-24 03:51:11 +0000 |
---|---|---|
committer | Marcos Pinto <markybob@dipconsultants.com> | 2007-11-24 03:51:11 +0000 |
commit | dde291d6dd28faf2a31f27c47dce11cb993ce19f (patch) | |
tree | 6de686fd233c87b2e91d7f033b236e75fd1f0a23 | |
parent | adb7bcdf382fb52376bc0e8ca2d34fd31c3f1748 (diff) | |
download | deluge-dde291d6dd28faf2a31f27c47dce11cb993ce19f.tar.gz deluge-dde291d6dd28faf2a31f27c47dce11cb993ce19f.tar.bz2 deluge-dde291d6dd28faf2a31f27c47dce11cb993ce19f.zip |
add connection_speed setting
-rw-r--r-- | glade/preferences_dialog.glade | 31 | ||||
-rw-r--r-- | src/core.py | 1 | ||||
-rw-r--r-- | src/deluge_core.cpp | 11 | ||||
-rw-r--r-- | src/dialogs.py | 2 | ||||
-rw-r--r-- | src/pref.py | 2 |
5 files changed, 46 insertions, 1 deletions
diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade index 1bf4d665d..49f6eafd0 100644 --- a/glade/preferences_dialog.glade +++ b/glade/preferences_dialog.glade @@ -1175,9 +1175,38 @@ Either</property> <widget class="GtkTable" id="table1"> <property name="visible">True</property> <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> - <property name="n_rows">5</property> + <property name="n_rows">6</property> <property name="n_columns">2</property> <child> + <widget class="GtkSpinButton" id="spin_connection_speed"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="tooltip" translatable="yes">The maximum half-open connections. A high value may crash some cheap routers. Set -1 for unlimited.</property> + <property name="xalign">1</property> + <property name="adjustment">-1 -1 9000 1 10 10</property> + <property name="climb_rate">1</property> + </widget> + <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="x_options">GTK_FILL</property> + </packing> + </child> + <child> + <widget class="GtkLabel" id="label43"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">The maximum half-open connections. A high value may crash some cheap routers. Set -1 for unlimited.</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Maximum Connection Attempts per Second:</property> + </widget> + <packing> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> + </packing> + </child> + <child> <widget class="GtkSpinButton" id="spin_max_upload_slots_global"> <property name="visible">True</property> <property name="can_focus">True</property> diff --git a/src/core.py b/src/core.py index c74024e7b..49bfe8763 100644 --- a/src/core.py +++ b/src/core.py @@ -70,6 +70,7 @@ DHT_FILENAME = "dht.state" PREF_FUNCTIONS = { "listen_on" : deluge_core.set_listen_on, "max_half_open" : deluge_core.set_max_half_open, + "connection_speed" : deluge_core.connection_speed, "max_connections_global" : deluge_core.set_max_connections_global, "max_active_torrents" : None, # no need for a function, applied constantly "max_upload_slots_global" : deluge_core.set_max_upload_slots_global, diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index 6322697ec..829696e25 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -510,6 +510,16 @@ static PyObject *torrent_set_max_half_open(PyObject *self, PyObject *args) Py_INCREF(Py_None); return Py_None; } +static PyObject *torrent_connection_speed(PyObject *self, PyObject *args) +{ + python_long arg; + if (!PyArg_ParseTuple(args, "i", &arg)) + return NULL; + M_settings->connection_speed = arg; + M_ses->set_settings(*M_settings); + + Py_INCREF(Py_None); return Py_None; +} static PyObject *torrent_set_download_rate_limit(PyObject *self, PyObject *args) { @@ -2022,6 +2032,7 @@ static PyMethodDef deluge_core_methods[] = {"quit", torrent_quit, METH_VARARGS, "."}, {"save_fastresume", torrent_save_fastresume, METH_VARARGS, "."}, {"set_max_half_open", torrent_set_max_half_open, METH_VARARGS, "."}, + {"connection_speed", torrent_connection_speed, METH_VARARGS, "."}, {"set_download_rate_limit", torrent_set_download_rate_limit, METH_VARARGS, "."}, {"set_upload_rate_limit", torrent_set_upload_rate_limit, METH_VARARGS, "."}, {"set_per_upload_rate_limit", torrent_set_per_upload_rate_limit, METH_VARARGS, "."}, diff --git a/src/dialogs.py b/src/dialogs.py index 840b90b10..68cd90fdd 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -144,6 +144,7 @@ class PreferencesDlg: self.glade.get_widget("spin_dht_proxy_port").set_value(self.preferences.get("dht_proxy_port")) self.glade.get_widget("spin_web_proxy_port").set_value(self.preferences.get("web_proxy_port")) self.glade.get_widget("spin_max_half_open").set_value(float(self.preferences.get("max_half_open"))) + self.glade.get_widget("spin_connection_speed").set_value(float(self.preferences.get("connection_speed"))) self.glade.get_widget("spin_torrents").set_value(float(self.preferences.get("max_active_torrents"))) self.glade.get_widget("chk_seedbottom").set_active(self.preferences.get("queue_seeds_to_bottom")) self.glade.get_widget("chk_queue_above_completed").set_sensitive(self.preferences.get("queue_seeds_to_bottom")) @@ -269,6 +270,7 @@ class PreferencesDlg: self.preferences.set("max_connections_global", int(self.glade.get_widget("spin_max_connections_global").get_value())) self.preferences.set("max_connections_per_torrent", int(self.glade.get_widget("spin_max_connections_per_torrent").get_value())) self.preferences.set("max_half_open", int(self.glade.get_widget("spin_max_half_open").get_value())) + self.preferences.set("connection_speed", int(self.glade.get_widget("spin_connection_speed").get_value())) self.preferences.set("max_active_torrents", int(self.glade.get_widget("spin_torrents").get_value())) self.preferences.set("queue_seeds_to_bottom", self.glade.get_widget("chk_seedbottom").get_active()) self.preferences.set("enable_dht", self.glade.get_widget("chk_dht").get_active()) diff --git a/src/pref.py b/src/pref.py index 50f03bc6b..2432b8efd 100644 --- a/src/pref.py +++ b/src/pref.py @@ -70,6 +70,7 @@ if common.windows_check(): "listen_on" : [6881,6889], "lock_tray" : False, "max_half_open" : 8, + "connection_speed" : -1, "max_active_torrents" : 8, "max_active_torrents_tmp" : 8, "max_connections_global" : 200, @@ -183,6 +184,7 @@ else: "listen_on" : [6881,6889], "lock_tray" : False, "max_half_open" : 20, + "connection_speed" : -1, "max_active_torrents" : 8, "max_active_torrents_tmp" : 8, "max_connections_global" : 200, |