Changeset 5590


Ignore:
Timestamp:
Apr 12, 2008, 1:36:31 AM (14 years ago)
Author:
charles
Message:

(gtk) #860: Nobody knows what the UI DEI etc. it the Details>Peers status column mean

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r5491 r5590  
    479479}
    480480
    481 static GtkWidget* peer_page_new ( TrTorrent * gtor )
     481#if GTK_CHECK_VERSION(2,12,0)
     482static gboolean
     483onPeerViewQueryTooltip( GtkWidget  * widget,
     484                        gint         x,
     485                        gint         y,
     486                        gboolean     keyboard_tip,
     487                        GtkTooltip * tooltip,
     488                        gpointer     user_data UNUSED )
     489{
     490    gboolean show_tip = FALSE;
     491    GtkTreeModel * model;
     492    GtkTreeIter iter;
     493
     494    if( gtk_tree_view_get_tooltip_context( GTK_TREE_VIEW( widget ),
     495                                           &x, &y, keyboard_tip,
     496                                           &model, NULL, &iter ) )
     497    {
     498        const char * pch;
     499        char * str = NULL;
     500        GString * gstr = g_string_new( NULL );
     501        gtk_tree_model_get( model, &iter, PEER_COL_STATUS, &str, -1 );
     502        for( pch=str; pch && *pch; ++pch ) {
     503            const char * txt = NULL;
     504            switch( *pch ) {
     505                case 'O': txt = _( "Optimistic unchoke" ); break;
     506                case 'D': txt = _( "Downloading from peer" ); break;
     507                case 'd': txt = _( "We'd download from peer if they'd let us" ); break;
     508                case 'U': txt = _( "Uploading to peer" ); break;
     509                case 'u': txt = _( "Peer would download from us if we'd let them" ); break;
     510                case 'K': txt = _( "Peer has unchoked use, but we're not interested" ); break;
     511                case '?': txt = _( "We unchoked the peer, but they're not interested" ); break;
     512                case 'E': txt = _( "Using encryption to communicate with peer" ); break;
     513                case 'X': txt = _( "Peer was discovered through Peer Exchange (PEX)" ); break;
     514                case 'I': txt = _( "Peer is an incoming connection" ); break;
     515            }
     516            if( txt )
     517                g_string_append_printf( gstr, "%c: %s\n", *pch, txt );
     518        }
     519        if( gstr->len ) /* remove the last linefeed */
     520            g_string_set_size( gstr, gstr->len-1 );
     521        gtk_tooltip_set_text( tooltip, gstr->str );
     522        g_string_free( gstr, TRUE );
     523        g_free( str );
     524        show_tip = TRUE;
     525    }
     526
     527    return show_tip;
     528
     529}
     530#endif
     531
     532static GtkWidget*
     533peer_page_new ( TrTorrent * gtor )
    482534{
    483535  guint i;
     
    497549
    498550  m  = peer_model_new (tor);
    499   v = gtk_tree_view_new_with_model (m);
     551  v = GTK_WIDGET( g_object_new( GTK_TYPE_TREE_VIEW,
     552                                "model", m,
     553                                "rules-hint", TRUE,
     554#if GTK_CHECK_VERSION(2,12,0)
     555                                "has-tooltip", TRUE,
     556#endif
     557                                NULL ) );
     558#if GTK_CHECK_VERSION(2,12,0)
     559  g_signal_connect( v, "query-tooltip",
     560                    G_CALLBACK(onPeerViewQueryTooltip), NULL );
     561#endif
    500562  gtk_widget_set_size_request( v, 550, 0 );
    501   gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(v), TRUE);
    502563  g_object_unref (G_OBJECT(m));
    503564
Note: See TracChangeset for help on using the changeset viewer.