Changeset 9259 for trunk/gtk/details.c
- Timestamp:
- Oct 10, 2009, 12:17:00 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gtk/details.c
r9253 r9259 1613 1613 if( pch ) 1614 1614 host = pch + 3; 1615 g_string_append( gstr, st->is Active ? "<b>" : "<i>" );1615 g_string_append( gstr, st->isBackup ? "<i>" : "<b>" ); 1616 1616 if( key ) 1617 1617 str = g_markup_printf_escaped( "%s - %s", host, key ); … … 1620 1620 g_string_append( gstr, str ); 1621 1621 g_free( str ); 1622 g_string_append( gstr, st->isActive ? "</b>" : "</i>" ); 1623 } 1624 1625 if( st->isActive && st->hasAnnounced ) { 1626 g_string_append_c( gstr, '\n' ); 1627 tr_strltime_rounded( timebuf, now - st->lastAnnounceTime, sizeof( timebuf ) ); 1628 if( st->lastAnnounceSucceeded ) 1629 g_string_append_printf( gstr, _( "Got a list of %s%'d peers%s %s ago" ), 1630 success_markup_begin, st->lastAnnouncePeerCount, success_markup_end, 1631 timebuf ); 1632 else 1633 g_string_append_printf( gstr, _( "Got an error %s\"%s\"%s %s ago" ), 1634 err_markup_begin, st->lastAnnounceResult, err_markup_end, 1635 timebuf ); 1636 } 1637 1638 if( st->isActive ) switch( st->announceState ) { 1639 case TR_TRACKER_INACTIVE: 1640 if( !st->hasAnnounced ) { 1641 g_string_append_c( gstr, '\n' ); 1642 g_string_append( gstr, _( "No updates scheduled" ) ); 1643 } 1644 break; 1645 case TR_TRACKER_WAITING: 1646 tr_strltime_rounded( timebuf, st->nextAnnounceTime - now, sizeof( timebuf ) ); 1622 g_string_append( gstr, st->isBackup ? "</i>" : "</b>" ); 1623 } 1624 1625 if( !st->isBackup ) 1626 { 1627 if( st->hasAnnounced ) 1628 { 1647 1629 g_string_append_c( gstr, '\n' ); 1648 g_string_append_printf( gstr, _( "Asking for more peers in %s" ), timebuf ); 1649 break; 1650 case TR_TRACKER_QUEUED: 1651 g_string_append_c( gstr, '\n' ); 1652 g_string_append( gstr, _( "Queued to ask for more peers" ) ); 1653 break; 1654 case TR_TRACKER_ACTIVE: 1655 tr_strltime_rounded( timebuf, now - st->lastAnnounceStartTime, sizeof( timebuf ) ); 1656 g_string_append_printf( gstr, _( "Asking for more peers now... <small>%s</small>" ), timebuf ); 1657 break; 1658 } 1659 1660 if( st->isActive && showScrape ) 1661 { 1662 if( st->hasScraped ) { 1663 g_string_append_c( gstr, '\n' ); 1664 tr_strltime_rounded( timebuf, now - st->lastScrapeTime, sizeof( timebuf ) ); 1665 if( st->lastScrapeSucceeded ) 1666 g_string_append_printf( gstr, _( "Tracker had %s%'d seeders and %'d leechers%s %s ago" ), 1667 success_markup_begin, st->seederCount, st->leecherCount, success_markup_end, 1630 tr_strltime_rounded( timebuf, now - st->lastAnnounceTime, sizeof( timebuf ) ); 1631 if( st->lastAnnounceSucceeded ) 1632 g_string_append_printf( gstr, _( "Got a list of %s%'d peers%s %s ago" ), 1633 success_markup_begin, st->lastAnnouncePeerCount, success_markup_end, 1668 1634 timebuf ); 1669 1635 else 1670 g_string_append_printf( gstr, _( "Got a scrape error \"%s%s%s\" %s ago" ), err_markup_begin, st->lastScrapeResult, err_markup_end, timebuf ); 1671 } 1672 1673 switch( st->scrapeState ) 1636 g_string_append_printf( gstr, _( "Got an error %s\"%s\"%s %s ago" ), 1637 err_markup_begin, st->lastAnnounceResult, err_markup_end, 1638 timebuf ); 1639 } 1640 1641 switch( st->announceState ) 1674 1642 { 1675 1643 case TR_TRACKER_INACTIVE: 1644 if( !st->hasAnnounced ) { 1645 g_string_append_c( gstr, '\n' ); 1646 g_string_append( gstr, _( "No updates scheduled" ) ); 1647 } 1676 1648 break; 1677 1649 case TR_TRACKER_WAITING: 1650 tr_strltime_rounded( timebuf, st->nextAnnounceTime - now, sizeof( timebuf ) ); 1678 1651 g_string_append_c( gstr, '\n' ); 1679 tr_strltime_rounded( timebuf, now - st->lastScrapeStartTime, sizeof( timebuf ) ); 1680 g_string_append_printf( gstr, _( "Asking for peer counts now... <small>%s</small>" ), timebuf ); 1652 g_string_append_printf( gstr, _( "Asking for more peers in %s" ), timebuf ); 1681 1653 break; 1682 1654 case TR_TRACKER_QUEUED: 1683 1655 g_string_append_c( gstr, '\n' ); 1684 g_string_append( gstr, _( "Queued to ask for peer counts" ) );1656 g_string_append( gstr, _( "Queued to ask for more peers" ) ); 1685 1657 break; 1686 1658 case TR_TRACKER_ACTIVE: 1659 tr_strltime_rounded( timebuf, now - st->lastAnnounceStartTime, sizeof( timebuf ) ); 1660 g_string_append_printf( gstr, _( "Asking for more peers now... <small>%s</small>" ), timebuf ); 1661 break; 1662 } 1663 1664 if( showScrape ) 1665 { 1666 if( st->hasScraped ) { 1687 1667 g_string_append_c( gstr, '\n' ); 1688 tr_strltime_rounded( timebuf, st->nextScrapeTime - now, sizeof( timebuf ) ); 1689 g_string_append_printf( gstr, _( "Asking for peer counts in %s" ), timebuf ); 1690 break; 1668 tr_strltime_rounded( timebuf, now - st->lastScrapeTime, sizeof( timebuf ) ); 1669 if( st->lastScrapeSucceeded ) 1670 g_string_append_printf( gstr, _( "Tracker had %s%'d seeders and %'d leechers%s %s ago" ), 1671 success_markup_begin, st->seederCount, st->leecherCount, success_markup_end, 1672 timebuf ); 1673 else 1674 g_string_append_printf( gstr, _( "Got a scrape error \"%s%s%s\" %s ago" ), err_markup_begin, st->lastScrapeResult, err_markup_end, timebuf ); 1675 } 1676 1677 switch( st->scrapeState ) 1678 { 1679 case TR_TRACKER_INACTIVE: 1680 break; 1681 case TR_TRACKER_WAITING: 1682 g_string_append_c( gstr, '\n' ); 1683 tr_strltime_rounded( timebuf, now - st->lastScrapeStartTime, sizeof( timebuf ) ); 1684 g_string_append_printf( gstr, _( "Asking for peer counts now... <small>%s</small>" ), timebuf ); 1685 break; 1686 case TR_TRACKER_QUEUED: 1687 g_string_append_c( gstr, '\n' ); 1688 g_string_append( gstr, _( "Queued to ask for peer counts" ) ); 1689 break; 1690 case TR_TRACKER_ACTIVE: 1691 g_string_append_c( gstr, '\n' ); 1692 tr_strltime_rounded( timebuf, st->nextScrapeTime - now, sizeof( timebuf ) ); 1693 g_string_append_printf( gstr, _( "Asking for peer counts in %s" ), timebuf ); 1694 break; 1695 } 1691 1696 } 1692 1697 } … … 1700 1705 TRACKER_COL_TRACKER_INDEX, 1701 1706 TRACKER_COL_TEXT, 1702 TRACKER_COL_ ACTIVE,1707 TRACKER_COL_BACKUP, 1703 1708 TRACKER_COL_TORRENT_NAME, 1704 1709 TRACKER_COL_TRACKER_NAME, … … 1709 1714 trackerVisibleFunc( GtkTreeModel * model, GtkTreeIter * iter, gpointer data ) 1710 1715 { 1711 gboolean active;1716 gboolean isBackup; 1712 1717 struct DetailsImpl * di = data; 1713 1718 … … 1716 1721 return TRUE; 1717 1722 1718 /* only showing the active ones... */1719 gtk_tree_model_get( model, iter, TRACKER_COL_ ACTIVE, &active, -1 );1720 return active;1723 /* don't show the backups... */ 1724 gtk_tree_model_get( model, iter, TRACKER_COL_BACKUP, &isBackup, -1 ); 1725 return !isBackup; 1721 1726 } 1722 1727 … … 1827 1832 char * text = buildTrackerSummary( key, st, showScrape ); 1828 1833 gtk_list_store_set( store, &iter, TRACKER_COL_TEXT, text, 1829 TRACKER_COL_ ACTIVE, st->isActive,1834 TRACKER_COL_BACKUP, st->isBackup, 1830 1835 -1 ); 1831 1836 g_free( text );
Note: See TracChangeset
for help on using the changeset viewer.