diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2009-05-06 02:10:23 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2009-06-01 23:47:40 +0800 |
commit | 3d6b55954ec8fe6fd037f78f3114bdf6f6952e1a (patch) | |
tree | 74173d5297fc4618fe0af8a4258605ff6439800a /libempathy | |
parent | c7ea0ef05972116a5b29b50bad98f759cb641e4c (diff) | |
download | gsoc2013-empathy-3d6b55954ec8fe6fd037f78f3114bdf6f6952e1a.tar gsoc2013-empathy-3d6b55954ec8fe6fd037f78f3114bdf6f6952e1a.tar.gz gsoc2013-empathy-3d6b55954ec8fe6fd037f78f3114bdf6f6952e1a.tar.bz2 gsoc2013-empathy-3d6b55954ec8fe6fd037f78f3114bdf6f6952e1a.tar.lz gsoc2013-empathy-3d6b55954ec8fe6fd037f78f3114bdf6f6952e1a.tar.xz gsoc2013-empathy-3d6b55954ec8fe6fd037f78f3114bdf6f6952e1a.tar.zst gsoc2013-empathy-3d6b55954ec8fe6fd037f78f3114bdf6f6952e1a.zip |
First cleanup after rebase
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-dispatch-operation.c | 17 | ||||
-rw-r--r-- | libempathy/empathy-dispatcher.c | 2 | ||||
-rw-r--r-- | libempathy/empathy-ft-handler.c | 80 | ||||
-rw-r--r-- | libempathy/empathy-tp-file.c | 18 |
4 files changed, 40 insertions, 77 deletions
diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c index 2a98b912a..7a116f870 100644 --- a/libempathy/empathy-dispatch-operation.c +++ b/libempathy/empathy-dispatch-operation.c @@ -406,23 +406,6 @@ empathy_dispatcher_operation_tp_chat_ready_cb (GObject *object, } static void -empathy_dispatcher_operation_tp_file_ready_cb (GObject *object, - GParamSpec *spec, gpointer user_data) -{ - EmpathyDispatchOperation *self = EMPATHY_DISPATCH_OPERATION (user_data); - EmpathyDispatchOperationPriv *priv = GET_PRIV (self); - - if (!empathy_tp_file_is_ready (EMPATHY_TP_FILE (priv->channel_wrapper))) - return; - - g_signal_handler_disconnect (priv->channel_wrapper, priv->ready_handler); - priv->ready_handler = 0; - - empathy_dispatch_operation_set_status (self, - EMPATHY_DISPATCHER_OPERATION_STATE_PENDING); -} - -static void empathy_dispatch_operation_channel_ready_cb (TpChannel *channel, const GError *error, gpointer user_data) { diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index bc216d6f1..393c4a92d 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -38,7 +38,7 @@ #include "empathy-utils.h" #include "empathy-tube-handler.h" #include "empathy-account-manager.h" -#include "empathy-contact-factory.h" +#include "empathy-tp-contact-factory.h" #include "empathy-chatroom-manager.h" #include "empathy-utils.h" diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index 2ad946480..6c3dae81c 100644 --- a/libempathy/empathy-ft-handler.c +++ b/libempathy/empathy-ft-handler.c @@ -26,7 +26,7 @@ #include <telepathy-glib/util.h> #include "empathy-ft-handler.h" -#include "empathy-contact-factory.h" +#include "empathy-tp-contact-factory.h" #include "empathy-dispatcher.h" #include "empathy-marshal.h" #include "empathy-time.h" @@ -475,16 +475,16 @@ static void ft_handler_push_to_dispatcher (EmpathyFTHandler *handler) { EmpathyDispatcher *dispatcher; - McAccount *account; + TpConnection *connection; EmpathyFTHandlerPriv *priv = GET_PRIV (handler); DEBUG ("Pushing request to the dispatcher"); dispatcher = empathy_dispatcher_dup_singleton (); - account = empathy_contact_get_account (priv->contact); + connection = empathy_contact_get_connection (priv->contact); /* I want to own a reference to the request, and destroy it later */ - empathy_dispatcher_create_channel (dispatcher, account, + empathy_dispatcher_create_channel (dispatcher, connection, g_hash_table_ref (priv->request), ft_handler_create_channel_cb, handler); g_object_unref (dispatcher); @@ -495,14 +495,14 @@ ft_handler_check_if_allowed (EmpathyFTHandler *handler) { EmpathyDispatcher *dispatcher; EmpathyFTHandlerPriv *priv = GET_PRIV (handler); - McAccount *account; + TpConnection *connection; GStrv allowed; gboolean res = TRUE; dispatcher = empathy_dispatcher_dup_singleton (); - account = empathy_contact_get_account (priv->contact); + connection = empathy_contact_get_connection (priv->contact); - allowed = empathy_dispatcher_find_channel_class (dispatcher, account, + allowed = empathy_dispatcher_find_channel_class (dispatcher, connection, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, TP_HANDLE_TYPE_CONTACT); if (!tp_strv_contains ((const gchar * const *) allowed, @@ -800,29 +800,27 @@ out: callbacks_data_free (cb_data); } -static void -ft_handler_contact_ready_cb (EmpathyContact *contact, - const GError *error, - gpointer user_data, - GObject *weak_object) +static void +contact_factory_contact_cb (EmpathyTpContactFactory *factory, + EmpathyContact *contact, + const GError *error, + gpointer user_data, + GObject *weak_object) { CallbacksData *cb_data = user_data; - EmpathyFTHandlerPriv *priv = GET_PRIV (weak_object); + EmpathyFTHandler *handler = EMPATHY_FT_HANDLER (weak_object); + EmpathyFTHandlerPriv *priv = GET_PRIV (handler); - g_assert (priv->contact != NULL); - g_assert (priv->gfile != NULL); + if (error != NULL) + { + cb_data->callback (NULL, (GError *) error, cb_data->user_data); + g_object_unref (handler); + return; + } - DEBUG ("Contact is ready."); + priv->contact = contact; - /* start collecting info about the file */ - g_file_query_info_async (priv->gfile, - G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," - G_FILE_ATTRIBUTE_STANDARD_SIZE "," - G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," - G_FILE_ATTRIBUTE_TIME_MODIFIED, - G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, - NULL, (GAsyncReadyCallback) ft_handler_gfile_ready_cb, - cb_data); + cb_data->callback (handler, NULL, cb_data->user_data); } static void @@ -835,9 +833,8 @@ channel_get_all_properties_cb (TpProxy *proxy, CallbacksData *cb_data = user_data; EmpathyFTHandler *handler = EMPATHY_FT_HANDLER (weak_object); EmpathyFTHandlerPriv *priv = GET_PRIV (handler); - EmpathyContactFactory *c_factory; - guint c_handle; - McAccount *account; + EmpathyTpContactFactory *c_factory; + TpHandle c_handle; if (error != NULL) { @@ -869,16 +866,12 @@ channel_get_all_properties_cb (TpProxy *proxy, g_hash_table_destroy (properties); - c_factory = empathy_contact_factory_dup_singleton (); - account = empathy_channel_get_account (TP_CHANNEL (proxy)); + c_factory = empathy_tp_contact_factory_dup_singleton + (tp_channel_borrow_connection (TP_CHANNEL (proxy))); c_handle = tp_channel_get_handle (TP_CHANNEL (proxy), NULL); - priv->contact = empathy_contact_factory_get_from_handle - (c_factory, account, c_handle); - - g_object_unref (c_factory); - g_object_unref (account); - - cb_data->callback (handler, NULL, cb_data->user_data); + empathy_tp_contact_factory_get_from_handle (c_factory, c_handle, + contact_factory_contact_cb, cb_data, callbacks_data_free, + G_OBJECT (handler)); } /* public methods */ @@ -906,9 +899,14 @@ empathy_ft_handler_new_outgoing (EmpathyContact *contact, data->user_data = user_data; data->handler = g_object_ref (handler); - empathy_contact_call_when_ready (priv->contact, - EMPATHY_CONTACT_READY_HANDLE, - ft_handler_contact_ready_cb, data, NULL, G_OBJECT (handler)); + /* start collecting info about the file */ + g_file_query_info_async (priv->gfile, + G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," + G_FILE_ATTRIBUTE_STANDARD_SIZE "," + G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," + G_FILE_ATTRIBUTE_TIME_MODIFIED, + G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, + NULL, (GAsyncReadyCallback) ft_handler_gfile_ready_cb, data); } void @@ -934,7 +932,7 @@ empathy_ft_handler_new_incoming (EmpathyTpFile *tp_file, tp_cli_dbus_properties_call_get_all (channel, -1, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, - channel_get_all_properties_cb, data, callbacks_data_free, G_OBJECT (handler)); + channel_get_all_properties_cb, data, NULL, G_OBJECT (handler)); } void diff --git a/libempathy/empathy-tp-file.c b/libempathy/empathy-tp-file.c index 03dfb7875..7fa4548c9 100644 --- a/libempathy/empathy-tp-file.c +++ b/libempathy/empathy-tp-file.c @@ -814,21 +814,3 @@ empathy_tp_file_cancel (EmpathyTpFile *tp_file) { close_channel_internal (tp_file, TRUE); } - -/** - * empathy_tp_file_is_ready: - * @tp_file: an #EmpathyTpFile - * - * Returns whether the file channel @tp_file is ready for use. - * - * @tp_file is classed as ready if its state is no longer - * %TP_FILE_TRANSFER_STATE_NONE, or if details about the remote - * contact have been fully received. - * - * Return value: %TRUE if @tp_file is ready for use - */ -gboolean -empathy_tp_file_is_ready (EmpathyTpFile *tp_file) -{ - close_channel_internal (tp_file, FALSE); -} |