aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-ui-utils.c
diff options
context:
space:
mode:
authorShaun McCance <Shaun McCance>2009-09-15 10:15:06 +0800
committerShaun McCance <shaunm@gnome.org>2009-11-25 02:05:31 +0800
commit2e2fdd45ae2d7fac58c9cc40b48c84ffc6b3f48e (patch)
treeacd72f1059e152155f1ae3b30f8aa610c3233cfb /libempathy-gtk/empathy-ui-utils.c
parent783fe36cb4d096a9ed17078e8ddc36b3542b638b (diff)
downloadgsoc2013-empathy-2e2fdd45ae2d7fac58c9cc40b48c84ffc6b3f48e.tar
gsoc2013-empathy-2e2fdd45ae2d7fac58c9cc40b48c84ffc6b3f48e.tar.gz
gsoc2013-empathy-2e2fdd45ae2d7fac58c9cc40b48c84ffc6b3f48e.tar.bz2
gsoc2013-empathy-2e2fdd45ae2d7fac58c9cc40b48c84ffc6b3f48e.tar.lz
gsoc2013-empathy-2e2fdd45ae2d7fac58c9cc40b48c84ffc6b3f48e.tar.xz
gsoc2013-empathy-2e2fdd45ae2d7fac58c9cc40b48c84ffc6b3f48e.tar.zst
gsoc2013-empathy-2e2fdd45ae2d7fac58c9cc40b48c84ffc6b3f48e.zip
Implementing drag and drop file sending on chat windows
Diffstat (limited to 'libempathy-gtk/empathy-ui-utils.c')
-rw-r--r--libempathy-gtk/empathy-ui-utils.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index ce5ec419e..411a76640 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -1451,30 +1451,40 @@ empathy_toggle_button_set_state_quietly (GtkWidget *widget,
g_signal_handlers_unblock_by_func (widget, callback, user_data);
}
+void
+empathy_send_file (EmpathyContact *contact, GFile *file)
+{
+ EmpathyFTFactory *factory;
+ GtkRecentManager *manager;
+ gchar *uri;
+
+ g_return_if_fail (EMPATHY_IS_CONTACT (contact));
+ g_return_if_fail (G_IS_FILE (file));
+
+ factory = empathy_ft_factory_dup_singleton ();
+
+ empathy_ft_factory_new_transfer_outgoing (factory, contact, file);
+
+ uri = g_file_get_uri (file);
+ manager = gtk_recent_manager_get_default ();
+ gtk_recent_manager_add_item (manager, uri);
+ g_free (uri);
+
+ g_object_unref (factory);
+}
+
static void
file_manager_send_file_response_cb (GtkDialog *widget,
gint response_id,
EmpathyContact *contact)
{
- EmpathyFTFactory *factory;
GFile *file;
- gchar *uri;
- GtkRecentManager *manager;
if (response_id == GTK_RESPONSE_OK) {
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (widget));
- uri = g_file_get_uri (file);
-
- factory = empathy_ft_factory_dup_singleton ();
- empathy_ft_factory_new_transfer_outgoing (factory, contact,
- file);
+ empathy_send_file (contact, file);
- manager = gtk_recent_manager_get_default ();
- gtk_recent_manager_add_item (manager, uri);
-
- g_free (uri);
- g_object_unref (factory);
g_object_unref (file);
}