From e9ded6f25f658ac65ee9f2f228798c4c96d63e5f Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Sun, 15 Jul 2007 23:48:12 +0000 Subject: [PATCH] set private flag when adding torrents with the file selection thingy - not yet connected --- glade/files_dialog.glade | 173 +++++++++++++++++++-------------------- src/core.py | 4 + src/deluge_core.cpp | 20 +++++ 3 files changed, 106 insertions(+), 91 deletions(-) diff --git a/glade/files_dialog.glade b/glade/files_dialog.glade index 9869cac6d..0db86a64b 100644 --- a/glade/files_dialog.glade +++ b/glade/files_dialog.glade @@ -1,93 +1,84 @@ - - - + + + - - - 5 - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Deluge File Selection - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER_ON_PARENT - False - 550 - 550 - True - True - True - True - True - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 1 - - - - True - GTK_BUTTONBOX_END - - - - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - 0 - - - - - - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - 1 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - - - - - 2 - True - True - - - - - - + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + Deluge File Selection + GTK_WIN_POS_CENTER_ON_PARENT + 550 + 550 + True + GDK_WINDOW_TYPE_HINT_DIALOG + True + True + False + + + True + 1 + + + True + True + + + True + True + + + + + 2 + 1 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Set the private flag + 0 + True + + + False + False + 2 + + + + + True + GTK_BUTTONBOX_END + + + True + gtk-cancel + True + 0 + + + + + True + gtk-ok + True + 1 + + + 1 + + + + + False + GTK_PACK_END + + + + + diff --git a/src/core.py b/src/core.py index e727061bd..29cd70215 100644 --- a/src/core.py +++ b/src/core.py @@ -867,3 +867,7 @@ class Manager: def set_flp(self, unique_ID, num): return deluge_core.set_flp(unique_ID, int(num)) + + def set_priv(self, unique_ID, on_off): + print unique_ID, on_off + return deluge_core.set_flp(unique_ID, on_off) diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index 9a7e9e350..a6fcbe7ae 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -1470,6 +1470,25 @@ static PyObject *torrent_prioritize_files(PyObject *self, PyObject *args) return Py_None; } +static PyObject *torrent_set_priv(PyObject *self, PyObject *args) +{ + using namespace libtorrent; + python_long unique_ID; + bool onoff; + + if (!PyArg_ParseTuple(args, "ib", &unique_ID, &onoff)) + return NULL; + long index = get_index_from_unique_ID(unique_ID); + if (PyErr_Occurred()) + return NULL; + + torrent_t &t = M_torrents->at(index); + torrent_info info = t.handle.get_torrent_info(); + + info.set_priv(onoff); + + return Py_None; +} //==================== // Python Module data @@ -1519,6 +1538,7 @@ static PyMethodDef deluge_core_methods[] = {"replace_trackers", torrent_replace_trackers, METH_VARARGS, "."}, {"set_flp", torrent_set_flp, METH_VARARGS, "."}, {"prioritize_files", torrent_prioritize_files, METH_VARARGS, "."}, + {"set_priv", torrent_set_priv, METH_VARARGS, "."}, {NULL} };