diff options
author | Cosimo Cecchi <cosimo.cecchi@collabora.co.uk> | 2009-05-15 06:46:26 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2009-06-01 23:49:57 +0800 |
commit | 0a96c62150fe235167c291ead9a4f180fd80109e (patch) | |
tree | 3420dd852451992e710efa227beb5f63e4fe5cc6 | |
parent | 997c9dabb5fd8ea6631a37a80576d312b0da56d5 (diff) | |
download | gsoc2013-empathy-0a96c62150fe235167c291ead9a4f180fd80109e.tar gsoc2013-empathy-0a96c62150fe235167c291ead9a4f180fd80109e.tar.gz gsoc2013-empathy-0a96c62150fe235167c291ead9a4f180fd80109e.tar.bz2 gsoc2013-empathy-0a96c62150fe235167c291ead9a4f180fd80109e.tar.lz gsoc2013-empathy-0a96c62150fe235167c291ead9a4f180fd80109e.tar.xz gsoc2013-empathy-0a96c62150fe235167c291ead9a4f180fd80109e.tar.zst gsoc2013-empathy-0a96c62150fe235167c291ead9a4f180fd80109e.zip |
Handle construction errors
Handle errors that may arise when constructing the handler from the
factory.
-rw-r--r-- | libempathy/empathy-ft-factory.c | 25 | ||||
-rw-r--r-- | libempathy/empathy-ft-handler.c | 9 | ||||
-rw-r--r-- | src/empathy.c | 14 |
3 files changed, 27 insertions, 21 deletions
diff --git a/libempathy/empathy-ft-factory.c b/libempathy/empathy-ft-factory.c index e294eba61..97fe6022b 100644 --- a/libempathy/empathy-ft-factory.c +++ b/libempathy/empathy-ft-factory.c @@ -73,17 +73,16 @@ empathy_ft_factory_class_init (EmpathyFTFactoryClass *klass) G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, - _empathy_marshal_VOID__OBJECT_BOOLEAN, - G_TYPE_NONE, - 2, EMPATHY_TYPE_FT_HANDLER, G_TYPE_BOOLEAN); + _empathy_marshal_VOID__OBJECT_POINTER, + G_TYPE_NONE, 2, EMPATHY_TYPE_FT_HANDLER, G_TYPE_POINTER); 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); + _empathy_marshal_VOID__OBJECT_POINTER, + G_TYPE_NONE, 2, EMPATHY_TYPE_FT_HANDLER, G_TYPE_POINTER); } static void @@ -99,13 +98,7 @@ ft_handler_outgoing_ready_cb (EmpathyFTHandler *handler, { EmpathyFTFactory *factory = user_data; - if (error != NULL) - { - /* TODO: error handling */ - return; - } - - g_signal_emit (factory, signals[NEW_FT_HANDLER], 0, handler, TRUE); + g_signal_emit (factory, signals[NEW_FT_HANDLER], 0, handler, error); } static void @@ -115,13 +108,7 @@ ft_handler_incoming_ready_cb (EmpathyFTHandler *handler, { EmpathyFTFactory *factory = user_data; - if (error != NULL) - { - /* TODO: error handling */ - return; - } - - g_signal_emit (factory, signals[NEW_INCOMING_TRANSFER], 0, handler); + g_signal_emit (factory, signals[NEW_INCOMING_TRANSFER], 0, handler, error); } /* public methods */ diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index b139fa70e..1f6fd86d2 100644 --- a/libempathy/empathy-ft-handler.c +++ b/libempathy/empathy-ft-handler.c @@ -913,6 +913,9 @@ out: } else { + if (!g_cancellable_is_cancelled (priv->cancellable)) + g_cancellable_cancel (priv->cancellable); + cb_data->callback (NULL, error, cb_data->user_data); g_error_free (error); g_object_unref (cb_data->handler); @@ -934,6 +937,9 @@ contact_factory_contact_cb (EmpathyTpContactFactory *factory, if (error != NULL) { + if (!g_cancellable_is_cancelled (priv->cancellable)) + g_cancellable_cancel (priv->cancellable); + cb_data->callback (NULL, (GError *) error, cb_data->user_data); g_object_unref (handler); return; @@ -959,6 +965,9 @@ channel_get_all_properties_cb (TpProxy *proxy, if (error != NULL) { + if (!g_cancellable_is_cancelled (priv->cancellable)) + g_cancellable_cancel (priv->cancellable); + cb_data->callback (NULL, (GError *) error, cb_data->user_data); g_object_unref (handler); return; diff --git a/src/empathy.c b/src/empathy.c index ffdb97949..3bed5ce7a 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -407,17 +407,27 @@ show_version_cb (const char *option_name, static void new_incoming_transfer_cb (EmpathyFTFactory *factory, EmpathyFTHandler *handler, + GError *error, gpointer user_data) { - empathy_receive_file_with_file_chooser (handler); + if (error) { + empathy_ft_manager_display_error (handler, error); + } else { + empathy_receive_file_with_file_chooser (handler); + } } static void new_ft_handler_cb (EmpathyFTFactory *factory, EmpathyFTHandler *handler, + GError *error, gpointer user_data) { - empathy_ft_manager_add_handler (handler); + if (error) { + empathy_ft_manager_display_error (handler, error); + } else { + empathy_ft_manager_add_handler (handler); + } g_object_unref (handler); } |