result->group = ecore_hash_get(result->data, "KDE Desktop Entry");
if (result->group)
{
- char *eap_name = NULL;
- char *exe = NULL;
- char *categories = NULL;
int size = 0;
value = (char *) ecore_file_get_file(result->original_path);
sprintf(result->eap_name, "%s.edj", value);
if (temp) *temp = '.';
}
- eap_name = result->eap_name;
IFGETDUP(value, "Name", result->name);
IFGETDUP(value, "GenericName", result->generic);
IFGETDUP(value, "Exec", result->exec);
if (result->exec)
{
+ char *exe = NULL;
+
exe = strchr(result->exec, ' ');
if (exe)
{
exe++;
result->exec_params = strdup(exe);
}
- exe = result->exec;
}
IFGETDUP(value, "StartupWMClass", result->window_class);
IFGETDUP(value, "X-Enlightenment-WindowTitle", result->window_title);
IFGETDUP(value, "X-Enlightenment-WindowRole", result->window_role);
+ IFGETDUP(value, "Categories", result->categories);
+ if (result->categories)
+ result->Categories =
+ ecore_desktop_paths_to_hash(result->categories);
IFGETDUP(value, "Icon", result->icon);
IFGETDUP(value, "X-Enlightenment-IconTheme", result->icon_theme);
IFGETDUP(value, "X-Enlightenment-IconClass", result->icon_class);
}
}
- IFGETDUP(value, "Categories", result->categories);
- if (result->categories)
- result->Categories =
- ecore_desktop_paths_to_hash(result->categories);
- categories = result->categories;
-
- value = ecore_hash_get(result->group, "OnlyShowIn");
- if (value)
- result->OnlyShowIn =
- ecore_desktop_paths_to_hash(value);
- value = ecore_hash_get(result->group, "NotShowIn");
- if (value)
- result->NotShowIn =
- ecore_desktop_paths_to_hash(value);
- value = ecore_hash_get(result->group, "X-KDE-StartupNotify");
- if (value)
- result->startup = (strcmp(value, "true") == 0);
- value = ecore_hash_get(result->group, "StartupNotify");
- if (value)
- result->startup = (strcmp(value, "true") == 0);
- value = ecore_hash_get(result->group, "X-Enlightenment-WaitExit");
- if (value)
- result->wait_exit = (strcmp(value, "true") == 0);
- value = ecore_hash_get(result->group, "NoDisplay");
- if (value)
- result->no_display = (strcmp(value, "true") == 0);
- value = ecore_hash_get(result->group, "Hidden");
- if (value)
- result->hidden = (strcmp(value, "true") == 0);
-
- /*
- * icon/class is a list of standard icons from the theme that can override the icon created above.
- * Use (from .desktop) eap name,exe name,categories. It's case sensitive, the reccomendation is to lowercase it.
+ /* icon/class is a list of standard icons from the theme that can override the icon created above.
+ * Use (from .desktop) name,exe name,categories. It's case sensitive, the reccomendation is to lowercase it.
* It should be most specific to most generic. firefox,browser,internet for instance
*/
size = 0;
if ((result->icon) && (strchr(result->icon, '/') == NULL))
size += strlen(result->icon) + 1;
- if (eap_name)
- size += strlen(eap_name) + 1;
- if (exe)
- size += strlen(exe) + 1;
- if (categories)
- size += strlen(categories) + 1;
+ if (result->eap_name)
+ size += strlen(result->eap_name) + 1;
+ if (result->exec)
+ size += strlen(result->exec) + 1;
+ if (result->categories)
+ size += strlen(result->categories) + 1;
result->icon_class = malloc(size + 1);
if (result->icon_class)
{
/* We do this here coz we don't want to lower case the result->icon part later. */
p = result->icon_class;
p += strlen(result->icon_class);
- if ((eap_name) && (eap_name[0] != '\0'))
+ if ((result->eap_name) && (result->eap_name[0] != '\0'))
{
if (done)
strcat(result->icon_class, ",");
- strcat(result->icon_class, eap_name);
+ strcat(result->icon_class, result->eap_name);
done = 1;
}
- if ((exe) && (exe[0] != '\0'))
+ if ((result->exec) && (result->exec[0] != '\0'))
{
char *tmp;
- tmp = strdup(ecore_file_get_file(exe));
+ tmp = strdup(ecore_file_get_file(result->exec));
if (tmp)
{
char *p2;
free(tmp);
}
}
- if ((categories) && (categories[0] != '\0'))
+ if ((result->categories) && (result->categories[0] != '\0'))
{
if (done)
strcat(result->icon_class, ",");
- strcat(result->icon_class, categories);
+ strcat(result->icon_class, result->categories);
done = 1;
}
while (*p != '\0')
}
}
}
+
+ value = ecore_hash_get(result->group, "OnlyShowIn");
+ if (value)
+ result->OnlyShowIn =
+ ecore_desktop_paths_to_hash(value);
+ value = ecore_hash_get(result->group, "NotShowIn");
+ if (value)
+ result->NotShowIn =
+ ecore_desktop_paths_to_hash(value);
+ value = ecore_hash_get(result->group, "X-KDE-StartupNotify");
+ if (value)
+ result->startup = (strcmp(value, "true") == 0);
+ value = ecore_hash_get(result->group, "StartupNotify");
+ if (value)
+ result->startup = (strcmp(value, "true") == 0);
+ value = ecore_hash_get(result->group, "X-Enlightenment-WaitExit");
+ if (value)
+ result->wait_exit = (strcmp(value, "true") == 0);
+ value = ecore_hash_get(result->group, "NoDisplay");
+ if (value)
+ result->no_display = (strcmp(value, "true") == 0);
+ value = ecore_hash_get(result->group, "Hidden");
+ if (value)
+ result->hidden = (strcmp(value, "true") == 0);
+
}
else
{
ecore_desktop_icon_find(const char *icon, const char *icon_size,
const char *icon_theme)
{
- char *dir = NULL, *icn;
+ char *result = NULL, *icn;
Ecore_List *icons;
int in_cache = 0;
double begin;
begin = ecore_time_get();
- if (icon == NULL)
- return NULL;
-
- /* Easy check first, was a full path supplied? */
- if ((icon[0] == '/') && (ecore_file_exists(icon)))
- return strdup(icon);
-
- if (icon_size == NULL)
- icon_size = "48x48";
- if (icon_theme == NULL)
- icon_theme = "hicolor";
-
- icons = ecore_desktop_paths_to_list(icon);
- if (!icons)
- return NULL;
- ecore_list_goto_first(icons);
- while ((icn = ecore_list_next(icons)))
+ if (icon)
{
- char *ext;
+ /* Easy check first, was a full path supplied? */
+ if ((icon[0] == '/') && (ecore_file_exists(icon)))
+ result = strdup(icon);
+ else
+ {
+ icons = ecore_desktop_paths_to_list(icon);
+ if (icons)
+ {
+
+ if (icon_size == NULL)
+ icon_size = "48x48";
+ if (icon_theme == NULL)
+ icon_theme = "hicolor";
+ ecore_list_goto_first(icons);
+ while ((icn = ecore_list_next(icons)))
+ {
+ char *ext;
#ifdef DEBUG
- fprintf(stderr, "\tTrying To Find Icon %s\n", icn);
+ fprintf(stderr, "\tTrying To Find Icon %s\n", icn);
#endif
- ext = strrchr(icn, '.');
- /* Check for unsupported extension */
- if ((ext) && (!strcmp(ext, ".ico"))) continue;
+ ext = strrchr(icn, '.');
+ /* Check for unsupported extension */
+ if ((ext) && (!strcmp(ext, ".ico")))
+ continue;
- dir = _ecore_desktop_icon_find0(icn, icon_size, icon_theme);
- if (dir)
- break;
- }
- ecore_list_destroy(icons);
+ result = _ecore_desktop_icon_find0(icn, icon_size, icon_theme);
+ if (result)
+ break;
+ }
+ ecore_list_destroy(icons);
+
+ } /* if (icons) */
+ } /* if ((icon[0] == '/') && (ecore_file_exists(icon))) ; else */
+ } /* if (icon) */
- if (dir)
+ if (result)
{
if (in_cache)
{
instrumentation.icons_not_found_time += ecore_time_get() - begin;
instrumentation.icons_not_found++;
}
- return dir;
+
+ return result;
}
/** Search for an icon the fdo way.