]> git.0d.be Git - empathy.git/commitdiff
Cleanup after rebase v2
authorCosimo Cecchi <cosimoc@gnome.org>
Tue, 5 May 2009 19:19:38 +0000 (21:19 +0200)
committerCosimo Cecchi <cosimoc@gnome.org>
Mon, 1 Jun 2009 15:47:40 +0000 (17:47 +0200)
libempathy/empathy-tp-file.c
src/empathy-event-manager.c
src/empathy-ft-manager.c
src/empathy-ft-manager.h
src/empathy-main-window.c

index 7fa4548c9405c3eef6c489bb5f52beddc9c92614..a2a999b81f9bbd05d79c2fbee0c400a95950048e 100644 (file)
@@ -812,5 +812,15 @@ empathy_tp_file_is_incoming (EmpathyTpFile *tp_file)
 void
 empathy_tp_file_cancel (EmpathyTpFile *tp_file)
 {
+  g_return_if_fail (EMPATHY_IS_TP_FILE (tp_file));
+
   close_channel_internal (tp_file, TRUE);
 }
+
+void
+empathy_tp_file_close (EmpathyTpFile *tp_file)
+{
+  g_return_if_fail (EMPATHY_IS_TP_FILE (tp_file));
+
+  close_channel_internal (tp_file, FALSE);
+}
index bd31b193e80270ae0df6239a5dbe57b601fdf1a1..c8749bc4674e67f19d2662e8cfad0f441efb8847 100644 (file)
@@ -751,6 +751,32 @@ event_manager_muc_invite_got_contact_cb (EmpathyTpContactFactory *factory,
   g_free (msg);
 }
 
+static void
+event_manager_ft_got_contact_cb (EmpathyTpContactFactory *factory,
+                                 EmpathyContact *contact,
+                                 const GError *error,
+                                 gpointer user_data,
+                                 GObject *object)
+{
+  EventManagerApproval *approval = (EventManagerApproval *) user_data;
+  char *header;
+
+  approval->contact = contact;
+
+  header = g_strdup_printf (_("Incoming file transfer from %s"),
+                            empathy_contact_get_name (approval->contact));
+
+  event_manager_add (approval->manager, approval->contact,
+      EMPATHY_IMAGE_DOCUMENT_SEND, header, NULL, approval,
+      event_channel_process_func, NULL);
+
+  /* FIXME better sound for incoming file transfers ?*/
+  empathy_sound_play (empathy_main_window_get (),
+                      EMPATHY_SOUND_CONVERSATION_NEW);
+
+  g_free (header);
+}
+
 static void
 event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
   EmpathyDispatchOperation  *operation, EmpathyEventManager *manager)
@@ -839,23 +865,18 @@ event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
     }
   else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER))
     {
-      EmpathyTpFile *file;
-      gchar *header;
-
-      file = EMPATHY_TP_FILE (empathy_dispatch_operation_get_channel_wrapper (operation));
-      approval->contact = g_object_ref (empathy_tp_file_get_contact (file));
-
-      header = g_strdup_printf (_("Incoming file transfer from %s"),
-        empathy_contact_get_name (approval->contact));
-
-      event_manager_add (manager, approval->contact, EMPATHY_IMAGE_DOCUMENT_SEND,
-        header, NULL, approval, event_channel_process_func, NULL);
+      TpChannel *channel;
+      TpConnection *connection;
+      TpHandle handle;
+      EmpathyTpContactFactory *factory;
 
-      /* FIXME better sound for incoming file transfers ?*/
-      empathy_sound_play (empathy_main_window_get (),
-        EMPATHY_SOUND_CONVERSATION_NEW);
+      channel = empathy_dispatch_operation_get_channel (operation);
+      handle = tp_channel_get_handle (channel, NULL);
 
-      g_free (header);
+      connection = tp_channel_borrow_connection (channel);
+      factory = empathy_tp_contact_factory_dup_singleton (connection);
+      empathy_tp_contact_factory_get_from_handle (factory, handle,
+        event_manager_ft_got_contact_cb, approval, NULL, G_OBJECT (manager));
     }
   else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAM_TUBE) ||
       !tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_DBUS_TUBE))
index 91c1ef0d890cfc6136a0d88fabed01ab5a71d353..40a1d7b6c8068627767fa346fa857c2dc833eae1 100644 (file)
@@ -1084,3 +1084,13 @@ empathy_ft_manager_display_error (EmpathyFTManager *manager,
   ft_manager_add_handler_to_list (manager, handler, error);
   gtk_window_present (GTK_WINDOW (priv->window));
 }
+
+void
+empathy_ft_manager_show (EmpathyFTManager *manager)
+{
+  EmpathyFTManagerPriv *priv = GET_PRIV (manager);
+
+  g_return_if_fail (EMPATHY_IS_FT_MANAGER (manager));
+
+  gtk_window_present (GTK_WINDOW (priv->window));
+}
index 7a2fbcdc0fbe47d7a24660dad46bdfb2737583bb..7200f3f080c3e420d9a9d5a5a0c5c21dff823f08 100644 (file)
@@ -66,6 +66,7 @@ void empathy_ft_manager_add_handler (EmpathyFTManager *ft_manager,
     EmpathyFTHandler *handler);
 void empathy_ft_manager_display_error (EmpathyFTManager *ft_manager,
     EmpathyFTHandler *handler, const GError *error);
+void empathy_ft_manager_show (EmpathyFTManager *manager);
 
 G_END_DECLS
 
index e538072362a53818080a332a4b22495525dfed97..43e9224bb3910c521ee67c16b061366a0b03bb18 100644 (file)
@@ -696,12 +696,10 @@ main_window_view_show_ft_manager (GtkAction         *action,
                                  EmpathyMainWindow *window)
 {
        EmpathyFTManager *manager;
-       GtkWidget *dialog;
 
        manager = empathy_ft_manager_dup_singleton ();
-       dialog = empathy_ft_manager_get_dialog (manager);
+       empathy_ft_manager_show (manager);
 
-       gtk_window_present (GTK_WINDOW (dialog));
        g_object_unref (manager);
 }