Mercurial > pidgin
comparison src/browser.c @ 6861:4ae5d9c3d9ec
[gaim-migrate @ 7407]
You know the thing that checked if the manual browser command was valid?
I moved the funcion that does the actual checking into util.c It's pretty
generic, I guess.
I moved the check (the call to that function) to browser.c, so it checks
for a valid browser when you click on a link. The old way used to really
annoy me, because you would get multiple error boxes about the browser
being invalid.
Herman, I tried to keep things compiling on Windows. I didn't want to
#ifdef the program_is_valid() function in util.c--I don't see any
reason why it wouldn't compile in Windows. But if there's a problem
with it feel free to #ifdef that puppy.
Also, Nathan, I'm going to quiz you later on my townhousemates, so
please bring a number two pencil and make sure you eat a healthy breakfast.
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Tue, 16 Sep 2003 04:57:36 +0000 |
| parents | 338147ea6896 |
| children | 6faeeecab0dc |
comparison
equal
deleted
inserted
replaced
| 6860:82607477da69 | 6861:4ae5d9c3d9ec |
|---|---|
| 565 const char *web_command; | 565 const char *web_command; |
| 566 | 566 |
| 567 web_command = gaim_prefs_get_string("/gaim/gtk/browsers/command"); | 567 web_command = gaim_prefs_get_string("/gaim/gtk/browsers/command"); |
| 568 | 568 |
| 569 if (web_command == NULL || *web_command == '\0') { | 569 if (web_command == NULL || *web_command == '\0') { |
| 570 gaim_notify_error(NULL, NULL, | 570 gaim_notify_error(NULL, NULL, _("Unable to open URL"), |
| 571 _("Unable to launch your browser because " | 571 _("The 'Manual' browser command has been " |
| 572 "the 'Manual' browser command has been " | 572 "chosen, but no command has been set.")); |
| 573 "chosen, but no command has been set."), | |
| 574 NULL); | |
| 575 return NULL; | 573 return NULL; |
| 576 } | 574 } |
| 577 | 575 |
| 578 if (strstr(web_command, "%s")) | 576 if (strstr(web_command, "%s")) |
| 579 command = gaim_strreplace(web_command, "%s", uri); | 577 command = gaim_strreplace(web_command, "%s", uri); |
| 584 */ | 582 */ |
| 585 command = g_strdup_printf("%s %s", web_command, uri); | 583 command = g_strdup_printf("%s %s", web_command, uri); |
| 586 } | 584 } |
| 587 } | 585 } |
| 588 | 586 |
| 589 if (!g_spawn_command_line_async(command, &error)) { | 587 if (!program_is_valid(command)) { |
| 588 gchar *tmp = g_strdup_printf(_("The browser \"%s\" is invalid."), | |
| 589 command); | |
| 590 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); | |
| 591 g_free(tmp); | |
| 592 | |
| 593 } else if (!g_spawn_command_line_async(command, &error)) { | |
| 590 char *tmp = g_strdup_printf( | 594 char *tmp = g_strdup_printf( |
| 591 _("There was an error launching your chosen browser: %s"), | 595 _("Error launching \"command\": %s"), |
| 592 error->message); | 596 error->message); |
| 593 | 597 |
| 594 gaim_notify_error(NULL, NULL, tmp, NULL); | 598 gaim_notify_error(NULL, NULL, _("Unable to open URL"), tmp); |
| 595 | 599 |
| 596 g_free(tmp); | 600 g_free(tmp); |
| 597 g_error_free(error); | 601 g_error_free(error); |
| 598 } | 602 } |
| 599 | 603 |
