[Goodies-commits] r2340 - in thunar-volman/trunk: . icons icons/48x48 icons/scalable po thunar-volman
Benedikt Meurer
benny at xfce.org
Fri Jan 12 00:11:32 CET 2007
Author: benny
Date: 2007-01-11 23:11:32 +0000 (Thu, 11 Jan 2007)
New Revision: 2340
Added:
thunar-volman/trunk/AUTHORS
thunar-volman/trunk/COPYING
thunar-volman/trunk/ChangeLog
thunar-volman/trunk/INSTALL
thunar-volman/trunk/Makefile.am
thunar-volman/trunk/NEWS
thunar-volman/trunk/README
thunar-volman/trunk/autogen.sh
thunar-volman/trunk/configure.in.in
thunar-volman/trunk/icons/
thunar-volman/trunk/icons/48x48/
thunar-volman/trunk/icons/48x48/Makefile.am
thunar-volman/trunk/icons/48x48/tvm-burn-cd.png
thunar-volman/trunk/icons/48x48/tvm-dev-tablet.png
thunar-volman/trunk/icons/Makefile.am
thunar-volman/trunk/icons/scalable/
thunar-volman/trunk/icons/scalable/Makefile.am
thunar-volman/trunk/icons/scalable/tvm-burn-cd.svg
thunar-volman/trunk/po/
thunar-volman/trunk/po/ChangeLog
thunar-volman/trunk/po/LINGUAS
thunar-volman/trunk/po/Makefile
thunar-volman/trunk/po/POTFILES.in
thunar-volman/trunk/po/de.po
thunar-volman/trunk/po/thunar-volman.pot
thunar-volman/trunk/thunar-volman/
thunar-volman/trunk/thunar-volman/Makefile.am
thunar-volman/trunk/thunar-volman/main.c
thunar-volman/trunk/thunar-volman/tvm-block-device.c
thunar-volman/trunk/thunar-volman/tvm-block-device.h
thunar-volman/trunk/thunar-volman/tvm-camera-device.c
thunar-volman/trunk/thunar-volman/tvm-camera-device.h
thunar-volman/trunk/thunar-volman/tvm-command-entry.c
thunar-volman/trunk/thunar-volman/tvm-command-entry.h
thunar-volman/trunk/thunar-volman/tvm-device.c
thunar-volman/trunk/thunar-volman/tvm-device.h
thunar-volman/trunk/thunar-volman/tvm-input-device.c
thunar-volman/trunk/thunar-volman/tvm-input-device.h
thunar-volman/trunk/thunar-volman/tvm-pango-extensions.c
thunar-volman/trunk/thunar-volman/tvm-pango-extensions.h
thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.c
thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.h
thunar-volman/trunk/thunar-volman/tvm-preferences.c
thunar-volman/trunk/thunar-volman/tvm-preferences.h
thunar-volman/trunk/thunar-volman/tvm-prompt.c
thunar-volman/trunk/thunar-volman/tvm-prompt.h
thunar-volman/trunk/thunar-volman/tvm-run.c
thunar-volman/trunk/thunar-volman/tvm-run.h
thunar-volman/trunk/thunar-volman/xfce-heading.c
thunar-volman/trunk/thunar-volman/xfce-heading.h
thunar-volman/trunk/thunar-volman/xfce-titled-dialog.c
thunar-volman/trunk/thunar-volman/xfce-titled-dialog.h
Modified:
thunar-volman/trunk/
Log:
2007-01-12 Benedikt Meurer <benny at xfce.org>
* Initial import.
Property changes on: thunar-volman/trunk
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.in
aclocal.m4
autom4te.cache
compile
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
configure.in
depcomp
install-sh
intltool-*
libtool
ltmain.sh
mkinstalldirs
missing
stamp-h1
.*.swp
thunar-volman-*.tar.bz2
thunar-volman-*.tar.gz
core.*
core
*.core
Added: thunar-volman/trunk/AUTHORS
===================================================================
--- thunar-volman/trunk/AUTHORS (rev 0)
+++ thunar-volman/trunk/AUTHORS 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,4 @@
+Benedikt Meurer <benny at xfce.org>
+
+Portions of the code are based on code from gnome-volume-manager, written by
+Robert Love <rml at novell.com> and Jeffrey Stedfast <fejj at novell.com> for GNOME.
Added: thunar-volman/trunk/COPYING
===================================================================
--- thunar-volman/trunk/COPYING (rev 0)
+++ thunar-volman/trunk/COPYING 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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-volman/trunk/ChangeLog
===================================================================
--- thunar-volman/trunk/ChangeLog (rev 0)
+++ thunar-volman/trunk/ChangeLog 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,5 @@
+2007-01-12 Benedikt Meurer <benny at xfce.org>
+
+ * Initial import.
+
+# vi:set ts=8 sw=8 noet ai nocindent:
Added: thunar-volman/trunk/INSTALL
===================================================================
--- thunar-volman/trunk/INSTALL (rev 0)
+++ thunar-volman/trunk/INSTALL 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,231 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 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' will install the package's files in
+`/usr/local/bin', `/usr/local/man', 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
+give `configure' the option `--exec-prefix=PREFIX', the package will
+use PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files will 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 `--target=TYPE' option 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
+
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+`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-volman/trunk/Makefile.am
===================================================================
--- thunar-volman/trunk/Makefile.am (rev 0)
+++ thunar-volman/trunk/Makefile.am 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,15 @@
+# $Id$
+
+SUBDIRS = \
+ icons \
+ po \
+ thunar-volman
+
+distclean-local:
+ rm -rf *.spec *.cache *~
+
+rpm: dist
+ rpmbuild -ta $(PACKAGE)-$(VERSION).tar.gz
+ @rm -f $(PACKAGE)-$(VERSION).tar.gz
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
Property changes on: thunar-volman/trunk/Makefile.am
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/NEWS
===================================================================
Added: thunar-volman/trunk/README
===================================================================
--- thunar-volman/trunk/README (rev 0)
+++ thunar-volman/trunk/README 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,87 @@
+What is it?
+===========
+
+thunar-volman is an extension for the Thunar File Manager, which enables
+automatic management of removable drives and media. For example, if
+thunar-volman is installed and configured properly, and you plug in your
+digitcal camera, it will automatically spawn your preferred photo application
+and import the new pictures from your camera.
+
+It was designed to look and behave similar to gnome-volume-manager to get
+consistent removable drive and media management in Xfce and GNOME. This is
+to help GNOME refugees and people using both Xfce and GNOME (i.e. having to
+use GNOME at the office).
+
+
+Required packages
+=================
+
+thunar-volman depends on the following packages:
+
+ - Thunar 0.5.1svn or above
+ - libexo 0.3.1.13svn or above
+ - intltool 0.30 or above
+ - D-BUS 0.34 or above (esp. the dbus-glib devel package)
+ - HAL 0.5.0 or above (esp. the libhal devel package)
+
+
+Installation
+============
+
+The file 'INSTALL' contains generic installation instructions. For more
+detailed information, visit the thunar-volman website at
+http://thunar.xfce.org/projects/thunar-volman/.
+
+
+Debugging Support
+=================
+
+thunar-volman currently supports four different levels of debugging support, which
+can be setup using the configure flag `--enable-debug' (check the output of
+`configure --help'):
+
+ `full' Use this if you want to debug thunar-volman to locate a bug.
+ The build will most probably be noticably slower. This is also
+ recommended for people that want to develop thunar-volman stuff.
+
+ `yes' This is the default for SVN snapshot builds. It adds all
+ kinds of checks to the code, and is therefore likely to run
+ slower.
+
+ `minimum' This is the default for release builds, and presents the
+ recommended behaviour.
+
+ `no' Disables all sanity checks. Don't use this unless you know
+ exactly what you do.
+
+
+Standards compliance
+====================
+
+Thunar supports the following standards/specifications:
+
+ * XDG Base Directory Specification
+ http://freedesktop.org/wiki/Standards_2fbasedir_2dspec
+
+ * Shared MIME Database Specification
+ http://freedesktop.org/wiki/Standards_2fshared_2dmime_2dinfo_2dspec
+
+ * Icon Naming Specification
+ http://freedesktop.org/wiki/Standards_2ficon_2dnaming_2dspec
+
+ * Icon Theme Specification
+ http://freedesktop.org/wiki/Standards_2ficon_2dtheme_2dspec
+
+ * File URI Specification
+ http://freedesktop.org/wiki/Standards_2ffile_2duri_2dspec
+
+ * Desktop Application Autostart Specification
+ http://freedesktop.org/wiki/Standards_2fautostart_2dspec
+
+
+How to report bugs?
+===================
+
+Bugs should be reported to the Xfce bug tracking system
+(http://bugzilla.xfce.org, product Thunar Plugins, component
+thunar-volman). You will need to create an account for yourself.
Added: thunar-volman/trunk/autogen.sh
===================================================================
--- thunar-volman/trunk/autogen.sh (rev 0)
+++ thunar-volman/trunk/autogen.sh 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# $Id$
+#
+# 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:
Property changes on: thunar-volman/trunk/autogen.sh
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/configure.in.in
===================================================================
--- thunar-volman/trunk/configure.in.in (rev 0)
+++ thunar-volman/trunk/configure.in.in 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,185 @@
+dnl $Id$
+dnl
+dnl Copyright (c) 2004-2007
+dnl The Thunar development team. All rights reserved.
+dnl
+dnl Written for thunar-volman by Benedikt Meurer <benny at xfce.org>.
+dnl
+
+dnl ***************************
+dnl *** Version information ***
+dnl ***************************
+m4_define([tvm_version_major], [0])
+m4_define([tvm_version_minor], [0])
+m4_define([tvm_version_micro], [1])
+m4_define([tvm_version_build], [r at REVISION@])
+m4_define([tvm_version_tag], [svn])
+m4_define([tvm_version], [tvm_version_major().tvm_version_minor().tvm_version_micro()ifelse(tvm_version_tag(), [svn], [tvm_version_tag()-tvm_version_build()], [tvm_version_tag()])])
+
+dnl *******************************************
+dnl *** Debugging support for SVN snapshots ***
+dnl *******************************************
+m4_define([tvm_debug_default], [ifelse(tvm_version_tag(), [svn], [yes], [minimum])])
+
+dnl ***************************
+dnl *** Initialize autoconf ***
+dnl ***************************
+AC_COPYRIGHT([Copyright (c) 2004-2007
+ The Thunar development team. All rights reserved.
+
+Written for thunar-volman by Benedikt Meurer <benny at xfce.org>.])
+AC_INIT([thunar-volman], [tvm_version()], [http://bugzilla.xfce.org/])
+AC_PREREQ([2.50])
+AC_CANONICAL_TARGET()
+AC_REVISION([$Id$])
+
+dnl ***************************
+dnl *** Initialize automake ***
+dnl ***************************
+AM_INIT_AUTOMAKE([1.8 dist-bzip2 tar-ustar])
+AM_CONFIG_HEADER([config.h])
+AM_MAINTAINER_MODE()
+
+dnl *******************************
+dnl *** Check for UNIX variants ***
+dnl *******************************
+AC_AIX()
+AC_ISC_POSIX()
+AC_MINIX()
+
+dnl ********************************
+dnl *** Check for basic programs ***
+dnl ********************************
+AC_PROG_CC()
+AC_PROG_LD()
+AC_PROG_INSTALL()
+
+dnl **************************
+dnl *** Initialize libtool ***
+dnl **************************
+AC_DISABLE_STATIC()
+AC_PROG_LIBTOOL()
+
+dnl **********************************
+dnl *** Check for standard headers ***
+dnl **********************************
+AC_CHECK_HEADERS([errno.h path.h stdarg.h sys/types.h sys/wait.h])
+
+dnl ************************************
+dnl *** Check for standard functions ***
+dnl ************************************
+AC_CHECK_FUNCS([])
+
+dnl ******************************
+dnl *** Check for i18n support ***
+dnl ******************************
+XDT_I18N([@LINGUAS@])
+
+dnl ***********************************
+dnl *** Check for required packages ***
+dnl ***********************************
+XDT_CHECK_PACKAGE([DBUS], [dbus-glib-1], [0.34])
+XDT_CHECK_PACKAGE([EXO_HAL], [exo-hal-0.3], [0.3.1.13])
+XDT_CHECK_PACKAGE([HAL], [hal-storage], [0.5.0])
+XDT_CHECK_PACKAGE([THUNAR_VFS], [thunar-vfs-1], [0.5.1])
+
+dnl ***********************************
+dnl *** Check for debugging support ***
+dnl ***********************************
+AC_ARG_ENABLE([debug],
+AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes/full@:>@], [Turn on debugging @<:@default=tvm_debug_default@:>@]),
+ [], [enable_debug=tvm_debug_default])
+AC_MSG_CHECKING([whether to enable debugging support])
+if test x"$enable_debug" = x"full" -o x"$enable_debug" = x"yes"; then
+ dnl Print the result
+ AC_MSG_RESULT([$enable_debug])
+
+ dnl Make sure we detect possible errors (if supported)
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Wall -Werror"
+ AC_MSG_CHECKING([whether $CC accepts -Wall -Werror])
+ AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [
+ AC_MSG_RESULT([yes])
+ PLATFORM_CFLAGS="$PLATFORM_CFLAGS -Wall -Werror"
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+ CFLAGS="$save_CFLAGS"
+
+ dnl Paranoia for --enable-debug=full
+ if test x"$enable_debug" = x"full"; then
+ dnl Enable extensive debugging
+ PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_ENABLE_DEBUG"
+
+ dnl Use -O0 -g3 if the compiler supports it
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -O0 -g3"
+ AC_MSG_CHECKING([whether $CC accepts -O0 -g3])
+ AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [
+ AC_MSG_RESULT([yes])
+ PLATFORM_CFLAGS="$PLATFORM_CFLAGS -O0 -g3"
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+ CFLAGS="$save_CFLAGS"
+ fi
+else
+ dnl Print the result
+ AC_MSG_RESULT([$enable_debug])
+
+ dnl Disable debugging (release build)
+ PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DNDEBUG"
+
+ dnl Disable object cast checks
+ PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_CAST_CHECKS"
+
+ dnl Disable all checks for --enable-debug=no
+ if test x"$enable_debug" = x"no"; then
+ PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
+ fi
+fi
+
+dnl **************************************
+dnl *** Check for linker optimizations ***
+dnl **************************************
+AC_MSG_CHECKING([whether $LD accepts -O1])
+case `$LD -O1 -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -Wl,-O1"
+ AC_MSG_RESULT([yes])
+ ;;
+*)
+ AC_MSG_RESULT([no])
+ ;;
+esac
+
+dnl *********************************
+dnl *** Substitute platform flags ***
+dnl *********************************
+AC_MSG_CHECKING([PLATFORM_CPPFLAGS])
+AC_MSG_RESULT([$PLATFORM_CPPFLAGS])
+AC_SUBST([PLATFORM_CPPFLAGS])
+AC_MSG_CHECKING([PLATFORM_CFLAGS])
+AC_MSG_RESULT([$PLATFORM_CFLAGS])
+AC_SUBST([PLATFORM_CFLAGS])
+AC_MSG_CHECKING([PLATFORM_LDFLAGS])
+AC_MSG_RESULT([$PLATFORM_LDFLAGS])
+AC_SUBST([PLATFORM_LDFLAGS])
+
+AC_OUTPUT([
+Makefile
+icons/Makefile
+icons/48x48/Makefile
+icons/scalable/Makefile
+po/Makefile.in
+thunar-volman/Makefile
+])
+
+dnl ***************************
+dnl *** Print configuration ***
+dnl ***************************
+echo
+echo "Build Configuration:"
+echo
+echo "* Debug Support: $enable_debug"
+echo
Property changes on: thunar-volman/trunk/configure.in.in
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Property changes on: thunar-volman/trunk/icons
___________________________________________________________________
Name: svn:ignore
+ .deps
.libs
Makefile
Makefile.in
.*.swp
Property changes on: thunar-volman/trunk/icons/48x48
___________________________________________________________________
Name: svn:ignore
+ .deps
.libs
Makefile
Makefile.in
.*.swp
Added: thunar-volman/trunk/icons/48x48/Makefile.am
===================================================================
--- thunar-volman/trunk/icons/48x48/Makefile.am (rev 0)
+++ thunar-volman/trunk/icons/48x48/Makefile.am 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,11 @@
+# $Id$
+
+iconsdir = $(datadir)/icons/hicolor/48x48/apps
+icons_DATA = \
+ tvm-burn-cd.png \
+ tvm-dev-tablet.png
+
+EXTRA_DIST = \
+ $(icons_DATA)
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
Property changes on: thunar-volman/trunk/icons/48x48/Makefile.am
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/icons/48x48/tvm-burn-cd.png
===================================================================
(Binary files differ)
Property changes on: thunar-volman/trunk/icons/48x48/tvm-burn-cd.png
___________________________________________________________________
Name: svn:mime-type
+ image/png
Added: thunar-volman/trunk/icons/48x48/tvm-dev-tablet.png
===================================================================
(Binary files differ)
Property changes on: thunar-volman/trunk/icons/48x48/tvm-dev-tablet.png
___________________________________________________________________
Name: svn:mime-type
+ image/png
Added: thunar-volman/trunk/icons/Makefile.am
===================================================================
--- thunar-volman/trunk/icons/Makefile.am (rev 0)
+++ thunar-volman/trunk/icons/Makefile.am 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,20 @@
+# $Id$
+
+SUBDIRS = \
+ 48x48 \
+ scalable
+
+gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
+
+install-data-hook:
+ @-if test -z "$(DESTDIR)"; then \
+ echo "Updating Gtk icon cache."; \
+ $(gtk_update_icon_cache); \
+ else \
+ echo "*** Icon cache not updated. Remember to run:"; \
+ echo "***"; \
+ echo "*** $(gtk_update_icon_cache)"; \
+ echo "***"; \
+ fi
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
Property changes on: thunar-volman/trunk/icons/Makefile.am
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Property changes on: thunar-volman/trunk/icons/scalable
___________________________________________________________________
Name: svn:ignore
+ .deps
.libs
Makefile
Makefile.in
.*.swp
Added: thunar-volman/trunk/icons/scalable/Makefile.am
===================================================================
--- thunar-volman/trunk/icons/scalable/Makefile.am (rev 0)
+++ thunar-volman/trunk/icons/scalable/Makefile.am 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,10 @@
+# $Id$
+
+iconsdir = $(datadir)/icons/hicolor/scalable/apps
+icons_DATA = \
+ tvm-burn-cd.svg
+
+EXTRA_DIST = \
+ $(icons_DATA)
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
Property changes on: thunar-volman/trunk/icons/scalable/Makefile.am
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/icons/scalable/tvm-burn-cd.svg
===================================================================
(Binary files differ)
Property changes on: thunar-volman/trunk/icons/scalable/tvm-burn-cd.svg
___________________________________________________________________
Name: svn:mime-type
+ image/svg+xml
Property changes on: thunar-volman/trunk/po
___________________________________________________________________
Name: svn:ignore
+ .deps
.libs
Makefile
Makefile.in
Makefile.in.in
POTFILES
*.gmo
*.mo
.*.swp
Added: thunar-volman/trunk/po/ChangeLog
===================================================================
--- thunar-volman/trunk/po/ChangeLog (rev 0)
+++ thunar-volman/trunk/po/ChangeLog 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,5 @@
+2007-01-12 Benedikt Meurer <benny at xfce.org>
+
+ * Initial import.
+
+# vi:set ts=8 sw=8 noet ai nocindent:
Added: thunar-volman/trunk/po/LINGUAS
===================================================================
--- thunar-volman/trunk/po/LINGUAS (rev 0)
+++ thunar-volman/trunk/po/LINGUAS 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,2 @@
+# set of available languages (in alphabetic order)
+de
Added: thunar-volman/trunk/po/Makefile
===================================================================
--- thunar-volman/trunk/po/Makefile (rev 0)
+++ thunar-volman/trunk/po/Makefile 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,283 @@
+# Makefile for program source directory in GNU NLS utilities package.
+# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper at gnu.ai.mit.edu>
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+#
+# - Modified by Owen Taylor <otaylor at redhat.com> to use GETTEXT_PACKAGE
+# instead of PACKAGE and to look for po2tbl in ./ not in intl/
+#
+# - Modified by jacob berkman <jacob at ximian.com> to install
+# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
+
+GETTEXT_PACKAGE = thunar-volman
+PACKAGE = thunar-volman
+VERSION = 0.0.1svn-r00000
+
+SHELL = /bin/sh
+
+
+srcdir = .
+top_srcdir = ..
+
+
+prefix = /opt/local
+exec_prefix = ${prefix}
+datadir = ${prefix}/share
+libdir = ${exec_prefix}/lib
+localedir = $(prefix)/share/locale
+gnulocaledir = $(prefix)/share/locale
+gettextsrcdir = $(datadir)/glib-2.0/gettext/po
+subdir = po
+
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+MKINSTALLDIRS = $(top_srcdir)/./mkinstalldirs
+
+CC = gcc
+GENCAT = @GENCAT@
+GMSGFMT = /opt/local/bin/msgfmt
+MSGFMT = /opt/local/bin/msgfmt
+XGETTEXT_ARGS = --keyword=Q_
+XGETTEXT = /opt/local/bin/xgettext $(XGETTEXT_ARGS)
+MSGMERGE = msgmerge
+
+DEFS = -DHAVE_CONFIG_H
+CFLAGS = -O2 -pipe -mmmx -msse -msse2 -mfpmath=sse
+CPPFLAGS = -I/opt/local/include -I/usr/local/include
+
+INCLUDES = -I.. -I$(top_srcdir)/intl
+
+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+SOURCES =
+POFILES = de.po
+GMOFILES = de.gmo
+DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
+$(POFILES) $(GMOFILES) $(SOURCES)
+
+POTFILES = \
+ ../thunar-volman/main.c \
+ ../thunar-volman/tvm-block-device.c \
+ ../thunar-volman/tvm-camera-device.c \
+ ../thunar-volman/tvm-command-entry.c \
+ ../thunar-volman/tvm-device.c \
+ ../thunar-volman/tvm-input-device.c \
+ ../thunar-volman/tvm-pango-extensions.c \
+ ../thunar-volman/tvm-preferences-dialog.c \
+ ../thunar-volman/tvm-preferences.c \
+ ../thunar-volman/tvm-prompt.c \
+ ../thunar-volman/tvm-run.c \
+ ../thunar-volman/xfce-heading.c \
+ ../thunar-volman/xfce-titled-dialog.c
+
+CATALOGS = de.gmo
+CATOBJEXT = .gmo
+INSTOBJEXT = .mo
+
+.SUFFIXES:
+.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
+
+.c.o:
+ $(COMPILE) $<
+
+.po.pox:
+ $(MAKE) $(GETTEXT_PACKAGE).pot
+ $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
+
+.po.mo:
+ $(MSGFMT) -o $@ $<
+
+.po.gmo:
+ file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
+ && rm -f $$file && $(GMSGFMT) -c -o $$file $<
+
+.po.cat:
+ sed -f ../intl/po2msg.sed < $< > $*.msg \
+ && rm -f $@ && $(GENCAT) $@ $*.msg
+
+
+all: all-yes
+
+all-yes: $(CATALOGS)
+all-no:
+
+$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
+ $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
+ --add-comments --keyword=_ --keyword=N_ \
+ --flag=g_strdup_printf:1:c-format \
+ --flag=g_string_printf:2:c-format \
+ --flag=g_string_append_printf:2:c-format \
+ --flag=g_error_new:3:c-format \
+ --flag=g_set_error:4:c-format \
+ --flag=g_markup_printf_escaped:1:c-format \
+ --flag=g_log:3:c-format \
+ --flag=g_print:1:c-format \
+ --flag=g_printerr:1:c-format \
+ --flag=g_printf:1:c-format \
+ --flag=g_fprintf:2:c-format \
+ --flag=g_sprintf:2:c-format \
+ --flag=g_snprintf:3:c-format \
+ --flag=g_scanner_error:2:c-format \
+ --flag=g_scanner_warn:2:c-format \
+ --files-from=$(srcdir)/POTFILES.in \
+ && test ! -f $(GETTEXT_PACKAGE).po \
+ || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
+ && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
+
+install: install-exec install-data
+install-exec:
+install-data: install-data-yes
+install-data-no: all
+install-data-yes: all
+ if test -r "$(MKINSTALLDIRS)"; then \
+ $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
+ else \
+ $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
+ fi
+ @catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ case "$$cat" in \
+ *.gmo) destdir=$(gnulocaledir);; \
+ *) destdir=$(localedir);; \
+ esac; \
+ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+ dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
+ if test -r "$(MKINSTALLDIRS)"; then \
+ $(MKINSTALLDIRS) $$dir; \
+ else \
+ $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
+ fi; \
+ if test -r $$cat; then \
+ $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+ echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
+ else \
+ $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+ echo "installing $(srcdir)/$$cat as" \
+ "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
+ fi; \
+ if test -r $$cat.m; then \
+ $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+ echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
+ else \
+ if test -r $(srcdir)/$$cat.m ; then \
+ $(INSTALL_DATA) $(srcdir)/$$cat.m \
+ $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+ echo "installing $(srcdir)/$$cat as" \
+ "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
+ else \
+ true; \
+ fi; \
+ fi; \
+ done
+ if test "$(PACKAGE)" = "glib"; then \
+ if test -r "$(MKINSTALLDIRS)"; then \
+ $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
+ else \
+ $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
+ fi; \
+ $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
+ $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
+ else \
+ : ; \
+ fi
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall:
+ catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+ rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+ rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+ rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+ rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+ done
+ if test "$(PACKAGE)" = "glib"; then \
+ rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
+ fi
+
+check: all
+
+dvi info tags TAGS ID:
+
+mostlyclean:
+ rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
+ rm -fr *.o
+
+clean: mostlyclean
+
+distclean: clean
+ rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
+
+maintainer-clean: distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+ rm -f $(GMOFILES)
+
+distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
+dist distdir: update-po $(DISTFILES)
+ dists="$(DISTFILES)"; \
+ for file in $$dists; do \
+ ln $(srcdir)/$$file $(distdir) 2> /dev/null \
+ || cp -p $(srcdir)/$$file $(distdir); \
+ done
+
+update-po: Makefile
+ $(MAKE) $(GETTEXT_PACKAGE).pot
+ tmpdir=`pwd`; \
+ cd $(srcdir); \
+ catalogs='$(CATALOGS)'; \
+ for cat in $$catalogs; do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+ echo "$$lang:"; \
+ if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \
+ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+ rm -f $$tmpdir/$$lang.new.po; \
+ else \
+ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+ :; \
+ else \
+ echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+ rm -f $$tmpdir/$$lang.new.po; \
+ exit 1; \
+ fi; \
+ fi; \
+ else \
+ echo "msgmerge for $$cat failed!"; \
+ rm -f $$tmpdir/$$lang.new.po; \
+ fi; \
+ done
+
+# POTFILES is created from POTFILES.in by stripping comments, empty lines
+# and Intltool tags (enclosed in square brackets), and appending a full
+# relative path to them
+POTFILES: POTFILES.in
+ ( if test 'x$(srcdir)' != 'x.'; then \
+ posrcprefix='$(top_srcdir)/'; \
+ else \
+ posrcprefix="../"; \
+ fi; \
+ rm -f $@-t $@ \
+ && (sed -e '/^#/d' \
+ -e "s/^\[.*\] +//" \
+ -e '/^[ ]*$$/d' \
+ -e "s at .*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
+ | sed -e '$$s/\\$$//') > $@-t \
+ && chmod a-w $@-t \
+ && mv $@-t $@ )
+
+Makefile: Makefile.in.in ../config.status POTFILES
+ cd .. \
+ && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
+ $(SHELL) ./config.status
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Property changes on: thunar-volman/trunk/po/Makefile
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/po/POTFILES.in
===================================================================
--- thunar-volman/trunk/po/POTFILES.in (rev 0)
+++ thunar-volman/trunk/po/POTFILES.in 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,13 @@
+thunar-volman/main.c
+thunar-volman/tvm-block-device.c
+thunar-volman/tvm-camera-device.c
+thunar-volman/tvm-command-entry.c
+thunar-volman/tvm-device.c
+thunar-volman/tvm-input-device.c
+thunar-volman/tvm-pango-extensions.c
+thunar-volman/tvm-preferences-dialog.c
+thunar-volman/tvm-preferences.c
+thunar-volman/tvm-prompt.c
+thunar-volman/tvm-run.c
+thunar-volman/xfce-heading.c
+thunar-volman/xfce-titled-dialog.c
Added: thunar-volman/trunk/po/de.po
===================================================================
--- thunar-volman/trunk/po/de.po (rev 0)
+++ thunar-volman/trunk/po/de.po 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,363 @@
+# German translations for thunar-volman.
+# Copyright (C) 2007 Benedikt Meurer.
+# This file is distributed under the same license as the thunar-volman package.
+# Benedikt Meurer <benny at xfce.org>, 2007.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: thunar-volman 0.0.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-01-11 23:49+0100\n"
+"PO-Revision-Date: 2007-01-11 23:30+0100\n"
+"Last-Translator: Benedikt Meurer <benny at xfce.org>\n"
+"Language-Team: German <de at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: thunar-volman/main.c:50
+msgid "The HAL device UDI of the newly added device"
+msgstr ""
+
+#: thunar-volman/main.c:51 thunar-volman/tvm-preferences-dialog.c:118
+msgid "Configure management of removable drives and media"
+msgstr "Die Verwaltung von Wechseldatenträgern und -medien konfigurieren"
+
+#: thunar-volman/main.c:52
+msgid "Print version information and exit"
+msgstr "Programmversion anzeigen"
+
+#. setup application name
+#: thunar-volman/main.c:69
+msgid "Thunar Volume Manager"
+msgstr "Thunar Datenträgerverwaltung"
+
+#: thunar-volman/main.c:90
+msgid "Failed to open display"
+msgstr "Konnte keine Verbindung zum XServer herstellen"
+
+#: thunar-volman/main.c:106
+msgid "The Thunar development team. All rights reserved."
+msgstr "Die Thunar Entwickler. Alle Rechte vorbehalten."
+
+#: thunar-volman/main.c:107
+msgid "Written by Benedikt Meurer <benny at xfce.org>."
+msgstr "Entwickelt von Benedikt Meurer <benny at xfce.org>."
+
+#: thunar-volman/main.c:108
+#, c-format
+msgid "Please report bugs to <%s>."
+msgstr "Bitte melden Sie Probleme unter <%s>."
+
+#. TRANSLATORS: A HAL device UDI must match certain conditions to be valid (to be exact, it must be a valid D-Bus object path)
+#: thunar-volman/main.c:133
+#, c-format
+msgid "The specified UDI \"%s\" is not a valid HAL device UDI"
+msgstr ""
+
+#. TRANSLATORS: thunar-volman wasn't invoked with either --device-added or --configure.
+#: thunar-volman/main.c:144
+#, c-format
+msgid "Must specify the new HAL device UDI with --device-added"
+msgstr ""
+
+#. ...so we need to prompt what to do
+#: thunar-volman/tvm-block-device.c:143
+msgid "Photos and Music"
+msgstr "Fotos und Musik"
+
+#: thunar-volman/tvm-block-device.c:144
+msgid "Photos were found on your portable music player."
+msgstr "Auf diesem Gerät wurden Fotos und Musik entdeckt."
+
+#: thunar-volman/tvm-block-device.c:145
+msgid "Would you like to import the photos or manage the music?"
+msgstr "Sollen die Fotos importiert oder die Musik verwaltet werden?"
+
+#: thunar-volman/tvm-block-device.c:146 thunar-volman/tvm-block-device.c:213
+#: thunar-volman/tvm-block-device.c:301 thunar-volman/tvm-block-device.c:359
+#: thunar-volman/tvm-block-device.c:629 thunar-volman/tvm-run.c:136
+#: thunar-volman/tvm-run.c:147
+msgid "Ig_nore"
+msgstr "_Ignorieren"
+
+#: thunar-volman/tvm-block-device.c:147 thunar-volman/tvm-block-device.c:214
+msgid "Import _Photos"
+msgstr "Fotos _Importieren"
+
+#: thunar-volman/tvm-block-device.c:148
+msgid "Manage _Music"
+msgstr "_Musik verwalten"
+
+#. ask the user whether to import photos
+#: thunar-volman/tvm-block-device.c:210
+msgid "Photo Import"
+msgstr "Fotos importieren"
+
+#: thunar-volman/tvm-block-device.c:211
+msgid "A photo card has been detected."
+msgstr "Ein Medium mit Fotos wurde erkannt."
+
+#: thunar-volman/tvm-block-device.c:212
+msgid ""
+"There are photos on the card. Would you like to add these photos to your "
+"album?"
+msgstr ""
+"Auf diesem Medium sind Fotos vorhanden. Sollen diese Ihrem Fotoalbum "
+"hinzugefügt werden?"
+
+#. prompt the user whether to execute this file
+#: thunar-volman/tvm-block-device.c:298
+#, c-format
+msgid "Would you like to allow \"%s\" to run?"
+msgstr "Soll »%s« ausgeführt werden?"
+
+#: thunar-volman/tvm-block-device.c:299
+msgid "Auto-Run Confirmation"
+msgstr "Automatisches Ausführen bestätigen"
+
+#: thunar-volman/tvm-block-device.c:300
+msgid "Auto-Run capability detected"
+msgstr "Unterstützung für Automatisches Ausführen erkannt."
+
+#: thunar-volman/tvm-block-device.c:302
+msgid "_Allow Auto-Run"
+msgstr "_Automatisches Ausführen erlauben"
+
+#. prompt the user whether to autoopen this file
+#: thunar-volman/tvm-block-device.c:356
+#, c-format
+msgid "Would you like to open \"%s\"?"
+msgstr "Soll »%s« geöffnet werden?"
+
+#: thunar-volman/tvm-block-device.c:357
+msgid "Auto-Open Confirmation"
+msgstr "Automatisches Öffnen bestätigen"
+
+#: thunar-volman/tvm-block-device.c:358
+msgid "Auto-Open capability detected"
+msgstr "Unterstützung für Automatisches Öffnen erkannt."
+
+#: thunar-volman/tvm-block-device.c:360
+msgid "_Open"
+msgstr "Ö_ffnen"
+
+#. ask what do with the mixed audio/data disc
+#: thunar-volman/tvm-block-device.c:626
+msgid "Audio / Data CD"
+msgstr "Audio-/Daten-CD"
+
+#: thunar-volman/tvm-block-device.c:627
+msgid "The CD in the drive contains both music and files."
+msgstr "Die CD im Laufwerk enthält sowohl Musik als auch Dateien."
+
+#: thunar-volman/tvm-block-device.c:628
+msgid "Would you like to listen to music or browse the files?"
+msgstr "Soll die Musik wiedergegeben oder die Dateien angezeigt werden?"
+
+#: thunar-volman/tvm-block-device.c:630
+msgid "_Browse Files"
+msgstr "_Dateien anzeigen"
+
+#: thunar-volman/tvm-block-device.c:631
+msgid "_Play CD"
+msgstr "_CD wiedergeben"
+
+#: thunar-volman/tvm-command-entry.c:233
+msgid "Select an Application"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:243
+msgid "All Files"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:248
+msgid "Executable Files"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:263
+msgid "Perl Scripts"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:269
+msgid "Python Scripts"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:275
+msgid "Ruby Scripts"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:281
+msgid "Shell Scripts"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:117
+msgid "Removable Drives and Media"
+msgstr "Wechseldatenträger- und Medieneinstellungen"
+
+#.
+#. Storage
+#.
+#: thunar-volman/tvm-preferences-dialog.c:135
+msgid "Storage"
+msgstr "Datenträger"
+
+#: thunar-volman/tvm-preferences-dialog.c:145
+msgid "Removable Storage"
+msgstr "Wechseldatenträger"
+
+#: thunar-volman/tvm-preferences-dialog.c:162
+msgid "_Mount removable drives when hot-plugged"
+msgstr "_Hotplug-Wechsellaufwerke automatisch einhängen"
+
+#: thunar-volman/tvm-preferences-dialog.c:167
+msgid "Mount removable media when _inserted"
+msgstr "Wechselmedien beim Einlegen ein_hängen"
+
+#: thunar-volman/tvm-preferences-dialog.c:172
+msgid "B_rowse removable media when inserted"
+msgstr "Wechselmedien beim _Einlegen öffnen"
+
+#: thunar-volman/tvm-preferences-dialog.c:177
+msgid "_Auto-run programs on new drives and media"
+msgstr "_Programme auf neuen Laufwerken und Medien automatisch ausführen"
+
+#: thunar-volman/tvm-preferences-dialog.c:182
+msgid "Auto-open files on new drives and media"
+msgstr "Dateien auf neuen Laufwerken und Medien automatisch ö_ffnen"
+
+#: thunar-volman/tvm-preferences-dialog.c:191
+msgid "Blank CDs and DVDs"
+msgstr "CD/DVD-Rohlinge"
+
+#: thunar-volman/tvm-preferences-dialog.c:208
+msgid "_Burn a CD or DVD when a blank disc is inserted"
+msgstr "Eine CD oder DVD _brennen, wenn ein Rohling eingelegt wird"
+
+#: thunar-volman/tvm-preferences-dialog.c:216
+msgid "Command for _Data CDs:"
+msgstr "Befehl für _Daten-CDs:"
+
+#: thunar-volman/tvm-preferences-dialog.c:223
+msgid "Command for A_udio CDs:"
+msgstr "Befehl für A_udio-CDs:"
+
+#.
+#. Multimedia
+#.
+#: thunar-volman/tvm-preferences-dialog.c:237
+msgid "Multimedia"
+msgstr "Unterhaltungsmedien"
+
+#: thunar-volman/tvm-preferences-dialog.c:247
+msgid "Audio CDs"
+msgstr "Audio-CDs"
+
+#: thunar-volman/tvm-preferences-dialog.c:264
+msgid "Play _audio CDs when inserted"
+msgstr "_Audio-CDs beim Einlegen wiedergeben"
+
+#: thunar-volman/tvm-preferences-dialog.c:269
+#: thunar-volman/tvm-preferences-dialog.c:375
+#: thunar-volman/tvm-preferences-dialog.c:416
+msgid "_Command:"
+msgstr "_Befehl:"
+
+#: thunar-volman/tvm-preferences-dialog.c:279
+msgid "Video CDs/DVDs"
+msgstr "Video-CDs/DVDs"
+
+#: thunar-volman/tvm-preferences-dialog.c:296
+msgid "Play _video CDs and DVDs when inserted"
+msgstr "_Video-CDs/DVDs beim Einlegen wiedergeben"
+
+#: thunar-volman/tvm-preferences-dialog.c:301
+#: thunar-volman/tvm-preferences-dialog.c:333
+#: thunar-volman/tvm-preferences-dialog.c:448
+msgid "C_ommand:"
+msgstr "B_efehl:"
+
+#: thunar-volman/tvm-preferences-dialog.c:311
+msgid "Portable Music Players"
+msgstr "Tragbare Musik-Player"
+
+#: thunar-volman/tvm-preferences-dialog.c:328
+msgid "Play _music files when connected"
+msgstr "Nach dem Verbinden _Musikdateien abspielen"
+
+#.
+#. Cameras
+#.
+#: thunar-volman/tvm-preferences-dialog.c:343
+msgid "Cameras"
+msgstr "Kameras"
+
+#: thunar-volman/tvm-preferences-dialog.c:353
+msgid "Digital Cameras"
+msgstr "Digitalkameras"
+
+#: thunar-volman/tvm-preferences-dialog.c:370
+msgid "Import digital photographs when connected"
+msgstr "Nach dem Verbinden digitale Fotos _importieren"
+
+#.
+#. Input Devices
+#.
+#: thunar-volman/tvm-preferences-dialog.c:384
+msgid "Input Devices"
+msgstr "Eingabegeräte"
+
+#: thunar-volman/tvm-preferences-dialog.c:394
+msgid "Keyboards"
+msgstr "Tastaturen"
+
+#: thunar-volman/tvm-preferences-dialog.c:411
+msgid "Automatically run a program when an USB _keyboard is connected"
+msgstr ""
+"Automatisch ein Programm ausführen, wenn eine USB-_Tastatur eingesteckt wird"
+
+#: thunar-volman/tvm-preferences-dialog.c:426
+msgid "Mice"
+msgstr "Mäuse"
+
+#: thunar-volman/tvm-preferences-dialog.c:443
+msgid "Automatically run a program when an USB _mouse is connected"
+msgstr ""
+"Automatisch ein Programm ausführen, wenn eine USB-_Maus eingesteckt wird"
+
+#: thunar-volman/tvm-preferences-dialog.c:458
+msgid "Tablet"
+msgstr "Grafiktablets"
+
+#: thunar-volman/tvm-preferences-dialog.c:475
+msgid "Automatically run a program when a _tablet is connected"
+msgstr ""
+"Automatisch ein Programm ausführen, wenn ein _Grafiktablett eingesteckt wird"
+
+#: thunar-volman/tvm-preferences-dialog.c:480
+msgid "Com_mand:"
+msgstr "Befe_hl:"
+
+#: thunar-volman/tvm-run.c:133 thunar-volman/tvm-run.c:144
+msgid "Choose Disc Type"
+msgstr "Medientyp auswählen"
+
+#: thunar-volman/tvm-run.c:134 thunar-volman/tvm-run.c:145
+msgid "You have inserted a blank disc."
+msgstr "Ein Rohling wurde eingelegt."
+
+#: thunar-volman/tvm-run.c:135 thunar-volman/tvm-run.c:146
+msgid "What would you like to do?"
+msgstr "Welche Aktion soll ausgeführt werden?"
+
+#: thunar-volman/tvm-run.c:137
+msgid "Make _DVD"
+msgstr "_DVD brennen"
+
+#: thunar-volman/tvm-run.c:148
+msgid "Make _Data CD"
+msgstr "_Daten-CD brennen"
+
+#: thunar-volman/tvm-run.c:149
+msgid "Make _Audio CD"
+msgstr "_Audio-CD brennen"
Added: thunar-volman/trunk/po/thunar-volman.pot
===================================================================
--- thunar-volman/trunk/po/thunar-volman.pot (rev 0)
+++ thunar-volman/trunk/po/thunar-volman.pot 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,359 @@
+# 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: 2007-01-11 23:49+0100\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"
+
+#: thunar-volman/main.c:50
+msgid "The HAL device UDI of the newly added device"
+msgstr ""
+
+#: thunar-volman/main.c:51 thunar-volman/tvm-preferences-dialog.c:118
+msgid "Configure management of removable drives and media"
+msgstr ""
+
+#: thunar-volman/main.c:52
+msgid "Print version information and exit"
+msgstr ""
+
+#. setup application name
+#: thunar-volman/main.c:69
+msgid "Thunar Volume Manager"
+msgstr ""
+
+#: thunar-volman/main.c:90
+msgid "Failed to open display"
+msgstr ""
+
+#: thunar-volman/main.c:106
+msgid "The Thunar development team. All rights reserved."
+msgstr ""
+
+#: thunar-volman/main.c:107
+msgid "Written by Benedikt Meurer <benny at xfce.org>."
+msgstr ""
+
+#: thunar-volman/main.c:108
+#, c-format
+msgid "Please report bugs to <%s>."
+msgstr ""
+
+#. TRANSLATORS: A HAL device UDI must match certain conditions to be valid (to be exact, it must be a valid D-Bus object path)
+#: thunar-volman/main.c:133
+#, c-format
+msgid "The specified UDI \"%s\" is not a valid HAL device UDI"
+msgstr ""
+
+#. TRANSLATORS: thunar-volman wasn't invoked with either --device-added or --configure.
+#: thunar-volman/main.c:144
+#, c-format
+msgid "Must specify the new HAL device UDI with --device-added"
+msgstr ""
+
+#. ...so we need to prompt what to do
+#: thunar-volman/tvm-block-device.c:143
+msgid "Photos and Music"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:144
+msgid "Photos were found on your portable music player."
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:145
+msgid "Would you like to import the photos or manage the music?"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:146 thunar-volman/tvm-block-device.c:213
+#: thunar-volman/tvm-block-device.c:301 thunar-volman/tvm-block-device.c:359
+#: thunar-volman/tvm-block-device.c:629 thunar-volman/tvm-run.c:136
+#: thunar-volman/tvm-run.c:147
+msgid "Ig_nore"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:147 thunar-volman/tvm-block-device.c:214
+msgid "Import _Photos"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:148
+msgid "Manage _Music"
+msgstr ""
+
+#. ask the user whether to import photos
+#: thunar-volman/tvm-block-device.c:210
+msgid "Photo Import"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:211
+msgid "A photo card has been detected."
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:212
+msgid ""
+"There are photos on the card. Would you like to add these photos to your "
+"album?"
+msgstr ""
+
+#. prompt the user whether to execute this file
+#: thunar-volman/tvm-block-device.c:298
+#, c-format
+msgid "Would you like to allow \"%s\" to run?"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:299
+msgid "Auto-Run Confirmation"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:300
+msgid "Auto-Run capability detected"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:302
+msgid "_Allow Auto-Run"
+msgstr ""
+
+#. prompt the user whether to autoopen this file
+#: thunar-volman/tvm-block-device.c:356
+#, c-format
+msgid "Would you like to open \"%s\"?"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:357
+msgid "Auto-Open Confirmation"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:358
+msgid "Auto-Open capability detected"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:360
+msgid "_Open"
+msgstr ""
+
+#. ask what do with the mixed audio/data disc
+#: thunar-volman/tvm-block-device.c:626
+msgid "Audio / Data CD"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:627
+msgid "The CD in the drive contains both music and files."
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:628
+msgid "Would you like to listen to music or browse the files?"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:630
+msgid "_Browse Files"
+msgstr ""
+
+#: thunar-volman/tvm-block-device.c:631
+msgid "_Play CD"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:233
+msgid "Select an Application"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:243
+msgid "All Files"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:248
+msgid "Executable Files"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:263
+msgid "Perl Scripts"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:269
+msgid "Python Scripts"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:275
+msgid "Ruby Scripts"
+msgstr ""
+
+#: thunar-volman/tvm-command-entry.c:281
+msgid "Shell Scripts"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:117
+msgid "Removable Drives and Media"
+msgstr ""
+
+#.
+#. Storage
+#.
+#: thunar-volman/tvm-preferences-dialog.c:135
+msgid "Storage"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:145
+msgid "Removable Storage"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:162
+msgid "_Mount removable drives when hot-plugged"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:167
+msgid "Mount removable media when _inserted"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:172
+msgid "B_rowse removable media when inserted"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:177
+msgid "_Auto-run programs on new drives and media"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:182
+msgid "Auto-open files on new drives and media"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:191
+msgid "Blank CDs and DVDs"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:208
+msgid "_Burn a CD or DVD when a blank disc is inserted"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:216
+msgid "Command for _Data CDs:"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:223
+msgid "Command for A_udio CDs:"
+msgstr ""
+
+#.
+#. Multimedia
+#.
+#: thunar-volman/tvm-preferences-dialog.c:237
+msgid "Multimedia"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:247
+msgid "Audio CDs"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:264
+msgid "Play _audio CDs when inserted"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:269
+#: thunar-volman/tvm-preferences-dialog.c:375
+#: thunar-volman/tvm-preferences-dialog.c:416
+msgid "_Command:"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:279
+msgid "Video CDs/DVDs"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:296
+msgid "Play _video CDs and DVDs when inserted"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:301
+#: thunar-volman/tvm-preferences-dialog.c:333
+#: thunar-volman/tvm-preferences-dialog.c:448
+msgid "C_ommand:"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:311
+msgid "Portable Music Players"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:328
+msgid "Play _music files when connected"
+msgstr ""
+
+#.
+#. Cameras
+#.
+#: thunar-volman/tvm-preferences-dialog.c:343
+msgid "Cameras"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:353
+msgid "Digital Cameras"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:370
+msgid "Import digital photographs when connected"
+msgstr ""
+
+#.
+#. Input Devices
+#.
+#: thunar-volman/tvm-preferences-dialog.c:384
+msgid "Input Devices"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:394
+msgid "Keyboards"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:411
+msgid "Automatically run a program when an USB _keyboard is connected"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:426
+msgid "Mice"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:443
+msgid "Automatically run a program when an USB _mouse is connected"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:458
+msgid "Tablet"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:475
+msgid "Automatically run a program when a _tablet is connected"
+msgstr ""
+
+#: thunar-volman/tvm-preferences-dialog.c:480
+msgid "Com_mand:"
+msgstr ""
+
+#: thunar-volman/tvm-run.c:133 thunar-volman/tvm-run.c:144
+msgid "Choose Disc Type"
+msgstr ""
+
+#: thunar-volman/tvm-run.c:134 thunar-volman/tvm-run.c:145
+msgid "You have inserted a blank disc."
+msgstr ""
+
+#: thunar-volman/tvm-run.c:135 thunar-volman/tvm-run.c:146
+msgid "What would you like to do?"
+msgstr ""
+
+#: thunar-volman/tvm-run.c:137
+msgid "Make _DVD"
+msgstr ""
+
+#: thunar-volman/tvm-run.c:148
+msgid "Make _Data CD"
+msgstr ""
+
+#: thunar-volman/tvm-run.c:149
+msgid "Make _Audio CD"
+msgstr ""
Property changes on: thunar-volman/trunk/thunar-volman
___________________________________________________________________
Name: svn:ignore
+ .deps
.libs
Makefile
Makefile.in
.*.swp
thunar-volman
Added: thunar-volman/trunk/thunar-volman/Makefile.am
===================================================================
--- thunar-volman/trunk/thunar-volman/Makefile.am (rev 0)
+++ thunar-volman/trunk/thunar-volman/Makefile.am 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,60 @@
+# $Id$
+
+INCLUDES = \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ -DBINDIR=\"$(bindir)\" \
+ -DEXO_API_SUBJECT_TO_CHANGE \
+ -DEXO_DISABLE_DEPRECATED \
+ -DG_LOG_DOMAIN=\"thunar-volman\" \
+ -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
+ $(PLATFORM_CPPFLAGS)
+
+bin_PROGRAMS = \
+ thunar-volman
+
+thunar_volman_SOURCES = \
+ main.c \
+ tvm-block-device.c \
+ tvm-block-device.h \
+ tvm-camera-device.c \
+ tvm-camera-device.h \
+ tvm-command-entry.c \
+ tvm-command-entry.h \
+ tvm-device.c \
+ tvm-device.h \
+ tvm-input-device.c \
+ tvm-input-device.h \
+ tvm-pango-extensions.c \
+ tvm-pango-extensions.h \
+ tvm-preferences-dialog.c \
+ tvm-preferences-dialog.h \
+ tvm-preferences.c \
+ tvm-preferences.h \
+ tvm-prompt.c \
+ tvm-prompt.h \
+ tvm-run.c \
+ tvm-run.h \
+ xfce-heading.c \
+ xfce-heading.h \
+ xfce-titled-dialog.c \
+ xfce-titled-dialog.h
+
+thunar_volman_CFLAGS = \
+ $(DBUS_CFLAGS) \
+ $(EXO_HAL_CFLAGS) \
+ $(HAL_CFLAGS) \
+ $(THUNAR_VFS_CFLAGS) \
+ $(PLATFORM_CFLAGS)
+
+thunar_volman_LDFLAGS = \
+ -no-undefined \
+ $(PLATFORM_LDFLAGS)
+
+thunar_volman_LDADD = \
+ $(DBUS_LIBS) \
+ $(EXO_HAL_LIBS) \
+ $(HAL_LIBS) \
+ $(THUNAR_VFS_LIBS)
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
Property changes on: thunar-volman/trunk/thunar-volman/Makefile.am
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/main.c
===================================================================
--- thunar-volman/trunk/thunar-volman/main.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/main.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,164 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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 <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <glib/gstdio.h>
+
+#include <exo-hal/exo-hal.h>
+
+#include <thunar-vfs/thunar-vfs.h>
+
+#include <thunar-volman/tvm-device.h>
+#include <thunar-volman/tvm-preferences-dialog.h>
+
+
+
+/* --- globals --- */
+static gchar *opt_hal_udi = NULL;
+static gboolean opt_configure = FALSE;
+static gboolean opt_version = FALSE;
+
+
+
+/* --- command line options --- */
+static GOptionEntry option_entries[] =
+{
+ { "device-added", 'a', 0, G_OPTION_ARG_STRING, &opt_hal_udi, N_ ("The HAL device UDI of the newly added device"), NULL, },
+ { "configure", 'c', 0, G_OPTION_ARG_NONE, &opt_configure, N_ ("Configure management of removable drives and media"), NULL, },
+ { "version", 'v', 0, G_OPTION_ARG_NONE, &opt_version, N_ ("Print version information and exit"), NULL, },
+ { NULL, },
+};
+
+
+
+int
+main (int argc, char **argv)
+{
+ TvmPreferences *preferences;
+ GtkWidget *dialog;
+ GError *err = NULL;
+
+ /* setup translation domain */
+ xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+
+ /* setup application name */
+ g_set_application_name (_("Thunar Volume Manager"));
+
+#ifdef G_ENABLE_DEBUG
+ /* Do NOT remove this line for now, If something doesn't work,
+ * fix your code instead!
+ */
+ g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
+#endif
+
+ /* initialize the GThread system */
+ if (!g_thread_supported ())
+ g_thread_init (NULL);
+
+ /* initialize Gtk+ */
+ if (!gtk_init_with_args (&argc, &argv, NULL, option_entries, GETTEXT_PACKAGE, &err))
+ {
+ /* check if we have an error message */
+ if (G_LIKELY (err == NULL))
+ {
+ /* no error message, the GUI initialization failed */
+ const gchar *display_name = gdk_get_display_arg_name ();
+ g_fprintf (stderr, "thunar-volman: %s: %s.\n", _("Failed to open display"), (display_name != NULL) ? display_name : " ");
+ }
+ else
+ {
+ /* yep, there's an error, so print it */
+ g_fprintf (stderr, "%s: %s.\n", g_get_prgname (), err->message);
+ g_error_free (err);
+ }
+ return EXIT_FAILURE;
+ }
+
+ /* check if we should print version information */
+ if (G_UNLIKELY (opt_version))
+ {
+ g_print ("%s %s (Xfce %s)\n\n", PACKAGE_NAME, PACKAGE_VERSION, xfce_version_string ());
+ g_print ("%s\n", "Copyright (c) 2004-2007");
+ g_print ("\t%s\n\n", _("The Thunar development team. All rights reserved."));
+ g_print ("%s\n\n", _("Written by Benedikt Meurer <benny at xfce.org>."));
+ g_print (_("Please report bugs to <%s>."), PACKAGE_BUGREPORT);
+ g_print ("\n");
+ return EXIT_SUCCESS;
+ }
+
+ /* initialize the ThunarVFS library */
+ thunar_vfs_init ();
+
+ /* load the preferences for the volume manager */
+ preferences = tvm_preferences_get ();
+
+ /* check if we should configure the volume manager */
+ if (G_UNLIKELY (opt_configure))
+ {
+ /* bring up the preferences dialog */
+ dialog = tvm_preferences_dialog_new ();
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+ else if (G_LIKELY (opt_hal_udi != NULL))
+ {
+ /* make sure the specified UDI is valid */
+ if (!exo_hal_udi_validate (opt_hal_udi, -1, NULL))
+ {
+ /* TRANSLATORS: A HAL device UDI must match certain conditions to be valid (to be exact, it must be a valid D-Bus object path) */
+ g_set_error (&err, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("The specified UDI \"%s\" is not a valid HAL device UDI"), opt_hal_udi);
+ }
+ else
+ {
+ /* try to handle the newly added device */
+ tvm_device_added (preferences, opt_hal_udi, &err);
+ }
+ }
+ else
+ {
+ /* TRANSLATORS: thunar-volman wasn't invoked with either --device-added or --configure. */
+ g_set_error (&err, G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Must specify the new HAL device UDI with --device-added"));
+ }
+
+ /* flush the preferences */
+ g_object_unref (G_OBJECT (preferences));
+
+ /* shutdown thunar-vfs */
+ thunar_vfs_shutdown ();
+
+ /* check if an error occurred */
+ if (G_UNLIKELY (err != NULL))
+ {
+ /* tell the user about the problem */
+ g_fprintf (stderr, "%s: %s.\n", g_get_prgname (), err->message);
+ g_error_free (err);
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
+}
+
Property changes on: thunar-volman/trunk/thunar-volman/main.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-block-device.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-block-device.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-block-device.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,691 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include <thunar-volman/tvm-block-device.h>
+#include <thunar-volman/tvm-prompt.h>
+#include <thunar-volman/tvm-run.h>
+
+
+
+static gboolean tvm_block_device_autoipod (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *device_file,
+ const gchar *mount_point,
+ GError **error);
+static gboolean tvm_block_device_autophoto (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *device_file,
+ const gchar *mount_point,
+ GError **error);
+static gboolean tvm_block_device_autorun (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *device_file,
+ const gchar *mount_point,
+ GError **error);
+static gboolean tvm_block_device_mount (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ GError **error);
+static gboolean tvm_block_device_mounted (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *device_file,
+ const gchar *mount_point,
+ GError **error);
+
+
+
+static gboolean
+tvm_block_device_autoipod (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *device_file,
+ const gchar *mount_point,
+ GError **error)
+{
+ gboolean result = FALSE;
+ gboolean autoipod;
+ gchar *autoipod_command;
+ gchar *autophoto_command;
+ gchar *storage_udi;
+ gchar *path_dcim = NULL;
+ gchar *product;
+ gint response;
+
+ /* check if music players should be handled automatically */
+ g_object_get (G_OBJECT (preferences), "autoipod", &autoipod, "autoipod-command", &autoipod_command, NULL);
+ if (G_LIKELY (autoipod && autoipod_command != NULL && *autoipod_command != '\0'))
+ {
+ /* determine the storage device UDI */
+ storage_udi = libhal_device_get_property_string (context, udi, "block.storage_device", NULL);
+ if (G_LIKELY (storage_udi != NULL))
+ {
+ /* check if we have a portable audio player here */
+ if (libhal_device_query_capability (context, storage_udi, "portable_audio_player", NULL))
+ {
+ /* check if we have an iPod here */
+ product = libhal_device_get_property_string (context, storage_udi, "info.product", NULL);
+ if (product != NULL && strcmp (product, "iPod") != 0)
+ {
+ /* an iPod may have photos */
+ path_dcim = g_build_filename (mount_point, "dcim", NULL);
+ if (!g_file_test (path_dcim, G_FILE_TEST_IS_DIR))
+ {
+ /* no photos */
+ g_free (path_dcim);
+ path_dcim = NULL;
+ }
+ else
+ {
+ /* add the "content.photos" capability to this device */
+ libhal_device_add_capability (context, udi, "content.photos", NULL);
+ }
+ }
+ libhal_free_string (product);
+ }
+
+ /* check if autophoto command is specified, else we cannot handle the photos on the iPod anyway */
+ g_object_get (G_OBJECT (preferences), "autophoto-command", &autophoto_command, NULL);
+ if (G_UNLIKELY (autophoto_command == NULL || *autophoto_command == '\0'))
+ {
+ /* cannot handle photos */
+ g_free (path_dcim);
+ path_dcim = NULL;
+ }
+
+ /* iPods can carry both music and photos... */
+ if (G_LIKELY (path_dcim != NULL))
+ {
+ /* ...so we need to prompt what to do */
+ response = tvm_prompt (context, udi, "gnome-dev-ipod", _("Photos and Music"),
+ _("Photos were found on your portable music player."),
+ _("Would you like to import the photos or manage the music?"),
+ _("Ig_nore"), GTK_RESPONSE_CANCEL,
+ _("Import _Photos"), TVM_RESPONSE_PHOTOS,
+ _("Manage _Music"), TVM_RESPONSE_MUSIC,
+ NULL);
+ }
+ else
+ {
+ /* no photos, so we can manage only music */
+ response = TVM_RESPONSE_MUSIC;
+ }
+
+ /* check what to do */
+ if (response == TVM_RESPONSE_MUSIC)
+ {
+ /* run the preferred application to manage music players */
+ result = tvm_run_command (context, udi, autoipod_command, device_file, mount_point, error);
+ }
+ else if (response == TVM_RESPONSE_PHOTOS)
+ {
+ /* run the preferred application to manage photos */
+ result = tvm_run_command (context, udi, autophoto_command, device_file, mount_point, error);
+ }
+
+ /* cleanup */
+ libhal_free_string (storage_udi);
+ g_free (autophoto_command);
+ g_free (path_dcim);
+ }
+ }
+
+ /* cleanup */
+ g_free (autoipod_command);
+
+ return result;
+}
+
+
+
+static gboolean
+tvm_block_device_autophoto (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *device_file,
+ const gchar *mount_point,
+ GError **error)
+{
+ gboolean result = FALSE;
+ gboolean autophoto;
+ gchar *autophoto_command;
+ gchar *path_dcim;
+ gint response;
+
+ /* check autophoto support is enabled */
+ g_object_get (G_OBJECT (preferences), "autophoto", &autophoto, "autophoto-command", &autophoto_command, NULL);
+ if (G_LIKELY (autophoto && autophoto_command != NULL && *autophoto_command != '\0'))
+ {
+ /* check if we have photos on the volume */
+ path_dcim = g_build_filename (mount_point, "dcim", NULL);
+ if (g_file_test (path_dcim, G_FILE_TEST_IS_DIR))
+ {
+ /* add the "content.photos" capability to this device */
+ libhal_device_add_capability (context, udi, "content.photos", NULL);
+
+ /* ask the user whether to import photos */
+ response = tvm_prompt (context, udi, "camera-photo", _("Photo Import"),
+ _("A photo card has been detected."),
+ _("There are photos on the card. Would you like to add these photos to your album?"),
+ _("Ig_nore"), GTK_RESPONSE_CANCEL,
+ _("Import _Photos"), TVM_RESPONSE_PHOTOS,
+ NULL);
+ if (G_LIKELY (response == TVM_RESPONSE_PHOTOS))
+ {
+ /* run the preferred application to manage photos */
+ result = tvm_run_command (context, udi, autophoto_command, device_file, mount_point, error);
+ }
+ else
+ {
+ /* pretend that we handled the device */
+ result = TRUE;
+ }
+ }
+ g_free (path_dcim);
+ }
+ g_free (autophoto_command);
+
+ return result;
+}
+
+
+
+static gboolean
+tvm_block_device_autorun (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *device_file,
+ const gchar *mount_point,
+ GError **error)
+{
+ struct stat statb_mount_point;
+ struct stat statb_autoopen;
+ gboolean result;
+ gboolean autoopen;
+ gboolean autoplay;
+ gboolean autorun;
+ gchar *autoplay_command;
+ gchar *path_video_ts;
+ gchar *path_autoopen;
+ gchar *path_autorun;
+ gchar line[1024];
+ gchar *path_vcd;
+ gchar *message;
+ gchar **argv;
+ FILE *fp;
+ gint response;
+ gint n;
+
+ /* check if autoplay video CDs/DVDs is enabled */
+ g_object_get (G_OBJECT (preferences), "autoplay-video-cd", &autoplay, "autoplay-video-cd-command", &autoplay_command, NULL);
+ if (G_LIKELY (autoplay))
+ {
+ /* check if we have a video CD or video DVD here */
+ path_vcd = g_build_filename (mount_point, "vcd", NULL);
+ path_video_ts = g_build_filename (mount_point, "video_ts", NULL);
+ if (g_file_test (path_vcd, G_FILE_TEST_IS_DIR) || g_file_test (path_video_ts, G_FILE_TEST_IS_DIR))
+ {
+ /* try to spawn the preferred video CD/DVD-Player */
+ result = tvm_run_command (context, udi, autoplay_command, device_file, mount_point, error);
+ g_free (autoplay_command);
+ g_free (path_video_ts);
+ g_free (path_vcd);
+ return result;
+ }
+
+ /* cleanup */
+ g_free (path_video_ts);
+ g_free (path_vcd);
+ }
+ g_free (autoplay_command);
+
+ /* check if autorun support is enabled */
+ g_object_get (G_OBJECT (preferences), "autorun", &autorun, NULL);
+ if (G_LIKELY (autorun))
+ {
+ /* "Autostart Files" (Desktop Application Autostart Specification) */
+ static const gchar *AUTORUN[] = { ".autorun", "autorun", "autorun.sh" };
+ for (n = 0; n < G_N_ELEMENTS (AUTORUN); ++n)
+ {
+ /* check if one of the autorun files is present and executable */
+ path_autorun = g_build_filename (mount_point, AUTORUN[n], NULL);
+ if (g_file_test (path_autorun, G_FILE_TEST_IS_EXECUTABLE))
+ {
+ /* prompt the user whether to execute this file */
+ message = g_strdup_printf (_("Would you like to allow \"%s\" to run?"), AUTORUN[n]);
+ response = tvm_prompt (context, udi, "gnome-fs-executable", _("Auto-Run Confirmation"),
+ _("Auto-Run capability detected"), message,
+ _("Ig_nore"), GTK_RESPONSE_CANCEL,
+ _("_Allow Auto-Run"), TVM_RESPONSE_AUTORUN,
+ NULL);
+ g_free (message);
+
+ /* check if we should autorun */
+ if (response == TVM_RESPONSE_AUTORUN)
+ {
+ /* prepare argv to launch autorun file */
+ argv = g_new (gchar *, 2);
+ argv[0] = path_autorun;
+ argv[1] = NULL;
+
+ /* try to launch the autorun file */
+ result = g_spawn_async (mount_point, argv, NULL, 0, NULL, NULL, NULL, error);
+
+ /* cleanup */
+ g_strfreev (argv);
+
+ /* outa here */
+ return result;
+ }
+ }
+ g_free (path_autorun);
+ }
+ }
+
+ /* check if autoopen support is enabled */
+ g_object_get (G_OBJECT (preferences), "autoopen", &autoopen, NULL);
+ if (G_LIKELY (autoopen))
+ {
+ /* "Autoopen Files" (Desktop Application Autostart Specification) */
+ static const gchar *AUTOOPEN[] = { ".autoopen", "autoopen" };
+ for (n = 0; n < G_N_ELEMENTS (AUTOOPEN); ++n)
+ {
+ /* check if one of the autoopen files is present */
+ path_autoopen = g_build_filename (mount_point, AUTOOPEN[n], NULL);
+ fp = fopen (path_autoopen, "r");
+ g_free (path_autoopen);
+
+ /* check if the file could be opened */
+ if (G_UNLIKELY (fp != NULL))
+ {
+ /* read the first line of the file (MUST NOT be an absolute path) */
+ if (fgets (line, sizeof (line), fp) != NULL && !g_path_is_absolute (line))
+ {
+ /* determine the absolute path of the file */
+ path_autoopen = g_build_filename (mount_point, line, NULL);
+
+ /* the file must exist on exactly this device */
+ if (stat (mount_point, &statb_mount_point) == 0 && stat (path_autoopen, &statb_autoopen) == 0
+ && S_ISREG (statb_autoopen.st_mode) && (statb_autoopen.st_mode & 0111) == 0
+ && (statb_mount_point.st_dev == statb_autoopen.st_dev))
+ {
+ /* prompt the user whether to autoopen this file */
+ message = g_strdup_printf (_("Would you like to open \"%s\"?"), AUTOOPEN[n]);
+ response = tvm_prompt (context, udi, "gnome-fs-executable", _("Auto-Open Confirmation"),
+ _("Auto-Open capability detected"), message,
+ _("Ig_nore"), GTK_RESPONSE_CANCEL,
+ _("_Open"), TVM_RESPONSE_AUTOOPEN,
+ NULL);
+ g_free (message);
+
+ /* check if we should autoopen */
+ if (response == TVM_RESPONSE_AUTOOPEN)
+ {
+ /* prepare the command to autoopen */
+ argv = g_new (gchar *, 3);
+ argv[0] = g_strdup ("Thunar");
+ argv[1] = path_autoopen;
+ argv[2] = NULL;
+
+ /* let Thunar open the file */
+ result = g_spawn_async (mount_point, argv, NULL, 0, NULL, NULL, NULL, error);
+
+ /* cleanup */
+ g_free (path_autoopen);
+ fclose (fp);
+ return result;
+ }
+ }
+
+ /* cleanup */
+ g_free (path_autoopen);
+ }
+
+ /* close the file handle */
+ fclose (fp);
+ }
+ }
+ }
+
+ /* not handled */
+ return FALSE;
+}
+
+
+
+static gboolean
+tvm_block_device_mount (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ GError **error)
+{
+ DBusError derror;
+ gboolean result = FALSE;
+ GSList *mount_points;
+ gchar *device_file;
+ gchar *argv[4];
+ gint status;
+
+ /* check if we should ignore the volume, if so, pretend that we succeed */
+ if (libhal_device_get_property_bool (context, udi, "volume.ignore", NULL))
+ return TRUE;
+
+ /* generate the command to mount the device */
+ argv[0] = (gchar *) "exo-mount";
+ argv[1] = (gchar *) "--hal-udi";
+ argv[2] = (gchar *) udi;
+ argv[3] = NULL;
+
+ /* let exo-mount mount the device */
+ if (!g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, &status, error))
+ {
+ /* failed to spawn the exo-mount command */
+ return FALSE;
+ }
+ else if (!WIFEXITED (status) || WEXITSTATUS (status) != 0)
+ {
+ /* exo-mount failed, but already displayed an error */
+ return TRUE;
+ }
+
+ /* initalize D-Bus error */
+ dbus_error_init (&derror);
+
+ /* successfully mounted the device, determine the device file */
+ device_file = libhal_device_get_property_string (context, udi, "block.device", &derror);
+ if (G_UNLIKELY (device_file == NULL))
+ {
+ /* propagate the error */
+ dbus_set_g_error (error, &derror);
+ return FALSE;
+ }
+
+ /* determine the active mount point(s) for the device from the kernel */
+ mount_points = exo_mount_point_list_matched (EXO_MOUNT_POINT_MATCH_ACTIVE | EXO_MOUNT_POINT_MATCH_DEVICE, device_file, NULL, NULL, error);
+ if (G_LIKELY (mount_points != NULL))
+ {
+ /* try to handled the mounted volume */
+ result = tvm_block_device_mounted (preferences, context, udi, device_file, ((ExoMountPoint *) mount_points->data)->folder, error);
+
+ /* release the mount points */
+ g_slist_foreach (mount_points, (GFunc) exo_mount_point_free, NULL);
+ g_slist_free (mount_points);
+ }
+
+ /* release the device file */
+ libhal_free_string (device_file);
+
+ return result;
+}
+
+
+
+
+static gboolean
+tvm_block_device_mounted (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *device_file,
+ const gchar *mount_point,
+ GError **error)
+{
+ gboolean autobrowse;
+ gboolean result;
+ GError *err = NULL;
+
+ /* check if we have a portable media player here */
+ result = tvm_block_device_autoipod (preferences, context, udi, device_file, mount_point, &err);
+ if (G_LIKELY (!result && err == NULL))
+ {
+ /* check if we have a digital photo camera here */
+ result = tvm_block_device_autophoto (preferences, context, udi, device_file, mount_point, &err);
+ if (G_LIKELY (!result && err == NULL))
+ {
+ /* try autorun (video CD/DVD, autoopen, etc.) first */
+ result = tvm_block_device_autorun (preferences, context, udi, device_file, mount_point, &err);
+ if (G_LIKELY (!result && err == NULL))
+ {
+ /* check if we should autobrowse the mount point folder */
+ g_object_get (G_OBJECT (preferences), "autobrowse", &autobrowse, NULL);
+ if (G_LIKELY (autobrowse))
+ {
+ /* open the mount point folder in Thunar */
+ result = tvm_run_command (context, udi, "Thunar %m", device_file, mount_point, &err);
+ }
+ }
+ }
+ }
+
+ /* check if we need to propagate an error */
+ if (G_UNLIKELY (err != NULL))
+ {
+ /* propagate the error */
+ g_propagate_error (error, err);
+ result = FALSE;
+ }
+
+ return result;
+}
+
+
+
+/**
+ * tvm_block_device_added:
+ * @preferences : a #TvmPreferences.
+ * @context : a #LibHalContext.
+ * @udi : the HAL device UDI of the newly added block device.
+ * @capability : the capability, which caused this handler to be run.
+ * @error : return location for errors or %NULL.
+ *
+ * See #TvmDeviceCallback for further information.
+ *
+ * Return value: %TRUE if handled, %FALSE if not handled or an
+ * unrecoverable error occurred.
+ **/
+gboolean
+tvm_block_device_added (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *capability,
+ GError **error)
+{
+ DBusError derror;
+ gboolean disc_has_audio;
+ gboolean disc_has_data;
+ gboolean automount;
+ gboolean autoplay;
+ gboolean is_cdrom;
+ gchar *storage_udi;
+ gchar *drive_type;
+ gint response;
+
+ g_return_val_if_fail (exo_hal_udi_validate (udi, -1, NULL), FALSE);
+ g_return_val_if_fail (TVM_IS_PREFERENCES (preferences), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (capability != NULL, FALSE);
+ g_return_val_if_fail (context != NULL, FALSE);
+
+ /* initialize D-Bus error */
+ dbus_error_init (&derror);
+
+ /* verify that we have a mountable volume here */
+ if (!libhal_device_get_property_bool (context, udi, "block.is_volume", &derror))
+ {
+err0: /* check if we have an error to propagate */
+ if (dbus_error_is_set (&derror))
+ {
+ /* propagate the error */
+ dbus_set_g_error (error, &derror);
+ dbus_error_free (&derror);
+ }
+
+ return FALSE;
+ }
+
+ /* determine the HAL UDI of the backing storage device */
+ storage_udi = libhal_device_get_property_string (context, udi, "block.storage_device", &derror);
+ if (G_UNLIKELY (storage_udi == NULL))
+ goto err0;
+
+ /* if the partition_table_changed flag is set, we don't want to mount as a partitioning tool might be modifying this device */
+ if (libhal_device_get_property_bool (context, storage_udi, "storage.partition_table_changed", NULL))
+ {
+err1: libhal_free_string (storage_udi);
+ goto err0;
+ }
+
+ /* check if this device supports removable media */
+ if (libhal_device_get_property_bool (context, storage_udi, "storage.removable", NULL))
+ {
+ /* check if the device is locked */
+ if (libhal_device_get_property_bool (context, storage_udi, "info.locked", NULL))
+ {
+ /* pretend that we handled the device */
+ libhal_free_string (storage_udi);
+ return TRUE;
+ }
+
+ /* determine the drive type */
+ drive_type = libhal_device_get_property_string (context, storage_udi, "storage.drive_type", &derror);
+ if (G_UNLIKELY (drive_type == NULL))
+ goto err1;
+
+ /* check if we have a CD-ROM here */
+ is_cdrom = (strcmp (drive_type, "cdrom") == 0);
+
+ /* we don't need the storage UDI any more */
+ libhal_free_string (storage_udi);
+
+ /* free the drive type */
+ libhal_free_string (drive_type);
+
+ /* CD-ROMs deserve special handling */
+ if (G_LIKELY (is_cdrom))
+ {
+ /* check for blank discs */
+ if (libhal_device_get_property_bool (context, udi, "volume.disc.is_blank", NULL))
+ {
+ /* run the preferred CD-Burner application */
+ return tvm_run_cdburner (preferences, context, udi, error);
+ }
+ else
+ {
+ /* check if we have DATA/AUDIO tracks */
+ disc_has_audio = libhal_device_get_property_bool (context, udi, "volume.disc.has_audio", NULL);
+ disc_has_data = libhal_device_get_property_bool (context, udi, "volume.disc.has_data", NULL);
+ if (G_UNLIKELY (disc_has_audio && disc_has_data))
+ {
+ /* check if we need to prompt the user */
+ g_object_get (G_OBJECT (preferences), "automount-media", &automount, "autoplay-audio-cd", &autoplay, NULL);
+ if (G_LIKELY (automount && autoplay))
+ {
+ /* ask what do with the mixed audio/data disc */
+ response = tvm_prompt (context, udi, "gnome-dev-cdrom-audio", _("Audio / Data CD"),
+ _("The CD in the drive contains both music and files."),
+ _("Would you like to listen to music or browse the files?"),
+ _("Ig_nore"), GTK_RESPONSE_CANCEL,
+ _("_Browse Files"), TVM_RESPONSE_BROWSE,
+ _("_Play CD"), TVM_RESPONSE_PLAY,
+ NULL);
+ switch (response)
+ {
+ case TVM_RESPONSE_PLAY:
+ goto autoplay_disc;
+
+ case TVM_RESPONSE_BROWSE:
+ goto automount_disc;
+
+ default:
+ break;
+ }
+ }
+ else if (automount)
+ {
+ /* just automount the media */
+ goto automount_disc;
+ }
+ else if (autoplay)
+ {
+ /* just autoplay the disc */
+ goto autoplay_disc;
+ }
+ }
+ else if (G_LIKELY (disc_has_audio))
+ {
+autoplay_disc: /* run the preferred CD-Player application */
+ return tvm_run_cdplayer (preferences, context, udi, error);
+ }
+ else if (G_LIKELY (disc_has_data))
+ {
+automount_disc: /* check if we should automount removable media */
+ g_object_get (G_OBJECT (preferences), "automount-media", &automount, NULL);
+ if (G_LIKELY (automount))
+ {
+ /* try to mount the CD-ROM in the disc */
+ return tvm_block_device_mount (preferences, context, udi, error);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ /* we don't need the storage UDI any more */
+ libhal_free_string (storage_udi);
+ }
+
+ /* check if we should automount drives, otherwise, we're done here */
+ g_object_get (G_OBJECT (preferences), "automount-drives", &automount, NULL);
+ if (G_UNLIKELY (!automount))
+ return FALSE;
+
+ /* try to mount the block device */
+ return tvm_block_device_mount (preferences, context, udi, error);
+}
+
+
+
+
Property changes on: thunar-volman/trunk/thunar-volman/tvm-block-device.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-block-device.h
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-block-device.h (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-block-device.h 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,35 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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 __TVM_BLOCK_DEVICE_H__
+#define __TVM_BLOCK_DEVICE_H__
+
+#include <thunar-volman/tvm-device.h>
+
+G_BEGIN_DECLS;
+
+gboolean tvm_block_device_added (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *capability,
+ GError **error) G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* !__TVM_BLOCK_DEVICE_H__ */
Property changes on: thunar-volman/trunk/thunar-volman/tvm-block-device.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-camera-device.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-camera-device.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-camera-device.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,89 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <thunar-volman/tvm-camera-device.h>
+#include <thunar-volman/tvm-prompt.h>
+#include <thunar-volman/tvm-run.h>
+
+
+
+/**
+ * tvm_block_camera_added:
+ * @preferences : a #TvmPreferences.
+ * @context : a #LibHalContext.
+ * @udi : the HAL device UDI of the newly added camera device.
+ * @capability : the capability, which caused this handler to be run.
+ * @error : return location for errors or %NULL.
+ *
+ * See #TvmDeviceCallback for further information.
+ *
+ * Return value: %TRUE if handled, %FALSE if not handled or an
+ * unrecoverable error occurred.
+ **/
+gboolean
+tvm_camera_device_added (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *capability,
+ GError **error)
+{
+ gboolean result = FALSE;
+ gboolean autophoto;
+ gchar *autophoto_command;
+ gchar *access_method;
+
+ g_return_val_if_fail (exo_hal_udi_validate (udi, -1, NULL), FALSE);
+ g_return_val_if_fail (TVM_IS_PREFERENCES (preferences), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (capability != NULL, FALSE);
+ g_return_val_if_fail (context != NULL, FALSE);
+
+ /* check if this is a non-mass-storage camera device, handled by gphoto2 */
+ access_method = libhal_device_get_property_string (context, udi, "camera.access_method", NULL);
+ if ((access_method != NULL && strcmp (access_method, "ptp") == 0)
+ || libhal_device_get_property_bool (context, udi, "camera.libgphoto2.support", NULL))
+ {
+ /* check if autophoto support is enabled */
+ g_object_get (G_OBJECT (preferences), "autophoto", &autophoto, "autophoto-command", &autophoto_command, NULL);
+ if (G_LIKELY (autophoto && autophoto_command != NULL && *autophoto_command != '\0'))
+ {
+ /* run the preferred photo management application */
+ result = tvm_run_command (context, udi, autophoto_command, NULL, NULL, error);
+ }
+ g_free (autophoto_command);
+ }
+ libhal_free_string (access_method);
+
+ return result;
+}
+
+
+
+
Property changes on: thunar-volman/trunk/thunar-volman/tvm-camera-device.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-camera-device.h
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-camera-device.h (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-camera-device.h 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,35 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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 __TVM_CAMERA_DEVICE_H__
+#define __TVM_CAMERA_DEVICE_H__
+
+#include <thunar-volman/tvm-device.h>
+
+G_BEGIN_DECLS;
+
+gboolean tvm_camera_device_added (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *capability,
+ GError **error) G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* !__TVM_CAMERA_DEVICE_H__ */
Property changes on: thunar-volman/trunk/thunar-volman/tvm-camera-device.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-command-entry.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-command-entry.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-command-entry.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,411 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2005-2007 Benedikt Meurer <benny at xfce.org>
+ *
+ * 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
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <thunar-volman/tvm-command-entry.h>
+
+
+
+/* Property identifiers */
+enum
+{
+ PROP_0,
+ PROP_COMMAND,
+};
+
+
+
+static void tvm_command_entry_class_init (TvmCommandEntryClass *klass);
+static void tvm_command_entry_init (TvmCommandEntry *command_entry);
+static void tvm_command_entry_finalize (GObject *object);
+static void tvm_command_entry_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void tvm_command_entry_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void tvm_command_entry_clicked (GtkWidget *button,
+ TvmCommandEntry *command_entry);
+
+
+
+static GObjectClass *tvm_command_entry_parent_class;
+
+
+
+GType
+tvm_command_entry_get_type (void)
+{
+ static GType type = G_TYPE_INVALID;
+
+ if (G_UNLIKELY (type == G_TYPE_INVALID))
+ {
+ static const GTypeInfo info =
+ {
+ sizeof (TvmCommandEntryClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) tvm_command_entry_class_init,
+ NULL,
+ NULL,
+ sizeof (TvmCommandEntry),
+ 0,
+ (GInstanceInitFunc) tvm_command_entry_init,
+ NULL,
+ };
+
+ type = g_type_register_static (GTK_TYPE_HBOX, I_("TvmCommandEntry"), &info, 0);
+ }
+
+ return type;
+}
+
+
+
+static void
+tvm_command_entry_class_init (TvmCommandEntryClass *klass)
+{
+ GObjectClass *gobject_class;
+
+ /* determine the parent type class */
+ tvm_command_entry_parent_class = g_type_class_peek_parent (klass);
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = tvm_command_entry_finalize;
+ gobject_class->get_property = tvm_command_entry_get_property;
+ gobject_class->set_property = tvm_command_entry_set_property;
+
+ /**
+ * TvmCommandEntry:command:
+ *
+ * The command currently entered into this command entry widget.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_COMMAND,
+ g_param_spec_string ("command",
+ "command",
+ "command",
+ NULL,
+ EXO_PARAM_READWRITE));
+}
+
+
+
+static void
+tvm_command_entry_init (TvmCommandEntry *command_entry)
+{
+ GtkWidget *button;
+ GtkWidget *align;
+ GtkWidget *image;
+
+ gtk_box_set_spacing (GTK_BOX (command_entry), 2);
+
+ align = g_object_new (GTK_TYPE_ALIGNMENT, "width-request", 10, NULL);
+ gtk_box_pack_start (GTK_BOX (command_entry), align, FALSE, FALSE, 0);
+ gtk_widget_show (align);
+
+ command_entry->label = g_object_new (GTK_TYPE_LABEL, "use-underline", TRUE, "xalign", 0.0f, NULL);
+ gtk_box_pack_start (GTK_BOX (command_entry), command_entry->label, FALSE, FALSE, 10);
+ gtk_widget_show (command_entry->label);
+
+ command_entry->entry = gtk_entry_new ();
+ gtk_label_set_mnemonic_widget (GTK_LABEL (command_entry->label), command_entry->entry);
+ exo_mutual_binding_new (G_OBJECT (command_entry->entry), "text", G_OBJECT (command_entry), "command");
+ gtk_box_pack_start (GTK_BOX (command_entry), command_entry->entry, TRUE, TRUE, 0);
+ gtk_widget_show (command_entry->entry);
+
+ button = gtk_button_new ();
+ g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (tvm_command_entry_clicked), command_entry);
+ gtk_box_pack_start (GTK_BOX (command_entry), button, FALSE, FALSE, 0);
+ gtk_widget_show (button);
+
+ image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
+ gtk_container_add (GTK_CONTAINER (button), image);
+ gtk_widget_show (image);
+}
+
+
+
+static void
+tvm_command_entry_finalize (GObject *object)
+{
+ TvmCommandEntry *command_entry = TVM_COMMAND_ENTRY (object);
+
+ /* cleanup properties */
+ g_free (command_entry->command);
+
+ (*G_OBJECT_CLASS (tvm_command_entry_parent_class)->finalize) (object);
+}
+
+
+
+static void
+tvm_command_entry_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ TvmCommandEntry *command_entry = TVM_COMMAND_ENTRY (object);
+
+ switch (prop_id)
+ {
+ case PROP_COMMAND:
+ g_value_set_string (value, tvm_command_entry_get_command (command_entry));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+
+static void
+tvm_command_entry_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ TvmCommandEntry *command_entry = TVM_COMMAND_ENTRY (object);
+
+ switch (prop_id)
+ {
+ case PROP_COMMAND:
+ tvm_command_entry_set_command (command_entry, g_value_get_string (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+
+
+static void
+tvm_command_entry_clicked (GtkWidget *button,
+ TvmCommandEntry *command_entry)
+{
+ GtkFileFilter *filter;
+ GtkWidget *toplevel;
+ GtkWidget *chooser;
+ gchar *filename;
+ gchar *s;
+
+ g_return_if_fail (GTK_IS_BUTTON (button));
+ g_return_if_fail (TVM_IS_COMMAND_ENTRY (command_entry));
+
+ /* determine the toplevel widget */
+ toplevel = gtk_widget_get_toplevel (button);
+ if (toplevel == NULL || !GTK_WIDGET_TOPLEVEL (toplevel))
+ return;
+
+ chooser = gtk_file_chooser_dialog_new (_("Select an Application"),
+ GTK_WINDOW (toplevel),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (chooser), TRUE);
+
+ /* add file chooser filters */
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("All Files"));
+ gtk_file_filter_add_pattern (filter, "*");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("Executable Files"));
+ gtk_file_filter_add_mime_type (filter, "application/x-csh");
+ gtk_file_filter_add_mime_type (filter, "application/x-executable");
+ gtk_file_filter_add_mime_type (filter, "application/x-perl");
+ gtk_file_filter_add_mime_type (filter, "application/x-python");
+ gtk_file_filter_add_mime_type (filter, "application/x-ruby");
+ gtk_file_filter_add_mime_type (filter, "application/x-shellscript");
+ gtk_file_filter_add_pattern (filter, "*.pl");
+ gtk_file_filter_add_pattern (filter, "*.py");
+ gtk_file_filter_add_pattern (filter, "*.rb");
+ gtk_file_filter_add_pattern (filter, "*.sh");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+ gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("Perl Scripts"));
+ gtk_file_filter_add_mime_type (filter, "application/x-perl");
+ gtk_file_filter_add_pattern (filter, "*.pl");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("Python Scripts"));
+ gtk_file_filter_add_mime_type (filter, "application/x-python");
+ gtk_file_filter_add_pattern (filter, "*.py");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("Ruby Scripts"));
+ gtk_file_filter_add_mime_type (filter, "application/x-ruby");
+ gtk_file_filter_add_pattern (filter, "*.rb");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("Shell Scripts"));
+ gtk_file_filter_add_mime_type (filter, "application/x-csh");
+ gtk_file_filter_add_mime_type (filter, "application/x-shellscript");
+ gtk_file_filter_add_pattern (filter, "*.sh");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+ /* use the bindir as default folder */
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser), BINDIR);
+
+ /* setup the currently selected file */
+ g_object_get (G_OBJECT (command_entry), "command", &filename, NULL);
+ if (G_LIKELY (filename != NULL))
+ {
+ /* use only the first argument */
+ s = strchr (filename, ' ');
+ if (G_UNLIKELY (s != NULL))
+ *s = '\0';
+
+ /* check if we have a file name */
+ if (G_LIKELY (*filename != '\0'))
+ {
+ /* check if the filename is not an absolute path */
+ if (G_LIKELY (!g_path_is_absolute (filename)))
+ {
+ /* try to lookup the filename in $PATH */
+ s = g_find_program_in_path (filename);
+ if (G_LIKELY (s != NULL))
+ {
+ /* use the absolute path instead */
+ g_free (filename);
+ filename = s;
+ }
+ }
+
+ /* check if we have an absolute path now */
+ if (G_LIKELY (g_path_is_absolute (filename)))
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (chooser), filename);
+ }
+
+ /* release the filename */
+ g_free (filename);
+ }
+
+ /* run the chooser dialog */
+ if (gtk_dialog_run (GTK_DIALOG (chooser)) == GTK_RESPONSE_ACCEPT)
+ {
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
+ tvm_command_entry_set_command (command_entry, filename);
+ g_free (filename);
+ }
+
+ gtk_widget_destroy (chooser);
+}
+
+
+
+/**
+ * tvm_command_entry_new:
+ *
+ * Allocates a new #TvmCommandEntry instance.
+ *
+ * Return value: the newly allocated #TvmCommandEntry.
+ **/
+GtkWidget*
+tvm_command_entry_new (void)
+{
+ return g_object_new (TVM_TYPE_COMMAND_ENTRY, NULL);
+}
+
+
+
+/**
+ * tvm_command_entry_new:
+ * @label : the label for the command entry.
+ *
+ * Allocates a new #TvmCommandEntry instance with the @label.
+ *
+ * Return value: the newly allocated #TvmCommandEntry.
+ **/
+GtkWidget*
+tvm_command_entry_new_with_label (const gchar *label)
+{
+ TvmCommandEntry *entry;
+
+ g_return_val_if_fail (label == NULL || g_utf8_validate (label, -1, NULL), NULL);
+
+ entry = g_object_new (TVM_TYPE_COMMAND_ENTRY, NULL);
+ if (G_LIKELY (label != NULL))
+ g_object_set (G_OBJECT (entry->label), "label", label, "use-underline", TRUE, NULL);
+ return GTK_WIDGET (entry);
+}
+
+
+
+/**
+ * tvm_command_entry_get_command:
+ * @command_entry : a #TvmCommandEntry.
+ *
+ * Returns the command of the @command_entry.
+ *
+ * Return value: the command in the @command_entry.
+ **/
+const gchar*
+tvm_command_entry_get_command (TvmCommandEntry *command_entry)
+{
+ g_return_val_if_fail (TVM_IS_COMMAND_ENTRY (command_entry), NULL);
+ return command_entry->command;
+}
+
+
+
+/**
+ * tvm_command_entry_set_command:
+ * @command_entry : a #TvmCommandEntry.
+ * @command : the new command.
+ *
+ * Sets the command in @command_entry to @command.
+ **/
+void
+tvm_command_entry_set_command (TvmCommandEntry *command_entry,
+ const gchar *command)
+{
+ g_return_if_fail (TVM_IS_COMMAND_ENTRY (command_entry));
+ g_return_if_fail (g_utf8_validate (command, -1, NULL));
+
+ /* update to the new command */
+ g_free (command_entry->command);
+ command_entry->command = g_strdup (command);
+ g_object_notify (G_OBJECT (command_entry), "command");
+}
+
Property changes on: thunar-volman/trunk/thunar-volman/tvm-command-entry.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-command-entry.h
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-command-entry.h (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-command-entry.h 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,61 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2005-2007 Benedikt Meurer <benny at xfce.org>
+ *
+ * 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 __TVM_COMMAND_ENTRY_H__
+#define __TVM_COMMAND_ENTRY_H__
+
+#include <exo/exo.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _TvmCommandEntryClass TvmCommandEntryClass;
+typedef struct _TvmCommandEntry TvmCommandEntry;
+
+#define TVM_TYPE_COMMAND_ENTRY (tvm_command_entry_get_type ())
+#define TVM_COMMAND_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TVM_TYPE_COMMAND_ENTRY, TvmCommandEntry))
+#define TVM_COMMAND_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TVM_TYPE_COMMAND_ENTRY, TvmCommandEntryClass))
+#define TVM_IS_COMMAND_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TVM_TYPE_COMMAND_ENTRY))
+#define TVM_IS_COMMAND_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TVM_TYPE_COMMAND_ENTRY))
+#define TVM_COMMAND_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TVM_TYPE_COMMAND_ENTRY, TvmCommandEntryClass))
+
+struct _TvmCommandEntryClass
+{
+ GtkHBoxClass __parent__;
+};
+
+struct _TvmCommandEntry
+{
+ GtkHBox __parent__;
+ GtkWidget *entry;
+ GtkWidget *label;
+ gchar *command;
+};
+
+GType tvm_command_entry_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
+
+GtkWidget *tvm_command_entry_new (void) G_GNUC_INTERNAL G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+GtkWidget *tvm_command_entry_new_with_label (const gchar *label) G_GNUC_INTERNAL G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+
+const gchar *tvm_command_entry_get_command (TvmCommandEntry *command_entry) G_GNUC_INTERNAL;
+void tvm_command_entry_set_command (TvmCommandEntry *command_entry,
+ const gchar *command) G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* !__TVM_COMMAND_ENTRY_H__ */
Property changes on: thunar-volman/trunk/thunar-volman/tvm-command-entry.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-device.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-device.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-device.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,199 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include <thunar-volman/tvm-block-device.h>
+#include <thunar-volman/tvm-camera-device.h>
+#include <thunar-volman/tvm-device.h>
+#include <thunar-volman/tvm-input-device.h>
+
+
+
+typedef struct _TvmDeviceHandler TvmDeviceHandler;
+struct _TvmDeviceHandler
+{
+ const gchar *capability;
+ TvmDeviceCallback callback;
+};
+
+
+
+static const TvmDeviceHandler handlers[] =
+{
+ { "block", tvm_block_device_added, },
+ { "camera", tvm_camera_device_added, },
+ { "input.keyboard", tvm_input_device_added, },
+ { "input.mouse", tvm_input_device_added, },
+ { "input.tablet", tvm_input_device_added, },
+};
+
+
+
+static gint
+strptrcmp (gconstpointer strptr1,
+ gconstpointer strptr2)
+{
+ return strcmp (*((const gchar **) strptr1),
+ *((const gchar **) strptr2));
+}
+
+
+
+/**
+ * tvm_device_added:
+ * @preferences : a #TvmPreferences.
+ * @udi : the HAL device UDI of the newly added device.
+ * @error : return location for errors or %NULL.
+ *
+ * Invoked whenever a new device is added, where @udi is the
+ * HAL device UDI of the device in question. Returns %FALSE if
+ * an unrecoverable error occurred, %TRUE otherwise.
+ *
+ * Return value: %FALSE in case of an unrecoverable error,
+ * %TRUE otherwise.
+ **/
+gboolean
+tvm_device_added (TvmPreferences *preferences,
+ const gchar *udi,
+ GError **error)
+{
+ DBusConnection *connection;
+ LibHalContext *context;
+ DBusError derror;
+ GError *err = NULL;
+ gchar **capabilities;
+ gint n_capabilities;
+ gint i, j, n;
+
+ g_return_val_if_fail (exo_hal_udi_validate (udi, -1, NULL), FALSE);
+ g_return_val_if_fail (TVM_IS_PREFERENCES (preferences), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ /* try to allocate a new HAL context */
+ context = libhal_ctx_new ();
+ if (G_UNLIKELY (context == NULL))
+ {
+ /* out of memory */
+ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_NOMEM, g_strerror (ENOMEM));
+ return FALSE;
+ }
+
+ /* initialize D-Bus error */
+ dbus_error_init (&derror);
+
+ /* try to connect to the system bus */
+ connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror);
+ if (G_UNLIKELY (connection == NULL))
+ {
+err0: /* release the HAL context */
+ libhal_ctx_free (context);
+
+ /* propagate the error */
+ dbus_set_g_error (error, &derror);
+ return FALSE;
+ }
+
+ /* setup the D-Bus connection for the GLib main loop */
+ dbus_connection_setup_with_g_main (connection, NULL);
+
+ /* setup the D-Bus connection for the HAL context */
+ libhal_ctx_set_dbus_connection (context, connection);
+
+ /* the HAL context now owns the connection */
+ dbus_connection_unref (connection);
+
+ /* try to initialize the HAL context */
+ if (!libhal_ctx_init (context, &derror))
+ goto err0;
+
+ /* query the capabilities of the device */
+ capabilities = libhal_device_get_property_strlist (context, udi, "info.capabilities", &derror);
+ if (G_UNLIKELY (capabilities == NULL))
+ {
+ /* shutdown the HAL context */
+ libhal_ctx_shutdown (context, NULL);
+ goto err0;
+ }
+
+ /* determine the number of capabilities */
+ n_capabilities = g_strv_length (capabilities);
+
+ /* sort the capabilities */
+ qsort (capabilities, n_capabilities, sizeof (*capabilities), strptrcmp);
+
+ /* try various handlers until one of them succeeds */
+ for (i = 0, j = 0; err == NULL && i < G_N_ELEMENTS (handlers) && j < n_capabilities; ++i)
+ {
+ /* search for a handler with the capability */
+ for (n = -1; j < n_capabilities; )
+ {
+ /* check if we have a match here */
+ n = strcmp (capabilities[j], handlers[i].capability);
+ if (G_LIKELY (n >= 0))
+ break;
+ ++j;
+ }
+
+ /* check if we have a potential match */
+ if (n == 0)
+ {
+ /* try to handle the device */
+ if ((*handlers[i].callback) (preferences, context, udi, capabilities[j], &err))
+ break;
+ ++j;
+ }
+ }
+
+ /* cleanup the capabilities */
+ libhal_free_string_array (capabilities);
+
+ /* shutdown the HAL context */
+ libhal_ctx_shutdown (context, NULL);
+ libhal_ctx_free (context);
+
+ /* check if we failed */
+ if (G_UNLIKELY (err != NULL))
+ {
+ /* propagate the error */
+ g_propagate_error (error, err);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
Property changes on: thunar-volman/trunk/thunar-volman/tvm-device.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-device.h
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-device.h (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-device.h 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,58 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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 __TVM_DEVICE_H__
+#define __TVM_DEVICE_H__
+
+#include <libhal.h>
+
+#include <exo-hal/exo-hal.h>
+
+#include <thunar-volman/tvm-preferences.h>
+
+G_BEGIN_DECLS;
+
+/**
+ * TvmDeviceCallback:
+ * @preferences : a #TvmPreferences.
+ * @context : a #LibHalContext.
+ * @udi : the HAL device UDI of the newly added device.
+ * @capability : the capability that caused this callback to be invoked.
+ * @error : return location for errors or %NULL.
+ *
+ * Prototype for device callbacks, which are invoked if a device is inserted,
+ * with a capability they claim to be able to handle. Returns %TRUE if the
+ * device was handled, %FALSE if the device cannot be handled or an unrecoverable
+ * error occurred (in which case the @error should be set).
+ *
+ * Return value:
+ **/
+typedef gboolean (*TvmDeviceCallback) (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *capability,
+ GError **error);
+
+gboolean tvm_device_added (TvmPreferences *preferences,
+ const gchar *udi,
+ GError **error) G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* !__TVM_DEVICE_H__ */
Property changes on: thunar-volman/trunk/thunar-volman/tvm-device.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-input-device.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-input-device.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-input-device.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,102 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <thunar-volman/tvm-input-device.h>
+#include <thunar-volman/tvm-prompt.h>
+#include <thunar-volman/tvm-run.h>
+
+
+
+static const struct
+{
+ const gchar *capability;
+ const gchar *auto_option_name;
+ const gchar *auto_command_name;
+} commands[] = {
+ { "input.keyboard", "autokeyboard", "autokeyboard-command", },
+ { "input.mouse", "automouse", "automouse-command", },
+ { "input.tablet", "autotablet", "autotablet-command", },
+};
+
+
+
+/**
+ * tvm_block_input_added:
+ * @preferences : a #TvmPreferences.
+ * @context : a #LibHalContext.
+ * @udi : the HAL device UDI of the newly added input device.
+ * @capability : the capability, which caused this handler to be run.
+ * @error : return location for errors or %NULL.
+ *
+ * See #TvmDeviceCallback for further information.
+ *
+ * Return value: %TRUE if handled, %FALSE if not handled or an
+ * unrecoverable error occurred.
+ **/
+gboolean
+tvm_input_device_added (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *capability,
+ GError **error)
+{
+ gboolean result = FALSE;
+ gboolean auto_enabled;
+ gchar *auto_command;
+ guint n;
+
+ g_return_val_if_fail (exo_hal_udi_validate (udi, -1, NULL), FALSE);
+ g_return_val_if_fail (TVM_IS_PREFERENCES (preferences), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (capability != NULL, FALSE);
+ g_return_val_if_fail (context != NULL, FALSE);
+
+ /* check which type of input device we have */
+ for (n = 0; n < G_N_ELEMENTS (commands); ++n)
+ if (strcmp (commands[n].capability, capability) == 0)
+ break;
+ if (G_LIKELY (n < G_N_ELEMENTS (commands)))
+ {
+ /* check if this handling is enabled and we have a command */
+ g_object_get (G_OBJECT (preferences), commands[n].auto_option_name, &auto_enabled, commands[n].auto_command_name, &auto_command, NULL);
+ if (G_LIKELY (auto_enabled && auto_command != NULL && *auto_command != '\0'))
+ {
+ /* try to run the command */
+ result = tvm_run_command (context, udi, auto_command, NULL, NULL, error);
+ }
+ g_free (auto_command);
+ }
+
+ return result;
+}
+
+
+
+
Property changes on: thunar-volman/trunk/thunar-volman/tvm-input-device.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-input-device.h
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-input-device.h (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-input-device.h 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,35 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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 __TVM_INPUT_DEVICE_H__
+#define __TVM_INPUT_DEVICE_H__
+
+#include <thunar-volman/tvm-device.h>
+
+G_BEGIN_DECLS;
+
+gboolean tvm_input_device_added (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ const gchar *capability,
+ GError **error) G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* !__TVM_INPUT_DEVICE_H__ */
Property changes on: thunar-volman/trunk/thunar-volman/tvm-input-device.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-pango-extensions.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-pango-extensions.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-pango-extensions.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,177 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2006-2007 Benedikt Meurer <benny at xfce.org>
+ *
+ * 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
+
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+
+#include <thunar-volman/tvm-pango-extensions.h>
+
+
+
+static PangoAttrList *tvm_pango_attr_list_wrap (PangoAttribute *attribute, ...) G_GNUC_MALLOC;
+
+
+
+static PangoAttrList*
+tvm_pango_attr_list_wrap (PangoAttribute *attribute, ...)
+{
+ PangoAttrList *attr_list;
+ va_list args;
+
+ /* allocate a new attribute list */
+ attr_list = pango_attr_list_new ();
+
+ /* add all specified attributes */
+ va_start (args, attribute);
+ while (attribute != NULL)
+ {
+ attribute->start_index = 0;
+ attribute->end_index = -1;
+ pango_attr_list_insert (attr_list, attribute);
+ attribute = va_arg (args, PangoAttribute *);
+ }
+ va_end (args);
+
+ return attr_list;
+}
+
+
+
+/**
+ * tvm_pango_attr_list_big:
+ *
+ * Returns a #PangoAttrList for rendering big text.
+ * The returned list is owned by the callee and must
+ * not be freed or modified by the caller.
+ *
+ * Return value: a #PangoAttrList for rendering big text.
+ **/
+PangoAttrList*
+tvm_pango_attr_list_big (void)
+{
+ static PangoAttrList *attr_list = NULL;
+ if (G_UNLIKELY (attr_list == NULL))
+ attr_list = tvm_pango_attr_list_wrap (pango_attr_scale_new (PANGO_SCALE_LARGE), NULL);
+ return attr_list;
+}
+
+
+
+/**
+ * tvm_pango_attr_list_big_bold:
+ *
+ * Returns a #PangoAttrList for rendering big bold text.
+ * The returned list is owned by the callee and must
+ * not be freed or modified by the caller.
+ *
+ * Return value: a #PangoAttrList for rendering big bold text.
+ **/
+PangoAttrList*
+tvm_pango_attr_list_big_bold (void)
+{
+ static PangoAttrList *attr_list = NULL;
+ if (G_UNLIKELY (attr_list == NULL))
+ attr_list = tvm_pango_attr_list_wrap (pango_attr_scale_new (PANGO_SCALE_LARGE), pango_attr_weight_new (PANGO_WEIGHT_BOLD), NULL);
+ return attr_list;
+}
+
+
+
+/**
+ * tvm_pango_attr_list_bold:
+ *
+ * Returns a #PangoAttrList for rendering bold text.
+ * The returned list is owned by the callee and must
+ * not be freed or modified by the caller.
+ *
+ * Return value: a #PangoAttrList for rendering bold text.
+ **/
+PangoAttrList*
+tvm_pango_attr_list_bold (void)
+{
+ static PangoAttrList *attr_list = NULL;
+ if (G_UNLIKELY (attr_list == NULL))
+ attr_list = tvm_pango_attr_list_wrap (pango_attr_weight_new (PANGO_WEIGHT_BOLD), NULL);
+ return attr_list;
+}
+
+
+
+/**
+ * tvm_pango_attr_list_italic:
+ *
+ * Returns a #PangoAttrList for rendering italic text.
+ * The returned list is owned by the callee and must
+ * not be freed or modified by the caller.
+ *
+ * Return value: a #PangoAttrList for rendering italic text.
+ **/
+PangoAttrList*
+tvm_pango_attr_list_italic (void)
+{
+ static PangoAttrList *attr_list = NULL;
+ if (G_UNLIKELY (attr_list == NULL))
+ attr_list = tvm_pango_attr_list_wrap (pango_attr_style_new (PANGO_STYLE_ITALIC), NULL);
+ return attr_list;
+}
+
+
+
+/**
+ * tvm_pango_attr_list_small_italic:
+ *
+ * Returns a #PangoAttrList for rendering small italic text.
+ * The returned list is owned by the callee and must
+ * not be freed or modified by the caller.
+ *
+ * Return value: a #PangoAttrList for rendering small italic text.
+ **/
+PangoAttrList*
+tvm_pango_attr_list_small_italic (void)
+{
+ static PangoAttrList *attr_list = NULL;
+ if (G_UNLIKELY (attr_list == NULL))
+ attr_list = tvm_pango_attr_list_wrap (pango_attr_scale_new (PANGO_SCALE_SMALL), pango_attr_style_new (PANGO_STYLE_ITALIC), NULL);
+ return attr_list;
+}
+
+
+
+/**
+ * tvm_pango_attr_list_underline_single:
+ *
+ * Returns a #PangoAttrList for underlining text using a single line.
+ * The returned list is owned by the callee and must not be freed
+ * or modified by the caller.
+ *
+ * Return value: a #PangoAttrList for underlining text using a single line.
+ **/
+PangoAttrList*
+tvm_pango_attr_list_underline_single (void)
+{
+ static PangoAttrList *attr_list = NULL;
+ if (G_UNLIKELY (attr_list == NULL))
+ attr_list = tvm_pango_attr_list_wrap (pango_attr_underline_new (PANGO_UNDERLINE_SINGLE), NULL);
+ return attr_list;
+}
Property changes on: thunar-volman/trunk/thunar-volman/tvm-pango-extensions.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-pango-extensions.h
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-pango-extensions.h (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-pango-extensions.h 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,36 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2006-2007 Benedikt Meurer <benny at xfce.org>
+ *
+ * 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 __TVM_PANGO_EXTENSIONS_H__
+#define __TVM_PANGO_EXTENSIONS_H__
+
+#include <pango/pango.h>
+
+G_BEGIN_DECLS;
+
+PangoAttrList *tvm_pango_attr_list_big (void) G_GNUC_CONST G_GNUC_INTERNAL;
+PangoAttrList *tvm_pango_attr_list_big_bold (void) G_GNUC_CONST G_GNUC_INTERNAL;
+PangoAttrList *tvm_pango_attr_list_bold (void) G_GNUC_CONST G_GNUC_INTERNAL;
+PangoAttrList *tvm_pango_attr_list_italic (void) G_GNUC_CONST G_GNUC_INTERNAL;
+PangoAttrList *tvm_pango_attr_list_small_italic (void) G_GNUC_CONST G_GNUC_INTERNAL;
+PangoAttrList *tvm_pango_attr_list_underline_single (void) G_GNUC_CONST G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* !__TVM_PANGO_EXTENSIONS_H__ */
Property changes on: thunar-volman/trunk/thunar-volman/tvm-pango-extensions.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,515 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2005-2007 Benedikt Meurer <benny at xfce.org>
+ *
+ * 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 <thunar-volman/tvm-command-entry.h>
+#include <thunar-volman/tvm-pango-extensions.h>
+#include <thunar-volman/tvm-preferences-dialog.h>
+#include <thunar-volman/xfce-titled-dialog.h>
+
+
+
+static void tvm_preferences_dialog_class_init (TvmPreferencesDialogClass *klass);
+static void tvm_preferences_dialog_init (TvmPreferencesDialog *dialog);
+static void tvm_preferences_dialog_finalize (GObject *object);
+
+
+
+struct _TvmPreferencesDialogClass
+{
+ XfceTitledDialogClass __parent__;
+};
+
+struct _TvmPreferencesDialog
+{
+ XfceTitledDialog __parent__;
+ TvmPreferences *preferences;
+};
+
+
+
+static GObjectClass *tvm_preferences_dialog_parent_class;
+
+
+
+GType
+tvm_preferences_dialog_get_type (void)
+{
+ static GType type = G_TYPE_INVALID;
+
+ if (G_UNLIKELY (type == G_TYPE_INVALID))
+ {
+ static const GTypeInfo info =
+ {
+ sizeof (TvmPreferencesDialogClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) tvm_preferences_dialog_class_init,
+ NULL,
+ NULL,
+ sizeof (TvmPreferencesDialog),
+ 0,
+ (GInstanceInitFunc) tvm_preferences_dialog_init,
+ NULL,
+ };
+
+ type = g_type_register_static (XFCE_TYPE_TITLED_DIALOG, I_("TvmPreferencesDialog"), &info, 0);
+ }
+
+ return type;
+}
+
+
+
+static void
+tvm_preferences_dialog_class_init (TvmPreferencesDialogClass *klass)
+{
+ GObjectClass *gobject_class;
+
+ /* determine the parent type class */
+ tvm_preferences_dialog_parent_class = g_type_class_peek_parent (klass);
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = tvm_preferences_dialog_finalize;
+}
+
+
+
+static void
+tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
+{
+ GtkSizeGroup *size_group;
+ GtkWidget *notebook;
+ GtkWidget *button;
+ GtkWidget *entry;
+ GtkWidget *frame;
+ GtkWidget *image;
+ GtkWidget *label;
+ GtkWidget *table;
+ GtkWidget *vbox;
+
+ /* grab a reference on the preferences */
+ dialog->preferences = tvm_preferences_get ();
+
+ /* configure the dialog properties */
+ gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), "gnome-dev-removable");
+ gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Removable Drives and Media"));
+ xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog), _("Configure management of removable drives and media"));
+
+ /* add "Help" and "Close" buttons */
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+ GTK_STOCK_HELP, GTK_RESPONSE_HELP,
+ NULL);
+
+ notebook = gtk_notebook_new ();
+ gtk_container_set_border_width (GTK_CONTAINER (notebook), 6);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE, TRUE, 0);
+ gtk_widget_show (notebook);
+
+
+ /*
+ Storage
+ */
+ label = gtk_label_new (_("Storage"));
+ vbox = g_object_new (GTK_TYPE_VBOX, "border-width", 12, "spacing", 12, NULL);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, label);
+ gtk_widget_show (label);
+ gtk_widget_show (vbox);
+
+ frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+ gtk_widget_show (frame);
+
+ label = gtk_label_new (_("Removable Storage"));
+ gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_bold ());
+ gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+ gtk_widget_show (label);
+
+ table = gtk_table_new (5, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 8);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+
+ image = gtk_image_new_from_icon_name ("gnome-dev-removable", GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+ gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ button = gtk_check_button_new_with_mnemonic (_("_Mount removable drives when hot-plugged"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "automount-drives", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ button = gtk_check_button_new_with_mnemonic (_("Mount removable media when _inserted"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "automount-media", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ button = gtk_check_button_new_with_mnemonic (_("B_rowse removable media when inserted"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autobrowse", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ button = gtk_check_button_new_with_mnemonic (_("_Auto-run programs on new drives and media"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autorun", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ button = gtk_check_button_new_with_mnemonic (_("Auto-open files on new drives and media"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autoopen", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+ gtk_widget_show (frame);
+
+ label = gtk_label_new (_("Blank CDs and DVDs"));
+ gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_bold ());
+ gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+ gtk_widget_show (label);
+
+ table = gtk_table_new (3, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 8);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+
+ image = gtk_image_new_from_icon_name ("tvm-burn-cd", GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+ gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ button = gtk_check_button_new_with_mnemonic (_("_Burn a CD or DVD when a blank disc is inserted"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autoburn", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ /* use a size group to make sure both labels request the same width */
+ size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+
+ entry = tvm_command_entry_new_with_label (_("Command for _Data CDs:"));
+ exo_binding_new (G_OBJECT (button), "active", G_OBJECT (entry), "sensitive");
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autoburn-data-command", G_OBJECT (entry), "command");
+ gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_size_group_add_widget (size_group, TVM_COMMAND_ENTRY (entry)->label);
+ gtk_widget_show (entry);
+
+ entry = tvm_command_entry_new_with_label (_("Command for A_udio CDs:"));
+ exo_binding_new (G_OBJECT (button), "active", G_OBJECT (entry), "sensitive");
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autoburn-audio-command", G_OBJECT (entry), "command");
+ gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_size_group_add_widget (size_group, TVM_COMMAND_ENTRY (entry)->label);
+ gtk_widget_show (entry);
+
+ /* release the size group */
+ g_object_unref (G_OBJECT (size_group));
+
+
+ /*
+ Multimedia
+ */
+ label = gtk_label_new (_("Multimedia"));
+ vbox = g_object_new (GTK_TYPE_VBOX, "border-width", 12, "spacing", 12, NULL);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, label);
+ gtk_widget_show (label);
+ gtk_widget_show (vbox);
+
+ frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+ gtk_widget_show (frame);
+
+ label = gtk_label_new (_("Audio CDs"));
+ gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_bold ());
+ gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+ gtk_widget_show (label);
+
+ table = gtk_table_new (2, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 8);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+
+ image = gtk_image_new_from_icon_name ("gnome-dev-cdrom-audio", GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+ gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ button = gtk_check_button_new_with_mnemonic (_("Play _audio CDs when inserted"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autoplay-audio-cd", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ entry = tvm_command_entry_new_with_label (_("_Command:"));
+ exo_binding_new (G_OBJECT (button), "active", G_OBJECT (entry), "sensitive");
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autoplay-audio-cd-command", G_OBJECT (entry), "command");
+ gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (entry);
+
+ frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+ gtk_widget_show (frame);
+
+ label = gtk_label_new (_("Video CDs/DVDs"));
+ gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_bold ());
+ gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+ gtk_widget_show (label);
+
+ table = gtk_table_new (2, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 8);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+
+ image = gtk_image_new_from_icon_name ("gnome-dev-cdrom", GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+ gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ button = gtk_check_button_new_with_mnemonic (_("Play _video CDs and DVDs when inserted"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autoplay-video-cd", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ entry = tvm_command_entry_new_with_label (_("C_ommand:"));
+ exo_binding_new (G_OBJECT (button), "active", G_OBJECT (entry), "sensitive");
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autoplay-video-cd-command", G_OBJECT (entry), "command");
+ gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (entry);
+
+ frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+ gtk_widget_show (frame);
+
+ label = gtk_label_new (_("Portable Music Players"));
+ gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_bold ());
+ gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+ gtk_widget_show (label);
+
+ table = gtk_table_new (2, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 8);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+
+ image = gtk_image_new_from_icon_name ("gnome-dev-ipod", GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+ gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ button = gtk_check_button_new_with_mnemonic (_("Play _music files when connected"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autoipod", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ entry = tvm_command_entry_new_with_label (_("C_ommand:"));
+ exo_binding_new (G_OBJECT (button), "active", G_OBJECT (entry), "sensitive");
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autoipod-command", G_OBJECT (entry), "command");
+ gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (entry);
+
+
+ /*
+ Cameras
+ */
+ label = gtk_label_new (_("Cameras"));
+ vbox = g_object_new (GTK_TYPE_VBOX, "border-width", 12, "spacing", 12, NULL);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, label);
+ gtk_widget_show (label);
+ gtk_widget_show (vbox);
+
+ frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+ gtk_widget_show (frame);
+
+ label = gtk_label_new (_("Digital Cameras"));
+ gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_bold ());
+ gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+ gtk_widget_show (label);
+
+ table = gtk_table_new (2, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 8);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+
+ image = gtk_image_new_from_icon_name ("camera-photo", GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+ gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ button = gtk_check_button_new_with_mnemonic (_("Import digital photographs when connected"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autophoto", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ entry = tvm_command_entry_new_with_label (_("_Command:"));
+ exo_binding_new (G_OBJECT (button), "active", G_OBJECT (entry), "sensitive");
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autophoto-command", G_OBJECT (entry), "command");
+ gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (entry);
+
+ /*
+ Input Devices
+ */
+ label = gtk_label_new (_("Input Devices"));
+ vbox = g_object_new (GTK_TYPE_VBOX, "border-width", 12, "spacing", 12, NULL);
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, label);
+ gtk_widget_show (label);
+ gtk_widget_show (vbox);
+
+ frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+ gtk_widget_show (frame);
+
+ label = gtk_label_new (_("Keyboards"));
+ gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_bold ());
+ gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+ gtk_widget_show (label);
+
+ table = gtk_table_new (2, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 8);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+
+ image = gtk_image_new_from_icon_name ("gnome-dev-keyboard", GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+ gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ button = gtk_check_button_new_with_mnemonic (_("Automatically run a program when an USB _keyboard is connected"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autokeyboard", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ entry = tvm_command_entry_new_with_label (_("_Command:"));
+ exo_binding_new (G_OBJECT (button), "active", G_OBJECT (entry), "sensitive");
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autokeyboard-command", G_OBJECT (entry), "command");
+ gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (entry);
+
+ frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+ gtk_widget_show (frame);
+
+ label = gtk_label_new (_("Mice"));
+ gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_bold ());
+ gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+ gtk_widget_show (label);
+
+ table = gtk_table_new (2, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 8);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+
+ image = gtk_image_new_from_icon_name ("gnome-dev-mouse-optical", GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+ gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ button = gtk_check_button_new_with_mnemonic (_("Automatically run a program when an USB _mouse is connected"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "automouse", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ entry = tvm_command_entry_new_with_label (_("C_ommand:"));
+ exo_binding_new (G_OBJECT (button), "active", G_OBJECT (entry), "sensitive");
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "automouse-command", G_OBJECT (entry), "command");
+ gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (entry);
+
+ frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0);
+ gtk_widget_show (frame);
+
+ label = gtk_label_new (_("Tablet"));
+ gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_bold ());
+ gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+ gtk_widget_show (label);
+
+ table = gtk_table_new (2, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 12);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 8);
+ gtk_container_add (GTK_CONTAINER (frame), table);
+ gtk_widget_show (table);
+
+ image = gtk_image_new_from_icon_name ("tvm-dev-tablet", GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+ gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 3, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (image);
+
+ button = gtk_check_button_new_with_mnemonic (_("Automatically run a program when a _tablet is connected"));
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autotablet", G_OBJECT (button), "active");
+ gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (button);
+
+ entry = tvm_command_entry_new_with_label (_("Com_mand:"));
+ exo_binding_new (G_OBJECT (button), "active", G_OBJECT (entry), "sensitive");
+ exo_mutual_binding_new (G_OBJECT (dialog->preferences), "autotablet-command", G_OBJECT (entry), "command");
+ gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (entry);
+}
+
+
+
+static void
+tvm_preferences_dialog_finalize (GObject *object)
+{
+ TvmPreferencesDialog *dialog = TVM_PREFERENCES_DIALOG (object);
+
+ /* release our reference on the preferences */
+ g_object_unref (G_OBJECT (dialog->preferences));
+
+ (*G_OBJECT_CLASS (tvm_preferences_dialog_parent_class)->finalize) (object);
+}
+
+
+
+/**
+ * tvm_preferences_dialog_new:
+ * @parent : a #GtkWindow or %NULL.
+ *
+ * Allocates a new #TvmPreferencesDialog widget.
+ *
+ * Return value: the newly allocated #TvmPreferencesDialog.
+ **/
+GtkWidget*
+tvm_preferences_dialog_new (void)
+{
+ return g_object_new (TVM_TYPE_PREFERENCES_DIALOG, NULL);
+}
+
Property changes on: thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.h
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.h (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.h 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,43 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2005-2007 Benedikt Meurer <benny at xfce.org>
+ *
+ * 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 __TVM_PREFERENCES_DIALOG_H__
+#define __TVM_PREFERENCES_DIALOG_H__
+
+#include <thunar-volman/tvm-preferences.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _TvmPreferencesDialogClass TvmPreferencesDialogClass;
+typedef struct _TvmPreferencesDialog TvmPreferencesDialog;
+
+#define TVM_TYPE_PREFERENCES_DIALOG (tvm_preferences_dialog_get_type ())
+#define TVM_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TVM_TYPE_PREFERENCES_DIALOG, TvmPreferencesDialog))
+#define TVM_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TVM_TYPE_PREFERENCES_DIALOG, TvmPreferencesDialogClass))
+#define TVM_IS_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TVM_TYPE_PREFERENCES_DIALOG))
+#define TVM_IS_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TVM_TYPE_PREFERENCES_DIALOG))
+#define TVM_PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TVM_TYPE_PREFERENCES_DIALOG, TvmPreferencesDialogClass))
+
+GType tvm_preferences_dialog_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL;
+
+GtkWidget *tvm_preferences_dialog_new (void) G_GNUC_INTERNAL G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
+
+G_END_DECLS;
+
+#endif /* !__TVM_PREFERENCES_DIALOG_H__ */
Property changes on: thunar-volman/trunk/thunar-volman/tvm-preferences-dialog.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-preferences.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-preferences.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-preferences.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,876 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2005-2007 Benedikt Meurer <benny at xfce.org>
+ *
+ * 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
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <thunar-vfs/thunar-vfs.h>
+
+#include <thunar-volman/tvm-preferences.h>
+
+
+
+/* Property identifiers */
+enum
+{
+ PROP_0,
+ PROP_AUTOMOUNT_DRIVES,
+ PROP_AUTOMOUNT_MEDIA,
+ PROP_AUTOBROWSE,
+ PROP_AUTORUN,
+ PROP_AUTOOPEN,
+ PROP_AUTOBURN,
+ PROP_AUTOBURN_DATA_COMMAND,
+ PROP_AUTOBURN_AUDIO_COMMAND,
+ PROP_AUTOPLAY_AUDIO_CD,
+ PROP_AUTOPLAY_AUDIO_CD_COMMAND,
+ PROP_AUTOPLAY_VIDEO_CD,
+ PROP_AUTOPLAY_VIDEO_CD_COMMAND,
+ PROP_AUTOIPOD,
+ PROP_AUTOIPOD_COMMAND,
+ PROP_AUTOPHOTO,
+ PROP_AUTOPHOTO_COMMAND,
+ PROP_AUTOKEYBOARD,
+ PROP_AUTOKEYBOARD_COMMAND,
+ PROP_AUTOMOUSE,
+ PROP_AUTOMOUSE_COMMAND,
+ PROP_AUTOTABLET,
+ PROP_AUTOTABLET_COMMAND,
+ N_PROPERTIES,
+};
+
+
+
+static void tvm_preferences_class_init (TvmPreferencesClass *klass);
+static void tvm_preferences_init (TvmPreferences *preferences);
+static void tvm_preferences_dispose (GObject *object);
+static void tvm_preferences_finalize (GObject *object);
+static void tvm_preferences_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void tvm_preferences_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void tvm_preferences_resume_monitor (TvmPreferences *preferences);
+static void tvm_preferences_suspend_monitor (TvmPreferences *preferences);
+static void tvm_preferences_monitor (ThunarVfsMonitor *monitor,
+ ThunarVfsMonitorHandle *handle,
+ ThunarVfsMonitorEvent event,
+ ThunarVfsPath *handle_path,
+ ThunarVfsPath *event_path,
+ gpointer user_data);
+static void tvm_preferences_queue_load (TvmPreferences *preferences);
+static void tvm_preferences_queue_store (TvmPreferences *preferences);
+static gboolean tvm_preferences_load_idle (gpointer user_data);
+static void tvm_preferences_load_idle_destroy (gpointer user_data);
+static gboolean tvm_preferences_store_idle (gpointer user_data);
+static void tvm_preferences_store_idle_destroy (gpointer user_data);
+
+
+
+struct _TvmPreferencesClass
+{
+ GObjectClass __parent__;
+};
+
+struct _TvmPreferences
+{
+ GObject __parent__;
+
+ ThunarVfsMonitorHandle *handle;
+ ThunarVfsMonitor *monitor;
+
+ GValue values[N_PROPERTIES];
+
+ gboolean loading_in_progress;
+
+ gint load_idle_id;
+ gint store_idle_id;
+};
+
+
+
+static GObjectClass *tvm_preferences_parent_class;
+
+
+
+GType
+tvm_preferences_get_type (void)
+{
+ static GType type = G_TYPE_INVALID;
+
+ if (G_UNLIKELY (type == G_TYPE_INVALID))
+ {
+ static const GTypeInfo info =
+ {
+ sizeof (TvmPreferencesClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) tvm_preferences_class_init,
+ NULL,
+ NULL,
+ sizeof (TvmPreferences),
+ 0,
+ (GInstanceInitFunc) tvm_preferences_init,
+ NULL,
+ };
+
+ type = g_type_register_static (G_TYPE_OBJECT, I_("TvmPreferences"), &info, 0);
+ }
+
+ return type;
+}
+
+
+
+static void
+transform_string_to_boolean (const GValue *src,
+ GValue *dst)
+{
+ g_value_set_boolean (dst, strcmp (g_value_get_string (src), "FALSE") != 0);
+}
+
+
+
+static void
+tvm_preferences_class_init (TvmPreferencesClass *klass)
+{
+ GObjectClass *gobject_class;
+
+ /* register transformation functions */
+ if (!g_value_type_transformable (G_TYPE_STRING, G_TYPE_BOOLEAN))
+ g_value_register_transform_func (G_TYPE_STRING, G_TYPE_BOOLEAN, transform_string_to_boolean);
+
+ /* determine the parent type class */
+ tvm_preferences_parent_class = g_type_class_peek_parent (klass);
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->dispose = tvm_preferences_dispose;
+ gobject_class->finalize = tvm_preferences_finalize;
+ gobject_class->get_property = tvm_preferences_get_property;
+ gobject_class->set_property = tvm_preferences_set_property;
+
+ /**
+ * TvmPreferences:automount-drives:
+ *
+ * Mount removable drives when hot-plugged.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOMOUNT_DRIVES,
+ g_param_spec_boolean ("automount-drives",
+ "automount-drives",
+ "automount-drives",
+ TRUE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:automount-media:
+ *
+ * Mount removable media when inserted.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOMOUNT_MEDIA,
+ g_param_spec_boolean ("automount-media",
+ "automount-media",
+ "automount-media",
+ TRUE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autobrowse:
+ *
+ * Browse removable media when inserted.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOBROWSE,
+ g_param_spec_boolean ("autobrowse",
+ "autobrowse",
+ "autobrowse",
+ TRUE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autorun:
+ *
+ * Auto-run programs on new drives and media.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTORUN,
+ g_param_spec_boolean ("autorun",
+ "autorun",
+ "autorun",
+ FALSE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autoopen:
+ *
+ * Auto-open files on new drives and media.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOOPEN,
+ g_param_spec_boolean ("autoopen",
+ "autoopen",
+ "autoopen",
+ FALSE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autoburn:
+ *
+ * Burn a CD or DVD if a blank disc is inserted.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOBURN,
+ g_param_spec_boolean ("autoburn",
+ "autoburn",
+ "autoburn",
+ FALSE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autoburn-data-command:
+ *
+ * Command to burn a new data CD/DVD.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOBURN_DATA_COMMAND,
+ g_param_spec_string ("autoburn-data-command",
+ "autoburn-data-command",
+ "autoburn-data-command",
+ "xfburn",
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autoburn-audio-command:
+ *
+ * Command to burn a new audio CD.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOBURN_AUDIO_COMMAND,
+ g_param_spec_string ("autoburn-audio-command",
+ "autoburn-audio-command",
+ "autoburn-audio-command",
+ "xfburn",
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autoplay-audio-cd:
+ *
+ * Play audio discs when inserted.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOPLAY_AUDIO_CD,
+ g_param_spec_boolean ("autoplay-audio-cd",
+ "autoplay-audio-cd",
+ "autoplay-audio-cd",
+ FALSE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autoplay-audio-cd-command:
+ *
+ * Command to run the preferred audio CD player.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOPLAY_AUDIO_CD_COMMAND,
+ g_param_spec_string ("autoplay-audio-cd-command",
+ "autoplay-audio-cd-command",
+ "autoplay-audio-cd-command",
+ "totem %d",
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autoplay-video-cd:
+ *
+ * Play video CDs and DVDs when inserted.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOPLAY_VIDEO_CD,
+ g_param_spec_boolean ("autoplay-video-cd",
+ "autoplay-video-cd",
+ "autoplay-video-cd",
+ TRUE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autoplay-video-cd-command:
+ *
+ * Command to run the preferred video CD/DVD-Player.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOPLAY_VIDEO_CD_COMMAND,
+ g_param_spec_string ("autoplay-video-cd-command",
+ "autoplay-video-cd-command",
+ "autoplay-video-cd-command",
+ "totem %d",
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autoipod:
+ *
+ * Play music files when portable music player is connected.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOIPOD,
+ g_param_spec_boolean ("autoipod",
+ "autoipod",
+ "autoipod",
+ FALSE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autoipod-command:
+ *
+ * Command to run when portable music player is connected.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOIPOD_COMMAND,
+ g_param_spec_string ("autoipod-command",
+ "autoipod-command",
+ "autoipod-command",
+ "",
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autophoto:
+ *
+ * Import photos when digital camera is connected.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOPHOTO,
+ g_param_spec_boolean ("autophoto",
+ "autophoto",
+ "autophoto",
+ FALSE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autophoto-command:
+ *
+ * Command to run when digitcal camera is connected.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOPHOTO_COMMAND,
+ g_param_spec_string ("autophoto-command",
+ "autophoto-command",
+ "autophoto-command",
+ "",
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autokeyboard:
+ *
+ * Automatically run a program when an USB keyboard is connected.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOKEYBOARD,
+ g_param_spec_boolean ("autokeyboard",
+ "autokeyboard",
+ "autokeyboard",
+ FALSE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autokeyboard-command:
+ *
+ * Command to run when an USB keyboard is connected.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOKEYBOARD_COMMAND,
+ g_param_spec_string ("autokeyboard-command",
+ "autokeyboard-command",
+ "autokeyboard-command",
+ "",
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:automouse:
+ *
+ * Automatically run a program when an USB mouse is connected.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOMOUSE,
+ g_param_spec_boolean ("automouse",
+ "automouse",
+ "automouse",
+ FALSE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:automouse-command:
+ *
+ * Command to run when an USB mouse is connected.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOMOUSE_COMMAND,
+ g_param_spec_string ("automouse-command",
+ "automouse-command",
+ "automouse-command",
+ "",
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autotablet:
+ *
+ * Automatically run a program when a table is connected.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOTABLET,
+ g_param_spec_boolean ("autotablet",
+ "autotablet",
+ "autotablet",
+ FALSE,
+ EXO_PARAM_READWRITE));
+
+ /**
+ * TvmPreferences:autotablet-command:
+ *
+ * Command to run when a table is connected.
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_AUTOTABLET_COMMAND,
+ g_param_spec_string ("autotablet-command",
+ "autotablet-command",
+ "autotablet-command",
+ "",
+ EXO_PARAM_READWRITE));
+}
+
+
+
+static void
+tvm_preferences_init (TvmPreferences *preferences)
+{
+ /* grab a reference on the VFS monitor */
+ preferences->monitor = thunar_vfs_monitor_get_default ();
+
+ /* load the settings */
+ tvm_preferences_load_idle (preferences);
+
+ /* launch the file monitor */
+ tvm_preferences_resume_monitor (preferences);
+}
+
+
+
+static void
+tvm_preferences_dispose (GObject *object)
+{
+ TvmPreferences *preferences = TVM_PREFERENCES (object);
+
+ /* flush preferences */
+ if (G_UNLIKELY (preferences->store_idle_id != 0))
+ {
+ tvm_preferences_store_idle (preferences);
+ g_source_remove (preferences->store_idle_id);
+ }
+
+ (*G_OBJECT_CLASS (tvm_preferences_parent_class)->dispose) (object);
+}
+
+
+
+static void
+tvm_preferences_finalize (GObject *object)
+{
+ TvmPreferences *preferences = TVM_PREFERENCES (object);
+ guint n;
+
+ /* stop any pending load idle source */
+ if (G_UNLIKELY (preferences->load_idle_id != 0))
+ g_source_remove (preferences->load_idle_id);
+
+ /* stop the file monitor */
+ if (G_LIKELY (preferences->monitor != NULL))
+ {
+ tvm_preferences_suspend_monitor (preferences);
+ g_object_unref (G_OBJECT (preferences->monitor));
+ }
+
+ /* release the property values */
+ for (n = 1; n < N_PROPERTIES; ++n)
+ if (G_IS_VALUE (preferences->values + n))
+ g_value_unset (preferences->values + n);
+
+ (*G_OBJECT_CLASS (tvm_preferences_parent_class)->finalize) (object);
+}
+
+
+
+static void
+tvm_preferences_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ TvmPreferences *preferences = TVM_PREFERENCES (object);
+ GValue *src;
+
+ src = preferences->values + prop_id;
+ if (G_IS_VALUE (src))
+ g_value_copy (src, value);
+ else
+ g_param_value_set_default (pspec, value);
+}
+
+
+
+static void
+tvm_preferences_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ TvmPreferences *preferences = TVM_PREFERENCES (object);
+ GValue *dst;
+
+ dst = preferences->values + prop_id;
+ if (G_UNLIKELY (!G_IS_VALUE (dst)))
+ g_value_init (dst, pspec->value_type);
+
+ if (g_param_values_cmp (pspec, value, dst) != 0)
+ {
+ g_value_copy (value, dst);
+ tvm_preferences_queue_store (preferences);
+ }
+}
+
+
+
+static void
+tvm_preferences_resume_monitor (TvmPreferences *preferences)
+{
+ ThunarVfsPath *path;
+ gchar *filename;
+
+ /* verify that the monitor is suspended */
+ if (G_LIKELY (preferences->handle == NULL))
+ {
+ /* determine the save location for tvmrc to monitor */
+ filename = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, "Thunar/volmanrc", TRUE);
+ if (G_LIKELY (filename != NULL))
+ {
+ /* determine the VFS path for the filename */
+ path = thunar_vfs_path_new (filename, NULL);
+ if (G_LIKELY (path != NULL))
+ {
+ /* add the monitor handle for the file */
+ preferences->handle = thunar_vfs_monitor_add_file (preferences->monitor, path, tvm_preferences_monitor, preferences);
+ thunar_vfs_path_unref (path);
+ }
+
+ /* release the filename */
+ g_free (filename);
+ }
+ }
+}
+
+
+
+static void
+tvm_preferences_suspend_monitor (TvmPreferences *preferences)
+{
+ /* verify that the monitor is active */
+ if (G_LIKELY (preferences->handle != NULL))
+ {
+ /* disconnect the handle from the monitor */
+ thunar_vfs_monitor_remove (preferences->monitor, preferences->handle);
+ preferences->handle = NULL;
+ }
+}
+
+
+
+static void
+tvm_preferences_monitor (ThunarVfsMonitor *monitor,
+ ThunarVfsMonitorHandle *handle,
+ ThunarVfsMonitorEvent event,
+ ThunarVfsPath *handle_path,
+ ThunarVfsPath *event_path,
+ gpointer user_data)
+{
+ TvmPreferences *preferences = TVM_PREFERENCES (user_data);
+
+ g_return_if_fail (TVM_IS_PREFERENCES (preferences));
+ g_return_if_fail (THUNAR_VFS_IS_MONITOR (monitor));
+ g_return_if_fail (preferences->monitor == monitor);
+ g_return_if_fail (preferences->handle == handle);
+
+ /* schedule a reload whenever the file is created/changed */
+ if (event == THUNAR_VFS_MONITOR_EVENT_CHANGED || event == THUNAR_VFS_MONITOR_EVENT_CREATED)
+ tvm_preferences_queue_load (preferences);
+}
+
+
+
+static void
+tvm_preferences_queue_load (TvmPreferences *preferences)
+{
+ if (preferences->load_idle_id == 0 && preferences->store_idle_id == 0)
+ {
+ preferences->load_idle_id = g_idle_add_full (G_PRIORITY_LOW, tvm_preferences_load_idle,
+ preferences, tvm_preferences_load_idle_destroy);
+ }
+}
+
+
+
+static void
+tvm_preferences_queue_store (TvmPreferences *preferences)
+{
+ if (preferences->store_idle_id == 0 && !preferences->loading_in_progress)
+ {
+ preferences->store_idle_id = g_idle_add_full (G_PRIORITY_LOW, tvm_preferences_store_idle,
+ preferences, tvm_preferences_store_idle_destroy);
+ }
+}
+
+
+
+static gchar*
+property_name_to_option_name (const gchar *property_name)
+{
+ const gchar *s;
+ gboolean upper = TRUE;
+ gchar *option;
+ gchar *t;
+
+ option = g_new (gchar, strlen (property_name) + 1);
+ for (s = property_name, t = option; *s != '\0'; ++s)
+ {
+ if (*s == '-')
+ {
+ upper = TRUE;
+ }
+ else if (upper)
+ {
+ *t++ = g_ascii_toupper (*s);
+ upper = FALSE;
+ }
+ else
+ {
+ *t++ = *s;
+ }
+ }
+ *t = '\0';
+
+ return option;
+}
+
+
+
+static gboolean
+tvm_preferences_load_idle (gpointer user_data)
+{
+ TvmPreferences *preferences = TVM_PREFERENCES (user_data);
+ const gchar *string;
+ GParamSpec **specs;
+ GParamSpec *spec;
+ XfceRc *rc;
+ GValue dst = { 0, };
+ GValue src = { 0, };
+ gchar *option;
+ guint nspecs;
+ guint n;
+
+ rc = xfce_rc_config_open (XFCE_RESOURCE_CONFIG, "Thunar/volmanrc", TRUE);
+ if (G_UNLIKELY (rc == NULL))
+ {
+ g_warning ("Failed to load tvm preferences.");
+ return FALSE;
+ }
+
+ g_object_freeze_notify (G_OBJECT (preferences));
+
+ xfce_rc_set_group (rc, "Configuration");
+
+ preferences->loading_in_progress = TRUE;
+
+ specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (preferences), &nspecs);
+ for (n = 0; n < nspecs; ++n)
+ {
+ spec = specs[n];
+
+ option = property_name_to_option_name (spec->name);
+ string = xfce_rc_read_entry (rc, option, NULL);
+ g_free (option);
+
+ if (G_UNLIKELY (string == NULL))
+ continue;
+
+ g_value_init (&src, G_TYPE_STRING);
+ g_value_set_static_string (&src, string);
+
+ if (spec->value_type == G_TYPE_STRING)
+ {
+ g_object_set_property (G_OBJECT (preferences), spec->name, &src);
+ }
+ else if (g_value_type_transformable (G_TYPE_STRING, spec->value_type))
+ {
+ g_value_init (&dst, spec->value_type);
+ if (g_value_transform (&src, &dst))
+ g_object_set_property (G_OBJECT (preferences), spec->name, &dst);
+ g_value_unset (&dst);
+ }
+ else
+ {
+ g_warning ("Failed to load property \"%s\"", spec->name);
+ }
+
+ g_value_unset (&src);
+ }
+ g_free (specs);
+
+ preferences->loading_in_progress = FALSE;
+
+ xfce_rc_close (rc);
+
+ g_object_thaw_notify (G_OBJECT (preferences));
+
+ return FALSE;
+}
+
+
+
+static void
+tvm_preferences_load_idle_destroy (gpointer user_data)
+{
+ TVM_PREFERENCES (user_data)->load_idle_id = 0;
+}
+
+
+
+static gboolean
+tvm_preferences_store_idle (gpointer user_data)
+{
+ TvmPreferences *preferences = TVM_PREFERENCES (user_data);
+ const gchar *string;
+ GParamSpec **specs;
+ GParamSpec *spec;
+ XfceRc *rc;
+ GValue dst = { 0, };
+ GValue src = { 0, };
+ gchar *option;
+ guint nspecs;
+ guint n;
+
+ rc = xfce_rc_config_open (XFCE_RESOURCE_CONFIG, "Thunar/volmanrc", FALSE);
+ if (G_UNLIKELY (rc == NULL))
+ {
+ g_warning ("Failed to store thunar-volman preferences.");
+ return FALSE;
+ }
+
+ /* suspend the monitor (hopefully tricking FAM to avoid unnecessary reloads) */
+ tvm_preferences_suspend_monitor (preferences);
+
+ xfce_rc_set_group (rc, "Configuration");
+
+ specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (preferences), &nspecs);
+ for (n = 0; n < nspecs; ++n)
+ {
+ spec = specs[n];
+
+ g_value_init (&dst, G_TYPE_STRING);
+
+ if (spec->value_type == G_TYPE_STRING)
+ {
+ g_object_get_property (G_OBJECT (preferences), spec->name, &dst);
+ }
+ else
+ {
+ g_value_init (&src, spec->value_type);
+ g_object_get_property (G_OBJECT (preferences), spec->name, &src);
+ g_value_transform (&src, &dst);
+ g_value_unset (&src);
+ }
+
+ /* determine the option name for the spec */
+ option = property_name_to_option_name (spec->name);
+
+ /* store the setting */
+ string = g_value_get_string (&dst);
+ if (G_LIKELY (string != NULL))
+ xfce_rc_write_entry (rc, option, string);
+
+ /* cleanup */
+ g_value_unset (&dst);
+ g_free (option);
+ }
+
+ /* cleanup */
+ xfce_rc_close (rc);
+ g_free (specs);
+
+ /* restart the monitor */
+ tvm_preferences_resume_monitor (preferences);
+
+ return FALSE;
+}
+
+
+
+static void
+tvm_preferences_store_idle_destroy (gpointer user_data)
+{
+ TVM_PREFERENCES (user_data)->store_idle_id = 0;
+}
+
+
+
+/**
+ * tvm_preferences_get:
+ *
+ * Queries the global #TvmPreferences instance, which is shared
+ * by all modules. The function automatically takes a reference
+ * for the caller, so you'll need to call g_object_unref() when
+ * you're done with it.
+ *
+ * Return value: the global #TvmPreferences instance.
+ **/
+TvmPreferences*
+tvm_preferences_get (void)
+{
+ static TvmPreferences *preferences = NULL;
+
+ if (G_UNLIKELY (preferences == NULL))
+ {
+ preferences = g_object_new (TVM_TYPE_PREFERENCES, NULL);
+ g_object_add_weak_pointer (G_OBJECT (preferences), (gpointer) &preferences);
+ }
+ else
+ {
+ g_object_ref (G_OBJECT (preferences));
+ }
+
+ return preferences;
+}
+
+
Property changes on: thunar-volman/trunk/thunar-volman/tvm-preferences.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-preferences.h
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-preferences.h (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-preferences.h 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,43 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2005-2007 Benedikt Meurer <benny at xfce.org>
+ *
+ * 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 __TVM_PREFERENCES_H__
+#define __TVM_PREFERENCES_H__
+
+#include <exo/exo.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _TvmPreferencesClass TvmPreferencesClass;
+typedef struct _TvmPreferences TvmPreferences;
+
+#define TVM_TYPE_PREFERENCES (tvm_preferences_get_type ())
+#define TVM_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TVM_TYPE_PREFERENCES, TvmPreferences))
+#define TVM_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TVM_TYPE_PREFERENCES, TvmPreferencesClass))
+#define TVM_IS_PREFERENCES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TVM_TYPE_PREFERENCES))
+#define TVM_IS_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TVM_TYPE_PREFERENCES))
+#define TVM_PREFERENCES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TVM_TYPE_PREFERENCES, TvmPreferencesClass))
+
+GType tvm_preferences_get_type (void) G_GNUC_CONST;
+
+TvmPreferences *tvm_preferences_get (void);
+
+G_END_DECLS;
+
+#endif /* !__TVM_PREFERENCES_H__ */
Property changes on: thunar-volman/trunk/thunar-volman/tvm-preferences.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-prompt.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-prompt.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-prompt.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,173 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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
+
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+
+#include <thunar-volman/tvm-pango-extensions.h>
+#include <thunar-volman/tvm-prompt.h>
+
+
+
+static void
+hal_device_removed (LibHalContext *context,
+ const gchar *udi)
+{
+ const gchar *dialog_udi;
+ GtkWidget *dialog = libhal_ctx_get_user_data (context);
+
+ /* check if the active UDI of the dialog was removed */
+ dialog_udi = g_object_get_data (G_OBJECT (dialog), "udi");
+ if (exo_str_is_equal (dialog_udi, udi))
+ {
+ /* cancel the dialog */
+ gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
+ }
+}
+
+
+
+/**
+ * tvm_prompt:
+ * @context : a #LibHalContext.
+ * @udi : the UDI of the device being added, which is watched for removal.
+ * @icon : the icon or %NULL.
+ * @title : the prompt title.
+ * @primary_text : the primary prompt text.
+ * @secondary_text : the secondary prompt text.
+ * @first_button_text : the first button text.
+ * @... : %NULL-terminated list of button text, response id pairs.
+ *
+ * Return value: the selected response.
+ **/
+gint
+tvm_prompt (LibHalContext *context,
+ const gchar *udi,
+ const gchar *icon,
+ const gchar *title,
+ const gchar *primary_text,
+ const gchar *secondary_text,
+ const gchar *first_button_text,
+ ...)
+{
+ GtkWidget *dialog;
+ GtkWidget *image;
+ GtkWidget *label;
+ GtkWidget *hbox;
+ GtkWidget *vbox;
+ DBusError derror;
+ va_list args;
+ gint response;
+
+ g_return_val_if_fail (exo_hal_udi_validate (udi, -1, NULL), GTK_RESPONSE_CANCEL);
+ g_return_val_if_fail (context != NULL, GTK_RESPONSE_CANCEL);
+
+ /* allocate a new dialog */
+ dialog = gtk_dialog_new ();
+ gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
+ gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+ g_object_set_data_full (G_OBJECT (dialog), "udi", g_strdup (udi), g_free);
+ gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 6);
+ gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
+
+ /* setup the specified title */
+ if (G_LIKELY (title != NULL))
+ gtk_window_set_title (GTK_WINDOW (dialog), title);
+
+ /* setup the specified buttons */
+ if (G_LIKELY (first_button_text != NULL))
+ {
+ va_start (args, first_button_text);
+ for (response = va_arg (args, gint); first_button_text != NULL; )
+ {
+ /* insert the button */
+ gtk_dialog_add_button (GTK_DIALOG (dialog), first_button_text, response);
+ first_button_text = va_arg (args, const gchar *);
+ if (G_UNLIKELY (first_button_text == NULL))
+ break;
+ response = va_arg (args, gint);
+ }
+ va_end (args);
+ }
+
+ /* setup the hbox */
+ hbox = gtk_hbox_new (FALSE, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
+ gtk_widget_show (hbox);
+
+ /* setup the specified icon */
+ if (G_LIKELY (icon != NULL))
+ {
+ /* setup an image for the icon */
+ image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.0f, 0.0f);
+ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+ gtk_widget_show (image);
+ }
+
+ /* setup the vbox */
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
+ gtk_widget_show (vbox);
+
+ /* setup the primary text */
+ label = gtk_label_new (primary_text);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+ gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_big_bold ());
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
+ /* setup the secondary text */
+ if (G_LIKELY (secondary_text != NULL))
+ {
+ label = gtk_label_new (secondary_text);
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+ }
+
+ /* initialize D-Bus error */
+ dbus_error_init (&derror);
+
+ /* setup HAL to watch the UDI for removal */
+ libhal_ctx_set_user_data (context, dialog);
+ libhal_ctx_set_device_removed (context, hal_device_removed);
+ libhal_device_property_watch_all (context, &derror);
+
+ /* run the dialog */
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ /* cleanup */
+ libhal_ctx_set_device_removed (context, NULL);
+ libhal_ctx_set_user_data (context, NULL);
+ gtk_widget_destroy (dialog);
+ dbus_error_free (&derror);
+
+ return response;
+}
+
+
Property changes on: thunar-volman/trunk/thunar-volman/tvm-prompt.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-prompt.h
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-prompt.h (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-prompt.h 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,51 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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 __TVM_PROMPT_H__
+#define __TVM_PROMPT_H__
+
+#include <thunar-volman/tvm-device.h>
+
+G_BEGIN_DECLS;
+
+enum
+{
+ TVM_RESPONSE_NONE,
+ TVM_RESPONSE_PLAY,
+ TVM_RESPONSE_MUSIC,
+ TVM_RESPONSE_BROWSE,
+ TVM_RESPONSE_PHOTOS,
+ TVM_RESPONSE_AUTORUN,
+ TVM_RESPONSE_AUTOOPEN,
+ TVM_RESPONSE_BURN_DATA_CD,
+ TVM_RESPONSE_BURN_AUDIO_CD,
+};
+
+gint tvm_prompt (LibHalContext *context,
+ const gchar *udi,
+ const gchar *icon,
+ const gchar *title,
+ const gchar *primary_text,
+ const gchar *secondary_text,
+ const gchar *first_button_text,
+ ...) G_GNUC_INTERNAL G_GNUC_NULL_TERMINATED;
+
+G_END_DECLS;
+
+#endif /* !__TVM_PROMPT_H__ */
Property changes on: thunar-volman/trunk/thunar-volman/tvm-prompt.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-run.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-run.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-run.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,335 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <thunar-volman/tvm-prompt.h>
+#include <thunar-volman/tvm-run.h>
+
+
+
+static void tvm_run_resolve (LibHalContext *context,
+ const gchar *udi,
+ gchar **device_file_return,
+ gchar **mount_point_return);
+
+
+
+static void
+tvm_run_resolve (LibHalContext *context,
+ const gchar *udi,
+ gchar **device_file_return,
+ gchar **mount_point_return)
+{
+ GSList *mount_points;
+ gchar *device_file;
+
+ /* initialize return values */
+ if (device_file_return != NULL)
+ *device_file_return = NULL;
+ if (mount_point_return != NULL)
+ *mount_point_return = NULL;
+
+ /* determine the device file path of the device */
+ device_file = libhal_device_get_property_string (context, udi, "block.device", NULL);
+ if (G_LIKELY (device_file != NULL))
+ {
+ /* determine the active mount point(s) for the device from the kernel */
+ mount_points = exo_mount_point_list_matched (EXO_MOUNT_POINT_MATCH_ACTIVE | EXO_MOUNT_POINT_MATCH_DEVICE, device_file, NULL, NULL, NULL);
+ if (G_LIKELY (mount_points != NULL))
+ {
+ /* return the mount point folder path */
+ if (G_LIKELY (mount_point_return != NULL))
+ *mount_point_return = g_strdup (((ExoMountPoint *) mount_points->data)->folder);
+
+ /* release the mount points */
+ g_slist_foreach (mount_points, (GFunc) exo_mount_point_free, NULL);
+ g_slist_free (mount_points);
+ }
+
+ /* return the device file path */
+ if (G_LIKELY (device_file_return != NULL))
+ *device_file_return = g_strdup (device_file);
+
+ /* cleanup */
+ libhal_free_string (device_file);
+ }
+}
+
+
+
+/**
+ * tvm_run_cdburner:
+ * @preferences : a #TvmPreferences.
+ * @context : a #LibHalContext.
+ * @udi : the UDI of the blank CD/DVD.
+ * @error : return location for errors or %NULL.
+ *
+ * Tries to spawn the preferred CD-Burner application for the
+ * given @udi. Returns %TRUE if the device was handled, %FALSE
+ * if not handled or an unrecoverable error occurred.
+ *
+ * Return value: %TRUE if handled, %FALSE otherwise.
+ **/
+gboolean
+tvm_run_cdburner (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ GError **error)
+{
+ const gchar *autoburn_command_name;
+ gboolean autoburn;
+ gboolean result = FALSE;
+ gboolean is_dvd;
+ gchar *autoburn_command;
+ gchar *disc_type;
+ gint response;
+
+ g_return_val_if_fail (exo_hal_udi_validate (udi, -1, NULL), FALSE);
+ g_return_val_if_fail (TVM_IS_PREFERENCES (preferences), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (context != NULL, FALSE);
+
+ /* check if autoburn is enabled */
+ g_object_get (G_OBJECT (preferences), "autoburn", &autoburn, NULL);
+ if (G_UNLIKELY (!autoburn))
+ return TRUE;
+
+ /* check if we have a DVD here */
+ disc_type = libhal_device_get_property_string (context, udi, "volume.disc.type", NULL);
+ is_dvd = (disc_type != NULL && strncmp (disc_type, "dvd_", 4) == 0);
+ libhal_free_string (disc_type);
+
+ /* ask the user what to do now */
+ if (G_LIKELY (is_dvd))
+ {
+ /* ask what to do with the empty DVD */
+ response = tvm_prompt (context, udi, "gnome-dev-disc-dvdr",
+ _("Choose Disc Type"),
+ _("You have inserted a blank disc."),
+ _("What would you like to do?"),
+ _("Ig_nore"), GTK_RESPONSE_CANCEL,
+ _("Make _DVD"), TVM_RESPONSE_BURN_DATA_CD,
+ NULL);
+ }
+ else
+ {
+ /* ask whether to burn data or audio CD */
+ response = tvm_prompt (context, udi, "gnome-dev-disc-cdr",
+ _("Choose Disc Type"),
+ _("You have inserted a blank disc."),
+ _("What would you like to do?"),
+ _("Ig_nore"), GTK_RESPONSE_CANCEL,
+ _("Make _Data CD"), TVM_RESPONSE_BURN_DATA_CD,
+ _("Make _Audio CD"), TVM_RESPONSE_BURN_AUDIO_CD,
+ NULL);
+ }
+
+ /* determine the autoburn command name */
+ if (response == TVM_RESPONSE_BURN_DATA_CD)
+ autoburn_command_name = "autoburn-data-command";
+ else if (response == TVM_RESPONSE_BURN_AUDIO_CD)
+ autoburn_command_name = "autoburn-audio-command";
+ else
+ return TRUE;
+
+ /* determine the command */
+ g_object_get (G_OBJECT (preferences), autoburn_command_name, &autoburn_command, NULL);
+ if (G_LIKELY (autoburn_command != NULL && *autoburn_command != '\0'))
+ {
+ /* try to execute the preferred CD-Burner application */
+ result = tvm_run_command (context, udi, autoburn_command, NULL, NULL, error);
+ }
+ g_free (autoburn_command);
+
+ return result;
+}
+
+
+
+/**
+ * tvm_run_cdplayer:
+ * @preferences : a #TvmPreferences.
+ * @context : a #LibHalContext.
+ * @udi : the UDI of the Audio CD.
+ * @error : return location for errors or %NULL.
+ *
+ * Tries to spawn the preferred CD-Player application for the
+ * given @udi. Returns %TRUE if the device was handled, %FALSE
+ * if not handled or an unrecoverable error occurred.
+ *
+ * Return value: %TRUE if handled, %FALSE otherwise.
+ **/
+gboolean
+tvm_run_cdplayer (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ GError **error)
+{
+ gboolean autoplay;
+ gboolean result = TRUE;
+ gchar *autoplay_command;
+
+ g_return_val_if_fail (exo_hal_udi_validate (udi, -1, NULL), FALSE);
+ g_return_val_if_fail (TVM_IS_PREFERENCES (preferences), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (context != NULL, FALSE);
+
+ /* check if autoplay is enabled and we have a command */
+ g_object_get (G_OBJECT (preferences), "autoplay-audio-cd", &autoplay, "autoplay-audio-cd-command", &autoplay_command, NULL);
+ if (G_LIKELY (autoplay && autoplay_command != NULL && *autoplay_command != '\0'))
+ {
+ /* try to run the preferred CD-Player application */
+ result = tvm_run_command (context, udi, autoplay_command, NULL, NULL, error);
+ }
+ g_free (autoplay_command);
+
+ return result;
+}
+
+
+
+/**
+ * tvm_run_command:
+ * @context : a #LibHalContext.
+ * @udi : the UDI of the device for which to run the @command.
+ * @command : the command line of the application to spawn.
+ * @device_file : the value to substitute for <literal>%d</literal> or %NULL.
+ * @mount_point : the value to substitute for <literal>%m</literal> or %NULL.
+ * @error : return location for errors or %NULL.
+ *
+ * Substitutes special values in @command and tries to spawn the application
+ * identified by the @command.
+ *
+ * The HAL UDI will be substituted for <literal>%h</literal>, the device file path
+ * for <literal>%d</literal> and the mount point for <literal>%m</literal>.
+ *
+ * Return value: %TRUE if the command was spawn successfully, %FALSE otherwise.
+ **/
+gboolean
+tvm_run_command (LibHalContext *context,
+ const gchar *udi,
+ const gchar *command,
+ const gchar *device_file,
+ const gchar *mount_point,
+ GError **error)
+{
+ const gchar *p;
+ gboolean result;
+ GString *command_line;
+ gchar *quoted;
+ gchar *device;
+ gchar *folder;
+ gchar **argv;
+
+ g_return_val_if_fail (exo_hal_udi_validate (udi, -1, NULL), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (context != NULL, FALSE);
+
+ /* perform the required substitutions */
+ command_line = g_string_new (NULL);
+ for (p = command; *p != '\0'; ++p)
+ {
+ /* check if we should substitute */
+ if (G_UNLIKELY (p[0] == '%' && p[1] != '\0'))
+ {
+ /* check which substitution to perform */
+ switch (*++p)
+ {
+ case 'd': /* device file */
+ /* check if know the device file path */
+ if (G_LIKELY (device_file != NULL))
+ device = g_strdup (device_file);
+ else
+ tvm_run_resolve (context, udi, &device, NULL);
+ if (G_LIKELY (device != NULL))
+ g_string_append (command_line, device);
+ g_free (device);
+ break;
+
+ case 'h': /* HAL UDI */
+ g_string_append (command_line, udi);
+ break;
+
+ case 'm': /* mount point */
+ /* check if know the mount point */
+ if (G_LIKELY (mount_point != NULL))
+ folder = g_strdup (mount_point);
+ else
+ tvm_run_resolve (context, udi, NULL, &folder);
+ if (G_LIKELY (folder != NULL))
+ {
+ /* substitute mount point quoted */
+ quoted = g_shell_quote (folder);
+ g_string_append (command_line, quoted);
+ g_free (quoted);
+ }
+ else
+ {
+ /* %m must always be substituted */
+ g_string_append (command_line, "\"\"");
+ }
+ g_free (folder);
+ break;
+
+ case '%':
+ g_string_append_c (command_line, '%');
+ break;
+
+ default:
+ g_string_append_c (command_line, '%');
+ g_string_append_c (command_line, *p);
+ break;
+ }
+ }
+ else
+ {
+ /* just append the character */
+ g_string_append_c (command_line, *p);
+ }
+ }
+
+ /* try to parse the command line */
+ result = g_shell_parse_argv (command_line->str, NULL, &argv, error);
+ if (G_LIKELY (result))
+ {
+ /* try to spawn the command asynchronously in the users home directory */
+ result = g_spawn_async (g_get_home_dir (), argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, error);
+
+ /* cleanup */
+ g_strfreev (argv);
+ }
+
+ /* cleanup */
+ g_string_free (command_line, TRUE);
+
+ return result;
+}
+
+
+
Property changes on: thunar-volman/trunk/thunar-volman/tvm-run.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/tvm-run.h
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-run.h (rev 0)
+++ thunar-volman/trunk/thunar-volman/tvm-run.h 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,46 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2007 Benedikt Meurer <benny at xfce.org>.
+ *
+ * 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 __TVM_RUN_H__
+#define __TVM_RUN_H__
+
+#include <thunar-volman/tvm-device.h>
+
+G_BEGIN_DECLS;
+
+gboolean tvm_run_cdburner (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ GError **error) G_GNUC_INTERNAL;
+
+gboolean tvm_run_cdplayer (TvmPreferences *preferences,
+ LibHalContext *context,
+ const gchar *udi,
+ GError **error) G_GNUC_INTERNAL;
+
+gboolean tvm_run_command (LibHalContext *context,
+ const gchar *udi,
+ const gchar *command,
+ const gchar *device_file,
+ const gchar *mount_point,
+ GError **error) G_GNUC_INTERNAL;
+
+G_END_DECLS;
+
+#endif /* !__TVM_RUN_H__ */
Property changes on: thunar-volman/trunk/thunar-volman/tvm-run.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/xfce-heading.c
===================================================================
--- thunar-volman/trunk/thunar-volman/xfce-heading.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/xfce-heading.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,755 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, 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
+
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "xfce-heading.h"
+
+
+
+#define XFCE_HEADING_BORDER 6
+#define XFCE_HEADING_SPACING 12
+#define XFCE_HEADING_ICON_SIZE 48
+
+#define XFCE_HEADING_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), XFCE_TYPE_HEADING, XfceHeadingPrivate))
+
+
+
+/* Property identifiers */
+enum
+{
+ PROP_0,
+ PROP_ICON,
+ PROP_ICON_NAME,
+ PROP_SUBTITLE,
+ PROP_TITLE,
+};
+
+
+
+static void xfce_heading_class_init (XfceHeadingClass *klass);
+static void xfce_heading_init (XfceHeading *heading);
+static void xfce_heading_finalize (GObject *object);
+static void xfce_heading_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void xfce_heading_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void xfce_heading_realize (GtkWidget *widget);
+static void xfce_heading_size_request (GtkWidget *widget,
+ GtkRequisition *requisition);
+static void xfce_heading_style_set (GtkWidget *widget,
+ GtkStyle *previous_style);
+static gboolean xfce_heading_expose_event (GtkWidget *widget,
+ GdkEventExpose *event);
+static AtkObject *xfce_heading_get_accessible (GtkWidget *widget);
+static PangoLayout *xfce_heading_make_layout (XfceHeading *heading);
+static GdkPixbuf *xfce_heading_make_pixbuf (XfceHeading *heading);
+
+
+
+struct _XfceHeadingPrivate
+{
+ GdkPixbuf *icon;
+ gchar *icon_name;
+ gchar *subtitle;
+ gchar *title;
+};
+
+
+
+G_DEFINE_TYPE (XfceHeading, xfce_heading, GTK_TYPE_WIDGET);
+
+
+
+static void
+xfce_heading_class_init (XfceHeadingClass *klass)
+{
+ GtkWidgetClass *gtkwidget_class;
+ GObjectClass *gobject_class;
+
+ /* add our private data to the class */
+ g_type_class_add_private (klass, sizeof (XfceHeadingPrivate));
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = xfce_heading_finalize;
+ gobject_class->get_property = xfce_heading_get_property;
+ gobject_class->set_property = xfce_heading_set_property;
+
+ gtkwidget_class = GTK_WIDGET_CLASS (klass);
+ gtkwidget_class->realize = xfce_heading_realize;
+ gtkwidget_class->size_request = xfce_heading_size_request;
+ gtkwidget_class->style_set = xfce_heading_style_set;
+ gtkwidget_class->expose_event = xfce_heading_expose_event;
+ gtkwidget_class->get_accessible = xfce_heading_get_accessible;
+
+ /**
+ * XfceHeading:icon:
+ *
+ * The #GdkPixbuf to display as icon, or %NULL to use the
+ * "icon-name" property.
+ *
+ * Since: 4.4.0
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_ICON,
+ g_param_spec_object ("icon",
+ "icon",
+ "icon",
+ GDK_TYPE_PIXBUF,
+ G_PARAM_READWRITE));
+
+ /**
+ * XfceHeading:icon-name:
+ *
+ * If the "icon" property value is %NULL this is the name of
+ * the icon to display instead (looked up using the icon theme).
+ * If this property is also %NULL or the specified icon does not
+ * exist in the selected icon theme, no icon will be displayed.
+ *
+ * Since: 4.4.0
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_ICON_NAME,
+ g_param_spec_string ("icon-name",
+ "icon-name",
+ "icon-name",
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * XfceHeading:subtitle:
+ *
+ * The sub title that should be displayed below the
+ * title. May be %NULL or the empty string to display
+ * only the title.
+ *
+ * Since: 4.4.0
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_SUBTITLE,
+ g_param_spec_string ("subtitle",
+ "subtitle",
+ "subtitle",
+ NULL,
+ G_PARAM_READWRITE));
+
+ /**
+ * XfceHeading:title:
+ *
+ * The title text to display in the heading.
+ *
+ * Since: 4.4.0
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_TITLE,
+ g_param_spec_string ("title",
+ "title",
+ "title",
+ NULL,
+ G_PARAM_READWRITE));
+}
+
+
+
+static void
+xfce_heading_init (XfceHeading *heading)
+{
+ /* setup the private data */
+ heading->priv = XFCE_HEADING_GET_PRIVATE (heading);
+
+ /* setup the widget parameters */
+ GTK_WIDGET_UNSET_FLAGS (heading, GTK_NO_WINDOW);
+}
+
+
+
+static void
+xfce_heading_finalize (GObject *object)
+{
+ XfceHeading *heading = XFCE_HEADING (object);
+
+ /* release the private data */
+ if (G_UNLIKELY (heading->priv->icon != NULL))
+ g_object_unref (G_OBJECT (heading->priv->icon));
+ g_free (heading->priv->icon_name);
+ g_free (heading->priv->subtitle);
+ g_free (heading->priv->title);
+
+ (*G_OBJECT_CLASS (xfce_heading_parent_class)->finalize) (object);
+}
+
+
+
+static void
+xfce_heading_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ XfceHeading *heading = XFCE_HEADING (object);
+
+ switch (prop_id)
+ {
+ case PROP_ICON:
+ g_value_set_object (value, xfce_heading_get_icon (heading));
+ break;
+
+ case PROP_ICON_NAME:
+ g_value_set_string (value, xfce_heading_get_icon_name (heading));
+ break;
+
+ case PROP_SUBTITLE:
+ g_value_set_string (value, xfce_heading_get_subtitle (heading));
+ break;
+
+ case PROP_TITLE:
+ g_value_set_string (value, xfce_heading_get_title (heading));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+
+static void
+xfce_heading_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ XfceHeading *heading = XFCE_HEADING (object);
+
+ switch (prop_id)
+ {
+ case PROP_ICON:
+ xfce_heading_set_icon (heading, g_value_get_object (value));
+ break;
+
+ case PROP_ICON_NAME:
+ xfce_heading_set_icon_name (heading, g_value_get_string (value));
+ break;
+
+ case PROP_SUBTITLE:
+ xfce_heading_set_subtitle (heading, g_value_get_string (value));
+ break;
+
+ case PROP_TITLE:
+ xfce_heading_set_title (heading, g_value_get_string (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+
+static void
+xfce_heading_realize (GtkWidget *widget)
+{
+ GdkWindowAttr attributes;
+
+ /* mark the widget as realized */
+ GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+
+ /* setup the window attributes */
+ attributes.x = widget->allocation.x;
+ attributes.y = widget->allocation.y;
+ attributes.width = widget->allocation.width;
+ attributes.height = widget->allocation.height;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.visual = gtk_widget_get_visual (widget);
+ attributes.colormap = gtk_widget_get_colormap (widget);
+ attributes.event_mask = gtk_widget_get_events (widget)
+ | GDK_EXPOSURE_MASK;
+
+ /* allocate the widget window */
+ widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
+ GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP);
+ gdk_window_set_user_data (widget->window, widget);
+
+ /* connect the style to the window */
+ widget->style = gtk_style_attach (widget->style, widget->window);
+
+ /* set background color (using the base color) */
+ gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
+}
+
+
+
+static void
+xfce_heading_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ XfceHeading *heading = XFCE_HEADING (widget);
+ PangoLayout *layout;
+ GdkPixbuf *pixbuf;
+ gint layout_width;
+ gint layout_height;
+ gint pixbuf_width = 0;
+ gint pixbuf_height = 0;
+
+ /* determine the dimensions of the title text */
+ layout = xfce_heading_make_layout (heading);
+ pango_layout_get_pixel_size (layout, &layout_width, &layout_height);
+ g_object_unref (G_OBJECT (layout));
+
+ /* determine the dimensions of the pixbuf */
+ pixbuf = xfce_heading_make_pixbuf (heading);
+ if (G_LIKELY (pixbuf != NULL))
+ {
+ pixbuf_width = gdk_pixbuf_get_width (pixbuf);
+ pixbuf_height = gdk_pixbuf_get_height (pixbuf);
+ g_object_unref (G_OBJECT (pixbuf));
+ }
+
+ /* determine the base dimensions */
+ requisition->width = layout_width + pixbuf_width + ((pixbuf_width > 0) ? XFCE_HEADING_SPACING : 0);
+ requisition->height = MAX (XFCE_HEADING_ICON_SIZE, MAX (pixbuf_height, layout_height));
+
+ /* add border size */
+ requisition->width += 2 * XFCE_HEADING_BORDER;
+ requisition->height += 2 * XFCE_HEADING_BORDER;
+}
+
+
+
+static void
+xfce_heading_style_set (GtkWidget *widget,
+ GtkStyle *previous_style)
+{
+ /* check if we're already realized */
+ if (GTK_WIDGET_REALIZED (widget))
+ {
+ /* set background color (using the base color) */
+ gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
+ }
+}
+
+
+
+static gboolean
+xfce_heading_expose_event (GtkWidget *widget,
+ GdkEventExpose *event)
+{
+ XfceHeading *heading = XFCE_HEADING (widget);
+ PangoLayout *layout;
+ GdkPixbuf *pixbuf;
+ gboolean rtl;
+ gint width;
+ gint height;
+ gint x;
+ gint y;
+
+ /* check if we should render from right to left */
+ rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
+
+ /* determine the initial horizontal position */
+ x = (rtl ? widget->allocation.width - XFCE_HEADING_BORDER : XFCE_HEADING_BORDER);
+
+ /* check if we have a pixbuf to render */
+ pixbuf = xfce_heading_make_pixbuf (heading);
+ if (G_LIKELY (pixbuf != NULL))
+ {
+ /* determine the pixbuf dimensions */
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+
+ /* determine the vertical position */
+ y = (widget->allocation.height - height) / 2;
+
+ /* render the pixbuf */
+ gdk_draw_pixbuf (widget->window, widget->style->black_gc, pixbuf, 0, 0,
+ (rtl ? x - width : x), y, width, height,
+ GDK_RGB_DITHER_NORMAL, 0, 0);
+
+ /* release the pixbuf */
+ g_object_unref (G_OBJECT (pixbuf));
+
+ /* advance the horizontal position */
+ x += (rtl ? -1 : 1) * (width + XFCE_HEADING_SPACING);
+ }
+
+ /* generate the title layout */
+ layout = xfce_heading_make_layout (heading);
+ pango_layout_get_pixel_size (layout, &width, &height);
+
+ /* determine the vertical position */
+ y = (widget->allocation.height - height) / 2;
+
+ /* render the title */
+ gtk_paint_layout (widget->style, widget->window, GTK_WIDGET_STATE (widget), TRUE, &event->area,
+ widget, "heading", (rtl ? x - width : x), y, layout);
+
+ /* release the layout */
+ g_object_unref (G_OBJECT (layout));
+
+ return FALSE;
+}
+
+
+
+static AtkObject*
+xfce_heading_get_accessible (GtkWidget *widget)
+{
+ AtkObject *object;
+
+ object = (*GTK_WIDGET_CLASS (xfce_heading_parent_class)->get_accessible) (widget);
+ atk_object_set_role (object, ATK_ROLE_HEADER);
+
+ return object;
+}
+
+
+
+static PangoLayout*
+xfce_heading_make_layout (XfceHeading *heading)
+{
+ PangoAttribute *attribute;
+ PangoAttrList *attr_list;
+ PangoLayout *layout;
+ GString *text;
+ gint title_length = 0;
+
+ /* generate the full text */
+ text = g_string_sized_new (128);
+ if (G_LIKELY (heading->priv->title != NULL))
+ {
+ /* add the main title */
+ title_length = strlen (heading->priv->title);
+ g_string_append (text, heading->priv->title);
+ }
+ if (heading->priv->subtitle != NULL && *heading->priv->subtitle != '\0')
+ {
+ /* add an empty line between the title and the subtitle */
+ if (G_LIKELY (heading->priv->title != NULL))
+ g_string_append (text, "\n");
+
+ /* add the subtitle */
+ g_string_append (text, heading->priv->subtitle);
+ }
+
+ /* allocate and setup a new layout from the widget's context */
+ layout = gtk_widget_create_pango_layout (GTK_WIDGET (heading), text->str);
+
+ /* allocate an attribute list (large bold title) */
+ attr_list = pango_attr_list_new ();
+ attribute = pango_attr_scale_new (PANGO_SCALE_LARGE); /* large title */
+ attribute->start_index = 0;
+ attribute->end_index = title_length;
+ pango_attr_list_insert (attr_list, attribute);
+ attribute = pango_attr_weight_new (PANGO_WEIGHT_BOLD); /* bold title */
+ attribute->start_index = 0;
+ attribute->end_index = title_length;
+ pango_attr_list_insert (attr_list, attribute);
+ pango_layout_set_attributes (layout, attr_list);
+ pango_attr_list_unref (attr_list);
+
+ /* cleanup */
+ g_string_free (text, TRUE);
+
+ return layout;
+}
+
+
+
+static GdkPixbuf*
+xfce_heading_make_pixbuf (XfceHeading *heading)
+{
+ GtkIconTheme *icon_theme;
+ GdkPixbuf *pixbuf = NULL;
+ GdkScreen *screen;
+
+ if (G_UNLIKELY (heading->priv->icon != NULL))
+ {
+ /* just use the specified icon */
+ pixbuf = g_object_ref (G_OBJECT (heading->priv->icon));
+ }
+ else if (G_LIKELY (heading->priv->icon_name != NULL))
+ {
+ /* determine the icon theme for the current screen */
+ screen = gtk_widget_get_screen (GTK_WIDGET (heading));
+ icon_theme = gtk_icon_theme_get_for_screen (screen);
+
+ /* try to load the icon from the icon theme */
+ pixbuf = gtk_icon_theme_load_icon (icon_theme, heading->priv->icon_name,
+ XFCE_HEADING_ICON_SIZE,
+ GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
+ }
+
+ return pixbuf;
+}
+
+
+
+/**
+ * xfce_heading_new:
+ *
+ * Allocates a new #XfceHeading instance.
+ *
+ * Return value: the newly allocated #XfceHeading.
+ *
+ * Since: 4.4.0
+ **/
+GtkWidget*
+xfce_heading_new (void)
+{
+ return g_object_new (XFCE_TYPE_HEADING, NULL);
+}
+
+
+
+/**
+ * xfce_heading_get_icon:
+ * @heading : a #XfceHeading.
+ *
+ * Returns the #GdkPixbuf that was set as icon for
+ * @heading or %NULL if no icon is set. The returned
+ * #GdkPixbuf object is owned by @heading.
+ *
+ * Return value: the icon for @heading, or %NULL.
+ *
+ * Since: 4.4.0
+ **/
+GdkPixbuf*
+xfce_heading_get_icon (XfceHeading *heading)
+{
+ g_return_val_if_fail (XFCE_IS_HEADING (heading), NULL);
+ return heading->priv->icon;
+}
+
+
+
+/**
+ * xfce_heading_set_icon:
+ * @heading : a #XfceHeading.
+ * @icon : the new icon or %NULL.
+ *
+ * If @icon is not %NULL, @heading will display the new @icon
+ * aside the title. Else, if @icon is %NULL no icon is displayed
+ * unless an icon name was set with xfce_heading_set_icon_name().
+ *
+ * Since: 4.4.0
+ **/
+void
+xfce_heading_set_icon (XfceHeading *heading,
+ GdkPixbuf *icon)
+{
+ g_return_if_fail (XFCE_IS_HEADING (heading));
+ g_return_if_fail (icon == NULL || GDK_IS_PIXBUF (icon));
+
+ /* check if we have a new icon */
+ if (G_LIKELY (heading->priv->icon != icon))
+ {
+ /* disconnect from the previous icon */
+ if (G_LIKELY (heading->priv->icon != NULL))
+ g_object_unref (G_OBJECT (heading->priv->icon));
+
+ /* activate the new icon */
+ heading->priv->icon = icon;
+
+ /* connect to the new icon */
+ if (G_LIKELY (icon != NULL))
+ g_object_ref (G_OBJECT (icon));
+
+ /* schedule a resize */
+ gtk_widget_queue_resize (GTK_WIDGET (heading));
+
+ /* notify listeners */
+ g_object_notify (G_OBJECT (heading), "icon");
+ }
+}
+
+
+
+/**
+ * xfce_heading_get_icon_name:
+ * @heading : a #XfceHeading.
+ *
+ * Returns the icon name previously set by a call to
+ * xfce_heading_set_icon_name() or %NULL if no icon name
+ * is set for @heading.
+ *
+ * Return value: the icon name for @heading, or %NULL.
+ *
+ * Since: 4.4.0
+ **/
+G_CONST_RETURN gchar*
+xfce_heading_get_icon_name (XfceHeading *heading)
+{
+ g_return_val_if_fail (XFCE_IS_HEADING (heading), NULL);
+ return heading->priv->icon_name;
+}
+
+
+
+/**
+ * xfce_heading_set_icon_name:
+ * @heading : a #XfceHeading.
+ * @icon_name : the new icon name, or %NULL.
+ *
+ * If @icon_name is not %NULL and the "icon" property is set to
+ * %NULL, see xfce_heading_set_icon(), the @heading will display
+ * the name icon identified by the @icon_name.
+ *
+ * Since: 4.4.0
+ **/
+void
+xfce_heading_set_icon_name (XfceHeading *heading,
+ const gchar *icon_name)
+{
+ g_return_if_fail (XFCE_IS_HEADING (heading));
+
+ /* release the previous icon name */
+ g_free (heading->priv->icon_name);
+
+ /* activate the new icon name */
+ heading->priv->icon_name = g_strdup (icon_name);
+
+ /* schedule a resize */
+ gtk_widget_queue_resize (GTK_WIDGET (heading));
+
+ /* notify listeners */
+ g_object_notify (G_OBJECT (heading), "icon-name");
+}
+
+
+
+/**
+ * xfce_heading_get_subtitle:
+ * @heading : a #XfceHeading.
+ *
+ * Returns the sub title displayed below the
+ * main title of the @heading, or %NULL if
+ * no subtitle is set.
+ *
+ * Return value: the subtitle of @heading, or %NULL.
+ *
+ * Since: 4.4.0
+ **/
+G_CONST_RETURN gchar*
+xfce_heading_get_subtitle (XfceHeading *heading)
+{
+ g_return_val_if_fail (XFCE_IS_HEADING (heading), NULL);
+ return heading->priv->subtitle;
+}
+
+
+
+/**
+ * xfce_heading_set_subtitle:
+ * @heading : a #XfceHeading.
+ * @subtitle : the new subtitle for @heading, or %NULL.
+ *
+ * If @subtitle is not %NULL and not the empty string, it
+ * will be displayed by @heading below the main title.
+ *
+ * Since: 4.4.0
+ **/
+void
+xfce_heading_set_subtitle (XfceHeading *heading,
+ const gchar *subtitle)
+{
+ g_return_if_fail (XFCE_IS_HEADING (heading));
+ g_return_if_fail (subtitle == NULL || g_utf8_validate (subtitle, -1, NULL));
+
+ /* release the previous subtitle */
+ g_free (heading->priv->subtitle);
+
+ /* activate the new subtitle */
+ heading->priv->subtitle = g_strdup (subtitle);
+
+ /* schedule a resize */
+ gtk_widget_queue_resize (GTK_WIDGET (heading));
+
+ /* notify listeners */
+ g_object_notify (G_OBJECT (heading), "subtitle");
+}
+
+
+
+/**
+ * xfce_heading_get_title:
+ * @heading : a #XfceHeading.
+ *
+ * Returns the title displayed by the @heading.
+ *
+ * Return value: the title displayed by the @heading.
+ *
+ * Since: 4.4.0
+ **/
+G_CONST_RETURN gchar*
+xfce_heading_get_title (XfceHeading *heading)
+{
+ g_return_val_if_fail (XFCE_IS_HEADING (heading), NULL);
+ return heading->priv->title;
+}
+
+
+
+/**
+ * xfce_heading_set_title:
+ * @heading : a #XfceHeading.
+ * @title : the new title for the @heading.
+ *
+ * Sets the title displayed by the @heading to the
+ * specified @title.
+ *
+ * Since: 4.4.0
+ **/
+void
+xfce_heading_set_title (XfceHeading *heading,
+ const gchar *title)
+{
+ g_return_if_fail (XFCE_IS_HEADING (heading));
+ g_return_if_fail (title == NULL || g_utf8_validate (title, -1, NULL));
+
+ /* release the previous title */
+ g_free (heading->priv->title);
+
+ /* activate the new title */
+ heading->priv->title = g_strdup (title);
+
+ /* schedule a resize */
+ gtk_widget_queue_resize (GTK_WIDGET (heading));
+
+ /* notify listeners */
+ g_object_notify (G_OBJECT (heading), "title");
+}
+
+
Property changes on: thunar-volman/trunk/thunar-volman/xfce-heading.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/xfce-heading.h
===================================================================
--- thunar-volman/trunk/thunar-volman/xfce-heading.h (rev 0)
+++ thunar-volman/trunk/thunar-volman/xfce-heading.h 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,82 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFCE_HEADING_H__
+#define __XFCE_HEADING_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _XfceHeadingPrivate XfceHeadingPrivate;
+typedef struct _XfceHeadingClass XfceHeadingClass;
+typedef struct _XfceHeading XfceHeading;
+
+#define XFCE_TYPE_HEADING (xfce_heading_get_type ())
+#define XFCE_HEADING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_HEADING, XfceHeading))
+#define XFCE_HEADING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_HEADING, XfceHeadingClass))
+#define XFCE_IS_HEADING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_HEADING))
+#define XFCE_IS_HEADING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_HEADING))
+#define XFCE_HEADING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_HEADING, XfceHeadingClass))
+
+struct _XfceHeadingClass
+{
+ /*< private >*/
+ GtkWidgetClass __parent__;
+
+ /* reserved for future expansion */
+ void (*reserved0) (void);
+ void (*reserved1) (void);
+ void (*reserved2) (void);
+ void (*reserved3) (void);
+ void (*reserved4) (void);
+ void (*reserved5) (void);
+};
+
+struct _XfceHeading
+{
+ /*< private >*/
+ GtkWidget __parent__;
+ XfceHeadingPrivate *priv;
+};
+
+GType xfce_heading_get_type (void) G_GNUC_CONST;
+
+GtkWidget *xfce_heading_new (void) G_GNUC_MALLOC;
+
+GdkPixbuf *xfce_heading_get_icon (XfceHeading *heading);
+void xfce_heading_set_icon (XfceHeading *heading,
+ GdkPixbuf *icon);
+
+G_CONST_RETURN gchar *xfce_heading_get_icon_name (XfceHeading *heading);
+void xfce_heading_set_icon_name (XfceHeading *heading,
+ const gchar *icon_name);
+
+G_CONST_RETURN gchar *xfce_heading_get_subtitle (XfceHeading *heading);
+void xfce_heading_set_subtitle (XfceHeading *heading,
+ const gchar *subtitle);
+
+G_CONST_RETURN gchar *xfce_heading_get_title (XfceHeading *heading);
+void xfce_heading_set_title (XfceHeading *heading,
+ const gchar *title);
+
+G_END_DECLS;
+
+#endif /* !__XFCE_HEADING_H__ */
Property changes on: thunar-volman/trunk/thunar-volman/xfce-heading.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/xfce-titled-dialog.c
===================================================================
--- thunar-volman/trunk/thunar-volman/xfce-titled-dialog.c (rev 0)
+++ thunar-volman/trunk/thunar-volman/xfce-titled-dialog.c 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,370 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, 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
+
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+
+#include <gdk/gdkkeysyms.h>
+
+#include "xfce-heading.h"
+#include "xfce-titled-dialog.h"
+
+
+
+#define XFCE_TITLED_DIALOG_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), XFCE_TYPE_TITLED_DIALOG, XfceTitledDialogPrivate))
+
+
+
+/* Property identifiers */
+enum
+{
+ PROP_0,
+ PROP_SUBTITLE,
+};
+
+
+
+static void xfce_titled_dialog_class_init (XfceTitledDialogClass *klass);
+static void xfce_titled_dialog_init (XfceTitledDialog *titled_dialog);
+static void xfce_titled_dialog_finalize (GObject *object);
+static void xfce_titled_dialog_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void xfce_titled_dialog_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void xfce_titled_dialog_close (GtkDialog *dialog);
+static void xfce_titled_dialog_update_heading (XfceTitledDialog *titled_dialog);
+
+
+
+struct _XfceTitledDialogPrivate
+{
+ GtkWidget *heading;
+ gchar *subtitle;
+};
+
+
+
+G_DEFINE_TYPE (XfceTitledDialog, xfce_titled_dialog, GTK_TYPE_DIALOG);
+
+
+
+static void
+xfce_titled_dialog_class_init (XfceTitledDialogClass *klass)
+{
+ GtkDialogClass *gtkdialog_class;
+ GtkBindingSet *binding_set;
+ GObjectClass *gobject_class;
+
+ /* add our private data to the class */
+ g_type_class_add_private (klass, sizeof (XfceTitledDialogPrivate));
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = xfce_titled_dialog_finalize;
+ gobject_class->get_property = xfce_titled_dialog_get_property;
+ gobject_class->set_property = xfce_titled_dialog_set_property;
+
+ gtkdialog_class = GTK_DIALOG_CLASS (klass);
+ gtkdialog_class->close = xfce_titled_dialog_close;
+
+ /**
+ * XfceTitledDialog:subtitle:
+ *
+ * The subtitle displayed below the main dialog title.
+ *
+ * Since: 4.4.0
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_SUBTITLE,
+ g_param_spec_string ("subtitle",
+ "subtitle",
+ "subtitle",
+ NULL,
+ G_PARAM_READWRITE));
+
+ /* connect additional key bindings to the GtkDialog::close action signal */
+ binding_set = gtk_binding_set_by_class (klass);
+ gtk_binding_entry_add_signal (binding_set, GDK_w, GDK_CONTROL_MASK, "close", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_W, GDK_CONTROL_MASK, "close", 0);
+}
+
+
+
+static void
+xfce_titled_dialog_init (XfceTitledDialog *titled_dialog)
+{
+ GtkWidget *line;
+ GtkWidget *vbox;
+
+ /* connect the private data */
+ titled_dialog->priv = XFCE_TITLED_DIALOG_GET_PRIVATE (titled_dialog);
+
+ /* remove the main dialog box from the window */
+ g_object_ref (G_OBJECT (GTK_DIALOG (titled_dialog)->vbox));
+ gtk_container_remove (GTK_CONTAINER (titled_dialog), GTK_DIALOG (titled_dialog)->vbox);
+
+ /* add a new vbox w/o border to the main window */
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (titled_dialog), vbox);
+ gtk_widget_show (vbox);
+
+ /* add the heading to the window */
+ titled_dialog->priv->heading = xfce_heading_new ();
+ gtk_box_pack_start (GTK_BOX (vbox), titled_dialog->priv->heading, FALSE, FALSE, 0);
+ gtk_widget_show (titled_dialog->priv->heading);
+
+ /* add the separator between header and content */
+ line = gtk_hseparator_new ();
+ gtk_box_pack_start (GTK_BOX (vbox), line, FALSE, FALSE, 0);
+ gtk_widget_show (line);
+
+ /* add the main dialog box to the new vbox */
+ gtk_box_pack_start (GTK_BOX (vbox), GTK_DIALOG (titled_dialog)->vbox, TRUE, TRUE, 0);
+ g_object_unref (G_OBJECT (GTK_DIALOG (titled_dialog)->vbox));
+
+ /* make sure to update the heading whenever one of the relevant window properties changes */
+ g_signal_connect (G_OBJECT (titled_dialog), "notify::icon", G_CALLBACK (xfce_titled_dialog_update_heading), NULL);
+ g_signal_connect (G_OBJECT (titled_dialog), "notify::icon-name", G_CALLBACK (xfce_titled_dialog_update_heading), NULL);
+ g_signal_connect (G_OBJECT (titled_dialog), "notify::title", G_CALLBACK (xfce_titled_dialog_update_heading), NULL);
+
+ /* initially update the heading properties */
+ xfce_titled_dialog_update_heading (titled_dialog);
+}
+
+
+
+
+static void
+xfce_titled_dialog_finalize (GObject *object)
+{
+ XfceTitledDialog *titled_dialog = XFCE_TITLED_DIALOG (object);
+
+ /* release the subtitle */
+ g_free (titled_dialog->priv->subtitle);
+
+ (*G_OBJECT_CLASS (xfce_titled_dialog_parent_class)->finalize) (object);
+}
+
+
+
+static void
+xfce_titled_dialog_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ XfceTitledDialog *titled_dialog = XFCE_TITLED_DIALOG (object);
+
+ switch (prop_id)
+ {
+ case PROP_SUBTITLE:
+ g_value_set_string (value, xfce_titled_dialog_get_subtitle (titled_dialog));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+
+static void
+xfce_titled_dialog_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ XfceTitledDialog *titled_dialog = XFCE_TITLED_DIALOG (object);
+
+ switch (prop_id)
+ {
+ case PROP_SUBTITLE:
+ xfce_titled_dialog_set_subtitle (titled_dialog, g_value_get_string (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+
+
+static void
+xfce_titled_dialog_close (GtkDialog *dialog)
+{
+ GdkEvent *event;
+
+ /* verify that the dialog is realized */
+ if (G_LIKELY (GTK_WIDGET_REALIZED (dialog)))
+ {
+ /* send a delete event to the dialog */
+ event = gdk_event_new (GDK_DELETE);
+ event->any.window = g_object_ref (GTK_WIDGET (dialog)->window);
+ event->any.send_event = TRUE;
+ gtk_main_do_event (event);
+ gdk_event_free (event);
+ }
+}
+
+
+
+static void
+xfce_titled_dialog_update_heading (XfceTitledDialog *titled_dialog)
+{
+ /* update the heading properties using the window property values */
+ xfce_heading_set_icon (XFCE_HEADING (titled_dialog->priv->heading), gtk_window_get_icon (GTK_WINDOW (titled_dialog)));
+ xfce_heading_set_icon_name (XFCE_HEADING (titled_dialog->priv->heading), gtk_window_get_icon_name (GTK_WINDOW (titled_dialog)));
+ xfce_heading_set_title (XFCE_HEADING (titled_dialog->priv->heading), gtk_window_get_title (GTK_WINDOW (titled_dialog)));
+}
+
+
+
+/**
+ * xfce_titled_dialog_new:
+ *
+ * Allocates a new #XfceTitledDialog instance.
+ *
+ * Return value: the newly allocated #XfceTitledDialog.
+ *
+ * Since: 4.4.0
+ **/
+GtkWidget*
+xfce_titled_dialog_new (void)
+{
+ return g_object_new (XFCE_TYPE_TITLED_DIALOG, NULL);
+}
+
+
+
+/**
+ * xfce_titled_dialog_new_with_buttons:
+ * @title : title of the dialog, or %NULL.
+ * @parent : transient parent window of the dialog, or %NULL.
+ * @flags : from #GtkDialogFlags.
+ * @first_button_text : stock ID or text to go in first, or %NULL.
+ * @... : response ID for the first button, then additional buttons, ending with %NULL.
+ *
+ * See the documentation of gtk_dialog_new_with_buttons() for details about the
+ * parameters and the returned dialog.
+ *
+ * Return value: the newly allocated #XfceTitledDialog.
+ *
+ * Since: 4.4.0
+ **/
+GtkWidget*
+xfce_titled_dialog_new_with_buttons (const gchar *title,
+ GtkWindow *parent,
+ GtkDialogFlags flags,
+ const gchar *first_button_text,
+ ...)
+{
+ const gchar *button_text;
+ GtkWidget *dialog;
+ va_list args;
+ gint response_id;
+
+ /* allocate the dialog */
+ dialog = g_object_new (XFCE_TYPE_TITLED_DIALOG,
+ "destroy-with-parent", ((flags & GTK_DIALOG_DESTROY_WITH_PARENT) != 0),
+ "has-separator", ((flags & GTK_DIALOG_NO_SEPARATOR) == 0),
+ "modal", ((flags & GTK_DIALOG_MODAL) != 0),
+ "title", title,
+ NULL);
+
+ /* set the transient parent (if any) */
+ if (G_LIKELY (parent != NULL))
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+
+ /* add all additional buttons */
+ va_start (args, first_button_text);
+ for (button_text = first_button_text; button_text != NULL; )
+ {
+ response_id = va_arg (args, gint);
+ gtk_dialog_add_button (GTK_DIALOG (dialog), button_text, response_id);
+ button_text = va_arg (args, const gchar *);
+ }
+ va_end (args);
+
+ return dialog;
+}
+
+
+
+/**
+ * xfce_titled_dialog_get_subtitle:
+ * @titled_dialog : a #XfceTitledDialog.
+ *
+ * Returns the subtitle of the @titled_dialog, or %NULL
+ * if no subtitle is displayed in the @titled_dialog.
+ *
+ * Return value: the subtitle of @titled_dialog, or %NULL.
+ *
+ * Since: 4.4.0
+ **/
+G_CONST_RETURN gchar*
+xfce_titled_dialog_get_subtitle (XfceTitledDialog *titled_dialog)
+{
+ g_return_val_if_fail (XFCE_IS_TITLED_DIALOG (titled_dialog), NULL);
+ return titled_dialog->priv->subtitle;
+}
+
+
+
+/**
+ * xfce_titled_dialog_set_subtitle:
+ * @titled_dialog : a #XfceTitledDialog.
+ * @subtitle : the new subtitle for the @titled_dialog, or %NULL.
+ *
+ * Sets the subtitle displayed by @titled_dialog to @subtitle; if
+ * @subtitle is %NULL no subtitle will be displayed by the @titled_dialog.
+ *
+ * Since: 4.4.0
+ **/
+void
+xfce_titled_dialog_set_subtitle (XfceTitledDialog *titled_dialog,
+ const gchar *subtitle)
+{
+ g_return_if_fail (XFCE_IS_TITLED_DIALOG (titled_dialog));
+ g_return_if_fail (subtitle == NULL || g_utf8_validate (subtitle, -1, NULL));
+
+ /* release the previous subtitle */
+ g_free (titled_dialog->priv->subtitle);
+
+ /* activate the new subtitle */
+ titled_dialog->priv->subtitle = g_strdup (subtitle);
+
+ /* update the subtitle for the heading */
+ xfce_heading_set_subtitle (XFCE_HEADING (titled_dialog->priv->heading), subtitle);
+
+ /* notify listeners */
+ g_object_notify (G_OBJECT (titled_dialog), "subtitle");
+}
+
+
Property changes on: thunar-volman/trunk/thunar-volman/xfce-titled-dialog.c
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
Added: thunar-volman/trunk/thunar-volman/xfce-titled-dialog.h
===================================================================
--- thunar-volman/trunk/thunar-volman/xfce-titled-dialog.h (rev 0)
+++ thunar-volman/trunk/thunar-volman/xfce-titled-dialog.h 2007-01-11 23:11:32 UTC (rev 2340)
@@ -0,0 +1,75 @@
+/* $Id$ */
+/*-
+ * Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __XFCE_TITLED_DIALOG_H__
+#define __XFCE_TITLED_DIALOG_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS;
+
+typedef struct _XfceTitledDialogPrivate XfceTitledDialogPrivate;
+typedef struct _XfceTitledDialogClass XfceTitledDialogClass;
+typedef struct _XfceTitledDialog XfceTitledDialog;
+
+#define XFCE_TYPE_TITLED_DIALOG (xfce_titled_dialog_get_type ())
+#define XFCE_TITLED_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_TITLED_DIALOG, XfceTitledDialog))
+#define XFCE_TITLED_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XFCE_TYPE_TITLED_DIALOG, XfceTitledDialogClass))
+#define XFCE_IS_TITLED_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XFCE_TYPE_TITLED_DIALOG))
+#define XFCE_IS_TITLED_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_TITLED_DIALOG))
+#define XFCE_TITLED_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_TITLED_DIALOG, XfceTitledDialogClass))
+
+struct _XfceTitledDialogClass
+{
+ /*< private >*/
+ GtkDialogClass __parent__;
+
+ /* reserved for future expansion */
+ void (*reserved0) (void);
+ void (*reserved1) (void);
+ void (*reserved2) (void);
+ void (*reserved3) (void);
+ void (*reserved4) (void);
+ void (*reserved5) (void);
+};
+
+struct _XfceTitledDialog
+{
+ /*< private >*/
+ GtkDialog __parent__;
+ XfceTitledDialogPrivate *priv;
+};
+
+GType xfce_titled_dialog_get_type (void) G_GNUC_CONST;
+
+GtkWidget *xfce_titled_dialog_new (void) G_GNUC_MALLOC;
+GtkWidget *xfce_titled_dialog_new_with_buttons (const gchar *title,
+ GtkWindow *parent,
+ GtkDialogFlags flags,
+ const gchar *first_button_text,
+ ...) G_GNUC_MALLOC;
+
+G_CONST_RETURN gchar *xfce_titled_dialog_get_subtitle (XfceTitledDialog *titled_dialog);
+void xfce_titled_dialog_set_subtitle (XfceTitledDialog *titled_dialog,
+ const gchar *subtitle);
+
+G_END_DECLS;
+
+#endif /* !__XFCE_TITLED_DIALOG_H__ */
Property changes on: thunar-volman/trunk/thunar-volman/xfce-titled-dialog.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Rev
More information about the Goodies-commits
mailing list