| 296 gtk_widget_set_sensitive(dialog->open_button, TRUE); |
296 gtk_widget_set_sensitive(dialog->open_button, TRUE); |
| 297 } else { |
297 } else { |
| 298 gtk_widget_set_sensitive(dialog->open_button, FALSE); |
298 gtk_widget_set_sensitive(dialog->open_button, FALSE); |
| 299 } |
299 } |
| 300 #else |
300 #else |
| 301 /* If using GNOME, use gnome-open */ |
301 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
| 302 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE && gaim_running_gnome()) { |
|
| 303 gtk_widget_set_sensitive(dialog->open_button, TRUE); |
302 gtk_widget_set_sensitive(dialog->open_button, TRUE); |
| 304 } else { |
303 } else { |
| 305 gtk_widget_set_sensitive (dialog->open_button, FALSE); |
304 gtk_widget_set_sensitive (dialog->open_button, FALSE); |
| 306 } |
305 } |
| 307 #endif |
306 #endif |
| 448 _("An error occurred while opening the file."), NULL); |
447 _("An error occurred while opening the file."), NULL); |
| 449 gaim_debug_warning("ft", "filename: %s; code: %d\n", |
448 gaim_debug_warning("ft", "filename: %s; code: %d\n", |
| 450 gaim_xfer_get_local_filename(dialog->selected_xfer), code); |
449 gaim_xfer_get_local_filename(dialog->selected_xfer), code); |
| 451 } |
450 } |
| 452 #else |
451 #else |
| 453 /* If using GNOME, use gnome-open */ |
452 const char *filename = gaim_xfer_get_local_filename(dialog->selected_xfer); |
| |
453 char *command = NULL; |
| |
454 char *tmp = NULL; |
| |
455 GError *error = NULL; |
| |
456 |
| 454 if (gaim_running_gnome()) |
457 if (gaim_running_gnome()) |
| 455 { |
458 { |
| 456 char *command = NULL; |
459 char *escaped = g_shell_quote(filename); |
| 457 char *tmp = NULL; |
460 command = g_strdup_printf("gnome-open %s", escaped); |
| 458 GError *error = NULL; |
461 g_free(escaped); |
| 459 |
462 } |
| 460 command = g_strdup_printf("gnome-open \"%s\"", |
463 else if (gaim_running_kde()) |
| 461 gaim_xfer_get_local_filename(dialog->selected_xfer)); |
464 { |
| 462 |
465 char *escaped = g_shell_quote(filename); |
| 463 if (gaim_program_is_valid(command)) |
466 |
| |
467 if (gaim_str_has_suffix(filename, ".desktop")) |
| |
468 command = g_strdup_printf("kfmclient openURL %s 'text/plain'", escaped); |
| |
469 else |
| |
470 command = g_strdup_printf("kfmclient openURL %s", escaped); |
| |
471 g_free(escaped); |
| |
472 } |
| |
473 else |
| |
474 { |
| |
475 gaim_notify_uri(NULL, filename); |
| |
476 return; |
| |
477 } |
| |
478 |
| |
479 if (gaim_program_is_valid(command)) |
| |
480 { |
| |
481 gint exit_status; |
| |
482 if (!g_spawn_command_line_sync(command, NULL, NULL, &exit_status, &error)) |
| 464 { |
483 { |
| 465 gint exit_status; |
484 tmp = g_strdup_printf(_("Error launching %s: %s"), |
| 466 if (!g_spawn_command_line_sync(command, NULL, NULL, &exit_status, &error)) |
485 gaim_xfer_get_local_filename(dialog->selected_xfer), |
| 467 { |
486 error->message); |
| 468 tmp = g_strdup_printf(_("Error launching %s: %s"), |
487 gaim_notify_error(dialog, NULL, _("Unable to open file."), tmp); |
| 469 gaim_xfer_get_local_filename(dialog->selected_xfer), |
488 g_free(tmp); |
| 470 error->message); |
489 g_error_free(error); |
| 471 gaim_notify_error(dialog, NULL, _("Unable to open file."), tmp); |
490 } |
| 472 g_free(tmp); |
491 if (exit_status != 0) |
| 473 g_error_free(error); |
492 { |
| 474 } |
493 char *primary = g_strdup_printf(_("Error running %s"), command); |
| 475 if (exit_status != 0) |
494 char *secondary = g_strdup_printf(_("Process returned error code %d"), |
| 476 { |
495 exit_status); |
| 477 char *primary = g_strdup_printf(_("Error running %s"), command); |
496 gaim_notify_error(dialog, NULL, primary, secondary); |
| 478 char *secondary = g_strdup_printf(_("Process returned error code %d"), |
497 g_free(tmp); |
| 479 exit_status); |
|
| 480 gaim_notify_error(dialog, NULL, primary, secondary); |
|
| 481 g_free(tmp); |
|
| 482 } |
|
| 483 } |
498 } |
| 484 } |
499 } |
| 485 #endif |
500 #endif |
| 486 } |
501 } |
| 487 |
502 |