[Goodies-commits] r7452 - / parole parole/trunk parole/trunk/data parole/trunk/data/icons parole/trunk/data/interfaces parole/trunk/data/pixmaps parole/trunk/po parole/trunk/src
Ali Abdallah
aliov at xfce.org
Wed Jun 3 10:40:27 CEST 2009
Author: aliov
Date: 2009-06-03 08:40:27 +0000 (Wed, 03 Jun 2009)
New Revision: 7452
Added:
parole/
parole/branches/
parole/tags/
parole/trunk/
parole/trunk/AUTHORS
parole/trunk/COPYING
parole/trunk/ChangeLog
parole/trunk/INSTALL
parole/trunk/Makefile.am
parole/trunk/NEWS
parole/trunk/README
parole/trunk/TODO
parole/trunk/autogen.sh
parole/trunk/configure.ac.in
parole/trunk/data/
parole/trunk/data/Makefile.am
parole/trunk/data/icons/
parole/trunk/data/icons/Makefile.am
parole/trunk/data/interfaces/
parole/trunk/data/interfaces/Makefile.am
parole/trunk/data/interfaces/parole.ui
parole/trunk/data/parole-media-player.desktop.in
parole/trunk/data/pixmaps/
parole/trunk/data/pixmaps/Makefile.am
parole/trunk/data/pixmaps/parole.png
parole/trunk/po/
parole/trunk/po/LINGUAS
parole/trunk/po/POTFILES.in
parole/trunk/po/parole-media-player.pot
parole/trunk/src/
parole/trunk/src/Makefile.am
parole/trunk/src/builder.c
parole/trunk/src/builder.h
parole/trunk/src/debug.c
parole/trunk/src/debug.h
parole/trunk/src/enum-glib.h
parole/trunk/src/gmarshal.list
parole/trunk/src/gst.c
parole/trunk/src/gst.h
parole/trunk/src/main.c
parole/trunk/src/manager.c
parole/trunk/src/manager.h
parole/trunk/src/mediachooser.c
parole/trunk/src/mediachooser.h
parole/trunk/src/mediafile.c
parole/trunk/src/mediafile.h
parole/trunk/src/medialist.c
parole/trunk/src/medialist.h
parole/trunk/src/player.c
parole/trunk/src/player.h
parole/trunk/src/rc-utils.c
parole/trunk/src/rc-utils.h
parole/trunk/src/sidebar.c
parole/trunk/src/sidebar.h
parole/trunk/src/statusbar.c
parole/trunk/src/statusbar.h
parole/trunk/src/stream.c
parole/trunk/src/stream.h
Log:
Initial import of parole, juste une parole
Added: parole/trunk/AUTHORS
===================================================================
--- parole/trunk/AUTHORS (rev 0)
+++ parole/trunk/AUTHORS 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1 @@
+Ali Abdallah aliov at xfce.org
\ No newline at end of file
Added: parole/trunk/COPYING
===================================================================
--- parole/trunk/COPYING (rev 0)
+++ parole/trunk/COPYING 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
Added: parole/trunk/ChangeLog
===================================================================
--- parole/trunk/ChangeLog (rev 0)
+++ parole/trunk/ChangeLog 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,2 @@
+2009-06-03: 10:30 Ali aliov at xfce.org
+ * Initial import of parole, Juste une parole.
Added: parole/trunk/INSTALL
===================================================================
--- parole/trunk/INSTALL (rev 0)
+++ parole/trunk/INSTALL 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,291 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007, 2008 Free Software Foundation, Inc.
+
+ This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+ Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+ 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 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.
+
+ Running `configure' might take a while. 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.
+
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
+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=c99 CFLAGS=-g 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 can use 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 `..'.
+
+ With a non-GNU `make', it is safer 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.
+
+ On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor. Like
+this:
+
+ ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CPP="gcc -E" CXXCPP="g++ -E"
+
+ This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+ By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Particular systems
+==================
+
+ On HP-UX, the default C compiler is not ANSI C compatible. If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+ ./configure CC="cc -Ae"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+ On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file. The option `-nodtk' can be used as
+a workaround. If GNU CC is not installed, it is therefore recommended
+to try
+
+ ./configure CC="cc"
+
+and if that doesn't work, try
+
+ ./configure CC="cc -nodtk"
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on. Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+ Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
+
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+ Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+ Print a summary of the options unique to this package's
+ `configure', and exit. The `short' variant lists options used
+ only in the top level, while the `recursive' variant lists options
+ also present in any nested packages.
+
+`--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.
+
+`--prefix=DIR'
+ Use DIR as the installation prefix. *Note Installation Names::
+ for more details, including other options available for fine-tuning
+ the installation locations.
+
+`--no-create'
+`-n'
+ Run the configure checks, but stop before creating any output
+ files.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
Added: parole/trunk/Makefile.am
===================================================================
--- parole/trunk/Makefile.am (rev 0)
+++ parole/trunk/Makefile.am 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,39 @@
+SUBDIRS = src \
+ data \
+ po
+
+EXTRA_DIST = \
+ intltool-extract.in \
+ intltool-merge.in \
+ intltool-update.in
+
+DISTCLEANFILES = \
+ intltool-extract \
+ intltool-merge \
+ intltool-update
+
+distclean-local:
+ rm -rf *.cache
+
+rpm: dist
+ rpmbuild -ta $(PACKAGE)-$(VERSION).tar.gz
+ @rm -f $(PACKAGE)-$(VERSION).tar.gz
+
+html: Makefile
+ make -C doc html
+
+dist-bz2: dist
+ zcat $(PACKAGE)-$(VERSION).tar.gz | \
+ bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2
+
+distcheck-bz2: distcheck
+ zcat $(PACKAGE)-$(VERSION).tar.gz | \
+ bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2
+
+snapshot: dist
+ mv $(PACKAGE)-$(VERSION).tar.gz \
+ $(PACKAGE)-$(VERSION)-r at REVISION@.tar.gz
+
+snapshot-bz2: dist-bz2
+ mv $(PACKAGE)-$(VERSION).tar.bz2 \
+ $(PACKAGE)-$(VERSION)-r at REVISION@.tar.bz2
Added: parole/trunk/NEWS
===================================================================
--- parole/trunk/NEWS (rev 0)
+++ parole/trunk/NEWS 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1 @@
+
Added: parole/trunk/TODO
===================================================================
--- parole/trunk/TODO (rev 0)
+++ parole/trunk/TODO 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1 @@
+
Added: parole/trunk/autogen.sh
===================================================================
--- parole/trunk/autogen.sh (rev 0)
+++ parole/trunk/autogen.sh 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# $Id: autogen.sh 23241 2006-09-29 19:05:15Z kelnos $
+#
+# Copyright (c) 2002-2005
+# The Xfce development team. All rights reserved.
+#
+# Written for Xfce 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, available from
+ http://xfce.org/~benny/projects/xfce4-dev-tools/.
+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
+}
+
+echo 'dnl *** This file is automatically generated from configure.ac.in ***' \
+ >configure.ac
+echo 'dnl *** DO NOT EDIT! ***' >>configure.ac
+echo >>configure.ac
+
+# substitute revision and linguas
+linguas=$(sed -e '/^#/d' po/LINGUAS)
+if [ -d .git/svn ]; then
+ revision=$(git svn find-rev trunk 2>/dev/null ||
+ git svn find-rev origin/trunk 2>/dev/null ||
+ git svn find-rev HEAD 2>/dev/null ||
+ git svn find-rev master 2>/dev/null)
+elif [ -d .svn ]; then
+ revision=$(LC_ALL=C svn info $0 | awk '/^Revision: / {printf "%05d\n", $2}')
+else
+ revision=UNKNOWN
+fi
+sed -e "s/@LINGUAS@/${linguas}/g" \
+ -e "s/@REVISION@/${revision}/g" \
+ < "configure.ac.in" >> "configure.ac"
+
+xdt-autogen $@
+
+# vi:set ts=2 sw=2 et ai:
Property changes on: parole/trunk/autogen.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: parole/trunk/configure.ac.in
===================================================================
--- parole/trunk/configure.ac.in (rev 0)
+++ parole/trunk/configure.ac.in 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,128 @@
+m4_define([intltool_minimum_version], [0.31])
+m4_define([parole_version_major], [0])
+m4_define([parole_version_minor], [1])
+m4_define([parole_version_micro], [0])
+m4_define([parole_version_build], [r at REVISION@])
+m4_define([parole_version_tag], [svn])
+m4_define([parole_version], [parole_version_major().parole_version_minor().parole_version_micro()ifelse(parole_version_tag(), [svn], [parole_version_tag().parole_version_build()], [parole_version_tag()])])
+
+AC_INIT([parole-media-player], [parole_version], [aliov at xfce.org])
+AC_PREREQ(2.50)
+
+AM_INIT_AUTOMAKE([1.8 dist-bzip2 tar-ustar])
+AM_CONFIG_HEADER([config.h])
+AM_MAINTAINER_MODE
+
+# ===================================================== #
+# Check for UNIX variants #
+# ===================================================== #
+AC_AIX
+AC_ISC_POSIX
+AC_MINIX
+
+# ===================================================== #
+# Basic compiler settings #
+# ===================================================== #
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_LD
+AC_PROG_INSTALL
+AC_PROG_INTLTOOL([intltool_minimum_version], [no-xml])
+
+# ===================================================== #
+# Initialize libtool #
+# ===================================================== #
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
+
+# ==================================================== #
+# Check for headers needed for standard interfaces #
+# ==================================================== #
+AC_HEADER_STDC
+AC_CHECK_HEADERS([errno.h signal.h stddef.h \
+ string.h sys/stat.h sys/types.h sys/wait.h time.h \
+ unistd.h])
+
+# ===================================================== #
+# Check for i18n support #
+# ===================================================== #
+
+XDT_I18N([@LINGUAS@])
+
+#==================================================== #
+# Check for required packages #
+#=====================================================#
+m4_define([gtk_minimum_version], [2.16.0])
+m4_define([glib_minimum_version], [2.16.0])
+m4_define([dbus_minimum_version], [0.60])
+m4_define([dbus_glib_minimum_version], [0.70])
+m4_define([gstreamer_minimum_version], [0.10.11])
+m4_define([libxfcegui4_minimum_version],[4.6.0])
+m4_define([libxfce4util_minimum_version],[4.6.0])
+
+m4_define([libnotify_minimum_version], [0.4.1])
+
+XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [gtk_minimum_version])
+XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [glib_minimum_version])
+XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [glib_minimum_version])
+XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [glib_minimum_version])
+XDT_CHECK_PACKAGE([GIO], [gio-2.0], [glib_minimum_version])
+
+XDT_CHECK_PACKAGE([GST], [gstreamer-0.10], [gstreamer_minimum_version])
+XDT_CHECK_PACKAGE([GST_BASE], [gstreamer-base-0.10], [gstreamer_minimum_version])
+XDT_CHECK_PACKAGE([GST_INTERFACES], [gstreamer-interfaces-0.10], [gstreamer_minimum_version])
+
+XDT_CHECK_PACKAGE([DBUS], [dbus-1], [dbus_minimum_version])
+XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [dbus_glib_minimum_version])
+
+XDT_CHECK_PACKAGE([LIBXFCE4GUI], [libxfcegui4-1.0],[libxfcegui4_minimum_version])
+XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0],[libxfce4util_minimum_version])
+
+XDT_CHECK_PACKAGE([LIBNOTIFY],[libnotify], [libnotify_minimum_version])
+
+# Taken from Gnome system tools
+#=======================================================#
+# Pixmaps and interface files #
+#=======================================================#
+if test "x${prefix}" = "xNONE"; then
+ AC_DEFINE_UNQUOTED(PIXMAPS_DIR, "${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/pixmaps", [pixmaps directory])
+ pixmapsdir="${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/pixmaps"
+ AC_DEFINE_UNQUOTED(INTERFACES_DIR, "${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/ui", [path where UI files will be installed])
+ interfacesdir="${ac_default_prefix}/${DATADIRNAME}/${PACKAGE}/ui"
+else
+ AC_DEFINE_UNQUOTED(PIXMAPS_DIR, "${prefix}/${DATADIRNAME}/${PACKAGE}/pixmaps", [pixmaps directory])
+ pixmapsdir="${prefix}/${DATADIRNAME}/${PACKAGE}/pixmaps"
+ AC_DEFINE_UNQUOTED(INTERFACES_DIR, "${prefix}/${DATADIRNAME}/${PACKAGE}/ui", [path where UI files will be installed])
+ interfacesdir="${prefix}/${DATADIRNAME}/${PACKAGE}/ui"
+fi
+
+AC_SUBST(pixmapsdir)
+AC_SUBST(interfacesdir)
+
+#=======================================================#
+# Check for debugging support #
+#=======================================================#
+XDT_FEATURE_DEBUG
+
+AC_OUTPUT([
+Makefile
+src/Makefile
+data/Makefile
+data/pixmaps/Makefile
+data/interfaces/Makefile
+data/icons/Makefile
+po/Makefile.in
+])
+
+echo "
+--------------------------------------------------
+ Parole Media Player $VERSION
+ ====================================
+
+ prefix: $prefix
+ interface_dir $interfacesdir
+ pixmapsdir $pixmapsdir
+ Debug support: $enable_debug
+--------------------------------------------------
+
+Configuration finished, type make to compile"
Added: parole/trunk/data/Makefile.am
===================================================================
--- parole/trunk/data/Makefile.am (rev 0)
+++ parole/trunk/data/Makefile.am 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,19 @@
+SUBDIRS = \
+ interfaces \
+ pixmaps \
+ icons
+
+#
+# .desktop file
+#
+desktop_in_files = parole-media-player.desktop.in
+desktopdir = $(datadir)/applications
+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+
+ at INTLTOOL_DESKTOP_RULE@
+
+EXTRA_DIST = \
+ $(desktop_in_files)
+
+DISTCLEANFILES = \
+ $(desktop_DATA)
\ No newline at end of file
Added: parole/trunk/data/interfaces/Makefile.am
===================================================================
--- parole/trunk/data/interfaces/Makefile.am (rev 0)
+++ parole/trunk/data/interfaces/Makefile.am 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,8 @@
+interfaces = \
+ parole.ui
+
+interfaces_DATA = \
+ $(interfaces)
+
+EXTRA_DIST = \
+ $(interfaces)
\ No newline at end of file
Added: parole/trunk/data/interfaces/parole.ui
===================================================================
--- parole/trunk/data/interfaces/parole.ui (rev 0)
+++ parole/trunk/data/interfaces/parole.ui 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,865 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkWindow" id="main-window">
+ <property name="window_position">center</property>
+ <property name="default_width">680</property>
+ <property name="default_height">440</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkMenuBar" id="menubar1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkMenuItem" id="file-menu">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_File</property>
+ <property name="use_underline">True</property>
+ <child type="submenu">
+ <object class="GtkMenu" id="menu1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImageMenuItem" id="menu-open">
+ <property name="label">gtk-open</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImageMenuItem" id="menu-open-location">
+ <property name="label">_Open location</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="image">image5</property>
+ <property name="use_stock">False</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImageMenuItem" id="menu-add">
+ <property name="label">gtk-add</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImageMenuItem" id="menu-exit">
+ <property name="label">gtk-quit</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="edit-menu">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Edit</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="view-menu">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_View</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="help-menu">
+ <property name="visible">True</property>
+ <property name="right_justified">True</property>
+ <property name="label" translatable="yes">_Help</property>
+ <property name="use_underline">True</property>
+ <child type="submenu">
+ <object class="GtkMenu" id="menu3">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkImageMenuItem" id="imagemenuitem10">
+ <property name="label">gtk-about</property>
+ <property name="visible">True</property>
+ <property name="use_underline">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkTreeView" id="treeview">
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="enable_search">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkNotebook" id="notebook">
+ <property name="visible">True</property>
+ <property name="show_tabs">False</property>
+ <property name="scrollable">True</property>
+ <property name="group_id">0</property>
+ <child>
+ <object class="GtkHBox" id="playerbox">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkHBox" id="output">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkHScale" id="scale">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="draw_value">False</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkButton" id="back">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image6</property>
+ <property name="relief">none</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="stop">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image7</property>
+ <property name="relief">none</property>
+ <property name="focus_on_click">False</property>
+ <accelerator key="s" signal="clicked"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="play-pause">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image8</property>
+ <property name="relief">none</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="forward">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image9</property>
+ <property name="relief">none</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVSeparator" id="vseparator2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="list-box">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTreeView" id="media-list">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="show_expanders">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkButton" id="add-media">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image1</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="remove-media">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image2</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="media-up">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image3</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="media-down">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image4</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="Player">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Media player</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="converter-box">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Nothing yet.</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Audio converter</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="recorder-box">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Nothing yet.</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Audio recorder</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="albums-box">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Nothing yet.</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="album">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Albums</property>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkNotebook" id="notebook1">
+ <property name="visible">True</property>
+ <property name="show_tabs">False</property>
+ <property name="scrollable">True</property>
+ <property name="group_id">0</property>
+ <child>
+ <object class="GtkHBox" id="playerbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkHBox" id="output1">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox5">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkHScale" id="scale1">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="draw_value">False</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkButton" id="back1">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image10</property>
+ <property name="relief">none</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="stop1">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image11</property>
+ <property name="relief">none</property>
+ <property name="focus_on_click">False</property>
+ <accelerator key="s" signal="clicked"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="play-pause1">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image12</property>
+ <property name="relief">none</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="forward1">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image13</property>
+ <property name="relief">none</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVSeparator" id="vseparator1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="list-box1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTreeView" id="media-list1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="show_expanders">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkButton" id="add-media1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image14</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="remove-media1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image15</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="media-up1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image16</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="media-down1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image17</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="Player1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Media player</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="converter-box1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Nothing yet.</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Audio converter</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="recorder-box1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Nothing yet.</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Audio recorder</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="albums-box1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Nothing yet.</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="album1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Albums</property>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="statusbox">
+ <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="spacing">5</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkAction" id="action1"/>
+ <object class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="stock">gtk-network</property>
+ </object>
+ <object class="GtkImage" id="image6">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-previous</property>
+ </object>
+ <object class="GtkImage" id="image7">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-stop</property>
+ </object>
+ <object class="GtkImage" id="image8">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-play</property>
+ </object>
+ <object class="GtkImage" id="image9">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-next</property>
+ </object>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-add</property>
+ </object>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-remove</property>
+ </object>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-go-up</property>
+ </object>
+ <object class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-go-down</property>
+ </object>
+ <object class="GtkImage" id="image10">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-previous</property>
+ </object>
+ <object class="GtkImage" id="image11">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-stop</property>
+ </object>
+ <object class="GtkImage" id="image12">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-play</property>
+ </object>
+ <object class="GtkImage" id="image13">
+ <property name="visible">True</property>
+ <property name="stock">gtk-media-next</property>
+ </object>
+ <object class="GtkImage" id="image14">
+ <property name="visible">True</property>
+ <property name="stock">gtk-add</property>
+ </object>
+ <object class="GtkImage" id="image15">
+ <property name="visible">True</property>
+ <property name="stock">gtk-remove</property>
+ </object>
+ <object class="GtkImage" id="image16">
+ <property name="visible">True</property>
+ <property name="stock">gtk-go-up</property>
+ </object>
+ <object class="GtkImage" id="image17">
+ <property name="visible">True</property>
+ <property name="stock">gtk-go-down</property>
+ </object>
+</interface>
Added: parole/trunk/data/parole-media-player.desktop.in
===================================================================
--- parole/trunk/data/parole-media-player.desktop.in (rev 0)
+++ parole/trunk/data/parole-media-player.desktop.in 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,8 @@
+[Desktop Entry]
+_Name=Xfce Media Player
+Icon=multimedia
+Exec=xfce-media-player
+Terminal=false
+Type=Application;
+Categories=GTK;AudioVideo;Player;Video;
+StartupNotify=true
Added: parole/trunk/data/pixmaps/Makefile.am
===================================================================
--- parole/trunk/data/pixmaps/Makefile.am (rev 0)
+++ parole/trunk/data/pixmaps/Makefile.am 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,8 @@
+pixmaps = \
+ parole.png
+
+pixmaps_DATA = \
+ $(pixmaps)
+
+EXTRA_DIST = \
+ $(pixmaps)
\ No newline at end of file
Added: parole/trunk/data/pixmaps/parole.png
===================================================================
(Binary files differ)
Property changes on: parole/trunk/data/pixmaps/parole.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: parole/trunk/po/LINGUAS
===================================================================
--- parole/trunk/po/LINGUAS (rev 0)
+++ parole/trunk/po/LINGUAS 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1 @@
+# set of available languages (in alphabetic order)
Added: parole/trunk/po/POTFILES.in
===================================================================
--- parole/trunk/po/POTFILES.in (rev 0)
+++ parole/trunk/po/POTFILES.in 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,8 @@
+data/interfaces/parole.ui
+data/parole-media-player.desktop.in
+src/gst.c
+src/mediachooser.c
+src/medialist.c
+src/player.c
+src/sidebar.c
+src/statusbar.c
Added: parole/trunk/po/parole-media-player.pot
===================================================================
--- parole/trunk/po/parole-media-player.pot (rev 0)
+++ parole/trunk/po/parole-media-player.pot 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,107 @@
+# 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: 2009-06-03 10:35+0200\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"
+
+#: ../data/parole-media-player.desktop.in.h:1
+msgid "Xfce Media Player"
+msgstr ""
+
+#: ../src/gst.c:548
+msgid "Error in changing state to ready"
+msgstr ""
+
+#: ../src/gst.c:595
+msgid ""
+"Unable to load playbin GStreamer plugin, check your GStreamer installation"
+msgstr ""
+
+#: ../src/gst.c:605
+msgid ""
+"Unable to load xvimagesink GStreamer plugin, check your GStreamer "
+"installation"
+msgstr ""
+
+#: ../src/mediachooser.c:420
+msgid "Audio and video"
+msgstr ""
+
+#: ../src/mediachooser.c:447
+msgid "Add media files"
+msgstr ""
+
+#: ../src/mediachooser.c:447
+msgid "Open media file"
+msgstr ""
+
+#: ../src/mediachooser.c:452
+msgid "Open location"
+msgstr ""
+
+#: ../src/mediachooser.c:532
+msgid "Open location of media file or live stream"
+msgstr ""
+
+#: ../src/medialist.c:274
+msgid "Media list"
+msgstr ""
+
+#: ../src/player.c:164 ../src/statusbar.c:119 ../src/statusbar.c:121
+msgid "Playing"
+msgstr ""
+
+#: ../src/player.c:165
+msgid "Media stream is not seekable"
+msgstr ""
+
+#: ../src/player.c:179 ../src/player.c:192
+msgid "Paused"
+msgstr ""
+
+#: ../src/player.c:210
+msgid "Stopped"
+msgstr ""
+
+#: ../src/sidebar.c:137
+msgid ""
+"<b>Media \n"
+"player\n"
+"</b>"
+msgstr ""
+
+#: ../src/sidebar.c:147
+msgid ""
+"<b>Audio \n"
+"recorder\n"
+"</b>"
+msgstr ""
+
+#: ../src/sidebar.c:158
+msgid ""
+"<b>Audio \n"
+"converter\n"
+"</b>"
+msgstr ""
+
+#: ../src/sidebar.c:168
+msgid ""
+"<b>Albums\n"
+"</b>"
+msgstr ""
+
+#: ../src/statusbar.c:131
+msgid "Buffering"
+msgstr ""
Added: parole/trunk/src/Makefile.am
===================================================================
--- parole/trunk/src/Makefile.am (rev 0)
+++ parole/trunk/src/Makefile.am 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,115 @@
+bin_PROGRAMS = parole-media-player
+
+GENERATED_FILES = \
+ gmarshal.c \
+ gmarshal.h \
+ enum-gtypes.c \
+ enum-gtypes.h
+
+parole_media_player_SOURCES = \
+ main.c \
+ $(GENERATED_FILES) \
+ manager.c \
+ manager.h \
+ sidebar.c \
+ sidebar.h \
+ player.c \
+ player.h \
+ stream.c \
+ stream.h \
+ gst.c \
+ gst.h \
+ statusbar.c \
+ statusbar.h \
+ builder.c \
+ builder.h \
+ medialist.c \
+ medialist.h \
+ mediafile.c \
+ mediafile.h \
+ mediachooser.c \
+ mediachooser.h \
+ rc-utils.c \
+ rc-utils.h \
+ debug.c \
+ debug.h
+
+parole_media_player_CFLAGS = \
+ -I$(top_srcdir) \
+ -DLOCALEDIR=\"$(localedir)\" \
+ -DG_LOG_DOMAIN=\"parole-media-player\" \
+ $(GTK_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(GOBJECT_CFLAGS) \
+ $(GTHREAD_CFLAGS) \
+ $(GIO_CFLAGS) \
+ $(DBUS_CFLAGS) \
+ $(DBUS_GLIB_CFLAGS) \
+ $(LIBXFCE4GUI_CFLAGS) \
+ $(LIBXFCE4UTIL_CFLAGS) \
+ $(GST_CFLAGS) \
+ $(GST_BASE_CFLAGS) \
+ $(GST_INTERFACES_CFLAGS)
+
+parole_media_player_LDADD = \
+ $(GTK_LIBS) \
+ $(GLIB_LIBS) \
+ $(GOBJECT_LIBS) \
+ $(GTHREAD_LIBS) \
+ $(GIO_LIBS) \
+ $(DBUS_LIBS) \
+ $(DBUS_GLIB_LIBS) \
+ $(LIBXFCE4GUI_LIBS) \
+ $(LIBXFCE4UTIL_LIBS) \
+ $(GST_LIBS) \
+ $(GST_BASE_LIBS) \
+ $(GST_INTERFACES_LIBS)
+
+parole_glib_header = \
+ $(srcdir)/enum-glib.h
+
+if MAINTAINER_MODE
+
+BUILT_SOURCES = \
+ gmarshal.c \
+ gmarshal.h \
+ enum-gtypes.c \
+ enum-gtypes.h
+
+gmarshal.c: gmarshal.list
+ echo "#include \"gmarshal.h\"" > $@ && \
+ glib-genmarshal $< --prefix=_gmarshal --body >> $@
+
+gmarshal.h: gmarshal.list
+ glib-genmarshal $< --prefix=_gmarshal --header > $@
+
+enum-gtypes.h: $(parole_glib_header)
+ ( cd $(srcdir) && glib-mkenums \
+ --fhead "#ifndef _ENUM_GTYPES_H\n#define _ENUM_GTYPES_H\n#include <glib-object.h>\nG_BEGIN_DECLS\n" \
+ --fprod "/* enumerations from \"@filename@\" */\n" \
+ --vhead "GType @enum_name at _get_type (void);\n#define ENUM_GTYPE_ at ENUMSHORT@ (@enum_name at _get_type())\n" \
+ --ftail "G_END_DECLS\n\n#endif /* _ENUM_GTYPES_H__ */" \
+ $(parole_glib_header) ) >> xgen \
+ && (cmp -s xgen enum-gtypes.h || cp xgen enum-gtypes.h ) \
+ && rm -f xgen xgen~
+
+enum-gtypes.c: enum-gtypes.h
+ ( cd $(srcdir) && glib-mkenums \
+ --fhead "#include <enum-gtypes.h>\n" \
+ --fhead "#include \"enum-glib.h\"\n\n" \
+ --fprod "\n/* enumerations from \"@filename@\" */\n" \
+ --vhead "GType\n at enum_name@_get_type (void)\n{\n\tstatic GType type = 0;\n\tif (type == 0) {\n\tstatic const G at Type@Value values[] = {"\
+ --vprod "\t{ @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
+ --vtail "\t{ 0, NULL, NULL }\n\t};\n\ttype = g_ at type@_register_static (\"@EnumName@\", values);\n }\n\treturn type;\n}\n" \
+ enum-glib.h ) > xgen \
+ && cp xgen enum-gtypes.c \
+ && rm -f xgen xgen~
+
+endif
+
+EXTRA_DIST = \
+ gmarshal.list \
+ enum-glib.h
+
+DISTCLEANFILES = \
+ $(BUILT_SOURCES)
\ No newline at end of file
Added: parole/trunk/src/builder.c
===================================================================
--- parole/trunk/src/builder.c (rev 0)
+++ parole/trunk/src/builder.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,75 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <libxfce4util/libxfce4util.h>
+#include <libxfcegui4/libxfcegui4.h>
+
+#include "builder.h"
+
+#define INTERFACE_FILE INTERFACES_DIR "/parole.ui"
+
+G_DEFINE_TYPE (ParoleBuilder, parole_builder, GTK_TYPE_BUILDER)
+
+static gpointer parole_builder_object = NULL;
+
+static void
+parole_builder_class_init (ParoleBuilderClass *klass)
+{
+
+}
+
+static void
+parole_builder_init (ParoleBuilder *builder)
+{
+ GError *error = NULL;
+
+ gtk_builder_add_from_file (GTK_BUILDER (builder),
+ INTERFACE_FILE,
+ &error);
+ if ( error )
+ {
+ xfce_err ("%s : %s", error->message, _("Check your Parole installation"));
+ g_error ("%s", error->message);
+ }
+}
+
+GtkBuilder *
+parole_builder_new (void)
+{
+ if ( parole_builder_object != NULL )
+ {
+ g_object_ref (parole_builder_object);
+ }
+ else
+ {
+ parole_builder_object = g_object_new (PAROLE_TYPE_BUILDER, NULL);
+ g_object_add_weak_pointer (parole_builder_object, &parole_builder_object);
+ }
+
+ return GTK_BUILDER (parole_builder_object);
+}
Added: parole/trunk/src/builder.h
===================================================================
--- parole/trunk/src/builder.h (rev 0)
+++ parole/trunk/src/builder.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,50 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAROLE_BUILDER_H
+#define __PAROLE_BUILDER_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_BUILDER (parole_builder_get_type () )
+#define PAROLE_BUILDER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), XFMP_TYPE_BUILDER, ParoleBuilder))
+#define PAROLE_IS_BUILDER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), XFMP_TYPE_BUILDER))
+
+typedef struct
+{
+ GtkBuilder parent;
+
+} ParoleBuilder;
+
+typedef struct
+{
+ GtkBuilderClass parent_class;
+
+} ParoleBuilderClass;
+
+GType parole_builder_get_type (void) G_GNUC_CONST;
+GtkBuilder *parole_builder_new (void);
+
+G_END_DECLS
+
+#endif /* __PAROLE_BUILDER_H */
Added: parole/trunk/src/debug.c
===================================================================
--- parole/trunk/src/debug.c (rev 0)
+++ parole/trunk/src/debug.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,81 @@
+/*
+ * * Copyright (C) 2008-2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib-object.h>
+#include <glib/gprintf.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+
+#include "debug.h"
+
+#if defined(DEBUG) && defined(G_HAVE_ISO_VARARGS)
+
+void parole_debug_enum (const gchar *func, const gchar *file, gint line,
+ const gchar *text, gint v_enum, GType type)
+{
+ gchar *content = NULL;
+ GValue __value__ = { 0, };
+
+ g_value_init (&__value__, type);
+ g_value_set_enum (&__value__, v_enum);
+
+ content = g_strdup_value_contents (&__value__);
+
+ fprintf(stdout, "TRACE[%s:%d] %s(): %s : %s", file, line , func, text, content);
+ fprintf(stdout, "\n");
+
+ g_value_unset (&__value__);
+ g_free (content);
+}
+
+void parole_debug_enum_full (const gchar *func, const gchar *file, gint line,
+ gint v_enum, GType type, const gchar *format, ...)
+{
+ va_list args;
+ gchar *buffer;
+
+ gchar *content = NULL;
+ GValue __value__ = { 0, };
+
+ g_value_init (&__value__, type);
+ g_value_set_enum (&__value__, v_enum);
+
+ content = g_strdup_value_contents (&__value__);
+
+ va_start (args, format);
+ g_vasprintf (&buffer, format, args);
+ va_end (args);
+
+ fprintf(stdout, "TRACE[%s:%d] %s(): ", file, line, func);
+ fprintf(stdout, "%s: %s", buffer, content);
+ fprintf(stdout, "\n");
+
+ g_value_unset (&__value__);
+ g_free (content);
+ g_free (buffer);
+}
+
+#endif /*#if defined(DEBUG) && defined(G_HAVE_ISO_VARARGS)*/
Added: parole/trunk/src/debug.h
===================================================================
--- parole/trunk/src/debug.h (rev 0)
+++ parole/trunk/src/debug.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,66 @@
+/*
+ * * Copyright (C) 2008-2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAROLE_DEBUG_H
+#define __PAROLE_DEBUG_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdarg.h>
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#if defined(DEBUG) && defined(G_HAVE_ISO_VARARGS)
+
+#define PAROLE_DEBUG_ENUM(_text, _value, _type)\
+ parole_debug_enum (__func__, __FILE__, __LINE__, _text, _value, _type)
+
+#define PAROLE_DEBUG_ENUM_FULL(_value, _type, ...)\
+ parole_debug_enum_full (__func__, __FILE__, __LINE__, _value, _type, __VA_ARGS__)
+
+void parole_debug_enum (const gchar *func,
+ const gchar *file,
+ gint line,
+ const gchar *text,
+ gint v_enum,
+ GType type);
+
+void parole_debug_enum_full (const gchar *func,
+ const gchar *file,
+ gint line,
+ gint v_enum,
+ GType type,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (6, 7);
+
+
+#else
+
+#define PAROLE_DEBUG_ENUM(_text, _value, _type)
+#define PAROLE_DEBUG_ENUM_FULL(_value, _type, ...)
+
+#endif
+
+G_END_DECLS
+
+#endif /* __XFPM_DEBUG_H */
Added: parole/trunk/src/enum-glib.h
===================================================================
--- parole/trunk/src/enum-glib.h (rev 0)
+++ parole/trunk/src/enum-glib.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,35 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAROLE_ENUM_GLIB_H
+#define __PAROLE_ENUM_GLIB_H
+
+typedef enum
+{
+ PAROLE_MEDIA_STATE_PAUSED,
+ PAROLE_MEDIA_STATE_PLAYING,
+ PAROLE_MEDIA_STATE_STOPPED,
+ PAROLE_MEDIA_STATE_FINISHED
+
+} ParoleMediaState;
+
+
+
+#endif /*__PAROLE_ENUM_GLIB_H*/
Added: parole/trunk/src/gmarshal.list
===================================================================
--- parole/trunk/src/gmarshal.list (rev 0)
+++ parole/trunk/src/gmarshal.list 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,3 @@
+VOID:OBJECT,ENUM
+VOID:OBJECT,DOUBLE
+VOID:OBJECT,INT
Added: parole/trunk/src/gst.c
===================================================================
--- parole/trunk/src/gst.c (rev 0)
+++ parole/trunk/src/gst.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,821 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+
+#include <gst/gst.h>
+#include <gst/interfaces/xoverlay.h>
+
+#include <libxfce4util/libxfce4util.h>
+#include <libxfcegui4/libxfcegui4.h>
+
+#include <gdk/gdkx.h>
+
+#include "gst.h"
+#include "enum-gtypes.h"
+#include "gmarshal.h"
+
+#define PAROLE_GST_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), PAROLE_TYPE_GST, ParoleGstPrivate))
+
+static void parole_gst_play_file_internal (ParoleGst *gst);
+static void parole_gst_change_state (ParoleGst *gst,
+ GstState new);
+
+struct ParoleGstPrivate
+{
+ GstElement *playbin;
+ GstElement *video_sink;
+ GstElement *vis_sink;
+
+ GMutex *lock;
+ GstState state;
+ GstState target;
+
+ ParoleStream *stream;
+ gulong tick_id;
+ gboolean seeking;
+
+ GdkPixbuf *logo;
+ GdkCursor *busy_cursor;
+};
+
+enum
+{
+ MEDIA_STATE,
+ MEDIA_PROGRESSED,
+ BUFFERING,
+ ERROR,
+ LAST_SIGNAL
+};
+
+static guint signals [LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE (ParoleGst, parole_gst, GTK_TYPE_WIDGET)
+
+static void
+parole_gst_finalize (GObject *object)
+{
+ ParoleGst *gst;
+
+ gst = PAROLE_GST (object);
+
+ TRACE ("start");
+
+ if ( gst->priv->tick_id != 0)
+ g_source_remove (gst->priv->tick_id);
+
+ parole_stream_init_properties (gst->priv->stream);
+ g_object_unref (gst->priv->stream);
+ g_object_unref (gst->priv->playbin);
+ gdk_cursor_unref (gst->priv->busy_cursor);
+
+ g_object_unref (gst->priv->logo);
+ g_mutex_free (gst->priv->lock);
+
+ G_OBJECT_CLASS (parole_gst_parent_class)->finalize (object);
+}
+
+static void
+parole_gst_set_window_cursor (GdkWindow *window, GdkCursor *cursor)
+{
+ if ( window )
+ gdk_window_set_cursor (window, cursor);
+}
+
+static gboolean
+parole_gst_configure_event_cb (GtkWidget *widget, GdkEventConfigure *ev, ParoleGst *gst)
+{
+
+
+ return FALSE;
+}
+
+static void
+parole_gst_realize (GtkWidget *widget)
+{
+ ParoleGst *gst;
+ GdkWindowAttr attr;
+ GdkColor color;
+ gint mask;
+
+ GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ gst = PAROLE_GST (widget);
+
+ attr.x = widget->allocation.x;
+ attr.y = widget->allocation.y;
+ attr.width = widget->allocation.width;
+ attr.height = widget->allocation.height;
+ attr.visual = gtk_widget_get_visual (widget);
+ attr.colormap = gtk_widget_get_colormap (widget);
+ attr.wclass = GDK_INPUT_OUTPUT;
+ attr.window_type = GDK_WINDOW_CHILD;
+ attr.event_mask = gtk_widget_get_events (widget) |
+ GDK_EXPOSURE_MASK |
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK;
+
+ mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+
+ widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attr, mask);
+
+ gdk_window_set_user_data (widget->window, widget);
+ gdk_color_parse ("black", &color);
+ gdk_colormap_alloc_color (gtk_widget_get_colormap (widget), &color,
+ TRUE, TRUE);
+
+ gdk_window_set_background (widget->window, &color);
+ widget->style = gtk_style_attach (widget->style, widget->window);
+
+ g_signal_connect (gtk_widget_get_toplevel (widget), "configure_event",
+ G_CALLBACK (parole_gst_configure_event_cb), gst);
+}
+
+static void
+parole_gst_show (GtkWidget *widget)
+{
+ ParoleGst *gst;
+
+ gst = PAROLE_GST (widget);
+
+ gdk_window_show (widget->window);
+
+ if ( GTK_WIDGET_CLASS (parole_gst_parent_class)->show )
+ GTK_WIDGET_CLASS (parole_gst_parent_class)->show (widget);
+}
+
+static void
+parole_gst_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
+{
+ g_return_if_fail (allocation != NULL);
+
+ widget->allocation = *allocation;
+
+ if ( GTK_WIDGET_REALIZED (widget) )
+ {
+ gdk_window_move_resize (widget->window,
+ allocation->x, allocation->y,
+ allocation->width, allocation->height);
+
+ gtk_widget_queue_draw (widget);
+ }
+}
+
+static void
+parole_gst_draw_logo (ParoleGst *gst)
+{
+ GdkPixbuf *pix;
+ GdkRegion *region;
+ GdkRectangle rect;
+ GtkWidget *widget;
+
+ widget = GTK_WIDGET (gst);
+
+ if ( !widget->window )
+ return;
+
+ rect.x = 0;
+ rect.y = 0;
+
+ rect.width = widget->allocation.width;
+ rect.height = widget->allocation.height;
+
+ region = gdk_region_rectangle (&rect);
+
+ gdk_window_begin_paint_region (widget->window,
+ region);
+
+ gdk_window_clear_area (widget->window,
+ 0, 0,
+ widget->allocation.width,
+ widget->allocation.height);
+
+ pix = gdk_pixbuf_scale_simple (gst->priv->logo,
+ widget->allocation.width,
+ widget->allocation.height,
+ GDK_INTERP_BILINEAR);
+
+ gdk_draw_pixbuf (GDK_DRAWABLE (widget->window),
+ GTK_WIDGET(widget)->style->fg_gc[0],
+ pix,
+ 0, 0, 0, 0,
+ widget->allocation.width,
+ widget->allocation.height,
+ GDK_RGB_DITHER_NONE,
+ 0, 0);
+
+ gdk_pixbuf_unref (pix);
+ gdk_window_end_paint (GTK_WIDGET (gst)->window);
+}
+
+static void
+parole_gst_set_x_overlay (ParoleGst *gst)
+{
+ GstElement *video_sink;
+
+ g_object_get (G_OBJECT (gst->priv->playbin),
+ "video-sink", &video_sink,
+ NULL);
+
+ g_assert (video_sink != NULL);
+
+ gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (video_sink),
+ GDK_WINDOW_XWINDOW (GTK_WIDGET (gst)->window));
+
+ gst_object_unref (video_sink);
+}
+
+static gboolean
+parole_gst_expose_event (GtkWidget *widget, GdkEventExpose *ev)
+{
+ ParoleGst *gst;
+
+ if ( ev && ev->count > 0 )
+ return TRUE;
+
+ gst = PAROLE_GST (widget);
+
+ g_mutex_lock (gst->priv->lock);
+ parole_gst_set_x_overlay (gst);
+ g_mutex_unlock (gst->priv->lock);
+
+ if ( gst->priv->state < GST_STATE_PAUSED )
+ parole_gst_draw_logo (gst);
+ else
+ gst_x_overlay_expose (GST_X_OVERLAY (gst->priv->video_sink));
+
+ return TRUE;
+}
+
+static void
+parole_gst_load_logo (ParoleGst *gst)
+{
+ gchar *path;
+
+ path = g_strdup_printf ("%s/parole.png", PIXMAPS_DIR);
+ gst->priv->logo = gdk_pixbuf_new_from_file (path, NULL);
+ g_free (path);
+}
+
+static gboolean
+parole_gst_tick_timeout (gpointer data)
+{
+ ParoleGst *gst;
+
+ gint64 pos;
+ GstFormat format = GST_FORMAT_TIME;
+ gdouble value;
+
+ gst = PAROLE_GST (data);
+
+ gst_element_query_position (gst->priv->playbin, &format, &pos);
+
+ if ( G_UNLIKELY (format != GST_FORMAT_TIME ) )
+ goto out;
+
+ value = ( pos / ((gdouble) 60 * 1000 * 1000 * 1000 ));
+
+ g_signal_emit (G_OBJECT (gst), signals [MEDIA_PROGRESSED], 0, gst->priv->stream, value);
+
+out:
+ return TRUE;
+}
+
+static void
+parole_gst_tick (ParoleGst *gst)
+{
+ if ( gst->priv->state >= GST_STATE_PAUSED )
+ {
+ if ( gst->priv->tick_id != 0 )
+ {
+ return;
+ }
+ gst->priv->tick_id = g_timeout_add (1000, (GSourceFunc) parole_gst_tick_timeout, gst);
+ }
+ else if ( gst->priv->tick_id != 0)
+ {
+ g_source_remove (gst->priv->tick_id);
+ gst->priv->tick_id = 0;
+ }
+
+}
+
+static void
+parole_gst_query_capabilities (ParoleGst *gst)
+{
+ GstQuery *query;
+ gboolean seekable;
+
+ query = gst_query_new_seeking (GST_FORMAT_TIME);
+
+ if ( gst_element_query (gst->priv->playbin, query) )
+ {
+ gst_query_parse_seeking (query,
+ NULL,
+ &seekable,
+ NULL,
+ NULL);
+ }
+ gst_query_unref (query);
+
+ g_object_set (G_OBJECT (gst->priv->stream),
+ "seekable", seekable,
+ NULL);
+}
+
+static void
+parole_gst_query_info (ParoleGst *gst)
+{
+ gint64 absolute_duration = 0;
+ gdouble duration = 0;
+
+ GstFormat gst_time = GST_FORMAT_TIME;
+
+ gst_element_query_duration (gst->priv->playbin,
+ &gst_time,
+ &absolute_duration);
+
+ if (gst_time == GST_FORMAT_TIME)
+ {
+ duration = absolute_duration / ((gdouble) 60 * 1000 * 1000 * 1000);
+ g_object_set (G_OBJECT (gst->priv->stream),
+ "absolute-duration", absolute_duration,
+ "duration", duration,
+ NULL);
+ }
+}
+
+static void
+parole_gst_evaluate_state (ParoleGst *gst, GstState old, GstState new, GstState pending)
+{
+ if ( gst->priv->state != new )
+ {
+ TRACE ("State change %d", new);
+
+ gst->priv->state = new;
+
+ parole_gst_tick (gst);
+
+ if ( gst->priv->target == new )
+ parole_gst_set_window_cursor (GTK_WIDGET (gst)->window, NULL);
+
+ switch (gst->priv->state)
+ {
+ case GST_STATE_PLAYING:
+ parole_gst_query_capabilities (gst);
+ parole_gst_query_info (gst);
+ g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0,
+ gst->priv->stream, PAROLE_MEDIA_STATE_PLAYING);
+ break;
+ case GST_STATE_PAUSED:
+ parole_gst_set_x_overlay (gst);
+ g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0,
+ gst->priv->stream, PAROLE_MEDIA_STATE_PAUSED);
+ break;
+ default:
+ {
+ if ( gst->priv->target == GST_STATE_PLAYING)
+ {
+ parole_gst_play_file_internal (gst);
+ }
+ else if ( gst->priv->target == GST_STATE_PAUSED)
+ {
+ parole_gst_change_state (gst, GST_STATE_PAUSED);
+ }
+ else if ( gst->priv->target == GST_STATE_READY)
+ {
+ g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0,
+ gst->priv->stream, PAROLE_MEDIA_STATE_STOPPED);
+ parole_gst_draw_logo (gst);
+ }
+ else if ( gst->priv->target == GST_STATE_NULL )
+ {
+ g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0,
+ gst->priv->stream, PAROLE_MEDIA_STATE_STOPPED);
+ }
+ }
+ }
+ }
+}
+
+static void
+parole_gst_handle_element_message (ParoleGst *gst, GstMessage *message)
+{
+ if ( !message->structure )
+ goto out;
+
+ if ( gst_structure_has_name (message->structure, "prepare-xwindow-id") )
+ parole_gst_set_x_overlay (gst);
+out:
+ ;
+}
+
+static gboolean
+parole_gst_bus_event (GstBus *bus, GstMessage *msg, gpointer data)
+{
+ ParoleGst *gst;
+
+ gst = PAROLE_GST (data);
+
+ switch (GST_MESSAGE_TYPE (msg))
+ {
+ case GST_MESSAGE_EOS:
+ TRACE ("End of stream");
+ g_signal_emit (G_OBJECT (gst), signals [MEDIA_STATE], 0,
+ gst->priv->stream, PAROLE_MEDIA_STATE_FINISHED);
+ break;
+ case GST_MESSAGE_ERROR:
+ {
+ GError *error = NULL;
+ gchar *debug;
+ parole_gst_set_window_cursor (GTK_WIDGET (gst)->window, NULL);
+ gst_message_parse_error (msg, &error, &debug);
+ TRACE ("*** ERROR %s : %s ***", error->message, debug);
+ g_signal_emit (G_OBJECT (gst), signals [ERROR], 0, error->message);
+ g_error_free (error);
+ g_free (debug);
+ break;
+ }
+ case GST_MESSAGE_BUFFERING:
+ {
+ gint per = 0;
+ gst_message_parse_buffering (msg, &per);
+ TRACE ("Buffering %d %%", per);
+ g_signal_emit (G_OBJECT (gst), signals [BUFFERING], 0,
+ gst->priv->stream, per);
+ break;
+ }
+ case GST_MESSAGE_STATE_CHANGED:
+ {
+ GstState old, new, pending;
+ gst_message_parse_state_changed (msg, &old, &new, &pending);
+
+ if ( GST_MESSAGE_SRC (msg) == GST_OBJECT (gst->priv->playbin) )
+ parole_gst_evaluate_state (gst, old, new, pending);
+ break;
+ }
+ case GST_MESSAGE_WARNING:
+ break;
+ case GST_MESSAGE_INFO:
+ TRACE ("Info message:");
+ break;
+ case GST_MESSAGE_TAG:
+ TRACE ("Tag message:");
+ break;
+ case GST_MESSAGE_STATE_DIRTY:
+ TRACE ("Stream is dirty");
+ break;
+ case GST_MESSAGE_STEP_DONE:
+ break;
+ case GST_MESSAGE_CLOCK_PROVIDE:
+ break;
+ case GST_MESSAGE_CLOCK_LOST:
+ break;
+ case GST_MESSAGE_NEW_CLOCK:
+ break;
+ case GST_MESSAGE_STRUCTURE_CHANGE:
+ break;
+ case GST_MESSAGE_STREAM_STATUS:
+ TRACE ("Stream status");
+ break;
+ case GST_MESSAGE_APPLICATION:
+ TRACE ("Application message");
+ break;
+ case GST_MESSAGE_ELEMENT:
+ parole_gst_handle_element_message (gst, msg);
+ break;
+ case GST_MESSAGE_SEGMENT_START:
+ break;
+ case GST_MESSAGE_DURATION:
+ break;
+ case GST_MESSAGE_LATENCY:
+ break;
+ case GST_MESSAGE_ASYNC_START:
+ break;
+ case GST_MESSAGE_ASYNC_DONE:
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+static void
+parole_gst_change_state (ParoleGst *gst, GstState new)
+{
+ GstStateChangeReturn ret;
+
+ ret = gst_element_set_state (GST_ELEMENT (gst->priv->playbin), new);
+
+ switch (ret)
+ {
+ case GST_STATE_CHANGE_SUCCESS:
+ parole_gst_evaluate_state (gst,
+ GST_STATE_RETURN (gst->priv->playbin),
+ GST_STATE (gst->priv->playbin),
+ GST_STATE_PENDING (gst->priv->playbin));
+ break;
+ case GST_STATE_CHANGE_ASYNC:
+ TRACE ("State will change async");
+ break;
+ case GST_STATE_CHANGE_FAILURE:
+ g_signal_emit (G_OBJECT (gst), signals [ERROR], 0, _("Error in changing state to ready"));
+ break;
+ case GST_STATE_CHANGE_NO_PREROLL:
+ TRACE ("State change no_preroll");
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+parole_gst_play_file_internal (ParoleGst *gst)
+{
+ ParoleMediaFile *file;
+
+ TRACE ("Start");
+
+ if ( G_UNLIKELY (GST_STATE (gst->priv->playbin) == GST_STATE_PLAYING ) )
+ {
+ TRACE ("*** Error *** This is a bug, playbin element is already playing");
+ }
+
+ g_object_get (G_OBJECT (gst->priv->stream),
+ "media-file", &file,
+ NULL);
+
+ g_object_set (G_OBJECT (gst->priv->playbin),
+ "uri", parole_media_file_get_uri (file),
+ NULL);
+
+ parole_gst_change_state (gst, GST_STATE_PLAYING);
+
+ g_object_unref (file);
+}
+
+static void
+parole_gst_construct (GObject *object)
+{
+ ParoleGst *gst;
+ GstBus *bus;
+
+ gst = PAROLE_GST (object);
+
+ gst->priv->playbin = gst_element_factory_make ("playbin", "player");
+
+ if ( G_UNLIKELY (gst->priv->playbin == NULL) )
+ {
+ xfce_err (_("Unable to load playbin GStreamer plugin"
+ ", check your GStreamer installation"));
+
+ g_error ("playbin load failed");
+ }
+
+ gst->priv->video_sink = gst_element_factory_make ("xvimagesink", "video");
+
+ if ( G_UNLIKELY (gst->priv->video_sink == NULL) )
+ {
+ xfce_err (_("Unable to load xvimagesink GStreamer plugin"
+ ", check your GStreamer installation"));
+
+ g_error ("xvimagesink load failed");
+ }
+
+ gst->priv->vis_sink = gst_element_factory_make ("goom", "vis");
+
+ g_object_set (G_OBJECT (gst->priv->playbin),
+ "video-sink", gst->priv->video_sink,
+ "vis-plugin", gst->priv->vis_sink,
+ NULL);
+
+ /*
+ * Listen to the bus events.
+ */
+ bus = gst_pipeline_get_bus (GST_PIPELINE (gst->priv->playbin));
+ gst_bus_add_watch (bus, parole_gst_bus_event, gst);
+ g_object_unref (bus);
+
+ parole_gst_load_logo (gst);
+}
+
+static void
+parole_gst_class_init (ParoleGstClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ object_class->finalize = parole_gst_finalize;
+ object_class->constructed = parole_gst_construct;
+
+ widget_class->realize = parole_gst_realize;
+ widget_class->show = parole_gst_show;
+ widget_class->size_allocate = parole_gst_size_allocate;
+ widget_class->expose_event = parole_gst_expose_event;
+
+ signals[MEDIA_STATE] =
+ g_signal_new ("media-state",
+ PAROLE_TYPE_GST,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ParoleGstClass, media_state),
+ NULL, NULL,
+ _gmarshal_VOID__OBJECT_ENUM,
+ G_TYPE_NONE, 2,
+ G_TYPE_OBJECT, ENUM_GTYPE_MEDIA_STATE);
+
+ signals[MEDIA_PROGRESSED] =
+ g_signal_new ("media-progressed",
+ PAROLE_TYPE_GST,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ParoleGstClass, media_progressed),
+ NULL, NULL,
+ _gmarshal_VOID__OBJECT_DOUBLE,
+ G_TYPE_NONE, 2,
+ G_TYPE_OBJECT, G_TYPE_DOUBLE);
+
+ signals[BUFFERING] =
+ g_signal_new ("buffering",
+ PAROLE_TYPE_GST,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ParoleGstClass, buffering),
+ NULL, NULL,
+ _gmarshal_VOID__OBJECT_INT,
+ G_TYPE_NONE, 2,
+ G_TYPE_OBJECT, G_TYPE_INT);
+
+ signals[ERROR] =
+ g_signal_new ("error",
+ PAROLE_TYPE_GST,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ParoleGstClass, error),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1,
+ G_TYPE_STRING);
+
+ g_type_class_add_private (klass, sizeof (ParoleGstPrivate));
+}
+
+static void
+parole_gst_init (ParoleGst *gst)
+{
+ gst->priv = PAROLE_GST_GET_PRIVATE (gst);
+
+ gst->priv->state = GST_STATE_VOID_PENDING;
+ gst->priv->target = GST_STATE_VOID_PENDING;
+ gst->priv->lock = g_mutex_new ();
+ gst->priv->stream = parole_stream_new ();
+ gst->priv->tick_id = 0;
+ gst->priv->busy_cursor = gdk_cursor_new (GDK_WATCH);
+
+ GTK_WIDGET_SET_FLAGS (GTK_WIDGET (gst), GTK_CAN_FOCUS);
+
+ /*
+ * Disable double buffering on the video output to avoid
+ * flickering when resizing the window.
+ */
+ GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (gst), GTK_DOUBLE_BUFFERED);
+}
+
+GtkWidget *
+parole_gst_new (void)
+{
+ ParoleGst *gst;
+ gst = g_object_new (PAROLE_TYPE_GST, NULL);
+ return GTK_WIDGET (gst);
+}
+
+void parole_gst_play_file (ParoleGst *gst, ParoleMediaFile *file)
+{
+ g_mutex_lock (gst->priv->lock);
+
+ gst->priv->target = GST_STATE_PLAYING;
+
+ parole_stream_init_properties (gst->priv->stream);
+
+ g_object_set (G_OBJECT (gst->priv->stream),
+ "media-file", g_object_ref (file),
+ NULL);
+
+ g_mutex_unlock (gst->priv->lock);
+
+ parole_gst_set_window_cursor (GTK_WIDGET (gst)->window, gst->priv->busy_cursor);
+
+ if ( gst->priv->state < GST_STATE_PAUSED )
+ parole_gst_play_file_internal (gst);
+ else
+ parole_gst_change_state (gst, GST_STATE_READY);
+}
+
+void parole_gst_pause (ParoleGst *gst)
+{
+ g_mutex_lock (gst->priv->lock);
+
+ gst->priv->target = GST_STATE_PAUSED;
+
+ g_mutex_unlock (gst->priv->lock);
+
+ parole_gst_set_window_cursor (GTK_WIDGET (gst)->window, gst->priv->busy_cursor);
+ parole_gst_change_state (gst, GST_STATE_PAUSED);
+}
+
+void parole_gst_resume (ParoleGst *gst)
+{
+ g_mutex_lock (gst->priv->lock);
+
+ gst->priv->target = GST_STATE_PLAYING;
+
+ g_mutex_unlock (gst->priv->lock);
+
+ parole_gst_set_window_cursor (GTK_WIDGET (gst)->window, gst->priv->busy_cursor);
+ parole_gst_change_state (gst, GST_STATE_PLAYING);
+}
+
+void parole_gst_stop (ParoleGst *gst)
+{
+ g_mutex_lock (gst->priv->lock);
+
+ parole_stream_init_properties (gst->priv->stream);
+ gst->priv->target = GST_STATE_READY;
+
+ g_mutex_unlock (gst->priv->lock);
+
+ parole_gst_set_window_cursor (GTK_WIDGET (gst)->window, gst->priv->busy_cursor);
+
+ parole_gst_change_state (gst, GST_STATE_READY);
+}
+
+void parole_gst_null_state (ParoleGst *gst)
+{
+ g_mutex_lock (gst->priv->lock);
+
+ parole_stream_init_properties (gst->priv->stream);
+ gst->priv->target = GST_STATE_NULL;
+
+ g_mutex_unlock (gst->priv->lock);
+
+ parole_gst_set_window_cursor (GTK_WIDGET (gst)->window, gst->priv->busy_cursor);
+
+ parole_gst_change_state (gst, GST_STATE_NULL);
+}
+
+void parole_gst_seek (ParoleGst *gst, gdouble pos)
+{
+ gint64 seek;
+ gint64 absolute_duration;
+ gdouble duration;
+ gboolean seekable;
+ gboolean ret;
+
+ g_object_get (G_OBJECT (gst->priv->stream),
+ "absolute-duration", &absolute_duration,
+ "duration", &duration,
+ "seekable", &seekable,
+ NULL);
+
+#ifdef DEBUG
+ g_return_if_fail (duration != 0);
+ g_return_if_fail (absolute_duration != 0);
+ g_return_if_fail (seekable == TRUE);
+#endif
+
+ seek = (gint64) (pos * absolute_duration) / duration;
+
+ ret = gst_element_seek (gst->priv->playbin,
+ 1.0,
+ GST_FORMAT_TIME,
+ GST_SEEK_FLAG_KEY_UNIT | GST_SEEK_FLAG_FLUSH,
+ GST_SEEK_TYPE_SET, seek,
+ GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
+
+ if ( !ret )
+ {
+ g_warning ("Failed to seek element");
+ }
+}
Added: parole/trunk/src/gst.h
===================================================================
--- parole/trunk/src/gst.h (rev 0)
+++ parole/trunk/src/gst.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,86 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAROLE_GST_H
+#define __PAROLE_GST_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+#include "enum-glib.h"
+#include "stream.h"
+#include "mediafile.h"
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_GST (parole_gst_get_type () )
+#define PAROLE_GST(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_GST, ParoleGst))
+#define PAROLE_IS_GST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_GST))
+
+typedef struct ParoleGstPrivate ParoleGstPrivate;
+
+typedef struct
+{
+ GtkWidget parent;
+ ParoleGstPrivate *priv;
+
+} ParoleGst;
+
+typedef struct
+{
+ GtkWidgetClass parent_class;
+
+ void (*media_state) (ParoleGst *gst,
+ const ParoleStream *stream,
+ ParoleMediaState state);
+
+ void (*media_progressed) (ParoleGst *gst,
+ const ParoleStream *stream,
+ gdouble value);
+
+ void (*buffering) (ParoleGst *gst,
+ const ParoleStream *stream,
+ gint percentage);
+
+ void (*error) (ParoleGst *gst,
+ const gchar *error);
+
+} ParoleGstClass;
+
+GType parole_gst_get_type (void) G_GNUC_CONST;
+GtkWidget *parole_gst_new (void);
+
+void parole_gst_play_file (ParoleGst *gst,
+ ParoleMediaFile *file);
+
+void parole_gst_pause (ParoleGst *gst);
+
+void parole_gst_resume (ParoleGst *gst);
+
+void parole_gst_stop (ParoleGst *gst);
+
+void parole_gst_null_state (ParoleGst *gst);
+
+void parole_gst_seek (ParoleGst *gst,
+ gdouble pos);
+
+G_END_DECLS
+
+#endif /* __PAROLE_GST_H */
Added: parole/trunk/src/main.c
===================================================================
--- parole/trunk/src/main.c (rev 0)
+++ parole/trunk/src/main.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,64 @@
+/*
+ * * Copyright (C) 2008-2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <unistd.h>
+#include <signal.h>
+
+#include <gtk/gtk.h>
+#include <glib.h>
+
+#include <gst/gst.h>
+
+#include <libxfce4util/libxfce4util.h>
+
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include "manager.h"
+
+int main (int argc, char **argv)
+{
+ ParoleManager *manager;
+
+ if ( !g_thread_supported () )
+ g_thread_init (NULL);
+
+ gtk_init (&argc, &argv);
+ gst_init (&argc, &argv);
+
+ manager = parole_manager_new ();
+
+ gdk_notify_startup_complete ();
+
+ gtk_main ();
+
+ g_object_unref (manager);
+ gst_deinit ();
+
+ return 0;
+}
Added: parole/trunk/src/manager.c
===================================================================
--- parole/trunk/src/manager.c (rev 0)
+++ parole/trunk/src/manager.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,83 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "manager.h"
+#include "player.h"
+#include "builder.h"
+
+#define PAROLE_MANAGER_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), PAROLE_TYPE_MANAGER, ParoleManagerPrivate))
+
+struct ParoleManagerPrivate
+{
+ ParolePlayer *player;
+};
+
+G_DEFINE_TYPE (ParoleManager, parole_manager, G_TYPE_OBJECT)
+
+static void
+parole_manager_finalize (GObject *object)
+{
+ ParoleManager *manager;
+
+ manager = PAROLE_MANAGER (object);
+
+ G_OBJECT_CLASS (parole_manager_parent_class)->finalize (object);
+}
+
+static void
+parole_manager_class_init (ParoleManagerClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = parole_manager_finalize;
+
+ g_type_class_add_private (klass, sizeof (ParoleManagerPrivate));
+}
+
+static void
+parole_manager_init (ParoleManager *manager)
+{
+ GtkBuilder *builder;
+
+ manager->priv = PAROLE_MANAGER_GET_PRIVATE (manager);
+
+ builder = parole_builder_new ();
+
+ manager->priv->player = parole_player_new ();
+
+ g_object_unref (builder);
+}
+
+ParoleManager *
+parole_manager_new (void)
+{
+ ParoleManager *manager = NULL;
+ manager = g_object_new (PAROLE_TYPE_MANAGER, NULL);
+ return manager;
+}
Added: parole/trunk/src/manager.h
===================================================================
--- parole/trunk/src/manager.h (rev 0)
+++ parole/trunk/src/manager.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,52 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAROLE_MANAGER_H
+#define __PAROLE_MANAGER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_MANAGER (parole_manager_get_type () )
+#define PAROLE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_MANAGER, ParoleManager))
+#define PAROLE_IS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_MANAGER))
+
+typedef struct ParoleManagerPrivate ParoleManagerPrivate;
+
+typedef struct
+{
+ GObject parent;
+ ParoleManagerPrivate *priv;
+
+} ParoleManager;
+
+typedef struct
+{
+ GObjectClass parent_class;
+
+} ParoleManagerClass;
+
+GType parole_manager_get_type (void) G_GNUC_CONST;
+ParoleManager *parole_manager_new (void);
+
+G_END_DECLS
+
+#endif /* __PAROLE_MANAGER_H */
Added: parole/trunk/src/mediachooser.c
===================================================================
--- parole/trunk/src/mediachooser.c (rev 0)
+++ parole/trunk/src/mediachooser.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,657 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <gtk/gtk.h>
+#include <glib.h>
+
+#include <libxfce4util/libxfce4util.h>
+#include <libxfcegui4/libxfcegui4.h>
+
+#include "mediachooser.h"
+#include "builder.h"
+#include "mediafile.h"
+#include "rc-utils.h"
+
+#define PAROLE_MEDIA_CHOOSER_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), PAROLE_TYPE_MEDIA_CHOOSER, ParoleMediaChooserPrivate))
+
+struct ParoleMediaChooserPrivate
+{
+ GtkWidget *parent;
+ GtkWidget *window;
+ GtkWidget *file_chooser;
+
+ GtkWidget *entry;
+
+ GtkFileFilter *filter;
+ gboolean open;
+};
+
+enum
+{
+ MEDIA_FILES_OPENED,
+ MEDIA_FILE_OPENED,
+ LOCATION_OPENED,
+ LAST_SIGNAL
+};
+
+static gpointer parole_media_chooser_object = NULL;
+
+static guint signals [LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE (ParoleMediaChooser, parole_media_chooser, G_TYPE_OBJECT)
+
+static void
+parole_media_chooser_close (ParoleMediaChooser *chooser)
+{
+ gtk_widget_destroy (chooser->priv->window);
+ chooser->priv->open = FALSE;
+ chooser->priv->window = NULL;
+ chooser->priv->file_chooser = NULL;
+ chooser->priv->entry = NULL;
+}
+
+/*
+ * compare_by_name_using_number
+ *
+ * * Copyright (c) 2005-2007 Benedikt Meurer <benny at xfce.org>
+ *
+ */
+static gint
+compare_by_name_using_number (const gchar *ap,
+ const gchar *bp)
+{
+ guint anum;
+ guint bnum;
+
+ /* determine the numbers in ap and bp */
+ anum = strtoul (ap, NULL, 10);
+ bnum = strtoul (bp, NULL, 10);
+
+ /* compare the numbers */
+ if (anum < bnum)
+ return -1;
+ else if (anum > bnum)
+ return 1;
+
+ /* the numbers are equal, and so the higher first digit should
+ * be sorted first, i.e. 'file10' before 'file010', since we
+ * also sort 'file10' before 'file011'.
+ */
+ return (*bp - *ap);
+}
+
+/*
+ * thunar_file_compare_by_name
+ *
+ * * Copyright (c) 2005-2007 Benedikt Meurer <benny at xfce.org>
+ *
+ */
+static gint
+thunar_file_compare_by_name (ParoleMediaFile *file_a,
+ ParoleMediaFile *file_b,
+ gboolean case_sensitive)
+{
+ const gchar *ap;
+ const gchar *bp;
+ guint ac;
+ guint bc;
+
+
+ /* we compare only the display names (UTF-8!) */
+ ap = parole_media_file_get_display_name (file_a);
+ bp = parole_media_file_get_display_name (file_b);
+
+ /* check if we should ignore case */
+ if (G_LIKELY (case_sensitive))
+ {
+ /* try simple (fast) ASCII comparison first */
+ for (;; ++ap, ++bp)
+ {
+ /* check if the characters differ or we have a non-ASCII char */
+ ac = *((const guchar *) ap);
+ bc = *((const guchar *) bp);
+ if (ac != bc || ac == 0 || ac > 127)
+ break;
+ }
+
+ /* fallback to Unicode comparison */
+ if (G_UNLIKELY (ac > 127 || bc > 127))
+ {
+ for (;; ap = g_utf8_next_char (ap), bp = g_utf8_next_char (bp))
+ {
+ /* check if characters differ or end of string */
+ ac = g_utf8_get_char (ap);
+ bc = g_utf8_get_char (bp);
+ if (ac != bc || ac == 0)
+ break;
+ }
+ }
+ }
+ else
+ {
+ /* try simple (fast) ASCII comparison first (case-insensitive!) */
+ for (;; ++ap, ++bp)
+ {
+ /* check if the characters differ or we have a non-ASCII char */
+ ac = *((const guchar *) ap);
+ bc = *((const guchar *) bp);
+ if (g_ascii_tolower (ac) != g_ascii_tolower (bc) || ac == 0 || ac > 127)
+ break;
+ }
+
+ /* fallback to Unicode comparison (case-insensitive!) */
+ if (G_UNLIKELY (ac > 127 || bc > 127))
+ {
+ for (;; ap = g_utf8_next_char (ap), bp = g_utf8_next_char (bp))
+ {
+ /* check if characters differ or end of string */
+ ac = g_utf8_get_char (ap);
+ bc = g_utf8_get_char (bp);
+ if (g_unichar_tolower (ac) != g_unichar_tolower (bc) || ac == 0)
+ break;
+ }
+ }
+ }
+
+ /* if both strings are equal, we're done */
+ if (G_UNLIKELY (ac == bc || (!case_sensitive && g_unichar_tolower (ac) == g_unichar_tolower (bc))))
+ return 0;
+
+ /* check if one of the characters that differ is a digit */
+ if (G_UNLIKELY (g_ascii_isdigit (ac) || g_ascii_isdigit (bc)))
+ {
+ /* if both strings differ in a digit, we use a smarter comparison
+ * to get sorting 'file1', 'file5', 'file10' done the right way.
+ */
+ if (g_ascii_isdigit (ac) && g_ascii_isdigit (bc))
+ return compare_by_name_using_number (ap, bp);
+
+ /* a second case is '20 file' and '2file', where comparison by number
+ * makes sense, if the previous char for both strings is a digit.
+ */
+ if (ap > parole_media_file_get_display_name (file_a) && bp > parole_media_file_get_display_name (file_b)
+ && g_ascii_isdigit (*(ap - 1)) && g_ascii_isdigit (*(bp - 1)))
+ {
+ return compare_by_name_using_number (ap - 1, bp - 1);
+ }
+ }
+
+ /* otherwise, if they differ in a unicode char, use the
+ * appropriate collate function for the current locale (only
+ * if charset is UTF-8, else the required transformations
+ * would be too expensive)
+ */
+#ifdef HAVE_STRCOLL
+ if ((ac > 127 || bc > 127) && g_get_charset (NULL))
+ {
+ /* case-sensitive is easy, case-insensitive is expensive,
+ * but we use a simple optimization to make it fast.
+ */
+ if (G_LIKELY (case_sensitive))
+ {
+ return strcoll (ap, bp);
+ }
+ else
+ {
+ /* we use a trick here, so we don't need to allocate
+ * and transform the two strings completely first (8
+ * byte for each buffer, so all compilers should align
+ * them properly)
+ */
+ gchar abuf[8];
+ gchar bbuf[8];
+
+ /* transform the unicode chars to strings and
+ * make sure the strings are nul-terminated.
+ */
+ abuf[g_unichar_to_utf8 (ac, abuf)] = '\0';
+ bbuf[g_unichar_to_utf8 (bc, bbuf)] = '\0';
+
+ /* compare the unicode chars (as strings) */
+ return strcoll (abuf, bbuf);
+ }
+ }
+#endif
+
+ /* else, they differ in an ASCII character */
+ if (G_UNLIKELY (!case_sensitive))
+ return (g_unichar_tolower (ac) > g_unichar_tolower (bc)) ? 1 : -1;
+ else
+ return (ac > bc) ? 1 : -1;
+}
+
+static void
+parole_media_chooser_sort_and_emit (ParoleMediaChooser *chooser, GSList **list)
+{
+ *list = g_slist_sort (*list, (GCompareFunc) thunar_file_compare_by_name);
+
+ g_signal_emit (G_OBJECT (chooser), signals [MEDIA_FILES_OPENED], 0, *list);
+}
+
+static gboolean
+parole_media_chooser_filter_media (GtkFileFilter *filter, ParoleMediaFile *file)
+{
+ GtkFileFilterInfo filter_info;
+
+ gboolean ret;
+
+ filter_info.display_name = parole_media_file_get_display_name (file);
+ filter_info.mime_type = parole_media_file_get_content_type (file);
+
+ filter_info.contains = GTK_FILE_FILTER_DISPLAY_NAME | GTK_FILE_FILTER_MIME_TYPE;
+
+ ret = gtk_file_filter_filter (filter, &filter_info);
+
+ return ret;
+}
+
+static void
+parole_media_chooser_get_media_files (ParoleMediaChooser *chooser, const gchar *filename)
+{
+ GDir *dir;
+ GSList *list = NULL;
+ const gchar *name;
+ ParoleMediaFile *file;
+
+ if ( g_file_test (filename, G_FILE_TEST_IS_REGULAR ) )
+ {
+ file = parole_media_file_new (filename);
+ if ( parole_media_chooser_filter_media (chooser->priv->filter, file) )
+ list = g_slist_append (list, file);
+ else
+ g_object_unref (file);
+ }
+ else if ( g_file_test (filename, G_FILE_TEST_IS_DIR ) )
+ {
+ dir = g_dir_open (filename, 0, NULL);
+
+ if ( G_UNLIKELY (dir == NULL) )
+ return;
+
+ while ( (name = g_dir_read_name (dir)) )
+ {
+ gchar *path = g_strdup_printf ("%s/%s", filename, name);
+ if ( g_file_test (path, G_FILE_TEST_IS_DIR) )
+ {
+ parole_media_chooser_get_media_files (chooser, path);
+ }
+ else if ( g_file_test (path, G_FILE_TEST_IS_REGULAR) )
+ {
+ file = parole_media_file_new (path);
+ if ( parole_media_chooser_filter_media (chooser->priv->filter, file) )
+ list = g_slist_append (list, file);
+ else
+ g_object_unref (file);
+ }
+ g_free (path);
+ }
+ g_dir_close (dir);
+ }
+
+ parole_media_chooser_sort_and_emit (chooser, &list);
+
+ g_slist_free (list);
+}
+
+static void
+parole_media_chooser_add_many (ParoleMediaChooser *chooser)
+{
+ GSList *files;
+ gchar *file;
+ guint i;
+ guint len;
+
+ files = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (chooser->priv->file_chooser));
+
+ if ( G_UNLIKELY (files == NULL) )
+ return;
+
+ len = g_slist_length (files);
+ for ( i = 0; i < len; i++)
+ {
+ file = g_slist_nth_data (files, i);
+ parole_media_chooser_get_media_files (chooser, file);
+ }
+
+ g_slist_foreach (files, (GFunc) g_free, NULL);
+ g_slist_free (files);
+}
+
+static void
+parole_media_chooser_open_cb (ParoleMediaChooser *chooser)
+{
+ ParoleMediaFile *file;
+ gboolean multiple;
+ gchar *filename;
+
+ multiple = gtk_file_chooser_get_select_multiple (GTK_FILE_CHOOSER (chooser->priv->file_chooser));
+
+ /*
+ * Emit one file opened
+ */
+ if ( multiple == FALSE )
+ {
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser->priv->file_chooser ));
+ parole_media_chooser_close (chooser);
+ if ( G_LIKELY (filename != NULL ) )
+ {
+ file = parole_media_file_new (filename);
+ g_signal_emit (G_OBJECT (chooser), signals [MEDIA_FILE_OPENED], 0, file);
+ g_free (filename);
+ }
+ }
+ else
+ {
+ parole_media_chooser_add_many (chooser);
+ parole_media_chooser_close (chooser);
+ }
+}
+
+static void
+parole_media_chooser_open_location_cb (ParoleMediaChooser *chooser)
+{
+ ParoleMediaFile *file;
+ const gchar *location;
+
+ location = gtk_entry_get_text (GTK_ENTRY (chooser->priv->entry));
+
+ if ( !location )
+ return;
+
+ TRACE ("Location %s", location);
+
+ file = parole_media_file_new (location);
+ parole_media_chooser_close (chooser);
+ g_signal_emit (G_OBJECT (chooser), signals [MEDIA_FILE_OPENED], 0, file);
+}
+
+static void
+parole_media_chooser_current_folder_changed_cb (GtkWidget *widget, gpointer data)
+{
+ gchar *folder;
+ folder = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (widget));
+
+ if ( folder )
+ {
+ write_string_entry ("media-chooser-folder", folder);
+ g_free (folder);
+ }
+}
+
+static GtkWidget *
+parole_media_chooser_create_chooser (gboolean multiple)
+{
+ GtkWidget *chooser;
+ GtkFileFilter *filter;
+ const gchar *folder;
+
+ chooser = gtk_file_chooser_widget_new (GTK_FILE_CHOOSER_ACTION_OPEN);
+
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (chooser), TRUE);
+
+ filter = gtk_file_filter_new ();
+
+ gtk_file_filter_set_name (filter, _("Audio and video"));
+
+ gtk_file_filter_add_mime_type (filter, "video/*");
+ gtk_file_filter_add_mime_type (filter, "audio/*");
+
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+ folder = read_string_entry ("media-chooser-folder");
+
+ if ( folder )
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (chooser), folder);
+
+ gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), multiple);
+
+ g_signal_connect (chooser, "current-folder-changed",
+ G_CALLBACK (parole_media_chooser_current_folder_changed_cb), NULL);
+ return chooser;
+}
+
+static GtkWidget *
+parole_media_chooser_create_chooser_window (GtkWidget *parent, gboolean multiple, gboolean local)
+{
+ GtkWidget *window;
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ if ( local )
+ {
+ gtk_window_set_title (GTK_WINDOW (window), multiple == TRUE ? _("Add media files") : _("Open media file"));
+ gtk_window_set_default_size (GTK_WINDOW (window), 680, 480);
+ }
+ else
+ {
+ gtk_window_set_title (GTK_WINDOW (window), _("Open location"));
+ }
+
+ gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (parent));
+ gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER_ON_PARENT);
+
+ return window;
+}
+
+static void
+parole_media_chooser_open_internal (ParoleMediaChooser *chooser, gboolean multiple)
+{
+ GtkWidget *window;
+ GtkWidget *file_chooser;
+ GtkWidget *frame;
+ GtkWidget *vbox;
+ GtkWidget *bbox;
+ GtkWidget *open_w;
+ GtkWidget *close_w;
+
+ file_chooser = parole_media_chooser_create_chooser (multiple);
+ window = parole_media_chooser_create_chooser_window (chooser->priv->parent, multiple, TRUE);
+
+ frame = gtk_frame_new (NULL);
+
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (window), frame);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+
+ gtk_box_pack_start (GTK_BOX (vbox), file_chooser, TRUE, TRUE, 4);
+
+ bbox = gtk_hbutton_box_new ();
+ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
+ gtk_box_set_spacing (GTK_BOX (bbox), 6);
+
+ gtk_box_pack_end (GTK_BOX (vbox), bbox, FALSE, FALSE, 4);
+
+ open_w = gtk_button_new_from_stock (multiple ? GTK_STOCK_ADD : GTK_STOCK_OPEN);
+ close_w = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+
+ gtk_container_add (GTK_CONTAINER (bbox), close_w);
+ gtk_container_add (GTK_CONTAINER (bbox), open_w);
+
+
+ g_signal_connect_swapped (file_chooser, "file-activated",
+ G_CALLBACK (gtk_widget_activate), open_w);
+
+ g_signal_connect_swapped (open_w, "clicked",
+ G_CALLBACK (parole_media_chooser_open_cb), chooser);
+
+ g_signal_connect_swapped (close_w, "clicked",
+ G_CALLBACK (parole_media_chooser_close), chooser);
+
+ g_signal_connect_swapped (window, "destroy",
+ G_CALLBACK (parole_media_chooser_close), chooser);
+
+ chooser->priv->window = window;
+ chooser->priv->file_chooser = file_chooser;
+ chooser->priv->open = TRUE;
+
+ gtk_widget_show_all (window);
+}
+
+static void
+parole_media_chooser_open_location_internal (ParoleMediaChooser *chooser)
+{
+ GtkWidget *window;
+ GtkWidget *box;
+ GtkWidget *label;
+ GtkWidget *entry;
+ GtkWidget *bbox;
+ GtkWidget *open_w;
+ GtkWidget *close_w;
+
+ window = parole_media_chooser_create_chooser_window (chooser->priv->parent, FALSE, FALSE);
+
+ box = gtk_vbox_new (FALSE, 8);
+
+ gtk_container_add (GTK_CONTAINER (window), box);
+
+ label = gtk_label_new (_("Open location of media file or live stream"));
+
+ gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
+
+ entry = gtk_entry_new ();
+
+ gtk_box_pack_start (GTK_BOX (box), entry, FALSE, FALSE, 0);
+
+ bbox = gtk_hbutton_box_new ();
+ gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
+ gtk_box_set_spacing (GTK_BOX (bbox), 6);
+
+ gtk_box_pack_end (GTK_BOX (box), bbox, FALSE, FALSE, 4);
+
+ open_w = gtk_button_new_from_stock (GTK_STOCK_OK);
+ close_w = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+
+ gtk_container_add (GTK_CONTAINER (bbox), close_w);
+ gtk_container_add (GTK_CONTAINER (bbox), open_w);
+
+
+ g_signal_connect_swapped (open_w, "clicked",
+ G_CALLBACK (parole_media_chooser_open_location_cb), chooser);
+
+ g_signal_connect_swapped (close_w, "clicked",
+ G_CALLBACK (parole_media_chooser_close), chooser);
+
+ g_signal_connect_swapped (window, "destroy",
+ G_CALLBACK (parole_media_chooser_close), chooser);
+
+ chooser->priv->window = window;
+ chooser->priv->open = TRUE;
+ chooser->priv->entry = entry;
+
+ gtk_widget_show_all (window);
+}
+
+static void
+parole_media_chooser_finalize (GObject *object)
+{
+ ParoleMediaChooser *parole_media_chooser;
+
+ parole_media_chooser = PAROLE_MEDIA_CHOOSER (object);
+
+ G_OBJECT_CLASS (parole_media_chooser_parent_class)->finalize (object);
+}
+
+static void
+parole_media_chooser_class_init (ParoleMediaChooserClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ signals[MEDIA_FILES_OPENED] =
+ g_signal_new("media-files-opened",
+ PAROLE_TYPE_MEDIA_CHOOSER,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ParoleMediaChooserClass, media_files_opened),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
+
+ signals[MEDIA_FILE_OPENED] =
+ g_signal_new("media-file-opened",
+ PAROLE_TYPE_MEDIA_CHOOSER,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ParoleMediaChooserClass, media_file_opened),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, G_TYPE_OBJECT);
+
+ object_class->finalize = parole_media_chooser_finalize;
+
+ g_type_class_add_private (klass, sizeof (ParoleMediaChooserPrivate));
+}
+
+static void
+parole_media_chooser_init (ParoleMediaChooser *chooser)
+{
+ GtkBuilder *builder;
+
+ chooser->priv = PAROLE_MEDIA_CHOOSER_GET_PRIVATE (chooser);
+
+ builder = parole_builder_new ();
+
+ chooser->priv->parent = GTK_WIDGET (gtk_builder_get_object (builder, "main-window"));
+
+ chooser->priv->filter = gtk_file_filter_new ();
+ gtk_file_filter_add_mime_type (chooser->priv->filter, "video/*");
+ gtk_file_filter_add_mime_type (chooser->priv->filter, "audio/*");
+}
+
+ParoleMediaChooser *
+parole_media_chooser_new (void)
+{
+ if ( parole_media_chooser_object )
+ {
+ g_object_ref (parole_media_chooser_object);
+ }
+ else
+ {
+ parole_media_chooser_object = g_object_new (PAROLE_TYPE_MEDIA_CHOOSER, NULL);
+ g_object_add_weak_pointer (parole_media_chooser_object, &parole_media_chooser_object);
+ }
+
+ return PAROLE_MEDIA_CHOOSER (parole_media_chooser_object);
+}
+
+void parole_media_chooser_open (ParoleMediaChooser *chooser, gboolean multiple)
+{
+ g_return_if_fail (PAROLE_IS_MEDIA_CHOOSER (chooser));
+
+ if ( chooser->priv->open )
+ return;
+
+ parole_media_chooser_open_internal (chooser, multiple);
+}
+
+void parole_media_chooser_open_location (ParoleMediaChooser *chooser)
+{
+ g_return_if_fail (PAROLE_IS_MEDIA_CHOOSER (chooser));
+
+ if ( chooser->priv->open )
+ return;
+
+ parole_media_chooser_open_location_internal (chooser);
+}
Added: parole/trunk/src/mediachooser.h
===================================================================
--- parole/trunk/src/mediachooser.h (rev 0)
+++ parole/trunk/src/mediachooser.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,64 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAROLE_MEDIA_CHOOSER_H
+#define __PAROLE_MEDIA_CHOOSER_H
+
+#include <glib-object.h>
+#include "mediafile.h"
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_MEDIA_CHOOSER (parole_media_chooser_get_type () )
+#define PAROLE_MEDIA_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_MEDIA_CHOOSER, ParoleMediaChooser))
+#define PAROLE_IS_MEDIA_CHOOSER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_MEDIA_CHOOSER))
+
+typedef struct ParoleMediaChooserPrivate ParoleMediaChooserPrivate;
+
+typedef struct
+{
+ GObject parent;
+ ParoleMediaChooserPrivate *priv;
+
+} ParoleMediaChooser;
+
+typedef struct
+{
+ GObjectClass parent_class;
+
+ void (*media_files_opened) (ParoleMediaChooser *chooser,
+ GPtrArray *array);
+
+ void (*media_file_opened) (ParoleMediaChooser *chooser,
+ ParoleMediaFile *file);
+
+} ParoleMediaChooserClass;
+
+GType parole_media_chooser_get_type (void) G_GNUC_CONST;
+ParoleMediaChooser *parole_media_chooser_new (void);
+
+void parole_media_chooser_open (ParoleMediaChooser *chooser,
+ gboolean multiple);
+
+void parole_media_chooser_open_location (ParoleMediaChooser *chooser);
+
+G_END_DECLS
+
+#endif /* __PAROLE_MEDIA_CHOOSER_H */
Added: parole/trunk/src/mediafile.c
===================================================================
--- parole/trunk/src/mediafile.c (rev 0)
+++ parole/trunk/src/mediafile.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,220 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <libxfce4util/libxfce4util.h>
+
+#include "mediafile.h"
+
+#define PAROLE_MEDIA_FILE_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), PAROLE_TYPE_MEDIA_FILE, ParoleMediaFilePrivate))
+
+struct ParoleMediaFilePrivate
+{
+ gchar *path;
+ gchar *display_name;
+ gchar *uri;
+ gchar *mime_type;
+
+};
+
+enum
+{
+ PROP_0,
+ PROP_PATH
+};
+
+G_DEFINE_TYPE (ParoleMediaFile, parole_media_file, G_TYPE_OBJECT)
+
+static void
+parole_media_file_finalize (GObject *object)
+{
+ ParoleMediaFile *file;
+
+ file = PAROLE_MEDIA_FILE (object);
+
+ TRACE ("Media file finalized %s", file->priv->display_name);
+
+ if ( file->priv->path )
+ g_free (file->priv->path);
+
+ if ( file->priv->uri )
+ g_free (file->priv->uri);
+
+ if ( file->priv->display_name )
+ g_free (file->priv->display_name);
+
+ if ( file->priv->mime_type )
+ g_free (file->priv->mime_type);
+
+ G_OBJECT_CLASS (parole_media_file_parent_class)->finalize (object);
+}
+
+static void
+parole_media_file_set_property (GObject *object, guint prop_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ ParoleMediaFile *file;
+ file = PAROLE_MEDIA_FILE (object);
+
+ switch (prop_id)
+ {
+ case PROP_PATH:
+ file->priv->path = g_strdup (g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+parole_media_file_get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
+{
+ ParoleMediaFile *file;
+
+ file = PAROLE_MEDIA_FILE (object);
+
+ switch (prop_id)
+ {
+ case PROP_PATH:
+ g_value_set_string (value, file->priv->path);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+parole_media_file_constructed (GObject *object)
+{
+ GFile *gfile;
+ GFileInfo *info;
+ ParoleMediaFile *file;
+ GError *error = NULL;
+
+ file = PAROLE_MEDIA_FILE (object);
+
+ gfile = g_file_new_for_commandline_arg (file->priv->path);
+
+ info = g_file_query_info (gfile,
+ "standard::*,",
+ 0,
+ NULL,
+ &error);
+
+ if ( error )
+ {
+#ifdef DEBUG
+ g_warning ("Unable to read file info %s :", error->message);
+#endif
+ g_error_free (error);
+ file->priv->display_name = g_file_get_basename (gfile);
+ goto out;
+ }
+
+ file->priv->display_name = g_strdup (g_file_info_get_display_name (info));
+ file->priv->mime_type = g_strdup (g_file_info_get_content_type (info));
+
+ g_object_unref (info);
+out:
+ file->priv->uri = g_file_get_uri (gfile);
+ g_object_unref (gfile);
+}
+
+static void
+parole_media_file_class_init (ParoleMediaFileClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = parole_media_file_finalize;
+
+ object_class->constructed = parole_media_file_constructed;
+ object_class->set_property = parole_media_file_set_property;
+ object_class->get_property = parole_media_file_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_PATH,
+ g_param_spec_string ("path",
+ NULL, NULL,
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY|
+ G_PARAM_READWRITE));
+
+ g_type_class_add_private (klass, sizeof (ParoleMediaFilePrivate));
+}
+
+static void
+parole_media_file_init (ParoleMediaFile *file)
+{
+ file->priv = PAROLE_MEDIA_FILE_GET_PRIVATE (file);
+}
+
+ParoleMediaFile *
+parole_media_file_new (const gchar *path)
+{
+ ParoleMediaFile *file = NULL;
+ file = g_object_new (PAROLE_TYPE_MEDIA_FILE, "path", path, NULL);
+ return file;
+}
+
+const gchar *
+parole_media_file_get_file_name (const ParoleMediaFile *file)
+{
+ g_return_val_if_fail (PAROLE_IS_MEDIA_FILE (file), NULL);
+
+ return file->priv->path;
+}
+
+const gchar *
+parole_media_file_get_display_name (const ParoleMediaFile *file)
+{
+ g_return_val_if_fail (PAROLE_IS_MEDIA_FILE (file), NULL);
+
+ return file->priv->display_name;
+}
+
+const gchar *
+parole_media_file_get_uri (const ParoleMediaFile *file)
+{
+ g_return_val_if_fail (PAROLE_IS_MEDIA_FILE (file), NULL);
+
+ return file->priv->uri;
+}
+
+const gchar *
+parole_media_file_get_content_type (const ParoleMediaFile *file)
+{
+ g_return_val_if_fail (PAROLE_IS_MEDIA_FILE (file), NULL);
+
+ return file->priv->mime_type;
+}
Added: parole/trunk/src/mediafile.h
===================================================================
--- parole/trunk/src/mediafile.h (rev 0)
+++ parole/trunk/src/mediafile.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,60 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAROLE_MEDIA_FILE_H
+#define __PAROLE_MEDIA_FILE_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_MEDIA_FILE (parole_media_file_get_type () )
+#define PAROLE_MEDIA_FILE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_MEDIA_FILE, ParoleMediaFile))
+#define PAROLE_IS_MEDIA_FILE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_MEDIA_FILE))
+
+typedef struct ParoleMediaFilePrivate ParoleMediaFilePrivate;
+
+typedef struct
+{
+ GObject parent;
+ ParoleMediaFilePrivate *priv;
+
+} ParoleMediaFile;
+
+typedef struct
+{
+ GObjectClass parent_class;
+
+} ParoleMediaFileClass;
+
+GType parole_media_file_get_type (void) G_GNUC_CONST;
+ParoleMediaFile *parole_media_file_new (const gchar *path);
+
+const gchar *parole_media_file_get_file_name (const ParoleMediaFile *file) G_GNUC_PURE;
+
+const gchar *parole_media_file_get_display_name (const ParoleMediaFile *file) G_GNUC_PURE;
+
+const gchar *parole_media_file_get_uri (const ParoleMediaFile *file) G_GNUC_PURE;
+
+const gchar *parole_media_file_get_content_type (const ParoleMediaFile *file) G_GNUC_PURE;
+
+G_END_DECLS
+
+#endif /* __PAROLE_MEDIA_FILE_H */
Added: parole/trunk/src/medialist.c
===================================================================
--- parole/trunk/src/medialist.c (rev 0)
+++ parole/trunk/src/medialist.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,398 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <gtk/gtk.h>
+#include <glib.h>
+
+#include <libxfce4util/libxfce4util.h>
+#include <libxfcegui4/libxfcegui4.h>
+
+#include "medialist.h"
+#include "mediafile.h"
+#include "mediachooser.h"
+#include "builder.h"
+
+#define PAROLE_MEDIA_LIST_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), PAROLE_TYPE_MEDIA_LIST, ParoleMediaListPrivate))
+
+struct ParoleMediaListPrivate
+{
+ GtkWidget *view;
+ GtkWidget *box;
+
+ GtkListStore *store;
+ ParoleMediaChooser *chooser;
+};
+
+enum
+{
+ MEDIA_ACTIVATED,
+ LAST_SIGNAL
+};
+
+static guint signals [LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE (ParoleMediaList, parole_media_list, G_TYPE_OBJECT)
+
+static void
+parole_media_list_add (ParoleMediaList *list, ParoleMediaFile *file, gboolean emit)
+{
+ GtkListStore *list_store;
+ GtkTreePath *path;
+ GtkTreeRowReference *row;
+ GtkTreeIter iter;
+
+ list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (list->priv->view)));
+
+ gtk_list_store_append (list_store, &iter);
+
+ gtk_list_store_set (list_store,
+ &iter,
+ NAME_COL, parole_media_file_get_display_name (file),
+ DATA_COL, file,
+ -1);
+ if ( emit )
+ {
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (list_store), &iter);
+ row = gtk_tree_row_reference_new (GTK_TREE_MODEL (list_store), path);
+ gtk_tree_path_free (path);
+ g_signal_emit (G_OBJECT (list), signals [MEDIA_ACTIVATED], 0, row);
+ }
+ /*
+ * Unref it as the list store will have
+ * a reference anyway.
+ */
+ g_object_unref (file);
+}
+
+static void
+parole_media_list_file_opened_cb (ParoleMediaChooser *chooser, ParoleMediaFile *file, ParoleMediaList *list)
+{
+ parole_media_list_add (list, file, TRUE);
+}
+
+static void
+parole_media_list_files_opened_cb (ParoleMediaChooser *chooser, GSList *files, ParoleMediaList *list)
+{
+ ParoleMediaFile *file;
+ guint len;
+ guint i;
+
+ len = g_slist_length (files);
+
+ for ( i = 0; i < len; i++)
+ {
+ file = g_slist_nth_data (files, i);
+ parole_media_list_add (list, file, FALSE);
+ }
+}
+
+static void
+parole_media_list_add_clicked_cb (ParoleMediaList *list)
+{
+ parole_media_chooser_open (list->priv->chooser, TRUE);
+}
+
+static void
+parole_media_list_remove_clicked_cb (ParoleMediaList *list)
+{
+ GtkTreeSelection *sel;
+ GtkTreeIter iter;
+
+ sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (list->priv->view));
+
+ if ( !gtk_tree_selection_get_selected (sel, NULL, &iter) )
+ return;
+
+ gtk_list_store_remove (list->priv->store,
+ &iter);
+}
+
+static void
+parole_media_list_media_down_clicked_cb (ParoleMediaList *list)
+{
+ GtkTreeSelection *sel;
+ GtkTreeIter iter;
+ GtkTreeIter *pos_iter;
+
+ sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (list->priv->view));
+
+ if ( !gtk_tree_selection_get_selected (sel, NULL, &iter) )
+ return;
+
+ /* Save the selected iter to the selected row */
+ pos_iter = gtk_tree_iter_copy (&iter);
+
+ /* We are on the last node in the list!*/
+ if ( !gtk_tree_model_iter_next (GTK_TREE_MODEL (list->priv->store), &iter) )
+ {
+ /* Return false if tree is empty*/
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list->priv->store), &iter))
+ {
+ gtk_list_store_move_before (GTK_LIST_STORE (list->priv->store), pos_iter, &iter);
+ }
+ }
+ else
+ {
+ gtk_list_store_move_after (GTK_LIST_STORE (list->priv->store), pos_iter, &iter);
+ }
+
+ gtk_tree_iter_free (pos_iter);
+}
+
+static void
+parole_media_list_media_up_clicked_cb (ParoleMediaList *list)
+{
+ GtkTreeSelection *sel;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ GtkTreeIter *pos_iter;
+
+ sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (list->priv->view));
+
+ if ( !gtk_tree_selection_get_selected (sel, NULL, &iter) )
+ return;
+
+ /* Save the selected iter to the selected row */
+ pos_iter = gtk_tree_iter_copy (&iter);
+
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (list->priv->store), &iter);
+
+ /* We are on the top of the list */
+ if ( !gtk_tree_path_prev (path) )
+ {
+ /* Passing NULL as the last argument will cause this call to move
+ * the iter to the end of the list, Gtk API*/
+ gtk_list_store_move_before (GTK_LIST_STORE (list->priv->store), &iter, NULL);
+ }
+ else
+ {
+ if (gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->store), &iter, path))
+ gtk_list_store_move_before (GTK_LIST_STORE (list->priv->store), pos_iter, &iter);
+ }
+
+ gtk_tree_path_free (path);
+ gtk_tree_iter_free (pos_iter);
+}
+
+static void
+parole_media_list_row_activated (GtkTreeView *view, GtkTreePath *path,
+ GtkTreeViewColumn *col, ParoleMediaList *list)
+{
+ GtkTreeModel *model;
+ GtkTreeRowReference *row;
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (list->priv->view));
+
+ row = gtk_tree_row_reference_new (gtk_tree_view_get_model (GTK_TREE_VIEW (list->priv->view)),
+ path);
+
+ g_signal_emit (G_OBJECT (list), signals [MEDIA_ACTIVATED], 0, row);
+}
+
+static void
+parole_media_list_finalize (GObject *object)
+{
+ ParoleMediaList *list;
+
+ list = PAROLE_MEDIA_LIST (object);
+
+ g_object_unref (list->priv->chooser);
+
+ G_OBJECT_CLASS (parole_media_list_parent_class)->finalize (object);
+}
+
+static void
+parole_media_list_class_init (ParoleMediaListClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = parole_media_list_finalize;
+
+ signals[MEDIA_ACTIVATED] =
+ g_signal_new ("media-activated",
+ PAROLE_TYPE_MEDIA_LIST,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ParoleMediaListClass, media_activated),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
+
+ g_type_class_add_private (klass, sizeof (ParoleMediaListPrivate));
+}
+
+static void
+parole_media_list_setup_view (ParoleMediaList *list)
+{
+ GtkListStore *list_store;
+ GtkTreeViewColumn *col;
+ GtkCellRenderer *renderer;
+
+ list_store = gtk_list_store_new (COL_NUMBERS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_OBJECT);
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW (list->priv->view), GTK_TREE_MODEL(list_store));
+
+ gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (list->priv->view), TRUE);
+ col = gtk_tree_view_column_new ();
+
+ renderer = gtk_cell_renderer_pixbuf_new ();
+
+ gtk_tree_view_column_pack_start(col, renderer, FALSE);
+ gtk_tree_view_column_set_attributes(col, renderer, "pixbuf", PIXBUF_COL, NULL);
+
+ renderer = gtk_cell_renderer_text_new();
+
+ gtk_tree_view_column_pack_start(col, renderer, FALSE);
+ gtk_tree_view_column_set_attributes(col, renderer, "text", NAME_COL, NULL);
+
+ gtk_tree_view_append_column (GTK_TREE_VIEW (list->priv->view), col);
+ gtk_tree_view_column_set_title (col, _("Media list"));
+
+ g_signal_connect (G_OBJECT (list->priv->view), "row_activated",
+ G_CALLBACK (parole_media_list_row_activated), list);
+
+ list->priv->store = list_store;
+}
+
+static void
+parole_media_list_init (ParoleMediaList *list)
+{
+ GtkBuilder *builder;
+
+ list->priv = PAROLE_MEDIA_LIST_GET_PRIVATE (list);
+
+ builder = parole_builder_new ();
+
+ list->priv->view = GTK_WIDGET (gtk_builder_get_object (builder, "media-list"));
+ list->priv->box = GTK_WIDGET (gtk_builder_get_object (builder, "list-box"));
+
+ parole_media_list_setup_view (list);
+
+ g_signal_connect_swapped (gtk_builder_get_object (builder, "add-media"), "clicked",
+ G_CALLBACK (parole_media_list_add_clicked_cb), list);
+
+ g_signal_connect_swapped (gtk_builder_get_object (builder, "remove-media"), "clicked",
+ G_CALLBACK (parole_media_list_remove_clicked_cb), list);
+
+ g_signal_connect_swapped (gtk_builder_get_object (builder, "media-down"), "clicked",
+ G_CALLBACK (parole_media_list_media_down_clicked_cb), list);
+
+ g_signal_connect_swapped (gtk_builder_get_object (builder, "media-up"), "clicked",
+ G_CALLBACK (parole_media_list_media_up_clicked_cb), list);
+
+ list->priv->chooser = parole_media_chooser_new ();
+
+ g_signal_connect (G_OBJECT (list->priv->chooser), "media_file_opened",
+ G_CALLBACK (parole_media_list_file_opened_cb), list);
+
+ g_signal_connect (G_OBJECT (list->priv->chooser), "media_files_opened",
+ G_CALLBACK (parole_media_list_files_opened_cb), list);
+
+ g_object_unref (builder);
+}
+
+ParoleMediaList *
+parole_media_list_new (void)
+{
+ ParoleMediaList *list = NULL;
+ list = g_object_new (PAROLE_TYPE_MEDIA_LIST, NULL);
+ return list;
+}
+
+GtkTreeRowReference *parole_media_list_get_next_row (ParoleMediaList *list, GtkTreeRowReference *row)
+{
+ GtkTreeRowReference *next;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+
+ g_return_val_if_fail (row != NULL, NULL);
+
+ if ( !gtk_tree_row_reference_valid (row) )
+ return NULL;
+
+ path = gtk_tree_row_reference_get_path (row);
+
+ gtk_tree_path_next (path);
+
+ if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->store), &iter, path))
+ {
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (list->priv->store), &iter);
+ next = gtk_tree_row_reference_new (GTK_TREE_MODEL (list->priv->store), path);
+ gtk_tree_path_free (path);
+ return next;
+ }
+
+ return NULL;
+}
+
+GtkTreeRowReference *parole_media_list_get_selected_row (ParoleMediaList *list)
+{
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeSelection *sel;
+ GtkTreeRowReference *row;
+ GtkTreeIter iter;
+
+ sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (list->priv->view));
+
+ if (!gtk_tree_selection_get_selected (sel, &model, &iter))
+ return NULL;
+
+ path = gtk_tree_model_get_path (model, &iter);
+
+ row = gtk_tree_row_reference_new (model, path);
+
+ gtk_tree_path_free (path);
+
+ return row;
+}
+
+void parole_media_list_set_row_pixbuf (ParoleMediaList *list, GtkTreeRowReference *row, GdkPixbuf *pix)
+{
+ GtkTreeIter iter;
+ GtkTreePath *path;
+
+ if ( gtk_tree_row_reference_valid (row) )
+ {
+ path = gtk_tree_row_reference_get_path (row);
+
+ if ( gtk_tree_model_get_iter (GTK_TREE_MODEL (list->priv->store), &iter, path) )
+ {
+ gtk_list_store_set (list->priv->store, &iter, PIXBUF_COL, pix, -1);
+ }
+ gtk_tree_path_free (path);
+ }
+}
+
+void parole_media_list_set_visible (ParoleMediaList *list, gboolean visible)
+{
+ if ( visible )
+ gtk_widget_show_all (GTK_WIDGET (list->priv->box));
+ else
+ gtk_widget_hide_all (GTK_WIDGET (list->priv->box));
+}
Added: parole/trunk/src/medialist.h
===================================================================
--- parole/trunk/src/medialist.h (rev 0)
+++ parole/trunk/src/medialist.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,76 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAROLE_MEDIA_LIST_H
+#define __PAROLE_MEDIA_LIST_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_MEDIA_LIST (parole_media_list_get_type () )
+#define PAROLE_MEDIA_LIST(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_MEDIA_LIST, ParoleMediaList))
+#define PAROLE_IS_MEDIA_LIST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_MEDIA_LIST))
+
+enum
+{
+ PIXBUF_COL,
+ NAME_COL,
+ DATA_COL,
+ COL_NUMBERS
+};
+
+typedef struct ParoleMediaListPrivate ParoleMediaListPrivate;
+
+typedef struct
+{
+ GObject parent;
+ ParoleMediaListPrivate *priv;
+
+} ParoleMediaList;
+
+typedef struct
+{
+ GObjectClass parent_class;
+
+ void (*media_activated) (ParoleMediaList *list,
+ GtkTreeRowReference *row);
+
+} ParoleMediaListClass;
+
+GType parole_media_list_get_type (void) G_GNUC_CONST;
+ParoleMediaList *parole_media_list_new (void);
+
+GtkTreeRowReference *parole_media_list_get_selected_row(ParoleMediaList *list);
+
+GtkTreeRowReference *parole_media_list_get_next_row (ParoleMediaList *list,
+ GtkTreeRowReference *row);
+
+void parole_media_list_set_row_pixbuf (ParoleMediaList *list,
+ GtkTreeRowReference *row,
+ GdkPixbuf *pix);
+
+void parole_media_list_set_visible (ParoleMediaList *list,
+ gboolean visible);
+
+G_END_DECLS
+
+#endif /* __PAROLE_MEDIA_LIST_H */
Added: parole/trunk/src/player.c
===================================================================
--- parole/trunk/src/player.c (rev 0)
+++ parole/trunk/src/player.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,674 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <libxfce4util/libxfce4util.h>
+#include <libxfcegui4/libxfcegui4.h>
+
+#include <gtk/gtk.h>
+
+#include "player.h"
+#include "builder.h"
+#include "gst.h"
+#include "medialist.h"
+#include "mediafile.h"
+#include "mediachooser.h"
+#include "sidebar.h"
+#include "statusbar.h"
+#include "enum-glib.h"
+#include "enum-gtypes.h"
+#include "debug.h"
+
+#define PAROLE_PLAYER_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), PAROLE_TYPE_PLAYER, ParolePlayerPrivate))
+
+struct ParolePlayerPrivate
+{
+ GtkWidget *gst;
+ GtkWidget *window;
+
+ GtkWidget *play_pause;
+ GtkWidget *stop;
+ GtkWidget *range;
+
+ gboolean exit;
+
+ gboolean full_screen;
+
+ gboolean playing;
+ gboolean user_seeking;
+ gboolean internal_range_change;
+ gboolean buffering;
+
+ GtkTreeRowReference *row;
+
+ ParoleMediaList *list;
+ //ParoleSidebar *sidebar;
+ ParoleStatusbar *status;
+};
+
+G_DEFINE_TYPE (ParolePlayer, parole_player, G_TYPE_OBJECT)
+
+static void
+parole_player_media_activated_cb (ParoleMediaList *list, GtkTreeRowReference *row, ParolePlayer *player)
+{
+ ParoleMediaFile *file;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+
+ if ( player->priv->row )
+ {
+ parole_media_list_set_row_pixbuf (player->priv->list, player->priv->row, NULL);
+ gtk_tree_row_reference_free (player->priv->row);
+ player->priv->row = NULL;
+ }
+
+ player->priv->row = row;
+ model = gtk_tree_row_reference_get_model (row);
+
+ if ( gtk_tree_model_get_iter (model, &iter, gtk_tree_row_reference_get_path (row)) )
+ {
+ gtk_tree_model_get (model, &iter, DATA_COL, &file, -1);
+
+ if ( file )
+ {
+ TRACE ("Trying to play media file %s", parole_media_file_get_uri (file));
+ gtk_widget_set_sensitive (player->priv->stop, TRUE);
+ parole_gst_play_file (PAROLE_GST (player->priv->gst), file);
+ g_object_unref (file);
+ }
+ }
+}
+
+static void
+parole_player_media_progressed_cb (ParoleGst *gst, const ParoleStream *stream, gdouble value, ParolePlayer *player)
+{
+ if ( !player->priv->user_seeking && value > 0)
+ {
+ player->priv->internal_range_change = TRUE;
+ gtk_range_set_value (GTK_RANGE (player->priv->range), value);
+ player->priv->internal_range_change = FALSE;
+ }
+ parole_statusbar_set_position (player->priv->status, player->priv->playing, value);
+}
+
+static void
+parole_player_set_playpause_widget_image (GtkWidget *widget, const gchar *stock_id)
+{
+ GtkWidget *img;
+
+ g_object_get (G_OBJECT (widget),
+ "image", &img,
+ NULL);
+
+ g_object_set (G_OBJECT (img),
+ "stock", stock_id,
+ NULL);
+}
+
+static void
+parole_player_playing (ParolePlayer *player, const ParoleStream *stream)
+{
+ GdkPixbuf *pix = NULL;
+ gdouble duration;
+ gboolean seekable;
+
+ player->priv->playing = TRUE;
+ pix = xfce_themed_icon_load ("gtk-media-play-ltr", 16);
+
+ parole_media_list_set_row_pixbuf (player->priv->list, player->priv->row, pix);
+
+ gtk_widget_set_sensitive (player->priv->play_pause, TRUE);
+ gtk_widget_set_sensitive (player->priv->stop, TRUE);
+
+ parole_player_set_playpause_widget_image (player->priv->play_pause, GTK_STOCK_MEDIA_PAUSE);
+
+ g_object_get (G_OBJECT (stream),
+ "seekable", &seekable,
+ "duration", &duration,
+ NULL);
+
+ gtk_widget_set_sensitive (player->priv->range, seekable);
+
+ if ( seekable )
+ {
+ parole_statusbar_set_duration (player->priv->status, duration );
+ gtk_range_set_range (GTK_RANGE (player->priv->range), 0, duration);
+ }
+ else
+ {
+ parole_statusbar_set_text (player->priv->status, _("Playing"));
+ gtk_widget_set_tooltip_text (GTK_WIDGET (player->priv->range), _("Media stream is not seekable"));
+ }
+
+ if ( pix )
+ g_object_unref (pix);
+}
+
+static void
+parole_player_paused (ParolePlayer *player)
+{
+ GdkPixbuf *pix = NULL;
+
+ player->priv->playing = FALSE;
+ if ( !player->priv->buffering )
+ parole_statusbar_set_text (player->priv->status, _("Paused"));
+
+ pix = xfce_themed_icon_load ("gtk-media-pause", 16);
+ parole_media_list_set_row_pixbuf (player->priv->list, player->priv->row, pix);
+
+ gtk_widget_set_sensitive (player->priv->play_pause, TRUE);
+ gtk_widget_set_sensitive (player->priv->stop, TRUE);
+
+ parole_player_set_playpause_widget_image (player->priv->play_pause, GTK_STOCK_MEDIA_PLAY);
+
+ if ( pix )
+ g_object_unref (pix);
+
+ parole_statusbar_set_text (player->priv->status, _("Paused"));
+}
+
+static void
+parole_player_quit (ParolePlayer *player)
+{
+ g_object_unref (player);
+ gtk_widget_destroy (player->priv->window);
+ gtk_main_quit ();
+}
+
+static void
+parole_player_stopped (ParolePlayer *player)
+{
+ TRACE ("Player stopped");
+
+ player->priv->playing = FALSE;
+
+ parole_statusbar_set_text (player->priv->status, _("Stopped"));
+
+ gtk_widget_set_sensitive (player->priv->play_pause, FALSE);
+ gtk_widget_set_sensitive (player->priv->stop, FALSE);
+ player->priv->internal_range_change = TRUE;
+ gtk_widget_set_sensitive (player->priv->range, FALSE);
+ gtk_range_set_value (GTK_RANGE (player->priv->range), 0);
+ player->priv->internal_range_change = FALSE;
+
+ parole_player_set_playpause_widget_image (player->priv->play_pause, GTK_STOCK_MEDIA_PLAY);
+
+ parole_media_list_set_row_pixbuf (player->priv->list, player->priv->row, NULL);
+
+ if ( player->priv->exit )
+ {
+ parole_player_quit (player);
+ }
+}
+
+static void
+parole_player_play_next (ParolePlayer *player)
+{
+ GtkTreeRowReference *row;
+
+ if ( player->priv->row )
+ {
+ row = parole_media_list_get_next_row (player->priv->list, player->priv->row);
+
+ if ( row )
+ {
+ parole_player_media_activated_cb (player->priv->list, row, player);
+ goto out;
+ }
+ else
+ {
+ gtk_tree_row_reference_free (player->priv->row);
+ player->priv->row = NULL;
+ }
+ }
+
+ parole_gst_stop (PAROLE_GST (player->priv->gst));
+out:
+ ;
+}
+
+static void
+parole_player_media_state_cb (ParoleGst *gst, const ParoleStream *stream, ParoleMediaState state, ParolePlayer *player)
+{
+ PAROLE_DEBUG_ENUM ("State callback", state, ENUM_GTYPE_MEDIA_STATE);
+
+ if ( state == PAROLE_MEDIA_STATE_PLAYING )
+ {
+ parole_player_playing (player, stream);
+ }
+ else if ( state == PAROLE_MEDIA_STATE_PAUSED )
+ {
+ parole_player_paused (player);
+ }
+ else if ( state == PAROLE_MEDIA_STATE_FINISHED )
+ {
+ TRACE ("***Playback finished***");
+ parole_player_stopped (player);
+ parole_player_play_next (player);
+ }
+ else
+ {
+ parole_player_stopped (player);
+ }
+}
+
+static void
+parole_player_play_pause_clicked (ParolePlayer *player)
+{
+ if ( player->priv->playing )
+ parole_gst_pause (PAROLE_GST (player->priv->gst));
+ else
+ parole_gst_resume (PAROLE_GST (player->priv->gst));
+}
+
+static void
+parole_player_stop_clicked (ParolePlayer *player)
+{
+ parole_gst_stop (PAROLE_GST (player->priv->gst));
+}
+
+static gboolean
+parole_player_range_button_release (GtkWidget *widget, GdkEventButton *ev, ParolePlayer *player)
+{
+ if ( ev->button == 3 )
+ {
+ player->priv->user_seeking = TRUE;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+parole_player_range_button_press (GtkWidget *widget, GdkEventButton *ev, ParolePlayer *player)
+{
+ if ( ev->button == 3 )
+ {
+ player->priv->user_seeking = FALSE;
+ }
+
+ return FALSE;
+}
+
+static void
+parole_player_range_value_changed (GtkRange *range, ParolePlayer *player)
+{
+ gdouble value;
+
+ if ( !player->priv->internal_range_change )
+ {
+ value = gtk_range_get_value (GTK_RANGE (range));
+ player->priv->user_seeking = TRUE;
+ parole_gst_seek (PAROLE_GST (player->priv->gst), value);
+ player->priv->user_seeking = FALSE;
+ }
+}
+
+static void
+parole_player_error_cb (ParoleGst *gst, const gchar *error, ParolePlayer *player)
+{
+ xfce_err ("%s", error);
+ parole_player_stopped (player);
+}
+
+static void
+parole_player_buffering_cb (ParoleGst *gst, const ParoleStream *stream, gint percentage, ParolePlayer *player)
+{
+ if ( percentage == 100 )
+ {
+ player->priv->buffering = FALSE;
+ parole_gst_resume (PAROLE_GST (player->priv->gst));
+ }
+ else
+ {
+ player->priv->buffering = TRUE;
+ parole_statusbar_set_buffering (player->priv->status, percentage);
+ if ( player->priv->playing )
+ parole_gst_pause (PAROLE_GST (player->priv->gst));
+ }
+}
+
+static void
+parole_player_destroy_cb (GtkObject *window, ParolePlayer *player)
+{
+ player->priv->exit = TRUE;
+ parole_gst_null_state (PAROLE_GST (player->priv->gst));
+}
+
+static void
+parole_player_play_menu_item_activate (ParolePlayer *player)
+{
+ gtk_widget_activate (player->priv->play_pause);
+}
+
+static void
+parole_player_stop_menu_item_activate (ParolePlayer *player)
+{
+ gtk_widget_activate (player->priv->stop);
+}
+
+static void
+parole_player_next_menu_item_activate (ParolePlayer *player)
+{
+
+}
+
+static void
+parole_player_previous_menu_item_activate (ParolePlayer *player)
+{
+
+}
+
+static void
+parole_player_full_screen_menu_item_activate (ParolePlayer *player)
+{
+ if ( player->priv->full_screen )
+ {
+ parole_media_list_set_visible (player->priv->list, TRUE);
+ //parole_sidebar_set_visible (player->priv->sidebar, TRUE);
+ player->priv->full_screen = FALSE;
+ gtk_window_unfullscreen (GTK_WINDOW (player->priv->window));
+ }
+ else
+ {
+ parole_media_list_set_visible (player->priv->list, FALSE);
+ //parole_sidebar_set_visible (player->priv->sidebar, FALSE);
+ player->priv->full_screen = TRUE;
+ gtk_window_fullscreen (GTK_WINDOW (player->priv->window));
+ }
+}
+
+static void
+parole_player_show_menu (ParolePlayer *player, guint button, guint activate_time)
+{
+ GtkWidget *menu, *mi;
+ gboolean sensitive;
+
+ menu = gtk_menu_new ();
+
+ /*Play menu item
+ */
+ mi = gtk_image_menu_item_new_from_stock (player->priv->playing ? GTK_STOCK_MEDIA_PAUSE:
+ GTK_STOCK_MEDIA_PLAY, NULL);
+
+ g_object_get (G_OBJECT (player->priv->play_pause),
+ "sensitive", &sensitive,
+ NULL);
+
+ gtk_widget_set_sensitive (mi, sensitive);
+ gtk_widget_show (mi);
+ g_signal_connect_swapped (mi, "activate",
+ G_CALLBACK (parole_player_play_menu_item_activate), player);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
+
+ /*Stop menu item
+ */
+ mi = gtk_image_menu_item_new_from_stock (GTK_STOCK_MEDIA_STOP, NULL);
+
+ gtk_widget_set_sensitive (mi, player->priv->playing);
+ gtk_widget_show (mi);
+ g_signal_connect_swapped (mi, "activate",
+ G_CALLBACK (parole_player_stop_menu_item_activate), player);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
+
+ /*Next chapter menu item
+ */
+ mi = gtk_image_menu_item_new_from_stock (GTK_STOCK_MEDIA_NEXT, NULL);
+
+ gtk_widget_set_sensitive (mi, player->priv->playing);
+ gtk_widget_show (mi);
+ g_signal_connect_swapped (mi, "activate",
+ G_CALLBACK (parole_player_next_menu_item_activate), player);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
+
+ /*Previous chapter menu item
+ */
+ mi = gtk_image_menu_item_new_from_stock (GTK_STOCK_MEDIA_PREVIOUS, NULL);
+
+ gtk_widget_set_sensitive (mi, player->priv->playing);
+ gtk_widget_show (mi);
+ g_signal_connect_swapped (mi, "activate",
+ G_CALLBACK (parole_player_previous_menu_item_activate), player);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
+
+
+ g_signal_connect_swapped (menu, "selection-done",
+ G_CALLBACK (gtk_widget_destroy), menu);
+
+ mi = gtk_separator_menu_item_new ();
+ gtk_widget_show (mi);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
+
+ /*
+ * Un/Full screen
+ */
+ mi = gtk_image_menu_item_new_from_stock (player->priv->full_screen ? GTK_STOCK_LEAVE_FULLSCREEN:
+ GTK_STOCK_FULLSCREEN, NULL);
+ gtk_widget_show (mi);
+ g_signal_connect_swapped (mi, "activate",
+ G_CALLBACK (parole_player_full_screen_menu_item_activate), player);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
+
+
+ g_signal_connect_swapped (menu, "selection-done",
+ G_CALLBACK (gtk_widget_destroy), menu);
+
+
+ gtk_menu_popup (GTK_MENU (menu),
+ NULL, NULL,
+ NULL, NULL,
+ button, activate_time);
+}
+
+static gboolean
+parole_player_gst_widget_button_press (GtkWidget *widget, GdkEventButton *ev, ParolePlayer *player)
+{
+ if ( ev->button == 3)
+ {
+ parole_player_show_menu (player, ev->button, ev->time);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+parole_player_open_media_chooser (gboolean multiple)
+{
+ ParoleMediaChooser *chooser;
+
+ chooser = parole_media_chooser_new ();
+
+ parole_media_chooser_open (chooser, multiple);
+
+ /*
+ * We drop the reference here as the object is
+ * referenced in the medialist which will send events
+ * about media files added by the media chooser.
+ */
+ g_object_unref (chooser);
+}
+
+static void
+parole_player_menu_open_cb (ParolePlayer *player)
+{
+ parole_player_open_media_chooser (FALSE);
+}
+
+static void
+parole_player_menu_open_location_cb (ParolePlayer *player)
+{
+ ParoleMediaChooser *chooser;
+ chooser = parole_media_chooser_new ();
+ parole_media_chooser_open_location (chooser);
+ g_object_unref (chooser);
+}
+
+static void
+parole_player_menu_add_cb (ParolePlayer *player)
+{
+ parole_player_open_media_chooser (TRUE);
+}
+
+static void
+parole_player_menu_exit_cb (ParolePlayer *player)
+{
+ parole_player_destroy_cb (NULL, player);
+}
+
+static void
+parole_player_finalize (GObject *object)
+{
+ ParolePlayer *player;
+
+ player = PAROLE_PLAYER (object);
+
+ TRACE ("start");
+
+ g_object_unref (player->priv->list);
+ g_object_unref (player->priv->gst);
+ //g_object_unref (player->priv->sidebar);
+ g_object_unref (player->priv->status);
+
+ G_OBJECT_CLASS (parole_player_parent_class)->finalize (object);
+}
+
+static void
+parole_player_class_init (ParolePlayerClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = parole_player_finalize;
+
+ g_type_class_add_private (klass, sizeof (ParolePlayerPrivate));
+}
+
+static void
+parole_player_init (ParolePlayer *player)
+{
+ GtkBuilder *builder;
+
+ player->priv = PAROLE_PLAYER_GET_PRIVATE (player);
+
+ builder = parole_builder_new ();
+
+ player->priv->gst = parole_gst_new ();
+ /*
+ * Since ParoleGst is derived from GtkWidget and packed in the media output
+ * box the destroy event on the window will destroy the ParoleGst widget
+ * se we ref it to clean up the gst objects before quitting.
+ */
+ g_object_ref (player->priv->gst);
+
+ //player->priv->sidebar = parole_sidebar_new ();
+ player->priv->status = parole_statusbar_new ();
+
+ player->priv->playing = FALSE;
+ player->priv->user_seeking = FALSE;
+ player->priv->internal_range_change = FALSE;
+ player->priv->exit = FALSE;
+ player->priv->full_screen = FALSE;
+ player->priv->buffering = FALSE;
+
+ g_signal_connect (G_OBJECT (player->priv->gst), "media_state",
+ G_CALLBACK (parole_player_media_state_cb), player);
+
+ g_signal_connect (G_OBJECT (player->priv->gst), "media_progressed",
+ G_CALLBACK (parole_player_media_progressed_cb), player);
+
+ g_signal_connect (G_OBJECT (player->priv->gst), "error",
+ G_CALLBACK (parole_player_error_cb), player);
+
+ g_signal_connect (G_OBJECT (player->priv->gst), "buffering",
+ G_CALLBACK (parole_player_buffering_cb), player);
+
+ g_signal_connect (G_OBJECT (player->priv->gst), "button_release_event",
+ G_CALLBACK (parole_player_gst_widget_button_press), player);
+
+ player->priv->row = NULL;
+
+ gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (builder, "output")), player->priv->gst,
+ TRUE, TRUE, 0);
+
+ gtk_widget_realize (player->priv->gst);
+ gtk_widget_show (player->priv->gst);
+
+ player->priv->window = GTK_WIDGET (gtk_builder_get_object (builder, "main-window"));
+
+ g_signal_connect (G_OBJECT (player->priv->window), "destroy",
+ G_CALLBACK (parole_player_destroy_cb), player);
+
+ player->priv->stop = GTK_WIDGET (gtk_builder_get_object (builder, "stop"));
+ player->priv->play_pause = GTK_WIDGET (gtk_builder_get_object (builder, "play-pause"));
+ player->priv->range = GTK_WIDGET (gtk_builder_get_object (builder, "scale"));
+
+ g_signal_connect (G_OBJECT (player->priv->range), "button_press_event",
+ G_CALLBACK (parole_player_range_button_press), player);
+
+ g_signal_connect (G_OBJECT (player->priv->range), "button_release_event",
+ G_CALLBACK (parole_player_range_button_release), player);
+
+ g_signal_connect (G_OBJECT (player->priv->range), "value_changed",
+ G_CALLBACK (parole_player_range_value_changed), player);
+
+ g_signal_connect_swapped (G_OBJECT (player->priv->stop), "clicked",
+ G_CALLBACK (parole_player_stop_clicked), player);
+
+ g_signal_connect_swapped (G_OBJECT (player->priv->play_pause), "clicked",
+ G_CALLBACK (parole_player_play_pause_clicked), player);
+
+ /*
+ * Connect to the menu items from the menu bar
+ */
+ g_signal_connect_swapped (gtk_builder_get_object (builder, "menu-open"), "activate",
+ G_CALLBACK (parole_player_menu_open_cb), player);
+
+ g_signal_connect_swapped (gtk_builder_get_object (builder, "menu-open-location"), "activate",
+ G_CALLBACK (parole_player_menu_open_location_cb), player);
+
+ g_signal_connect_swapped (gtk_builder_get_object (builder, "menu-add"), "activate",
+ G_CALLBACK (parole_player_menu_add_cb), player);
+
+ g_signal_connect_swapped (gtk_builder_get_object (builder, "menu-exit"), "activate",
+ G_CALLBACK (parole_player_menu_exit_cb), player);
+
+ gtk_widget_show_all (player->priv->window);
+
+ g_object_unref (builder);
+
+ player->priv->list = parole_media_list_new ();
+ g_signal_connect (player->priv->list, "media_activated",
+ G_CALLBACK (parole_player_media_activated_cb), player);
+}
+
+ParolePlayer *
+parole_player_new (void)
+{
+ ParolePlayer *player = NULL;
+ player = g_object_new (PAROLE_TYPE_PLAYER, NULL);
+ return player;
+}
Added: parole/trunk/src/player.h
===================================================================
--- parole/trunk/src/player.h (rev 0)
+++ parole/trunk/src/player.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,52 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAROLE_PLAYER_H
+#define __PAROLE_PLAYER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_PLAYER (parole_player_get_type () )
+#define PAROLE_PLAYER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_PLAYER, ParolePlayer))
+#define PAROLE_IS_PLAYER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_PLAYER))
+
+typedef struct ParolePlayerPrivate ParolePlayerPrivate;
+
+typedef struct
+{
+ GObject parent;
+ ParolePlayerPrivate *priv;
+
+} ParolePlayer;
+
+typedef struct
+{
+ GObjectClass parent_class;
+
+} ParolePlayerClass;
+
+GType parole_player_get_type (void) G_GNUC_CONST;
+ParolePlayer *parole_player_new (void);
+
+G_END_DECLS
+
+#endif /* __PAROLE_PLAYER_H */
Added: parole/trunk/src/rc-utils.c
===================================================================
--- parole/trunk/src/rc-utils.c (rev 0)
+++ parole/trunk/src/rc-utils.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,69 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+
+#include <libxfce4util/libxfce4util.h>
+
+#include "rc-utils.h"
+
+#define MEDIA_PLAYER_RESOURCE_FILE "xfce4/parole/parole-media-player.rc"
+
+static XfceRc *
+open_resource_file (gboolean readonly)
+{
+ gchar *file;
+ XfceRc *rc;
+ file = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, MEDIA_PLAYER_RESOURCE_FILE, TRUE);
+ rc = xfce_rc_simple_open (file, readonly);
+ g_free (file);
+
+ return rc;
+}
+
+gboolean read_bool_entry (const gchar *property)
+{
+ XfceRc *rc = open_resource_file (TRUE);
+
+ return xfce_rc_read_bool_entry (rc, property, TRUE);
+}
+
+const gchar *read_string_entry (const gchar *property)
+{
+ XfceRc *rc = open_resource_file (TRUE);
+
+ return xfce_rc_read_entry (rc, property, NULL);
+}
+
+void write_string_entry (const gchar *property, const gchar *value)
+{
+ XfceRc *rc = open_resource_file (FALSE);
+
+ xfce_rc_write_entry (rc, property, value);
+ xfce_rc_close (rc);
+}
Added: parole/trunk/src/rc-utils.h
===================================================================
--- parole/trunk/src/rc-utils.h (rev 0)
+++ parole/trunk/src/rc-utils.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,31 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __RC_UTILS_
+#define __RC_UTILS_
+
+gboolean read_bool_entry (const gchar *property);
+
+const gchar *read_string_entry (const gchar *property);
+
+void write_string_entry (const gchar *property,
+ const gchar *value);
+
+#endif /* __RC_UTILS_ */
Added: parole/trunk/src/sidebar.c
===================================================================
--- parole/trunk/src/sidebar.c (rev 0)
+++ parole/trunk/src/sidebar.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,218 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <gtk/gtk.h>
+#include <glib.h>
+
+#include <libxfce4util/libxfce4util.h>
+#include <libxfcegui4/libxfcegui4.h>
+
+#include "sidebar.h"
+#include "builder.h"
+
+#define PAROLE_SIDEBAR_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), PAROLE_TYPE_SIDEBAR, ParoleSidebarPrivate))
+
+struct ParoleSidebarPrivate
+{
+ GtkWidget *treeview;
+ GtkWidget *nt;
+
+ gboolean visible;
+};
+
+enum
+{
+ PIXBUF_COL,
+ NAME_COL,
+ NOTEBOOK_NUMBER,
+ COL_NUMBERS
+};
+
+G_DEFINE_TYPE (ParoleSidebar, parole_sidebar, G_TYPE_OBJECT)
+
+static void
+parole_sidebar_finalize (GObject *object)
+{
+ ParoleSidebar *sidebar;
+
+ sidebar = PAROLE_SIDEBAR (object);
+
+ G_OBJECT_CLASS (parole_sidebar_parent_class)->finalize (object);
+}
+
+static void
+parole_sidebar_class_init (ParoleSidebarClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = parole_sidebar_finalize;
+
+ g_type_class_add_private (klass, sizeof (ParoleSidebarPrivate));
+}
+
+static void
+parole_sidebar_cursor_changed_cb (ParoleSidebar *sidebar)
+{
+ GtkTreeSelection *sel;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint int_data = 0;
+
+ sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (sidebar->priv->treeview));
+
+ if ( !gtk_tree_selection_get_selected (sel, &model, &iter))
+ return;
+
+ gtk_tree_model_get (model,
+ &iter,
+ NOTEBOOK_NUMBER,
+ &int_data,
+ -1);
+
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (sidebar->priv->nt), int_data);
+}
+
+static void
+parole_sidebar_setup (ParoleSidebar *sidebar)
+{
+ GtkListStore *list_store;
+ GtkTreeViewColumn *col;
+ GtkCellRenderer *renderer;
+ GtkTreeSelection *sel;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ GdkPixbuf *pix;
+ guint i = 0;
+
+ list_store = gtk_list_store_new (COL_NUMBERS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT);
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW (sidebar->priv->treeview), GTK_TREE_MODEL(list_store));
+
+ gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (sidebar->priv->treeview), TRUE);
+ col = gtk_tree_view_column_new ();
+
+ renderer = gtk_cell_renderer_pixbuf_new ();
+
+ gtk_tree_view_column_pack_start(col, renderer, FALSE);
+ gtk_tree_view_column_set_attributes(col, renderer, "pixbuf", PIXBUF_COL, NULL);
+
+ renderer = gtk_cell_renderer_text_new();
+
+ gtk_tree_view_column_pack_start (col, renderer, FALSE);
+ gtk_tree_view_column_set_attributes (col, renderer, "markup", NAME_COL, NULL);
+
+ gtk_tree_view_append_column (GTK_TREE_VIEW (sidebar->priv->treeview), col);
+
+ /*
+ * Multimedia tab
+ */
+ pix = xfce_themed_icon_load ("multimedia", 24);
+ gtk_list_store_append (list_store, &iter);
+ gtk_list_store_set (list_store, &iter, PIXBUF_COL, pix, NAME_COL, _("<b>Media \nplayer\n</b>"), NOTEBOOK_NUMBER, i, -1);
+ i++;
+ if ( pix )
+ g_object_unref (pix);
+
+ /*
+ * Recoreder tab
+ */
+ pix = xfce_themed_icon_load ("gnome-sound-recorder", 24);
+ gtk_list_store_append (list_store, &iter);
+ gtk_list_store_set (list_store, &iter, PIXBUF_COL, pix, NAME_COL, _("<b>Audio \nrecorder\n</b>"), NOTEBOOK_NUMBER, i, -1);
+ i++;
+ if ( pix )
+ g_object_unref (pix);
+
+
+ /*
+ * Converter tab
+ */
+ pix = xfce_themed_icon_load ("soundconverter", 24);
+ gtk_list_store_append (list_store, &iter);
+ gtk_list_store_set (list_store, &iter, PIXBUF_COL, pix, NAME_COL, _("<b>Audio \nconverter\n</b>"), NOTEBOOK_NUMBER, i, -1);
+ i++;
+ if ( pix )
+ g_object_unref (pix);
+
+ /*
+ * Album
+ */
+ pix = xfce_themed_icon_load ("", 24);
+ gtk_list_store_append (list_store, &iter);
+ gtk_list_store_set (list_store, &iter, PIXBUF_COL, pix, NAME_COL, _("<b>Albums\n</b>"), NOTEBOOK_NUMBER, i, -1);
+ i++;
+ if ( pix )
+ g_object_unref (pix);
+
+ g_signal_connect_swapped (G_OBJECT (sidebar->priv->treeview), "cursor_changed",
+ G_CALLBACK (parole_sidebar_cursor_changed_cb), sidebar);
+
+
+ sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (sidebar->priv->treeview));
+ path = gtk_tree_path_new_first ();
+ gtk_tree_selection_select_path (sel, path);
+ gtk_tree_path_free (path);
+}
+
+static void
+parole_sidebar_init (ParoleSidebar *sidebar)
+{
+ GtkBuilder *builder;
+
+ sidebar->priv = PAROLE_SIDEBAR_GET_PRIVATE (sidebar);
+
+ builder = parole_builder_new ();
+
+ sidebar->priv->visible = TRUE;
+ sidebar->priv->treeview = GTK_WIDGET (gtk_builder_get_object (builder, "treeview"));
+ sidebar->priv->nt = GTK_WIDGET (gtk_builder_get_object (builder, "notebook"));
+
+ parole_sidebar_setup (sidebar);
+
+ g_object_unref (builder);
+}
+
+ParoleSidebar *
+parole_sidebar_new (void)
+{
+ ParoleSidebar *sidebar = NULL;
+ sidebar = g_object_new (PAROLE_TYPE_SIDEBAR, NULL);
+ return sidebar;
+}
+
+void parole_sidebar_set_visible (ParoleSidebar *sidebar, gboolean visible)
+{
+ if ( visible )
+ {
+ if ( sidebar->priv->visible )
+ gtk_widget_show_all (sidebar->priv->treeview);
+ }
+ else
+ gtk_widget_hide_all (sidebar->priv->treeview);
+}
Added: parole/trunk/src/sidebar.h
===================================================================
--- parole/trunk/src/sidebar.h (rev 0)
+++ parole/trunk/src/sidebar.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,55 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAROLE_SIDEBAR_H
+#define __PAROLE_SIDEBAR_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_SIDEBAR (parole_sidebar_get_type () )
+#define PAROLE_SIDEBAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_SIDEBAR, ParoleSidebar))
+#define PAROLE_IS_SIDEBAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_SIDEBAR))
+
+typedef struct ParoleSidebarPrivate ParoleSidebarPrivate;
+
+typedef struct
+{
+ GObject parent;
+ ParoleSidebarPrivate *priv;
+
+} ParoleSidebar;
+
+typedef struct
+{
+ GObjectClass parent_class;
+
+} ParoleSidebarClass;
+
+GType parole_sidebar_get_type (void) G_GNUC_CONST;
+ParoleSidebar *parole_sidebar_new (void);
+
+void parole_sidebar_set_visible (ParoleSidebar *sidebar,
+ gboolean visible);
+
+G_END_DECLS
+
+#endif /* __PAROLE_SIDEBAR_H */
Added: parole/trunk/src/statusbar.c
===================================================================
--- parole/trunk/src/statusbar.c (rev 0)
+++ parole/trunk/src/statusbar.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,138 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <gtk/gtk.h>
+
+#include <libxfcegui4/libxfcegui4.h>
+
+#include "statusbar.h"
+#include "builder.h"
+
+#define PAROLE_STATUSBAR_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), PAROLE_TYPE_STATUSBAR, ParoleStatusbarPrivate))
+
+struct ParoleStatusbarPrivate
+{
+ GtkWidget *progress;
+ GtkWidget *label;
+
+ gdouble duration;
+};
+
+G_DEFINE_TYPE (ParoleStatusbar, parole_statusbar, G_TYPE_OBJECT)
+
+static void
+parole_statusbar_finalize (GObject *object)
+{
+ ParoleStatusbar *statusbar;
+
+ statusbar = PAROLE_STATUSBAR (object);
+
+ G_OBJECT_CLASS (parole_statusbar_parent_class)->finalize (object);
+}
+
+static void
+parole_statusbar_class_init (ParoleStatusbarClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = parole_statusbar_finalize;
+
+ g_type_class_add_private (klass, sizeof (ParoleStatusbarPrivate));
+}
+
+static void
+parole_statusbar_init (ParoleStatusbar *statusbar)
+{
+ GtkWidget *box;
+ GtkBuilder *builder;
+
+ statusbar->priv = PAROLE_STATUSBAR_GET_PRIVATE (statusbar);
+ statusbar->priv->duration = 0;
+
+ builder = parole_builder_new ();
+
+ box = GTK_WIDGET (gtk_builder_get_object (builder, "statusbox"));
+
+ statusbar->priv->progress = gtk_progress_bar_new ();
+ gtk_widget_hide (statusbar->priv->progress);
+ statusbar->priv->label = gtk_label_new (NULL);
+
+ gtk_box_pack_start (GTK_BOX (box), statusbar->priv->label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (box), statusbar->priv->progress, FALSE, FALSE, 0);
+
+ gtk_widget_show (box);
+ gtk_widget_show (statusbar->priv->label);
+ g_object_unref (builder);
+}
+
+ParoleStatusbar *
+parole_statusbar_new (void)
+{
+ ParoleStatusbar *statusbar = NULL;
+ statusbar = g_object_new (PAROLE_TYPE_STATUSBAR, NULL);
+ return statusbar;
+}
+
+void parole_statusbar_set_text (ParoleStatusbar *bar, const gchar *text)
+{
+ gtk_label_set_text (GTK_LABEL (bar->priv->label), text);
+ gtk_widget_show (bar->priv->label);
+ gtk_widget_hide (bar->priv->progress);
+}
+
+void parole_statusbar_set_duration (ParoleStatusbar *bar, gdouble duration)
+{
+ bar->priv->duration = duration;
+}
+
+void parole_statusbar_set_position (ParoleStatusbar *bar, gboolean playing, gdouble position)
+{
+ gchar *text;
+
+ if ( bar->priv->duration != 0)
+ text = g_strdup_printf ("%s %4.2f/%4.2f", playing ? _("Playing") : ("Paused"), position, bar->priv->duration);
+ else
+ text = g_strdup_printf ("%s %4.2f", playing ? _("Playing") : ("Paused"), position);
+
+ parole_statusbar_set_text (bar, text);
+ g_free (text);
+}
+
+void parole_statusbar_set_buffering (ParoleStatusbar *bar, gint percentage)
+{
+ gchar *buff;
+
+ buff = g_strdup_printf ("%s %d%%", _("Buffering"), percentage);
+
+ gtk_progress_bar_set_text (GTK_PROGRESS_BAR (bar->priv->progress), buff);
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar->priv->progress), (gdouble) percentage/100);
+ gtk_widget_hide (bar->priv->label);
+ gtk_widget_show (bar->priv->progress);
+ g_free (buff);
+}
Added: parole/trunk/src/statusbar.h
===================================================================
--- parole/trunk/src/statusbar.h (rev 0)
+++ parole/trunk/src/statusbar.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,65 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAROLE_STATUSBAR_H
+#define __PAROLE_STATUSBAR_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_STATUSBAR (parole_statusbar_get_type () )
+#define PAROLE_STATUSBAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_STATUSBAR, ParoleStatusbar))
+#define PAROLE_IS_STATUSBAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_STATUSBAR))
+
+typedef struct ParoleStatusbarPrivate ParoleStatusbarPrivate;
+
+typedef struct
+{
+ GObject parent;
+ ParoleStatusbarPrivate *priv;
+
+} ParoleStatusbar;
+
+typedef struct
+{
+ GObjectClass parent_class;
+
+} ParoleStatusbarClass;
+
+GType parole_statusbar_get_type (void) G_GNUC_CONST;
+ParoleStatusbar *parole_statusbar_new (void);
+
+void parole_statusbar_set_text (ParoleStatusbar *bar,
+ const gchar *text);
+
+void parole_statusbar_set_duration (ParoleStatusbar *bar,
+ gdouble duration);
+
+void parole_statusbar_set_position (ParoleStatusbar *bar,
+ gboolean playing,
+ gdouble position);
+
+void parole_statusbar_set_buffering (ParoleStatusbar *bar,
+ gint percentage);
+
+G_END_DECLS
+
+#endif /* __PAROLE_STATUSBAR_H */
Added: parole/trunk/src/stream.c
===================================================================
--- parole/trunk/src/stream.c (rev 0)
+++ parole/trunk/src/stream.c 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,213 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <glib.h>
+
+#include "stream.h"
+#include "mediafile.h"
+
+#define PAROLE_STREAM_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), PAROLE_TYPE_STREAM, ParoleStreamPrivate))
+
+struct ParoleStreamPrivate
+{
+ /*Properties*/
+ gpointer media_file;
+ gboolean live;
+ gboolean seekable;
+ gdouble duration;
+ gint64 absolute_duration;
+
+};
+
+enum
+{
+ PROP_0,
+ PROP_MEDIA_FILE,
+ PROP_LIVE,
+ PROP_SEEKABLE,
+ PROP_DURATION,
+ PROP_ABSOLUTE_DURATION
+};
+
+G_DEFINE_TYPE (ParoleStream, parole_stream, G_TYPE_OBJECT)
+
+static void parole_stream_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ ParoleStream *stream;
+ stream = PAROLE_STREAM (object);
+
+ switch (prop_id)
+ {
+ case PROP_LIVE:
+ stream->priv->live = g_value_get_boolean (value);
+ break;
+ case PROP_MEDIA_FILE:
+ stream->priv->media_file = g_value_get_object (value);
+ break;
+ case PROP_SEEKABLE:
+ stream->priv->seekable = g_value_get_boolean (value);
+ break;
+ case PROP_DURATION:
+ stream->priv->duration = g_value_get_double (value);
+ break;
+ case PROP_ABSOLUTE_DURATION:
+ stream->priv->absolute_duration = g_value_get_int64 (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void parole_stream_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ ParoleStream *stream;
+ stream = PAROLE_STREAM (object);
+
+ switch (prop_id)
+ {
+ case PROP_LIVE:
+ g_value_set_boolean (value, stream->priv->live);
+ break;
+ case PROP_MEDIA_FILE:
+ g_value_set_object (value, stream->priv->media_file);
+ break;
+ case PROP_SEEKABLE:
+ g_value_set_boolean (value, stream->priv->seekable);
+ break;
+ case PROP_DURATION:
+ g_value_set_double (value, stream->priv->duration);
+ break;
+ case PROP_ABSOLUTE_DURATION:
+ g_value_set_int64 (value, stream->priv->absolute_duration);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+parole_stream_finalize (GObject *object)
+{
+ ParoleStream *stream;
+
+ stream = PAROLE_STREAM (object);
+
+ if ( stream->priv->media_file )
+ g_object_unref (stream->priv->media_file);
+
+ G_OBJECT_CLASS (parole_stream_parent_class)->finalize (object);
+}
+
+static void
+parole_stream_class_init (ParoleStreamClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = parole_stream_finalize;
+
+ object_class->get_property = parole_stream_get_property;
+ object_class->set_property = parole_stream_set_property;
+
+ g_object_class_install_property (object_class,
+ PROP_MEDIA_FILE,
+ g_param_spec_object ("media-file",
+ NULL, NULL,
+ PAROLE_TYPE_MEDIA_FILE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_LIVE,
+ g_param_spec_boolean ("live",
+ NULL, NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_SEEKABLE,
+ g_param_spec_boolean ("seekable",
+ NULL, NULL,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_DURATION,
+ g_param_spec_double("duration",
+ NULL, NULL,
+ 0, G_MAXDOUBLE,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_ABSOLUTE_DURATION,
+ g_param_spec_int64 ("absolute-duration",
+ NULL, NULL,
+ 0, G_MAXINT64,
+ 0,
+ G_PARAM_READWRITE));
+
+ g_type_class_add_private (klass, sizeof (ParoleStreamPrivate));
+}
+
+static void
+parole_stream_init (ParoleStream *stream)
+{
+ stream->priv = PAROLE_STREAM_GET_PRIVATE (stream);
+
+ stream->priv->media_file = NULL;
+ parole_stream_init_properties (stream);
+}
+
+ParoleStream *
+parole_stream_new (void)
+{
+ ParoleStream *stream = NULL;
+ stream = g_object_new (PAROLE_TYPE_STREAM, NULL);
+ return stream;
+}
+
+void parole_stream_init_properties (ParoleStream *stream)
+{
+ stream->priv->live = FALSE;
+ stream->priv->seekable = FALSE;
+ stream->priv->absolute_duration = 0;
+ stream->priv->duration = 0;
+
+ if ( stream->priv->media_file )
+ g_object_unref (stream->priv->media_file);
+
+ stream->priv->media_file = NULL;
+}
Added: parole/trunk/src/stream.h
===================================================================
--- parole/trunk/src/stream.h (rev 0)
+++ parole/trunk/src/stream.h 2009-06-03 08:40:27 UTC (rev 7452)
@@ -0,0 +1,54 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __PAROLE_STREAM_H
+#define __PAROLE_STREAM_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_STREAM (parole_stream_get_type () )
+#define PAROLE_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_STREAM, ParoleStream))
+#define PAROLE_IS_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_STREAM))
+
+typedef struct ParoleStreamPrivate ParoleStreamPrivate;
+
+typedef struct
+{
+ GObject parent;
+ ParoleStreamPrivate *priv;
+
+} ParoleStream;
+
+typedef struct
+{
+ GObjectClass parent_class;
+
+} ParoleStreamClass;
+
+GType parole_stream_get_type (void) G_GNUC_CONST;
+ParoleStream *parole_stream_new (void);
+
+void parole_stream_init_properties (ParoleStream *stream);
+
+G_END_DECLS
+
+#endif /* __PAROLE_STREAM_H */
More information about the Goodies-commits
mailing list