]> git.0d.be Git - empathy.git/commitdiff
pass to proper user action time when requesting an outgoing FT
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 31 Jan 2011 13:34:21 +0000 (14:34 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 27 Sep 2011 13:11:27 +0000 (15:11 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=658245

libempathy-gtk/empathy-ui-utils.c
libempathy/empathy-ft-factory.c
libempathy/empathy-ft-factory.h
libempathy/empathy-ft-handler.c
libempathy/empathy-ft-handler.h
nautilus-sendto-plugin/empathy-nautilus-sendto.c

index d5f63c9e0281271dd3b2a7908603aa5cf2c40c5c..3fde9e3e15d48407987470199c74da24b5680816 100644 (file)
@@ -1759,7 +1759,8 @@ empathy_send_file (EmpathyContact *contact, GFile *file)
 
        factory = empathy_ft_factory_dup_singleton ();
 
-       empathy_ft_factory_new_transfer_outgoing (factory, contact, file);
+       empathy_ft_factory_new_transfer_outgoing (factory, contact, file,
+               empathy_get_current_action_time ());
 
        uri = g_file_get_uri (file);
        manager = gtk_recent_manager_get_default ();
index 597bbaf5110378777efb29959849d3197d1db568..472451fa06b8b33206733527adf4afffd8db157e 100644 (file)
@@ -265,13 +265,14 @@ empathy_ft_factory_dup_singleton (void)
 void
 empathy_ft_factory_new_transfer_outgoing (EmpathyFTFactory *factory,
     EmpathyContact *contact,
-    GFile *source)
+    GFile *source,
+    gint64 action_time)
 {
   g_return_if_fail (EMPATHY_IS_FT_FACTORY (factory));
   g_return_if_fail (EMPATHY_IS_CONTACT (contact));
   g_return_if_fail (G_IS_FILE (source));
 
-  empathy_ft_handler_new_outgoing (contact, source,
+  empathy_ft_handler_new_outgoing (contact, source, action_time,
       ft_handler_outgoing_ready_cb, factory);
 }
 
index f59ecc44c489bbaba08dd1ab2c0a6579cfc83348..dcbffe1e1eb66879c10b8f6ee26abd651ecbba3f 100644 (file)
@@ -62,7 +62,8 @@ GType empathy_ft_factory_get_type (void);
 EmpathyFTFactory* empathy_ft_factory_dup_singleton (void);
 void empathy_ft_factory_new_transfer_outgoing (EmpathyFTFactory *factory,
     EmpathyContact *contact,
-    GFile *source);
+    GFile *source,
+    gint64 user_action_time);
 void empathy_ft_factory_set_destination_for_incoming_handler (
     EmpathyFTFactory *factory,
     EmpathyFTHandler *handler,
index 99b6dc85ffd78eeab5c245c9a998b5accf8923c8..8654bdd208398f6fc7dbe2d72a0a7164562c7f8d 100644 (file)
@@ -85,7 +85,8 @@ enum {
   PROP_FILENAME,
   PROP_MODIFICATION_TIME,
   PROP_TOTAL_BYTES,
-  PROP_TRANSFERRED_BYTES
+  PROP_TRANSFERRED_BYTES,
+  PROP_USER_ACTION_TIME
 };
 
 enum {
@@ -138,6 +139,8 @@ typedef struct {
   gchar *content_hash;
   TpFileHashType content_hash_type;
 
+  gint64 user_action_time;
+
   /* time and speed */
   gdouble speed;
   guint remaining_time;
@@ -189,6 +192,9 @@ do_get_property (GObject *object,
       case PROP_TP_FILE:
         g_value_set_object (value, priv->tpfile);
         break;
+      case PROP_USER_ACTION_TIME:
+        g_value_set_int64 (value, priv->user_action_time);
+        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
     }
@@ -231,6 +237,9 @@ do_set_property (GObject *object,
       case PROP_TP_FILE:
         priv->tpfile = g_value_dup_object (value);
         break;
+      case PROP_USER_ACTION_TIME:
+        priv->user_action_time = g_value_get_int64 (value);
+        break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
     }
@@ -412,6 +421,13 @@ empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
     G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
   g_object_class_install_property (object_class, PROP_TP_FILE, param_spec);
 
+  param_spec = g_param_spec_int64 ("user-action-time", "user action time",
+    "User action time",
+    0, G_MAXINT64, 0,
+    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
+  g_object_class_install_property (object_class, PROP_USER_ACTION_TIME,
+      param_spec);
+
   /* signals */
 
   /**
@@ -751,7 +767,7 @@ ft_handler_push_to_dispatcher (EmpathyFTHandler *handler)
   account = empathy_contact_get_account (priv->contact);
 
   req = tp_account_channel_request_new (account, priv->request,
-      TP_USER_ACTION_TIME_NOT_USER_ACTION);
+      priv->user_action_time);
 
   tp_account_channel_request_create_and_handle_channel_async (req, NULL,
       ft_handler_create_channel_cb, handler);
@@ -1295,6 +1311,7 @@ channel_get_all_properties_cb (TpProxy *proxy,
 void
 empathy_ft_handler_new_outgoing (EmpathyContact *contact,
     GFile *source,
+    gint64 action_time,
     EmpathyFTHandlerReadyCallback callback,
     gpointer user_data)
 {
@@ -1308,7 +1325,10 @@ empathy_ft_handler_new_outgoing (EmpathyContact *contact,
   g_return_if_fail (G_IS_FILE (source));
 
   handler = g_object_new (EMPATHY_TYPE_FT_HANDLER,
-      "contact", contact, "gfile", source, NULL);
+      "contact", contact,
+      "gfile", source,
+      "user-action-time", action_time,
+      NULL);
 
   priv = GET_PRIV (handler);
 
index 7d41536110e043aa38e8bdedc09563dfae90f3a2..a4392b5082827a9ace81618e5449bf628d22bab9 100644 (file)
@@ -71,6 +71,7 @@ GType empathy_ft_handler_get_type (void);
 /* public methods */
 void empathy_ft_handler_new_outgoing (EmpathyContact *contact,
     GFile *source,
+    gint64 action_time,
     EmpathyFTHandlerReadyCallback callback,
     gpointer user_data);
 
index c480e02f7d541538f2846e84d9d1624c81af75f1..cce55f8a0f1218300841a689a4d4cb9159715505 100644 (file)
@@ -210,7 +210,7 @@ send_files (NstPlugin *plugin,
       ++transfers;
 
       empathy_ft_factory_new_transfer_outgoing (factory,
-          contact, file);
+          contact, file, empathy_get_current_action_time ());
 
       g_object_unref (file);
     }