changeset 8366:5956297c6bcc

[gaim-migrate @ 9091] Win32 users can now open things from the FT dialog with the Open button. It's about time Win32 got a useful feature before Linux. Patch by Kevin Stange. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 29 Feb 2004 00:30:51 +0000
parents 0e05e094e371
children 5f78e96ff135
files ChangeLog.win32 src/gtkft.c
diffstat 2 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.win32	Sat Feb 28 23:33:20 2004 +0000
+++ b/ChangeLog.win32	Sun Feb 29 00:30:51 2004 +0000
@@ -1,4 +1,5 @@
 version 0.76:
+	* Ability to open files directly from file transfer window.
 	* Installer translations for: Russian, Polish, Finnish, Japanese.
 
 version 0.75 (01/09/2004):
--- a/src/gtkft.c	Sat Feb 28 23:33:20 2004 +0000
+++ b/src/gtkft.c	Sun Feb 29 00:30:51 2004 +0000
@@ -262,7 +262,13 @@
 		gtk_widget_hide(dialog->stop_button);
 		gtk_widget_show(dialog->remove_button);
 
-		/* TODO: gtk_widget_set_sensitive(dialog->open_button, TRUE); */
+#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);
+        }
+#endif
 		gtk_widget_set_sensitive(dialog->pause_button,  FALSE);
 		gtk_widget_set_sensitive(dialog->resume_button, FALSE);
 
@@ -370,6 +376,22 @@
 static void
 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);
+    }
+#endif
 }
 
 static void