[totem] main: Update for "buffering" API change



commit 09deaabb8efefddd3b3e424f6089ee2d29f5f57c
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jul 5 10:03:56 2012 +0100

    main: Update for "buffering" API change

 src/totem-object.c    |    2 +-
 src/totem-statusbar.c |   14 +++++++-------
 src/totem-statusbar.h |    2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/totem-object.c b/src/totem-object.c
index 5db9aca..77107eb 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -2420,7 +2420,7 @@ on_error_event (BaconVideoWidget *bvw, char *message,
 }
 
 static void
-on_buffering_event (BaconVideoWidget *bvw, int percentage, TotemObject *totem)
+on_buffering_event (BaconVideoWidget *bvw, gdouble percentage, TotemObject *totem)
 {
 	totem_statusbar_push (TOTEM_STATUSBAR (totem->statusbar), percentage);
 }
diff --git a/src/totem-statusbar.c b/src/totem-statusbar.c
index e5e2cf0..e8bd38b 100644
--- a/src/totem-statusbar.c
+++ b/src/totem-statusbar.c
@@ -27,8 +27,8 @@
 
 #include "config.h"
 
+#include <math.h>
 #include <glib/gi18n.h>
-
 #include <gtk/gtk.h>
 
 #include "totem-statusbar.h"
@@ -49,7 +49,7 @@ struct _TotemStatusbarPrivate {
   gint time;
   gint length;
   guint timeout;
-  guint percentage;
+  gdouble percentage;
 
   guint pushed : 1;
   guint seeking : 1;
@@ -225,7 +225,7 @@ totem_statusbar_timeout_pop (TotemStatusbar *statusbar)
 }
 
 void
-totem_statusbar_push (TotemStatusbar *statusbar, guint percentage)
+totem_statusbar_push (TotemStatusbar *statusbar, gdouble percentage)
 {
   TotemStatusbarPrivate *priv = statusbar->priv;
   GtkStatusbar *gstatusbar = GTK_STATUSBAR (statusbar);
@@ -247,11 +247,11 @@ totem_statusbar_push (TotemStatusbar *statusbar, guint percentage)
     priv->percentage = percentage;
 
     /* eg: 75 % */
-    label = g_strdup_printf (_("%d %%"), percentage);
+    label = g_strdup_printf (_("%lf %%"), floorf (percentage));
     gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->progress), label);
     g_free (label);
     gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress),
-                                  percentage / 100.);
+                                  percentage);
     gtk_widget_show (priv->progress);
 
     need_update = TRUE;
@@ -327,9 +327,9 @@ totem_statusbar_sync_description (TotemStatusbar *statusbar)
 	gtk_label_get_text (GTK_LABEL (statusbar->priv->time_label)));
   } else {
     /* eg: Buffering, 75 % */
-    text = g_strdup_printf (_("%s, %d %%"),
+    text = g_strdup_printf (_("%s, %f %%"),
 	gtk_label_get_text (GTK_LABEL (label)),
-	statusbar->priv->percentage);
+	floorf (statusbar->priv->percentage));
   }
 
   atk_object_set_name (obj, text);
diff --git a/src/totem-statusbar.h b/src/totem-statusbar.h
index d5681f6..f27c81c 100644
--- a/src/totem-statusbar.h
+++ b/src/totem-statusbar.h
@@ -65,7 +65,7 @@ void       totem_statusbar_push_help            (TotemStatusbar *statusbar,
 						 const char *message);
 void       totem_statusbar_pop_help             (TotemStatusbar *statusbar);
 void	   totem_statusbar_push			(TotemStatusbar *statusbar,
-						 guint percentage);
+						 gdouble percentage);
 void       totem_statusbar_pop			(TotemStatusbar *statusbar);
 
 G_END_DECLS



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]