[Xfce4-commits] r23268 - xfmedia/trunk/src
Brian Tarricone
kelnos at xfce.org
Tue Oct 3 05:19:55 UTC 2006
Author: kelnos
Date: 2006-10-03 05:19:54 +0000 (Tue, 03 Oct 2006)
New Revision: 23268
Modified:
xfmedia/trunk/src/mainwin-callbacks.c
xfmedia/trunk/src/mainwin.c
xfmedia/trunk/src/playlist.c
Log:
separate hours from minutes in the time label, file info dialog, and playlist
view. idea and partial patch from erik harrison (bug 2370)
Modified: xfmedia/trunk/src/mainwin-callbacks.c
===================================================================
--- xfmedia/trunk/src/mainwin-callbacks.c 2006-10-02 22:13:25 UTC (rev 23267)
+++ xfmedia/trunk/src/mainwin-callbacks.c 2006-10-03 05:19:54 UTC (rev 23268)
@@ -540,7 +540,13 @@
entry = gtk_entry_new();
if(xine_get_pos_length(mwin->extra_stream, &pos_stream, &pos_time, &length_time)) {
length_time /= 1000;
- g_snprintf(tmpbuf, TMPBUF, "%02d:%02d", length_time/60, length_time%60);
+ if(length_time >= 3600) {
+ g_snprintf(tmpbuf, TMPBUF, "%02d:%02d:%02d", length_time/3600,
+ (length_time%3600)/60, (length_time%3600)%60);
+ } else {
+ g_snprintf(tmpbuf, TMPBUF, "%02d:%02d", length_time/60,
+ length_time%60);
+ }
gtk_entry_set_text(GTK_ENTRY(entry), tmpbuf);
gtk_entry_set_width_chars(GTK_ENTRY(entry), strlen(tmpbuf));
}
Modified: xfmedia/trunk/src/mainwin.c
===================================================================
--- xfmedia/trunk/src/mainwin.c 2006-10-02 22:13:25 UTC (rev 23267)
+++ xfmedia/trunk/src/mainwin.c 2006-10-03 05:19:54 UTC (rev 23268)
@@ -1054,19 +1054,39 @@
gboolean is_remaining, const gchar *extra_pango_markup)
{
gchar time_lbl[128];
+ gint h, m, s;
- g_snprintf(time_lbl, 128,
- "<span font_family=\"monospace\" size=\"large\" weight=\"bold\" %s>%c%02d:%02d</span>",
- extra_pango_markup ? extra_pango_markup : "",
- is_remaining ? '-' : ' ',
- time / 60, time % 60);
+ if(time >= 3600) {
+ h = time / 3600;
+ m = (time % 3600) / 60;
+ s = (time % 3600) % 60;
+
+ g_snprintf(time_lbl, 128,
+ "<span font_family=\"monospace\" size=\"large\" weight=\"bold\" %s>%c%02d:%02d:%02d</span>",
+ extra_pango_markup ? extra_pango_markup : "",
+ is_remaining ? '-' : ' ', h, m, s);
+ } else {
+ m = time / 60;
+ s = time % 60;
+
+ g_snprintf(time_lbl, 128,
+ "<span font_family=\"monospace\" size=\"large\" weight=\"bold\" %s>%c%02d:%02d</span>",
+ extra_pango_markup ? extra_pango_markup : "",
+ is_remaining ? '-' : ' ', m, s);
+ }
gtk_label_set_markup(GTK_LABEL(mwin->time_label), time_lbl);
- g_snprintf(time_lbl, 128,
- "<span font_family=\"monospace\" %s>%c%02d:%02d</span>",
- extra_pango_markup ? extra_pango_markup : "",
- is_remaining ? '-' : ' ',
- time / 60, time % 60);
+ if(time >= 3600) {
+ g_snprintf(time_lbl, 128,
+ "<span font_family=\"monospace\" %s>%c%02d:%02d:%02d</span>",
+ extra_pango_markup ? extra_pango_markup : "",
+ is_remaining ? '-' : ' ', h, m, s);
+ } else {
+ g_snprintf(time_lbl, 128,
+ "<span font_family=\"monospace\" %s>%c%02d:%02d</span>",
+ extra_pango_markup ? extra_pango_markup : "",
+ is_remaining ? '-' : ' ', m, s);
+ }
gtk_label_set_markup(GTK_LABEL(mwin->fs_time_label), time_lbl);
}
Modified: xfmedia/trunk/src/playlist.c
===================================================================
--- xfmedia/trunk/src/playlist.c 2006-10-02 22:13:25 UTC (rev 23267)
+++ xfmedia/trunk/src/playlist.c 2006-10-03 05:19:54 UTC (rev 23268)
@@ -1585,7 +1585,10 @@
gchar length_str[32];
gint last_mtime = 0;
- if(length >= 0)
+ if(length >= 3600) {
+ g_snprintf(length_str, 32, "%02d:%02d:%02d", length/3600,
+ (length%3600)/60, (length%3600)%60);
+ } else if(length >= 0)
g_snprintf(length_str, 32, "%02d:%02d", length/60, length%60);
if(metadata_loaded) {
@@ -1660,7 +1663,13 @@
}
if(length >= 0) {
- gchar *length_str = g_strdup_printf("%02d:%02d", length/60, length%60);
+ gchar *length_str;
+
+ if(length >= 3600) {
+ length_str = g_strdup_printf("%02d:%02d:%02d", length/3600,
+ (length%3600)/60, (length%3600)%60);
+ } else
+ length_str = g_strdup_printf("%02d:%02d", length/60, length%60);
gtk_list_store_set(plist->priv->file_list, &itr,
PLAYLIST_COL_LENGTH, length,
PLAYLIST_COL_LENGTH_S, length_str, -1);
More information about the Xfce4-commits
mailing list