# HG changeset patch # User melunko # Date 1185976229 -3600 # Node ID 7a914b3fafc1479314496e280d63707a2d221726 # Parent f9cd59844f787a455456a0c058abc8b1c502d11f [svn r796] Moved maemo-ui to maemo-ui-old diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/AUTHORS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/AUTHORS Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,4 @@ +Alexsandro Jose Virginio dos Santos +Hallyson Luiz de Morais Melo +Leonardo Sobral Cunha +Rosfran Lins Borges diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/COPYING --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/COPYING Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. 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. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/ChangeLog --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/ChangeLog Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,24 @@ +2006-08-17 Rosfran Borges + * Added the correct gstreamer-base package (GSTBASE) at the configure.ac; + GSTBASE_CFLAGS and GSTBASE_LIBS variables had the same values from + the GST_CFLAGS/GST_LIBS. + +2006-08-16 Rosfran Borges + * Fixed some installation issues, regarding lib-installing to the + correct directory, and copying the header files to the destination + dir (make install). + * Put 'pkg-config' resource to the Maemo Myth library. The name of the + PKG-CONFIG resource is 'maemo-myth', plus the minor and major version. + Actually, the version is '0.1', so the library config file is: + 'maemo-myth-0.1.pc'. You can type: 'pkg-config --cflags --libs + maemo-myth-0.1'. + * Many adjustments in the automake/autoconf configuration files + (configure.ac, Makefile.am) - some autotools misusage fixed. + * Added the MythURI structure, and the URI parsing utility functions + (missing in the GLib). + * Some functions were exported (myth_socket, mmyth_context), that's + why many ther modules need to use them. + * Fixed some library dependencies. + * Prepared to be used inside the GStreamer (linking with the MythTV + plug-in). + diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/INSTALL --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/INSTALL Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,236 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/Makefile.am Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,8 @@ +SUBDIRS= src pixmaps + +EXTRA_DIST = \ + autogen.sh \ + AUTHORS \ + COPYING \ + README + diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/autogen.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/autogen.sh Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,99 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +DIE=0 +package=gmyth +srcfile=configure.ac + +# a quick cvs co if necessary to alleviate the pain - may remove this +# when developers get a clue ;) +if test ! -d common; +then + echo "+ getting common/ from svn" + svn co common +fi + +# source helper functions +if test ! -f common/autogen-helper.sh; +then + echo There is something wrong with your source tree. + echo You are missing common/autogen-helper.sh + exit 1 +fi +. common/autogen-helper.sh + +CONFIGURE_DEF_OPT='--enable-maintainer-mode' + +autogen_options + +echo -n "+ check for build tools" +if test ! -z "$NOCHECK"; then echo " skipped"; else echo; fi +version_check "autoconf" "$AUTOCONF autoconf autoconf-2.54 autoconf-2.53" \ + "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 53 || DIE=1 +version_check "automake" "$AUTOMAKE automake automake-1.9 automake-1.8 automake-1.7 automake-1.6" \ + "ftp://ftp.gnu.org/pub/gnu/automake/" 1 6 || DIE=1 +version_check "libtoolize" "$LIBTOOLIZE libtoolize" \ + "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 5 0 || DIE=1 +version_check "pkg-config" "" \ + "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1 + +die_check $DIE + +aclocal_check || DIE=1 +autoheader_check || DIE=1 + +die_check $DIE + +# if no arguments specified then this will be printed +if test -z "$*"; then + echo "+ checking for autogen.sh options" + echo " This autogen script will automatically run ./configure as:" + echo " ./configure $CONFIGURE_DEF_OPT" + echo " To pass any additional options, please specify them on the $0" + echo " command line." +fi + +toplevel_check $srcfile + +tool_run "$aclocal" "-I m4 $ACLOCAL_FLAGS" +tool_run "$libtoolize" "--copy --force" +tool_run "$autoheader" + +# touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo +echo timestamp > stamp-h.in 2> /dev/null + +tool_run "$autoconf" +tool_run "$automake" "-a -c" + +# if enable exists, add an -enable option for each of the lines in that file +if test -f enable; then + for a in `cat enable`; do + CONFIGURE_FILE_OPT="--enable-$a" + done +fi + +# if disable exists, add an -disable option for each of the lines in that file +if test -f disable; then + for a in `cat disable`; do + CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a" + done +fi + +test -n "$NOCONFIGURE" && { + echo "+ skipping configure stage for package $package, as requested." + echo "+ autogen.sh done." + exit 0 +} + +echo "+ running configure ... " +test ! -z "$CONFIGURE_DEF_OPT" && echo " ./configure default flags: $CONFIGURE_DEF_OPT" +test ! -z "$CONFIGURE_EXT_OPT" && echo " ./configure external flags: $CONFIGURE_EXT_OPT" +test ! -z "$CONFIGURE_FILE_OPT" && echo " ./configure enable/disable flags: $CONFIGURE_FILE_OPT" +echo + +./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || { + echo " configure failed" + exit 1 +} + +echo "Now type 'make' to compile $package." diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/common/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/common/Makefile.am Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,1 @@ +EXTRA_DIST = autogen-helper.sh diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/common/autogen-helper.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/common/autogen-helper.sh Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,302 @@ +# a silly hack that generates autoregen.sh but it's handy +echo "#!/bin/sh" > autoregen.sh +echo "./autogen.sh $@ \$@" >> autoregen.sh +chmod +x autoregen.sh + +# helper functions for autogen.sh + +debug () +# print out a debug message if DEBUG is a defined variable +{ + if test ! -z "$DEBUG" + then + echo "DEBUG: $1" + fi +} + +version_check () +# check the version of a package +# first argument : package name (executable) +# second argument : optional path where to look for it instead +# third argument : source download url +# rest of arguments : major, minor, micro version +# all consecutive ones : suggestions for binaries to use +# (if not specified in second argument) +{ + PACKAGE=$1 + PKG_PATH=$2 + URL=$3 + MAJOR=$4 + MINOR=$5 + MICRO=$6 + + # for backwards compatibility, we let PKG_PATH=PACKAGE when PKG_PATH null + if test -z "$PKG_PATH"; then PKG_PATH=$PACKAGE; fi + debug "major $MAJOR minor $MINOR micro $MICRO" + VERSION=$MAJOR + if test ! -z "$MINOR"; then VERSION=$VERSION.$MINOR; else MINOR=0; fi + if test ! -z "$MICRO"; then VERSION=$VERSION.$MICRO; else MICRO=0; fi + + debug "major $MAJOR minor $MINOR micro $MICRO" + + for SUGGESTION in $PKG_PATH; do + COMMAND="$SUGGESTION" + + # don't check if asked not to + test -z "$NOCHECK" && { + echo -n " checking for $COMMAND >= $VERSION ... " + } || { + # we set a var with the same name as the package, but stripped of + # unwanted chars + VAR=`echo $PACKAGE | sed 's/-//g'` + debug "setting $VAR" + eval $VAR="$COMMAND" + return 0 + } + + debug "checking version with $COMMAND" + ($COMMAND --version) < /dev/null > /dev/null 2>&1 || + { + echo "not found." + continue + } + # strip everything that's not a digit, then use cut to get the first field + pkg_version=`$COMMAND --version|head -n 1|sed 's/^[^0-9]*//'|cut -d' ' -f1` + debug "pkg_version $pkg_version" + # remove any non-digit characters from the version numbers to permit numeric + # comparison + pkg_major=`echo $pkg_version | cut -d. -f1 | sed s/[a-zA-Z\-].*//g` + pkg_minor=`echo $pkg_version | cut -d. -f2 | sed s/[a-zA-Z\-].*//g` + pkg_micro=`echo $pkg_version | cut -d. -f3 | sed s/[a-zA-Z\-].*//g` + test -z "$pkg_major" && pkg_major=0 + test -z "$pkg_minor" && pkg_minor=0 + test -z "$pkg_micro" && pkg_micro=0 + debug "found major $pkg_major minor $pkg_minor micro $pkg_micro" + + #start checking the version + debug "version check" + + # reset check + WRONG= + + if [ ! "$pkg_major" -gt "$MAJOR" ]; then + debug "major: $pkg_major <= $MAJOR" + if [ "$pkg_major" -lt "$MAJOR" ]; then + debug "major: $pkg_major < $MAJOR" + WRONG=1 + elif [ ! "$pkg_minor" -gt "$MINOR" ]; then + debug "minor: $pkg_minor <= $MINOR" + if [ "$pkg_minor" -lt "$MINOR" ]; then + debug "minor: $pkg_minor < $MINOR" + WRONG=1 + elif [ "$pkg_micro" -lt "$MICRO" ]; then + debug "micro: $pkg_micro < $MICRO" + WRONG=1 + fi + fi + fi + + if test ! -z "$WRONG"; then + echo "found $pkg_version, not ok !" + continue + else + echo "found $pkg_version, ok." + # we set a var with the same name as the package, but stripped of + # unwanted chars + VAR=`echo $PACKAGE | sed 's/-//g'` + debug "setting $VAR" + eval $VAR="$COMMAND" + return 0 + fi + done + + echo "not found !" + echo "You must have $PACKAGE installed to compile $package." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at $URL" + return 1; +} + +aclocal_check () +{ + # normally aclocal is part of automake + # so we expect it to be in the same place as automake + # so if a different automake is supplied, we need to adapt as well + # so how's about replacing automake with aclocal in the set var, + # and saving that in $aclocal ? + # note, this will fail if the actual automake isn't called automake* + # or if part of the path before it contains it + if [ -z "$automake" ]; then + echo "Error: no automake variable set !" + return 1 + else + aclocal=`echo $automake | sed s/automake/aclocal/` + debug "aclocal: $aclocal" + if [ "$aclocal" != "aclocal" ]; + then + CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-aclocal=$aclocal" + fi + if [ ! -x `which $aclocal` ]; then + echo "Error: cannot execute $aclocal !" + return 1 + fi + fi +} + +autoheader_check () +{ + # same here - autoheader is part of autoconf + # use the same voodoo + if [ -z "$autoconf" ]; then + echo "Error: no autoconf variable set !" + return 1 + else + autoheader=`echo $autoconf | sed s/autoconf/autoheader/` + debug "autoheader: $autoheader" + if [ "$autoheader" != "autoheader" ]; + then + CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoheader=$autoheader" + fi + if [ ! -x `which $autoheader` ]; then + echo "Error: cannot execute $autoheader !" + return 1 + fi + fi + +} + +autoconf_2_52d_check () +{ + # autoconf 2.52d has a weird issue involving a yes:no error + # so don't allow it's use + test -z "$NOCHECK" && { + ac_version=`$autoconf --version|head -n 1|sed 's/^[a-zA-Z\.\ ()]*//;s/ .*$//'` + if test "$ac_version" = "2.52d"; then + echo "autoconf 2.52d has an issue with our current build." + echo "We don't know who's to blame however. So until we do, get a" + echo "regular version. RPM's of a working version are on the gstreamer site." + exit 1 + fi + } + return 0 +} + +die_check () +{ + # call with $DIE + # if set to 1, we need to print something helpful then die + DIE=$1 + if test "x$DIE" = "x1"; + then + echo + echo "- Please get the right tools before proceeding." + echo "- Alternatively, if you're sure we're wrong, run with --nocheck." + exit 1 + fi +} + +autogen_options () +{ + if test "x$1" = "x"; then + return 0 + fi + + while test "x$1" != "x" ; do + optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + case "$1" in + --noconfigure) + NOCONFIGURE=defined + AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure" + echo "+ configure run disabled" + shift + ;; + --nocheck) + AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck" + NOCHECK=defined + echo "+ autotools version check disabled" + shift + ;; + --debug) + DEBUG=defined + AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug" + echo "+ debug output enabled" + shift + ;; + --prefix=*) + CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$optarg" + echo "+ passing --prefix=$optarg to configure" + shift + ;; + --prefix) + shift + echo "DEBUG: $1" + CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$1" + echo "+ passing --prefix=$1 to configure" + shift + ;; + -h|--help) + echo "autogen.sh (autogen options) -- (configure options)" + echo "autogen.sh help options: " + echo " --noconfigure don't run the configure script" + echo " --nocheck don't do version checks" + echo " --debug debug the autogen process" + echo " --prefix will be passed on to configure" + echo + echo " --with-autoconf PATH use autoconf in PATH" + echo " --with-automake PATH use automake in PATH" + echo + echo "to pass options to configure, put them as arguments after -- " + exit 1 + ;; + --with-automake=*) + AUTOMAKE=$optarg + echo "+ using alternate automake in $optarg" + CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-automake=$AUTOMAKE" + shift + ;; + --with-autoconf=*) + AUTOCONF=$optarg + echo "+ using alternate autoconf in $optarg" + CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoconf=$AUTOCONF" + shift + ;; + --disable*|--enable*|--with*) + echo "+ passing option $1 to configure" + CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $1" + shift + ;; + --) shift ; break ;; + *) echo "- ignoring unknown autogen.sh argument $1"; shift ;; + esac + done + + for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done + if test ! -z "$CONFIGURE_EXT_OPT" + then + echo "+ options passed to configure: $CONFIGURE_EXT_OPT" + fi +} + +toplevel_check () +{ + srcfile=$1 + test -f $srcfile || { + echo "You must run this script in the top-level $package directory" + exit 1 + } +} + + +tool_run () +{ + tool=$1 + options=$2 + run_if_fail=$3 + echo "+ running $tool $options..." + $tool $options || { + echo + echo $tool failed + eval $run_if_fail + exit 1 + } +} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/configure.ac --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/configure.ac Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,229 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.50) + +AC_INIT([maemo-myth],[0.1]) + +dnl AC_CONFIG_SRCDIR([src/mmyth_main.c]) +AC_CONFIG_HEADER(config.h) + +dnl when going to/from release please set the nano (fourth number) right ! +dnl releases only do Wall, SVN and prerelease does Werror too +AS_VERSION(maemo-myth, GMYTH, 0, 1, 0, 3, GMYTH_SVN="no", GMYTH_SVN="yes") + +GMYTH_MAJORMINOR=$GMYTH_MAJOR_VERSION.$GMYTH_MINOR_VERSION + +AC_SUBST(GMYTH_MAJORMINOR) + +dnl AM_MAINTAINER_MODE provides the option to enable maintainer mode +AM_MAINTAINER_MODE +dnl make aclocal work in maintainer mode +AC_SUBST(ACLOCAL_AMFLAGS, "-I m4") + +# Checks for programs. +# check for tools +# Make sure CFLAGS is defined to stop AC_PROC_CC adding -g +CFLAGS="$CFLAGS -Wall" +AC_PROG_CC +AC_PROG_LIBTOOL + +# Checks for libraries. + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_PID_T +AC_STRUCT_TM + +# Checks for library functions. +AC_FUNC_FORK +AC_PROG_GCC_TRADITIONAL +AC_FUNC_MALLOC +AC_FUNC_MKTIME +AC_FUNC_VPRINTF +AC_CHECK_FUNCS([memset socket stime strstr strtoul]) + +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) + +# Checks required packages + +dnl Test if --disable-debug given +AC_ARG_ENABLE(debug, + [AC_HELP_STRING([--disable-debug], [disable debugging mode])], + enable_debug="$enableval", + enable_debug=yes) + +if test "x$enable_debug" = "xyes" ; then + CFLAGS="$CFLAGS -g" +else + AC_DEFINE( NDEBUG, 1, [disable debug messages] ) + CFLAGS="$CFLAGS -O2 -DG_DISABLE_CHECKS -DNDEBUG" +fi + +AM_CONDITIONAL( NDEBUG, test "x$enable_debug" = "xyes" ) + +# Check for pkgconfig +AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no) +# Give error and exit if we don't have pkgconfig +if test "x$HAVE_PKGCONFIG" = "xno"; then + AC_MSG_ERROR(you need to have pkgconfig installed !) +fi + +# Check for Glib2.0 +PKG_CHECK_MODULES(GLIB, glib-2.0, HAVE_GLIB=yes,HAVE_GLIB=no) + +# Give error and exit if we don't have glib +if test "x$HAVE_GLIB" = "xno"; then + AC_MSG_ERROR(you need glib-2.0 installed) +fi + +# make GLIB_CFLAGS and GLIB_LIBS available +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) + +# Check for GObject2.0 +PKG_CHECK_MODULES(GOBJECT, + gobject-2.0, + HAVE_GOBJECT=yes, HAVE_GOBJECT=no) + +# Give error and exit if we don't have gobject +if test "x$HAVE_GOBJECT" = "xno"; then + AC_MSG_ERROR(you need gobject-2.0 installed) +fi + +# make GOBJECT_CFLAGS and GOBJECT_LIBS available +AC_SUBST(GOBJECT_CFLAGS) +AC_SUBST(GOBJECT_LIBS) + +# Check for GTK+-2.0 +PKG_CHECK_MODULES(GTK, gtk+-2.0, HAVE_GTK=yes,HAVE_GTK=no) + +# Give error and exit if we don't have gtk +if test "x$HAVE_GTK" = "xyes"; then + AC_DEFINE(WITH_GTK, 1, [build with GTK+ related stuff]) + dnl AC_MSG_ERROR(you need gtk+-2.0 installed) +else + AC_MSG_RESULT(no) +fi + +AM_CONDITIONAL(WITH_GTK, test "x$HAVE_GTK" = "xyes" ) + +# make GTK_CFLAGS and GTK_LIBS available +AC_SUBST(GTK_CFLAGS) +AC_SUBST(GTK_LIBS) + +dnl ========== Check for Hildon Libraries +PKG_CHECK_MODULES(HILDON, + libosso hildon-lgpl libosso hildon-status-bar-lib libhildonmenu hildon-base-lib hildon-control-panel hildon-libs, + HAVE_HILDON=yes, HAVE_HILDON=no) + +if test "x$HAVE_HILDON" = "xyes"; then + HILDON_CFLAGS="$HILDON_CFLAGS -DMAEMO_PLATFORM" + AC_DEFINE(MAEMO_PLATFORM, 1, [build with hildon libs]) +else + AC_MSG_RESULT(no) +fi + +AM_CONDITIONAL(MAEMO_PLATFORM, test "x$HAVE_HILDON" = "xyes") + +dnl make HILDON_CFLAGS and HILDON_LIBS available +AC_SUBST(HILDON_CFLAGS) +AC_SUBST(HILDON_LIBS) + +# Check for libxml-2.0 +PKG_CHECK_MODULES(LIBXML, libxml-2.0, HAVE_LIBXML=yes,HAVE_LIBXML=no) + +# Give error and exit if we don't have libxml +if test "x$HAVE_LIBXML" = "xno"; then + AC_MSG_ERROR(you need libxml-2.0 installed) +fi + +# make LIBXML_CFLAGS and LIBXML_LIBS available +AC_SUBST(LIBXML_CFLAGS) +AC_SUBST(LIBXML_LIBS) + + +# check for gstreamer development files +GST_REQUIRED=0.10 +GST_MAJORMINOR=0.10 +PKG_CHECK_MODULES(GST, \ + gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED, + HAVE_GST=yes, HAVE_GST=no) + +# Give error and exit if we don't have gstreamer +if test "x$HAVE_GST" = "xno"; then + AC_MSG_ERROR(you need gstreamer development packages installed !) +fi + +# make GST_CFLAGS and GST_LIBS available +AC_SUBST(GST_CFLAGS) +AC_SUBST(GST_LIBS) + +# check for gstreamer-base plugins (xoverlay interface) +GSTBASE_REQUIRED=0.10 +GSTBASE_MAJORMINOR=0.10 +PKG_CHECK_MODULES(GSTBASE, \ + gstreamer-base-$GSTBASE_MAJORMINOR >= $GSTBASE_REQUIRED, + HAVE_GSTBASE=yes, HAVE_GSTBASE=no) + +# Give error and exit if we don't have gstreamer base libraries +if test "x$HAVE_GSTBASE" = "xno"; then + AC_MSG_ERROR(you need gstreamer base development packages installed !) +fi + +# make GSTBASE_CFLAGS and GSTBASE_LIBS available +AC_SUBST(GSTBASE_CFLAGS) +AC_SUBST(GSTBASE_LIBS) + +# make GST_MAJORMINOR available in Makefile.am +AC_SUBST(GST_MAJORMINOR) + + +# check for gstreamer-base plugins (xoverlay interface) +GSTPLUGINSBASE_REQUIRED=0.10 +GSTPLUGINSBASE_MAJORMINOR=0.10 +PKG_CHECK_MODULES(GSTPLUGINSBASE, \ + gstreamer-plugins-base-$GSTPLUGINSBASE_MAJORMINOR >= $GSTPLUGINSBASE_REQUIRED, + HAVE_GSTPLUGINSBASE=yes, HAVE_GSTPLUGINSBASE=no) + +# Give error and exit if we don't have gstreamer base libraries +if test "x$HAVE_GSTPLUGINSBASE" = "xno"; then + AC_MSG_ERROR(you need gstreamer plugins base development packages installed !) +fi + +# make GSTPLUGINSBASE_CFLAGS and GSTPLUGINSBASE_LIBS available +AC_SUBST(GSTPLUGINSBASE_CFLAGS) +AC_SUBST(GSTPLUGINSBASE_LIBS) + +# check for gstreamer-interfaces (xoverlay interface) +AC_CHECK_FUNC( gst_x_overlay_get_type, + HAVE_GSTINTERFACES=yes, HAVE_GSTINTERFACES=no ) + +# Give error and exit if we don't have gstreamer base libraries +if test "x$HAVE_GSTINTERFACES" = "xno"; then + AC_MSG_NOTICE(you need gstreamer interfaces development packages installed !) + CFLAGS="$CFLAGS -lgstinterfaces-$GSTPLUGINSBASE_MAJORMINOR" +fi + +# Check for gmyth-0.1 + +PKG_CHECK_MODULES(LIBGMYTH, gmyth-0.1, HAVE_LIBGMYTH=yes,HAVE_LIBGMYTH=no) + +# Give error and exit if we don't have gmyth-0.1 +if test "x$HAVE_LIBGMYTH" = "xno"; then + AC_MSG_ERROR(you need gmyth-0.1 installed) +fi + +# make LIBXML_CFLAGS and LIBXML_LIBS available +AC_SUBST(LIBGMYTH_CFLAGS) +AC_SUBST(LIBGMYTH_LIBS) + + +AC_CONFIG_FILES([Makefile + src/Makefile + pixmaps/Makefile]) +AC_OUTPUT diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/m4/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/m4/Makefile.am Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,7 @@ +EXTRA_DIST = \ + ac_doxygen.m4 \ + as-compiler-flag.m4 \ + as-expand.m4 \ + as-version.m4 \ + as-gtk-doc.m4 + diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/m4/ac_doxygen.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/m4/ac_doxygen.m4 Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,312 @@ +# This file is part of Autoconf. -*- Autoconf -*- + +# Copyright (C) 2004 Oren Ben-Kiki +# This file is distributed under the same terms as the Autoconf macro files. + +# Generate automatic documentation using Doxygen. Works in concert with the +# aminclude.m4 file and a compatible doxygen configuration file. Defines the +# following public macros: +# +# DX_???_FEATURE(ON|OFF) - control the default setting fo a Doxygen feature. +# Supported features are 'DOXYGEN' itself, 'DOT' for generating graphics, +# 'HTML' for plain HTML, 'CHM' for compressed HTML help (for MS users), 'CHI' +# for generating a seperate .chi file by the .chm file, and 'MAN', 'RTF', +# 'XML', 'PDF' and 'PS' for the appropriate output formats. The environment +# variable DOXYGEN_PAPER_SIZE may be specified to override the default 'a4wide' +# paper size. +# +# By default, HTML, PDF and PS documentation is generated as this seems to be +# the most popular and portable combination. MAN pages created by Doxygen are +# usually problematic, though by picking an appropriate subset and doing some +# massaging they might be better than nothing. CHM and RTF are specific for MS +# (note that you can't generate both HTML and CHM at the same time). The XML is +# rather useless unless you apply specialized post-processing to it. +# +# The macro mainly controls the default state of the feature. The use can +# override the default by specifying --enable or --disable. The macros ensure +# that contradictory flags are not given (e.g., --enable-doxygen-html and +# --enable-doxygen-chm, --enable-doxygen-anything with --disable-doxygen, etc.) +# Finally, each feature will be automatically disabled (with a warning) if the +# required programs are missing. +# +# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN with +# the following parameters: a one-word name for the project for use as a +# filename base etc., an optional configuration file name (the default is +# 'Doxyfile', the same as Doxygen's default), and an optional output directory +# name (the default is 'doxygen-doc'). + +## ----------## +## Defaults. ## +## ----------## + +DX_ENV="" +AC_DEFUN([DX_FEATURE_doc], ON) +AC_DEFUN([DX_FEATURE_dot], ON) +AC_DEFUN([DX_FEATURE_man], OFF) +AC_DEFUN([DX_FEATURE_html], ON) +AC_DEFUN([DX_FEATURE_chm], OFF) +AC_DEFUN([DX_FEATURE_chi], OFF) +AC_DEFUN([DX_FEATURE_rtf], OFF) +AC_DEFUN([DX_FEATURE_xml], OFF) +AC_DEFUN([DX_FEATURE_pdf], ON) +AC_DEFUN([DX_FEATURE_ps], ON) + +## --------------- ## +## Private macros. ## +## --------------- ## + +# DX_ENV_APPEND(VARIABLE, VALUE) +# ------------------------------ +# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen. +AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])]) + +# DX_DIRNAME_EXPR +# --------------- +# Expand into a shell expression prints the directory part of a path. +AC_DEFUN([DX_DIRNAME_EXPR], + [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']]) + +# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF) +# ------------------------------------- +# Expands according to the M4 (static) status of the feature. +AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])]) + +# DX_REQUIRE_PROG(VARIABLE, PROGRAM) +# ---------------------------------- +# Require the specified program to be found for the DX_CURRENT_FEATURE to work. +AC_DEFUN([DX_REQUIRE_PROG], [ +AC_PATH_TOOL([$1], [$2]) +if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then + AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION]) + AC_SUBST([DX_FLAG_[]DX_CURRENT_FEATURE], 0) +fi +]) + +# DX_TEST_FEATURE(FEATURE) +# ------------------------ +# Expand to a shell expression testing whether the feature is active. +AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1]) + +# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE) +# ------------------------------------------------- +# Verify that a required features has the right state before trying to turn on +# the DX_CURRENT_FEATURE. +AC_DEFUN([DX_CHECK_DEPEND], [ +test "$DX_FLAG_$1" = "$2" \ +|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1, + requires, contradicts) doxygen-DX_CURRENT_FEATURE]) +]) + +# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE) +# ---------------------------------------------------------- +# Turn off the DX_CURRENT_FEATURE if the required feature is off. +AC_DEFUN([DX_CLEAR_DEPEND], [ +test "$DX_FLAG_$1" = "$2" || AC_SUBST([DX_FLAG_[]DX_CURRENT_FEATURE], 0) +]) + +# DX_FEATURE_ARG(FEATURE, DESCRIPTION, +# CHECK_DEPEND, CLEAR_DEPEND, +# REQUIRE, DO-IF-ON, DO-IF-OFF) +# -------------------------------------------- +# Parse the command-line option controlling a feature. CHECK_DEPEND is called +# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND), +# otherwise CLEAR_DEPEND is called to turn off the default state if a required +# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional +# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and +# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature. +AC_DEFUN([DX_ARG_ABLE], [ + AC_DEFUN([DX_CURRENT_FEATURE], [$1]) + AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2]) + AC_ARG_ENABLE(doxygen-$1, + [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1], + [--enable-doxygen-$1]), + DX_IF_FEATURE([$1], [don't $2], [$2]))], + [ +case "$enableval" in +#( +y|Y|yes|Yes|YES) + AC_SUBST([DX_FLAG_$1], 1) + $3 +;; #( +n|N|no|No|NO) + AC_SUBST([DX_FLAG_$1], 0) +;; #( +*) + AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1]) +;; +esac +], [ +AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)]) +$4 +]) +if DX_TEST_FEATURE([$1]); then + $5 + : +fi +if DX_TEST_FEATURE([$1]); then + AM_CONDITIONAL(DX_COND_$1, :) + $6 + : +else + AM_CONDITIONAL(DX_COND_$1, false) + $7 + : +fi +]) + +## -------------- ## +## Public macros. ## +## -------------- ## + +# DX_XXX_FEATURE(DEFAULT_STATE) +# ----------------------------- +AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])]) +AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])]) +AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])]) +AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])]) +AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])]) +AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])]) +AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) +AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) +AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])]) +AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])]) + +# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR]) +# --------------------------------------------------------- +# PROJECT also serves as the base name for the documentation files. +# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc". +AC_DEFUN([DX_INIT_DOXYGEN], [ + +# Files: +AC_SUBST([DX_PROJECT], [$1]) +AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])]) +AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])]) + +# Environment variables used inside doxygen.cfg: +DX_ENV_APPEND(SRCDIR, $srcdir) +DX_ENV_APPEND(PROJECT, $DX_PROJECT) +DX_ENV_APPEND(DOCDIR, $DX_DOCDIR) +DX_ENV_APPEND(VERSION, $PACKAGE_VERSION) + +# Doxygen itself: +DX_ARG_ABLE(doc, [generate any doxygen documentation], + [], + [], + [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen) + DX_REQUIRE_PROG([DX_PERL], perl)], + [DX_ENV_APPEND(PERL_PATH, $DX_PERL)]) + +# Dot for graphics: +DX_ARG_ABLE(dot, [generate graphics for doxygen documentation], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [DX_REQUIRE_PROG([DX_DOT], dot)], + [DX_ENV_APPEND(HAVE_DOT, YES) + DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])], + [DX_ENV_APPEND(HAVE_DOT, NO)]) + +# Man pages generation: +DX_ARG_ABLE(man, [generate doxygen manual pages], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [], + [DX_ENV_APPEND(GENERATE_MAN, YES)], + [DX_ENV_APPEND(GENERATE_MAN, NO)]) + +# RTF file generation: +DX_ARG_ABLE(rtf, [generate doxygen RTF documentation], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [], + [DX_ENV_APPEND(GENERATE_RTF, YES)], + [DX_ENV_APPEND(GENERATE_RTF, NO)]) + +# XML file generation: +DX_ARG_ABLE(xml, [generate doxygen XML documentation], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [], + [DX_ENV_APPEND(GENERATE_XML, YES)], + [DX_ENV_APPEND(GENERATE_XML, NO)]) + +# (Compressed) HTML help generation: +DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [DX_REQUIRE_PROG([DX_HHC], hhc)], + [DX_ENV_APPEND(HHC_PATH, $DX_HHC) + DX_ENV_APPEND(GENERATE_HTML, YES) + DX_ENV_APPEND(GENERATE_HTMLHELP, YES)], + [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)]) + +# Seperate CHI file generation. +DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file], + [DX_CHECK_DEPEND(chm, 1)], + [DX_CLEAR_DEPEND(chm, 1)], + [], + [DX_ENV_APPEND(GENERATE_CHI, YES)], + [DX_ENV_APPEND(GENERATE_CHI, NO)]) + +# Plain HTML pages generation: +DX_ARG_ABLE(html, [generate doxygen plain HTML documentation], + [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)], + [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)], + [], + [DX_ENV_APPEND(GENERATE_HTML, YES)], + [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)]) + +# PostScript file generation: +DX_ARG_ABLE(ps, [generate doxygen PostScript documentation], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [DX_REQUIRE_PROG([DX_LATEX], latex) + DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) + DX_REQUIRE_PROG([DX_DVIPS], dvips) + DX_REQUIRE_PROG([DX_EGREP], egrep)]) + +# PDF file generation: +DX_ARG_ABLE(pdf, [generate doxygen PDF documentation], + [DX_CHECK_DEPEND(doc, 1)], + [DX_CLEAR_DEPEND(doc, 1)], + [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex) + DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) + DX_REQUIRE_PROG([DX_EGREP], egrep)]) + +# LaTeX generation for PS and/or PDF: +if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then + AM_CONDITIONAL(DX_COND_latex, :) + DX_ENV_APPEND(GENERATE_LATEX, YES) +else + AM_CONDITIONAL(DX_COND_latex, false) + DX_ENV_APPEND(GENERATE_LATEX, NO) +fi + +# Paper size for PS and/or PDF: +AC_ARG_VAR(DOXYGEN_PAPER_SIZE, + [a4wide (default), a4, letter, legal or executive]) +case "$DOXYGEN_PAPER_SIZE" in +#( +"") + AC_SUBST(DOXYGEN_PAPER_SIZE, "") +;; #( +a4wide|a4|letter|legal|executive) + DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE) +;; #( +*) + AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE']) +;; +esac + +#For debugging: +#echo DX_FLAG_doc=$DX_FLAG_doc +#echo DX_FLAG_dot=$DX_FLAG_dot +#echo DX_FLAG_man=$DX_FLAG_man +#echo DX_FLAG_html=$DX_FLAG_html +#echo DX_FLAG_chm=$DX_FLAG_chm +#echo DX_FLAG_chi=$DX_FLAG_chi +#echo DX_FLAG_rtf=$DX_FLAG_rtf +#echo DX_FLAG_xml=$DX_FLAG_xml +#echo DX_FLAG_pdf=$DX_FLAG_pdf +#echo DX_FLAG_ps=$DX_FLAG_ps +#echo DX_ENV=$DX_ENV +]) diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/m4/as-compiler-flag.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/m4/as-compiler-flag.m4 Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,33 @@ +dnl as-compiler-flag.m4 0.1.0 + +dnl autostars m4 macro for detection of compiler flags + +dnl David Schleef + +dnl $Id: as-compiler-flag.m4,v 1.1.1.1 2005/08/26 00:42:44 andrunko Exp $ + +dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) +dnl Tries to compile with the given CFLAGS. +dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, +dnl and ACTION-IF-NOT-ACCEPTED otherwise. + +AC_DEFUN([AS_COMPILER_FLAG], +[ + AC_MSG_CHECKING([to see if compiler understands $1]) + + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + + AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) + CFLAGS="$save_CFLAGS" + + if test "X$flag_ok" = Xyes ; then + $2 + true + else + $3 + true + fi + AC_MSG_RESULT([$flag_ok]) +]) + diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/m4/as-expand.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/m4/as-expand.m4 Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,40 @@ +dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) +dnl +dnl example +dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) +dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local + +AC_DEFUN([AS_AC_EXPAND], +[ + EXP_VAR=[$1] + FROM_VAR=[$2] + + dnl first expand prefix and exec_prefix if necessary + prefix_save=$prefix + exec_prefix_save=$exec_prefix + + dnl if no prefix given, then use /usr/local, the default prefix + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + fi + dnl if no exec_prefix given, then use prefix + if test "x$exec_prefix" = "xNONE"; then + exec_prefix=$prefix + fi + + full_var="$FROM_VAR" + dnl loop until it doesn't change anymore + while true; do + new_full_var="`eval echo $full_var`" + if test "x$new_full_var"="x$full_var"; then break; fi + full_var=$new_full_var + done + + dnl clean up + full_var=$new_full_var + AC_SUBST([$1], "$full_var") + + dnl restore prefix and exec_prefix + prefix=$prefix_save + exec_prefix=$exec_prefix_save +]) diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/m4/as-version.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/m4/as-version.m4 Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,59 @@ +dnl version.m4 0.0.5 +dnl autostars m4 macro for versioning +dnl thomas@apestaart.org +dnl +dnl AS_VERSION(PACKAGE, PREFIX, MAJOR, MINOR, MICRO, NANO, ACTION_IF_NO_NANO, ACTION_IF_NANO) +dnl example +dnl AS_VERSION(gstreamer, GST_VERSION, 0, 3, 2,) +dnl for a 0.3.2 release version +dnl +dnl this macro +dnl - defines [$PREFIX]_MAJOR, MINOR and MICRO +dnl - if NANO is empty, then we're in release mode, else in cvs/dev mode +dnl - defines [$PREFIX], VERSION, and [$PREFIX]_RELEASE +dnl - executes the relevant action +dnl - AC_SUBST's PACKAGE, VERSION, [$PREFIX] and [$PREFIX]_RELEASE +dnl as well as the little ones +dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents +dnl maintainer mode from running ok +dnl +dnl don't forget to put #undef [$2] and [$2]_RELEASE in acconfig.h + +AC_DEFUN([AS_VERSION], +[ + PACKAGE=[$1] + [$2]_MAJOR_VERSION=[$3] + [$2]_MINOR_VERSION=[$4] + [$2]_MICRO_VERSION=[$5] + NANO=[$6] + [$2]_NANO_VERSION=$NANO + if test "x$NANO" = "x" || test "x$NANO" = "x0"; + then + AC_MSG_NOTICE(configuring [$1] for release) + VERSION=[$3].[$4].[$5] + [$2]_RELEASE=1 + dnl execute action + ifelse([$7], , :, [$7]) + else + AC_MSG_NOTICE(configuring [$1] for development with nano $NANO) + VERSION=[$3].[$4].[$5].$NANO + [$2]_RELEASE=`date +%Y%m%d_%H%M%S` + dnl execute action + ifelse([$8], , :, [$8]) + fi + + [$2]_VERSION=$VERSION + AC_DEFINE_UNQUOTED([$2]_VERSION, "$[$2]_VERSION", [Define the version]) + AC_SUBST([$2]_VERSION) + + AC_SUBST([$2]_RELEASE) + + AC_SUBST([$2]_MAJOR_VERSION) + AC_SUBST([$2]_MINOR_VERSION) + AC_SUBST([$2]_MICRO_VERSION) + AC_SUBST([$2]_NANO_VERSION) + AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define the package name]) + AC_SUBST(PACKAGE) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define the version]) + AC_SUBST(VERSION) +]) diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/pixmaps/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/pixmaps/Makefile.am Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,11 @@ +# Adding the application icon +#icondir = $(datadir)/mmyth/pixmaps +#icon_DATA = \ +# mmyth.png + + +# Adding the application resources +pixmapdir = $(pkgdatadir)/pixmaps +pixmap_DATA = mmyth_logo.png + +EXTRA_DIST = $(pixmap_DATA) diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/pixmaps/mmyth_logo.png Binary file maemo-ui-old/pixmaps/mmyth_logo.png has changed diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/Makefile.am Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,46 @@ +bin_PROGRAMS = mmyth + +mmyth_SOURCES = \ + mmyth_main.c \ + mmyth_ui.c \ + mmyth_uicommon.c \ + mmyth_epg_grid_view.c \ + mmyth_epg_grid_widget.c \ + mmyth_recordui.c \ + mmyth_uisettings.c \ + mmyth_schedulerui.c \ + mmyth_tvplayer.c + +mmyth_CFLAGS = \ + $(GTK_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(GST_CFLAGS) \ + $(GSTBASE_CFLAGS) \ + $(GSTPLUGINSBASE_CFLAGS) \ + $(MYSQL_CFLAGS) \ + $(LIBGMYTH_CFLAGS) \ + -I$(top_srcdir)/src \ + -DDATA_DIR=\""$(pkgdatadir)"\" \ + -DPIX_DIR=\""$(pkgdatadir)/pixmaps/"\" \ + -DICON_DIR=\""$(datadir)/pixmaps/"\" \ + -g3 -O0 + +if MAEMO_PLATFORM +mmyth_CFLAGS+= \ + $(HILDON_CFLAGS) +endif + +mmyth_LDADD = \ + $(LIBGMYTH_LIBS) \ + $(GTK_LIBS) \ + $(GLIB_LIBS) \ + $(GST_LIBS) \ + $(GSTBASE_LIBS) \ + $(GSTPLUGINSBASE_LIBS) \ + $(GSTINTERFACES_LIBS) + +if MAEMO_PLATFORM +mmyth_LDADD += \ + $(HILDON_LIBS) +endif + diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_epg_grid_view.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_epg_grid_view.c Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,243 @@ +#include +#include +#include +#include +#include + +#include "mmyth_epg_grid_view.h" +#include "mmyth_epg_grid_widget.h" + +/* + * Service genre + */ +#define GENRE_MIN 0 +#define GENRE_MAX 10 +#define GENRE_UNDEFINED 0 +#define GENRE_MOVIE 1 +#define GENRE_NEWS 2 +#define GENRE_SHOW 3 +#define GENRE_SPORTS 4 +#define GENRE_CHILDREN 5 +#define GENRE_MUSIC 6 +#define GENRE_CULTURE 7 +#define GENRE_SOCIAL 8 +#define GENRE_EDUCATION 9 +#define GENRE_LEISURE 10 + +#define NRO_HOURS 3 + +/* + * Function prototypes + */ +static void update_service_details(MMythEpgGridWidget * object, + gpointer arg1, gpointer user_data); +static gboolean key_press_epg_grid_view(GtkWidget * widget, + GdkEventKey * event, + gpointer user_data); + +static GtkWidget *mmyth_epg_grid_widget = NULL; + +/* + * is a GtkEventBox + */ +static GtkWidget *program_details_area = NULL; +static GtkWidget *details_main_hbox = NULL; +static GtkWidget *details_vbox = NULL; +static GtkWidget *details_logo_vbox = NULL; + +/* + * update signal callback from MMythEpgGridWidget + */ +static void +update_service_details(MMythEpgGridWidget * object, gpointer arg1, + gpointer user_data) +{ + g_return_if_fail(arg1 != NULL); + + EpgGridItem *epg_grid_item = (EpgGridItem *) arg1; + + gchar sel_prog_desc[100] = ""; + gchar time_buffer[50]; + + /* + * FIXME: get first content from content_list + */ + GMythProgramInfo *proginfo = + (GMythProgramInfo *) epg_grid_item->proginfo; + + if (proginfo) { + GString *prog_name = proginfo->title; + GString *service_name = proginfo->chanid; + + if (details_vbox != NULL) + gtk_container_remove(GTK_CONTAINER(details_main_hbox), + details_vbox); + + /* + * update service description + */ + strcat(sel_prog_desc, service_name->str); + strcat(sel_prog_desc, ""); + + GtkWidget *fst_line_lbl = gtk_label_new(NULL); + gtk_misc_set_alignment(GTK_MISC(fst_line_lbl), 0.0, 0.0); + gtk_label_set_markup(GTK_LABEL(fst_line_lbl), sel_prog_desc); + + /* + * freeing char[] + */ + sel_prog_desc[0] = 0; + strcat(sel_prog_desc, "\t"); + strcat(sel_prog_desc, prog_name->str); + + struct tm loctime_start, + loctime_end; + + // Convert it to local time representation. + /* + * FIXME: conversion from time to localtime is different in + * different machines + */ + long int schedule_start_time = proginfo->startts->tv_sec; + long int schedule_end_time = proginfo->endts->tv_sec; + + if (localtime_r(&schedule_start_time, &loctime_start) == NULL) { + g_warning("localtime_r error in mmyth_epg_grid_view!\n"); + } +#if 0 + fprintf(stderr, asctime(loctime_start)); +#endif + + strftime(time_buffer, 100, " %H:%M - ", &loctime_start); + strcat(sel_prog_desc, time_buffer); + + if (localtime_r(&schedule_end_time, &loctime_end) == NULL) { + g_warning("localtime_r error in mmyth_epg_grid_view!\n"); + } +#if 0 + fprintf(stderr, asctime(loctime_end)); +#endif + + strftime(time_buffer, 100, "%H:%M\n", &loctime_end); + strcat(sel_prog_desc, time_buffer); + + GtkWidget *snd_line_lbl = gtk_label_new(NULL); + gtk_misc_set_alignment(GTK_MISC(snd_line_lbl), 0.0, 0.0); + gtk_label_set_markup(GTK_LABEL(snd_line_lbl), sel_prog_desc); + + // add the current selected program description to the label + details_vbox = gtk_vbox_new(FALSE, 0); + GtkWidget *fst_line_hbox = gtk_hbox_new(FALSE, 0); + + gtk_box_pack_start(GTK_BOX(fst_line_hbox), + fst_line_lbl, FALSE, FALSE, 6); + gtk_box_pack_start(GTK_BOX(details_vbox), + fst_line_hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(details_vbox), + snd_line_lbl, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(details_main_hbox), + details_vbox, FALSE, FALSE, 0); + + gtk_widget_show_all(details_main_hbox); + } +} + +/* + * Callback for hardware keys + */ +static gboolean +key_press_epg_grid_view(GtkWidget * widget, + GdkEventKey * event, gpointer user_data) +{ + MMythEpgGridWidget *mmyth_epg_grid_widget = + (MMythEpgGridWidget *) user_data; + + return mmyth_epg_grid_widget_key_press(mmyth_epg_grid_widget, widget, + event); +} + +GtkWidget * +epg_grid_view_new(MMythUi * mmyth_ui) +{ + GtkWidget *scrolled_window; + scrolled_window = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), + GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + + gtk_widget_modify_bg(scrolled_window, GTK_STATE_NORMAL, + &main_bg_color); + + GtkWidget *main_vbox = gtk_vbox_new(FALSE, 0); + // gtk_container_set_border_width(main_vbox, 4); + + GtkWidget *details_event_box = gtk_event_box_new(); + gtk_widget_modify_bg(details_event_box, GTK_STATE_NORMAL, + &main_bg_color); + + program_details_area = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(details_event_box), + program_details_area); + gtk_container_set_border_width(GTK_CONTAINER(program_details_area), 4); + + details_main_hbox = gtk_hbox_new(FALSE, 10); + + gtk_box_pack_start(GTK_BOX(program_details_area), + details_main_hbox, FALSE, FALSE, 0); + + details_logo_vbox = gtk_vbox_new(FALSE, 0); + + GtkWidget *details_desc_vbox = gtk_vbox_new(FALSE, 0); + + gtk_box_pack_start(GTK_BOX(details_main_hbox), + details_desc_vbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(details_main_hbox), + details_logo_vbox, FALSE, FALSE, 0); + + gtk_widget_set_size_request(program_details_area, -1, 120); + + mmyth_epg_grid_widget = mmyth_epg_grid_widget_new(); + g_signal_connect(mmyth_epg_grid_widget, "selection_updated", + G_CALLBACK(update_service_details), NULL); + + /* + * select by default the first service + */ + /* + * depends on mount services + */ + if (MMYTH_EPG_GRID_WIDGET(mmyth_epg_grid_widget)->epg_view_model) { + GList *fst_service = (GList *) + MMYTH_EPG_GRID_WIDGET(mmyth_epg_grid_widget)->epg_view_model-> + data; + mmyth_epg_grid_widget_update_service(MMYTH_EPG_GRID_WIDGET + (mmyth_epg_grid_widget), + fst_service); + } + + gtk_box_pack_start(GTK_BOX(main_vbox), + details_event_box, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(main_vbox), + gtk_hseparator_new(), FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(main_vbox), + mmyth_epg_grid_widget, FALSE, FALSE, 0); + + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW + (scrolled_window), main_vbox); + + /* + * Add hardware button listener to application + */ + g_signal_connect(mmyth_ui->main_window, "key_press_event", + G_CALLBACK(key_press_epg_grid_view), + mmyth_epg_grid_widget); + + gtk_widget_show_all(scrolled_window); + + return scrolled_window; +} + +/* + * DVBHScheduleEvent * mmyth_epg_grid_view_get_selected_schedule() { + * return mmyth_epg_grid_get_selected_schedule + * (MMYTH_EPG_GRID_WIDGET(mmyth_epg_grid_widget)); } + */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_epg_grid_view.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_epg_grid_view.h Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,8 @@ +#ifndef MMYTH_ESG_GRID_VIEW_H_ +#define MMYTH_ESG_GRID_VIEW_H_ + +#include "mmyth_ui.h" + +GtkWidget *epg_grid_view_new(MMythUi * mmyth_ui); + +#endif /* MMYTH_ESG_GRID_VIEW_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_epg_grid_widget.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_epg_grid_widget.c Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,776 @@ +#include +#include +#include + +#include "mmyth_uicommon.h" +#include "mmyth_epg_grid_widget.h" + +#include +#include + +#define PIXELS_HOUR 105 +#define PROGRAM_SEPARATION 2 + +enum { + SELECTION_UPDATED_SIGNAL, + LAST_SIGNAL +}; + +struct _MMythEpgGridWidgetPrivate { + /* + * private widget components + */ + GtkWidget *epg_channels_vbox; + GtkWidget *epg_programs_vbox; + + GHashTable *service_model_hash; + + /* + * guidegrid attributes + */ + gboolean show_favorites; + gint current_start_channel_id; + + GTimeVal *current_start_time; + GTimeVal *current_end_time; + + guint selected_channel_index; + + /* + * GList of ProgramInfo for each Channel + */ + GList *program_list[MAX_DISPLAY_CHANS]; + GList *channel_list; + + GMythEPG *mmyth_epg; + + GMythBackendInfo *backend_info; + + gint DISPLAY_CHANS; +}; + +static void mmyth_epg_grid_widget_class_init(MMythEpgGridWidgetClass * + klass); +static void mmyth_epg_grid_widget_init(MMythEpgGridWidget * object); +static void +mmyth_epg_grid_widget_private_init(MMythEpgGridWidgetPrivate * private); +static void mmyth_epg_grid_widget_mount_services(MMythEpgGridWidget * + object, + GTimeVal * start_time, + GTimeVal * end_time); +static void mmyth_epg_grid_widget_mount_header(MMythEpgGridWidget * + object); +static void mmyth_epg_grid_widget_clicked(GtkWidget * widget, + GdkEventExpose * event, + gpointer data); +static GtkWidget *create_event_box_lbl(gchar * str, int width, + const GdkColor * bg_color, + const GdkColor * fg_color); + +static void +mmyth_epg_grid_widget_fill_programinfos(MMythEpgGridWidgetPrivate * + private); +static void +mmyth_epg_grid_widget_fill_program_row_infos(MMythEpgGridWidgetPrivate * + private, unsigned int chanNum, + unsigned int row); + +static gint mmyth_epg_grid_widget_signals[LAST_SIGNAL] = { 0 }; + +G_DEFINE_TYPE(MMythEpgGridWidget, mmyth_epg_grid_widget, + GTK_TYPE_EVENT_BOX) + + static void + + + + + + + + + + + + + + mmyth_epg_grid_widget_class_init(MMythEpgGridWidgetClass * klass) +{ + g_type_class_add_private(klass, sizeof(MMythEpgGridWidgetPrivate)); + + mmyth_epg_grid_widget_signals[SELECTION_UPDATED_SIGNAL] = + g_signal_new("selection_updated", G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_FIRST, 0, NULL, NULL, + g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, + G_TYPE_POINTER); +} + +static void +mmyth_epg_grid_widget_private_init(MMythEpgGridWidgetPrivate * private) +{ + time_t cur_time; + + g_return_if_fail(private != NULL); + + private->epg_channels_vbox = NULL; + private->epg_programs_vbox = NULL; + private->service_model_hash = NULL; + + private->show_favorites = FALSE; + private->current_start_channel_id = -1; + + /* + * Selected the first diplayable channel initially + */ + private->selected_channel_index = 0; + + /* + * TODO fix the current start/end time + */ + private->current_start_time = g_new0(GTimeVal, 1); + private->current_start_time->tv_sec = time(&cur_time); + + private->current_end_time = g_new0(GTimeVal, 1); + private->current_end_time->tv_sec = time(&cur_time) + 10800; + + private->DISPLAY_CHANS = MAX_DISPLAY_CHANS; + + private->backend_info = + gmyth_backend_info_new_full("localhost", "mythtv", "mythtv", + "mythconverg", 6543); + + // TODO: Close the epg and unref it in dispose call + private->mmyth_epg = gmyth_epg_new(); + if (!gmyth_epg_connect(private->mmyth_epg, private->backend_info)) { + g_warning("[%s] Could not connect mysql handler to db", + __FUNCTION__); + g_object_unref(private->mmyth_epg); + private->mmyth_epg = NULL; + } +} + +static void +mmyth_epg_grid_widget_init(MMythEpgGridWidget * mmyth_epg_grid_widget) +{ + MMythEpgGridWidgetPrivate *private = + MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(mmyth_epg_grid_widget); + + /* + * init private fields + */ + mmyth_epg_grid_widget_private_init(private); + + mmyth_epg_grid_widget->epg_view_model = NULL; + mmyth_epg_grid_widget->selected_grid_item = NULL; + + GtkWidget *epg_event_box = GTK_WIDGET(mmyth_epg_grid_widget); + gtk_widget_modify_bg(epg_event_box, GTK_STATE_NORMAL, &main_bg_color); + gtk_widget_set_size_request(epg_event_box, 0, 125); + + GtkWidget *epg_main_hbox = gtk_hbox_new(FALSE, 10); + gtk_container_set_border_width(GTK_CONTAINER(epg_main_hbox), 10); + + gtk_container_add(GTK_CONTAINER(epg_event_box), epg_main_hbox); + + /* + * channels vbox + */ + GtkWidget *epg_channels_vbox = gtk_vbox_new(FALSE, 3); + private->epg_channels_vbox = epg_channels_vbox; + + /* + * programs vbox + */ + GtkWidget *epg_programs_vbox = gtk_vbox_new(FALSE, 3); + private->epg_programs_vbox = epg_programs_vbox; + + /* + * packing start + */ + gtk_box_pack_start(GTK_BOX(epg_main_hbox), + epg_channels_vbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(epg_main_hbox), + epg_programs_vbox, FALSE, FALSE, 0); + + /* + * table header (first line) + */ + mmyth_epg_grid_widget_mount_header(mmyth_epg_grid_widget); + + /* + * service programs + */ + /* + * mount service programs with current time + */ + mmyth_epg_grid_widget_mount_services(mmyth_epg_grid_widget, + private->current_start_time, + private->current_end_time); +} + +GtkWidget * +mmyth_epg_grid_widget_new() +{ + return GTK_WIDGET(gtk_type_new(mmyth_epg_grid_widget_get_type())); +} + +static void +mmyth_epg_grid_widget_mount_services(MMythEpgGridWidget * + mmyth_epg_grid_widget, + GTimeVal * start_time, + GTimeVal * end_time) +{ + GList *proglist; + GList *channel_list = NULL; + GMythChannelInfo *channel_info; + + int chanid; + MMythEpgGridWidgetPrivate *private = + MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(mmyth_epg_grid_widget); + + // update view_model + /* + * FIXME shallow free or recursive? + */ + if (mmyth_epg_grid_widget->epg_view_model != NULL) { + g_list_free(mmyth_epg_grid_widget->epg_view_model); + mmyth_epg_grid_widget->epg_view_model = NULL; + } + + if (private->service_model_hash != NULL) { + g_hash_table_destroy(private->service_model_hash); + } + + private->service_model_hash = g_hash_table_new(NULL, NULL); + + /* + * fill program infos from db + */ + mmyth_epg_grid_widget_fill_programinfos(private); + + channel_list = private->channel_list; + + /* + * for each channel get_programs() + */ + for (chanid = 0; channel_list && + chanid < private->DISPLAY_CHANS; chanid++) { + proglist = (GList *) private->program_list[chanid]; + + channel_info = (GMythChannelInfo *) channel_list->data; + channel_list = g_list_next(channel_list); + + /* + * Service Title + */ + GString *name = NULL; + if (channel_info->channel_name) + name = g_string_new(channel_info->channel_name->str); + + GdkColor title_bg_color; + title_bg_color.red = 5000; + title_bg_color.green = 9000; + title_bg_color.blue = 40000; + + GdkColor title_fg_color; + title_fg_color.red = 60000; + title_fg_color.green = 60000; + title_fg_color.blue = 60000; + + GtkWidget *event_box_channel = + create_event_box_lbl(name->str, 90, + &title_bg_color, + &title_fg_color); + + gtk_box_pack_start(GTK_BOX(private->epg_channels_vbox), + event_box_channel, FALSE, FALSE, 0); + + GtkWidget *epg_line_hbox = gtk_hbox_new(FALSE, 0); + + GdkColor bg_color; + bg_color.red = 5000; + bg_color.green = 30000; + bg_color.blue = 60000; + + GdkColor fg_color; + fg_color.red = 60000; + fg_color.green = 60000; + fg_color.blue = 60000; + + /* + * Content parsing + */ + GList *epg_grid_list = NULL; + + GMythProgramInfo *proginfo; + int pixel_count = 0; + for (; proglist; proglist = proglist->next) { + proginfo = (GMythProgramInfo *) proglist->data; + + GString *content_name = proginfo->title; + + GTimeVal *initial_time = g_new0(GTimeVal, 1); + GTimeVal *last_time = g_new0(GTimeVal, 1); + GTimeVal *duration = g_new0(GTimeVal, 1); + + GTimeVal *schedule_start_time = proginfo->startts; + GTimeVal *schedule_end_time = proginfo->endts; + + initial_time->tv_sec = + (schedule_start_time->tv_sec < + start_time->tv_sec) ? start_time-> + tv_sec : schedule_start_time->tv_sec; + last_time->tv_sec = + (schedule_end_time->tv_sec > + end_time->tv_sec) ? end_time->tv_sec : schedule_end_time-> + tv_sec; + duration->tv_sec = last_time->tv_sec - initial_time->tv_sec; + + // Verify program time +#if 0 + g_debug("ServiceID: %d, ScheduleID: %d\n", service->id, + schedule->id); + fprintf(stderr, "program time\nfrom = %d, to = %d\n", + schedule->validFrom, schedule->validTo); + + struct tm loctime; + + /* + * Convert it to local time representation. + */ + if (localtime_r((time_t *) & schedule->validFrom, &loctime) == + NULL) { + g_warning("localtime_r error in mmyth_epg_grid_widget!\n"); + return NULL; + } + fprintf(stderr, asctime(&loctime)); + + if (localtime_r((time_t *) & schedule->validTo, &loctime) == + NULL) { + g_warning("localtime_r error in mmyth_epg_grid_widget!\n"); + return NULL; + } + fprintf(stderr, asctime(&loctime)); +#endif + + /* + * fprintf(stderr, "duration = %d\n", duration); + */ + double duration_hour = + duration->tv_sec / (double) 3600.0; + /* + * fprintf(stderr, "duration_hour = %lf\n", duration_hour); + */ + + int size = PIXELS_HOUR * duration_hour; + + /* + * complete hour + */ + /* + * FIXME: UGLY WRONG HACK TO ALIGN PROGRAM TIME!!! + */ + if (last_time->tv_sec % 3600 != 0) { + size -= PROGRAM_SEPARATION; + } + if (initial_time->tv_sec % 3600 != 0) { + size -= PROGRAM_SEPARATION; + } + + pixel_count += size + PROGRAM_SEPARATION; + GtkWidget *event_box = + create_event_box_lbl(content_name->str, + size, &bg_color, + &fg_color); + gtk_widget_add_events(event_box, + GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK); + + /* + * create EpgGridItem + */ + EpgGridItem *epg_grid_item = g_new0(EpgGridItem, 1); + epg_grid_item->proginfo = proginfo; + epg_grid_item->event_box = event_box; + epg_grid_item->object = mmyth_epg_grid_widget; + + epg_grid_list = + g_list_prepend(epg_grid_list, (gpointer) epg_grid_item); + + gtk_box_pack_start(GTK_BOX(epg_line_hbox), + event_box, FALSE, FALSE, + PROGRAM_SEPARATION); + + g_signal_connect(G_OBJECT(event_box), "button-press-event", + G_CALLBACK(mmyth_epg_grid_widget_clicked), + (gpointer *) epg_grid_list); + } +#if 0 + printf("chaind = %d!!!!" chanid); + fflush(stdout); +#endif + + if (!epg_grid_list) { + /* + * No programs for current channel + */ + /* + * FIXME: size HARDCODED + */ + GtkWidget *event_box = + create_event_box_lbl("No program list available", + PIXELS_HOUR * 3, &bg_color, + &fg_color); + gtk_widget_add_events(event_box, + GDK_BUTTON_PRESS_MASK | + GDK_BUTTON_RELEASE_MASK); + + /* + * create EpgGridItem + */ + EpgGridItem *epg_grid_item = g_new0(EpgGridItem, 1); + epg_grid_item->proginfo = NULL; + epg_grid_item->event_box = event_box; + epg_grid_item->object = mmyth_epg_grid_widget; + + epg_grid_list = + g_list_prepend(epg_grid_list, (gpointer) epg_grid_item); + + gtk_box_pack_start(GTK_BOX(epg_line_hbox), + event_box, FALSE, FALSE, + PROGRAM_SEPARATION); + + g_signal_connect(G_OBJECT(event_box), "button-press-event", + G_CALLBACK(mmyth_epg_grid_widget_clicked), + (gpointer *) epg_grid_list); + } + + epg_grid_list = g_list_reverse(epg_grid_list); + mmyth_epg_grid_widget->epg_view_model = + g_list_append(mmyth_epg_grid_widget->epg_view_model, + epg_grid_list); + + gtk_box_pack_start(GTK_BOX(private->epg_programs_vbox), + epg_line_hbox, FALSE, FALSE, 0); + } +} + +static void +mmyth_epg_grid_widget_mount_header(MMythEpgGridWidget * + mmyth_epg_grid_widget) +{ + MMythEpgGridWidgetPrivate *private = + MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(mmyth_epg_grid_widget); + + struct tm hour_tm; + const gchar name_title[] = "Today"; + GtkWidget *lbl_title = gtk_label_new(name_title); + + gtk_misc_set_alignment(GTK_MISC(lbl_title), 0.0, 0.5); + + gtk_box_pack_start(GTK_BOX(private->epg_channels_vbox), + lbl_title, FALSE, FALSE, 0); + + /* + * hours title line + */ + GtkWidget *epg_programs_hours_hbox = gtk_hbox_new(TRUE, 0); + + if (localtime_r + ((time_t *) & private->current_start_time->tv_sec, + &hour_tm) == NULL) { + g_warning("localtime_r error in mmyth_epg_grid_widget!\n"); + return; + } + + if (hour_tm.tm_min > 30) { + hour_tm.tm_min = 30; + } else if (hour_tm.tm_min > 0) { + hour_tm.tm_min = 0; + } + + gchar hour1_str[10]; + strftime(hour1_str, 8, "%H:%M", &hour_tm); + GtkWidget *lbl_hour1 = gtk_label_new(hour1_str); + gtk_misc_set_alignment(GTK_MISC(lbl_hour1), 0.0, 0.5); + + hour_tm.tm_hour++; + gchar hour2_str[10]; + strftime(hour2_str, 8, "%H:%M", &hour_tm); + GtkWidget *lbl_hour2 = gtk_label_new(hour2_str); + gtk_misc_set_alignment(GTK_MISC(lbl_hour2), 0.0, 0.5); + + hour_tm.tm_hour++; + gchar hour3_str[10]; + strftime(hour3_str, 8, "%H:%M", &hour_tm); + GtkWidget *lbl_hour3 = gtk_label_new(hour3_str); + gtk_misc_set_alignment(GTK_MISC(lbl_hour3), 0.0, 0.5); + + gtk_box_pack_start(GTK_BOX(epg_programs_hours_hbox), + lbl_hour1, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(epg_programs_hours_hbox), + lbl_hour2, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(epg_programs_hours_hbox), + lbl_hour3, TRUE, TRUE, 0); + + gtk_box_pack_start(GTK_BOX(private->epg_programs_vbox), + epg_programs_hours_hbox, FALSE, FALSE, 0); +} + +/****************************************************************************** + * INTERNAL CALLBACKS FOR STATE CHANGE * + *****************************************************************************/ +static void +mmyth_epg_grid_widget_deselect_service(MMythEpgGridWidget * + mmyth_epg_grid_widget) +{ + EpgGridItem *epg_grid_item; + + /* + * deselect + */ + if (mmyth_epg_grid_widget->selected_grid_item != NULL) { + epg_grid_item = + (EpgGridItem *) mmyth_epg_grid_widget->selected_grid_item-> + data; + gtk_widget_set_state(GTK_WIDGET(epg_grid_item->event_box), + GTK_STATE_NORMAL); + } +} + +static void +mmyth_epg_grid_widget_clicked(GtkWidget * widget, + GdkEventExpose * event, gpointer data) +{ + g_return_if_fail(data != NULL); + + GList *epg_grid_item_list = (GList *) data; + EpgGridItem *epg_grid_item = + (EpgGridItem *) epg_grid_item_list->data; + + /* + * update the selected service + */ + mmyth_epg_grid_widget_update_service(epg_grid_item->object, + (GList *) data); +} + +void +mmyth_epg_grid_widget_update_service(MMythEpgGridWidget * object, + GList * selected_grid_list) +{ + g_return_if_fail(object != NULL); + g_return_if_fail(selected_grid_list != NULL); + + EpgGridItem *epg_grid_item = + (EpgGridItem *) selected_grid_list->data; + + mmyth_epg_grid_widget_deselect_service(epg_grid_item->object); + + /* + * updating current selected schedule_item and schedule_list + */ + object->selected_grid_item = selected_grid_list; + + /* + * set state of the event box + */ + gtk_widget_set_state(GTK_WIDGET(epg_grid_item->event_box), + GTK_STATE_SELECTED); + /* + * emit update signal for listeners + */ + g_signal_emit(object, + mmyth_epg_grid_widget_signals[SELECTION_UPDATED_SIGNAL], + 0, (gpointer) epg_grid_item); +} + +static GtkWidget * +create_event_box_lbl(gchar * str, int width, const GdkColor * bg_color, + const GdkColor * fg_color) +{ + GtkWidget *event_box = gtk_event_box_new(); + GtkWidget *lbl = gtk_label_new(str); + gtk_label_set_ellipsize(GTK_LABEL(lbl), PANGO_ELLIPSIZE_END); + + gtk_widget_modify_bg(event_box, GTK_STATE_NORMAL, bg_color); + gtk_widget_modify_fg(lbl, GTK_STATE_NORMAL, fg_color); + + /* + * selected colors are const + */ + GdkColor selected_bg_color; + selected_bg_color.red = 100; + selected_bg_color.green = 40000; + selected_bg_color.blue = 100; + + GdkColor selected_fg_color; + selected_fg_color.red = 100; + selected_fg_color.green = 100; + selected_fg_color.blue = 100; + + gtk_widget_modify_bg(event_box, GTK_STATE_SELECTED, + &selected_bg_color); + gtk_widget_modify_fg(lbl, GTK_STATE_SELECTED, &selected_fg_color); + + gtk_misc_set_alignment(GTK_MISC(lbl), 0.0, 0.5); + gtk_container_add(GTK_CONTAINER(event_box), lbl); + gtk_widget_set_size_request(event_box, width, -1); + + return event_box; +} + +/****************************************************************************** + * METHODS * + *****************************************************************************/ + +/* + * Callback for hardware keys + */ +gboolean +mmyth_epg_grid_widget_key_press(MMythEpgGridWidget * object, + GtkWidget * widget, GdkEventKey * event) +{ + MMythEpgGridWidgetPrivate *private = + MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(object); + + EpgGridItem *epg_grid_item; + GList *tmp; + + /* + * List of selected_grid_item + */ + GList *selected_view_model; + + gint channel_index; + + if (object->selected_grid_item == NULL) { + g_warning("No program selected"); + return FALSE; + } + + epg_grid_item = (EpgGridItem *) object->selected_grid_item->data; + + channel_index = private->selected_channel_index; + + switch (event->keyval) { + case GDK_Up: + selected_view_model = + g_list_nth(object->epg_view_model, channel_index - 1); + if (selected_view_model != NULL) { + private->selected_channel_index = channel_index - 1; + tmp = (GList *) selected_view_model->data; + /* + * TODO: select a better centralized item currently is + * picking the 1st or last item + */ + if (g_list_next(object->selected_grid_item) == NULL && + g_list_previous(object->selected_grid_item) != NULL) { + /* + * in this case the new selected will be the last + */ + tmp = g_list_last(tmp); + } + + /* + * update the selected service + */ + mmyth_epg_grid_widget_update_service(object, tmp); + } + return TRUE; + case GDK_Down: + selected_view_model = + g_list_nth(object->epg_view_model, channel_index + 1); + if (selected_view_model != NULL) { + private->selected_channel_index = channel_index + 1; + tmp = (GList *) selected_view_model->data; + /* + * TODO: select a better centralized item currently is + * picking the 1st or last item + */ + if (g_list_next(object->selected_grid_item) == NULL && + g_list_previous(object->selected_grid_item) != NULL) { + /* + * in this case the new selected will be the last + */ + tmp = g_list_last(tmp); + } + + /* + * update the selected service + */ + mmyth_epg_grid_widget_update_service(object, tmp); + } + return TRUE; + case GDK_Left: + tmp = g_list_previous(object->selected_grid_item); + if (tmp != NULL) { + /* + * update the selected service + */ + mmyth_epg_grid_widget_update_service(object, tmp); + } + return TRUE; + case GDK_Right: + tmp = g_list_next(object->selected_grid_item); + if (tmp != NULL) { + /* + * update the selected service + */ + mmyth_epg_grid_widget_update_service(object, tmp); + } + return TRUE; + default: + return TRUE; + } + + return FALSE; +} + +static void +mmyth_epg_grid_widget_fill_programinfos(MMythEpgGridWidgetPrivate * + private) +{ + GList *channels_list = NULL; + int y; + + if ((private->mmyth_epg != NULL) && + (gmyth_epg_get_channel_list(private->mmyth_epg, &channels_list) < + 0)) { + private->channel_list = NULL; + return; + } + + private->channel_list = channels_list; + + for (y = 0; y < private->DISPLAY_CHANS && channels_list; y++) { + GMythChannelInfo *channel_info = + (GMythChannelInfo *) channels_list->data; + + mmyth_epg_grid_widget_fill_program_row_infos(private, + channel_info-> + channel_ID, y); + + channels_list = g_list_next(channels_list); + } +} + +static void +mmyth_epg_grid_widget_fill_program_row_infos(MMythEpgGridWidgetPrivate * + private, guint chanNum, + guint row) +{ + gint res = gmyth_epg_get_program_list(private->mmyth_epg, + &(private-> + program_list[row]), + chanNum, + private-> + current_start_time, + private-> + current_end_time); + + if (res < 0) { + g_warning("[%s] Error while retrieving epg programs", + __FUNCTION__); + } +} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_epg_grid_widget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_epg_grid_widget.h Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,87 @@ +#ifndef __MMYTH_EPG_GRID_WIDGET_H__ +#define __MMYTH_EPG_GRID_WIDGET_H__ + +#include +#include +#include +#include + +#include +#include +#define MAX_DISPLAY_CHANS 4 + +G_BEGIN_DECLS +#define MMYTH_EPG_GRID_WIDGET_TYPE (mmyth_epg_grid_widget_get_type ()) +#define MMYTH_EPG_GRID_WIDGET(obj) (GTK_CHECK_CAST ((obj), MMYTH_EPG_GRID_WIDGET_TYPE, MMythEpgGridWidget)) +#define MMYTH_EPG_GRID_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), MMYTH_EPG_GRID_WIDGET_TYPE, MMythEpgGridWidgetClass)) +#define IS_MMYTH_EPG_GRID_WIDGET(obj) (GTK_CHECK_TYPE ((obj), MMYTH_EPG_GRID_WIDGET_TYPE)) +#define IS_MMYTH_EPG_GRID_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MMYTH_EPG_GRID_WIDGET_TYPE)) +#define MMYTH_EPG_GRID_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MMYTH_EPG_GRID_WIDGET_TYPE, MMythEpgGridWidgetClass)) +#define MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MMYTH_EPG_GRID_WIDGET_TYPE, MMythEpgGridWidgetPrivate)) +typedef struct _MMythEpgGridWidget MMythEpgGridWidget; +typedef struct _MMythEpgGridWidgetClass MMythEpgGridWidgetClass; +typedef struct _MMythEpgGridWidgetPrivate MMythEpgGridWidgetPrivate; + +struct _MMythEpgGridWidgetClass { + GtkEventBoxClass parent_class; + + /* + * callbacks + */ + /* + * no one for now + */ +}; + +struct _MMythEpgGridWidget { + GtkEventBox event_box; + + /* + * Selected Widgets Logic + */ + /* + * List os Service Model in the current view the data of this list are + * GList for the programs of each service + */ + GList *epg_view_model; + + /* + * Selected Schedule Item + */ + GList *selected_grid_item; + +}; + + +GType mmyth_epg_grid_widget_get_type(void); +GtkWidget *mmyth_epg_grid_widget_new(void); +/* + * DVBHScheduleEvent* mmyth_epg_grid_get_selected_schedule + * (MMythEpgGridWidget * object); + */ +void mmyth_epg_grid_widget_update_service(MMythEpgGridWidget * + object, + GList * + epg_grid_item_node); +gboolean mmyth_epg_grid_widget_key_press(MMythEpgGridWidget * + object, GtkWidget * widget, + GdkEventKey * event); + +typedef struct _EpgGridItem EpgGridItem; + +/* + * FIXME: auxiliary struct + */ +struct _EpgGridItem { + + GMythProgramInfo *proginfo; + GtkWidget *event_box; + + /* + * for callback purposes + */ + MMythEpgGridWidget *object; +}; + +G_END_DECLS +#endif /* __MMYTH_EPG_GRID_WIDGET_H__ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_main.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_main.c Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,122 @@ + +#include + +#include "config.h" + +#ifdef MAEMO_PLATFORM +#include "hildon-widgets/hildon-program.h" +#include "hildon-widgets/hildon-window.h" +#endif + +#include +#include +#include +#include + +#include "mmyth_ui.h" +#include "mmyth_tvplayer.h" + +static void +cb_destroy(GtkWidget * widget, gpointer data) +{ + MMythUi *mmyth_ui = (MMythUi *) data; + + if (mmyth_ui->tvplayer != NULL) { + if (mmyth_tvplayer_is_playing(mmyth_ui->tvplayer)) + mmyth_tvplayer_stop_playing(mmyth_ui->tvplayer); + } + + mmyth_ui_finalize(mmyth_ui); + + gtk_main_quit(); +} + +#ifdef NDEBUG +static void +debug_error_func(const gchar * log_domain, GLogLevelFlags log_level, + const gchar * message, gpointer user_data) +{ + /* + * leave this with NO print out messages, once you need to disable + * debug messages! + */ + // g_print ( "[%s] DEBUG messages disabled!\n", __FUNCTION__ ); +} +#endif + +gint +main(gint argc, gchar * argv[]) +{ + GtkWidget *window; + MMythUi *mmyth_ui; +#ifdef MAEMO_PLATFORM + HildonProgram *program = NULL; +#endif + + /* + * init threads + */ + g_thread_init(NULL); + + /* + * Initializes GTK + */ + gtk_init(&argc, &argv); + gst_init(&argc, &argv); +#ifdef NDEBUG + g_log_set_default_handler(debug_error_func, NULL); +#endif + + /* + * Init libmmyth context + */ + /* + * TODO + */ +#ifndef MAEMO_PLATFORM + /* + * create the main window + */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_widget_set_size_request(window, MAIN_WINDOW_WIDTH, + MAIN_WINDOW_HEIGHT); + gtk_window_set_title(GTK_WINDOW(window), "Mythtv Frontend"); +#else + /* + * Creating Hildonized main view + */ + program = HILDON_PROGRAM(hildon_program_get_instance()); + window = hildon_window_new(); + + // g_signal_connect(G_OBJECT(window), "delete_event", gtk_main_quit, + // NULL); + + hildon_program_add_window(program, HILDON_WINDOW(window)); + g_set_application_name("Maemo Mythtv"); +#endif + + /* + * Initializes MMyth Widgets + */ +#ifdef MAEMO_PLATFORM + mmyth_ui = mmyth_ui_initialize(program, window); +#else + mmyth_ui = mmyth_ui_initialize(window); +#endif + + // mmyth_ui->loop = g_main_loop_new (NULL, FALSE); + + /* + * Connect destroy signal handling + */ + g_signal_connect(window, "destroy", G_CALLBACK(cb_destroy), mmyth_ui); + + /* + * Shows main window and start gtk loop + */ + gtk_widget_show(window); + + gtk_main(); + + return 0; +} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_recordui.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_recordui.c Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,433 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mmyth_ui.h" +#include "mmyth_recordui.h" + +/* + * GMyth library includes + */ +#include +#include + +enum { + START_DATE_COLUMN = 0, + TITLE_COLUMN, + CHAN_ID_COLUMN, + END_TIME_COLUMN, + RECORD_ID_COLUMN, + BASENAME_COLUMN, + N_COLUMNS +}; + +gboolean +mmyth_recordui_reload_all(MMythRecordUI * recordui) +{ + gboolean res = FALSE; + + res = mmyth_recordui_reload_schedule(recordui); + + res = res & mmyth_recordui_reload_record(recordui); + + + if (!res) + g_warning + ("[%s] Error while reloading schedule and recording content", + __FUNCTION__); + + return res; +} + +gboolean +mmyth_recordui_reload_schedule(MMythRecordUI * recordui) +{ + gint new_row = 0; + ScheduleInfo *schedule_info; + GList *schedule_list; + GtkTreeIter iter; + gchar *start_date_time = NULL; + gchar *end_date_time = NULL; + GString *str_aux = g_string_new(""); + gint res; + + gtk_tree_store_clear(recordui->sch_tree_store); + + res = + gmyth_scheduler_get_schedule_list(recordui->scheduler, + &(schedule_list)); + if (res < 0) { + g_warning + ("[%s] Retrieved NULL list of scheduled data from database", + __FUNCTION__); + return FALSE; + } + + for (; schedule_list; schedule_list = schedule_list->next) { + schedule_info = (ScheduleInfo *) schedule_list->data; + + gtk_tree_store_insert(recordui->sch_tree_store, &iter, NULL, + new_row++); + + start_date_time = + gmyth_util_time_to_string_from_time_val(schedule_info-> + start_time); + end_date_time = + gmyth_util_time_to_string_from_time_val(schedule_info-> + end_time); + + g_string_printf(str_aux, "%d", schedule_info->channel_id); + + gtk_tree_store_set(recordui->sch_tree_store, &iter, START_DATE_COLUMN, start_date_time, TITLE_COLUMN, schedule_info->title->str, CHAN_ID_COLUMN, str_aux->str, END_TIME_COLUMN, end_date_time, // It + // doesn't + // appear + RECORD_ID_COLUMN, schedule_info->record_id, -1); // the + // last + // line + // is + // a + // hidden + // item + // to + // be + // used + // in + // searching + // tasks + } + + g_debug("[%s] %d lines added to schedule list UI", __FUNCTION__, + new_row); + + /* + * free allocated memory + */ + if (!start_date_time) + g_free(start_date_time); + if (!end_date_time) + g_free(end_date_time); + g_string_free(str_aux, FALSE); + + return TRUE; +} + +gboolean +mmyth_recordui_reload_record(MMythRecordUI * recordui) +{ + gint new_row = 0; + RecordedInfo *recorded_info; + GList *record_list = NULL; + GtkTreeIter iter; + gchar *start_date_time = NULL; + gchar *end_date_time = NULL; + GString *str_aux = g_string_new(""); + gint res; + + gtk_tree_store_clear(recordui->rec_tree_store); + + res = + gmyth_scheduler_get_recorded_list(recordui->scheduler, + &record_list); + if (res < 0) { + g_warning + ("[%s] Retrieved NULL list of recorded data from database", + __FUNCTION__); + return FALSE; + } + + for (; record_list; record_list = record_list->next) { + recorded_info = (RecordedInfo *) record_list->data; + + gtk_tree_store_insert(recordui->rec_tree_store, &iter, NULL, + new_row++); + + start_date_time = + gmyth_util_time_to_string_from_time_val(recorded_info-> + start_time); + end_date_time = + gmyth_util_time_to_string_from_time_val(recorded_info-> + end_time); + + g_string_printf(str_aux, "%d", recorded_info->channel_id); + + gtk_tree_store_set(recordui->rec_tree_store, &iter, START_DATE_COLUMN, start_date_time, TITLE_COLUMN, recorded_info->title->str, CHAN_ID_COLUMN, str_aux->str, END_TIME_COLUMN, end_date_time, // It + // doesn't + // appear + RECORD_ID_COLUMN, recorded_info->record_id, + BASENAME_COLUMN, recorded_info->basename->str, + -1); + // the last line is a hidden item to be used in searching tasks + } + + g_debug("[%s] %d lines added to record list UI", __FUNCTION__, + new_row); + + /* + * free allocated memory + */ + if (NULL != start_date_time) + g_free(start_date_time); + if (NULL != end_date_time) + g_free(end_date_time); + g_string_free(str_aux, FALSE); + + return TRUE; +} + + +MMythRecordUI * +mmyth_recordui_new(GMythBackendInfo * backend_info) +{ + MMythRecordUI *recordui = g_new0(MMythRecordUI, 1); + + g_return_val_if_fail(backend_info != NULL, NULL); + + recordui->backend_info = backend_info; + + recordui->scrolled_window = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW + (recordui->scrolled_window), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + + recordui->viewport = gtk_viewport_new(NULL, NULL); + gtk_container_add(GTK_CONTAINER(recordui->scrolled_window), + recordui->viewport); + + recordui->notebook = gtk_notebook_new(); + gtk_container_set_border_width(GTK_CONTAINER(recordui->notebook), 1); + gtk_notebook_set_scrollable(GTK_NOTEBOOK(recordui->notebook), TRUE); + gtk_notebook_popup_enable(GTK_NOTEBOOK(recordui->notebook)); + gtk_container_add(GTK_CONTAINER(recordui->viewport), + recordui->notebook); + gtk_notebook_popup_disable(GTK_NOTEBOOK(recordui->notebook)); + + /* + * Schedule tab + */ + recordui->sch_scrolled_window = gtk_scrolled_window_new(NULL, NULL); + gtk_container_add(GTK_CONTAINER(recordui->notebook), + recordui->sch_scrolled_window); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW + (recordui->sch_scrolled_window), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW + (recordui->sch_scrolled_window), + GTK_SHADOW_IN); + + /* + * The basename column in the sched_tree_store is not being used + */ + recordui->sch_tree_store = + gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, + G_TYPE_STRING); + + recordui->sch_treeview = + gtk_tree_view_new_with_model(GTK_TREE_MODEL + (recordui->sch_tree_store)); + gtk_container_add(GTK_CONTAINER(recordui->sch_scrolled_window), + recordui->sch_treeview); + recordui->sch_renderer = gtk_cell_renderer_text_new(); + // g_object_set(G_OBJECT(renderer1), "foreground", "green", + // "background", "black", NULL); + recordui->sch_column1 = + gtk_tree_view_column_new_with_attributes("Start time", + recordui->sch_renderer, + "text", START_DATE_COLUMN, + NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), + recordui->sch_column1); + recordui->sch_column2 = + gtk_tree_view_column_new_with_attributes("Title", + recordui->sch_renderer, + "text", TITLE_COLUMN, + NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), + recordui->sch_column2); + recordui->sch_column3 = + gtk_tree_view_column_new_with_attributes("Channel", + recordui->sch_renderer, + "text", CHAN_ID_COLUMN, + NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), + recordui->sch_column3); + gtk_tree_view_column_set_resizable(recordui->sch_column1, TRUE); + gtk_tree_view_column_set_resizable(recordui->sch_column2, TRUE); + gtk_tree_view_column_set_resizable(recordui->sch_column3, TRUE); + gtk_tree_view_column_set_reorderable(recordui->sch_column1, TRUE); + gtk_tree_view_column_set_reorderable(recordui->sch_column2, TRUE); + gtk_tree_view_column_set_reorderable(recordui->sch_column3, TRUE); + // recordui->sch_column4 = + // gtk_tree_view_column_new_with_attributes("", + // recordui->sch_renderer, "text", END_TIME_COLUMN, NULL); + // gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), + // recordui->sch_column4); + + recordui->sch_label = gtk_label_new(("Schedule")); + gtk_notebook_set_tab_label(GTK_NOTEBOOK(recordui->notebook), + gtk_notebook_get_nth_page(GTK_NOTEBOOK + (recordui-> + notebook), 0), + recordui->sch_label); + + // Record items tab + // g_object_set(G_OBJECT(renderer2), "foreground", "blue", NULL); + recordui->rec_scrolled_window = gtk_scrolled_window_new(NULL, NULL); + gtk_container_add(GTK_CONTAINER(recordui->notebook), + recordui->rec_scrolled_window); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW + (recordui->rec_scrolled_window), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW + (recordui->rec_scrolled_window), + GTK_SHADOW_IN); + + recordui->rec_tree_store = + gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, + G_TYPE_STRING); + recordui->rec_treeview = + gtk_tree_view_new_with_model(GTK_TREE_MODEL + (recordui->rec_tree_store)); + gtk_container_add(GTK_CONTAINER(recordui->rec_scrolled_window), + recordui->rec_treeview); + recordui->rec_renderer = gtk_cell_renderer_text_new(); + // g_object_set(G_OBJECT(renderer1), "foreground", "green", + // "background", "black", NULL); + + recordui->rec_column1 = + gtk_tree_view_column_new_with_attributes("Start time", + recordui->rec_renderer, + "text", START_DATE_COLUMN, + NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), + recordui->rec_column1); + recordui->rec_column2 = + gtk_tree_view_column_new_with_attributes("Title", + recordui->rec_renderer, + "text", TITLE_COLUMN, + NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), + recordui->rec_column2); + recordui->rec_column3 = + gtk_tree_view_column_new_with_attributes("Channel", + recordui->rec_renderer, + "text", CHAN_ID_COLUMN, + NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), + recordui->rec_column3); + gtk_tree_view_column_set_resizable(recordui->rec_column1, TRUE); + gtk_tree_view_column_set_resizable(recordui->rec_column2, TRUE); + gtk_tree_view_column_set_resizable(recordui->rec_column3, TRUE); + gtk_tree_view_column_set_reorderable(recordui->rec_column1, TRUE); + gtk_tree_view_column_set_reorderable(recordui->rec_column2, TRUE); + gtk_tree_view_column_set_reorderable(recordui->rec_column3, TRUE); + // recordui->rec_column4 = + // gtk_tree_view_column_new_with_attributes("", + // recordui->rec_renderer, "text", END_TIME_COLUMN, NULL); + // gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), + // recordui->rec_column4); + + recordui->rec_label = gtk_label_new(("Recorded")); + gtk_notebook_set_tab_label(GTK_NOTEBOOK(recordui->notebook), + gtk_notebook_get_nth_page(GTK_NOTEBOOK + (recordui-> + notebook), 1), + recordui->rec_label); + + // Gets the mmyth scheduler manager + recordui->scheduler = gmyth_scheduler_new(backend_info); + + /* + * init connection to the backend + */ + gmyth_scheduler_connect(recordui->scheduler, + recordui->scheduler->backend_info); + + return recordui; +} + +void +mmyth_recordui_free(MMythRecordUI * recordui) +{ + // FIXME: Release memory here! + /* + * close connection to the backend + */ + gmyth_scheduler_disconnect(recordui->scheduler); +} + +void +mmyth_recordui_delete_selected(GtkButton * button, + MMythRecordUI * recordui) +{ + GtkTreeSelection *selection; + GtkTreeModel *list_store; + GtkTreeIter iter; + int index; + int curr_page = 0; + + curr_page = + gtk_notebook_get_current_page(GTK_NOTEBOOK(recordui->notebook)); + + if (curr_page == 0) { + selection = + gtk_tree_view_get_selection(GTK_TREE_VIEW + (recordui->sch_treeview)); + if (selection != NULL) { + gtk_tree_selection_get_selected(selection, &list_store, &iter); + gtk_tree_model_get(list_store, &iter, RECORD_ID_COLUMN, &index, + -1); + gmyth_scheduler_delete_schedule(recordui->scheduler, index); + mmyth_recordui_reload_schedule(recordui); + return; + } + + } else if (curr_page == 1) { + selection = + gtk_tree_view_get_selection(GTK_TREE_VIEW + (recordui->rec_treeview)); + if (selection != NULL) { + gtk_tree_selection_get_selected(selection, &list_store, &iter); + gtk_tree_model_get(list_store, &iter, RECORD_ID_COLUMN, &index, + -1); + gmyth_scheduler_delete_recorded(recordui->scheduler, index); + mmyth_recordui_reload_record(recordui); + return; + } + } + + g_warning("[%s] None element was removed from the list", __FUNCTION__); +} + +/* + * FIXME: change this function name, it is returning the basename_column + * that represents the nuv filename of the recorded content + */ +gchar * +mmyth_recordui_get_selected_recorded(MMythRecordUI * recordui) +{ + GtkTreeSelection *selection = NULL; + GtkTreeModel *list_store = NULL; + GtkTreeIter iter; + gchar *path = NULL; + + /* + * returning nuv filename, basename_column + */ + selection = + gtk_tree_view_get_selection(GTK_TREE_VIEW(recordui->rec_treeview)); + if (gtk_tree_selection_get_selected(selection, &list_store, &iter)) { + gtk_tree_model_get(list_store, &iter, BASENAME_COLUMN, &path, -1); + } + // FIXME: MOVE THIS TO OTHER PLACE + return path; +} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_recordui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_recordui.h Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,52 @@ +#ifndef MMYTH_RECORD_H_ +#define MMYTH_RECORD_H_ + +#include +#include + +typedef struct _MMythRecordUI { + GtkWidget *scrolled_window; + GtkWidget *viewport; + GtkWidget *notebook; + + GtkWidget *rec_scrolled_window; + GtkWidget *sch_scrolled_window; + GtkWidget *rec_treeview; + GtkWidget *sch_treeview; + GtkWidget *rec_label; + GtkWidget *sch_label; + + GtkTreeViewColumn *rec_column1; + GtkTreeViewColumn *rec_column2; + GtkTreeViewColumn *rec_column3; + GtkTreeViewColumn *rec_column4; + GtkTreeViewColumn *sch_column1; + GtkTreeViewColumn *sch_column2; + GtkTreeViewColumn *sch_column3; + GtkTreeViewColumn *sch_column4; + + GtkCellRenderer *rec_renderer; + GtkCellRenderer *sch_renderer; + + GtkTreeStore *sch_tree_store; + GtkTreeStore *rec_tree_store; + + GMythScheduler *scheduler; + + GMythBackendInfo *backend_info; + +} MMythRecordUI; + +MMythRecordUI *mmyth_recordui_new(GMythBackendInfo * backend_info); +void mmyth_recordui_free(MMythRecordUI * recordui); + +void mmyth_recordui_delete_selected(GtkButton * button, + MMythRecordUI * recordui); +gboolean mmyth_recordui_reload_all(MMythRecordUI * recordui); +gboolean mmyth_recordui_reload_schedule(MMythRecordUI * recordui); +gboolean mmyth_recordui_reload_record(MMythRecordUI * recordui); + +gchar *mmyth_recordui_get_selected_recorded(MMythRecordUI * + recordui); + +#endif /* MMYTH_RECORD_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_schedulerui.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_schedulerui.c Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,443 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mmyth_ui.h" +#include "mmyth_uicommon.h" +#include "mmyth_recordui.h" +#include "mmyth_schedulerui.h" + +/* + * GMyth library includes + */ +#include +#include +#include + +static void run_calendar_dialog(GtkButton * button, gpointer data); + +static void add_channel_field(MMythSchedulerUI * scheduler_ui, + GtkWidget * vbox); +static void add_time_field(MMythSchedulerUI * scheduler_ui, + GtkWidget * vbox); +static void add_date_field(MMythSchedulerUI * scheduler_ui, + GtkWidget * vbox); +static void add_duration_field(MMythSchedulerUI * scheduler_ui, + GtkWidget * vbox); +static void add_frequency_field(MMythSchedulerUI * scheduler_ui, + GtkWidget * vbox); +static void add_title_field(MMythSchedulerUI * scheduler_ui, + GtkWidget * vbox); + +MMythSchedulerUI * +mmyth_schedulerui_new(GMythBackendInfo * backend_info) +{ + GtkWidget *scrolledwindow; + GtkWidget *viewport; + GtkWidget *head_hbox; + GtkWidget *fields_vbox; + GtkWidget *hseparator; + GtkWidget *label; + + MMythSchedulerUI *scheduler_ui = g_new0(MMythSchedulerUI, 1); + + scheduler_ui->backend_info = backend_info; + + scrolledwindow = gtk_scrolled_window_new(NULL, NULL); + scheduler_ui->main_widget = scrolledwindow; + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + + // Is this needed? + viewport = gtk_viewport_new(NULL, NULL); + gtk_container_add(GTK_CONTAINER(scrolledwindow), viewport); + + // Is this needed? + head_hbox = gtk_hbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(viewport), head_hbox); + + fields_vbox = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(head_hbox), fields_vbox, TRUE, TRUE, 0); + gtk_container_set_border_width(GTK_CONTAINER(fields_vbox), 10); + + label = gtk_label_new_with_mnemonic(("Manual Schedule Recording")); + gtk_box_pack_start(GTK_BOX(fields_vbox), label, FALSE, FALSE, 0); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + + hseparator = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(fields_vbox), hseparator, FALSE, TRUE, 0); + + add_channel_field(scheduler_ui, fields_vbox); + add_time_field(scheduler_ui, fields_vbox); + add_date_field(scheduler_ui, fields_vbox); + add_duration_field(scheduler_ui, fields_vbox); + add_frequency_field(scheduler_ui, fields_vbox); + add_title_field(scheduler_ui, fields_vbox); + + return scheduler_ui; +} + +static void +set_date_from_calendar(GtkCalendar * calendar, gpointer data) +{ + char sched_date[24]; + + MMythSchedulerUI *scheduler_ui = (MMythSchedulerUI *) data; + + // FIXME: Change this, save another value instead of month_temp, + // day_temp, ... + gtk_calendar_get_date(GTK_CALENDAR(calendar), + &(scheduler_ui->year_temp), + &(scheduler_ui->month_temp), + &(scheduler_ui->day_temp)); + + sched_date[23] = '\0'; + g_sprintf(sched_date, "%04d %02d %02d (yyyy mm dd)", + scheduler_ui->year_temp, scheduler_ui->month_temp + 1, + scheduler_ui->day_temp); + + gtk_button_set_label(GTK_BUTTON(scheduler_ui->date_button), + sched_date); + + gtk_widget_destroy(scheduler_ui->calendar_dialog); + scheduler_ui->calendar_dialog = NULL; + scheduler_ui->calendar = NULL; +} + +// calendar +static void +run_calendar_dialog(GtkButton * button, gpointer data) +{ + + GtkWidget *dialog_vbox; + MMythSchedulerUI *scheduler_ui = (MMythSchedulerUI *) data; + + // calendar_dialog and calendar are been released at + // set_date_from_calendar () + scheduler_ui->calendar_dialog = gtk_dialog_new(); + gtk_container_set_border_width(GTK_CONTAINER + (scheduler_ui->calendar_dialog), 1); + gtk_window_set_title(GTK_WINDOW(scheduler_ui->calendar_dialog), + "Select starting date"); + gtk_window_set_position(GTK_WINDOW(scheduler_ui->calendar_dialog), + GTK_WIN_POS_CENTER); + gtk_window_set_decorated(GTK_WINDOW(scheduler_ui->calendar_dialog), + FALSE); + + dialog_vbox = GTK_DIALOG(scheduler_ui->calendar_dialog)->vbox; + + scheduler_ui->calendar = gtk_calendar_new(); + + gtk_box_pack_start(GTK_BOX(dialog_vbox), scheduler_ui->calendar, TRUE, + TRUE, 0); + gtk_calendar_display_options(GTK_CALENDAR(scheduler_ui->calendar), + GTK_CALENDAR_SHOW_HEADING | + GTK_CALENDAR_SHOW_DAY_NAMES); + + gtk_widget_show_all(scheduler_ui->calendar_dialog); + + g_signal_connect(G_OBJECT(scheduler_ui->calendar), + "day-selected-double-click", + G_CALLBACK(set_date_from_calendar), data); +} + + +gboolean +mmyth_schedulerui_save(MMythSchedulerUI * scheduler_ui) +{ + GMythScheduler *scheduler; + ScheduleInfo *schedule_info; + GMythChannelInfo *channel_info; + + GList *clist; + gint index, + duration; + gint frequency; + struct tm start_tm; + + schedule_info = g_new0(ScheduleInfo, 1); + if (schedule_info == NULL) { + g_warning("Error allocating memory"); + return FALSE; + } + + clist = scheduler_ui->channel_list; + + index = + gtk_combo_box_get_active(GTK_COMBO_BOX + (scheduler_ui->channel_combobox)); + + if (clist != NULL) + clist = g_list_nth(clist, index); + + if (clist) { + g_debug("[%s] New schedule: %d", __FUNCTION__, index); + } else { + g_warning("[%s] Error when adding new schedule", __FUNCTION__); + return FALSE; + } + + channel_info = clist->data; + + /* + * initialize schedule_info + */ + schedule_info->channel_id = channel_info->channel_ID; + + start_tm.tm_hour = + (int) + gtk_spin_button_get_value(GTK_SPIN_BUTTON + (scheduler_ui->hour_spinbutton)); + start_tm.tm_min = + (int) + gtk_spin_button_get_value(GTK_SPIN_BUTTON + (scheduler_ui->min_spinbutton)); + start_tm.tm_sec = 0; + + start_tm.tm_mday = (gint) scheduler_ui->day_temp; + start_tm.tm_mon = (gint) scheduler_ui->month_temp; + start_tm.tm_year = (gint) scheduler_ui->year_temp - 1900; // years + // since + // 1900 + GTimeVal *time_val_local = g_new0(GTimeVal, 1); + time_val_local->tv_sec = timelocal(&start_tm); + + schedule_info->start_time = time_val_local; + if (NULL == schedule_info->start_time) { + g_warning("timelocal error!\n"); + return FALSE; + } + + duration = + (gint) + gtk_spin_button_get_value(GTK_SPIN_BUTTON + (scheduler_ui->duration_spinbutton)); + schedule_info->end_time = schedule_info->start_time + (duration * 60); + + /* + * TODO: frequency is not implemented yet + */ + frequency = + gtk_combo_box_get_active(GTK_COMBO_BOX + (scheduler_ui->freq_combobox)); + + schedule_info->title = g_string_new(""); + g_string_printf(schedule_info->title, "%s", + gtk_entry_get_text(GTK_ENTRY + (scheduler_ui->title_entry))); + + /* + * FIXME: Architecture change to reuse the scheduler created in the + * recordui! + */ + scheduler = gmyth_scheduler_new(); + + gmyth_scheduler_connect(scheduler, scheduler->backend_info); + + /* + * FIXME: set record_id = -1 to add a new schedule + */ + schedule_info->record_id = -1; + gmyth_scheduler_add_schedule(scheduler, schedule_info); + + gmyth_scheduler_disconnect(scheduler); + + /* + * free allocated memory + */ + g_object_unref(scheduler); + g_free(schedule_info); + + return TRUE; +} + +static GtkWidget * +add_line(GtkWidget * vbox, const gchar * str) +{ + GtkWidget *label; + GtkWidget *hbox = gtk_hbox_new(FALSE, 0); + + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 3); + + label = gtk_label_new(str); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + + return hbox; +} + +static void +add_channel_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox) +{ + GtkWidget *combobox; + + GtkWidget *hbox = add_line(vbox, "Channel: "); + + combobox = gtk_combo_box_new_text(); + + scheduler_ui->channel_combobox = combobox; + gtk_box_pack_start(GTK_BOX(hbox), combobox, FALSE, FALSE, 0); + + GMythEPG *mmyth_epg = gmyth_epg_new(); + if (!gmyth_epg_connect(mmyth_epg, scheduler_ui->backend_info)) { + // FIXME: Without this list the scheduler UI should not be shown! + g_warning("[%s] Error when getting list of channels", + __FUNCTION__); + } + + if (gmyth_epg_get_channel_list + (mmyth_epg, &(scheduler_ui->channel_list)) < 0) { + g_debug("[%s] Error while trying to retrieve channel list", + __FUNCTION__); + } else { + GList *clist = scheduler_ui->channel_list; + GMythChannelInfo *channel_info; + + while (clist != NULL) { + channel_info = clist->data; + clist = clist->next; + gtk_combo_box_append_text(GTK_COMBO_BOX + (scheduler_ui->channel_combobox), + (channel_info->channel_name->str)); + } + + gtk_combo_box_set_active(GTK_COMBO_BOX + (scheduler_ui->channel_combobox), 0); + } +} + +static void +add_time_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox) +{ + GtkWidget *label; + GtkObject *spinbutton_adj; + GtkWidget *hbox = add_line(vbox, "Time: "); + + time_t real_time; + struct tm sched_time; + + time(&real_time); + + if (localtime_r((time_t *) & real_time, &sched_time) == NULL) { + g_warning("localtime_r error in mmyth_epg_grid_view!\n"); + return; + } + + if (sched_time.tm_min > 30) { + sched_time.tm_hour = sched_time.tm_hour + 1; + sched_time.tm_min = 0; + } else if (sched_time.tm_min > 0) { + sched_time.tm_min = 30; + } + + scheduler_ui->year_temp = (guint) sched_time.tm_year + 1900; + scheduler_ui->month_temp = (guint) sched_time.tm_mon; + scheduler_ui->day_temp = (guint) sched_time.tm_mday; + + // hour entry + spinbutton_adj = + gtk_adjustment_new(sched_time.tm_hour, 00, 23, 1, 10, 10); + scheduler_ui->hour_spinbutton = + gtk_spin_button_new(GTK_ADJUSTMENT(spinbutton_adj), 1, 0); + gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->hour_spinbutton, FALSE, + FALSE, 0); + + label = gtk_label_new((" : ")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + + // minute entry + spinbutton_adj = + gtk_adjustment_new(sched_time.tm_min, 0, 59, 1, 10, 10); + scheduler_ui->min_spinbutton = + gtk_spin_button_new(GTK_ADJUSTMENT(spinbutton_adj), 1, 0); + gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->min_spinbutton, FALSE, + FALSE, 0); + + label = gtk_label_new((" (hh:mm)")); + + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + +} + +static void +add_date_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox) +{ + char sched_date[24]; + GtkWidget *hbox = add_line(vbox, "Date: "); + + // sched_date = ctime(&real_time); + g_sprintf(sched_date, "%04d %02d %02d (yyyy mm dd)", + scheduler_ui->year_temp, scheduler_ui->month_temp + 1, + scheduler_ui->day_temp); + sched_date[23] = '\0'; + + scheduler_ui->date_button = gtk_button_new_with_label(sched_date); + gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->date_button, FALSE, + FALSE, 0); + gtk_button_set_relief(GTK_BUTTON(scheduler_ui->date_button), + GTK_RELIEF_NONE); + + g_signal_connect(G_OBJECT(scheduler_ui->date_button), "clicked", + G_CALLBACK(run_calendar_dialog), scheduler_ui); + +} + +static void +add_duration_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox) +{ + GtkWidget *hbox = add_line(vbox, "Duration: "); + GtkWidget *label; + GtkObject *spinbutton_adj; + + spinbutton_adj = gtk_adjustment_new(60, 5, 360, 5, 60, 60); + scheduler_ui->duration_spinbutton = + gtk_spin_button_new(GTK_ADJUSTMENT(spinbutton_adj), 1, 0); + gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->duration_spinbutton, + FALSE, TRUE, 0); + gtk_spin_button_set_numeric(GTK_SPIN_BUTTON + (scheduler_ui->duration_spinbutton), TRUE); + + label = gtk_label_new((" (minutes) ")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); +} + +static void +add_frequency_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox) +{ + + GtkWidget *hbox = add_line(vbox, "Frequency: "); + + scheduler_ui->freq_combobox = gtk_combo_box_new_text(); + gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->freq_combobox, FALSE, + FALSE, 0); + gtk_combo_box_append_text(GTK_COMBO_BOX(scheduler_ui->freq_combobox), + ("Only this day ")); + gtk_combo_box_append_text(GTK_COMBO_BOX(scheduler_ui->freq_combobox), + ("Daily ")); + gtk_combo_box_append_text(GTK_COMBO_BOX(scheduler_ui->freq_combobox), + ("Weekly ")); + gtk_combo_box_set_active(GTK_COMBO_BOX(scheduler_ui->freq_combobox), + 0); + +} + +static void +add_title_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox) +{ + GtkWidget *hbox = add_line(vbox, "Title: "); + + scheduler_ui->title_entry = gtk_entry_new(); + gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->title_entry, FALSE, + FALSE, 0); + gtk_entry_set_text(GTK_ENTRY(scheduler_ui->title_entry), "(Optional)"); + +} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_schedulerui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_schedulerui.h Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,53 @@ +#ifndef MMYTH_SCHEDULERECORDING_H_ +#define MMYTH_SCHEDULERECORDING_H_ + +#include + +#include + +typedef struct _MMythSchedulerUI { + + GList *channel_list; + + GtkWidget *main_widget; + + GtkWidget *channel_combobox; + GtkWidget *freq_combobox; + GtkWidget *hour_spinbutton; + GtkWidget *min_spinbutton; + GtkWidget *duration_spinbutton; + GtkWidget *title_entry; + GtkWidget *date_button; + + GtkWidget *calendar_dialog; + GtkWidget *calendar; + + guint year_temp, + month_temp, + day_temp; + + GMythBackendInfo *backend_info; + +} MMythSchedulerUI; + +typedef struct { + long int channel_id; + + struct tm start_tm; + + int duration; + int frequency; + + GString *title; + +} ScheduleEntry; + +MMythSchedulerUI *mmyth_schedulerui_new(GMythBackendInfo * backend_info); + +gboolean mmyth_schedulerui_save(MMythSchedulerUI * scheduler_ui); + +void mmyth_schedulerui_cb_schedule_button(GtkButton * button, + gpointer user_data); + + +#endif /* MMYTH_SCHEDULERECORDING_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_tvplayer.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_tvplayer.c Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,712 @@ +/** + * GMyth Library + * + * @file gmyth/mmyth_tvplayer.c + * + * @brief

This component provides playback of the remote A/V using + * GStreamer. + * + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. + * @author Hallyson Luiz de Morais Melo + * + *//* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "mmyth_tvplayer.h" + +#include + +#include + +#define MYTHTV_VERSION_DEFAULT 30 + +typedef struct _GstPlayerWindowStateChange { + GstElement *play; + GstState old_state, + new_state; + MMythTVPlayer *tvplayer; +} GstPlayerWindowStateChange; + +typedef struct _GstPlayerWindowTagFound { + GstElement *play; + GstTagList *taglist; + MMythTVPlayer *tvplayer; +} GstPlayerWindowTagFound; + +/* + * static gboolean idle_state (gpointer data); + */ +static gboolean bus_call(GstBus * bus, GstMessage * msg, gpointer data); + +static void mmyth_tvplayer_class_init(MMythTVPlayerClass * klass); +static void mmyth_tvplayer_init(MMythTVPlayer * object); + +static void mmyth_tvplayer_dispose(GObject * object); +static void mmyth_tvplayer_finalize(GObject * object); + +G_DEFINE_TYPE(MMythTVPlayer, mmyth_tvplayer, G_TYPE_OBJECT) + + static gboolean mmyth_tvplayer_create_pipeline(MMythTVPlayer * + tvplayer); + static void new_pad_cb(GstElement * element, GstPad * pad, + gpointer data); + + static gboolean expose_cb(GtkWidget * widget, + GdkEventExpose * event, gpointer user_data); + + static void + mmyth_tvplayer_class_init(MMythTVPlayerClass * klass) +{ + GObjectClass *gobject_class; + + gobject_class = (GObjectClass *) klass; + + gobject_class->dispose = mmyth_tvplayer_dispose; + gobject_class->finalize = mmyth_tvplayer_finalize; +} + +static void +new_pad_cb(GstElement * element, GstPad * pad, gpointer data) +{ + MMythTVPlayer *tvplayer = MMYTH_TVPLAYER(data); + GstPadLinkReturn ret; + char *s; + + s = gst_caps_to_string(pad->caps); + + if (s[0] == 'a') { + ret = + gst_pad_link(pad, + gst_element_get_pad(tvplayer->audioqueue1, + "sink")); + } else { + ret = + gst_pad_link(pad, + gst_element_get_pad(tvplayer->videoqueue1, + "sink")); + } + + g_free(s); +} + +static gboolean +expose_cb(GtkWidget * widget, GdkEventExpose * event, gpointer user_data) +{ + MMythTVPlayer *tvplayer = MMYTH_TVPLAYER(user_data); + + if (tvplayer && tvplayer->videow) { + gst_x_overlay_set_xwindow_id(GST_X_OVERLAY + (tvplayer->gst_videosink), + GDK_WINDOW_XWINDOW(widget->window)); + return TRUE; + } + + g_warning("MMythTVPlayer expose called before setting video window\n"); + + return FALSE; +} + +static void +mmyth_tvplayer_init(MMythTVPlayer * tvplayer) +{ + tvplayer->gst_pipeline = NULL; + tvplayer->gst_source = NULL; + tvplayer->gst_videodec = NULL; + tvplayer->gst_videosink = NULL; + tvplayer->gst_videocolortrs = NULL; + tvplayer->videoqueue1 = NULL; + tvplayer->videoqueue2 = NULL; + tvplayer->audioqueue1 = NULL; + tvplayer->audioqueue2 = NULL; + + /* + * GTKWidget for rendering the video + */ + tvplayer->videow = NULL; + tvplayer->expose_handler = 0; + + tvplayer->backend_hostname = NULL; + tvplayer->backend_port = 0; + tvplayer->local_hostname = NULL; + + tvplayer->recorder = NULL; + tvplayer->tvchain = NULL; + tvplayer->proginfo = NULL; +} + +static void +mmyth_tvplayer_dispose(GObject * object) +{ + + G_OBJECT_CLASS(mmyth_tvplayer_parent_class)->dispose(object); +} + +static void +mmyth_tvplayer_finalize(GObject * object) +{ + g_signal_handlers_destroy(object); + + MMythTVPlayer *tvplayer = MMYTH_TVPLAYER(object); + + g_debug("[%s] Finalizing tvplayer", __FUNCTION__); + + if (tvplayer->videow != NULL) { + if (g_signal_handler_is_connected(tvplayer->videow, + tvplayer->expose_handler)) { + g_signal_handler_disconnect(tvplayer->videow, + tvplayer->expose_handler); + } + g_object_unref(tvplayer->videow); + } + + if (tvplayer->recorder != NULL) + g_object_unref(tvplayer->recorder); + if (tvplayer->tvchain != NULL) + g_object_unref(tvplayer->tvchain); + if (tvplayer->proginfo != NULL) + g_object_unref(tvplayer->proginfo); + + // Release Gstreamer elements + if (tvplayer->gst_pipeline != NULL) + g_object_unref(tvplayer->gst_pipeline); + if (tvplayer->gst_source != NULL) + g_object_unref(tvplayer->gst_source); + if (tvplayer->gst_videodec != NULL) + g_object_unref(tvplayer->gst_videodec); + if (tvplayer->gst_videocolortrs != NULL) + g_object_unref(tvplayer->gst_videocolortrs); + if (tvplayer->gst_videosink != NULL) + g_object_unref(tvplayer->gst_videosink); + if (tvplayer->videoqueue1 != NULL) + g_object_unref(tvplayer->videoqueue1); + if (tvplayer->videoqueue2 != NULL) + g_object_unref(tvplayer->videoqueue2); + if (tvplayer->audioqueue1 != NULL) + g_object_unref(tvplayer->audioqueue1); + if (tvplayer->audioqueue2 != NULL) + g_object_unref(tvplayer->audioqueue2); + + G_OBJECT_CLASS(mmyth_tvplayer_parent_class)->finalize(object); +} + +/** Creates a new instance of MMythTVPlayer. + * + * @return a new instance of MMythTVPlayer. + */ +MMythTVPlayer * +mmyth_tvplayer_new() +{ + MMythTVPlayer *tvplayer = + MMYTH_TVPLAYER(g_object_new(MMYTH_TVPLAYER_TYPE, NULL)); + + return tvplayer; +} + +/** Initializes the tv player. + * + * @param tvplayer the object instance. + * @return gboolean TRUE if the pipeline was created + * successfully, FALSE otherwise. + */ +gboolean +mmyth_tvplayer_initialize(MMythTVPlayer * tvplayer, + GMythBackendInfo * backend_info) +{ + tvplayer->backend_info = backend_info; + + if (!mmyth_tvplayer_create_pipeline(tvplayer)) { + g_warning + ("[%s] Error while creating pipeline. TV Player not initialized", + __FUNCTION__); + return FALSE; + } else { + g_debug("[%s] GStreamer pipeline created", __FUNCTION__); + } + + return TRUE; +} + +/** Creates the GStreamer pipeline used by the player. + * + * @param tvplayer the object instance. + * @return gboolean TRUE if the pipeline was created + * successfully, FALSE otherwise. + */ +static gboolean +mmyth_tvplayer_create_pipeline(MMythTVPlayer * tvplayer) +{ + GstElement *pipeline; + GstElement *source, + *parser; + GstElement *videodec, + *videosink; + GstElement *videocolortrs; +#ifndef MAEMO_PLATFORM + GstElement *audiodec, + *audioconv, + *audioqueue2; +#endif + GstElement *audiosink; + GstElement *videoqueue1, + *videoqueue2, + *audioqueue1; + + g_debug("MMythTVPlayer: Setting the Gstreamer pipeline\n"); + + pipeline = gst_pipeline_new("video-player"); + source = gst_element_factory_make("mythtvsrc", "myth-source"); + parser = gst_element_factory_make("nuvdemux", "nuv-demux"); + + /* + * Gstreamer Video elements + */ + videoqueue1 = gst_element_factory_make("queue", "video-queue1"); + videodec = gst_element_factory_make("ffdec_mpeg4", "video-decoder"); + videoqueue2 = gst_element_factory_make("queue", "video-queue2"); + videocolortrs = + gst_element_factory_make("ffmpegcolorspace", + "image-color-transforms"); + +#ifdef MAEMO_PLATFORM + videosink = gst_element_factory_make("sdlvideosink", "image-output"); +#else + videosink = gst_element_factory_make("xvimagesink", "image-output"); +#endif + + /* + * Gstreamer Audio elements + */ + audioqueue1 = gst_element_factory_make("queue", "audio-queue1"); +#ifdef MAEMO_PLATFORM + audiosink = gst_element_factory_make("dspmp3sink", "audio-output"); +#else + audioqueue2 = gst_element_factory_make("queue", "audio-queue2"); + audiodec = gst_element_factory_make("mad", "audio-decoder"); + audioconv = + gst_element_factory_make("audioconvert", "audio-converter"); + audiosink = gst_element_factory_make("alsasink", "audio-output"); +#endif + + if (!(pipeline && source && parser && videodec && videosink) || + !(videoqueue1 && videoqueue2 && audioqueue1 && audiosink)) { + /* + * FIXME: hanlde the error correctly + */ + /* + * video_alignment is not being created (below) and is causing + * problems to the ui + */ + + tvplayer->gst_pipeline = NULL; + tvplayer->gst_videodec = NULL; + tvplayer->gst_videosink = NULL; + tvplayer->gst_videocolortrs = NULL; + + g_warning("GstElement creation error!\n"); + return FALSE; + } +#ifndef MAEMO_PLATFORM + if (!(audiodec && audioconv)) { + g_warning("GstElement for audio stream creation error!"); + return FALSE; + } +#endif + + tvplayer->gst_pipeline = pipeline; + tvplayer->gst_source = source; + tvplayer->gst_videodec = videodec; + tvplayer->gst_videosink = videosink; + tvplayer->gst_videocolortrs = videocolortrs; + g_object_ref(tvplayer->gst_pipeline); + g_object_ref(tvplayer->gst_source); + g_object_ref(tvplayer->gst_videodec); + g_object_ref(tvplayer->gst_videosink); + g_object_ref(tvplayer->gst_videocolortrs); + + tvplayer->videoqueue1 = videoqueue1; + tvplayer->videoqueue2 = videoqueue2; + tvplayer->audioqueue1 = audioqueue1; + g_object_ref(tvplayer->videoqueue1); + g_object_ref(tvplayer->videoqueue2); + g_object_ref(tvplayer->audioqueue1); + +#ifndef MAEMO_PLATFORM + tvplayer->audioqueue2 = audioqueue2; + g_object_ref(tvplayer->audioqueue2); +#endif + + // g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL); + g_object_set(G_OBJECT(audiosink), "sync", FALSE, NULL); + + gst_bus_add_watch(gst_pipeline_get_bus + (GST_PIPELINE(tvplayer->gst_pipeline)), bus_call, + tvplayer); + + gst_bin_add_many(GST_BIN(pipeline), source, parser, videoqueue1, + videodec, videoqueue2, videocolortrs, videosink, + NULL); + +#ifndef MAEMO_PLATFORM + gst_bin_add_many(GST_BIN(pipeline), audioqueue1, audiodec, audioconv, + audioqueue2, audiosink, NULL); +#else + gst_bin_add_many(GST_BIN(pipeline), audioqueue1, audiosink, NULL); +#endif + + { + // GstCaps *rtpcaps = gst_caps_new_simple ("application/x-rtp", + // NULL); + // gst_element_link_filtered(source, parser, rtpcaps); + } + + gst_element_link(source, parser); + gst_element_link_many(videoqueue1, videodec, videoqueue2, + videocolortrs, videosink, NULL); + +#ifndef MAEMO_PLATFORM + gst_element_link_many(videosink, audioqueue1, audiodec, audioconv, + audioqueue2, audiosink, NULL); +#else + gst_element_link_many(videosink, audioqueue1, audiosink, NULL); +#endif + + g_signal_connect(parser, "pad-added", G_CALLBACK(new_pad_cb), + tvplayer); + + return TRUE; +} + +/** Configures the backend and the tv player + * for playing the recorded content A/V. + * + * FIXME: Change filename to program info or other structure about the recorded + * + * @param tvplayer the object instance. + * @param filename the file uri of the recorded content to be played. + * @return TRUE if successfull, FALSE if any error happens. + */ +gboolean +mmyth_tvplayer_record_setup(MMythTVPlayer * tvplayer, + const gchar * filename) +{ + // FIXME: we should receive the uri instead of filename + const gchar *hostname = + gmyth_backend_info_get_hostname(tvplayer->backend_info); + const gint port = + gmyth_backend_info_get_port(tvplayer->backend_info); + + GString *fullpath = g_string_new("myth://"); + g_string_append_printf(fullpath, "%s:%d/%s", hostname, port, filename); + + tvplayer->is_livetv = FALSE; + + g_debug("[%s] Setting record uri to gstreamer pipeline to %s", + __FUNCTION__, fullpath->str); + + g_object_set(G_OBJECT(tvplayer->gst_source), "location", + fullpath->str, NULL); + + return TRUE; +} + +/** Configures the backend and the tv player + * for playing the live tv. + * + * @param tvplayer the object instance. + * @return TRUE if successfull, FALSE if any error happens. + */ +gboolean +mmyth_tvplayer_livetv_setup(MMythTVPlayer * tvplayer) +{ + gboolean res = TRUE; + + tvplayer->livetv = gmyth_livetv_new(); + + if (!gmyth_livetv_setup(tvplayer->livetv, tvplayer->backend_info)) + goto error; + + return res; + + error: + res = FALSE; + if (tvplayer->livetv != NULL) { + g_object_unref(tvplayer->livetv); + } + + if (tvplayer->local_hostname != NULL) { + g_string_free(tvplayer->local_hostname, TRUE); + } + + if (tvplayer->recorder != NULL) { + g_object_unref(tvplayer->recorder); + tvplayer->recorder = NULL; + } + + if (tvplayer->tvchain != NULL) { + g_object_unref(tvplayer->tvchain); + tvplayer->tvchain = NULL; + } + + if (tvplayer->proginfo != NULL) { + g_object_unref(tvplayer->proginfo); + tvplayer->proginfo = NULL; + } + + return res; + +} + +/** Sets the GTK video widget for the tv player. + * + * @param tvplayer the object instance. + * @param videow the GTK video window. + * @return TRUE if successfull, FALSE if any error happens. + */ +gboolean +mmyth_tvplayer_set_widget(MMythTVPlayer * tvplayer, GtkWidget * videow) +{ + tvplayer->videow = videow; + g_object_ref(videow); + + g_debug("[%s] Setting widget for tv player render", __FUNCTION__); + + tvplayer->expose_handler = + g_signal_connect(tvplayer->videow, "expose-event", + G_CALLBACK(expose_cb), tvplayer); + + // g_signal_connect(miptv_ui->videow, "size_request", + // G_CALLBACK(cb_preferred_video_size), miptv_ui); + + return TRUE; +} + +static gboolean +bus_call(GstBus * bus, GstMessage * msg, gpointer data) +{ + // MMythTVPlayer *tvplayer = MMYTH_TVPLAYER ( data ); + // GMainLoop *loop = tvplayer->loop; + + switch (GST_MESSAGE_TYPE(msg)) { + case GST_MESSAGE_EOS: + printf("End of stream\n"); + // g_idle_add ((GSourceFunc) idle_eos, data); + gst_element_set_state(GST_ELEMENT(GST_MESSAGE_SRC(msg)), + GST_STATE_NULL); + gst_element_set_locked_state(GST_ELEMENT(GST_MESSAGE_SRC(msg)), + TRUE); + break; + case GST_MESSAGE_ERROR: + { + gchar *debug; + GError *err; + + gst_message_parse_error(msg, &err, &debug); + g_free(debug); + + printf("Error: %s\n", err->message); + g_error_free(err); + + // g_main_loop_quit (loop); + } + break; + default: + printf(gst_message_type_get_name(GST_MESSAGE_TYPE(msg))); + printf("\n"); + break; + } + + return TRUE; +} + + +#if 0 +static gboolean +idle_state(gpointer data) +{ + GstPlayerWindowStateChange *st = data; + + if (st->old_state == GST_STATE_PLAYING) { + if (st->miptv_ui->idle_id != 0) { + g_source_remove(st->miptv_ui->idle_id); + st->miptv_ui->idle_id = 0; + } + } else if (st->new_state == GST_STATE_PLAYING) { + if (st->miptv_ui->idle_id != 0) + g_source_remove(st->miptv_ui->idle_id); + + st->miptv_ui->idle_id = g_idle_add(cb_iterate, st->miptv_ui); + } + + /* + * new movie loaded? + */ + if (st->old_state == GST_STATE_READY + && st->new_state > GST_STATE_READY) { + + /* + * gboolean have_video = FALSE; + */ + + gtk_widget_show(st->miptv_ui->videow); + + gtk_window_resize(GTK_WINDOW(st->miptv_ui->main_window), 1, 1); + + } + + /* + * discarded movie? + */ + if (st->old_state > GST_STATE_READY + && st->new_state == GST_STATE_READY) { + + if (st->miptv_ui->tagcache) { + gst_tag_list_free(st->miptv_ui->tagcache); + st->miptv_ui->tagcache = NULL; + } + } + + gst_object_unref(GST_OBJECT(st->play)); + // g_object_unref (G_OBJECT (st->win)); + g_free(st); + + /* + * once + */ + return FALSE; +} + +#endif + +/** Stops playing the current A/V. + * + * FIXME: How to proceed differently between livetv + * and recorded content? + * + * @param tvplayer the object instance. + * @return void + */ +void +mmyth_tvplayer_stop_playing(MMythTVPlayer * tvplayer) +{ + g_debug("[%s] Setting gstreamer pipeline state to NULL", __FUNCTION__); + + gst_element_set_state(tvplayer->gst_pipeline, GST_STATE_NULL); + + if (tvplayer->is_livetv) { + if (!gmyth_recorder_stop_livetv(tvplayer->recorder)) { + g_warning("[%s] Error while stoping remote encoder", + __FUNCTION__); + } + } +} + +/** Queries if the tvplayer is active playing A/V content. + * + * @param tvplayer the object instance. + * @return TRUE if the tvplayer is active, FALSE otherwise. + */ +gboolean +mmyth_tvplayer_is_playing(MMythTVPlayer * tvplayer) +{ + return (GST_STATE(tvplayer->gst_pipeline) == GST_STATE_PLAYING); +} + +/** Static function that sets the tvplayer state to PLAYING. + * + * @param tvplayer the object instance. + * @return TRUE if the tvplayer is active, FALSE otherwise. + */ +static gboolean +idle_play(gpointer data) +{ + MMythTVPlayer *tvplayer = MMYTH_TVPLAYER(data); + + g_debug("MMythTVPlayer: Setting pipeline state to PLAYING\n"); + + gst_element_set_state(tvplayer->gst_pipeline, GST_STATE_PLAYING); + + return FALSE; +} + +/** Start playing A/V with the tvplayer attributes. + * + * @param tvplayer the object instance. + */ +void +mmyth_tvplayer_start_playing(MMythTVPlayer * tvplayer) +{ + + // FIXME: Move this to livetv_setup?? + if (tvplayer->is_livetv) { + +#if 0 + if (!tvplayer || !(tvplayer->proginfo) + || !(tvplayer->local_hostname) + || !(tvplayer->gst_source)) { + g_warning("GMythtvPlayer not ready to start playing\n"); + } + + if (!(tvplayer->proginfo->pathname)) { + g_warning + ("[%s] Playback url is null, could not play the myth content", + __FUNCTION__); + return; + } + + g_debug("MMythTVPlayer: Start playing %s", + tvplayer->proginfo->pathname->str); +#endif + g_object_set(G_OBJECT(tvplayer->gst_source), "mythtv-live", + TRUE, NULL); +#if 0 + if (tvplayer->tvchain != NULL) { + GString *str_chainid = + gmyth_tvchain_get_id(tvplayer->tvchain); + g_print("[%s]\tCHAIN ID: %s\n", __FUNCTION__, + str_chainid->str); + + g_object_set(G_OBJECT(tvplayer->gst_source), + "mythtv-live-chainid", g_strdup(str_chainid->str), + NULL); + if (str_chainid != NULL) + g_string_free(str_chainid, FALSE); + } + + if (tvplayer->recorder != NULL) + g_object_set(G_OBJECT(tvplayer->gst_source), "mythtv-live-id", + tvplayer->recorder->recorder_num, NULL); + g_debug("[%s] Setting location to %s", __FUNCTION__, + tvplayer->proginfo->pathname->str); + + /* + * Sets the gstreamer properties acording to the service access + * address + */ + g_object_set(G_OBJECT(tvplayer->gst_source), "location", + tvplayer->proginfo->pathname->str, NULL); +#endif + } + + g_object_set(G_OBJECT(tvplayer->gst_source), "mythtv-version", + MYTHTV_VERSION_DEFAULT, NULL); + + g_object_set(G_OBJECT(tvplayer->gst_source), "mythtv-debug", + TRUE, NULL); + + g_idle_add(idle_play, tvplayer); + +} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_tvplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_tvplayer.h Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,122 @@ +/** + * GMyth Library + * + * @file gmyth/mmyth_tvplayer.h + * + * @brief

This component provides playback of the remote A/V using + * GStreamer. + * + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. + * @author Hallyson Luiz de Morais Melo + * + *//* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef MMYTH_TVPLAYER_H_ +#define MMYTH_TVPLAYER_H_ + +#include +#include + +/* + * GStreamer includes + */ +#include +#include + +#include +#include +#include +#include + +G_BEGIN_DECLS +#define MMYTH_TVPLAYER_TYPE (mmyth_tvplayer_get_type ()) +#define MMYTH_TVPLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MMYTH_TVPLAYER_TYPE, MMythTVPlayer)) +#define MMYTH_TVPLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MMYTH_TVPLAYER_TYPE, MMythTVPlayerClass)) +#define IS_MMYTH_TVPLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MMYTH_TVPLAYER_TYPE)) +#define IS_MMYTH_TVPLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MMYTH_TVPLAYER_TYPE)) +#define MMYTH_TVPLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MMYTH_TVPLAYER_TYPE, MMythTVPlayerClass)) +typedef struct _MMythTVPlayer MMythTVPlayer; +typedef struct _MMythTVPlayerClass MMythTVPlayerClass; + +struct _MMythTVPlayerClass { + GObjectClass parent_class; + + /* + * callbacks + */ + /* + * no one for now + */ +}; + +struct _MMythTVPlayer { + GObject parent; + + GstElement *gst_pipeline; + GstElement *gst_source; + GstElement *gst_videodec; + GstElement *gst_videosink; + GstElement *gst_videocolortrs; + GstElement *videoqueue1; + GstElement *videoqueue2; + GstElement *audioqueue1; + GstElement *audioqueue2; + + gulong expose_handler; + // GMainLoop *loop; + + GtkWidget *videow; + + /* + * Backend connection related variables + */ + GString *backend_hostname; + gint backend_port; + GString *local_hostname; + + GMythRecorder *recorder; + GMythTVChain *tvchain; + GMythProgramInfo *proginfo; + GMythLiveTV *livetv; + + GMythBackendInfo *backend_info; + + gboolean is_livetv; +}; + + +GType mmyth_tvplayer_get_type(void); + +MMythTVPlayer *mmyth_tvplayer_new(); +gboolean mmyth_tvplayer_initialize(MMythTVPlayer * tvplayer, + GMythBackendInfo * backend_info); + +void mmyth_tvplayer_start_playing(MMythTVPlayer * tvplayer); +void mmyth_tvplayer_stop_playing(MMythTVPlayer * tvplayer); + +gboolean mmyth_tvplayer_set_widget(MMythTVPlayer * tvplayer, + GtkWidget * videow); + +gboolean mmyth_tvplayer_is_playing(MMythTVPlayer * tvplayer); + +gboolean mmyth_tvplayer_record_setup(MMythTVPlayer * tvplayer, + const gchar * filename); +gboolean mmyth_tvplayer_livetv_setup(MMythTVPlayer * tvplayer); + +G_END_DECLS +#endif /* MMYTH_TVPLAYER_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_ui.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_ui.c Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,894 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mmyth_ui.h" +#include "mmyth_uicommon.h" +#include "mmyth_schedulerui.h" +#include "mmyth_recordui.h" +#include "mmyth_uisettings.h" +#include "mmyth_epg_grid_view.h" +#include "mmyth_tvplayer.h" + +/* + * GMyth library includes + */ + +#ifndef MAEMO_PLATFORM +static gint button_press_handler(GtkWidget * widget, GdkEvent * event); +#endif + +static MMythUiCommon *create_main_view(MMythUi * mmyth_ui); +static MMythUiCommon *create_video_view(MMythUi * mmyth_ui); +static MMythUiCommon *create_epg_grid_view(MMythUi * mmyth_ui); +static MMythUiCommon *create_record_view(MMythUi * mmyth_ui); +static MMythUiCommon *create_schedule_view(MMythUi * mmyth_ui); + +static void cb_video_close_button(GtkButton * button, + gpointer user_data); +static void cb_record_button(GtkButton * button, gpointer user_data); +static void cb_menu_item_settings(GtkMenuItem * menuitem, + gpointer user_data); + +/* + * main box from button box separator + */ +static GtkWidget *main_vseparator = NULL; + +GdkPixbuf *icon_sports, + *icon_news, + *icon_movies, + *icon_shows, + *icon_default; + +#ifndef MAEMO_PLATFORM +/* + * FIXME: + */ +static MMythUi *popup_mmyth_ui; +#endif + +MMythUi * +mmyth_ui_initialize( +#ifdef MAEMO_PLATFORM + HildonProgram * program, +#endif + GtkWidget * main_window) +{ + MMythUi *mmyth_ui; + + mmyth_ui = g_new0(MMythUi, 1); + + mmyth_ui->backend_info = + gmyth_backend_info_new_full("localhost", "mythtv", "mythtv", + "mythconverg", 6543); + + mmyth_ui->main_window = main_window; + mmyth_ui->videow = NULL; + mmyth_ui->mmyth_recordui = NULL; + mmyth_ui->mmyth_schedulerui = NULL; + + /* + * Horizontal box that divides the view into control and video area + */ + mmyth_ui->main_hbox = gtk_hbox_new(FALSE, 0); + gtk_widget_show(mmyth_ui->main_hbox); + g_object_ref(mmyth_ui->main_hbox); + + main_bg_color.red = 65000; + main_bg_color.green = 65000; + main_bg_color.blue = 65000; + + +#ifndef MAEMO_PLATFORM + /* + * Popup menu + */ + popup_mmyth_ui = mmyth_ui; + g_signal_connect(G_OBJECT(mmyth_ui->main_hbox), "event", + G_CALLBACK(button_press_handler), + G_OBJECT(mmyth_ui->main_hbox)); + +#else // #ifdef MAEMO + + mmyth_ui->main_menu = GTK_MENU(gtk_menu_new()); + hildon_program_set_common_menu(program, mmyth_ui->main_menu); + + mmyth_ui->menu_setup = gtk_menu_item_new_with_label("Setup"); + gtk_widget_set_size_request(GTK_WIDGET(mmyth_ui->menu_setup), 150, 40); + gtk_menu_append(mmyth_ui->main_menu, mmyth_ui->menu_setup); + + g_signal_connect(G_OBJECT(mmyth_ui->menu_setup), "activate", + G_CALLBACK(cb_menu_item_settings), mmyth_ui); + + gtk_widget_show_all(GTK_WIDGET(mmyth_ui->main_menu)); +#endif + + // Main widget is mmyth_ui->main_hbox + mmyth_ui->main_uicommon = create_main_view(mmyth_ui); + + gtk_container_add(GTK_CONTAINER(mmyth_ui->main_window), + mmyth_ui->main_hbox); + + mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon); + + return mmyth_ui; +} + +void +mmyth_ui_finalize(MMythUi * mmyth_ui) +{ + if (mmyth_ui != NULL) { + if (mmyth_ui->main_uicommon) + mmyth_uicommon_free(mmyth_ui->main_uicommon); + if (mmyth_ui->video_uicommon) + mmyth_uicommon_free(mmyth_ui->video_uicommon); + if (mmyth_ui->epg_grid_uicommon) + mmyth_uicommon_free(mmyth_ui->epg_grid_uicommon); + if (mmyth_ui->record_uicommon) + mmyth_uicommon_free(mmyth_ui->record_uicommon); + if (mmyth_ui->schedule_uicommon) + mmyth_uicommon_free(mmyth_ui->schedule_uicommon); + + g_free(mmyth_ui); + } +} + +void +mmyth_ui_set_widget(MMythUi * mmyth_ui, MMythUiCommon * new_uicommon) +{ + if (new_uicommon == NULL) { + g_warning("MMythUI setting a NULL UI_Common as current display\n"); + return; + } + + if (mmyth_ui->current_uicommon) { + if (mmyth_ui->current_uicommon == mmyth_ui->video_uicommon) { + gtk_widget_hide(mmyth_ui->current_uicommon->main_widget); + gtk_widget_hide(mmyth_ui->videow); + } else { + gtk_container_remove(GTK_CONTAINER(mmyth_ui->main_hbox), + mmyth_ui->current_uicommon->main_widget); + } + + gtk_container_remove(GTK_CONTAINER(mmyth_ui->main_hbox), + mmyth_ui->current_uicommon->event_box); + gtk_container_remove(GTK_CONTAINER(mmyth_ui->main_hbox), + main_vseparator); + + } + + if (new_uicommon->main_widget == mmyth_ui->video_alignment) { + // gst_player_video_show (GST_PLAYER_VIDEO(mmyth_ui->videow)); + gtk_widget_show(mmyth_ui->video_alignment); + gtk_widget_show(mmyth_ui->videow); + } else { + /* + * FIXME: Fst call is NULL when mmyth_player_init fails + */ + if (mmyth_ui->video_alignment != NULL) + gtk_widget_hide(mmyth_ui->video_alignment); + /* + * FIXME: Fst call is NULL when mmyth_player_init fails + */ + if (mmyth_ui->videow != NULL) + gtk_widget_hide(mmyth_ui->videow); + + gtk_box_pack_start(GTK_BOX(mmyth_ui->main_hbox), + new_uicommon->main_widget, TRUE, TRUE, 0); + } + + if (main_vseparator == NULL) { + /* + * FIXME: should free this variable + */ + main_vseparator = gtk_vseparator_new(); + g_object_ref(main_vseparator); + } + gtk_box_pack_start(GTK_BOX(mmyth_ui->main_hbox), + main_vseparator, FALSE, FALSE, 0); + gtk_widget_show(main_vseparator); + + gtk_box_pack_end(GTK_BOX(mmyth_ui->main_hbox), new_uicommon->event_box, + FALSE, FALSE, 0); + + mmyth_ui->current_uicommon = new_uicommon; + +} + +/* + * The close callback is the same for all windows + */ +static void +cb_not_impl_button(GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + GtkWidget *msg_dialog = + gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window), + GTK_DIALOG_MODAL | + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "Feature not implemented"); + gtk_widget_set_size_request(msg_dialog, 350, 120); + + gtk_dialog_run(GTK_DIALOG(msg_dialog)); + + gtk_widget_destroy(GTK_WIDGET(msg_dialog)); +} + +/****************************************************************************** + * POPUP MENU WIDGET METHODS * + *****************************************************************************/ + +static void +cb_menu_item_settings(GtkMenuItem * menuitem, gpointer user_data) +{ + + MMythUi *mmyth_ui = (MMythUi *) user_data; + + if (mmyth_uisettings_run(GTK_WINDOW(mmyth_ui->main_window))) { + // If user changes the settings, we restart the context + g_debug("[%s] Restarting mmyth_context to new settings", + __FUNCTION__); + // gmyth_context_initialize(); + } +} + +#ifndef MAEMO_PLATFORM + +static void +detacher(GtkWidget * attach_widget, GtkMenu * menu) +{ + +} + +static void +do_popup_menu(GtkWidget * my_widget, GdkEventButton * event) +{ + GtkWidget *popup; + + int button, + event_time; + + GtkWidget *item_general; + GtkWidget *image; + + popup = gtk_menu_new(); + + item_general = gtk_image_menu_item_new_with_mnemonic("Setup"); + gtk_widget_show(item_general); + gtk_container_add(GTK_CONTAINER(popup), item_general); + + image = gtk_image_new_from_stock("gtk-edit", GTK_ICON_SIZE_MENU); + gtk_widget_show(image); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item_general), + image); + + g_signal_connect(G_OBJECT(item_general), "activate", + G_CALLBACK(cb_menu_item_settings), popup_mmyth_ui); + + if (event) { + button = event->button; + event_time = event->time; + } else { + button = 0; + event_time = gtk_get_current_event_time(); + } + + gtk_menu_attach_to_widget(GTK_MENU(popup), my_widget, detacher); + gtk_menu_popup(GTK_MENU(popup), NULL, NULL, NULL, NULL, + button, event_time); + gtk_widget_show_all(popup); +} + +/* + * Respond to a button-press by posting a menu passed in as widget. Note + * that the "widget" argument is the menu being posted, NOT the button + * that was pressed. + */ +static gint +button_press_handler(GtkWidget * widget, GdkEvent * event) +{ + + if (event->type == GDK_BUTTON_PRESS) { + GdkEventButton *bevent = (GdkEventButton *) event; + /* + * Ignore double-clicks and triple-clicks + */ + if (bevent->button == 3) { + do_popup_menu(widget, bevent); + return TRUE; + } + } + + /* + * Tell calling code that we have not handled this event; pass it on. + */ + return FALSE; +} +#endif + +/****************************************************************************** + * MAIN APP VIEW METHODS * + *****************************************************************************/ + +static void +cb_close_button(GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon); +} + +static void +cb_watch_tv_button(GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + gboolean res = FALSE; + + if (!(mmyth_ui->video_uicommon)) + mmyth_ui->video_uicommon = create_video_view(mmyth_ui); + + // Creates the tv player that will retrieve the mythtv content, decode + // and show it + mmyth_ui->tvplayer = mmyth_tvplayer_new(); + /* + * choose here if this is a LiveTV session + */ + mmyth_ui->tvplayer->is_livetv = TRUE; + + res = + mmyth_tvplayer_initialize(mmyth_ui->tvplayer, + mmyth_ui->backend_info); + + if (!res) { + g_warning("[%s] Could not initialize tvplayer", __FUNCTION__); + + g_object_unref(mmyth_ui->tvplayer); + mmyth_ui->tvplayer = NULL; + + GtkWidget *dialog = + gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "MMyth found errors while starting TV Player, please check " + "the GStreamer installation"); + + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + + return; + } + // res = mmyth_tvplayer_livetv_setup (mmyth_ui->tvplayer); + // + if (mmyth_ui && mmyth_ui->tvplayer && res) { + mmyth_tvplayer_set_widget(mmyth_ui->tvplayer, mmyth_ui->videow); + mmyth_tvplayer_start_playing(mmyth_ui->tvplayer); + } else { + // TODO: Show Alert with error description! + g_warning("[%s] MMythUI can't initialize tv_player", __FUNCTION__); + g_object_unref(mmyth_ui->tvplayer); + mmyth_ui->tvplayer = NULL; + // FIXME: Show the exact error that happened + GtkWidget *dialog = + gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "Error while starting TV Player, please check if the backend" + " is running properly and a tv card is available!"); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + return; + } + mmyth_ui_set_widget(mmyth_ui, mmyth_ui->video_uicommon); + +} + +static void +cb_epg_button(GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + if (!(mmyth_ui->epg_grid_uicommon)) + mmyth_ui->epg_grid_uicommon = create_epg_grid_view(mmyth_ui); + + mmyth_ui_set_widget(mmyth_ui, mmyth_ui->epg_grid_uicommon); +} + +static MMythUiCommon * +create_main_view(MMythUi * mmyth_ui) +{ + MMythUiCommon *ui_common; + GtkWidget *main_widget; + GtkWidget *image; + + g_debug("Creating Main UI Common"); + + // FIXME: file path +#ifdef MMYTH_DEV + image = gtk_image_new_from_file("../pixmaps/mmyth_logo.png"); +#else + image = gtk_image_new_from_file(PIX_DIR "mmyth_logo.png"); +#endif + + main_widget = gtk_event_box_new(); + + gtk_container_add(GTK_CONTAINER(main_widget), image); + + + gtk_widget_show_all(main_widget); + g_object_ref(main_widget); + + ui_common = mmyth_uicommon_new(main_widget, + "Watch TV", "EPG", "Recording"); + + /* + * Button signals + */ + // FIXME + g_signal_connect(G_OBJECT(ui_common->button1), "clicked", + G_CALLBACK(cb_watch_tv_button), mmyth_ui); + g_signal_connect(G_OBJECT(ui_common->button2), "clicked", + G_CALLBACK(cb_epg_button), mmyth_ui); + g_signal_connect(G_OBJECT(ui_common->button3), "clicked", + G_CALLBACK(cb_record_button), mmyth_ui); + + return ui_common; + +} + +/****************************************************************************** + * epg GRID VIEW METHODS * + *****************************************************************************/ + +static MMythUiCommon * +create_epg_grid_view(MMythUi * mmyth_ui) +{ + MMythUiCommon *ui_common; + + g_debug("Creating EPG Grid UI Common"); + + GtkWidget *epg_grid_view = + GTK_WIDGET(epg_grid_view_new(mmyth_ui)); + + ui_common = mmyth_uicommon_new(epg_grid_view, + "Play", "Record", "Close"); + + /* + * Button signals + */ + g_signal_connect(G_OBJECT(ui_common->button1), "clicked", + G_CALLBACK(cb_not_impl_button), mmyth_ui); + g_signal_connect(G_OBJECT(ui_common->button2), "clicked", + G_CALLBACK(cb_record_button), mmyth_ui); + g_signal_connect(G_OBJECT(ui_common->button3), "clicked", + G_CALLBACK(cb_close_button), mmyth_ui); + + return ui_common; +} +/****************************************************************************** + * SCHEDULE VIEW METHODS * + ******************************************************************************/ + +static void +cb_save_new_schedule(GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + if (!(mmyth_ui->schedule_uicommon)) + mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui); + + mmyth_schedulerui_save(mmyth_ui->mmyth_schedulerui); + + mmyth_recordui_reload_schedule(mmyth_ui->mmyth_recordui); + + mmyth_ui_set_widget(mmyth_ui, mmyth_ui->record_uicommon); + +} + +static void +cb_edit_scheduled(GtkTreeView * tree_view, GtkTreePath * path, + GtkTreeViewColumn * column, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + GtkTreeSelection *selection; + GtkTreeModel *list_store; + GtkTreeIter iter; + int index; + // gint new_row = 0, record_id = 0; + ScheduleInfo *schedule_info; + GList *schedule_list; + // GtkTreeIter iter; + gint res; + + // gtk_tree_store_clear(recordui->sch_tree_store); + + res = + gmyth_scheduler_get_schedule_list(mmyth_ui->mmyth_recordui-> + scheduler, &(schedule_list)); + if (res < 0) { + g_warning + ("[%s] Retrieved NULL list of scheduled data from database", + __FUNCTION__); + // return FALSE; + } + printf("\nX %d", res); + fflush(stdout); + + selection = + gtk_tree_view_get_selection(GTK_TREE_VIEW + (mmyth_ui->mmyth_recordui-> + sch_treeview)); + + gtk_tree_selection_get_selected(selection, &list_store, &iter); + gtk_tree_model_get(list_store, &iter, 4, &index, -1); + + mmyth_ui_set_widget(mmyth_ui, mmyth_ui->schedule_uicommon); + + if (!(mmyth_ui->schedule_uicommon)) + mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui); + + schedule_list = + g_list_nth(schedule_list, + g_ascii_strtoull(gtk_tree_path_to_string(path), NULL, + 10)); + schedule_info = (ScheduleInfo *) schedule_list->data; + + printf("\nstarttime: %ld", schedule_info->start_time->tv_sec); + fflush(stdout); +} + +static MMythUiCommon * +create_schedule_view(MMythUi * mmyth_ui) +{ + MMythUiCommon *ui_common; + GtkWidget *schedule_widget; + + g_debug("Creating Schedule UI Common"); + + mmyth_ui->mmyth_schedulerui = + mmyth_schedulerui_new(mmyth_ui->backend_info); + if (mmyth_ui->mmyth_schedulerui == NULL) { + g_warning("[%s] Error while creating scheduler ui", __FUNCTION__); + return NULL; + } + + schedule_widget = mmyth_ui->mmyth_schedulerui->main_widget; + + gtk_widget_show_all(schedule_widget); + g_object_ref(schedule_widget); + + ui_common = mmyth_uicommon_new(schedule_widget, + "Save", "Clear", "Cancel"); + + /* + * Button signals + */ + g_signal_connect(G_OBJECT(ui_common->button1), "clicked", + G_CALLBACK(cb_save_new_schedule), mmyth_ui); + g_signal_connect(G_OBJECT(ui_common->button2), "clicked", + G_CALLBACK(cb_not_impl_button), mmyth_ui); + g_signal_connect(G_OBJECT(ui_common->button3), "clicked", + G_CALLBACK(cb_record_button), mmyth_ui); + + return ui_common; +} +/****************************************************************************** + * RECORD VIEW METHODS * + ******************************************************************************/ +static void +cb_record_button(GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + if (!(mmyth_ui->record_uicommon)) { + mmyth_ui->record_uicommon = create_record_view(mmyth_ui); + mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui); + } + + mmyth_recordui_reload_all(mmyth_ui->mmyth_recordui); + + mmyth_ui_set_widget(mmyth_ui, mmyth_ui->record_uicommon); + +} + +static void +cb_record_close_button(GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon); + + mmyth_recordui_free(mmyth_ui->mmyth_recordui); + + if (mmyth_ui->record_uicommon) { + gtk_widget_destroy(mmyth_ui->record_uicommon->main_widget); + mmyth_uicommon_free(mmyth_ui->record_uicommon); + mmyth_ui->record_uicommon = NULL; + } + + if (mmyth_ui->schedule_uicommon) { + // mmyth_uicommon_free(mmyth_ui->schedule_uicommon); + } +} + + + + +static void +play_selected_recorded(gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + gboolean res = FALSE; + + gchar *path = + mmyth_recordui_get_selected_recorded(mmyth_ui->mmyth_recordui); + + if (path == NULL) { + // This should never happens. Play button is just activated when + // a recording is selected. + g_warning + ("[%s] Play button pressed while none recorded is selected", + __FUNCTION__); + return; + } + + if (!(mmyth_ui->video_uicommon)) + mmyth_ui->video_uicommon = create_video_view(mmyth_ui); + + // Creates the tv player that will retrieve the mythtv content, decode + // and show it + mmyth_ui->tvplayer = mmyth_tvplayer_new(); + g_debug("[%s] New TV Player created: %d\n", __FUNCTION__, + (int) (mmyth_ui->tvplayer)); + res = + mmyth_tvplayer_initialize(mmyth_ui->tvplayer, + mmyth_ui->backend_info); + if (!res) { + g_warning("[%s] Could not initialize tvplayer", __FUNCTION__); + + g_object_unref(mmyth_ui->tvplayer); + mmyth_ui->tvplayer = NULL; + + GtkWidget *dialog = + gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "MMyth found errors while starting TV Player, please check " + "the GStreamer installation"); + + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + + return; + } + + res = mmyth_tvplayer_record_setup(mmyth_ui->tvplayer, path); + + if (mmyth_ui && mmyth_ui->tvplayer && res) { + mmyth_tvplayer_set_widget(mmyth_ui->tvplayer, mmyth_ui->videow); + mmyth_tvplayer_start_playing(mmyth_ui->tvplayer); + } else { + // TODO: Show Alert with error description! + g_warning("[%s] MMythUI can't initialize tv_player", __FUNCTION__); + g_object_unref(mmyth_ui->tvplayer); + mmyth_ui->tvplayer = NULL; + // FIXME: Show the exact error that happened + GtkWidget *dialog = + gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + "Error while starting TV Player, please check if the backend" + " is running properly and a tv card is available!"); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + return; + } + + mmyth_ui_set_widget(mmyth_ui, mmyth_ui->video_uicommon); +} + +static void +cb_play_clicked_recorded(GtkTreeView * tree_view, GtkTreePath * path, + GtkTreeViewColumn * column, gpointer user_data) +{ + play_selected_recorded(user_data); +} + +static void +cb_play_selected(GtkButton * button, gpointer user_data) +{ + play_selected_recorded(user_data); +} + +static void +cb_schedule_button(GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + mmyth_ui_set_widget(mmyth_ui, mmyth_ui->schedule_uicommon); +} + +void +cb_switch_page(GtkNotebook * notebook, GtkNotebookPage * page, + guint page_num, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + MMythUiCommon *ui_common; + + assert(mmyth_ui); + assert(mmyth_ui->record_uicommon); + + ui_common = mmyth_ui->record_uicommon; + + if (page_num == 0) { // Switched to Schedule list + gtk_button_set_label(GTK_BUTTON(ui_common->button1), "New"); + g_signal_handlers_disconnect_by_func(G_OBJECT(ui_common->button1), + G_CALLBACK(cb_play_selected), + mmyth_ui); + g_signal_connect(G_OBJECT(ui_common->button1), "clicked", + G_CALLBACK(cb_schedule_button), mmyth_ui); + } else if (page_num == 1) { + gtk_button_set_label(GTK_BUTTON(ui_common->button1), "Play"); + g_signal_handlers_disconnect_by_func(G_OBJECT(ui_common->button1), + G_CALLBACK + (cb_schedule_button), + mmyth_ui); + g_signal_connect(G_OBJECT(ui_common->button1), "clicked", + G_CALLBACK(cb_play_selected), mmyth_ui); + } +} + + +static MMythUiCommon * +create_record_view(MMythUi * mmyth_ui) +{ + MMythUiCommon *ui_common; + + g_debug("Creating Record UI Common"); + + mmyth_ui->mmyth_recordui = mmyth_recordui_new(mmyth_ui->backend_info); + + // FIXME: Change MMythRecordUI to a GtkWidget child and avoid this + // call! + gtk_widget_show_all(mmyth_ui->mmyth_recordui->scrolled_window); + + ui_common = + mmyth_uicommon_new(mmyth_ui->mmyth_recordui->scrolled_window, + "New", "Delete", "<mmyth_recordui->scrolled_window); + + /* + * Button signals + */ + g_signal_connect(G_OBJECT(ui_common->button1), "clicked", + G_CALLBACK(cb_schedule_button), mmyth_ui); + g_signal_connect(G_OBJECT(ui_common->button2), "clicked", + G_CALLBACK(mmyth_recordui_delete_selected), + mmyth_ui->mmyth_recordui); + g_signal_connect(G_OBJECT(ui_common->button3), "clicked", + G_CALLBACK(cb_record_close_button), mmyth_ui); + g_signal_connect(G_OBJECT(mmyth_ui->mmyth_recordui->notebook), + "switch-page", G_CALLBACK(cb_switch_page), mmyth_ui); + g_signal_connect(G_OBJECT(mmyth_ui->mmyth_recordui->rec_treeview), + "row-activated", G_CALLBACK(cb_play_clicked_recorded), + mmyth_ui); + g_signal_connect(G_OBJECT(mmyth_ui->mmyth_recordui->sch_treeview), + "row-activated", G_CALLBACK(cb_edit_scheduled), + mmyth_ui); + return ui_common; +} + + +/****************************************************************************** + * GST VIDEO WIDGET METHODS * + *****************************************************************************/ + +static void +cb_video_close_button(GtkButton * button, gpointer user_data) +{ + MMythUi *mmyth_ui = (MMythUi *) user_data; + + g_debug("MMythUI video close button pressed"); + + if (mmyth_ui && mmyth_ui->tvplayer) { + mmyth_tvplayer_stop_playing(mmyth_ui->tvplayer); + + g_object_unref(mmyth_ui->tvplayer); + mmyth_ui->tvplayer = NULL; + } else { + g_warning("cb_video_close_button called with NULL pointer\n"); + } + + mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon); +} + + +static MMythUiCommon * +create_video_view(MMythUi * mmyth_ui) +{ + + MMythUiCommon *ui_common; + + g_debug("Creating Video UI Common"); + + /* + * Creates widget to be user by MMythTVPlayer to draw the video + */ + mmyth_ui->videow = gtk_drawing_area_new(); + // FIXME: Get the widget size from settings + gtk_widget_set_size_request(mmyth_ui->videow, 300, 240); + + // mmiptv_ui->logo = gdk_pixbuf_new_from_file ("logo.png", NULL); + + // Creates an alignment to place the video widget inside + mmyth_ui->video_alignment = gtk_alignment_new(0.5, 0.5, 1, 1); + gtk_widget_hide(mmyth_ui->video_alignment); + + gtk_container_add(GTK_CONTAINER(mmyth_ui->video_alignment), + mmyth_ui->videow); + + /* + * Add the gst video widget to hbox. It should never be removed. + */ + /* + * FIXME: mmyth_ui->video_alignment == NULL when mmyth_player_init + * fails + */ + if ((mmyth_ui->main_hbox != NULL) + && (mmyth_ui->video_alignment != NULL)) { + gtk_box_pack_start(GTK_BOX(mmyth_ui->main_hbox), + mmyth_ui->video_alignment, TRUE, TRUE, 0); + } else { + g_warning("[%s] Error while adding video_alignment to main widget", + __FUNCTION__); + } + + g_object_ref(mmyth_ui->videow); + g_object_ref(mmyth_ui->video_alignment); + + ui_common = mmyth_uicommon_new(mmyth_ui->video_alignment, + " Full\nScreen", "Other\nServices", + "Close"); + + + g_signal_connect(G_OBJECT(ui_common->button1), "clicked", + G_CALLBACK(cb_not_impl_button), mmyth_ui); + g_signal_connect(G_OBJECT(ui_common->button2), "clicked", + G_CALLBACK(cb_not_impl_button), mmyth_ui); + g_signal_connect(G_OBJECT(ui_common->button3), "clicked", + G_CALLBACK(cb_video_close_button), mmyth_ui); + + if (ui_common) + g_debug("Video UI_Common sucessfull created"); + + return ui_common; +} + + + +GtkWidget * +mmyth_ui_get_video_widget(MMythUi * mmyth_ui) +{ + + if (mmyth_ui && mmyth_ui->videow) { + + return mmyth_ui->videow; + } + + return NULL; +} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_ui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_ui.h Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,91 @@ +#ifndef MMYTH_UI_H_ +#define MMYTH_UI_H_ + +#include +#include + +#include "config.h" + +#ifdef MAEMO_PLATFORM +#include "hildon-widgets/hildon-program.h" +#include "hildon-widgets/hildon-window.h" +#endif + +#include "mmyth_uicommon.h" +#include "mmyth_recordui.h" +#include "mmyth_schedulerui.h" +#include "mmyth_tvplayer.h" + +/* + * GMyth specific includes + */ +#include + +typedef struct _MMythUi { + + /* + * The main application window + */ + GtkWidget *main_window; + MMythUiCommon *current_uicommon; + + /* + * Main widget components + */ + GtkWidget *main_hbox; + GtkWidget *video_alignment; + GdkPixbuf *logo; + + /* + * Main widgets grouping + */ + MMythUiCommon *main_uicommon; + MMythUiCommon *video_uicommon; + MMythUiCommon *epg_grid_uicommon; + MMythUiCommon *record_uicommon; + MMythUiCommon *schedule_uicommon; + + GMythBackendInfo *backend_info; + + GtkWidget *videow; + int idle_id; + // GstTagList *tagcache; + + MMythRecordUI *mmyth_recordui; + MMythSchedulerUI *mmyth_schedulerui; + +#ifdef MAEMO_PLATFORM + HildonProgram *program; + GtkMenu *main_menu; + GtkWidget *menu_setup; +#endif + + MMythTVPlayer *tvplayer; + +} MMythUi; + +GdkPixbuf *icon_sports, + *icon_news, + *icon_movies, + *icon_shows; +GdkColor main_bg_color; + +void mmyth_set_main_widget(MMythUi * mmyth_ui, + MMythUiCommon * new_ui); +// void mmyth_play_selected(GtkButton * button, gpointer user_data); + +#ifdef MAEMO_PLATFORM +MMythUi *mmyth_ui_initialize(HildonProgram * program, + GtkWidget * main_window); +#else +MMythUi *mmyth_ui_initialize(GtkWidget * main_window); +#endif + +void mmyth_ui_finalize(MMythUi * mmyth_ui); + +void mmyth_ui_set_widget(MMythUi * mmyth_ui, + MMythUiCommon * new_uicommon); + +GtkWidget *mmyth_ui_get_video_widget(MMythUi * mmyth_ui); + +#endif /* MMYTH_UI_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_uicommon.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_uicommon.c Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,156 @@ + +#include +#include +#include + +#include "mmyth_uicommon.h" +#include "mmyth_ui.h" + +static void +refresh_time_on_screen(GtkWidget * label) +{ + time_t real_time; + struct tm sched_time; + GString *time_showed; + + time_showed = g_string_new(""); + time(&real_time); + + if (localtime_r((time_t *) & real_time, &sched_time) == NULL) { + g_error("localtime_r error in mmyth_epg_grid_view!\n"); + return; + } + + g_string_printf(time_showed, "%d:%02d:%02d", + sched_time.tm_hour, + sched_time.tm_min, sched_time.tm_sec); + + gtk_label_set_text(GTK_LABEL(label), time_showed->str); +} + +MMythUiCommon * +mmyth_uicommon_new(GtkWidget * main_widget, const gchar * label1, + const gchar * label2, const gchar * label3) +{ + + MMythUiCommon *ui_common = g_new0(MMythUiCommon, 1); + + if (!main_widget) { + g_warning("MMythUICommon created with a NULL main widget\n"); + } + + ui_common->main_widget = main_widget; + + ui_common->event_box = gtk_event_box_new(); + + /* + * Vertical box that divides the control area into two (buttons + + * clock) + */ + ui_common->vbox = gtk_vbox_new(FALSE, 0); /* spacing */ + gtk_container_set_border_width(GTK_CONTAINER(ui_common->vbox), 4); + + gtk_container_add(GTK_CONTAINER(ui_common->event_box), + ui_common->vbox); + gtk_widget_modify_bg(ui_common->event_box, GTK_STATE_NORMAL, + &main_bg_color); + + /* + * Vertical box that divides the control area into four + */ + ui_common->button_vbox = gtk_vbox_new(TRUE, 0); /* spacing */ + + gtk_container_set_border_width(GTK_CONTAINER(ui_common->button_vbox), + 0); + + /* + * The button 1 + */ + ui_common->button1 = gtk_button_new_with_label(label1); + gtk_widget_modify_bg(ui_common->button1, GTK_STATE_NORMAL, + &main_bg_color); + gtk_widget_set_size_request(ui_common->button1, BUTTON_WIDTH, + BUTTON_HEIGHT); + + /* + * The button 2 + */ + ui_common->button2 = gtk_button_new_with_label(label2); + gtk_widget_modify_bg(ui_common->button2, GTK_STATE_NORMAL, + &main_bg_color); + gtk_widget_set_size_request(ui_common->button2, BUTTON_WIDTH, + BUTTON_HEIGHT); + + /* + * The button 3 + */ + ui_common->button3 = gtk_button_new_with_label(label3); + gtk_widget_modify_bg(ui_common->button3, GTK_STATE_NORMAL, + &main_bg_color); + gtk_widget_set_size_request(ui_common->button3, BUTTON_WIDTH, + BUTTON_HEIGHT); + + /* + * The clock label + */ + ui_common->label = gtk_label_new("Starting..."); + gtk_widget_show(ui_common->label); + ui_common->source_id = + g_timeout_add(500, (GSourceFunc) refresh_time_on_screen, + ui_common->label); + + /* + * Packing components + */ + gtk_box_pack_start(GTK_BOX(ui_common->vbox), + ui_common->button_vbox, TRUE, TRUE, 0); + + gtk_box_pack_start(GTK_BOX(ui_common->vbox), + ui_common->label, FALSE, FALSE, 0); + + gtk_box_pack_start(GTK_BOX(ui_common->button_vbox), + ui_common->button1, FALSE, FALSE, 0); + + gtk_box_pack_start(GTK_BOX(ui_common->button_vbox), + ui_common->button2, FALSE, FALSE, 0); + + gtk_box_pack_start(GTK_BOX(ui_common->button_vbox), + ui_common->button3, FALSE, FALSE, 0); + + gtk_widget_show_all(ui_common->event_box); + + /* + * FIXME: mmyth_ui->video_alignment == NULL when mmyth_player_init + * fails + */ + if (ui_common->main_widget != NULL) + g_object_ref(ui_common->main_widget); + + g_object_ref(ui_common->vbox); + g_object_ref(ui_common->button_vbox); + g_object_ref(ui_common->label); + g_object_ref(ui_common->button1); + g_object_ref(ui_common->button2); + g_object_ref(ui_common->button3); + g_object_ref(ui_common->event_box); + return ui_common; +} + +void +mmyth_uicommon_free(MMythUiCommon * ui_common) +{ + g_debug("[%s] Clean uicommon used memory", __FUNCTION__); + + g_source_remove(ui_common->source_id); + + g_object_unref(ui_common->main_widget); + g_object_unref(ui_common->vbox); + g_object_unref(ui_common->button_vbox); + g_object_unref(ui_common->label); + g_object_unref(ui_common->button1); + g_object_unref(ui_common->button2); + g_object_unref(ui_common->button3); + g_object_unref(ui_common->event_box); + + g_free(ui_common); +} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_uicommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_uicommon.h Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,53 @@ +#ifndef MMYTH_UICOMMON_H_ +#define MMYTH_UICOMMON_H_ + +#include "config.h" + +#include +#include + +#ifndef MAEMO_PLATFORM +#define BUTTON_HEIGHT 50 +#define BUTTON_WIDTH 100 +#else +#define BUTTON_HEIGHT 80 +#define BUTTON_WIDTH 150 +#endif + +#define MAIN_WINDOW_WIDTH 550 +#define MAIN_WINDOW_HEIGHT 250 + +#define CHANNELS_DIALOG_WIDTH 300 +#define CHANNELS_DIALOG_HEIGHT 200 + +#define SETTINGS_DIALOG_WIDTH 300 +#define SETTINGS_DIALOG_HEIGHT 120 + +extern GdkColor main_bg_color; + +typedef struct _MMythUiCommon { + GtkWidget *main_widget; + + /* + * event box to set the background color + */ + GtkWidget *event_box; + + GtkWidget *vbox; + GtkWidget *button_vbox; + GtkWidget *label; + + GtkWidget *button1; + GtkWidget *button2; + GtkWidget *button3; + + gint source_id; +} MMythUiCommon; + +MMythUiCommon *mmyth_uicommon_new(GtkWidget * main_widget, + const gchar * label1, + const gchar * label2, + const gchar * label3); +void mmyth_uicommon_free(MMythUiCommon * ui_common); + +#endif /* MMYTH_UICOMMON_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_uisettings.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_uisettings.c Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,196 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mmyth_uisettings.h" + +#include + +static GtkWidget *settings_dialog; +static GtkWidget *entry_hostname; +static GtkWidget *entry_dbname; +static GtkWidget *entry_username; +static GtkWidget *entry_passwd; +static GtkWidget *entry_port; + +static void settings_dialog_update_data(void); +static GtkWidget *add_entry_to_table(GtkWidget * table, + const gchar * init_str, + guint pos_left, guint pos_right, + guint pos_top, guint pos_bottom); +static GtkWidget *add_label_to_table(GtkWidget * table, const gchar * str, + guint pos_left, guint pos_right, + guint pos_top, guint pos_bottom); + +static GMythBackendInfo *backend_info = NULL; + +gboolean +mmyth_uisettings_run(GtkWindow * main_window) +{ + + GtkWidget *settings_table; + GtkWidget *label_hostname, + *label_dbname; + GtkWidget *label_username, + *label_passwd, + *label_port; + + backend_info = gmyth_backend_info_new_full("localhost", "mythtv", + "mythtv", "mythconverg", + 6543); + + settings_dialog = gtk_dialog_new_with_buttons("Settings", + main_window, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, + GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, + GTK_RESPONSE_REJECT, + NULL); + + gtk_widget_set_size_request(settings_dialog, 400, 244); + + /* + * scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); + * gtk_widget_show (scrolledwindow1); gtk_container_add (GTK_CONTAINER + * (window1), scrolledwindow1); gtk_scrolled_window_set_policy + * (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, + * GTK_POLICY_NEVER); + * + * viewport1 = gtk_viewport_new (NULL, NULL); gtk_widget_show + * (viewport1); gtk_container_add (GTK_CONTAINER (scrolledwindow1), + * viewport1); gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport1), + * GTK_SHADOW_NONE); + */ + + // Creates the table and attach it to the settings dialog + settings_table = gtk_table_new(5, 2, FALSE); + gtk_widget_show(settings_table); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(settings_dialog)->vbox), + settings_table, FALSE, TRUE, 0); + gtk_container_set_border_width(GTK_CONTAINER(settings_table), 3); + gtk_table_set_row_spacings(GTK_TABLE(settings_table), 5); + gtk_table_set_col_spacings(GTK_TABLE(settings_table), 10); + + label_hostname = + add_label_to_table(settings_table, "Host Name:", 0, 1, 0, 1); + label_dbname = + add_label_to_table(settings_table, "Database Name:", 0, 1, 1, 2); + label_username = + add_label_to_table(settings_table, "Username:", 0, 1, 2, 3); + label_passwd = + add_label_to_table(settings_table, "Password:", 0, 1, 3, 4); + label_port = + add_label_to_table(settings_table, "Server port:", 0, 1, 4, 5); + + entry_hostname = add_entry_to_table(settings_table, + gmyth_backend_info_get_hostname + (backend_info), 1, 2, 0, 1); + entry_dbname = + add_entry_to_table(settings_table, + gmyth_backend_info_get_db_name(backend_info), 1, + 2, 1, 2); + entry_username = + add_entry_to_table(settings_table, + gmyth_backend_info_get_username(backend_info), + 1, 2, 2, 3); + entry_passwd = + add_entry_to_table(settings_table, + gmyth_backend_info_get_password(backend_info), + 1, 2, 3, 4); + + entry_port = + add_entry_to_table(settings_table, + g_strdup_printf("%d", + gmyth_backend_info_get_port + (backend_info)), 1, 2, 4, 5); + + if (gtk_dialog_run(GTK_DIALOG(settings_dialog)) == GTK_RESPONSE_ACCEPT) { + settings_dialog_update_data(); + gtk_widget_destroy(settings_dialog); + return TRUE; + } + + gtk_widget_destroy(settings_dialog); + + return FALSE; + +} + +static GtkWidget * +add_label_to_table(GtkWidget * table, const gchar * str, guint pos_left, + guint pos_right, guint pos_top, guint pos_bottom) +{ + GtkWidget *tmp_label = gtk_label_new(str); + + gtk_widget_show(tmp_label); + gtk_table_attach(GTK_TABLE(table), tmp_label, + pos_left, pos_right, pos_top, pos_bottom, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment(GTK_MISC(tmp_label), 0, 0.5); + + return tmp_label; +} + +static GtkWidget * +add_entry_to_table(GtkWidget * table, const gchar * init_str, + guint pos_left, guint pos_right, guint pos_top, + guint pos_bottom) +{ + GtkWidget *tmp_entry = gtk_entry_new(); + gtk_widget_show(tmp_entry); + gtk_table_attach(GTK_TABLE(table), tmp_entry, + pos_left, pos_right, pos_top, pos_bottom, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + if (init_str) + gtk_entry_set_text(GTK_ENTRY(tmp_entry), init_str); + + // gtk_entry_set_invisible_char (GTK_ENTRY (entry_port), 9679); + + return tmp_entry; +} + +static void +settings_dialog_update_data(void) +{ + // GMythSettings *backend_info = gmyth_context_get_settings(); + + if (!backend_info) { + g_warning + ("[%s] Could not get GMythSettings instance from context\n", + __FUNCTION__); + return; + } + + gmyth_backend_info_set_hostname(backend_info, + gtk_entry_get_text(GTK_ENTRY + (entry_hostname))); + + gmyth_backend_info_set_db_name(backend_info, + gtk_entry_get_text(GTK_ENTRY + (entry_dbname))); + + gmyth_backend_info_set_username(backend_info, + gtk_entry_get_text(GTK_ENTRY + (entry_username))); + + gmyth_backend_info_set_password(backend_info, + gtk_entry_get_text(GTK_ENTRY + (entry_passwd))); + + gmyth_backend_info_set_port(backend_info, + (gint) + g_ascii_strtoull(gtk_entry_get_text + (GTK_ENTRY(entry_port)), + NULL, 10)); + + // gmyth_backend_info_save (backend_info); + +} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui-old/src/mmyth_uisettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/maemo-ui-old/src/mmyth_uisettings.h Wed Aug 01 14:50:29 2007 +0100 @@ -0,0 +1,6 @@ +#ifndef MMYTH_SETTINGS_H_ +#define MMYTH_SETTINGS_H_ + +gboolean mmyth_uisettings_run(GtkWindow * main_window); + +#endif /* MMYTH_SETTINGS_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/AUTHORS --- a/maemo-ui/AUTHORS Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -Alexsandro Jose Virginio dos Santos -Hallyson Luiz de Morais Melo -Leonardo Sobral Cunha -Rosfran Lins Borges diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/COPYING --- a/maemo-ui/COPYING Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. 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. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/ChangeLog --- a/maemo-ui/ChangeLog Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -2006-08-17 Rosfran Borges - * Added the correct gstreamer-base package (GSTBASE) at the configure.ac; - GSTBASE_CFLAGS and GSTBASE_LIBS variables had the same values from - the GST_CFLAGS/GST_LIBS. - -2006-08-16 Rosfran Borges - * Fixed some installation issues, regarding lib-installing to the - correct directory, and copying the header files to the destination - dir (make install). - * Put 'pkg-config' resource to the Maemo Myth library. The name of the - PKG-CONFIG resource is 'maemo-myth', plus the minor and major version. - Actually, the version is '0.1', so the library config file is: - 'maemo-myth-0.1.pc'. You can type: 'pkg-config --cflags --libs - maemo-myth-0.1'. - * Many adjustments in the automake/autoconf configuration files - (configure.ac, Makefile.am) - some autotools misusage fixed. - * Added the MythURI structure, and the URI parsing utility functions - (missing in the GLib). - * Some functions were exported (myth_socket, mmyth_context), that's - why many ther modules need to use them. - * Fixed some library dependencies. - * Prepared to be used inside the GStreamer (linking with the MythTV - plug-in). - diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/INSTALL --- a/maemo-ui/INSTALL Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,236 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free -Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is -disabled by default to prevent problems with accidental use of stale -cache files.) - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. - -Installation Names -================== - -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). Here is a another example: - - /bin/bash ./configure CONFIG_SHELL=/bin/bash - -Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent -configuration-related scripts to be executed by `/bin/bash'. - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/Makefile.am --- a/maemo-ui/Makefile.am Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -SUBDIRS= src pixmaps - -EXTRA_DIST = \ - autogen.sh \ - AUTHORS \ - COPYING \ - README - diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/autogen.sh --- a/maemo-ui/autogen.sh Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -#!/bin/sh -# Run this to generate all the initial makefiles, etc. - -DIE=0 -package=gmyth -srcfile=configure.ac - -# a quick cvs co if necessary to alleviate the pain - may remove this -# when developers get a clue ;) -if test ! -d common; -then - echo "+ getting common/ from svn" - svn co common -fi - -# source helper functions -if test ! -f common/autogen-helper.sh; -then - echo There is something wrong with your source tree. - echo You are missing common/autogen-helper.sh - exit 1 -fi -. common/autogen-helper.sh - -CONFIGURE_DEF_OPT='--enable-maintainer-mode' - -autogen_options - -echo -n "+ check for build tools" -if test ! -z "$NOCHECK"; then echo " skipped"; else echo; fi -version_check "autoconf" "$AUTOCONF autoconf autoconf-2.54 autoconf-2.53" \ - "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 53 || DIE=1 -version_check "automake" "$AUTOMAKE automake automake-1.9 automake-1.8 automake-1.7 automake-1.6" \ - "ftp://ftp.gnu.org/pub/gnu/automake/" 1 6 || DIE=1 -version_check "libtoolize" "$LIBTOOLIZE libtoolize" \ - "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 5 0 || DIE=1 -version_check "pkg-config" "" \ - "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1 - -die_check $DIE - -aclocal_check || DIE=1 -autoheader_check || DIE=1 - -die_check $DIE - -# if no arguments specified then this will be printed -if test -z "$*"; then - echo "+ checking for autogen.sh options" - echo " This autogen script will automatically run ./configure as:" - echo " ./configure $CONFIGURE_DEF_OPT" - echo " To pass any additional options, please specify them on the $0" - echo " command line." -fi - -toplevel_check $srcfile - -tool_run "$aclocal" "-I m4 $ACLOCAL_FLAGS" -tool_run "$libtoolize" "--copy --force" -tool_run "$autoheader" - -# touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo -echo timestamp > stamp-h.in 2> /dev/null - -tool_run "$autoconf" -tool_run "$automake" "-a -c" - -# if enable exists, add an -enable option for each of the lines in that file -if test -f enable; then - for a in `cat enable`; do - CONFIGURE_FILE_OPT="--enable-$a" - done -fi - -# if disable exists, add an -disable option for each of the lines in that file -if test -f disable; then - for a in `cat disable`; do - CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a" - done -fi - -test -n "$NOCONFIGURE" && { - echo "+ skipping configure stage for package $package, as requested." - echo "+ autogen.sh done." - exit 0 -} - -echo "+ running configure ... " -test ! -z "$CONFIGURE_DEF_OPT" && echo " ./configure default flags: $CONFIGURE_DEF_OPT" -test ! -z "$CONFIGURE_EXT_OPT" && echo " ./configure external flags: $CONFIGURE_EXT_OPT" -test ! -z "$CONFIGURE_FILE_OPT" && echo " ./configure enable/disable flags: $CONFIGURE_FILE_OPT" -echo - -./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || { - echo " configure failed" - exit 1 -} - -echo "Now type 'make' to compile $package." diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/common/Makefile.am --- a/maemo-ui/common/Makefile.am Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -EXTRA_DIST = autogen-helper.sh diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/common/autogen-helper.sh --- a/maemo-ui/common/autogen-helper.sh Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,302 +0,0 @@ -# a silly hack that generates autoregen.sh but it's handy -echo "#!/bin/sh" > autoregen.sh -echo "./autogen.sh $@ \$@" >> autoregen.sh -chmod +x autoregen.sh - -# helper functions for autogen.sh - -debug () -# print out a debug message if DEBUG is a defined variable -{ - if test ! -z "$DEBUG" - then - echo "DEBUG: $1" - fi -} - -version_check () -# check the version of a package -# first argument : package name (executable) -# second argument : optional path where to look for it instead -# third argument : source download url -# rest of arguments : major, minor, micro version -# all consecutive ones : suggestions for binaries to use -# (if not specified in second argument) -{ - PACKAGE=$1 - PKG_PATH=$2 - URL=$3 - MAJOR=$4 - MINOR=$5 - MICRO=$6 - - # for backwards compatibility, we let PKG_PATH=PACKAGE when PKG_PATH null - if test -z "$PKG_PATH"; then PKG_PATH=$PACKAGE; fi - debug "major $MAJOR minor $MINOR micro $MICRO" - VERSION=$MAJOR - if test ! -z "$MINOR"; then VERSION=$VERSION.$MINOR; else MINOR=0; fi - if test ! -z "$MICRO"; then VERSION=$VERSION.$MICRO; else MICRO=0; fi - - debug "major $MAJOR minor $MINOR micro $MICRO" - - for SUGGESTION in $PKG_PATH; do - COMMAND="$SUGGESTION" - - # don't check if asked not to - test -z "$NOCHECK" && { - echo -n " checking for $COMMAND >= $VERSION ... " - } || { - # we set a var with the same name as the package, but stripped of - # unwanted chars - VAR=`echo $PACKAGE | sed 's/-//g'` - debug "setting $VAR" - eval $VAR="$COMMAND" - return 0 - } - - debug "checking version with $COMMAND" - ($COMMAND --version) < /dev/null > /dev/null 2>&1 || - { - echo "not found." - continue - } - # strip everything that's not a digit, then use cut to get the first field - pkg_version=`$COMMAND --version|head -n 1|sed 's/^[^0-9]*//'|cut -d' ' -f1` - debug "pkg_version $pkg_version" - # remove any non-digit characters from the version numbers to permit numeric - # comparison - pkg_major=`echo $pkg_version | cut -d. -f1 | sed s/[a-zA-Z\-].*//g` - pkg_minor=`echo $pkg_version | cut -d. -f2 | sed s/[a-zA-Z\-].*//g` - pkg_micro=`echo $pkg_version | cut -d. -f3 | sed s/[a-zA-Z\-].*//g` - test -z "$pkg_major" && pkg_major=0 - test -z "$pkg_minor" && pkg_minor=0 - test -z "$pkg_micro" && pkg_micro=0 - debug "found major $pkg_major minor $pkg_minor micro $pkg_micro" - - #start checking the version - debug "version check" - - # reset check - WRONG= - - if [ ! "$pkg_major" -gt "$MAJOR" ]; then - debug "major: $pkg_major <= $MAJOR" - if [ "$pkg_major" -lt "$MAJOR" ]; then - debug "major: $pkg_major < $MAJOR" - WRONG=1 - elif [ ! "$pkg_minor" -gt "$MINOR" ]; then - debug "minor: $pkg_minor <= $MINOR" - if [ "$pkg_minor" -lt "$MINOR" ]; then - debug "minor: $pkg_minor < $MINOR" - WRONG=1 - elif [ "$pkg_micro" -lt "$MICRO" ]; then - debug "micro: $pkg_micro < $MICRO" - WRONG=1 - fi - fi - fi - - if test ! -z "$WRONG"; then - echo "found $pkg_version, not ok !" - continue - else - echo "found $pkg_version, ok." - # we set a var with the same name as the package, but stripped of - # unwanted chars - VAR=`echo $PACKAGE | sed 's/-//g'` - debug "setting $VAR" - eval $VAR="$COMMAND" - return 0 - fi - done - - echo "not found !" - echo "You must have $PACKAGE installed to compile $package." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at $URL" - return 1; -} - -aclocal_check () -{ - # normally aclocal is part of automake - # so we expect it to be in the same place as automake - # so if a different automake is supplied, we need to adapt as well - # so how's about replacing automake with aclocal in the set var, - # and saving that in $aclocal ? - # note, this will fail if the actual automake isn't called automake* - # or if part of the path before it contains it - if [ -z "$automake" ]; then - echo "Error: no automake variable set !" - return 1 - else - aclocal=`echo $automake | sed s/automake/aclocal/` - debug "aclocal: $aclocal" - if [ "$aclocal" != "aclocal" ]; - then - CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-aclocal=$aclocal" - fi - if [ ! -x `which $aclocal` ]; then - echo "Error: cannot execute $aclocal !" - return 1 - fi - fi -} - -autoheader_check () -{ - # same here - autoheader is part of autoconf - # use the same voodoo - if [ -z "$autoconf" ]; then - echo "Error: no autoconf variable set !" - return 1 - else - autoheader=`echo $autoconf | sed s/autoconf/autoheader/` - debug "autoheader: $autoheader" - if [ "$autoheader" != "autoheader" ]; - then - CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoheader=$autoheader" - fi - if [ ! -x `which $autoheader` ]; then - echo "Error: cannot execute $autoheader !" - return 1 - fi - fi - -} - -autoconf_2_52d_check () -{ - # autoconf 2.52d has a weird issue involving a yes:no error - # so don't allow it's use - test -z "$NOCHECK" && { - ac_version=`$autoconf --version|head -n 1|sed 's/^[a-zA-Z\.\ ()]*//;s/ .*$//'` - if test "$ac_version" = "2.52d"; then - echo "autoconf 2.52d has an issue with our current build." - echo "We don't know who's to blame however. So until we do, get a" - echo "regular version. RPM's of a working version are on the gstreamer site." - exit 1 - fi - } - return 0 -} - -die_check () -{ - # call with $DIE - # if set to 1, we need to print something helpful then die - DIE=$1 - if test "x$DIE" = "x1"; - then - echo - echo "- Please get the right tools before proceeding." - echo "- Alternatively, if you're sure we're wrong, run with --nocheck." - exit 1 - fi -} - -autogen_options () -{ - if test "x$1" = "x"; then - return 0 - fi - - while test "x$1" != "x" ; do - optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - case "$1" in - --noconfigure) - NOCONFIGURE=defined - AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --noconfigure" - echo "+ configure run disabled" - shift - ;; - --nocheck) - AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --nocheck" - NOCHECK=defined - echo "+ autotools version check disabled" - shift - ;; - --debug) - DEBUG=defined - AUTOGEN_EXT_OPT="$AUTOGEN_EXT_OPT --debug" - echo "+ debug output enabled" - shift - ;; - --prefix=*) - CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$optarg" - echo "+ passing --prefix=$optarg to configure" - shift - ;; - --prefix) - shift - echo "DEBUG: $1" - CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT --prefix=$1" - echo "+ passing --prefix=$1 to configure" - shift - ;; - -h|--help) - echo "autogen.sh (autogen options) -- (configure options)" - echo "autogen.sh help options: " - echo " --noconfigure don't run the configure script" - echo " --nocheck don't do version checks" - echo " --debug debug the autogen process" - echo " --prefix will be passed on to configure" - echo - echo " --with-autoconf PATH use autoconf in PATH" - echo " --with-automake PATH use automake in PATH" - echo - echo "to pass options to configure, put them as arguments after -- " - exit 1 - ;; - --with-automake=*) - AUTOMAKE=$optarg - echo "+ using alternate automake in $optarg" - CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-automake=$AUTOMAKE" - shift - ;; - --with-autoconf=*) - AUTOCONF=$optarg - echo "+ using alternate autoconf in $optarg" - CONFIGURE_DEF_OPT="$CONFIGURE_DEF_OPT --with-autoconf=$AUTOCONF" - shift - ;; - --disable*|--enable*|--with*) - echo "+ passing option $1 to configure" - CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $1" - shift - ;; - --) shift ; break ;; - *) echo "- ignoring unknown autogen.sh argument $1"; shift ;; - esac - done - - for arg do CONFIGURE_EXT_OPT="$CONFIGURE_EXT_OPT $arg"; done - if test ! -z "$CONFIGURE_EXT_OPT" - then - echo "+ options passed to configure: $CONFIGURE_EXT_OPT" - fi -} - -toplevel_check () -{ - srcfile=$1 - test -f $srcfile || { - echo "You must run this script in the top-level $package directory" - exit 1 - } -} - - -tool_run () -{ - tool=$1 - options=$2 - run_if_fail=$3 - echo "+ running $tool $options..." - $tool $options || { - echo - echo $tool failed - eval $run_if_fail - exit 1 - } -} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/configure.ac --- a/maemo-ui/configure.ac Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.50) - -AC_INIT([maemo-myth],[0.1]) - -dnl AC_CONFIG_SRCDIR([src/mmyth_main.c]) -AC_CONFIG_HEADER(config.h) - -dnl when going to/from release please set the nano (fourth number) right ! -dnl releases only do Wall, SVN and prerelease does Werror too -AS_VERSION(maemo-myth, GMYTH, 0, 1, 0, 3, GMYTH_SVN="no", GMYTH_SVN="yes") - -GMYTH_MAJORMINOR=$GMYTH_MAJOR_VERSION.$GMYTH_MINOR_VERSION - -AC_SUBST(GMYTH_MAJORMINOR) - -dnl AM_MAINTAINER_MODE provides the option to enable maintainer mode -AM_MAINTAINER_MODE -dnl make aclocal work in maintainer mode -AC_SUBST(ACLOCAL_AMFLAGS, "-I m4") - -# Checks for programs. -# check for tools -# Make sure CFLAGS is defined to stop AC_PROC_CC adding -g -CFLAGS="$CFLAGS -Wall" -AC_PROG_CC -AC_PROG_LIBTOOL - -# Checks for libraries. - -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_PID_T -AC_STRUCT_TM - -# Checks for library functions. -AC_FUNC_FORK -AC_PROG_GCC_TRADITIONAL -AC_FUNC_MALLOC -AC_FUNC_MKTIME -AC_FUNC_VPRINTF -AC_CHECK_FUNCS([memset socket stime strstr strtoul]) - -AM_INIT_AUTOMAKE($PACKAGE, $VERSION) - -# Checks required packages - -dnl Test if --disable-debug given -AC_ARG_ENABLE(debug, - [AC_HELP_STRING([--disable-debug], [disable debugging mode])], - enable_debug="$enableval", - enable_debug=yes) - -if test "x$enable_debug" = "xyes" ; then - CFLAGS="$CFLAGS -g" -else - AC_DEFINE( NDEBUG, 1, [disable debug messages] ) - CFLAGS="$CFLAGS -O2 -DG_DISABLE_CHECKS -DNDEBUG" -fi - -AM_CONDITIONAL( NDEBUG, test "x$enable_debug" = "xyes" ) - -# Check for pkgconfig -AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no) -# Give error and exit if we don't have pkgconfig -if test "x$HAVE_PKGCONFIG" = "xno"; then - AC_MSG_ERROR(you need to have pkgconfig installed !) -fi - -# Check for Glib2.0 -PKG_CHECK_MODULES(GLIB, glib-2.0, HAVE_GLIB=yes,HAVE_GLIB=no) - -# Give error and exit if we don't have glib -if test "x$HAVE_GLIB" = "xno"; then - AC_MSG_ERROR(you need glib-2.0 installed) -fi - -# make GLIB_CFLAGS and GLIB_LIBS available -AC_SUBST(GLIB_CFLAGS) -AC_SUBST(GLIB_LIBS) - -# Check for GObject2.0 -PKG_CHECK_MODULES(GOBJECT, - gobject-2.0, - HAVE_GOBJECT=yes, HAVE_GOBJECT=no) - -# Give error and exit if we don't have gobject -if test "x$HAVE_GOBJECT" = "xno"; then - AC_MSG_ERROR(you need gobject-2.0 installed) -fi - -# make GOBJECT_CFLAGS and GOBJECT_LIBS available -AC_SUBST(GOBJECT_CFLAGS) -AC_SUBST(GOBJECT_LIBS) - -# Check for GTK+-2.0 -PKG_CHECK_MODULES(GTK, gtk+-2.0, HAVE_GTK=yes,HAVE_GTK=no) - -# Give error and exit if we don't have gtk -if test "x$HAVE_GTK" = "xyes"; then - AC_DEFINE(WITH_GTK, 1, [build with GTK+ related stuff]) - dnl AC_MSG_ERROR(you need gtk+-2.0 installed) -else - AC_MSG_RESULT(no) -fi - -AM_CONDITIONAL(WITH_GTK, test "x$HAVE_GTK" = "xyes" ) - -# make GTK_CFLAGS and GTK_LIBS available -AC_SUBST(GTK_CFLAGS) -AC_SUBST(GTK_LIBS) - -dnl ========== Check for Hildon Libraries -PKG_CHECK_MODULES(HILDON, - libosso hildon-lgpl libosso hildon-status-bar-lib libhildonmenu hildon-base-lib hildon-control-panel hildon-libs, - HAVE_HILDON=yes, HAVE_HILDON=no) - -if test "x$HAVE_HILDON" = "xyes"; then - HILDON_CFLAGS="$HILDON_CFLAGS -DMAEMO_PLATFORM" - AC_DEFINE(MAEMO_PLATFORM, 1, [build with hildon libs]) -else - AC_MSG_RESULT(no) -fi - -AM_CONDITIONAL(MAEMO_PLATFORM, test "x$HAVE_HILDON" = "xyes") - -dnl make HILDON_CFLAGS and HILDON_LIBS available -AC_SUBST(HILDON_CFLAGS) -AC_SUBST(HILDON_LIBS) - -# Check for libxml-2.0 -PKG_CHECK_MODULES(LIBXML, libxml-2.0, HAVE_LIBXML=yes,HAVE_LIBXML=no) - -# Give error and exit if we don't have libxml -if test "x$HAVE_LIBXML" = "xno"; then - AC_MSG_ERROR(you need libxml-2.0 installed) -fi - -# make LIBXML_CFLAGS and LIBXML_LIBS available -AC_SUBST(LIBXML_CFLAGS) -AC_SUBST(LIBXML_LIBS) - - -# check for gstreamer development files -GST_REQUIRED=0.10 -GST_MAJORMINOR=0.10 -PKG_CHECK_MODULES(GST, \ - gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED, - HAVE_GST=yes, HAVE_GST=no) - -# Give error and exit if we don't have gstreamer -if test "x$HAVE_GST" = "xno"; then - AC_MSG_ERROR(you need gstreamer development packages installed !) -fi - -# make GST_CFLAGS and GST_LIBS available -AC_SUBST(GST_CFLAGS) -AC_SUBST(GST_LIBS) - -# check for gstreamer-base plugins (xoverlay interface) -GSTBASE_REQUIRED=0.10 -GSTBASE_MAJORMINOR=0.10 -PKG_CHECK_MODULES(GSTBASE, \ - gstreamer-base-$GSTBASE_MAJORMINOR >= $GSTBASE_REQUIRED, - HAVE_GSTBASE=yes, HAVE_GSTBASE=no) - -# Give error and exit if we don't have gstreamer base libraries -if test "x$HAVE_GSTBASE" = "xno"; then - AC_MSG_ERROR(you need gstreamer base development packages installed !) -fi - -# make GSTBASE_CFLAGS and GSTBASE_LIBS available -AC_SUBST(GSTBASE_CFLAGS) -AC_SUBST(GSTBASE_LIBS) - -# make GST_MAJORMINOR available in Makefile.am -AC_SUBST(GST_MAJORMINOR) - - -# check for gstreamer-base plugins (xoverlay interface) -GSTPLUGINSBASE_REQUIRED=0.10 -GSTPLUGINSBASE_MAJORMINOR=0.10 -PKG_CHECK_MODULES(GSTPLUGINSBASE, \ - gstreamer-plugins-base-$GSTPLUGINSBASE_MAJORMINOR >= $GSTPLUGINSBASE_REQUIRED, - HAVE_GSTPLUGINSBASE=yes, HAVE_GSTPLUGINSBASE=no) - -# Give error and exit if we don't have gstreamer base libraries -if test "x$HAVE_GSTPLUGINSBASE" = "xno"; then - AC_MSG_ERROR(you need gstreamer plugins base development packages installed !) -fi - -# make GSTPLUGINSBASE_CFLAGS and GSTPLUGINSBASE_LIBS available -AC_SUBST(GSTPLUGINSBASE_CFLAGS) -AC_SUBST(GSTPLUGINSBASE_LIBS) - -# check for gstreamer-interfaces (xoverlay interface) -AC_CHECK_FUNC( gst_x_overlay_get_type, - HAVE_GSTINTERFACES=yes, HAVE_GSTINTERFACES=no ) - -# Give error and exit if we don't have gstreamer base libraries -if test "x$HAVE_GSTINTERFACES" = "xno"; then - AC_MSG_NOTICE(you need gstreamer interfaces development packages installed !) - CFLAGS="$CFLAGS -lgstinterfaces-$GSTPLUGINSBASE_MAJORMINOR" -fi - -# Check for gmyth-0.1 - -PKG_CHECK_MODULES(LIBGMYTH, gmyth-0.1, HAVE_LIBGMYTH=yes,HAVE_LIBGMYTH=no) - -# Give error and exit if we don't have gmyth-0.1 -if test "x$HAVE_LIBGMYTH" = "xno"; then - AC_MSG_ERROR(you need gmyth-0.1 installed) -fi - -# make LIBXML_CFLAGS and LIBXML_LIBS available -AC_SUBST(LIBGMYTH_CFLAGS) -AC_SUBST(LIBGMYTH_LIBS) - - -AC_CONFIG_FILES([Makefile - src/Makefile - pixmaps/Makefile]) -AC_OUTPUT diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/m4/Makefile.am --- a/maemo-ui/m4/Makefile.am Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -EXTRA_DIST = \ - ac_doxygen.m4 \ - as-compiler-flag.m4 \ - as-expand.m4 \ - as-version.m4 \ - as-gtk-doc.m4 - diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/m4/ac_doxygen.m4 --- a/maemo-ui/m4/ac_doxygen.m4 Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,312 +0,0 @@ -# This file is part of Autoconf. -*- Autoconf -*- - -# Copyright (C) 2004 Oren Ben-Kiki -# This file is distributed under the same terms as the Autoconf macro files. - -# Generate automatic documentation using Doxygen. Works in concert with the -# aminclude.m4 file and a compatible doxygen configuration file. Defines the -# following public macros: -# -# DX_???_FEATURE(ON|OFF) - control the default setting fo a Doxygen feature. -# Supported features are 'DOXYGEN' itself, 'DOT' for generating graphics, -# 'HTML' for plain HTML, 'CHM' for compressed HTML help (for MS users), 'CHI' -# for generating a seperate .chi file by the .chm file, and 'MAN', 'RTF', -# 'XML', 'PDF' and 'PS' for the appropriate output formats. The environment -# variable DOXYGEN_PAPER_SIZE may be specified to override the default 'a4wide' -# paper size. -# -# By default, HTML, PDF and PS documentation is generated as this seems to be -# the most popular and portable combination. MAN pages created by Doxygen are -# usually problematic, though by picking an appropriate subset and doing some -# massaging they might be better than nothing. CHM and RTF are specific for MS -# (note that you can't generate both HTML and CHM at the same time). The XML is -# rather useless unless you apply specialized post-processing to it. -# -# The macro mainly controls the default state of the feature. The use can -# override the default by specifying --enable or --disable. The macros ensure -# that contradictory flags are not given (e.g., --enable-doxygen-html and -# --enable-doxygen-chm, --enable-doxygen-anything with --disable-doxygen, etc.) -# Finally, each feature will be automatically disabled (with a warning) if the -# required programs are missing. -# -# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN with -# the following parameters: a one-word name for the project for use as a -# filename base etc., an optional configuration file name (the default is -# 'Doxyfile', the same as Doxygen's default), and an optional output directory -# name (the default is 'doxygen-doc'). - -## ----------## -## Defaults. ## -## ----------## - -DX_ENV="" -AC_DEFUN([DX_FEATURE_doc], ON) -AC_DEFUN([DX_FEATURE_dot], ON) -AC_DEFUN([DX_FEATURE_man], OFF) -AC_DEFUN([DX_FEATURE_html], ON) -AC_DEFUN([DX_FEATURE_chm], OFF) -AC_DEFUN([DX_FEATURE_chi], OFF) -AC_DEFUN([DX_FEATURE_rtf], OFF) -AC_DEFUN([DX_FEATURE_xml], OFF) -AC_DEFUN([DX_FEATURE_pdf], ON) -AC_DEFUN([DX_FEATURE_ps], ON) - -## --------------- ## -## Private macros. ## -## --------------- ## - -# DX_ENV_APPEND(VARIABLE, VALUE) -# ------------------------------ -# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen. -AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])]) - -# DX_DIRNAME_EXPR -# --------------- -# Expand into a shell expression prints the directory part of a path. -AC_DEFUN([DX_DIRNAME_EXPR], - [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']]) - -# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF) -# ------------------------------------- -# Expands according to the M4 (static) status of the feature. -AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])]) - -# DX_REQUIRE_PROG(VARIABLE, PROGRAM) -# ---------------------------------- -# Require the specified program to be found for the DX_CURRENT_FEATURE to work. -AC_DEFUN([DX_REQUIRE_PROG], [ -AC_PATH_TOOL([$1], [$2]) -if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then - AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION]) - AC_SUBST([DX_FLAG_[]DX_CURRENT_FEATURE], 0) -fi -]) - -# DX_TEST_FEATURE(FEATURE) -# ------------------------ -# Expand to a shell expression testing whether the feature is active. -AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1]) - -# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE) -# ------------------------------------------------- -# Verify that a required features has the right state before trying to turn on -# the DX_CURRENT_FEATURE. -AC_DEFUN([DX_CHECK_DEPEND], [ -test "$DX_FLAG_$1" = "$2" \ -|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1, - requires, contradicts) doxygen-DX_CURRENT_FEATURE]) -]) - -# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE) -# ---------------------------------------------------------- -# Turn off the DX_CURRENT_FEATURE if the required feature is off. -AC_DEFUN([DX_CLEAR_DEPEND], [ -test "$DX_FLAG_$1" = "$2" || AC_SUBST([DX_FLAG_[]DX_CURRENT_FEATURE], 0) -]) - -# DX_FEATURE_ARG(FEATURE, DESCRIPTION, -# CHECK_DEPEND, CLEAR_DEPEND, -# REQUIRE, DO-IF-ON, DO-IF-OFF) -# -------------------------------------------- -# Parse the command-line option controlling a feature. CHECK_DEPEND is called -# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND), -# otherwise CLEAR_DEPEND is called to turn off the default state if a required -# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional -# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and -# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature. -AC_DEFUN([DX_ARG_ABLE], [ - AC_DEFUN([DX_CURRENT_FEATURE], [$1]) - AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2]) - AC_ARG_ENABLE(doxygen-$1, - [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1], - [--enable-doxygen-$1]), - DX_IF_FEATURE([$1], [don't $2], [$2]))], - [ -case "$enableval" in -#( -y|Y|yes|Yes|YES) - AC_SUBST([DX_FLAG_$1], 1) - $3 -;; #( -n|N|no|No|NO) - AC_SUBST([DX_FLAG_$1], 0) -;; #( -*) - AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1]) -;; -esac -], [ -AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)]) -$4 -]) -if DX_TEST_FEATURE([$1]); then - $5 - : -fi -if DX_TEST_FEATURE([$1]); then - AM_CONDITIONAL(DX_COND_$1, :) - $6 - : -else - AM_CONDITIONAL(DX_COND_$1, false) - $7 - : -fi -]) - -## -------------- ## -## Public macros. ## -## -------------- ## - -# DX_XXX_FEATURE(DEFAULT_STATE) -# ----------------------------- -AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])]) -AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])]) -AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])]) -AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])]) -AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])]) -AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])]) -AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) -AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) -AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])]) -AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])]) - -# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR]) -# --------------------------------------------------------- -# PROJECT also serves as the base name for the documentation files. -# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc". -AC_DEFUN([DX_INIT_DOXYGEN], [ - -# Files: -AC_SUBST([DX_PROJECT], [$1]) -AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])]) -AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])]) - -# Environment variables used inside doxygen.cfg: -DX_ENV_APPEND(SRCDIR, $srcdir) -DX_ENV_APPEND(PROJECT, $DX_PROJECT) -DX_ENV_APPEND(DOCDIR, $DX_DOCDIR) -DX_ENV_APPEND(VERSION, $PACKAGE_VERSION) - -# Doxygen itself: -DX_ARG_ABLE(doc, [generate any doxygen documentation], - [], - [], - [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen) - DX_REQUIRE_PROG([DX_PERL], perl)], - [DX_ENV_APPEND(PERL_PATH, $DX_PERL)]) - -# Dot for graphics: -DX_ARG_ABLE(dot, [generate graphics for doxygen documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_DOT], dot)], - [DX_ENV_APPEND(HAVE_DOT, YES) - DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])], - [DX_ENV_APPEND(HAVE_DOT, NO)]) - -# Man pages generation: -DX_ARG_ABLE(man, [generate doxygen manual pages], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [], - [DX_ENV_APPEND(GENERATE_MAN, YES)], - [DX_ENV_APPEND(GENERATE_MAN, NO)]) - -# RTF file generation: -DX_ARG_ABLE(rtf, [generate doxygen RTF documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [], - [DX_ENV_APPEND(GENERATE_RTF, YES)], - [DX_ENV_APPEND(GENERATE_RTF, NO)]) - -# XML file generation: -DX_ARG_ABLE(xml, [generate doxygen XML documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [], - [DX_ENV_APPEND(GENERATE_XML, YES)], - [DX_ENV_APPEND(GENERATE_XML, NO)]) - -# (Compressed) HTML help generation: -DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_HHC], hhc)], - [DX_ENV_APPEND(HHC_PATH, $DX_HHC) - DX_ENV_APPEND(GENERATE_HTML, YES) - DX_ENV_APPEND(GENERATE_HTMLHELP, YES)], - [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)]) - -# Seperate CHI file generation. -DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file], - [DX_CHECK_DEPEND(chm, 1)], - [DX_CLEAR_DEPEND(chm, 1)], - [], - [DX_ENV_APPEND(GENERATE_CHI, YES)], - [DX_ENV_APPEND(GENERATE_CHI, NO)]) - -# Plain HTML pages generation: -DX_ARG_ABLE(html, [generate doxygen plain HTML documentation], - [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)], - [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)], - [], - [DX_ENV_APPEND(GENERATE_HTML, YES)], - [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)]) - -# PostScript file generation: -DX_ARG_ABLE(ps, [generate doxygen PostScript documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_LATEX], latex) - DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) - DX_REQUIRE_PROG([DX_DVIPS], dvips) - DX_REQUIRE_PROG([DX_EGREP], egrep)]) - -# PDF file generation: -DX_ARG_ABLE(pdf, [generate doxygen PDF documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex) - DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) - DX_REQUIRE_PROG([DX_EGREP], egrep)]) - -# LaTeX generation for PS and/or PDF: -if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then - AM_CONDITIONAL(DX_COND_latex, :) - DX_ENV_APPEND(GENERATE_LATEX, YES) -else - AM_CONDITIONAL(DX_COND_latex, false) - DX_ENV_APPEND(GENERATE_LATEX, NO) -fi - -# Paper size for PS and/or PDF: -AC_ARG_VAR(DOXYGEN_PAPER_SIZE, - [a4wide (default), a4, letter, legal or executive]) -case "$DOXYGEN_PAPER_SIZE" in -#( -"") - AC_SUBST(DOXYGEN_PAPER_SIZE, "") -;; #( -a4wide|a4|letter|legal|executive) - DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE) -;; #( -*) - AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE']) -;; -esac - -#For debugging: -#echo DX_FLAG_doc=$DX_FLAG_doc -#echo DX_FLAG_dot=$DX_FLAG_dot -#echo DX_FLAG_man=$DX_FLAG_man -#echo DX_FLAG_html=$DX_FLAG_html -#echo DX_FLAG_chm=$DX_FLAG_chm -#echo DX_FLAG_chi=$DX_FLAG_chi -#echo DX_FLAG_rtf=$DX_FLAG_rtf -#echo DX_FLAG_xml=$DX_FLAG_xml -#echo DX_FLAG_pdf=$DX_FLAG_pdf -#echo DX_FLAG_ps=$DX_FLAG_ps -#echo DX_ENV=$DX_ENV -]) diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/m4/as-compiler-flag.m4 --- a/maemo-ui/m4/as-compiler-flag.m4 Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -dnl as-compiler-flag.m4 0.1.0 - -dnl autostars m4 macro for detection of compiler flags - -dnl David Schleef - -dnl $Id: as-compiler-flag.m4,v 1.1.1.1 2005/08/26 00:42:44 andrunko Exp $ - -dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) -dnl Tries to compile with the given CFLAGS. -dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, -dnl and ACTION-IF-NOT-ACCEPTED otherwise. - -AC_DEFUN([AS_COMPILER_FLAG], -[ - AC_MSG_CHECKING([to see if compiler understands $1]) - - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $1" - - AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) - CFLAGS="$save_CFLAGS" - - if test "X$flag_ok" = Xyes ; then - $2 - true - else - $3 - true - fi - AC_MSG_RESULT([$flag_ok]) -]) - diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/m4/as-expand.m4 --- a/maemo-ui/m4/as-expand.m4 Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) -dnl -dnl example -dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) -dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local - -AC_DEFUN([AS_AC_EXPAND], -[ - EXP_VAR=[$1] - FROM_VAR=[$2] - - dnl first expand prefix and exec_prefix if necessary - prefix_save=$prefix - exec_prefix_save=$exec_prefix - - dnl if no prefix given, then use /usr/local, the default prefix - if test "x$prefix" = "xNONE"; then - prefix=$ac_default_prefix - fi - dnl if no exec_prefix given, then use prefix - if test "x$exec_prefix" = "xNONE"; then - exec_prefix=$prefix - fi - - full_var="$FROM_VAR" - dnl loop until it doesn't change anymore - while true; do - new_full_var="`eval echo $full_var`" - if test "x$new_full_var"="x$full_var"; then break; fi - full_var=$new_full_var - done - - dnl clean up - full_var=$new_full_var - AC_SUBST([$1], "$full_var") - - dnl restore prefix and exec_prefix - prefix=$prefix_save - exec_prefix=$exec_prefix_save -]) diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/m4/as-version.m4 --- a/maemo-ui/m4/as-version.m4 Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -dnl version.m4 0.0.5 -dnl autostars m4 macro for versioning -dnl thomas@apestaart.org -dnl -dnl AS_VERSION(PACKAGE, PREFIX, MAJOR, MINOR, MICRO, NANO, ACTION_IF_NO_NANO, ACTION_IF_NANO) -dnl example -dnl AS_VERSION(gstreamer, GST_VERSION, 0, 3, 2,) -dnl for a 0.3.2 release version -dnl -dnl this macro -dnl - defines [$PREFIX]_MAJOR, MINOR and MICRO -dnl - if NANO is empty, then we're in release mode, else in cvs/dev mode -dnl - defines [$PREFIX], VERSION, and [$PREFIX]_RELEASE -dnl - executes the relevant action -dnl - AC_SUBST's PACKAGE, VERSION, [$PREFIX] and [$PREFIX]_RELEASE -dnl as well as the little ones -dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents -dnl maintainer mode from running ok -dnl -dnl don't forget to put #undef [$2] and [$2]_RELEASE in acconfig.h - -AC_DEFUN([AS_VERSION], -[ - PACKAGE=[$1] - [$2]_MAJOR_VERSION=[$3] - [$2]_MINOR_VERSION=[$4] - [$2]_MICRO_VERSION=[$5] - NANO=[$6] - [$2]_NANO_VERSION=$NANO - if test "x$NANO" = "x" || test "x$NANO" = "x0"; - then - AC_MSG_NOTICE(configuring [$1] for release) - VERSION=[$3].[$4].[$5] - [$2]_RELEASE=1 - dnl execute action - ifelse([$7], , :, [$7]) - else - AC_MSG_NOTICE(configuring [$1] for development with nano $NANO) - VERSION=[$3].[$4].[$5].$NANO - [$2]_RELEASE=`date +%Y%m%d_%H%M%S` - dnl execute action - ifelse([$8], , :, [$8]) - fi - - [$2]_VERSION=$VERSION - AC_DEFINE_UNQUOTED([$2]_VERSION, "$[$2]_VERSION", [Define the version]) - AC_SUBST([$2]_VERSION) - - AC_SUBST([$2]_RELEASE) - - AC_SUBST([$2]_MAJOR_VERSION) - AC_SUBST([$2]_MINOR_VERSION) - AC_SUBST([$2]_MICRO_VERSION) - AC_SUBST([$2]_NANO_VERSION) - AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define the package name]) - AC_SUBST(PACKAGE) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Define the version]) - AC_SUBST(VERSION) -]) diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/pixmaps/Makefile.am --- a/maemo-ui/pixmaps/Makefile.am Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -# Adding the application icon -#icondir = $(datadir)/mmyth/pixmaps -#icon_DATA = \ -# mmyth.png - - -# Adding the application resources -pixmapdir = $(pkgdatadir)/pixmaps -pixmap_DATA = mmyth_logo.png - -EXTRA_DIST = $(pixmap_DATA) diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/pixmaps/mmyth_logo.png Binary file maemo-ui/pixmaps/mmyth_logo.png has changed diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/Makefile.am --- a/maemo-ui/src/Makefile.am Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -bin_PROGRAMS = mmyth - -mmyth_SOURCES = \ - mmyth_main.c \ - mmyth_ui.c \ - mmyth_uicommon.c \ - mmyth_epg_grid_view.c \ - mmyth_epg_grid_widget.c \ - mmyth_recordui.c \ - mmyth_uisettings.c \ - mmyth_schedulerui.c \ - mmyth_tvplayer.c - -mmyth_CFLAGS = \ - $(GTK_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(GST_CFLAGS) \ - $(GSTBASE_CFLAGS) \ - $(GSTPLUGINSBASE_CFLAGS) \ - $(MYSQL_CFLAGS) \ - $(LIBGMYTH_CFLAGS) \ - -I$(top_srcdir)/src \ - -DDATA_DIR=\""$(pkgdatadir)"\" \ - -DPIX_DIR=\""$(pkgdatadir)/pixmaps/"\" \ - -DICON_DIR=\""$(datadir)/pixmaps/"\" \ - -g3 -O0 - -if MAEMO_PLATFORM -mmyth_CFLAGS+= \ - $(HILDON_CFLAGS) -endif - -mmyth_LDADD = \ - $(LIBGMYTH_LIBS) \ - $(GTK_LIBS) \ - $(GLIB_LIBS) \ - $(GST_LIBS) \ - $(GSTBASE_LIBS) \ - $(GSTPLUGINSBASE_LIBS) \ - $(GSTINTERFACES_LIBS) - -if MAEMO_PLATFORM -mmyth_LDADD += \ - $(HILDON_LIBS) -endif - diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_epg_grid_view.c --- a/maemo-ui/src/mmyth_epg_grid_view.c Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,243 +0,0 @@ -#include -#include -#include -#include -#include - -#include "mmyth_epg_grid_view.h" -#include "mmyth_epg_grid_widget.h" - -/* - * Service genre - */ -#define GENRE_MIN 0 -#define GENRE_MAX 10 -#define GENRE_UNDEFINED 0 -#define GENRE_MOVIE 1 -#define GENRE_NEWS 2 -#define GENRE_SHOW 3 -#define GENRE_SPORTS 4 -#define GENRE_CHILDREN 5 -#define GENRE_MUSIC 6 -#define GENRE_CULTURE 7 -#define GENRE_SOCIAL 8 -#define GENRE_EDUCATION 9 -#define GENRE_LEISURE 10 - -#define NRO_HOURS 3 - -/* - * Function prototypes - */ -static void update_service_details(MMythEpgGridWidget * object, - gpointer arg1, gpointer user_data); -static gboolean key_press_epg_grid_view(GtkWidget * widget, - GdkEventKey * event, - gpointer user_data); - -static GtkWidget *mmyth_epg_grid_widget = NULL; - -/* - * is a GtkEventBox - */ -static GtkWidget *program_details_area = NULL; -static GtkWidget *details_main_hbox = NULL; -static GtkWidget *details_vbox = NULL; -static GtkWidget *details_logo_vbox = NULL; - -/* - * update signal callback from MMythEpgGridWidget - */ -static void -update_service_details(MMythEpgGridWidget * object, gpointer arg1, - gpointer user_data) -{ - g_return_if_fail(arg1 != NULL); - - EpgGridItem *epg_grid_item = (EpgGridItem *) arg1; - - gchar sel_prog_desc[100] = ""; - gchar time_buffer[50]; - - /* - * FIXME: get first content from content_list - */ - GMythProgramInfo *proginfo = - (GMythProgramInfo *) epg_grid_item->proginfo; - - if (proginfo) { - GString *prog_name = proginfo->title; - GString *service_name = proginfo->chanid; - - if (details_vbox != NULL) - gtk_container_remove(GTK_CONTAINER(details_main_hbox), - details_vbox); - - /* - * update service description - */ - strcat(sel_prog_desc, service_name->str); - strcat(sel_prog_desc, ""); - - GtkWidget *fst_line_lbl = gtk_label_new(NULL); - gtk_misc_set_alignment(GTK_MISC(fst_line_lbl), 0.0, 0.0); - gtk_label_set_markup(GTK_LABEL(fst_line_lbl), sel_prog_desc); - - /* - * freeing char[] - */ - sel_prog_desc[0] = 0; - strcat(sel_prog_desc, "\t"); - strcat(sel_prog_desc, prog_name->str); - - struct tm loctime_start, - loctime_end; - - // Convert it to local time representation. - /* - * FIXME: conversion from time to localtime is different in - * different machines - */ - long int schedule_start_time = proginfo->startts->tv_sec; - long int schedule_end_time = proginfo->endts->tv_sec; - - if (localtime_r(&schedule_start_time, &loctime_start) == NULL) { - g_warning("localtime_r error in mmyth_epg_grid_view!\n"); - } -#if 0 - fprintf(stderr, asctime(loctime_start)); -#endif - - strftime(time_buffer, 100, " %H:%M - ", &loctime_start); - strcat(sel_prog_desc, time_buffer); - - if (localtime_r(&schedule_end_time, &loctime_end) == NULL) { - g_warning("localtime_r error in mmyth_epg_grid_view!\n"); - } -#if 0 - fprintf(stderr, asctime(loctime_end)); -#endif - - strftime(time_buffer, 100, "%H:%M\n", &loctime_end); - strcat(sel_prog_desc, time_buffer); - - GtkWidget *snd_line_lbl = gtk_label_new(NULL); - gtk_misc_set_alignment(GTK_MISC(snd_line_lbl), 0.0, 0.0); - gtk_label_set_markup(GTK_LABEL(snd_line_lbl), sel_prog_desc); - - // add the current selected program description to the label - details_vbox = gtk_vbox_new(FALSE, 0); - GtkWidget *fst_line_hbox = gtk_hbox_new(FALSE, 0); - - gtk_box_pack_start(GTK_BOX(fst_line_hbox), - fst_line_lbl, FALSE, FALSE, 6); - gtk_box_pack_start(GTK_BOX(details_vbox), - fst_line_hbox, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(details_vbox), - snd_line_lbl, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(details_main_hbox), - details_vbox, FALSE, FALSE, 0); - - gtk_widget_show_all(details_main_hbox); - } -} - -/* - * Callback for hardware keys - */ -static gboolean -key_press_epg_grid_view(GtkWidget * widget, - GdkEventKey * event, gpointer user_data) -{ - MMythEpgGridWidget *mmyth_epg_grid_widget = - (MMythEpgGridWidget *) user_data; - - return mmyth_epg_grid_widget_key_press(mmyth_epg_grid_widget, widget, - event); -} - -GtkWidget * -epg_grid_view_new(MMythUi * mmyth_ui) -{ - GtkWidget *scrolled_window; - scrolled_window = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), - GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - - gtk_widget_modify_bg(scrolled_window, GTK_STATE_NORMAL, - &main_bg_color); - - GtkWidget *main_vbox = gtk_vbox_new(FALSE, 0); - // gtk_container_set_border_width(main_vbox, 4); - - GtkWidget *details_event_box = gtk_event_box_new(); - gtk_widget_modify_bg(details_event_box, GTK_STATE_NORMAL, - &main_bg_color); - - program_details_area = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(details_event_box), - program_details_area); - gtk_container_set_border_width(GTK_CONTAINER(program_details_area), 4); - - details_main_hbox = gtk_hbox_new(FALSE, 10); - - gtk_box_pack_start(GTK_BOX(program_details_area), - details_main_hbox, FALSE, FALSE, 0); - - details_logo_vbox = gtk_vbox_new(FALSE, 0); - - GtkWidget *details_desc_vbox = gtk_vbox_new(FALSE, 0); - - gtk_box_pack_start(GTK_BOX(details_main_hbox), - details_desc_vbox, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(details_main_hbox), - details_logo_vbox, FALSE, FALSE, 0); - - gtk_widget_set_size_request(program_details_area, -1, 120); - - mmyth_epg_grid_widget = mmyth_epg_grid_widget_new(); - g_signal_connect(mmyth_epg_grid_widget, "selection_updated", - G_CALLBACK(update_service_details), NULL); - - /* - * select by default the first service - */ - /* - * depends on mount services - */ - if (MMYTH_EPG_GRID_WIDGET(mmyth_epg_grid_widget)->epg_view_model) { - GList *fst_service = (GList *) - MMYTH_EPG_GRID_WIDGET(mmyth_epg_grid_widget)->epg_view_model-> - data; - mmyth_epg_grid_widget_update_service(MMYTH_EPG_GRID_WIDGET - (mmyth_epg_grid_widget), - fst_service); - } - - gtk_box_pack_start(GTK_BOX(main_vbox), - details_event_box, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(main_vbox), - gtk_hseparator_new(), FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(main_vbox), - mmyth_epg_grid_widget, FALSE, FALSE, 0); - - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW - (scrolled_window), main_vbox); - - /* - * Add hardware button listener to application - */ - g_signal_connect(mmyth_ui->main_window, "key_press_event", - G_CALLBACK(key_press_epg_grid_view), - mmyth_epg_grid_widget); - - gtk_widget_show_all(scrolled_window); - - return scrolled_window; -} - -/* - * DVBHScheduleEvent * mmyth_epg_grid_view_get_selected_schedule() { - * return mmyth_epg_grid_get_selected_schedule - * (MMYTH_EPG_GRID_WIDGET(mmyth_epg_grid_widget)); } - */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_epg_grid_view.h --- a/maemo-ui/src/mmyth_epg_grid_view.h Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -#ifndef MMYTH_ESG_GRID_VIEW_H_ -#define MMYTH_ESG_GRID_VIEW_H_ - -#include "mmyth_ui.h" - -GtkWidget *epg_grid_view_new(MMythUi * mmyth_ui); - -#endif /* MMYTH_ESG_GRID_VIEW_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_epg_grid_widget.c --- a/maemo-ui/src/mmyth_epg_grid_widget.c Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,776 +0,0 @@ -#include -#include -#include - -#include "mmyth_uicommon.h" -#include "mmyth_epg_grid_widget.h" - -#include -#include - -#define PIXELS_HOUR 105 -#define PROGRAM_SEPARATION 2 - -enum { - SELECTION_UPDATED_SIGNAL, - LAST_SIGNAL -}; - -struct _MMythEpgGridWidgetPrivate { - /* - * private widget components - */ - GtkWidget *epg_channels_vbox; - GtkWidget *epg_programs_vbox; - - GHashTable *service_model_hash; - - /* - * guidegrid attributes - */ - gboolean show_favorites; - gint current_start_channel_id; - - GTimeVal *current_start_time; - GTimeVal *current_end_time; - - guint selected_channel_index; - - /* - * GList of ProgramInfo for each Channel - */ - GList *program_list[MAX_DISPLAY_CHANS]; - GList *channel_list; - - GMythEPG *mmyth_epg; - - GMythBackendInfo *backend_info; - - gint DISPLAY_CHANS; -}; - -static void mmyth_epg_grid_widget_class_init(MMythEpgGridWidgetClass * - klass); -static void mmyth_epg_grid_widget_init(MMythEpgGridWidget * object); -static void -mmyth_epg_grid_widget_private_init(MMythEpgGridWidgetPrivate * private); -static void mmyth_epg_grid_widget_mount_services(MMythEpgGridWidget * - object, - GTimeVal * start_time, - GTimeVal * end_time); -static void mmyth_epg_grid_widget_mount_header(MMythEpgGridWidget * - object); -static void mmyth_epg_grid_widget_clicked(GtkWidget * widget, - GdkEventExpose * event, - gpointer data); -static GtkWidget *create_event_box_lbl(gchar * str, int width, - const GdkColor * bg_color, - const GdkColor * fg_color); - -static void -mmyth_epg_grid_widget_fill_programinfos(MMythEpgGridWidgetPrivate * - private); -static void -mmyth_epg_grid_widget_fill_program_row_infos(MMythEpgGridWidgetPrivate * - private, unsigned int chanNum, - unsigned int row); - -static gint mmyth_epg_grid_widget_signals[LAST_SIGNAL] = { 0 }; - -G_DEFINE_TYPE(MMythEpgGridWidget, mmyth_epg_grid_widget, - GTK_TYPE_EVENT_BOX) - - static void - - - - - - - - - - - - - - mmyth_epg_grid_widget_class_init(MMythEpgGridWidgetClass * klass) -{ - g_type_class_add_private(klass, sizeof(MMythEpgGridWidgetPrivate)); - - mmyth_epg_grid_widget_signals[SELECTION_UPDATED_SIGNAL] = - g_signal_new("selection_updated", G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_FIRST, 0, NULL, NULL, - g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, - G_TYPE_POINTER); -} - -static void -mmyth_epg_grid_widget_private_init(MMythEpgGridWidgetPrivate * private) -{ - time_t cur_time; - - g_return_if_fail(private != NULL); - - private->epg_channels_vbox = NULL; - private->epg_programs_vbox = NULL; - private->service_model_hash = NULL; - - private->show_favorites = FALSE; - private->current_start_channel_id = -1; - - /* - * Selected the first diplayable channel initially - */ - private->selected_channel_index = 0; - - /* - * TODO fix the current start/end time - */ - private->current_start_time = g_new0(GTimeVal, 1); - private->current_start_time->tv_sec = time(&cur_time); - - private->current_end_time = g_new0(GTimeVal, 1); - private->current_end_time->tv_sec = time(&cur_time) + 10800; - - private->DISPLAY_CHANS = MAX_DISPLAY_CHANS; - - private->backend_info = - gmyth_backend_info_new_full("localhost", "mythtv", "mythtv", - "mythconverg", 6543); - - // TODO: Close the epg and unref it in dispose call - private->mmyth_epg = gmyth_epg_new(); - if (!gmyth_epg_connect(private->mmyth_epg, private->backend_info)) { - g_warning("[%s] Could not connect mysql handler to db", - __FUNCTION__); - g_object_unref(private->mmyth_epg); - private->mmyth_epg = NULL; - } -} - -static void -mmyth_epg_grid_widget_init(MMythEpgGridWidget * mmyth_epg_grid_widget) -{ - MMythEpgGridWidgetPrivate *private = - MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(mmyth_epg_grid_widget); - - /* - * init private fields - */ - mmyth_epg_grid_widget_private_init(private); - - mmyth_epg_grid_widget->epg_view_model = NULL; - mmyth_epg_grid_widget->selected_grid_item = NULL; - - GtkWidget *epg_event_box = GTK_WIDGET(mmyth_epg_grid_widget); - gtk_widget_modify_bg(epg_event_box, GTK_STATE_NORMAL, &main_bg_color); - gtk_widget_set_size_request(epg_event_box, 0, 125); - - GtkWidget *epg_main_hbox = gtk_hbox_new(FALSE, 10); - gtk_container_set_border_width(GTK_CONTAINER(epg_main_hbox), 10); - - gtk_container_add(GTK_CONTAINER(epg_event_box), epg_main_hbox); - - /* - * channels vbox - */ - GtkWidget *epg_channels_vbox = gtk_vbox_new(FALSE, 3); - private->epg_channels_vbox = epg_channels_vbox; - - /* - * programs vbox - */ - GtkWidget *epg_programs_vbox = gtk_vbox_new(FALSE, 3); - private->epg_programs_vbox = epg_programs_vbox; - - /* - * packing start - */ - gtk_box_pack_start(GTK_BOX(epg_main_hbox), - epg_channels_vbox, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(epg_main_hbox), - epg_programs_vbox, FALSE, FALSE, 0); - - /* - * table header (first line) - */ - mmyth_epg_grid_widget_mount_header(mmyth_epg_grid_widget); - - /* - * service programs - */ - /* - * mount service programs with current time - */ - mmyth_epg_grid_widget_mount_services(mmyth_epg_grid_widget, - private->current_start_time, - private->current_end_time); -} - -GtkWidget * -mmyth_epg_grid_widget_new() -{ - return GTK_WIDGET(gtk_type_new(mmyth_epg_grid_widget_get_type())); -} - -static void -mmyth_epg_grid_widget_mount_services(MMythEpgGridWidget * - mmyth_epg_grid_widget, - GTimeVal * start_time, - GTimeVal * end_time) -{ - GList *proglist; - GList *channel_list = NULL; - GMythChannelInfo *channel_info; - - int chanid; - MMythEpgGridWidgetPrivate *private = - MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(mmyth_epg_grid_widget); - - // update view_model - /* - * FIXME shallow free or recursive? - */ - if (mmyth_epg_grid_widget->epg_view_model != NULL) { - g_list_free(mmyth_epg_grid_widget->epg_view_model); - mmyth_epg_grid_widget->epg_view_model = NULL; - } - - if (private->service_model_hash != NULL) { - g_hash_table_destroy(private->service_model_hash); - } - - private->service_model_hash = g_hash_table_new(NULL, NULL); - - /* - * fill program infos from db - */ - mmyth_epg_grid_widget_fill_programinfos(private); - - channel_list = private->channel_list; - - /* - * for each channel get_programs() - */ - for (chanid = 0; channel_list && - chanid < private->DISPLAY_CHANS; chanid++) { - proglist = (GList *) private->program_list[chanid]; - - channel_info = (GMythChannelInfo *) channel_list->data; - channel_list = g_list_next(channel_list); - - /* - * Service Title - */ - GString *name = NULL; - if (channel_info->channel_name) - name = g_string_new(channel_info->channel_name->str); - - GdkColor title_bg_color; - title_bg_color.red = 5000; - title_bg_color.green = 9000; - title_bg_color.blue = 40000; - - GdkColor title_fg_color; - title_fg_color.red = 60000; - title_fg_color.green = 60000; - title_fg_color.blue = 60000; - - GtkWidget *event_box_channel = - create_event_box_lbl(name->str, 90, - &title_bg_color, - &title_fg_color); - - gtk_box_pack_start(GTK_BOX(private->epg_channels_vbox), - event_box_channel, FALSE, FALSE, 0); - - GtkWidget *epg_line_hbox = gtk_hbox_new(FALSE, 0); - - GdkColor bg_color; - bg_color.red = 5000; - bg_color.green = 30000; - bg_color.blue = 60000; - - GdkColor fg_color; - fg_color.red = 60000; - fg_color.green = 60000; - fg_color.blue = 60000; - - /* - * Content parsing - */ - GList *epg_grid_list = NULL; - - GMythProgramInfo *proginfo; - int pixel_count = 0; - for (; proglist; proglist = proglist->next) { - proginfo = (GMythProgramInfo *) proglist->data; - - GString *content_name = proginfo->title; - - GTimeVal *initial_time = g_new0(GTimeVal, 1); - GTimeVal *last_time = g_new0(GTimeVal, 1); - GTimeVal *duration = g_new0(GTimeVal, 1); - - GTimeVal *schedule_start_time = proginfo->startts; - GTimeVal *schedule_end_time = proginfo->endts; - - initial_time->tv_sec = - (schedule_start_time->tv_sec < - start_time->tv_sec) ? start_time-> - tv_sec : schedule_start_time->tv_sec; - last_time->tv_sec = - (schedule_end_time->tv_sec > - end_time->tv_sec) ? end_time->tv_sec : schedule_end_time-> - tv_sec; - duration->tv_sec = last_time->tv_sec - initial_time->tv_sec; - - // Verify program time -#if 0 - g_debug("ServiceID: %d, ScheduleID: %d\n", service->id, - schedule->id); - fprintf(stderr, "program time\nfrom = %d, to = %d\n", - schedule->validFrom, schedule->validTo); - - struct tm loctime; - - /* - * Convert it to local time representation. - */ - if (localtime_r((time_t *) & schedule->validFrom, &loctime) == - NULL) { - g_warning("localtime_r error in mmyth_epg_grid_widget!\n"); - return NULL; - } - fprintf(stderr, asctime(&loctime)); - - if (localtime_r((time_t *) & schedule->validTo, &loctime) == - NULL) { - g_warning("localtime_r error in mmyth_epg_grid_widget!\n"); - return NULL; - } - fprintf(stderr, asctime(&loctime)); -#endif - - /* - * fprintf(stderr, "duration = %d\n", duration); - */ - double duration_hour = - duration->tv_sec / (double) 3600.0; - /* - * fprintf(stderr, "duration_hour = %lf\n", duration_hour); - */ - - int size = PIXELS_HOUR * duration_hour; - - /* - * complete hour - */ - /* - * FIXME: UGLY WRONG HACK TO ALIGN PROGRAM TIME!!! - */ - if (last_time->tv_sec % 3600 != 0) { - size -= PROGRAM_SEPARATION; - } - if (initial_time->tv_sec % 3600 != 0) { - size -= PROGRAM_SEPARATION; - } - - pixel_count += size + PROGRAM_SEPARATION; - GtkWidget *event_box = - create_event_box_lbl(content_name->str, - size, &bg_color, - &fg_color); - gtk_widget_add_events(event_box, - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK); - - /* - * create EpgGridItem - */ - EpgGridItem *epg_grid_item = g_new0(EpgGridItem, 1); - epg_grid_item->proginfo = proginfo; - epg_grid_item->event_box = event_box; - epg_grid_item->object = mmyth_epg_grid_widget; - - epg_grid_list = - g_list_prepend(epg_grid_list, (gpointer) epg_grid_item); - - gtk_box_pack_start(GTK_BOX(epg_line_hbox), - event_box, FALSE, FALSE, - PROGRAM_SEPARATION); - - g_signal_connect(G_OBJECT(event_box), "button-press-event", - G_CALLBACK(mmyth_epg_grid_widget_clicked), - (gpointer *) epg_grid_list); - } -#if 0 - printf("chaind = %d!!!!" chanid); - fflush(stdout); -#endif - - if (!epg_grid_list) { - /* - * No programs for current channel - */ - /* - * FIXME: size HARDCODED - */ - GtkWidget *event_box = - create_event_box_lbl("No program list available", - PIXELS_HOUR * 3, &bg_color, - &fg_color); - gtk_widget_add_events(event_box, - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK); - - /* - * create EpgGridItem - */ - EpgGridItem *epg_grid_item = g_new0(EpgGridItem, 1); - epg_grid_item->proginfo = NULL; - epg_grid_item->event_box = event_box; - epg_grid_item->object = mmyth_epg_grid_widget; - - epg_grid_list = - g_list_prepend(epg_grid_list, (gpointer) epg_grid_item); - - gtk_box_pack_start(GTK_BOX(epg_line_hbox), - event_box, FALSE, FALSE, - PROGRAM_SEPARATION); - - g_signal_connect(G_OBJECT(event_box), "button-press-event", - G_CALLBACK(mmyth_epg_grid_widget_clicked), - (gpointer *) epg_grid_list); - } - - epg_grid_list = g_list_reverse(epg_grid_list); - mmyth_epg_grid_widget->epg_view_model = - g_list_append(mmyth_epg_grid_widget->epg_view_model, - epg_grid_list); - - gtk_box_pack_start(GTK_BOX(private->epg_programs_vbox), - epg_line_hbox, FALSE, FALSE, 0); - } -} - -static void -mmyth_epg_grid_widget_mount_header(MMythEpgGridWidget * - mmyth_epg_grid_widget) -{ - MMythEpgGridWidgetPrivate *private = - MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(mmyth_epg_grid_widget); - - struct tm hour_tm; - const gchar name_title[] = "Today"; - GtkWidget *lbl_title = gtk_label_new(name_title); - - gtk_misc_set_alignment(GTK_MISC(lbl_title), 0.0, 0.5); - - gtk_box_pack_start(GTK_BOX(private->epg_channels_vbox), - lbl_title, FALSE, FALSE, 0); - - /* - * hours title line - */ - GtkWidget *epg_programs_hours_hbox = gtk_hbox_new(TRUE, 0); - - if (localtime_r - ((time_t *) & private->current_start_time->tv_sec, - &hour_tm) == NULL) { - g_warning("localtime_r error in mmyth_epg_grid_widget!\n"); - return; - } - - if (hour_tm.tm_min > 30) { - hour_tm.tm_min = 30; - } else if (hour_tm.tm_min > 0) { - hour_tm.tm_min = 0; - } - - gchar hour1_str[10]; - strftime(hour1_str, 8, "%H:%M", &hour_tm); - GtkWidget *lbl_hour1 = gtk_label_new(hour1_str); - gtk_misc_set_alignment(GTK_MISC(lbl_hour1), 0.0, 0.5); - - hour_tm.tm_hour++; - gchar hour2_str[10]; - strftime(hour2_str, 8, "%H:%M", &hour_tm); - GtkWidget *lbl_hour2 = gtk_label_new(hour2_str); - gtk_misc_set_alignment(GTK_MISC(lbl_hour2), 0.0, 0.5); - - hour_tm.tm_hour++; - gchar hour3_str[10]; - strftime(hour3_str, 8, "%H:%M", &hour_tm); - GtkWidget *lbl_hour3 = gtk_label_new(hour3_str); - gtk_misc_set_alignment(GTK_MISC(lbl_hour3), 0.0, 0.5); - - gtk_box_pack_start(GTK_BOX(epg_programs_hours_hbox), - lbl_hour1, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(epg_programs_hours_hbox), - lbl_hour2, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(epg_programs_hours_hbox), - lbl_hour3, TRUE, TRUE, 0); - - gtk_box_pack_start(GTK_BOX(private->epg_programs_vbox), - epg_programs_hours_hbox, FALSE, FALSE, 0); -} - -/****************************************************************************** - * INTERNAL CALLBACKS FOR STATE CHANGE * - *****************************************************************************/ -static void -mmyth_epg_grid_widget_deselect_service(MMythEpgGridWidget * - mmyth_epg_grid_widget) -{ - EpgGridItem *epg_grid_item; - - /* - * deselect - */ - if (mmyth_epg_grid_widget->selected_grid_item != NULL) { - epg_grid_item = - (EpgGridItem *) mmyth_epg_grid_widget->selected_grid_item-> - data; - gtk_widget_set_state(GTK_WIDGET(epg_grid_item->event_box), - GTK_STATE_NORMAL); - } -} - -static void -mmyth_epg_grid_widget_clicked(GtkWidget * widget, - GdkEventExpose * event, gpointer data) -{ - g_return_if_fail(data != NULL); - - GList *epg_grid_item_list = (GList *) data; - EpgGridItem *epg_grid_item = - (EpgGridItem *) epg_grid_item_list->data; - - /* - * update the selected service - */ - mmyth_epg_grid_widget_update_service(epg_grid_item->object, - (GList *) data); -} - -void -mmyth_epg_grid_widget_update_service(MMythEpgGridWidget * object, - GList * selected_grid_list) -{ - g_return_if_fail(object != NULL); - g_return_if_fail(selected_grid_list != NULL); - - EpgGridItem *epg_grid_item = - (EpgGridItem *) selected_grid_list->data; - - mmyth_epg_grid_widget_deselect_service(epg_grid_item->object); - - /* - * updating current selected schedule_item and schedule_list - */ - object->selected_grid_item = selected_grid_list; - - /* - * set state of the event box - */ - gtk_widget_set_state(GTK_WIDGET(epg_grid_item->event_box), - GTK_STATE_SELECTED); - /* - * emit update signal for listeners - */ - g_signal_emit(object, - mmyth_epg_grid_widget_signals[SELECTION_UPDATED_SIGNAL], - 0, (gpointer) epg_grid_item); -} - -static GtkWidget * -create_event_box_lbl(gchar * str, int width, const GdkColor * bg_color, - const GdkColor * fg_color) -{ - GtkWidget *event_box = gtk_event_box_new(); - GtkWidget *lbl = gtk_label_new(str); - gtk_label_set_ellipsize(GTK_LABEL(lbl), PANGO_ELLIPSIZE_END); - - gtk_widget_modify_bg(event_box, GTK_STATE_NORMAL, bg_color); - gtk_widget_modify_fg(lbl, GTK_STATE_NORMAL, fg_color); - - /* - * selected colors are const - */ - GdkColor selected_bg_color; - selected_bg_color.red = 100; - selected_bg_color.green = 40000; - selected_bg_color.blue = 100; - - GdkColor selected_fg_color; - selected_fg_color.red = 100; - selected_fg_color.green = 100; - selected_fg_color.blue = 100; - - gtk_widget_modify_bg(event_box, GTK_STATE_SELECTED, - &selected_bg_color); - gtk_widget_modify_fg(lbl, GTK_STATE_SELECTED, &selected_fg_color); - - gtk_misc_set_alignment(GTK_MISC(lbl), 0.0, 0.5); - gtk_container_add(GTK_CONTAINER(event_box), lbl); - gtk_widget_set_size_request(event_box, width, -1); - - return event_box; -} - -/****************************************************************************** - * METHODS * - *****************************************************************************/ - -/* - * Callback for hardware keys - */ -gboolean -mmyth_epg_grid_widget_key_press(MMythEpgGridWidget * object, - GtkWidget * widget, GdkEventKey * event) -{ - MMythEpgGridWidgetPrivate *private = - MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(object); - - EpgGridItem *epg_grid_item; - GList *tmp; - - /* - * List of selected_grid_item - */ - GList *selected_view_model; - - gint channel_index; - - if (object->selected_grid_item == NULL) { - g_warning("No program selected"); - return FALSE; - } - - epg_grid_item = (EpgGridItem *) object->selected_grid_item->data; - - channel_index = private->selected_channel_index; - - switch (event->keyval) { - case GDK_Up: - selected_view_model = - g_list_nth(object->epg_view_model, channel_index - 1); - if (selected_view_model != NULL) { - private->selected_channel_index = channel_index - 1; - tmp = (GList *) selected_view_model->data; - /* - * TODO: select a better centralized item currently is - * picking the 1st or last item - */ - if (g_list_next(object->selected_grid_item) == NULL && - g_list_previous(object->selected_grid_item) != NULL) { - /* - * in this case the new selected will be the last - */ - tmp = g_list_last(tmp); - } - - /* - * update the selected service - */ - mmyth_epg_grid_widget_update_service(object, tmp); - } - return TRUE; - case GDK_Down: - selected_view_model = - g_list_nth(object->epg_view_model, channel_index + 1); - if (selected_view_model != NULL) { - private->selected_channel_index = channel_index + 1; - tmp = (GList *) selected_view_model->data; - /* - * TODO: select a better centralized item currently is - * picking the 1st or last item - */ - if (g_list_next(object->selected_grid_item) == NULL && - g_list_previous(object->selected_grid_item) != NULL) { - /* - * in this case the new selected will be the last - */ - tmp = g_list_last(tmp); - } - - /* - * update the selected service - */ - mmyth_epg_grid_widget_update_service(object, tmp); - } - return TRUE; - case GDK_Left: - tmp = g_list_previous(object->selected_grid_item); - if (tmp != NULL) { - /* - * update the selected service - */ - mmyth_epg_grid_widget_update_service(object, tmp); - } - return TRUE; - case GDK_Right: - tmp = g_list_next(object->selected_grid_item); - if (tmp != NULL) { - /* - * update the selected service - */ - mmyth_epg_grid_widget_update_service(object, tmp); - } - return TRUE; - default: - return TRUE; - } - - return FALSE; -} - -static void -mmyth_epg_grid_widget_fill_programinfos(MMythEpgGridWidgetPrivate * - private) -{ - GList *channels_list = NULL; - int y; - - if ((private->mmyth_epg != NULL) && - (gmyth_epg_get_channel_list(private->mmyth_epg, &channels_list) < - 0)) { - private->channel_list = NULL; - return; - } - - private->channel_list = channels_list; - - for (y = 0; y < private->DISPLAY_CHANS && channels_list; y++) { - GMythChannelInfo *channel_info = - (GMythChannelInfo *) channels_list->data; - - mmyth_epg_grid_widget_fill_program_row_infos(private, - channel_info-> - channel_ID, y); - - channels_list = g_list_next(channels_list); - } -} - -static void -mmyth_epg_grid_widget_fill_program_row_infos(MMythEpgGridWidgetPrivate * - private, guint chanNum, - guint row) -{ - gint res = gmyth_epg_get_program_list(private->mmyth_epg, - &(private-> - program_list[row]), - chanNum, - private-> - current_start_time, - private-> - current_end_time); - - if (res < 0) { - g_warning("[%s] Error while retrieving epg programs", - __FUNCTION__); - } -} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_epg_grid_widget.h --- a/maemo-ui/src/mmyth_epg_grid_widget.h Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -#ifndef __MMYTH_EPG_GRID_WIDGET_H__ -#define __MMYTH_EPG_GRID_WIDGET_H__ - -#include -#include -#include -#include - -#include -#include -#define MAX_DISPLAY_CHANS 4 - -G_BEGIN_DECLS -#define MMYTH_EPG_GRID_WIDGET_TYPE (mmyth_epg_grid_widget_get_type ()) -#define MMYTH_EPG_GRID_WIDGET(obj) (GTK_CHECK_CAST ((obj), MMYTH_EPG_GRID_WIDGET_TYPE, MMythEpgGridWidget)) -#define MMYTH_EPG_GRID_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), MMYTH_EPG_GRID_WIDGET_TYPE, MMythEpgGridWidgetClass)) -#define IS_MMYTH_EPG_GRID_WIDGET(obj) (GTK_CHECK_TYPE ((obj), MMYTH_EPG_GRID_WIDGET_TYPE)) -#define IS_MMYTH_EPG_GRID_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), MMYTH_EPG_GRID_WIDGET_TYPE)) -#define MMYTH_EPG_GRID_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MMYTH_EPG_GRID_WIDGET_TYPE, MMythEpgGridWidgetClass)) -#define MMYTH_EPG_GRID_WIDGET_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MMYTH_EPG_GRID_WIDGET_TYPE, MMythEpgGridWidgetPrivate)) -typedef struct _MMythEpgGridWidget MMythEpgGridWidget; -typedef struct _MMythEpgGridWidgetClass MMythEpgGridWidgetClass; -typedef struct _MMythEpgGridWidgetPrivate MMythEpgGridWidgetPrivate; - -struct _MMythEpgGridWidgetClass { - GtkEventBoxClass parent_class; - - /* - * callbacks - */ - /* - * no one for now - */ -}; - -struct _MMythEpgGridWidget { - GtkEventBox event_box; - - /* - * Selected Widgets Logic - */ - /* - * List os Service Model in the current view the data of this list are - * GList for the programs of each service - */ - GList *epg_view_model; - - /* - * Selected Schedule Item - */ - GList *selected_grid_item; - -}; - - -GType mmyth_epg_grid_widget_get_type(void); -GtkWidget *mmyth_epg_grid_widget_new(void); -/* - * DVBHScheduleEvent* mmyth_epg_grid_get_selected_schedule - * (MMythEpgGridWidget * object); - */ -void mmyth_epg_grid_widget_update_service(MMythEpgGridWidget * - object, - GList * - epg_grid_item_node); -gboolean mmyth_epg_grid_widget_key_press(MMythEpgGridWidget * - object, GtkWidget * widget, - GdkEventKey * event); - -typedef struct _EpgGridItem EpgGridItem; - -/* - * FIXME: auxiliary struct - */ -struct _EpgGridItem { - - GMythProgramInfo *proginfo; - GtkWidget *event_box; - - /* - * for callback purposes - */ - MMythEpgGridWidget *object; -}; - -G_END_DECLS -#endif /* __MMYTH_EPG_GRID_WIDGET_H__ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_main.c --- a/maemo-ui/src/mmyth_main.c Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ - -#include - -#include "config.h" - -#ifdef MAEMO_PLATFORM -#include "hildon-widgets/hildon-program.h" -#include "hildon-widgets/hildon-window.h" -#endif - -#include -#include -#include -#include - -#include "mmyth_ui.h" -#include "mmyth_tvplayer.h" - -static void -cb_destroy(GtkWidget * widget, gpointer data) -{ - MMythUi *mmyth_ui = (MMythUi *) data; - - if (mmyth_ui->tvplayer != NULL) { - if (mmyth_tvplayer_is_playing(mmyth_ui->tvplayer)) - mmyth_tvplayer_stop_playing(mmyth_ui->tvplayer); - } - - mmyth_ui_finalize(mmyth_ui); - - gtk_main_quit(); -} - -#ifdef NDEBUG -static void -debug_error_func(const gchar * log_domain, GLogLevelFlags log_level, - const gchar * message, gpointer user_data) -{ - /* - * leave this with NO print out messages, once you need to disable - * debug messages! - */ - // g_print ( "[%s] DEBUG messages disabled!\n", __FUNCTION__ ); -} -#endif - -gint -main(gint argc, gchar * argv[]) -{ - GtkWidget *window; - MMythUi *mmyth_ui; -#ifdef MAEMO_PLATFORM - HildonProgram *program = NULL; -#endif - - /* - * init threads - */ - g_thread_init(NULL); - - /* - * Initializes GTK - */ - gtk_init(&argc, &argv); - gst_init(&argc, &argv); -#ifdef NDEBUG - g_log_set_default_handler(debug_error_func, NULL); -#endif - - /* - * Init libmmyth context - */ - /* - * TODO - */ -#ifndef MAEMO_PLATFORM - /* - * create the main window - */ - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_set_size_request(window, MAIN_WINDOW_WIDTH, - MAIN_WINDOW_HEIGHT); - gtk_window_set_title(GTK_WINDOW(window), "Mythtv Frontend"); -#else - /* - * Creating Hildonized main view - */ - program = HILDON_PROGRAM(hildon_program_get_instance()); - window = hildon_window_new(); - - // g_signal_connect(G_OBJECT(window), "delete_event", gtk_main_quit, - // NULL); - - hildon_program_add_window(program, HILDON_WINDOW(window)); - g_set_application_name("Maemo Mythtv"); -#endif - - /* - * Initializes MMyth Widgets - */ -#ifdef MAEMO_PLATFORM - mmyth_ui = mmyth_ui_initialize(program, window); -#else - mmyth_ui = mmyth_ui_initialize(window); -#endif - - // mmyth_ui->loop = g_main_loop_new (NULL, FALSE); - - /* - * Connect destroy signal handling - */ - g_signal_connect(window, "destroy", G_CALLBACK(cb_destroy), mmyth_ui); - - /* - * Shows main window and start gtk loop - */ - gtk_widget_show(window); - - gtk_main(); - - return 0; -} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_recordui.c --- a/maemo-ui/src/mmyth_recordui.c Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,433 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mmyth_ui.h" -#include "mmyth_recordui.h" - -/* - * GMyth library includes - */ -#include -#include - -enum { - START_DATE_COLUMN = 0, - TITLE_COLUMN, - CHAN_ID_COLUMN, - END_TIME_COLUMN, - RECORD_ID_COLUMN, - BASENAME_COLUMN, - N_COLUMNS -}; - -gboolean -mmyth_recordui_reload_all(MMythRecordUI * recordui) -{ - gboolean res = FALSE; - - res = mmyth_recordui_reload_schedule(recordui); - - res = res & mmyth_recordui_reload_record(recordui); - - - if (!res) - g_warning - ("[%s] Error while reloading schedule and recording content", - __FUNCTION__); - - return res; -} - -gboolean -mmyth_recordui_reload_schedule(MMythRecordUI * recordui) -{ - gint new_row = 0; - ScheduleInfo *schedule_info; - GList *schedule_list; - GtkTreeIter iter; - gchar *start_date_time = NULL; - gchar *end_date_time = NULL; - GString *str_aux = g_string_new(""); - gint res; - - gtk_tree_store_clear(recordui->sch_tree_store); - - res = - gmyth_scheduler_get_schedule_list(recordui->scheduler, - &(schedule_list)); - if (res < 0) { - g_warning - ("[%s] Retrieved NULL list of scheduled data from database", - __FUNCTION__); - return FALSE; - } - - for (; schedule_list; schedule_list = schedule_list->next) { - schedule_info = (ScheduleInfo *) schedule_list->data; - - gtk_tree_store_insert(recordui->sch_tree_store, &iter, NULL, - new_row++); - - start_date_time = - gmyth_util_time_to_string_from_time_val(schedule_info-> - start_time); - end_date_time = - gmyth_util_time_to_string_from_time_val(schedule_info-> - end_time); - - g_string_printf(str_aux, "%d", schedule_info->channel_id); - - gtk_tree_store_set(recordui->sch_tree_store, &iter, START_DATE_COLUMN, start_date_time, TITLE_COLUMN, schedule_info->title->str, CHAN_ID_COLUMN, str_aux->str, END_TIME_COLUMN, end_date_time, // It - // doesn't - // appear - RECORD_ID_COLUMN, schedule_info->record_id, -1); // the - // last - // line - // is - // a - // hidden - // item - // to - // be - // used - // in - // searching - // tasks - } - - g_debug("[%s] %d lines added to schedule list UI", __FUNCTION__, - new_row); - - /* - * free allocated memory - */ - if (!start_date_time) - g_free(start_date_time); - if (!end_date_time) - g_free(end_date_time); - g_string_free(str_aux, FALSE); - - return TRUE; -} - -gboolean -mmyth_recordui_reload_record(MMythRecordUI * recordui) -{ - gint new_row = 0; - RecordedInfo *recorded_info; - GList *record_list = NULL; - GtkTreeIter iter; - gchar *start_date_time = NULL; - gchar *end_date_time = NULL; - GString *str_aux = g_string_new(""); - gint res; - - gtk_tree_store_clear(recordui->rec_tree_store); - - res = - gmyth_scheduler_get_recorded_list(recordui->scheduler, - &record_list); - if (res < 0) { - g_warning - ("[%s] Retrieved NULL list of recorded data from database", - __FUNCTION__); - return FALSE; - } - - for (; record_list; record_list = record_list->next) { - recorded_info = (RecordedInfo *) record_list->data; - - gtk_tree_store_insert(recordui->rec_tree_store, &iter, NULL, - new_row++); - - start_date_time = - gmyth_util_time_to_string_from_time_val(recorded_info-> - start_time); - end_date_time = - gmyth_util_time_to_string_from_time_val(recorded_info-> - end_time); - - g_string_printf(str_aux, "%d", recorded_info->channel_id); - - gtk_tree_store_set(recordui->rec_tree_store, &iter, START_DATE_COLUMN, start_date_time, TITLE_COLUMN, recorded_info->title->str, CHAN_ID_COLUMN, str_aux->str, END_TIME_COLUMN, end_date_time, // It - // doesn't - // appear - RECORD_ID_COLUMN, recorded_info->record_id, - BASENAME_COLUMN, recorded_info->basename->str, - -1); - // the last line is a hidden item to be used in searching tasks - } - - g_debug("[%s] %d lines added to record list UI", __FUNCTION__, - new_row); - - /* - * free allocated memory - */ - if (NULL != start_date_time) - g_free(start_date_time); - if (NULL != end_date_time) - g_free(end_date_time); - g_string_free(str_aux, FALSE); - - return TRUE; -} - - -MMythRecordUI * -mmyth_recordui_new(GMythBackendInfo * backend_info) -{ - MMythRecordUI *recordui = g_new0(MMythRecordUI, 1); - - g_return_val_if_fail(backend_info != NULL, NULL); - - recordui->backend_info = backend_info; - - recordui->scrolled_window = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW - (recordui->scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - - recordui->viewport = gtk_viewport_new(NULL, NULL); - gtk_container_add(GTK_CONTAINER(recordui->scrolled_window), - recordui->viewport); - - recordui->notebook = gtk_notebook_new(); - gtk_container_set_border_width(GTK_CONTAINER(recordui->notebook), 1); - gtk_notebook_set_scrollable(GTK_NOTEBOOK(recordui->notebook), TRUE); - gtk_notebook_popup_enable(GTK_NOTEBOOK(recordui->notebook)); - gtk_container_add(GTK_CONTAINER(recordui->viewport), - recordui->notebook); - gtk_notebook_popup_disable(GTK_NOTEBOOK(recordui->notebook)); - - /* - * Schedule tab - */ - recordui->sch_scrolled_window = gtk_scrolled_window_new(NULL, NULL); - gtk_container_add(GTK_CONTAINER(recordui->notebook), - recordui->sch_scrolled_window); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW - (recordui->sch_scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW - (recordui->sch_scrolled_window), - GTK_SHADOW_IN); - - /* - * The basename column in the sched_tree_store is not being used - */ - recordui->sch_tree_store = - gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, - G_TYPE_STRING); - - recordui->sch_treeview = - gtk_tree_view_new_with_model(GTK_TREE_MODEL - (recordui->sch_tree_store)); - gtk_container_add(GTK_CONTAINER(recordui->sch_scrolled_window), - recordui->sch_treeview); - recordui->sch_renderer = gtk_cell_renderer_text_new(); - // g_object_set(G_OBJECT(renderer1), "foreground", "green", - // "background", "black", NULL); - recordui->sch_column1 = - gtk_tree_view_column_new_with_attributes("Start time", - recordui->sch_renderer, - "text", START_DATE_COLUMN, - NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), - recordui->sch_column1); - recordui->sch_column2 = - gtk_tree_view_column_new_with_attributes("Title", - recordui->sch_renderer, - "text", TITLE_COLUMN, - NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), - recordui->sch_column2); - recordui->sch_column3 = - gtk_tree_view_column_new_with_attributes("Channel", - recordui->sch_renderer, - "text", CHAN_ID_COLUMN, - NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), - recordui->sch_column3); - gtk_tree_view_column_set_resizable(recordui->sch_column1, TRUE); - gtk_tree_view_column_set_resizable(recordui->sch_column2, TRUE); - gtk_tree_view_column_set_resizable(recordui->sch_column3, TRUE); - gtk_tree_view_column_set_reorderable(recordui->sch_column1, TRUE); - gtk_tree_view_column_set_reorderable(recordui->sch_column2, TRUE); - gtk_tree_view_column_set_reorderable(recordui->sch_column3, TRUE); - // recordui->sch_column4 = - // gtk_tree_view_column_new_with_attributes("", - // recordui->sch_renderer, "text", END_TIME_COLUMN, NULL); - // gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->sch_treeview), - // recordui->sch_column4); - - recordui->sch_label = gtk_label_new(("Schedule")); - gtk_notebook_set_tab_label(GTK_NOTEBOOK(recordui->notebook), - gtk_notebook_get_nth_page(GTK_NOTEBOOK - (recordui-> - notebook), 0), - recordui->sch_label); - - // Record items tab - // g_object_set(G_OBJECT(renderer2), "foreground", "blue", NULL); - recordui->rec_scrolled_window = gtk_scrolled_window_new(NULL, NULL); - gtk_container_add(GTK_CONTAINER(recordui->notebook), - recordui->rec_scrolled_window); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW - (recordui->rec_scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW - (recordui->rec_scrolled_window), - GTK_SHADOW_IN); - - recordui->rec_tree_store = - gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, - G_TYPE_STRING); - recordui->rec_treeview = - gtk_tree_view_new_with_model(GTK_TREE_MODEL - (recordui->rec_tree_store)); - gtk_container_add(GTK_CONTAINER(recordui->rec_scrolled_window), - recordui->rec_treeview); - recordui->rec_renderer = gtk_cell_renderer_text_new(); - // g_object_set(G_OBJECT(renderer1), "foreground", "green", - // "background", "black", NULL); - - recordui->rec_column1 = - gtk_tree_view_column_new_with_attributes("Start time", - recordui->rec_renderer, - "text", START_DATE_COLUMN, - NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), - recordui->rec_column1); - recordui->rec_column2 = - gtk_tree_view_column_new_with_attributes("Title", - recordui->rec_renderer, - "text", TITLE_COLUMN, - NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), - recordui->rec_column2); - recordui->rec_column3 = - gtk_tree_view_column_new_with_attributes("Channel", - recordui->rec_renderer, - "text", CHAN_ID_COLUMN, - NULL); - gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), - recordui->rec_column3); - gtk_tree_view_column_set_resizable(recordui->rec_column1, TRUE); - gtk_tree_view_column_set_resizable(recordui->rec_column2, TRUE); - gtk_tree_view_column_set_resizable(recordui->rec_column3, TRUE); - gtk_tree_view_column_set_reorderable(recordui->rec_column1, TRUE); - gtk_tree_view_column_set_reorderable(recordui->rec_column2, TRUE); - gtk_tree_view_column_set_reorderable(recordui->rec_column3, TRUE); - // recordui->rec_column4 = - // gtk_tree_view_column_new_with_attributes("", - // recordui->rec_renderer, "text", END_TIME_COLUMN, NULL); - // gtk_tree_view_append_column(GTK_TREE_VIEW(recordui->rec_treeview), - // recordui->rec_column4); - - recordui->rec_label = gtk_label_new(("Recorded")); - gtk_notebook_set_tab_label(GTK_NOTEBOOK(recordui->notebook), - gtk_notebook_get_nth_page(GTK_NOTEBOOK - (recordui-> - notebook), 1), - recordui->rec_label); - - // Gets the mmyth scheduler manager - recordui->scheduler = gmyth_scheduler_new(backend_info); - - /* - * init connection to the backend - */ - gmyth_scheduler_connect(recordui->scheduler, - recordui->scheduler->backend_info); - - return recordui; -} - -void -mmyth_recordui_free(MMythRecordUI * recordui) -{ - // FIXME: Release memory here! - /* - * close connection to the backend - */ - gmyth_scheduler_disconnect(recordui->scheduler); -} - -void -mmyth_recordui_delete_selected(GtkButton * button, - MMythRecordUI * recordui) -{ - GtkTreeSelection *selection; - GtkTreeModel *list_store; - GtkTreeIter iter; - int index; - int curr_page = 0; - - curr_page = - gtk_notebook_get_current_page(GTK_NOTEBOOK(recordui->notebook)); - - if (curr_page == 0) { - selection = - gtk_tree_view_get_selection(GTK_TREE_VIEW - (recordui->sch_treeview)); - if (selection != NULL) { - gtk_tree_selection_get_selected(selection, &list_store, &iter); - gtk_tree_model_get(list_store, &iter, RECORD_ID_COLUMN, &index, - -1); - gmyth_scheduler_delete_schedule(recordui->scheduler, index); - mmyth_recordui_reload_schedule(recordui); - return; - } - - } else if (curr_page == 1) { - selection = - gtk_tree_view_get_selection(GTK_TREE_VIEW - (recordui->rec_treeview)); - if (selection != NULL) { - gtk_tree_selection_get_selected(selection, &list_store, &iter); - gtk_tree_model_get(list_store, &iter, RECORD_ID_COLUMN, &index, - -1); - gmyth_scheduler_delete_recorded(recordui->scheduler, index); - mmyth_recordui_reload_record(recordui); - return; - } - } - - g_warning("[%s] None element was removed from the list", __FUNCTION__); -} - -/* - * FIXME: change this function name, it is returning the basename_column - * that represents the nuv filename of the recorded content - */ -gchar * -mmyth_recordui_get_selected_recorded(MMythRecordUI * recordui) -{ - GtkTreeSelection *selection = NULL; - GtkTreeModel *list_store = NULL; - GtkTreeIter iter; - gchar *path = NULL; - - /* - * returning nuv filename, basename_column - */ - selection = - gtk_tree_view_get_selection(GTK_TREE_VIEW(recordui->rec_treeview)); - if (gtk_tree_selection_get_selected(selection, &list_store, &iter)) { - gtk_tree_model_get(list_store, &iter, BASENAME_COLUMN, &path, -1); - } - // FIXME: MOVE THIS TO OTHER PLACE - return path; -} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_recordui.h --- a/maemo-ui/src/mmyth_recordui.h Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -#ifndef MMYTH_RECORD_H_ -#define MMYTH_RECORD_H_ - -#include -#include - -typedef struct _MMythRecordUI { - GtkWidget *scrolled_window; - GtkWidget *viewport; - GtkWidget *notebook; - - GtkWidget *rec_scrolled_window; - GtkWidget *sch_scrolled_window; - GtkWidget *rec_treeview; - GtkWidget *sch_treeview; - GtkWidget *rec_label; - GtkWidget *sch_label; - - GtkTreeViewColumn *rec_column1; - GtkTreeViewColumn *rec_column2; - GtkTreeViewColumn *rec_column3; - GtkTreeViewColumn *rec_column4; - GtkTreeViewColumn *sch_column1; - GtkTreeViewColumn *sch_column2; - GtkTreeViewColumn *sch_column3; - GtkTreeViewColumn *sch_column4; - - GtkCellRenderer *rec_renderer; - GtkCellRenderer *sch_renderer; - - GtkTreeStore *sch_tree_store; - GtkTreeStore *rec_tree_store; - - GMythScheduler *scheduler; - - GMythBackendInfo *backend_info; - -} MMythRecordUI; - -MMythRecordUI *mmyth_recordui_new(GMythBackendInfo * backend_info); -void mmyth_recordui_free(MMythRecordUI * recordui); - -void mmyth_recordui_delete_selected(GtkButton * button, - MMythRecordUI * recordui); -gboolean mmyth_recordui_reload_all(MMythRecordUI * recordui); -gboolean mmyth_recordui_reload_schedule(MMythRecordUI * recordui); -gboolean mmyth_recordui_reload_record(MMythRecordUI * recordui); - -gchar *mmyth_recordui_get_selected_recorded(MMythRecordUI * - recordui); - -#endif /* MMYTH_RECORD_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_schedulerui.c --- a/maemo-ui/src/mmyth_schedulerui.c Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,443 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mmyth_ui.h" -#include "mmyth_uicommon.h" -#include "mmyth_recordui.h" -#include "mmyth_schedulerui.h" - -/* - * GMyth library includes - */ -#include -#include -#include - -static void run_calendar_dialog(GtkButton * button, gpointer data); - -static void add_channel_field(MMythSchedulerUI * scheduler_ui, - GtkWidget * vbox); -static void add_time_field(MMythSchedulerUI * scheduler_ui, - GtkWidget * vbox); -static void add_date_field(MMythSchedulerUI * scheduler_ui, - GtkWidget * vbox); -static void add_duration_field(MMythSchedulerUI * scheduler_ui, - GtkWidget * vbox); -static void add_frequency_field(MMythSchedulerUI * scheduler_ui, - GtkWidget * vbox); -static void add_title_field(MMythSchedulerUI * scheduler_ui, - GtkWidget * vbox); - -MMythSchedulerUI * -mmyth_schedulerui_new(GMythBackendInfo * backend_info) -{ - GtkWidget *scrolledwindow; - GtkWidget *viewport; - GtkWidget *head_hbox; - GtkWidget *fields_vbox; - GtkWidget *hseparator; - GtkWidget *label; - - MMythSchedulerUI *scheduler_ui = g_new0(MMythSchedulerUI, 1); - - scheduler_ui->backend_info = backend_info; - - scrolledwindow = gtk_scrolled_window_new(NULL, NULL); - scheduler_ui->main_widget = scrolledwindow; - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - - // Is this needed? - viewport = gtk_viewport_new(NULL, NULL); - gtk_container_add(GTK_CONTAINER(scrolledwindow), viewport); - - // Is this needed? - head_hbox = gtk_hbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(viewport), head_hbox); - - fields_vbox = gtk_vbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(head_hbox), fields_vbox, TRUE, TRUE, 0); - gtk_container_set_border_width(GTK_CONTAINER(fields_vbox), 10); - - label = gtk_label_new_with_mnemonic(("Manual Schedule Recording")); - gtk_box_pack_start(GTK_BOX(fields_vbox), label, FALSE, FALSE, 0); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - - hseparator = gtk_hseparator_new(); - gtk_box_pack_start(GTK_BOX(fields_vbox), hseparator, FALSE, TRUE, 0); - - add_channel_field(scheduler_ui, fields_vbox); - add_time_field(scheduler_ui, fields_vbox); - add_date_field(scheduler_ui, fields_vbox); - add_duration_field(scheduler_ui, fields_vbox); - add_frequency_field(scheduler_ui, fields_vbox); - add_title_field(scheduler_ui, fields_vbox); - - return scheduler_ui; -} - -static void -set_date_from_calendar(GtkCalendar * calendar, gpointer data) -{ - char sched_date[24]; - - MMythSchedulerUI *scheduler_ui = (MMythSchedulerUI *) data; - - // FIXME: Change this, save another value instead of month_temp, - // day_temp, ... - gtk_calendar_get_date(GTK_CALENDAR(calendar), - &(scheduler_ui->year_temp), - &(scheduler_ui->month_temp), - &(scheduler_ui->day_temp)); - - sched_date[23] = '\0'; - g_sprintf(sched_date, "%04d %02d %02d (yyyy mm dd)", - scheduler_ui->year_temp, scheduler_ui->month_temp + 1, - scheduler_ui->day_temp); - - gtk_button_set_label(GTK_BUTTON(scheduler_ui->date_button), - sched_date); - - gtk_widget_destroy(scheduler_ui->calendar_dialog); - scheduler_ui->calendar_dialog = NULL; - scheduler_ui->calendar = NULL; -} - -// calendar -static void -run_calendar_dialog(GtkButton * button, gpointer data) -{ - - GtkWidget *dialog_vbox; - MMythSchedulerUI *scheduler_ui = (MMythSchedulerUI *) data; - - // calendar_dialog and calendar are been released at - // set_date_from_calendar () - scheduler_ui->calendar_dialog = gtk_dialog_new(); - gtk_container_set_border_width(GTK_CONTAINER - (scheduler_ui->calendar_dialog), 1); - gtk_window_set_title(GTK_WINDOW(scheduler_ui->calendar_dialog), - "Select starting date"); - gtk_window_set_position(GTK_WINDOW(scheduler_ui->calendar_dialog), - GTK_WIN_POS_CENTER); - gtk_window_set_decorated(GTK_WINDOW(scheduler_ui->calendar_dialog), - FALSE); - - dialog_vbox = GTK_DIALOG(scheduler_ui->calendar_dialog)->vbox; - - scheduler_ui->calendar = gtk_calendar_new(); - - gtk_box_pack_start(GTK_BOX(dialog_vbox), scheduler_ui->calendar, TRUE, - TRUE, 0); - gtk_calendar_display_options(GTK_CALENDAR(scheduler_ui->calendar), - GTK_CALENDAR_SHOW_HEADING | - GTK_CALENDAR_SHOW_DAY_NAMES); - - gtk_widget_show_all(scheduler_ui->calendar_dialog); - - g_signal_connect(G_OBJECT(scheduler_ui->calendar), - "day-selected-double-click", - G_CALLBACK(set_date_from_calendar), data); -} - - -gboolean -mmyth_schedulerui_save(MMythSchedulerUI * scheduler_ui) -{ - GMythScheduler *scheduler; - ScheduleInfo *schedule_info; - GMythChannelInfo *channel_info; - - GList *clist; - gint index, - duration; - gint frequency; - struct tm start_tm; - - schedule_info = g_new0(ScheduleInfo, 1); - if (schedule_info == NULL) { - g_warning("Error allocating memory"); - return FALSE; - } - - clist = scheduler_ui->channel_list; - - index = - gtk_combo_box_get_active(GTK_COMBO_BOX - (scheduler_ui->channel_combobox)); - - if (clist != NULL) - clist = g_list_nth(clist, index); - - if (clist) { - g_debug("[%s] New schedule: %d", __FUNCTION__, index); - } else { - g_warning("[%s] Error when adding new schedule", __FUNCTION__); - return FALSE; - } - - channel_info = clist->data; - - /* - * initialize schedule_info - */ - schedule_info->channel_id = channel_info->channel_ID; - - start_tm.tm_hour = - (int) - gtk_spin_button_get_value(GTK_SPIN_BUTTON - (scheduler_ui->hour_spinbutton)); - start_tm.tm_min = - (int) - gtk_spin_button_get_value(GTK_SPIN_BUTTON - (scheduler_ui->min_spinbutton)); - start_tm.tm_sec = 0; - - start_tm.tm_mday = (gint) scheduler_ui->day_temp; - start_tm.tm_mon = (gint) scheduler_ui->month_temp; - start_tm.tm_year = (gint) scheduler_ui->year_temp - 1900; // years - // since - // 1900 - GTimeVal *time_val_local = g_new0(GTimeVal, 1); - time_val_local->tv_sec = timelocal(&start_tm); - - schedule_info->start_time = time_val_local; - if (NULL == schedule_info->start_time) { - g_warning("timelocal error!\n"); - return FALSE; - } - - duration = - (gint) - gtk_spin_button_get_value(GTK_SPIN_BUTTON - (scheduler_ui->duration_spinbutton)); - schedule_info->end_time = schedule_info->start_time + (duration * 60); - - /* - * TODO: frequency is not implemented yet - */ - frequency = - gtk_combo_box_get_active(GTK_COMBO_BOX - (scheduler_ui->freq_combobox)); - - schedule_info->title = g_string_new(""); - g_string_printf(schedule_info->title, "%s", - gtk_entry_get_text(GTK_ENTRY - (scheduler_ui->title_entry))); - - /* - * FIXME: Architecture change to reuse the scheduler created in the - * recordui! - */ - scheduler = gmyth_scheduler_new(); - - gmyth_scheduler_connect(scheduler, scheduler->backend_info); - - /* - * FIXME: set record_id = -1 to add a new schedule - */ - schedule_info->record_id = -1; - gmyth_scheduler_add_schedule(scheduler, schedule_info); - - gmyth_scheduler_disconnect(scheduler); - - /* - * free allocated memory - */ - g_object_unref(scheduler); - g_free(schedule_info); - - return TRUE; -} - -static GtkWidget * -add_line(GtkWidget * vbox, const gchar * str) -{ - GtkWidget *label; - GtkWidget *hbox = gtk_hbox_new(FALSE, 0); - - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - gtk_container_set_border_width(GTK_CONTAINER(hbox), 3); - - label = gtk_label_new(str); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - - return hbox; -} - -static void -add_channel_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox) -{ - GtkWidget *combobox; - - GtkWidget *hbox = add_line(vbox, "Channel: "); - - combobox = gtk_combo_box_new_text(); - - scheduler_ui->channel_combobox = combobox; - gtk_box_pack_start(GTK_BOX(hbox), combobox, FALSE, FALSE, 0); - - GMythEPG *mmyth_epg = gmyth_epg_new(); - if (!gmyth_epg_connect(mmyth_epg, scheduler_ui->backend_info)) { - // FIXME: Without this list the scheduler UI should not be shown! - g_warning("[%s] Error when getting list of channels", - __FUNCTION__); - } - - if (gmyth_epg_get_channel_list - (mmyth_epg, &(scheduler_ui->channel_list)) < 0) { - g_debug("[%s] Error while trying to retrieve channel list", - __FUNCTION__); - } else { - GList *clist = scheduler_ui->channel_list; - GMythChannelInfo *channel_info; - - while (clist != NULL) { - channel_info = clist->data; - clist = clist->next; - gtk_combo_box_append_text(GTK_COMBO_BOX - (scheduler_ui->channel_combobox), - (channel_info->channel_name->str)); - } - - gtk_combo_box_set_active(GTK_COMBO_BOX - (scheduler_ui->channel_combobox), 0); - } -} - -static void -add_time_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox) -{ - GtkWidget *label; - GtkObject *spinbutton_adj; - GtkWidget *hbox = add_line(vbox, "Time: "); - - time_t real_time; - struct tm sched_time; - - time(&real_time); - - if (localtime_r((time_t *) & real_time, &sched_time) == NULL) { - g_warning("localtime_r error in mmyth_epg_grid_view!\n"); - return; - } - - if (sched_time.tm_min > 30) { - sched_time.tm_hour = sched_time.tm_hour + 1; - sched_time.tm_min = 0; - } else if (sched_time.tm_min > 0) { - sched_time.tm_min = 30; - } - - scheduler_ui->year_temp = (guint) sched_time.tm_year + 1900; - scheduler_ui->month_temp = (guint) sched_time.tm_mon; - scheduler_ui->day_temp = (guint) sched_time.tm_mday; - - // hour entry - spinbutton_adj = - gtk_adjustment_new(sched_time.tm_hour, 00, 23, 1, 10, 10); - scheduler_ui->hour_spinbutton = - gtk_spin_button_new(GTK_ADJUSTMENT(spinbutton_adj), 1, 0); - gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->hour_spinbutton, FALSE, - FALSE, 0); - - label = gtk_label_new((" : ")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - - // minute entry - spinbutton_adj = - gtk_adjustment_new(sched_time.tm_min, 0, 59, 1, 10, 10); - scheduler_ui->min_spinbutton = - gtk_spin_button_new(GTK_ADJUSTMENT(spinbutton_adj), 1, 0); - gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->min_spinbutton, FALSE, - FALSE, 0); - - label = gtk_label_new((" (hh:mm)")); - - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - -} - -static void -add_date_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox) -{ - char sched_date[24]; - GtkWidget *hbox = add_line(vbox, "Date: "); - - // sched_date = ctime(&real_time); - g_sprintf(sched_date, "%04d %02d %02d (yyyy mm dd)", - scheduler_ui->year_temp, scheduler_ui->month_temp + 1, - scheduler_ui->day_temp); - sched_date[23] = '\0'; - - scheduler_ui->date_button = gtk_button_new_with_label(sched_date); - gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->date_button, FALSE, - FALSE, 0); - gtk_button_set_relief(GTK_BUTTON(scheduler_ui->date_button), - GTK_RELIEF_NONE); - - g_signal_connect(G_OBJECT(scheduler_ui->date_button), "clicked", - G_CALLBACK(run_calendar_dialog), scheduler_ui); - -} - -static void -add_duration_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox) -{ - GtkWidget *hbox = add_line(vbox, "Duration: "); - GtkWidget *label; - GtkObject *spinbutton_adj; - - spinbutton_adj = gtk_adjustment_new(60, 5, 360, 5, 60, 60); - scheduler_ui->duration_spinbutton = - gtk_spin_button_new(GTK_ADJUSTMENT(spinbutton_adj), 1, 0); - gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->duration_spinbutton, - FALSE, TRUE, 0); - gtk_spin_button_set_numeric(GTK_SPIN_BUTTON - (scheduler_ui->duration_spinbutton), TRUE); - - label = gtk_label_new((" (minutes) ")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); -} - -static void -add_frequency_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox) -{ - - GtkWidget *hbox = add_line(vbox, "Frequency: "); - - scheduler_ui->freq_combobox = gtk_combo_box_new_text(); - gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->freq_combobox, FALSE, - FALSE, 0); - gtk_combo_box_append_text(GTK_COMBO_BOX(scheduler_ui->freq_combobox), - ("Only this day ")); - gtk_combo_box_append_text(GTK_COMBO_BOX(scheduler_ui->freq_combobox), - ("Daily ")); - gtk_combo_box_append_text(GTK_COMBO_BOX(scheduler_ui->freq_combobox), - ("Weekly ")); - gtk_combo_box_set_active(GTK_COMBO_BOX(scheduler_ui->freq_combobox), - 0); - -} - -static void -add_title_field(MMythSchedulerUI * scheduler_ui, GtkWidget * vbox) -{ - GtkWidget *hbox = add_line(vbox, "Title: "); - - scheduler_ui->title_entry = gtk_entry_new(); - gtk_box_pack_start(GTK_BOX(hbox), scheduler_ui->title_entry, FALSE, - FALSE, 0); - gtk_entry_set_text(GTK_ENTRY(scheduler_ui->title_entry), "(Optional)"); - -} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_schedulerui.h --- a/maemo-ui/src/mmyth_schedulerui.h Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -#ifndef MMYTH_SCHEDULERECORDING_H_ -#define MMYTH_SCHEDULERECORDING_H_ - -#include - -#include - -typedef struct _MMythSchedulerUI { - - GList *channel_list; - - GtkWidget *main_widget; - - GtkWidget *channel_combobox; - GtkWidget *freq_combobox; - GtkWidget *hour_spinbutton; - GtkWidget *min_spinbutton; - GtkWidget *duration_spinbutton; - GtkWidget *title_entry; - GtkWidget *date_button; - - GtkWidget *calendar_dialog; - GtkWidget *calendar; - - guint year_temp, - month_temp, - day_temp; - - GMythBackendInfo *backend_info; - -} MMythSchedulerUI; - -typedef struct { - long int channel_id; - - struct tm start_tm; - - int duration; - int frequency; - - GString *title; - -} ScheduleEntry; - -MMythSchedulerUI *mmyth_schedulerui_new(GMythBackendInfo * backend_info); - -gboolean mmyth_schedulerui_save(MMythSchedulerUI * scheduler_ui); - -void mmyth_schedulerui_cb_schedule_button(GtkButton * button, - gpointer user_data); - - -#endif /* MMYTH_SCHEDULERECORDING_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_tvplayer.c --- a/maemo-ui/src/mmyth_tvplayer.c Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,712 +0,0 @@ -/** - * GMyth Library - * - * @file gmyth/mmyth_tvplayer.c - * - * @brief

This component provides playback of the remote A/V using - * GStreamer. - * - * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. - * @author Hallyson Luiz de Morais Melo - * - *//* - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "mmyth_tvplayer.h" - -#include - -#include - -#define MYTHTV_VERSION_DEFAULT 30 - -typedef struct _GstPlayerWindowStateChange { - GstElement *play; - GstState old_state, - new_state; - MMythTVPlayer *tvplayer; -} GstPlayerWindowStateChange; - -typedef struct _GstPlayerWindowTagFound { - GstElement *play; - GstTagList *taglist; - MMythTVPlayer *tvplayer; -} GstPlayerWindowTagFound; - -/* - * static gboolean idle_state (gpointer data); - */ -static gboolean bus_call(GstBus * bus, GstMessage * msg, gpointer data); - -static void mmyth_tvplayer_class_init(MMythTVPlayerClass * klass); -static void mmyth_tvplayer_init(MMythTVPlayer * object); - -static void mmyth_tvplayer_dispose(GObject * object); -static void mmyth_tvplayer_finalize(GObject * object); - -G_DEFINE_TYPE(MMythTVPlayer, mmyth_tvplayer, G_TYPE_OBJECT) - - static gboolean mmyth_tvplayer_create_pipeline(MMythTVPlayer * - tvplayer); - static void new_pad_cb(GstElement * element, GstPad * pad, - gpointer data); - - static gboolean expose_cb(GtkWidget * widget, - GdkEventExpose * event, gpointer user_data); - - static void - mmyth_tvplayer_class_init(MMythTVPlayerClass * klass) -{ - GObjectClass *gobject_class; - - gobject_class = (GObjectClass *) klass; - - gobject_class->dispose = mmyth_tvplayer_dispose; - gobject_class->finalize = mmyth_tvplayer_finalize; -} - -static void -new_pad_cb(GstElement * element, GstPad * pad, gpointer data) -{ - MMythTVPlayer *tvplayer = MMYTH_TVPLAYER(data); - GstPadLinkReturn ret; - char *s; - - s = gst_caps_to_string(pad->caps); - - if (s[0] == 'a') { - ret = - gst_pad_link(pad, - gst_element_get_pad(tvplayer->audioqueue1, - "sink")); - } else { - ret = - gst_pad_link(pad, - gst_element_get_pad(tvplayer->videoqueue1, - "sink")); - } - - g_free(s); -} - -static gboolean -expose_cb(GtkWidget * widget, GdkEventExpose * event, gpointer user_data) -{ - MMythTVPlayer *tvplayer = MMYTH_TVPLAYER(user_data); - - if (tvplayer && tvplayer->videow) { - gst_x_overlay_set_xwindow_id(GST_X_OVERLAY - (tvplayer->gst_videosink), - GDK_WINDOW_XWINDOW(widget->window)); - return TRUE; - } - - g_warning("MMythTVPlayer expose called before setting video window\n"); - - return FALSE; -} - -static void -mmyth_tvplayer_init(MMythTVPlayer * tvplayer) -{ - tvplayer->gst_pipeline = NULL; - tvplayer->gst_source = NULL; - tvplayer->gst_videodec = NULL; - tvplayer->gst_videosink = NULL; - tvplayer->gst_videocolortrs = NULL; - tvplayer->videoqueue1 = NULL; - tvplayer->videoqueue2 = NULL; - tvplayer->audioqueue1 = NULL; - tvplayer->audioqueue2 = NULL; - - /* - * GTKWidget for rendering the video - */ - tvplayer->videow = NULL; - tvplayer->expose_handler = 0; - - tvplayer->backend_hostname = NULL; - tvplayer->backend_port = 0; - tvplayer->local_hostname = NULL; - - tvplayer->recorder = NULL; - tvplayer->tvchain = NULL; - tvplayer->proginfo = NULL; -} - -static void -mmyth_tvplayer_dispose(GObject * object) -{ - - G_OBJECT_CLASS(mmyth_tvplayer_parent_class)->dispose(object); -} - -static void -mmyth_tvplayer_finalize(GObject * object) -{ - g_signal_handlers_destroy(object); - - MMythTVPlayer *tvplayer = MMYTH_TVPLAYER(object); - - g_debug("[%s] Finalizing tvplayer", __FUNCTION__); - - if (tvplayer->videow != NULL) { - if (g_signal_handler_is_connected(tvplayer->videow, - tvplayer->expose_handler)) { - g_signal_handler_disconnect(tvplayer->videow, - tvplayer->expose_handler); - } - g_object_unref(tvplayer->videow); - } - - if (tvplayer->recorder != NULL) - g_object_unref(tvplayer->recorder); - if (tvplayer->tvchain != NULL) - g_object_unref(tvplayer->tvchain); - if (tvplayer->proginfo != NULL) - g_object_unref(tvplayer->proginfo); - - // Release Gstreamer elements - if (tvplayer->gst_pipeline != NULL) - g_object_unref(tvplayer->gst_pipeline); - if (tvplayer->gst_source != NULL) - g_object_unref(tvplayer->gst_source); - if (tvplayer->gst_videodec != NULL) - g_object_unref(tvplayer->gst_videodec); - if (tvplayer->gst_videocolortrs != NULL) - g_object_unref(tvplayer->gst_videocolortrs); - if (tvplayer->gst_videosink != NULL) - g_object_unref(tvplayer->gst_videosink); - if (tvplayer->videoqueue1 != NULL) - g_object_unref(tvplayer->videoqueue1); - if (tvplayer->videoqueue2 != NULL) - g_object_unref(tvplayer->videoqueue2); - if (tvplayer->audioqueue1 != NULL) - g_object_unref(tvplayer->audioqueue1); - if (tvplayer->audioqueue2 != NULL) - g_object_unref(tvplayer->audioqueue2); - - G_OBJECT_CLASS(mmyth_tvplayer_parent_class)->finalize(object); -} - -/** Creates a new instance of MMythTVPlayer. - * - * @return a new instance of MMythTVPlayer. - */ -MMythTVPlayer * -mmyth_tvplayer_new() -{ - MMythTVPlayer *tvplayer = - MMYTH_TVPLAYER(g_object_new(MMYTH_TVPLAYER_TYPE, NULL)); - - return tvplayer; -} - -/** Initializes the tv player. - * - * @param tvplayer the object instance. - * @return gboolean TRUE if the pipeline was created - * successfully, FALSE otherwise. - */ -gboolean -mmyth_tvplayer_initialize(MMythTVPlayer * tvplayer, - GMythBackendInfo * backend_info) -{ - tvplayer->backend_info = backend_info; - - if (!mmyth_tvplayer_create_pipeline(tvplayer)) { - g_warning - ("[%s] Error while creating pipeline. TV Player not initialized", - __FUNCTION__); - return FALSE; - } else { - g_debug("[%s] GStreamer pipeline created", __FUNCTION__); - } - - return TRUE; -} - -/** Creates the GStreamer pipeline used by the player. - * - * @param tvplayer the object instance. - * @return gboolean TRUE if the pipeline was created - * successfully, FALSE otherwise. - */ -static gboolean -mmyth_tvplayer_create_pipeline(MMythTVPlayer * tvplayer) -{ - GstElement *pipeline; - GstElement *source, - *parser; - GstElement *videodec, - *videosink; - GstElement *videocolortrs; -#ifndef MAEMO_PLATFORM - GstElement *audiodec, - *audioconv, - *audioqueue2; -#endif - GstElement *audiosink; - GstElement *videoqueue1, - *videoqueue2, - *audioqueue1; - - g_debug("MMythTVPlayer: Setting the Gstreamer pipeline\n"); - - pipeline = gst_pipeline_new("video-player"); - source = gst_element_factory_make("mythtvsrc", "myth-source"); - parser = gst_element_factory_make("nuvdemux", "nuv-demux"); - - /* - * Gstreamer Video elements - */ - videoqueue1 = gst_element_factory_make("queue", "video-queue1"); - videodec = gst_element_factory_make("ffdec_mpeg4", "video-decoder"); - videoqueue2 = gst_element_factory_make("queue", "video-queue2"); - videocolortrs = - gst_element_factory_make("ffmpegcolorspace", - "image-color-transforms"); - -#ifdef MAEMO_PLATFORM - videosink = gst_element_factory_make("sdlvideosink", "image-output"); -#else - videosink = gst_element_factory_make("xvimagesink", "image-output"); -#endif - - /* - * Gstreamer Audio elements - */ - audioqueue1 = gst_element_factory_make("queue", "audio-queue1"); -#ifdef MAEMO_PLATFORM - audiosink = gst_element_factory_make("dspmp3sink", "audio-output"); -#else - audioqueue2 = gst_element_factory_make("queue", "audio-queue2"); - audiodec = gst_element_factory_make("mad", "audio-decoder"); - audioconv = - gst_element_factory_make("audioconvert", "audio-converter"); - audiosink = gst_element_factory_make("alsasink", "audio-output"); -#endif - - if (!(pipeline && source && parser && videodec && videosink) || - !(videoqueue1 && videoqueue2 && audioqueue1 && audiosink)) { - /* - * FIXME: hanlde the error correctly - */ - /* - * video_alignment is not being created (below) and is causing - * problems to the ui - */ - - tvplayer->gst_pipeline = NULL; - tvplayer->gst_videodec = NULL; - tvplayer->gst_videosink = NULL; - tvplayer->gst_videocolortrs = NULL; - - g_warning("GstElement creation error!\n"); - return FALSE; - } -#ifndef MAEMO_PLATFORM - if (!(audiodec && audioconv)) { - g_warning("GstElement for audio stream creation error!"); - return FALSE; - } -#endif - - tvplayer->gst_pipeline = pipeline; - tvplayer->gst_source = source; - tvplayer->gst_videodec = videodec; - tvplayer->gst_videosink = videosink; - tvplayer->gst_videocolortrs = videocolortrs; - g_object_ref(tvplayer->gst_pipeline); - g_object_ref(tvplayer->gst_source); - g_object_ref(tvplayer->gst_videodec); - g_object_ref(tvplayer->gst_videosink); - g_object_ref(tvplayer->gst_videocolortrs); - - tvplayer->videoqueue1 = videoqueue1; - tvplayer->videoqueue2 = videoqueue2; - tvplayer->audioqueue1 = audioqueue1; - g_object_ref(tvplayer->videoqueue1); - g_object_ref(tvplayer->videoqueue2); - g_object_ref(tvplayer->audioqueue1); - -#ifndef MAEMO_PLATFORM - tvplayer->audioqueue2 = audioqueue2; - g_object_ref(tvplayer->audioqueue2); -#endif - - // g_object_set (G_OBJECT (videosink), "sync", TRUE, NULL); - g_object_set(G_OBJECT(audiosink), "sync", FALSE, NULL); - - gst_bus_add_watch(gst_pipeline_get_bus - (GST_PIPELINE(tvplayer->gst_pipeline)), bus_call, - tvplayer); - - gst_bin_add_many(GST_BIN(pipeline), source, parser, videoqueue1, - videodec, videoqueue2, videocolortrs, videosink, - NULL); - -#ifndef MAEMO_PLATFORM - gst_bin_add_many(GST_BIN(pipeline), audioqueue1, audiodec, audioconv, - audioqueue2, audiosink, NULL); -#else - gst_bin_add_many(GST_BIN(pipeline), audioqueue1, audiosink, NULL); -#endif - - { - // GstCaps *rtpcaps = gst_caps_new_simple ("application/x-rtp", - // NULL); - // gst_element_link_filtered(source, parser, rtpcaps); - } - - gst_element_link(source, parser); - gst_element_link_many(videoqueue1, videodec, videoqueue2, - videocolortrs, videosink, NULL); - -#ifndef MAEMO_PLATFORM - gst_element_link_many(videosink, audioqueue1, audiodec, audioconv, - audioqueue2, audiosink, NULL); -#else - gst_element_link_many(videosink, audioqueue1, audiosink, NULL); -#endif - - g_signal_connect(parser, "pad-added", G_CALLBACK(new_pad_cb), - tvplayer); - - return TRUE; -} - -/** Configures the backend and the tv player - * for playing the recorded content A/V. - * - * FIXME: Change filename to program info or other structure about the recorded - * - * @param tvplayer the object instance. - * @param filename the file uri of the recorded content to be played. - * @return TRUE if successfull, FALSE if any error happens. - */ -gboolean -mmyth_tvplayer_record_setup(MMythTVPlayer * tvplayer, - const gchar * filename) -{ - // FIXME: we should receive the uri instead of filename - const gchar *hostname = - gmyth_backend_info_get_hostname(tvplayer->backend_info); - const gint port = - gmyth_backend_info_get_port(tvplayer->backend_info); - - GString *fullpath = g_string_new("myth://"); - g_string_append_printf(fullpath, "%s:%d/%s", hostname, port, filename); - - tvplayer->is_livetv = FALSE; - - g_debug("[%s] Setting record uri to gstreamer pipeline to %s", - __FUNCTION__, fullpath->str); - - g_object_set(G_OBJECT(tvplayer->gst_source), "location", - fullpath->str, NULL); - - return TRUE; -} - -/** Configures the backend and the tv player - * for playing the live tv. - * - * @param tvplayer the object instance. - * @return TRUE if successfull, FALSE if any error happens. - */ -gboolean -mmyth_tvplayer_livetv_setup(MMythTVPlayer * tvplayer) -{ - gboolean res = TRUE; - - tvplayer->livetv = gmyth_livetv_new(); - - if (!gmyth_livetv_setup(tvplayer->livetv, tvplayer->backend_info)) - goto error; - - return res; - - error: - res = FALSE; - if (tvplayer->livetv != NULL) { - g_object_unref(tvplayer->livetv); - } - - if (tvplayer->local_hostname != NULL) { - g_string_free(tvplayer->local_hostname, TRUE); - } - - if (tvplayer->recorder != NULL) { - g_object_unref(tvplayer->recorder); - tvplayer->recorder = NULL; - } - - if (tvplayer->tvchain != NULL) { - g_object_unref(tvplayer->tvchain); - tvplayer->tvchain = NULL; - } - - if (tvplayer->proginfo != NULL) { - g_object_unref(tvplayer->proginfo); - tvplayer->proginfo = NULL; - } - - return res; - -} - -/** Sets the GTK video widget for the tv player. - * - * @param tvplayer the object instance. - * @param videow the GTK video window. - * @return TRUE if successfull, FALSE if any error happens. - */ -gboolean -mmyth_tvplayer_set_widget(MMythTVPlayer * tvplayer, GtkWidget * videow) -{ - tvplayer->videow = videow; - g_object_ref(videow); - - g_debug("[%s] Setting widget for tv player render", __FUNCTION__); - - tvplayer->expose_handler = - g_signal_connect(tvplayer->videow, "expose-event", - G_CALLBACK(expose_cb), tvplayer); - - // g_signal_connect(miptv_ui->videow, "size_request", - // G_CALLBACK(cb_preferred_video_size), miptv_ui); - - return TRUE; -} - -static gboolean -bus_call(GstBus * bus, GstMessage * msg, gpointer data) -{ - // MMythTVPlayer *tvplayer = MMYTH_TVPLAYER ( data ); - // GMainLoop *loop = tvplayer->loop; - - switch (GST_MESSAGE_TYPE(msg)) { - case GST_MESSAGE_EOS: - printf("End of stream\n"); - // g_idle_add ((GSourceFunc) idle_eos, data); - gst_element_set_state(GST_ELEMENT(GST_MESSAGE_SRC(msg)), - GST_STATE_NULL); - gst_element_set_locked_state(GST_ELEMENT(GST_MESSAGE_SRC(msg)), - TRUE); - break; - case GST_MESSAGE_ERROR: - { - gchar *debug; - GError *err; - - gst_message_parse_error(msg, &err, &debug); - g_free(debug); - - printf("Error: %s\n", err->message); - g_error_free(err); - - // g_main_loop_quit (loop); - } - break; - default: - printf(gst_message_type_get_name(GST_MESSAGE_TYPE(msg))); - printf("\n"); - break; - } - - return TRUE; -} - - -#if 0 -static gboolean -idle_state(gpointer data) -{ - GstPlayerWindowStateChange *st = data; - - if (st->old_state == GST_STATE_PLAYING) { - if (st->miptv_ui->idle_id != 0) { - g_source_remove(st->miptv_ui->idle_id); - st->miptv_ui->idle_id = 0; - } - } else if (st->new_state == GST_STATE_PLAYING) { - if (st->miptv_ui->idle_id != 0) - g_source_remove(st->miptv_ui->idle_id); - - st->miptv_ui->idle_id = g_idle_add(cb_iterate, st->miptv_ui); - } - - /* - * new movie loaded? - */ - if (st->old_state == GST_STATE_READY - && st->new_state > GST_STATE_READY) { - - /* - * gboolean have_video = FALSE; - */ - - gtk_widget_show(st->miptv_ui->videow); - - gtk_window_resize(GTK_WINDOW(st->miptv_ui->main_window), 1, 1); - - } - - /* - * discarded movie? - */ - if (st->old_state > GST_STATE_READY - && st->new_state == GST_STATE_READY) { - - if (st->miptv_ui->tagcache) { - gst_tag_list_free(st->miptv_ui->tagcache); - st->miptv_ui->tagcache = NULL; - } - } - - gst_object_unref(GST_OBJECT(st->play)); - // g_object_unref (G_OBJECT (st->win)); - g_free(st); - - /* - * once - */ - return FALSE; -} - -#endif - -/** Stops playing the current A/V. - * - * FIXME: How to proceed differently between livetv - * and recorded content? - * - * @param tvplayer the object instance. - * @return void - */ -void -mmyth_tvplayer_stop_playing(MMythTVPlayer * tvplayer) -{ - g_debug("[%s] Setting gstreamer pipeline state to NULL", __FUNCTION__); - - gst_element_set_state(tvplayer->gst_pipeline, GST_STATE_NULL); - - if (tvplayer->is_livetv) { - if (!gmyth_recorder_stop_livetv(tvplayer->recorder)) { - g_warning("[%s] Error while stoping remote encoder", - __FUNCTION__); - } - } -} - -/** Queries if the tvplayer is active playing A/V content. - * - * @param tvplayer the object instance. - * @return TRUE if the tvplayer is active, FALSE otherwise. - */ -gboolean -mmyth_tvplayer_is_playing(MMythTVPlayer * tvplayer) -{ - return (GST_STATE(tvplayer->gst_pipeline) == GST_STATE_PLAYING); -} - -/** Static function that sets the tvplayer state to PLAYING. - * - * @param tvplayer the object instance. - * @return TRUE if the tvplayer is active, FALSE otherwise. - */ -static gboolean -idle_play(gpointer data) -{ - MMythTVPlayer *tvplayer = MMYTH_TVPLAYER(data); - - g_debug("MMythTVPlayer: Setting pipeline state to PLAYING\n"); - - gst_element_set_state(tvplayer->gst_pipeline, GST_STATE_PLAYING); - - return FALSE; -} - -/** Start playing A/V with the tvplayer attributes. - * - * @param tvplayer the object instance. - */ -void -mmyth_tvplayer_start_playing(MMythTVPlayer * tvplayer) -{ - - // FIXME: Move this to livetv_setup?? - if (tvplayer->is_livetv) { - -#if 0 - if (!tvplayer || !(tvplayer->proginfo) - || !(tvplayer->local_hostname) - || !(tvplayer->gst_source)) { - g_warning("GMythtvPlayer not ready to start playing\n"); - } - - if (!(tvplayer->proginfo->pathname)) { - g_warning - ("[%s] Playback url is null, could not play the myth content", - __FUNCTION__); - return; - } - - g_debug("MMythTVPlayer: Start playing %s", - tvplayer->proginfo->pathname->str); -#endif - g_object_set(G_OBJECT(tvplayer->gst_source), "mythtv-live", - TRUE, NULL); -#if 0 - if (tvplayer->tvchain != NULL) { - GString *str_chainid = - gmyth_tvchain_get_id(tvplayer->tvchain); - g_print("[%s]\tCHAIN ID: %s\n", __FUNCTION__, - str_chainid->str); - - g_object_set(G_OBJECT(tvplayer->gst_source), - "mythtv-live-chainid", g_strdup(str_chainid->str), - NULL); - if (str_chainid != NULL) - g_string_free(str_chainid, FALSE); - } - - if (tvplayer->recorder != NULL) - g_object_set(G_OBJECT(tvplayer->gst_source), "mythtv-live-id", - tvplayer->recorder->recorder_num, NULL); - g_debug("[%s] Setting location to %s", __FUNCTION__, - tvplayer->proginfo->pathname->str); - - /* - * Sets the gstreamer properties acording to the service access - * address - */ - g_object_set(G_OBJECT(tvplayer->gst_source), "location", - tvplayer->proginfo->pathname->str, NULL); -#endif - } - - g_object_set(G_OBJECT(tvplayer->gst_source), "mythtv-version", - MYTHTV_VERSION_DEFAULT, NULL); - - g_object_set(G_OBJECT(tvplayer->gst_source), "mythtv-debug", - TRUE, NULL); - - g_idle_add(idle_play, tvplayer); - -} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_tvplayer.h --- a/maemo-ui/src/mmyth_tvplayer.h Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/** - * GMyth Library - * - * @file gmyth/mmyth_tvplayer.h - * - * @brief

This component provides playback of the remote A/V using - * GStreamer. - * - * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia. - * @author Hallyson Luiz de Morais Melo - * - *//* - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MMYTH_TVPLAYER_H_ -#define MMYTH_TVPLAYER_H_ - -#include -#include - -/* - * GStreamer includes - */ -#include -#include - -#include -#include -#include -#include - -G_BEGIN_DECLS -#define MMYTH_TVPLAYER_TYPE (mmyth_tvplayer_get_type ()) -#define MMYTH_TVPLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MMYTH_TVPLAYER_TYPE, MMythTVPlayer)) -#define MMYTH_TVPLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MMYTH_TVPLAYER_TYPE, MMythTVPlayerClass)) -#define IS_MMYTH_TVPLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MMYTH_TVPLAYER_TYPE)) -#define IS_MMYTH_TVPLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MMYTH_TVPLAYER_TYPE)) -#define MMYTH_TVPLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MMYTH_TVPLAYER_TYPE, MMythTVPlayerClass)) -typedef struct _MMythTVPlayer MMythTVPlayer; -typedef struct _MMythTVPlayerClass MMythTVPlayerClass; - -struct _MMythTVPlayerClass { - GObjectClass parent_class; - - /* - * callbacks - */ - /* - * no one for now - */ -}; - -struct _MMythTVPlayer { - GObject parent; - - GstElement *gst_pipeline; - GstElement *gst_source; - GstElement *gst_videodec; - GstElement *gst_videosink; - GstElement *gst_videocolortrs; - GstElement *videoqueue1; - GstElement *videoqueue2; - GstElement *audioqueue1; - GstElement *audioqueue2; - - gulong expose_handler; - // GMainLoop *loop; - - GtkWidget *videow; - - /* - * Backend connection related variables - */ - GString *backend_hostname; - gint backend_port; - GString *local_hostname; - - GMythRecorder *recorder; - GMythTVChain *tvchain; - GMythProgramInfo *proginfo; - GMythLiveTV *livetv; - - GMythBackendInfo *backend_info; - - gboolean is_livetv; -}; - - -GType mmyth_tvplayer_get_type(void); - -MMythTVPlayer *mmyth_tvplayer_new(); -gboolean mmyth_tvplayer_initialize(MMythTVPlayer * tvplayer, - GMythBackendInfo * backend_info); - -void mmyth_tvplayer_start_playing(MMythTVPlayer * tvplayer); -void mmyth_tvplayer_stop_playing(MMythTVPlayer * tvplayer); - -gboolean mmyth_tvplayer_set_widget(MMythTVPlayer * tvplayer, - GtkWidget * videow); - -gboolean mmyth_tvplayer_is_playing(MMythTVPlayer * tvplayer); - -gboolean mmyth_tvplayer_record_setup(MMythTVPlayer * tvplayer, - const gchar * filename); -gboolean mmyth_tvplayer_livetv_setup(MMythTVPlayer * tvplayer); - -G_END_DECLS -#endif /* MMYTH_TVPLAYER_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_ui.c --- a/maemo-ui/src/mmyth_ui.c Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,894 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mmyth_ui.h" -#include "mmyth_uicommon.h" -#include "mmyth_schedulerui.h" -#include "mmyth_recordui.h" -#include "mmyth_uisettings.h" -#include "mmyth_epg_grid_view.h" -#include "mmyth_tvplayer.h" - -/* - * GMyth library includes - */ - -#ifndef MAEMO_PLATFORM -static gint button_press_handler(GtkWidget * widget, GdkEvent * event); -#endif - -static MMythUiCommon *create_main_view(MMythUi * mmyth_ui); -static MMythUiCommon *create_video_view(MMythUi * mmyth_ui); -static MMythUiCommon *create_epg_grid_view(MMythUi * mmyth_ui); -static MMythUiCommon *create_record_view(MMythUi * mmyth_ui); -static MMythUiCommon *create_schedule_view(MMythUi * mmyth_ui); - -static void cb_video_close_button(GtkButton * button, - gpointer user_data); -static void cb_record_button(GtkButton * button, gpointer user_data); -static void cb_menu_item_settings(GtkMenuItem * menuitem, - gpointer user_data); - -/* - * main box from button box separator - */ -static GtkWidget *main_vseparator = NULL; - -GdkPixbuf *icon_sports, - *icon_news, - *icon_movies, - *icon_shows, - *icon_default; - -#ifndef MAEMO_PLATFORM -/* - * FIXME: - */ -static MMythUi *popup_mmyth_ui; -#endif - -MMythUi * -mmyth_ui_initialize( -#ifdef MAEMO_PLATFORM - HildonProgram * program, -#endif - GtkWidget * main_window) -{ - MMythUi *mmyth_ui; - - mmyth_ui = g_new0(MMythUi, 1); - - mmyth_ui->backend_info = - gmyth_backend_info_new_full("localhost", "mythtv", "mythtv", - "mythconverg", 6543); - - mmyth_ui->main_window = main_window; - mmyth_ui->videow = NULL; - mmyth_ui->mmyth_recordui = NULL; - mmyth_ui->mmyth_schedulerui = NULL; - - /* - * Horizontal box that divides the view into control and video area - */ - mmyth_ui->main_hbox = gtk_hbox_new(FALSE, 0); - gtk_widget_show(mmyth_ui->main_hbox); - g_object_ref(mmyth_ui->main_hbox); - - main_bg_color.red = 65000; - main_bg_color.green = 65000; - main_bg_color.blue = 65000; - - -#ifndef MAEMO_PLATFORM - /* - * Popup menu - */ - popup_mmyth_ui = mmyth_ui; - g_signal_connect(G_OBJECT(mmyth_ui->main_hbox), "event", - G_CALLBACK(button_press_handler), - G_OBJECT(mmyth_ui->main_hbox)); - -#else // #ifdef MAEMO - - mmyth_ui->main_menu = GTK_MENU(gtk_menu_new()); - hildon_program_set_common_menu(program, mmyth_ui->main_menu); - - mmyth_ui->menu_setup = gtk_menu_item_new_with_label("Setup"); - gtk_widget_set_size_request(GTK_WIDGET(mmyth_ui->menu_setup), 150, 40); - gtk_menu_append(mmyth_ui->main_menu, mmyth_ui->menu_setup); - - g_signal_connect(G_OBJECT(mmyth_ui->menu_setup), "activate", - G_CALLBACK(cb_menu_item_settings), mmyth_ui); - - gtk_widget_show_all(GTK_WIDGET(mmyth_ui->main_menu)); -#endif - - // Main widget is mmyth_ui->main_hbox - mmyth_ui->main_uicommon = create_main_view(mmyth_ui); - - gtk_container_add(GTK_CONTAINER(mmyth_ui->main_window), - mmyth_ui->main_hbox); - - mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon); - - return mmyth_ui; -} - -void -mmyth_ui_finalize(MMythUi * mmyth_ui) -{ - if (mmyth_ui != NULL) { - if (mmyth_ui->main_uicommon) - mmyth_uicommon_free(mmyth_ui->main_uicommon); - if (mmyth_ui->video_uicommon) - mmyth_uicommon_free(mmyth_ui->video_uicommon); - if (mmyth_ui->epg_grid_uicommon) - mmyth_uicommon_free(mmyth_ui->epg_grid_uicommon); - if (mmyth_ui->record_uicommon) - mmyth_uicommon_free(mmyth_ui->record_uicommon); - if (mmyth_ui->schedule_uicommon) - mmyth_uicommon_free(mmyth_ui->schedule_uicommon); - - g_free(mmyth_ui); - } -} - -void -mmyth_ui_set_widget(MMythUi * mmyth_ui, MMythUiCommon * new_uicommon) -{ - if (new_uicommon == NULL) { - g_warning("MMythUI setting a NULL UI_Common as current display\n"); - return; - } - - if (mmyth_ui->current_uicommon) { - if (mmyth_ui->current_uicommon == mmyth_ui->video_uicommon) { - gtk_widget_hide(mmyth_ui->current_uicommon->main_widget); - gtk_widget_hide(mmyth_ui->videow); - } else { - gtk_container_remove(GTK_CONTAINER(mmyth_ui->main_hbox), - mmyth_ui->current_uicommon->main_widget); - } - - gtk_container_remove(GTK_CONTAINER(mmyth_ui->main_hbox), - mmyth_ui->current_uicommon->event_box); - gtk_container_remove(GTK_CONTAINER(mmyth_ui->main_hbox), - main_vseparator); - - } - - if (new_uicommon->main_widget == mmyth_ui->video_alignment) { - // gst_player_video_show (GST_PLAYER_VIDEO(mmyth_ui->videow)); - gtk_widget_show(mmyth_ui->video_alignment); - gtk_widget_show(mmyth_ui->videow); - } else { - /* - * FIXME: Fst call is NULL when mmyth_player_init fails - */ - if (mmyth_ui->video_alignment != NULL) - gtk_widget_hide(mmyth_ui->video_alignment); - /* - * FIXME: Fst call is NULL when mmyth_player_init fails - */ - if (mmyth_ui->videow != NULL) - gtk_widget_hide(mmyth_ui->videow); - - gtk_box_pack_start(GTK_BOX(mmyth_ui->main_hbox), - new_uicommon->main_widget, TRUE, TRUE, 0); - } - - if (main_vseparator == NULL) { - /* - * FIXME: should free this variable - */ - main_vseparator = gtk_vseparator_new(); - g_object_ref(main_vseparator); - } - gtk_box_pack_start(GTK_BOX(mmyth_ui->main_hbox), - main_vseparator, FALSE, FALSE, 0); - gtk_widget_show(main_vseparator); - - gtk_box_pack_end(GTK_BOX(mmyth_ui->main_hbox), new_uicommon->event_box, - FALSE, FALSE, 0); - - mmyth_ui->current_uicommon = new_uicommon; - -} - -/* - * The close callback is the same for all windows - */ -static void -cb_not_impl_button(GtkButton * button, gpointer user_data) -{ - MMythUi *mmyth_ui = (MMythUi *) user_data; - - GtkWidget *msg_dialog = - gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window), - GTK_DIALOG_MODAL | - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, - "Feature not implemented"); - gtk_widget_set_size_request(msg_dialog, 350, 120); - - gtk_dialog_run(GTK_DIALOG(msg_dialog)); - - gtk_widget_destroy(GTK_WIDGET(msg_dialog)); -} - -/****************************************************************************** - * POPUP MENU WIDGET METHODS * - *****************************************************************************/ - -static void -cb_menu_item_settings(GtkMenuItem * menuitem, gpointer user_data) -{ - - MMythUi *mmyth_ui = (MMythUi *) user_data; - - if (mmyth_uisettings_run(GTK_WINDOW(mmyth_ui->main_window))) { - // If user changes the settings, we restart the context - g_debug("[%s] Restarting mmyth_context to new settings", - __FUNCTION__); - // gmyth_context_initialize(); - } -} - -#ifndef MAEMO_PLATFORM - -static void -detacher(GtkWidget * attach_widget, GtkMenu * menu) -{ - -} - -static void -do_popup_menu(GtkWidget * my_widget, GdkEventButton * event) -{ - GtkWidget *popup; - - int button, - event_time; - - GtkWidget *item_general; - GtkWidget *image; - - popup = gtk_menu_new(); - - item_general = gtk_image_menu_item_new_with_mnemonic("Setup"); - gtk_widget_show(item_general); - gtk_container_add(GTK_CONTAINER(popup), item_general); - - image = gtk_image_new_from_stock("gtk-edit", GTK_ICON_SIZE_MENU); - gtk_widget_show(image); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item_general), - image); - - g_signal_connect(G_OBJECT(item_general), "activate", - G_CALLBACK(cb_menu_item_settings), popup_mmyth_ui); - - if (event) { - button = event->button; - event_time = event->time; - } else { - button = 0; - event_time = gtk_get_current_event_time(); - } - - gtk_menu_attach_to_widget(GTK_MENU(popup), my_widget, detacher); - gtk_menu_popup(GTK_MENU(popup), NULL, NULL, NULL, NULL, - button, event_time); - gtk_widget_show_all(popup); -} - -/* - * Respond to a button-press by posting a menu passed in as widget. Note - * that the "widget" argument is the menu being posted, NOT the button - * that was pressed. - */ -static gint -button_press_handler(GtkWidget * widget, GdkEvent * event) -{ - - if (event->type == GDK_BUTTON_PRESS) { - GdkEventButton *bevent = (GdkEventButton *) event; - /* - * Ignore double-clicks and triple-clicks - */ - if (bevent->button == 3) { - do_popup_menu(widget, bevent); - return TRUE; - } - } - - /* - * Tell calling code that we have not handled this event; pass it on. - */ - return FALSE; -} -#endif - -/****************************************************************************** - * MAIN APP VIEW METHODS * - *****************************************************************************/ - -static void -cb_close_button(GtkButton * button, gpointer user_data) -{ - MMythUi *mmyth_ui = (MMythUi *) user_data; - - mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon); -} - -static void -cb_watch_tv_button(GtkButton * button, gpointer user_data) -{ - MMythUi *mmyth_ui = (MMythUi *) user_data; - gboolean res = FALSE; - - if (!(mmyth_ui->video_uicommon)) - mmyth_ui->video_uicommon = create_video_view(mmyth_ui); - - // Creates the tv player that will retrieve the mythtv content, decode - // and show it - mmyth_ui->tvplayer = mmyth_tvplayer_new(); - /* - * choose here if this is a LiveTV session - */ - mmyth_ui->tvplayer->is_livetv = TRUE; - - res = - mmyth_tvplayer_initialize(mmyth_ui->tvplayer, - mmyth_ui->backend_info); - - if (!res) { - g_warning("[%s] Could not initialize tvplayer", __FUNCTION__); - - g_object_unref(mmyth_ui->tvplayer); - mmyth_ui->tvplayer = NULL; - - GtkWidget *dialog = - gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "MMyth found errors while starting TV Player, please check " - "the GStreamer installation"); - - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - - return; - } - // res = mmyth_tvplayer_livetv_setup (mmyth_ui->tvplayer); - // - if (mmyth_ui && mmyth_ui->tvplayer && res) { - mmyth_tvplayer_set_widget(mmyth_ui->tvplayer, mmyth_ui->videow); - mmyth_tvplayer_start_playing(mmyth_ui->tvplayer); - } else { - // TODO: Show Alert with error description! - g_warning("[%s] MMythUI can't initialize tv_player", __FUNCTION__); - g_object_unref(mmyth_ui->tvplayer); - mmyth_ui->tvplayer = NULL; - // FIXME: Show the exact error that happened - GtkWidget *dialog = - gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "Error while starting TV Player, please check if the backend" - " is running properly and a tv card is available!"); - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - return; - } - mmyth_ui_set_widget(mmyth_ui, mmyth_ui->video_uicommon); - -} - -static void -cb_epg_button(GtkButton * button, gpointer user_data) -{ - MMythUi *mmyth_ui = (MMythUi *) user_data; - - if (!(mmyth_ui->epg_grid_uicommon)) - mmyth_ui->epg_grid_uicommon = create_epg_grid_view(mmyth_ui); - - mmyth_ui_set_widget(mmyth_ui, mmyth_ui->epg_grid_uicommon); -} - -static MMythUiCommon * -create_main_view(MMythUi * mmyth_ui) -{ - MMythUiCommon *ui_common; - GtkWidget *main_widget; - GtkWidget *image; - - g_debug("Creating Main UI Common"); - - // FIXME: file path -#ifdef MMYTH_DEV - image = gtk_image_new_from_file("../pixmaps/mmyth_logo.png"); -#else - image = gtk_image_new_from_file(PIX_DIR "mmyth_logo.png"); -#endif - - main_widget = gtk_event_box_new(); - - gtk_container_add(GTK_CONTAINER(main_widget), image); - - - gtk_widget_show_all(main_widget); - g_object_ref(main_widget); - - ui_common = mmyth_uicommon_new(main_widget, - "Watch TV", "EPG", "Recording"); - - /* - * Button signals - */ - // FIXME - g_signal_connect(G_OBJECT(ui_common->button1), "clicked", - G_CALLBACK(cb_watch_tv_button), mmyth_ui); - g_signal_connect(G_OBJECT(ui_common->button2), "clicked", - G_CALLBACK(cb_epg_button), mmyth_ui); - g_signal_connect(G_OBJECT(ui_common->button3), "clicked", - G_CALLBACK(cb_record_button), mmyth_ui); - - return ui_common; - -} - -/****************************************************************************** - * epg GRID VIEW METHODS * - *****************************************************************************/ - -static MMythUiCommon * -create_epg_grid_view(MMythUi * mmyth_ui) -{ - MMythUiCommon *ui_common; - - g_debug("Creating EPG Grid UI Common"); - - GtkWidget *epg_grid_view = - GTK_WIDGET(epg_grid_view_new(mmyth_ui)); - - ui_common = mmyth_uicommon_new(epg_grid_view, - "Play", "Record", "Close"); - - /* - * Button signals - */ - g_signal_connect(G_OBJECT(ui_common->button1), "clicked", - G_CALLBACK(cb_not_impl_button), mmyth_ui); - g_signal_connect(G_OBJECT(ui_common->button2), "clicked", - G_CALLBACK(cb_record_button), mmyth_ui); - g_signal_connect(G_OBJECT(ui_common->button3), "clicked", - G_CALLBACK(cb_close_button), mmyth_ui); - - return ui_common; -} -/****************************************************************************** - * SCHEDULE VIEW METHODS * - ******************************************************************************/ - -static void -cb_save_new_schedule(GtkButton * button, gpointer user_data) -{ - MMythUi *mmyth_ui = (MMythUi *) user_data; - - if (!(mmyth_ui->schedule_uicommon)) - mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui); - - mmyth_schedulerui_save(mmyth_ui->mmyth_schedulerui); - - mmyth_recordui_reload_schedule(mmyth_ui->mmyth_recordui); - - mmyth_ui_set_widget(mmyth_ui, mmyth_ui->record_uicommon); - -} - -static void -cb_edit_scheduled(GtkTreeView * tree_view, GtkTreePath * path, - GtkTreeViewColumn * column, gpointer user_data) -{ - MMythUi *mmyth_ui = (MMythUi *) user_data; - GtkTreeSelection *selection; - GtkTreeModel *list_store; - GtkTreeIter iter; - int index; - // gint new_row = 0, record_id = 0; - ScheduleInfo *schedule_info; - GList *schedule_list; - // GtkTreeIter iter; - gint res; - - // gtk_tree_store_clear(recordui->sch_tree_store); - - res = - gmyth_scheduler_get_schedule_list(mmyth_ui->mmyth_recordui-> - scheduler, &(schedule_list)); - if (res < 0) { - g_warning - ("[%s] Retrieved NULL list of scheduled data from database", - __FUNCTION__); - // return FALSE; - } - printf("\nX %d", res); - fflush(stdout); - - selection = - gtk_tree_view_get_selection(GTK_TREE_VIEW - (mmyth_ui->mmyth_recordui-> - sch_treeview)); - - gtk_tree_selection_get_selected(selection, &list_store, &iter); - gtk_tree_model_get(list_store, &iter, 4, &index, -1); - - mmyth_ui_set_widget(mmyth_ui, mmyth_ui->schedule_uicommon); - - if (!(mmyth_ui->schedule_uicommon)) - mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui); - - schedule_list = - g_list_nth(schedule_list, - g_ascii_strtoull(gtk_tree_path_to_string(path), NULL, - 10)); - schedule_info = (ScheduleInfo *) schedule_list->data; - - printf("\nstarttime: %ld", schedule_info->start_time->tv_sec); - fflush(stdout); -} - -static MMythUiCommon * -create_schedule_view(MMythUi * mmyth_ui) -{ - MMythUiCommon *ui_common; - GtkWidget *schedule_widget; - - g_debug("Creating Schedule UI Common"); - - mmyth_ui->mmyth_schedulerui = - mmyth_schedulerui_new(mmyth_ui->backend_info); - if (mmyth_ui->mmyth_schedulerui == NULL) { - g_warning("[%s] Error while creating scheduler ui", __FUNCTION__); - return NULL; - } - - schedule_widget = mmyth_ui->mmyth_schedulerui->main_widget; - - gtk_widget_show_all(schedule_widget); - g_object_ref(schedule_widget); - - ui_common = mmyth_uicommon_new(schedule_widget, - "Save", "Clear", "Cancel"); - - /* - * Button signals - */ - g_signal_connect(G_OBJECT(ui_common->button1), "clicked", - G_CALLBACK(cb_save_new_schedule), mmyth_ui); - g_signal_connect(G_OBJECT(ui_common->button2), "clicked", - G_CALLBACK(cb_not_impl_button), mmyth_ui); - g_signal_connect(G_OBJECT(ui_common->button3), "clicked", - G_CALLBACK(cb_record_button), mmyth_ui); - - return ui_common; -} -/****************************************************************************** - * RECORD VIEW METHODS * - ******************************************************************************/ -static void -cb_record_button(GtkButton * button, gpointer user_data) -{ - MMythUi *mmyth_ui = (MMythUi *) user_data; - - if (!(mmyth_ui->record_uicommon)) { - mmyth_ui->record_uicommon = create_record_view(mmyth_ui); - mmyth_ui->schedule_uicommon = create_schedule_view(mmyth_ui); - } - - mmyth_recordui_reload_all(mmyth_ui->mmyth_recordui); - - mmyth_ui_set_widget(mmyth_ui, mmyth_ui->record_uicommon); - -} - -static void -cb_record_close_button(GtkButton * button, gpointer user_data) -{ - MMythUi *mmyth_ui = (MMythUi *) user_data; - - mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon); - - mmyth_recordui_free(mmyth_ui->mmyth_recordui); - - if (mmyth_ui->record_uicommon) { - gtk_widget_destroy(mmyth_ui->record_uicommon->main_widget); - mmyth_uicommon_free(mmyth_ui->record_uicommon); - mmyth_ui->record_uicommon = NULL; - } - - if (mmyth_ui->schedule_uicommon) { - // mmyth_uicommon_free(mmyth_ui->schedule_uicommon); - } -} - - - - -static void -play_selected_recorded(gpointer user_data) -{ - MMythUi *mmyth_ui = (MMythUi *) user_data; - gboolean res = FALSE; - - gchar *path = - mmyth_recordui_get_selected_recorded(mmyth_ui->mmyth_recordui); - - if (path == NULL) { - // This should never happens. Play button is just activated when - // a recording is selected. - g_warning - ("[%s] Play button pressed while none recorded is selected", - __FUNCTION__); - return; - } - - if (!(mmyth_ui->video_uicommon)) - mmyth_ui->video_uicommon = create_video_view(mmyth_ui); - - // Creates the tv player that will retrieve the mythtv content, decode - // and show it - mmyth_ui->tvplayer = mmyth_tvplayer_new(); - g_debug("[%s] New TV Player created: %d\n", __FUNCTION__, - (int) (mmyth_ui->tvplayer)); - res = - mmyth_tvplayer_initialize(mmyth_ui->tvplayer, - mmyth_ui->backend_info); - if (!res) { - g_warning("[%s] Could not initialize tvplayer", __FUNCTION__); - - g_object_unref(mmyth_ui->tvplayer); - mmyth_ui->tvplayer = NULL; - - GtkWidget *dialog = - gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "MMyth found errors while starting TV Player, please check " - "the GStreamer installation"); - - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - - return; - } - - res = mmyth_tvplayer_record_setup(mmyth_ui->tvplayer, path); - - if (mmyth_ui && mmyth_ui->tvplayer && res) { - mmyth_tvplayer_set_widget(mmyth_ui->tvplayer, mmyth_ui->videow); - mmyth_tvplayer_start_playing(mmyth_ui->tvplayer); - } else { - // TODO: Show Alert with error description! - g_warning("[%s] MMythUI can't initialize tv_player", __FUNCTION__); - g_object_unref(mmyth_ui->tvplayer); - mmyth_ui->tvplayer = NULL; - // FIXME: Show the exact error that happened - GtkWidget *dialog = - gtk_message_dialog_new(GTK_WINDOW(mmyth_ui->main_window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_CLOSE, - "Error while starting TV Player, please check if the backend" - " is running properly and a tv card is available!"); - gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - return; - } - - mmyth_ui_set_widget(mmyth_ui, mmyth_ui->video_uicommon); -} - -static void -cb_play_clicked_recorded(GtkTreeView * tree_view, GtkTreePath * path, - GtkTreeViewColumn * column, gpointer user_data) -{ - play_selected_recorded(user_data); -} - -static void -cb_play_selected(GtkButton * button, gpointer user_data) -{ - play_selected_recorded(user_data); -} - -static void -cb_schedule_button(GtkButton * button, gpointer user_data) -{ - MMythUi *mmyth_ui = (MMythUi *) user_data; - - mmyth_ui_set_widget(mmyth_ui, mmyth_ui->schedule_uicommon); -} - -void -cb_switch_page(GtkNotebook * notebook, GtkNotebookPage * page, - guint page_num, gpointer user_data) -{ - MMythUi *mmyth_ui = (MMythUi *) user_data; - MMythUiCommon *ui_common; - - assert(mmyth_ui); - assert(mmyth_ui->record_uicommon); - - ui_common = mmyth_ui->record_uicommon; - - if (page_num == 0) { // Switched to Schedule list - gtk_button_set_label(GTK_BUTTON(ui_common->button1), "New"); - g_signal_handlers_disconnect_by_func(G_OBJECT(ui_common->button1), - G_CALLBACK(cb_play_selected), - mmyth_ui); - g_signal_connect(G_OBJECT(ui_common->button1), "clicked", - G_CALLBACK(cb_schedule_button), mmyth_ui); - } else if (page_num == 1) { - gtk_button_set_label(GTK_BUTTON(ui_common->button1), "Play"); - g_signal_handlers_disconnect_by_func(G_OBJECT(ui_common->button1), - G_CALLBACK - (cb_schedule_button), - mmyth_ui); - g_signal_connect(G_OBJECT(ui_common->button1), "clicked", - G_CALLBACK(cb_play_selected), mmyth_ui); - } -} - - -static MMythUiCommon * -create_record_view(MMythUi * mmyth_ui) -{ - MMythUiCommon *ui_common; - - g_debug("Creating Record UI Common"); - - mmyth_ui->mmyth_recordui = mmyth_recordui_new(mmyth_ui->backend_info); - - // FIXME: Change MMythRecordUI to a GtkWidget child and avoid this - // call! - gtk_widget_show_all(mmyth_ui->mmyth_recordui->scrolled_window); - - ui_common = - mmyth_uicommon_new(mmyth_ui->mmyth_recordui->scrolled_window, - "New", "Delete", "<mmyth_recordui->scrolled_window); - - /* - * Button signals - */ - g_signal_connect(G_OBJECT(ui_common->button1), "clicked", - G_CALLBACK(cb_schedule_button), mmyth_ui); - g_signal_connect(G_OBJECT(ui_common->button2), "clicked", - G_CALLBACK(mmyth_recordui_delete_selected), - mmyth_ui->mmyth_recordui); - g_signal_connect(G_OBJECT(ui_common->button3), "clicked", - G_CALLBACK(cb_record_close_button), mmyth_ui); - g_signal_connect(G_OBJECT(mmyth_ui->mmyth_recordui->notebook), - "switch-page", G_CALLBACK(cb_switch_page), mmyth_ui); - g_signal_connect(G_OBJECT(mmyth_ui->mmyth_recordui->rec_treeview), - "row-activated", G_CALLBACK(cb_play_clicked_recorded), - mmyth_ui); - g_signal_connect(G_OBJECT(mmyth_ui->mmyth_recordui->sch_treeview), - "row-activated", G_CALLBACK(cb_edit_scheduled), - mmyth_ui); - return ui_common; -} - - -/****************************************************************************** - * GST VIDEO WIDGET METHODS * - *****************************************************************************/ - -static void -cb_video_close_button(GtkButton * button, gpointer user_data) -{ - MMythUi *mmyth_ui = (MMythUi *) user_data; - - g_debug("MMythUI video close button pressed"); - - if (mmyth_ui && mmyth_ui->tvplayer) { - mmyth_tvplayer_stop_playing(mmyth_ui->tvplayer); - - g_object_unref(mmyth_ui->tvplayer); - mmyth_ui->tvplayer = NULL; - } else { - g_warning("cb_video_close_button called with NULL pointer\n"); - } - - mmyth_ui_set_widget(mmyth_ui, mmyth_ui->main_uicommon); -} - - -static MMythUiCommon * -create_video_view(MMythUi * mmyth_ui) -{ - - MMythUiCommon *ui_common; - - g_debug("Creating Video UI Common"); - - /* - * Creates widget to be user by MMythTVPlayer to draw the video - */ - mmyth_ui->videow = gtk_drawing_area_new(); - // FIXME: Get the widget size from settings - gtk_widget_set_size_request(mmyth_ui->videow, 300, 240); - - // mmiptv_ui->logo = gdk_pixbuf_new_from_file ("logo.png", NULL); - - // Creates an alignment to place the video widget inside - mmyth_ui->video_alignment = gtk_alignment_new(0.5, 0.5, 1, 1); - gtk_widget_hide(mmyth_ui->video_alignment); - - gtk_container_add(GTK_CONTAINER(mmyth_ui->video_alignment), - mmyth_ui->videow); - - /* - * Add the gst video widget to hbox. It should never be removed. - */ - /* - * FIXME: mmyth_ui->video_alignment == NULL when mmyth_player_init - * fails - */ - if ((mmyth_ui->main_hbox != NULL) - && (mmyth_ui->video_alignment != NULL)) { - gtk_box_pack_start(GTK_BOX(mmyth_ui->main_hbox), - mmyth_ui->video_alignment, TRUE, TRUE, 0); - } else { - g_warning("[%s] Error while adding video_alignment to main widget", - __FUNCTION__); - } - - g_object_ref(mmyth_ui->videow); - g_object_ref(mmyth_ui->video_alignment); - - ui_common = mmyth_uicommon_new(mmyth_ui->video_alignment, - " Full\nScreen", "Other\nServices", - "Close"); - - - g_signal_connect(G_OBJECT(ui_common->button1), "clicked", - G_CALLBACK(cb_not_impl_button), mmyth_ui); - g_signal_connect(G_OBJECT(ui_common->button2), "clicked", - G_CALLBACK(cb_not_impl_button), mmyth_ui); - g_signal_connect(G_OBJECT(ui_common->button3), "clicked", - G_CALLBACK(cb_video_close_button), mmyth_ui); - - if (ui_common) - g_debug("Video UI_Common sucessfull created"); - - return ui_common; -} - - - -GtkWidget * -mmyth_ui_get_video_widget(MMythUi * mmyth_ui) -{ - - if (mmyth_ui && mmyth_ui->videow) { - - return mmyth_ui->videow; - } - - return NULL; -} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_ui.h --- a/maemo-ui/src/mmyth_ui.h Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -#ifndef MMYTH_UI_H_ -#define MMYTH_UI_H_ - -#include -#include - -#include "config.h" - -#ifdef MAEMO_PLATFORM -#include "hildon-widgets/hildon-program.h" -#include "hildon-widgets/hildon-window.h" -#endif - -#include "mmyth_uicommon.h" -#include "mmyth_recordui.h" -#include "mmyth_schedulerui.h" -#include "mmyth_tvplayer.h" - -/* - * GMyth specific includes - */ -#include - -typedef struct _MMythUi { - - /* - * The main application window - */ - GtkWidget *main_window; - MMythUiCommon *current_uicommon; - - /* - * Main widget components - */ - GtkWidget *main_hbox; - GtkWidget *video_alignment; - GdkPixbuf *logo; - - /* - * Main widgets grouping - */ - MMythUiCommon *main_uicommon; - MMythUiCommon *video_uicommon; - MMythUiCommon *epg_grid_uicommon; - MMythUiCommon *record_uicommon; - MMythUiCommon *schedule_uicommon; - - GMythBackendInfo *backend_info; - - GtkWidget *videow; - int idle_id; - // GstTagList *tagcache; - - MMythRecordUI *mmyth_recordui; - MMythSchedulerUI *mmyth_schedulerui; - -#ifdef MAEMO_PLATFORM - HildonProgram *program; - GtkMenu *main_menu; - GtkWidget *menu_setup; -#endif - - MMythTVPlayer *tvplayer; - -} MMythUi; - -GdkPixbuf *icon_sports, - *icon_news, - *icon_movies, - *icon_shows; -GdkColor main_bg_color; - -void mmyth_set_main_widget(MMythUi * mmyth_ui, - MMythUiCommon * new_ui); -// void mmyth_play_selected(GtkButton * button, gpointer user_data); - -#ifdef MAEMO_PLATFORM -MMythUi *mmyth_ui_initialize(HildonProgram * program, - GtkWidget * main_window); -#else -MMythUi *mmyth_ui_initialize(GtkWidget * main_window); -#endif - -void mmyth_ui_finalize(MMythUi * mmyth_ui); - -void mmyth_ui_set_widget(MMythUi * mmyth_ui, - MMythUiCommon * new_uicommon); - -GtkWidget *mmyth_ui_get_video_widget(MMythUi * mmyth_ui); - -#endif /* MMYTH_UI_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_uicommon.c --- a/maemo-ui/src/mmyth_uicommon.c Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,156 +0,0 @@ - -#include -#include -#include - -#include "mmyth_uicommon.h" -#include "mmyth_ui.h" - -static void -refresh_time_on_screen(GtkWidget * label) -{ - time_t real_time; - struct tm sched_time; - GString *time_showed; - - time_showed = g_string_new(""); - time(&real_time); - - if (localtime_r((time_t *) & real_time, &sched_time) == NULL) { - g_error("localtime_r error in mmyth_epg_grid_view!\n"); - return; - } - - g_string_printf(time_showed, "%d:%02d:%02d", - sched_time.tm_hour, - sched_time.tm_min, sched_time.tm_sec); - - gtk_label_set_text(GTK_LABEL(label), time_showed->str); -} - -MMythUiCommon * -mmyth_uicommon_new(GtkWidget * main_widget, const gchar * label1, - const gchar * label2, const gchar * label3) -{ - - MMythUiCommon *ui_common = g_new0(MMythUiCommon, 1); - - if (!main_widget) { - g_warning("MMythUICommon created with a NULL main widget\n"); - } - - ui_common->main_widget = main_widget; - - ui_common->event_box = gtk_event_box_new(); - - /* - * Vertical box that divides the control area into two (buttons + - * clock) - */ - ui_common->vbox = gtk_vbox_new(FALSE, 0); /* spacing */ - gtk_container_set_border_width(GTK_CONTAINER(ui_common->vbox), 4); - - gtk_container_add(GTK_CONTAINER(ui_common->event_box), - ui_common->vbox); - gtk_widget_modify_bg(ui_common->event_box, GTK_STATE_NORMAL, - &main_bg_color); - - /* - * Vertical box that divides the control area into four - */ - ui_common->button_vbox = gtk_vbox_new(TRUE, 0); /* spacing */ - - gtk_container_set_border_width(GTK_CONTAINER(ui_common->button_vbox), - 0); - - /* - * The button 1 - */ - ui_common->button1 = gtk_button_new_with_label(label1); - gtk_widget_modify_bg(ui_common->button1, GTK_STATE_NORMAL, - &main_bg_color); - gtk_widget_set_size_request(ui_common->button1, BUTTON_WIDTH, - BUTTON_HEIGHT); - - /* - * The button 2 - */ - ui_common->button2 = gtk_button_new_with_label(label2); - gtk_widget_modify_bg(ui_common->button2, GTK_STATE_NORMAL, - &main_bg_color); - gtk_widget_set_size_request(ui_common->button2, BUTTON_WIDTH, - BUTTON_HEIGHT); - - /* - * The button 3 - */ - ui_common->button3 = gtk_button_new_with_label(label3); - gtk_widget_modify_bg(ui_common->button3, GTK_STATE_NORMAL, - &main_bg_color); - gtk_widget_set_size_request(ui_common->button3, BUTTON_WIDTH, - BUTTON_HEIGHT); - - /* - * The clock label - */ - ui_common->label = gtk_label_new("Starting..."); - gtk_widget_show(ui_common->label); - ui_common->source_id = - g_timeout_add(500, (GSourceFunc) refresh_time_on_screen, - ui_common->label); - - /* - * Packing components - */ - gtk_box_pack_start(GTK_BOX(ui_common->vbox), - ui_common->button_vbox, TRUE, TRUE, 0); - - gtk_box_pack_start(GTK_BOX(ui_common->vbox), - ui_common->label, FALSE, FALSE, 0); - - gtk_box_pack_start(GTK_BOX(ui_common->button_vbox), - ui_common->button1, FALSE, FALSE, 0); - - gtk_box_pack_start(GTK_BOX(ui_common->button_vbox), - ui_common->button2, FALSE, FALSE, 0); - - gtk_box_pack_start(GTK_BOX(ui_common->button_vbox), - ui_common->button3, FALSE, FALSE, 0); - - gtk_widget_show_all(ui_common->event_box); - - /* - * FIXME: mmyth_ui->video_alignment == NULL when mmyth_player_init - * fails - */ - if (ui_common->main_widget != NULL) - g_object_ref(ui_common->main_widget); - - g_object_ref(ui_common->vbox); - g_object_ref(ui_common->button_vbox); - g_object_ref(ui_common->label); - g_object_ref(ui_common->button1); - g_object_ref(ui_common->button2); - g_object_ref(ui_common->button3); - g_object_ref(ui_common->event_box); - return ui_common; -} - -void -mmyth_uicommon_free(MMythUiCommon * ui_common) -{ - g_debug("[%s] Clean uicommon used memory", __FUNCTION__); - - g_source_remove(ui_common->source_id); - - g_object_unref(ui_common->main_widget); - g_object_unref(ui_common->vbox); - g_object_unref(ui_common->button_vbox); - g_object_unref(ui_common->label); - g_object_unref(ui_common->button1); - g_object_unref(ui_common->button2); - g_object_unref(ui_common->button3); - g_object_unref(ui_common->event_box); - - g_free(ui_common); -} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_uicommon.h --- a/maemo-ui/src/mmyth_uicommon.h Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -#ifndef MMYTH_UICOMMON_H_ -#define MMYTH_UICOMMON_H_ - -#include "config.h" - -#include -#include - -#ifndef MAEMO_PLATFORM -#define BUTTON_HEIGHT 50 -#define BUTTON_WIDTH 100 -#else -#define BUTTON_HEIGHT 80 -#define BUTTON_WIDTH 150 -#endif - -#define MAIN_WINDOW_WIDTH 550 -#define MAIN_WINDOW_HEIGHT 250 - -#define CHANNELS_DIALOG_WIDTH 300 -#define CHANNELS_DIALOG_HEIGHT 200 - -#define SETTINGS_DIALOG_WIDTH 300 -#define SETTINGS_DIALOG_HEIGHT 120 - -extern GdkColor main_bg_color; - -typedef struct _MMythUiCommon { - GtkWidget *main_widget; - - /* - * event box to set the background color - */ - GtkWidget *event_box; - - GtkWidget *vbox; - GtkWidget *button_vbox; - GtkWidget *label; - - GtkWidget *button1; - GtkWidget *button2; - GtkWidget *button3; - - gint source_id; -} MMythUiCommon; - -MMythUiCommon *mmyth_uicommon_new(GtkWidget * main_widget, - const gchar * label1, - const gchar * label2, - const gchar * label3); -void mmyth_uicommon_free(MMythUiCommon * ui_common); - -#endif /* MMYTH_UICOMMON_H_ */ diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_uisettings.c --- a/maemo-ui/src/mmyth_uisettings.c Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mmyth_uisettings.h" - -#include - -static GtkWidget *settings_dialog; -static GtkWidget *entry_hostname; -static GtkWidget *entry_dbname; -static GtkWidget *entry_username; -static GtkWidget *entry_passwd; -static GtkWidget *entry_port; - -static void settings_dialog_update_data(void); -static GtkWidget *add_entry_to_table(GtkWidget * table, - const gchar * init_str, - guint pos_left, guint pos_right, - guint pos_top, guint pos_bottom); -static GtkWidget *add_label_to_table(GtkWidget * table, const gchar * str, - guint pos_left, guint pos_right, - guint pos_top, guint pos_bottom); - -static GMythBackendInfo *backend_info = NULL; - -gboolean -mmyth_uisettings_run(GtkWindow * main_window) -{ - - GtkWidget *settings_table; - GtkWidget *label_hostname, - *label_dbname; - GtkWidget *label_username, - *label_passwd, - *label_port; - - backend_info = gmyth_backend_info_new_full("localhost", "mythtv", - "mythtv", "mythconverg", - 6543); - - settings_dialog = gtk_dialog_new_with_buttons("Settings", - main_window, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_OK, - GTK_RESPONSE_ACCEPT, - GTK_STOCK_CANCEL, - GTK_RESPONSE_REJECT, - NULL); - - gtk_widget_set_size_request(settings_dialog, 400, 244); - - /* - * scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); - * gtk_widget_show (scrolledwindow1); gtk_container_add (GTK_CONTAINER - * (window1), scrolledwindow1); gtk_scrolled_window_set_policy - * (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, - * GTK_POLICY_NEVER); - * - * viewport1 = gtk_viewport_new (NULL, NULL); gtk_widget_show - * (viewport1); gtk_container_add (GTK_CONTAINER (scrolledwindow1), - * viewport1); gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport1), - * GTK_SHADOW_NONE); - */ - - // Creates the table and attach it to the settings dialog - settings_table = gtk_table_new(5, 2, FALSE); - gtk_widget_show(settings_table); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(settings_dialog)->vbox), - settings_table, FALSE, TRUE, 0); - gtk_container_set_border_width(GTK_CONTAINER(settings_table), 3); - gtk_table_set_row_spacings(GTK_TABLE(settings_table), 5); - gtk_table_set_col_spacings(GTK_TABLE(settings_table), 10); - - label_hostname = - add_label_to_table(settings_table, "Host Name:", 0, 1, 0, 1); - label_dbname = - add_label_to_table(settings_table, "Database Name:", 0, 1, 1, 2); - label_username = - add_label_to_table(settings_table, "Username:", 0, 1, 2, 3); - label_passwd = - add_label_to_table(settings_table, "Password:", 0, 1, 3, 4); - label_port = - add_label_to_table(settings_table, "Server port:", 0, 1, 4, 5); - - entry_hostname = add_entry_to_table(settings_table, - gmyth_backend_info_get_hostname - (backend_info), 1, 2, 0, 1); - entry_dbname = - add_entry_to_table(settings_table, - gmyth_backend_info_get_db_name(backend_info), 1, - 2, 1, 2); - entry_username = - add_entry_to_table(settings_table, - gmyth_backend_info_get_username(backend_info), - 1, 2, 2, 3); - entry_passwd = - add_entry_to_table(settings_table, - gmyth_backend_info_get_password(backend_info), - 1, 2, 3, 4); - - entry_port = - add_entry_to_table(settings_table, - g_strdup_printf("%d", - gmyth_backend_info_get_port - (backend_info)), 1, 2, 4, 5); - - if (gtk_dialog_run(GTK_DIALOG(settings_dialog)) == GTK_RESPONSE_ACCEPT) { - settings_dialog_update_data(); - gtk_widget_destroy(settings_dialog); - return TRUE; - } - - gtk_widget_destroy(settings_dialog); - - return FALSE; - -} - -static GtkWidget * -add_label_to_table(GtkWidget * table, const gchar * str, guint pos_left, - guint pos_right, guint pos_top, guint pos_bottom) -{ - GtkWidget *tmp_label = gtk_label_new(str); - - gtk_widget_show(tmp_label); - gtk_table_attach(GTK_TABLE(table), tmp_label, - pos_left, pos_right, pos_top, pos_bottom, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment(GTK_MISC(tmp_label), 0, 0.5); - - return tmp_label; -} - -static GtkWidget * -add_entry_to_table(GtkWidget * table, const gchar * init_str, - guint pos_left, guint pos_right, guint pos_top, - guint pos_bottom) -{ - GtkWidget *tmp_entry = gtk_entry_new(); - gtk_widget_show(tmp_entry); - gtk_table_attach(GTK_TABLE(table), tmp_entry, - pos_left, pos_right, pos_top, pos_bottom, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - if (init_str) - gtk_entry_set_text(GTK_ENTRY(tmp_entry), init_str); - - // gtk_entry_set_invisible_char (GTK_ENTRY (entry_port), 9679); - - return tmp_entry; -} - -static void -settings_dialog_update_data(void) -{ - // GMythSettings *backend_info = gmyth_context_get_settings(); - - if (!backend_info) { - g_warning - ("[%s] Could not get GMythSettings instance from context\n", - __FUNCTION__); - return; - } - - gmyth_backend_info_set_hostname(backend_info, - gtk_entry_get_text(GTK_ENTRY - (entry_hostname))); - - gmyth_backend_info_set_db_name(backend_info, - gtk_entry_get_text(GTK_ENTRY - (entry_dbname))); - - gmyth_backend_info_set_username(backend_info, - gtk_entry_get_text(GTK_ENTRY - (entry_username))); - - gmyth_backend_info_set_password(backend_info, - gtk_entry_get_text(GTK_ENTRY - (entry_passwd))); - - gmyth_backend_info_set_port(backend_info, - (gint) - g_ascii_strtoull(gtk_entry_get_text - (GTK_ENTRY(entry_port)), - NULL, 10)); - - // gmyth_backend_info_save (backend_info); - -} diff -r f9cd59844f78 -r 7a914b3fafc1 maemo-ui/src/mmyth_uisettings.h --- a/maemo-ui/src/mmyth_uisettings.h Wed Aug 01 14:22:14 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#ifndef MMYTH_SETTINGS_H_ -#define MMYTH_SETTINGS_H_ - -gboolean mmyth_uisettings_run(GtkWindow * main_window); - -#endif /* MMYTH_SETTINGS_H_ */