| 291 if (gaim_xfer_is_completed(xfer)) { |
291 if (gaim_xfer_is_completed(xfer)) { |
| 292 gtk_widget_hide(dialog->stop_button); |
292 gtk_widget_hide(dialog->stop_button); |
| 293 gtk_widget_show(dialog->remove_button); |
293 gtk_widget_show(dialog->remove_button); |
| 294 |
294 |
| 295 #ifdef _WIN32 /* Only supported in Win32 right now */ |
295 #ifdef _WIN32 /* Only supported in Win32 right now */ |
| 296 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
296 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
| 297 gtk_widget_set_sensitive(dialog->open_button, TRUE); |
297 gtk_widget_set_sensitive(dialog->open_button, TRUE); |
| 298 } else { |
298 } else { |
| 299 gtk_widget_set_sensitive(dialog->open_button, FALSE); |
299 gtk_widget_set_sensitive(dialog->open_button, FALSE); |
| 300 } |
300 } |
| 301 #endif |
301 #endif |
| 302 gtk_widget_set_sensitive(dialog->pause_button, FALSE); |
302 gtk_widget_set_sensitive(dialog->pause_button, FALSE); |
| 303 gtk_widget_set_sensitive(dialog->resume_button, FALSE); |
303 gtk_widget_set_sensitive(dialog->resume_button, FALSE); |
| 304 |
304 |
| 305 gtk_widget_set_sensitive(dialog->remove_button, TRUE); |
305 gtk_widget_set_sensitive(dialog->remove_button, TRUE); |
| 405 |
405 |
| 406 static void |
406 static void |
| 407 open_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
407 open_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
| 408 { |
408 { |
| 409 #ifdef _WIN32 /* Only supported in Win32 right now */ |
409 #ifdef _WIN32 /* Only supported in Win32 right now */ |
| 410 int code = (int)ShellExecute(NULL, NULL, |
410 int code; |
| 411 gaim_xfer_get_local_filename(dialog->selected_xfer), |
411 if (G_WIN32_HAVE_WIDECHAR_API ()) { |
| 412 NULL, NULL, SW_SHOW); |
412 wchar_t *wc_filename = g_utf8_to_utf16( |
| 413 if (code == SE_ERR_ASSOCINCOMPLETE || code == SE_ERR_NOASSOC) |
413 gaim_xfer_get_local_filename( |
| 414 { |
414 dialog->selected_xfer), |
| 415 gaim_notify_error(NULL, NULL, |
415 -1, NULL, NULL, NULL); |
| 416 _("There is no application configured to open this type of file."), NULL); |
416 |
| 417 } |
417 code = (int) ShellExecuteW(NULL, NULL, wc_filename, NULL, NULL, |
| 418 else if (code < 32) |
418 SW_SHOW); |
| 419 { |
419 |
| 420 gaim_notify_error(NULL, NULL, |
420 g_free(wc_filename); |
| 421 _("An error occurred while opening the file."), NULL); |
421 } else { |
| 422 gaim_debug_warning("ft", "filename: %s; code: %d\n", gaim_xfer_get_local_filename(dialog->selected_xfer), code); |
422 char *l_filename = g_locale_from_utf8( |
| 423 } |
423 gaim_xfer_get_local_filename( |
| |
424 dialog->selected_xfer), |
| |
425 -1, NULL, NULL, NULL); |
| |
426 |
| |
427 code = (int) ShellExecuteA(NULL, NULL, l_filename, NULL, NULL, |
| |
428 SW_SHOW); |
| |
429 |
| |
430 g_free(l_filename); |
| |
431 } |
| |
432 |
| |
433 if (code == SE_ERR_ASSOCINCOMPLETE || code == SE_ERR_NOASSOC) |
| |
434 { |
| |
435 gaim_notify_error(NULL, NULL, |
| |
436 _("There is no application configured to open this type of file."), NULL); |
| |
437 } |
| |
438 else if (code < 32) |
| |
439 { |
| |
440 gaim_notify_error(NULL, NULL, |
| |
441 _("An error occurred while opening the file."), NULL); |
| |
442 gaim_debug_warning("ft", "filename: %s; code: %d\n", |
| |
443 gaim_xfer_get_local_filename(dialog->selected_xfer), code); |
| |
444 } |
| 424 #endif |
445 #endif |
| 425 } |
446 } |
| 426 |
447 |
| 427 static void |
448 static void |
| 428 pause_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
449 pause_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |