]> granicus.if.org Git - transmission/commitdiff
(trunk gtk) use ngettext() instead of gtr_dngettext() to address https://bugs.launchp...
authorJordan Lee <jordan@transmissionbt.com>
Mon, 2 May 2011 17:58:27 +0000 (17:58 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Mon, 2 May 2011 17:58:27 +0000 (17:58 +0000)
gtk/details.c
gtk/dialogs.c
gtk/main.c
gtk/makemeta-ui.c
gtk/stats.c
gtk/torrent-cell-renderer.c
gtk/tr-prefs.c
gtk/tr-window.c
gtk/util.c
gtk/util.h

index 70cb443ca86857029217dbba87164f1ec280a2e0..e2b6cc869f5a2e8d07bb2c1a9121240c2ac5f251 100644 (file)
@@ -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;
index b4fc13ffd07be21e79483b3388cd0bdd000cd9f7..1644ecad94a26eea17e349128c0705a697495f88 100644 (file)
@@ -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 ) );
     }
 
index 3472a7c224aed65ca761bbbcbafcf19787bd7498..f2e454f214ed4ea4e16abbc51cda2c73a26d1541 100644 (file)
@@ -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 );
 }
 
index 7788ce6e487f5ef6992b1481a1eacd8cd06466e5..3dac3298619b5b95569da926759efe389d7acba6 100644 (file)
@@ -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, "</i>" );
index cbf81ed99e0f1d5338a62cafb0c6c6598df22dee..2f51459eaea964d8a0f651a0cfc211102152f1fc 100644 (file)
@@ -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 ) );
index e62284c2a22bac561686145714cdeccc53a95ec1..3cf3ff3c39fe4673a68e5b10d61c59273a8d1b20 100644 (file)
@@ -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;
index 28907e5811f8ddb18444bc74560aa01f958fd81e..a207911ca10b512cdb14cdb0d704d2116b0831ee 100644 (file)
@@ -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 ), "<i>%s</i>", 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 );
index c2996b5a13da5a42d1b4d841400e5334257b0d70..2215abede8a5c36528f0000b9d00615fb06061aa 100644 (file)
@@ -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 );
     }
index c792e86bc35be650f555c88bf798ba9834d8b7ad..5463a5b4584a3be6983aa65ded07e697e4652a0d 100644 (file)
@@ -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 )
 {
index e6cd07aab6267e1d0ab9faee8839fc755f9ec912..783fbd0dbf1a97c6e076cfa636e33bbaf3b1e4da 100644 (file)
@@ -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 );
 
 /***