diff options
author | Cosimo Cecchi <cosimo.cecchi@collabora.co.uk> | 2009-02-18 23:41:12 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2009-06-01 23:47:34 +0800 |
commit | 58d08cef143811d990218551a922451609978610 (patch) | |
tree | d90811a64a6135a048d3c90aee13654019089b5b /libempathy-gtk/empathy-ui-utils.c | |
parent | 1e69ae50fa2a35ac4e54283d40e9d96777ff6e61 (diff) | |
download | gsoc2013-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-gtk/empathy-ui-utils.c')
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index c61ad0dac..c33abb63d 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -1418,13 +1418,14 @@ file_manager_send_file_response_cb (GtkDialog *widget, factory = empathy_ft_factory_dup_singleton (); - empathy_ft_factory_new_transfer (factory, contact, file); + empathy_ft_factory_new_transfer_outgoing (factory, contact, file); manager = gtk_recent_manager_get_default (); gtk_recent_manager_add_item (manager, uri); g_free (uri); g_object_unref (factory); + g_object_unref (file); } gtk_widget_destroy (GTK_WIDGET (widget)); @@ -1466,6 +1467,49 @@ empathy_send_file_with_file_chooser (EmpathyContact *contact) gtk_widget_show (widget); } +static void +file_manager_receive_file_response_cb (GtkDialog *dialog, + GtkResponseType response, + EmpathyFTHandler *handler) +{ + EmpathyFTFactory *factory; + GFile *file; + + if (response == GTK_RESPONSE_OK) { + factory = empathy_ft_factory_dup_singleton (); + file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog)); + + empathy_ft_factory_set_destination_for_incoming_handler + (factory, handler, file); + + g_object_unref (factory); + g_object_unref (file); + } + + gtk_widget_destroy (GTK_WIDGET (dialog)); +} + +void +empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler) +{ + GtkWidget *widget; + + widget = gtk_file_chooser_dialog_new (_("Select a destination"), + NULL, + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + GTK_STOCK_SAVE, + GTK_RESPONSE_OK, + NULL); + gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (widget), + empathy_ft_handler_get_filename (handler)); + g_signal_connect (widget, "response", + G_CALLBACK (file_manager_receive_file_response_cb), handler); + + gtk_widget_show (widget); +} + typedef struct { EmpathySound sound_id; const char * event_ca_id; |