Mercurial > pidgin.yaz
comparison libgaim/ft.c @ 14905:dff16b654f14
[gaim-migrate @ 17677]
sf patch #1588433, from Ka-Hing Cheung
"prompt again if non-writable dir selected for FT"
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 06 Nov 2006 00:14:30 +0000 |
parents | 118fd0dc5b6e |
children | 59189ce09f10 |
comparison
equal
deleted
inserted
replaced
14904:0512fddbaaf2 | 14905:dff16b654f14 |
---|---|
31 #include "request.h" | 31 #include "request.h" |
32 #include "util.h" | 32 #include "util.h" |
33 | 33 |
34 static GaimXferUiOps *xfer_ui_ops = NULL; | 34 static GaimXferUiOps *xfer_ui_ops = NULL; |
35 | 35 |
36 static int gaim_xfer_choose_file(GaimXfer *xfer); | |
37 | |
36 GaimXfer * | 38 GaimXfer * |
37 gaim_xfer_new(GaimAccount *account, GaimXferType type, const char *who) | 39 gaim_xfer_new(GaimAccount *account, GaimXferType type, const char *who) |
38 { | 40 { |
39 GaimXfer *xfer; | 41 GaimXfer *xfer; |
40 GaimXferUiOps *ui_ops; | 42 GaimXferUiOps *ui_ops; |
208 static void | 210 static void |
209 gaim_xfer_choose_file_ok_cb(void *user_data, const char *filename) | 211 gaim_xfer_choose_file_ok_cb(void *user_data, const char *filename) |
210 { | 212 { |
211 GaimXfer *xfer; | 213 GaimXfer *xfer; |
212 struct stat st; | 214 struct stat st; |
215 gchar *dir; | |
213 | 216 |
214 xfer = (GaimXfer *)user_data; | 217 xfer = (GaimXfer *)user_data; |
215 | 218 |
216 if (g_stat(filename, &st) != 0) { | 219 if (g_stat(filename, &st) != 0) { |
217 /* File not found. */ | 220 /* File not found. */ |
218 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | 221 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
219 gaim_xfer_request_accepted(xfer, filename); | 222 dir = g_path_get_dirname(filename); |
223 | |
224 if (g_access(dir, W_OK) == 0) { | |
225 gaim_xfer_request_accepted(xfer, filename); | |
226 } else { | |
227 gaim_xfer_ref(xfer); | |
228 gaim_notify_message( | |
229 NULL, GAIM_NOTIFY_MSG_ERROR, NULL, | |
230 _("Directory is not writable."), NULL, | |
231 (GaimNotifyCloseCallback)gaim_xfer_choose_file, xfer); | |
232 } | |
233 | |
234 g_free(dir); | |
220 } | 235 } |
221 else { | 236 else { |
222 gaim_xfer_show_file_error(xfer, filename); | 237 gaim_xfer_show_file_error(xfer, filename); |
223 gaim_xfer_request_denied(xfer); | 238 gaim_xfer_request_denied(xfer); |
224 } | 239 } |