Changeset 11401


Ignore:
Timestamp:
Nov 13, 2010, 5:05:22 PM (11 years ago)
Author:
charles
Message:

(trunk gtk) #3697 "make blocklist URL configurable" -- better error handling in GTK+ client if the user-specified blocklist can't be fetched

Location:
trunk/gtk
Files:
2 edited

Legend:

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

    r11344 r11401  
    16941694{
    16951695    tr_benc * args;
    1696     int64_t ruleCount = 0;
     1696    int64_t ruleCount = -1;
    16971697
    16981698    if( tr_bencDictFindDict( response, "arguments", &args ) )
  • trunk/gtk/tr-prefs.c

    r11397 r11401  
    426426onBlocklistUpdated( TrCore * core, int n, gpointer gdata )
    427427{
    428     const char * s = gtr_ngettext( "Blocklist now has %'d rule.", "Blocklist now has %'d rules.", n );
     428    const tr_bool success = n >= 0;
     429    const int count = n >=0 ? n : tr_blocklistGetRuleCount( tr_core_session( core ) );
     430    const char * s = gtr_ngettext( "Blocklist has %'d rule.", "Blocklist has %'d rules.", count );
    429431    struct blocklist_data * data = gdata;
    430432    GtkMessageDialog * d = GTK_MESSAGE_DIALOG( data->updateBlocklistDialog );
    431433    gtk_widget_set_sensitive( data->updateBlocklistButton, TRUE );
    432     gtk_message_dialog_set_markup( d, _( "<b>Update succeeded!</b>" ) );
    433     gtk_message_dialog_format_secondary_text( d, s, n );
     434    gtk_message_dialog_set_markup( d, success ? _( "<b>Update succeeded!</b>" ) : _( "<b>Unable to update.</b>" ) );
     435    gtk_message_dialog_format_secondary_text( d, s, count );
    434436    updateBlocklistText( data->label, core );
    435437}
Note: See TracChangeset for help on using the changeset viewer.