pref_int_set_default ( PREF_KEY_MAIN_WINDOW_Y, 50 );
pref_string_set_default ( PREF_KEY_PROXY_SERVER, "" );
- pref_int_set_default ( PREF_KEY_PROXY_TYPE, TR_PROXY_HTTP );
- pref_flag_set_default ( PREF_KEY_PROXY_SERVER_ENABLED, FALSE );
- pref_flag_set_default ( PREF_KEY_PROXY_AUTH_ENABLED, FALSE );
+ pref_int_set_default ( PREF_KEY_PROXY_PORT, TR_DEFAULT_PROXY_PORT );
+ pref_int_set_default ( PREF_KEY_PROXY_TYPE, TR_DEFAULT_PROXY_TYPE );
+ pref_flag_set_default ( PREF_KEY_PROXY_SERVER_ENABLED, TR_DEFAULT_PROXY_ENABLED );
+ pref_flag_set_default ( PREF_KEY_PROXY_AUTH_ENABLED, TR_DEFAULT_PROXY_AUTH_ENABLED );
pref_string_set_default ( PREF_KEY_PROXY_USERNAME, "" );
pref_string_set_default ( PREF_KEY_PROXY_PASSWORD, "" );
}
static GtkWidget*
-networkPage( GObject * core )
+trackerPage( GObject * core )
{
int row = 0;
const char * s;
GtkWidget * t;
- GtkWidget * w, * w2;
+ GtkWidget * w;
GtkTreeModel * m;
GtkCellRenderer * r;
struct ProxyPage * page = tr_new0( struct ProxyPage, 1 );
page->core = TR_CORE( core );
t = hig_workarea_create( );
- hig_workarea_add_section_title (t, &row, _( "Router" ) );
-
- s = _("Use UPnP or NAT-PMP port _forwarding from my router" );
- w = new_check_button( s, PREF_KEY_PORT_FORWARDING, core );
- hig_workarea_add_wide_control( t, &row, w );
-
- hig_workarea_add_section_divider( t, &row );
- hig_workarea_add_section_title (t, &row, _("Bandwidth"));
-
- s = _("Limit _download speed (KB/s):");
- w = new_check_button( s, PREF_KEY_DL_LIMIT_ENABLED, core );
- w2 = new_spin_button( PREF_KEY_DL_LIMIT, core, 0, INT_MAX, 5 );
- gtk_widget_set_sensitive( GTK_WIDGET(w2), pref_flag_get( PREF_KEY_DL_LIMIT_ENABLED ) );
- g_signal_connect( w, "toggled", G_CALLBACK(target_cb), w2 );
- hig_workarea_add_row_w( t, &row, w, w2, NULL );
-
- s = _("Limit _upload speed (KB/s):");
- w = new_check_button( s, PREF_KEY_UL_LIMIT_ENABLED, core );
- w2 = new_spin_button( PREF_KEY_UL_LIMIT, core, 0, INT_MAX, 5 );
- gtk_widget_set_sensitive( GTK_WIDGET(w2), pref_flag_get( PREF_KEY_UL_LIMIT_ENABLED ) );
- g_signal_connect( w, "toggled", G_CALLBACK(target_cb), w2 );
- hig_workarea_add_row_w( t, &row, w, w2, NULL );
-
- hig_workarea_add_section_divider( t, &row );
hig_workarea_add_section_title (t, &row, _( "Tracker Proxy" ) );
s = _( "Connect to tracker with HTTP proxy" );
w = hig_workarea_add_row( t, &row, s, w, NULL );
page->proxy_widgets = g_slist_append( page->proxy_widgets, w );
+ w = new_spin_button( PREF_KEY_PROXY_PORT, core, 0, 65536, 1 );
+ page->proxy_widgets = g_slist_append( page->proxy_widgets, w );
+ w = hig_workarea_add_row( t, &row, _( "Proxy port:" ), w, NULL );
+ page->proxy_widgets = g_slist_append( page->proxy_widgets, w );
+
s = _( "Proxy type:" );
m = proxyTypeModelNew( );
w = gtk_combo_box_new_with_model( m );
return t;
}
+static GtkWidget*
+networkPage( GObject * core )
+{
+ int row = 0;
+ const char * s;
+ GtkWidget * t;
+ GtkWidget * w, * w2;
+
+ t = hig_workarea_create( );
+ hig_workarea_add_section_title (t, &row, _( "Router" ) );
+
+ s = _("Use UPnP or NAT-PMP port _forwarding from my router" );
+ w = new_check_button( s, PREF_KEY_PORT_FORWARDING, core );
+ hig_workarea_add_wide_control( t, &row, w );
+
+ hig_workarea_add_section_divider( t, &row );
+ hig_workarea_add_section_title (t, &row, _("Bandwidth"));
+
+ s = _("Limit _download speed (KB/s):");
+ w = new_check_button( s, PREF_KEY_DL_LIMIT_ENABLED, core );
+ w2 = new_spin_button( PREF_KEY_DL_LIMIT, core, 0, INT_MAX, 5 );
+ gtk_widget_set_sensitive( GTK_WIDGET(w2), pref_flag_get( PREF_KEY_DL_LIMIT_ENABLED ) );
+ g_signal_connect( w, "toggled", G_CALLBACK(target_cb), w2 );
+ hig_workarea_add_row_w( t, &row, w, w2, NULL );
+
+ s = _("Limit _upload speed (KB/s):");
+ w = new_check_button( s, PREF_KEY_UL_LIMIT_ENABLED, core );
+ w2 = new_spin_button( PREF_KEY_UL_LIMIT, core, 0, INT_MAX, 5 );
+ gtk_widget_set_sensitive( GTK_WIDGET(w2), pref_flag_get( PREF_KEY_UL_LIMIT_ENABLED ) );
+ g_signal_connect( w, "toggled", G_CALLBACK(target_cb), w2 );
+ hig_workarea_add_row_w( t, &row, w, w2, NULL );
+
+ hig_workarea_finish( t, &row );
+ return t;
+}
+
GtkWidget *
tr_prefs_dialog_new( GObject * core, GtkWindow * parent )
{
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
peerPage( core, alive ),
gtk_label_new (_("Peers")) );
+ gtk_notebook_append_page( GTK_NOTEBOOK( n ),
+ trackerPage( core ),
+ gtk_label_new (_("Trackers")) );
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
networkPage( core ),
gtk_label_new (_("Network")) );
const char * downloadDir,
int isPexEnabled,
int isPortForwardingEnabled,
- int publicPort,
+ int publicPort,
int encryptionMode,
int isUploadLimitEnabled,
int uploadLimit,
const char * rpcPassword,
int proxyIsEnabled,
const char * proxy,
+ int proxyPort,
tr_proxy_type proxyType,
int proxyAuthIsEnabled,
const char * proxyUsername,
h->downloadDir = tr_strdup( downloadDir );
h->isProxyEnabled = proxyIsEnabled ? 1 : 0;
h->proxy = tr_strdup( proxy );
+ h->proxyPort = proxyPort;
h->proxyType = proxyType;
h->isProxyAuthEnabled = proxyAuthIsEnabled ? 1 : 0;
h->proxyUsername = tr_strdup( proxyUsername );
"potzrebie",
TR_DEFAULT_PROXY_ENABLED,
TR_DEFAULT_PROXY,
+ TR_DEFAULT_PROXY_PORT,
TR_DEFAULT_PROXY_TYPE,
TR_DEFAULT_PROXY_AUTH_ENABLED,
TR_DEFAULT_PROXY_USERNAME,
{
return session->proxy;
}
+int
+tr_sessionGetProxyPort( const tr_session * session )
+{
+ return session->proxyPort;
+}
void
tr_sessionSetProxy( tr_session * session, const char * proxy )
{
session->proxy = tr_strdup( proxy );
}
}
+void
+tr_sessionSetProxyPort( tr_session * session, int port )
+{
+ session->proxyPort = port;
+}
int
tr_sessionIsProxyAuthEnabled( const tr_session * session )
{
/** @see tr_sessionInitFull */
#define TR_DEFAULT_PROXY NULL
/** @see tr_sessionInitFull */
+#define TR_DEFAULT_PROXY_PORT 80
+/** @see tr_sessionInitFull */
#define TR_DEFAULT_PROXY_TYPE TR_PROXY_HTTP
/** @see tr_sessionInitFull */
#define TR_DEFAULT_PROXY_AUTH_ENABLED 0
const char * rpcPassword,
int proxyIsEnabled,
const char * proxy,
+ int proxyPort,
tr_proxy_type proxyType,
int proxyAuthIsEnabled,
const char * proxyUsername,
int tr_sessionIsProxyEnabled ( const tr_session * );
int tr_sessionIsProxyAuthEnabled ( const tr_session * );
const char* tr_sessionGetProxy ( const tr_session * );
+int tr_sessionGetProxyPort ( const tr_session * );
tr_proxy_type tr_sessionGetProxyType ( const tr_session * );
const char* tr_sessionGetProxyPassword ( const tr_session * );
void tr_sessionSetProxyEnabled ( tr_session *, int isEnabled );
void tr_sessionSetProxyAuthEnabled ( tr_session *, int isEnabled );
void tr_sessionSetProxy ( tr_session *, const char * proxy );
+void tr_sessionSetProxyPort ( tr_session *, int port );
void tr_sessionSetProxyType ( tr_session *, tr_proxy_type );
void tr_sessionSetProxyUsername ( tr_session *, const char * username );
void tr_sessionSetProxyPassword ( tr_session *, const char * password );