1
=== modified file 'src/empathy-ft-manager.c'
2
--- old/src/empathy-ft-manager.c 2011-02-15 17:11:00 +0000
3
+++ new/src/empathy-ft-manager.c 2011-02-16 21:48:36 +0000
6
#include "empathy-ft-manager.h"
14
GtkWidget *open_button;
15
GtkWidget *abort_button;
16
GtkWidget *clear_button;
17
+ UnityLauncherEntry *launcher;
18
} EmpathyFTManagerPriv;
22
static void ft_handler_hashing_started_cb (EmpathyFTHandler *handler,
23
EmpathyFTManager *manager);
25
+static gchar * ft_manager_format_progress_bytes_and_percentage (
32
+ft_update_unity_launcher (EmpathyFTManager *manager)
34
+ EmpathyFTManagerPriv *priv;
36
+ priv = GET_PRIV (manager);
37
+ g_return_if_fail (priv->launcher != NULL);
39
+ guint64 current_bytes = 0;
40
+ guint64 total_bytes = 0;
43
+ GHashTableIter iter;
46
+ g_hash_table_iter_init (&iter, priv->ft_handler_to_row_ref);
47
+ while (g_hash_table_iter_next (&iter, &handler, NULL))
49
+ if (!empathy_ft_handler_is_completed (handler) &&
50
+ !empathy_ft_handler_is_cancelled (handler))
52
+ current_bytes = current_bytes + empathy_ft_handler_get_transferred_bytes (handler);
53
+ total_bytes = total_bytes + empathy_ft_handler_get_total_bytes (handler);
56
+ ft_manager_format_progress_bytes_and_percentage (current_bytes, total_bytes, -1, &percentage);
58
+ progress = percentage;
59
+ progress = progress / 100;
61
+ unity_launcher_entry_set_progress (priv->launcher, progress);
62
+ if (progress > 0 && progress < 100)
64
+ unity_launcher_entry_set_progress_visible (priv->launcher, TRUE);
68
+ unity_launcher_entry_set_progress_visible (priv->launcher, FALSE);
73
ft_manager_format_interval (guint interval)
76
COL_PERCENT, percentage,
79
+ ft_update_unity_launcher (manager);
81
gtk_tree_path_free (path);
85
ft_manager_clear_handler_time (manager, row_ref);
86
ft_manager_update_buttons (manager);
88
+ ft_update_unity_launcher (manager);
94
do_real_transfer_done (EmpathyFTManager *manager,
95
EmpathyFTHandler *handler)
97
+ EmpathyFTManagerPriv *priv;
98
const char *contact_name;
100
char *first_line, *second_line, *message;
102
GtkRecentManager *recent_manager;
105
+ priv = GET_PRIV (manager);
107
row_ref = ft_manager_get_row_from_handler (manager, handler);
108
g_return_if_fail (row_ref != NULL);
111
ft_manager_update_handler_message (manager, row_ref, message);
112
ft_manager_clear_handler_time (manager, row_ref);
114
+ ft_update_unity_launcher (manager);
117
ft_manager_update_buttons (manager);
120
DEBUG ("Transfer done, no hashing");
122
do_real_transfer_done (manager, handler);
124
+ ft_update_unity_launcher (manager);
129
EmpathyTpFile *tp_file,
130
EmpathyFTManager *manager)
132
+ EmpathyFTManagerPriv *priv;
133
+ priv = GET_PRIV (manager);
134
guint64 transferred_bytes, total_bytes;
136
DEBUG ("Transfer started");
137
@@ -1054,6 +1117,12 @@
139
g_hash_table_destroy (priv->ft_handler_to_row_ref);
141
+ if (priv->launcher != NULL)
143
+ g_object_unref(priv->launcher);
144
+ priv->launcher = NULL;
147
G_OBJECT_CLASS (empathy_ft_manager_parent_class)->finalize (object);
150
@@ -1071,6 +1140,8 @@
151
g_direct_equal, (GDestroyNotify) g_object_unref,
152
(GDestroyNotify) gtk_tree_row_reference_free);
154
+ priv->launcher = unity_launcher_entry_get_for_desktop_id ("empathy.desktop");
156
ft_manager_build_ui (manager);