rpms/nautilus-sendto/devel nautilus-sendto-empathy-contact-selector.patch, NONE, 1.1 nautilus-sendto.spec, 1.65, 1.66
Matthias Clasen
mclasen at fedoraproject.org
Wed Mar 18 05:26:30 UTC 2009
- Previous message (by thread): rpms/kernel/devel config-x86-generic, 1.71, 1.72 config-x86_64-generic, 1.70, 1.71 kernel.spec, 1.1439, 1.1440
- Next message (by thread): rpms/eclipse-findbugs/F-10 eclipsePlugin-1.3.8-build.patch, NONE, 1.1 .cvsignore, 1.2, 1.3 eclipse-findbugs.spec, 1.2, 1.3 sources, 1.2, 1.3 eclipsePlugin-1.3.7-build.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: mclasen
Update of /cvs/pkgs/rpms/nautilus-sendto/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23853
Modified Files:
nautilus-sendto.spec
Added Files:
nautilus-sendto-empathy-contact-selector.patch
Log Message:
make run with current Empathy
nautilus-sendto-empathy-contact-selector.patch:
--- NEW FILE nautilus-sendto-empathy-contact-selector.patch ---
diff -up nautilus-sendto-1.1.2/src/plugins/empathy/empathy.c.empathy-contact-selector nautilus-sendto-1.1.2/src/plugins/empathy/empathy.c
--- nautilus-sendto-1.1.2/src/plugins/empathy/empathy.c.empathy-contact-selector 2009-02-09 06:14:53.000000000 -0500
+++ nautilus-sendto-1.1.2/src/plugins/empathy/empathy.c 2009-03-18 01:19:37.695461932 -0400
@@ -26,23 +26,25 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
+#include <telepathy-glib/enums.h>
+#include <telepathy-glib/connection.h>
+
#include <libempathy/empathy-debug.h>
#include <libempathy/empathy-contact-manager.h>
#include <libempathy/empathy-dispatcher.h>
#include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-tp-file.h>
-#include <libempathy-gtk/empathy-contact-list-store.h>
+#include <libempathy-gtk/empathy-contact-selector.h>
#include "nautilus-sendto-plugin.h"
-static EmpathyContactManager *manager = NULL;
-static MissionControl *mc = NULL;
-
static gboolean destroy (NstPlugin *plugin);
static gboolean
init (NstPlugin *plugin)
{
+ MissionControl *mc = NULL;
GSList *accounts = NULL;
GSList *l;
@@ -50,9 +52,11 @@ init (NstPlugin *plugin)
empathy_debug_set_flags (g_getenv ("EMPATHY_DEBUG"));
- mc = empathy_mission_control_new ();
+ mc = empathy_mission_control_dup_singleton ();
accounts = mission_control_get_online_connections (mc, FALSE);
+ g_object_unref (mc);
+
if (g_slist_length (accounts) == 0)
{
destroy (plugin);
@@ -70,27 +74,15 @@ init (NstPlugin *plugin)
static GtkWidget *
get_contacts_widget (NstPlugin *plugin)
{
- EmpathyContactListStore *store;
- GtkWidget *combo;
- GtkCellRenderer *renderer;
-
- /* TODO: Replace all this with EmpathyContactSelector once it's fixed up and
- * merged into libempathy-gtk. */
- manager = empathy_contact_manager_new ();
- store = empathy_contact_list_store_new (EMPATHY_CONTACT_LIST (manager));
+ EmpathyContactManager *manager;
+ GtkWidget *selector;
- empathy_contact_list_store_set_is_compact (store, TRUE);
- empathy_contact_list_store_set_show_groups (store, FALSE);
+ manager = empathy_contact_manager_dup_singleton ();
+ selector = empathy_contact_selector_new (EMPATHY_CONTACT_LIST (manager));
- combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
+ g_object_unref (manager);
- renderer = gtk_cell_renderer_text_new ();
-
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
- gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo),
- renderer, "text", EMPATHY_CONTACT_LIST_STORE_COL_NAME);
-
- return combo;
+ return selector;
}
static gboolean
@@ -140,6 +132,95 @@ validate_destination (NstPlugin *plugin,
return TRUE;
}
+static EmpathyTpFile *
+empathy_dispatcher_send_file (EmpathyContact *contact,
+ GFile *gfile)
+
+{
+ GFileInfo *info;
+ guint64 size;
+ MissionControl *mc;
+ McAccount *account;
+ TpConnection *connection;
+ guint handle;
+ gchar *object_path;
+ TpChannel *channel;
+ EmpathyTpFile *tp_file;
+ GError *error = NULL;
+ GValue value = { 0 };
+ gchar *filename;
+
+ g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL);
+ g_return_val_if_fail (G_IS_FILE (gfile), NULL);
+
+ info = g_file_query_info (gfile,
+ G_FILE_ATTRIBUTE_STANDARD_SIZE ","
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ 0, NULL, NULL);
+ size = info ? g_file_info_get_size (info) : EMPATHY_TP_FILE_UNKNOWN_SIZE;
+ filename = g_file_get_basename (gfile);
+ mc = empathy_mission_control_dup_singleton ();
+ account = empathy_contact_get_account (contact);
+ connection = mission_control_get_tpconnection (mc, account, NULL);
+ tp_connection_run_until_ready (connection, FALSE, NULL, NULL);
+ handle = empathy_contact_get_handle (contact);
+
+ if (!tp_cli_connection_run_request_channel (connection, -1,
+ TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER,
+ TP_HANDLE_TYPE_CONTACT,
+ handle,
+ TRUE,
+ &object_path,
+ &error,
+ NULL)) {
+ g_clear_error (&error);
+ g_object_unref (mc);
+ g_object_unref (connection);
+ return NULL;
+ }
+
+ channel = tp_channel_new (connection,
+ object_path,
+ TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER,
+ TP_HANDLE_TYPE_CONTACT,
+ handle,
+ NULL);
+
+ /* FIXME: this should go in CreateChannel in the new requests API */
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, g_filename_display_basename (filename));
+ tp_cli_dbus_properties_call_set (TP_PROXY (channel), -1,
+ TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "Filename",
+ &value, NULL, NULL, NULL, NULL);
+ g_value_reset (&value);
+
+ g_value_set_string (&value, g_file_info_get_content_type (info));
+ tp_cli_dbus_properties_call_set (TP_PROXY (channel), -1,
+ TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "ContentType",
+ &value, NULL, NULL, NULL, NULL);
+
+ g_value_unset (&value);
+
+ g_value_init (&value, G_TYPE_UINT64);
+ g_value_set_uint64 (&value, size);
+ tp_cli_dbus_properties_call_set (TP_PROXY (channel), -1,
+ TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "Size",
+ &value, NULL, NULL, NULL, NULL);
+ g_value_unset (&value);
+
+ tp_file = empathy_tp_file_new (channel);
+
+ empathy_tp_file_offer (tp_file, gfile, NULL);
+
+ g_object_unref (mc);
+ g_object_unref (connection);
+ g_object_unref (channel);
+ g_free (object_path);
+
+ return tp_file;
+}
+
static gboolean
send_files (NstPlugin *plugin,
GtkWidget *contact_widget,
@@ -157,6 +238,7 @@ send_files (NstPlugin *plugin,
GFile *file;
file = g_file_new_for_uri (path);
+
empathy_dispatcher_send_file (contact, file);
g_object_unref (file);
@@ -171,12 +253,6 @@ send_files (NstPlugin *plugin,
static gboolean
destroy (NstPlugin *plugin)
{
- if (manager)
- g_object_unref (manager);
-
- if (mc)
- g_object_unref (mc);
-
return TRUE;
}
Index: nautilus-sendto.spec
===================================================================
RCS file: /cvs/pkgs/rpms/nautilus-sendto/devel/nautilus-sendto.spec,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- nautilus-sendto.spec 4 Mar 2009 21:43:09 -0000 1.65
+++ nautilus-sendto.spec 18 Mar 2009 05:25:59 -0000 1.66
@@ -1,6 +1,6 @@
Name: nautilus-sendto
Version: 1.1.2
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Nautilus context menu for sending files
Group: User Interface/Desktops
@@ -31,6 +31,9 @@
Obsoletes: nautilus-sendto-bluetooth
Provides: nautilus-sendto-bluetooth
+# http://bugzilla.gnome.org/show_bug.cgi?id=567065
+Patch0: nautilus-sendto-empathy-contact-selector.patch
+
%description
The nautilus-sendto package provides a Nautilus context menu for
sending files via other desktop applications. These functions are
@@ -40,6 +43,7 @@
%prep
%setup -q
+%patch0 -p1 -b .empathy-contact-selector
%build
%configure
@@ -94,6 +98,9 @@
%{_mandir}/man1/nautilus-sendto.1.gz
%changelog
+* Tue Mar 17 2009 Matthias Clasen <mclasen at redhat.com> - 1.1.2-4
+- Make build and run with current Empathy
+
* Wed Mar 04 2009 Warren Togami <wtogami at redhat.com> - 1.1.2-3
- rebuild for libempathy
- Previous message (by thread): rpms/kernel/devel config-x86-generic, 1.71, 1.72 config-x86_64-generic, 1.70, 1.71 kernel.spec, 1.1439, 1.1440
- Next message (by thread): rpms/eclipse-findbugs/F-10 eclipsePlugin-1.3.8-build.patch, NONE, 1.1 .cvsignore, 1.2, 1.3 eclipse-findbugs.spec, 1.2, 1.3 sources, 1.2, 1.3 eclipsePlugin-1.3.7-build.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list