diff options
author | Alexander Larsson <alexl@redhat.com> | 2009-12-04 12:39:20 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2009-12-04 12:39:20 +0100 |
commit | 881f208b876c6e4386d54a0db3fca26aaa34ff71 (patch) | |
tree | e3e017129b6a0c6d7aabfdbc069515619711e87f /libnautilus-extension | |
parent | 002bea81792cdfe6f4e45da95a59708040566171 (diff) | |
download | nautilus-881f208b876c6e4386d54a0db3fca26aaa34ff71.tar.gz |
Add lookup and creator functions for NautilusFileInfo objects
This has been requested by many extension developers.
Diffstat (limited to 'libnautilus-extension')
-rw-r--r-- | libnautilus-extension/nautilus-file-info.c | 40 | ||||
-rw-r--r-- | libnautilus-extension/nautilus-file-info.h | 4 |
2 files changed, 44 insertions, 0 deletions
diff --git a/libnautilus-extension/nautilus-file-info.c b/libnautilus-extension/nautilus-file-info.c index 942677036..38a1e427c 100644 --- a/libnautilus-extension/nautilus-file-info.c +++ b/libnautilus-extension/nautilus-file-info.c @@ -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; +} diff --git a/libnautilus-extension/nautilus-file-info.h b/libnautilus-extension/nautilus-file-info.h index d7a7278b5..fe2cfe97c 100644 --- a/libnautilus-extension/nautilus-file-info.h +++ b/libnautilus-extension/nautilus-file-info.h @@ -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 |