summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-10-22 17:00:48 +0200
committerBerke Viktor <bviktor@hexchat.org>2012-10-22 17:00:48 +0200
commit302a06e2e15901a3764b30914a772efe5bad220f (patch)
tree7b484ff8e06dc221f39d783ae3ebc983a509940e /src
parentb007592cdef959219784aecf3be54c707054982a (diff)
Fix previous, failed attempt at fixing the default folder for DCC transfers
Diffstat (limited to 'src')
-rw-r--r--src/fe-gtk/fe-gtk.c2
-rw-r--r--src/fe-gtk/gtkutil.c18
2 files changed, 19 insertions, 1 deletions
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index 12b636a7..9272c6b3 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -919,7 +919,7 @@ fe_confirm (const char *message, void (*yesproc)(void *), void (*noproc)(void *)
 
 	if (dcc->file)
 		gtkutil_file_req (message, dcc_saveas_cb, ud, dcc->file, NULL,
-								FRF_WRITE|FRF_FILTERISINITIAL|FRF_NOASKOVERWRITE);
+								FRF_WRITE|FRF_NOASKOVERWRITE);
 }
 
 int
diff --git a/src/fe-gtk/gtkutil.c b/src/fe-gtk/gtkutil.c
index a6fb12aa..241ff3e5 100644
--- a/src/fe-gtk/gtkutil.c
+++ b/src/fe-gtk/gtkutil.c
@@ -49,6 +49,8 @@
 #include "../common/xchat.h"
 #include "../common/fe.h"
 #include "../common/util.h"
+#include "../common/cfgfiles.h"
+#include "../common/xchatc.h"
 #include "gtkutil.h"
 #include "pixmaps.h"
 
@@ -473,7 +475,23 @@ gtkutil_file_req (const char *title, void *callback, void *userdata, char *filte
 	else
 	{
 		if (filter && (flags & FRF_FILTERISINITIAL))
+		{
 			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), filter);
+		}
+		/* With DCC, we can't rely on filter as initial folder since filter already contains
+		 * the filename upon DCC RECV. Thus we have no better option than to check for the message
+		 * which will be the title of the window. For DCC it always contains the "offering" word.
+		 * This method is really ugly but it works so we'll stick with it for now.
+		 */
+		else if (strstr (title, "offering") != NULL)
+		{
+			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), prefs.hex_dcc_dir);
+		}
+		/* by default, open the config folder */
+		else
+		{
+			gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), get_xdir_fs ());
+		}
 	}
 
 	if (flags & FRF_EXTENSIONS && extensions != NULL)