(trunk gtk) remove function gtr_localtime2()

This commit is contained in:
Charles Kerr 2010-05-28 19:43:37 +00:00
parent 37f90426c1
commit 56e614b66d
3 changed files with 14 additions and 14 deletions

View File

@ -578,6 +578,16 @@ gtr_text_buffer_set_text( GtkTextBuffer * b, const char * str )
g_free( old_str );
}
static char*
get_short_date_string( time_t t )
{
char buf[64];
struct tm tm;
tr_localtime_r( &t, &tm );
strftime( buf, sizeof( buf ), "%d %b %Y", &tm );
return g_locale_to_utf8( buf, -1, NULL, NULL, NULL );
};
static void
refreshInfo( struct DetailsImpl * di, tr_torrent ** torrents, int n )
{
@ -618,12 +628,12 @@ refreshInfo( struct DetailsImpl * di, tr_torrent ** torrents, int n )
if( n<=0 )
str = none;
else {
char datestr[64];
const char * creator = infos[0]->creator ? infos[0]->creator : "";
const time_t date = infos[0]->dateCreated;
char * datestr = get_short_date_string( date );
gboolean mixed_creator = FALSE;
gboolean mixed_date = FALSE;
gtr_localtime2( datestr, date, sizeof( datestr ) );
for( i=1; i<n; ++i ) {
mixed_creator |= strcmp( creator, infos[i]->creator ? infos[i]->creator : "" );
mixed_date |= ( date != infos[i]->dateCreated );
@ -639,6 +649,8 @@ refreshInfo( struct DetailsImpl * di, tr_torrent ** torrents, int n )
g_snprintf( buf, sizeof( buf ), _( "Created by %1$s on %2$s" ), creator, datestr );
str = buf;
}
g_free( datestr );
}
gtr_label_set_text( GTK_LABEL( di->origin_lb ), str );

View File

@ -219,15 +219,6 @@ gtr_localtime( time_t time )
return g_locale_to_utf8( buf, -1, NULL, NULL, NULL );
}
char *
gtr_localtime2( char * buf, time_t time, size_t buflen )
{
char * tmp = gtr_localtime( time );
g_strlcpy( buf, tmp, buflen );
g_free( tmp );
return buf;
}
int
gtr_mkdir_with_parents( const char * path, int mode )
{

View File

@ -55,9 +55,6 @@ char* tr_strltime( char * buf, int secs, size_t buflen );
/* similar to asctime, but is utf8-clean */
char* gtr_localtime( time_t time );
/* similar to asctime, but is utf8-clean */
char* gtr_localtime2( char * buf, time_t time, size_t buflen );
/***
****
***/