]> git.0d.be Git - empathy.git/commitdiff
Add use_hash params for incoming transfers
authorCosimo Cecchi <cosimo.cecchi@collabora.co.uk>
Wed, 13 May 2009 13:02:16 +0000 (15:02 +0200)
committerCosimo Cecchi <cosimoc@gnome.org>
Mon, 1 Jun 2009 15:49:56 +0000 (17:49 +0200)
Add use_hash params for incoming transfers to the FT Factory and
Handler, so that we will use them to check hash for received files.

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

index 3ea3e76aa43c56f2bbcf811678f06a5b22005ded..29c3b600fdf51839c46e4b5f02c978fac3292c01 100644 (file)
@@ -1481,13 +1481,19 @@ file_manager_receive_file_response_cb (GtkDialog *dialog,
 {
        EmpathyFTFactory *factory;
        GFile *file;
+       gboolean use_hash;
 
        if (response == GTK_RESPONSE_OK) {
                factory = empathy_ft_factory_dup_singleton ();
                file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
 
+               use_hash = empathy_conf_get_bool
+                       (empathy_conf_get (),
+                        EMPATHY_PREFS_FILE_TRANSFER_USE_HASH,
+                        &use_hash);
+
                empathy_ft_factory_set_destination_for_incoming_handler
-                       (factory, handler, file);
+                       (factory, handler, file, use_hash);
 
                g_object_unref (factory);
                g_object_unref (file);
index e36f553c85d0b2f6b3228df2141f59ed90255079..e294eba61ba99c4426bf3687fe6849e96fb9be8b 100644 (file)
@@ -169,13 +169,14 @@ void
 empathy_ft_factory_set_destination_for_incoming_handler
                                                  (EmpathyFTFactory *factory,
                                                   EmpathyFTHandler *handler,
-                                                  GFile *destination)
+                                                  GFile *destination,
+                                                  gboolean use_hash)
 {
   g_return_if_fail (EMPATHY_IS_FT_FACTORY (factory));
   g_return_if_fail (EMPATHY_IS_FT_HANDLER (handler));
   g_return_if_fail (G_IS_FILE (destination));
 
-  empathy_ft_handler_incoming_set_destination (handler, destination);
+  empathy_ft_handler_incoming_set_destination (handler, destination, use_hash);
 
   g_signal_emit (factory, signals[NEW_FT_HANDLER], 0, handler, FALSE);
 }
index 18310bd2ddcf2566a112cdc5ff1a3bb02536cf06..82dcb660be8bd53a63c7a6976b285befe37827d6 100644 (file)
@@ -64,7 +64,7 @@ void empathy_ft_factory_claim_channel (EmpathyFTFactory *factory,
   EmpathyDispatchOperation *operation);
 void empathy_ft_factory_set_destination_for_incoming_handler
   (EmpathyFTFactory *factory, EmpathyFTHandler *handler,
-   GFile *destination);
+   GFile *destination, gboolean use_hash);
 
 G_END_DECLS
 
index 5e6d02922c94d1609837d0beea301d99f8d7ffcf..f2fafd73b791a20150de41c4df8b90fd5e9e7775 100644 (file)
@@ -250,7 +250,7 @@ empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
   param_spec = g_param_spec_object ("gfile",
     "gfile", "The GFile we're handling",
     G_TYPE_FILE,
-    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
+    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
   g_object_class_install_property (object_class, PROP_G_FILE, param_spec);
 
   param_spec = g_param_spec_object ("tp-file",
@@ -261,7 +261,7 @@ empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
 
   param_spec = g_param_spec_boolean ("use-hash",
     "use-hash", "Whether we should use checksum when sending or receiving",
-    FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY);
+    FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
   g_object_class_install_property (object_class, PROP_USE_HASH, param_spec);
 
   /* signals */
@@ -996,12 +996,14 @@ empathy_ft_handler_cancel_transfer (EmpathyFTHandler *handler)
 
 void
 empathy_ft_handler_incoming_set_destination (EmpathyFTHandler *handler,
-                                             GFile *destination)
+                                             GFile *destination,
+                                             gboolean use_hash)
 {
   g_return_if_fail (EMPATHY_IS_FT_HANDLER (handler));
   g_return_if_fail (G_IS_FILE (destination));
 
-  g_object_set (handler, "gfile", destination, NULL);
+  g_object_set (handler, "gfile", destination,
+      "use-hash", use_hash, NULL);
 }
 
 const char *
index 70232e00e26563969f40852e4c53df9d9255b901..654c3a6f19cbfcf3ed5a4e25b4f28f796e82403b 100644 (file)
@@ -67,7 +67,7 @@ void empathy_ft_handler_new_outgoing (EmpathyContact *contact,
 void empathy_ft_handler_new_incoming (EmpathyTpFile *tp_file,
     EmpathyFTHandlerReadyCallback callback, gpointer user_data);
 void empathy_ft_handler_incoming_set_destination (EmpathyFTHandler *handler,
-    GFile *destination);
+    GFile *destination, gboolean use_hash);
 
 void empathy_ft_handler_start_transfer (EmpathyFTHandler *handler);
 void empathy_ft_handler_cancel_transfer (EmpathyFTHandler *handler);