comparison src/util.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 060aa79a733e
children dd0eecfbe413
comparison
equal deleted inserted replaced
6860:82607477da69 6861:4ae5d9c3d9ec
851 } 851 }
852 852
853 return fp; 853 return fp;
854 } 854 }
855 855
856 gboolean program_is_valid(const char *program)
857 {
858 GError *error = NULL;
859 char **argv;
860 gchar *progname;
861 gboolean is_valid = FALSE;
862
863 if (program == NULL || *program == '\0') {
864 return FALSE;
865 }
866
867 if (!g_shell_parse_argv(program, NULL, &argv, &error)) {
868 gaim_debug(GAIM_DEBUG_ERROR, "program_is_valid",
869 "Could not parse program '%s': %s\n",
870 program, error->message);
871 g_error_free(error);
872 return FALSE;
873 }
874
875 if (argv == NULL) {
876 return FALSE;
877 }
878
879 progname = g_find_program_in_path(argv[0]);
880 is_valid = (progname != NULL);
881
882 g_strfreev(argv);
883 g_free(progname);
884
885 return is_valid;
886 }
887
856 char *gaim_try_conv_to_utf8(const char *str) 888 char *gaim_try_conv_to_utf8(const char *str)
857 { 889 {
858 gsize converted; 890 gsize converted;
859 char *utf8; 891 char *utf8;
860 892