Changeset 6149


Ignore:
Timestamp:
Jun 11, 2008, 9:05:13 PM (13 years ago)
Author:
charles
Message:

blarg

Location:
trunk/gtk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r6148 r6149  
    984984    {
    985985        int i = pref_int_get( key );
     986g_message( "new type is %d", i );
    986987        tr_sessionSetProxyType( tr, i );
    987988    }
  • trunk/gtk/tr-prefs.c

    r6148 r6149  
    893893struct ProxyPage
    894894{
     895    TrCore * core;
    895896    GSList * proxy_widgets;
    896897    GSList * proxy_auth_widgets;
     
    927928}
    928929
     930static GtkTreeModel*
     931proxyTypeModelNew( void )
     932{
     933    GtkTreeIter iter;
     934    GtkListStore * store = gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_INT );
     935    gtk_list_store_append( store, &iter );
     936    gtk_list_store_set( store, &iter, 0, _( "HTTP" ), 1, TR_PROXY_HTTP, -1 );
     937    gtk_list_store_append( store, &iter );
     938    gtk_list_store_set( store, &iter, 0, _( "SOCKS4" ), 1, TR_PROXY_SOCKS4, -1 );
     939    gtk_list_store_append( store, &iter );
     940    gtk_list_store_set( store, &iter, 0, _( "SOCKS5" ), 1, TR_PROXY_SOCKS5, -1 );
     941    return GTK_TREE_MODEL( store );
     942}
     943
     944static void
     945onProxyTypeChanged( GtkComboBox * w, gpointer gpage )
     946{
     947    GtkTreeIter iter;
     948    if( gtk_combo_box_get_active_iter( w, &iter ) )
     949    {
     950        struct ProxyPage * page = gpage;
     951        int type = TR_PROXY_HTTP;
     952        gtk_tree_model_get( gtk_combo_box_get_model( w ), &iter, 1, &type, -1 );
     953        tr_core_set_pref_int( TR_CORE( page->core ), PREF_KEY_PROXY_TYPE, type );
     954    }
     955}
     956
    929957static GtkWidget*
    930958networkPage( GObject * core )
     
    934962    GtkWidget * t;
    935963    GtkWidget * w, * w2;
     964    GtkTreeModel * m;
     965    GtkCellRenderer * r;
    936966    struct ProxyPage * page = tr_new0( struct ProxyPage, 1 );
    937967
     968    page->core = TR_CORE( core );
     969
    938970    t = hig_workarea_create( );
    939 
    940971    hig_workarea_add_section_title (t, &row, _( "Router" ) );
    941972
     
    9711002        s = _( "Proxy server:" );
    9721003        w = new_entry( PREF_KEY_PROXY_SERVER, core );
     1004        page->proxy_widgets = g_slist_append( page->proxy_widgets, w );
     1005        w = hig_workarea_add_row( t, &row, s, w, NULL );
     1006        page->proxy_widgets = g_slist_append( page->proxy_widgets, w );
     1007
     1008        s = _( "Proxy type:" );
     1009        m = proxyTypeModelNew( );
     1010        w = gtk_combo_box_new_with_model( m );
     1011        r = gtk_cell_renderer_text_new( );
     1012        gtk_cell_layout_pack_start( GTK_CELL_LAYOUT( w ), r, TRUE );
     1013        gtk_cell_layout_set_attributes( GTK_CELL_LAYOUT( w ), r, "text", 0, NULL );
     1014        gtk_combo_box_set_active( GTK_COMBO_BOX( w ), pref_int_get( PREF_KEY_PROXY_TYPE ) );
     1015        g_signal_connect( w, "changed", G_CALLBACK(onProxyTypeChanged), NULL );
     1016        g_object_unref( G_OBJECT( m ) );
    9731017        page->proxy_widgets = g_slist_append( page->proxy_widgets, w );
    9741018        w = hig_workarea_add_row( t, &row, s, w, NULL );
Note: See TracChangeset for help on using the changeset viewer.