aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorxclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4>2008-11-22 00:19:48 +0800
committerxclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4>2008-11-22 00:19:48 +0800
commit48464a641604e83d19cfe6de3544889ff311f3f9 (patch)
treeb59752d20f20c5aa965138180f2fccf5e84a11dc /libempathy-gtk
parentbb6fc083f8c221ce43de2b85eb422b3d35410151 (diff)
downloadgsoc2013-empathy-48464a641604e83d19cfe6de3544889ff311f3f9.tar
gsoc2013-empathy-48464a641604e83d19cfe6de3544889ff311f3f9.tar.gz
gsoc2013-empathy-48464a641604e83d19cfe6de3544889ff311f3f9.tar.bz2
gsoc2013-empathy-48464a641604e83d19cfe6de3544889ff311f3f9.tar.lz
gsoc2013-empathy-48464a641604e83d19cfe6de3544889ff311f3f9.tar.xz
gsoc2013-empathy-48464a641604e83d19cfe6de3544889ff311f3f9.tar.zst
gsoc2013-empathy-48464a641604e83d19cfe6de3544889ff311f3f9.zip
Removed empathy_send_file_with_file_chooser_and_manager and made file transfers always use the manager. (Jonny Lamb)
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk> git-svn-id: svn+ssh://svn.gnome.org/svn/empathy/trunk@1832 4ee84921-47dd-4033-b63a-18d7a039a3e4
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-contact-menu.c2
-rw-r--r--libempathy-gtk/empathy-ui-utils.c57
-rw-r--r--libempathy-gtk/empathy-ui-utils.h8
3 files changed, 13 insertions, 54 deletions
diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c
index 0a2b5eccb..fb01052a1 100644
--- a/libempathy-gtk/empathy-contact-menu.c
+++ b/libempathy-gtk/empathy-contact-menu.c
@@ -196,7 +196,7 @@ static void
contact_file_transfer_menu_item_activate_cb (EmpathyContact *contact)
{
g_return_if_fail (EMPATHY_IS_CONTACT (contact));
- empathy_send_file_with_file_chooser_and_manager (contact);
+ empathy_send_file_with_file_chooser (contact);
}
GtkWidget *
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 1e296db0b..71aaf7eca 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -1450,23 +1450,18 @@ empathy_text_buffer_tag_set (GtkTextBuffer *buffer,
/* Sending files with the file chooser */
-typedef struct {
- EmpathyContact *contact;
- EmpathyFileChooserCallback callback;
- gpointer user_data;
-} FileChooserResponseData;
-
static void
-file_manager_send_file_response_cb (GtkDialog *widget,
- gint response_id,
- FileChooserResponseData *response_data)
+file_manager_send_file_response_cb (GtkDialog *widget,
+ gint response_id,
+ EmpathyContact *contact)
{
if (response_id == GTK_RESPONSE_OK) {
GSList *list;
+ GSList *l;
+ EmpathyFTManager *ft_manager;
list = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (widget));
-
- GSList *l;
+ ft_manager = empathy_ft_manager_get_default ();
DEBUG ("File chooser selected files:");
@@ -1480,11 +1475,10 @@ file_manager_send_file_response_cb (GtkDialog *widget,
gfile = g_file_new_for_uri (uri);
DEBUG ("\t%s", uri);
- tp_file = empathy_send_file (response_data->contact,
+ tp_file = empathy_send_file (contact,
gfile);
- if (response_data->callback)
- response_data->callback (tp_file,
- response_data->user_data);
+
+ empathy_ft_manager_add_tp_file (ft_manager, tp_file);
manager = gtk_recent_manager_get_default ();
gtk_recent_manager_add_item (manager, uri);
@@ -1504,22 +1498,14 @@ file_manager_send_file_response_cb (GtkDialog *widget,
g_slist_free (list);
}
- g_object_unref (response_data->contact);
- g_free (response_data);
gtk_widget_destroy (GTK_WIDGET (widget));
}
void
-empathy_send_file_with_file_chooser (EmpathyContact *contact,
- EmpathyFileChooserCallback callback,
- gpointer user_data)
+empathy_send_file_with_file_chooser (EmpathyContact *contact)
{
GtkWidget *widget;
GtkWidget *button;
- FileChooserResponseData *response_data;
-
- /* FIXME we cannot return the ft as the response is async, maybe we
- * should call a callback with the file when available */
g_return_if_fail (EMPATHY_IS_CONTACT (contact));
@@ -1544,30 +1530,9 @@ empathy_send_file_with_file_chooser (EmpathyContact *contact,
gtk_dialog_set_default_response (GTK_DIALOG (widget),
GTK_RESPONSE_OK);
- response_data = g_new0 (FileChooserResponseData, 1);
- response_data->contact = g_object_ref (contact);
- response_data->callback = callback;
- response_data->user_data = user_data;
g_signal_connect (widget, "response",
G_CALLBACK (file_manager_send_file_response_cb),
- response_data);
+ contact);
gtk_widget_show (widget);
}
-
-static void
-add_file_to_manager (EmpathyTpFile *tp_file,
- EmpathyFTManager *ft_manager)
-{
- empathy_ft_manager_add_tp_file (ft_manager, tp_file);
-}
-
-void
-empathy_send_file_with_file_chooser_and_manager (EmpathyContact *contact)
-{
- g_return_if_fail (EMPATHY_IS_CONTACT (contact));
-
- empathy_send_file_with_file_chooser (contact,
- (EmpathyFileChooserCallback) add_file_to_manager,
- empathy_ft_manager_get_default ());
-}
diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h
index c4b699818..b28a67b89 100644
--- a/libempathy-gtk/empathy-ui-utils.h
+++ b/libempathy-gtk/empathy-ui-utils.h
@@ -116,13 +116,7 @@ GtkTextTag *empathy_text_buffer_tag_set (GtkTextBuffer *buffer,
const gchar *first_property_name,
...);
-typedef gboolean (*EmpathyFileChooserCallback) (EmpathyTpFile *tp_file,
- gpointer user_data);
-
-void empathy_send_file_with_file_chooser (EmpathyContact *contact,
- EmpathyFileChooserCallback callback,
- gpointer user_data);
-void empathy_send_file_with_file_chooser_and_manager (EmpathyContact *contact);
+void empathy_send_file_with_file_chooser (EmpathyContact *contact);
G_END_DECLS