Fixed launcher behavior for .desktop files with multiple shortcut groups; fixed launcher memory leak
git-svn-id: http://tint2.googlecode.com/svn/trunk@640 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
cfd2bde7e4
commit
9c90f80ff1
1 changed files with 10 additions and 6 deletions
|
@ -424,17 +424,21 @@ int launcher_read_desktop_file(const char *path, DesktopEntry *entry)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int inside_desktop_entry = 0;
|
||||||
while (getline(&line, &line_size, fp) >= 0) {
|
while (getline(&line, &line_size, fp) >= 0) {
|
||||||
int len = strlen(line);
|
int len = strlen(line);
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
continue;
|
continue;
|
||||||
line[len - 1] = '\0';
|
line[len - 1] = '\0';
|
||||||
if (parse_dektop_line(line, &key, &value)) {
|
if (line[0] == '[') {
|
||||||
if (strcmp(key, "Name") == 0) {
|
inside_desktop_entry = (strcmp(line, "[Desktop Entry]") == 0);
|
||||||
|
}
|
||||||
|
if (inside_desktop_entry && parse_dektop_line(line, &key, &value)) {
|
||||||
|
if (!entry->name && strcmp(key, "Name") == 0) {
|
||||||
entry->name = strdup(value);
|
entry->name = strdup(value);
|
||||||
} else if (strcmp(key, "Exec") == 0) {
|
} else if (!entry->exec && strcmp(key, "Exec") == 0) {
|
||||||
entry->exec = strdup(value);
|
entry->exec = strdup(value);
|
||||||
} else if (strcmp(key, "Icon") == 0) {
|
} else if (!entry->icon && strcmp(key, "Icon") == 0) {
|
||||||
entry->icon = strdup(value);
|
entry->icon = strdup(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -702,9 +706,9 @@ void launcher_load_themes(Launcher *launcher)
|
||||||
if (!icon_theme_name) {
|
if (!icon_theme_name) {
|
||||||
fprintf(stderr, "Missing launcher theme, default to 'hicolor'.\n");
|
fprintf(stderr, "Missing launcher theme, default to 'hicolor'.\n");
|
||||||
icon_theme_name = strdup("hicolor");
|
icon_theme_name = strdup("hicolor");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
fprintf(stderr, "Loading %s. Icon theme :", icon_theme_name);
|
fprintf(stderr, "Loading %s. Icon theme :", icon_theme_name);
|
||||||
|
}
|
||||||
|
|
||||||
GSList *queue = g_slist_append(NULL, strdup(icon_theme_name));
|
GSList *queue = g_slist_append(NULL, strdup(icon_theme_name));
|
||||||
GSList *queued = g_slist_append(NULL, strdup(icon_theme_name));
|
GSList *queued = g_slist_append(NULL, strdup(icon_theme_name));
|
||||||
|
|
Loading…
Reference in a new issue