Changeset 7272


Ignore:
Timestamp:
Dec 4, 2008, 5:05:34 PM (12 years ago)
Author:
charles
Message:

(gtk) undo r7271 damage: I checked in an extra file I didn't intend to.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr-window.c

    r7271 r7272  
    8484    GtkWidget *           stats_lb;
    8585    GtkWidget *           gutter_lb;
    86     GSList *              toggles;
    8786    GtkTreeSelection *    selection;
    8887    GtkCellRenderer *     renderer;
     
    258257};
    259258
    260 const char *  filter_names[FILTER_MODE_QTY] = {
    261     /* show all torrents */
    262     N_( "A_ll" ),
    263     /* show only torrents that have connected peers */
    264     N_( "_Active" ),
    265     /* show only torrents that are trying to download */
    266     N_( "_Downloading" ),
    267     /* show only torrents that are trying to upload */
    268     N_( "_Seeding" ),
    269     /* show only torrents that are paused */
    270     N_( "_Paused" )
    271 };
    272 
    273259static void
    274260status_menu_toggled_cb( GtkCheckMenuItem * menu_item,
     
    394380        refilter( p );
    395381    }
    396 }
    397 
    398 static void
    399 update_toggle( GtkToggleButton * toggle,
    400                    gpointer          vprivate )
    401 {
    402     PrivateData *       p = vprivate;
    403     GtkWidget * l;
    404     const filter_mode_t mode =
    405             GPOINTER_TO_UINT( g_object_get_data( G_OBJECT( toggle ),
    406                                          FILTER_MODE_KEY ) );
    407     const char * mnemonic  = (char *) g_object_get_data( G_OBJECT( toggle ), "title");
    408 
    409     char buf[128];
    410     int filtercount = 0;
    411 
    412     tr_session * session = tr_core_session(p->core);
    413     tr_torrent * torrent = tr_torrentNext(session, 0);
    414 
    415     while (torrent) {
    416         if (checkFilterMode(mode, torrent))
    417             filtercount++;
    418         torrent = tr_torrentNext(session, torrent);
    419     }
    420 
    421     l = gtk_bin_get_child( GTK_BIN( toggle ) );
    422     if( filtercount )
    423         g_snprintf( buf, sizeof( buf ), "%s (%d)", mnemonic, filtercount );
    424     else
    425         g_snprintf( buf, sizeof( buf ), "%s", mnemonic );
    426     gtk_label_set_markup_with_mnemonic( GTK_LABEL( l ), buf );
    427 
    428 //ccc
    429   //  gtk_button_set_label( GTK_BUTTON( toggle ), buf);
    430382}
    431383
     
    443395        GPOINTER_TO_UINT( g_object_get_data( G_OBJECT( toggle ),
    444396                                             FILTER_MODE_KEY ) );
    445    
     397
    446398    /* update the filter */
    447399    if( isActive )
     
    455407    {
    456408        GtkToggleButton * walk = GTK_TOGGLE_BUTTON( l->data );
    457         update_toggle(walk, vprivate);
    458409        if( isActive && ( toggle != walk ) )
    459410            gtk_toggle_button_set_active( walk, FALSE );
     
    558509    GSList *      l;
    559510    GSList *      toggles;
    560 
     511    const char *  filter_names[FILTER_MODE_QTY] = {
     512        /* show all torrents */
     513        N_( "A_ll" ),
     514        /* show only torrents that have connected peers */
     515        N_( "_Active" ),
     516        /* show only torrents that are trying to download */
     517        N_( "_Downloading" ),
     518        /* show only torrents that are trying to upload */
     519        N_( "_Seeding" ),
     520        /* show only torrents that are paused */
     521        N_( "_Paused" )
     522    };
    561523    const char *  filter_text_names[FILTER_TEXT_MODE_QTY] = {
    562524        N_( "Name" ), N_( "Files" ), N_( "Tracker" )
     
    602564    /* filter */
    603565    toggles = NULL;
    604     h = p->filter = gtk_hbox_new( FALSE, GUI_PAD );
     566    h = p->filter = gtk_hbox_new( FALSE, 0 );
    605567    gtk_container_set_border_width( GTK_CONTAINER( h ), GUI_PAD_SMALL );
    606568    for( i = 0; i < FILTER_MODE_QTY; ++i )
    607569    {
    608570        const char * mnemonic = _( filter_names[i] );
    609         GtkWidget * label;
    610         w = gtk_toggle_button_new( );
    611         label = gtk_label_new_with_mnemonic( mnemonic );
    612         gtk_container_add( GTK_CONTAINER( w ), label );
    613         g_object_set_data( G_OBJECT( w ), FILTER_MODE_KEY, GINT_TO_POINTER( i ) );
     571        w = gtk_toggle_button_new_with_mnemonic( mnemonic );
     572        g_object_set_data( G_OBJECT( w ), FILTER_MODE_KEY,
     573                          GINT_TO_POINTER( i ) );
    614574        gtk_button_set_relief( GTK_BUTTON( w ), GTK_RELIEF_NONE );
    615         gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( w ), i == FILTER_MODE_ALL );
     575        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(
     576                                          w ), i == FILTER_MODE_ALL );
    616577        toggles = g_slist_prepend( toggles, w );
    617578        g_signal_connect( w, "toggled", G_CALLBACK( filter_toggled_cb ), p );
    618579        gtk_box_pack_start( GTK_BOX( h ), w, FALSE, FALSE, 0 );
    619         g_object_set_data( G_OBJECT( w ), "title", mnemonic);
    620580    }
    621581    for( l = toggles; l != NULL; l = l->next )
    622582        g_object_set_data( G_OBJECT( l->data ), FILTER_TOGGLES_KEY, toggles );
    623     p->toggles = toggles;
    624583    s = sexy_icon_entry_new( );
    625584    sexy_icon_entry_add_clear_button( SEXY_ICON_ENTRY( s ) );
     
    728687
    729688    filter_entry_changed( GTK_EDITABLE( s ), p );
    730    
    731     for( l = toggles; l != NULL; l = l->next ) {
    732         update_toggle(GTK_TOGGLE_BUTTON( l->data ), p);
    733     }
    734689    return self;
    735690}
     
    832787{
    833788    PrivateData * p = get_private_data( self );
    834     GSList *      l;   
    835789
    836790    if( p && p->core && tr_core_session( p->core ) )
     
    840794        updateStats( p );
    841795        refilter( p );
    842         for( l = p->toggles; l != NULL; l = l->next ) {
    843             update_toggle(GTK_TOGGLE_BUTTON( l->data ), p);
    844         }
    845796    }
    846797}
Note: See TracChangeset for help on using the changeset viewer.