summaryrefslogtreecommitdiffstats
path: root/libnautilus-extension
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 15:59:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 15:59:36 +0000
commitec52555862913a23417735f9f7f5402f5230da13 (patch)
tree5e43a30d289a3daa69dddfbb060216ff6332f197 /libnautilus-extension
parentInitial commit. (diff)
downloadnautilus-upstream.tar.xz
nautilus-upstream.zip
Adding upstream version 3.38.2.upstream/3.38.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--libnautilus-extension/.gitignore3
-rw-r--r--libnautilus-extension/LICENSE458
-rw-r--r--libnautilus-extension/meson.build125
-rw-r--r--libnautilus-extension/nautilus-column-provider.c45
-rw-r--r--libnautilus-extension/nautilus-column-provider.h84
-rw-r--r--libnautilus-extension/nautilus-column.c285
-rw-r--r--libnautilus-extension/nautilus-column.h76
-rw-r--r--libnautilus-extension/nautilus-extension-private.h31
-rw-r--r--libnautilus-extension/nautilus-extension-types.h33
-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.h255
-rw-r--r--libnautilus-extension/nautilus-info-provider.c98
-rw-r--r--libnautilus-extension/nautilus-info-provider.h137
-rw-r--r--libnautilus-extension/nautilus-location-widget-provider.c48
-rw-r--r--libnautilus-extension/nautilus-location-widget-provider.h91
-rw-r--r--libnautilus-extension/nautilus-menu-item.c349
-rw-r--r--libnautilus-extension/nautilus-menu-item.h30
-rw-r--r--libnautilus-extension/nautilus-menu-provider.c98
-rw-r--r--libnautilus-extension/nautilus-menu-provider.h115
-rw-r--r--libnautilus-extension/nautilus-menu.c98
-rw-r--r--libnautilus-extension/nautilus-menu.h145
-rw-r--r--libnautilus-extension/nautilus-property-page-provider.c48
-rw-r--r--libnautilus-extension/nautilus-property-page-provider.h95
-rw-r--r--libnautilus-extension/nautilus-property-page.c224
-rw-r--r--libnautilus-extension/nautilus-property-page.h73
26 files changed, 3481 insertions, 0 deletions
diff --git a/libnautilus-extension/.gitignore b/libnautilus-extension/.gitignore
new file mode 100644
index 0000000..e5781c4
--- /dev/null
+++ b/libnautilus-extension/.gitignore
@@ -0,0 +1,3 @@
+/*.pc
+/Nautilus-3.0.gir
+/Nautilus-3.0.typelib
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..ad791f6
--- /dev/null
+++ b/libnautilus-extension/meson.build
@@ -0,0 +1,125 @@
+nautilus_extension_version = '1.5.0'
+
+libnautilus_extension_deprecated_headers = [
+ 'nautilus-extension-types.h',
+ 'nautilus-menu-item.h'
+]
+
+libnautilus_extension_headers = [
+ 'nautilus-column-provider.h',
+ 'nautilus-column.h',
+ 'nautilus-file-info.h',
+ 'nautilus-info-provider.h',
+ 'nautilus-location-widget-provider.h',
+ 'nautilus-menu-provider.h',
+ 'nautilus-property-page-provider.h',
+ 'nautilus-property-page.h',
+ 'nautilus-menu.h'
+]
+
+install_headers(
+ 'nautilus-extension.h',
+ subdir: 'nautilus'
+)
+install_headers(
+ libnautilus_extension_headers,
+ libnautilus_extension_deprecated_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-location-widget-provider.c',
+ 'nautilus-menu-item.c',
+ 'nautilus-menu-provider.c',
+ 'nautilus-property-page-provider.c',
+ 'nautilus-property-page.c',
+ 'nautilus-menu.c'
+]
+
+libnautilus_extension_deps = [
+ config_h,
+ glib,
+ gtk
+]
+
+libnautilus_extension = shared_library(
+ 'nautilus-extension', [
+ libnautilus_extension_deprecated_headers,
+ libnautilus_extension_sources,
+ ],
+ c_args: [
+ '-DNAUTILUS_COMPILATION'
+ ],
+ dependencies: libnautilus_extension_deps,
+ include_directories: nautilus_include_dirs,
+ version: nautilus_extension_version,
+ install: true
+)
+
+if get_option('introspection')
+ gnome.generate_gir(
+ libnautilus_extension,
+ export_packages: [
+ 'libnautilus-extension'
+ ],
+ extra_args: [
+ '-DNAUTILUS_COMPILATION'
+ ],
+ sources: libnautilus_extension_sources,
+ nsversion: '3.0',
+ namespace: 'Nautilus',
+ includes: [
+ 'Gtk-3.0',
+ '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',
+ libraries: [
+ libnautilus_extension
+ ],
+ name: 'libnautilus-extension',
+ subdirs: [
+ 'nautilus'
+ ],
+ requires: [
+ 'gio-2.0',
+ 'glib-2.0',
+ 'gtk+-3.0'
+ ],
+ variables: [
+ 'exec_prefix=${prefix}',
+ 'extensiondir=${libdir}/nautilus/extensions-3.0'
+ ],
+ 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..e9d820b
--- /dev/null
+++ b/libnautilus-extension/nautilus-column-provider.h
@@ -0,0 +1,84 @@
+/*
+ * 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>
+/* These should be removed at some point. */
+#include "nautilus-extension-types.h"
+#include "nautilus-column.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)
+
+/* For compatibility reasons, remove this once you start introducing breaking changes. */
+typedef NautilusColumnProviderInterface NautilusColumnProviderIface;
+
+/**
+ * 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: (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..38a7814
--- /dev/null
+++ b/libnautilus-extension/nautilus-column.c
@@ -0,0 +1,285 @@
+/*
+ * 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 <gtk/gtk.h>
+#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;
+ GtkSortType default_sort_order;
+};
+
+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_enum (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_enum (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;
+
+ 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));
+ 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));
+ 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));
+ 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));
+ 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));
+
+ 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));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_DEFAULT_SORT_ORDER,
+ g_param_spec_enum ("default-sort-order",
+ "Default sort order",
+ "Default sort order",
+ GTK_TYPE_SORT_TYPE,
+ GTK_SORT_ASCENDING,
+ G_PARAM_READWRITE));
+}
diff --git a/libnautilus-extension/nautilus-column.h b/libnautilus-extension/nautilus-column.h
new file mode 100644
index 0000000..bf07779
--- /dev/null
+++ b/libnautilus-extension/nautilus-column.h
@@ -0,0 +1,76 @@
+/*
+ * 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>
+/* This should be removed at some point. */
+#include "nautilus-extension-types.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_COLUMN (nautilus_column_get_type())
+
+G_DECLARE_FINAL_TYPE (NautilusColumn, nautilus_column, NAUTILUS, COLUMN, GObject)
+
+/**
+ * SECTION:nautilus-column
+ * @title: NautilusColumn
+ * @short_description: 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
+ * #NautilusColumnProvider and returning them from
+ * nautilus_column_provider_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
+ *
+ * Returns: (transfer full): a new #NautilusColumn
+ */
+NautilusColumn *nautilus_column_new (const char *name,
+ const char *attribute,
+ const char *label,
+ const char *description);
+
+/* NautilusColumn has the following properties:
+ * name (string) - the identifier for the column
+ * attribute (string) - the file attribute to be displayed in the
+ * column
+ * label (string) - the user-visible label for the column
+ * description (string) - a user-visible description of the column
+ * xalign (float) - x-alignment of the column
+ * default-sort-order (GtkSortType) - default sort order of the column
+ */
+
+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-types.h b/libnautilus-extension/nautilus-extension-types.h
new file mode 100644
index 0000000..7f2eab3
--- /dev/null
+++ b/libnautilus-extension/nautilus-extension-types.h
@@ -0,0 +1,33 @@
+/* nautilus-info-provider.h - Type definitions for Nautilus extensions
+ *
+ * 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 "This header is deprecated, include <nautilus-extension.h> instead."
+#endif
+
+#include <nautilus-extension.h>
diff --git a/libnautilus-extension/nautilus-extension.h b/libnautilus-extension/nautilus-extension.h
new file mode 100644
index 0000000..1c3ca5a
--- /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-location-widget-provider.h>
+#include <libnautilus-extension/nautilus-menu.h>
+#include <libnautilus-extension/nautilus-menu-provider.h>
+#include <libnautilus-extension/nautilus-property-page.h>
+#include <libnautilus-extension/nautilus-property-page-provider.h>
+
+/**
+ * SECTION:nautilus-extension
+ * @title: Extension entry points
+ */
+
+/**
+ * nautilus_module_initialize:
+ * @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:
+ *
+ * Called when the extension is being unloaded.
+ */
+void nautilus_module_shutdown (void);
+/**
+ * nautilus_module_list_types:
+ * @types: (out) (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..271f0b8
--- /dev/null
+++ b/libnautilus-extension/nautilus-file-info.h
@@ -0,0 +1,255 @@
+/*
+ * 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)
+
+/* For compatibility reasons; remove this once you start introducing breaking changes.
+ *
+ * I’ve only noticed nautilus-python depending on this, but the context is that
+ * NautilusFileInfo used to be an alias for NautilusFile to make it easier to
+ * implement the interface,
+ */
+typedef struct NautilusFile NautilusFile;
+
+/**
+ * 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 */
+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);
+char *nautilus_file_info_get_name (NautilusFileInfo *file_info);
+char *nautilus_file_info_get_uri (NautilusFileInfo *file_info);
+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);
+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);
+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);
+gboolean nautilus_file_info_is_mime_type (NautilusFileInfo *file_info,
+ const char *mime_type);
+gboolean nautilus_file_info_is_directory (NautilusFileInfo *file_info);
+gboolean nautilus_file_info_can_write (NautilusFileInfo *file_info);
+
+
+/* Modifying the NautilusFileInfo */
+void nautilus_file_info_add_emblem (NautilusFileInfo *file_info,
+ const char *emblem_name);
+char *nautilus_file_info_get_string_attribute (NautilusFileInfo *file_info,
+ const char *attribute_name);
+void nautilus_file_info_add_string_attribute (NautilusFileInfo *file_info,
+ const char *attribute_name,
+ const char *value);
+
+/* Invalidating file info */
+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: (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: (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..285f672
--- /dev/null
+++ b/libnautilus-extension/nautilus-info-provider.h
@@ -0,0 +1,137 @@
+/*
+ * 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"
+/* This should be removed at some point. */
+#include "nautilus-extension-types.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)
+
+/* For compatibility reasons, remove this once you start introducing breaking changes. */
+typedef NautilusInfoProviderInterface NautilusInfoProviderIface;
+
+/**
+ * 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 */
+NautilusOperationResult nautilus_info_provider_update_file_info (NautilusInfoProvider *provider,
+ NautilusFileInfo *file,
+ GClosure *update_complete,
+ NautilusOperationHandle **handle);
+void nautilus_info_provider_cancel_update (NautilusInfoProvider *provider,
+ NautilusOperationHandle *handle);
+
+
+
+/* Helper functions for implementations */
+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-location-widget-provider.c b/libnautilus-extension/nautilus-location-widget-provider.c
new file mode 100644
index 0000000..5290d51
--- /dev/null
+++ b/libnautilus-extension/nautilus-location-widget-provider.c
@@ -0,0 +1,48 @@
+/*
+ * nautilus-location-widget-provider.c - Interface for Nautilus
+ * extensions that provide extra widgets for a location
+ *
+ * Copyright (C) 2005 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>
+ *
+ */
+
+#include "nautilus-location-widget-provider.h"
+
+G_DEFINE_INTERFACE (NautilusLocationWidgetProvider, nautilus_location_widget_provider,
+ G_TYPE_OBJECT)
+
+static void
+nautilus_location_widget_provider_default_init (NautilusLocationWidgetProviderInterface *klass)
+{
+}
+
+GtkWidget *
+nautilus_location_widget_provider_get_widget (NautilusLocationWidgetProvider *self,
+ const char *uri,
+ GtkWidget *window)
+{
+ NautilusLocationWidgetProviderInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_LOCATION_WIDGET_PROVIDER (self), NULL);
+
+ iface = NAUTILUS_LOCATION_WIDGET_PROVIDER_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_widget != NULL, NULL);
+
+ return iface->get_widget (self, uri, window);
+}
diff --git a/libnautilus-extension/nautilus-location-widget-provider.h b/libnautilus-extension/nautilus-location-widget-provider.h
new file mode 100644
index 0000000..f357382
--- /dev/null
+++ b/libnautilus-extension/nautilus-location-widget-provider.h
@@ -0,0 +1,91 @@
+/*
+ * nautilus-info-provider.h - Interface for Nautilus extensions that
+ * provide info about files.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ * Copyright (C) 2005 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: Dave Camp <dave@ximian.com>
+ * Alexander Larsson <alexl@redhat.com>
+ *
+ */
+
+/* This interface is implemented by Nautilus extensions that want to
+ * provide extra location widgets for a particular location.
+ * Extensions are called when Nautilus displays a location.
+ */
+
+#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 <gtk/gtk.h>
+/* This should be removed at some point. */
+#include "nautilus-extension-types.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_LOCATION_WIDGET_PROVIDER (nautilus_location_widget_provider_get_type ())
+
+G_DECLARE_INTERFACE (NautilusLocationWidgetProvider, nautilus_location_widget_provider,
+ NAUTILUS, LOCATION_WIDGET_PROVIDER,
+ GObject)
+
+/* For compatibility reasons, remove this once you start introducing breaking changes. */
+typedef NautilusLocationWidgetProviderInterface NautilusLocationWidgetProviderIface;
+
+/**
+ * SECTION:nautilus-location-widget-provider
+ * @title: NautilusLocationWidgetProvider
+ * @short_description: Interface to provide additional location widgets
+ *
+ * #NautilusLocationWidgetProvider allows extension to provide additional location
+ * widgets in the file manager views.
+ */
+
+/**
+ * NautilusLocationWidgetProviderInterface:
+ * @g_iface: The parent interface.
+ * @get_widget: Returns a #GtkWidget.
+ * See nautilus_location_widget_provider_get_widget() for details.
+ *
+ * Interface for extensions to provide additional location widgets.
+ */
+struct _NautilusLocationWidgetProviderInterface
+{
+ GTypeInterface g_iface;
+
+ GtkWidget *(*get_widget) (NautilusLocationWidgetProvider *provider,
+ const char *uri,
+ GtkWidget *window);
+};
+
+/**
+ * nautilus_location_widget_provider_get_widget:
+ * @provider: a #NautilusLocationWidgetProvider
+ * @uri: the URI of the location
+ * @window: parent #GtkWindow
+ *
+ * Returns: (transfer none): the location widget for @provider at @uri
+ */
+GtkWidget *nautilus_location_widget_provider_get_widget (NautilusLocationWidgetProvider *provider,
+ const char *uri,
+ GtkWidget *window);
+
+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..ead7ee8
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu-item.c
@@ -0,0 +1,349 @@
+/*
+ * 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);
+ g_return_val_if_fail (tip != 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-item.h b/libnautilus-extension/nautilus-menu-item.h
new file mode 100644
index 0000000..bf7b9e6
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu-item.h
@@ -0,0 +1,30 @@
+/*
+ * nautilus-menu-item.h - 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>
+ *
+ */
+
+#pragma once
+
+#if !defined (NAUTILUS_EXTENSION_H) && !defined (NAUTILUS_COMPILATION)
+#warning "Only <nautilus-extension.h> should be included directly."
+#endif
+
+#include "nautilus-menu.h" \ No newline at end of file
diff --git a/libnautilus-extension/nautilus-menu-provider.c b/libnautilus-extension/nautilus-menu-provider.c
new file mode 100644
index 0000000..a6b86a8
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu-provider.c
@@ -0,0 +1,98 @@
+/*
+ * 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,
+ GtkWidget *window,
+ GList *files)
+{
+ 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 (GTK_IS_WIDGET (window), NULL);
+
+ if (iface->get_file_items != NULL)
+ {
+ return iface->get_file_items (provider, window, files);
+ }
+
+ return NULL;
+}
+
+GList *
+nautilus_menu_provider_get_background_items (NautilusMenuProvider *provider,
+ GtkWidget *window,
+ 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 (GTK_IS_WIDGET (window), 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, window, 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..ca64ab2
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu-provider.h
@@ -0,0 +1,115 @@
+/*
+ * 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 <gtk/gtk.h>
+#include "nautilus-file-info.h"
+/* These should be removed at some point. */
+#include "nautilus-extension-types.h"
+#include "nautilus-menu.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)
+
+/* For compatibility reasons, remove this once you start introducing breaking changes. */
+typedef NautilusMenuProviderInterface NautilusMenuProviderIface;
+
+/**
+ * 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,
+ GtkWidget *window,
+ GList *files);
+ GList *(*get_background_items) (NautilusMenuProvider *provider,
+ GtkWidget *window,
+ NautilusFileInfo *current_folder);
+};
+
+/**
+ * nautilus_menu_provider_get_file_items:
+ * @provider: a #NautilusMenuProvider
+ * @window: the parent #GtkWidget window
+ * @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,
+ GtkWidget *window,
+ GList *files);
+/**
+ * nautilus_menu_provider_get_background_items:
+ * @provider: a #NautilusMenuProvider
+ * @window: the parent #GtkWidget window
+ * @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,
+ GtkWidget *window,
+ 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..d699e1c
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu.h
@@ -0,0 +1,145 @@
+/*
+ * 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>
+/* This should be removed at some point. */
+#include "nautilus-extension-types.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: (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: the tooltip of the menu item
+ * @icon: 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-property-page-provider.c b/libnautilus-extension/nautilus-property-page-provider.c
new file mode 100644
index 0000000..45b2daf
--- /dev/null
+++ b/libnautilus-extension/nautilus-property-page-provider.c
@@ -0,0 +1,48 @@
+/*
+ * nautilus-property-page-provider.c - Interface for Nautilus extensions
+ * that provide property pages 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 "nautilus-property-page-provider.h"
+
+G_DEFINE_INTERFACE (NautilusPropertyPageProvider, nautilus_property_page_provider,
+ G_TYPE_OBJECT)
+
+static void
+nautilus_property_page_provider_default_init (NautilusPropertyPageProviderInterface *klass)
+{
+}
+
+GList *
+nautilus_property_page_provider_get_pages (NautilusPropertyPageProvider *self,
+ GList *files)
+{
+ NautilusPropertyPageProviderInterface *iface;
+
+ g_return_val_if_fail (NAUTILUS_IS_PROPERTY_PAGE_PROVIDER (self), NULL);
+
+ iface = NAUTILUS_PROPERTY_PAGE_PROVIDER_GET_IFACE (self);
+
+ g_return_val_if_fail (iface->get_pages != NULL, NULL);
+
+ return iface->get_pages (self, files);
+}
diff --git a/libnautilus-extension/nautilus-property-page-provider.h b/libnautilus-extension/nautilus-property-page-provider.h
new file mode 100644
index 0000000..61bcd8b
--- /dev/null
+++ b/libnautilus-extension/nautilus-property-page-provider.h
@@ -0,0 +1,95 @@
+/*
+ * nautilus-property-page-provider.h - Interface for Nautilus extensions
+ * that provide property pages.
+ *
+ * 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 property page to property dialogs. Extensions are called when
+ * Nautilus needs property pages for a selection. They are passed a
+ * list of NautilusFileInfo objects for which information should
+ * be displayed */
+
+#pragma once
+
+#if !defined (NAUTILUS_EXTENSION_H) && !defined (NAUTILUS_COMPILATION)
+#warning "Only <nautilus-extension.h> should be included directly."
+#endif
+
+#include <glib-object.h>
+/* These should be removed at some point. */
+#include "nautilus-extension-types.h"
+#include "nautilus-file-info.h"
+#include "nautilus-property-page.h"
+
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER (nautilus_property_page_provider_get_type ())
+
+G_DECLARE_INTERFACE (NautilusPropertyPageProvider, nautilus_property_page_provider,
+ NAUTILUS, PROPERTY_PAGE_PROVIDER,
+ GObject)
+
+/* For compatibility reasons, remove this once you start introducing breaking changes. */
+typedef NautilusPropertyPageProviderInterface NautilusPropertyPageProviderIface;
+
+/**
+ * SECTION:nautilus-property-page-provider
+ * @title: NautilusPropertyPageProvider
+ * @short_description: Interface to provide additional property pages
+ *
+ * #NautilusPropertyPageProvider allows extension to provide additional pages
+ * for the file properties dialog.
+ */
+
+/**
+ * NautilusPropertyPageProviderInterface:
+ * @g_iface: The parent interface.
+ * @get_pages: Returns a #GList of #NautilusPropertyPage.
+ * See nautilus_property_page_provider_get_pages() for details.
+ *
+ * Interface for extensions to provide additional property pages.
+ */
+struct _NautilusPropertyPageProviderInterface
+{
+ GTypeInterface g_iface;
+
+ GList *(*get_pages) (NautilusPropertyPageProvider *provider,
+ GList *files);
+};
+
+/**
+ * nautilus_property_page_provider_get_pages:
+ * @provider: a #NautilusPropertyPageProvider
+ * @files: (element-type NautilusFileInfo): a #GList of #NautilusFileInfo
+ *
+ * This function is called by Nautilus when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * Returns: (element-type NautilusPropertyPage) (transfer full): A #GList of allocated #NautilusPropertyPage items.
+ */
+GList *nautilus_property_page_provider_get_pages (NautilusPropertyPageProvider *provider,
+ GList *files);
+
+G_END_DECLS
diff --git a/libnautilus-extension/nautilus-property-page.c b/libnautilus-extension/nautilus-property-page.c
new file mode 100644
index 0000000..dad8e53
--- /dev/null
+++ b/libnautilus-extension/nautilus-property-page.c
@@ -0,0 +1,224 @@
+/*
+ * nautilus-property-page.h - Property pages exported by
+ * NautilusPropertyProvider 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 "nautilus-property-page.h"
+
+#include <glib/gi18n-lib.h>
+
+enum
+{
+ PROP_0,
+ PROP_NAME,
+ PROP_LABEL,
+ PROP_PAGE,
+ LAST_PROP
+};
+
+struct _NautilusPropertyPage
+{
+ GObject parent_instance;
+
+ char *name;
+ GtkWidget *label;
+ GtkWidget *page;
+};
+
+G_DEFINE_TYPE (NautilusPropertyPage, nautilus_property_page, G_TYPE_OBJECT)
+
+NautilusPropertyPage *
+nautilus_property_page_new (const char *name,
+ GtkWidget *label,
+ GtkWidget *page_widget)
+{
+ NautilusPropertyPage *page;
+
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (GTK_IS_WIDGET (label), NULL);
+ g_return_val_if_fail (GTK_IS_WIDGET (page_widget), NULL);
+
+ page = g_object_new (NAUTILUS_TYPE_PROPERTY_PAGE,
+ "name", name,
+ "label", label,
+ "page", page_widget,
+ NULL);
+
+ return page;
+}
+
+static void
+nautilus_property_page_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusPropertyPage *page;
+
+ page = NAUTILUS_PROPERTY_PAGE (object);
+
+ switch (param_id)
+ {
+ case PROP_NAME:
+ {
+ g_value_set_string (value, page->name);
+ }
+ break;
+
+ case PROP_LABEL:
+ {
+ g_value_set_object (value, page->label);
+ }
+ break;
+
+ case PROP_PAGE:
+ {
+ g_value_set_object (value, page->page);
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ }
+ break;
+ }
+}
+
+static void
+nautilus_property_page_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusPropertyPage *page;
+
+ page = NAUTILUS_PROPERTY_PAGE (object);
+
+ switch (param_id)
+ {
+ case PROP_NAME:
+ {
+ g_free (page->name);
+ page->name = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "name");
+ }
+ break;
+
+ case PROP_LABEL:
+ {
+ if (page->label)
+ {
+ g_object_unref (page->label);
+ }
+
+ page->label = g_object_ref (g_value_get_object (value));
+ g_object_notify (object, "label");
+ }
+ break;
+
+ case PROP_PAGE:
+ {
+ if (page->page)
+ {
+ g_object_unref (page->page);
+ }
+
+ page->page = g_object_ref (g_value_get_object (value));
+ g_object_notify (object, "page");
+ }
+ break;
+
+ default:
+ {
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ }
+ break;
+ }
+}
+
+static void
+nautilus_property_page_dispose (GObject *object)
+{
+ NautilusPropertyPage *page;
+
+ page = NAUTILUS_PROPERTY_PAGE (object);
+
+ if (page->label)
+ {
+ g_object_unref (page->label);
+ page->label = NULL;
+ }
+ if (page->page)
+ {
+ g_object_unref (page->page);
+ page->page = NULL;
+ }
+}
+
+static void
+nautilus_property_page_finalize (GObject *object)
+{
+ NautilusPropertyPage *page;
+
+ page = NAUTILUS_PROPERTY_PAGE (object);
+
+ g_free (page->name);
+
+ G_OBJECT_CLASS (nautilus_property_page_parent_class)->finalize (object);
+}
+
+static void
+nautilus_property_page_init (NautilusPropertyPage *page)
+{
+}
+
+static void
+nautilus_property_page_class_init (NautilusPropertyPageClass *class)
+{
+ G_OBJECT_CLASS (class)->finalize = nautilus_property_page_finalize;
+ G_OBJECT_CLASS (class)->dispose = nautilus_property_page_dispose;
+ G_OBJECT_CLASS (class)->get_property = nautilus_property_page_get_property;
+ G_OBJECT_CLASS (class)->set_property = nautilus_property_page_set_property;
+
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Name",
+ "Name of the page",
+ 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_object ("label",
+ "Label",
+ "Label widget to display in the notebook tab",
+ GTK_TYPE_WIDGET,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_PAGE,
+ g_param_spec_object ("page",
+ "Page",
+ "Widget for the property page",
+ GTK_TYPE_WIDGET,
+ G_PARAM_READWRITE));
+}
diff --git a/libnautilus-extension/nautilus-property-page.h b/libnautilus-extension/nautilus-property-page.h
new file mode 100644
index 0000000..1177f79
--- /dev/null
+++ b/libnautilus-extension/nautilus-property-page.h
@@ -0,0 +1,73 @@
+/*
+ * nautilus-property-page.h - Property pages exported by
+ * NautilusPropertyProvider 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>
+#include <gtk/gtk.h>
+/* This should be removed at some point. */
+#include "nautilus-extension-types.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_PROPERTY_PAGE (nautilus_property_page_get_type ())
+
+G_DECLARE_FINAL_TYPE (NautilusPropertyPage, nautilus_property_page,
+ NAUTILUS, PROPERTY_PAGE,
+ GObject)
+
+/**
+ * SECTION:nautilus-property-page
+ * @title: NautilusPropertyPage
+ * @short_description: Property page descriptor object
+ *
+ * #NautilusPropertyPage is an object that describes a page in the file
+ * properties dialog. Extensions can provide #NautilusPropertyPage objects
+ * by registering a #NautilusPropertyPageProvider and returning them from
+ * nautilus_property_page_provider_get_pages(), which will be called by the
+ * main application when creating file properties dialogs.
+ */
+
+/**
+ * nautilus_property_page_new:
+ * @name: the identifier for the property page
+ * @label: the user-visible label of the property page
+ * @page: the property page to display
+ *
+ * Returns: (transfer full): a new #NautilusPropertyPage
+ */
+NautilusPropertyPage *nautilus_property_page_new (const char *name,
+ GtkWidget *label,
+ GtkWidget *page);
+
+/* NautilusPropertyPage has the following properties:
+ * name (string) - the identifier for the property page
+ * label (widget) - the user-visible label of the property page
+ * page (widget) - the property page to display
+ */
+
+G_END_DECLS