Code cleanup

This commit is contained in:
Pierre Pronchery 2011-02-19 20:04:45 +00:00
parent 7860400316
commit 7db77088f6
2 changed files with 18 additions and 20 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Browser 0.1.4\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-02-19 20:57+0100\n"
"POT-Creation-Date: 2011-02-19 21:04+0100\n"
"PO-Revision-Date: 2010-03-29 23:28+0200\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: English\n"
@ -187,7 +187,7 @@ msgstr ""
#: ../src/browser.c:592 ../src/browser.c:597 ../src/copy.c:668
#: ../src/copy.c:672 ../src/delete.c:421 ../src/delete.c:426
#: ../src/desktop.c:1442 ../src/desktop.c:1447 ../src/move.c:452
#: ../src/desktop.c:1440 ../src/desktop.c:1445 ../src/move.c:452
#: ../src/move.c:456 ../src/properties.c:118 ../src/properties.c:122
#: ../src/view.c:366 ../src/view.c:371
msgid "Error"
@ -468,11 +468,11 @@ msgstr ""
msgid "Applications"
msgstr ""
#: ../src/desktop.c:1491
#: ../src/desktop.c:1489
msgid "Could not load preferences"
msgstr ""
#: ../src/desktop.c:1547
#: ../src/desktop.c:1545
msgid ""
"Usage: desktop [-H|-V][-a|-c|-f|-h|-n][-m monitor]\n"
" -H\tPlace icons horizontally\n"

View File

@ -1016,6 +1016,8 @@ static int _current_loop_applications(Desktop * desktop)
char const * q;
DesktopIcon * icon;
if((config = config_new()) == NULL)
return -1;
while((de = readdir(desktop->refresh_dir)) != NULL)
{
if(de->d_name[0] == '.')
@ -1038,29 +1040,25 @@ static int _current_loop_applications(Desktop * desktop)
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s() \"%s\"\n", __func__, path);
#endif
/* XXX not very elegant */
if(desktop->category != NULL && (config = config_new()) != NULL)
{
if(config_load(config, path) != 0
|| (q = config_get(config,
"Desktop Entry",
"Categories")) == NULL
|| string_find(q,
desktop->category->name)
== NULL)
{
config_delete(config);
continue;
}
config_delete(config);
}
if(desktop->category == NULL)
continue;
config_reset(config);
if(config_load(config, path) != 0)
continue;
if((q = config_get(config, "Desktop Entry", "Categories"))
== NULL)
continue;
if(string_find(q, desktop->category->name) == NULL)
continue;
if((icon = desktopicon_new_application(desktop, path)) == NULL)
continue;
desktop_icon_add(desktop, icon);
free(path);
config_delete(config);
return 0;
}
free(path);
config_delete(config);
return -1;
}