|
Lines 18-23
typedef struct
Link Here
|
| 18 |
gboolean delete_target; |
18 |
gboolean delete_target; |
| 19 |
guint timeout_id; |
19 |
guint timeout_id; |
| 20 |
gboolean canceled; |
20 |
gboolean canceled; |
|
|
21 |
gint vfs_status; |
| 22 |
gchar *target_dir; |
| 21 |
} TransferInfo; |
23 |
} TransferInfo; |
| 22 |
|
24 |
|
| 23 |
static gboolean show_dialog_timeout (TransferInfo *transfer_info); |
25 |
static gboolean show_dialog_timeout (TransferInfo *transfer_info); |
|
Lines 148-153
handle_transfer_ok (const GnomeVFSXferPr
Link Here
|
| 148 |
} |
150 |
} |
| 149 |
|
151 |
|
| 150 |
static gint |
152 |
static gint |
|
|
153 |
handle_access_error (GnomeVFSXferProgressInfo *progress_info, |
| 154 |
TransferInfo *transfer_info) |
| 155 |
{ |
| 156 |
GtkWidget *dialog; |
| 157 |
remove_timeout (transfer_info); |
| 158 |
dialog = gtk_message_dialog_new (GTK_WINDOW (transfer_info_get_parent (transfer_info)), |
| 159 |
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, |
| 160 |
GTK_MESSAGE_ERROR, |
| 161 |
GTK_BUTTONS_OK, |
| 162 |
_("Insufficient permissions to save the file in:\n%s"), |
| 163 |
transfer_info->target_dir); |
| 164 |
|
| 165 |
gtk_dialog_run (GTK_DIALOG (dialog)); |
| 166 |
gtk_widget_destroy (dialog); |
| 167 |
if (transfer_info->progress_dialog) |
| 168 |
{ |
| 169 |
gtk_widget_destroy (transfer_info->progress_dialog); |
| 170 |
transfer_info->progress_dialog = NULL; |
| 171 |
} |
| 172 |
gtk_main_quit (); |
| 173 |
return 1; |
| 174 |
} |
| 175 |
|
| 176 |
static gint |
| 151 |
handle_transfer_vfs_error (GnomeVFSXferProgressInfo *progress_info, |
177 |
handle_transfer_vfs_error (GnomeVFSXferProgressInfo *progress_info, |
| 152 |
TransferInfo *transfer_info) |
178 |
TransferInfo *transfer_info) |
| 153 |
{ |
179 |
{ |
|
Lines 216-221
screenshot_async_xfer_progress (GnomeVFS
Link Here
|
| 216 |
{ |
242 |
{ |
| 217 |
TransferInfo *transfer_info = data; |
243 |
TransferInfo *transfer_info = data; |
| 218 |
|
244 |
|
|
|
245 |
transfer_info->vfs_status = progress_info->vfs_status; |
| 246 |
|
| 219 |
switch (progress_info->status) |
247 |
switch (progress_info->status) |
| 220 |
{ |
248 |
{ |
| 221 |
case GNOME_VFS_XFER_PROGRESS_STATUS_OK: |
249 |
case GNOME_VFS_XFER_PROGRESS_STATUS_OK: |
|
Lines 233-238
screenshot_async_xfer_progress (GnomeVFS
Link Here
|
| 233 |
} |
261 |
} |
| 234 |
} |
262 |
} |
| 235 |
|
263 |
|
|
|
264 |
static gint |
| 265 |
screenshot_async_xfer_sync (GnomeVFSXferProgressInfo *progress_info, |
| 266 |
gpointer data) |
| 267 |
{ |
| 268 |
TransferInfo *transfer_info = data; |
| 269 |
|
| 270 |
g_print ("xfer_sync: %d\n", progress_info->vfs_status); |
| 271 |
|
| 272 |
transfer_info->vfs_status = progress_info->vfs_status; |
| 273 |
|
| 274 |
if (progress_info->vfs_status == GNOME_VFS_ERROR_ACCESS_DENIED) |
| 275 |
return handle_access_error (progress_info, transfer_info); |
| 276 |
else |
| 277 |
return GNOME_VFS_OK; |
| 278 |
} |
| 279 |
|
| 236 |
static gboolean |
280 |
static gboolean |
| 237 |
show_dialog_timeout (TransferInfo *transfer_info) |
281 |
show_dialog_timeout (TransferInfo *transfer_info) |
| 238 |
{ |
282 |
{ |
|
Lines 259-264
screenshot_xfer_uri (GnomeVFSURI *source
Link Here
|
| 259 |
|
303 |
|
| 260 |
transfer_info = g_new0 (TransferInfo, 1); |
304 |
transfer_info = g_new0 (TransferInfo, 1); |
| 261 |
transfer_info->parent_dialog = parent; |
305 |
transfer_info->parent_dialog = parent; |
|
|
306 |
transfer_info->target_dir = g_strdup (gnome_vfs_uri_extract_dirname (target_uri)); |
| 262 |
add_timeout (transfer_info); |
307 |
add_timeout (transfer_info); |
| 263 |
|
308 |
|
| 264 |
result = gnome_vfs_async_xfer (&transfer_info->handle, |
309 |
result = gnome_vfs_async_xfer (&transfer_info->handle, |
|
Lines 268-274
screenshot_xfer_uri (GnomeVFSURI *source
Link Here
|
| 268 |
GNOME_VFS_XFER_OVERWRITE_MODE_QUERY, |
313 |
GNOME_VFS_XFER_OVERWRITE_MODE_QUERY, |
| 269 |
GNOME_VFS_PRIORITY_DEFAULT, |
314 |
GNOME_VFS_PRIORITY_DEFAULT, |
| 270 |
screenshot_async_xfer_progress, transfer_info, |
315 |
screenshot_async_xfer_progress, transfer_info, |
| 271 |
NULL, NULL); |
316 |
screenshot_async_xfer_sync, transfer_info); |
| 272 |
gtk_main (); |
317 |
gtk_main (); |
| 273 |
remove_timeout (transfer_info); |
318 |
remove_timeout (transfer_info); |
| 274 |
g_list_free (source_uri_list); |
319 |
g_list_free (source_uri_list); |
|
Lines 277-282
screenshot_xfer_uri (GnomeVFSURI *source
Link Here
|
| 277 |
if (transfer_info->delete_target) |
322 |
if (transfer_info->delete_target) |
| 278 |
;/* try to delete the target, iff it started writing */ |
323 |
;/* try to delete the target, iff it started writing */ |
| 279 |
|
324 |
|
| 280 |
return GNOME_VFS_OK; |
325 |
return transfer_info->vfs_status; |
| 281 |
} |
326 |
} |
| 282 |
|
327 |
|