static void
cached_dir_free (CachedDir *dir)
{
  if (dir->dir_monitor)
    {
      menu_monitor_remove_notify (dir->dir_monitor,
				  (MenuMonitorNotifyFunc) handle_cached_dir_changed,
				  dir);
      menu_monitor_unref (dir->dir_monitor);
      dir->dir_monitor = NULL;
    }

  g_slist_foreach (dir->monitors, (GFunc) g_free, NULL);
  g_slist_free (dir->monitors);
  dir->monitors = NULL;

  g_slist_foreach (dir->entries,
                   (GFunc) desktop_entry_unref,
                   NULL);
  g_slist_free (dir->entries);
  dir->entries = NULL;

  g_slist_foreach (dir->subdirs,
                   (GFunc) cached_dir_unref,
                   NULL);
  g_slist_free (dir->subdirs);
  dir->subdirs = NULL;

  g_free (dir->name);
  g_free (dir);
}
Exemplo n.º 2
0
static gboolean
emit_events_in_idle (void)
{
  GSList *events_to_emit;
  GSList *tmp;

  events_to_emit = pending_events;

  pending_events = NULL;
  events_idle_handler = 0;

  tmp = events_to_emit;
  while (tmp != NULL)
    {
      MenuMonitorEventInfo *event_info = tmp->data;

      menu_monitor_ref (event_info->monitor);

      tmp = tmp->next;
    }
  
  tmp = events_to_emit;
  while (tmp != NULL)
    {
      MenuMonitorEventInfo *event_info = tmp->data;

      invoke_notifies (event_info->monitor,
		       event_info->event,
		       event_info->path);

      menu_monitor_unref (event_info->monitor);
      event_info->monitor = NULL;

      g_free (event_info->path);
      event_info->path = NULL;

      event_info->event = MENU_MONITOR_EVENT_INVALID;

      g_free (event_info);

      tmp = tmp->next;
    }

  g_slist_free (events_to_emit);

  return FALSE;
}