static void
caja_clipboard_info_free (CajaClipboardInfo *info)
{
    caja_file_list_free (info->files);

    g_slice_free (CajaClipboardInfo, info);
}
void
caja_file_queue_destroy (CajaFileQueue *queue)
{
    g_hash_table_destroy (queue->item_to_link_map);
    caja_file_list_free (queue->head);
    g_free (queue);
}
static CajaRequestStatus
search_directory_file_get_deep_counts (CajaFile *file,
                                       guint *directory_count,
                                       guint *file_count,
                                       guint *unreadable_directory_count,
                                       goffset *total_size,
                                       goffset *total_size_on_disk)
{
    GList *file_list, *l;
    guint dirs, files;
    GFileType type;
    CajaFile *dir_file = NULL;

    file_list = caja_directory_get_file_list (file->details->directory);

    dirs = files = 0;
    for (l = file_list; l != NULL; l = l->next)
    {
        dir_file = CAJA_FILE (l->data);
        type = caja_file_get_file_type (dir_file);
        if (type == G_FILE_TYPE_DIRECTORY)
        {
            dirs++;
        }
        else
        {
            files++;
        }
    }

    if (directory_count != NULL)
    {
        *directory_count = dirs;
    }
    if (file_count != NULL)
    {
        *file_count = files;
    }
    if (unreadable_directory_count != NULL)
    {
        *unreadable_directory_count = 0;
    }
    if (total_size != NULL)
    {
        /* FIXME: Maybe we want to calculate this? */
        *total_size = 0;
    }
    if (total_size_on_disk != NULL)
    {
        /* FIXME: Maybe we want to calculate this? */
        *total_size_on_disk = 0;
    }

    caja_file_list_free (file_list);

    return CAJA_REQUEST_DONE;
}
static void
merged_callback_destroy (MergedCallback *merged_callback)
{
    g_assert (merged_callback != NULL);
    g_assert (CAJA_IS_DESKTOP_DIRECTORY (merged_callback->desktop_dir));

    g_list_free (merged_callback->non_ready_directories);
    caja_file_list_free (merged_callback->merged_file_list);
    g_free (merged_callback);
}
static void
desktop_monitor_add (CajaDirectory *directory,
                     gconstpointer client,
                     gboolean monitor_hidden_files,
                     gboolean monitor_backup_files,
                     CajaFileAttributes file_attributes,
                     CajaDirectoryCallback callback,
                     gpointer callback_data)
{
    CajaDesktopDirectory *desktop;
    MergedMonitor *monitor;
    GList *merged_callback_list;

    desktop = CAJA_DESKTOP_DIRECTORY (directory);

    /* Map the client to a unique value so this doesn't interfere
     * with direct monitoring of the directory by the same client.
     */
    monitor = g_hash_table_lookup (desktop->details->monitors, client);
    if (monitor != NULL)
    {
        g_assert (monitor->desktop_dir == desktop);
    }
    else
    {
        monitor = g_new0 (MergedMonitor, 1);
        monitor->desktop_dir = desktop;
        g_hash_table_insert (desktop->details->monitors,
                             (gpointer) client, monitor);
    }
    monitor->monitor_hidden_files = monitor_hidden_files;
    monitor->monitor_backup_files = monitor_backup_files;
    monitor->monitor_attributes = file_attributes;

    /* Call through to the real directory add calls. */
    merged_callback_list = NULL;

    /* Call up to real dir */
    caja_directory_file_monitor_add
    (desktop->details->real_directory, monitor,
     monitor_hidden_files, monitor_backup_files,
     file_attributes,
     build_merged_callback_list, &merged_callback_list);

    /* Handle the desktop part */
    merged_callback_list = g_list_concat (merged_callback_list,
                                          caja_file_list_copy (directory->details->file_list));


    if (callback != NULL)
    {
        (* callback) (directory, merged_callback_list, callback_data);
    }
    caja_file_list_free (merged_callback_list);
}
static gboolean
search_directory_file_get_item_count (CajaFile *file,
                                      guint *count,
                                      gboolean *count_unreadable)
{
    if (count)
    {
        GList *file_list;

        file_list = caja_directory_get_file_list (file->details->directory);

        *count = g_list_length (file_list);

        caja_file_list_free (file_list);
    }

    return TRUE;
}