aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-ft-factory.c
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimo.cecchi@collabora.co.uk>2009-02-18 23:41:12 +0800
committerCosimo Cecchi <cosimoc@gnome.org>2009-06-01 23:47:34 +0800
commit58d08cef143811d990218551a922451609978610 (patch)
treed90811a64a6135a048d3c90aee13654019089b5b /libempathy/empathy-ft-factory.c
parent1e69ae50fa2a35ac4e54283d40e9d96777ff6e61 (diff)
downloadgsoc2013-empathy-58d08cef143811d990218551a922451609978610.tar
gsoc2013-empathy-58d08cef143811d990218551a922451609978610.tar.gz
gsoc2013-empathy-58d08cef143811d990218551a922451609978610.tar.bz2
gsoc2013-empathy-58d08cef143811d990218551a922451609978610.tar.lz
gsoc2013-empathy-58d08cef143811d990218551a922451609978610.tar.xz
gsoc2013-empathy-58d08cef143811d990218551a922451609978610.tar.zst
gsoc2013-empathy-58d08cef143811d990218551a922451609978610.zip
Rethink a bit the logic for an incoming transfer.
Now, a client should have to do the following, in order to receive a file transfer: - let the EmpathyFTFactory claim the EmpathyDispatchOperation - the factory will emit "new-incoming-transfer" when the handler is filled with the relevant properties - now you can choose a destination file, and then you should call _set_destination on EmpathyFTFactory passing the handler. - the factory will emit "new-ft-handler" as you're now ready to start the actual transfer.
Diffstat (limited to 'libempathy/empathy-ft-factory.c')
-rw-r--r--libempathy/empathy-ft-factory.c43
1 files changed, 33 insertions, 10 deletions
diff --git a/libempathy/empathy-ft-factory.c b/libempathy/empathy-ft-factory.c
index 8aad81a5a..d180fa1ed 100644
--- a/libempathy/empathy-ft-factory.c
+++ b/libempathy/empathy-ft-factory.c
@@ -34,6 +34,7 @@ G_DEFINE_TYPE (EmpathyFTFactory, empathy_ft_factory, G_TYPE_OBJECT);
enum {
NEW_FT_HANDLER,
+ NEW_INCOMING_TRANSFER,
LAST_SIGNAL
};
@@ -75,6 +76,14 @@ empathy_ft_factory_class_init (EmpathyFTFactoryClass *klass)
_empathy_marshal_VOID__OBJECT_BOOLEAN,
G_TYPE_NONE,
2, EMPATHY_TYPE_FT_HANDLER, G_TYPE_BOOLEAN);
+
+ signals[NEW_INCOMING_TRANSFER] =
+ g_signal_new ("new-incoming-transfer",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, EMPATHY_TYPE_FT_HANDLER);
}
static void
@@ -112,7 +121,7 @@ ft_handler_incoming_ready_cb (EmpathyFTHandler *handler,
return;
}
- g_signal_emit (factory, signals[NEW_FT_HANDLER], 0, handler, FALSE);
+ g_signal_emit (factory, signals[NEW_INCOMING_TRANSFER], 0, handler);
}
/* public methods */
@@ -124,9 +133,9 @@ empathy_ft_factory_dup_singleton (void)
}
void
-empathy_ft_factory_new_transfer (EmpathyFTFactory *factory,
- EmpathyContact *contact,
- GFile *source)
+empathy_ft_factory_new_transfer_outgoing (EmpathyFTFactory *factory,
+ EmpathyContact *contact,
+ GFile *source)
{
g_return_if_fail (EMPATHY_IS_FT_FACTORY (factory));
g_return_if_fail (EMPATHY_IS_CONTACT (contact));
@@ -138,20 +147,34 @@ empathy_ft_factory_new_transfer (EmpathyFTFactory *factory,
void
empathy_ft_factory_claim_channel (EmpathyFTFactory *factory,
- EmpathyDispatchOperation *operation,
- GFile *destination)
+ EmpathyDispatchOperation *operation)
{
EmpathyTpFile *tp_file;
g_return_if_fail (EMPATHY_IS_FT_FACTORY (factory));
g_return_if_fail (EMPATHY_IS_DISPATCH_OPERATION (operation));
- g_return_if_fail (G_IS_FILE (destination));
+ /* own a reference to the EmpathyTpFile */
tp_file = EMPATHY_TP_FILE
- (empathy_dispatch_operation_get_channel_wrapper (operation));
- empathy_ft_handler_new_incoming (tp_file, destination,
- ft_handler_incoming_ready_cb, factory);
+ ((empathy_dispatch_operation_get_channel_wrapper (operation)));
+
+ empathy_ft_handler_new_incoming (tp_file, ft_handler_incoming_ready_cb,
+ factory);
empathy_dispatch_operation_claim (operation);
}
+void
+empathy_ft_factory_set_destination_for_incoming_handler
+ (EmpathyFTFactory *factory,
+ EmpathyFTHandler *handler,
+ GFile *destination)
+{
+ 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);
+
+ g_signal_emit (factory, signals[NEW_FT_HANDLER], 0, handler, FALSE);
+}