From: Jordan Lee Date: Mon, 2 May 2011 17:58:27 +0000 (+0000) Subject: (trunk gtk) use ngettext() instead of gtr_dngettext() to address https://bugs.launchp... X-Git-Tag: 2.30~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=45bdc18210a2601596eb4df90481d00464650870;p=transmission (trunk gtk) use ngettext() instead of gtr_dngettext() to address https://bugs.launchpad.net/ubuntu/+source/transmission/+bug/760761 --- diff --git a/gtk/details.c b/gtk/details.c index 70cb443ca..e2b6cc869 100644 --- a/gtk/details.c +++ b/gtk/details.c @@ -772,13 +772,13 @@ refreshInfo( struct DetailsImpl * di, tr_torrent ** torrents, int n ) char piecebuf[128]; tr_formatter_mem_B( piecebuf, pieceSize, sizeof( piecebuf ) ); g_snprintf( buf, sizeof( buf ), - gtr_ngettext( "%1$s (%2$'d piece @ %3$s)", + ngettext( "%1$s (%2$'d piece @ %3$s)", "%1$s (%2$'d pieces @ %3$s)", pieces ), sizebuf, pieces, piecebuf ); str = buf; } else { g_snprintf( buf, sizeof( buf ), - gtr_ngettext( "%1$s (%2$'d piece)", + ngettext( "%1$s (%2$'d piece)", "%1$s (%2$'d pieces)", pieces ), sizebuf, pieces ); str = buf; diff --git a/gtk/dialogs.c b/gtk/dialogs.c index b4fc13ffd..1644ecad9 100644 --- a/gtk/dialogs.c +++ b/gtk/dialogs.c @@ -92,50 +92,50 @@ gtr_confirm_remove( GtkWindow * parent, if( !delete_files ) { - g_string_printf( primary_text, gtr_ngettext( "Remove torrent?", - "Remove %d torrents?", - count ), count ); + g_string_printf( primary_text, ngettext( "Remove torrent?", + "Remove %d torrents?", + count ), count ); } else { - g_string_printf( primary_text, gtr_ngettext( "Delete this torrent's downloaded files?", - "Delete these %d torrents' downloaded files?", - count ), count ); + g_string_printf( primary_text, ngettext( "Delete this torrent's downloaded files?", + "Delete these %d torrents' downloaded files?", + count ), count ); } secondary_text = g_string_new( NULL ); if( !incomplete && !connected ) { - g_string_assign( secondary_text, gtr_ngettext( + g_string_assign( secondary_text, ngettext( "Once removed, continuing the transfer will require the torrent file or magnet link.", "Once removed, continuing the transfers will require the torrent files or magnet links.", count ) ); } else if( count == incomplete ) { - g_string_assign( secondary_text, gtr_ngettext( "This torrent has not finished downloading.", - "These torrents have not finished downloading.", - count ) ); + g_string_assign( secondary_text, ngettext( "This torrent has not finished downloading.", + "These torrents have not finished downloading.", + count ) ); } else if( count == connected ) { - g_string_assign( secondary_text, gtr_ngettext( "This torrent is connected to peers.", - "These torrents are connected to peers.", - count ) ); + g_string_assign( secondary_text, ngettext( "This torrent is connected to peers.", + "These torrents are connected to peers.", + count ) ); } else { if( connected ) - g_string_append( secondary_text, gtr_ngettext( "One of these torrents is connected to peers.", - "Some of these torrents are connected to peers.", + g_string_append( secondary_text, ngettext( "One of these torrents is connected to peers.", + "Some of these torrents are connected to peers.", connected ) ); if( connected && incomplete ) g_string_append( secondary_text, "\n" ); if( incomplete ) - g_string_assign( secondary_text, gtr_ngettext( "One of these torrents has not finished downloading.", - "Some of these torrents have not finished downloading.", + g_string_assign( secondary_text, ngettext( "One of these torrents has not finished downloading.", + "Some of these torrents have not finished downloading.", incomplete ) ); } diff --git a/gtk/main.c b/gtk/main.c index 3472a7c22..f2e454f21 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1340,16 +1340,16 @@ flush_torrent_errors( struct cbdata * cbdata ) { if( cbdata->error_list ) show_torrent_errors( cbdata->wind, - gtr_ngettext( "Couldn't add corrupt torrent", - "Couldn't add corrupt torrents", - g_slist_length( cbdata->error_list ) ), + ngettext( "Couldn't add corrupt torrent", + "Couldn't add corrupt torrents", + g_slist_length( cbdata->error_list ) ), &cbdata->error_list ); if( cbdata->duplicates_list ) show_torrent_errors( cbdata->wind, - gtr_ngettext( "Couldn't add duplicate torrent", - "Couldn't add duplicate torrents", - g_slist_length( cbdata->duplicates_list ) ), + ngettext( "Couldn't add duplicate torrent", + "Couldn't add duplicate torrents", + g_slist_length( cbdata->duplicates_list ) ), &cbdata->duplicates_list ); } diff --git a/gtk/makemeta-ui.c b/gtk/makemeta-ui.c index 7788ce6e4..3dac32986 100644 --- a/gtk/makemeta-ui.c +++ b/gtk/makemeta-ui.c @@ -295,16 +295,16 @@ updatePiecesLabel( MakeMetaUI * ui ) { char buf[128]; tr_strlsize( buf, builder->totalSize, sizeof( buf ) ); - g_string_append_printf( gstr, gtr_ngettext( "%1$s; %2$'d File", - "%1$s; %2$'d Files", - builder->fileCount ), + g_string_append_printf( gstr, ngettext( "%1$s; %2$'d File", + "%1$s; %2$'d Files", + builder->fileCount ), buf, builder->fileCount ); g_string_append( gstr, "; " ); tr_formatter_mem_B( buf, builder->pieceSize, sizeof( buf ) ); - g_string_append_printf( gstr, gtr_ngettext( "%1$'d Piece @ %2$s", - "%1$'d Pieces @ %2$s", - builder->pieceCount ), + g_string_append_printf( gstr, ngettext( "%1$'d Piece @ %2$s", + "%1$'d Pieces @ %2$s", + builder->pieceCount ), builder->pieceCount, buf ); } g_string_append( gstr, "" ); diff --git a/gtk/stats.c b/gtk/stats.c index cbf81ed99..2f51459ea 100644 --- a/gtk/stats.c +++ b/gtk/stats.c @@ -69,8 +69,8 @@ updateStats( gpointer gdata ) setLabel( ui->one_time_lb, tr_strltime( buf, one.secondsActive, buflen ) ); setLabelFromRatio( ui->one_ratio_lb, one.ratio ); - fmt = gtr_ngettext( "Started %'d time", "Started %'d times", - (int)all.sessionCount ); + fmt = ngettext( "Started %'d time", "Started %'d times", + (int)all.sessionCount ); g_snprintf( buf, buflen, fmt, (int)all.sessionCount ); setLabel( ui->all_sessions_lb, buf ); setLabel( ui->all_up_lb, tr_strlsize( buf, all.uploadedBytes, buflen ) ); diff --git a/gtk/torrent-cell-renderer.c b/gtk/torrent-cell-renderer.c index e62284c2a..3cf3ff3c3 100644 --- a/gtk/torrent-cell-renderer.c +++ b/gtk/torrent-cell-renderer.c @@ -279,18 +279,18 @@ getStatusString( GString * gstr, if( tr_torrentHasMetadata( tor ) ) { g_string_append_printf( gstr, - gtr_ngettext( "Downloading from %1$'d of %2$'d connected peer", - "Downloading from %1$'d of %2$'d connected peers", - st->webseedsSendingToUs + st->peersSendingToUs ), + ngettext( "Downloading from %1$'d of %2$'d connected peer", + "Downloading from %1$'d of %2$'d connected peers", + st->webseedsSendingToUs + st->peersSendingToUs ), st->webseedsSendingToUs + st->peersSendingToUs, st->webseedsSendingToUs + st->peersConnected ); } else { g_string_append_printf( gstr, - gtr_ngettext( "Downloading metadata from %1$'d peer (%2$d%% done)", - "Downloading metadata from %1$'d peers (%2$d%% done)", - st->peersConnected + st->peersConnected ), + ngettext( "Downloading metadata from %1$'d peer (%2$d%% done)", + "Downloading metadata from %1$'d peers (%2$d%% done)", + st->peersConnected + st->peersConnected ), st->peersConnected + st->webseedsSendingToUs, (int)(100.0*st->metadataPercentComplete) ); } @@ -299,9 +299,9 @@ getStatusString( GString * gstr, case TR_STATUS_SEED: g_string_append_printf( gstr, - gtr_ngettext( "Seeding to %1$'d of %2$'d connected peer", - "Seeding to %1$'d of %2$'d connected peers", - st->peersConnected ), + ngettext( "Seeding to %1$'d of %2$'d connected peer", + "Seeding to %1$'d of %2$'d connected peers", + st->peersConnected ), st->peersGettingFromUs, st->peersConnected ); break; diff --git a/gtk/tr-prefs.c b/gtk/tr-prefs.c index 28907e581..a207911ca 100644 --- a/gtk/tr-prefs.c +++ b/gtk/tr-prefs.c @@ -394,8 +394,8 @@ updateBlocklistText( GtkWidget * w, TrCore * core ) char buf2[512]; const int n = tr_blocklistGetRuleCount( gtr_core_session( core ) ); g_snprintf( buf1, sizeof( buf1 ), - gtr_ngettext( "Blocklist contains %'d rule", - "Blocklist contains %'d rules", n ), n ); + ngettext( "Blocklist contains %'d rule", + "Blocklist contains %'d rules", n ), n ); g_snprintf( buf2, sizeof( buf2 ), "%s", buf1 ); gtk_label_set_markup( GTK_LABEL( w ), buf2 ); } @@ -427,7 +427,7 @@ onBlocklistUpdated( TrCore * core, int n, gpointer gdata ) { const bool success = n >= 0; const int count = n >=0 ? n : tr_blocklistGetRuleCount( gtr_core_session( core ) ); - const char * s = gtr_ngettext( "Blocklist has %'d rule.", "Blocklist has %'d rules.", count ); + const char * s = ngettext( "Blocklist has %'d rule.", "Blocklist has %'d rules.", count ); struct blocklist_data * data = gdata; GtkMessageDialog * d = GTK_MESSAGE_DIALOG( data->updateBlocklistDialog ); gtk_widget_set_sensitive( data->updateBlocklistButton, TRUE ); diff --git a/gtk/tr-window.c b/gtk/tr-window.c index c2996b5a1..2215abede 100644 --- a/gtk/tr-window.c +++ b/gtk/tr-window.c @@ -748,13 +748,13 @@ updateTorrentCount( PrivateData * p ) *buf = '\0'; else if( torrentCount != visibleCount ) g_snprintf( buf, sizeof( buf ), - gtr_ngettext( "%1$'d of %2$'d Torrent", - "%1$'d of %2$'d Torrents", - torrentCount ), + ngettext( "%1$'d of %2$'d Torrent", + "%1$'d of %2$'d Torrents", + torrentCount ), visibleCount, torrentCount ); else g_snprintf( buf, sizeof( buf ), - gtr_ngettext( "%'d Torrent", "%'d Torrents", torrentCount ), + ngettext( "%'d Torrent", "%'d Torrents", torrentCount ), torrentCount ); gtr_label_set_text( GTK_LABEL( p->gutter_lb ), buf ); } diff --git a/gtk/util.c b/gtk/util.c index c792e86bc..5463a5b45 100644 --- a/gtk/util.c +++ b/gtk/util.c @@ -160,10 +160,10 @@ tr_strltime( char * buf, int seconds, size_t buflen ) minutes = ( seconds % 3600 ) / 60; seconds = ( seconds % 3600 ) % 60; - g_snprintf( d, sizeof( d ), gtr_ngettext( "%'d day", "%'d days", days ), days ); - g_snprintf( h, sizeof( h ), gtr_ngettext( "%'d hour", "%'d hours", hours ), hours ); - g_snprintf( m, sizeof( m ), gtr_ngettext( "%'d minute", "%'d minutes", minutes ), minutes ); - g_snprintf( s, sizeof( s ), gtr_ngettext( "%'d second", "%'d seconds", seconds ), seconds ); + g_snprintf( d, sizeof( d ), ngettext( "%'d day", "%'d days", days ), days ); + g_snprintf( h, sizeof( h ), ngettext( "%'d hour", "%'d hours", hours ), hours ); + g_snprintf( m, sizeof( m ), ngettext( "%'d minute", "%'d minutes", minutes ), minutes ); + g_snprintf( s, sizeof( s ), ngettext( "%'d second", "%'d seconds", seconds ), seconds ); if( days ) { @@ -373,18 +373,6 @@ gtr_object_ref_sink( gpointer object ) return object; } -const gchar * -gtr_ngettext( const gchar * msgid, - const gchar * msgid_plural, - gulong n ) -{ -#if GLIB_CHECK_VERSION( 2, 18, 0 ) - return g_dngettext( NULL, msgid, msgid_plural, n ); -#else - return ngettext( msgid, msgid_plural, n ); -#endif -} - int gtr_file_trash_or_remove( const char * filename ) { diff --git a/gtk/util.h b/gtk/util.h index e6cd07aab..783fbd0db 100644 --- a/gtk/util.h +++ b/gtk/util.h @@ -132,9 +132,6 @@ void gtr_widget_set_visible( GtkWidget *, gboolean ); /* backwards-compatible wrapper around g_object_ref_sink() */ gpointer gtr_object_ref_sink( gpointer object ); -/* backwards-compatible wrapper around g_dngettext() */ -const gchar* gtr_ngettext( const gchar*, const gchar*, gulong ); - void gtr_dialog_set_content( GtkDialog * dialog, GtkWidget * content ); /***