Commit 881f208b authored by Alexander Larsson's avatar Alexander Larsson

Add lookup and creator functions for NautilusFileInfo objects

This has been requested by many extension developers.
parent 002bea81
......@@ -21,7 +21,9 @@
#include <config.h>
#include "nautilus-file-info.h"
#include "nautilus-extension-private.h"
NautilusFileInfo *(*nautilus_file_info_getter) (GFile *location, gboolean create);
GList *
nautilus_file_info_list_copy (GList *files)
......@@ -262,3 +264,41 @@ nautilus_file_info_invalidate_extension_info (NautilusFileInfo *file)
NAUTILUS_FILE_INFO_GET_IFACE (file)->invalidate_extension_info (file);
}
NautilusFileInfo *
nautilus_file_info_lookup (GFile *location)
{
return nautilus_file_info_getter (location, FALSE);
}
NautilusFileInfo *
nautilus_file_info_create (GFile *location)
{
return nautilus_file_info_getter (location, TRUE);
}
NautilusFileInfo *
nautilus_file_info_lookup_for_uri (const char *uri)
{
GFile *location;
NautilusFile *file;
location = g_file_new_for_uri (uri);
file = nautilus_file_info_lookup (location);
g_object_unref (location);
return file;
}
NautilusFileInfo *
nautilus_file_info_create_for_uri (const char *uri)
{
GFile *location;
NautilusFile *file;
location = g_file_new_for_uri (uri);
file = nautilus_file_info_create (location);
g_object_unref (location);
return file;
}
......@@ -126,6 +126,10 @@ void nautilus_file_info_add_string_attribute (NautilusFileInfo *fil
/* Invalidating file info */
void nautilus_file_info_invalidate_extension_info (NautilusFileInfo *file);
NautilusFileInfo *nautilus_file_info_lookup (GFile *location);
NautilusFileInfo *nautilus_file_info_create (GFile *location);
NautilusFileInfo *nautilus_file_info_lookup_for_uri (const char *uri);
NautilusFileInfo *nautilus_file_info_create_for_uri (const char *uri);
G_END_DECLS
......
......@@ -59,6 +59,7 @@
#include <gio/gio.h>
#include <glib.h>
#include <libnautilus-extension/nautilus-file-info.h>
#include <libnautilus-extension/nautilus-extension-private.h>
#include <libxml/parser.h>
#include <pwd.h>
#include <stdlib.h>
......@@ -7828,7 +7829,9 @@ static void
nautilus_file_class_init (NautilusFileClass *class)
{
GtkIconTheme *icon_theme;
nautilus_file_info_getter = nautilus_file_get_internal;
attribute_name_q = g_quark_from_static_string ("name");
attribute_size_q = g_quark_from_static_string ("size");
attribute_type_q = g_quark_from_static_string ("type");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment