| 400 } |
400 } |
| 401 else |
401 else |
| 402 gtk_widget_destroy(GTK_WIDGET(ui_handle)); |
402 gtk_widget_destroy(GTK_WIDGET(ui_handle)); |
| 403 } |
403 } |
| 404 |
404 |
| |
405 #ifndef _WIN32 |
| |
406 static gint |
| |
407 uri_command(const char *command, const gboolean sync) |
| |
408 { |
| |
409 GError *error = NULL; |
| |
410 gint ret = 0; |
| |
411 |
| |
412 if (!gaim_program_is_valid(command)) { |
| |
413 gchar *tmp = g_strdup_printf(_("The browser \"%s\" is invalid."), |
| |
414 command); |
| |
415 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
| |
416 g_free(tmp); |
| |
417 |
| |
418 } else if (sync) { |
| |
419 gint status; |
| |
420 |
| |
421 if (!g_spawn_command_line_sync(command, NULL, NULL, &status, &error)) { |
| |
422 char *tmp = g_strdup_printf( |
| |
423 _("Error launching \"command\": %s"), |
| |
424 error->message); |
| |
425 |
| |
426 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
| |
427 |
| |
428 g_free(tmp); |
| |
429 g_error_free(error); |
| |
430 } else { |
| |
431 ret = status; |
| |
432 } |
| |
433 |
| |
434 } else { |
| |
435 if (!g_spawn_command_line_async(command, &error)) { |
| |
436 char *tmp = g_strdup_printf( |
| |
437 _("Error launching \"command\": %s"), |
| |
438 error->message); |
| |
439 |
| |
440 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
| |
441 |
| |
442 g_free(tmp); |
| |
443 g_error_free(error); |
| |
444 } |
| |
445 } |
| |
446 |
| |
447 printf("command: %d = %s\n", ret, command); |
| |
448 return ret; |
| |
449 } |
| |
450 #endif |
| |
451 |
| 405 static void * |
452 static void * |
| 406 gaim_gtk_notify_uri(const char *uri) |
453 gaim_gtk_notify_uri(const char *uri) |
| 407 { |
454 { |
| 408 #ifndef _WIN32 |
455 #ifndef _WIN32 |
| 409 char *command = NULL; |
456 char *command = NULL; |
| 410 GError *error = NULL; |
457 char *remote_command = NULL; |
| 411 const char *web_browser; |
458 const char *web_browser; |
| |
459 int place; |
| 412 |
460 |
| 413 web_browser = gaim_prefs_get_string("/gaim/gtk/browsers/browser"); |
461 web_browser = gaim_prefs_get_string("/gaim/gtk/browsers/browser"); |
| |
462 place = gaim_prefs_get_int("/gaim/gtk/browsers/place"); |
| 414 |
463 |
| 415 if (!strcmp(web_browser, "netscape")) { |
464 if (!strcmp(web_browser, "netscape")) { |
| 416 command = g_strdup_printf("netscape \"%s\"", uri); |
465 command = g_strdup_printf("netscape \"%s\"", uri); |
| |
466 if (place == GAIM_BROWSER_NEW_WINDOW) |
| |
467 remote_command = g_strdup_printf("netscape -remote \"openURL(\"%s\",new-window)\"", uri); |
| |
468 else if (place == GAIM_BROWSER_CURRENT) |
| |
469 remote_command = g_strdup_printf("netscape -remote \"openURL(\"%s\")\"", uri); |
| |
470 |
| 417 } else if (!strcmp(web_browser, "opera")) { |
471 } else if (!strcmp(web_browser, "opera")) { |
| 418 if (gaim_prefs_get_bool("/gaim/gtk/browsers/new_window")) |
472 if (place == GAIM_BROWSER_NEW_WINDOW) |
| 419 command = g_strdup_printf("opera -newwindow \"%s\"", uri); |
473 command = g_strdup_printf("opera -newwindow \"%s\"", uri); |
| 420 else |
474 else if (place == GAIM_BROWSER_NEW_TAB) |
| |
475 command = g_strdup_printf("opera -newpage \"%s\"", uri); |
| |
476 else if (place == GAIM_BROWSER_CURRENT) { |
| |
477 remote_command = g_strdup_printf("opera -remote \"openURL(\"%s\")\"", uri); |
| 421 command = g_strdup_printf("opera \"%s\"", uri); |
478 command = g_strdup_printf("opera \"%s\"", uri); |
| |
479 } else |
| |
480 command = g_strdup_printf("opera \"%s\"", uri); |
| |
481 |
| 422 } else if (!strcmp(web_browser, "kfmclient")) { |
482 } else if (!strcmp(web_browser, "kfmclient")) { |
| 423 command = g_strdup_printf("kfmclient openURL \"%s\"", uri); |
483 command = g_strdup_printf("kfmclient openURL \"%s\"", uri); |
| |
484 /* does Konqueror have options to open in new tab and/or current window? */ |
| |
485 |
| 424 } else if (!strcmp(web_browser, "galeon")) { |
486 } else if (!strcmp(web_browser, "galeon")) { |
| 425 if (gaim_prefs_get_bool("/gaim/gtk/browsers/new_window")) |
487 if (place == GAIM_BROWSER_NEW_WINDOW) |
| 426 command = g_strdup_printf("galeon -w \"%s\"", uri); |
488 command = g_strdup_printf("galeon -w \"%s\"", uri); |
| |
489 else if (place == GAIM_BROWSER_NEW_TAB) |
| |
490 command = g_strdup_printf("galeon -n \"%s\"", uri); |
| 427 else |
491 else |
| 428 command = g_strdup_printf("galeon \"%s\"", uri); |
492 command = g_strdup_printf("galeon \"%s\"", uri); |
| 429 } else if (!strcmp(web_browser, "mozilla")) { |
493 |
| 430 command = g_strdup_printf("mozilla \"%s\"", uri); |
494 } else if (!strcmp(web_browser, "mozilla") || |
| 431 } else if (!strcmp(web_browser, "mozilla-firebird")) { |
495 !strcmp(web_browser, "mozilla-firebird") || |
| 432 command = g_strdup_printf("mozilla-firebird \"%s\"", uri); |
496 !strcmp(web_browser, "firefox")) { |
| 433 } else if (!strcmp(web_browser, "firefox")) { |
497 command = g_strdup_printf("%s \"%s\"", web_browser, uri); |
| 434 command = g_strdup_printf("firefox \"%s\"", uri); |
498 if (place == GAIM_BROWSER_NEW_WINDOW) |
| |
499 remote_command = g_strdup_printf("%s -remote \"openURL(\"%s\",new-window)\"", web_browser, uri); |
| |
500 else if (place == GAIM_BROWSER_NEW_TAB) |
| |
501 remote_command = g_strdup_printf("%s -remote \"openURL(\"%s\",new-tab)\"", web_browser, uri); |
| |
502 else if (place == GAIM_BROWSER_CURRENT) |
| |
503 remote_command = g_strdup_printf("%s -remote \"openURL(\"%s\")\"", web_browser, uri); |
| |
504 |
| 435 } else if (!strcmp(web_browser, "custom")) { |
505 } else if (!strcmp(web_browser, "custom")) { |
| 436 const char *web_command; |
506 const char *web_command; |
| 437 |
507 |
| 438 web_command = gaim_prefs_get_string("/gaim/gtk/browsers/command"); |
508 web_command = gaim_prefs_get_string("/gaim/gtk/browsers/command"); |
| 439 |
509 |