From a93e738c107fc5b24c5055027c17559200734c23 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 31 Jan 2011 14:34:21 +0100 Subject: [PATCH] pass to proper user action time when requesting an outgoing FT https://bugzilla.gnome.org/show_bug.cgi?id=658245 --- libempathy-gtk/empathy-ui-utils.c | 3 ++- libempathy/empathy-ft-factory.c | 5 ++-- libempathy/empathy-ft-factory.h | 3 ++- libempathy/empathy-ft-handler.c | 26 ++++++++++++++++--- libempathy/empathy-ft-handler.h | 1 + .../empathy-nautilus-sendto.c | 2 +- 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index d5f63c9e..3fde9e3e 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -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 (); diff --git a/libempathy/empathy-ft-factory.c b/libempathy/empathy-ft-factory.c index 597bbaf5..472451fa 100644 --- a/libempathy/empathy-ft-factory.c +++ b/libempathy/empathy-ft-factory.c @@ -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); } diff --git a/libempathy/empathy-ft-factory.h b/libempathy/empathy-ft-factory.h index f59ecc44..dcbffe1e 100644 --- a/libempathy/empathy-ft-factory.h +++ b/libempathy/empathy-ft-factory.h @@ -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, diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index 99b6dc85..8654bdd2 100644 --- a/libempathy/empathy-ft-handler.c +++ b/libempathy/empathy-ft-handler.c @@ -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); diff --git a/libempathy/empathy-ft-handler.h b/libempathy/empathy-ft-handler.h index 7d415361..a4392b50 100644 --- a/libempathy/empathy-ft-handler.h +++ b/libempathy/empathy-ft-handler.h @@ -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); diff --git a/nautilus-sendto-plugin/empathy-nautilus-sendto.c b/nautilus-sendto-plugin/empathy-nautilus-sendto.c index c480e02f..cce55f8a 100644 --- a/nautilus-sendto-plugin/empathy-nautilus-sendto.c +++ b/nautilus-sendto-plugin/empathy-nautilus-sendto.c @@ -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); } -- 2.39.2