void
nautilus_search_directory_file_update_display_name (NautilusSearchDirectoryFile *search_file)
{
	NautilusFile *file;
	NautilusSearchDirectory *search_dir;
	NautilusQuery *query;
	char *display_name;
	gboolean changed;

	
	display_name = NULL;
	file = NAUTILUS_FILE (search_file);
	if (file->details->directory) {
		search_dir = NAUTILUS_SEARCH_DIRECTORY (file->details->directory);
		query = nautilus_search_directory_get_query (search_dir);
	
		if (query != NULL) {
			display_name = nautilus_query_to_readable_string (query);
			g_object_unref (query);
		} 
	}

	if (display_name == NULL) {
		display_name = g_strdup (_("Search"));
	}

	changed = nautilus_file_set_display_name (file, display_name, NULL, TRUE);
	if (changed) {
		nautilus_file_emit_changed (file);
	}

	g_free (display_name);
}
Exemplo n.º 2
0
void
nautilus_directory_emit_change_signals (NautilusDirectory *directory,
					     GList *changed_files)
{
	GList *p;

	for (p = changed_files; p != NULL; p = p->next) {
		nautilus_file_emit_changed (p->data);
	}
	nautilus_directory_emit_files_changed (directory, changed_files);
}
Exemplo n.º 3
0
static void
search_engine_hits_added (NautilusSearchEngine *engine, GList *hits, 
			  NautilusSearchDirectory *search)
{
	GList *hit_list;
	GList *file_list;
	NautilusFile *file;
	SearchMonitor *monitor;
	GList *monitor_list;

	file_list = NULL;

	for (hit_list = hits; hit_list != NULL; hit_list = hit_list->next) {
		NautilusSearchHit *hit = hit_list->data;
		const char *uri;

		uri = nautilus_search_hit_get_uri (hit);
		if (g_str_has_suffix (uri, NAUTILUS_SAVED_SEARCH_EXTENSION)) {
			/* Never return saved searches themselves as hits */
			continue;
		}

		nautilus_search_hit_compute_scores (hit, search->details->query);

		file = nautilus_file_get_by_uri (uri);
		nautilus_file_set_search_relevance (file, nautilus_search_hit_get_relevance (hit));

		for (monitor_list = search->details->monitor_list; monitor_list; monitor_list = monitor_list->next) {
			monitor = monitor_list->data;

			/* Add monitors */
			nautilus_file_monitor_add (file, monitor, monitor->monitor_attributes);
		}

		g_signal_connect (file, "changed", G_CALLBACK (file_changed), search),

		file_list = g_list_prepend (file_list, file);
		g_hash_table_add (search->details->files_hash, file);
	}
	
	search->details->files = g_list_concat (search->details->files, file_list);

	nautilus_directory_emit_files_added (NAUTILUS_DIRECTORY (search), file_list);

	file = nautilus_directory_get_corresponding_file (NAUTILUS_DIRECTORY (search));
	nautilus_file_emit_changed (file);
	nautilus_file_unref (file);

        search_directory_add_pending_files_callbacks (search);
}