rpms/nautilus-sendto/devel nst-empathy-new-api-again.patch, NONE, 1.1 nautilus-sendto.spec, 1.75, 1.76

Bastien Nocera hadess at fedoraproject.org
Thu Jun 18 15:13:09 UTC 2009


Author: hadess

Update of /cvs/pkgs/rpms/nautilus-sendto/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13807

Modified Files:
	nautilus-sendto.spec 
Added Files:
	nst-empathy-new-api-again.patch 
Log Message:
* Thu Jun 18 2009 Bastien Nocera <bnocera at redhat.com> 1.1.5-4
- Update for new empathy API

nst-empathy-new-api-again.patch:

--- NEW FILE nst-empathy-new-api-again.patch ---
diff --git a/src/plugins/empathy/empathy.c b/src/plugins/empathy/empathy.c
index 25d446f..60c9a15 100644
--- a/src/plugins/empathy/empathy.c
+++ b/src/plugins/empathy/empathy.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Collabora Ltd.
+ * Copyright (C) 2008, 2009 Collabora Ltd.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -16,7 +16,8 @@
  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA 02110-1301  USA.
  *
- * Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
+ * Authors: Jonny Lamb <jonny.lamb at collabora.co.uk>
+ *          Cosimo Cecchi <cosimo.cecchi at collabora.co.uk>
  */
 
 #include "config.h"
@@ -31,8 +32,10 @@
 #include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-contact-manager.h>
 #include <libempathy/empathy-dispatcher.h>
-#include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-ft-factory.h>
+#include <libempathy/empathy-ft-handler.h>
 #include <libempathy/empathy-tp-file.h>
+#include <libempathy/empathy-utils.h>
 
 #include <libempathy-gtk/empathy-contact-selector.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
@@ -41,6 +44,7 @@
 
 static MissionControl *mc = NULL;
 static EmpathyDispatcher *dispatcher = NULL;
+static EmpathyFTFactory *factory = NULL;
 static guint transfers = 0;
 
 static gboolean destroy (NstPlugin *plugin);
@@ -59,6 +63,7 @@ init (NstPlugin *plugin)
   empathy_gtk_init ();
 
   mc = empathy_mission_control_dup_singleton ();
+  dispatcher = empathy_dispatcher_dup_singleton ();
   accounts = mission_control_get_online_connections (mc, FALSE);
 
   if (g_slist_length (accounts) == 0)
@@ -147,16 +152,19 @@ quit (void)
 }
 
 static void
-state_changed_cb (EmpathyTpFile *tp_file,
-                  GParamSpec *arg,
-                  gpointer user_data)
+transfer_done_cb (EmpathyFTHandler *handler,
+                  EmpathyTpFile *tp_file,
+                  NstPlugin *plugin)
 {
-  TpFileTransferState state;
-
-  state = empathy_tp_file_get_state (tp_file, NULL);
+  quit ();  
+}
 
-  if (state == TP_FILE_TRANSFER_STATE_COMPLETED || state == TP_FILE_TRANSFER_STATE_CANCELLED)
-    quit ();
+static void
+transfer_error_cb (EmpathyFTHandler *handler,
+                   GError *error,
+                   NstPlugin *plugin)
+{
+  quit ();
 }
 
 static void
@@ -169,13 +177,14 @@ error_dialog_cb (GtkDialog *dialog,
 }
 
 static void
-send_file_cb (EmpathyDispatchOperation *dispatch,
-              const GError *error,
-              gpointer user_data)
+handler_ready_cb (EmpathyFTFactory *factory,
+                  EmpathyFTHandler *handler,
+                  GError *error,
+                  NstPlugin *plugin)
 {
-  GFile *file = (GFile *) user_data;
+  g_print ("handler ready!, error %p", error);
 
-  if (error)
+  if (error != NULL)
     {
       GtkWidget *dialog;
       dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR,
@@ -187,19 +196,13 @@ send_file_cb (EmpathyDispatchOperation *dispatch,
     }
   else
     {
-      EmpathyTpFile *tp_file;
-
-      tp_file = EMPATHY_TP_FILE (
-          empathy_dispatch_operation_get_channel_wrapper (dispatch));
+      g_signal_connect (handler, "transfer-done",
+          G_CALLBACK (transfer_done_cb), plugin);
+      g_signal_connect (handler, "transfer-error",
+          G_CALLBACK (transfer_error_cb), plugin);
 
-      g_signal_connect (tp_file, "notify::state",
-          G_CALLBACK (state_changed_cb), NULL);
-
-      empathy_tp_file_offer (tp_file, file, NULL);
+      empathy_ft_handler_start_transfer (handler);
     }
-
-  g_object_unref (file);
-
 }
 
 static gboolean
@@ -212,56 +215,27 @@ send_files (NstPlugin *plugin,
 
   contact = get_selected_contact (contact_widget);
 
-  dispatcher = empathy_dispatcher_dup_singleton ();
-
   if (!contact)
     return FALSE;
 
+  factory = empathy_ft_factory_dup_singleton ();
+
+  g_signal_connect (factory, "new-ft-handler",
+      G_CALLBACK (handler_ready_cb), plugin);
+
   for (l = file_list; l; l = l->next)
     {
       gchar *path = l->data;
       GFile *file;
-      GFileInfo *info;
-      GError *error = NULL;
-      GTimeVal mod_timeval;
 
       file = g_file_new_for_uri (path);
 
-      info = g_file_query_info (file,
-          G_FILE_ATTRIBUTE_STANDARD_SIZE ","
-          G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
-          G_FILE_ATTRIBUTE_TIME_MODIFIED ","
-          G_FILE_ATTRIBUTE_STANDARD_NAME,
-          0, NULL, &error);
-
-      if (error)
-        {
-          GtkWidget *dialog;
-          dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR,
-              GTK_BUTTONS_CLOSE, "Failed to get information for %s",
-              path);
-          gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-              "%s", error->message ? error->message : _("No error message"));
-          gtk_dialog_run (GTK_DIALOG (dialog));
-          gtk_widget_destroy (dialog);
-
-          g_object_unref (file);
-          g_object_unref (contact);
-          continue;
-        }
-
-      g_file_info_get_modification_time (info, &mod_timeval);
-
-      empathy_dispatcher_send_file_to_contact (contact,
-          g_file_info_get_name (info),
-          g_file_info_get_size (info),
-          mod_timeval.tv_sec,
-          g_file_info_get_content_type (info),
-          send_file_cb, file);
-
-      transfers++;
-
-      g_object_unref (info);
+      ++transfers;
+
+      empathy_ft_factory_new_transfer_outgoing (factory,
+          contact, file, FALSE);
+
+      g_object_unref (file);
     }
 
   g_object_unref (contact);
@@ -281,8 +255,8 @@ destroy (NstPlugin *plugin)
   if (mc)
     g_object_unref (mc);
 
-  if (dispatcher)
-    g_object_unref (dispatcher);
+  if (factory)
+    g_object_unref (factory);
 
   return TRUE;
 }
diff --git a/src/plugins/empathy/empathy.c b/src/plugins/empathy/empathy.c
index 60c9a15..f38e5e8 100644
--- a/src/plugins/empathy/empathy.c
+++ b/src/plugins/empathy/empathy.c
@@ -31,7 +31,6 @@
 
 #include <libempathy/empathy-debug.h>
 #include <libempathy/empathy-contact-manager.h>
-#include <libempathy/empathy-dispatcher.h>
 #include <libempathy/empathy-ft-factory.h>
 #include <libempathy/empathy-ft-handler.h>
 #include <libempathy/empathy-tp-file.h>
@@ -43,7 +42,6 @@
 #include "nautilus-sendto-plugin.h"
 
 static MissionControl *mc = NULL;
-static EmpathyDispatcher *dispatcher = NULL;
 static EmpathyFTFactory *factory = NULL;
 static guint transfers = 0;
 
@@ -63,7 +61,6 @@ init (NstPlugin *plugin)
   empathy_gtk_init ();
 
   mc = empathy_mission_control_dup_singleton ();
-  dispatcher = empathy_dispatcher_dup_singleton ();
   accounts = mission_control_get_online_connections (mc, FALSE);
 
   if (g_slist_length (accounts) == 0)

diff --git a/configure.in b/configure.in
index 105a01f..cc7159c 100644
--- a/configure.in
+++ b/configure.in
@@ -34,8 +34,8 @@ NAUTILUS_EXTENSION=2.13.3
 DBUS_REQUIRED=1.0
 DBUS_GLIB_REQUIRED=0.60
 GUPNP_AV_REQUIRED=0.2.1
-EMPATHY_REQUIRED=2.25.5
-EMPATHY_GTK_REQUIRED=2.25.2
+EMPATHY_REQUIRED=2.27.3
+EMPATHY_GTK_REQUIRED=2.27.3
 
 AC_SUBST(GLIB_REQUIRED)
 AC_SUBST(GTK_REQUIRED)


Index: nautilus-sendto.spec
===================================================================
RCS file: /cvs/pkgs/rpms/nautilus-sendto/devel/nautilus-sendto.spec,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -p -r1.75 -r1.76
--- nautilus-sendto.spec	31 May 2009 23:21:37 -0000	1.75
+++ nautilus-sendto.spec	18 Jun 2009 15:12:38 -0000	1.76
@@ -1,6 +1,6 @@
 Name:           nautilus-sendto
 Version:        1.1.5
-Release: 	3%{?dist}
+Release: 	4%{?dist}
 Summary:        Nautilus context menu for sending files
 
 Group:          User Interface/Desktops
@@ -9,6 +9,8 @@ URL:            ftp://ftp.gnome.org/pub/
 Source0:        http://download.gnome.org/sources/%{name}/1.1/%{name}-%{version}.tar.bz2
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+Patch0:         nst-empathy-new-api-again.patch
+
 BuildRequires:  gtk2-devel
 BuildRequires:  libglade2-devel
 BuildRequires:  evolution-data-server-devel >= 1.9.1
@@ -42,6 +44,7 @@ additional features.
 
 %prep
 %setup -q
+%patch0 -p1 -b .empathy
 
 %build
 %configure
@@ -95,6 +98,9 @@ fi
 %{_mandir}/man1/nautilus-sendto.1.gz
 
 %changelog
+* Thu Jun 18 2009 Bastien Nocera <bnocera at redhat.com> 1.1.5-4
+- Update for new empathy API
+
 * Sun May 31 2009 Matthias Clasen <mclasen at redhat.com> 1.1.5-3
 - Rebuild against newer empathy
 




More information about the fedora-extras-commits mailing list