[empathy: 103/148] Use the right macros to pass a gboolean as user_data



commit 948f05b5e6b28afbfc0549efe6cc4fd55598738c
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon May 18 14:30:08 2009 +0200

    Use the right macros to pass a gboolean as user_data
    
    Use GPOINTER_TO_INT and GINT_TO_POINTER instead of passing the address,
    as that doesn't work.
---
 libempathy/empathy-ft-handler.c |    2 ++
 libempathy/empathy-tp-file.c    |   23 ++++++++++++-----------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index 4a14038..e2172bc 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -694,6 +694,8 @@ ft_handler_check_if_allowed (EmpathyFTHandler *handler)
       TP_IFACE_CHANNEL ".TargetHandle"))
     res = FALSE;
 
+  DEBUG ("check if FT allowed: %s", res ? "True" : "False");
+
   g_object_unref (dispatcher);
 
   return res;
diff --git a/libempathy/empathy-tp-file.c b/libempathy/empathy-tp-file.c
index a5af58b..6a28872 100644
--- a/libempathy/empathy-tp-file.c
+++ b/libempathy/empathy-tp-file.c
@@ -149,11 +149,11 @@ ft_operation_close_clean (EmpathyTpFile *tp_file)
 {
   EmpathyTpFilePriv *priv = GET_PRIV (tp_file);
 
-  DEBUG ("FT operation close clean");
-
   if (priv->is_closed)
     return;
 
+  DEBUG ("FT operation close clean");
+
   priv->is_closed = TRUE;
 
   if (priv->op_callback != NULL)
@@ -166,11 +166,11 @@ ft_operation_close_with_error (EmpathyTpFile *tp_file,
 {
   EmpathyTpFilePriv *priv = GET_PRIV (tp_file);
 
-  DEBUG ("FT operation close with error %s", error->message);
-
   if (priv->is_closed)
     return;
 
+  DEBUG ("FT operation close with error %s", error->message);
+
   priv->is_closed = TRUE;
 
   /* close the channel if it's not cancelled already */
@@ -191,10 +191,10 @@ splice_stream_ready_cb (GObject *source,
 
   tp_file = user_data;
 
-  DEBUG ("Splice stream ready cb");
-
   g_output_stream_splice_finish (G_OUTPUT_STREAM (source), res, &error);
 
+  DEBUG ("Splice stream ready cb, error %p", error);
+
   if (error != NULL)
     {
       ft_operation_close_with_error (tp_file, error);
@@ -520,12 +520,12 @@ channel_closed_cb (TpChannel *proxy,
 {
   EmpathyTpFile *tp_file = EMPATHY_TP_FILE (weak_object);
   EmpathyTpFilePriv *priv = GET_PRIV (tp_file);
-  gboolean *cancel = user_data;
+  gboolean cancel = GPOINTER_TO_INT (user_data);
 
-  DEBUG ("Channel is closed");
+  DEBUG ("Channel is closed, should cancel %s", cancel ? "True" : "False");
 
   if (priv->cancellable != NULL &&
-      !g_cancellable_is_cancelled (priv->cancellable) && *cancel)
+      !g_cancellable_is_cancelled (priv->cancellable) && cancel)
     g_cancellable_cancel (priv->cancellable);  
 }
 
@@ -535,10 +535,11 @@ close_channel_internal (EmpathyTpFile *tp_file,
 {
   EmpathyTpFilePriv *priv = GET_PRIV (tp_file);
 
-  DEBUG ("Closing channel..");
+  DEBUG ("Closing channel, should cancel %s", cancel ?
+         "True" : "False");
 
   tp_cli_channel_call_close (priv->channel, -1,
-    channel_closed_cb, &cancel, NULL, G_OBJECT (tp_file));
+    channel_closed_cb, GINT_TO_POINTER (cancel), NULL, G_OBJECT (tp_file));
 }
 
 /* GObject methods */



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