[gnome-bluetooth] Bug 584937 – Bug#531892 Gtk-CRITICAL when sending an empty file
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-bluetooth] Bug 584937 – Bug#531892 Gtk-CRITICAL when sending an empty file
- Date: Mon, 8 Jun 2009 06:35:41 -0400 (EDT)
commit 9b7ae60cc359cb0ebbf2e46f918850f8146a4db1
Author: Bastien Nocera <hadess hadess net>
Date: Mon Jun 8 11:33:18 2009 +0100
Bug 584937 â?? Bug#531892 Gtk-CRITICAL when sending an empty file
When sending an empty file (or empty files), set the progress bar
to 0.0 when starting the transfer, and to 1.0 when it has finished.
---
sendto/main.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/sendto/main.c b/sendto/main.c
index 8a0af8b..3127d5d 100644
--- a/sendto/main.c
+++ b/sendto/main.c
@@ -224,6 +224,7 @@ static void create_window(void)
static void finish_sending(DBusGProxy *proxy)
{
gtk_label_set_markup(GTK_LABEL(label_status), NULL);
+ gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), 1.0);
dbus_g_proxy_call(proxy, "Disconnect", NULL, G_TYPE_INVALID,
G_TYPE_INVALID);
@@ -299,7 +300,10 @@ static void transfer_progress(DBusGProxy *proxy,
gchar *time, *rate, *file, *text;
current_sent = total_sent + bytes;
- fraction = (gdouble) current_sent / (gdouble) total_size;
+ if (total_size == 0)
+ fraction = 0.0;
+ else
+ fraction = (gdouble) current_sent / (gdouble) total_size;
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), fraction);
current_time = get_system_time();
@@ -629,6 +633,8 @@ static gboolean complete_callback(DBusGMethodInvocation *context,
file_index++;
+ gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), 1.0);
+
dbus_g_method_return(context);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]