# HG changeset patch # User Daniel Atallah # Date 1116204461 0 # Node ID accfd1f1f80d4c76291a9d2aa82dcf05501f9ec6 # Parent 68083504217c7e1be2e18746b54fcae475ca87e0 [gaim-migrate @ 12693] FT dialog "Open" works w/ non-ASCII paths (win32) committer: Tailor Script diff -r 68083504217c -r accfd1f1f80d src/gtkft.c --- a/src/gtkft.c Mon May 16 00:20:26 2005 +0000 +++ b/src/gtkft.c Mon May 16 00:47:41 2005 +0000 @@ -293,11 +293,11 @@ gtk_widget_show(dialog->remove_button); #ifdef _WIN32 /* Only supported in Win32 right now */ - if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { - gtk_widget_set_sensitive(dialog->open_button, TRUE); - } else { - gtk_widget_set_sensitive(dialog->open_button, FALSE); - } + if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { + gtk_widget_set_sensitive(dialog->open_button, TRUE); + } else { + gtk_widget_set_sensitive(dialog->open_button, FALSE); + } #endif gtk_widget_set_sensitive(dialog->pause_button, FALSE); gtk_widget_set_sensitive(dialog->resume_button, FALSE); @@ -407,20 +407,41 @@ open_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) { #ifdef _WIN32 /* Only supported in Win32 right now */ - int code = (int)ShellExecute(NULL, NULL, - gaim_xfer_get_local_filename(dialog->selected_xfer), - NULL, NULL, SW_SHOW); - if (code == SE_ERR_ASSOCINCOMPLETE || code == SE_ERR_NOASSOC) - { - gaim_notify_error(NULL, NULL, - _("There is no application configured to open this type of file."), NULL); - } - else if (code < 32) - { - gaim_notify_error(NULL, NULL, - _("An error occurred while opening the file."), NULL); - gaim_debug_warning("ft", "filename: %s; code: %d\n", gaim_xfer_get_local_filename(dialog->selected_xfer), code); - } + int code; + if (G_WIN32_HAVE_WIDECHAR_API ()) { + wchar_t *wc_filename = g_utf8_to_utf16( + gaim_xfer_get_local_filename( + dialog->selected_xfer), + -1, NULL, NULL, NULL); + + code = (int) ShellExecuteW(NULL, NULL, wc_filename, NULL, NULL, + SW_SHOW); + + g_free(wc_filename); + } else { + char *l_filename = g_locale_from_utf8( + gaim_xfer_get_local_filename( + dialog->selected_xfer), + -1, NULL, NULL, NULL); + + code = (int) ShellExecuteA(NULL, NULL, l_filename, NULL, NULL, + SW_SHOW); + + g_free(l_filename); + } + + if (code == SE_ERR_ASSOCINCOMPLETE || code == SE_ERR_NOASSOC) + { + gaim_notify_error(NULL, NULL, + _("There is no application configured to open this type of file."), NULL); + } + else if (code < 32) + { + gaim_notify_error(NULL, NULL, + _("An error occurred while opening the file."), NULL); + gaim_debug_warning("ft", "filename: %s; code: %d\n", + gaim_xfer_get_local_filename(dialog->selected_xfer), code); + } #endif }