~ubuntu-branches/ubuntu/precise/rhythmbox/precise-201203091205

« back to all changes in this revision

Viewing changes to lib/rb-util.c

Tags: upstream-0.9.2cvs20060102
ImportĀ upstreamĀ versionĀ 0.9.2cvs20060102

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "rb-util.h"
23
23
#include <gtk/gtk.h>
24
24
#include <string.h>
 
25
#include <libgnome/gnome-i18n.h>
25
26
#include <libgnomevfs/gnome-vfs.h>
26
27
#include "rb-debug.h"
27
28
 
546
547
        return g_string_free (string, FALSE);
547
548
}
548
549
 
 
550
char *
 
551
rb_make_duration_string (guint duration)
 
552
{
 
553
        char *str;
 
554
        int hours, minutes, seconds;
 
555
 
 
556
        hours = duration / (60 * 60);
 
557
        minutes = (duration - (hours * 60 * 60)) / 60;
 
558
        seconds = duration % 60;
 
559
 
 
560
        if (hours == 0 && minutes == 0 && seconds == 0)
 
561
                str = g_strdup (_("Unknown"));
 
562
        else if (hours == 0)
 
563
                str = g_strdup_printf (_("%d:%02d"), minutes, seconds);
 
564
        else
 
565
                str = g_strdup_printf (_("%d:%02d:%02d"), hours, minutes, seconds);
 
566
 
 
567
        return str;
 
568
}
 
569