summaryrefslogtreecommitdiffstats
path: root/libnautilus-extension
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:39:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:39:48 +0000
commit3ade071f273aaa973e44bf95d6b1d4913a18f03b (patch)
treee2f99d267ae18427645404f215b984afbe73098d /libnautilus-extension
parentInitial commit. (diff)
downloadnautilus-3ade071f273aaa973e44bf95d6b1d4913a18f03b.tar.xz
nautilus-3ade071f273aaa973e44bf95d6b1d4913a18f03b.zip
Adding upstream version 43.2.upstream/43.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libnautilus-extension')
-rw-r--r--libnautilus-extension/LICENSE458
-rw-r--r--libnautilus-extension/meson.build115
-rw-r--r--libnautilus-extension/nautilus-column-provider.c45
-rw-r--r--libnautilus-extension/nautilus-column-provider.h78
-rw-r--r--libnautilus-extension/nautilus-column.c325
-rw-r--r--libnautilus-extension/nautilus-column.h67
-rw-r--r--libnautilus-extension/nautilus-extension-private.h31
-rw-r--r--libnautilus-extension/nautilus-extension.h62
-rw-r--r--libnautilus-extension/nautilus-file-info.c375
-rw-r--r--libnautilus-extension/nautilus-file-info.h328
-rw-r--r--libnautilus-extension/nautilus-info-provider.c98
-rw-r--r--libnautilus-extension/nautilus-info-provider.h156
-rw-r--r--libnautilus-extension/nautilus-menu-item.c348
-rw-r--r--libnautilus-extension/nautilus-menu-provider.c94
-rw-r--r--libnautilus-extension/nautilus-menu-provider.h102
-rw-r--r--libnautilus-extension/nautilus-menu.c98
-rw-r--r--libnautilus-extension/nautilus-menu.h143
-rw-r--r--libnautilus-extension/nautilus-properties-item.c149
-rw-r--r--libnautilus-extension/nautilus-properties-item.h61
-rw-r--r--libnautilus-extension/nautilus-properties-model-provider.c29
-rw-r--r--libnautilus-extension/nautilus-properties-model-provider.h66
-rw-r--r--libnautilus-extension/nautilus-properties-model.c167
-rw-r--r--libnautilus-extension/nautilus-properties-model.h71
23 files changed, 3466 insertions, 0 deletions
diff --git a/libnautilus-extension/LICENSE b/libnautilus-extension/LICENSE
new file mode 100644
index 0000000..e9ab0b3
--- /dev/null
+++ b/libnautilus-extension/LICENSE
@@ -0,0 +1,458 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
diff --git a/libnautilus-extension/meson.build b/libnautilus-extension/meson.build
new file mode 100644
index 0000000..3c2ab4b
--- /dev/null
+++ b/libnautilus-extension/meson.build
@@ -0,0 +1,115 @@
+libnautilus_extension_headers = [
+ 'nautilus-column-provider.h',
+ 'nautilus-column.h',
+ 'nautilus-file-info.h',
+ 'nautilus-info-provider.h',
+ 'nautilus-menu-provider.h',
+ 'nautilus-properties-model-provider.h',
+ 'nautilus-properties-model.h',
+ 'nautilus-properties-item.h',
+ 'nautilus-menu.h'
+]
+
+install_headers(
+ 'nautilus-extension.h',
+ subdir: 'nautilus'
+)
+install_headers(
+ libnautilus_extension_headers,
+ subdir: join_paths('nautilus', 'libnautilus-extension')
+)
+
+libnautilus_extension_enums = gnome.mkenums_simple(
+ 'nautilus-extension-enum-types',
+ install_header: true,
+ install_dir: join_paths(includedir, 'nautilus', 'libnautilus-extension'),
+ sources: [
+ 'nautilus-info-provider.h'
+ ]
+)
+
+libnautilus_extension_sources = [
+ libnautilus_extension_enums,
+ libnautilus_extension_headers,
+ 'nautilus-column-provider.c',
+ 'nautilus-column.c',
+ 'nautilus-extension.h',
+ 'nautilus-extension-private.h',
+ 'nautilus-file-info.c',
+ 'nautilus-info-provider.c',
+ 'nautilus-menu-item.c',
+ 'nautilus-menu-provider.c',
+ 'nautilus-properties-model-provider.c',
+ 'nautilus-properties-model.c',
+ 'nautilus-properties-item.c',
+ 'nautilus-menu.c'
+]
+
+libnautilus_extension_deps = [
+ config_h,
+ glib,
+ gio
+]
+
+libnautilus_extension = shared_library(
+ 'nautilus-extension', [
+ libnautilus_extension_sources,
+ ],
+ c_args: [
+ '-DNAUTILUS_COMPILATION'
+ ],
+ dependencies: libnautilus_extension_deps,
+ include_directories: nautilus_include_dirs,
+ soversion: nautilus_extension_version,
+ install: true
+)
+
+if get_option('introspection')
+ nautilus_extension_gir = gnome.generate_gir(
+ libnautilus_extension,
+ export_packages: [
+ 'libnautilus-extension'
+ ],
+ extra_args: [
+ '-DNAUTILUS_COMPILATION'
+ ],
+ sources: libnautilus_extension_sources,
+ nsversion: nautilus_extension_version + '.0',
+ namespace: 'Nautilus',
+ includes: [
+ 'Gio-2.0',
+ 'GLib-2.0'
+ ],
+ header: 'nautilus-extension.h',
+ install: true
+ )
+endif
+
+nautilus_extension = declare_dependency(
+ sources: libnautilus_extension_enums[1],
+ link_with: libnautilus_extension,
+ dependencies: libnautilus_extension_deps,
+ include_directories: nautilus_include_dirs
+)
+
+pkgconfig.generate(
+ description: 'A library to create Nautilus view extensions',
+ filebase: 'libnautilus-extension-' + nautilus_extension_version,
+ libraries: [
+ libnautilus_extension
+ ],
+ name: 'libnautilus-extension',
+ subdirs: [
+ 'nautilus'
+ ],
+ requires: [
+ 'gio-2.0',
+ 'glib-2.0',
+ ],
+ variables: [
+ 'exec_prefix=${prefix}',
+ 'extensiondir=${libdir}/nautilus/extensions-' + nautilus_extension_version,
+ 'extensions_api_version=' + nautilus_extension_version
+ ],
+ version: meson.project_version()
+)
diff --git a/libnautilus-extension/nautilus-column-provider.c b/libnautilus-extension/nautilus-column-provider.c
new file mode 100644
index 0000000..a66ef85
--- /dev/null
+++ b/libnautilus-extension/nautilus-column-provider.c
@@ -0,0 +1,45 @@
+/*
+ * nautilus-column-provider.c - Interface for Nautilus extensions
+ * that provide column specifications.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Dave Camp <dave@ximian.com>
+ *
+ */
+
+#include "nautilus-column-provider.h"
+
+G_DEFINE_INTERFACE (NautilusColumnProvider, nautilus_column_provider, G_TYPE_OBJECT)
+
+static void
+nautilus_column_provider_default_init (NautilusColumnProviderInterface *klass)
+{
+}
+
+GList *
+nautilus_column_provider_get_columns (NautilusColumnProvider *self)
+{
+ NautilusColumnProviderInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_COLUMN_PROVIDER (self), NULL);
+
+ iface = NAUTILUS_COLUMN_PROVIDER_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_columns != NULL, NULL);
+
+ return iface->get_columns (self);
+}
diff --git a/libnautilus-extension/nautilus-column-provider.h b/libnautilus-extension/nautilus-column-provider.h
new file mode 100644
index 0000000..ab54ac5
--- /dev/null
+++ b/libnautilus-extension/nautilus-column-provider.h
@@ -0,0 +1,78 @@
+/*
+ * nautilus-column-provider.h - Interface for Nautilus extensions that
+ * provide column descriptions.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Dave Camp <dave@ximian.com>
+ *
+ */
+
+/* This interface is implemented by Nautilus extensions that want to
+ * add columns to the list view and details to the icon view.
+ * Extensions are asked for a list of columns to display. Each
+ * returned column refers to a string attribute which can be filled in
+ * by NautilusInfoProvider */
+
+#pragma once
+
+#if !defined (NAUTILUS_EXTENSION_H) && !defined (NAUTILUS_COMPILATION)
+#warning "Only <nautilus-extension.h> should be included directly."
+#endif
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_COLUMN_PROVIDER (nautilus_column_provider_get_type ())
+
+G_DECLARE_INTERFACE (NautilusColumnProvider, nautilus_column_provider,
+ NAUTILUS, COLUMN_PROVIDER,
+ GObject)
+
+/**
+ * SECTION:nautilus-column-provider
+ * @title: NautilusColumnProvider
+ * @short_description: Interface to provide additional list view columns
+ *
+ * #NautilusColumnProvider allows extension to provide additional columns
+ * in the file manager list view.
+ */
+
+/**
+ * NautilusColumnProviderInterface:
+ * @g_iface: The parent interface.
+ * @get_columns: Returns a #GList of #NautilusColumn.
+ * See nautilus_column_provider_get_columns() for details.
+ *
+ * Interface for extensions to provide additional list view columns.
+ */
+struct _NautilusColumnProviderInterface
+{
+ GTypeInterface g_iface;
+
+ GList *(*get_columns) (NautilusColumnProvider *provider);
+};
+
+/**
+ * nautilus_column_provider_get_columns:
+ * @provider: a #NautilusColumnProvider
+ *
+ * Returns: (nullable) (element-type NautilusColumn) (transfer full): the provided #NautilusColumn objects
+ */
+GList *nautilus_column_provider_get_columns (NautilusColumnProvider *provider);
+
+G_END_DECLS
diff --git a/libnautilus-extension/nautilus-column.c b/libnautilus-extension/nautilus-column.c
new file mode 100644
index 0000000..0349863
--- /dev/null
+++ b/libnautilus-extension/nautilus-column.c
@@ -0,0 +1,325 @@
+/*
+ * nautilus-column.c - Info columns exported by NautilusColumnProvider
+ * objects.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Dave Camp <dave@ximian.com>
+ *
+ */
+
+#include "nautilus-column.h"
+
+enum
+{
+ PROP_0,
+ PROP_NAME,
+ PROP_ATTRIBUTE,
+ PROP_ATTRIBUTE_Q,
+ PROP_LABEL,
+ PROP_DESCRIPTION,
+ PROP_XALIGN,
+ PROP_DEFAULT_SORT_ORDER,
+ LAST_PROP
+};
+
+struct _NautilusColumn
+{
+ GObject parent_instance;
+
+ char *name;
+ GQuark attribute;
+ char *label;
+ char *description;
+ float xalign;
+ int default_sort_order; /* Actually, meant to store GtkSortType */
+};
+
+G_DEFINE_TYPE (NautilusColumn, nautilus_column, G_TYPE_OBJECT);
+
+NautilusColumn *
+nautilus_column_new (const char *name,
+ const char *attribute,
+ const char *label,
+ const char *description)
+{
+ NautilusColumn *column;
+
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (attribute != NULL, NULL);
+ g_return_val_if_fail (label != NULL, NULL);
+ g_return_val_if_fail (description != NULL, NULL);
+
+ column = g_object_new (NAUTILUS_TYPE_COLUMN,
+ "name", name,
+ "attribute", attribute,
+ "label", label,
+ "description", description,
+ NULL);
+
+ return column;
+}
+
+static void
+nautilus_column_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusColumn *column;
+
+ column = NAUTILUS_COLUMN (object);
+
+ switch (param_id)
+ {
+ case PROP_NAME:
+ {
+ g_value_set_string (value, column->name);
+ }
+ break;
+
+ case PROP_ATTRIBUTE:
+ {
+ g_value_set_string (value, g_quark_to_string (column->attribute));
+ }
+ break;
+
+ case PROP_ATTRIBUTE_Q:
+ {
+ g_value_set_uint (value, column->attribute);
+ }
+ break;
+
+ case PROP_LABEL:
+ {
+ g_value_set_string (value, column->label);
+ }
+ break;
+
+ case PROP_DESCRIPTION:
+ {
+ g_value_set_string (value, column->description);
+ }
+ break;
+
+ case PROP_XALIGN:
+ {
+ g_value_set_float (value, column->xalign);
+ }
+ break;
+
+ case PROP_DEFAULT_SORT_ORDER:
+ {
+ g_value_set_int (value, column->default_sort_order);
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ }
+ break;
+ }
+}
+
+static void
+nautilus_column_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusColumn *column;
+
+ column = NAUTILUS_COLUMN (object);
+
+ switch (param_id)
+ {
+ case PROP_NAME:
+ {
+ g_free (column->name);
+ column->name = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "name");
+ }
+ break;
+
+ case PROP_ATTRIBUTE:
+ {
+ column->attribute = g_quark_from_string (g_value_get_string (value));
+ g_object_notify (object, "attribute");
+ g_object_notify (object, "attribute_q");
+ }
+ break;
+
+ case PROP_LABEL:
+ {
+ g_free (column->label);
+ column->label = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "label");
+ }
+ break;
+
+ case PROP_DESCRIPTION:
+ {
+ g_free (column->description);
+ column->description = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "description");
+ }
+ break;
+
+ case PROP_XALIGN:
+ {
+ column->xalign = g_value_get_float (value);
+ g_object_notify (object, "xalign");
+ }
+ break;
+
+ case PROP_DEFAULT_SORT_ORDER:
+ {
+ column->default_sort_order = g_value_get_int (value);
+ g_object_notify (object, "default-sort-order");
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ }
+ break;
+ }
+}
+
+static void
+nautilus_column_finalize (GObject *object)
+{
+ NautilusColumn *column;
+
+ column = NAUTILUS_COLUMN (object);
+
+ g_free (column->name);
+ g_free (column->label);
+ g_free (column->description);
+
+ G_OBJECT_CLASS (nautilus_column_parent_class)->finalize (object);
+}
+
+static void
+nautilus_column_init (NautilusColumn *column)
+{
+ column->xalign = 0.0;
+}
+
+static void
+nautilus_column_class_init (NautilusColumnClass *class)
+{
+ G_OBJECT_CLASS (class)->finalize = nautilus_column_finalize;
+ G_OBJECT_CLASS (class)->get_property = nautilus_column_get_property;
+ G_OBJECT_CLASS (class)->set_property = nautilus_column_set_property;
+
+ /**
+ * NautilusColumn:name:
+ *
+ * The identifier for the column.
+ */
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Name",
+ "Name of the column",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE));
+
+ /**
+ * NautilusColumn:attribute:
+ *
+ * The file attribute to be displayed in the column.
+ */
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_ATTRIBUTE,
+ g_param_spec_string ("attribute",
+ "Attribute",
+ "The attribute name to display",
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * NautilusColumn:attribute_q:
+ *
+ * The name of the attribute to display, in quark form.
+ */
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_ATTRIBUTE_Q,
+ g_param_spec_uint ("attribute_q",
+ "Attribute quark",
+ "The attribute name to display, in quark form",
+ 0, G_MAXUINT, 0,
+ G_PARAM_READABLE));
+
+ /**
+ * NautilusColumn:label:
+ *
+ * The label to display in the column.
+ */
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_LABEL,
+ g_param_spec_string ("label",
+ "Label",
+ "Label to display in the column",
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * NautilusColumn:description:
+ *
+ * The user-visible description of the column.
+ */
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_DESCRIPTION,
+ g_param_spec_string ("description",
+ "Description",
+ "A user-visible description of the column",
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * NautilusColumn:xalign:
+ *
+ * The x-alignment of the column.
+ */
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_XALIGN,
+ g_param_spec_float ("xalign",
+ "xalign",
+ "The x-alignment of the column",
+ 0.0,
+ 1.0,
+ 0.0,
+ G_PARAM_READWRITE));
+ /**
+ * NautilusColumn:default-sort-order: (type gboolean)
+ *
+ * Actually meant to store the enum values of GtkSortType, but we don't want
+ * extensions to depend on GTK. Also, this is for internal consumption only.
+ *
+ * Stability: Private: Internal to the application.
+ */
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_DEFAULT_SORT_ORDER,
+ g_param_spec_int ("default-sort-order",
+ "Default sort order",
+ "Default sort order",
+ G_MININT, G_MAXINT, 0,
+ G_PARAM_READWRITE));
+}
diff --git a/libnautilus-extension/nautilus-column.h b/libnautilus-extension/nautilus-column.h
new file mode 100644
index 0000000..09dc0c7
--- /dev/null
+++ b/libnautilus-extension/nautilus-column.h
@@ -0,0 +1,67 @@
+/*
+ * nautilus-column.h - Info columns exported by
+ * NautilusColumnProvider objects.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Dave Camp <dave@ximian.com>
+ *
+ */
+
+#pragma once
+
+#if !defined (NAUTILUS_EXTENSION_H) && !defined (NAUTILUS_COMPILATION)
+#warning "Only <nautilus-extension.h> should be included directly."
+#endif
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_COLUMN (nautilus_column_get_type())
+
+G_DECLARE_FINAL_TYPE (NautilusColumn, nautilus_column, NAUTILUS, COLUMN, GObject)
+
+/**
+ * NautilusColumn:
+ *
+ * List view column descriptor object.
+ *
+ * `NautilusColumn` is an object that describes a column in the file manager
+ * list view. Extensions can provide `NautilusColumn` by registering a
+ * [class@ColumnProvider] and returning them from
+ * [method@ColumnProvider.get_columns], which will be called by the main
+ * application when creating a view.
+ */
+
+/**
+ * nautilus_column_new:
+ *
+ * @name: (not nullable): identifier of the column
+ * @attribute: (not nullable): the file attribute to be displayed in the column
+ * @label: (not nullable): the user-visible label for the column
+ * @description: (not nullable): a user-visible description of the column
+ *
+ * Creates a new [class@Column] object.
+ *
+ * Returns: (transfer full): a new #NautilusColumn
+ */
+NautilusColumn *nautilus_column_new (const char *name,
+ const char *attribute,
+ const char *label,
+ const char *description);
+
+G_END_DECLS
diff --git a/libnautilus-extension/nautilus-extension-private.h b/libnautilus-extension/nautilus-extension-private.h
new file mode 100644
index 0000000..775e892
--- /dev/null
+++ b/libnautilus-extension/nautilus-extension-private.h
@@ -0,0 +1,31 @@
+/*
+ * nautilus-extension-private.h - Type definitions for Nautilus extensions
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Alexander Larsson <alexl@redhat.com>
+ *
+ */
+
+#pragma once
+
+#include <libnautilus-extension/nautilus-file-info.h>
+
+G_BEGIN_DECLS
+
+extern NautilusFileInfo *(*nautilus_file_info_getter) (GFile *location, gboolean create);
+
+G_END_DECLS \ No newline at end of file
diff --git a/libnautilus-extension/nautilus-extension.h b/libnautilus-extension/nautilus-extension.h
new file mode 100644
index 0000000..e7dc3c8
--- /dev/null
+++ b/libnautilus-extension/nautilus-extension.h
@@ -0,0 +1,62 @@
+/* Copyright (C) 2018 Ernestas Kulik <ernestask@gnome.org>
+ *
+ * This file is part of libnautilus-extension.
+ *
+ * libnautilus-extension is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * libnautilus-extension is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with libnautilus-extension. If not, see <https://www.gnu.org/licenses/>.
+ */
+#ifndef NAUTILUS_EXTENSION_H
+#define NAUTILUS_EXTENSION_H
+
+#include <libnautilus-extension/nautilus-column-provider.h>
+#include <libnautilus-extension/nautilus-column.h>
+#include <libnautilus-extension/nautilus-extension-enum-types.h>
+#include <libnautilus-extension/nautilus-file-info.h>
+#include <libnautilus-extension/nautilus-info-provider.h>
+#include <libnautilus-extension/nautilus-menu.h>
+#include <libnautilus-extension/nautilus-menu-provider.h>
+#include <libnautilus-extension/nautilus-properties-model.h>
+#include <libnautilus-extension/nautilus-properties-model-provider.h>
+#include <libnautilus-extension/nautilus-properties-item.h>
+
+/**
+ * SECTION:nautilus-extension
+ * @title: Extension entry points
+ */
+
+/**
+ * nautilus_module_initialize: (skip)
+ * @module: a #GTypeModule used in type registration
+ *
+ * Called when the extension is begin loaded to register the types it exports
+ * and to perform other initializations.
+ */
+void nautilus_module_initialize (GTypeModule *module);
+/**
+ * nautilus_module_shutdown: (skip)
+ *
+ * Called when the extension is being unloaded.
+ */
+void nautilus_module_shutdown (void);
+/**
+ * nautilus_module_list_types: (skip)
+ * @types: (out) (transfer none) (array length=num_types): array of GType *
+ * @num_types: the number of types in the array
+ *
+ * Called after the extension has been initialized and has registered all the
+ * types it exports, to load them into Nautilus.
+ */
+void nautilus_module_list_types (const GType **types,
+ int *num_types);
+
+#endif
diff --git a/libnautilus-extension/nautilus-file-info.c b/libnautilus-extension/nautilus-file-info.c
new file mode 100644
index 0000000..020cac3
--- /dev/null
+++ b/libnautilus-extension/nautilus-file-info.c
@@ -0,0 +1,375 @@
+/*
+ * nautilus-file-info.c - Information about a file
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "nautilus-file-info.h"
+
+#include "nautilus-extension-private.h"
+
+G_DEFINE_INTERFACE (NautilusFileInfo, nautilus_file_info, G_TYPE_OBJECT)
+
+NautilusFileInfo * (*nautilus_file_info_getter)(GFile *location,
+ gboolean create);
+
+GList *
+nautilus_file_info_list_copy (GList *files)
+{
+ GList *ret;
+ GList *l;
+
+ ret = g_list_copy (files);
+ for (l = ret; l != NULL; l = l->next)
+ {
+ g_object_ref (G_OBJECT (l->data));
+ }
+
+ return ret;
+}
+
+void
+nautilus_file_info_list_free (GList *files)
+{
+ GList *l;
+
+ for (l = files; l != NULL; l = l->next)
+ {
+ g_object_unref (G_OBJECT (l->data));
+ }
+
+ g_list_free (files);
+}
+
+static void
+nautilus_file_info_default_init (NautilusFileInfoInterface *klass)
+{
+}
+
+gboolean
+nautilus_file_info_is_gone (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), FALSE);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->is_gone != NULL, FALSE);
+
+ return iface->is_gone (self);
+}
+
+GFileType
+nautilus_file_info_get_file_type (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), G_FILE_TYPE_UNKNOWN);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_file_type != NULL, G_FILE_TYPE_UNKNOWN);
+
+ return iface->get_file_type (self);
+}
+
+char *
+nautilus_file_info_get_name (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), NULL);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_name != NULL, NULL);
+
+ return iface->get_name (self);
+}
+
+GFile *
+nautilus_file_info_get_location (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), NULL);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_location != NULL, NULL);
+
+ return iface->get_location (self);
+}
+char *
+nautilus_file_info_get_uri (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), NULL);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_uri != NULL, NULL);
+
+ return iface->get_uri (self);
+}
+
+char *
+nautilus_file_info_get_activation_uri (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), NULL);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_activation_uri != NULL, NULL);
+
+ return iface->get_activation_uri (self);
+}
+
+GFile *
+nautilus_file_info_get_parent_location (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), NULL);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_parent_location != NULL, NULL);
+
+ return iface->get_parent_location (self);
+}
+
+char *
+nautilus_file_info_get_parent_uri (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), NULL);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_parent_uri != NULL, NULL);
+
+ return iface->get_parent_uri (self);
+}
+
+NautilusFileInfo *
+nautilus_file_info_get_parent_info (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), NULL);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_parent_info != NULL, NULL);
+
+ return iface->get_parent_info (self);
+}
+
+GMount *
+nautilus_file_info_get_mount (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), NULL);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_mount != NULL, NULL);
+
+ return iface->get_mount (self);
+}
+
+char *
+nautilus_file_info_get_uri_scheme (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), NULL);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_uri_scheme != NULL, NULL);
+
+ return iface->get_uri_scheme (self);
+}
+
+char *
+nautilus_file_info_get_mime_type (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), NULL);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_mime_type != NULL, NULL);
+
+ return iface->get_mime_type (self);
+}
+
+gboolean
+nautilus_file_info_is_mime_type (NautilusFileInfo *self,
+ const char *mime_type)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), FALSE);
+ g_return_val_if_fail (mime_type != NULL, FALSE);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->is_mime_type != NULL, FALSE);
+
+ return iface->is_mime_type (self, mime_type);
+}
+
+gboolean
+nautilus_file_info_is_directory (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), FALSE);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->is_directory != NULL, FALSE);
+
+ return iface->is_directory (self);
+}
+
+gboolean
+nautilus_file_info_can_write (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), FALSE);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->can_write != NULL, FALSE);
+
+ return iface->can_write (self);
+}
+
+void
+nautilus_file_info_add_emblem (NautilusFileInfo *self,
+ const char *emblem_name)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_if_fail (NAUTILUS_IS_FILE_INFO (self));
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_if_fail (iface->add_emblem != NULL);
+
+ iface->add_emblem (self, emblem_name);
+}
+
+char *
+nautilus_file_info_get_string_attribute (NautilusFileInfo *self,
+ const char *attribute_name)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (self), NULL);
+ g_return_val_if_fail (attribute_name != NULL, NULL);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_string_attribute != NULL, NULL);
+
+ return iface->get_string_attribute (self, attribute_name);
+}
+
+void
+nautilus_file_info_add_string_attribute (NautilusFileInfo *self,
+ const char *attribute_name,
+ const char *value)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_if_fail (NAUTILUS_IS_FILE_INFO (self));
+ g_return_if_fail (attribute_name != NULL);
+ g_return_if_fail (value != NULL);
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_if_fail (iface->add_string_attribute != NULL);
+
+ iface->add_string_attribute (self, attribute_name, value);
+}
+
+void
+nautilus_file_info_invalidate_extension_info (NautilusFileInfo *self)
+{
+ NautilusFileInfoInterface *iface;
+
+ g_return_if_fail (NAUTILUS_IS_FILE_INFO (self));
+
+ iface = NAUTILUS_FILE_INFO_GET_IFACE (self);
+
+ g_return_if_fail (iface->invalidate_extension_info != NULL);
+
+ iface->invalidate_extension_info (self);
+}
+
+NautilusFileInfo *
+nautilus_file_info_lookup (GFile *location)
+{
+ g_return_val_if_fail (G_IS_FILE (location), NULL);
+
+ return nautilus_file_info_getter (location, FALSE);
+}
+
+NautilusFileInfo *
+nautilus_file_info_create (GFile *location)
+{
+ g_return_val_if_fail (G_IS_FILE (location), NULL);
+
+ return nautilus_file_info_getter (location, TRUE);
+}
+
+NautilusFileInfo *
+nautilus_file_info_lookup_for_uri (const char *uri)
+{
+ g_autoptr (GFile) location = NULL;
+
+ g_return_val_if_fail (uri != NULL, NULL);
+
+ location = g_file_new_for_uri (uri);
+
+ return nautilus_file_info_lookup (location);
+}
+
+NautilusFileInfo *
+nautilus_file_info_create_for_uri (const char *uri)
+{
+ g_autoptr (GFile) location = NULL;
+
+ g_return_val_if_fail (uri != NULL, NULL);
+
+ location = g_file_new_for_uri (uri);
+
+ return nautilus_file_info_create (location);
+}
diff --git a/libnautilus-extension/nautilus-file-info.h b/libnautilus-extension/nautilus-file-info.h
new file mode 100644
index 0000000..1fe71b5
--- /dev/null
+++ b/libnautilus-extension/nautilus-file-info.h
@@ -0,0 +1,328 @@
+/*
+ * nautilus-file-info.h - Information about a file
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/* NautilusFileInfo is an interface to the NautilusFile object. It
+ * provides access to the asynchronous data in the NautilusFile.
+ * Extensions are passed objects of this type for operations. */
+
+#pragma once
+
+#if !defined (NAUTILUS_EXTENSION_H) && !defined (NAUTILUS_COMPILATION)
+#warning "Only <nautilus-extension.h> should be included directly."
+#endif
+
+#include <glib-object.h>
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_FILE_INFO (nautilus_file_info_get_type ())
+
+G_DECLARE_INTERFACE (NautilusFileInfo, nautilus_file_info, NAUTILUS, FILE_INFO, GObject)
+
+/**
+ * SECTION:nautilus-file-info
+ * @title: NautilusFileInfo
+ * @short_description: File interface for nautilus extensions
+ *
+ * #NautilusFileInfo provides methods to get and modify information
+ * about file objects in the file manager.
+ */
+
+/**
+ * NautilusFileInfoInterface:
+ * @g_iface: The parent interface.
+ * @is_gone: Returns whether the file info is gone.
+ * See nautilus_file_info_is_gone() for details.
+ * @get_name: Returns the file name as a string.
+ * See nautilus_file_info_get_name() for details.
+ * @get_uri: Returns the file URI as a string.
+ * See nautilus_file_info_get_uri() for details.
+ * @get_parent_uri: Returns the file parent URI as a string.
+ * See nautilus_file_info_get_parent_uri() for details.
+ * @get_uri_scheme: Returns the file URI scheme as a string.
+ * See nautilus_file_info_get_uri_scheme() for details.
+ * @get_mime_type: Returns the file mime type as a string.
+ * See nautilus_file_info_get_mime_type() for details.
+ * @is_mime_type: Returns whether the file is the given mime type.
+ * See nautilus_file_info_is_mime_type() for details.
+ * @is_directory: Returns whether the file is a directory.
+ * See nautilus_file_info_is_directory() for details.
+ * @add_emblem: Adds an emblem to this file.
+ * See nautilus_file_info_add_emblem() for details.
+ * @get_string_attribute: Returns the specified file attribute as a string.
+ * See nautilus_file_info_get_string_attribute() for details.
+ * @add_string_attribute: Sets the specified string file attribute value.
+ * See nautilus_file_info_add_string_attribute() for details.
+ * @invalidate_extension_info: Invalidates information of the file provided by extensions.
+ * See nautilus_file_info_invalidate_extension_info() for details.
+ * @get_activation_uri: Returns the file activation URI as a string.
+ * See nautilus_file_info_get_activation_uri() for details.
+ * @get_file_type: Returns the file type.
+ * See nautilus_file_info_get_file_type() for details.
+ * @get_location: Returns the file location as a #GFile.
+ * See nautilus_file_info_get_location() for details.
+ * @get_parent_location: Returns the file parent location as a #GFile.
+ * See nautilus_file_info_get_parent_location() for details.
+ * @get_parent_info: Returns the file parent #NautilusFileInfo.
+ * See nautilus_file_info_get_parent_info() for details.
+ * @get_mount: Returns the file mount as a #GMount.
+ * See nautilus_file_info_get_mount() for details.
+ * @can_write: Returns whether the file is writable.
+ * See nautilus_file_info_can_write() for details.
+ *
+ * Interface for extensions to provide additional menu items.
+ */
+struct _NautilusFileInfoInterface
+{
+ GTypeInterface g_iface;
+
+ gboolean (*is_gone) (NautilusFileInfo *file_info);
+
+ char *(*get_name) (NautilusFileInfo *file_info);
+ char *(*get_uri) (NautilusFileInfo *file_info);
+ char *(*get_parent_uri) (NautilusFileInfo *file_info);
+ char *(*get_uri_scheme) (NautilusFileInfo *file_info);
+
+ char *(*get_mime_type) (NautilusFileInfo *file_info);
+ gboolean (*is_mime_type) (NautilusFileInfo *file_info,
+ const char *mime_type);
+ gboolean (*is_directory) (NautilusFileInfo *file_info);
+
+ void (*add_emblem) (NautilusFileInfo *file_info,
+ const char *emblem_name);
+ char *(*get_string_attribute) (NautilusFileInfo *file_info,
+ const char *attribute_name);
+ void (*add_string_attribute) (NautilusFileInfo *file_info,
+ const char *attribute_name,
+ const char *value);
+ void (*invalidate_extension_info) (NautilusFileInfo *file_info);
+
+ char *(*get_activation_uri) (NautilusFileInfo *file_info);
+
+ GFileType (*get_file_type) (NautilusFileInfo *file_info);
+ GFile *(*get_location) (NautilusFileInfo *file_info);
+ GFile *(*get_parent_location) (NautilusFileInfo *file_info);
+ NautilusFileInfo *(*get_parent_info) (NautilusFileInfo *file_info);
+ GMount *(*get_mount) (NautilusFileInfo *file_info);
+ gboolean (*can_write) (NautilusFileInfo *file_info);
+};
+
+/**
+ * nautilus_file_info_list_copy:
+ * @files: (element-type NautilusFileInfo): the files to copy
+ *
+ * Returns: (element-type NautilusFileInfo) (transfer full): a copy of @files.
+ * Use #nautilus_file_info_list_free to free the list and unref its contents.
+ */
+GList *nautilus_file_info_list_copy (GList *files);
+/**
+ * nautilus_file_info_list_free:
+ * @files: (element-type NautilusFileInfo): a list created with #nautilus_file_info_list_copy
+ *
+ */
+void nautilus_file_info_list_free (GList *files);
+
+/**
+ * nautilus_file_info_is_gone:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: whether the file has been deleted
+ */
+gboolean nautilus_file_info_is_gone (NautilusFileInfo *file_info);
+
+/* Name and Location */
+/**
+ * nautilus_file_info_get_file_type:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: a #GFileType for the location of @file_info
+ */
+GFileType nautilus_file_info_get_file_type (NautilusFileInfo *file_info);
+/**
+ * nautilus_file_info_get_location:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: (transfer full): a #GFile for the location of @file_info
+ */
+GFile *nautilus_file_info_get_location (NautilusFileInfo *file_info);
+/**
+ * nautilus_file_info_get_name:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: the file name of @file_info
+ */
+char *nautilus_file_info_get_name (NautilusFileInfo *file_info);
+/**
+ * nautilus_file_info_get_uri:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: the file URI of @file_info
+ */
+char *nautilus_file_info_get_uri (NautilusFileInfo *file_info);
+/**
+ * nautilus_file_info_get_activation_uri:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: the activation URI of @file_info, which may differ from the actual
+ * URI if e.g. the file is a .desktop file or a Nautilus XML link file
+ */
+char *nautilus_file_info_get_activation_uri (NautilusFileInfo *file_info);
+/**
+ * nautilus_file_info_get_parent_location:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: (allow-none) (transfer full): a #GFile for the parent location of @file_info,
+ * or %NULL if @file_info has no parent
+ */
+GFile *nautilus_file_info_get_parent_location (NautilusFileInfo *file_info);
+/**
+ * nautilus_file_info_get_parent_uri:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: the URI for the parent location of @file_info, or the empty string
+ * if it has none
+ */
+char *nautilus_file_info_get_parent_uri (NautilusFileInfo *file_info);
+/**
+ * nautilus_file_info_get_mount:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: (nullable) (transfer full): a #GMount for the mount of @file_info,
+ * or %NULL if @file_info has no mount
+ */
+GMount *nautilus_file_info_get_mount (NautilusFileInfo *file_info);
+/**
+ * nautilus_file_info_get_uri_scheme:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: the URI scheme of @file_info
+ */
+char *nautilus_file_info_get_uri_scheme (NautilusFileInfo *file_info);
+/**
+ * nautilus_file_info_get_parent_info:
+ * @file_info: a #NautilusFileInfo
+ *
+ * It's not safe to call this recursively multiple times, as it works
+ * only for files already cached by Nautilus.
+ *
+ * Returns: (nullable) (transfer full): a #NautilusFileInfo for the parent of @file_info,
+ * or %NULL if @file_info has no parent.
+ */
+NautilusFileInfo *nautilus_file_info_get_parent_info (NautilusFileInfo *file_info);
+
+/**
+ * nautilus_file_info_get_mime_type:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: (transfer full): the MIME type of @file_info
+ */
+char * nautilus_file_info_get_mime_type (NautilusFileInfo *file_info);
+/**
+ * nautilus_file_info_is_mime_type:
+ * @file_info: a #NautilusFileInfo
+ * @mime_type: a MIME type
+ *
+ * Returns: %TRUE when the MIME type of @file_info matches @mime_type, and
+ * %FALSE otherwise
+ */
+gboolean nautilus_file_info_is_mime_type (NautilusFileInfo *file_info,
+ const char *mime_type);
+/**
+ * nautilus_file_info_is_directory:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: %TRUE when @file_info is a directory, and %FALSE otherwise
+ */
+gboolean nautilus_file_info_is_directory (NautilusFileInfo *file_info);
+/**
+ * nautilus_file_info_can_write:
+ * @file_info: a #NautilusFileInfo
+ *
+ * Returns: %TRUE when @file_info is writeable, and %FALSE otherwise
+ */
+gboolean nautilus_file_info_can_write (NautilusFileInfo *file_info);
+
+
+/* Modifying the NautilusFileInfo */
+/**
+ * nautilus_file_info_add_emblem:
+ * @file_info: a #NautilusFileInfo
+ * @emblem_name: the name of an emblem
+ */
+void nautilus_file_info_add_emblem (NautilusFileInfo *file_info,
+ const char *emblem_name);
+/**
+ * nautilus_file_info_get_string_attribute:
+ * @file_info: a #NautilusFileInfo
+ * @attribute_name: the name of an attribute
+ *
+ * Returns: (nullable): the value for the given @attribute_name, or %NULL if
+ * there is none
+ */
+char *nautilus_file_info_get_string_attribute (NautilusFileInfo *file_info,
+ const char *attribute_name);
+/**
+ * nautilus_file_info_add_string_attribute:
+ * @file_info: a #NautilusFileInfo
+ * @attribute_name: the name of an attribute
+ * @value: the name of an attribute
+ */
+void nautilus_file_info_add_string_attribute (NautilusFileInfo *file_info,
+ const char *attribute_name,
+ const char *value);
+
+/* Invalidating file info */
+/**
+ * nautilus_file_info_invalidate_extension_info:
+ * @file_info: a #NautilusFileInfo
+ */
+void nautilus_file_info_invalidate_extension_info (NautilusFileInfo *file_info);
+
+/**
+ * nautilus_file_info_lookup:
+ * @location: the location for which to look up a corresponding #NautilusFileInfo object
+ *
+ * Returns: (nullable) (transfer full): a #NautilusFileInfo
+ */
+NautilusFileInfo *nautilus_file_info_lookup (GFile *location);
+/**
+ * nautilus_file_info_create:
+ * @location: the location to create the file info for
+ *
+ * Returns: (transfer full): a #NautilusFileInfo
+ */
+NautilusFileInfo *nautilus_file_info_create (GFile *location);
+/**
+ * nautilus_file_info_lookup_for_uri:
+ * @uri: the URI to lookup the file info for
+ *
+ * Returns: (nullable) (transfer full): a #NautilusFileInfo
+ */
+NautilusFileInfo *nautilus_file_info_lookup_for_uri (const char *uri);
+/**
+ * nautilus_file_info_create_for_uri:
+ * @uri: the URI to lookup the file info for
+ *
+ * Returns: (transfer full): a #NautilusFileInfo
+ */
+NautilusFileInfo *nautilus_file_info_create_for_uri (const char *uri);
+
+G_END_DECLS
diff --git a/libnautilus-extension/nautilus-info-provider.c b/libnautilus-extension/nautilus-info-provider.c
new file mode 100644
index 0000000..5fce655
--- /dev/null
+++ b/libnautilus-extension/nautilus-info-provider.c
@@ -0,0 +1,98 @@
+/*
+ * nautilus-info-provider.c - Interface for Nautilus extensions that
+ * provide info about files.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Dave Camp <dave@ximian.com>
+ *
+ */
+
+#include "nautilus-info-provider.h"
+
+#include "nautilus-extension-enum-types.h"
+
+G_DEFINE_INTERFACE (NautilusInfoProvider, nautilus_info_provider, G_TYPE_OBJECT)
+
+static void
+nautilus_info_provider_default_init (NautilusInfoProviderInterface *klass)
+{
+}
+
+NautilusOperationResult
+nautilus_info_provider_update_file_info (NautilusInfoProvider *self,
+ NautilusFileInfo *file,
+ GClosure *update_complete,
+ NautilusOperationHandle **handle)
+{
+ NautilusInfoProviderInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_INFO_PROVIDER (self),
+ NAUTILUS_OPERATION_FAILED);
+ g_return_val_if_fail (update_complete != NULL,
+ NAUTILUS_OPERATION_FAILED);
+ g_return_val_if_fail (handle != NULL, NAUTILUS_OPERATION_FAILED);
+
+ iface = NAUTILUS_INFO_PROVIDER_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->update_file_info != NULL,
+ NAUTILUS_OPERATION_FAILED);
+
+ return iface->update_file_info (self, file, update_complete, handle);
+}
+
+void
+nautilus_info_provider_cancel_update (NautilusInfoProvider *self,
+ NautilusOperationHandle *handle)
+{
+ NautilusInfoProviderInterface *iface;
+
+ g_return_if_fail (NAUTILUS_IS_INFO_PROVIDER (self));
+ g_return_if_fail (handle != NULL);
+
+ iface = NAUTILUS_INFO_PROVIDER_GET_IFACE (self);
+
+ g_return_if_fail (iface->cancel_update != NULL);
+
+ iface->cancel_update (self, handle);
+}
+
+void
+nautilus_info_provider_update_complete_invoke (GClosure *update_complete,
+ NautilusInfoProvider *provider,
+ NautilusOperationHandle *handle,
+ NautilusOperationResult result)
+{
+ GValue args[3] = { { 0, } };
+ GValue return_val = { 0, };
+
+ g_return_if_fail (update_complete != NULL);
+ g_return_if_fail (NAUTILUS_IS_INFO_PROVIDER (provider));
+
+ g_value_init (&args[0], NAUTILUS_TYPE_INFO_PROVIDER);
+ g_value_init (&args[1], G_TYPE_POINTER);
+ g_value_init (&args[2], NAUTILUS_TYPE_OPERATION_RESULT);
+
+ g_value_set_object (&args[0], provider);
+ g_value_set_pointer (&args[1], handle);
+ g_value_set_enum (&args[2], result);
+
+ g_closure_invoke (update_complete, &return_val, 3, args, NULL);
+
+ g_value_unset (&args[0]);
+ g_value_unset (&args[1]);
+ g_value_unset (&args[2]);
+}
diff --git a/libnautilus-extension/nautilus-info-provider.h b/libnautilus-extension/nautilus-info-provider.h
new file mode 100644
index 0000000..128a46b
--- /dev/null
+++ b/libnautilus-extension/nautilus-info-provider.h
@@ -0,0 +1,156 @@
+/*
+ * nautilus-info-provider.h - Interface for Nautilus extensions that
+ * provide info about files.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Dave Camp <dave@ximian.com>
+ *
+ */
+
+/* This interface is implemented by Nautilus extensions that want to
+ * provide information about files. Extensions are called when Nautilus
+ * needs information about a file. They are passed a NautilusFileInfo
+ * object which should be filled with relevant information */
+
+#pragma once
+
+#if !defined (NAUTILUS_EXTENSION_H) && !defined (NAUTILUS_COMPILATION)
+#warning "Only <nautilus-extension.h> should be included directly."
+#endif
+
+#include <glib-object.h>
+#include "nautilus-file-info.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_INFO_PROVIDER (nautilus_info_provider_get_type ())
+
+G_DECLARE_INTERFACE (NautilusInfoProvider, nautilus_info_provider,
+ NAUTILUS, INFO_PROVIDER,
+ GObject)
+
+/**
+ * SECTION:nautilus-info-provider
+ * @title: NautilusInfoProvider
+ * @short_description: Interface to provide additional information about files
+ *
+ * #NautilusInfoProvider allows extension to provide additional information about
+ * files. When nautilus_info_provider_update_file_info() is called by the application,
+ * extensions will know that it's time to add extra information to the provided
+ * #NautilusFileInfo.
+ */
+
+/**
+ * NautilusOperationHandle:
+ *
+ * Handle for asynchronous interfaces. These are opaque handles that must
+ * be unique within an extension object. These are returned by operations
+ * that return #NAUTILUS_OPERATION_IN_PROGRESS.
+ */
+typedef struct _NautilusOperationHandle NautilusOperationHandle;
+
+/**
+ * NautilusOperationResult:
+ * @NAUTILUS_OPERATION_COMPLETE: the operation succeeded, and the extension
+ * is done with the request.
+ * @NAUTILUS_OPERATION_FAILED: the operation failed.
+ * @NAUTILUS_OPERATION_IN_PROGRESS: the extension has begin an async operation.
+ * When this value is returned, the extension must set the handle parameter
+ * and call the callback closure when the operation is complete.
+ *
+ * Return values for asynchronous operations performed by the extension.
+ * See nautilus_info_provider_update_file_info().
+ */
+typedef enum
+{
+ /* Returned if the call succeeded, and the extension is done
+ * with the request */
+ NAUTILUS_OPERATION_COMPLETE,
+
+ /* Returned if the call failed */
+ NAUTILUS_OPERATION_FAILED,
+
+ /* Returned if the extension has begun an async operation.
+ * If this is returned, the extension must set the handle
+ * parameter and call the callback closure when the
+ * operation is complete. */
+ NAUTILUS_OPERATION_IN_PROGRESS
+} NautilusOperationResult;
+
+/**
+ * NautilusInfoProviderInterface:
+ * @g_iface: The parent interface.
+ * @update_file_info: Returns a #NautilusOperationResult.
+ * See nautilus_info_provider_update_file_info() for details.
+ * @cancel_update: Cancels a previous call to nautilus_info_provider_update_file_info().
+ * See nautilus_info_provider_cancel_update() for details.
+ *
+ * Interface for extensions to provide additional information about files.
+ */
+struct _NautilusInfoProviderInterface
+{
+ GTypeInterface g_iface;
+
+ NautilusOperationResult (*update_file_info) (NautilusInfoProvider *provider,
+ NautilusFileInfo *file,
+ GClosure *update_complete,
+ NautilusOperationHandle **handle);
+ void (*cancel_update) (NautilusInfoProvider *provider,
+ NautilusOperationHandle *handle);
+};
+
+/* Interface Functions */
+/**
+ * nautilus_info_provider_update_file_info:
+ * @provider: a #NautilusInfoProvider
+ * @file: a #NautilusFileInfo
+ * @update_complete: the closure to invoke at some later time when returning
+ * @NAUTILUS_OPERATION_IN_PROGRESS.
+ * @handle: (transfer none) (nullable) (out): an opaque #NautilusOperationHandle
+ * that must be set when returning @NAUTILUS_OPERATION_IN_PROGRESS.
+ *
+ * Returns: A #NautilusOperationResult.
+ */
+NautilusOperationResult nautilus_info_provider_update_file_info (NautilusInfoProvider *provider,
+ NautilusFileInfo *file,
+ GClosure *update_complete,
+ NautilusOperationHandle **handle);
+/**
+ * nautilus_info_provider_cancel_update:
+ * @provider: a #NautilusInfoProvider
+ * @handle: the opaque #NautilusOperationHandle returned from a previous call to
+ * nautilus_info_provider_update_file_info().
+ */
+void nautilus_info_provider_cancel_update (NautilusInfoProvider *provider,
+ NautilusOperationHandle *handle);
+
+
+
+/* Helper functions for implementations */
+/**
+ * nautilus_info_provider_update_complete_invoke:
+ * @update_complete: a #GClosure
+ * @provider: a #NautilusInfoProvider
+ * @handle: an opaque #NautilusOperationHandle
+ * @result: a #NautilusOperationResult
+ */
+void nautilus_info_provider_update_complete_invoke (GClosure *update_complete,
+ NautilusInfoProvider *provider,
+ NautilusOperationHandle *handle,
+ NautilusOperationResult result);
+
+G_END_DECLS
diff --git a/libnautilus-extension/nautilus-menu-item.c b/libnautilus-extension/nautilus-menu-item.c
new file mode 100644
index 0000000..50cf7fd
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu-item.c
@@ -0,0 +1,348 @@
+/*
+ * nautilus-menu-item.c - Menu items exported by NautilusMenuProvider
+ * objects.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Dave Camp <dave@ximian.com>
+ *
+ */
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+#include "nautilus-menu.h"
+
+typedef struct
+{
+ char *name;
+ char *label;
+ char *tip;
+ char *icon;
+ NautilusMenu *menu;
+ gboolean sensitive;
+ gboolean priority;
+} NautilusMenuItemPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (NautilusMenuItem, nautilus_menu_item, G_TYPE_OBJECT)
+
+enum
+{
+ ACTIVATE,
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_NAME,
+ PROP_LABEL,
+ PROP_TIP,
+ PROP_ICON,
+ PROP_SENSITIVE,
+ PROP_PRIORITY,
+ PROP_MENU,
+ LAST_PROP
+};
+
+static guint signals[LAST_SIGNAL];
+
+NautilusMenuItem *
+nautilus_menu_item_new (const char *name,
+ const char *label,
+ const char *tip,
+ const char *icon)
+{
+ NautilusMenuItem *item;
+
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (label != NULL, NULL);
+
+ item = g_object_new (NAUTILUS_TYPE_MENU_ITEM,
+ "name", name,
+ "label", label,
+ "tip", tip,
+ "icon", icon,
+ NULL);
+
+ return item;
+}
+
+void
+nautilus_menu_item_activate (NautilusMenuItem *self)
+{
+ g_return_if_fail (NAUTILUS_IS_MENU_ITEM (self));
+
+ g_signal_emit (self, signals[ACTIVATE], 0);
+}
+
+void
+nautilus_menu_item_set_submenu (NautilusMenuItem *self,
+ NautilusMenu *menu)
+{
+ g_return_if_fail (NAUTILUS_IS_MENU_ITEM (self));
+
+ g_object_set (self, "menu", menu, NULL);
+}
+
+static void
+nautilus_menu_item_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusMenuItem *item;
+ NautilusMenuItemPrivate *priv;
+
+ item = NAUTILUS_MENU_ITEM (object);
+ priv = nautilus_menu_item_get_instance_private (item);
+
+ switch (param_id)
+ {
+ case PROP_NAME:
+ {
+ g_value_set_string (value, priv->name);
+ }
+ break;
+
+ case PROP_LABEL:
+ {
+ g_value_set_string (value, priv->label);
+ }
+ break;
+
+ case PROP_TIP:
+ {
+ g_value_set_string (value, priv->tip);
+ }
+ break;
+
+ case PROP_ICON:
+ {
+ g_value_set_string (value, priv->icon);
+ }
+ break;
+
+ case PROP_SENSITIVE:
+ {
+ g_value_set_boolean (value, priv->sensitive);
+ }
+ break;
+
+ case PROP_PRIORITY:
+ {
+ g_value_set_boolean (value, priv->priority);
+ }
+ break;
+
+ case PROP_MENU:
+ {
+ g_value_set_object (value, priv->menu);
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ }
+ break;
+ }
+}
+
+static void
+nautilus_menu_item_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusMenuItem *item;
+ NautilusMenuItemPrivate *priv;
+
+ item = NAUTILUS_MENU_ITEM (object);
+ priv = nautilus_menu_item_get_instance_private (item);
+
+ switch (param_id)
+ {
+ case PROP_NAME:
+ {
+ g_free (priv->name);
+ priv->name = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "name");
+ }
+ break;
+
+ case PROP_LABEL:
+ {
+ g_free (priv->label);
+ priv->label = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "label");
+ }
+ break;
+
+ case PROP_TIP:
+ {
+ g_free (priv->tip);
+ priv->tip = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "tip");
+ }
+ break;
+
+ case PROP_ICON:
+ {
+ g_free (priv->icon);
+ priv->icon = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "icon");
+ }
+ break;
+
+ case PROP_SENSITIVE:
+ {
+ priv->sensitive = g_value_get_boolean (value);
+ g_object_notify (object, "sensitive");
+ }
+ break;
+
+ case PROP_PRIORITY:
+ {
+ priv->priority = g_value_get_boolean (value);
+ g_object_notify (object, "priority");
+ }
+ break;
+
+ case PROP_MENU:
+ {
+ if (priv->menu)
+ {
+ g_object_unref (priv->menu);
+ }
+ priv->menu = g_object_ref (g_value_get_object (value));
+ g_object_notify (object, "menu");
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ }
+ break;
+ }
+}
+
+static void
+nautilus_menu_item_finalize (GObject *object)
+{
+ NautilusMenuItem *item;
+ NautilusMenuItemPrivate *priv;
+
+ item = NAUTILUS_MENU_ITEM (object);
+ priv = nautilus_menu_item_get_instance_private (item);
+
+ g_free (priv->name);
+ g_free (priv->label);
+ g_free (priv->tip);
+ g_free (priv->icon);
+ if (priv->menu)
+ {
+ g_object_unref (priv->menu);
+ }
+
+ G_OBJECT_CLASS (nautilus_menu_item_parent_class)->finalize (object);
+}
+
+static void
+nautilus_menu_item_init (NautilusMenuItem *self)
+{
+ NautilusMenuItemPrivate *priv;
+
+ priv = nautilus_menu_item_get_instance_private (self);
+
+ priv->sensitive = TRUE;
+ priv->menu = NULL;
+}
+
+static void
+nautilus_menu_item_class_init (NautilusMenuItemClass *class)
+{
+ G_OBJECT_CLASS (class)->finalize = nautilus_menu_item_finalize;
+ G_OBJECT_CLASS (class)->get_property = nautilus_menu_item_get_property;
+ G_OBJECT_CLASS (class)->set_property = nautilus_menu_item_set_property;
+
+ /**
+ * NautilusMenuItem::activate:
+ * @item: the object which received the signal
+ *
+ * Signals that the user has activated this menu item.
+ */
+ signals[ACTIVATE] =
+ g_signal_new ("activate",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusMenuItemClass,
+ activate),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Name",
+ "Name of the item",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_LABEL,
+ g_param_spec_string ("label",
+ "Label",
+ "Label to display to the user",
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_TIP,
+ g_param_spec_string ("tip",
+ "Tip",
+ "Tooltip for the menu item",
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_ICON,
+ g_param_spec_string ("icon",
+ "Icon",
+ "Name of the icon to display in the menu item",
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_SENSITIVE,
+ g_param_spec_boolean ("sensitive",
+ "Sensitive",
+ "Whether the menu item is sensitive",
+ TRUE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_PRIORITY,
+ g_param_spec_boolean ("priority",
+ "Priority",
+ "Show priority text in toolbars",
+ TRUE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_MENU,
+ g_param_spec_object ("menu",
+ "Menu",
+ "The menu belonging to this item. May be null.",
+ NAUTILUS_TYPE_MENU,
+ G_PARAM_READWRITE));
+}
diff --git a/libnautilus-extension/nautilus-menu-provider.c b/libnautilus-extension/nautilus-menu-provider.c
new file mode 100644
index 0000000..a5c4682
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu-provider.c
@@ -0,0 +1,94 @@
+/*
+ * nautilus-property-page-provider.c - Interface for Nautilus extensions
+ * that provide context menu items
+ * for files.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Dave Camp <dave@ximian.com>
+ *
+ */
+
+#include <config.h>
+#include "nautilus-menu-provider.h"
+
+G_DEFINE_INTERFACE (NautilusMenuProvider, nautilus_menu_provider, G_TYPE_OBJECT)
+
+enum
+{
+ ITEMS_UPDATED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
+static void
+nautilus_menu_provider_default_init (NautilusMenuProviderInterface *klass)
+{
+ /* This signal should be emited each time the extension modify the list of menu items */
+ signals[ITEMS_UPDATED] = g_signal_new ("items-updated",
+ NAUTILUS_TYPE_MENU_PROVIDER,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+GList *
+nautilus_menu_provider_get_file_items (NautilusMenuProvider *provider,
+ GList *files)
+{
+ NautilusMenuProviderInterface *iface;
+
+ iface = NAUTILUS_MENU_PROVIDER_GET_IFACE (provider);
+
+ g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider), NULL);
+
+ if (iface->get_file_items != NULL)
+ {
+ return iface->get_file_items (provider, files);
+ }
+
+ return NULL;
+}
+
+GList *
+nautilus_menu_provider_get_background_items (NautilusMenuProvider *provider,
+ NautilusFileInfo *current_folder)
+{
+ NautilusMenuProviderInterface *iface;
+
+ iface = NAUTILUS_MENU_PROVIDER_GET_IFACE (provider);
+
+ g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider), NULL);
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (current_folder), NULL);
+
+ if (iface->get_background_items != NULL)
+ {
+ return iface->get_background_items (provider, current_folder);
+ }
+
+ return NULL;
+}
+
+void
+nautilus_menu_provider_emit_items_updated_signal (NautilusMenuProvider *provider)
+{
+ g_return_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider));
+
+ g_signal_emit (provider, signals[ITEMS_UPDATED], 0);
+}
diff --git a/libnautilus-extension/nautilus-menu-provider.h b/libnautilus-extension/nautilus-menu-provider.h
new file mode 100644
index 0000000..7939f14
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu-provider.h
@@ -0,0 +1,102 @@
+/*
+ * nautilus-menu-provider.h - Interface for Nautilus extensions that
+ * provide context menu items.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Dave Camp <dave@ximian.com>
+ *
+ */
+
+/* This interface is implemented by Nautilus extensions that want to
+ * add context menu entries to files. Extensions are called when
+ * Nautilus constructs the context menu for a file. They are passed a
+ * list of NautilusFileInfo objects which holds the current selection */
+
+#pragma once
+
+#if !defined (NAUTILUS_EXTENSION_H) && !defined (NAUTILUS_COMPILATION)
+#warning "Only <nautilus-extension.h> should be included directly."
+#endif
+
+#include <glib-object.h>
+#include "nautilus-file-info.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_MENU_PROVIDER (nautilus_menu_provider_get_type ())
+
+G_DECLARE_INTERFACE (NautilusMenuProvider, nautilus_menu_provider,
+ NAUTILUS, MENU_PROVIDER,
+ GObject)
+
+/**
+ * SECTION:nautilus-menu-provider
+ * @title: NautilusMenuProvider
+ * @short_description: Interface to provide additional menu items
+ *
+ * #NautilusMenuProvider allows extension to provide additional menu items
+ * in the file manager menus.
+ */
+
+/**
+ * NautilusMenuProviderInterface:
+ * @g_iface: The parent interface.
+ * @get_file_items: Returns a #GList of #NautilusMenuItem.
+ * See nautilus_menu_provider_get_file_items() for details.
+ * @get_background_items: Returns a #GList of #NautilusMenuItem.
+ * See nautilus_menu_provider_get_background_items() for details.
+ *
+ * Interface for extensions to provide additional menu items.
+ */
+struct _NautilusMenuProviderInterface
+{
+ GTypeInterface g_iface;
+
+ GList *(*get_file_items) (NautilusMenuProvider *provider,
+ GList *files);
+ GList *(*get_background_items) (NautilusMenuProvider *provider,
+ NautilusFileInfo *current_folder);
+};
+
+/**
+ * nautilus_menu_provider_get_file_items:
+ * @provider: a #NautilusMenuProvider
+ * @files: (element-type NautilusFileInfo): a list of #NautilusFileInfo
+ *
+ * Returns: (nullable) (element-type NautilusMenuItem) (transfer full): the provided list of #NautilusMenuItem.
+ */
+GList *nautilus_menu_provider_get_file_items (NautilusMenuProvider *provider,
+ GList *files);
+/**
+ * nautilus_menu_provider_get_background_items:
+ * @provider: a #NautilusMenuProvider
+ * @current_folder: the folder for which background items are requested
+ *
+ * Returns: (nullable) (element-type NautilusMenuItem) (transfer full): the provided list of #NautilusMenuItem.
+ */
+GList *nautilus_menu_provider_get_background_items (NautilusMenuProvider *provider,
+ NautilusFileInfo *current_folder);
+
+/**
+ * nautilus_menu_provider_emit_items_updated_signal:
+ * @provider: a #NautilusMenuProvider
+ *
+ * Emits #NautilusMenuProvider::items-updated.
+ */
+void nautilus_menu_provider_emit_items_updated_signal (NautilusMenuProvider *provider);
+
+G_END_DECLS
diff --git a/libnautilus-extension/nautilus-menu.c b/libnautilus-extension/nautilus-menu.c
new file mode 100644
index 0000000..34eab8f
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu.c
@@ -0,0 +1,98 @@
+/*
+ * nautilus-menu.h - Menus exported by NautilusMenuProvider objects.
+ *
+ * Copyright (C) 2005 Raffaele Sandrini
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Raffaele Sandrini <rasa@gmx.ch>
+ *
+ */
+
+#include <config.h>
+#include "nautilus-menu.h"
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+
+struct _NautilusMenu
+{
+ GObject parent_instance;
+
+ GList *item_list;
+};
+
+G_DEFINE_TYPE (NautilusMenu, nautilus_menu, G_TYPE_OBJECT);
+
+void
+nautilus_menu_append_item (NautilusMenu *self,
+ NautilusMenuItem *menu_item)
+{
+ g_return_if_fail (NAUTILUS_IS_MENU (self));
+ g_return_if_fail (NAUTILUS_IS_MENU_ITEM (menu_item));
+
+ self->item_list = g_list_append (self->item_list, g_object_ref (menu_item));
+}
+
+GList *
+nautilus_menu_get_items (NautilusMenu *self)
+{
+ GList *item_list;
+
+ g_return_val_if_fail (NAUTILUS_IS_MENU (self), NULL);
+
+ item_list = g_list_copy (self->item_list);
+ g_list_foreach (item_list, (GFunc) g_object_ref, NULL);
+
+ return item_list;
+}
+
+void
+nautilus_menu_item_list_free (GList *item_list)
+{
+ g_return_if_fail (item_list != NULL);
+
+ g_list_foreach (item_list, (GFunc) g_object_unref, NULL);
+ g_list_free (item_list);
+}
+
+static void
+nautilus_menu_finalize (GObject *object)
+{
+ NautilusMenu *menu = NAUTILUS_MENU (object);
+
+ g_clear_pointer (&menu->item_list, g_list_free);
+
+ G_OBJECT_CLASS (nautilus_menu_parent_class)->finalize (object);
+}
+
+static void
+nautilus_menu_init (NautilusMenu *self)
+{
+ self->item_list = NULL;
+}
+
+static void
+nautilus_menu_class_init (NautilusMenuClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = nautilus_menu_finalize;
+}
+
+NautilusMenu *
+nautilus_menu_new (void)
+{
+ return g_object_new (NAUTILUS_TYPE_MENU, NULL);
+}
diff --git a/libnautilus-extension/nautilus-menu.h b/libnautilus-extension/nautilus-menu.h
new file mode 100644
index 0000000..c483716
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu.h
@@ -0,0 +1,143 @@
+/*
+ * nautilus-menu.h - Menus exported by NautilusMenuProvider objects.
+ *
+ * Copyright (C) 2005 Raffaele Sandrini
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Dave Camp <dave@ximian.com>
+ * Raffaele Sandrini <rasa@gmx.ch>
+ *
+ */
+
+#pragma once
+
+#if !defined (NAUTILUS_EXTENSION_H) && !defined (NAUTILUS_COMPILATION)
+#warning "Only <nautilus-extension.h> should be included directly."
+#endif
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_MENU (nautilus_menu_get_type ())
+#define NAUTILUS_TYPE_MENU_ITEM (nautilus_menu_item_get_type ())
+
+G_DECLARE_FINAL_TYPE (NautilusMenu, nautilus_menu,
+ NAUTILUS, MENU,
+ GObject)
+G_DECLARE_DERIVABLE_TYPE (NautilusMenuItem, nautilus_menu_item,
+ NAUTILUS, MENU_ITEM,
+ GObject)
+
+/**
+ * SECTION:nautilus-menu
+ * @title: NautilusMenu
+ * @short_description: Menu descriptor object
+ *
+ * #NautilusMenu is an object that describes a submenu in a file manager
+ * menu. Extensions can provide #NautilusMenu objects by attaching them to
+ * #NautilusMenuItem objects, using nautilus_menu_item_set_submenu().
+ *
+ * ## Menu Items
+ *
+ * #NautilusMenuItem is an object that describes an item in a file manager
+ * menu. Extensions can provide #NautilusMenuItem objects by registering a
+ * #NautilusMenuProvider and returning them from
+ * nautilus_menu_provider_get_file_items(), or
+ * nautilus_menu_provider_get_background_items(), which will be called by the
+ * main application when creating menus.
+ */
+
+struct _NautilusMenuItemClass
+{
+ GObjectClass parent;
+
+ void (*activate) (NautilusMenuItem *item);
+};
+
+/**
+ * nautilus_menu_new:
+ *
+ * Returns: a new #NautilusMenu.
+ */
+NautilusMenu *nautilus_menu_new (void);
+
+/**
+ * nautilus_menu_append_item:
+ * @menu: a #NautilusMenu
+ * @item: (transfer full): a #NautilusMenuItem to append
+ */
+void nautilus_menu_append_item (NautilusMenu *menu,
+ NautilusMenuItem *item);
+/**
+ * nautilus_menu_get_items:
+ * @menu: a #NautilusMenu
+ *
+ * Returns: (nullable) (element-type NautilusMenuItem) (transfer full): the provided #NautilusMenuItem list
+ */
+GList *nautilus_menu_get_items (NautilusMenu *menu);
+/**
+ * nautilus_menu_item_list_free:
+ * @item_list: (element-type NautilusMenuItem): a list of #NautilusMenuItem
+ *
+ */
+void nautilus_menu_item_list_free (GList *item_list);
+
+/**
+ * nautilus_menu_item_new:
+ * @name: the identifier for the menu item
+ * @label: the user-visible label of the menu item
+ * @tip: (nullable): the tooltip of the menu item
+ * @icon: (nullable): the name of the icon to display in the menu item
+ *
+ * Creates a new menu item that can be added to the toolbar or to a contextual menu.
+ *
+ * Returns: (transfer full): a new #NautilusMenuItem
+ */
+NautilusMenuItem *nautilus_menu_item_new (const char *name,
+ const char *label,
+ const char *tip,
+ const char *icon);
+
+/**
+ * nautilus_menu_item_activate:
+ * @item: pointer to a #NautilusMenuItem
+ *
+ * Emits #NautilusMenuItem::activate.
+ */
+void nautilus_menu_item_activate (NautilusMenuItem *item);
+/**
+ * nautilus_menu_item_set_submenu:
+ * @item: pointer to a #NautilusMenuItem
+ * @menu: (transfer full): pointer to a #NautilusMenu to attach to the button
+ *
+ * Attaches a menu to the given #NautilusMenuItem.
+ */
+void nautilus_menu_item_set_submenu (NautilusMenuItem *item,
+ NautilusMenu *menu);
+
+/* NautilusMenuItem has the following properties:
+ * name (string) - the identifier for the menu item
+ * label (string) - the user-visible label of the menu item
+ * tip (string) - the tooltip of the menu item
+ * icon (string) - the name of the icon to display in the menu item
+ * sensitive (boolean) - whether the menu item is sensitive or not
+ * priority (boolean) - used for toolbar items, whether to show priority
+ * text.
+ * menu (NautilusMenu) - The menu belonging to this item. May be null.
+ */
+
+G_END_DECLS
diff --git a/libnautilus-extension/nautilus-properties-item.c b/libnautilus-extension/nautilus-properties-item.c
new file mode 100644
index 0000000..8731274
--- /dev/null
+++ b/libnautilus-extension/nautilus-properties-item.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2022 António Fernandes <antoniof@gnome.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include <config.h>
+#include "nautilus-properties-item.h"
+
+enum
+{
+ PROP_0,
+ PROP_NAME,
+ PROP_VALUE,
+ LAST_PROP
+};
+
+struct _NautilusPropertiesItem
+{
+ GObject parent_instance;
+
+ char *name;
+ char *value;
+};
+
+G_DEFINE_TYPE (NautilusPropertiesItem, nautilus_properties_item, G_TYPE_OBJECT)
+
+NautilusPropertiesItem *
+nautilus_properties_item_new (const char *name,
+ const char *value)
+{
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+
+ return g_object_new (NAUTILUS_TYPE_PROPERTIES_ITEM,
+ "name", name,
+ "value", value,
+ NULL);
+}
+
+static void
+nautilus_properties_item_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusPropertiesItem *self = NAUTILUS_PROPERTIES_ITEM (object);
+
+ switch (param_id)
+ {
+ case PROP_NAME:
+ {
+ g_value_set_string (value, self->name);
+ }
+ break;
+
+ case PROP_VALUE:
+ {
+ g_value_set_string (value, self->value);
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ }
+ break;
+ }
+}
+
+static void
+nautilus_properties_item_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusPropertiesItem *self = NAUTILUS_PROPERTIES_ITEM (object);
+
+ switch (param_id)
+ {
+ case PROP_NAME:
+ {
+ g_free (self->name);
+ self->name = g_value_dup_string (value);
+ }
+ break;
+
+ case PROP_VALUE:
+ {
+ g_free (self->value);
+ self->value = g_value_dup_string (value);
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ }
+ break;
+ }
+}
+
+static void
+nautilus_properties_item_finalize (GObject *object)
+{
+ NautilusPropertiesItem *self = NAUTILUS_PROPERTIES_ITEM (object);
+
+ g_free (self->name);
+ g_free (self->value);
+
+ G_OBJECT_CLASS (nautilus_properties_item_parent_class)->finalize (object);
+}
+
+static void
+nautilus_properties_item_init (NautilusPropertiesItem *self)
+{
+}
+
+static void
+nautilus_properties_item_class_init (NautilusPropertiesItemClass *class)
+{
+ GParamSpec *pspec;
+
+ G_OBJECT_CLASS (class)->finalize = nautilus_properties_item_finalize;
+ G_OBJECT_CLASS (class)->get_property = nautilus_properties_item_get_property;
+ G_OBJECT_CLASS (class)->set_property = nautilus_properties_item_set_property;
+
+ pspec = g_param_spec_string ("name", "", "",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (G_OBJECT_CLASS (class), PROP_NAME, pspec);
+
+ pspec = g_param_spec_string ("value", "", "",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (G_OBJECT_CLASS (class), PROP_VALUE, pspec);
+}
+
+const char *
+nautilus_properties_item_get_name (NautilusPropertiesItem *self)
+{
+ return self->name;
+}
+
+const char *
+nautilus_properties_item_get_value (NautilusPropertiesItem *self)
+{
+ return self->value;
+}
diff --git a/libnautilus-extension/nautilus-properties-item.h b/libnautilus-extension/nautilus-properties-item.h
new file mode 100644
index 0000000..c55fb91
--- /dev/null
+++ b/libnautilus-extension/nautilus-properties-item.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2022 António Fernandes <antoniof@gnome.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#pragma once
+
+#if !defined (NAUTILUS_EXTENSION_H) && !defined (NAUTILUS_COMPILATION)
+#warning "Only <nautilus-extension.h> should be included directly."
+#endif
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_PROPERTIES_ITEM (nautilus_properties_item_get_type ())
+
+G_DECLARE_FINAL_TYPE (NautilusPropertiesItem,
+ nautilus_properties_item,
+ NAUTILUS, PROPERTIES_ITEM,
+ GObject)
+
+/**
+ * SECTION:nautilus-properties-item
+ * @name: NautilusPropertiesItem
+ * @value: Properties item descriptor object
+ *
+ * #NautilusPropertiesItem is an object that describes a name & value pair in
+ * file properties. Extensions can provide #NautilusPropertiesItem objects in
+ * models provided by #NautilusPropertiesModel.
+ */
+
+/**
+ * nautilus_properties_item_new:
+ * @name: the user-visible name for the properties item.
+ * @value: the user-visible value for the properties item.
+ *
+ * Returns: (transfer full): a new #NautilusPropertiesItem
+ */
+NautilusPropertiesItem *nautilus_properties_item_new (const char *name,
+ const char *value);
+
+/**
+ * nautilus_properties_item_get_name:
+ * @self: the properties item
+ *
+ * Returns: (transfer none): the name of this #NautilusPropertiesItem
+ */
+const char *nautilus_properties_item_get_name (NautilusPropertiesItem *self);
+
+/**
+ * nautilus_properties_item_get_value:
+ * @self: the properties item
+ *
+ * Returns: (transfer none): the value of this #NautilusPropertiesItem
+ */
+const char * nautilus_properties_item_get_value (NautilusPropertiesItem *self);
+
+
+G_END_DECLS
diff --git a/libnautilus-extension/nautilus-properties-model-provider.c b/libnautilus-extension/nautilus-properties-model-provider.c
new file mode 100644
index 0000000..4ade110
--- /dev/null
+++ b/libnautilus-extension/nautilus-properties-model-provider.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2022 The GNOME project contributors
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "nautilus-properties-model-provider.h"
+
+G_DEFINE_INTERFACE (NautilusPropertiesModelProvider, nautilus_properties_model_provider, G_TYPE_OBJECT)
+
+static void
+nautilus_properties_model_provider_default_init (NautilusPropertiesModelProviderInterface *klass)
+{
+}
+
+GList *
+nautilus_properties_model_provider_get_models (NautilusPropertiesModelProvider *self,
+ GList *files)
+{
+ NautilusPropertiesModelProviderInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_PROPERTIES_MODEL_PROVIDER (self), NULL);
+
+ iface = NAUTILUS_PROPERTIES_MODEL_PROVIDER_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_models != NULL, NULL);
+
+ return iface->get_models (self, files);
+}
diff --git a/libnautilus-extension/nautilus-properties-model-provider.h b/libnautilus-extension/nautilus-properties-model-provider.h
new file mode 100644
index 0000000..b4ecda5
--- /dev/null
+++ b/libnautilus-extension/nautilus-properties-model-provider.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2022 The GNOME project contributors
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#pragma once
+
+#if !defined (NAUTILUS_EXTENSION_H) && !defined (NAUTILUS_COMPILATION)
+#warning "Only <nautilus-extension.h> should be included directly."
+#endif
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_PROPERTIES_MODEL_PROVIDER (nautilus_properties_model_provider_get_type ())
+
+G_DECLARE_INTERFACE (NautilusPropertiesModelProvider,
+ nautilus_properties_model_provider,
+ NAUTILUS, PROPERTIES_MODEL_PROVIDER,
+ GObject)
+
+/**
+ * SECTION:nautilus-properties-model-provider
+ * @title: NautilusPropertiesModelProvider
+ * @short_description: Interface to provide additional properties
+ *
+ * #NautilusPropertiesModelProvider allows extension to provide additional
+ * information for the file properties.
+ */
+
+/**
+ * NautilusPropertiesModelProviderInterface:
+ * @g_iface: The parent interface.
+ * @get_models: Returns a #GList of #NautilusPropertiesModel.
+ * See nautilus_properties_model_provider_get_models() for details.
+ *
+ * Interface for extensions to provide additional properties.
+ */
+struct _NautilusPropertiesModelProviderInterface
+{
+ GTypeInterface g_iface;
+
+ GList *(*get_models) (NautilusPropertiesModelProvider *provider,
+ GList *files);
+};
+
+/**
+ * nautilus_properties_model_provider_get_models:
+ * @provider: a #NautilusPropertiesModelProvider
+ * @files: (element-type NautilusFileInfo): a #GList of #NautilusFileInfo
+ *
+ * This function is called by the application when it wants properties models
+ * from the extension.
+ *
+ * This function is called in the main thread before the Properties are shown,
+ * so it should return quickly. The models can be populated and updated
+ * asynchronously.
+ *
+ * Returns: (nullable) (element-type NautilusPropertiesModel) (transfer full): A #GList of allocated #NautilusPropertiesModel models.
+ */
+GList *nautilus_properties_model_provider_get_models (NautilusPropertiesModelProvider *provider,
+ GList *files);
+
+G_END_DECLS
diff --git a/libnautilus-extension/nautilus-properties-model.c b/libnautilus-extension/nautilus-properties-model.c
new file mode 100644
index 0000000..b222ae0
--- /dev/null
+++ b/libnautilus-extension/nautilus-properties-model.c
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2022 The GNOME project contributors
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include <config.h>
+#include "nautilus-properties-model.h"
+#include "nautilus-properties-item.h"
+
+enum
+{
+ PROP_0,
+ PROP_TITLE,
+ PROP_MODEL,
+ LAST_PROP
+};
+
+struct _NautilusPropertiesModel
+{
+ GObject parent_instance;
+
+ char *title;
+ GListModel *model;
+};
+
+G_DEFINE_TYPE (NautilusPropertiesModel, nautilus_properties_model, G_TYPE_OBJECT)
+
+NautilusPropertiesModel *
+nautilus_properties_model_new (const char *title,
+ GListModel *model)
+{
+ g_return_val_if_fail (title != NULL, NULL);
+ g_return_val_if_fail (G_IS_LIST_MODEL (model), NULL);
+ g_return_val_if_fail (g_list_model_get_item_type (model) == NAUTILUS_TYPE_PROPERTIES_ITEM, NULL);
+
+ return g_object_new (NAUTILUS_TYPE_PROPERTIES_MODEL,
+ "title", title,
+ "model", model,
+ NULL);
+}
+
+static void
+nautilus_properties_model_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusPropertiesModel *self = NAUTILUS_PROPERTIES_MODEL (object);
+
+ switch (param_id)
+ {
+ case PROP_TITLE:
+ {
+ g_value_set_string (value, self->title);
+ }
+ break;
+
+ case PROP_MODEL:
+ {
+ g_value_set_object (value, self->model);
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ }
+ break;
+ }
+}
+
+static void
+nautilus_properties_model_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusPropertiesModel *self = NAUTILUS_PROPERTIES_MODEL (object);
+
+ switch (param_id)
+ {
+ case PROP_TITLE:
+ {
+ g_free (self->title);
+ self->title = g_value_dup_string (value);
+ }
+ break;
+
+ case PROP_MODEL:
+ {
+ g_set_object (&self->model, g_value_get_object (value));
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ }
+ break;
+ }
+}
+
+static void
+nautilus_properties_model_dispose (GObject *object)
+{
+ NautilusPropertiesModel *self = NAUTILUS_PROPERTIES_MODEL (object);
+
+ g_clear_object (&self->model);
+
+ G_OBJECT_CLASS (nautilus_properties_model_parent_class)->dispose (object);
+}
+
+static void
+nautilus_properties_model_finalize (GObject *object)
+{
+ NautilusPropertiesModel *self = NAUTILUS_PROPERTIES_MODEL (object);
+
+ g_free (self->title);
+
+ G_OBJECT_CLASS (nautilus_properties_model_parent_class)->finalize (object);
+}
+
+static void
+nautilus_properties_model_init (NautilusPropertiesModel *self)
+{
+}
+
+static void
+nautilus_properties_model_class_init (NautilusPropertiesModelClass *class)
+{
+ GParamSpec *pspec;
+
+ G_OBJECT_CLASS (class)->finalize = nautilus_properties_model_finalize;
+ G_OBJECT_CLASS (class)->dispose = nautilus_properties_model_dispose;
+ G_OBJECT_CLASS (class)->get_property = nautilus_properties_model_get_property;
+ G_OBJECT_CLASS (class)->set_property = nautilus_properties_model_set_property;
+
+ pspec = g_param_spec_string ("title", "", "",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (G_OBJECT_CLASS (class), PROP_TITLE, pspec);
+
+ pspec = g_param_spec_object ("model", "", "",
+ G_TYPE_LIST_MODEL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (G_OBJECT_CLASS (class), PROP_MODEL, pspec);
+}
+
+const char *
+nautilus_properties_model_get_title (NautilusPropertiesModel *self)
+{
+ return self->title;
+}
+
+void
+nautilus_properties_model_set_title (NautilusPropertiesModel *self,
+ const char *title)
+{
+ g_object_set (self, "title", title, NULL);
+}
+
+GListModel *
+nautilus_properties_model_get_model (NautilusPropertiesModel *self)
+{
+ return self->model;
+}
diff --git a/libnautilus-extension/nautilus-properties-model.h b/libnautilus-extension/nautilus-properties-model.h
new file mode 100644
index 0000000..3b60ba9
--- /dev/null
+++ b/libnautilus-extension/nautilus-properties-model.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2022 The GNOME project contributors
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#pragma once
+
+#if !defined (NAUTILUS_EXTENSION_H) && !defined (NAUTILUS_COMPILATION)
+#warning "Only <nautilus-extension.h> should be included directly."
+#endif
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_PROPERTIES_MODEL (nautilus_properties_model_get_type ())
+
+G_DECLARE_FINAL_TYPE (NautilusPropertiesModel,
+ nautilus_properties_model,
+ NAUTILUS, PROPERTIES_MODEL,
+ GObject)
+
+/**
+ * SECTION:nautilus-properties-model
+ * @title: NautilusPropertiesModel
+ * @short_description: Properties set descriptor model
+ *
+ * #NautilusPropertiesModel is an model that describes a set of file properties.
+ * Extensions can provide #NautilusPropertiesModel objects by registering a
+ * #NautilusPropertiesModelProvider and returning them from
+ * nautilus_properties_model_provider_get_models(), which will be called by
+ * the main application when creating file properties.
+ */
+
+/**
+ * nautilus_properties_model_new:
+ * @title: the user-visible name for the set of properties in this model
+ * @model: a #GListModel containing #NautilusPropertyItem objects.
+ *
+ * Returns: (transfer full): a new #NautilusPropertiesModel
+ */
+NautilusPropertiesModel *nautilus_properties_model_new (const char *title,
+ GListModel *model);
+
+/**
+ * nautilus_properties_model_get_title:
+ * @self: the properties model
+ *
+ * Returns: (transfer none): the title of this #NautilusPropertiesModel
+ */
+const char *nautilus_properties_model_get_title (NautilusPropertiesModel *self);
+
+/**
+ * nautilus_properties_model_set_title:
+ * @self: the properties model
+ * @title: the new title of this #NautilusPropertiesModel
+ */
+void nautilus_properties_model_set_title (NautilusPropertiesModel *self,
+ const char *title);
+
+/**
+ * nautilus_properties_model_get_model:
+ * @self: the properties model
+ *
+ * Returns: (transfer none): a #GListModel containing #NautilusPropertiesItem.
+ */
+GListModel * nautilus_properties_model_get_model (NautilusPropertiesModel *self);
+
+
+G_END_DECLS