From 53138664c59afe454c5d3ade01ae9c9a1d87193b Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 7 Apr 2011 13:11:23 +0200 Subject: factor out close_window() --- src/empathy-ft-manager.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/empathy-ft-manager.c b/src/empathy-ft-manager.c index abe7975c4..3ef95db4a 100644 --- a/src/empathy-ft-manager.c +++ b/src/empathy-ft-manager.c @@ -868,6 +868,27 @@ ft_manager_stop (EmpathyFTManager *manager) g_object_unref (handler); } +static gboolean +close_window (EmpathyFTManager *manager) +{ + EmpathyFTManagerPriv *priv = GET_PRIV (manager); + + DEBUG ("%p", manager); + + /* remove all the completed/cancelled/errored transfers */ + ft_manager_clear (manager); + + if (g_hash_table_size (priv->ft_handler_to_row_ref) > 0) + { + /* There is still FTs on flight, just hide the window */ + DEBUG ("Hiding window"); + gtk_widget_hide (priv->window); + return TRUE; + } + + return FALSE; +} + static void ft_manager_response_cb (GtkWidget *widget, gint response, @@ -898,22 +919,7 @@ ft_manager_delete_event_cb (GtkWidget *widget, GdkEvent *event, EmpathyFTManager *manager) { - EmpathyFTManagerPriv *priv = GET_PRIV (manager); - - DEBUG ("%p", manager); - - /* remove all the completed/cancelled/errored transfers */ - ft_manager_clear (manager); - - if (g_hash_table_size (priv->ft_handler_to_row_ref) > 0) - { - /* There is still FTs on flight, just hide the window */ - DEBUG ("Hiding window"); - gtk_widget_hide (widget); - return TRUE; - } - - return FALSE; + return close_window (manager); } static void -- cgit v1.2.3