[empathy] Set XDG_DOWNLOAD_DIR as default directory when receiving a file (#612672)



commit c57f6e063efe334033061088263d246868477c88
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri Mar 12 13:45:27 2010 +0100

    Set XDG_DOWNLOAD_DIR as default directory when receiving a file (#612672)

 libempathy-gtk/empathy-ui-utils.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index 807b6af..4b0f4a4 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -1669,6 +1669,7 @@ void
 empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler)
 {
 	GtkWidget *widget;
+	const gchar *dir;
 
 	widget = gtk_file_chooser_dialog_new (_("Select a destination"),
 					      NULL,
@@ -1683,6 +1684,13 @@ empathy_receive_file_with_file_chooser (EmpathyFTHandler *handler)
 	gtk_file_chooser_set_do_overwrite_confirmation
 		(GTK_FILE_CHOOSER (widget), TRUE);
 
+	dir = g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD);
+	if (dir == NULL)
+		/* Fallback to $HOME if $XDG_DOWNLOAD_DIR is not set */
+		dir = g_get_home_dir ();
+
+	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (widget), dir);
+
 	g_signal_connect (widget, "response",
 		G_CALLBACK (file_manager_receive_file_response_cb), handler);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]