2007-09-27 20:57:58 +00:00
|
|
|
/*
|
2008-01-01 17:20:20 +00:00
|
|
|
* This file Copyright (C) 2007-2008 Charles Kerr <charles@rebelbase.com>
|
2007-02-19 22:09:05 +00:00
|
|
|
*
|
2007-09-27 20:57:58 +00:00
|
|
|
* This file is licensed by the GPL version 2. Works owned by the
|
|
|
|
* Transmission project are granted a special exemption to clause 2(b)
|
|
|
|
* so that the bulk of its code can remain under the MIT license.
|
|
|
|
* This exemption does not extend to derived works not owned by
|
|
|
|
* the Transmission project.
|
|
|
|
*
|
2007-09-28 00:46:22 +00:00
|
|
|
* $Id$
|
2007-09-27 20:57:58 +00:00
|
|
|
*/
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2008-06-04 19:46:37 +00:00
|
|
|
#include <ctype.h> /* isspace */
|
2008-06-03 20:59:57 +00:00
|
|
|
#include <errno.h>
|
2008-06-04 19:46:37 +00:00
|
|
|
#include <stdarg.h>
|
2008-03-18 01:22:11 +00:00
|
|
|
#include <stdlib.h> /* free() */
|
2008-03-30 00:21:46 +00:00
|
|
|
#include <unistd.h>
|
2007-02-19 22:09:05 +00:00
|
|
|
#include <glib/gi18n.h>
|
2007-09-27 20:57:58 +00:00
|
|
|
#include <gtk/gtk.h>
|
2007-07-18 23:04:26 +00:00
|
|
|
#include <libtransmission/transmission.h>
|
2008-03-30 03:20:18 +00:00
|
|
|
#include <libtransmission/utils.h>
|
2008-05-09 03:20:34 +00:00
|
|
|
#include <libtransmission/version.h>
|
2008-04-25 18:35:48 +00:00
|
|
|
#include <libtransmission/web.h>
|
2007-02-19 22:09:05 +00:00
|
|
|
#include "conf.h"
|
2007-09-27 20:57:58 +00:00
|
|
|
#include "hig.h"
|
2008-02-26 19:58:03 +00:00
|
|
|
#include "tr-core.h"
|
|
|
|
#include "tr-prefs.h"
|
2007-02-19 22:09:05 +00:00
|
|
|
#include "util.h"
|
|
|
|
|
2007-09-27 20:57:58 +00:00
|
|
|
/**
|
|
|
|
* This is where we initialize the preferences file with the default values.
|
|
|
|
* If you add a new preferences key, you /must/ add a default value here.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
tr_prefs_init_global( void )
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
2008-06-02 21:02:38 +00:00
|
|
|
int i;
|
2008-06-05 16:23:03 +00:00
|
|
|
char pw[32];
|
2008-03-07 16:30:44 +00:00
|
|
|
const char * str;
|
2008-06-05 16:23:03 +00:00
|
|
|
const char * pool = "abcdefghijklmnopqrstuvwxyz"
|
|
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
|
|
"1234567890";
|
2008-03-07 16:30:44 +00:00
|
|
|
|
2007-12-01 01:41:10 +00:00
|
|
|
cf_check_older_configs( );
|
|
|
|
|
2008-03-09 15:27:08 +00:00
|
|
|
#if HAVE_GIO
|
|
|
|
str = NULL;
|
|
|
|
if( !str ) str = g_get_user_special_dir( G_USER_DIRECTORY_DESKTOP );
|
|
|
|
if( !str ) str = g_get_home_dir( );
|
|
|
|
pref_string_set_default ( PREF_KEY_DIR_WATCH, str );
|
|
|
|
pref_flag_set_default ( PREF_KEY_DIR_WATCH_ENABLED, FALSE );
|
|
|
|
#endif
|
|
|
|
|
2008-04-12 00:29:49 +00:00
|
|
|
pref_int_set_default ( PREF_KEY_PEER_SOCKET_TOS, TR_DEFAULT_PEER_SOCKET_TOS );
|
2008-05-24 23:23:20 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_ALLOW_HIBERNATION, TRUE );
|
2008-05-18 16:44:30 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_BLOCKLIST_ENABLED, TR_DEFAULT_BLOCKLIST_ENABLED );
|
2008-03-30 00:21:46 +00:00
|
|
|
|
2008-03-18 20:41:27 +00:00
|
|
|
pref_string_set_default ( PREF_KEY_OPEN_DIALOG_FOLDER, g_get_home_dir( ) );
|
|
|
|
|
2008-04-12 00:29:49 +00:00
|
|
|
pref_int_set_default ( PREF_KEY_MAX_PEERS_GLOBAL, TR_DEFAULT_GLOBAL_PEER_LIMIT );
|
2008-01-20 00:40:41 +00:00
|
|
|
pref_int_set_default ( PREF_KEY_MAX_PEERS_PER_TORRENT, 50 );
|
2007-12-22 00:06:38 +00:00
|
|
|
|
2007-12-20 02:56:47 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_TOOLBAR, TRUE );
|
2008-03-19 19:30:03 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_FILTERBAR, TRUE );
|
|
|
|
pref_flag_set_default ( PREF_KEY_STATUSBAR, TRUE );
|
2008-06-10 04:23:11 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_SHOW_TRAY_ICON, FALSE );
|
2008-03-19 19:30:03 +00:00
|
|
|
pref_string_set_default ( PREF_KEY_STATUSBAR_STATS, "total-ratio" );
|
2007-12-20 02:56:47 +00:00
|
|
|
|
2007-09-27 20:57:58 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_DL_LIMIT_ENABLED, FALSE );
|
|
|
|
pref_int_set_default ( PREF_KEY_DL_LIMIT, 100 );
|
|
|
|
pref_flag_set_default ( PREF_KEY_UL_LIMIT_ENABLED, FALSE );
|
|
|
|
pref_int_set_default ( PREF_KEY_UL_LIMIT, 50 );
|
2008-02-13 03:00:21 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_OPTIONS_PROMPT, TRUE );
|
2008-03-07 16:30:44 +00:00
|
|
|
|
2008-04-21 20:58:39 +00:00
|
|
|
pref_int_set_default ( PREF_KEY_MAIN_WINDOW_HEIGHT, 500 );
|
|
|
|
pref_int_set_default ( PREF_KEY_MAIN_WINDOW_WIDTH, 300 );
|
|
|
|
pref_int_set_default ( PREF_KEY_MAIN_WINDOW_X, 50 );
|
|
|
|
pref_int_set_default ( PREF_KEY_MAIN_WINDOW_Y, 50 );
|
|
|
|
|
2008-06-06 20:03:19 +00:00
|
|
|
pref_string_set_default ( PREF_KEY_PROXY_SERVER, "" );
|
2008-06-11 20:45:53 +00:00
|
|
|
pref_int_set_default ( PREF_KEY_PROXY_TYPE, TR_PROXY_HTTP );
|
2008-06-06 20:03:19 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_PROXY_SERVER_ENABLED, FALSE );
|
|
|
|
pref_flag_set_default ( PREF_KEY_PROXY_AUTH_ENABLED, FALSE );
|
|
|
|
pref_string_set_default ( PREF_KEY_PROXY_USERNAME, "" );
|
|
|
|
pref_string_set_default ( PREF_KEY_PROXY_PASSWORD, "" );
|
|
|
|
|
2008-03-07 16:30:44 +00:00
|
|
|
str = NULL;
|
2008-02-19 19:22:15 +00:00
|
|
|
#if GLIB_CHECK_VERSION(2,14,0)
|
2008-03-09 15:27:08 +00:00
|
|
|
if( !str ) str = g_get_user_special_dir( G_USER_DIRECTORY_DOWNLOAD );
|
2008-02-19 19:22:15 +00:00
|
|
|
#endif
|
2008-03-09 15:27:08 +00:00
|
|
|
if( !str ) str = g_get_home_dir( );
|
2008-05-18 16:44:30 +00:00
|
|
|
pref_string_set_default ( PREF_KEY_DOWNLOAD_DIR, str );
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2007-09-27 20:57:58 +00:00
|
|
|
pref_int_set_default ( PREF_KEY_PORT, TR_DEFAULT_PORT );
|
2007-05-24 13:55:57 +00:00
|
|
|
|
2007-09-27 20:57:58 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_NAT, TRUE );
|
2008-04-12 00:29:49 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_PEX, TR_DEFAULT_PEX_ENABLED );
|
2007-09-27 20:57:58 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_ASKQUIT, TRUE );
|
2007-09-28 00:46:22 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_ENCRYPTED_ONLY, FALSE );
|
2007-05-24 13:55:57 +00:00
|
|
|
|
2007-09-27 20:57:58 +00:00
|
|
|
pref_int_set_default ( PREF_KEY_MSGLEVEL, TR_MSG_INF );
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2007-12-19 02:46:30 +00:00
|
|
|
pref_string_set_default ( PREF_KEY_SORT_MODE, "sort-by-name" );
|
|
|
|
pref_flag_set_default ( PREF_KEY_SORT_REVERSED, FALSE );
|
|
|
|
pref_flag_set_default ( PREF_KEY_MINIMAL_VIEW, FALSE );
|
2007-10-17 18:31:12 +00:00
|
|
|
|
2008-02-13 03:00:21 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_START, TRUE );
|
2008-03-09 15:27:08 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_TRASH_ORIGINAL, FALSE );
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2008-05-18 16:44:30 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_RPC_ENABLED, TR_DEFAULT_RPC_ENABLED );
|
|
|
|
pref_int_set_default ( PREF_KEY_RPC_PORT, TR_DEFAULT_RPC_PORT );
|
|
|
|
pref_string_set_default ( PREF_KEY_RPC_ACL, TR_DEFAULT_RPC_ACL );
|
|
|
|
|
2008-06-05 16:23:03 +00:00
|
|
|
for( i=0; i<16; ++i )
|
|
|
|
pw[i] = pool[ tr_rand( strlen( pool ) ) ];
|
|
|
|
pw[16] = '\0';
|
|
|
|
pref_string_set_default( PREF_KEY_RPC_USERNAME, "transmission" );
|
2008-06-02 21:02:38 +00:00
|
|
|
pref_string_set_default( PREF_KEY_RPC_PASSWORD, pw );
|
2008-06-06 20:03:19 +00:00
|
|
|
pref_flag_set_default ( PREF_KEY_RPC_AUTH_ENABLED, FALSE );
|
2008-06-02 21:02:38 +00:00
|
|
|
|
2008-02-13 03:00:21 +00:00
|
|
|
pref_save( NULL );
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
2007-09-27 20:57:58 +00:00
|
|
|
/**
|
|
|
|
***
|
|
|
|
**/
|
2007-02-19 22:09:05 +00:00
|
|
|
|
2008-02-14 17:18:00 +00:00
|
|
|
#define PREF_KEY "pref-key"
|
2007-02-19 22:09:05 +00:00
|
|
|
|
|
|
|
static void
|
2008-05-09 03:20:34 +00:00
|
|
|
response_cb( GtkDialog * dialog, int response, gpointer unused UNUSED )
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
#963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of #963: use branch numbers for help, such as 1.2x, instead of
#963 (gtk) for online help URLs, use branch names (1.2x) instead of specific version names (1.21) so that we don't have to add a URL for every release.
2008-05-22 17:39:20 +00:00
|
|
|
if( response == GTK_RESPONSE_HELP ) {
|
|
|
|
char * base = gtr_get_help_url( );
|
|
|
|
char * url = g_strdup_printf( "%s/html/preferences.html", base );
|
|
|
|
gtr_open_file( url );
|
|
|
|
g_free( url );
|
|
|
|
g_free( base );
|
|
|
|
}
|
2008-05-09 03:20:34 +00:00
|
|
|
|
|
|
|
if( response == GTK_RESPONSE_CLOSE )
|
|
|
|
gtk_widget_destroy( GTK_WIDGET(dialog) );
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-09-27 20:57:58 +00:00
|
|
|
toggled_cb( GtkToggleButton * w, gpointer core )
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
2008-02-14 17:18:00 +00:00
|
|
|
const char * key = g_object_get_data( G_OBJECT(w), PREF_KEY );
|
2007-09-27 20:57:58 +00:00
|
|
|
const gboolean flag = gtk_toggle_button_get_active( w );
|
|
|
|
tr_core_set_pref_bool( TR_CORE(core), key, flag );
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
2007-09-27 20:57:58 +00:00
|
|
|
static GtkWidget*
|
|
|
|
new_check_button( const char * mnemonic, const char * key, gpointer core )
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
2007-09-27 20:57:58 +00:00
|
|
|
GtkWidget * w = gtk_check_button_new_with_mnemonic( mnemonic );
|
2008-02-14 17:18:00 +00:00
|
|
|
g_object_set_data_full( G_OBJECT(w), PREF_KEY, g_strdup(key), g_free );
|
2007-09-27 20:57:58 +00:00
|
|
|
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(w), pref_flag_get(key) );
|
|
|
|
g_signal_connect( w, "toggled", G_CALLBACK(toggled_cb), core );
|
|
|
|
return w;
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-09-27 20:57:58 +00:00
|
|
|
spun_cb( GtkSpinButton * w, gpointer core )
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
2008-02-14 17:18:00 +00:00
|
|
|
const char * key = g_object_get_data( G_OBJECT(w), PREF_KEY );
|
2007-09-27 20:57:58 +00:00
|
|
|
const int value = gtk_spin_button_get_value_as_int( w );
|
|
|
|
tr_core_set_pref_int( TR_CORE(core), key, value );
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
2007-09-27 20:57:58 +00:00
|
|
|
static GtkWidget*
|
2007-12-26 10:39:10 +00:00
|
|
|
new_spin_button( const char * key, gpointer core, int low, int high, int step )
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
2007-12-26 10:39:10 +00:00
|
|
|
GtkWidget * w = gtk_spin_button_new_with_range( low, high, step );
|
2008-02-14 17:18:00 +00:00
|
|
|
g_object_set_data_full( G_OBJECT(w), PREF_KEY, g_strdup(key), g_free );
|
2007-09-27 20:57:58 +00:00
|
|
|
gtk_spin_button_set_digits( GTK_SPIN_BUTTON(w), 0 );
|
|
|
|
gtk_spin_button_set_value( GTK_SPIN_BUTTON(w), pref_int_get(key) );
|
|
|
|
g_signal_connect( w, "value-changed", G_CALLBACK(spun_cb), core );
|
|
|
|
return w;
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
2008-06-02 21:02:38 +00:00
|
|
|
static void
|
|
|
|
entry_changed_cb( GtkEntry * w, gpointer core )
|
|
|
|
{
|
|
|
|
const char * key = g_object_get_data( G_OBJECT( w ), PREF_KEY );
|
|
|
|
const char * value = gtk_entry_get_text( w );
|
|
|
|
tr_core_set_pref( TR_CORE( core ), key, value );
|
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget*
|
|
|
|
new_entry( const char * key, gpointer core )
|
|
|
|
{
|
|
|
|
GtkWidget * w = gtk_entry_new( );
|
|
|
|
char * value = pref_string_get( key );
|
2008-06-06 20:03:19 +00:00
|
|
|
if( value )
|
|
|
|
gtk_entry_set_text( GTK_ENTRY( w ), value );
|
2008-06-02 21:02:38 +00:00
|
|
|
g_object_set_data_full( G_OBJECT(w), PREF_KEY, g_strdup(key), g_free );
|
|
|
|
g_signal_connect( w, "changed", G_CALLBACK(entry_changed_cb), core );
|
|
|
|
g_free( value );
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
2007-02-19 22:09:05 +00:00
|
|
|
static void
|
2007-09-27 20:57:58 +00:00
|
|
|
chosen_cb( GtkFileChooser * w, gpointer core )
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
2008-02-14 17:18:00 +00:00
|
|
|
const char * key = g_object_get_data( G_OBJECT(w), PREF_KEY );
|
2007-09-27 20:57:58 +00:00
|
|
|
char * value = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(w) );
|
|
|
|
tr_core_set_pref( TR_CORE(core), key, value );
|
|
|
|
g_free( value );
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
2007-09-27 20:57:58 +00:00
|
|
|
static GtkWidget*
|
|
|
|
new_path_chooser_button( const char * key, gpointer core )
|
2007-02-19 22:09:05 +00:00
|
|
|
{
|
2007-09-28 00:46:22 +00:00
|
|
|
GtkWidget * w = gtk_file_chooser_button_new( NULL,
|
|
|
|
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER );
|
2007-09-27 20:57:58 +00:00
|
|
|
char * path = pref_string_get( key );
|
2008-02-14 17:18:00 +00:00
|
|
|
g_object_set_data_full( G_OBJECT(w), PREF_KEY, g_strdup(key), g_free );
|
2007-09-27 20:57:58 +00:00
|
|
|
g_signal_connect( w, "selection-changed", G_CALLBACK(chosen_cb), core );
|
|
|
|
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(w), path );
|
2008-03-18 01:06:06 +00:00
|
|
|
g_free( path );
|
2007-09-27 20:57:58 +00:00
|
|
|
return w;
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|
|
|
|
|
2007-12-13 20:46:19 +00:00
|
|
|
static void
|
2008-02-14 17:18:00 +00:00
|
|
|
target_cb( GtkWidget * tb, gpointer target )
|
2007-12-13 20:46:19 +00:00
|
|
|
{
|
2008-02-14 17:18:00 +00:00
|
|
|
const gboolean b = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( tb ) );
|
|
|
|
gtk_widget_set_sensitive( GTK_WIDGET(target), b );
|
2007-12-13 20:46:19 +00:00
|
|
|
}
|
|
|
|
|
2008-02-07 16:17:52 +00:00
|
|
|
struct test_port_data
|
|
|
|
{
|
|
|
|
GtkWidget * label;
|
|
|
|
gboolean * alive;
|
|
|
|
};
|
|
|
|
|
2008-04-25 18:35:48 +00:00
|
|
|
static void
|
|
|
|
testing_port_done( tr_handle * handle UNUSED,
|
|
|
|
long response_code UNUSED,
|
|
|
|
const void * response,
|
|
|
|
size_t response_len,
|
|
|
|
void * gdata )
|
2007-12-15 22:24:16 +00:00
|
|
|
{
|
2008-04-25 18:35:48 +00:00
|
|
|
struct test_port_data * data = gdata;
|
|
|
|
if( *data->alive )
|
|
|
|
{
|
|
|
|
const int isOpen = response_len && *(char*)response=='1';
|
|
|
|
gtk_label_set_markup( GTK_LABEL( data->label ), isOpen
|
|
|
|
? _("Port is <b>open</b>")
|
|
|
|
: _("Port is <b>closed</b>") );
|
|
|
|
}
|
|
|
|
}
|
2008-02-07 16:17:52 +00:00
|
|
|
|
2008-04-25 18:35:48 +00:00
|
|
|
static gboolean
|
|
|
|
testing_port_begin( gpointer gdata )
|
|
|
|
{
|
|
|
|
struct test_port_data * data = gdata;
|
2008-02-07 16:17:52 +00:00
|
|
|
if( *data->alive )
|
|
|
|
{
|
2008-04-25 18:35:48 +00:00
|
|
|
GtkSpinButton * spin = g_object_get_data( G_OBJECT( data->label ), "tr-port-spin" );
|
|
|
|
tr_handle * handle = g_object_get_data( G_OBJECT( data->label ), "handle" );
|
2008-02-07 16:17:52 +00:00
|
|
|
const int port = gtk_spin_button_get_value_as_int( spin );
|
|
|
|
char url[256];
|
|
|
|
snprintf( url, sizeof(url), "http://portcheck.transmissionbt.com/%d", port );
|
2008-06-07 21:26:41 +00:00
|
|
|
tr_webRun( handle, url, NULL, testing_port_done, data );
|
2008-02-07 16:17:52 +00:00
|
|
|
}
|
2008-04-25 18:35:48 +00:00
|
|
|
return FALSE;
|
2007-12-15 22:24:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
testing_port_cb( GtkWidget * unused UNUSED, gpointer l )
|
|
|
|
{
|
2008-04-25 20:05:24 +00:00
|
|
|
gtk_label_set_markup( GTK_LABEL( l ), _( "<i>Testing port...</i>" ) );
|
2008-04-25 18:35:48 +00:00
|
|
|
/* wait three seconds to give the port forwarding time to kick in */
|
2008-02-07 16:17:52 +00:00
|
|
|
struct test_port_data * data = g_new0( struct test_port_data, 1 );
|
|
|
|
data->label = l;
|
2008-04-25 18:35:48 +00:00
|
|
|
data->alive = g_object_get_data( G_OBJECT( l ), "alive" );
|
|
|
|
g_timeout_add( 3000, testing_port_begin, data );
|
2008-02-07 16:17:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dialogDestroyed( gpointer alive, GObject * dialog UNUSED )
|
|
|
|
{
|
|
|
|
*(gboolean*)alive = FALSE;
|
2007-12-15 22:24:16 +00:00
|
|
|
}
|
|
|
|
|
2008-02-13 03:00:21 +00:00
|
|
|
static GtkWidget*
|
|
|
|
torrentPage( GObject * core )
|
|
|
|
{
|
|
|
|
int row = 0;
|
|
|
|
const char * s;
|
|
|
|
GtkWidget * t;
|
|
|
|
GtkWidget * w;
|
2008-03-18 19:14:21 +00:00
|
|
|
#ifdef HAVE_GIO
|
2008-03-09 15:27:08 +00:00
|
|
|
GtkWidget * l;
|
2008-03-18 19:14:21 +00:00
|
|
|
#endif
|
2008-02-13 03:00:21 +00:00
|
|
|
|
2008-02-14 17:18:00 +00:00
|
|
|
t = hig_workarea_create( );
|
2008-04-03 02:11:15 +00:00
|
|
|
hig_workarea_add_section_title( t, &row, _( "Adding Torrents" ) );
|
2008-02-13 03:00:21 +00:00
|
|
|
|
2008-03-09 15:27:08 +00:00
|
|
|
#ifdef HAVE_GIO
|
|
|
|
s = _( "Automatically add torrents from:" );
|
|
|
|
l = new_check_button( s, PREF_KEY_DIR_WATCH_ENABLED, core );
|
|
|
|
w = new_path_chooser_button( PREF_KEY_DIR_WATCH, core );
|
|
|
|
gtk_widget_set_sensitive( GTK_WIDGET(w), pref_flag_get( PREF_KEY_DIR_WATCH_ENABLED ) );
|
|
|
|
g_signal_connect( l, "toggled", G_CALLBACK(target_cb), w );
|
|
|
|
hig_workarea_add_row_w( t, &row, l, w, NULL );
|
|
|
|
#endif
|
2008-02-13 03:00:21 +00:00
|
|
|
|
2008-03-18 19:14:21 +00:00
|
|
|
s = _( "Display _options dialog" );
|
2008-02-13 03:00:21 +00:00
|
|
|
w = new_check_button( s, PREF_KEY_OPTIONS_PROMPT, core );
|
|
|
|
hig_workarea_add_wide_control( t, &row, w );
|
|
|
|
|
2008-04-03 02:11:15 +00:00
|
|
|
s = _( "_Start when added" );
|
2008-02-13 03:00:21 +00:00
|
|
|
w = new_check_button( s, PREF_KEY_START, core );
|
|
|
|
hig_workarea_add_wide_control( t, &row, w );
|
|
|
|
|
2008-03-18 19:14:21 +00:00
|
|
|
s = _( "Mo_ve source files to Trash" );
|
2008-03-09 15:27:08 +00:00
|
|
|
w = new_check_button( s, PREF_KEY_TRASH_ORIGINAL, core );
|
|
|
|
hig_workarea_add_wide_control( t, &row, w );
|
|
|
|
|
2008-05-18 16:44:30 +00:00
|
|
|
w = new_path_chooser_button( PREF_KEY_DOWNLOAD_DIR, core );
|
2008-03-19 17:14:47 +00:00
|
|
|
hig_workarea_add_row( t, &row, _( "_Destination folder:" ), w, NULL );
|
2008-03-09 15:27:08 +00:00
|
|
|
|
2008-02-14 17:18:00 +00:00
|
|
|
hig_workarea_finish( t, &row );
|
2008-02-13 03:00:21 +00:00
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
2008-03-30 00:21:46 +00:00
|
|
|
/***
|
|
|
|
****
|
|
|
|
***/
|
|
|
|
|
|
|
|
struct blocklist_data
|
|
|
|
{
|
2008-04-01 16:57:48 +00:00
|
|
|
GtkWidget * check;
|
2008-03-30 00:21:46 +00:00
|
|
|
GtkWidget * dialog;
|
|
|
|
TrCore * core;
|
|
|
|
int abortFlag;
|
2008-04-01 16:57:48 +00:00
|
|
|
char secondary[256];
|
2008-03-30 00:21:46 +00:00
|
|
|
};
|
|
|
|
|
2008-04-01 16:57:48 +00:00
|
|
|
static void
|
|
|
|
updateBlocklistText( GtkWidget * w, TrCore * core )
|
|
|
|
{
|
|
|
|
const int n = tr_blocklistGetRuleCount( tr_core_handle( core ) );
|
|
|
|
char buf[512];
|
|
|
|
g_snprintf( buf, sizeof( buf ),
|
2008-04-01 18:33:34 +00:00
|
|
|
ngettext( "Ignore the %'d _blocklisted peer",
|
|
|
|
"Ignore the %'d _blocklisted peers", n ), n );
|
2008-04-01 16:57:48 +00:00
|
|
|
gtk_button_set_label( GTK_BUTTON( w ), buf );
|
|
|
|
}
|
2008-03-30 00:21:46 +00:00
|
|
|
static gboolean
|
2008-04-01 16:57:48 +00:00
|
|
|
updateBlocklistTextFromData( gpointer gdata )
|
2008-03-30 00:21:46 +00:00
|
|
|
{
|
2008-04-01 16:57:48 +00:00
|
|
|
struct blocklist_data * data = gdata;
|
|
|
|
updateBlocklistText( data->check, data->core );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
blocklistDialogSetSecondary( gpointer gdata )
|
|
|
|
{
|
|
|
|
struct blocklist_data * data = gdata;
|
2008-03-30 00:21:46 +00:00
|
|
|
GtkMessageDialog * md = GTK_MESSAGE_DIALOG( data->dialog );
|
|
|
|
gtk_message_dialog_format_secondary_text( md, data->secondary );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
blocklistDialogAllowClose( gpointer dialog )
|
|
|
|
{
|
|
|
|
GtkDialog * d = GTK_DIALOG( dialog );
|
|
|
|
gtk_dialog_set_response_sensitive( GTK_DIALOG( d ), GTK_RESPONSE_CANCEL, FALSE );
|
|
|
|
gtk_dialog_set_response_sensitive( GTK_DIALOG( d ), GTK_RESPONSE_CLOSE, TRUE );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-04-25 18:35:48 +00:00
|
|
|
static void
|
|
|
|
got_blocklist( tr_handle * handle UNUSED,
|
|
|
|
long response_code UNUSED,
|
|
|
|
const void * response,
|
|
|
|
size_t response_len,
|
|
|
|
void * gdata )
|
2008-03-30 00:21:46 +00:00
|
|
|
{
|
2008-04-25 18:35:48 +00:00
|
|
|
struct blocklist_data * data = gdata;
|
|
|
|
const char * text = response;
|
|
|
|
int size = response_len;
|
2008-03-30 00:21:46 +00:00
|
|
|
int rules = 0;
|
|
|
|
gchar * filename = NULL;
|
2008-03-30 03:20:18 +00:00
|
|
|
gchar * filename2 = NULL;
|
2008-03-30 00:21:46 +00:00
|
|
|
int fd = -1;
|
|
|
|
int ok = 1;
|
|
|
|
|
2008-04-25 18:35:48 +00:00
|
|
|
if( !data->abortFlag && ( !text || !size ) )
|
2008-03-30 00:21:46 +00:00
|
|
|
{
|
2008-04-25 18:35:48 +00:00
|
|
|
ok = FALSE;
|
2008-03-30 00:21:46 +00:00
|
|
|
g_snprintf( data->secondary, sizeof( data->secondary ),
|
2008-04-25 18:35:48 +00:00
|
|
|
_( "Unable to get blocklist." ) );
|
|
|
|
g_message( data->secondary );
|
2008-03-30 00:21:46 +00:00
|
|
|
g_idle_add( blocklistDialogSetSecondary, data );
|
2008-04-25 18:35:48 +00:00
|
|
|
}
|
2008-03-30 00:21:46 +00:00
|
|
|
|
|
|
|
if( ok && !data->abortFlag )
|
|
|
|
{
|
2008-03-30 03:03:42 +00:00
|
|
|
GError * err = NULL;
|
2008-03-30 03:20:18 +00:00
|
|
|
fd = g_file_open_tmp( "transmission-blockfile-XXXXXX", &filename, &err );
|
2008-03-30 00:21:46 +00:00
|
|
|
if( err ) {
|
|
|
|
g_snprintf( data->secondary, sizeof( data->secondary ),
|
|
|
|
_( "Unable to get blocklist: %s" ), err->message );
|
2008-03-30 03:03:42 +00:00
|
|
|
g_warning( data->secondary );
|
2008-03-30 00:21:46 +00:00
|
|
|
g_idle_add( blocklistDialogSetSecondary, data );
|
|
|
|
g_clear_error( &err );
|
2008-03-30 03:03:42 +00:00
|
|
|
ok = FALSE;
|
2008-03-30 00:21:46 +00:00
|
|
|
} else {
|
|
|
|
write( fd, text, size );
|
|
|
|
close( fd );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( ok && !data->abortFlag )
|
|
|
|
{
|
2008-03-30 03:20:18 +00:00
|
|
|
filename2 = g_strdup_printf( "%s.txt", filename );
|
2008-03-30 00:21:46 +00:00
|
|
|
g_snprintf( data->secondary, sizeof( data->secondary ),
|
|
|
|
_( "Uncompressing blocklist..." ) );
|
|
|
|
g_idle_add( blocklistDialogSetSecondary, data );
|
2008-03-30 03:20:18 +00:00
|
|
|
char * cmd = g_strdup_printf( "zcat %s > %s ", filename, filename2 );
|
|
|
|
tr_dbg( "%s", cmd );
|
2008-03-30 00:21:46 +00:00
|
|
|
system( cmd );
|
|
|
|
g_free( cmd );
|
|
|
|
}
|
|
|
|
if( ok && !data->abortFlag )
|
|
|
|
{
|
|
|
|
g_snprintf( data->secondary, sizeof( data->secondary ),
|
|
|
|
_( "Parsing blocklist..." ) );
|
|
|
|
g_idle_add( blocklistDialogSetSecondary, data );
|
2008-03-30 03:20:18 +00:00
|
|
|
rules = tr_blocklistSetContent( tr_core_handle( data->core ), filename2 );
|
2008-03-30 00:21:46 +00:00
|
|
|
}
|
|
|
|
if( ok && !data->abortFlag )
|
|
|
|
{
|
|
|
|
g_snprintf( data->secondary, sizeof( data->secondary ),
|
2008-04-01 16:57:48 +00:00
|
|
|
_( "Blocklist updated with %'d entries" ), rules );
|
2008-03-30 00:21:46 +00:00
|
|
|
g_idle_add( blocklistDialogSetSecondary, data );
|
|
|
|
g_idle_add( blocklistDialogAllowClose, data->dialog );
|
2008-04-01 16:57:48 +00:00
|
|
|
g_idle_add( updateBlocklistTextFromData, data );
|
2008-03-30 00:21:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* g_free( data ); */
|
2008-03-30 03:20:18 +00:00
|
|
|
if( filename2 ) {
|
|
|
|
unlink( filename2 );
|
|
|
|
g_free( filename2 );
|
|
|
|
}
|
|
|
|
if( filename ) {
|
|
|
|
unlink( filename );
|
|
|
|
g_free( filename );
|
|
|
|
}
|
2008-03-30 00:21:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
onUpdateBlocklistResponseCB( GtkDialog * dialog, int response, gpointer vdata )
|
|
|
|
{
|
|
|
|
struct blocklist_data * data = vdata;
|
|
|
|
|
|
|
|
if( response == GTK_RESPONSE_CANCEL )
|
|
|
|
data->abortFlag = 1;
|
|
|
|
|
|
|
|
data->dialog = NULL;
|
|
|
|
gtk_widget_destroy( GTK_WIDGET( dialog ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-04-01 16:57:48 +00:00
|
|
|
onUpdateBlocklistCB( GtkButton * w, gpointer gdata )
|
2008-03-30 00:21:46 +00:00
|
|
|
{
|
|
|
|
GtkWidget * d;
|
2008-04-01 16:57:48 +00:00
|
|
|
struct blocklist_data * data = gdata;
|
2008-04-25 18:35:48 +00:00
|
|
|
tr_handle * handle = g_object_get_data( G_OBJECT( w ), "handle" );
|
|
|
|
const char * url = "http://download.m0k.org/transmission/files/level1.gz";
|
2008-03-30 00:21:46 +00:00
|
|
|
|
|
|
|
d = gtk_message_dialog_new( GTK_WINDOW( gtk_widget_get_toplevel( GTK_WIDGET( w ) ) ),
|
|
|
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
|
|
|
GTK_MESSAGE_INFO,
|
|
|
|
GTK_BUTTONS_NONE,
|
|
|
|
_( "Updating Blocklist" ) );
|
2008-04-25 18:35:48 +00:00
|
|
|
gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG( d ),
|
|
|
|
_( "Retrieving blocklist..." ) );
|
2008-03-30 00:21:46 +00:00
|
|
|
gtk_dialog_add_buttons( GTK_DIALOG( d ),
|
|
|
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
|
|
|
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
|
|
|
|
NULL );
|
|
|
|
gtk_dialog_set_response_sensitive( GTK_DIALOG( d ), GTK_RESPONSE_CLOSE, FALSE );
|
|
|
|
|
|
|
|
data->dialog = d;
|
|
|
|
|
|
|
|
g_signal_connect( d, "response", G_CALLBACK(onUpdateBlocklistResponseCB), data );
|
|
|
|
gtk_widget_show( d );
|
2008-04-25 18:35:48 +00:00
|
|
|
|
2008-06-07 21:26:41 +00:00
|
|
|
tr_webRun( handle, url, NULL, got_blocklist, data );
|
2008-03-30 00:21:46 +00:00
|
|
|
}
|
|
|
|
|
2008-02-13 03:00:21 +00:00
|
|
|
static GtkWidget*
|
2008-06-06 20:03:19 +00:00
|
|
|
peerPage( GObject * core, gboolean * alive )
|
2008-02-13 03:00:21 +00:00
|
|
|
{
|
|
|
|
int row = 0;
|
|
|
|
const char * s;
|
|
|
|
GtkWidget * t;
|
|
|
|
GtkWidget * w;
|
2008-06-06 20:03:19 +00:00
|
|
|
GtkWidget * w2;
|
2008-03-30 00:21:46 +00:00
|
|
|
GtkWidget * b;
|
|
|
|
GtkWidget * h;
|
2008-06-06 20:03:19 +00:00
|
|
|
GtkWidget * l;
|
2008-04-01 16:57:48 +00:00
|
|
|
struct blocklist_data * data;
|
2008-02-13 03:00:21 +00:00
|
|
|
|
2008-02-14 17:18:00 +00:00
|
|
|
t = hig_workarea_create( );
|
2008-02-13 03:00:21 +00:00
|
|
|
hig_workarea_add_section_title (t, &row, _("Options"));
|
|
|
|
|
2008-04-01 16:57:48 +00:00
|
|
|
w = new_check_button( "", PREF_KEY_BLOCKLIST_ENABLED, core );
|
|
|
|
updateBlocklistText( w, TR_CORE( core ) );
|
|
|
|
h = gtk_hbox_new( FALSE, GUI_PAD_BIG );
|
|
|
|
gtk_box_pack_start_defaults( GTK_BOX(h), w );
|
|
|
|
b = gtk_button_new_with_mnemonic( _( "_Update Blocklist" ) );
|
2008-03-30 00:21:46 +00:00
|
|
|
|
2008-04-01 16:57:48 +00:00
|
|
|
data = g_new0( struct blocklist_data, 1 );
|
|
|
|
data->core = TR_CORE( core );
|
|
|
|
data->check = w;
|
2008-03-30 00:21:46 +00:00
|
|
|
|
2008-04-25 18:35:48 +00:00
|
|
|
g_object_set_data( G_OBJECT( b ), "handle", tr_core_handle( TR_CORE( core ) ) );
|
2008-04-01 16:57:48 +00:00
|
|
|
g_signal_connect( b, "clicked", G_CALLBACK(onUpdateBlocklistCB), data );
|
2008-03-30 00:21:46 +00:00
|
|
|
gtk_box_pack_start( GTK_BOX(h), b, FALSE, FALSE, 0 );
|
2008-04-01 16:57:48 +00:00
|
|
|
g_signal_connect( w, "toggled", G_CALLBACK(target_cb), b );
|
|
|
|
target_cb( w, b );
|
2008-03-30 00:21:46 +00:00
|
|
|
hig_workarea_add_wide_control( t, &row, h );
|
2008-04-01 18:33:34 +00:00
|
|
|
|
2008-04-06 14:07:41 +00:00
|
|
|
s = _("_Ignore unencrypted peers");
|
2008-04-01 18:33:34 +00:00
|
|
|
w = new_check_button( s, PREF_KEY_ENCRYPTED_ONLY, core );
|
|
|
|
hig_workarea_add_wide_control( t, &row, w );
|
2008-03-30 00:21:46 +00:00
|
|
|
|
2008-04-01 18:33:34 +00:00
|
|
|
s = _("Use peer e_xchange");
|
|
|
|
w = new_check_button( s, PREF_KEY_PEX, core );
|
|
|
|
hig_workarea_add_wide_control( t, &row, w );
|
2008-06-06 20:03:19 +00:00
|
|
|
|
|
|
|
h = gtk_hbox_new( FALSE, GUI_PAD_BIG );
|
|
|
|
w2 = new_spin_button( PREF_KEY_PORT, core, 1, INT_MAX, 1 );
|
|
|
|
gtk_box_pack_start( GTK_BOX(h), w2, FALSE, FALSE, 0 );
|
|
|
|
l = gtk_label_new( NULL );
|
|
|
|
gtk_misc_set_alignment( GTK_MISC(l), 0.0f, 0.5f );
|
|
|
|
gtk_box_pack_start( GTK_BOX(h), l, FALSE, FALSE, 0 );
|
|
|
|
hig_workarea_add_row( t, &row, _("Listening _port:"), h, w2 );
|
|
|
|
|
|
|
|
g_object_set_data( G_OBJECT(l), "tr-port-spin", w2 );
|
|
|
|
g_object_set_data( G_OBJECT(l), "alive", alive );
|
|
|
|
g_object_set_data( G_OBJECT(l), "handle", tr_core_handle( TR_CORE( core ) ) );
|
|
|
|
testing_port_cb( NULL, l );
|
|
|
|
g_signal_connect( w2, "value-changed", G_CALLBACK(testing_port_cb), l );
|
2008-04-01 18:33:34 +00:00
|
|
|
|
2008-04-01 02:36:41 +00:00
|
|
|
hig_workarea_add_section_divider( t, &row );
|
|
|
|
hig_workarea_add_section_title( t, &row, _( "Limits" ) );
|
|
|
|
|
|
|
|
w = new_spin_button( PREF_KEY_MAX_PEERS_GLOBAL, core, 1, 3000, 5 );
|
|
|
|
hig_workarea_add_row( t, &row, _( "Maximum peers _overall:" ), w, NULL );
|
|
|
|
w = new_spin_button( PREF_KEY_MAX_PEERS_PER_TORRENT, core, 1, 300, 5 );
|
|
|
|
hig_workarea_add_row( t, &row, _( "Maximum peers per _torrent:" ), w, NULL );
|
|
|
|
|
2008-02-14 17:18:00 +00:00
|
|
|
hig_workarea_finish( t, &row );
|
2008-02-13 03:00:21 +00:00
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
2008-06-03 20:59:57 +00:00
|
|
|
static GtkTreeModel*
|
|
|
|
allow_deny_model_new( void )
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkListStore * store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_CHAR );
|
|
|
|
gtk_list_store_append( store, &iter );
|
|
|
|
gtk_list_store_set( store, &iter, 0, _( "Allow" ), 1, '+', -1 );
|
|
|
|
gtk_list_store_append( store, &iter );
|
|
|
|
gtk_list_store_set( store, &iter, 0, _( "Deny" ), 1, '-', -1 );
|
|
|
|
return GTK_TREE_MODEL( store );
|
|
|
|
}
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2008-06-04 19:46:37 +00:00
|
|
|
COL_ADDRESS,
|
|
|
|
COL_PERMISSION,
|
|
|
|
N_COLS
|
2008-06-03 20:59:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static GtkTreeModel*
|
2008-06-04 19:46:37 +00:00
|
|
|
acl_tree_model_new( const char * acl )
|
2008-06-03 20:59:57 +00:00
|
|
|
{
|
2008-06-04 19:46:37 +00:00
|
|
|
int i;
|
|
|
|
char ** rules;
|
2008-06-03 20:59:57 +00:00
|
|
|
GtkListStore * store = gtk_list_store_new( N_COLS,
|
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_STRING );
|
2008-06-04 19:46:37 +00:00
|
|
|
rules = g_strsplit( acl, ",", 0 );
|
|
|
|
|
|
|
|
for( i=0; rules && rules[i]; ++i )
|
|
|
|
{
|
|
|
|
const char * s = rules[i];
|
|
|
|
while( isspace( *s ) ) ++s;
|
|
|
|
if( *s=='+' || *s=='-' )
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
gtk_list_store_append( store, &iter );
|
|
|
|
gtk_list_store_set( store, &iter,
|
|
|
|
COL_PERMISSION, *s=='+' ? _( "Allow" ) : _( "Deny" ) ,
|
|
|
|
COL_ADDRESS, s+1,
|
|
|
|
-1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev( rules );
|
2008-06-03 20:59:57 +00:00
|
|
|
return GTK_TREE_MODEL( store );
|
|
|
|
}
|
|
|
|
|
|
|
|
struct remote_page
|
|
|
|
{
|
2008-06-04 19:46:37 +00:00
|
|
|
TrCore * core;
|
2008-06-03 20:59:57 +00:00
|
|
|
GtkTreeView * view;
|
|
|
|
GtkListStore * store;
|
|
|
|
GtkWidget * remove_button;
|
2008-06-04 19:46:37 +00:00
|
|
|
GSList * widgets;
|
2008-06-05 16:23:03 +00:00
|
|
|
GSList * auth_widgets;
|
2008-06-04 19:46:37 +00:00
|
|
|
GtkToggleButton * rpc_tb;
|
2008-06-05 16:23:03 +00:00
|
|
|
GtkToggleButton * auth_tb;
|
2008-06-03 20:59:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
2008-06-04 19:46:37 +00:00
|
|
|
refreshACL( struct remote_page * page )
|
2008-06-03 20:59:57 +00:00
|
|
|
{
|
2008-06-04 19:46:37 +00:00
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreeModel * model = GTK_TREE_MODEL( page->store );
|
|
|
|
GString * gstr = g_string_new( NULL );
|
|
|
|
|
|
|
|
if( gtk_tree_model_get_iter_first( model, &iter ) ) do
|
|
|
|
{
|
|
|
|
char * permission;
|
|
|
|
char * address;
|
|
|
|
gtk_tree_model_get( model, &iter, COL_PERMISSION, &permission,
|
|
|
|
COL_ADDRESS, &address,
|
|
|
|
-1 );
|
|
|
|
g_string_append_c( gstr, strcmp(permission,_("Allow")) ? '-' : '+' );
|
|
|
|
g_string_append( gstr, address );
|
|
|
|
g_string_append( gstr, ", " );
|
|
|
|
g_free( address );
|
|
|
|
g_free( permission );
|
|
|
|
}
|
|
|
|
while( gtk_tree_model_iter_next( model, &iter ) );
|
|
|
|
|
|
|
|
g_string_truncate( gstr, gstr->len-2 ); /* remove the trailing ", " */
|
|
|
|
|
|
|
|
tr_core_set_pref( page->core, PREF_KEY_RPC_ACL, gstr->str );
|
|
|
|
|
|
|
|
g_string_free( gstr, TRUE );
|
2008-06-03 20:59:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-06-04 19:46:37 +00:00
|
|
|
onPermissionEdited( GtkCellRendererText * renderer UNUSED,
|
|
|
|
gchar * path_string,
|
|
|
|
gchar * new_text,
|
|
|
|
gpointer gpage )
|
2008-06-03 20:59:57 +00:00
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreePath * path = gtk_tree_path_new_from_string( path_string );
|
|
|
|
struct remote_page * page = gpage;
|
|
|
|
GtkTreeModel * model = GTK_TREE_MODEL( page->store );
|
|
|
|
if( gtk_tree_model_get_iter( model, &iter, path ) )
|
2008-06-04 19:46:37 +00:00
|
|
|
gtk_list_store_set( page->store, &iter, COL_PERMISSION, new_text, -1 );
|
2008-06-03 20:59:57 +00:00
|
|
|
gtk_tree_path_free( path );
|
2008-06-04 19:46:37 +00:00
|
|
|
refreshACL( page );
|
2008-06-03 20:59:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-06-04 19:46:37 +00:00
|
|
|
onAddressEdited( GtkCellRendererText * r UNUSED,
|
|
|
|
gchar * path_string,
|
|
|
|
gchar * new_text,
|
|
|
|
gpointer gpage )
|
2008-06-03 20:59:57 +00:00
|
|
|
{
|
2008-06-04 19:46:37 +00:00
|
|
|
char * acl;
|
2008-06-03 20:59:57 +00:00
|
|
|
GtkTreeIter iter;
|
|
|
|
struct remote_page * page = gpage;
|
|
|
|
GtkTreeModel * model = GTK_TREE_MODEL( page->store );
|
2008-06-04 19:46:37 +00:00
|
|
|
tr_handle * session = tr_core_handle( page->core );
|
|
|
|
GtkTreePath * path = gtk_tree_path_new_from_string( path_string );
|
2008-06-03 20:59:57 +00:00
|
|
|
|
2008-06-04 19:46:37 +00:00
|
|
|
acl = g_strdup_printf( "+%s", new_text );
|
|
|
|
if( !tr_sessionTestRPCACL( session, acl, NULL ) )
|
|
|
|
if( gtk_tree_model_get_iter( model, &iter, path ) )
|
|
|
|
gtk_list_store_set( page->store, &iter, COL_ADDRESS, new_text, -1 );
|
2008-06-03 20:59:57 +00:00
|
|
|
|
2008-06-04 19:46:37 +00:00
|
|
|
g_free( acl );
|
2008-06-03 20:59:57 +00:00
|
|
|
gtk_tree_path_free( path );
|
2008-06-04 19:46:37 +00:00
|
|
|
refreshACL( page );
|
2008-06-03 20:59:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
onAddACLClicked( GtkButton * b UNUSED, gpointer gpage )
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkTreePath * path;
|
|
|
|
struct remote_page * page = gpage;
|
|
|
|
gtk_list_store_append( page->store, &iter );
|
|
|
|
gtk_list_store_set( page->store, &iter,
|
2008-06-04 19:46:37 +00:00
|
|
|
COL_PERMISSION, _( "Allow" ),
|
|
|
|
COL_ADDRESS, _( "0.0.0.0" ),
|
2008-06-03 20:59:57 +00:00
|
|
|
-1 );
|
|
|
|
|
|
|
|
path = gtk_tree_model_get_path( GTK_TREE_MODEL( page->store ), &iter );
|
2008-06-04 19:46:37 +00:00
|
|
|
gtk_tree_view_set_cursor(
|
|
|
|
page->view, path,
|
|
|
|
gtk_tree_view_get_column( page->view, COL_ADDRESS ),
|
|
|
|
TRUE );
|
2008-06-03 20:59:57 +00:00
|
|
|
gtk_tree_path_free( path );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
onRemoveACLClicked( GtkButton * b UNUSED, gpointer gpage )
|
|
|
|
{
|
|
|
|
struct remote_page * page = gpage;
|
|
|
|
GtkTreeSelection * sel = gtk_tree_view_get_selection( page->view );
|
|
|
|
GtkTreeIter iter;
|
|
|
|
if( gtk_tree_selection_get_selected( sel, NULL, &iter ) )
|
2008-06-04 19:46:37 +00:00
|
|
|
{
|
2008-06-03 20:59:57 +00:00
|
|
|
gtk_list_store_remove( page->store, &iter );
|
2008-06-04 19:46:37 +00:00
|
|
|
refreshACL( page );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
refreshRPCSensitivity( struct remote_page * page )
|
|
|
|
{
|
|
|
|
GSList * l;
|
|
|
|
const int rpc_active = gtk_toggle_button_get_active( page->rpc_tb );
|
2008-06-05 16:23:03 +00:00
|
|
|
const int auth_active = gtk_toggle_button_get_active( page->auth_tb );
|
2008-06-04 19:46:37 +00:00
|
|
|
GtkTreeSelection * sel = gtk_tree_view_get_selection( page->view );
|
|
|
|
const int have_addr = gtk_tree_selection_get_selected( sel, NULL, NULL );
|
|
|
|
const int n_rules = gtk_tree_model_iter_n_children(
|
|
|
|
GTK_TREE_MODEL( page->store ), NULL );
|
|
|
|
|
|
|
|
for( l=page->widgets; l!=NULL; l=l->next )
|
|
|
|
gtk_widget_set_sensitive( GTK_WIDGET( l->data ), rpc_active );
|
|
|
|
|
2008-06-05 16:23:03 +00:00
|
|
|
for( l=page->auth_widgets; l!=NULL; l=l->next )
|
|
|
|
gtk_widget_set_sensitive( GTK_WIDGET( l->data ), rpc_active && auth_active);
|
2008-06-04 19:46:37 +00:00
|
|
|
|
|
|
|
gtk_widget_set_sensitive( page->remove_button,
|
|
|
|
rpc_active && have_addr && n_rules>1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
onRPCToggled( GtkToggleButton * tb UNUSED, gpointer page )
|
|
|
|
{
|
|
|
|
refreshRPCSensitivity( page );
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
onACLSelectionChanged( GtkTreeSelection * sel UNUSED, gpointer page )
|
|
|
|
{
|
|
|
|
refreshRPCSensitivity( page );
|
2008-06-03 20:59:57 +00:00
|
|
|
}
|
|
|
|
|
2008-06-02 21:02:38 +00:00
|
|
|
static GtkWidget*
|
|
|
|
remotePage( GObject * core )
|
|
|
|
{
|
|
|
|
const char * s;
|
|
|
|
int row = 0;
|
|
|
|
GtkWidget * t;
|
|
|
|
GtkWidget * w;
|
2008-06-03 20:59:57 +00:00
|
|
|
struct remote_page * page = g_new0( struct remote_page, 1 );
|
2008-06-02 21:02:38 +00:00
|
|
|
|
2008-06-04 19:46:37 +00:00
|
|
|
page->core = TR_CORE( core );
|
|
|
|
|
2008-06-02 21:02:38 +00:00
|
|
|
t = hig_workarea_create( );
|
2008-06-03 20:59:57 +00:00
|
|
|
g_object_set_data_full( G_OBJECT( t ), "page", page, g_free );
|
2008-06-02 21:02:38 +00:00
|
|
|
|
|
|
|
hig_workarea_add_section_title( t, &row, _( "Remote Access" ) );
|
|
|
|
|
|
|
|
/* "enabled" checkbutton */
|
2008-06-03 20:59:57 +00:00
|
|
|
s = _( "A_llow requests from transmission-remote, Clutch, etc." );
|
2008-06-02 21:02:38 +00:00
|
|
|
w = new_check_button( s, PREF_KEY_RPC_ENABLED, core );
|
|
|
|
hig_workarea_add_wide_control( t, &row, w );
|
2008-06-04 19:46:37 +00:00
|
|
|
page->rpc_tb = GTK_TOGGLE_BUTTON( w );
|
|
|
|
g_signal_connect( w, "clicked", G_CALLBACK(onRPCToggled), page );
|
2008-06-02 21:02:38 +00:00
|
|
|
|
2008-06-05 16:23:03 +00:00
|
|
|
/* require authentication */
|
|
|
|
s = _( "Require _authentication" );
|
2008-06-06 20:03:19 +00:00
|
|
|
w = new_check_button( s, PREF_KEY_RPC_AUTH_ENABLED, core );
|
2008-06-05 16:23:03 +00:00
|
|
|
hig_workarea_add_wide_control( t, &row, w );
|
|
|
|
page->auth_tb = GTK_TOGGLE_BUTTON( w );
|
2008-06-04 19:46:37 +00:00
|
|
|
page->widgets = g_slist_append( page->widgets, w );
|
2008-06-05 16:23:03 +00:00
|
|
|
g_signal_connect( w, "clicked", G_CALLBACK(onRPCToggled), page );
|
|
|
|
|
|
|
|
/* username */
|
|
|
|
s = _( "_Username:" );
|
|
|
|
w = new_entry( PREF_KEY_RPC_USERNAME, core );
|
|
|
|
page->auth_widgets = g_slist_append( page->auth_widgets, w );
|
|
|
|
w = hig_workarea_add_row( t, &row, s, w, NULL );
|
|
|
|
page->auth_widgets = g_slist_append( page->auth_widgets, w );
|
|
|
|
|
|
|
|
/* password */
|
|
|
|
s = _( "_Password:" );
|
|
|
|
w = new_entry( PREF_KEY_RPC_PASSWORD, core );
|
|
|
|
gtk_entry_set_visibility( GTK_ENTRY( w ), FALSE );
|
|
|
|
page->auth_widgets = g_slist_append( page->auth_widgets, w );
|
|
|
|
w = hig_workarea_add_row( t, &row, s, w, NULL );
|
|
|
|
page->auth_widgets = g_slist_append( page->auth_widgets, w );
|
2008-06-02 21:02:38 +00:00
|
|
|
|
2008-06-03 20:59:57 +00:00
|
|
|
/* port */
|
|
|
|
w = new_spin_button( PREF_KEY_RPC_PORT, core, 0, 65535, 1 );
|
2008-06-04 19:46:37 +00:00
|
|
|
page->widgets = g_slist_append( page->widgets, w );
|
|
|
|
w = hig_workarea_add_row( t, &row, _( "Listening _port:" ), w, NULL );
|
|
|
|
page->widgets = g_slist_append( page->widgets, w );
|
2008-06-03 20:59:57 +00:00
|
|
|
|
2008-06-02 21:02:38 +00:00
|
|
|
/* access control list */
|
2008-06-03 20:59:57 +00:00
|
|
|
{
|
|
|
|
char * val = pref_string_get( PREF_KEY_RPC_ACL );
|
|
|
|
GtkTreeModel * m = acl_tree_model_new( val );
|
|
|
|
GtkTreeViewColumn * c;
|
|
|
|
GtkCellRenderer * r;
|
|
|
|
GtkTreeSelection * sel;
|
|
|
|
GtkTreeView * v;
|
|
|
|
GtkWidget * w;
|
|
|
|
GtkWidget * h;
|
2008-06-04 19:46:37 +00:00
|
|
|
GtkTooltips * tips = gtk_tooltips_new( );
|
2008-06-03 20:59:57 +00:00
|
|
|
|
2008-06-02 21:02:38 +00:00
|
|
|
s = _( "Access control list:" );
|
2008-06-03 20:59:57 +00:00
|
|
|
page->store = GTK_LIST_STORE( m );
|
|
|
|
w = gtk_tree_view_new_with_model( m );
|
2008-06-04 19:46:37 +00:00
|
|
|
|
|
|
|
page->widgets = g_slist_append( page->widgets, w );
|
2008-06-03 20:59:57 +00:00
|
|
|
v = page->view = GTK_TREE_VIEW( w );
|
2008-06-04 19:46:37 +00:00
|
|
|
gtk_tooltips_set_tip( tips, w,
|
|
|
|
_( "IP addresses may use wildcards, such as 192.168.*.*" ),
|
|
|
|
NULL );
|
2008-06-03 20:59:57 +00:00
|
|
|
sel = gtk_tree_view_get_selection( v );
|
|
|
|
g_signal_connect( sel, "changed",
|
|
|
|
G_CALLBACK( onACLSelectionChanged ), page );
|
|
|
|
g_object_unref( G_OBJECT( m ) );
|
2008-06-04 19:46:37 +00:00
|
|
|
gtk_tree_view_set_headers_visible( v, TRUE );
|
2008-06-03 20:59:57 +00:00
|
|
|
w = gtk_frame_new( NULL );
|
|
|
|
gtk_frame_set_shadow_type( GTK_FRAME( w ), GTK_SHADOW_IN );
|
|
|
|
gtk_container_add( GTK_CONTAINER( w ), GTK_WIDGET( v ) );
|
|
|
|
|
2008-06-04 19:46:37 +00:00
|
|
|
/* ip address column */
|
|
|
|
r = gtk_cell_renderer_text_new( );
|
|
|
|
g_signal_connect( r, "edited",
|
|
|
|
G_CALLBACK( onAddressEdited ), page );
|
|
|
|
g_object_set( G_OBJECT( r ), "editable", TRUE, NULL );
|
|
|
|
c = gtk_tree_view_column_new_with_attributes( _( "IP Address" ), r,
|
|
|
|
"text", COL_ADDRESS,
|
|
|
|
NULL );
|
|
|
|
gtk_tree_view_column_set_expand( c, TRUE );
|
|
|
|
gtk_tree_view_append_column( v, c );
|
|
|
|
|
|
|
|
w = hig_workarea_add_row( t, &row, s, w, NULL );
|
|
|
|
gtk_misc_set_alignment( GTK_MISC( w ), 0.0f, 0.1f );
|
|
|
|
page->widgets = g_slist_append( page->widgets, w );
|
|
|
|
g_free( val );
|
|
|
|
|
|
|
|
/* permission column */
|
2008-06-03 20:59:57 +00:00
|
|
|
m = allow_deny_model_new( );
|
|
|
|
r = gtk_cell_renderer_combo_new( );
|
2008-06-04 19:46:37 +00:00
|
|
|
g_object_set( G_OBJECT( r ), "model", m,
|
2008-06-03 20:59:57 +00:00
|
|
|
"editable", TRUE,
|
|
|
|
"has-entry", FALSE,
|
|
|
|
"text-column", 0,
|
|
|
|
NULL );
|
2008-06-04 19:46:37 +00:00
|
|
|
c = gtk_tree_view_column_new_with_attributes( _( "Permission" ), r,
|
|
|
|
"text", COL_PERMISSION,
|
|
|
|
NULL );
|
|
|
|
g_signal_connect( r, "edited",
|
|
|
|
G_CALLBACK( onPermissionEdited ), page );
|
2008-06-03 20:59:57 +00:00
|
|
|
gtk_tree_view_append_column( v, c );
|
|
|
|
|
|
|
|
h = gtk_hbox_new( TRUE, GUI_PAD );
|
|
|
|
w = gtk_button_new_from_stock( GTK_STOCK_REMOVE );
|
|
|
|
g_signal_connect( w, "clicked", G_CALLBACK(onRemoveACLClicked), page );
|
|
|
|
page->remove_button = w;
|
|
|
|
onACLSelectionChanged( sel, page );
|
|
|
|
gtk_box_pack_start_defaults( GTK_BOX( h ), w );
|
|
|
|
w = gtk_button_new_from_stock( GTK_STOCK_ADD );
|
2008-06-04 19:46:37 +00:00
|
|
|
page->widgets = g_slist_append( page->widgets, w );
|
2008-06-03 20:59:57 +00:00
|
|
|
g_signal_connect( w, "clicked", G_CALLBACK(onAddACLClicked), page );
|
|
|
|
gtk_box_pack_start_defaults( GTK_BOX( h ), w );
|
|
|
|
w = gtk_hbox_new( FALSE, 0 );
|
|
|
|
gtk_box_pack_start_defaults( GTK_BOX( w ), gtk_alignment_new( 0, 0, 0, 0 ) );
|
|
|
|
gtk_box_pack_start( GTK_BOX( w ), h, FALSE, FALSE, 0 );
|
|
|
|
hig_workarea_add_wide_control( t, &row, w );
|
|
|
|
}
|
2008-06-02 21:02:38 +00:00
|
|
|
|
2008-06-05 16:23:03 +00:00
|
|
|
refreshRPCSensitivity( page );
|
2008-06-02 21:02:38 +00:00
|
|
|
hig_workarea_finish( t, &row );
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
2008-06-06 23:48:17 +00:00
|
|
|
struct ProxyPage
|
|
|
|
{
|
2008-06-11 21:05:13 +00:00
|
|
|
TrCore * core;
|
2008-06-06 23:48:17 +00:00
|
|
|
GSList * proxy_widgets;
|
|
|
|
GSList * proxy_auth_widgets;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
refreshProxySensitivity( struct ProxyPage * p )
|
|
|
|
{
|
|
|
|
GSList * l;
|
|
|
|
const gboolean proxy_enabled = pref_flag_get( PREF_KEY_PROXY_SERVER_ENABLED );
|
|
|
|
const gboolean proxy_auth_enabled = pref_flag_get( PREF_KEY_PROXY_AUTH_ENABLED );
|
|
|
|
|
|
|
|
for( l=p->proxy_widgets; l!=NULL; l=l->next )
|
|
|
|
gtk_widget_set_sensitive( GTK_WIDGET( l->data ), proxy_enabled );
|
|
|
|
|
|
|
|
for( l=p->proxy_auth_widgets; l!=NULL; l=l->next )
|
|
|
|
gtk_widget_set_sensitive( GTK_WIDGET( l->data ),
|
|
|
|
proxy_enabled && proxy_auth_enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
onProxyToggled( GtkToggleButton * tb UNUSED, gpointer user_data )
|
|
|
|
{
|
|
|
|
refreshProxySensitivity( user_data );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
proxyPageFree( gpointer gpage )
|
|
|
|
{
|
|
|
|
struct ProxyPage * page = gpage;
|
|
|
|
g_slist_free( page->proxy_widgets );
|
|
|
|
g_slist_free( page->proxy_auth_widgets );
|
|
|
|
g_free( page );
|
|
|
|
}
|
|
|
|
|
2008-06-11 21:05:13 +00:00
|
|
|
static GtkTreeModel*
|
|
|
|
proxyTypeModelNew( void )
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GtkListStore * store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_INT );
|
|
|
|
gtk_list_store_append( store, &iter );
|
|
|
|
gtk_list_store_set( store, &iter, 0, _( "HTTP" ), 1, TR_PROXY_HTTP, -1 );
|
|
|
|
gtk_list_store_append( store, &iter );
|
|
|
|
gtk_list_store_set( store, &iter, 0, _( "SOCKS4" ), 1, TR_PROXY_SOCKS4, -1 );
|
|
|
|
gtk_list_store_append( store, &iter );
|
|
|
|
gtk_list_store_set( store, &iter, 0, _( "SOCKS5" ), 1, TR_PROXY_SOCKS5, -1 );
|
|
|
|
return GTK_TREE_MODEL( store );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
onProxyTypeChanged( GtkComboBox * w, gpointer gpage )
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
|
|
|
if( gtk_combo_box_get_active_iter( w, &iter ) )
|
|
|
|
{
|
|
|
|
struct ProxyPage * page = gpage;
|
|
|
|
int type = TR_PROXY_HTTP;
|
|
|
|
gtk_tree_model_get( gtk_combo_box_get_model( w ), &iter, 1, &type, -1 );
|
|
|
|
tr_core_set_pref_int( TR_CORE( page->core ), PREF_KEY_PROXY_TYPE, type );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-13 03:00:21 +00:00
|
|
|
static GtkWidget*
|
2008-06-06 20:03:19 +00:00
|
|
|
networkPage( GObject * core )
|
2008-02-13 03:00:21 +00:00
|
|
|
{
|
|
|
|
int row = 0;
|
|
|
|
const char * s;
|
|
|
|
GtkWidget * t;
|
|
|
|
GtkWidget * w, * w2;
|
2008-06-11 21:05:13 +00:00
|
|
|
GtkTreeModel * m;
|
|
|
|
GtkCellRenderer * r;
|
2008-06-06 23:48:17 +00:00
|
|
|
struct ProxyPage * page = tr_new0( struct ProxyPage, 1 );
|
2007-09-27 20:57:58 +00:00
|
|
|
|
2008-06-11 21:05:13 +00:00
|
|
|
page->core = TR_CORE( core );
|
2007-09-27 20:57:58 +00:00
|
|
|
|
2008-06-11 21:05:13 +00:00
|
|
|
t = hig_workarea_create( );
|
2008-06-06 20:03:19 +00:00
|
|
|
hig_workarea_add_section_title (t, &row, _( "Router" ) );
|
|
|
|
|
|
|
|
s = _("Use port _forwarding from my router" );
|
|
|
|
w = new_check_button( s, PREF_KEY_NAT, core );
|
|
|
|
hig_workarea_add_wide_control( t, &row, w );
|
|
|
|
|
|
|
|
hig_workarea_add_section_divider( t, &row );
|
2008-02-13 03:33:01 +00:00
|
|
|
hig_workarea_add_section_title (t, &row, _("Bandwidth"));
|
2007-09-27 20:57:58 +00:00
|
|
|
|
2008-03-07 20:48:36 +00:00
|
|
|
s = _("Limit _download speed (KB/s):");
|
2007-09-28 00:46:22 +00:00
|
|
|
w = new_check_button( s, PREF_KEY_DL_LIMIT_ENABLED, core );
|
2007-12-26 10:39:10 +00:00
|
|
|
w2 = new_spin_button( PREF_KEY_DL_LIMIT, core, 0, INT_MAX, 5 );
|
2007-12-13 20:46:19 +00:00
|
|
|
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 );
|
2008-02-12 16:56:44 +00:00
|
|
|
hig_workarea_add_row_w( t, &row, w, w2, NULL );
|
2007-09-27 20:57:58 +00:00
|
|
|
|
2008-03-11 04:19:50 +00:00
|
|
|
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 );
|
|
|
|
|
2008-06-03 20:59:57 +00:00
|
|
|
hig_workarea_add_section_divider( t, &row );
|
2008-06-10 23:05:30 +00:00
|
|
|
hig_workarea_add_section_title (t, &row, _( "Tracker Proxy" ) );
|
2007-12-15 22:24:16 +00:00
|
|
|
|
2008-06-10 23:05:30 +00:00
|
|
|
s = _( "Connect to tracker with HTTP proxy" );
|
2008-06-06 20:03:19 +00:00
|
|
|
w = new_check_button( s, PREF_KEY_PROXY_SERVER_ENABLED, core );
|
2008-06-06 23:48:17 +00:00
|
|
|
g_signal_connect( w, "toggled", G_CALLBACK(onProxyToggled), page );
|
2008-06-10 23:05:30 +00:00
|
|
|
hig_workarea_add_wide_control( t, &row, w );
|
2007-12-15 22:24:16 +00:00
|
|
|
|
2008-06-10 23:05:30 +00:00
|
|
|
s = _( "Proxy server:" );
|
|
|
|
w = new_entry( PREF_KEY_PROXY_SERVER, core );
|
2008-06-06 23:48:17 +00:00
|
|
|
page->proxy_widgets = g_slist_append( page->proxy_widgets, w );
|
2008-06-11 21:05:13 +00:00
|
|
|
w = hig_workarea_add_row( t, &row, s, 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 );
|
|
|
|
r = gtk_cell_renderer_text_new( );
|
|
|
|
gtk_cell_layout_pack_start( GTK_CELL_LAYOUT( w ), r, TRUE );
|
|
|
|
gtk_cell_layout_set_attributes( GTK_CELL_LAYOUT( w ), r, "text", 0, NULL );
|
|
|
|
gtk_combo_box_set_active( GTK_COMBO_BOX( w ), pref_int_get( PREF_KEY_PROXY_TYPE ) );
|
2008-06-11 23:34:01 +00:00
|
|
|
g_signal_connect( w, "changed", G_CALLBACK(onProxyTypeChanged), page );
|
2008-06-11 21:05:13 +00:00
|
|
|
g_object_unref( G_OBJECT( m ) );
|
|
|
|
page->proxy_widgets = g_slist_append( page->proxy_widgets, w );
|
2008-06-10 23:05:30 +00:00
|
|
|
w = hig_workarea_add_row( t, &row, s, w, NULL );
|
|
|
|
page->proxy_widgets = g_slist_append( page->proxy_widgets, w );
|
|
|
|
|
|
|
|
s = _( "_Authentication is required" );
|
|
|
|
w = new_check_button( s, PREF_KEY_PROXY_AUTH_ENABLED, core );
|
2008-06-06 23:48:17 +00:00
|
|
|
g_signal_connect( w, "toggled", G_CALLBACK(onProxyToggled), page );
|
2008-05-23 16:18:58 +00:00
|
|
|
hig_workarea_add_wide_control( t, &row, w );
|
2008-06-10 23:05:30 +00:00
|
|
|
page->proxy_widgets = g_slist_append( page->proxy_widgets, w );
|
2008-05-23 16:18:58 +00:00
|
|
|
|
2008-06-10 23:05:30 +00:00
|
|
|
s = _( "_Username:" );
|
2008-06-06 20:03:19 +00:00
|
|
|
w = new_entry( PREF_KEY_PROXY_USERNAME, core );
|
2008-06-06 23:48:17 +00:00
|
|
|
page->proxy_auth_widgets = g_slist_append( page->proxy_auth_widgets, w );
|
2008-06-10 23:05:30 +00:00
|
|
|
w = hig_workarea_add_row( t, &row, s, w, NULL );
|
2008-06-06 23:48:17 +00:00
|
|
|
page->proxy_auth_widgets = g_slist_append( page->proxy_auth_widgets, w );
|
2008-06-06 20:03:19 +00:00
|
|
|
|
2008-06-10 23:05:30 +00:00
|
|
|
s = _( "_Password:" );
|
2008-06-06 20:03:19 +00:00
|
|
|
w = new_entry( PREF_KEY_PROXY_PASSWORD, core );
|
|
|
|
gtk_entry_set_visibility( GTK_ENTRY( w ), FALSE );
|
2008-06-06 23:48:17 +00:00
|
|
|
page->proxy_auth_widgets = g_slist_append( page->proxy_auth_widgets, w );
|
2008-06-10 23:05:30 +00:00
|
|
|
w = hig_workarea_add_row( t, &row, s, w, NULL );
|
2008-06-06 23:48:17 +00:00
|
|
|
page->proxy_auth_widgets = g_slist_append( page->proxy_auth_widgets, w );
|
2008-05-18 16:44:30 +00:00
|
|
|
|
2008-02-14 17:18:00 +00:00
|
|
|
hig_workarea_finish( t, &row );
|
2008-06-06 23:48:17 +00:00
|
|
|
g_object_set_data_full( G_OBJECT( t ), "page", page, proxyPageFree );
|
|
|
|
|
|
|
|
refreshProxySensitivity( page );
|
2008-02-13 03:00:21 +00:00
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *
|
|
|
|
tr_prefs_dialog_new( GObject * core, GtkWindow * parent )
|
|
|
|
{
|
|
|
|
GtkWidget * d;
|
|
|
|
GtkWidget * n;
|
|
|
|
gboolean * alive;
|
|
|
|
|
|
|
|
alive = g_new( gboolean, 1 );
|
|
|
|
*alive = TRUE;
|
|
|
|
|
2008-04-12 14:40:13 +00:00
|
|
|
d = gtk_dialog_new_with_buttons( _( "Transmission Preferences" ), parent,
|
2008-02-13 03:00:21 +00:00
|
|
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
2008-05-09 03:20:34 +00:00
|
|
|
GTK_STOCK_HELP, GTK_RESPONSE_HELP,
|
2008-02-13 03:00:21 +00:00
|
|
|
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
|
|
|
|
NULL );
|
|
|
|
gtk_window_set_role( GTK_WINDOW(d), "transmission-preferences-dialog" );
|
|
|
|
gtk_dialog_set_has_separator( GTK_DIALOG( d ), FALSE );
|
|
|
|
gtk_container_set_border_width( GTK_CONTAINER( d ), GUI_PAD );
|
|
|
|
g_object_weak_ref( G_OBJECT( d ), dialogDestroyed, alive );
|
|
|
|
|
|
|
|
n = gtk_notebook_new( );
|
2008-04-12 14:40:13 +00:00
|
|
|
gtk_container_set_border_width ( GTK_CONTAINER ( n ), GUI_PAD );
|
2008-02-13 03:00:21 +00:00
|
|
|
|
2008-02-14 17:18:00 +00:00
|
|
|
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
|
|
|
|
torrentPage( core ),
|
|
|
|
gtk_label_new (_("Torrents")) );
|
|
|
|
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
|
2008-06-06 20:03:19 +00:00
|
|
|
peerPage( core, alive ),
|
2008-02-14 17:18:00 +00:00
|
|
|
gtk_label_new (_("Peers")) );
|
|
|
|
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
|
2008-06-06 20:03:19 +00:00
|
|
|
networkPage( core ),
|
2008-02-14 17:18:00 +00:00
|
|
|
gtk_label_new (_("Network")) );
|
2008-06-02 21:02:38 +00:00
|
|
|
gtk_notebook_append_page( GTK_NOTEBOOK( n ),
|
|
|
|
remotePage( core ),
|
|
|
|
gtk_label_new (_("Remote")) );
|
2008-02-13 03:00:21 +00:00
|
|
|
|
|
|
|
g_signal_connect( d, "response", G_CALLBACK(response_cb), core );
|
|
|
|
gtk_box_pack_start_defaults( GTK_BOX(GTK_DIALOG(d)->vbox), n );
|
2007-09-28 00:46:22 +00:00
|
|
|
gtk_widget_show_all( GTK_DIALOG(d)->vbox );
|
|
|
|
return d;
|
2007-02-19 22:09:05 +00:00
|
|
|
}
|