Fix a couple issues with incorrect result evaluations when loading
desktop files caused by 44ee2de737e53b0
Michael Webster
7 years ago
323 | 323 |
{
|
324 | 324 |
GKeyFile *key_file = NULL;
|
325 | 325 |
GError *error = NULL;
|
326 | |
rescode = DESKTOP_ENTRY_LOAD_SUCCESS;
|
327 | 326 |
|
328 | 327 |
key_file = g_key_file_new ();
|
329 | 328 |
|
|
361 | 360 |
return rescode;
|
362 | 361 |
}
|
363 | 362 |
|
364 | |
static gboolean
|
365 | |
code_failed (DesktopEntryResultCode code)
|
366 | |
{
|
367 | |
return code == DESKTOP_ENTRY_LOAD_FAIL_OTHER ||
|
368 | |
code == DESKTOP_ENTRY_LOAD_FAIL_APPINFO;
|
369 | |
}
|
370 | |
|
371 | 363 |
DesktopEntry *
|
372 | 364 |
desktop_entry_new (const char *path,
|
373 | 365 |
DesktopEntryResultCode *res_code)
|
|
404 | 396 |
code = desktop_entry_load (retval);
|
405 | 397 |
*res_code = code;
|
406 | 398 |
|
407 | |
if (code_failed (code))
|
|
399 |
if (code < DESKTOP_ENTRY_LOAD_SUCCESS)
|
408 | 400 |
{
|
409 | 401 |
desktop_entry_unref (retval);
|
410 | 402 |
return NULL;
|
|
446 | 438 |
else
|
447 | 439 |
g_assert_not_reached ();
|
448 | 440 |
|
449 | |
if (code_failed (desktop_entry_load (entry)))
|
|
441 |
if (desktop_entry_load (entry) < DESKTOP_ENTRY_LOAD_SUCCESS)
|
450 | 442 |
{
|
451 | 443 |
desktop_entry_unref (entry);
|
452 | 444 |
return NULL;
|
32 | 32 |
|
33 | 33 |
typedef enum
|
34 | 34 |
{
|
35 | |
DESKTOP_ENTRY_LOAD_SUCCESS = 0,
|
36 | |
DESKTOP_ENTRY_LOAD_FAIL_OTHER,
|
37 | |
DESKTOP_ENTRY_LOAD_FAIL_APPINFO
|
|
35 |
DESKTOP_ENTRY_LOAD_FAIL_OTHER = 0,
|
|
36 |
DESKTOP_ENTRY_LOAD_FAIL_APPINFO,
|
|
37 |
DESKTOP_ENTRY_LOAD_SUCCESS
|
38 | 38 |
} DesktopEntryResultCode;
|
39 | 39 |
|
40 | 40 |
typedef struct DesktopEntry DesktopEntry;
|
351 | 351 |
entry_basename = desktop_entry_get_basename (tmp->data);
|
352 | 352 |
if (strcmp (entry_basename, basename) == 0)
|
353 | 353 |
{
|
354 | |
if (!desktop_entry_reload (tmp->data))
|
|
354 |
if (desktop_entry_reload (tmp->data) == NULL)
|
355 | 355 |
{
|
356 | 356 |
dir->entries = g_slist_delete_link (dir->entries, tmp);
|
357 | 357 |
}
|
|
652 | 652 |
if (handled)
|
653 | 653 |
{
|
654 | 654 |
/* CHANGED events don't change the set of desktop entries, unless it's the mimeinfo.cache file changing */
|
655 | |
if (retry_changes || (event == MENU_MONITOR_EVENT_CREATED || event == MENU_MONITOR_EVENT_DELETED))
|
|
655 |
if ((event == MENU_MONITOR_EVENT_CREATED || event == MENU_MONITOR_EVENT_DELETED))
|
656 | 656 |
{
|
657 | 657 |
_entry_directory_list_empty_desktop_cache ();
|
658 | 658 |
}
|