static void
nautilus_emblem_sidebar_populate (NautilusEmblemSidebar *emblem_sidebar)
{
	GList *icons, *l, *widgets;
	GtkWidget *emblem_widget;
	char *name;
	char *path;
	GdkPixbuf *erase_pixbuf;

	erase_pixbuf = NULL;

	path = nautilus_pixmap_file ("erase.png");
	if (path != NULL) {
		erase_pixbuf = gdk_pixbuf_new_from_file (path, NULL);
	}
	g_free (path);

	if (erase_pixbuf != NULL) {
		emblem_widget = create_emblem_widget_with_pixbuf (emblem_sidebar,
							ERASE_EMBLEM_KEYWORD,
							_("Erase"),
							erase_pixbuf);
		gtk_container_add (GTK_CONTAINER
				(emblem_sidebar->details->emblems_table),
				emblem_widget);
	}


	icons = nautilus_emblem_list_available ();

	l = icons;
	widgets = NULL;
	while (l != NULL) {
		name = (char *)l->data;
		l = l->next;

		if (!nautilus_emblem_should_show_in_list (name)) {
			continue;
		}

		emblem_widget = create_emblem_widget (emblem_sidebar, name);
		
		widgets = g_list_prepend (widgets, emblem_widget);
	}
	eel_g_list_free_deep (icons);

	/* sort the emblems by display name */
	widgets = g_list_sort (widgets, emblem_widget_sort_func);

	l = widgets;
	while (l != NULL) {
		gtk_container_add
			(GTK_CONTAINER (emblem_sidebar->details->emblems_table),
			 l->data);
		l = l->next;
	}
	g_list_free (widgets);

	gtk_widget_show_all (emblem_sidebar->details->emblems_table);
}
void
nautilus_drag_file_receive_dropped_keyword (NautilusFile *file,
					    const char *keyword)
{
	GList *keywords, *word;

	g_return_if_fail (NAUTILUS_IS_FILE (file));
	g_return_if_fail (keyword != NULL);

	/* special case the erase emblem */
	if (strcmp (keyword, NAUTILUS_FILE_DND_ERASE_KEYWORD) == 0) {
		keywords = NULL;
	} else {
		keywords = nautilus_file_get_keywords (file);
		word = g_list_find_custom (keywords, keyword, (GCompareFunc) strcmp);
		if (word == NULL) {
			keywords = g_list_prepend (keywords, g_strdup (keyword));
		} else {
			keywords = g_list_remove_link (keywords, word);
			g_free (word->data);
			g_list_free_1 (word);
		}
	}

	nautilus_file_set_keywords (file, keywords);
	eel_g_list_free_deep (keywords);
}
static void
nautilus_search_engine_beagle_start (NautilusSearchEngine *engine)
{
	NautilusSearchEngineBeagle *beagle;
	GError *error;
	GList *mimetypes, *l;
	char *text, *mimetype;

	error = NULL;
	beagle = NAUTILUS_SEARCH_ENGINE_BEAGLE (engine);

	if (beagle->details->current_query) {
		return;
	}

	beagle->details->query_finished = FALSE;
	beagle->details->current_query = beagle_query_new ();
	g_signal_connect (beagle->details->current_query,
			  "hits-added", G_CALLBACK (beagle_hits_added), engine);
	g_signal_connect (beagle->details->current_query,
			  "hits-subtracted", G_CALLBACK (beagle_hits_subtracted), engine);
	g_signal_connect (beagle->details->current_query,
			  "finished", G_CALLBACK (beagle_finished), engine);
	g_signal_connect (beagle->details->current_query,
			  "error", G_CALLBACK (beagle_error), engine);

	/* We only want files */
	beagle_query_add_text (beagle->details->current_query," type:File");
				   
	beagle_query_set_max_hits (beagle->details->current_query,
				   1000);
	
	text = nautilus_query_get_text (beagle->details->query);
	beagle_query_add_text (beagle->details->current_query,
			       text);

	mimetypes = nautilus_query_get_mime_types (beagle->details->query);
	for (l = mimetypes; l != NULL; l = l->next) {
		char* temp;
		mimetype = l->data;
		temp = g_strconcat (" mimetype:", mimetype, NULL);
		beagle_query_add_text (beagle->details->current_query,temp);
		g_free (temp);
	}

	beagle->details->current_query_uri_prefix = nautilus_query_get_location (beagle->details->query);
	
	if (!beagle_client_send_request_async (beagle->details->client,
					       BEAGLE_REQUEST (beagle->details->current_query), &error)) {
		nautilus_search_engine_error (engine, error->message);
		g_error_free (error);
	}

	/* These must live during the lifetime of the query */
	g_free (text);
	eel_g_list_free_deep (mimetypes);
}
static void
position_set_list_free (GList *list)
{
	GList *p;
	NautilusFileChangesQueuePosition *item;

	for (p = list; p != NULL; p = p->next) {
		item = p->data;
		g_object_unref (item->location);
	}
	/* delete the list and the now empty structs */
	eel_g_list_free_deep (list);
}
static void
pairs_list_free (GList *pairs)
{
	GList *p;
	GFilePair *pair;

	/* deep delete the list of pairs */

	for (p = pairs; p != NULL; p = p->next) {
		/* delete the strings in each pair */
		pair = p->data;
		g_object_unref (pair->from);
		g_object_unref (pair->to);
	}

	/* delete the list and the now empty pair structs */
	eel_g_list_free_deep (pairs);
}
void
caja_clipboard_clear_if_colliding_uris (GtkWidget *widget,
                                        const GList *item_uris,
                                        GdkAtom copied_files_atom)
{
    GtkSelectionData *data;
    GList *clipboard_item_uris, *l;
    gboolean collision;

    collision = FALSE;
    data = gtk_clipboard_wait_for_contents (caja_clipboard_get (widget),
                                            copied_files_atom);
    if (data == NULL)
    {
        return;
    }

    clipboard_item_uris = caja_clipboard_get_uri_list_from_selection_data (data, NULL,
                          copied_files_atom);

    for (l = (GList *) item_uris; l; l = l->next)
    {
        if (g_list_find_custom ((GList *) item_uris, l->data,
                                (GCompareFunc) g_strcmp0))
        {
            collision = TRUE;
            break;
        }
    }

    if (collision)
    {
        gtk_clipboard_clear (caja_clipboard_get (widget));
    }

    if (clipboard_item_uris)
    {
        eel_g_list_free_deep (clipboard_item_uris);
    }
}