|
Lines 1922-1979
Link Here
|
| 1922 |
int workspace, |
1922 |
int workspace, |
| 1923 |
char **envp, |
1923 |
char **envp, |
| 1924 |
GError **error) |
1924 |
GError **error) |
| 1925 |
{ |
1925 |
{ |
|
|
1926 |
char *to_free = NULL; |
| 1926 |
const char *exec; |
1927 |
const char *exec; |
| 1927 |
char *the_exec; |
1928 |
char *the_exec; |
| 1928 |
int ret; |
1929 |
int ret; |
| 1929 |
|
1930 |
|
| 1930 |
exec = gnome_desktop_item_get_string (item, GNOME_DESKTOP_ITEM_EXEC); |
1931 |
exec = gnome_desktop_item_get_string (item, GNOME_DESKTOP_ITEM_EXEC); |
|
|
1932 |
if ( gnome_desktop_item_get_boolean (item, GNOME_DESKTOP_ITEM_SUBSTITUTEUID)==TRUE) { |
| 1933 |
exec = to_free = g_strdup_printf ("gnomesu -c \"%s\"", exec); |
| 1934 |
} else if ( gnome_desktop_item_get_boolean (item, GNOME_DESKTOP_ITEM_ROOT_ONLY)==TRUE) { |
| 1935 |
exec = to_free = g_strdup_printf ("gnomesu -c \"%s\"", exec); |
| 1936 |
}; |
| 1937 |
|
| 1931 |
/* This is a URL, so launch it as a url */ |
1938 |
/* This is a URL, so launch it as a url */ |
| 1932 |
if (item->type == GNOME_DESKTOP_ITEM_TYPE_LINK) { |
1939 |
if (item->type == GNOME_DESKTOP_ITEM_TYPE_LINK) { |
| 1933 |
const char *url; |
1940 |
const char *url; |
| 1934 |
url = gnome_desktop_item_get_string (item, GNOME_DESKTOP_ITEM_URL); |
1941 |
url = gnome_desktop_item_get_string (item, GNOME_DESKTOP_ITEM_URL); |
| 1935 |
if (url && url[0] != '\0') { |
1942 |
if (url && url[0] != '\0') { |
|
|
1943 |
g_free (to_free); |
| 1936 |
if (gnome_url_show (url, error)) |
1944 |
if (gnome_url_show (url, error)) |
| 1937 |
return 0; |
1945 |
return 0; |
| 1938 |
else |
1946 |
else |
| 1939 |
return -1; |
1947 |
return -1; |
| 1940 |
/* Gnome panel used to put this in Exec */ |
1948 |
/* Gnome panel used to put this in Exec */ |
| 1941 |
} else if (exec && exec[0] != '\0') { |
1949 |
} else if (exec && exec[0] != '\0') { |
| 1942 |
if (gnome_url_show (exec, error)) |
1950 |
if (gnome_url_show (exec, error)) { |
|
|
1951 |
g_free (to_free); |
| 1943 |
return 0; |
1952 |
return 0; |
| 1944 |
else |
1953 |
} else { |
|
|
1954 |
g_free (to_free); |
| 1945 |
return -1; |
1955 |
return -1; |
|
|
1956 |
} |
| 1946 |
} else { |
1957 |
} else { |
|
|
1958 |
g_free (to_free); |
| 1947 |
g_set_error (error, |
1959 |
g_set_error (error, |
| 1948 |
GNOME_DESKTOP_ITEM_ERROR, |
1960 |
GNOME_DESKTOP_ITEM_ERROR, |
| 1949 |
GNOME_DESKTOP_ITEM_ERROR_NO_URL, |
1961 |
GNOME_DESKTOP_ITEM_ERROR_NO_URL, |
| 1950 |
_("No URL to launch")); |
1962 |
_("No URL to launch")); |
| 1951 |
return -1; |
1963 |
return -1; |
| 1952 |
} |
1964 |
} |
| 1953 |
} |
1965 |
} |
| 1954 |
|
1966 |
|
| 1955 |
/* check the type, if there is one set */ |
1967 |
/* check the type, if there is one set */ |
| 1956 |
if (item->type != GNOME_DESKTOP_ITEM_TYPE_APPLICATION) { |
1968 |
if (item->type != GNOME_DESKTOP_ITEM_TYPE_APPLICATION) { |
|
|
1969 |
g_free (to_free); |
| 1957 |
g_set_error (error, |
1970 |
g_set_error (error, |
| 1958 |
GNOME_DESKTOP_ITEM_ERROR, |
1971 |
GNOME_DESKTOP_ITEM_ERROR, |
| 1959 |
GNOME_DESKTOP_ITEM_ERROR_NOT_LAUNCHABLE, |
1972 |
GNOME_DESKTOP_ITEM_ERROR_NOT_LAUNCHABLE, |
| 1960 |
_("Not a launchable item")); |
1973 |
_("Not a launchable item")); |
| 1961 |
return -1; |
1974 |
return -1; |
| 1962 |
} |
1975 |
} |
| 1963 |
|
1976 |
|
| 1964 |
|
1977 |
|
| 1965 |
if (exec == NULL || |
1978 |
if (exec == NULL || |
| 1966 |
exec[0] == '\0') { |
1979 |
exec[0] == '\0') { |
| 1967 |
g_set_error (error, |
1980 |
g_set_error (error, |
| 1968 |
GNOME_DESKTOP_ITEM_ERROR, |
1981 |
GNOME_DESKTOP_ITEM_ERROR, |
| 1969 |
GNOME_DESKTOP_ITEM_ERROR_NO_EXEC_STRING, |
1982 |
GNOME_DESKTOP_ITEM_ERROR_NO_EXEC_STRING, |
| 1970 |
_("No command (Exec) to launch")); |
1983 |
_("No command (Exec) to launch")); |
| 1971 |
return -1; |
1984 |
return -1; |
| 1972 |
} |
1985 |
} |
| 1973 |
|
1986 |
|
| 1974 |
|
1987 |
|
| 1975 |
/* make a new copy and get rid of spaces */ |
1988 |
/* make a new copy and get rid of spaces */ |
| 1976 |
the_exec = g_alloca (strlen (exec) + 1); |
1989 |
the_exec = g_alloca (strlen (exec) + 1); |
| 1977 |
strcpy (the_exec, exec); |
1990 |
strcpy (the_exec, exec); |
|
|
1991 |
g_free (to_free); |
| 1978 |
|
1992 |
|
| 1979 |
if ( ! strip_the_amp (the_exec)) { |
1993 |
if ( ! strip_the_amp (the_exec)) { |