Codebase list cinnamon-menus / fd154c5
Fix a couple issues with incorrect result evaluations when loading desktop files caused by 44ee2de737e53b0 Michael Webster 7 years ago
3 changed file(s) with 7 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
323323 {
324324 GKeyFile *key_file = NULL;
325325 GError *error = NULL;
326 rescode = DESKTOP_ENTRY_LOAD_SUCCESS;
327326
328327 key_file = g_key_file_new ();
329328
361360 return rescode;
362361 }
363362
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
371363 DesktopEntry *
372364 desktop_entry_new (const char *path,
373365 DesktopEntryResultCode *res_code)
404396 code = desktop_entry_load (retval);
405397 *res_code = code;
406398
407 if (code_failed (code))
399 if (code < DESKTOP_ENTRY_LOAD_SUCCESS)
408400 {
409401 desktop_entry_unref (retval);
410402 return NULL;
446438 else
447439 g_assert_not_reached ();
448440
449 if (code_failed (desktop_entry_load (entry)))
441 if (desktop_entry_load (entry) < DESKTOP_ENTRY_LOAD_SUCCESS)
450442 {
451443 desktop_entry_unref (entry);
452444 return NULL;
3232
3333 typedef enum
3434 {
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
3838 } DesktopEntryResultCode;
3939
4040 typedef struct DesktopEntry DesktopEntry;
351351 entry_basename = desktop_entry_get_basename (tmp->data);
352352 if (strcmp (entry_basename, basename) == 0)
353353 {
354 if (!desktop_entry_reload (tmp->data))
354 if (desktop_entry_reload (tmp->data) == NULL)
355355 {
356356 dir->entries = g_slist_delete_link (dir->entries, tmp);
357357 }
652652 if (handled)
653653 {
654654 /* 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))
656656 {
657657 _entry_directory_list_empty_desktop_cache ();
658658 }