## EmpathyFTFactory EmpathyFTFactory — creates EmpathyFTHandler objects |

## Synopsis

    #include <libempathy/empathy-ft-factory.h>

                        EmpathyFTFactory;
    EmpathyFTFactory*   empathy_ft_factory_dup_singleton    (void);
    void                empathy_ft_factory_new_transfer_outgoing
                                                            (EmpathyFTFactory *factory,
                                                             EmpathyContact *contact,
                                                             GFile *source);
    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);

## Object Hierarchy

      GObject
       +----EmpathyFTFactory

## Signals

      "new-ft-handler"                                 : Run Last
      "new-incoming-transfer"                          : Run Last

## Description

EmpathyFTFactory takes care of the creation of the EmpathyFTHandler objects used for file transfer. As the creation of the handlers is async, a client will have to connect to the ::new-ft-handler signal to receive the handler. In case of an incoming file transfer, the handler will need the destination file before being useful; as this is usually decided by the user (e.g. with a file selector), a ::new-incoming-transfer is emitted by the factory when a destination file is needed, which can be set later with `empathy_ft_factory_set_destination_for_incoming_handler()`.

## Details

### EmpathyFTFactory

    typedef struct _EmpathyFTFactory EmpathyFTFactory;

### empathy_ft_factory_dup_singleton ()

    EmpathyFTFactory*   empathy_ft_factory_dup_singleton    (void);

Gives the caller a reference to the EmpathyFTFactory singleton, (creating it if necessary).

Returns : | an EmpathyFTFactory object

### empathy_ft_factory_new_transfer_outgoing ()

    void                empathy_ft_factory_new_transfer_outgoing
                                                            (EmpathyFTFactory *factory,
                                                             EmpathyContact *contact,
                                                             GFile *source);

Trigger the creation of an EmpathyFTHandler object to send `source` to the specified `contact`.

`factory` : | an EmpathyFTFactory
`contact` : | the EmpathyContact destination of the transfer
`source` : | the GFile to be transferred to `contact`

### empathy_ft_factory_claim_channel ()

    void                empathy_ft_factory_claim_channel    (EmpathyFTFactory *factory,
                                                             EmpathyDispatchOperation *operation);

Let the `factory` claim the channel, starting the creation of a new incoming EmpathyFTHandler.

`factory` : | an EmpathyFTFactory
`operation` : | the EmpathyDispatchOperation wrapping the channel

### empathy_ft_factory_set_destination_for_incoming_handler ()

    void                empathy_ft_factory_set_destination_for_incoming_handler
                                                            (EmpathyFTFactory *factory,
                                                             EmpathyFTHandler *handler,
                                                             GFile *destination);

Sets `destination` as destination file for the transfer. After the call of this method, the ::new-ft-handler will be emitted for the incoming handler.

`factory` : | an EmpathyFTFactory
`handler` : | the EmpathyFTHandler to set the destination of
`destination` : | the GFile destination of the transfer

## Signal Details

### The `"new-ft-handler"` signal

    void                user_function                      (EmpathyFTFactory *factory,
                                                            EmpathyFTHandler *handler,
                                                            gpointer          error,
                                                            gpointer          user_data)      : Run Last

The signal is emitted when a new EmpathyFTHandler is available. Note that `handler` is never `NULL` even if `error` is set, as you might want to display the error in an UI; in that case, the handler won't support any transfer.

`factory` : | the object which received the signal
`handler` : | the handler made available by the factory
`error` : | a GError or `NULL`
`user_data` : | user data set when the signal handler was connected.

### The `"new-incoming-transfer"` signal

    void                user_function                      (EmpathyFTFactory *factory,
                                                            EmpathyFTHandler *handler,
                                                            gpointer          error,
                                                            gpointer          user_data)      : Run Last

The signal is emitted when a new incoming EmpathyFTHandler is being constructed, and needs a destination GFile to be useful. Clients that connect to this signal will have to call `empathy_ft_factory_set_destination_for_incoming_handler()` when they have a GFile. Note that `handler` is never `NULL` even if `error` is set, as you might want to display the error in an UI; in that case, the handler won't support any transfer.

`factory` : | the object which received the signal
`handler` : | the incoming handler being constructed
`error` : | a GError or `NULL`
`user_data` : | user data set when the signal handler was connected.