[Goodies-commits] r5173 - in thunar-shares-plugin/trunk: . data libshares po thunar-plugin
Daniel Morales
danielm at xfce.org
Tue Jul 29 03:45:18 CEST 2008
Author: danielm
Date: 2008-07-29 01:45:18 +0000 (Tue, 29 Jul 2008)
New Revision: 5173
Added:
thunar-shares-plugin/trunk/AUTHORS
thunar-shares-plugin/trunk/COPYING
thunar-shares-plugin/trunk/ChangeLog
thunar-shares-plugin/trunk/INSTALL
thunar-shares-plugin/trunk/Makefile.am
thunar-shares-plugin/trunk/NEWS
thunar-shares-plugin/trunk/README
thunar-shares-plugin/trunk/TODO
thunar-shares-plugin/trunk/autogen.sh
thunar-shares-plugin/trunk/configure.in.in
thunar-shares-plugin/trunk/data/
thunar-shares-plugin/trunk/data/Makefile.am
thunar-shares-plugin/trunk/data/admin-dialog-editor.xml
thunar-shares-plugin/trunk/data/admin-dialog.xml
thunar-shares-plugin/trunk/data/dialogs.xml
thunar-shares-plugin/trunk/data/thunar-page.xml
thunar-shares-plugin/trunk/libshares/
thunar-shares-plugin/trunk/libshares/Makefile.am
thunar-shares-plugin/trunk/libshares/libshares-paths.c
thunar-shares-plugin/trunk/libshares/libshares-paths.h
thunar-shares-plugin/trunk/libshares/libshares-util.c
thunar-shares-plugin/trunk/libshares/libshares-util.h
thunar-shares-plugin/trunk/libshares/libshares-xml.c
thunar-shares-plugin/trunk/libshares/libshares-xml.h
thunar-shares-plugin/trunk/libshares/shares.c
thunar-shares-plugin/trunk/libshares/shares.h
thunar-shares-plugin/trunk/po/
thunar-shares-plugin/trunk/po/ChangeLog
thunar-shares-plugin/trunk/po/LINGUAS
thunar-shares-plugin/trunk/po/POTFILES.in
thunar-shares-plugin/trunk/po/POTFILES.skip
thunar-shares-plugin/trunk/po/es.po
thunar-shares-plugin/trunk/po/fr.po
thunar-shares-plugin/trunk/po/it.po
thunar-shares-plugin/trunk/po/nb.po
thunar-shares-plugin/trunk/po/ru.po
thunar-shares-plugin/trunk/po/thunar-shares-plugin.pot
thunar-shares-plugin/trunk/thunar-plugin/
thunar-shares-plugin/trunk/thunar-plugin/Makefile.am
thunar-shares-plugin/trunk/thunar-plugin/thunar-shares-plugin.c
thunar-shares-plugin/trunk/thunar-plugin/tsp-admin-editor.c
thunar-shares-plugin/trunk/thunar-plugin/tsp-admin-editor.h
thunar-shares-plugin/trunk/thunar-plugin/tsp-admin.c
thunar-shares-plugin/trunk/thunar-plugin/tsp-admin.h
thunar-shares-plugin/trunk/thunar-plugin/tsp-page-provider.c
thunar-shares-plugin/trunk/thunar-plugin/tsp-page-provider.h
thunar-shares-plugin/trunk/thunar-plugin/tsp-page.c
thunar-shares-plugin/trunk/thunar-plugin/tsp-page.h
thunar-shares-plugin/trunk/thunar-plugin/tsp-prefs-provider.c
thunar-shares-plugin/trunk/thunar-plugin/tsp-prefs-provider.h
Log:
Initial Import. Moving the project to XFce Goodies.
Added: thunar-shares-plugin/trunk/AUTHORS
===================================================================
--- thunar-shares-plugin/trunk/AUTHORS (rev 0)
+++ thunar-shares-plugin/trunk/AUTHORS 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1 @@
+* Daniel Morales <daniel at daniel.com.uy>
Added: thunar-shares-plugin/trunk/COPYING
===================================================================
--- thunar-shares-plugin/trunk/COPYING (rev 0)
+++ thunar-shares-plugin/trunk/COPYING 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 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.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, 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 or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+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 give any other recipients of the Program a copy of this License
+along with the Program.
+
+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 Program or any portion
+of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+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 Program, 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 Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) 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; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, 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 executable. However, as a
+special exception, the source code 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.
+
+If distribution of executable or 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 counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program 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.
+
+ 5. 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 Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program 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 to
+this License.
+
+ 7. 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 Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program 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 Program.
+
+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.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program 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.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the 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 Program
+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 Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, 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
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. 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 PROGRAM 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 PROGRAM (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 PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
Added: thunar-shares-plugin/trunk/ChangeLog
===================================================================
--- thunar-shares-plugin/trunk/ChangeLog (rev 0)
+++ thunar-shares-plugin/trunk/ChangeLog 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,28 @@
+2008-07-28 Daniel Morales <daniel at daniel.com.uy>
+
+ * Project renamed to thunar-shares-plugin.
+ * Use Xfce dev tools instead gnome-common.
+ * Project moved to XFce Goodies.
+
+2008-07-09 Daniel Morales <daniel at daniel.com.uy>
+
+ * === Released 0.1.6 ===
+ * libshares API changes to help the packaging task.
+ * Internationalization Fixes.
+ * Added some translations from launchpad.
+
+2008-06-09 Daniel Morales <daniel at daniel.com.uy>
+
+ * === Released 0.1.3 ===
+ * Shares admin preferences.
+ * Share editor.
+ * Themeable share icon.
+ * Use a gzip tarball instead bz2.
+ * Bugfixes
+
+2008-04-08 Daniel Morales <daniel at daniel.com.uy>
+
+ * === Released 0.1.0 ===
+ * Have fun(and report bugs) :)
+
+# vi:set ts=8 sw=8 noet ai nocindent:
Added: thunar-shares-plugin/trunk/INSTALL
===================================================================
--- thunar-shares-plugin/trunk/INSTALL (rev 0)
+++ thunar-shares-plugin/trunk/INSTALL 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,236 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory. After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script). Here is a another example:
+
+ /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
Added: thunar-shares-plugin/trunk/Makefile.am
===================================================================
--- thunar-shares-plugin/trunk/Makefile.am (rev 0)
+++ thunar-shares-plugin/trunk/Makefile.am 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,22 @@
+
+SUBDIRS = data libshares thunar-plugin po
+
+INTLTOOL = \
+ intltool-extract.in \
+ intltool-merge.in \
+ intltool-update.in
+
+EXTRA_DIST = \
+ ChangeLog \
+ README \
+ AUTHORS \
+ NEWS \
+ $(INTLTOOL)
+
+DISTCLEANFILES = \
+ intltool-extract \
+ intltool-merge \
+ intltool-update \
+ po/POTFILES
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
Added: thunar-shares-plugin/trunk/NEWS
===================================================================
--- thunar-shares-plugin/trunk/NEWS (rev 0)
+++ thunar-shares-plugin/trunk/NEWS 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,28 @@
+NEW in 0.2.0:
+=============
+- New build system (Using XFCE dev tools).
+- Minor tweaks.
+- Project renamed to: thunar-shares-plugin.
+- Moved to XFce Goodies website:
+ http://goodies.xfce.org/projects/thunar-plugins/thunar-shares-plugin
+- More translations.
+
+NEW in 0.1.6:
+=============
+- libshares API changes to help the packaging task.
+- Internationalization Fixes
+- Added some translations.
+
+NEW in 0.1.3:
+=============
+- Shares admin preferences. (list shares to edit, add, and remove)
+- Share editor.
+- Themeable share icon.
+- Better code distribution.
+- Use a gzip tarball instead bz2.
+- Bugfixes
+
+NEW in 0.1.0:
+=============
+- All, First release. Have fun :)
+
Added: thunar-shares-plugin/trunk/README
===================================================================
--- thunar-shares-plugin/trunk/README (rev 0)
+++ thunar-shares-plugin/trunk/README 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,88 @@
+What is it?
+===========
+
+thunar-shares-plugin allows you to quickly share a folder using Samba
+from Thunar (the XFCE file manager) without requiring root access.
+
+
+Required packages
+=================
+
+thunar-shares-plugin depends on the following packages:
+
+ - thunarx - 0.8.0 or above
+ - thunar-vfs - 0.8.0 or above
+ - gtk+-2.0 - 2.12.0 or above
+ - glib-2.0 - 2.10.0 or above
+
+
+Installation
+============
+
+(For information about how to setup Samba correctly see bellow)
+
+If you downloaded a source tarball from the download page, you can run:
+
+ ./configure --prefix=$(pkg-config --variable prefix thunarx-1)
+
+in order to configure the plugin.
+
+If you fetched the source from SVN, you have to use this command:
+
+ ./autogen.sh --prefix=$(pkg-config --variable prefix thunarx-1)
+
+After that you should be able to build and install the plugin, using
+the following commands (remember you have to be root for that!):
+
+ make && make install
+
+For more detailed information, visit the thunar-shares-plugin website
+at http://goodies.xfce.org/projects/thunar-plugins/thunar-shares-plugin.
+
+
+Samba Setup
+===========
+
+If your are using (X)ubuntu 8.04 or above you don't need to do
+all the setup: just add your user to the group 'sambashare' and re-login
+after install the plugin.
+
+For non (X)ubuntu users the Samba setup is:
+
+ 1) Create a group (must be done as root):
+
+ export USERSHARES_DIR="/var/lib/samba/usershares"
+ export USERSHARES_GROUP="sambashare"
+ mkdir -p ${USERSHARES_DIR}
+ groupadd ${USERSHARES_GROUP}
+ chown root:${USERSHARES_GROUP} ${USERSHARES_DIR}
+ chmod 01770 ${USERSHARES_DIR}
+
+ 2) Use the following /etc/samba/smb.conf:
+
+ [global]
+ workgroup = WORKGROUP
+ security = share
+ usershare path = /var/lib/samba/usershares
+ usershare max shares = 100
+ usershare allow guests = yes
+ usershare owner only = yes
+
+ 3) Add the samba group to your user (replace your_username by your login):
+
+ usermod -a -G ${USERSHARES_GROUP} your_username
+
+ 4) Restart Samba daemons
+
+ Ex: /etc/init.d/samba restart
+
+ 5) Logout and login your user (your_username)
+
+
+How to report bugs?
+===================
+
+Bugs should be reported to the Xfce bug tracking system
+(http://bugzilla.xfce.org, product Thunar Plugins, component
+thunar-shares-plugin). You will need to create an
+account for yourself.
Added: thunar-shares-plugin/trunk/TODO
===================================================================
--- thunar-shares-plugin/trunk/TODO (rev 0)
+++ thunar-shares-plugin/trunk/TODO 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,12 @@
+TODO for thunar-shares-plugin
+=======================================================================
+
+ * No verbose logging by default (from: libshares/shares.c)!
+
+ * Add emblems to shared folders (Thunar doesn't allow to add/remove
+ emblembs from plugins yet).
+
+ * Maybe some help button at shares-admin dialog.
+
+ * We need to review the permissions hierarchy check:
+ (libshares/libshares-util.c: tsp_check_perms)
Added: thunar-shares-plugin/trunk/autogen.sh
===================================================================
--- thunar-shares-plugin/trunk/autogen.sh (rev 0)
+++ thunar-shares-plugin/trunk/autogen.sh 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Copyright (c) 2002-2006
+# The Thunar development team. All rights reserved.
+#
+# Written for Thunar by Benedikt Meurer <benny at xfce.org>.
+#
+
+(type xdt-autogen) >/dev/null 2>&1 || {
+ cat >&2 <<EOF
+autogen.sh: You don't seem to have the Xfce development tools installed on
+ your system, which are required to build this software.
+ Please install the xfce4-dev-tools package first, it is available
+ from http://www.xfce.org/.
+EOF
+ exit 1
+}
+
+# verify that po/LINGUAS is present
+(test -f po/LINGUAS) >/dev/null 2>&1 || {
+ cat >&2 <<EOF
+autogen.sh: The file po/LINGUAS could not be found. Please check your snapshot
+ or try to checkout again.
+EOF
+ exit 1
+}
+
+# substitute revision and linguas
+linguas=`sed -e '/^#/d' po/LINGUAS`
+revision=`LC_ALL=C svn info $0 | awk '/^Revision: / {printf "%05d\n", $2}'`
+sed -e "s/@LINGUAS@/${linguas}/g" \
+ -e "s/@REVISION@/${revision}/g" \
+ < "configure.in.in" > "configure.in"
+
+exec xdt-autogen $@
+
+# vi:set ts=2 sw=2 et ai:
Added: thunar-shares-plugin/trunk/configure.in.in
===================================================================
--- thunar-shares-plugin/trunk/configure.in.in (rev 0)
+++ thunar-shares-plugin/trunk/configure.in.in 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,77 @@
+dnl
+dnl Copyright (c) 2008
+dnl Daniel Morales <daniel at daniel.com.uy>
+dnl
+
+dnl -------------------------------------------------------
+dnl Version
+dnl -------------------------------------------------------
+m4_define([tsp_version_major], [0])
+m4_define([tsp_version_minor], [2])
+m4_define([tsp_version_micro], [0])
+m4_define([tsp_version_build], [r at REVISION@])
+m4_define([tsp_version_tag], [svn])
+m4_define([tsp_version], [tsp_version_major().tsp_version_minor().tsp_version_micro()ifelse(tsp_version_tag(),[],[], [-ifelse(tsp_version_tag(), [svn], [tsp_version_tag()-tsp_version_build()], [tsp_version_tag()])])])
+
+dnl -------------------------------------------------------
+dnl Debugging support for SVN
+dnl -------------------------------------------------------
+m4_define([tsp_debug_default], [ifelse(tsp_version_tag(), [svn], [full], [minimum])])
+
+dnl -------------------------------------------------------
+dnl Init autoconf
+dnl -------------------------------------------------------
+AC_COPYRIGHT([Copyright (c) 2008 Daniel Morales <daniel at daniel.com.uy>.])
+AC_INIT([thunar-shares-plugin], [tsp_version], [thunar-dev at xfce.org])
+AC_CONFIG_SRCDIR([thunar-plugin/thunar-shares-plugin.c])
+AC_PREREQ(2.59)
+AC_CANONICAL_TARGET()
+
+dnl -------------------------------------------------------
+dnl Init automake
+dnl -------------------------------------------------------
+AM_INIT_AUTOMAKE([1.9])
+AM_CONFIG_HEADER([config.h])
+AM_MAINTAINER_MODE
+
+AC_ISC_POSIX
+AC_HEADER_STDC
+
+dnl -------------------------------------------------------
+dnl Programs
+dnl -------------------------------------------------------
+AC_PROG_CC
+AC_PROG_LD
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+AC_PROG_INTLTOOL([0.31])
+
+dnl -------------------------------------------------------
+dnl Packages checks
+dnl -------------------------------------------------------
+XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.12.0])
+XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.10.0])
+XDT_CHECK_PACKAGE([THUNARX], [thunarx-1], [0.8.0])
+XDT_CHECK_PACKAGE([THUNARVFS], [thunar-vfs-1], [0.8.0])
+
+dnl -------------------------------------------------------
+dnl Languages
+dnl -------------------------------------------------------
+XDT_I18N([@LINGUAS@])
+
+dnl -------------------------------------------------------
+dnl Debugging support
+dnl -------------------------------------------------------
+XDT_FEATURE_DEBUG
+
+AC_OUTPUT([
+ Makefile
+ data/Makefile
+ po/Makefile.in
+ libshares/Makefile
+ thunar-plugin/Makefile
+])
+
+echo
+echo "Prefix: $prefix"
+echo
Added: thunar-shares-plugin/trunk/data/Makefile.am
===================================================================
--- thunar-shares-plugin/trunk/data/Makefile.am (rev 0)
+++ thunar-shares-plugin/trunk/data/Makefile.am 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,11 @@
+
+xmldir = $(datadir)/thunar-shares
+
+xml_DATA = thunar-page.xml \
+ admin-dialog.xml \
+ admin-dialog-editor.xml \
+ dialogs.xml
+
+EXTRA_DIST = $(xml_DATA)
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
Added: thunar-shares-plugin/trunk/data/admin-dialog-editor.xml
===================================================================
--- thunar-shares-plugin/trunk/data/admin-dialog-editor.xml (rev 0)
+++ thunar-shares-plugin/trunk/data/admin-dialog-editor.xml 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,176 @@
+<?xml version="1.0" ?>
+
+<interface>
+ <object class="GtkDialog" id="shares_editor">
+ <property name="border_width">5</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="share_label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Folder:</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="share_hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkFileChooserButton" id="share_folder">
+ <property name="visible">True</property>
+ <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
+ </object>
+ <packing>
+ <property name="padding">7</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Share name:</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">6</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkEntry" id="share_name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="padding">7</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Comments:</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">6</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkEntry" id="share_comments">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="padding">7</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="share_write">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Allow other users to write in this folder</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="padding">5</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="share_guest">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Allow Guest access</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="padding">5</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">3</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <object class="GtkButton" id="button_cancel">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_ok">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">button_cancel</action-widget>
+ <action-widget response="-5">button_ok</action-widget>
+ </action-widgets>
+ </object>
+</interface>
Added: thunar-shares-plugin/trunk/data/admin-dialog.xml
===================================================================
--- thunar-shares-plugin/trunk/data/admin-dialog.xml (rev 0)
+++ thunar-shares-plugin/trunk/data/admin-dialog.xml 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,158 @@
+<?xml version="1.0" ?>
+<interface>
+
+ <object class="GtkListStore" id="shares_model">
+ <columns>
+ <column type="gchararray"/>
+ <column type="gchararray"/>
+ <column type="gchararray"/>
+ </columns>
+ </object>
+
+ <object class="GtkDialog" id="shares_admin">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Thunar - Manage Shared Folders</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="default_width">500</property>
+ <property name="default_height">280</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkScrolledWindow" id="share_scroll">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <child>
+ <object class="GtkTreeView" id="share_list">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="headers_visible">False</property>
+ <property name="enable_search">False</property>
+ <property name="model">shares_model</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="icon_column">
+ <property name="title">Icon</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="icon_column_renderer">
+ <property name="stock-size">5</property>
+ <property name="xpad">2</property>
+ <property name="ypad">2</property>
+ </object>
+ <attributes>
+ <attribute name="icon-name">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="text_column">
+ <property name="title">Title</property>
+ <child>
+ <object class="GtkCellRendererText" id="text_column_renderer">
+ <property name="yalign">0</property>
+ <property name="xpad">2</property>
+ <property name="ypad">3</property>
+ </object>
+ <attributes>
+ <attribute name="markup">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkButton" id="share_add">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">True</property>
+ <property name="label">gtk-add</property>
+ <property name="use_stock">True</property>
+
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="share_edit">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">True</property>
+ <property name="label">gtk-edit</property>
+ <property name="use_stock">True</property>
+
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="share_remove">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="receives_default">True</property>
+ <property name="label">gtk-remove</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="padding">3</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">1</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <object class="GtkButton" id="share_close">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-1">share_close</action-widget>
+ </action-widgets></object>
+</interface>
Added: thunar-shares-plugin/trunk/data/dialogs.xml
===================================================================
--- thunar-shares-plugin/trunk/data/dialogs.xml (rev 0)
+++ thunar-shares-plugin/trunk/data/dialogs.xml 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,39 @@
+<?xml version="1.0" ?>
+<!--*- mode: xml -*-->
+
+<interface>
+ <object class="GtkMessageDialog" id="permissions_dialog">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Thunar Shares Question</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="urgency_hint">True</property>
+ <property name="deletable">False</property>
+ <property name="message_type">GTK_MESSAGE_QUESTION</property>
+ <property name="buttons">GTK_BUTTONS_OK_CANCEL</property>
+ <property name="text" translatable="yes">Thunar needs to add some permissions to your folder in order to share it. Do you agree?</property>
+ </object>
+
+ <object class="GtkMessageDialog" id="error_dialog">
+ <property name="border_width">5</property>
+ <property name="secondary_use_markup">True</property>
+ <property name="use_markup">True</property>
+ <property name="title" translatable="yes">Thunar Shares Error</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="skip_taskbar_hint">True</property>
+ <property name="skip_pager_hint">True</property>
+ <property name="urgency_hint">True</property>
+ <property name="deletable">False</property>
+ <property name="message_type">GTK_MESSAGE_ERROR</property>
+ <property name="buttons">GTK_BUTTONS_CLOSE</property>
+ <property name="text" translatable="yes">Cannot modify the share:</property>
+ </object>
+
+</interface>
Added: thunar-shares-plugin/trunk/data/thunar-page.xml
===================================================================
--- thunar-shares-plugin/trunk/data/thunar-page.xml (rev 0)
+++ thunar-shares-plugin/trunk/data/thunar-page.xml 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,204 @@
+<?xml version="1.0" ?>
+<!--*- mode: xml -*-->
+
+<interface>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="xpad">13</property>
+ <property name="icon_name">gnome-fs-share</property>
+ <property name="icon_size">6</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Folder Sharing</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="padding">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHSeparator" id="hseparator1">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ <property name="padding">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="cb_share_folder">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Share this folder</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label_name">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="xpad">7</property>
+ <property name="label" translatable="yes">Share Name:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_share_name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="max_length">12</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="cb_share_write">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Allow others users to write in this folder</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="cb_share_guest">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Allow Guest access</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label_comments">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="xpad">7</property>
+ <property name="label" translatable="yes">Comments:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_share_comments">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkButton" id="button_apply">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label">gtk-apply</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">7</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_status">
+ <property name="visible">True</property>
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="xpad">7</property>
+ <property name="label"></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">8</property>
+ </packing>
+ </child>
+ </object>
+</interface>
Added: thunar-shares-plugin/trunk/libshares/Makefile.am
===================================================================
--- thunar-shares-plugin/trunk/libshares/Makefile.am (rev 0)
+++ thunar-shares-plugin/trunk/libshares/Makefile.am 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,33 @@
+
+INCLUDES = \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ -DG_LOG_DOMAIN=\"thunar-shares-plugin-lib\" \
+ -DLOCALEDIR=\"$(localedir)\" \
+ -DDATADIR=\"$(datadir)\" \
+ $(PLATFORM_CPPFLAGS)
+
+noinst_LTLIBRARIES = libshares.la
+
+libshares_la_SOURCES = \
+ shares.c shares.h \
+ libshares-xml.c libshares-xml.h \
+ libshares-util.c libshares-util.h \
+ libshares-paths.c libshares-paths.h
+
+libshares_la_CFLAGS = \
+ $(PLATFORM_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(THUNARX_CFLAGS) \
+ $(THUNARVFS_CFLAGS) \
+ $(WARN_CFLAGS)
+
+libshares_la_LDFLAGS = \
+ $(GTK_LIBS) \
+ $(GLIB_LIBS) \
+ $(THUNARX_LIBS) \
+ $(THUNARVFS_LIBS) \
+ $(PLATFORM_LDFLAGS)
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
Added: thunar-shares-plugin/trunk/libshares/libshares-paths.c
===================================================================
--- thunar-shares-plugin/trunk/libshares/libshares-paths.c (rev 0)
+++ thunar-shares-plugin/trunk/libshares/libshares-paths.c 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,49 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2006-2007 Imendio AB
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Richard Hult <richard at imendio.com>
+ * Brian Pepple <bpepple at fedoraproject.org>
+ * Daniel Morales <daniel at daniel.com.uy>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "libshares-paths.h"
+
+#define THUNARSHARES "thunar-shares"
+
+gchar *
+tsp_paths_get_xml_path (const gchar *filename)
+{
+ return g_build_filename (DATADIR, THUNARSHARES, filename, NULL);
+}
+
+gchar *
+tsp_paths_get_image_path (const gchar *filename)
+{
+ return g_build_filename (DATADIR, THUNARSHARES, filename, NULL);
+}
+
+gchar *
+tsp_paths_get_locale_path ()
+{
+ return g_strdup (LOCALEDIR);
+}
Added: thunar-shares-plugin/trunk/libshares/libshares-paths.h
===================================================================
--- thunar-shares-plugin/trunk/libshares/libshares-paths.h (rev 0)
+++ thunar-shares-plugin/trunk/libshares/libshares-paths.h 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,34 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2006 Imendio AB
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __LIBSHARES_PATHS_H__
+#define __LIBSHARES_PATHS_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gchar *tsp_paths_get_xml_path (const gchar *filename);
+gchar *tsp_paths_get_image_path (const gchar *filename);
+gchar *tsp_paths_get_locale_path (void);
+
+G_END_DECLS
+
+#endif /* __LIBSHARES_PATHS_H__ */
Added: thunar-shares-plugin/trunk/libshares/libshares-util.c
===================================================================
--- thunar-shares-plugin/trunk/libshares/libshares-util.c (rev 0)
+++ thunar-shares-plugin/trunk/libshares/libshares-util.c 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,237 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+
+#include <thunar-vfs/thunar-vfs.h>
+#include <thunarx/thunarx.h>
+
+#include "libshares-util.h"
+#include "libshares-xml.h"
+#include "shares.h"
+
+#define XML_FILE "dialogs.xml"
+
+static gboolean tsp_ask_perms (gboolean need_r,
+ gboolean need_w,
+ gboolean need_x);
+
+static gboolean tsp_check_perms (const gchar *path,
+ gboolean is_writable);
+
+/* Gets a local file from the thunar-x file info*/
+gchar*
+tsp_get_local_file (ThunarxFileInfo *filex)
+{
+ gchar *file, *file_local;
+
+ file = thunarx_file_info_get_uri (filex);
+ file_local = g_filename_from_uri (file, NULL, NULL);
+
+ g_free (file);
+ return file_local;
+}
+
+/* Safe string comparison */
+gboolean
+tsp_str_equal (const char *txt1,
+ const char *txt2)
+{
+ if (G_STR_EMPTY (txt1) || G_STR_EMPTY (txt2)){
+ if (G_STR_EMPTY (txt1) && G_STR_EMPTY (txt2)){
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ return g_str_equal (txt1, txt2);
+}
+
+/* Un-share a folder */
+gboolean
+tsp_shares_unshare (const gchar *path)
+{
+ gboolean ret = FALSE;
+ gboolean is_shared;
+ GError *err = NULL;
+
+ /* Check if this path is shared */
+ shares_get_path_is_shared (path, &is_shared, NULL);
+ if (is_shared)
+ {
+ /* Un-share it */
+ ret = shares_modify_share (path, NULL, &err);
+ if (!ret){
+ tsp_show_error (NULL, err->message);
+ g_error_free (err);
+ } else {
+ ret = TRUE;
+ }
+ }
+
+ return ret;
+}
+
+/* Share a folder */
+ShareInfo *
+tsp_shares_share (const gchar *file_local,
+ const gchar *name,
+ const gchar *comments,
+ gboolean is_writable,
+ gboolean guests_ok)
+{
+ ShareInfo *share_info = NULL;
+ gboolean ret;
+ GError *err = NULL;
+
+ /* Check share name */
+ if (G_STR_EMPTY (name)){
+ tsp_show_error (NULL, _("Please, write a name."));
+ return NULL;
+ }
+
+ /* TODO: check if the share name is already used(?) */
+
+ if (tsp_check_perms (file_local, is_writable))
+ {
+ share_info = g_new0 (ShareInfo, 1);
+
+ /* Fill the struct */
+ share_info->path = g_strdup (file_local);
+ share_info->share_name = g_strdup (name);
+ if (G_STR_EMPTY (comments)){
+ share_info->comment = g_strdup ("");
+ } else {
+ share_info->comment = g_strdup (comments);
+ }
+ share_info->is_writable = is_writable;
+ share_info->guest_ok = guests_ok;
+
+ /* Share it */
+ ret = shares_modify_share (file_local, share_info, &err);
+ if (!ret){
+ tsp_show_error (NULL, err->message);
+ g_error_free (err);
+ shares_free_share_info (share_info);
+ share_info = NULL;
+ }
+ }
+
+ return share_info;
+}
+
+/* Displays an error message :(*/
+void
+tsp_show_error (const char *text,
+ const char *secondary)
+{
+ GtkBuilder *ui;
+ GtkWidget *dialog;
+
+ ui = tsp_xml_get_file (XML_FILE,
+ "error_dialog", &dialog,
+ NULL);
+
+ g_object_set (G_OBJECT (dialog), "secondary-text", secondary, NULL);
+
+ if (text){
+ gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), text);
+ } else {
+ gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), _("Cannot modify the share:"));
+ }
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
+ g_object_unref (ui);
+}
+
+/* Asks to the user if we can change the permissions of the folder */
+static gboolean
+tsp_ask_perms (gboolean need_r,
+ gboolean need_w,
+ gboolean need_x)
+{
+ GtkBuilder *ui;
+ GtkWidget *dialog;
+ gboolean result;
+
+ /* Get the dialogs */
+ ui = tsp_xml_get_file (XML_FILE,
+ "permissions_dialog", &dialog,
+ NULL);
+
+ result = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK;
+
+ gtk_widget_destroy (dialog);
+ g_object_unref (ui);
+
+ return result;
+}
+
+/* Checks if the current file has the necesary permissions */
+static gboolean
+tsp_check_perms (const gchar *path,
+ gboolean is_writable)
+{
+ struct stat st;
+ gboolean need_r;
+ gboolean need_w;
+ gboolean need_x;
+ mode_t new_mode;
+ mode_t mode;
+
+ if (stat (path, &st) != 0)
+ return FALSE;
+
+ mode = st.st_mode;
+
+ new_mode = mode;
+
+ need_r = (mode & THUNAR_VFS_FILE_MODE_OTH_READ) == 0;
+ new_mode |= THUNAR_VFS_FILE_MODE_OTH_READ;
+
+ need_w = is_writable && (mode & THUNAR_VFS_FILE_MODE_OTH_WRITE) == 0;
+ if (need_w)
+ new_mode |= THUNAR_VFS_FILE_MODE_OTH_WRITE;
+
+ need_x = (mode & THUNAR_VFS_FILE_MODE_OTH_EXEC) == 0;
+ new_mode |= THUNAR_VFS_FILE_MODE_OTH_EXEC;
+
+ if (need_r || need_w || need_x)
+ {
+ if (!tsp_ask_perms (need_r, need_w, need_x))
+ return FALSE;
+#ifdef G_ENABLE_DEBUG
+ g_message ("Changing permissions of '%s'", path);
+#endif
+ if (g_chmod (path, new_mode) != 0)
+ {
+ tsp_show_error (NULL, _("Error when changing folder permissions."));
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
Added: thunar-shares-plugin/trunk/libshares/libshares-util.h
===================================================================
--- thunar-shares-plugin/trunk/libshares/libshares-util.h (rev 0)
+++ thunar-shares-plugin/trunk/libshares/libshares-util.h 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,50 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBSHARES_MAIN_H__
+#define __LIBSHARES_MAIN_H__
+
+#include <glib.h>
+#include <libshares/shares.h>
+#include <thunarx/thunarx.h>
+
+G_BEGIN_DECLS
+
+#define G_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0')
+
+gchar *tsp_get_local_file (ThunarxFileInfo *file);
+
+gboolean tsp_str_equal (const char *txt1,
+ const char *txt2);
+
+void tsp_show_error (const char *text,
+ const char *secondary);
+
+gboolean tsp_shares_unshare (const gchar *path);
+
+ShareInfo *tsp_shares_share (const gchar *file_local,
+ const gchar *name,
+ const gchar *comments,
+ gboolean is_writable,
+ gboolean guests_ok);
+
+G_END_DECLS
+
+#endif /* __LIBSHARES_MAIN_H__ */
Added: thunar-shares-plugin/trunk/libshares/libshares-xml.c
===================================================================
--- thunar-shares-plugin/trunk/libshares/libshares-xml.c (rev 0)
+++ thunar-shares-plugin/trunk/libshares/libshares-xml.c 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,122 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2002 Imendio AB
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtkbuilder.h>
+
+#include "libshares-paths.h"
+#include "libshares-xml.h"
+
+static GtkBuilder *
+xml_get_file (const gchar *filename,
+ const gchar *first_widget,
+ va_list args)
+{
+ GtkBuilder *ui = NULL;
+ const char *name;
+ GObject **pointer;
+ GError *err = NULL;
+ gchar *path;
+
+ /* Create gtkbuilder & load the xml file */
+ ui = gtk_builder_new ();
+ gtk_builder_set_translation_domain (ui, GETTEXT_PACKAGE);
+ path = tsp_paths_get_xml_path (filename);
+ if (gtk_builder_add_from_file (ui, path, &err) == 0)
+ {
+ g_warning ("XML file error: %s", err->message);
+ g_error_free (err);
+ g_free (path);
+ return NULL;
+ }
+ g_free (path);
+
+ /* Grab the widgets */
+ for (name = first_widget; name; name = va_arg (args, char *))
+ {
+ pointer = va_arg (args, void *);
+
+ *pointer = gtk_builder_get_object (ui, name);
+
+ if (!*pointer) {
+ g_warning ("Widget '%s' at '%s' is missing.", name, filename);
+ continue;
+ }
+ }
+
+ return ui;
+}
+
+GtkBuilder *
+tsp_xml_get_file (const gchar *filename,
+ const gchar *first_widget,
+ ...)
+{
+ GtkBuilder *ui;
+ va_list args;
+
+ va_start (args, first_widget);
+
+ ui = xml_get_file (filename, first_widget, args);
+
+ va_end (args);
+
+ if (!ui) {
+ return NULL;
+ }
+
+ return ui;
+}
+
+void
+tsp_xml_connect (GtkBuilder *ui,
+ gpointer user_data,
+ gchar *first_widget,
+ ...)
+{
+ const gchar *signal;
+ const gchar *name;
+ gpointer *callback;
+ GObject *pointer;
+ va_list args;
+
+ va_start (args, first_widget);
+
+ for (name = first_widget; name; name = va_arg (args, char *)) {
+ signal = va_arg (args, void *);
+ callback = va_arg (args, void *);
+
+ pointer = gtk_builder_get_object (ui, name);
+ if (!pointer) {
+ g_warning ("Missing widget '%s'", name);
+ continue;
+ }
+
+ g_signal_connect (pointer, signal, G_CALLBACK (callback), user_data);
+ }
+
+ va_end (args);
+}
+
Added: thunar-shares-plugin/trunk/libshares/libshares-xml.h
===================================================================
--- thunar-shares-plugin/trunk/libshares/libshares-xml.h (rev 0)
+++ thunar-shares-plugin/trunk/libshares/libshares-xml.h 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,39 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2002 Imendio AB
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LIBSHARES_XML_H__
+#define __LIBSHARES_XML_H__
+
+#include <gtk/gtkbuilder.h>
+
+G_BEGIN_DECLS
+
+GtkBuilder *tsp_xml_get_file (const gchar *filename,
+ const gchar *first_widget,
+ ...);
+
+void tsp_xml_connect (GtkBuilder *gui,
+ gpointer user_data,
+ gchar *first_widget,
+ ...);
+G_END_DECLS
+
+#endif /* __LIBSHARES_XML_H__ */
Added: thunar-shares-plugin/trunk/libshares/shares.c
===================================================================
--- thunar-shares-plugin/trunk/libshares/shares.c (rev 0)
+++ thunar-shares-plugin/trunk/libshares/shares.c 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,1040 @@
+/* nautilus-share -- Nautilus File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#include <config.h>
+#include <string.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <glib/gi18n-lib.h>
+#include "shares.h"
+
+#undef DEBUG_SHARES
+#ifdef DEBUG_SHARES
+# define NET_USERSHARE_ARGV0 "debug-net-usershare"
+#else
+# define NET_USERSHARE_ARGV0 "net"
+#endif
+
+static GHashTable *path_share_info_hash;
+static GHashTable *share_name_share_info_hash;
+
+#define NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES 100
+#define TIMESTAMP_THRESHOLD 10 /* seconds */
+static int refresh_timestamp_update_counter;
+static time_t refresh_timestamp;
+
+#define KEY_PATH "path"
+#define KEY_COMMENT "comment"
+#define KEY_ACL "usershare_acl"
+#define KEY_GUEST_OK "guest_ok"
+#define GROUP_ALLOW_GUESTS "global"
+#define KEY_ALLOW_GUESTS "usershare allow guests"
+
+/* Debugging flags */
+static gboolean throw_error_on_refresh;
+static gboolean throw_error_on_add;
+static gboolean throw_error_on_modify;
+static gboolean throw_error_on_remove;
+
+
+
+/* Interface to "net usershare" */
+
+static gboolean
+net_usershare_run (int argc, char **argv, GKeyFile **ret_key_file, GError **error)
+{
+ int real_argc;
+ int i;
+ char **real_argv;
+ gboolean retval;
+ char *stdout_contents;
+ char *stderr_contents;
+ int exit_status;
+ int exit_code;
+ GKeyFile *key_file;
+ GError *real_error;
+
+ g_assert (argc > 0);
+ g_assert (argv != NULL);
+ g_assert (error == NULL || *error == NULL);
+
+ if (ret_key_file)
+ *ret_key_file = NULL;
+
+ /* Build command line */
+
+ real_argc = 2 + argc + 1; /* "net" "usershare" [argv] NULL */
+ real_argv = g_new (char *, real_argc);
+
+ real_argv[0] = NET_USERSHARE_ARGV0;
+ real_argv[1] = "usershare";
+
+ for (i = 0; i < argc; i++) {
+ g_assert (argv[i] != NULL);
+ real_argv[i + 2] = argv[i];
+ }
+
+ real_argv[real_argc - 1] = NULL;
+
+ /* Launch */
+
+ stdout_contents = NULL;
+ stderr_contents = NULL;
+
+ {
+ char **p;
+
+ g_message ("------------------------------------------");
+
+ for (p = real_argv; *p; p++)
+ g_message ("spawn arg \"%s\"", *p);
+
+ g_message ("end of spawn args; SPAWNING\n");
+ }
+
+ real_error = NULL;
+ retval = g_spawn_sync (NULL, /* cwd */
+ real_argv,
+ NULL, /* envp */
+ G_SPAWN_SEARCH_PATH,
+ NULL, /* GSpawnChildSetupFunc */
+ NULL, /* user_data */
+ &stdout_contents,
+ &stderr_contents,
+ &exit_status,
+ &real_error);
+
+ g_message ("returned from spawn: %s: %s", retval ? "SUCCESS" : "FAIL", retval ? "" : real_error->message);
+
+ if (!retval) {
+ g_propagate_error (error, real_error);
+ goto out;
+ }
+
+ if (!WIFEXITED (exit_status)) {
+ g_message ("WIFEXITED(%d) was false!", exit_status);
+ retval = FALSE;
+
+ if (WIFSIGNALED (exit_status)) {
+ int signal_num;
+
+ signal_num = WTERMSIG (exit_status);
+ g_message ("Child got signal %d", signal_num);
+
+ g_set_error (error,
+ SHARES_ERROR,
+ SHARES_ERROR_FAILED,
+ _("%s %s %s returned with signal %d"),
+ real_argv[0],
+ real_argv[1],
+ real_argv[2],
+ signal_num);
+ } else
+ g_set_error (error,
+ SHARES_ERROR,
+ SHARES_ERROR_FAILED,
+ _("%s %s %s failed for an unknown reason"),
+ real_argv[0],
+ real_argv[1],
+ real_argv[2]);
+
+ goto out;
+ }
+
+ exit_code = WEXITSTATUS (exit_status);
+
+ g_message ("exit code %d", exit_code);
+ if (exit_code != 0) {
+ char *str;
+ char *message;
+
+ /* stderr_contents is in the system locale encoding, not UTF-8 */
+
+ str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+ if (str && str[0])
+ message = g_strdup_printf (_("'net usershare' returned error %d: %s"), exit_code, str);
+ else
+ message = g_strdup_printf (_("'net usershare' returned error %d"), exit_code);
+
+ g_free (str);
+
+ g_set_error (error,
+ G_SPAWN_ERROR,
+ G_SPAWN_ERROR_FAILED,
+ "%s",
+ message);
+
+ g_free (message);
+
+ retval = FALSE;
+ goto out;
+ }
+
+ if (ret_key_file) {
+ g_message ("caller wants GKeyFile");
+
+ *ret_key_file = NULL;
+
+ /* FIXME: jeallison at novell.com says the output of "net usershare" is nearly always
+ * in UTF-8, but that it can be configured in the master smb.conf. We assume
+ * UTF-8 for now.
+ */
+
+ if (!g_utf8_validate (stdout_contents, -1, NULL)) {
+ g_message ("stdout of net usershare was not in valid UTF-8");
+ g_set_error (error,
+ G_SPAWN_ERROR,
+ G_SPAWN_ERROR_FAILED,
+ _("the output of 'net usershare' is not in valid UTF-8 encoding"));
+ retval = FALSE;
+ goto out;
+ }
+
+ key_file = g_key_file_new ();
+
+ real_error = NULL;
+ if (!g_key_file_load_from_data (key_file, stdout_contents, -1, 0, &real_error)) {
+ g_message ("Error when parsing key file {\n%s\n}: %s", stdout_contents, real_error->message);
+ g_propagate_error (error, real_error);
+ g_key_file_free (key_file);
+ retval = FALSE;
+ goto out;
+ }
+
+ retval = TRUE;
+ *ret_key_file = key_file;
+ } else
+ retval = TRUE;
+
+ g_message ("success from calling net usershare and parsing its output");
+
+ out:
+ g_free (real_argv);
+ g_free (stdout_contents);
+ g_free (stderr_contents);
+
+ g_message ("------------------------------------------");
+
+ return retval;
+}
+
+
+
+/* Internals */
+
+static void
+ensure_hashes (void)
+{
+ if (path_share_info_hash == NULL) {
+ g_assert (share_name_share_info_hash == NULL);
+
+ path_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ share_name_share_info_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ } else
+ g_assert (share_name_share_info_hash != NULL);
+}
+
+static ShareInfo *
+lookup_share_by_path (const char *path)
+{
+ ensure_hashes ();
+ return g_hash_table_lookup (path_share_info_hash, path);
+}
+
+static ShareInfo *
+lookup_share_by_share_name (const char *share_name)
+{
+ ensure_hashes ();
+ return g_hash_table_lookup (share_name_share_info_hash, share_name);
+}
+
+static void
+add_share_info_to_hashes (ShareInfo *info)
+{
+ ensure_hashes ();
+ g_hash_table_insert (path_share_info_hash, info->path, info);
+ g_hash_table_insert (share_name_share_info_hash, info->share_name, info);
+}
+
+static void
+remove_share_info_from_hashes (ShareInfo *info)
+{
+ ensure_hashes ();
+ g_hash_table_remove (path_share_info_hash, info->path);
+ g_hash_table_remove (share_name_share_info_hash, info->share_name);
+}
+
+static gboolean
+remove_from_path_hash_cb (gpointer key,
+ gpointer value,
+ gpointer data)
+{
+ ShareInfo *info;
+
+ info = value;
+ shares_free_share_info (info);
+
+ return TRUE;
+}
+
+static gboolean
+remove_from_share_name_hash_cb (gpointer key,
+ gpointer value,
+ gpointer data)
+{
+ /* The ShareInfo was already freed in remove_from_path_hash_cb() */
+ return TRUE;
+}
+
+static void
+free_all_shares (void)
+{
+ ensure_hashes ();
+ g_hash_table_foreach_remove (path_share_info_hash, remove_from_path_hash_cb, NULL);
+ g_hash_table_foreach_remove (share_name_share_info_hash, remove_from_share_name_hash_cb, NULL);
+}
+
+static char *
+get_string_from_key_file (GKeyFile *key_file, const char *group, const char *key)
+{
+ GError *error;
+ char *str;
+
+ error = NULL;
+ str = NULL;
+
+ if (g_key_file_has_key (key_file, group, key, &error)) {
+ str = g_key_file_get_string (key_file, group, key, &error);
+ if (!str) {
+ g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)
+ && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+
+ g_error_free (error);
+ }
+ } else {
+ g_assert (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND));
+ g_error_free (error);
+ }
+
+ return str;
+}
+
+static void
+add_key_group_to_hashes (GKeyFile *key_file, const char *group)
+{
+ char *path;
+ char *comment;
+ char *acl;
+ gboolean is_writable;
+ char *guest_ok_str;
+ gboolean guest_ok;
+ ShareInfo *info;
+ ShareInfo *old_info;
+
+ /* Remove the old share based on the name */
+
+ old_info = lookup_share_by_share_name (group);
+ if (old_info) {
+ remove_share_info_from_hashes (old_info);
+ shares_free_share_info (old_info);
+ }
+
+ /* Start parsing, and remove the old share based on the path */
+
+ path = get_string_from_key_file (key_file, group, KEY_PATH);
+ if (!path) {
+ g_message ("group '%s' doesn't have a '%s' key! Ignoring group.", group, KEY_PATH);
+ return;
+ }
+
+ old_info = lookup_share_by_path (path);
+ if (old_info) {
+ remove_share_info_from_hashes (old_info);
+ shares_free_share_info (old_info);
+ }
+
+ /* Finish parsing */
+
+ comment = get_string_from_key_file (key_file, group, KEY_COMMENT);
+
+ acl = get_string_from_key_file (key_file, group, KEY_ACL);
+ if (acl) {
+ if (strcmp (acl, "Everyone:R") == 0)
+ is_writable = FALSE;
+ else if (strcmp (acl, "Everyone:F") == 0)
+ is_writable = TRUE;
+ else {
+ g_message ("unknown format for key '%s/%s' as it contains '%s'. Assuming that the share is read-only",
+ group, KEY_ACL, acl);
+ is_writable = FALSE;
+ }
+
+ g_free (acl);
+ } else {
+ g_message ("group '%s' doesn't have a '%s' key! Assuming that the share is read-only.", group, KEY_ACL);
+ is_writable = FALSE;
+ }
+
+ guest_ok_str = get_string_from_key_file (key_file, group, KEY_GUEST_OK);
+ if (guest_ok_str) {
+ if (strcmp (guest_ok_str, "n") == 0)
+ guest_ok = FALSE;
+ else if (strcmp (guest_ok_str, "y") == 0)
+ guest_ok = TRUE;
+ else {
+ g_message ("unknown format for key '%s/%s' as it contains '%s'. Assuming that the share is not guest accessible.",
+ group, KEY_GUEST_OK, guest_ok_str);
+ guest_ok = FALSE;
+ }
+
+ g_free (guest_ok_str);
+ } else {
+ g_message ("group '%s' doesn't have a '%s' key! Assuming that the share is not guest accessible.", group, KEY_GUEST_OK);
+ guest_ok = FALSE;
+ }
+
+ g_assert (path != NULL);
+ g_assert (group != NULL);
+
+ info = g_new (ShareInfo, 1);
+ info->path = path;
+ info->share_name = g_strdup (group);
+ info->comment = comment;
+ info->is_writable = is_writable;
+ info->guest_ok = guest_ok;
+
+ add_share_info_to_hashes (info);
+}
+
+static void
+replace_shares_from_key_file (GKeyFile *key_file)
+{
+ gsize num_groups;
+ char **group_names;
+ gsize i;
+
+ group_names = g_key_file_get_groups (key_file, &num_groups);
+
+ /* FIXME: In add_key_group_to_hashes(), we simply ignore key groups
+ * which have invalid data (i.e. no path). We could probably accumulate a
+ * GError with the list of invalid groups and propagate it upwards.
+ */
+ for (i = 0; i < num_groups; i++) {
+ g_assert (group_names[i] != NULL);
+ add_key_group_to_hashes (key_file, group_names[i]);
+ }
+
+ g_strfreev (group_names);
+}
+
+static gboolean
+refresh_shares (GError **error)
+{
+ GKeyFile *key_file;
+ char *argv[1];
+ GError *real_error;
+
+ free_all_shares ();
+
+ if (throw_error_on_refresh) {
+ g_set_error (error,
+ SHARES_ERROR,
+ SHARES_ERROR_FAILED,
+ _("Failed"));
+ return FALSE;
+ }
+
+ argv[0] = "info";
+
+ real_error = NULL;
+ if (!net_usershare_run (G_N_ELEMENTS (argv), argv, &key_file, &real_error)) {
+ g_message ("Called \"net usershare info\" but it failed: %s", real_error->message);
+ g_propagate_error (error, real_error);
+ return FALSE;
+ }
+
+ g_assert (key_file != NULL);
+
+ replace_shares_from_key_file (key_file);
+ g_key_file_free (key_file);
+
+ return TRUE;
+}
+
+static gboolean
+refresh_if_needed (GError **error)
+{
+ gboolean retval;
+
+ if (refresh_timestamp_update_counter == 0) {
+ time_t new_timestamp;
+
+ refresh_timestamp_update_counter = NUM_CALLS_BETWEEN_TIMESTAMP_UPDATES;
+
+ new_timestamp = time (NULL);
+ if (new_timestamp - refresh_timestamp > TIMESTAMP_THRESHOLD) {
+ g_message ("REFRESHING SHARES");
+ retval = refresh_shares (error);
+ } else
+ retval = TRUE;
+
+ refresh_timestamp = new_timestamp;
+ } else {
+ refresh_timestamp_update_counter--;
+ retval = TRUE;
+ }
+
+ return retval;
+}
+
+static ShareInfo *
+copy_share_info (ShareInfo *info)
+{
+ ShareInfo *copy;
+
+ if (!info)
+ return NULL;
+
+ copy = g_new (ShareInfo, 1);
+ copy->path = g_strdup (info->path);
+ copy->share_name = g_strdup (info->share_name);
+ copy->comment = g_strdup (info->comment);
+ copy->is_writable = info->is_writable;
+ copy->guest_ok = info->guest_ok;
+
+ return copy;
+}
+
+/**
+ * shares_supports_guest_ok:
+ * @supports_guest_ok_ret: Location to store whether "usershare allow guests"
+ * is enabled.
+ * @error: Location to store error, or #NULL.
+ *
+ * Determines whether the option "usershare allow guests" is enabled in samba
+ * config as shown by testparm.
+ *
+ * Return value: #TRUE if if the info could be queried successfully, #FALSE
+ * otherwise. If this function returns #FALSE, an error code will be returned
+ * in the @error argument, and *@ret_info_list will be set to #FALSE.
+ **/
+gboolean
+shares_supports_guest_ok (gboolean *supports_guest_ok_ret, GError **error)
+{
+ gboolean retval;
+ gboolean result;
+ char *stdout_contents;
+ char *stderr_contents;
+ int exit_status;
+ int exit_code;
+
+ *supports_guest_ok_ret = FALSE;
+
+ result = g_spawn_command_line_sync ("testparm -s --parameter-name='usershare allow guests'",
+ &stdout_contents,
+ &stderr_contents,
+ &exit_status,
+ error);
+ if (!result)
+ return FALSE;
+
+ retval = FALSE;
+
+ if (!WIFEXITED (exit_status)) {
+ if (WIFSIGNALED (exit_status)) {
+ int signal_num;
+
+ signal_num = WTERMSIG (exit_status);
+ g_set_error (error,
+ SHARES_ERROR,
+ SHARES_ERROR_FAILED,
+ _("Samba's testparm returned with signal %d"),
+ signal_num);
+ } else
+ g_set_error (error,
+ SHARES_ERROR,
+ SHARES_ERROR_FAILED,
+ _("Samba's testparm failed for an unknown reason"));
+
+ goto out;
+ }
+
+ exit_code = WEXITSTATUS (exit_status);
+ if (exit_code != 0) {
+ char *str;
+ char *message;
+
+ /* stderr_contents is in the system locale encoding, not UTF-8 */
+
+ str = g_locale_to_utf8 (stderr_contents, -1, NULL, NULL, NULL);
+
+ if (str && str[0])
+ message = g_strdup_printf (_("Samba's testparm returned error %d: %s"), exit_code, str);
+ else
+ message = g_strdup_printf (_("Samba's testparm returned error %d"), exit_code);
+
+ g_free (str);
+
+ g_set_error (error,
+ G_SPAWN_ERROR,
+ G_SPAWN_ERROR_FAILED,
+ "%s",
+ message);
+
+ g_free (message);
+
+ goto out;
+ }
+
+ retval = TRUE;
+ *supports_guest_ok_ret = (g_ascii_strncasecmp (stdout_contents, "Yes", 3) == 0);
+
+ out:
+ g_free (stdout_contents);
+ g_free (stderr_contents);
+
+ return retval;
+}
+
+static gboolean
+add_share (ShareInfo *info, GError **error)
+{
+ char *argv[7];
+ int argc;
+ ShareInfo *copy;
+ GKeyFile *key_file;
+ GError *real_error;
+ gboolean supports_success;
+ gboolean supports_guest_ok;
+
+ g_message ("add_share() start");
+
+ if (throw_error_on_add) {
+ g_set_error (error,
+ SHARES_ERROR,
+ SHARES_ERROR_FAILED,
+ _("Failed"));
+ g_message ("add_share() end FAIL");
+ return FALSE;
+ }
+
+ supports_success = shares_supports_guest_ok (&supports_guest_ok, error);
+ if (!supports_success)
+ return FALSE;
+
+ argv[0] = "add";
+ argv[1] = "-l";
+ argv[2] = info->share_name;
+ argv[3] = info->path;
+ argv[4] = info->comment;
+ argv[5] = info->is_writable ? "Everyone:F" : "Everyone:R";
+
+ if (supports_guest_ok) {
+ argv[6] = info->guest_ok ? "guest_ok=y" : "guest_ok=n";
+ argc = 7;
+ } else
+ argc = 6;
+
+ real_error = NULL;
+ if (!net_usershare_run (argc, argv, &key_file, &real_error)) {
+ g_message ("Called \"net usershare add\" but it failed: %s", real_error->message);
+ g_propagate_error (error, real_error);
+ return FALSE;
+ }
+
+ replace_shares_from_key_file (key_file);
+
+ copy = copy_share_info (info);
+ add_share_info_to_hashes (copy);
+
+ g_message ("add_share() end SUCCESS");
+
+ return TRUE;
+}
+
+static gboolean
+remove_share (const char *path, GError **error)
+{
+ ShareInfo *old_info;
+ char *argv[2];
+ GError *real_error;
+
+ g_message ("remove_share() start");
+
+ if (throw_error_on_remove) {
+ g_set_error (error,
+ SHARES_ERROR,
+ SHARES_ERROR_FAILED,
+ "Failed");
+ g_message ("remove_share() end FAIL");
+ return FALSE;
+ }
+
+ old_info = lookup_share_by_path (path);
+ if (!old_info) {
+ char *display_name;
+
+ display_name = g_filename_display_name (path);
+ g_set_error (error,
+ SHARES_ERROR,
+ SHARES_ERROR_NONEXISTENT,
+ _("Cannot remove the share for path %s: that path is not shared"),
+ display_name);
+ g_free (display_name);
+
+ g_message ("remove_share() end FAIL: path %s was not in our hashes", path);
+ return FALSE;
+ }
+
+ argv[0] = "delete";
+ argv[1] = old_info->share_name;
+
+ real_error = NULL;
+ if (!net_usershare_run (G_N_ELEMENTS (argv), argv, NULL, &real_error)) {
+ g_message ("Called \"net usershare delete\" but it failed: %s", real_error->message);
+ g_propagate_error (error, real_error);
+ g_message ("remove_share() end FAIL");
+ return FALSE;
+ }
+
+ remove_share_info_from_hashes (old_info);
+ shares_free_share_info (old_info);
+
+ g_message ("remove_share() end SUCCESS");
+
+ return TRUE;
+}
+
+static gboolean
+modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+ ShareInfo *old_info;
+
+ g_message ("modify_share() start");
+
+ old_info = lookup_share_by_path (old_path);
+ if (old_info == NULL) {
+ g_message ("modify_share() end; calling add_share() instead");
+ return add_share (info, error);
+ }
+
+ g_assert (old_info != NULL);
+
+ if (strcmp (info->path, old_info->path) != 0) {
+ g_set_error (error,
+ SHARES_ERROR,
+ SHARES_ERROR_FAILED,
+ _("Cannot change the path of an existing share; please remove the old share first and add a new one"));
+ g_message ("modify_share() end FAIL: tried to change the path in a share!");
+ return FALSE;
+ }
+
+ if (throw_error_on_modify) {
+ g_set_error (error,
+ SHARES_ERROR,
+ SHARES_ERROR_FAILED,
+ "Failed");
+ g_message ("modify_share() end FAIL");
+ return FALSE;
+ }
+
+ /* Although "net usershare add" will modify an existing share if it has the same share name
+ * as the one that gets passed in, our semantics are different. We have a one-to-one mapping
+ * between paths and share names; "net usershare" supports a one-to-many mapping from paths
+ * to share names. So, we must first remove the old share and then add the new/modified one.
+ */
+
+ if (!remove_share (old_path, error)) {
+ g_message ("modify_share() end FAIL: error when removing old share");
+ return FALSE;
+ }
+
+ g_message ("modify_share() end: will call add_share() with the new share info");
+ return add_share (info, error);
+}
+
+
+
+/* Public API */
+
+GQuark
+shares_error_quark (void)
+{
+ static GQuark quark;
+
+ if (quark == 0)
+ quark = g_quark_from_string ("nautilus-shares-error-quark"); /* not from_static_string since we are a module */
+
+ return quark;
+}
+
+/**
+ * shares_free_share_info:
+ * @info: A #ShareInfo structure.
+ *
+ * Frees a #ShareInfo structure.
+ **/
+void
+shares_free_share_info (ShareInfo *info)
+{
+ g_assert (info != NULL);
+
+ g_free (info->path);
+ g_free (info->share_name);
+ g_free (info->comment);
+ g_free (info);
+}
+
+/**
+ * shares_get_path_is_shared:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_is_shared: Location to store result value (#TRUE if the path is shared, #FALSE otherwise)
+ * @error: Location to store error, or #NULL.
+ *
+ * Checks whether a path is shared through Samba.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise. If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_is_shared will be set to #FALSE.
+ **/
+gboolean
+shares_get_path_is_shared (const char *path, gboolean *ret_is_shared, GError **error)
+{
+ g_assert (ret_is_shared != NULL);
+ g_assert (error == NULL || *error == NULL);
+
+ if (!refresh_if_needed (error)) {
+ *ret_is_shared = FALSE;
+ return FALSE;
+ }
+
+ *ret_is_shared = (lookup_share_by_path (path) != NULL);
+
+ return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_path:
+ * @path: A full path name ("/foo/bar/baz") in file system encoding.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if the path is indeed shared, or #NULL if the path is not
+ * shared. You must free the non-NULL value with shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for a shared path: its share name, its read-only status, etc.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise. If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_path (const char *path, ShareInfo **ret_share_info, GError **error)
+{
+ ShareInfo *info;
+
+ g_assert (path != NULL);
+ g_assert (ret_share_info != NULL);
+ g_assert (error == NULL || *error == NULL);
+
+ if (!refresh_if_needed (error)) {
+ *ret_share_info = NULL;
+ return FALSE;
+ }
+
+ info = lookup_share_by_path (path);
+ *ret_share_info = copy_share_info (info);
+
+ return TRUE;
+}
+
+/**
+ * shares_get_share_name_exists:
+ * @share_name: Name of a share.
+ * @ret_exists: Location to store return value; #TRUE if the share name exists, #FALSE otherwise.
+ *
+ * Queries whether a share name already exists in the user's list of shares.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise. If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_exists will be set to #FALSE.
+ **/
+gboolean
+shares_get_share_name_exists (const char *share_name, gboolean *ret_exists, GError **error)
+{
+ g_assert (share_name != NULL);
+ g_assert (ret_exists != NULL);
+ g_assert (error == NULL || *error == NULL);
+
+ if (!refresh_if_needed (error)) {
+ *ret_exists = FALSE;
+ return FALSE;
+ }
+
+ *ret_exists = (lookup_share_by_share_name (share_name) != NULL);
+
+ return TRUE;
+}
+
+/**
+ * shares_get_share_info_for_share_name:
+ * @share_name: Name of a share.
+ * @ret_share_info: Location to store result with the share's info - on return,
+ * will be non-NULL if there is a share for the specified name, or #NULL if no
+ * share has such name. You must free the non-NULL value with
+ * shares_free_share_info().
+ * @error: Location to store error, or #NULL.
+ *
+ * Queries the information for the share which has a specific name.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise. If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_share_info will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_for_share_name (const char *share_name, ShareInfo **ret_share_info, GError **error)
+{
+ ShareInfo *info;
+
+ g_assert (share_name != NULL);
+ g_assert (ret_share_info != NULL);
+ g_assert (error == NULL || *error == NULL);
+
+ if (!refresh_if_needed (error)) {
+ *ret_share_info = NULL;
+ return FALSE;
+ }
+
+ info = lookup_share_by_share_name (share_name);
+ *ret_share_info = copy_share_info (info);
+
+ return TRUE;
+}
+
+/**
+ * shares_modify_share:
+ * @old_path: Path of the share to modify, or %NULL.
+ * @info: Info of the share to modify/add, or %NULL to delete a share.
+ * @error: Location to store error, or #NULL.
+ *
+ * Can add, modify, or delete shares. To add a share, pass %NULL for @old_path,
+ * and a non-null @info. To modify a share, pass a non-null @old_path and
+ * non-null @info; in this case, @info->path must have the same contents as
+ * @old_path. To remove a share, pass a non-NULL @old_path and a %NULL @info.
+ *
+ * Return value: TRUE if the share could be modified, FALSE otherwise. If this returns
+ * FALSE, then the error information will be placed in @error.
+ **/
+gboolean
+shares_modify_share (const char *old_path, ShareInfo *info, GError **error)
+{
+ g_assert ((old_path == NULL && info != NULL)
+ || (old_path != NULL && info == NULL)
+ || (old_path != NULL && info != NULL));
+ g_assert (error == NULL || *error == NULL);
+
+ if (!refresh_if_needed (error))
+ return FALSE;
+
+ if (old_path == NULL)
+ return add_share (info, error);
+ else if (info == NULL)
+ return remove_share (old_path, error);
+ else
+ return modify_share (old_path, info, error);
+}
+
+static void
+copy_to_slist_cb (gpointer key, gpointer value, gpointer data)
+{
+ ShareInfo *info;
+ ShareInfo *copy;
+ GSList **list;
+
+ info = value;
+ list = data;
+
+ copy = copy_share_info (info);
+ *list = g_slist_prepend (*list, copy);
+}
+
+/**
+ * shares_get_share_info_list:
+ * @ret_info_list: Location to store the return value, which is a list
+ * of #ShareInfo structures. Free this with shares_free_share_info_list().
+ * @error: Location to store error, or #NULL.
+ *
+ * Gets the list of shared folders and their information.
+ *
+ * Return value: #TRUE if the info could be queried successfully, #FALSE
+ * otherwise. If this function returns #FALSE, an error code will be returned in the
+ * @error argument, and *@ret_info_list will be set to #NULL.
+ **/
+gboolean
+shares_get_share_info_list (GSList **ret_info_list, GError **error)
+{
+ g_assert (ret_info_list != NULL);
+ g_assert (error == NULL || *error == NULL);
+
+ if (!refresh_if_needed (error)) {
+ *ret_info_list = NULL;
+ return FALSE;
+ }
+
+ *ret_info_list = NULL;
+ g_hash_table_foreach (path_share_info_hash, copy_to_slist_cb, ret_info_list);
+
+ return TRUE;
+}
+
+/**
+ * shares_free_share_info_list:
+ * @list: List of #ShareInfo structures, or %NULL.
+ *
+ * Frees a list of #ShareInfo structures as returned by shares_get_share_info_list().
+ **/
+void
+shares_free_share_info_list (GSList *list)
+{
+ GSList *l;
+
+ for (l = list; l; l = l->next) {
+ ShareInfo *info;
+
+ info = l->data;
+ shares_free_share_info (l->data);
+ }
+
+ g_slist_free (list);
+}
+
+void
+shares_set_debug (gboolean error_on_refresh,
+ gboolean error_on_add,
+ gboolean error_on_modify,
+ gboolean error_on_remove)
+{
+ throw_error_on_refresh = error_on_refresh;
+ throw_error_on_add = error_on_add;
+ throw_error_on_modify = error_on_modify;
+ throw_error_on_remove = error_on_remove;
+}
Added: thunar-shares-plugin/trunk/libshares/shares.h
===================================================================
--- thunar-shares-plugin/trunk/libshares/shares.h (rev 0)
+++ thunar-shares-plugin/trunk/libshares/shares.h 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,68 @@
+/* nautilus-share -- Nautilus File Sharing Extension
+ *
+ * Sebastien Estienne <sebastien.estienne at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * (C) Copyright 2005 Ethium, Inc.
+ */
+
+#ifndef SHARES_H
+#define SHARES_H
+
+#include <glib.h>
+
+typedef struct {
+ char *path;
+ char *share_name;
+ char *comment;
+ gboolean is_writable;
+ gboolean guest_ok;
+} ShareInfo;
+
+#define SHARES_ERROR (shares_error_quark ())
+
+typedef enum {
+ SHARES_ERROR_FAILED,
+ SHARES_ERROR_NONEXISTENT
+} SharesError;
+
+GQuark shares_error_quark (void);
+
+void shares_free_share_info (ShareInfo *info);
+
+gboolean shares_get_path_is_shared (const char *path, gboolean *ret_is_shared, GError **error);
+
+gboolean shares_get_share_info_for_path (const char *path, ShareInfo **ret_share_info, GError **error);
+
+gboolean shares_get_share_name_exists (const char *share_name, gboolean *ret_exists, GError **error);
+
+gboolean shares_get_share_info_for_share_name (const char *share_name, ShareInfo **ret_share_info, GError **error);
+
+gboolean shares_modify_share (const char *old_path, ShareInfo *info, GError **error);
+
+gboolean shares_get_share_info_list (GSList **ret_info_list, GError **error);
+
+void shares_free_share_info_list (GSList *list);
+
+gboolean shares_supports_guest_ok (gboolean *supports_guest_ok_ret,
+ GError **error);
+
+void shares_set_debug (gboolean error_on_refresh,
+ gboolean error_on_add,
+ gboolean error_on_modify,
+ gboolean error_on_remove);
+
+#endif
Added: thunar-shares-plugin/trunk/po/ChangeLog
===================================================================
Added: thunar-shares-plugin/trunk/po/LINGUAS
===================================================================
--- thunar-shares-plugin/trunk/po/LINGUAS (rev 0)
+++ thunar-shares-plugin/trunk/po/LINGUAS 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,2 @@
+# please keep this list sorted alphabetically
+es fr it nb ru
Added: thunar-shares-plugin/trunk/po/POTFILES.in
===================================================================
--- thunar-shares-plugin/trunk/po/POTFILES.in (rev 0)
+++ thunar-shares-plugin/trunk/po/POTFILES.in 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,16 @@
+# List of source files containing translatable strings.
+[encoding: UTF-8]
+libshares/libshares-paths.c
+libshares/libshares-util.c
+libshares/libshares-xml.c
+libshares/shares.c
+thunar-plugin/thunar-shares-plugin.c
+thunar-plugin/tsp-admin.c
+thunar-plugin/tsp-admin-editor.c
+thunar-plugin/tsp-page.c
+thunar-plugin/tsp-page-provider.c
+thunar-plugin/tsp-prefs-provider.c
+[type: gettext/glade]data/admin-dialog-editor.xml
+[type: gettext/glade]data/admin-dialog.xml
+[type: gettext/glade]data/dialogs.xml
+[type: gettext/glade]data/thunar-page.xml
Added: thunar-shares-plugin/trunk/po/POTFILES.skip
===================================================================
--- thunar-shares-plugin/trunk/po/POTFILES.skip (rev 0)
+++ thunar-shares-plugin/trunk/po/POTFILES.skip 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1 @@
+# please keep this list sorted alphabetically
Added: thunar-shares-plugin/trunk/po/es.po
===================================================================
--- thunar-shares-plugin/trunk/po/es.po (rev 0)
+++ thunar-shares-plugin/trunk/po/es.po 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,175 @@
+# LANGUAGE translation of Thunar Shares.
+# Copyright (C) 2008 THE Thunar Shares'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the Thunar Shares package.
+# daniel <>, 2008.
+# , fuzzy
+# daniel <>, 2008.
+#
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Thunar Shares 0.16\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-07-22 20:50-0300\n"
+"PO-Revision-Date: 2008-07-22 12:47-0300\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../libshares/libshares-util.c:111
+msgid "Please, write a name."
+msgstr "Porfavor, escriba un nombre para la compartición."
+
+#: ../libshares/libshares-util.c:162 ../data/dialogs.xml.h:1
+#: ../data/thunar-page.xml.h:4
+msgid "Cannot modify the share:"
+msgstr "No se puede modificar la compartición:"
+
+#: ../libshares/libshares-util.c:232
+msgid "Error when changing folder permissions."
+msgstr "Error al cambiar los permisos de la carpeta"
+
+#: ../libshares/shares.c:146
+#, c-format
+msgid "%s %s %s returned with signal %d"
+msgstr ""
+
+#: ../libshares/shares.c:155
+#, c-format
+msgid "%s %s %s failed for an unknown reason"
+msgstr ""
+
+#: ../libshares/shares.c:175
+#, c-format
+msgid "'net usershare' returned error %d: %s"
+msgstr ""
+
+#: ../libshares/shares.c:177
+#, c-format
+msgid "'net usershare' returned error %d"
+msgstr ""
+
+#: ../libshares/shares.c:208
+#, c-format
+msgid "the output of 'net usershare' is not in valid UTF-8 encoding"
+msgstr ""
+
+#: ../libshares/shares.c:463 ../libshares/shares.c:636
+#, c-format
+msgid "Failed"
+msgstr ""
+
+#: ../libshares/shares.c:571
+#, c-format
+msgid "Samba's testparm returned with signal %d"
+msgstr ""
+
+#: ../libshares/shares.c:577
+#, c-format
+msgid "Samba's testparm failed for an unknown reason"
+msgstr ""
+
+#: ../libshares/shares.c:592
+#, c-format
+msgid "Samba's testparm returned error %d: %s"
+msgstr ""
+
+#: ../libshares/shares.c:594
+#, c-format
+msgid "Samba's testparm returned error %d"
+msgstr ""
+
+#: ../libshares/shares.c:701
+#, c-format
+msgid "Cannot remove the share for path %s: that path is not shared"
+msgstr ""
+
+#: ../libshares/shares.c:747
+#, c-format
+msgid ""
+"Cannot change the path of an existing share; please remove the old share "
+"first and add a new one"
+msgstr ""
+
+#: ../thunar-plugin/tsp-admin-editor.c:174
+msgid "Thunar - Add a share"
+msgstr "Thunar - Agregar compartición"
+
+#: ../thunar-plugin/tsp-admin-editor.c:196
+msgid "Thunar - Edit share"
+msgstr "Thunar - Editar compartición"
+
+#: ../thunar-plugin/tsp-page.c:229
+msgid "Share"
+msgstr "Compartir"
+
+#: ../thunar-plugin/tsp-prefs-provider.c:99
+msgid "Manage shared folders..."
+msgstr "Administrar carpetas compartidas..."
+
+#: ../thunar-plugin/tsp-prefs-provider.c:100
+msgid "Add, edit and remove shared folders"
+msgstr "Agregar, editar y borrar carpetas compartidas"
+
+#: ../data/admin-dialog-editor.xml.h:1
+msgid "<b>Comments:</b>"
+msgstr "<b>Comentarios:</b>"
+
+#: ../data/admin-dialog-editor.xml.h:2
+msgid "<b>Folder:</b>"
+msgstr "<b>Carpeta:</b>"
+
+#: ../data/admin-dialog-editor.xml.h:3
+msgid "<b>Share name:</b>"
+msgstr "<b>Nombre:</b>"
+
+#: ../data/admin-dialog-editor.xml.h:4 ../data/thunar-page.xml.h:2
+msgid "Allow Guest access"
+msgstr "Permitir acceso a visitantes"
+
+#: ../data/admin-dialog-editor.xml.h:5
+msgid "Allow other users to write in this folder"
+msgstr "Permitir escritura a todos los usuarios"
+
+#: ../data/admin-dialog.xml.h:1
+msgid "Thunar - Manage Shared Folders"
+msgstr "Thunar - Administrar carpetas compartidas"
+
+#: ../data/dialogs.xml.h:2 ../data/thunar-page.xml.h:8
+msgid "Thunar Shares Error"
+msgstr "Thunar Shares - Error"
+
+#: ../data/dialogs.xml.h:3 ../data/thunar-page.xml.h:9
+msgid "Thunar Shares Question"
+msgstr "Thunar Shares - Pregunta"
+
+#: ../data/dialogs.xml.h:4 ../data/thunar-page.xml.h:10
+msgid ""
+"Thunar needs to add some permissions to your folder in order to share it. Do "
+"you agree?"
+msgstr "Son necesarios algunos permisos para compartir la carpeta. ¿Está de acuerdo en que thunar los cambie?"
+
+#: ../data/thunar-page.xml.h:1
+msgid "<b>Folder Sharing</b>"
+msgstr "<b>Compartición de carpetas</b>"
+
+#: ../data/thunar-page.xml.h:3
+msgid "Allow others users to write in this folder"
+msgstr "Permitir escritura a todos los usuarios"
+
+#: ../data/thunar-page.xml.h:5
+msgid "Comments:"
+msgstr "Comentarios:"
+
+#: ../data/thunar-page.xml.h:6
+msgid "Share Name:"
+msgstr "Nombre:"
+
+#: ../data/thunar-page.xml.h:7
+msgid "Share this folder"
+msgstr "Compartir esta carpeta"
+
+#~ msgid "Insufficient permissions to share the folder."
+#~ msgstr "Permisos de carpeta no cumplidos para compartir"
Added: thunar-shares-plugin/trunk/po/fr.po
===================================================================
--- thunar-shares-plugin/trunk/po/fr.po (rev 0)
+++ thunar-shares-plugin/trunk/po/fr.po 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,192 @@
+# French translation for the thunar-shares package.
+# Copyright (C) 2008 Daniel Morales
+# This file is distributed under the same license as the thunar-shares package.
+# Maximilian Schleiss <maximilian at xfce.org>, 2008.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Thunar-Shares 0.14\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-07-22 20:50-0300\n"
+"PO-Revision-Date: 2008-07-17 18:39+0100\n"
+"Last-Translator: Maximilian Schleiss <maximilian at xfce.org>\n"
+"Language-Team: French\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../libshares/libshares-util.c:111
+#, fuzzy
+msgid "Please, write a name."
+msgstr "Veuillez insérer un nom pour le partage."
+
+#: ../libshares/libshares-util.c:162 ../data/dialogs.xml.h:1
+#: ../data/thunar-page.xml.h:4
+msgid "Cannot modify the share:"
+msgstr "Échec à la modification du partage :"
+
+#: ../libshares/libshares-util.c:232
+msgid "Error when changing folder permissions."
+msgstr ""
+
+#: ../libshares/shares.c:146
+#, c-format
+msgid "%s %s %s returned with signal %d"
+msgstr "%s %s %s a renvoyé un signal %d"
+
+#: ../libshares/shares.c:155
+#, c-format
+msgid "%s %s %s failed for an unknown reason"
+msgstr "%s %s %s a échoué pour une raison inconnue"
+
+#: ../libshares/shares.c:175
+#, c-format
+msgid "'net usershare' returned error %d: %s"
+msgstr "'net usershare' a renvoyé une erreur %d : %s"
+
+#: ../libshares/shares.c:177
+#, c-format
+msgid "'net usershare' returned error %d"
+msgstr "'net usershare' a renvoyé une erreur %d"
+
+#: ../libshares/shares.c:208
+#, c-format
+msgid "the output of 'net usershare' is not in valid UTF-8 encoding"
+msgstr "la sortie de 'net usershare' n'est pas au format UTF-8"
+
+#: ../libshares/shares.c:463 ../libshares/shares.c:636
+#, c-format
+msgid "Failed"
+msgstr "Échec"
+
+#: ../libshares/shares.c:571
+#, c-format
+msgid "Samba's testparm returned with signal %d"
+msgstr "testparm a renvoyé un signal %d"
+
+#: ../libshares/shares.c:577
+#, c-format
+msgid "Samba's testparm failed for an unknown reason"
+msgstr "testparm a échoué pour une raison inconnue"
+
+#: ../libshares/shares.c:592
+#, c-format
+msgid "Samba's testparm returned error %d: %s"
+msgstr "testparm a renvoyé une erreur %d : %s"
+
+#: ../libshares/shares.c:594
+#, c-format
+msgid "Samba's testparm returned error %d"
+msgstr "testparm a renvoyé une erreur %d"
+
+#: ../libshares/shares.c:701
+#, c-format
+msgid "Cannot remove the share for path %s: that path is not shared"
+msgstr ""
+"Échec à la suppression du partage pour %s : le chemin d'accès n'est pas "
+"partagé"
+
+#: ../libshares/shares.c:747
+#, c-format
+msgid ""
+"Cannot change the path of an existing share; please remove the old share "
+"first and add a new one"
+msgstr ""
+"Un partage existant ne peut pas être modifié; veuillez le supprimer et le "
+"recréer"
+
+#: ../thunar-plugin/tsp-admin-editor.c:174
+msgid "Thunar - Add a share"
+msgstr "Thunar - Ajout d'un partage"
+
+#: ../thunar-plugin/tsp-admin-editor.c:196
+msgid "Thunar - Edit share"
+msgstr "Thunar - Éditer un partage"
+
+#: ../thunar-plugin/tsp-page.c:229
+#, fuzzy
+msgid "Share"
+msgstr "Nom du partage :"
+
+#: ../thunar-plugin/tsp-prefs-provider.c:99
+msgid "Manage shared folders..."
+msgstr "Gérer les dossiers partagés..."
+
+#: ../thunar-plugin/tsp-prefs-provider.c:100
+msgid "Add, edit and remove shared folders"
+msgstr "Ajouter, éditer et supprimer des dossiers partagés"
+
+#: ../data/admin-dialog-editor.xml.h:1
+msgid "<b>Comments:</b>"
+msgstr "<b>Commentaires :</b>"
+
+#: ../data/admin-dialog-editor.xml.h:2
+msgid "<b>Folder:</b>"
+msgstr "<b>Dossier :</b>"
+
+#: ../data/admin-dialog-editor.xml.h:3
+msgid "<b>Share name:</b>"
+msgstr "<b>Nom du partage :</b>"
+
+#: ../data/admin-dialog-editor.xml.h:4 ../data/thunar-page.xml.h:2
+msgid "Allow Guest access"
+msgstr "Permettre l'accès hôte"
+
+#: ../data/admin-dialog-editor.xml.h:5
+msgid "Allow other users to write in this folder"
+msgstr "Permettre l'écriture dans ce dossier aux autres utilisateurs"
+
+#: ../data/admin-dialog.xml.h:1
+msgid "Thunar - Manage Shared Folders"
+msgstr "Thunar - Gérer les dossiers partagés"
+
+#: ../data/dialogs.xml.h:2 ../data/thunar-page.xml.h:8
+msgid "Thunar Shares Error"
+msgstr "Erreur Thunar Shares"
+
+#: ../data/dialogs.xml.h:3 ../data/thunar-page.xml.h:9
+msgid "Thunar Shares Question"
+msgstr "Question Thunar Shares"
+
+#: ../data/dialogs.xml.h:4 ../data/thunar-page.xml.h:10
+msgid ""
+"Thunar needs to add some permissions to your folder in order to share it. Do "
+"you agree?"
+msgstr ""
+"Thunar doit ajouter des permissions à votre dossier pour en permettre le "
+"partage. Êtes-vous d'accord ?"
+
+#: ../data/thunar-page.xml.h:1
+msgid "<b>Folder Sharing</b>"
+msgstr "<b>Partage de dossier</b>"
+
+#: ../data/thunar-page.xml.h:3
+msgid "Allow others users to write in this folder"
+msgstr "Permettre l'écriture dans ce dossier aux autres utilisateurs"
+
+#: ../data/thunar-page.xml.h:5
+msgid "Comments:"
+msgstr "Commentaires :"
+
+#: ../data/thunar-page.xml.h:6
+msgid "Share Name:"
+msgstr "Nom du partage :"
+
+#: ../data/thunar-page.xml.h:7
+msgid "Share this folder"
+msgstr "Partager ce dossier"
+
+#~ msgid "Insufficient permissions to share the folder."
+#~ msgstr "Permissions insuffisantes pour créer le partage."
+
+#~ msgid "gtk-cancel"
+#~ msgstr "Annuler"
+
+#~ msgid "gtk-ok"
+#~ msgstr "Ok"
+
+#~ msgid "gtk-apply"
+#~ msgstr "Appliquer"
+
+#~ msgid "gtk-revert-to-saved"
+#~ msgstr "Annuler"
Added: thunar-shares-plugin/trunk/po/it.po
===================================================================
--- thunar-shares-plugin/trunk/po/it.po (rev 0)
+++ thunar-shares-plugin/trunk/po/it.po 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,182 @@
+# Italian translation for thunar-shares
+# Copyright (c) 2008 Rosetta Contributors and Canonical Ltd 2008
+# This file is distributed under the same license as the thunar-shares package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, 2008.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: thunar-shares\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-07-22 20:50-0300\n"
+"PO-Revision-Date: 2008-05-01 18:00+0000\n"
+"Last-Translator: Ermanno Strazzeri <hartman77 at gmail.com>\n"
+"Language-Team: Italian <it at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2008-07-17 13:36+0000\n"
+"X-Generator: Launchpad (build Unknown)\n"
+
+#: ../libshares/libshares-util.c:111
+#, fuzzy
+msgid "Please, write a name."
+msgstr "Assegna un nome alla condivisione."
+
+#: ../libshares/libshares-util.c:162 ../data/dialogs.xml.h:1
+#: ../data/thunar-page.xml.h:4
+msgid "Cannot modify the share:"
+msgstr ""
+
+#: ../libshares/libshares-util.c:232
+msgid "Error when changing folder permissions."
+msgstr ""
+
+#: ../libshares/shares.c:146
+#, c-format
+msgid "%s %s %s returned with signal %d"
+msgstr "%s %s %s ha restituito il segnale %d"
+
+#: ../libshares/shares.c:155
+#, c-format
+msgid "%s %s %s failed for an unknown reason"
+msgstr "%s %s %s non riuscito per un motivo sconosciuto"
+
+#: ../libshares/shares.c:175
+#, c-format
+msgid "'net usershare' returned error %d: %s"
+msgstr "\"net usershare\" ha restituito l'errore %d: %s"
+
+#: ../libshares/shares.c:177
+#, c-format
+msgid "'net usershare' returned error %d"
+msgstr "\"net usershare\" ha restituito l'errore %d"
+
+#: ../libshares/shares.c:208
+#, c-format
+msgid "the output of 'net usershare' is not in valid UTF-8 encoding"
+msgstr "l'output di \"net usershare\" non è codificato in UTF-8"
+
+#: ../libshares/shares.c:463 ../libshares/shares.c:636
+#, c-format
+msgid "Failed"
+msgstr "Non riuscito"
+
+#: ../libshares/shares.c:571
+#, c-format
+msgid "Samba's testparm returned with signal %d"
+msgstr "\"testparm\" di Samba ha restituito il segnale %d"
+
+#: ../libshares/shares.c:577
+#, c-format
+msgid "Samba's testparm failed for an unknown reason"
+msgstr "\"testparm\" di Samba non riuscito per un motivo sconosciuto"
+
+#: ../libshares/shares.c:592
+#, c-format
+msgid "Samba's testparm returned error %d: %s"
+msgstr "\"testparm\" di Samba ha restituito l'errore %d: %s"
+
+#: ../libshares/shares.c:594
+#, c-format
+msgid "Samba's testparm returned error %d"
+msgstr "\"testparm\" di Samba ha restituito l'errore %d"
+
+#: ../libshares/shares.c:701
+#, c-format
+msgid "Cannot remove the share for path %s: that path is not shared"
+msgstr ""
+"Impossibile rimuovere la condivisione per il percorso %s: tale percorso non "
+"è condiviso"
+
+#: ../libshares/shares.c:747
+#, c-format
+msgid ""
+"Cannot change the path of an existing share; please remove the old share "
+"first and add a new one"
+msgstr ""
+"Impossibile cambiare il percorso di una condivisione esistente; rimuovere la "
+"vecchia condivisione e poi aggiungerne una nuova"
+
+#: ../thunar-plugin/tsp-admin-editor.c:174
+msgid "Thunar - Add a share"
+msgstr ""
+
+#: ../thunar-plugin/tsp-admin-editor.c:196
+msgid "Thunar - Edit share"
+msgstr ""
+
+#: ../thunar-plugin/tsp-page.c:229
+msgid "Share"
+msgstr ""
+
+#: ../thunar-plugin/tsp-prefs-provider.c:99
+msgid "Manage shared folders..."
+msgstr ""
+
+#: ../thunar-plugin/tsp-prefs-provider.c:100
+msgid "Add, edit and remove shared folders"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:1
+msgid "<b>Comments:</b>"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:2
+msgid "<b>Folder:</b>"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:3
+msgid "<b>Share name:</b>"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:4 ../data/thunar-page.xml.h:2
+msgid "Allow Guest access"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:5
+msgid "Allow other users to write in this folder"
+msgstr ""
+
+#: ../data/admin-dialog.xml.h:1
+msgid "Thunar - Manage Shared Folders"
+msgstr ""
+
+#: ../data/dialogs.xml.h:2 ../data/thunar-page.xml.h:8
+msgid "Thunar Shares Error"
+msgstr ""
+
+#: ../data/dialogs.xml.h:3 ../data/thunar-page.xml.h:9
+msgid "Thunar Shares Question"
+msgstr ""
+
+#: ../data/dialogs.xml.h:4 ../data/thunar-page.xml.h:10
+msgid ""
+"Thunar needs to add some permissions to your folder in order to share it. Do "
+"you agree?"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:1
+msgid "<b>Folder Sharing</b>"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:3
+msgid "Allow others users to write in this folder"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:5
+msgid "Comments:"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:6
+msgid "Share Name:"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:7
+msgid "Share this folder"
+msgstr ""
+
+#~ msgid "Insufficient permissions to share the folder."
+#~ msgstr "Permessi insufficienti per condividere la cartella"
+
+#~ msgid "<span color=\"red\"><b>Error:</b> %s</span>"
+#~ msgstr "<span color=\"red\"><b>Errore:</b> %s</span>"
Added: thunar-shares-plugin/trunk/po/nb.po
===================================================================
--- thunar-shares-plugin/trunk/po/nb.po (rev 0)
+++ thunar-shares-plugin/trunk/po/nb.po 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,180 @@
+# Norwegian Bokmal translation for thunar-shares
+# Copyright (c) 2008 Rosetta Contributors and Canonical Ltd 2008
+# This file is distributed under the same license as the thunar-shares package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, 2008.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: thunar-shares\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-07-22 20:50-0300\n"
+"PO-Revision-Date: 2008-04-24 20:31+0000\n"
+"Last-Translator: Lomz <christian at vindstille.net>\n"
+"Language-Team: Norwegian Bokmal <nb at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2008-07-17 13:36+0000\n"
+"X-Generator: Launchpad (build Unknown)\n"
+
+#: ../libshares/libshares-util.c:111
+#, fuzzy
+msgid "Please, write a name."
+msgstr "Vennligst, skriv inn navnet for delingen"
+
+#: ../libshares/libshares-util.c:162 ../data/dialogs.xml.h:1
+#: ../data/thunar-page.xml.h:4
+msgid "Cannot modify the share:"
+msgstr ""
+
+#: ../libshares/libshares-util.c:232
+msgid "Error when changing folder permissions."
+msgstr ""
+
+#: ../libshares/shares.c:146
+#, c-format
+msgid "%s %s %s returned with signal %d"
+msgstr "%s %s %s kom tilbake med meldingen %d"
+
+#: ../libshares/shares.c:155
+#, c-format
+msgid "%s %s %s failed for an unknown reason"
+msgstr "%s %s %s feilet av en ukjent grunn"
+
+#: ../libshares/shares.c:175
+#, c-format
+msgid "'net usershare' returned error %d: %s"
+msgstr "'net usershare' kom tilbake med feil %d: %s"
+
+#: ../libshares/shares.c:177
+#, c-format
+msgid "'net usershare' returned error %d"
+msgstr "'net usershare' rkom tilbake med feil %d"
+
+#: ../libshares/shares.c:208
+#, c-format
+msgid "the output of 'net usershare' is not in valid UTF-8 encoding"
+msgstr "Utdata fra 'net usershare' er ikke i korrekt UTF-8 koding"
+
+#: ../libshares/shares.c:463 ../libshares/shares.c:636
+#, c-format
+msgid "Failed"
+msgstr "Feilet"
+
+#: ../libshares/shares.c:571
+#, c-format
+msgid "Samba's testparm returned with signal %d"
+msgstr "Samba's testparm kom tilbake med meldingen %d"
+
+#: ../libshares/shares.c:577
+#, c-format
+msgid "Samba's testparm failed for an unknown reason"
+msgstr "Samba's testparm feilet for en ukjent grunn"
+
+#: ../libshares/shares.c:592
+#, c-format
+msgid "Samba's testparm returned error %d: %s"
+msgstr "Samba's testparm kom tilbake med feilen %d: %s"
+
+#: ../libshares/shares.c:594
+#, c-format
+msgid "Samba's testparm returned error %d"
+msgstr "Samba's testparm kom tilbake med feil %d"
+
+#: ../libshares/shares.c:701
+#, c-format
+msgid "Cannot remove the share for path %s: that path is not shared"
+msgstr "Kunne ikke fjerne deling for stien %s: stien er ikke delt"
+
+#: ../libshares/shares.c:747
+#, c-format
+msgid ""
+"Cannot change the path of an existing share; please remove the old share "
+"first and add a new one"
+msgstr ""
+"Kunne ikke endre stien for en eksisterende deling; vennligst fjern den gamle "
+"delingen først og så legg til en ny en."
+
+#: ../thunar-plugin/tsp-admin-editor.c:174
+msgid "Thunar - Add a share"
+msgstr ""
+
+#: ../thunar-plugin/tsp-admin-editor.c:196
+msgid "Thunar - Edit share"
+msgstr ""
+
+#: ../thunar-plugin/tsp-page.c:229
+msgid "Share"
+msgstr ""
+
+#: ../thunar-plugin/tsp-prefs-provider.c:99
+msgid "Manage shared folders..."
+msgstr ""
+
+#: ../thunar-plugin/tsp-prefs-provider.c:100
+msgid "Add, edit and remove shared folders"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:1
+msgid "<b>Comments:</b>"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:2
+msgid "<b>Folder:</b>"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:3
+msgid "<b>Share name:</b>"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:4 ../data/thunar-page.xml.h:2
+msgid "Allow Guest access"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:5
+msgid "Allow other users to write in this folder"
+msgstr ""
+
+#: ../data/admin-dialog.xml.h:1
+msgid "Thunar - Manage Shared Folders"
+msgstr ""
+
+#: ../data/dialogs.xml.h:2 ../data/thunar-page.xml.h:8
+msgid "Thunar Shares Error"
+msgstr ""
+
+#: ../data/dialogs.xml.h:3 ../data/thunar-page.xml.h:9
+msgid "Thunar Shares Question"
+msgstr ""
+
+#: ../data/dialogs.xml.h:4 ../data/thunar-page.xml.h:10
+msgid ""
+"Thunar needs to add some permissions to your folder in order to share it. Do "
+"you agree?"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:1
+msgid "<b>Folder Sharing</b>"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:3
+msgid "Allow others users to write in this folder"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:5
+msgid "Comments:"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:6
+msgid "Share Name:"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:7
+msgid "Share this folder"
+msgstr ""
+
+#~ msgid "Insufficient permissions to share the folder."
+#~ msgstr "Mangler rettigheter for å dele ut mappen."
+
+#~ msgid "<span color=\"red\"><b>Error:</b> %s</span>"
+#~ msgstr "<span color=\"red\"><b>Feil:</b> %s</span>"
Added: thunar-shares-plugin/trunk/po/ru.po
===================================================================
--- thunar-shares-plugin/trunk/po/ru.po (rev 0)
+++ thunar-shares-plugin/trunk/po/ru.po 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,180 @@
+# Russian translation for thunar-shares
+# Copyright (c) 2008 Rosetta Contributors and Canonical Ltd 2008
+# This file is distributed under the same license as the thunar-shares package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, 2008.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: thunar-shares\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-07-22 20:50-0300\n"
+"PO-Revision-Date: 2008-07-13 12:59+0000\n"
+"Last-Translator: Sergei Zivukov <Unknown>\n"
+"Language-Team: Russian <ru at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2008-07-17 13:36+0000\n"
+"X-Generator: Launchpad (build Unknown)\n"
+
+#: ../libshares/libshares-util.c:111
+#, fuzzy
+msgid "Please, write a name."
+msgstr "Пожалуйста, напишите имя для общего доступа"
+
+#: ../libshares/libshares-util.c:162 ../data/dialogs.xml.h:1
+#: ../data/thunar-page.xml.h:4
+msgid "Cannot modify the share:"
+msgstr ""
+
+#: ../libshares/libshares-util.c:232
+msgid "Error when changing folder permissions."
+msgstr ""
+
+#: ../libshares/shares.c:146
+#, c-format
+msgid "%s %s %s returned with signal %d"
+msgstr "Процесс %s %s %s завершён с сигналом возврата %d"
+
+#: ../libshares/shares.c:155
+#, c-format
+msgid "%s %s %s failed for an unknown reason"
+msgstr "Неизвестная ошибка при запуске %s %s %s"
+
+#: ../libshares/shares.c:175
+#, c-format
+msgid "'net usershare' returned error %d: %s"
+msgstr "Ошибка %d при запуске 'net usershare': %s"
+
+#: ../libshares/shares.c:177
+#, c-format
+msgid "'net usershare' returned error %d"
+msgstr "Ошибка %d при запуске 'net usershare'"
+
+#: ../libshares/shares.c:208
+#, c-format
+msgid "the output of 'net usershare' is not in valid UTF-8 encoding"
+msgstr "вывод 'net usershare' не является действительной строкой UTF-8"
+
+#: ../libshares/shares.c:463 ../libshares/shares.c:636
+#, c-format
+msgid "Failed"
+msgstr "Ошибка"
+
+#: ../libshares/shares.c:571
+#, c-format
+msgid "Samba's testparm returned with signal %d"
+msgstr "Процесс testparm завершён с сигналом возврата %d"
+
+#: ../libshares/shares.c:577
+#, c-format
+msgid "Samba's testparm failed for an unknown reason"
+msgstr "Неизвестная ошибка при запуске testparm"
+
+#: ../libshares/shares.c:592
+#, c-format
+msgid "Samba's testparm returned error %d: %s"
+msgstr "Ошибка %d при запуске testparm: %s"
+
+#: ../libshares/shares.c:594
+#, c-format
+msgid "Samba's testparm returned error %d"
+msgstr "Ошибка %d при запуске testparm"
+
+#: ../libshares/shares.c:701
+#, c-format
+msgid "Cannot remove the share for path %s: that path is not shared"
+msgstr "Не удалось удалить ресурс для папки %s: эта папка не опубликована"
+
+#: ../libshares/shares.c:747
+#, c-format
+msgid ""
+"Cannot change the path of an existing share; please remove the old share "
+"first and add a new one"
+msgstr ""
+"Не удалось изменить путь существущего ресурса; пожалуйста, удалите старый "
+"ресурс и добавьте новый"
+
+#: ../thunar-plugin/tsp-admin-editor.c:174
+msgid "Thunar - Add a share"
+msgstr ""
+
+#: ../thunar-plugin/tsp-admin-editor.c:196
+msgid "Thunar - Edit share"
+msgstr ""
+
+#: ../thunar-plugin/tsp-page.c:229
+msgid "Share"
+msgstr ""
+
+#: ../thunar-plugin/tsp-prefs-provider.c:99
+msgid "Manage shared folders..."
+msgstr ""
+
+#: ../thunar-plugin/tsp-prefs-provider.c:100
+msgid "Add, edit and remove shared folders"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:1
+msgid "<b>Comments:</b>"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:2
+msgid "<b>Folder:</b>"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:3
+msgid "<b>Share name:</b>"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:4 ../data/thunar-page.xml.h:2
+msgid "Allow Guest access"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:5
+msgid "Allow other users to write in this folder"
+msgstr ""
+
+#: ../data/admin-dialog.xml.h:1
+msgid "Thunar - Manage Shared Folders"
+msgstr ""
+
+#: ../data/dialogs.xml.h:2 ../data/thunar-page.xml.h:8
+msgid "Thunar Shares Error"
+msgstr ""
+
+#: ../data/dialogs.xml.h:3 ../data/thunar-page.xml.h:9
+msgid "Thunar Shares Question"
+msgstr ""
+
+#: ../data/dialogs.xml.h:4 ../data/thunar-page.xml.h:10
+msgid ""
+"Thunar needs to add some permissions to your folder in order to share it. Do "
+"you agree?"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:1
+msgid "<b>Folder Sharing</b>"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:3
+msgid "Allow others users to write in this folder"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:5
+msgid "Comments:"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:6
+msgid "Share Name:"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:7
+msgid "Share this folder"
+msgstr ""
+
+#~ msgid "Insufficient permissions to share the folder."
+#~ msgstr "Недостаточно прав для открытия общего доступа к папке."
+
+#~ msgid "<span color=\"red\"><b>Error:</b> %s</span>"
+#~ msgstr "<span color=\"red\"><b>Ошибка:</b> %s</span>"
Added: thunar-shares-plugin/trunk/po/thunar-shares-plugin.pot
===================================================================
--- thunar-shares-plugin/trunk/po/thunar-shares-plugin.pot (rev 0)
+++ thunar-shares-plugin/trunk/po/thunar-shares-plugin.pot 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,170 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-07-22 20:50-0300\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../libshares/libshares-util.c:111
+msgid "Please, write a name."
+msgstr ""
+
+#: ../libshares/libshares-util.c:162 ../data/dialogs.xml.h:1
+#: ../data/thunar-page.xml.h:4
+msgid "Cannot modify the share:"
+msgstr ""
+
+#: ../libshares/libshares-util.c:232
+msgid "Error when changing folder permissions."
+msgstr ""
+
+#: ../libshares/shares.c:146
+#, c-format
+msgid "%s %s %s returned with signal %d"
+msgstr ""
+
+#: ../libshares/shares.c:155
+#, c-format
+msgid "%s %s %s failed for an unknown reason"
+msgstr ""
+
+#: ../libshares/shares.c:175
+#, c-format
+msgid "'net usershare' returned error %d: %s"
+msgstr ""
+
+#: ../libshares/shares.c:177
+#, c-format
+msgid "'net usershare' returned error %d"
+msgstr ""
+
+#: ../libshares/shares.c:208
+#, c-format
+msgid "the output of 'net usershare' is not in valid UTF-8 encoding"
+msgstr ""
+
+#: ../libshares/shares.c:463 ../libshares/shares.c:636
+#, c-format
+msgid "Failed"
+msgstr ""
+
+#: ../libshares/shares.c:571
+#, c-format
+msgid "Samba's testparm returned with signal %d"
+msgstr ""
+
+#: ../libshares/shares.c:577
+#, c-format
+msgid "Samba's testparm failed for an unknown reason"
+msgstr ""
+
+#: ../libshares/shares.c:592
+#, c-format
+msgid "Samba's testparm returned error %d: %s"
+msgstr ""
+
+#: ../libshares/shares.c:594
+#, c-format
+msgid "Samba's testparm returned error %d"
+msgstr ""
+
+#: ../libshares/shares.c:701
+#, c-format
+msgid "Cannot remove the share for path %s: that path is not shared"
+msgstr ""
+
+#: ../libshares/shares.c:747
+#, c-format
+msgid ""
+"Cannot change the path of an existing share; please remove the old share "
+"first and add a new one"
+msgstr ""
+
+#: ../thunar-plugin/tsp-admin-editor.c:174
+msgid "Thunar - Add a share"
+msgstr ""
+
+#: ../thunar-plugin/tsp-admin-editor.c:196
+msgid "Thunar - Edit share"
+msgstr ""
+
+#: ../thunar-plugin/tsp-page.c:229
+msgid "Share"
+msgstr ""
+
+#: ../thunar-plugin/tsp-prefs-provider.c:99
+msgid "Manage shared folders..."
+msgstr ""
+
+#: ../thunar-plugin/tsp-prefs-provider.c:100
+msgid "Add, edit and remove shared folders"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:1
+msgid "<b>Comments:</b>"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:2
+msgid "<b>Folder:</b>"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:3
+msgid "<b>Share name:</b>"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:4 ../data/thunar-page.xml.h:2
+msgid "Allow Guest access"
+msgstr ""
+
+#: ../data/admin-dialog-editor.xml.h:5
+msgid "Allow other users to write in this folder"
+msgstr ""
+
+#: ../data/admin-dialog.xml.h:1
+msgid "Thunar - Manage Shared Folders"
+msgstr ""
+
+#: ../data/dialogs.xml.h:2 ../data/thunar-page.xml.h:8
+msgid "Thunar Shares Error"
+msgstr ""
+
+#: ../data/dialogs.xml.h:3 ../data/thunar-page.xml.h:9
+msgid "Thunar Shares Question"
+msgstr ""
+
+#: ../data/dialogs.xml.h:4 ../data/thunar-page.xml.h:10
+msgid ""
+"Thunar needs to add some permissions to your folder in order to share it. Do "
+"you agree?"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:1
+msgid "<b>Folder Sharing</b>"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:3
+msgid "Allow others users to write in this folder"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:5
+msgid "Comments:"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:6
+msgid "Share Name:"
+msgstr ""
+
+#: ../data/thunar-page.xml.h:7
+msgid "Share this folder"
+msgstr ""
Added: thunar-shares-plugin/trunk/thunar-plugin/Makefile.am
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/Makefile.am (rev 0)
+++ thunar-shares-plugin/trunk/thunar-plugin/Makefile.am 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,42 @@
+
+INCLUDES = \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ -DG_LOG_DOMAIN=\"thunar-shares-plugin\" \
+ -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
+ -DDATADIR=\"$(datadir)\" \
+ $(PLATFORM_CPPFLAGS)
+
+extensionsdir = $(libdir)/thunarx-1
+extensions_LTLIBRARIES = thunar-shares-plugin.la
+
+thunar_shares_plugin_la_SOURCES = \
+ thunar-shares-plugin.c \
+ tsp-page.c tsp-page.h \
+ tsp-admin.c tsp-admin.h \
+ tsp-admin-editor.c tsp-admin-editor.h \
+ tsp-page-provider.c tsp-page-provider.h \
+ tsp-prefs-provider.c tsp-prefs-provider.h
+
+thunar_shares_plugin_la_CFLAGS = \
+ $(PLATFORM_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(THUNARX_CFLAGS) \
+ $(THUNARVFS_CFLAGS) \
+ $(WARN_CFLAGS)
+
+thunar_shares_plugin_la_LDFLAGS = \
+ -avoid-version \
+ -export-dynamic \
+ -module \
+ $(GTK_LIBS) \
+ $(GLIB_LIBS) \
+ $(THUNARX_LIBS) \
+ $(THUNARVFS_LIBS) \
+ $(PLATFORM_LDFLAGS)
+
+thunar_shares_plugin_la_LIBADD= \
+ $(top_builddir)/libshares/libshares.la
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
Added: thunar-shares-plugin/trunk/thunar-plugin/thunar-shares-plugin.c
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/thunar-shares-plugin.c (rev 0)
+++ thunar-shares-plugin/trunk/thunar-plugin/thunar-shares-plugin.c 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,80 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+
+#include "tsp-page-provider.h"
+#include "tsp-prefs-provider.h"
+#include "tsp-page.h"
+
+static GType type_list[2];
+
+G_MODULE_EXPORT void
+thunar_extension_initialize (ThunarxProviderPlugin *plugin)
+{
+ const gchar *mismatch;
+
+ /* verify that the thunarx versions are compatible */
+ mismatch = thunarx_check_version (THUNARX_MAJOR_VERSION, THUNARX_MINOR_VERSION, THUNARX_MICRO_VERSION);
+ if (G_UNLIKELY (mismatch != NULL))
+ {
+ g_warning ("Version mismatch: %s", mismatch);
+ return;
+ }
+
+ /* setup i18n support */
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+
+#ifdef G_ENABLE_DEBUG
+ g_message ("Initializing thunar-shares-plugin extension");
+#endif
+
+ /* register the types provided by this plugin */
+ tsp_page_register_type (plugin);
+ tsp_provider_register_type (plugin);
+ tsp_preferences_register_type (plugin);
+
+ /* setup the plugin provider type list */
+ type_list[0] = TSP_TYPE_PROVIDER;
+ type_list[1] = TSP_TYPE_PREFERENCES;
+}
+
+G_MODULE_EXPORT void
+thunar_extension_shutdown (void)
+{
+#ifdef G_ENABLE_DEBUG
+ g_message ("Shutting down thunar-archive-plugin extension");
+#endif
+}
+
+G_MODULE_EXPORT void
+thunar_extension_list_types (const GType **types,
+ gint *n_types)
+{
+ *types = type_list;
+ *n_types = G_N_ELEMENTS (type_list);
+}
Added: thunar-shares-plugin/trunk/thunar-plugin/tsp-admin-editor.c
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/tsp-admin-editor.c (rev 0)
+++ thunar-shares-plugin/trunk/thunar-plugin/tsp-admin-editor.c 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,220 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+#include <glib/gi18n.h>
+
+#include <libshares/shares.h>
+#include <libshares/libshares-xml.h>
+#include <libshares/libshares-util.h>
+
+#include "tsp-admin.h"
+#include "tsp-admin-editor.h"
+
+#define XML_FILE "admin-dialog-editor.xml"
+
+typedef struct {
+ GtkWidget *dialog;
+
+ GtkWidget *share_folder;
+ GtkWidget *share_name;
+ GtkWidget *share_comments;
+ GtkWidget *share_write;
+ GtkWidget *share_guest;
+
+ /* Widgets to hide, when edit */
+ GtkWidget *share_label1;
+ GtkWidget *share_hbox1;
+
+ gpointer admin;
+} TspAdminEdit;
+
+static void editor_response_cb (GtkWidget *widget,
+ gint response,
+ TspAdminEdit *editor);
+
+static void editor_destroy_cb (GtkWidget *widget,
+ TspAdminEdit *editor);
+
+static void editor_set_values (const gchar *path,
+ TspAdminEdit *editor);
+
+static void
+editor_response_cb (GtkWidget *widget,
+ gint response,
+ TspAdminEdit *editor)
+{
+ if (response == GTK_RESPONSE_OK)
+ {
+ /* Save changes */
+ const gchar *comments;
+ const gchar *name;
+ ShareInfo *share_info;
+ gchar *local_file;
+ gboolean is_writable;
+ gboolean guests_ok;
+
+ /* Share file */
+ local_file = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (editor->share_folder));
+ comments = gtk_entry_get_text (GTK_ENTRY (editor->share_comments));
+ name = gtk_entry_get_text (GTK_ENTRY (editor->share_name));
+ is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->share_write));
+ guests_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->share_guest));
+
+ share_info = tsp_shares_share (local_file, name, comments,
+ is_writable, guests_ok);
+ if (share_info)
+ {
+ shares_free_share_info (share_info);
+ } else {
+ /* Dunno destroy the dialog */
+ return;
+ }
+
+ /* Reload share list */
+ tsp_admin_load_shares (editor->admin);
+
+ g_free (local_file);
+ }
+ gtk_widget_destroy (widget);
+}
+
+static void
+editor_destroy_cb (GtkWidget *widget,
+ TspAdminEdit *editor)
+{
+ g_free (editor);
+}
+
+/* Displays the main admin dialog */
+void
+tsp_admin_editor_dialog_show (GtkWindow *parent,
+ const gchar *path,
+ gpointer admin)
+{
+ static TspAdminEdit *editor;
+ GtkBuilder *ui;
+
+ if (editor)
+ {
+ /* Update values */
+ editor_set_values (path, editor);
+
+ /* Bring the dialog to front */
+ gtk_window_present (GTK_WINDOW (editor->dialog));
+ return;
+ }
+
+ editor = g_new0 (TspAdminEdit, 1);
+ editor->admin = admin;
+
+ /* Get widgets */
+ ui = tsp_xml_get_file (XML_FILE,
+ "shares_editor", &editor->dialog,
+ "share_folder", &editor->share_folder,
+ "share_name", &editor->share_name,
+ "share_comments", &editor->share_comments,
+ "share_write", &editor->share_write,
+ "share_guest", &editor->share_guest,
+ "share_hbox1", &editor->share_hbox1,
+ "share_label1", &editor->share_label1,
+ NULL);
+
+ /* Connect signals */
+ tsp_xml_connect (ui, editor,
+ "shares_editor", "destroy", editor_destroy_cb,
+ "shares_editor", "response", editor_response_cb,
+ NULL);
+
+ g_object_unref (ui);
+
+ g_object_add_weak_pointer (G_OBJECT (editor->dialog), (gpointer) &editor);
+
+ /* Update values */
+ editor_set_values (path, editor);
+
+ /* Show the dialog */
+ gtk_window_set_transient_for (GTK_WINDOW (editor->dialog), parent);
+ gtk_widget_show (editor->dialog);
+}
+
+/* Updates the dialog to edit/add actions */
+static void
+editor_set_values (const gchar *path,
+ TspAdminEdit *editor)
+{
+ if (G_STR_EMPTY (path)){
+ const gchar *home_dir;
+
+ gtk_window_set_title (GTK_WINDOW (editor->dialog),
+ _("Thunar - Add a share"));
+
+ home_dir = g_get_home_dir ();
+
+ /* Show folders chooser */
+ gtk_widget_show (editor->share_hbox1);
+ gtk_widget_show (editor->share_label1);
+
+ /* Reset values */
+ gtk_file_chooser_set_current_folder (
+ GTK_FILE_CHOOSER (editor->share_folder), home_dir);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (editor->share_write), FALSE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (editor->share_guest), FALSE);
+ gtk_entry_set_text (
+ GTK_ENTRY (editor->share_name), "");
+ gtk_entry_set_text (
+ GTK_ENTRY (editor->share_comments), "");
+
+ } else {
+ gtk_window_set_title (GTK_WINDOW (editor->dialog),
+ _("Thunar - Edit share"));
+ /* Load values */
+ ShareInfo *share_info;
+ gboolean result;
+
+ /* Hide folders chooser */
+ gtk_widget_hide (editor->share_hbox1);
+ gtk_widget_hide (editor->share_label1);
+
+ result = shares_get_share_info_for_path (path, &share_info, NULL);
+ if (share_info)
+ {
+ gtk_file_chooser_set_current_folder (
+ GTK_FILE_CHOOSER (editor->share_folder), path);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (editor->share_write), share_info->is_writable);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (editor->share_guest), share_info->guest_ok);
+ gtk_entry_set_text (
+ GTK_ENTRY (editor->share_name), share_info->share_name);
+ gtk_entry_set_text (
+ GTK_ENTRY (editor->share_comments), share_info->comment);
+
+ shares_free_share_info (share_info);
+ }
+ }
+}
Added: thunar-shares-plugin/trunk/thunar-plugin/tsp-admin-editor.h
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/tsp-admin-editor.h (rev 0)
+++ thunar-shares-plugin/trunk/thunar-plugin/tsp-admin-editor.h 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,35 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef __TSP_ADMIN_EDITOR_H__
+#define __TSP_ADMIN_EDITOR_H__
+
+#include <gtk/gtkwindow.h>
+
+G_BEGIN_DECLS;
+
+void tsp_admin_editor_dialog_show (GtkWindow *parent,
+ const gchar *path,
+ gpointer admin);
+
+G_END_DECLS;
+
+#endif /* __TSP_ADMIN_EDITOR_H__ */
Added: thunar-shares-plugin/trunk/thunar-plugin/tsp-admin.c
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/tsp-admin.c (rev 0)
+++ thunar-shares-plugin/trunk/thunar-plugin/tsp-admin.c 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,262 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+
+#include <libshares/shares.h>
+#include <libshares/libshares-xml.h>
+#include <libshares/libshares-util.h>
+
+#include "tsp-admin.h"
+#include "tsp-admin-editor.h"
+
+#define XML_FILE "admin-dialog.xml"
+
+#define SHARES_ICON_NAME "gnome-fs-share"
+
+enum {
+ TSP_ADMIN_COL_ICON = 0,
+ TSP_ADMIN_COL_TXT,
+ TSP_ADMIN_COL_PATH
+};
+
+typedef struct {
+ GtkWidget *dialog;
+
+ GtkWidget *share_list;
+ GtkWidget *share_edit;
+ GtkWidget *share_remove;
+} TspAdmin;
+
+static void admin_response_cb (GtkWidget *widget,
+ gint response,
+ TspAdmin *admin);
+
+static void admin_destroy_cb (GtkWidget *widget,
+ TspAdmin *admin);
+
+static void admin_selection_cb (GtkTreeSelection *selection,
+ TspAdmin *admin);
+
+static void admin_add_cb (GtkButton *button,
+ TspAdmin *admin);
+static void admin_edit_cb (GtkButton *button,
+ TspAdmin *admin);
+static void admin_remove_cb (GtkButton *button,
+ TspAdmin *admin);
+
+static void admin_shares_foreach (gpointer data,
+ gpointer user_data);
+
+static void
+admin_response_cb (GtkWidget *widget,
+ gint response,
+ TspAdmin *admin)
+{
+ if (response == GTK_RESPONSE_OK)
+ {
+ /* Bleh.. */
+ }
+ gtk_widget_destroy (widget);
+}
+
+static void
+admin_destroy_cb (GtkWidget *widget,
+ TspAdmin *admin)
+{
+ g_free (admin);
+}
+
+/* Adding a shared folder */
+static void
+admin_add_cb (GtkButton *button,
+ TspAdmin *admin)
+{
+ tsp_admin_editor_dialog_show (GTK_WINDOW (admin->dialog), NULL, admin);
+}
+
+/* Editing a shared folder */
+static void
+admin_edit_cb (GtkButton *button,
+ TspAdmin *admin)
+{
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *path;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (admin->share_list));
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ {
+ gtk_tree_model_get (model, &iter, TSP_ADMIN_COL_PATH, &path, -1);
+
+ /* Run the editor dialog */
+ tsp_admin_editor_dialog_show (GTK_WINDOW (admin->dialog), path, admin);
+
+ g_free (path);
+ }
+}
+
+/* Removing a shared folder */
+static void
+admin_remove_cb (GtkButton *button,
+ TspAdmin *admin)
+{
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *path;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (admin->share_list));
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ {
+ gtk_tree_model_get (model, &iter, TSP_ADMIN_COL_PATH, &path, -1);
+
+ /* Remove from shares */
+ if (tsp_shares_unshare (path)){
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+ }
+
+ g_free (path);
+ }
+}
+
+/* Changing the folder selection */
+static void
+admin_selection_cb (GtkTreeSelection *selection,
+ TspAdmin *admin)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean has_selection;
+
+ has_selection = gtk_tree_selection_get_selected (selection, &model, &iter);
+
+ /* Update buttons sensitivity */
+ gtk_widget_set_sensitive (admin->share_edit, has_selection);
+ gtk_widget_set_sensitive (admin->share_remove, has_selection);
+}
+
+/* Add a share to the list view */
+static void
+admin_shares_foreach (gpointer data,
+ gpointer user_data)
+{
+ GtkListStore *store = GTK_LIST_STORE (user_data);
+ GtkTreeIter iter;
+ ShareInfo *share = (ShareInfo *)data;
+ gchar *text_string;
+
+ gtk_list_store_append (store, &iter);
+
+ text_string = g_strdup_printf ("<b>%s</b>\n<small>%s</small>",
+ share->share_name, share->path);
+
+ gtk_list_store_set (store, &iter,
+ TSP_ADMIN_COL_ICON, SHARES_ICON_NAME,
+ TSP_ADMIN_COL_TXT, text_string,
+ TSP_ADMIN_COL_PATH, share->path,
+ -1);
+
+ g_free (text_string);
+}
+
+/* (Re)loads the shares list */
+void
+tsp_admin_load_shares (gpointer data)
+{
+ TspAdmin *admin = (TspAdmin *)data;
+ GSList *info_list = NULL;
+
+ shares_get_share_info_list (&info_list, NULL);
+
+ if (info_list)
+ {
+ GtkTreeModel *model;
+
+ /* Reset the list */
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (admin->share_list));
+ gtk_list_store_clear (GTK_LIST_STORE (model));
+
+ g_slist_foreach (info_list, admin_shares_foreach, model);
+
+ shares_free_share_info_list (info_list);
+ }
+}
+
+/* Displays the main admin dialog */
+void
+tsp_admin_dialog_show (GtkWindow *parent)
+{
+ GtkTreeSelection *selection;
+ static TspAdmin *admin;
+ GtkBuilder *ui;
+
+ if (admin)
+ {
+ /* Bring the dialog to front */
+ gtk_window_present (GTK_WINDOW (admin->dialog));
+ return;
+ }
+
+ admin = g_new0 (TspAdmin, 1);
+
+ /* Get widgets */
+ ui = tsp_xml_get_file (XML_FILE,
+ "shares_admin", &admin->dialog,
+ "share_list", &admin->share_list,
+ "share_edit", &admin->share_edit,
+ "share_remove", &admin->share_remove,
+ NULL);
+
+ /* Connect signals */
+ tsp_xml_connect (ui, admin,
+ "shares_admin", "destroy", admin_destroy_cb,
+ "shares_admin", "response", admin_response_cb,
+ "share_add", "clicked", admin_add_cb,
+ "share_edit", "clicked", admin_edit_cb,
+ "share_remove", "clicked", admin_remove_cb,
+ NULL);
+
+ g_object_unref (ui);
+
+ g_object_add_weak_pointer (G_OBJECT (admin->dialog), (gpointer) &admin);
+
+ /* Disable edit and remove buttons */
+ gtk_widget_set_sensitive (admin->share_edit, FALSE);
+ gtk_widget_set_sensitive (admin->share_remove, FALSE);
+
+ /* Load current shares */
+ tsp_admin_load_shares (admin);
+
+ /* Setup selection changes */
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (admin->share_list));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+ g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (admin_selection_cb), admin);
+
+ /* Show the dialog */
+ gtk_window_set_transient_for (GTK_WINDOW (admin->dialog), parent);
+ gtk_widget_show (admin->dialog);
+}
Added: thunar-shares-plugin/trunk/thunar-plugin/tsp-admin.h
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/tsp-admin.h (rev 0)
+++ thunar-shares-plugin/trunk/thunar-plugin/tsp-admin.h 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,34 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef __TSP_ADMIN_H__
+#define __TSP_ADMIN_H__
+
+#include <gtk/gtkwindow.h>
+
+G_BEGIN_DECLS;
+
+void tsp_admin_dialog_show (GtkWindow *parent);
+void tsp_admin_load_shares (gpointer data);
+
+G_END_DECLS;
+
+#endif /* __TSP_ADMIN_H__ */
Added: thunar-shares-plugin/trunk/thunar-plugin/tsp-page-provider.c
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/tsp-page-provider.c (rev 0)
+++ thunar-shares-plugin/trunk/thunar-plugin/tsp-page-provider.c 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,94 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <thunarx/thunarx.h>
+
+#include "tsp-page-provider.h"
+#include "tsp-page.h"
+
+static void tsp_provider_class_init (TspProviderClass *klass);
+static void tsp_provider_page_provider_init (ThunarxPropertyPageProviderIface *iface);
+static void tsp_provider_init (TspProvider *tsp_provider);
+
+static void tsp_provider_finalize (GObject *object);
+static GList *tsp_provider_get_pages (ThunarxPropertyPageProvider *provider,
+ GList *files);
+
+struct _TspProviderClass
+{
+ GObjectClass __parent__;
+};
+
+struct _TspProvider
+{
+ GObject __parent__;
+};
+
+THUNARX_DEFINE_TYPE_WITH_CODE (TspProvider,
+ tsp_provider,
+ G_TYPE_OBJECT,
+ THUNARX_IMPLEMENT_INTERFACE (THUNARX_TYPE_PROPERTY_PAGE_PROVIDER,
+ tsp_provider_page_provider_init));
+
+static void
+tsp_provider_class_init (TspProviderClass *klass)
+{
+ GObjectClass *gobject_class;
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = tsp_provider_finalize;
+}
+
+static void
+tsp_provider_init (TspProvider *tsp_provider)
+{
+
+}
+
+static void
+tsp_provider_page_provider_init (ThunarxPropertyPageProviderIface *iface)
+{
+ iface->get_pages = tsp_provider_get_pages;
+}
+
+static void
+tsp_provider_finalize (GObject *object)
+{
+ //TspProvider *tsp_provider = TSP_PROVIDER (object);
+
+ (*G_OBJECT_CLASS (tsp_provider_parent_class)->finalize) (object);
+}
+
+static GList*
+tsp_provider_get_pages (ThunarxPropertyPageProvider *property_page_provider,
+ GList *files)
+{
+ if (g_list_length (files) != 1){
+ return NULL;
+ } else if (!thunarx_file_info_is_directory (THUNARX_FILE_INFO (files->data))){
+ return NULL;
+ }
+
+ return g_list_append (NULL, (gpointer)tsp_page_new (files->data));
+}
Added: thunar-shares-plugin/trunk/thunar-plugin/tsp-page-provider.h
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/tsp-page-provider.h (rev 0)
+++ thunar-shares-plugin/trunk/thunar-plugin/tsp-page-provider.h 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,43 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __TSP_PROVIDER_H__
+#define __TSP_PROVIDER_H__
+
+#include <thunarx/thunarx.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _TspProviderClass TspProviderClass;
+typedef struct _TspProvider TspProvider;
+
+#define TSP_TYPE_PROVIDER (tsp_provider_get_type ())
+#define TSP_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TSP_TYPE_PROVIDER, TspProvider))
+#define TSP_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TSP_TYPE_PROVIDER, TspProviderClass))
+#define TSP_IS_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TSP_TYPE_PROVIDER))
+#define TSP_IS_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TSP_TYPE_PROVIDER))
+#define TSP_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TSP_TYPE_PROVIDER, TspProviderClass))
+
+GType tsp_provider_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
+void tsp_provider_register_type (ThunarxProviderPlugin *plugin) G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* __TSP_PROVIDER_H__ */
Added: thunar-shares-plugin/trunk/thunar-plugin/tsp-page.c
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/tsp-page.c (rev 0)
+++ thunar-shares-plugin/trunk/thunar-plugin/tsp-page.c 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,493 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+#include <thunar-vfs/thunar-vfs.h>
+
+#include <libshares/shares.h>
+#include <libshares/libshares-xml.h>
+#include <libshares/libshares-util.h>
+
+#include "tsp-page.h"
+
+#define XML_FILE "thunar-page.xml"
+
+/* Property identifiers */
+enum
+{
+ PROP_0,
+ PROP_FILE,
+};
+
+static void tsp_page_class_init (TspPageClass *klass);
+static void tsp_page_init (TspPage *tsp_page);
+static void tsp_page_finalize (GObject *object);
+static void tsp_page_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void tsp_page_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void tsp_page_file_changed (ThunarxFileInfo *file,
+ TspPage *tsp_page);
+static void tsp_page_share_toggled (GtkToggleButton *togglebutton,
+ TspPage *tsp_page);
+static void tsp_page_write_toggled (GtkToggleButton *togglebutton,
+ TspPage *tsp_page);
+static void tsp_page_guest_toggled (GtkToggleButton *togglebutton,
+ TspPage *tsp_page);
+static void tsp_page_apply_clicked (GtkButton *button,
+ TspPage *tsp_page);
+static void tsp_page_name_changed (GtkEditable *editable,
+ TspPage *tsp_page);
+static void tsp_page_cmt_changed (GtkEditable *editable,
+ TspPage *tsp_page);
+static void tsp_page_sensibility (TspPage *tsp_page,
+ gboolean sens);
+
+static gboolean tsp_check_changes (TspPage *page);
+
+static void tsp_update_default (TspPage *page,
+ ShareInfo *info);
+
+struct _TspPageClass
+{
+ ThunarxPropertyPageClass __parent__;
+};
+
+struct _TspPage
+{
+ ThunarxPropertyPage __parent__;
+ ThunarxFileInfo *file;
+
+ GtkWidget *cb_share_folder;
+ GtkWidget *entry_share_name;
+ GtkWidget *cb_share_write;
+ GtkWidget *entry_share_comments;
+ GtkWidget *label_comments;
+ GtkWidget *label_name;
+ GtkWidget *button_apply;
+ GtkWidget *cb_share_guest;
+ GtkWidget *label_status;
+
+ /* Default values for the file */
+ gboolean is_shared;
+ gboolean can_write;
+ gboolean can_guests;
+ gchar *share_name;
+ gchar *share_comment;
+};
+
+/* implements the tsp_page_get_type() and tsp_page_register_type() functions */
+THUNARX_DEFINE_TYPE (TspPage, tsp_page, THUNARX_TYPE_PROPERTY_PAGE);
+
+static void
+tsp_page_class_init (TspPageClass *klass)
+{
+ GObjectClass *gobject_class;
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = tsp_page_finalize;
+ gobject_class->get_property = tsp_page_get_property;
+ gobject_class->set_property = tsp_page_set_property;
+
+ /**
+ * TspPage:file:
+ *
+ * The ThunarxFileInfo displayed by this TspPage.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_FILE,
+ g_param_spec_object ("file", "file", "file",
+ THUNARX_TYPE_FILE_INFO,
+ G_PARAM_READWRITE));
+}
+
+static void
+tsp_page_init (TspPage *tsp_page)
+{
+ GtkBuilder *ui;
+ GtkWidget *vbox;
+
+ /* Grab the widgets */
+ ui = tsp_xml_get_file (XML_FILE,
+ "cb_share_folder", &tsp_page->cb_share_folder,
+ "label_name", &tsp_page->label_name,
+ "entry_share_name", &tsp_page->entry_share_name,
+ "cb_share_write", &tsp_page->cb_share_write,
+ "label_comments", &tsp_page->label_comments,
+ "entry_share_comments", &tsp_page->entry_share_comments,
+ "button_apply", &tsp_page->button_apply,
+ "cb_share_guest", &tsp_page->cb_share_guest,
+ "label_status", &tsp_page->label_status,
+ "vbox1", &vbox,
+ NULL);
+
+ /* Connect the signals */
+ tsp_xml_connect (ui, tsp_page,
+ "cb_share_folder", "toggled", tsp_page_share_toggled,
+ "cb_share_write", "toggled", tsp_page_write_toggled,
+ "cb_share_guest", "toggled", tsp_page_guest_toggled,
+ "entry_share_comments", "changed", tsp_page_cmt_changed,
+ "entry_share_name", "changed", tsp_page_name_changed,
+ "button_apply", "clicked", tsp_page_apply_clicked,
+ NULL);
+
+ gtk_container_add (GTK_CONTAINER (tsp_page), vbox);
+ gtk_container_set_border_width (GTK_CONTAINER (tsp_page), 5);
+ gtk_widget_show_all (vbox);
+
+ g_object_unref (ui);
+}
+
+static void
+tsp_page_finalize (GObject *object)
+{
+ TspPage *tsp_page = TSP_PAGE (object);
+
+ /* disconnect from the file */
+ tsp_page_set_file (tsp_page, NULL);
+
+ /* Free some memory */
+ if (!G_STR_EMPTY (tsp_page->share_name))
+ g_free (tsp_page->share_name);
+
+ if (!G_STR_EMPTY (tsp_page->share_comment))
+ g_free (tsp_page->share_comment);
+
+ (*G_OBJECT_CLASS (tsp_page_parent_class)->finalize) (object);
+}
+
+static void
+tsp_page_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ TspPage *tsp_page = TSP_PAGE (object);
+
+ switch (prop_id)
+ {
+ case PROP_FILE:
+ g_value_set_object (value, tsp_page_get_file (tsp_page));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+tsp_page_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ TspPage *tsp_page = TSP_PAGE (object);
+
+ switch (prop_id)
+ {
+ case PROP_FILE:
+ tsp_page_set_file (tsp_page, g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+GtkWidget*
+tsp_page_new (ThunarxFileInfo *file)
+{
+ TspPage *page = g_object_new (TSP_TYPE_PAGE, "file", file, NULL);
+
+ thunarx_property_page_set_label (THUNARX_PROPERTY_PAGE (page), _("Share"));
+
+ return GTK_WIDGET (page);
+}
+
+ThunarxFileInfo*
+tsp_page_get_file (TspPage *tsp_page)
+{
+ g_return_val_if_fail (TSP_IS_PAGE (tsp_page), NULL);
+ return tsp_page->file;
+}
+
+void
+tsp_page_set_file (TspPage *tsp_page,
+ ThunarxFileInfo *file)
+{
+ g_return_if_fail (TSP_IS_PAGE (tsp_page));
+ g_return_if_fail (file == NULL || THUNARX_IS_FILE_INFO (file));
+
+ if (tsp_page->file != NULL)
+ {
+ g_signal_handlers_disconnect_by_func (tsp_page->file, tsp_page_file_changed, tsp_page);
+ g_object_unref (G_OBJECT (tsp_page->file));
+ }
+
+ tsp_page->file = file;
+
+ if (file != NULL)
+ {
+ g_object_ref (file);
+ tsp_page_file_changed (file, tsp_page);
+ g_signal_connect (file, "changed", G_CALLBACK (tsp_page_file_changed), tsp_page);
+ }
+
+ g_object_notify (G_OBJECT (tsp_page), "file");
+}
+
+/* File changed */
+static void
+tsp_page_file_changed (ThunarxFileInfo *file,
+ TspPage *tsp_page)
+{
+ ShareInfo *share_info;
+ gboolean result;
+ gchar *uri, *file_local;
+
+ /* Load share info */
+ uri = thunarx_file_info_get_uri (tsp_page->file);
+ file_local = g_filename_from_uri (uri, NULL, NULL);
+
+ result = shares_get_share_info_for_path (file_local, &share_info, NULL);
+ if (share_info)
+ {
+ tsp_page_sensibility (tsp_page, TRUE);
+
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (tsp_page->cb_share_folder), TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (tsp_page->cb_share_write), share_info->is_writable);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (tsp_page->cb_share_guest), share_info->guest_ok);
+ gtk_entry_set_text (
+ GTK_ENTRY (tsp_page->entry_share_name), share_info->share_name);
+ gtk_entry_set_text (
+ GTK_ENTRY (tsp_page->entry_share_comments), share_info->comment);
+
+ tsp_update_default (tsp_page, share_info);
+ shares_free_share_info (share_info);
+ } else {
+ tsp_update_default (tsp_page, NULL);
+ tsp_page_sensibility (tsp_page, FALSE);
+ }
+
+ g_free (uri);
+ g_free (file_local);
+}
+
+/* Share name changed */
+static void
+tsp_page_name_changed (GtkEditable *editable,
+ TspPage *tsp_page)
+{
+ tsp_check_changes (tsp_page);
+}
+
+/* Share comment changed */
+static void
+tsp_page_cmt_changed (GtkEditable *editable,
+ TspPage *tsp_page)
+{
+ tsp_check_changes (tsp_page);
+}
+
+/* Allow users to write in the folder toggled */
+static void
+tsp_page_write_toggled (GtkToggleButton *togglebutton,
+ TspPage *tsp_page)
+{
+ tsp_check_changes (tsp_page);
+}
+
+/* Allow guests access toggled */
+static void
+tsp_page_guest_toggled (GtkToggleButton *togglebutton,
+ TspPage *tsp_page)
+{
+ tsp_check_changes (tsp_page);
+}
+
+/* Share folder toggled */
+static void
+tsp_page_share_toggled (GtkToggleButton *togglebutton,
+ TspPage *tsp_page)
+{
+ gboolean share = gtk_toggle_button_get_active (togglebutton);
+
+ /* Toggle sharing */
+ tsp_page_sensibility (tsp_page, share);
+
+ /* Sharing (?) */
+ if (share)
+ {
+ const gchar *defauln;
+ gchar *name_utf8;
+ gchar *name;
+
+ /* Check if we alredy had a name for it */
+ defauln = gtk_entry_get_text (GTK_ENTRY (tsp_page->entry_share_name));
+ if (G_STR_EMPTY (defauln))
+ {
+ name = thunarx_file_info_get_name (tsp_page->file);
+ name_utf8 = g_filename_display_name (name);
+
+ /* First sharename is the filename */
+ gtk_entry_set_text (GTK_ENTRY (tsp_page->entry_share_name), name_utf8);
+
+ g_free (name_utf8);
+ g_free (name);
+ }
+ }
+
+ tsp_check_changes (tsp_page);
+}
+
+/* Apply button clicked */
+static void
+tsp_page_apply_clicked (GtkButton *button,
+ TspPage *tsp_page)
+{
+ gboolean share;
+ gchar *local_file;
+
+ share = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tsp_page->cb_share_folder));
+ local_file = tsp_get_local_file (tsp_page->file);
+
+ if (share){
+ const gchar *comments;
+ const gchar *name;
+ ShareInfo *share_info;
+ gboolean is_writable;
+ gboolean guests_ok;
+
+ /* Share file */
+ comments = gtk_entry_get_text (GTK_ENTRY (tsp_page->entry_share_comments));
+ name = gtk_entry_get_text (GTK_ENTRY (tsp_page->entry_share_name));
+ is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tsp_page->cb_share_write));
+ guests_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tsp_page->cb_share_guest));
+
+ share_info = tsp_shares_share (local_file, name, comments,
+ is_writable, guests_ok);
+ if (share_info)
+ {
+ tsp_update_default (tsp_page, share_info);
+ shares_free_share_info (share_info);
+ }
+ } else {
+ /* Un-share file */
+ if (tsp_shares_unshare (local_file)){
+ tsp_update_default (tsp_page, NULL);
+ }
+ }
+ g_free (local_file);
+}
+
+/* Disable ore enable widgets when 'share folder' is toggled */
+static void
+tsp_page_sensibility (TspPage *tsp_page,
+ gboolean sens)
+{
+ gtk_widget_set_sensitive (GTK_WIDGET (tsp_page->entry_share_name), sens);
+ gtk_widget_set_sensitive (GTK_WIDGET (tsp_page->cb_share_write), sens);
+ gtk_widget_set_sensitive (GTK_WIDGET (tsp_page->entry_share_comments), sens);
+ gtk_widget_set_sensitive (GTK_WIDGET (tsp_page->label_name), sens);
+ gtk_widget_set_sensitive (GTK_WIDGET (tsp_page->label_comments), sens);
+ gtk_widget_set_sensitive (GTK_WIDGET (tsp_page->label_comments), sens);
+ gtk_widget_set_sensitive (GTK_WIDGET (tsp_page->cb_share_guest), sens);
+}
+
+/* Checks if the settings of the current file has been changed */
+static
+gboolean tsp_check_changes (TspPage *page)
+{
+ const gchar *name, *comment;
+ gboolean shared, guests, write;
+ gboolean result = FALSE;
+
+ /* Get the info */
+ shared = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->cb_share_folder));
+ guests = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->cb_share_guest));
+ write = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->cb_share_write));
+ name = gtk_entry_get_text (GTK_ENTRY (page->entry_share_name));
+ comment = gtk_entry_get_text (GTK_ENTRY (page->entry_share_comments));
+
+ /* Shared? */
+ if (page->is_shared != shared){
+ result = TRUE;
+ } else if (!page->is_shared && !shared){
+ result = FALSE;
+ } else if ((page->can_write != write) ||
+ (page->can_guests != guests) ||
+ (!tsp_str_equal (page->share_comment, comment)) ||
+ (!tsp_str_equal (page->share_name, name))){
+ result = TRUE;
+ }
+
+ /* Update button */
+ gtk_widget_set_sensitive (page->button_apply, result);
+
+ return result;
+}
+
+/* Sets the default settings for the current file */
+static void
+tsp_update_default (TspPage *page,
+ ShareInfo *info)
+{
+ if (!G_STR_EMPTY (page->share_name))
+ g_free (page->share_name);
+
+ if (!G_STR_EMPTY (page->share_comment))
+ g_free (page->share_comment);
+
+ page->share_name = NULL;
+ page->share_comment = NULL;
+
+ if (!info){
+ /* Not shared info */
+ page->is_shared = FALSE;
+ page->can_write = FALSE;
+ page->can_guests = FALSE;
+ } else {
+ /* Shared info */
+ page->is_shared = TRUE;
+ page->can_write = info->is_writable;
+ page->can_guests = info->guest_ok;
+
+ if (!G_STR_EMPTY (info->share_name))
+ page->share_name = g_strdup (info->share_name);
+
+ if (!G_STR_EMPTY (info->comment))
+ page->share_comment = g_strdup (info->comment);
+ }
+
+ /* Disable button */
+ gtk_widget_set_sensitive (page->button_apply, FALSE);
+}
Added: thunar-shares-plugin/trunk/thunar-plugin/tsp-page.h
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/tsp-page.h (rev 0)
+++ thunar-shares-plugin/trunk/thunar-plugin/tsp-page.h 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,50 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __TSP_PAGE_H__
+#define __TSP_PAGE_H__
+
+#include <thunarx/thunarx.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _TspPageClass TspPageClass;
+typedef struct _TspPage TspPage;
+
+#define TSP_TYPE_PAGE (tsp_page_get_type ())
+#define TSP_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TSP_TYPE_PAGE, TspPage))
+#define TSP_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TSP_TYPE_PAGE, TspPageClass))
+#define TSP_IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TSP_TYPE_PAGE))
+#define TSP_IS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TSP_TYPE_PAGE))
+#define TSP_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TSP_TYPE_PAGE, TspPageClass))
+
+/* these two functions are implemented automatically by the THUNARX_DEFINE_TYPE macro */
+GType tsp_page_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
+void tsp_page_register_type (ThunarxProviderPlugin *plugin) G_GNUC_INTERNAL;
+
+GtkWidget *tsp_page_new (ThunarxFileInfo *file) G_GNUC_INTERNAL G_GNUC_MALLOC;
+
+ThunarxFileInfo *tsp_page_get_file (TspPage *tsp_page) G_GNUC_INTERNAL;
+void tsp_page_set_file (TspPage *tsp_page,
+ ThunarxFileInfo *file) G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* !__TSP_PAGE_H__ */
Added: thunar-shares-plugin/trunk/thunar-plugin/tsp-prefs-provider.c
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/tsp-prefs-provider.c (rev 0)
+++ thunar-shares-plugin/trunk/thunar-plugin/tsp-prefs-provider.c 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,116 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <thunarx/thunarx.h>
+#include <thunar-vfs/thunar-vfs.h>
+
+#include "tsp-prefs-provider.h"
+#include "tsp-admin.h"
+
+static void tsp_preferences_class_init (TspPreferencesClass *klass);
+static void tsp_preferences_provider_init (ThunarxPreferencesProviderIface *iface);
+static void tsp_preferences_init (TspPreferences *tsp_preferences);
+
+static void tsp_preferences_finalize (GObject *object);
+
+static GList* tsp_preferences_get_actions (ThunarxPreferencesProvider *provider,
+ GtkWidget *window);
+
+static void tsp_shares_admin_activated (GtkWindow *window);
+
+struct _TspPreferencesClass
+{
+ GObjectClass __parent__;
+};
+
+struct _TspPreferences
+{
+ GObject __parent__;
+};
+
+THUNARX_DEFINE_TYPE_WITH_CODE (TspPreferences,
+ tsp_preferences,
+ G_TYPE_OBJECT,
+ THUNARX_IMPLEMENT_INTERFACE (THUNARX_TYPE_PREFERENCES_PROVIDER,
+ tsp_preferences_provider_init));
+
+static void
+tsp_preferences_class_init (TspPreferencesClass *klass)
+{
+ GObjectClass *gobject_class;
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = tsp_preferences_finalize;
+}
+
+static void
+tsp_preferences_init (TspPreferences *tsp_preferences)
+{
+ /* Bleh.. */
+}
+
+static void
+tsp_preferences_provider_init (ThunarxPreferencesProviderIface *iface)
+{
+ iface->get_actions = tsp_preferences_get_actions;
+}
+
+static void
+tsp_preferences_finalize (GObject *object)
+{
+ //TspPreferences *tsp_preferences = TSP_PREFERENCES (object);
+
+ (*G_OBJECT_CLASS (tsp_preferences_parent_class)->finalize) (object);
+}
+
+static GList*
+tsp_preferences_get_actions (ThunarxPreferencesProvider *provider,
+ GtkWidget *window)
+{
+ GtkAction *action;
+ GClosure *closure;
+
+ action = gtk_action_new ("Tsp::thunar-shares-admin",
+ _("Manage shared folders..."),
+ _("Add, edit and remove shared folders"),
+ NULL);
+
+ g_object_set (G_OBJECT (action),
+ "icon-name", "gnome-fs-share",
+ NULL);
+
+ closure = g_cclosure_new_object_swap (
+ G_CALLBACK (tsp_shares_admin_activated), G_OBJECT (window));
+
+ g_signal_connect_closure (G_OBJECT (action), "activate", closure, TRUE);
+
+ return g_list_prepend (NULL, action);
+}
+
+
+static void
+tsp_shares_admin_activated (GtkWindow *window)
+{
+ tsp_admin_dialog_show (window);
+}
Added: thunar-shares-plugin/trunk/thunar-plugin/tsp-prefs-provider.h
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/tsp-prefs-provider.h (rev 0)
+++ thunar-shares-plugin/trunk/thunar-plugin/tsp-prefs-provider.h 2008-07-29 01:45:18 UTC (rev 5173)
@@ -0,0 +1,43 @@
+/* vim: set ts=4 sw=8 noet ai nocindent syntax=c: */
+/*
+ * Copyright (C) 2008 Daniel Morales <daniel at daniel.com.uy>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __TSP_PREFERENCES_H__
+#define __TSP_PREFERENCES_H__
+
+#include <thunarx/thunarx.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _TspPreferencesClass TspPreferencesClass;
+typedef struct _TspPreferences TspPreferences;
+
+#define TSP_TYPE_PREFERENCES (tsp_preferences_get_type ())
+#define TSP_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TSP_TYPE_PREFERENCES, TspPreferences))
+#define TSP_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TSP_TYPE_PREFERENCES, TspPreferencesClass))
+#define TSP_IS_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TSP_TYPE_PREFERENCES))
+#define TSP_IS_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TSP_TYPE_PREFERENCES))
+#define TSP_PREFERENCES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TSP_TYPE_PREFERENCES, TspPreferencesClass))
+
+GType tsp_preferences_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
+void tsp_preferences_register_type (ThunarxProviderPlugin *plugin) G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* __TSP_PREFERENCES_H__ */
More information about the Goodies-commits
mailing list