latest update
authorLuc Pionchon <luc.pionchon@nokia.com>
Wed, 6 Jul 2005 07:25:03 +0000 (07:25 +0000)
committerLuc Pionchon <luc.pionchon@nokia.com>
Wed, 6 Jul 2005 07:25:03 +0000 (07:25 +0000)
94 files changed:
COPYING
Changelog [new file with mode: 0644]
Makefile.in
config.h.in
configure
configure.ac
debian/changelog
debian/changelog1 [new file with mode: 0644]
debian/control
doc/Makefile.in
doc/hildon-libs-docs.xml
doc/hildon-libs.types
doc/tmpl/hildon-controlbar.sgml
doc/tmpl/hildon-date-editor.sgml
doc/tmpl/hildon-font-selection-dialog.sgml
doc/tmpl/hildon-get-password-dialog.sgml
doc/tmpl/hildon-grid-item.sgml
doc/tmpl/hildon-grid.sgml
doc/tmpl/hildon-libs-unused.sgml
doc/tmpl/hildon-name-password-dialog.sgml
doc/tmpl/hildon-note.sgml
doc/tmpl/hildon-number-editor.sgml
doc/tmpl/hildon-range-editor.sgml
doc/tmpl/hildon-scroll-area.sgml
doc/tmpl/hildon-seekbar.sgml
doc/tmpl/hildon-set-password-dialog.sgml
doc/tmpl/hildon-telephone-editor.sgml
doc/tmpl/hildon-time-editor.sgml
doc/tmpl/hildon-time-picker.sgml
doc/tmpl/hildon-volumebar.sgml
doc/tmpl/hildon-weekday-picker.sgml
hildon-widgets/Makefile.am
hildon-widgets/Makefile.in
hildon-widgets/hildon-calendar-popup.c
hildon-widgets/hildon-color-popup.c
hildon-widgets/hildon-color-selector.c
hildon-widgets/hildon-composite-widget.c
hildon-widgets/hildon-controlbar.c
hildon-widgets/hildon-date-editor.c
hildon-widgets/hildon-date-editor.h
hildon-widgets/hildon-dialoghelp.c
hildon-widgets/hildon-file-details-dialog.c
hildon-widgets/hildon-file-details-dialog.h
hildon-widgets/hildon-file-handling-note.c
hildon-widgets/hildon-file-handling-note.h
hildon-widgets/hildon-find-object-dialog.c [deleted file]
hildon-widgets/hildon-find-object-dialog.h [deleted file]
hildon-widgets/hildon-find-replace-dialog.c [deleted file]
hildon-widgets/hildon-find-replace-dialog.h [deleted file]
hildon-widgets/hildon-font-selection-dialog.c
hildon-widgets/hildon-font-selection-dialog.h
hildon-widgets/hildon-get-password-dialog.c
hildon-widgets/hildon-get-password-dialog.h
hildon-widgets/hildon-grid-item-private.h
hildon-widgets/hildon-grid-item.c
hildon-widgets/hildon-grid.c
hildon-widgets/hildon-marshalers.c [new file with mode: 0644]
hildon-widgets/hildon-marshalers.h [new file with mode: 0644]
hildon-widgets/hildon-marshalers.list [new file with mode: 0644]
hildon-widgets/hildon-name-password-dialog.c
hildon-widgets/hildon-name-password-dialog.h
hildon-widgets/hildon-note.c
hildon-widgets/hildon-note.h
hildon-widgets/hildon-number-editor.c
hildon-widgets/hildon-number-editor.h
hildon-widgets/hildon-range-editor.c
hildon-widgets/hildon-range-editor.h
hildon-widgets/hildon-scroll-area.c
hildon-widgets/hildon-search.c [deleted file]
hildon-widgets/hildon-search.h [deleted file]
hildon-widgets/hildon-seekbar.c
hildon-widgets/hildon-set-password-dialog.c
hildon-widgets/hildon-set-password-dialog.h
hildon-widgets/hildon-sort-dialog.c
hildon-widgets/hildon-time-editor.c
hildon-widgets/hildon-time-editor.h
hildon-widgets/hildon-time-picker.c
hildon-widgets/hildon-time-picker.h
hildon-widgets/hildon-volumebar-range.c
hildon-widgets/hildon-volumebar.c
hildon-widgets/hildon-weekday-picker.c
hildon-widgets/hildon-wizard-dialog.c
po/Makefile.am
po/Makefile.in
po/POTFILES [deleted file]
po/POTFILES.in
po/README
po/debian/control
po/debian/hildon-libs-l10n-engb.install [new file with mode: 0644]
po/en_GB.po
ut/Makefile.in
ut/hildon-clock-widgets_tests.c
ut/hildon-widgets_tests.c
ut/tmp [deleted file]

diff --git a/COPYING b/COPYING
index 54905a6..8add30a 100755 (executable)
--- a/COPYING
+++ b/COPYING
-                 GNU LESSER GENERAL PUBLIC LICENSE\r
-                      Version 2.1, February 1999\r
-\r
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.\r
-     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
- Everyone is permitted to copy and distribute verbatim copies\r
- of this license document, but changing it is not allowed.\r
-\r
-[This is the first released version of the Lesser GPL.  It also counts\r
- as the successor of the GNU Library Public License, version 2, hence\r
- the version number 2.1.]\r
-\r
-                           Preamble\r
-\r
-  The licenses for most software are designed to take away your\r
-freedom to share and change it.  By contrast, the GNU General Public\r
-Licenses are intended to guarantee your freedom to share and change\r
-free software--to make sure the software is free for all its users.\r
-\r
-  This license, the Lesser General Public License, applies to some\r
-specially designated software packages--typically libraries--of the\r
-Free Software Foundation and other authors who decide to use it.  You\r
-can use it too, but we suggest you first think carefully about whether\r
-this license or the ordinary General Public License is the better\r
-strategy to use in any particular case, based on the explanations below.\r
-\r
-  When we speak of free software, we are referring to freedom of use,\r
-not price.  Our General Public Licenses are designed to make sure that\r
-you have the freedom to distribute copies of free software (and charge\r
-for this service if you wish); that you receive source code or can get\r
-it if you want it; that you can change the software and use pieces of\r
-it in new free programs; and that you are informed that you can do\r
-these things.\r
-\r
-  To protect your rights, we need to make restrictions that forbid\r
-distributors to deny you these rights or to ask you to surrender these\r
-rights.  These restrictions translate to certain responsibilities for\r
-you if you distribute copies of the library or if you modify it.\r
-\r
-  For example, if you distribute copies of the library, whether gratis\r
-or for a fee, you must give the recipients all the rights that we gave\r
-you.  You must make sure that they, too, receive or can get the source\r
-code.  If you link other code with the library, you must provide\r
-complete object files to the recipients, so that they can relink them\r
-with the library after making changes to the library and recompiling\r
-it.  And you must show them these terms so they know their rights.\r
-\r
-  We protect your rights with a two-step method: (1) we copyright the\r
-library, and (2) we offer you this license, which gives you legal\r
-permission to copy, distribute and/or modify the library.\r
-\r
-  To protect each distributor, we want to make it very clear that\r
-there is no warranty for the free library.  Also, if the library is\r
-modified by someone else and passed on, the recipients should know\r
-that what they have is not the original version, so that the original\r
-author's reputation will not be affected by problems that might be\r
-introduced by others.\r
-\f\r
-  Finally, software patents pose a constant threat to the existence of\r
-any free program.  We wish to make sure that a company cannot\r
-effectively restrict the users of a free program by obtaining a\r
-restrictive license from a patent holder.  Therefore, we insist that\r
-any patent license obtained for a version of the library must be\r
-consistent with the full freedom of use specified in this license.\r
-\r
-  Most GNU software, including some libraries, is covered by the\r
-ordinary GNU General Public License.  This license, the GNU Lesser\r
-General Public License, applies to certain designated libraries, and\r
-is quite different from the ordinary General Public License.  We use\r
-this license for certain libraries in order to permit linking those\r
-libraries into non-free programs.\r
-\r
-  When a program is linked with a library, whether statically or using\r
-a shared library, the combination of the two is legally speaking a\r
-combined work, a derivative of the original library.  The ordinary\r
-General Public License therefore permits such linking only if the\r
-entire combination fits its criteria of freedom.  The Lesser General\r
-Public License permits more lax criteria for linking other code with\r
-the library.\r
-\r
-  We call this license the "Lesser" General Public License because it\r
-does Less to protect the user's freedom than the ordinary General\r
-Public License.  It also provides other free software developers Less\r
-of an advantage over competing non-free programs.  These disadvantages\r
-are the reason we use the ordinary General Public License for many\r
-libraries.  However, the Lesser license provides advantages in certain\r
-special circumstances.\r
-\r
-  For example, on rare occasions, there may be a special need to\r
-encourage the widest possible use of a certain library, so that it becomes\r
-a de-facto standard.  To achieve this, non-free programs must be\r
-allowed to use the library.  A more frequent case is that a free\r
-library does the same job as widely used non-free libraries.  In this\r
-case, there is little to gain by limiting the free library to free\r
-software only, so we use the Lesser General Public License.\r
-\r
-  In other cases, permission to use a particular library in non-free\r
-programs enables a greater number of people to use a large body of\r
-free software.  For example, permission to use the GNU C Library in\r
-non-free programs enables many more people to use the whole GNU\r
-operating system, as well as its variant, the GNU/Linux operating\r
-system.\r
-\r
-  Although the Lesser General Public License is Less protective of the\r
-users' freedom, it does ensure that the user of a program that is\r
-linked with the Library has the freedom and the wherewithal to run\r
-that program using a modified version of the Library.\r
-\r
-  The precise terms and conditions for copying, distribution and\r
-modification follow.  Pay close attention to the difference between a\r
-"work based on the library" and a "work that uses the library".  The\r
-former contains code derived from the library, whereas the latter must\r
-be combined with the library in order to run.\r
-\f\r
-                 GNU LESSER GENERAL PUBLIC LICENSE\r
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\r
-\r
-  0. This License Agreement applies to any software library or other\r
-program which contains a notice placed by the copyright holder or\r
-other authorized party saying it may be distributed under the terms of\r
-this Lesser General Public License (also called "this License").\r
-Each licensee is addressed as "you".\r
-\r
-  A "library" means a collection of software functions and/or data\r
-prepared so as to be conveniently linked with application programs\r
-(which use some of those functions and data) to form executables.\r
-\r
-  The "Library", below, refers to any such software library or work\r
-which has been distributed under these terms.  A "work based on the\r
-Library" means either the Library or any derivative work under\r
-copyright law: that is to say, a work containing the Library or a\r
-portion of it, either verbatim or with modifications and/or translated\r
-straightforwardly into another language.  (Hereinafter, translation is\r
-included without limitation in the term "modification".)\r
-\r
-  "Source code" for a work means the preferred form of the work for\r
-making modifications to it.  For a library, complete source code means\r
-all the source code for all modules it contains, plus any associated\r
-interface definition files, plus the scripts used to control compilation\r
-and installation of the library.\r
-\r
-  Activities other than copying, distribution and modification are not\r
-covered by this License; they are outside its scope.  The act of\r
-running a program using the Library is not restricted, and output from\r
-such a program is covered only if its contents constitute a work based\r
-on the Library (independent of the use of the Library in a tool for\r
-writing it).  Whether that is true depends on what the Library does\r
-and what the program that uses the Library does.\r
-  \r
-  1. You may copy and distribute verbatim copies of the Library's\r
-complete source code as you receive it, in any medium, provided that\r
-you conspicuously and appropriately publish on each copy an\r
-appropriate copyright notice and disclaimer of warranty; keep intact\r
-all the notices that refer to this License and to the absence of any\r
-warranty; and distribute a copy of this License along with the\r
-Library.\r
-\r
-  You may charge a fee for the physical act of transferring a copy,\r
-and you may at your option offer warranty protection in exchange for a\r
-fee.\r
-\f\r
-  2. You may modify your copy or copies of the Library or any portion\r
-of it, thus forming a work based on the Library, and copy and\r
-distribute such modifications or work under the terms of Section 1\r
-above, provided that you also meet all of these conditions:\r
-\r
-    a) The modified work must itself be a software library.\r
-\r
-    b) You must cause the files modified to carry prominent notices\r
-    stating that you changed the files and the date of any change.\r
-\r
-    c) You must cause the whole of the work to be licensed at no\r
-    charge to all third parties under the terms of this License.\r
-\r
-    d) If a facility in the modified Library refers to a function or a\r
-    table of data to be supplied by an application program that uses\r
-    the facility, other than as an argument passed when the facility\r
-    is invoked, then you must make a good faith effort to ensure that,\r
-    in the event an application does not supply such function or\r
-    table, the facility still operates, and performs whatever part of\r
-    its purpose remains meaningful.\r
-\r
-    (For example, a function in a library to compute square roots has\r
-    a purpose that is entirely well-defined independent of the\r
-    application.  Therefore, Subsection 2d requires that any\r
-    application-supplied function or table used by this function must\r
-    be optional: if the application does not supply it, the square\r
-    root function must still compute square roots.)\r
-\r
-These requirements apply to the modified work as a whole.  If\r
-identifiable sections of that work are not derived from the Library,\r
-and can be reasonably considered independent and separate works in\r
-themselves, then this License, and its terms, do not apply to those\r
-sections when you distribute them as separate works.  But when you\r
-distribute the same sections as part of a whole which is a work based\r
-on the Library, the distribution of the whole must be on the terms of\r
-this License, whose permissions for other licensees extend to the\r
-entire whole, and thus to each and every part regardless of who wrote\r
-it.\r
-\r
-Thus, it is not the intent of this section to claim rights or contest\r
-your rights to work written entirely by you; rather, the intent is to\r
-exercise the right to control the distribution of derivative or\r
-collective works based on the Library.\r
-\r
-In addition, mere aggregation of another work not based on the Library\r
-with the Library (or with a work based on the Library) on a volume of\r
-a storage or distribution medium does not bring the other work under\r
-the scope of this License.\r
-\r
-  3. You may opt to apply the terms of the ordinary GNU General Public\r
-License instead of this License to a given copy of the Library.  To do\r
-this, you must alter all the notices that refer to this License, so\r
-that they refer to the ordinary GNU General Public License, version 2,\r
-instead of to this License.  (If a newer version than version 2 of the\r
-ordinary GNU General Public License has appeared, then you can specify\r
-that version instead if you wish.)  Do not make any other change in\r
-these notices.\r
-\f\r
-  Once this change is made in a given copy, it is irreversible for\r
-that copy, so the ordinary GNU General Public License applies to all\r
-subsequent copies and derivative works made from that copy.\r
-\r
-  This option is useful when you wish to copy part of the code of\r
-the Library into a program that is not a library.\r
-\r
-  4. You may copy and distribute the Library (or a portion or\r
-derivative of it, under Section 2) in object code or executable form\r
-under the terms of Sections 1 and 2 above provided that you accompany\r
-it with the complete corresponding machine-readable source code, which\r
-must be distributed under the terms of Sections 1 and 2 above on a\r
-medium customarily used for software interchange.\r
-\r
-  If distribution of object code is made by offering access to copy\r
-from a designated place, then offering equivalent access to copy the\r
-source code from the same place satisfies the requirement to\r
-distribute the source code, even though third parties are not\r
-compelled to copy the source along with the object code.\r
-\r
-  5. A program that contains no derivative of any portion of the\r
-Library, but is designed to work with the Library by being compiled or\r
-linked with it, is called a "work that uses the Library".  Such a\r
-work, in isolation, is not a derivative work of the Library, and\r
-therefore falls outside the scope of this License.\r
-\r
-  However, linking a "work that uses the Library" with the Library\r
-creates an executable that is a derivative of the Library (because it\r
-contains portions of the Library), rather than a "work that uses the\r
-library".  The executable is therefore covered by this License.\r
-Section 6 states terms for distribution of such executables.\r
-\r
-  When a "work that uses the Library" uses material from a header file\r
-that is part of the Library, the object code for the work may be a\r
-derivative work of the Library even though the source code is not.\r
-Whether this is true is especially significant if the work can be\r
-linked without the Library, or if the work is itself a library.  The\r
-threshold for this to be true is not precisely defined by law.\r
-\r
-  If such an object file uses only numerical parameters, data\r
-structure layouts and accessors, and small macros and small inline\r
-functions (ten lines or less in length), then the use of the object\r
-file is unrestricted, regardless of whether it is legally a derivative\r
-work.  (Executables containing this object code plus portions of the\r
-Library will still fall under Section 6.)\r
-\r
-  Otherwise, if the work is a derivative of the Library, you may\r
-distribute the object code for the work under the terms of Section 6.\r
-Any executables containing that work also fall under Section 6,\r
-whether or not they are linked directly with the Library itself.\r
-\f\r
-  6. As an exception to the Sections above, you may also combine or\r
-link a "work that uses the Library" with the Library to produce a\r
-work containing portions of the Library, and distribute that work\r
-under terms of your choice, provided that the terms permit\r
-modification of the work for the customer's own use and reverse\r
-engineering for debugging such modifications.\r
-\r
-  You must give prominent notice with each copy of the work that the\r
-Library is used in it and that the Library and its use are covered by\r
-this License.  You must supply a copy of this License.  If the work\r
-during execution displays copyright notices, you must include the\r
-copyright notice for the Library among them, as well as a reference\r
-directing the user to the copy of this License.  Also, you must do one\r
-of these things:\r
-\r
-    a) Accompany the work with the complete corresponding\r
-    machine-readable source code for the Library including whatever\r
-    changes were used in the work (which must be distributed under\r
-    Sections 1 and 2 above); and, if the work is an executable linked\r
-    with the Library, with the complete machine-readable "work that\r
-    uses the Library", as object code and/or source code, so that the\r
-    user can modify the Library and then relink to produce a modified\r
-    executable containing the modified Library.  (It is understood\r
-    that the user who changes the contents of definitions files in the\r
-    Library will not necessarily be able to recompile the application\r
-    to use the modified definitions.)\r
-\r
-    b) Use a suitable shared library mechanism for linking with the\r
-    Library.  A suitable mechanism is one that (1) uses at run time a\r
-    copy of the library already present on the user's computer system,\r
-    rather than copying library functions into the executable, and (2)\r
-    will operate properly with a modified version of the library, if\r
-    the user installs one, as long as the modified version is\r
-    interface-compatible with the version that the work was made with.\r
-\r
-    c) Accompany the work with a written offer, valid for at\r
-    least three years, to give the same user the materials\r
-    specified in Subsection 6a, above, for a charge no more\r
-    than the cost of performing this distribution.\r
-\r
-    d) If distribution of the work is made by offering access to copy\r
-    from a designated place, offer equivalent access to copy the above\r
-    specified materials from the same place.\r
-\r
-    e) Verify that the user has already received a copy of these\r
-    materials or that you have already sent this user a copy.\r
-\r
-  For an executable, the required form of the "work that uses the\r
-Library" must include any data and utility programs needed for\r
-reproducing the executable from it.  However, as a special exception,\r
-the materials to be distributed need not include anything that is\r
-normally distributed (in either source or binary form) with the major\r
-components (compiler, kernel, and so on) of the operating system on\r
-which the executable runs, unless that component itself accompanies\r
-the executable.\r
-\r
-  It may happen that this requirement contradicts the license\r
-restrictions of other proprietary libraries that do not normally\r
-accompany the operating system.  Such a contradiction means you cannot\r
-use both them and the Library together in an executable that you\r
-distribute.\r
-\f\r
-  7. You may place library facilities that are a work based on the\r
-Library side-by-side in a single library together with other library\r
-facilities not covered by this License, and distribute such a combined\r
-library, provided that the separate distribution of the work based on\r
-the Library and of the other library facilities is otherwise\r
-permitted, and provided that you do these two things:\r
-\r
-    a) Accompany the combined library with a copy of the same work\r
-    based on the Library, uncombined with any other library\r
-    facilities.  This must be distributed under the terms of the\r
-    Sections above.\r
-\r
-    b) Give prominent notice with the combined library of the fact\r
-    that part of it is a work based on the Library, and explaining\r
-    where to find the accompanying uncombined form of the same work.\r
-\r
-  8. You may not copy, modify, sublicense, link with, or distribute\r
-the Library except as expressly provided under this License.  Any\r
-attempt otherwise to copy, modify, sublicense, link with, or\r
-distribute the Library is void, and will automatically terminate your\r
-rights under this License.  However, parties who have received copies,\r
-or rights, from you under this License will not have their licenses\r
-terminated so long as such parties remain in full compliance.\r
-\r
-  9. You are not required to accept this License, since you have not\r
-signed it.  However, nothing else grants you permission to modify or\r
-distribute the Library or its derivative works.  These actions are\r
-prohibited by law if you do not accept this License.  Therefore, by\r
-modifying or distributing the Library (or any work based on the\r
-Library), you indicate your acceptance of this License to do so, and\r
-all its terms and conditions for copying, distributing or modifying\r
-the Library or works based on it.\r
-\r
-  10. Each time you redistribute the Library (or any work based on the\r
-Library), the recipient automatically receives a license from the\r
-original licensor to copy, distribute, link with or modify the Library\r
-subject to these terms and conditions.  You may not impose any further\r
-restrictions on the recipients' exercise of the rights granted herein.\r
-You are not responsible for enforcing compliance by third parties with\r
-this License.\r
-\f\r
-  11. If, as a consequence of a court judgment or allegation of patent\r
-infringement or for any other reason (not limited to patent issues),\r
-conditions are imposed on you (whether by court order, agreement or\r
-otherwise) that contradict the conditions of this License, they do not\r
-excuse you from the conditions of this License.  If you cannot\r
-distribute so as to satisfy simultaneously your obligations under this\r
-License and any other pertinent obligations, then as a consequence you\r
-may not distribute the Library at all.  For example, if a patent\r
-license would not permit royalty-free redistribution of the Library by\r
-all those who receive copies directly or indirectly through you, then\r
-the only way you could satisfy both it and this License would be to\r
-refrain entirely from distribution of the Library.\r
-\r
-If any portion of this section is held invalid or unenforceable under any\r
-particular circumstance, the balance of the section is intended to apply,\r
-and the section as a whole is intended to apply in other circumstances.\r
-\r
-It is not the purpose of this section to induce you to infringe any\r
-patents or other property right claims or to contest validity of any\r
-such claims; this section has the sole purpose of protecting the\r
-integrity of the free software distribution system which is\r
-implemented by public license practices.  Many people have made\r
-generous contributions to the wide range of software distributed\r
-through that system in reliance on consistent application of that\r
-system; it is up to the author/donor to decide if he or she is willing\r
-to distribute software through any other system and a licensee cannot\r
-impose that choice.\r
-\r
-This section is intended to make thoroughly clear what is believed to\r
-be a consequence of the rest of this License.\r
-\r
-  12. If the distribution and/or use of the Library is restricted in\r
-certain countries either by patents or by copyrighted interfaces, the\r
-original copyright holder who places the Library under this License may add\r
-an explicit geographical distribution limitation excluding those countries,\r
-so that distribution is permitted only in or among countries not thus\r
-excluded.  In such case, this License incorporates the limitation as if\r
-written in the body of this License.\r
-\r
-  13. The Free Software Foundation may publish revised and/or new\r
-versions of the Lesser General Public License from time to time.\r
-Such new versions will be similar in spirit to the present version,\r
-but may differ in detail to address new problems or concerns.\r
-\r
-Each version is given a distinguishing version number.  If the Library\r
-specifies a version number of this License which applies to it and\r
-"any later version", you have the option of following the terms and\r
-conditions either of that version or of any later version published by\r
-the Free Software Foundation.  If the Library does not specify a\r
-license version number, you may choose any version ever published by\r
-the Free Software Foundation.\r
-\f\r
-  14. If you wish to incorporate parts of the Library into other free\r
-programs whose distribution conditions are incompatible with these,\r
-write to the author to ask for permission.  For software which is\r
-copyrighted by the Free Software Foundation, write to the Free\r
-Software Foundation; we sometimes make exceptions for this.  Our\r
-decision will be guided by the two goals of preserving the free status\r
-of all derivatives of our free software and of promoting the sharing\r
-and reuse of software generally.\r
-\r
-                           NO WARRANTY\r
-\r
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\r
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\r
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\r
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY\r
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\r
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\r
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\r
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\r
-\r
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\r
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\r
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\r
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\r
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\r
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\r
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\r
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\r
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\r
-DAMAGES.\r
-\r
-                    END OF TERMS AND CONDITIONS\r
-\f\r
-           How to Apply These Terms to Your New Libraries\r
-\r
-  If you develop a new library, and you want it to be of the greatest\r
-possible use to the public, we recommend making it free software that\r
-everyone can redistribute and change.  You can do so by permitting\r
-redistribution under these terms (or, alternatively, under the terms of the\r
-ordinary General Public License).\r
-\r
-  To apply these terms, attach the following notices to the library.  It is\r
-safest to attach them to the start of each source file to most effectively\r
-convey the exclusion of warranty; and each file should have at least the\r
-"copyright" line and a pointer to where the full notice is found.\r
-\r
-    <one line to give the library's name and a brief idea of what it does.>\r
-    Copyright (C) <year>  <name of author>\r
-\r
-    This library is free software; you can redistribute it and/or\r
-    modify it under the terms of the GNU Lesser General Public\r
-    License as published by the Free Software Foundation; either\r
-    version 2.1 of the License, or (at your option) any later version.\r
-\r
-    This library is distributed in the hope that it will be useful,\r
-    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-    Lesser General Public License for more details.\r
-\r
-    You should have received a copy of the GNU Lesser General Public\r
-    License along with this library; if not, write to the Free Software\r
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\r
-\r
-Also add information on how to contact you by electronic and paper mail.\r
-\r
-You should also get your employer (if you work as a programmer) or your\r
-school, if any, to sign a "copyright disclaimer" for the library, if\r
-necessary.  Here is a sample; alter the names:\r
-\r
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the\r
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.\r
-\r
-  <signature of Ty Coon>, 1 April 1990\r
-  Ty Coon, President of Vice\r
-\r
-That's all there is to it!\r
-\r
-\r
+                 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.
+\f
+  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.
+\f
+                 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.
+\f
+  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.
+\f
+  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.
+\f
+  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.
+\f
+  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.
+\f
+  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.
+\f
+  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
+\f
+           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.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/Changelog b/Changelog
new file mode 100644 (file)
index 0000000..e69de29
index 831f4a5..683174f 100644 (file)
@@ -59,8 +59,6 @@ CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOXYGEN_FOUND = @DOXYGEN_FOUND@
@@ -199,10 +197,10 @@ RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
        all-recursive install-data-recursive install-exec-recursive \
        installdirs-recursive install-recursive uninstall-recursive \
        check-recursive installcheck-recursive
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/configure COPYING \
-       Makefile.am aclocal.m4 config.guess config.h.in config.sub \
-       configure configure.ac depcomp hildon-libs.pc.in install-sh \
-       ltmain.sh missing mkinstalldirs
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/configure Makefile.am \
+       aclocal.m4 config.guess config.h.in config.sub configure \
+       configure.ac depcomp hildon-libs.pc.in install-sh ltmain.sh \
+       missing mkinstalldirs
 DIST_SUBDIRS = $(SUBDIRS)
 all: config.h
        $(MAKE) $(AM_MAKEFLAGS) all-recursive
index ab4e92b..c72b9e1 100644 (file)
@@ -69,8 +69,5 @@
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
-/* 1 if ESD is available */
-#undef USE_ESD
-
 /* Version number of package */
 #undef VERSION
index 1dac5f1..349104c 100755 (executable)
--- a/configure
+++ b/configure
@@ -463,7 +463,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG OUTO_CFLAGS OUTO_LIBS GTK_CFLAGS GTK_LIBS GTK_VERSION DBUS_CFLAGS DBUS_LIBS ESD_CFLAGS ESD_LIBS GNOME_VFS_CFLAGS GNOME_VFS_LIBS GCONF_CFLAGS GCONF_LIBS ALL_LINGUAS USE_NLS MSGFMT GMSGFMT XGETTEXT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLLIBS PO_IN_DATADIR_TRUE PO_IN_DATADIR_FALSE POFILES POSUB MKINSTALLDIRS GTKDOC ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE DOXYGEN_FOUND HAVE_DOXYGEN_TRUE HAVE_DOXYGEN_FALSE docdir localedir outomoduledir HTML_DIR LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG OUTO_CFLAGS OUTO_LIBS GTK_CFLAGS GTK_LIBS GTK_VERSION ESD_CFLAGS ESD_LIBS GNOME_VFS_CFLAGS GNOME_VFS_LIBS GCONF_CFLAGS GCONF_LIBS ALL_LINGUAS USE_NLS MSGFMT GMSGFMT XGETTEXT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLLIBS PO_IN_DATADIR_TRUE PO_IN_DATADIR_FALSE POFILES POSUB MKINSTALLDIRS GTKDOC ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE DOXYGEN_FOUND HAVE_DOXYGEN_TRUE HAVE_DOXYGEN_FALSE docdir localedir outomoduledir HTML_DIR LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -1773,7 +1773,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=hildon-libs
- VERSION=0.9.6
+ VERSION=0.9.35
 
 
 cat >>confdefs.h <<_ACEOF
@@ -19330,10 +19330,7 @@ echo "$as_me: error: Library requirements (outo >= 0.1.1) not met; consider adju
 
 
 
-# -pedantic removed due to D-BUS; should be replaced after D-BUS is no
-# longer broken in this regard...
-
-CFLAGS="$CFLAGS -Wall -ansi -Wmissing-prototypes -Wmissing-declarations -Werror"
+CFLAGS="$CFLAGS -Wall -pedantic -ansi -Wmissing-prototypes -Wmissing-declarations -Werror"
 
 GTK_VERSION=2.6.4
 
@@ -19439,114 +19436,7 @@ echo "$as_me: error: Library requirements (hildon-lgpl >= 0.9.1 hildon-fm >= 0.8
 
 
 
-# The hildon-note uses D-BUS directly as an interim solution for sound
-# playback - remove these after this is no longer the case!
-
-
-  succeeded=no
-
-  if test -z "$PKG_CONFIG"; then
-    # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-
-if test -n "$PKG_CONFIG"; then
-  echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
-echo "${ECHO_T}$PKG_CONFIG" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  fi
-
-  if test "$PKG_CONFIG" = "no" ; then
-     echo "*** The pkg-config script could not be found. Make sure it is"
-     echo "*** in your path, or set the PKG_CONFIG environment variable"
-     echo "*** to the full path to pkg-config."
-     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
-  else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        echo "$as_me:$LINENO: checking for dbus-glib-1 >= 0.20" >&5
-echo $ECHO_N "checking for dbus-glib-1 >= 0.20... $ECHO_C" >&6
-
-        if $PKG_CONFIG --exists "dbus-glib-1 >= 0.20" ; then
-            echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-            succeeded=yes
-
-            echo "$as_me:$LINENO: checking DBUS_CFLAGS" >&5
-echo $ECHO_N "checking DBUS_CFLAGS... $ECHO_C" >&6
-            DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-glib-1 >= 0.20"`
-            echo "$as_me:$LINENO: result: $DBUS_CFLAGS" >&5
-echo "${ECHO_T}$DBUS_CFLAGS" >&6
-
-            echo "$as_me:$LINENO: checking DBUS_LIBS" >&5
-echo $ECHO_N "checking DBUS_LIBS... $ECHO_C" >&6
-            DBUS_LIBS=`$PKG_CONFIG --libs "dbus-glib-1 >= 0.20"`
-            echo "$as_me:$LINENO: result: $DBUS_LIBS" >&5
-echo "${ECHO_T}$DBUS_LIBS" >&6
-        else
-            DBUS_CFLAGS=""
-            DBUS_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            DBUS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "dbus-glib-1 >= 0.20"`
-            echo $DBUS_PKG_ERRORS
-        fi
-
-
-
-     else
-        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
-        echo "*** See http://www.freedesktop.org/software/pkgconfig"
-     fi
-  fi
-
-  if test $succeeded = yes; then
-     :
-  else
-     { { echo "$as_me:$LINENO: error: Library requirements (dbus-glib-1 >= 0.20) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
-echo "$as_me: error: Library requirements (dbus-glib-1 >= 0.20) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-
-
-
-
-# Related to the previous entry, check if we have ESD headers available.
-# If yes, Hildon-note will build sound support with it; we're phasing
-# away from OSSO Multimedia... Clean this up after ESD is the
-# default.
+# ESD is needed for the hildon-note sounds.
 
 
   succeeded=no
@@ -19627,7 +19517,7 @@ echo "${ECHO_T}$ESD_LIBS" >&6
             ## If we have a custom action on failure, don't print errors, but
             ## do set a variable so people can do so.
             ESD_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "esound"`
-
+            echo $ESD_PKG_ERRORS
         fi
 
 
@@ -19639,28 +19529,15 @@ echo "${ECHO_T}$ESD_LIBS" >&6
   fi
 
   if test $succeeded = yes; then
-     esd_found=1
+     :
   else
-     esd_found=0
+     { { echo "$as_me:$LINENO: error: Library requirements (esound) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
+echo "$as_me: error: Library requirements (esound) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
+   { (exit 1); exit 1; }; }
   fi
 
-if test "x$esd_found" = "x1"; then
-
-
-
-
-
 
-if $ESD; then
-cat >>confdefs.h <<_ACEOF
-#define USE_ESD "1"
-_ACEOF
-
-fi
 
-else
-echo "No ESD found, so falling back to OSSO Multimedia support"
-fi
 
 # Needed to demonstrate how mime-types can be handled with gnome-vfs
 
@@ -22326,8 +22203,6 @@ s,@OUTO_LIBS@,$OUTO_LIBS,;t t
 s,@GTK_CFLAGS@,$GTK_CFLAGS,;t t
 s,@GTK_LIBS@,$GTK_LIBS,;t t
 s,@GTK_VERSION@,$GTK_VERSION,;t t
-s,@DBUS_CFLAGS@,$DBUS_CFLAGS,;t t
-s,@DBUS_LIBS@,$DBUS_LIBS,;t t
 s,@ESD_CFLAGS@,$ESD_CFLAGS,;t t
 s,@ESD_LIBS@,$ESD_LIBS,;t t
 s,@GNOME_VFS_CFLAGS@,$GNOME_VFS_CFLAGS,;t t
index d1d8ced..5e0b2e1 100644 (file)
@@ -1,5 +1,5 @@
 AC_INIT(Makefile.am)
-AM_INIT_AUTOMAKE(hildon-libs, 0.9.6)
+AM_INIT_AUTOMAKE(hildon-libs, 0.9.35)
 AM_CONFIG_HEADER(config.h)
 
 AC_CANONICAL_HOST
@@ -14,10 +14,7 @@ AC_HEADER_STDC
 PKG_CHECK_MODULES(OUTO, outo >= 0.1.1)
 AC_SUBST(OUTO_CFLAGS)
 
-# -pedantic removed due to D-BUS; should be replaced after D-BUS is no
-# longer broken in this regard...
-
-CFLAGS="$CFLAGS -Wall -ansi -Wmissing-prototypes -Wmissing-declarations -Werror"
+CFLAGS="$CFLAGS -Wall -pedantic -ansi -Wmissing-prototypes -Wmissing-declarations -Werror"
 
 GTK_VERSION=2.6.4
 
@@ -26,33 +23,12 @@ AC_SUBST(GTK_LIBS)
 AC_SUBST(GTK_CFLAGS)
 AC_SUBST(GTK_VERSION)
 
-# The hildon-note uses D-BUS directly as an interim solution for sound
-# playback - remove these after this is no longer the case!
-
-PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.20)
-AC_SUBST(DBUS_LIBS)
-AC_SUBST(DBUS_CFLAGS)
-
-# Related to the previous entry, check if we have ESD headers available.
-# If yes, Hildon-note will build sound support with it; we're phasing
-# away from OSSO Multimedia... Clean this up after ESD is the
-# default.
+# ESD is needed for the hildon-note sounds.
 
-PKG_CHECK_MODULES(ESD, esound, esd_found=1, esd_found=0)
-if test "x$esd_found" = "x1"; then
+PKG_CHECK_MODULES(ESD, esound)
 AC_SUBST(ESD_LIBS)
 AC_SUBST(ESD_CFLAGS)
 
-AH_TEMPLATE([USE_ESD], [1 if ESD is available])
-
-if $ESD; then
-AC_DEFINE_UNQUOTED([USE_ESD], ["1"])
-fi
-
-else
-echo "No ESD found, so falling back to OSSO Multimedia support"
-fi
-
 # Needed to demonstrate how mime-types can be handled with gnome-vfs
 PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0 >= 2.6 gnome-vfs-module-2.0 >= 2.6)
 AC_SUBST(GNOME_VFS_CFLAGS)
@@ -131,7 +107,7 @@ AC_SUBST(outomoduledir)
 AC_SUBST(HTML_DIR)
 
 AC_OUTPUT(Makefile \
-  hildon-widgets/Makefile \
+       hildon-widgets/Makefile \
        ut/Makefile \
        po/Makefile \
        po/porules.mk \
index bc1c7bc..390cda7 100644 (file)
@@ -1,411 +1,5 @@
-hildon-libs (0.9.6-2) unstable; urgency=low
-
-  * removed extra locales
-
- -- Nokia <Nokia>  Sun,  22 May 2005 18:27:55 +0300
-
-hildon-libs (0.9.6-1) unstable; urgency=low
-
-  * Cleaned non-logical and obsolete strings
-  * Updated localization
-
- -- First Release <Nokia>  Wed,  6 Apr 2005 18:27:55 +0300
-
-hildon-libs (0.9.5-1) unstable; urgency=low
-
-  * Seekbar fixes
-  * Updated dependency to newest GTK
-
-
-hildon-libs (0.9.4-1) unstable; urgency=low
-
-  * Fixed #2953 (HildonNumberEditor returns maximum value when it is
-    empy)
-  * Fixed #5542 (Hildon number editor behaviour is not inlined with UI
-    SPEC)
-  * Fixed #8386 (Incorrect + and - button showing in HildonNumberEditor)
-
-
-hildon-libs (0.9.3-1) unstable; urgency=low
-
-  * Fixed #8416 (Icons were missing in most of the information notes
-    displayed by the applications)
-  * Removed a useless focus grabbing to avoid focus flashing when
-    scrolling the page with focused item in it (task1645).
-  * Fixed #4276 (HildonDateEditor - When user enters a date manually in
-    the dateeditor, it is not accepted)
-  * Fixed #6050 (HildonDateEditor : No calendar icon debchange Fixed
-
-
-hildon-libs (0.9.2-1) unstable; urgency=low
-
-  * Updated to GTK 2.6
-
-
-hildon-libs (0.9.1-1) unstable; urgency=low
-
-  * GTK 2.6 Fixes
-
-
-hildon-libs (0.8.25-1) unstable; urgency=low
-
-  * Fixed hildon-time-editor to use icon name instead of stock icons
-  * Fixed hildon-time-editor pixels so that the previously unvisible
-    frame is show.
-  * Fixed po headers
-  * Fixed #3440 (HildonSetPasswordDialog - on pressing ENTER hard key
-    the field is getting cleared(reset))
-
-
-hildon-libs (0.8.24-1) unstable; urgency=low
-
-  * Update HildonGrid not to change focus when scrolled
-  * Dialogs: Keyboard navigation for each dialog, the focus must cycle
-    around the dialog widgets
-
-
-hildon-libs (0.8.23-1) unstable; urgency=low
-
-  * Fixed po issues
-  * Fixed logical localization IDs in all widgets according to WS 2.0
-    part 2
-  * Separated the More Colors selector to its own widget from the Color
-    Selector Widget
-
-
-hildon-libs (0.8.22-1) unstable; urgency=low
-
-  * Added es_MX and fr_CA
-  * Renamed localization packages: fi -> fi_FI
-
-
-hildon-libs (0.8.21-2) unstable; urgency=low
-
-  * Updated dependency to hildon-fm1
-
-
-hildon-libs (0.8.21-1) unstable; urgency=low
-
-  * ControlBar: application option for minimum number of visible bars
-
-
-hildon-libs (0.8.20-1) unstable; urgency=low
-
-  * Fixed #4638 (Updates to <Filetype> Details Dialog (WUD-DIA272)
-  * ColorSelector: add new color
-  * Number editor errorhandling improvements and localization
-  * VolumeBar: hardkey mute/unmute addition
-
-
-hildon-libs (0.8.19-1) unstable; urgency=low
-
-  * Seekbar: Added a feature that allows a different stream graphics to be shown
-    when streaming is complete.
-  * Fixed #6383 (hildon-libs, hildon-lgpl --- refers to new API provided
-    by updated gtk, but this is not specified in build-deps.)
-  * Fixed #6355 (HildonFontSelectionDialog - Segmentation Fault)
-
-
-hildon-libs (0.8.18-1) unstable; urgency=low
-
-  * Merge had happened against non-100% HEAD code, thus rebuilding...
-
-
-hildon-libs (0.8.17-1) unstable; urgency=low
-
-  * Added support for GTK icon theme names (task1777)
-  * hildon
-
-
-hildon-libs (0.8.16-1) unstable; urgency=low
-
-  * Fixed #5705 (HildonFontSelectionDialog crashes with Nokia Sans font
-    when selecting bold face)
-  * Fixed #5739 (FontSelectionDialog allows choosing italic face even
-    though it doesn't exist for some fonts)
-
-
-hildon-libs (0.8.15-1) unstable; urgency=low
-
-  * HildonFontSelectionDialog updates
-
-
-hildon-libs (0.8.14-1) unstable; urgency=low
-
-  * Fixed #3827 (HildonVolumebar is not dimmed when volume is muted)
-
-
-hildon-libs (0.8.13-1) unstable; urgency=low
-
-  * Timepicker skin updates
-
-
-hildon-libs (0.8.12-1) unstable; urgency=low
-
-  * Debianized locale-packages
-  * Fixed #4704 (libraries should be versioned)
-
-
-hildon-libs (0.8.11-1) unstable; urgency=low
-
-  * Fixed #1638 (HildonSeekBar & HilldonVolumeBar: widgets grab focus and
-    keypress events). Fixed by adding an option for applications to set focus
-    on/off
-
-
-hildon-libs (0.8.10-1) unstable; urgency=low
-
-  * Editors: Changed the focus behaviour inside a widget
-  * Fixed #3689 (It is not possible to adjust sound level through navigational
-    keys.). Mute button no longer can get focus. 
-
-
-hildon-libs (0.8.9-1) unstable; urgency=low
-
-  * Fixed #4285 (API docs contain old/deprecated widgets) 
-
-
-hildon-libs (0.8.8-2) unstable; urgency=low
-
-  * Added GnomeVFS dependencies
-
-
-hildon-libs (0.8.8-1) unstable; urgency=low
-
-  * Added sound support to hildon-note. Requires DBUS and osso-sounds-ui.
-  * Removed erroneus version dependency from pkgconfig file for fm and lgp.
-
-
-hildon-libs (0.8.7-1) unstable; urgency=low
-
-  * Fixed #4652 (missing dependency to hildon-fm-dev)
-  * Removed dependency to matchbox 
-
-
-hildon-libs (0.8.6-1) unstable; urgency=low
-
-  * Lots of updates from development. 
-
-
-hildon-libs (0.8.5-1) unstable; urgency=low
-
-  * Release 0.8.5 
-
-
-hildon-libs (0.8.4-3) unstable; urgency=low
-
-  * HildonRangeEditor: Changed author, removed #include
-  * Updated GTK doc
-
-
-hildon-libs (0.8.4-1) unstable; urgency=low
-
-  * Teema 0.8.4 Release
-
-
-hildon-libs (0.8.3-10) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.3-9) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.3-8) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.3-7) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.3-6) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.3-5) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.3-4) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.3-3) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.3-2) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.3-1) unstable; urgency=low
-
-  * Teema 0.8.3 release
-
-
-hildon-libs (0.8.2-6) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.2-5) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.2-4) unstable; urgency=low
-
-  * Last minute fixes
-
-
-hildon-libs (0.8.2-3) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.2-2) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.2-1) unstable; urgency=low
-
-  * Release 0.8.2
-
-
-hildon-libs (0.8.1-5) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.1-4) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.1-3) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.1-2) unstable; urgency=low
-
-  * Nightly build
-
-
-hildon-libs (0.8.1-1) unstable; urgency=low
-
-  * 0.8.1 release
-
-
-hildon-libs (0.8.0pre1.2-1) unstable; urgency=low
-
-  * hildon filesystem model 
-
-
-hildon-libs (0.8.0pre1.1-1) unstable; urgency=low
-
-  * possible updates 
-
-
-hildon-libs (0.8.0pre1-1) unstable; urgency=low
-
-  * Teema 0.8.0pre1 release
-
-
-hildon-libs (0.7.6-1) unstable; urgency=low
-
-  * Teema 0.7.6 release
-
-
-hildon-libs (0.7.5-1) unstable; urgency=low
-
-  * Teema 0.7.5 release
-
-
-hildon-libs (0.7.4-1) unstable; urgency=low
-
-  * Teema 0.7.4 release
-
-hildon-libs (0.7.3-1) unstable; urgency=low
-
-  * Teema 0.7.3 release
-
-
-hildon-libs (0.7.2-1) unstable; urgency=low
-
-  * Teema 0.7.2 release
-
-
-hildon-libs (0.7.1-1) unstable; urgency=low
-
-  * Teema 0.7.1 release
-
-
-hildon-libs (0.7.0-1) unstable; urgency=low
-
-  * T7 preliminary version
-
-hildon-libs (0.6.6-1) unstable; urgency=low
-
-  * M3 bug fix release 2
-
-
-hildon-libs (0.6.5-1) unstable; urgency=low
-
-  * M3 bug fix release
-
-
-hildon-libs (0.6.4-1) unstable; urgency=low
-
-  * M3 release
-
-
-hildon-libs (0.6.3-1) unstable; urgency=low
-
-  * M2 bug fix / M3 preview release
-  * Added -dbg package
-
-
-hildon-libs (0.6.2-1) unstable; urgency=low
-
-  * M2 release
-
-
-hildon-libs (0.6.1-1) unstable; urgency=low
-
-  * M1 bug fix / M2 preview release
-
-
-hildon-libs (0.6.0-1) unstable; urgency=low
-
-  * Updated dependencies.
-
-  * HildonRenameDialog and HildonNewObjectDialog was replaced by 
-  HildonNameObjectDialog. 
-
-  * Added new widgets HildonFindObjectDialog and HildonFindObjectOptionsDialog.
-       
-
-hildon-libs (0.5.1-1) unstable; urgency=low
-
-  * Teema5 M2 second delivery.
-
-
-hildon-libs (0.5.20040211-1) unstable; urgency=low
-
-  * Initial Release.
+hildon-libs (0.9.35-2) unstable; urgency=low
 
+  * Maemo dev release
 
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Wed,  6 Jul 2005 07:49:38 +0300
diff --git a/debian/changelog1 b/debian/changelog1
new file mode 100644 (file)
index 0000000..d8b397e
--- /dev/null
@@ -0,0 +1,806 @@
+hildon-libs (0.9.35-1) unstable; urgency=low
+
+  * po/Makefile.am:
+  * - Fixed the 'make merge'
+  * POTFILES.in:
+  * - Added missing and removed nonexisting files, corrected path
+  * po/README:
+  * - Updated the description how to properly merge the translations
+  * Fixed #13744 (again): Tapping time editor's am/pm field changes time
+    to "xx:54"
+  * Fixed #13897: Time editor does not display the AM/PM indicator
+    correctly always
+  * hildon-time-editor.c:
+  * - Fixed broken-ness in validation logic, if the validation had been
+    done already, the values inserted were ignored (oops)
+  * Fixed #14100: hildon-number-editor: truncation of number at left of
+    entry box.
+  * - Modified: hildon-number-editor.c
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Mon, 27 Jun 2005 15:51:38 +0300
+
+hildon-libs (0.9.34-1) unstable; urgency=low
+
+  * Implementation fixed for bug #14392: Duration Editor specification
+    prevents user from inputting values freely
+  * hildon-time-editor.c:
+  * - Change duration validation to validate by whole time (in seconds)
+    instead of by individual values. Removed the resulted unused and
+    obsolete function.
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Fri, 17 Jun 2005 10:49:40 +0300
+
+hildon-libs (0.9.33-1) unstable; urgency=low
+
+  * code clean up
+  * Fixed 13744, 13897, 13827, 12549, at least
+  * - Time editor rewrite
+  * get-password-dialog.c:
+  * - added option max characters reached.
+  * - fixed minor bugs.
+  * - Application options for setting strings
+  * get-password-dialog.h:
+  * - necessary changes for supporting the above.
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Thu, 16 Jun 2005 19:54:59 +0300
+
+hildon-libs (0.9.32-1) unstable; urgency=low
+
+  * Fixed #13990: HildonNote: There's no Cancel note w/o a progress bar
+    anymore
+  * hildon-note.c:
+  * - removed automatic progressbar creation if cancel note has NULL
+    progressbar
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Tue, 14 Jun 2005 12:32:17 +0300
+
+hildon-libs (0.9.31-1) unstable; urgency=low
+
+  * Fixed #13831: Wizard widget: Pixel perfecting
+  * hildon-wizard-dialog.c:
+  * - fixed icon name and placement, removed frame and separator
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Mon, 13 Jun 2005 17:00:25 +0300
+
+hildon-libs (0.9.30-1) unstable; urgency=low
+
+  * hildon-scroll-area.c:
+  * code cleanup.
+  * Fixed #13827: Time editor: pixel perfecting
+  * Fixed #13828: Time picker: pixel perfecting
+  * hildon-date-editor.c,hildon-time-editor.c:
+  * - Don't use xthickness and ythickness here, as the border is drawn
+    by the frame which already handles them
+  * - Correct spacing between 'entry' and button
+  * hildon-time-picker.c:
+  * - Specs-compliant spacing, sizing, etc
+  * Fixed #13992 - some old code present in hildon_wizard widget
+  * hildon-wizard-dialog.c:
+  * Stock icon usage changed to icon theme usage
+  * Fixed #13897: Time editor does not display the AM/PM indicator
+    correctly always
+  * hildon-time-editor.c:
+  * - Commented out unneccesary, duplicate and invalid higlighting from
+    hildon_time_editor_entry_clicked (shall be removed when the code is
+    cleaned up properly)
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Fri, 10 Jun 2005 10:53:29 +0300
+
+hildon-libs (0.9.29-1) unstable; urgency=low
+
+  * hildontimeeditor.c:
+  * - De-crackify size allocation
+  * - Set frame border width to 0
+  * hildon-date-editor.c:
+  * - Set frame border width to 0
+  * Fixed #13534: TimePicker text misaligned
+  * hildon-time-editor.c:
+  * - Play with ythickness correctly
+  * Fixed #13213: time values retrieval from HildonTimeEditor is
+    incorrect
+  * hildon-time-editor.c:
+  * - Update ticks after invalid value correction
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Mon,  6 Jun 2005 11:53:06 +0300
+
+hildon-libs (0.9.28-1) unstable; urgency=low
+
+  * hildon-composite-widget.c:
+  * - Added more checking to fix gtk-warning
+  * Fixed #11129: some strings are not localizable
+  * hildon-calendar-popup.c:
+  * - removed erroneous-date signal handling as deprecated and the
+    associated  infoprint as non-supported
+  * hildon-grid.c:
+  * - default "no items" label is now an empty string
+  * hildon-time-editor.c:
+  * - separator now uses logical name
+  * hildon-time-picker.c:
+  * - separator now uses logical name
+  * en_GB.po:
+  *  - added new logical strings in hildon-time-editor and hildon-time-
+    picker
+  * Fixed #9869: Search Field: Isn't this HildonSearch?
+  * hildon-libs-docs-xml,hildon-libs-section.txt,hildon-libs.types:
+  * - removed HildonSearch, HildonFindObjectDialog and
+    HildonFindReplaceDialog
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Fri, 27 May 2005 11:04:27 +0300
+
+hildon-libs (0.9.27-1) unstable; urgency=low
+
+  * hildon-time-editor.c:
+  * - Removed leftover test that wasn't catched at build time
+  * Fixed #7298: Preview of font properties Superscript and Subscript
+    are not shown
+  * Fixed #8493: Notable to select Italic in Font Dialog
+  * Fixed #10259: HildonFontSelectionDialog - Inital focus mismatch
+  * Fixed #11371: AF-BAT: HildonFontDialog field separators displayed as
+    ::
+  * Fixed #8400: Font selection dialog not showing the already applied
+    attribute to text
+  * API changes:
+  * - deprecated the following functions:
+  * - hildon_font_selection_dialog_set_buffer
+  * - hildon_font_selection_dialog_get_text_tag
+  * hildon-font-selection-dialog.[ch]:
+  * - old api doesnt work at all, redesign to have property approach
+  * - remove things like two overlapping property enumeration, unused
+    private member, over-larged private structure, unecessary self
+    written loop(which can be replaced by g_list_foreach), and much
+    more.
+  * - try to make the code flow clear and readable, more comment added
+  * - make things actually work, this includes: intermedia(inconsistent)
+    state of widget general state setting of the widget et.
+  * po/en_GB.po:
+  * - remove ":"
+  * Fixed #12675: HildonSearch container implementation bug (Gazpacho
+    integration)
+  * hildon-widgets/Makefile.am:
+  * - removed references to removed widgets
+  * Removed:
+  * - hildon-find-object-dialog.c, hildon-find-object-dialog.h, hildon-
+    find-replace-dialog.c, hildon-find-replace-dialog.h, hildon-
+    search.c, hildon-search.h
+  * ut/hildon-widgets_tests.c:
+  * - removed unit tests for removed widgets
+  * Fixed #12252: AF-BAT: HildonTimeEditor: Time picker flashes when
+    "Select" key is pressed
+  * hildon-time-picker.c:
+  * - moved handling of Select and Escape keys from key-release event to
+    key-press event
+  * Fixed #12785 - NOKGTK-35 HildonNote gazpacho integration
+  * hildon-note.c:
+  * - Removed G_PARAM_CONSTRUCT_ONLY from all properties
+  * - code needed to change properties at any time
+  * - fixed a potential crash in finalize()
+  * - makes the property blurbs somewhat more verbose
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Thu, 26 May 2005 16:00:59 +0300
+
+hildon-libs (0.9.26-1) unstable; urgency=low
+
+  * hildon-find-replace-dialog.c,hildon-file-handling-note.{h,c},hildon-
+    sort-dialog.c,hildon-get-password-dialog.c,hildon-name-password-
+    dialog.c,hildon-set-password-dialog.c:
+  * - Fixed compilation problems if HILDON_DISABLE_DEPRECATED is
+    defined
+  * hildon-time-editor.c:
+  * - Change the max time value to be 23.59.59 instead of 24.59.59
+  * Fixed #12674: NOKGTK-36 HildonSeekbar gazpacho integration
+  * hildon-seekbar.c:
+  * - When changing the properties "total_time" and "position", the
+    widget needs to be updated, instead of just setting the new value.
+  * Fixed #12176: it_IT Control Panel Date Time: Calendar view in
+    English
+  * hildon-calendar.c:
+  * - sets week_start property of GtkCalendar if week_start string is
+    localized
+  * Fixed #9624: Incorrect values in <Filetype> Details Dialog
+  * en_GB.po:
+  * - changed File details -> Details (once again...)
+  * Fixed #12276: AF-BAT: HildonVolumebar: When the mute button is
+    hidden, on pressing "select" h/w key, the volumebar is dimmed.
+  * hildon-volumebar.c:
+  * - select hardkey doesn't toggle mute button anymore if it is not
+    visible
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Tue, 24 May 2005 19:15:27 +0300
+
+hildon-libs (0.9.25-1) unstable; urgency=low
+
+  * Fixed #9690: Derived classes shouldn't connect to own signals
+  * Fixed #12229: hildon libs not ready for publishing
+  * - Applied Nokia patch from #12229 (Correct copyright/license
+    statements)
+  * Fixed #4289 (partly): Design doc has information that should be in
+    the developer documentation
+  * Modified: hildon-scroll-area.c,hildon-grid-item.sgml,hildon-
+    grid.sgml,hildon-scroll-area.sgml
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Mon, 23 May 2005 17:14:17 +0300
+
+hildon-libs (0.9.24-1) unstable; urgency=low
+
+  * hildon-time-editor.c:
+    * - fixed size allocation for widget's frame.
+  * hildon-scroll-area.sgml:
+  * - Added some missing documentation
+  * hildon-file-details-dialog.c:
+  * - Added missing NULL check
+  * Fixed #12128 - HildonControlbar: minimum_visible_bars does not work
+    properly
+  * controlbar.c:
+  * - handle minimum_visible_bars property correctly
+  * - fix widget sensitivity issues
+  * - use internal structures instead of public functions in private API
+  * Fixed #10129 (again): Af-BAT: HildonPasswordDialog fields have "::"
+    as separators
+  * hildon-get-password-dialog.c,hildon-name-password-dialog.c,hildon-
+    set-password-dialog.c:
+  * - caption separators set to ":"
+  * Fixed #4061 - HildonDateEditor: date fields not properly localized
+  * hildon-date-editor.c:
+  * - date separator is now a localizable string instead of being parsed
+    from  nl_langinfo output (which was kludgy and risky)
+  * en_GB.po:
+  * - added missing date editor strings (separator + "Date does not
+    exist"  that seemed to be missing although logical name was used in
+    the code)
+  * Fixed #12251: Range editor separator displayed in logical string.
+  * hildon-controlbar.c,hildon-range-editor.c,hildon-weekday-picker.c:
+  * - Changed to use dgettext insted of gettext.
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Mon, 23 May 2005 10:59:39 +0300
+
+hildon-libs (0.9.23-1) unstable; urgency=low
+
+  * Fixed #9350: Hildon-libs-test is an empty package
+  * Fixed #9191 - Lot of Critical GTK Warnings are thrown
+  * hildon-file-details-dialog.c:
+  * - Fixed unref warnings by adding checks in all instances of
+    g_object_unref()
+  * Fixed #11383: Text in the notification displayed when a search item
+    is deleted shows logical string
+  * en_GB.po:
+  * - restored several logical strings that were removed in rev.  1.11
+    for reasons unknown is deleted shows logical string
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Wed, 18 May 2005 11:07:50 +0300
+
+hildon-libs (0.9.22-1) unstable; urgency=low
+
+  * Fixed #11265: PDF Reader - Wrong information banner on entering
+    invalid page number in the switch to page dialog box
+  * - added signal range_error and its handler to hildon number editor
+  * hildon-grid.c:
+  * - removed marshaler code
+  * hildon-number-editor.h:
+  * - make error enumeration public
+  * - add function pointer for the signal handler
+  * hildon-number-editor.c:
+  * - add signal "range_error"
+  * - implemented default handler
+  * hildon-marshalers.list:
+  * - list for our customized marshalers
+  * hildon-widgets/Makefile.am:
+  * - make target for marshalers
+  * Fixed #10755: Control panel grid has layout problems
+  * API changes:
+  * - Bunch of changes in hildon-grid-item-private.h
+  * hildon-grid.c:
+  * - New purpose for style-properties
+  * - Allocation-fixes
+  * - Restructured the thing
+  * - Use new private API
+  * hildon-grid-item.c:
+  * - New allocate to match changes in hildon-grid
+  * - New private API
+  * hildon-grid-item-private.h:
+  * - New private API
+  * Fixed #11941: HildonFileDetailsDialog: there's a frame around the
+    additional tab widget
+  * hildon-file-details-dialog.c:
+  * - removed shadow of the viewport contained in additional tab
+  * Fixed #11968: Memory Leak in Hildon Range Editor API
+  * hildon-range-editor.c:
+  * - remove unnecessary strdups
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Mon, 16 May 2005 15:21:24 +0300
+
+hildon-libs (0.9.21-1) unstable; urgency=low
+
+  * Fixed #11372: AF-BAT: HildonFontSelectionDialog: Font Size field
+    displayed in logical strings
+  * Fixed #11373: AF-BAT: HildonFontSelectionDialog: The field name
+    'Colour' displayed as 'Color'
+  * Fixed #11096: Hildon number editor size request is calculated
+    incorrectly
+  * Fixed #10251: HildonTimePicker - left right keys not working at the
+    extreme end fields of the timepicker
+  * en_GB.po: Logical string corrections
+  * hildon-number-editor.c: Sanitize size requisition function
+  * hildon-time-picker.c: Fixed up/down/left/right keys + a few cleanups
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Thu, 12 May 2005 15:53:56 +0300
+
+hildon-libs (0.9.20-1) unstable; urgency=low
+
+  * Fixed #11129: Some strings are not localizable
+  * hildon-date-editor.c:
+  * - plain English infoprints changed to localizable logical names
+  * hildon-file-handling-note.c:
+  * - plain English strings changed to logical names
+  * hildon-note.c:
+  * - default title set to empty string since not supported by spec (and
+    not visible anyway)
+  * hildon-range-editor.c:
+  * - separator now uses logical name
+  * - typofix: hildon_range_editor_new_with_separator was setting
+    "separtor" property, which only produces an error message and sets
+    nothing
+  * hildon-time-editor.c:
+  * - plain English strings changed to logical names
+  * en_GB.po:
+  * - updates related to the above
+  * Fixed #11501: Re-added the translation for the modify-button
+  * Fixed #9880 - wrong infobanner shown in HildonTimeEditor
+  * hildon-time-editor.c:
+  * - Changed the infoprints to be clever in duration mode. They now
+    check the other field to determine values for the infoprint
+  * - Fixed few comparison bugs and entry<->internal value inconsistency
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Thu, 12 May 2005 13:41:47 +0300
+
+hildon-libs (0.9.19-1) unstable; urgency=low
+
+  * Fixed #11128: BM - Sorting - double colons
+  * hildon-sort-dialog.c:
+  * - both caption separators set to empty string
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Tue, 10 May 2005 10:17:06 +0300
+
+hildon-libs (0.9.18-1) unstable; urgency=low
+
+  * Fixed #10221: Preview in font selection dialog ellipzises text
+    invalidly after font size reduction
+  * hildon-font-selection-dialog.c:
+  * - Lot's of code reordering to make preview dialog destroyable
+  * - widget can be controlled with keyboard
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Wed,  4 May 2005 15:49:47 +0300
+
+hildon-libs (0.9.17-1) unstable; urgency=low
+
+  * Fixed #10249 - HildonTimePicker - ESC key is not closing the
+    timepicker
+  * hildon-time-picker.c:
+  * - Set Escape and Return keys to emit the "response" signal in
+    hildon_time_picker_event_box_key_release()
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Tue,  3 May 2005 17:14:43 +0300
+
+hildon-libs (0.9.16-1) unstable; urgency=low
+
+  * Fixed #9919: HildonGrid - weird behaviour when switching between
+    views
+  * Fixed #10253: HildonTimeEditor - Infoprint mismatch on deletion of a
+    number in a field
+  * hildon-grid.c:
+  * - scroll view to show something (in size_request)
+  * hildon-grid-item.c:
+  * - change default icon to something that exists
+  * en_GB.po:
+  * - changed the string in question
+  * hildon-volumebar.c,hildon-volumebar-range.c
+  * - Added properties
+  * hildon-volumebar.c:
+  * - Added lost gtk_toggle_button_set_active call
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Mon,  2 May 2005 14:38:31 +0300
+
+hildon-libs (0.9.15-1) unstable; urgency=low
+
+  * Fixed #8759 (Content area missing in username/password dialog)
+  * Fixed #10256 (HildonSortDialog - UI string mismatch)
+  * Fixed #10221 (Preview in font selection dialog ellipzises text
+    invalidly after font size reduction)
+  * Fixed #3092 (Horizontal scroll bar shown unnecessarily when using
+    multiline textview)
+  * Updated .po files from SDL were integrated
+  * hildon-note.[c|h]: Added requested properties and gtype to Note.
+  * hildon-get-password-dialog.h: Updated logical strings.
+  * hildon-get-password-dialog.c: Largely rewritten. Added a function.
+  * hildon-set-password-dialog.h: Logical strings were updated. Added a
+    function.
+  * hildon-set-password-dialog.c: Added a function.
+  * hildon-name-password-dialog.h: Updated logical strings. Added a
+    function.
+  * hildon-name-password-dialog.c: Added a function.
+  * hildon-note.h: added a function to set note dialog's button labels,
+    both of them.
+  * hildon-note.c: added a function to set note dialog's button labels,
+    both of them. Added requested properties and gtype to Note
+  * hildon-font-selection-dialog.c: Reorder code, so window is resized
+    correctly
+  * hildon-scroll-area.c: Scrollarea no longer displays horizontal
+    scroll bar when not needed. Some other cleanup.
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Thu, 28 Apr 2005 15:08:25 +0300
+
+hildon-libs (0.9.14-1) unstable; urgency=low
+
+  * Fixed #9694: Deprecated APIs should be marked with
+    HILDON_DISABLE_DEPRECATED
+  * hildon-file-details-dialog.[ch],hildon-widgets_tests.c,hildon-font-
+    selection-dialog.c:
+  * - Added HILDON_DISABLE_DEPRECATED ifdefs
+  * hildon-range-editor.[ch]:
+  * - Added properties; lower, higher, min, max, separator
+  * hildon-controlbar.c:
+  * - Added properties; min, max, value
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Wed, 27 Apr 2005 13:36:40 +0300
+
+hildon-libs (0.9.13-1) unstable; urgency=low
+
+  * Fixed #6840: gtk_dialog_help_enable () is broken
+  * Fixed #10123: Font Dialog - Contents of 'size' choice list is not as
+    per widget specification
+  * Fixed #10132 AF-BAT: HildonUserName and Password Dialog title
+    incorrect.
+  * Fixed #10133 AF-BAT: HildonSetPasswordDialog second field displayed
+    incorrectly.
+  * Fixed #10136 AF-BAT: File handling Notes display logical strings.
+  * Fixed #4061: HildonDateEditor: date fields not properly localized
+  * Fixed #10257: HildonRangeEditor - accepting alphabets also from VKB
+  * Fixed #10129: HildonPasswordDialog fields have "::" as separators
+  * Fixed #9624: Incorrect values in <Filetype> Details Dialog
+  * hildon-dialoghelp.c: changed the help signal type to GTK_TYPE_DIALOG
+  * en_GB.po: added translation for trailing text
+  * en_GB.po:
+  * - added translation for trailing text
+  * - added localizations for logical names in hildon-file-handling-
+    note.c
+  * - fixed incorrect strings for hildon-name-password-dialog.c and
+    hildon-set-password-dialog.c
+  * hildon-date-editor.c:
+  * - removed the hard coded "/" delimeter characters
+  * - added localized delimiters
+  * hildon-date-editor.[ch]:
+  * - Added year, month, day properties
+  * hildon-range-editor.c:
+  * - set the entries to use the numeric input-mode
+  * hildon-time-editor.[ch]:
+  * - added following public functions:
+  * -- hildon_time_editor_set_ticks ()
+  * -- hildon_time_editor_get_ticks ()
+  * -- hildon_time_editor_set_show_seconds ()
+  * -- hildon_time_editor_get_show_seconds ()
+  * -- hildon_time_editor_set_duration_mode ()
+  * -- hildon_time_editor_get_duration_mode ()
+  * -- hildon_time_editor_set_duration_min ()
+  * -- hildon_time_editor_get_duration_min ()
+  * -- hildon_time_editor_set_duration_max ()
+  * -- hildon_time_editor_get_duration_max ()
+  * - Added the following properties and rewrote some of the widget to
+    accommodate internal changes:
+  * -- "ticks": uint: The time/duration in seconds (from midnight if
+    appr.)
+  * -- "duration_mode": boolean: The mode of operation (true for
+    duration)
+  * -- "duration_min": uint: Smallest accepted duration
+  * -- "duration_max": uint: Greates accepted duration
+  * -- "show_seconds": boolean: Show seconds in the editor (or not if
+    false)
+  * hildon-get-password-dialog.c,hildon-name-password-dialog.c,hildon-
+    set-password-dialog.c:
+  * - caption separators set to empty string
+  * hildon-file-details-dialog.c
+  * - set two caption separators to empty strings to remove double
+    colons (first colon comes from localized string, second from caption
+    control)
+  * - wrapped <Filetype> view to a scrolled window to implement vertical
+    scrollbar
+  * - file type string is now localized
+  * - set G_PARAM_CONSTRUCT flag for show-tabs property hildon-
+    libs/po/en_GB.po
+  * - fixed string "File details" -> "Details"
+  * - Added HILDON_DISABLE_DEPRECATED ifdefs
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Wed, 27 Apr 2005 13:34:13 +0300
+
+hildon-libs (0.9.12-1) unstable; urgency=low
+
+  * Fixed #8557: Even after muting the audio Seek bar thumb progressess
+    and after that unmute also mute mark enabled
+  * hildon-volumebar.c:
+  * - The 'keyboard' navigation was made possible by enabling the mute
+    button to get focus. The icon for the focused button was set to the
+    same as mute icon because the mute button can have focus only when
+    volume is muted. After the volume was unmuted, the focus for mute
+    button was disabled and focus grabbed for the volumebar. If the
+    volumebar was unable to get focus, the mute button didn't lose focus
+    and a wrong icon was displayed -> fixed by adding a check if
+    volumebar can indeed focus and choosing the action based on that
+    information.
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Thu, 14 Apr 2005 20:08:51 +0300
+
+hildon-libs (0.9.11-1) unstable; urgency=low
+
+  * Fixed #8358 (Clicking mute button on volume bar does not affect the
+    mute icon.)
+  * Fixed #8400 (Font selection dialog not showing the already applied
+    attribute to text)
+  * Fixed #9155 (HildonTimeEditor - The border of the editors are
+    incomplete)
+  * hildon-date-editor.[c|h]: changed the widget to use a validate date
+    signal
+  * Fixed #9195 (HildonColorSelector - UI string mismatch)
+  * Fixed #9198 (HildonColorSelector - Tapping on custom colour does not
+    open the 5-bit palette)
+  * hildon-color-popup.c: fixed logical name of Cancel button
+  * hildon-color-selector.c: - Modify button is now dimmed when
+    predefined colour is selected
+  * - when a custom colour is selected, tapping on the selected colour
+    or pressing enter now opens the 5-bit colour selected
+  * - added parameter motion to select_color to distinguish between
+    button_press and motion_notify events (i.e. tapping on selected
+    colour and dragging the selected colour)
+  * - moved code related to creating and returning from the popup from
+    hildon_color_selector_response to a new function modify_selected to
+    avoid duplicating code
+  * .po changes: added Modify button text for Color Selector
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Thu, 14 Apr 2005 14:10:12 +0300
+
+hildon-libs (0.9.10-1) unstable; urgency=low
+
+  * Added osso-esd-dev dependency to hildon-libs-dev
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Wed, 13 Apr 2005 16:59:11 +0300
+
+hildon-libs (0.9.9-1) unstable; urgency=low
+
+  * Pretty much rewritten time picker
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Wed, 13 Apr 2005 10:58:32 +0300
+
+hildon-libs (0.9.8-1) unstable; urgency=low
+
+  * hildon-note.c: Fixes text ellipsizing (related to #8426, but does
+    not fix it)
+  * hildon-number-editor.c: Fixed (partially?) #5005 (In Settings
+    dialog,it is possible to enter alphabets to define the cache size)
+  * Hildon Note now uses ESD for the sound support instead of OSSO
+    multimedia
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Mon, 11 Apr 2005 17:55:01 +0300
+
+hildon-libs (0.9.7-1) unstable; urgency=low
+
+  * hildon-date-editor.c: improved enter key press handling
+  * - added hint for input mode only numeric
+  * - fixed setting of values if the some field is left empty
+  * - also made small pixel adjust
+  * hildon-time-editor.c:
+  * - improved enter key press handling
+  * - also made small pixel adjusts
+  * - the semicolon between hour and minutes is now visible
+  * - changed the rc file and size allocate to improve the look of the
+    widget
+  * Fixed #5381 (HildonTimeEditor - The api
+    hildon_time_editor_highlight_field() does not compile.)
+  * *.po clean up
+  * Fixed #5079 (Hildon Timeeditor-Accepting alphabets also from VKB)
+  * Fixed #5075 (HildonTimeEditor-Improper alignment of the clockicon)
+  * - added numeric input mode hints to the allow only numeric input
+    from the VKB
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Mon, 11 Apr 2005 12:03:59 +0300
+
+hildon-libs (0.9.6-2) unstable; urgency=low
+
+  * removed extra locales
+
+ -- Luc Pionchon <luc.pionchon@nokia.com>  Sun,  22 May 2005 18:27:55 +0300
+
+hildon-libs (0.9.6-1) unstable; urgency=low
+
+  * Cleaned non-logical and obsolete strings
+  * Updated localization
+
+ -- First Release <Nokia>  Wed,  6 Apr 2005 18:27:55 +0300
+
+hildon-libs (0.9.5-1) unstable; urgency=low
+
+  * Seekbar fixes
+  * Updated dependency to newest GTK
+
+
+hildon-libs (0.9.4-1) unstable; urgency=low
+
+  * Fixed #2953 (HildonNumberEditor returns maximum value when it is
+    empy)
+  * Fixed #5542 (Hildon number editor behaviour is not inlined with UI
+    SPEC)
+  * Fixed #8386 (Incorrect + and - button showing in HildonNumberEditor)
+
+
+hildon-libs (0.9.3-1) unstable; urgency=low
+
+  * Fixed #8416 (Icons were missing in most of the information notes
+    displayed by the applications)
+  * Removed a useless focus grabbing to avoid focus flashing when
+    scrolling the page with focused item in it (task1645).
+  * Fixed #4276 (HildonDateEditor - When user enters a date manually in
+    the dateeditor, it is not accepted)
+  * Fixed #6050 (HildonDateEditor : No calendar icon debchange Fixed
+
+
+hildon-libs (0.9.2-1) unstable; urgency=low
+
+  * Updated to GTK 2.6
+
+
+hildon-libs (0.9.1-1) unstable; urgency=low
+
+  * GTK 2.6 Fixes
+
+
+hildon-libs (0.8.25-1) unstable; urgency=low
+
+  * Fixed hildon-time-editor to use icon name instead of stock icons
+  * Fixed hildon-time-editor pixels so that the previously unvisible
+    frame is show.
+  * Fixed po headers
+  * Fixed #3440 (HildonSetPasswordDialog - on pressing ENTER hard key
+    the field is getting cleared(reset))
+
+
+hildon-libs (0.8.24-1) unstable; urgency=low
+
+  * Update HildonGrid not to change focus when scrolled
+  * Dialogs: Keyboard navigation for each dialog, the focus must cycle
+    around the dialog widgets
+
+
+hildon-libs (0.8.23-1) unstable; urgency=low
+
+  * Fixed po issues
+  * Fixed logical localization IDs in all widgets according to WS 2.0
+    part 2
+  * Separated the More Colors selector to its own widget from the Color
+    Selector Widget
+
+
+hildon-libs (0.8.22-1) unstable; urgency=low
+
+  * Added es_MX and fr_CA
+  * Renamed localization packages: fi -> fi_FI
+
+
+hildon-libs (0.8.21-2) unstable; urgency=low
+
+  * Updated dependency to hildon-fm1
+
+
+hildon-libs (0.8.21-1) unstable; urgency=low
+
+  * ControlBar: application option for minimum number of visible bars
+
+
+hildon-libs (0.8.20-1) unstable; urgency=low
+
+  * Fixed #4638 (Updates to <Filetype> Details Dialog (WUD-DIA272)
+  * ColorSelector: add new color
+  * Number editor errorhandling improvements and localization
+  * VolumeBar: hardkey mute/unmute addition
+
+
+hildon-libs (0.8.19-1) unstable; urgency=low
+
+  * Seekbar: Added a feature that allows a different stream graphics to be shown
+    when streaming is complete.
+  * Fixed #6383 (hildon-libs, hildon-lgpl --- refers to new API provided
+    by updated gtk, but this is not specified in build-deps.)
+  * Fixed #6355 (HildonFontSelectionDialog - Segmentation Fault)
+
+
+hildon-libs (0.8.18-1) unstable; urgency=low
+
+  * Merge had happened against non-100% HEAD code, thus rebuilding...
+
+
+hildon-libs (0.8.17-1) unstable; urgency=low
+
+  * Added support for GTK icon theme names (task1777)
+  * hildon
+
+
+hildon-libs (0.8.16-1) unstable; urgency=low
+
+  * Fixed #5705 (HildonFontSelectionDialog crashes with Nokia Sans font
+    when selecting bold face)
+  * Fixed #5739 (FontSelectionDialog allows choosing italic face even
+    though it doesn't exist for some fonts)
+
+
+hildon-libs (0.8.15-1) unstable; urgency=low
+
+  * HildonFontSelectionDialog updates
+
+
+hildon-libs (0.8.14-1) unstable; urgency=low
+
+  * Fixed #3827 (HildonVolumebar is not dimmed when volume is muted)
+
+
+hildon-libs (0.8.13-1) unstable; urgency=low
+
+  * Timepicker skin updates
+
+
+hildon-libs (0.8.12-1) unstable; urgency=low
+
+  * Debianized locale-packages
+  * Fixed #4704 (libraries should be versioned)
+
+
+hildon-libs (0.8.11-1) unstable; urgency=low
+
+  * Fixed #1638 (HildonSeekBar & HilldonVolumeBar: widgets grab focus and
+    keypress events). Fixed by adding an option for applications to set focus
+    on/off
+
+
+hildon-libs (0.8.10-1) unstable; urgency=low
+
+  * Editors: Changed the focus behaviour inside a widget
+  * Fixed #3689 (It is not possible to adjust sound level through navigational
+    keys.). Mute button no longer can get focus. 
+
+
+hildon-libs (0.8.9-1) unstable; urgency=low
+
+  * Fixed #4285 (API docs contain old/deprecated widgets) 
+
+
+hildon-libs (0.8.8-2) unstable; urgency=low
+
+  * Added GnomeVFS dependencies
+
+
+hildon-libs (0.8.8-1) unstable; urgency=low
+
+  * Added sound support to hildon-note. Requires DBUS and osso-sounds-ui.
+  * Removed erroneus version dependency from pkgconfig file for fm and lgp.
+
+
+hildon-libs (0.8.7-1) unstable; urgency=low
+
+  * Fixed #4652 (missing dependency to hildon-fm-dev)
+  * Removed dependency to matchbox 
+
+
+hildon-libs (0.8.6-1) unstable; urgency=low
+
+  * Lots of updates from development. 
+
+
+hildon-libs (0.8.5-1) unstable; urgency=low
+
+  * Release 0.8.5 
+
+
+hildon-libs (0.8.4-3) unstable; urgency=low
+
+  * HildonRangeEditor: Changed author, removed #include
+  * Updated GTK doc
+
+
+hildon-libs (0.8.4-1) unstable; urgency=low
+
+  * 0.8.4 Release
+
index 0cbc126..179a1f0 100644 (file)
@@ -1,33 +1,26 @@
 Source: hildon-libs
 Section: x11
 Priority: optional
-Maintainer: Luc Piochon <luc.piochon@nokia.com>
-Build-Depends: debhelper (>= 4.0.0), pkg-config, dbus-1-dev, hildon-lgpl-dev (>= 0.9.1), outo, libosso-gnomevfs2-dev, hildon-fm-dev, libgtk2.0-dev (>= 2:2.6.4-1.osso6)
+Maintainer: Luc Pionchon <luc.pionchon@nokia.com>
+Build-Depends: debhelper (>= 4.0.0), pkg-config, hildon-lgpl-dev (>= 0.9.24-1), outo, libosso-gnomevfs2-dev, hildon-fm-dev (>= 0.9.15-1), libgtk2.0-dev (>= 2:2.6.4-1.osso6), osso-esd-dev
 Standards-Version: 3.6.0
 
 Package: hildon-libs-dev
 Section: devel
 Architecture: any
-Depends: hildon-libs0 (= ${Source-Version}), libgtk2.0-dev (>= 2:2.6.4-1.osso6), hildon-lgpl-dev, hildon-fm-dev, libosso-gnomevfs2-dev
+Depends: hildon-libs0 (= ${Source-Version}), libgtk2.0-dev (>= 2:2.6.4-1.osso6), hildon-lgpl-dev (>= 0.9.24-1), hildon-fm-dev (>= 0.9.15-1), libosso-gnomevfs2-dev, osso-esd-dev
 Description: Hildon libraries development files
 
 Package: hildon-libs0
 Section: libs
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, dbus-1, hildon-lgpl0, hildon-fm1, osso-sounds-ui, libosso-gnomevfs2-0
+Depends: ${shlibs:Depends}, ${misc:Depends}, hildon-lgpl0, hildon-fm1, osso-sounds-ui, libosso-gnomevfs2-0, osso-esd
 Description: Hildon libraries
 
-Package: hildon-libs-test
-Section: libs
-Architecture: any
-Conflicts: hildon-libs (<<0.8.12)
-Depends: hildon-libs0, outo
-Description: Hildon libraries unit tests.
-
 Package: hildon-libs0-dbg
 Section: libs
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, dbus-1, hildon-lgpl0-dbg, hildon-fm1-dbg, osso-sounds-ui, libosso-gnomevfs2-0
+Depends: ${shlibs:Depends}, ${misc:Depends}, hildon-lgpl0-dbg, hildon-fm1-dbg, osso-sounds-ui, libosso-gnomevfs2-0, osso-esd
 Description: Hildon libraries (with debug info)
 
 Package: hildon-libs-l10n-engb
index d432133..2f7ee0b 100644 (file)
@@ -64,8 +64,6 @@ CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOXYGEN_FOUND = @DOXYGEN_FOUND@
index 69cfa0c..2783201 100644 (file)
@@ -18,7 +18,6 @@
       <xi:include href="xml/hildon-color-selector.xml"/>
       <xi:include href="xml/hildon-controlbar.xml"/>
       <xi:include href="xml/hildon-date-editor.xml"/>
-      <xi:include href="xml/hildon-find-object-dialog.xml"/>
       <xi:include href="xml/hildon-font-selection-dialog.xml"/>
       <xi:include href="xml/hildon-get-password-dialog.xml"/>
       <xi:include href="xml/hildon-hvolumebar.xml"/>
@@ -26,7 +25,6 @@
       <xi:include href="xml/hildon-note.xml"/>
       <xi:include href="xml/hildon-number-editor.xml"/>
       <xi:include href="xml/hildon-range-editor.xml"/>
-      <xi:include href="xml/hildon-search.xml"/>
       <xi:include href="xml/hildon-seekbar.xml"/>
       <xi:include href="xml/hildon-set-password-dialog.xml"/>
       <xi:include href="xml/hildon-sort-dialog.xml"/>
index 082a9a5..0409b15 100644 (file)
@@ -1,5 +1,4 @@
 #include <hildon-widgets/hildon-calendar-popup.h>
-#include <hildon-widgets/hildon-search.h>
 #include <hildon-widgets/hildon-seekbar.h>
 #include <hildon-widgets/hildon-hvolumebar.h>
 #include <hildon-widgets/hildon-vvolumebar.h>
@@ -12,8 +11,6 @@
 #include <hildon-widgets/hildon-name-password-dialog.h>
 #include <hildon-widgets/hildon-color-selector.h>
 #include <hildon-widgets/hildon-controlbar.h>
-#include <hildon-widgets/hildon-find-object-dialog.h>
-#include <hildon-widgets/hildon-find-replace-dialog.h>
 #include <hildon-widgets/hildon-font-selection-dialog.h>
 #include <hildon-widgets/hildon-get-password-dialog.h>
 #include <hildon-widgets/hildon-add-home-dialog.h>
@@ -32,8 +29,6 @@
 
 hildon_color_selector_get_type
 hildon_controlbar_get_type
-hildon_find_object_dialog_get_type
-hildon_find_replace_dialog_get_type
 hildon_font_selection_dialog_get_type
 hildon_get_password_dialog_get_type
 
@@ -52,7 +47,6 @@ hildon_file_details_dialog_get_type
 hildon_file_handling_note_get_type
 
 hildon_calendar_popup_get_type
-hildon_search_get_type
 hildon_seekbar_get_type
 hildon_hvolumebar_get_type
 hildon_vvolumebar_get_type
index 54578ff..22566a4 100644 (file)
@@ -107,6 +107,21 @@ hildon_controlbar_set_value( HILDON_CONTROLBAR(cbar), 6 );
 @max: 
 
 
+<!-- ##### ARG HildonControlbar:max ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonControlbar:min ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonControlbar:value ##### -->
+<para>
+
+</para>
+
 <!-- ##### ARG HildonControlbar:inner-border-width ##### -->
 <para>
 
index 8fc5022..fac682c 100644 (file)
@@ -72,10 +72,26 @@ hildon_date_editor_get_date(date_editor, &amp;y, &amp;m, &amp;d);
 @day: 
 
 
-<!-- ##### SIGNAL HildonDateEditor::activate ##### -->
+<!-- ##### SIGNAL HildonDateEditor::validate-date ##### -->
 <para>
 
 </para>
 
 @hildondateeditor: the object which received the signal.
+@Returns: 
+
+<!-- ##### ARG HildonDateEditor:day ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonDateEditor:month ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonDateEditor:year ##### -->
+<para>
+
+</para>
 
index 448a487..9d3ef7b 100644 (file)
@@ -2,83 +2,81 @@
 HildonFontSelectionDialog
 
 <!-- ##### SECTION Short_Description ##### -->
-A widget is used to select a font. (Selection is made by user)
+A widget is used to select a font with certain properties
 
 <!-- ##### SECTION Long_Description ##### -->
 <para>
-Font selection can be made using this widget. User can select e.g.
-font name, size, style, etc. User can also preview his/her selection.
-
-<informalexample>
-<programlisting>
-
-HildonFontSelectionDialog *hfsd = hildon_font_selection_dialog_new( NULL, NULL );
-  gtk_widget_show_all(hfsd);
+Font selection dialog provides the user with the possiblity to
+choose a different font family, font size, font color, font 
+weight(bold or not bold), font style(italic or not italic), 
+underline, strikethrough, and position(normal, superscript 
+or subscript).
+</para>
 
-response = gtk_dialog_run(GTK_DIALOG(hfsd));
+<!-- ##### SECTION See_Also ##### -->
+<para>
 
-if(response == -5)
-{
-  if(list)
-  pango_attr_list_unref( list );i
-  list = hildon_font_selection_dialog_get_font(
-                                                                                       HILDON_FONT_SELECTION_DIALOG(hfsd) );
-  gtk_label_set_attributes( GTK_LABEL(label), list );
-}
-gtk_widget_destroy(hfsd);
+</para>
 
-</programlisting>
-</informalexample>
+<!-- ##### STRUCT HildonFontSelectionDialog ##### -->
+<para>
 
 </para>
 
-<!-- ##### SECTION See_Also ##### -->
+
+<!-- ##### FUNCTION hildon_font_selection_dialog_new ##### -->
 <para>
 
 </para>
 
-<!-- ##### ENUM HildonPositioning ##### -->
+@parent: 
+@title: 
+@Returns: 
+
+
+<!-- ##### FUNCTION hildon_font_selection_dialog_set_font ##### -->
 <para>
 
 </para>
 
-@HILDON_POSITIONING_NORMAL: 
-@HILDON_POSITIONING_SUPER: 
-@HILDON_POSITIONING_SUB: 
+@fsd: 
+@list: 
+
 
-<!-- ##### ENUM HildonFontFaceType ##### -->
+<!-- ##### FUNCTION hildon_font_selection_dialog_get_font ##### -->
 <para>
 
 </para>
 
-@HILDON_FONT_FACE_NORMAL: 
-@HILDON_FONT_FACE_ITALIC: 
-@HILDON_FONT_FACE_BOLD: 
-@HILDON_FONT_FACE_BOLD_ITALIC: 
+@fsd: 
+@Returns: 
+
 
-<!-- ##### STRUCT HildonFontSelectionDialog ##### -->
+<!-- ##### FUNCTION hildon_font_selection_dialog_set_buffer ##### -->
 <para>
 
 </para>
 
+@fsd: 
+@buffer: 
 
-<!-- ##### FUNCTION hildon_font_selection_dialog_new ##### -->
+
+<!-- ##### FUNCTION hildon_font_selection_dialog_get_text_tag ##### -->
 <para>
 
 </para>
 
-@parent: 
-@title: 
+@fsd: 
 @Returns: 
 
 
-<!-- ##### FUNCTION hildon_font_selection_dialog_set_font ##### -->
+<!-- ##### FUNCTION hildon_font_selection_dialog_set_preview_text ##### -->
 <para>
 
 </para>
 
 @fsd: 
-@list: 
+@text: 
 
 
 <!-- ##### FUNCTION hildon_font_selection_dialog_get_preview_text ##### -->
@@ -90,12 +88,83 @@ gtk_widget_destroy(hfsd);
 @Returns: 
 
 
-<!-- ##### FUNCTION hildon_font_selection_dialog_set_preview_text ##### -->
+<!-- ##### ARG HildonFontSelectionDialog:bold ##### -->
 <para>
 
 </para>
 
-@fsd: 
-@text: 
+<!-- ##### ARG HildonFontSelectionDialog:bold-set ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:color ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:color-set ##### -->
+<para>
+
+</para>
 
+<!-- ##### ARG HildonFontSelectionDialog:family ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:family-set ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:italic ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:italic-set ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:position ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:position-set ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:size ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:size-set ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:strikethrough ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:strikethrough-set ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:underline ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonFontSelectionDialog:underline-set ##### -->
+<para>
+
+</para>
 
index 18da1d7..b8987eb 100644 (file)
@@ -65,3 +65,13 @@ HildonGetPasswordDialog is used to get a password.
 @Returns: 
 
 
+<!-- ##### ARG HildonGetPasswordDialog:domain ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonGetPasswordDialog:password ##### -->
+<para>
+
+</para>
+
index 60c3fd3..9a68754 100644 (file)
@@ -2,10 +2,13 @@
 HildonGridItem
 
 <!-- ##### SECTION Short_Description ##### -->
-
+#HildonGridItem is indeded to be used with #HildonGrid.
 
 <!-- ##### SECTION Long_Description ##### -->
 <para>
+#HildonGridItem is an uninteractive widget representing item on #HildonGrid.
+Each item has an icon and a label. Depending on current style, icon can be
+either above or to the left of the label.
 
 </para>
 
@@ -41,7 +44,7 @@ create_basic_icons (HildonGrid *grid)
 
 <!-- ##### SECTION See_Also ##### -->
 <para>
-
+#HildonGrid
 </para>
 
 <!-- ##### STRUCT HildonGridItem ##### -->
index f0af958..e9d4159 100644 (file)
@@ -2,11 +2,23 @@
 HildonGrid
 
 <!-- ##### SECTION Short_Description ##### -->
-
+#HildonGrid is intended to be used where ever a number of single tap
+activatable items need to be presented (e.g. Control Panel applets).
 
 <!-- ##### SECTION Long_Description ##### -->
 <para>
-
+HildonGrid is a set of application-defineable items that are presented in a
+table. The form of this table is selected from two modes; large icon mode and
+small icon mode.
+
+In large icon mode, the Grid View items are presented with a large icon and a
+label underneath it. In small icon mode, the items are presented with a small
+icon and a label on the right side of the icon.
+
+The label of an item is displayed within a band of colour displayed as a
+background colour as wide as the maximum text width. This allows the text to
+have focus as well as be legible when displayed upon a black or dark background
+image. Long names are truncated with an ellipsis ("...") appended.
 </para>
 
 <para>
@@ -361,7 +373,7 @@ set_icon_size (GtkMenuItem *item, gpointer data)
 
 <!-- ##### SECTION See_Also ##### -->
 <para>
-
+#HildonGridItem
 </para>
 
 <!-- ##### STRUCT HildonGrid ##### -->
@@ -477,6 +489,11 @@ set_icon_size (GtkMenuItem *item, gpointer data)
 
 </para>
 
+<!-- ##### ARG HildonGrid:label-height ##### -->
+<para>
+
+</para>
+
 <!-- ##### ARG HildonGrid:label-hspacing ##### -->
 <para>
 
index 7e0f662..bef4180 100644 (file)
@@ -1,3 +1,38 @@
+<!-- ##### SECTION ./tmpl/hildon-find-object-dialog.sgml:Long_Description ##### -->
+<para>
+#HildonFindObjectDialog is a widget to query a string from the user.
+This string is ment to be searched from a selected content of text.
+There's a two kind of dialogs, one with different search options and
+another with only one field to enter the searched parameter.
+
+<informalexample>
+<programlisting>
+
+FindDialog = hildon_find_object_dialog_new (grand_parent);
+...
+findDialogOptions = hildon_find_object_dialog_new_with_options (
+                                       grand_parent,GTK_DIALOG(dialog));
+
+</programlisting>
+</informalexample>
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hildon-find-object-dialog.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hildon-find-object-dialog.sgml:Short_Description ##### -->
+#HildonFindObjectDialog is a widget to query a string from the user.
+This string is ment to be searched from a selected content of text.
+
+
+<!-- ##### SECTION ./tmpl/hildon-find-object-dialog.sgml:Title ##### -->
+HildonFindObjectDialog
+
+
 <!-- ##### SECTION ./tmpl/hildon-hwr-area.sgml:Long_Description ##### -->
 <para>
 
 HildonHWRArea
 
 
+<!-- ##### SECTION ./tmpl/hildon-search.sgml:Long_Description ##### -->
+<para>
+HildonSearch is a widget to ask details to a comming search operation.
+It's possible to set an image to inform ongoing search operation.
+
+<informalexample>
+<programlisting>
+  GtkWidget *search = hildon_search_new( "hildon-search");
+       hildon_search_set_image_stock( HILDON_SEARCH(search), ICON_NAME[counter] );
+</programlisting>
+</informalexample>
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hildon-search.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### SECTION ./tmpl/hildon-search.sgml:Short_Description ##### -->
+HildonSearch is a widget to ask details to a comming search operation.
+
+
+<!-- ##### SECTION ./tmpl/hildon-search.sgml:Title ##### -->
+HildonSearch
+
+
 <!-- ##### MACRO GTK_FILE_SYSTEM_ENABLE_UNSUPPORTED ##### -->
 <para>
 
@@ -94,6 +157,13 @@ HildonHWRArea
 </para>
 
 
+<!-- ##### SIGNAL HildonDateEditor::activate ##### -->
+<para>
+
+</para>
+
+@hildondateeditor: the object which received the signal.
+
 <!-- ##### STRUCT HildonFileChooserDialogPrivate ##### -->
 <para>
 
@@ -160,7 +230,7 @@ HildonHWRArea
 @HILDON_FILE_SYSTEM_MODEL_SAFE_FOLDER_DOCUMENTS: 
 @HILDON_FILE_SYSTEM_MODEL_MMC: 
 @HILDON_FILE_SYSTEM_MODEL_GATEWAY: 
-@HILDON_FILE_SYSTEM_MODEL_SPUTNIK: 
+@HILDON_FILE_SYSTEM_MODEL_LOCAL_DEVICE: 
 
 <!-- ##### STRUCT HildonFileSystemModelPrivate ##### -->
 <para>
@@ -178,6 +248,12 @@ HildonHWRArea
 @thumbnail_file: 
 @Returns: 
 
+<!-- ##### STRUCT HildonFindObjectDialog ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### ENUM HildonHWRAreaMode ##### -->
 <para>
 
@@ -199,19 +275,70 @@ HildonHWRArea
 </para>
 
 
-<!-- ##### SIGNAL HildonVolumebar::level-changed ##### -->
+<!-- ##### SIGNAL HildonNumberEditor::activate ##### -->
+<para>
+
+</para>
+
+@hildonnumbereditor: the object which received the signal.
+
+<!-- ##### SIGNAL HildonRangeEditor::activate ##### -->
+<para>
+
+</para>
+
+@hildonrangeeditor: the object which received the signal.
+
+<!-- ##### STRUCT HildonSearch ##### -->
 <para>
 
 </para>
 
-@hildonvolumebar: the object which received the signal.
 
-<!-- ##### SIGNAL HildonVolumebar::mute-toggled ##### -->
+<!-- ##### ARG HildonSearch:stock-icon-name ##### -->
 <para>
 
 </para>
 
-@hildonvolumebar: the object which received the signal.
+
+<!-- ##### SIGNAL HildonTelephoneEditor::activate ##### -->
+<para>
+
+</para>
+
+@hildontelephoneeditor: the object which received the signal.
+
+<!-- ##### SIGNAL HildonTimeEditor::activate ##### -->
+<para>
+
+</para>
+
+@hildontimeeditor: the object which received the signal.
+
+<!-- ##### ENUM HildonTimeEditorField ##### -->
+<para>
+
+</para>
+
+@HILDON_TIME_EDITOR_HOUR_FIELD: 
+@HILDON_TIME_EDITOR_MINUTE_FIELD: 
+@HILDON_TIME_EDITOR_SECOND_FIELD: 
+
+<!-- ##### STRUCT HildonVolumebarClass ##### -->
+<para>
+
+</para>
+
+@parent_class: 
+@mute_toggled: 
+@level_changed: 
+
+<!-- ##### SIGNAL HildonWeekdayPicker::activate ##### -->
+<para>
+
+</para>
+
+@hildonweekdaypicker: the object which received the signal.
 
 <!-- ##### ENUM HildonZoomLevel ##### -->
 <para>
@@ -731,7 +858,7 @@ HildonHWRArea
 @recursive: 
 @Returns: 
 
-<!-- ##### FUNCTION hildon_find_replace_dialog_get_new_text ##### -->
+<!-- ##### FUNCTION hildon_find_object_dialog_get_text ##### -->
 <para>
 
 </para>
@@ -739,15 +866,40 @@ HildonHWRArea
 @dialog: 
 @Returns: 
 
-<!-- ##### FUNCTION hildon_font_selection_dialog_get_color ##### -->
+<!-- ##### FUNCTION hildon_find_object_dialog_new ##### -->
 <para>
 
 </para>
 
-@fsd: 
+@parent: 
+@Returns: 
+
+<!-- ##### FUNCTION hildon_find_object_dialog_new_with_options ##### -->
+<para>
+
+</para>
+
+@parent: 
+@dialog: 
+@Returns: 
+
+<!-- ##### FUNCTION hildon_find_object_dialog_set_label ##### -->
+<para>
+
+</para>
+
+@dialog: 
+@label: 
+
+<!-- ##### FUNCTION hildon_find_replace_dialog_get_new_text ##### -->
+<para>
+
+</para>
+
+@dialog: 
 @Returns: 
 
-<!-- ##### FUNCTION hildon_font_selection_dialog_get_font ##### -->
+<!-- ##### FUNCTION hildon_font_selection_dialog_get_color ##### -->
 <para>
 
 </para>
@@ -844,6 +996,22 @@ HildonHWRArea
 @description: 
 @Returns: 
 
+<!-- ##### FUNCTION hildon_search_new ##### -->
+<para>
+
+</para>
+
+@image: 
+@Returns: 
+
+<!-- ##### FUNCTION hildon_search_set_image_stock ##### -->
+<para>
+
+</para>
+
+@search: 
+@stock_icon: 
+
 <!-- ##### FUNCTION hildon_set_password_dialog_get_password ##### -->
 <para>
 
index 08815a9..df1a047 100644 (file)
@@ -76,3 +76,18 @@ void _testNamePasswordDialog(GtkWidget *parent, gchar **help)
 @Returns: 
 
 
+<!-- ##### ARG HildonNamePasswordDialog:content ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonNamePasswordDialog:name ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonNamePasswordDialog:password ##### -->
+<para>
+
+</para>
+
index e7cc8f5..7cbf5ea 100644 (file)
@@ -38,26 +38,6 @@ else
 </para>
 
 
-<!-- ##### ARG HildonNote:description ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG HildonNote:icon ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG HildonNote:note-type ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG HildonNote:progressbar ##### -->
-<para>
-
-</para>
-
 <!-- ##### FUNCTION hildon_note_new_confirmation ##### -->
 <para>
 
@@ -144,3 +124,23 @@ else
 @text: 
 
 
+<!-- ##### ARG HildonNote:description ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonNote:icon ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonNote:note-type ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonNote:progressbar ##### -->
+<para>
+
+</para>
+
index 292498f..9956c9b 100644 (file)
@@ -65,10 +65,12 @@ HildonNumberEditor is used to set a number from a specific range. There's two bu
 @value: 
 
 
-<!-- ##### SIGNAL HildonNumberEditor::activate ##### -->
+<!-- ##### SIGNAL HildonNumberEditor::range-error ##### -->
 <para>
 
 </para>
 
 @hildonnumbereditor: the object which received the signal.
+@arg1: 
+@Returns: 
 
index b8ea2f7..7222bc6 100644 (file)
@@ -83,12 +83,30 @@ HildonRangeEditor is used to ask a value from a specific limits.
 @end: 
 
 
-<!-- ##### SIGNAL HildonRangeEditor::activate ##### -->
+<!-- ##### ARG HildonRangeEditor:higher ##### -->
 <para>
 
 </para>
 
-@hildonrangeeditor: the object which received the signal.
+<!-- ##### ARG HildonRangeEditor:lower ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonRangeEditor:max ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonRangeEditor:min ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonRangeEditor:separator ##### -->
+<para>
+
+</para>
 
 <!-- ##### ARG HildonRangeEditor:hildon-range-editor-entry-alignment ##### -->
 <para>
index 6f43147..00379f9 100644 (file)
@@ -2,11 +2,46 @@
 hildon-scroll-area
 
 <!-- ##### SECTION Short_Description ##### -->
-
+@GtkScrollArea is a helper to create specific views,
+which are using scrollable area.
 
 <!-- ##### SECTION Long_Description ##### -->
 <para>
-
+When application developer needs a view which contains multiple
+components, from which some has built-in @GtkScrolledWindow handling.
+(eg. @GtkTreeView) These widgets creates a problem which can be seen as
+unfunctional scrolling. @GtkScrollArea creates an area which handles
+these scrolling problems.
+
+<informalexample>
+<programlisting>
+/*
+Following code is not a working copy,
+it's only giving an example of possible situation
+*/
+
+window = gtk_window_new ();
+box = gtk_box_new ();
+buttonA = gtk_button_new ();
+buttonB = gtk_button_new ();
+treeview = gtk_tree_view_new ();
+swindow = gtk_scrolled_window_new ();
+
+scrollarea = gtk_scroll_area_new (swindow, treeview);
+
+/*
+Pack the buttons to the box, the box to the scrolled window
+and the scrolled window to the window.
+*/
+
+gtk_box_pack (box, scrollarea);
+
+/*
+You can trye following situation without scroll area and
+notice that the treeview is not working as well as it should
+*/
+</programlisting>
+</informalexample>
 </para>
 
 <!-- ##### SECTION See_Also ##### -->
index 0190908..dc250b3 100644 (file)
@@ -48,16 +48,6 @@ static gint update_spin_button (GtkWidget *seek, GtkWidget *spin)
 </para>
 
 
-<!-- ##### ARG HildonSeekbar:position ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG HildonSeekbar:total-time ##### -->
-<para>
-
-</para>
-
 <!-- ##### FUNCTION hildon_seekbar_new ##### -->
 <para>
 
@@ -122,3 +112,13 @@ static gint update_spin_button (GtkWidget *seek, GtkWidget *spin)
 @Returns: 
 
 
+<!-- ##### ARG HildonSeekbar:position ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonSeekbar:total-time ##### -->
+<para>
+
+</para>
+
index 943b452..0601019 100644 (file)
@@ -73,8 +73,18 @@ Example:
 @Returns: 
 
 
+<!-- ##### ARG HildonSetPasswordDialog:domain ##### -->
+<para>
+
+</para>
+
 <!-- ##### ARG HildonSetPasswordDialog:modify-protection ##### -->
 <para>
 
 </para>
 
+<!-- ##### ARG HildonSetPasswordDialog:password ##### -->
+<para>
+
+</para>
+
index 4819027..fc4b811 100644 (file)
@@ -171,13 +171,6 @@ The widget is used where a user should enter a phone number. Free format should
 @number: 
 
 
-<!-- ##### SIGNAL HildonTelephoneEditor::activate ##### -->
-<para>
-
-</para>
-
-@hildontelephoneeditor: the object which received the signal.
-
 <!-- ##### ARG HildonTelephoneEditor:set-area ##### -->
 <para>
 
index fc821ff..8d71270 100644 (file)
@@ -38,29 +38,6 @@ hildon_time_editor_get_time( editor, &amp;h, &amp;m, &amp;s );
 </para>
 
 
-<!-- ##### SIGNAL HildonTimeEditor::activate ##### -->
-<para>
-
-</para>
-
-@hildontimeeditor: the object which received the signal.
-
-<!-- ##### SIGNAL HildonTimeEditor::activate ##### -->
-<para>
-
-</para>
-
-@hildontimeeditor: the object which received the signal.
-
-<!-- ##### ENUM HildonTimeEditorField ##### -->
-<para>
-
-</para>
-
-@HILDON_TIME_EDITOR_HOUR_FIELD: 
-@HILDON_TIME_EDITOR_MINUTE_FIELD: 
-@HILDON_TIME_EDITOR_SECOND_FIELD: 
-
 <!-- ##### FUNCTION hildon_time_editor_new ##### -->
 <para>
 
@@ -129,12 +106,53 @@ hildon_time_editor_get_time( editor, &amp;h, &amp;m, &amp;s );
 @max_seconds: 
 
 
-<!-- ##### FUNCTION hildon_time_editor_highlight_field ##### -->
+<!-- ##### ARG HildonTimeEditor:duration-max ##### -->
 <para>
 
 </para>
 
-@editor: 
-@field: 
+<!-- ##### ARG HildonTimeEditor:duration-min ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonTimeEditor:duration-mode ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonTimeEditor:show-seconds ##### -->
+<para>
 
+</para>
+
+<!-- ##### ARG HildonTimeEditor:ticks ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonTimeEditor:duration-max ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonTimeEditor:duration-min ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonTimeEditor:duration-mode ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonTimeEditor:show-seconds ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonTimeEditor:ticks ##### -->
+<para>
+
+</para>
 
index c216c22..941dd67 100644 (file)
@@ -80,3 +80,18 @@ gtk_widget_destroy( picker );
 @minutes: 
 
 
+<!-- ##### ARG HildonTimePicker:minutes ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonTimePicker:arrow-height ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonTimePicker:arrow-width ##### -->
+<para>
+
+</para>
+
index 3af97a0..48db546 100644 (file)
@@ -22,15 +22,6 @@ the volume by clicking on a specific mute icon.
 </para>
 
 
-<!-- ##### STRUCT HildonVolumebarClass ##### -->
-<para>
-
-</para>
-
-@parent_class: 
-@mute_toggled: 
-@level_changed: 
-
 <!-- ##### FUNCTION hildon_volumebar_set_level ##### -->
 <para>
 
@@ -98,8 +89,23 @@ the volume by clicking on a specific mute icon.
 
 @hildonvolumebar: the object which received the signal.
 
+<!-- ##### ARG HildonVolumebar:can-focus ##### -->
+<para>
+
+</para>
+
 <!-- ##### ARG HildonVolumebar:has-mute ##### -->
 <para>
 
 </para>
 
+<!-- ##### ARG HildonVolumebar:level ##### -->
+<para>
+
+</para>
+
+<!-- ##### ARG HildonVolumebar:mute ##### -->
+<para>
+
+</para>
+
index 229b02d..251f587 100644 (file)
@@ -47,21 +47,6 @@ Example function calls:
 </para>
 
 
-<!-- ##### SIGNAL HildonWeekdayPicker::activate ##### -->
-<para>
-
-</para>
-
-@hildonweekdaypicker: the object which received the signal.
-
-<!-- ##### SIGNAL HildonWeekdayPicker::selection-changed ##### -->
-<para>
-
-</para>
-
-@hildonweekdaypicker: the object which received the signal.
-@arg1: 
-
 <!-- ##### FUNCTION hildon_weekday_picker_new ##### -->
 <para>
 </para>
@@ -122,3 +107,11 @@ Example function calls:
 @Returns: 
 
 
+<!-- ##### SIGNAL HildonWeekdayPicker::selection-changed ##### -->
+<para>
+
+</para>
+
+@hildonweekdaypicker: the object which received the signal.
+@arg1: 
+
index 8e642b7..61a5afc 100644 (file)
@@ -1,17 +1,21 @@
-INCLUDES = $(GTK_CFLAGS) $(GNOME_VFS_CFLAGS) $(GCONF_CFLAGS) $(DBUS_CFLAGS) \
-       -DLOCALEDIR=\"$(localedir)\" -I$(srcdir)/..
+INCLUDES = $(GTK_CFLAGS) $(GNOME_VFS_CFLAGS) $(GCONF_CFLAGS) \
+          $(ESD_CFLAGS) -DLOCALEDIR=\"$(localedir)\" -I$(srcdir)/..
 
 lib_LTLIBRARIES = libhildonwidgets.la
 
-EXTRA_DIST = 
+EXTRA_DIST = hildon-marshalers.list
+
+libhildonwidgets_la_LDFLAGS = -version-info 5:0:5
 
 libhildonwidgets_la_LIBADD = $(GTK_LIBS) $(GNOME_VFS_LIBS) $(GCONF_LIBS) \
-       $(DBUS_LIBS)
-libhildonwidgets_la_LDFLAGS = -version-info 3:0:3
+                            $(ESD_LIBS)
+
 libhildonwidgets_la_SOURCES = \
-  hildon-composite-widget.c \
+       hildon-marshalers.c \
+       hildon-marshalers.h \
+       hildon-composite-widget.c \
        hildon-composite-widget.h \
-  hildon-controlbar.c \
+       hildon-controlbar.c \
        hildon-controlbar.h \
        hildon-seekbar.c \
        hildon-seekbar.h \
@@ -19,8 +23,6 @@ libhildonwidgets_la_SOURCES = \
        hildon-color-selector.h \
        hildon-note.c \
        hildon-note.h \
-       hildon-search.c \
-       hildon-search.h \
        hildon-volumebar.c \
        hildon-volumebar.h \
        hildon-volumebar-range.c \
@@ -56,25 +58,21 @@ libhildonwidgets_la_SOURCES = \
        hildon-sort-dialog.h \
        hildon-add-home-dialog.c \
        hildon-add-home-dialog.h \
-       hildon-find-object-dialog.c \
-       hildon-find-object-dialog.h \
        hildon-font-selection-dialog.c \
        hildon-font-selection-dialog.h \
        hildon-insert-object-dialog.c \
        hildon-insert-object-dialog.h \
-    hildon-file-details-dialog.c \
+       hildon-file-details-dialog.c \
        hildon-file-details-dialog.h \
-    hildon-grid.c \
-    hildon-grid.h \
+       hildon-grid.c \
+       hildon-grid.h \
        hildon-grid-item.c \
        hildon-grid-item.h \
        hildon-grid-item-private.h \
        hildon-file-handling-note.c \
        hildon-file-handling-note.h \
        hildon-name-password-dialog.c \
-    hildon-name-password-dialog.h \
-    hildon-find-replace-dialog.c \
-       hildon-find-replace-dialog.h \
+       hildon-name-password-dialog.h \
        hildon-scroll-area.c \
        hildon-scroll-area.h \
        hildon-wizard-dialog.c \
@@ -84,13 +82,21 @@ libhildonwidgets_la_SOURCES = \
        hildon-color-button.c \
        hildon-color-button.h
 
+hildon-marshalers.h: hildon-marshalers.list
+       glib-genmarshal --prefix _hildon_marshal --header \
+                       hildon-marshalers.list >hildon-marshalers.h
+
+hildon-marshalers.c: hildon-marshalers.list hildon-marshalers.h
+       echo '#include "hildon-marshalers.h"' >hildon-marshalers.c
+       glib-genmarshal --prefix _hildon_marshal --body \
+                       hildon-marshalers.list >>hildon-marshalers.c
+
 hildonwidgetsincludeinstdir=$(includedir)/hildon-widgets
 hildonwidgetsincludeinst_DATA = \
        hildon-controlbar.h \
        hildon-note.h \
        hildon-seekbar.h \
        hildon-color-selector.h \
-       hildon-search.h \
        hildon-volumebar.h \
        hildon-hvolumebar.h \
        hildon-vvolumebar.h \
@@ -107,15 +113,13 @@ hildonwidgetsincludeinst_DATA = \
        hildon-set-password-dialog.h \
        hildon-sort-dialog.h \
        hildon-add-home-dialog.h \
-       hildon-find-object-dialog.h \
        hildon-font-selection-dialog.h \
        hildon-insert-object-dialog.h \
        hildon-file-details-dialog.h \
        hildon-grid.h \
        hildon-grid-item.h \
        hildon-file-handling-note.h \
-    hildon-name-password-dialog.h \
-       hildon-find-replace-dialog.h \
+       hildon-name-password-dialog.h \
        hildon-scroll-area.h \
        hildon-wizard-dialog.h \
        hildon-color-popup.h \
index c12f218..7a5d134 100644 (file)
@@ -59,8 +59,6 @@ CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOXYGEN_FOUND = @DOXYGEN_FOUND@
@@ -169,22 +167,26 @@ sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
-INCLUDES = $(GTK_CFLAGS) $(GNOME_VFS_CFLAGS) $(GCONF_CFLAGS) $(DBUS_CFLAGS) \
-       -DLOCALEDIR=\"$(localedir)\" -I$(srcdir)/..
+INCLUDES = $(GTK_CFLAGS) $(GNOME_VFS_CFLAGS) $(GCONF_CFLAGS) \
+          $(ESD_CFLAGS) -DLOCALEDIR=\"$(localedir)\" -I$(srcdir)/..
 
 
 lib_LTLIBRARIES = libhildonwidgets.la
 
-EXTRA_DIST = 
+EXTRA_DIST = hildon-marshalers.list
+
+libhildonwidgets_la_LDFLAGS = -version-info 5:0:5
 
 libhildonwidgets_la_LIBADD = $(GTK_LIBS) $(GNOME_VFS_LIBS) $(GCONF_LIBS) \
-       $(DBUS_LIBS)
+                            $(ESD_LIBS)
+
 
-libhildonwidgets_la_LDFLAGS = -version-info 3:0:3
 libhildonwidgets_la_SOURCES = \
-  hildon-composite-widget.c \
+       hildon-marshalers.c \
+       hildon-marshalers.h \
+       hildon-composite-widget.c \
        hildon-composite-widget.h \
-  hildon-controlbar.c \
+       hildon-controlbar.c \
        hildon-controlbar.h \
        hildon-seekbar.c \
        hildon-seekbar.h \
@@ -192,8 +194,6 @@ libhildonwidgets_la_SOURCES = \
        hildon-color-selector.h \
        hildon-note.c \
        hildon-note.h \
-       hildon-search.c \
-       hildon-search.h \
        hildon-volumebar.c \
        hildon-volumebar.h \
        hildon-volumebar-range.c \
@@ -229,25 +229,21 @@ libhildonwidgets_la_SOURCES = \
        hildon-sort-dialog.h \
        hildon-add-home-dialog.c \
        hildon-add-home-dialog.h \
-       hildon-find-object-dialog.c \
-       hildon-find-object-dialog.h \
        hildon-font-selection-dialog.c \
        hildon-font-selection-dialog.h \
        hildon-insert-object-dialog.c \
        hildon-insert-object-dialog.h \
-    hildon-file-details-dialog.c \
+       hildon-file-details-dialog.c \
        hildon-file-details-dialog.h \
-    hildon-grid.c \
-    hildon-grid.h \
+       hildon-grid.c \
+       hildon-grid.h \
        hildon-grid-item.c \
        hildon-grid-item.h \
        hildon-grid-item-private.h \
        hildon-file-handling-note.c \
        hildon-file-handling-note.h \
        hildon-name-password-dialog.c \
-    hildon-name-password-dialog.h \
-    hildon-find-replace-dialog.c \
-       hildon-find-replace-dialog.h \
+       hildon-name-password-dialog.h \
        hildon-scroll-area.c \
        hildon-scroll-area.h \
        hildon-wizard-dialog.c \
@@ -264,7 +260,6 @@ hildonwidgetsincludeinst_DATA = \
        hildon-note.h \
        hildon-seekbar.h \
        hildon-color-selector.h \
-       hildon-search.h \
        hildon-volumebar.h \
        hildon-hvolumebar.h \
        hildon-vvolumebar.h \
@@ -281,15 +276,13 @@ hildonwidgetsincludeinst_DATA = \
        hildon-set-password-dialog.h \
        hildon-sort-dialog.h \
        hildon-add-home-dialog.h \
-       hildon-find-object-dialog.h \
        hildon-font-selection-dialog.h \
        hildon-insert-object-dialog.h \
        hildon-file-details-dialog.h \
        hildon-grid.h \
        hildon-grid-item.h \
        hildon-file-handling-note.h \
-    hildon-name-password-dialog.h \
-       hildon-find-replace-dialog.h \
+       hildon-name-password-dialog.h \
        hildon-scroll-area.h \
        hildon-wizard-dialog.h \
        hildon-color-popup.h \
@@ -303,23 +296,23 @@ CONFIG_CLEAN_FILES =
 LTLIBRARIES = $(lib_LTLIBRARIES)
 
 libhildonwidgets_la_DEPENDENCIES =
-am_libhildonwidgets_la_OBJECTS = hildon-composite-widget.lo \
-       hildon-controlbar.lo hildon-seekbar.lo hildon-color-selector.lo \
-       hildon-note.lo hildon-search.lo hildon-volumebar.lo \
-       hildon-volumebar-range.lo hildon-hvolumebar.lo \
-       hildon-vvolumebar.lo hildon-dialoghelp.lo \
+am_libhildonwidgets_la_OBJECTS = hildon-marshalers.lo \
+       hildon-composite-widget.lo hildon-controlbar.lo \
+       hildon-seekbar.lo hildon-color-selector.lo hildon-note.lo \
+       hildon-volumebar.lo hildon-volumebar-range.lo \
+       hildon-hvolumebar.lo hildon-vvolumebar.lo hildon-dialoghelp.lo \
        hildon-calendar-popup.lo hildon-date-editor.lo \
        hildon-time-editor.lo hildon-time-picker.lo \
        hildon-weekday-picker.lo hildon-telephone-editor.lo \
        hildon-number-editor.lo hildon-range-editor.lo \
        hildon-get-password-dialog.lo hildon-set-password-dialog.lo \
        hildon-sort-dialog.lo hildon-add-home-dialog.lo \
-       hildon-find-object-dialog.lo hildon-font-selection-dialog.lo \
-       hildon-insert-object-dialog.lo hildon-file-details-dialog.lo \
-       hildon-grid.lo hildon-grid-item.lo hildon-file-handling-note.lo \
-       hildon-name-password-dialog.lo hildon-find-replace-dialog.lo \
-       hildon-scroll-area.lo hildon-wizard-dialog.lo \
-       hildon-color-popup.lo hildon-color-button.lo
+       hildon-font-selection-dialog.lo hildon-insert-object-dialog.lo \
+       hildon-file-details-dialog.lo hildon-grid.lo \
+       hildon-grid-item.lo hildon-file-handling-note.lo \
+       hildon-name-password-dialog.lo hildon-scroll-area.lo \
+       hildon-wizard-dialog.lo hildon-color-popup.lo \
+       hildon-color-button.lo
 libhildonwidgets_la_OBJECTS = $(am_libhildonwidgets_la_OBJECTS)
 
 DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)
@@ -336,20 +329,18 @@ am__depfiles_maybe = depfiles
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-dialoghelp.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-file-details-dialog.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-file-handling-note.Plo \
-@AMDEP_TRUE@   ./$(DEPDIR)/hildon-find-object-dialog.Plo \
-@AMDEP_TRUE@   ./$(DEPDIR)/hildon-find-replace-dialog.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-font-selection-dialog.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-get-password-dialog.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-grid-item.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-grid.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-hvolumebar.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-insert-object-dialog.Plo \
+@AMDEP_TRUE@   ./$(DEPDIR)/hildon-marshalers.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-name-password-dialog.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-note.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-number-editor.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-range-editor.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-scroll-area.Plo \
-@AMDEP_TRUE@   ./$(DEPDIR)/hildon-search.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-seekbar.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-set-password-dialog.Plo \
 @AMDEP_TRUE@   ./$(DEPDIR)/hildon-sort-dialog.Plo \
@@ -431,20 +422,18 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-dialoghelp.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-file-details-dialog.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-file-handling-note.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-find-object-dialog.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-find-replace-dialog.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-font-selection-dialog.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-get-password-dialog.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-grid-item.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-grid.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-hvolumebar.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-insert-object-dialog.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-marshalers.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-name-password-dialog.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-note.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-number-editor.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-range-editor.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-scroll-area.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-search.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-seekbar.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-set-password-dialog.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hildon-sort-dialog.Plo@am__quote@
@@ -697,6 +686,15 @@ uninstall-am: uninstall-hildonwidgetsincludeinstDATA uninstall-info-am \
        uninstall-hildonwidgetsincludeinstDATA uninstall-info-am \
        uninstall-libLTLIBRARIES
 
+
+hildon-marshalers.h: hildon-marshalers.list
+       glib-genmarshal --prefix _hildon_marshal --header \
+                       hildon-marshalers.list >hildon-marshalers.h
+
+hildon-marshalers.c: hildon-marshalers.list hildon-marshalers.h
+       echo '#include "hildon-marshalers.h"' >hildon-marshalers.c
+       glib-genmarshal --prefix _hildon_marshal --body \
+                       hildon-marshalers.list >>hildon-marshalers.c
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
index 866015a..0021dcf 100644 (file)
@@ -72,8 +72,6 @@ static void hildon_calendar_allow_exit(GtkWidget * self, gpointer data);
 
 static gboolean hildon_calendar_deny_exit(GtkWidget * self);
 
-static gboolean
-hildon_calendar_erroneous_date(GtkWidget * widget, gpointer data);
 static gboolean hildon_key_pressed(GtkWidget * widget, GdkEventKey * event,
                                    gpointer data);
 
@@ -209,6 +207,7 @@ static void hildon_calendar_popup_init(HildonCalendarPopup * cal)
 {
     HildonCalendarPopupPrivate *priv;
     static int set_domain = 1;
+    gchar *week_start;
 
     priv = HILDON_CALENDAR_POPUP_GET_PRIVATE(cal);
 
@@ -220,6 +219,12 @@ static void hildon_calendar_popup_init(HildonCalendarPopup * cal)
     priv->can_exit = FALSE;
     priv->cal = gtk_calendar_new();
 
+    /* first day of the week is obtained from the PO file */
+    week_start = _("week_start");
+    if (week_start[0] >= '0' && week_start[0] <= '6' && week_start[1] == 0)
+      g_object_set(G_OBJECT(priv->cal),
+                   "week-start", week_start[0] - '0', NULL);
+
     gtk_calendar_set_display_options(GTK_CALENDAR(priv->cal),
                                      GTK_CALENDAR_SHOW_HEADING |
                                      GTK_CALENDAR_SHOW_DAY_NAMES |
@@ -245,9 +250,6 @@ static void hildon_calendar_popup_init(HildonCalendarPopup * cal)
     g_signal_connect_swapped(G_OBJECT(priv->cal), "button-press-event",
                              G_CALLBACK(hildon_calendar_deny_exit), cal);
 
-    g_signal_connect(G_OBJECT(priv->cal), "erroneous_date",
-                     G_CALLBACK(hildon_calendar_erroneous_date), cal);
-    
     g_signal_connect(G_OBJECT(priv->cal), "selected_date",
                      G_CALLBACK(hildon_calendar_allow_exit), cal);
 
@@ -256,15 +258,6 @@ static void hildon_calendar_popup_init(HildonCalendarPopup * cal)
     gtk_widget_grab_focus(priv->cal);
 }
 
-static gboolean hildon_calendar_erroneous_date(GtkWidget * widget,
-                                               gpointer data)
-{
-    gtk_infoprint(GTK_WINDOW(gtk_widget_get_ancestor(GTK_WIDGET(widget),
-                                                     GTK_TYPE_WINDOW)),
-                  _("Date should be between 01/01/1980 and 12/31/2100."));
-    return TRUE;
-}
-
 static gboolean
 hildon_calendar_day_selected(GtkWidget * widget, gpointer data)
 {
index 8879865..d2f5ca3 100644 (file)
@@ -152,12 +152,12 @@ hildon_color_popup_new(GtkWindow *parent, GdkColor *initial_color,
                       G_CALLBACK(hildon_popup_palette_expose), 
                       popup_data);
   
-  popup = gtk_dialog_new_with_buttons (_("ecdg_ti_colour_selector"), 
+  popup = gtk_dialog_new_with_buttons (_("ecdg_ti_5bit_colour_selector"), 
                                        GTK_WINDOW(parent),
                                        GTK_DIALOG_DESTROY_WITH_PARENT |
                                        GTK_DIALOG_NO_SEPARATOR,
-                                       _("ecdg_bd_colour_selector_ok"), GTK_RESPONSE_OK,
-                                       _("ecdg_bd_colour_selector_cancel"),
+                                       _("ecdg_bd_5bit_colour_selector_ok"), GTK_RESPONSE_OK,
+                                       _("Ecdg_bd_5bit_colour_selector_cancel"),
                                        GTK_RESPONSE_CANCEL,
                                        NULL);
 
index c0a1bd4..fe68d32 100644 (file)
@@ -38,6 +38,7 @@
 #include <gtk/gtkhbox.h>
 #include <gtk/gtklabel.h>
 #include <gtk/gtkdrawingarea.h>
+#include <gtk/gtkbutton.h>
 #include <gdk/gdkkeysyms.h>
 #include <gconf/gconf-client.h> 
 
@@ -69,8 +70,6 @@
 #define HILDON_COLOR_PALETTE_POS_PAD      45
 #define HILDON_COLOR_BAR_WIDTH 449
 
-#define HILDON_MORE_BUTTON_RESPONSE     1234
-
 /* gconf definitions */
 #define HILDON_COLOR_GCONF_PATH  "/system/osso/af/color_selector"
 #define HILDON_COLOR_GCONF_KEYS  "/system/osso/af/color_selector/custom_colors"
@@ -83,6 +82,7 @@ struct _HildonColorSelectorPriv
 {
     GConfClient *client;
     GtkWidget *drawing_area;
+    GtkWidget *modify_button;
     gint index;
     guint notify_id;
 
@@ -104,15 +104,9 @@ hildon_color_selector_expose (GtkWidget * widget,
                               GdkEventExpose * event, 
                               gpointer data);
 
-static void 
-hildon_color_selector_response (GtkWidget * widget,
-                               gint response_id, 
-                               gpointer data);
-
 static gboolean 
 key_pressed (GtkWidget * widget, 
-             GdkEventKey * event, 
-             gpointer user_data);
+             GdkEventKey * event);
 
 static gboolean 
 color_pressed (GtkWidget * widget, 
@@ -122,14 +116,22 @@ color_pressed (GtkWidget * widget,
 static void
 select_color (HildonColorSelector * selector, 
               int event_x, 
-              int event_y);   
+              int event_y,
+              gboolean motion);
 
 static gboolean
 color_moved (GtkWidget * widget, 
              GdkEventMotion * event, 
              gpointer data);
 
-GType 
+static void
+modify_button_clicked (GtkWidget * button,
+                       HildonColorSelector * selector);
+
+static void
+modify_selected(HildonColorSelector * colselector);
+
+GType
 hildon_color_selector_get_type(void)
 {
     static GType selector_type = 0;
@@ -173,8 +175,12 @@ hildon_color_selector_destroy(GtkObject *obj)
 static void
 hildon_color_selector_class_init(HildonColorSelectorClass * selector_class)
 {
+    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(selector_class);
+
     parent_class = g_type_class_peek_parent(selector_class);
-    
+
+    widget_class->key_press_event = key_pressed;
+
     g_type_class_add_private(selector_class,
                              sizeof(HildonColorSelectorPriv));
 
@@ -216,7 +222,7 @@ hildon_color_selector_set_custom_colors(
   g_assert(HILDON_IS_COLOR_SELECTOR(selector));
 
   /* We have to be really carefull. At least gconftool's
-     stress test can generate pretty ugly value setups */
+     stress test may generate unexpected value setups */
   if (value == NULL || value->type != GCONF_VALUE_LIST ||
     gconf_value_get_list_type(value) != GCONF_VALUE_STRING)
     list = NULL;
@@ -340,24 +346,25 @@ hildon_color_selector_init(HildonColorSelector * selector)
                       G_CALLBACK(color_pressed), selector);
     g_signal_connect (selector->priv->drawing_area, "motion-notify-event", 
                       G_CALLBACK(color_moved), selector);
-    g_signal_connect (selector, "key-press-event",
-                      G_CALLBACK(key_pressed), selector);
-
 
     gtk_dialog_add_button (GTK_DIALOG(selector), 
                            _("ecdg_bd_colour_selector_ok"), GTK_RESPONSE_OK);
-    gtk_dialog_add_button (GTK_DIALOG(selector),
-                           _("ecdg_ti_5bit_colour_selector"),
-                           HILDON_MORE_BUTTON_RESPONSE);
+
+    selector->priv->modify_button =
+        gtk_button_new_with_label(_("ecdg_bd_colour_selector_modify"));
+    gtk_widget_set_sensitive(selector->priv->modify_button, FALSE);
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(selector)->action_area),
+                       selector->priv->modify_button, FALSE, TRUE, 0);
+
+    g_signal_connect(selector->priv->modify_button, "clicked",
+                     G_CALLBACK(modify_button_clicked), selector);
+
     gtk_dialog_add_button (GTK_DIALOG(selector),
                            _("ecdg_bd_colour_selector_cancel"),
                            GTK_RESPONSE_CANCEL);
 
     gtk_dialog_set_default_response (GTK_DIALOG(selector), GTK_RESPONSE_OK);
     
-    g_signal_connect (G_OBJECT(selector), "response",
-                      G_CALLBACK(hildon_color_selector_response), selector);
-
     gtk_window_set_title ( GTK_WINDOW(selector),  
                           _("ecdg_ti_colour_selector") );
     gtk_widget_show_all (GTK_DIALOG(selector)->vbox);
@@ -476,6 +483,8 @@ void hildon_color_selector_set_color(HildonColorSelector * selector,
             selector->priv->color[i].blue  == color->blue) 
         {
             selector->priv->index = i;
+            gtk_widget_set_sensitive(selector->priv->modify_button,
+                                     selector->priv->index >= HILDON_BASE_COLOR_NUM);
             gtk_widget_queue_draw(selector->priv->drawing_area);
             break;
         }
@@ -486,25 +495,24 @@ static gboolean
 color_pressed(GtkWidget * widget, GdkEventButton * event,
               gpointer user_data)
 {
-    select_color(HILDON_COLOR_SELECTOR(user_data), event->x, event->y);
+    select_color(HILDON_COLOR_SELECTOR(user_data), event->x, event->y, FALSE);
     return TRUE;
 }
 
 static gboolean key_pressed(GtkWidget * widget,
-                            GdkEventKey * event, gpointer user_data)
+                            GdkEventKey * event)
 {
     HildonColorSelector *selector;
     gint index;
 
     g_return_val_if_fail(widget, FALSE);
-    g_return_val_if_fail(user_data, FALSE);
 
-    selector = HILDON_COLOR_SELECTOR(user_data);
+    selector = HILDON_COLOR_SELECTOR(widget);
     index = selector->priv->index;
 
     /* if dialog buttons has the focus */
     if (GTK_WIDGET_HAS_FOCUS(selector->priv->drawing_area) == FALSE)
-        return FALSE;
+        return GTK_WIDGET_CLASS(parent_class)->key_press_event(widget, event);
 
     /* go for if available index otherwise stop keypress handler because
        wrapping around is not allowed. */
@@ -537,7 +545,7 @@ static gboolean key_pressed(GtkWidget * widget,
         } 
         else 
         {
-            return FALSE;
+            return GTK_WIDGET_CLASS(parent_class)->key_press_event(widget, event);
         }
         break;
     case GDK_KP_Down:
@@ -548,11 +556,17 @@ static gboolean key_pressed(GtkWidget * widget,
         } 
         else 
         {
-            return FALSE;
+            return GTK_WIDGET_CLASS(parent_class)->key_press_event(widget, event);
         }
         break;
+    case GDK_KP_Enter:
+    case GDK_Return:
+        if (index < HILDON_BASE_COLOR_NUM)
+            return GTK_WIDGET_CLASS(parent_class)->key_press_event(widget, event);
+
+        modify_selected(selector);
     default:
-        return FALSE;
+        return GTK_WIDGET_CLASS(parent_class)->key_press_event(widget, event);
     }
 
     if (index < (HILDON_BASE_COLOR_NUM + HILDON_CUSTOM_COLOR_NUM)) 
@@ -564,14 +578,17 @@ static gboolean key_pressed(GtkWidget * widget,
         selector->priv->index = 
             HILDON_BASE_COLOR_NUM + HILDON_CUSTOM_COLOR_NUM - 1;
     }
-    
+    gtk_widget_set_sensitive(selector->priv->modify_button,
+                             selector->priv->index >= HILDON_BASE_COLOR_NUM);
+
     gtk_widget_queue_draw(selector->priv->drawing_area);
     
     return TRUE;
 }
 
 static void
-select_color(HildonColorSelector * selector, int event_x, int event_y)
+select_color(HildonColorSelector * selector, int event_x, int event_y,
+             gboolean motion)
 {
     gint x, y;
 
@@ -603,8 +620,15 @@ select_color(HildonColorSelector * selector, int event_x, int event_y)
     {
         y = 0;
     }
-    
+
+    if (!motion &&
+        selector->priv->index >= HILDON_BASE_COLOR_NUM &&
+        selector->priv->index == (x + y * HILDON_COLOR_SELECTOR_COLS))
+        modify_selected(selector);
+
     selector->priv->index = (x + y * HILDON_COLOR_SELECTOR_COLS);
+    gtk_widget_set_sensitive(selector->priv->modify_button,
+                             selector->priv->index >= HILDON_BASE_COLOR_NUM);
     
     gtk_widget_queue_draw(selector->priv->drawing_area);
 }
@@ -615,29 +639,24 @@ color_moved(GtkWidget * widget, GdkEventMotion * event, gpointer data)
     if ( event->state &
          (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK) ) 
     {
-        select_color(HILDON_COLOR_SELECTOR(data), event->x, event->y);
+        select_color(HILDON_COLOR_SELECTOR(data), event->x, event->y, TRUE);
         return TRUE;
     }
     return FALSE;
 }
 
-static void 
-hildon_color_selector_response(GtkWidget * widget,
-                               gint response_id, 
-                               gpointer data)
+static void
+modify_button_clicked(GtkWidget * button, HildonColorSelector * selector)
+{
+    modify_selected (selector);
+}
+
+static void
+modify_selected(HildonColorSelector * colselector)
 {
-    HildonColorSelector * colselector;
     HildonColorPopup popupdata;
     GtkWidget *popup;
 
-    g_return_if_fail (HILDON_IS_COLOR_SELECTOR(data));
-
-    if (response_id != HILDON_MORE_BUTTON_RESPONSE)
-        return;
-
-    g_signal_stop_emission_by_name (widget, "response");
-    colselector = HILDON_COLOR_SELECTOR(data);
-
     popup = hildon_color_popup_new(GTK_WINDOW(GTK_WIDGET(colselector)->window), 
                    hildon_color_selector_get_color(colselector), &popupdata);
     
index b4cb5ce..cf1e75a 100644 (file)
 #include "hildon-composite-widget.h"
 
 gboolean
-hildon_composite_widget_focus( GtkWidget *widget, GtkDirectionType direction )
+hildon_composite_widget_focus (GtkWidget *widget, GtkDirectionType direction)
 {
   GtkWidget *toplevel = NULL;
   GtkWidget *focus_widget = NULL;
   
-  toplevel = gtk_widget_get_toplevel(widget);
-  if( !GTK_IS_WINDOW(toplevel) )
-    return GTK_WIDGET_CLASS(g_type_class_peek_parent(
-                     GTK_WIDGET_GET_CLASS(widget)))->focus( widget, direction );
+  toplevel = gtk_widget_get_toplevel (widget);
+  if (!GTK_IS_WINDOW(toplevel))
+    return GTK_WIDGET_CLASS (g_type_class_peek_parent (
+                     GTK_WIDGET_GET_CLASS (widget)))->focus (widget, direction);
 
-  focus_widget = GTK_WINDOW(toplevel)->focus_widget;  
+  focus_widget = GTK_WINDOW (toplevel)->focus_widget;
 
-  if( !gtk_widget_is_ancestor( focus_widget, widget ) )
+  if (!GTK_IS_WIDGET (focus_widget))
+    return TRUE;
+
+  if (!gtk_widget_is_ancestor (focus_widget, widget))
     /* Containers grab_focus grabs the focus to the correct widget */
-    gtk_widget_grab_focus( widget );
+    gtk_widget_grab_focus (widget);
   else
-    return GTK_WIDGET_CLASS(g_type_class_peek_parent(
-                     GTK_WIDGET_GET_CLASS(widget)))->focus( widget, direction );
+    return GTK_WIDGET_CLASS (g_type_class_peek_parent (
+                     GTK_WIDGET_GET_CLASS(widget)))->focus (widget, direction);
 
   return TRUE;
 }
index e243d90..fd6ba5d 100644 (file)
@@ -36,7 +36,7 @@
 #include "hildon-controlbar.h"
 
 #include <libintl.h>
-#define _(String) gettext(String)
+#define _(string) dgettext(PACKAGE, string)
 
 #define HILDON_CONTROLBAR_GET_PRIVATE(obj) \
     (G_TYPE_INSTANCE_GET_PRIVATE ((obj),\
@@ -57,6 +57,13 @@ static GtkScaleClass *parent_class;
 
 typedef struct _HildonControlbarPrivate HildonControlbarPrivate;
 
+enum
+{
+  PROP_MIN = 1,
+  PROP_MAX,
+  PROP_VALUE
+};
+
 static void
 hildon_controlbar_class_init(HildonControlbarClass * controlbar_class);
 static void hildon_controlbar_init(HildonControlbar * controlbar);
@@ -77,6 +84,11 @@ hildon_controlbar_paint(HildonControlbar * self, GdkRectangle * area);
 static gboolean
 hildon_controlbar_keypress(GtkWidget * widget, GdkEventKey * event);
 
+static void hildon_controlbar_set_property( GObject *object, guint param_id,
+                                       const GValue *value, GParamSpec *pspec );
+static void hildon_controlbar_get_property( GObject *object, guint param_id,
+                                         GValue *value, GParamSpec *pspec );
+
 static void
 hildon_controlbar_value_changed( GtkAdjustment *adj, GtkRange *range );
 
@@ -111,6 +123,7 @@ struct _HildonControlbarPrivate {
 static void
 hildon_controlbar_class_init(HildonControlbarClass * controlbar_class)
 {
+  GObjectClass *gobject_class = G_OBJECT_CLASS(controlbar_class);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(controlbar_class);
 
   parent_class = g_type_class_peek_parent(controlbar_class);
@@ -118,6 +131,8 @@ hildon_controlbar_class_init(HildonControlbarClass * controlbar_class)
   g_type_class_add_private(controlbar_class,
                            sizeof(HildonControlbarPrivate));
 
+  gobject_class->get_property = hildon_controlbar_get_property;
+  gobject_class->set_property = hildon_controlbar_set_property;
   widget_class->size_request = hildon_controlbar_size_request;
   widget_class->button_press_event = hildon_controlbar_button_press_event;
   widget_class->button_release_event = hildon_controlbar_button_release_event;
@@ -125,10 +140,50 @@ hildon_controlbar_class_init(HildonControlbarClass * controlbar_class)
   widget_class->key_press_event = hildon_controlbar_keypress;
   G_OBJECT_CLASS(controlbar_class)->constructor = hildon_controlbar_constructor;
 
+  /**
+   * HildonControlbar:min:
+   *
+   * Controlbar minimum value.
+   */
+  g_object_class_install_property( gobject_class, PROP_MIN,
+                                   g_param_spec_int("min",
+                                   "Minimum value",
+                                   "Smallest possible value",
+                                   G_MININT, G_MAXINT,
+                                   HILDON_CONTROLBAR_LOWER_VALUE,
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  /**
+   * HildonControlbar:max:
+   *
+   * Controlbar maximum value.
+   */
+  g_object_class_install_property( gobject_class, PROP_MAX,
+                                   g_param_spec_int("max",
+                                   "Maximum value",
+                                   "Greatest possible value",
+                                   G_MININT, G_MAXINT, 
+                                   HILDON_CONTROLBAR_UPPER_VALUE,
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  /**
+   * HildonControlbar:value:
+   *
+   * Controlbar value.
+   */
+  g_object_class_install_property( gobject_class, PROP_VALUE,
+                                   g_param_spec_int("value",
+                                   "Current value",
+                                   "Current value",
+                                   G_MININT, G_MAXINT,
+                                   HILDON_CONTROLBAR_INITIAL_VALUE,
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+
   gtk_widget_class_install_style_property(widget_class,
                                  g_param_spec_uint("inner_border_width",
                                                    "Inner border width",
-                                                   "The border spacing between the controlbar border and controlbar blocks.",
+                       "The border spacing between the controlbar border and controlbar blocks.",
                                                    0, G_MAXINT,
                                                    DEFAULT_BORDER_WIDTH,
                                                    G_PARAM_READABLE));
@@ -167,14 +222,61 @@ static GObject *hildon_controlbar_constructor(GType type,
   adj->step_increment = HILDON_CONTROLBAR_STEP_INCREMENT;
   adj->page_increment = HILDON_CONTROLBAR_PAGE_INCREMENT;
   adj->page_size = HILDON_CONTROLBAR_PAGE_SIZE;
-  adj->upper = HILDON_CONTROLBAR_UPPER_VALUE;
-  adj->lower = HILDON_CONTROLBAR_LOWER_VALUE;
-  adj->value = HILDON_CONTROLBAR_INITIAL_VALUE;
+
   g_signal_connect( adj, "value-changed", 
                     G_CALLBACK(hildon_controlbar_value_changed), obj );
   return obj;
 }
 
+static void hildon_controlbar_set_property (GObject *object, guint param_id,
+                                       const GValue *value, GParamSpec *pspec)
+{
+  HildonControlbar *controlbar = HILDON_CONTROLBAR(object);
+  switch (param_id)
+  {
+    case PROP_MIN:
+      hildon_controlbar_set_min (controlbar, g_value_get_int(value));
+      break;
+
+    case PROP_MAX:
+      hildon_controlbar_set_max (controlbar, g_value_get_int(value));
+      break;
+
+    case PROP_VALUE:
+      hildon_controlbar_set_value (controlbar, g_value_get_int(value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+  }
+}
+
+static void hildon_controlbar_get_property( GObject *object, guint param_id,
+                                         GValue *value, GParamSpec *pspec )
+{
+  HildonControlbar *controlbar = HILDON_CONTROLBAR(object);
+  switch (param_id)
+  {
+    case PROP_MIN:
+      g_value_set_int (value, hildon_controlbar_get_min (controlbar));
+      break;
+
+    case PROP_MAX:
+      g_value_set_int (value, hildon_controlbar_get_max (controlbar));
+      break;
+
+    case PROP_VALUE:
+      g_value_set_int (value, hildon_controlbar_get_value (controlbar));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+  }
+}
+
+
 static void
 hildon_controlbar_value_changed( GtkAdjustment *adj, GtkRange *range )
 {
@@ -244,6 +346,8 @@ void hildon_controlbar_set_value(HildonControlbar * self, gint value)
 
     adj->value = value;
     gtk_adjustment_value_changed(adj);
+
+    g_object_notify (G_OBJECT(self), "value");
 }
 
 /**
@@ -282,17 +386,15 @@ void hildon_controlbar_set_max(HildonControlbar * self, gint max)
     adj = GTK_RANGE(self)->adjustment;
 
     if (max < adj->lower)
-        return;
-    else if( max == adj->lower )
-      gtk_widget_set_sensitive( GTK_WIDGET(self), FALSE );
-    else
-      gtk_widget_set_sensitive( GTK_WIDGET(self), TRUE );
+      max = adj->lower;
     
     if (adj->value > max)
-        adj->value = max;
+        hildon_controlbar_set_value (self, max);
 
     adj->upper = max;
     gtk_adjustment_changed(adj);
+
+    g_object_notify (G_OBJECT(self), "max");
 }
 
 /**
@@ -313,18 +415,15 @@ void hildon_controlbar_set_min(HildonControlbar * self, gint min)
     g_return_if_fail (HILDON_IS_CONTROLBAR (self));
     adj = GTK_RANGE(self)->adjustment;
 
-    if (min < 0 || min >= adj->upper)
-        return;
-    else if( min == adj->upper )
-      gtk_widget_set_sensitive( GTK_WIDGET(self), FALSE );
-    else
-      gtk_widget_set_sensitive( GTK_WIDGET(self), TRUE );
+    if (min > adj->upper)
+      min = adj->upper;
     
-    if (adj->value > min)
-        adj->value = min;
+    if (adj->value < min)
+        hildon_controlbar_set_value (self, min);
 
     adj->lower = min;
     gtk_adjustment_changed(adj);
+    g_object_notify (G_OBJECT(self), "min");
 }
 
 /**
@@ -347,25 +446,15 @@ void hildon_controlbar_set_min(HildonControlbar * self, gint min)
 void hildon_controlbar_set_range(HildonControlbar * self, gint min,
                                  gint max)
 {
-    GtkAdjustment *adj;
     g_return_if_fail (HILDON_IS_CONTROLBAR (self));
-    adj = GTK_RANGE(self)->adjustment;
 
-    if (min < 0 || min >= max)
-        return;
-
-    if (adj->value > max)
-        adj->value = max;
-
-    adj->upper = max;
-    adj->lower = min;
-    
-    if( adj->upper == adj->lower )
-       gtk_widget_set_sensitive( GTK_WIDGET(self), FALSE );
-    else
-      gtk_widget_set_sensitive( GTK_WIDGET(self), TRUE );
-
-    gtk_adjustment_changed(adj);
+    if (min > max)
+      min = max;
+    /* We need to set max first here, because when min is set before
+     * max is set, it would end up 0, because max can't be bigger than 0.
+     */
+    hildon_controlbar_set_max (self, max);
+    hildon_controlbar_set_min (self, min);
 }
 
 /**
@@ -526,6 +615,7 @@ static void hildon_controlbar_paint(HildonControlbar * self,
 {
     HildonControlbarPrivate *priv;
     GtkWidget *widget = GTK_WIDGET(self);
+    GtkAdjustment *ctrlbar = GTK_RANGE(self)->adjustment;
     gint x = widget->allocation.x;
     gint y = widget->allocation.y;
     gint h = widget->allocation.height;
@@ -535,12 +625,15 @@ static void hildon_controlbar_paint(HildonControlbar * self,
     gint stepper_spacing = 0;
     gint inner_border_width = 0;
     gint block_area = 0, block_width = 0, block_x = 0, block_max = 0, block_height,block_y;
-    gint block_count = 0;
-    gint selected_blocks = 0;
+    /* Number of blocks on the controlbar */
+    guint block_count = 0;
+    /* Number of displayed active blocks */
+    guint block_act = 0;
+    /* Minimum no. of blocks visible */
+    guint block_min = 0;
     gint separatingpixels = 2;
     gint block_remains = 0;
     gint i, start_x, end_x, current_width;
-    gint minimum_visible_bars = 0;
     GtkStateType state = GTK_STATE_NORMAL;
 
     g_return_if_fail(area);
@@ -553,21 +646,21 @@ static void hildon_controlbar_paint(HildonControlbar * self,
                          "stepper-size", &stepper_size,
                          "stepper-spacing", &stepper_spacing,
                         "inner_border_width", &inner_border_width, NULL);
-    g_object_get(G_OBJECT(self), "minimum_visible_bars", &minimum_visible_bars, NULL);
+    g_object_get(G_OBJECT(self), "minimum_visible_bars", &block_min, NULL);
 
     block_area = (w - 2 * stepper_size - 2 * stepper_spacing - 2 * inner_border_width);
     if (block_area <= 0)
         return;
 
-    max = hildon_controlbar_get_max(self);
-    block_max = max - GTK_RANGE(self)->adjustment->lower + minimum_visible_bars; 
-    selected_blocks = priv->old_value - GTK_RANGE(self)->adjustment->lower;
+    block_max = ctrlbar->upper - ctrlbar->lower + block_min; 
+    block_act = priv->old_value - GTK_RANGE(self)->adjustment->lower + block_min;
  
     /* We check border width and maximum value and adjust
      * separating pixels for block width here. If the block size would
      * become too small, we make the separators smaller. Graceful fallback.
      */
-    if( max == 0 )
+    max = ctrlbar->upper;
+    if( ctrlbar->upper == 0 )
     {
       separatingpixels = 3;
     }
@@ -600,8 +693,7 @@ static void hildon_controlbar_paint(HildonControlbar * self,
     block_y = y + inner_border_width;
     block_height = h - 2 * inner_border_width;
 
-    block_count = hildon_controlbar_get_value(self)/* - GTK_RANGE(self)->adjustment->lower*/;
-    if (minimum_visible_bars == 0) block_count=block_count - GTK_RANGE(self)->adjustment->lower;
+    block_count = ctrlbar->value - ctrlbar->lower +  block_min;
 
     /* Without this there is vertical block corruption when block_height = 
        1. This should work from 0 up to whatever */
index d5f839a..2d31a8b 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <glib.h>
 #include <gtk/gtk.h>
+#include <gtk/gtkmarshal.h>
 #include <gdk/gdkkeysyms.h>
 #include <time.h>
 #include <stdlib.h>
@@ -47,6 +48,7 @@
 #include <hildon-widgets/hildon-calendar-popup.h>
 #include <hildon-widgets/gtk-infoprint.h>
 #include <hildon-widgets/hildon-defines.h>
+#include <hildon-widgets/hildon-input-mode-hint.h>
 #include "hildon-composite-widget.h"
 
 #ifdef HAVE_CONFIG_H
@@ -59,6 +61,7 @@
 #define MAX_DATE_LEN 256
 #define ENTRY_BORDERS 11
 #define DATE_EDITOR_HEIGHT 30
+#define BUTTON_SPACING 6
 
 #define DAY_ENTRY_WIDTH 2
 #define MONTH_ENTRY_WIDTH 2
@@ -100,8 +103,18 @@ hildon_date_editor_keyrelease(GtkWidget * widget, GdkEventKey * event,
                               gpointer data);
 
 static gboolean
-hildon_date_editor_focus_out(GtkWidget * widget, GdkEventFocus * event,
-                             gpointer data);
+hildon_date_editor_entry_focus_out(GtkWidget * widget, GdkEventFocus * event,
+                                   gpointer data);
+
+static gboolean hildon_date_editor_validate_date(HildonDateEditor *editor);
+
+static gboolean hildon_date_editor_entry_focusin(GtkWidget * widget,
+                                                 GdkEventFocus * event,
+                                                 gpointer data);
+static void hildon_date_editor_get_property( GObject *object, guint param_id,
+                                         GValue *value, GParamSpec *pspec );
+static void hildon_date_editor_set_property (GObject *object, guint param_id,
+                                       const GValue *value, GParamSpec *pspec);
 static gboolean
 hildon_date_editor_mnemonic_activate(GtkWidget *widget, gboolean group_cycling);
 
@@ -123,6 +136,13 @@ hildon_date_editor_check_locale_settings(HildonDateEditor * editor);
 
 static void hildon_date_editor_finalize(GObject * object);
 
+enum
+{
+  PROP_DAY = 1,
+  PROP_MONTH,
+  PROP_YEAR
+};
+
 struct _HildonDateEditorPrivate {
     guint year; /* current year in the entry */
     guint month;        /* current month in the entry */
@@ -160,6 +180,13 @@ enum {
     YEAR_MONTH_DAY
 };
 
+enum {
+    VALIDATE_DATE,
+    LAST_SIGNAL
+};
+
+static guint date_editor_signals[LAST_SIGNAL] = { 0 };
+
 GType hildon_date_editor_get_type(void)
 {
     static GType editor_type = 0;
@@ -188,12 +215,15 @@ hildon_date_editor_class_init(HildonDateEditorClass * editor_class)
 {
     GtkContainerClass *container_class = GTK_CONTAINER_CLASS(editor_class);
     GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(editor_class);
-
+    GObjectClass *gobject_class = G_OBJECT_CLASS (editor_class);
+    
     parent_class = g_type_class_peek_parent(editor_class);
 
     g_type_class_add_private(editor_class,
                              sizeof(HildonDateEditorPrivate));
 
+    gobject_class->set_property = hildon_date_editor_set_property;
+    gobject_class->get_property = hildon_date_editor_get_property;
     widget_class->mnemonic_activate = hildon_date_editor_mnemonic_activate;
     widget_class->size_request = hildon_date_editor_size_request;
     widget_class->size_allocate = hildon_date_editor_size_allocate;
@@ -201,7 +231,58 @@ hildon_date_editor_class_init(HildonDateEditorClass * editor_class)
 
     container_class->forall = hildon_child_forall;
     GTK_OBJECT_CLASS(editor_class)->destroy = hildon_date_editor_destroy;
-    G_OBJECT_CLASS(editor_class)->finalize = hildon_date_editor_finalize;
+    gobject_class->finalize = hildon_date_editor_finalize;
+
+    editor_class->validate_date = hildon_date_editor_validate_date; 
+
+    
+    date_editor_signals[VALIDATE_DATE] =
+        g_signal_new("validate-date",
+                G_OBJECT_CLASS_TYPE(gobject_class),
+                G_SIGNAL_RUN_LAST,
+                G_STRUCT_OFFSET(HildonDateEditorClass, validate_date),
+                NULL, NULL,
+                gtk_marshal_BOOLEAN__VOID,
+                G_TYPE_BOOLEAN, 0);
+
+  /**
+   * HildonDateEditor:year:
+   *
+   * Current year.
+   */
+  g_object_class_install_property( gobject_class, PROP_YEAR,
+                                   g_param_spec_uint("year",
+                                   "Current year",
+                                   "Current year",
+                                   1, G_MAXUINT,
+                                   2005,
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  /**
+   * HildonControlbar:month:
+   *
+   * Current month.
+   */
+  g_object_class_install_property( gobject_class, PROP_MONTH,
+                                   g_param_spec_uint("month",
+                                   "Current month",
+                                   "Current month",
+                                   1, 12,
+                                   1,
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  /**
+   * HildonControlbar:day:
+   *
+   * Current day.
+   */
+  g_object_class_install_property( gobject_class, PROP_DAY,
+                                   g_param_spec_uint("day",
+                                   "Current day",
+                                   "Current day",
+                                   1, 31,
+                                   1,
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
 }
 
 static void hildon_date_editor_init(HildonDateEditor * editor)
@@ -232,13 +313,20 @@ static void hildon_date_editor_init(HildonDateEditor * editor)
 
     /* make widgets */
     priv->frame = gtk_frame_new(NULL);
+    gtk_container_set_border_width(GTK_CONTAINER(priv->frame), 0);
 
     priv->d_entry = gtk_entry_new();
     priv->m_entry = gtk_entry_new();
     priv->y_entry = gtk_entry_new();
     priv->editor_pressed = FALSE;
 
-    
+    g_object_set (G_OBJECT(priv->d_entry), "input-mode", 
+                  HILDON_INPUT_MODE_HINT_NUMERIC, NULL);
+    g_object_set (G_OBJECT(priv->m_entry), "input-mode", 
+                  HILDON_INPUT_MODE_HINT_NUMERIC, NULL);
+    g_object_set (G_OBJECT(priv->y_entry), "input-mode", 
+                  HILDON_INPUT_MODE_HINT_NUMERIC, NULL);
+
     /* set entry look */
     gtk_entry_set_width_chars(GTK_ENTRY(priv->d_entry), DAY_ENTRY_WIDTH);
     gtk_entry_set_width_chars(GTK_ENTRY(priv->m_entry), MONTH_ENTRY_WIDTH);
@@ -252,17 +340,17 @@ static void hildon_date_editor_init(HildonDateEditor * editor)
     gtk_entry_set_has_frame(GTK_ENTRY(priv->m_entry), FALSE);
     gtk_entry_set_has_frame(GTK_ENTRY(priv->y_entry), FALSE);
 
-    priv->dm_delim = gtk_label_new("/");
-    priv->my_delim = gtk_label_new("/");
+    priv->dm_delim = gtk_label_new(_("Ecdg_ti_date_editor_separator"));
+    priv->my_delim = gtk_label_new(_("Ecdg_ti_date_editor_separator"));
 
     priv->d_box_date = gtk_hbox_new(FALSE, 0);
 
     priv->d_event_box_image = gtk_event_box_new();
 
     priv->d_image = gtk_image_new_from_icon_name("qgn_widg_datedit",
-                                             HILDON_ICON_SIZE_WIDG);
+                                                 HILDON_ICON_SIZE_WIDG);
     priv->d_image_pressed = gtk_image_new_from_icon_name("qgn_widg_datedit_pr",
-                                                     HILDON_ICON_SIZE_WIDG);
+                                                         HILDON_ICON_SIZE_WIDG);
     g_object_ref(G_OBJECT(priv->d_image));
     g_object_ref(G_OBJECT(priv->d_image_pressed));
     gtk_object_sink(GTK_OBJECT(priv->d_image));
@@ -312,7 +400,9 @@ static void hildon_date_editor_init(HildonDateEditor * editor)
     gtk_widget_show_all(priv->frame);
     gtk_widget_show_all(priv->d_event_box_image);
 
-    /* set signals */
+
+    
+    /* image signal connects */
     g_signal_connect(GTK_OBJECT(priv->d_event_box_image), "button_press_event",
                      G_CALLBACK(hildon_date_editor_icon_press), editor);
 
@@ -320,23 +410,40 @@ static void hildon_date_editor_init(HildonDateEditor * editor)
                      "button_release_event",
                      G_CALLBACK(hildon_date_editor_released), editor);
 
+    g_signal_connect(GTK_OBJECT(priv->d_event_box_image), "key-press-event",
+                     G_CALLBACK(hildon_date_editor_keypress), editor);
+
+    g_signal_connect(GTK_OBJECT(priv->d_image), "key-press-event",
+                     G_CALLBACK(hildon_date_editor_keypress), editor);
+
+
+    /* entry signal connects */
     g_signal_connect(GTK_OBJECT(priv->d_entry), "button_release_event",
                      G_CALLBACK(hildon_date_editor_entry_released), editor);
+    
+    g_signal_connect(GTK_OBJECT(priv->d_entry), "focus-in-event",
+                     G_CALLBACK(hildon_date_editor_entry_focusin), editor);
 
     g_signal_connect(GTK_OBJECT(priv->m_entry), "button_release_event",
                      G_CALLBACK(hildon_date_editor_entry_released), editor);
 
+    g_signal_connect(GTK_OBJECT(priv->m_entry), "focus-in-event",
+                     G_CALLBACK(hildon_date_editor_entry_focusin), editor);
+
     g_signal_connect(GTK_OBJECT(priv->y_entry), "button_release_event",
                      G_CALLBACK(hildon_date_editor_entry_released), editor);
 
+    g_signal_connect(GTK_OBJECT(priv->y_entry), "focus-in-event",
+                     G_CALLBACK(hildon_date_editor_entry_focusin), editor);
+
     g_signal_connect(GTK_OBJECT(priv->d_entry), "focus-out-event",
-                     G_CALLBACK(hildon_date_editor_focus_out), editor);
+                     G_CALLBACK(hildon_date_editor_entry_focus_out), editor);
 
     g_signal_connect(GTK_OBJECT(priv->m_entry), "focus-out-event",
-                     G_CALLBACK(hildon_date_editor_focus_out), editor);
+                     G_CALLBACK(hildon_date_editor_entry_focus_out), editor);
 
     g_signal_connect(GTK_OBJECT(priv->y_entry), "focus-out-event",
-                     G_CALLBACK(hildon_date_editor_focus_out), editor);
+                     G_CALLBACK(hildon_date_editor_entry_focus_out), editor);
 
     g_signal_connect(GTK_OBJECT(priv->d_entry), "key-press-event",
                      G_CALLBACK(hildon_date_editor_keypress), editor);
@@ -356,17 +463,59 @@ static void hildon_date_editor_init(HildonDateEditor * editor)
     g_signal_connect(GTK_OBJECT(priv->y_entry), "key-release-event",
                      G_CALLBACK(hildon_date_editor_keyrelease), editor);
 
-    g_signal_connect(GTK_OBJECT(priv->d_event_box_image), "key-press-event",
-                     G_CALLBACK(hildon_date_editor_keypress), editor);
-
-    g_signal_connect(GTK_OBJECT(priv->d_image), "key-press-event",
-                     G_CALLBACK(hildon_date_editor_keypress), editor);
-
     hildon_date_editor_set_date(editor, priv->year, priv->month, priv->day);
 
     gtk_widget_pop_composite_child();
 }
 
+static void hildon_date_editor_set_property (GObject *object, guint param_id,
+                                       const GValue *value, GParamSpec *pspec)
+{
+  HildonDateEditor *editor = HILDON_DATE_EDITOR(object);
+  switch (param_id)
+  {
+    case PROP_YEAR:
+      hildon_date_editor_set_year (editor, g_value_get_uint(value));
+      break;
+
+    case PROP_MONTH:
+      hildon_date_editor_set_month (editor, g_value_get_uint(value));
+      break;
+
+    case PROP_DAY:
+      hildon_date_editor_set_day (editor, g_value_get_uint(value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+  }
+}
+
+static void hildon_date_editor_get_property( GObject *object, guint param_id,
+                                         GValue *value, GParamSpec *pspec )
+{
+  HildonDateEditor *editor = HILDON_DATE_EDITOR(object);
+  switch (param_id)
+  {
+    case PROP_YEAR:
+      g_value_set_uint (value, hildon_date_editor_get_year (editor));
+      break;
+
+    case PROP_MONTH:
+      g_value_set_uint (value, hildon_date_editor_get_month (editor));
+      break;
+
+    case PROP_DAY:
+      g_value_set_uint (value, hildon_date_editor_get_day (editor));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+  }
+}
+
 static gboolean
 hildon_date_editor_mnemonic_activate(GtkWidget *widget, gboolean group_cycling)
 
@@ -472,43 +621,15 @@ GtkWidget *hildon_date_editor_new(void)
  * if the date specified by the arguments is not valid, the
  * function returns.
  **/
-
 void hildon_date_editor_set_date(HildonDateEditor * date,
                                  guint year, guint month, guint day)
 {
-    HildonDateEditorPrivate *priv;
-    gchar date_str[MAX_DATE_LEN + 1];
-    GDate cur_date;
-
     g_return_if_fail(date);
     g_return_if_fail(HILDON_IS_DATE_EDITOR(date));
 
-    priv = HILDON_DATE_EDITOR_GET_PRIVATE(date);
-    g_date_clear(&cur_date, 1);
-
-    /* validate given date */
-    if (g_date_valid_dmy(day, month, year)) {
-        if (priv->y_orig == 0) {
-            priv->y_orig = year;
-            priv->m_orig = month;
-            priv->d_orig = day;
-        }
-
-        g_date_set_dmy(&cur_date, day, month, year);
-        priv->day = day;
-        priv->month = month;
-        priv->year = year;
-
-        /* write date to entries */
-        g_date_strftime(date_str, MAX_DATE_LEN, "%d", &cur_date);
-        gtk_entry_set_text(GTK_ENTRY(priv->d_entry), date_str);
-
-        g_date_strftime(date_str, MAX_DATE_LEN, "%m", &cur_date);
-        gtk_entry_set_text(GTK_ENTRY(priv->m_entry), date_str);
-
-        g_date_strftime(date_str, MAX_DATE_LEN, "%EY", &cur_date);
-        gtk_entry_set_text(GTK_ENTRY(priv->y_entry), date_str);
-    }
+    hildon_date_editor_set_year(date, year);
+    hildon_date_editor_set_month(date, month);
+    hildon_date_editor_set_day(date, day);
 }
 
 /**
@@ -521,7 +642,6 @@ void hildon_date_editor_set_date(HildonDateEditor * date,
  * This function returns the year, month, and day currently on the
  * date editor.
  **/
-
 void hildon_date_editor_get_date(HildonDateEditor * date,
                                  guint * year, guint * month, guint * day)
 {
@@ -572,10 +692,6 @@ static gboolean hildon_date_editor_entry_released(GtkWidget * widget,
     HildonDateEditor *ed;
     HildonDateEditorPrivate *priv;
 
-    g_return_val_if_fail(widget, FALSE);
-    g_return_val_if_fail(event, FALSE);
-    g_return_val_if_fail(data, FALSE);
-
     ed = HILDON_DATE_EDITOR(data);
     priv = HILDON_DATE_EDITOR_GET_PRIVATE(ed);
 
@@ -591,6 +707,21 @@ static gboolean hildon_date_editor_entry_released(GtkWidget * widget,
     return FALSE;
 }
 
+static gboolean hildon_date_editor_entry_focusin(GtkWidget * widget,
+                                                 GdkEventFocus * event,
+                                                 gpointer data)
+{
+    if (!GTK_ENTRY(widget)->button)
+    {
+        GtkEntry *e = GTK_ENTRY(widget);
+        gint end = gtk_entry_get_max_length(e);
+        gtk_editable_select_region(GTK_EDITABLE(widget), 0, end);
+    }
+
+    return FALSE;
+}
+
+
 /* This handler is called from mainloop
    after button exposes are processed */
 static gboolean idle_popup(gpointer data)
@@ -689,6 +820,7 @@ static gboolean hildon_date_editor_keypress(GtkWidget * widget,
                                             GdkEventKey * event,
                                             gpointer data)
 {
+
     HildonDateEditor *ed;
     HildonDateEditorPrivate *priv;
     gint pos;
@@ -700,8 +832,7 @@ static gboolean hildon_date_editor_keypress(GtkWidget * widget,
     priv = HILDON_DATE_EDITOR_GET_PRIVATE(ed);
     pos = gtk_editable_get_position(GTK_EDITABLE(widget));
 
-    if (event->keyval == GDK_KP_Enter ||
-        event->keyval == GDK_Return || event->keyval == GDK_ISO_Enter) {
+    if (event->keyval == GDK_Return || event->keyval == GDK_ISO_Enter) {
         if (!priv->editor_pressed) {
             gtk_container_remove(GTK_CONTAINER(priv->d_event_box_image),
                                  priv->d_image);
@@ -714,6 +845,11 @@ static gboolean hildon_date_editor_keypress(GtkWidget * widget,
         return FALSE;
     }
 
+    if  (event->keyval == GDK_KP_Enter)
+           return FALSE;
+       
+
+    
     /* We don't want wrap */
     if (event->keyval == GDK_KP_Left || event->keyval == GDK_Left)
         if (pos == 0) {
@@ -911,49 +1047,41 @@ static gboolean hildon_date_editor_keypress(GtkWidget * widget,
     }
 }
 
-/* Entry looses focus. Validate the date */
-static gboolean hildon_date_editor_focus_out(GtkWidget * widget,
+static gboolean hildon_date_editor_entry_focus_out(GtkWidget * widget,
                                              GdkEventFocus * event,
                                              gpointer data)
 {
-    gint d, m, y;
     HildonDateEditor *ed;
     HildonDateEditorPrivate *priv;
-    gchar new_val[5];
+    gint d, m, y;
+    gboolean return_value = FALSE;
     GDate gd;
-
-    g_return_val_if_fail(widget, FALSE);
-    g_return_val_if_fail(data, FALSE);
+    gchar new_val[5];
 
     ed = HILDON_DATE_EDITOR(data);
     priv = HILDON_DATE_EDITOR_GET_PRIVATE(ed);
-
+    
     /* deselect the entry */
-    if (widget == priv->d_entry)
-        gtk_editable_select_region(GTK_EDITABLE(priv->d_entry), 0, 0);
-
-    if (widget == priv->m_entry)
-        gtk_editable_select_region(GTK_EDITABLE(priv->m_entry), 0, 0);
-
-    if (widget == priv->y_entry)
-        gtk_editable_select_region(GTK_EDITABLE(priv->y_entry), 0, 0);
-
-    g_date_clear(&gd, 1);
-    g_date_set_time(&gd, time(NULL));
+    gtk_editable_select_region(GTK_EDITABLE(widget), 0, 0);
+    
+    g_signal_emit_by_name (G_OBJECT(ed), "validate_date", &return_value);
 
-    /* get texts */
     d = atoi(gtk_entry_get_text(GTK_ENTRY(priv->d_entry)));
     m = atoi(gtk_entry_get_text(GTK_ENTRY(priv->m_entry)));
     y = atoi(gtk_entry_get_text(GTK_ENTRY(priv->y_entry)));
 
-    /* if date is not valid, fix it */
-    if (!g_date_valid_dmy(d, m, y)) {
+    /* If date is invalid we'll try to fix it */
+    if(!return_value) {
+        
+        g_date_clear(&gd, 1);
+        g_date_set_time(&gd, time(NULL));
+            
         /* Year is illegal, year 0 is not allowed by this code */
         if ((g_utf8_strlen(gtk_entry_get_text(GTK_ENTRY(priv->y_entry)),
                            -1) == 0) || (y == 0)) {
             gint end = gtk_entry_get_max_length(GTK_ENTRY(priv->y_entry));
 
-            gtk_infoprint(NULL, "Set a value");
+            gtk_infoprint(NULL, _("Ckct_ib_date_does_not_exist"));
 
             /* set year to current year or to orignal value, if one exists 
              */
@@ -1029,7 +1157,7 @@ static gboolean hildon_date_editor_focus_out(GtkWidget * widget,
               /* set day to 1 */
               if (d < 1) {
                   d = 1;
-                  gtk_infoprint(NULL, "Minimum value is 1");
+                  gtk_infoprintf(NULL, _("Ckct_ib_minimum_value"), 1);
 
                   sprintf(new_val, "%02d", d);
                   gtk_entry_set_text(GTK_ENTRY(priv->d_entry),
@@ -1043,11 +1171,8 @@ static gboolean hildon_date_editor_focus_out(GtkWidget * widget,
               }
               /* set day to max number of days in this month */
               else if (d > g_date_get_days_in_month(m,y)) {
-                  gchar info[256];
-
                   d = g_date_get_days_in_month(m, y);
-                  g_snprintf(info,256,  "Maximum value is %d", d);
-                  gtk_infoprint(NULL, info);
+                  gtk_infoprintf(NULL, _("Ckct_ib_maximum_value"), d);
 
                   sprintf(new_val, "%02d", d);
                   gtk_entry_set_text(GTK_ENTRY(priv->d_entry),
@@ -1069,11 +1194,8 @@ static gboolean hildon_date_editor_focus_out(GtkWidget * widget,
 
               /* set month to 1 */
               if (m < 1) {
-                  gchar info[256];
-
                   m = 1;
-                  g_snprintf(info,256,  "Minimum value is 1");
-                  gtk_infoprint(NULL, info);
+                  gtk_infoprintf(NULL, _("Ckct_ib_minimum_value"), 1);
 
                   sprintf(new_val, "%02d", m);
                   gtk_entry_set_text(GTK_ENTRY(priv->m_entry),
@@ -1087,11 +1209,8 @@ static gboolean hildon_date_editor_focus_out(GtkWidget * widget,
               }
               /* set month to 12 */
               else if (m > 12) {
-                  gchar info[256];
-
                   m = 12;
-                  g_snprintf(info, 256, "Maximum value is %d", m);
-                  gtk_infoprint(NULL, info);
+                  gtk_infoprintf(NULL, _("Ckct_ib_maximum_value"), m);
                   sprintf(new_val, "%02d", m);
                   gtk_entry_set_text(GTK_ENTRY(priv->m_entry),
                                       new_val);
@@ -1103,11 +1222,8 @@ static gboolean hildon_date_editor_focus_out(GtkWidget * widget,
                   priv->valid_value = FALSE;
               }
               else if (d > g_date_get_days_in_month(m,y)) {
-                  gchar info[256];
-
                   d = g_date_get_days_in_month(m, y);
-                  g_snprintf(info,256,  "Maximum value is %d", d);
-                  gtk_infoprint(NULL, info);
+                  gtk_infoprintf(NULL, _("Ckct_ib_maximum_value"), d);
 
                   sprintf(new_val, "%02d", d);
                   gtk_entry_set_text(GTK_ENTRY(priv->d_entry),
@@ -1123,27 +1239,41 @@ static gboolean hildon_date_editor_focus_out(GtkWidget * widget,
         }
     }
 
-    priv->day = d;
-    priv->month = m;
-    priv->year = y;
+    hildon_date_editor_set_date(ed, y, m, d);
+
+    priv->d_orig = d;
+    priv->m_orig = m;
+    priv->y_orig = y;
 
     /* if month entry has only one character, prepend it with 0 */
     if (g_utf8_strlen(gtk_entry_get_text(GTK_ENTRY(priv->m_entry)), -1) ==
-        1) {
+            1) {
         sprintf(new_val, "%02d", m);
         gtk_entry_set_text(GTK_ENTRY(priv->m_entry), new_val);
     }
 
     /* if day entry has only one character, prepend it with 0 */
     if (g_utf8_strlen(gtk_entry_get_text(GTK_ENTRY(priv->d_entry)), -1) ==
-        1) {
+            1) {
         sprintf(new_val, "%02d", d);
         gtk_entry_set_text(GTK_ENTRY(priv->d_entry), new_val);
     }
-
     return FALSE;
 }
 
+static gboolean hildon_date_editor_validate_date(HildonDateEditor *editor)
+{
+    gint d, m, y;
+    HildonDateEditorPrivate *priv = HILDON_DATE_EDITOR_GET_PRIVATE(editor);
+    
+    /* get texts */
+    d = atoi(gtk_entry_get_text(GTK_ENTRY(priv->d_entry)));
+    m = atoi(gtk_entry_get_text(GTK_ENTRY(priv->m_entry)));
+    y = atoi(gtk_entry_get_text(GTK_ENTRY(priv->y_entry)));
+
+    return g_date_valid_dmy(d, m, y);
+}
+
 static void hildon_date_editor_size_request(GtkWidget * widget,
                                             GtkRequisition * requisition)
 {
@@ -1179,8 +1309,7 @@ static void hildon_date_editor_size_request(GtkWidget * widget,
     gtk_widget_size_request(priv->d_event_box_image, &img_req);
 
     /* calculate our size */
-    requisition->width = f_req.width + img_req.width +
-        widget->style->xthickness * 2;
+    requisition->width = f_req.width + img_req.width + BUTTON_SPACING;
     requisition->height = DATE_EDITOR_HEIGHT;
 }
 
@@ -1201,19 +1330,13 @@ static void hildon_date_editor_size_allocate(GtkWidget * widget,
 
     widget->allocation = *allocation;
 
-    gtk_widget_size_request(widget, &max_req);
+    gtk_widget_get_child_requisition(widget, &max_req);
 
-    if (allocation->height > max_req.height)
-        f_alloc.y = img_alloc.y = allocation->y +
-            (allocation->height - max_req.height) / 2;
-    else
-        f_alloc.y = img_alloc.y = allocation->y;
+    f_alloc.y = img_alloc.y = allocation->y +
+            MAX(allocation->height - max_req.height, 0) / 2;
 
-    if (allocation->width > max_req.width)
-        f_alloc.x = img_alloc.x = allocation->x +
-            (allocation->width - max_req.width) / 2;
-    else
-        f_alloc.x = img_alloc.x = allocation->x;
+    f_alloc.x = img_alloc.x = allocation->x +
+            MAX(allocation->width - max_req.width, 0) / 2;
 
     /* allocate frame */
     if (priv->frame)
@@ -1231,17 +1354,16 @@ static void hildon_date_editor_size_allocate(GtkWidget * widget,
             gtk_widget_get_child_requisition(priv->d_event_box_image,
                                              &req);
 
-            img_alloc.x += f_alloc.width;
+            img_alloc.x += f_alloc.width + BUTTON_SPACING;
             img_alloc.width = req.width;
             img_alloc.height = max_req.height;
             gtk_widget_size_allocate(priv->d_event_box_image, &img_alloc);
         }
 
-/* -1 just to make it look nice -- Hildon --
- * Same y -value for the label, just does not look good enough.
- */
-    priv->my_delim->allocation.y =
-        priv->dm_delim->allocation.y = f_alloc.y - 1;
+    priv->dm_delim->allocation.height = max_req.height; 
+    priv->my_delim->allocation.height = max_req.height; 
+    priv->my_delim->allocation.y = priv->d_entry->allocation.y-5;
+    priv->dm_delim->allocation.y = priv->d_entry->allocation.y-5;
     gtk_widget_size_allocate(priv->dm_delim, &priv->dm_delim->allocation);
     gtk_widget_size_allocate(priv->my_delim, &priv->my_delim->allocation);
 }
@@ -1265,3 +1387,148 @@ static int hildon_date_editor_get_font_width(GtkWidget * widget)
 
     return digit_width;
 }
+
+/**
+ * hildon_date_editor_set_year:
+ * @editor: the @HildonDateEditor widget
+ * @year: year
+ *
+ * This function sets the year shown in the editor. 
+ *
+ * Return: Returns TRUE if the year is valid.
+ **/
+gboolean hildon_date_editor_set_year(HildonDateEditor *editor, guint year)
+{
+  HildonDateEditorPrivate *priv;
+  g_return_val_if_fail( HILDON_IS_DATE_EDITOR(editor), FALSE );
+  priv = HILDON_DATE_EDITOR_GET_PRIVATE(editor);
+
+  if (g_date_valid_dmy(priv->day, priv->month, year))
+  {
+    GDate date;
+    gchar str[MAX_DATE_LEN + 1];
+    priv->year = year;
+    g_date_set_dmy(&date, priv->day, priv->month, year);
+
+    g_date_strftime(str, MAX_DATE_LEN, "%EY", &date);
+    gtk_entry_set_text(GTK_ENTRY(priv->y_entry), str);
+
+    g_object_notify(G_OBJECT(editor), "year");
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
+/**
+ * hildon_date_editor_set_month:
+ * @editor: the @HildonDateEditor widget
+ * @month: month
+ *
+ * This function sets the month shown in the editor. 
+ *
+ * Return: Returns TRUE if the month is valid.
+ **/
+gboolean hildon_date_editor_set_month(HildonDateEditor *editor, guint month)
+{
+  HildonDateEditorPrivate *priv;
+  g_return_val_if_fail( HILDON_IS_DATE_EDITOR(editor), FALSE );
+  priv = HILDON_DATE_EDITOR_GET_PRIVATE(editor);
+
+  if (g_date_valid_dmy(priv->day, month, priv->year))
+  {
+    GDate date;
+    gchar str[MAX_DATE_LEN + 1];
+    priv->month = month;
+    g_date_set_dmy(&date, priv->day, month, priv->year);
+
+    g_date_strftime(str, MAX_DATE_LEN, "%m", &date);
+    gtk_entry_set_text(GTK_ENTRY(priv->m_entry), str);
+
+    g_object_notify(G_OBJECT(editor), "month");
+    return TRUE;
+  }
+  return FALSE;
+}
+
+/**
+ * hildon_date_editor_set_day:
+ * @editor: the @HildonDateEditor widget
+ * @day: day
+ *
+ * This function sets the day shown in the editor. 
+ *
+ * Return: Returns TRUE if the day is valid.
+ **/
+gboolean hildon_date_editor_set_day(HildonDateEditor *editor, guint day)
+{
+  HildonDateEditorPrivate *priv;
+
+  g_return_val_if_fail( HILDON_IS_DATE_EDITOR(editor), FALSE );
+  priv = HILDON_DATE_EDITOR_GET_PRIVATE(editor);
+
+  if (g_date_valid_dmy(day, priv->month, priv->year))
+  {
+    GDate date;
+    gchar str[MAX_DATE_LEN + 1];
+    priv->day = day;
+    g_date_set_dmy(&date, day, priv->month, priv->year);
+
+    g_date_strftime(str, MAX_DATE_LEN, "%d", &date);
+    gtk_entry_set_text(GTK_ENTRY(priv->d_entry), str);
+
+    g_object_notify(G_OBJECT(editor), "day");
+    return TRUE;
+  }
+  return FALSE;
+}
+
+/**
+ * hildon_date_editor_get_year:
+ * @editor: the @HildonDateEditor widget
+ *
+ * This function gets the year shown in the editor. 
+ *
+ * Return: Returns the current year shown in the editor.
+ **/
+guint hildon_date_editor_get_year(HildonDateEditor *editor)
+{
+  HildonDateEditorPrivate *priv;
+  g_return_val_if_fail( HILDON_IS_DATE_EDITOR(editor), 0 );
+  priv = HILDON_DATE_EDITOR_GET_PRIVATE(editor);
+  return priv->year;
+}
+
+/**
+ * hildon_date_editor_get_month:
+ * @editor: the @HildonDateEditor widget
+ *
+ * This function gets the month shown in the editor. 
+ *
+ * Return: Returns the current month shown in the editor.
+ **/
+
+guint hildon_date_editor_get_month(HildonDateEditor *editor)
+{
+  HildonDateEditorPrivate *priv;
+  g_return_val_if_fail( HILDON_IS_DATE_EDITOR(editor), 0 );
+  priv = HILDON_DATE_EDITOR_GET_PRIVATE(editor);
+  return priv->month;
+}
+
+/**
+ * hildon_date_editor_get_day:
+ * @editor: the @HildonDateEditor widget
+ *
+ * This function gets the day shown in the editor. 
+ *
+ * Return: Returns the current day shown in the editor.
+ **/
+
+guint hildon_date_editor_get_day(HildonDateEditor *editor)
+{
+  HildonDateEditorPrivate *priv;
+  g_return_val_if_fail( HILDON_IS_DATE_EDITOR(editor), 0 );
+  priv = HILDON_DATE_EDITOR_GET_PRIVATE(editor);
+  return priv->day;
+}
index ba72c55..e206bda 100644 (file)
@@ -57,6 +57,8 @@ struct _HildonDateEditor {
 
 struct _HildonDateEditorClass {
     GtkContainerClass parent_class;
+
+    gboolean (*validate_date) (HildonDateEditor *editor);
 };
 
 GType hildon_date_editor_get_type(void);
@@ -69,6 +71,13 @@ void hildon_date_editor_set_date(HildonDateEditor * date,
 void hildon_date_editor_get_date(HildonDateEditor * date,
                                  guint * year, guint * month, guint * day);
 
+gboolean hildon_date_editor_set_year(HildonDateEditor *editor, guint year);
+gboolean hildon_date_editor_set_month(HildonDateEditor *editor, guint month);
+gboolean hildon_date_editor_set_day(HildonDateEditor *editor, guint day);
+
+guint hildon_date_editor_get_year(HildonDateEditor *editor);
+guint hildon_date_editor_get_month(HildonDateEditor *editor);
+guint hildon_date_editor_get_day(HildonDateEditor *editor);
 
 G_END_DECLS
 #endif
index a3a9738..753feed 100644 (file)
  */
 
 /*
-   @file hildon-dialoghelp.c
-
-   This file provides API for the help dialog with
-   the optional icon.
-*/
+ *  @file hildon-dialoghelp.c
+ *
+ *  This file provides API for the help dialog with
+ *  the optional icon.
+ *
+ */
 
 #include <gdk/gdkx.h>
 #include "hildon-dialoghelp.h"
@@ -77,9 +78,7 @@ void gtk_dialog_help_enable(GtkDialog * dialog)
     GdkWindow *window;
 
     if (help_signal == 0) {
-        help_signal = g_signal_new("help",
-                                   G_TYPE_FROM_INSTANCE(GTK_OBJECT
-                                                        (dialog)),
+        help_signal = g_signal_new("help", GTK_TYPE_DIALOG,
                                    G_SIGNAL_ACTION, (guint) - 1, NULL,
                                    NULL, g_cclosure_marshal_VOID__VOID,
                                    G_TYPE_NONE, 0);
index 32686ba..1317094 100644 (file)
@@ -26,7 +26,7 @@
  * 
  * This file contains API for Hildon File Details dialog.
  * 
-*/
+ */
 
 #include <gtk/gtkbox.h>
 #include <gtk/gtkcheckbutton.h>
@@ -35,6 +35,7 @@
 #include <gtk/gtktable.h>
 #include <gtk/gtkhbox.h>
 #include <gtk/gtkimage.h>
+#include <gtk/gtkscrolledwindow.h>
 #include <time.h>
 #include <libintl.h>
 #include <sys/types.h>
@@ -96,6 +97,8 @@ hildon_file_details_dialog_set_property( GObject *object, guint param_id,
 static void
 hildon_file_details_dialog_get_property( GObject *object, guint param_id,
                                                           GValue *value, GParamSpec *pspec );
+static void 
+hildon_file_details_dialog_response(GtkDialog *dialog, gint response_id);
 
 static GtkDialogClass *file_details_dialog_parent_class = NULL;
 
@@ -162,14 +165,14 @@ static void change_state(HildonFileDetailsDialog *self, gboolean readonly)
 
 /* Cancel changes if read-only is changed */
 static void 
-hildon_file_details_dialog_response(GtkWidget *widget, gint response_id, gpointer data)
+hildon_file_details_dialog_response(GtkDialog *dialog, gint response_id)
 {
     if (response_id == GTK_RESPONSE_CANCEL)
     {
       HildonFileDetailsDialog *self;
       gboolean state;
 
-      self = HILDON_FILE_DETAILS_DIALOG(widget);  
+      self = HILDON_FILE_DETAILS_DIALOG(dialog);  
       state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self->priv->file_readonly));
 
       if (state != self->priv->checkbox_original_state)
@@ -202,6 +205,8 @@ hildon_file_details_dialog_class_init(HildonFileDetailsDialogClass * klass)
     gobject_class->get_property = hildon_file_details_dialog_get_property;
     gobject_class->set_property = hildon_file_details_dialog_set_property;
     GTK_WIDGET_CLASS(klass)->map = hildon_file_details_dialog_map;
+    GTK_DIALOG_CLASS(klass)->response = hildon_file_details_dialog_response;
+
     g_type_class_add_private(klass, sizeof(HildonFileDetailsDialogPrivate));
 
   /**
@@ -213,7 +218,7 @@ hildon_file_details_dialog_class_init(HildonFileDetailsDialogClass * klass)
                                    g_param_spec_object("additional-tab",
                                    "Additional tab",
                                    "Tab to show additinal information",
-                                   GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+                                                      GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
   /**
    * HildonFileDetailsDialog:show_tabs:
    *
@@ -223,7 +228,7 @@ hildon_file_details_dialog_class_init(HildonFileDetailsDialogClass * klass)
                                    g_param_spec_boolean("show-tabs",
                                    "Show tab labels",
                                    "Do we want to show the tab label.",
-                                   FALSE, G_PARAM_READWRITE));
+                                   FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
   /**
    * HildonFileDetailsDialog:additional_tab_label:
    *
@@ -301,7 +306,10 @@ hildon_file_details_dialog_init(HildonFileDetailsDialog *self)
       priv->file_size, NULL, HILDON_CAPTION_OPTIONAL);
     caption_read = hildon_caption_new(group, _("ckdg_fi_properties_read_only"), 
       priv->file_readonly, NULL, HILDON_CAPTION_OPTIONAL);
-    g_object_unref(group);
+    hildon_caption_set_separator(HILDON_CAPTION(caption_size), "");
+    hildon_caption_set_separator(HILDON_CAPTION(caption_read), "");
+    if (G_IS_OBJECT(group))
+      g_object_unref(group);
 
     hbox_location = gtk_hbox_new(FALSE, HILDON_MARGIN_DEFAULT);
     hbox_device = gtk_hbox_new(FALSE, HILDON_MARGIN_DEFAULT);
@@ -333,11 +341,11 @@ hildon_file_details_dialog_init(HildonFileDetailsDialog *self)
     gtk_table_attach(table, priv->file_time, 1, 2, 5, 6, GTK_SHRINK | GTK_FILL, GTK_FILL, 0, 0);
 
     /* Populate dialog */
-    gtk_notebook_append_page(priv->notebook, GTK_WIDGET(table), 
-      gtk_label_new(_("sfil_ti_notebook_common")));
+    gtk_notebook_append_page(priv->notebook, GTK_WIDGET(table),
+                            gtk_label_new(_("sfil_ti_notebook_common")));
 
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(self)->vbox),
-                       GTK_WIDGET(priv->notebook), FALSE, TRUE, 0);
+                       GTK_WIDGET(priv->notebook), TRUE, TRUE, 0);
 
     /* From widget specs, generic dialog size */
     geometry.min_width = 133;
@@ -346,8 +354,8 @@ hildon_file_details_dialog_init(HildonFileDetailsDialog *self)
     geometry.max_height = 240;
 
     gtk_window_set_geometry_hints(GTK_WINDOW(self),
-                        GTK_WIDGET(priv->notebook), &geometry,
-                        GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
+                                 GTK_WIDGET(priv->notebook), &geometry,
+                                 GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
 
     gtk_widget_show_all(GTK_WIDGET(priv->notebook));
     priv->ok_button = gtk_dialog_add_button(GTK_DIALOG(self),
@@ -359,8 +367,6 @@ hildon_file_details_dialog_init(HildonFileDetailsDialog *self)
     gtk_dialog_set_default_response(GTK_DIALOG(self),
                           GTK_RESPONSE_OK);
 
-    g_signal_connect(self, "response", 
-      G_CALLBACK(hildon_file_details_dialog_response), NULL);
     priv->toggle_handler = g_signal_connect(priv->file_readonly, "toggled", 
       G_CALLBACK(hildon_file_details_dialog_read_only_toggled), 
       self);
@@ -385,13 +391,13 @@ hildon_file_details_dialog_set_property( GObject *object, guint param_id,
     {
       gtk_notebook_set_show_tabs(notebook, g_value_get_boolean(value));
       gtk_notebook_set_show_border(notebook, g_value_get_boolean(value));
-/*      g_assert(gtk_notebook_get_n_pages(notebook) == 2);*/
       break;
     }
     case PROP_ADDITIONAL_TAB:
     {
       GtkWidget *widget = g_value_get_object(value);
-
+      GtkWidget *sw = gtk_scrolled_window_new(NULL, NULL);
+      
       if (gtk_notebook_get_n_pages(notebook) == 2)
         gtk_notebook_remove_page(notebook, 1);
 
@@ -401,7 +407,13 @@ hildon_file_details_dialog_set_property( GObject *object, guint param_id,
         gtk_widget_show(widget);
       }
 
-      gtk_notebook_append_page(notebook, widget, priv->tab_label);
+      gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
+                                    GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+      gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), widget);
+      gtk_viewport_set_shadow_type(GTK_VIEWPORT(GTK_BIN(sw)->child),
+                                   GTK_SHADOW_NONE);
+      gtk_widget_show_all(sw);
+      gtk_notebook_append_page(notebook, sw, priv->tab_label);
       gtk_notebook_set_current_page(notebook, 0);
       break;
     }
@@ -413,7 +425,7 @@ hildon_file_details_dialog_set_property( GObject *object, guint param_id,
       HildonFileSystemModel *new_model = g_value_get_object(value);
       if (new_model != priv->model)
       {
-        if (priv->model)
+        if (G_IS_OBJECT(priv->model))
           g_object_unref(priv->model);
         priv->model = new_model;
         if (new_model)
@@ -463,9 +475,12 @@ static void hildon_file_details_dialog_finalize(GObject * object)
   g_return_if_fail(HILDON_IS_FILE_DETAILS_DIALOG(object));
 
   priv = HILDON_FILE_DETAILS_DIALOG(object)->priv;
-  g_object_unref(priv->model);
-  g_object_unref(priv->tab_label);
-  gtk_tree_row_reference_free(priv->active_file);
+  if (G_IS_OBJECT(priv->model))
+    g_object_unref(priv->model);
+  if (G_IS_OBJECT(priv->tab_label))
+    g_object_unref(priv->tab_label);
+  if (priv->active_file)
+    gtk_tree_row_reference_free(priv->active_file);
     
   G_OBJECT_CLASS(file_details_dialog_parent_class)->finalize(object);
 }
@@ -487,6 +502,7 @@ static void hildon_file_details_dialog_finalize(GObject * object)
  *
  * Returns: a new #HildonFileDetailsDialog.
  */
+#ifndef HILDON_DISABLE_DEPRECATED
 GtkWidget *hildon_file_details_dialog_new(GtkWindow * parent,
                                           const gchar * filename)
 {
@@ -510,7 +526,7 @@ GtkWidget *hildon_file_details_dialog_new(GtkWindow * parent,
 
   return GTK_WIDGET(dialog);
 }
-
+#endif
 /**
  * hildon_file_details_dialog_new_with_model:
  * @parent: the parent window.
@@ -579,7 +595,7 @@ void hildon_file_details_dialog_set_file_iter(HildonFileDetailsDialog *self, Gtk
     -1);
 
   g_object_set(self->priv->file_name, "label", name, NULL);
-  g_object_set(self->priv->file_type, "label", mime, NULL);
+  g_object_set(self->priv->file_type, "label", _(mime), NULL);
 
   if (size < 1024)
     g_snprintf(buffer, sizeof(buffer),
@@ -625,7 +641,8 @@ void hildon_file_details_dialog_set_file_iter(HildonFileDetailsDialog *self, Gtk
     gtk_image_set_from_pixbuf(GTK_IMAGE(self->priv->file_location_image), 
       location_icon);
 
-    g_object_unref(location_icon);
+    if (G_IS_OBJECT(location_icon))
+      g_object_unref(location_icon);
     g_free(location_name);
 
     /* Go upwards in model until we find a device node */
@@ -652,7 +669,8 @@ void hildon_file_details_dialog_set_file_iter(HildonFileDetailsDialog *self, Gtk
     gtk_image_set_from_pixbuf(GTK_IMAGE(self->priv->file_device_image), 
       location_icon);
 
-    g_object_unref(location_icon);
+    if (G_IS_OBJECT(location_icon))
+      g_object_unref(location_icon);
     g_free(location_name);
     g_free(parent_path);
   }
index bc724fd..ba5d16c 100644 (file)
@@ -63,8 +63,10 @@ struct _HildonFileDetailsDialogClass {
 GType hildon_file_details_dialog_get_type(void) G_GNUC_CONST;
 
 /* Depricated constructor... */
+#ifndef HILDON_DISABLE_DEPRECATED
 GtkWidget *hildon_file_details_dialog_new(GtkWindow * parent,
   const gchar * filename);
+#endif
 
 /* New API inspired by GtkComboBox */
 GtkWidget *hildon_file_details_dialog_new_with_model(GtkWindow *parent,
index eac79d4..501510e 100644 (file)
         (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
         HILDON_TYPE_FILE_HANDLING_NOTE, HildonFileHandlingNotePrivate));
 
-static HildonNote *parent_class;
-
 typedef struct _HildonFileHandlingNotePrivate
     HildonFileHandlingNotePrivate;
 
+struct _HildonFileHandlingNotePrivate {
+    guint note_type;
+};
+
+#ifndef HILDON_DISABLE_DEPRECATED
+
+static HildonNote *parent_class;
+
+
+/* standard forbids empty source file, therefore the ifdef must be
+   placed here. */
 
 static void
 hildon_file_handling_note_class_init(HildonFileHandlingNoteClass * class);
@@ -62,9 +71,6 @@ static void hildon_file_handling_note_init(HildonFileHandlingNote *
 static void hildon_file_handling_note_finalize(GObject * obj_self);
 
 
-struct _HildonFileHandlingNotePrivate {
-    guint note_type;
-};
 
 
 GType hildon_file_handling_note_get_type()
@@ -123,7 +129,8 @@ static void hildon_file_handling_note_finalize(GObject * obj_self)
  * @name: Filename
  *
  * This function sets current counter value, maximum
- * counter value and filename for dialog
+ * counter value and filename for dialog 
+ * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
  */
 void hildon_file_handling_note_set_counter_and_name(HildonFileHandlingNote
                                                     * note, guint current,
@@ -187,6 +194,7 @@ void hildon_file_handling_note_set_counter_and_name(HildonFileHandlingNote
  * @name: Filename
  *
  * This function sets filename for dialog
+ * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
  */
 void hildon_file_handling_note_set_name(HildonFileHandlingNote * note,
                                         const gchar * name)
@@ -216,6 +224,7 @@ void hildon_file_handling_note_set_name(HildonFileHandlingNote * note,
 
  * This function sets fraction value for
  * progress bar.
+ * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
  */
 void hildon_file_handling_note_set_fraction(HildonFileHandlingNote * note,
                                             gfloat frac)
@@ -234,6 +243,7 @@ void hildon_file_handling_note_set_fraction(HildonFileHandlingNote * note,
  * which is "moving" type.
  *
  * Return value: a new #HildonFileHandlingNote.
+ * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
  */
 GtkWidget *hildon_file_handling_note_new_moving(GtkWindow * parent)
 {
@@ -245,7 +255,7 @@ GtkWidget *hildon_file_handling_note_new_moving(GtkWindow * parent)
 
     file_note = g_object_new(HILDON_TYPE_FILE_HANDLING_NOTE,
                              "note_type", HILDON_NOTE_PROGRESSBAR_TYPE,
-                             "description", _("Moving..."),
+                             "description", _("sfil_nw_moving_file"), 
                              "progressbar", progbar, NULL);
 
     priv = HILDON_FILE_HANDLING_NOTE_GET_PRIVATE(file_note);
@@ -265,6 +275,7 @@ GtkWidget *hildon_file_handling_note_new_moving(GtkWindow * parent)
  * which is "deleting" type.
  *
  * Return value: a new #HildonFileHandlingNote.
+ * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
  */
 GtkWidget *hildon_file_handling_note_new_deleting(GtkWindow * parent)
 {
@@ -276,7 +287,7 @@ GtkWidget *hildon_file_handling_note_new_deleting(GtkWindow * parent)
 
     file_note = g_object_new(HILDON_TYPE_FILE_HANDLING_NOTE,
                              "note_type", HILDON_NOTE_PROGRESSBAR_TYPE,
-                             "description", _("Deleting..."),
+                             "description", _("docm_nw_deleting_file"),
                              "progressbar", progbar, NULL);
 
     priv = HILDON_FILE_HANDLING_NOTE_GET_PRIVATE(file_note);
@@ -296,6 +307,7 @@ GtkWidget *hildon_file_handling_note_new_deleting(GtkWindow * parent)
  * which is "opening" type
  *
  * Return value: a new #HildonFileHandlingNote.
+ * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
  */
 GtkWidget *hildon_file_handling_note_new_opening(GtkWindow * parent)
 {
@@ -307,7 +319,7 @@ GtkWidget *hildon_file_handling_note_new_opening(GtkWindow * parent)
 
     file_note = g_object_new(HILDON_TYPE_FILE_HANDLING_NOTE,
                              "note_type", HILDON_NOTE_PROGRESSBAR_TYPE,
-                             "description", _("Opening..."),
+                             "description", _("docm_nw_opening_file"),
                              "progressbar", progbar, NULL);
 
     priv = HILDON_FILE_HANDLING_NOTE_GET_PRIVATE(file_note);
@@ -327,6 +339,7 @@ GtkWidget *hildon_file_handling_note_new_opening(GtkWindow * parent)
  * which is "saving" type.
  *
  * Return value: a new #HildonFileHandlingNote.
+ * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
  */
 GtkWidget *hildon_file_handling_note_new_saving(GtkWindow * parent)
 {
@@ -335,9 +348,10 @@ GtkWidget *hildon_file_handling_note_new_saving(GtkWindow * parent)
     HildonFileHandlingNotePrivate *priv;
 
     progbar = gtk_progress_bar_new();
+
     file_note = g_object_new(HILDON_TYPE_FILE_HANDLING_NOTE,
                              "note_type", HILDON_NOTE_PROGRESSBAR_TYPE,
-                             "description", _("Saving..."),
+                             "description", _("docm_nw_saving_file"),
                              "progressbar", progbar, NULL);
 
     priv = HILDON_FILE_HANDLING_NOTE_GET_PRIVATE(file_note);
@@ -348,3 +362,5 @@ GtkWidget *hildon_file_handling_note_new_saving(GtkWindow * parent)
 
     return GTK_WIDGET(file_note);
 }
+
+#endif /* HILDON_DISABLE_DEPRECATED */
index 29d3fd0..cab10ce 100644 (file)
@@ -24,6 +24,9 @@
 #ifndef __HILDON_FILE_HANDLING_NOTE_H__
 #define __HILDON_FILE_HANDLING_NOTE_H__
 
+
+#ifndef HILDON_DISABLE_DEPRECATED
+
 #include "hildon-note.h"
 
 G_BEGIN_DECLS
@@ -69,4 +72,6 @@ void hildon_file_handling_note_set_name(HildonFileHandlingNote * note,
 GType hildon_file_handling_note_get_type(void);
 
 G_END_DECLS
+#endif /* HILDON_DISABLE_DEPRECATED */
+
 #endif /* __HILDON_NOTE_H__ */
diff --git a/hildon-widgets/hildon-find-object-dialog.c b/hildon-widgets/hildon-find-object-dialog.c
deleted file mode 100644 (file)
index 63e1947..0000000
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005 Nokia Corporation.
- *
- * Contact: Luc Pionchon <luc.pionchon@nokia.com>
- *
- * 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
- *
- */
-
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <errno.h>
-#include <string.h>
-#include <strings.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <libintl.h>
-
-#include <hildon-find-object-dialog.h>
-#include <hildon-search.h>
-
-#define _(String) dgettext(PACKAGE, String)
-#define MAX_ERR_MSG 256
-
-#define HILDON_FIND_OBJECT_DIALOG_WIDTH 370
-#define HILDON_FIND_OBJECT_DIALOG_HEIGHT 100
-
-static GtkDialogClass *parent_class;
-
-typedef struct _HildonFindObjectDialogPrivate
-    HildonFindObjectDialogPrivate;
-struct _HildonFindObjectDialogPrivate {
-    GtkButton *findButton;
-    GtkButton *closeButton;
-    GtkButton *optionsButton;
-    GtkLabel *label;
-    HildonSearch *search;
-    GtkComboBoxEntry *combo;
-    GtkDialog *optionsDialog;
-};
-
-#define HILDON_FIND_OBJECT_DIALOG_GET_PRIVATE(o)  \
-   (G_TYPE_INSTANCE_GET_PRIVATE ((o), HILDON_TYPE_FIND_OBJECT_DIALOG,\
-    HildonFindObjectDialogPrivate))
-
-static void
-hildon_find_object_dialog_class_init(HildonFindObjectDialogClass * class);
-static void hildon_find_object_dialog_init(HildonFindObjectDialog *
-                                           widget);
-static void hildon_find_object_dialog_finalize(GObject * obj_self);
-static void open_options_dialog(GtkWidget * widget,
-                                HildonFindObjectDialog * dialog);
-static void hildon_find_object_dialog_response_cb(HildonFindObjectDialog *
-                                                  dialog, gint response,
-                                                  gpointer data);
-static void hildon_find_object_options_dialog_response_cb(GtkDialog *
-                                                          dialog,
-                                                          gint response,
-                                                          gpointer data);
-
-static void
-hildon_find_object_dialog_class_init(HildonFindObjectDialogClass * class)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS(class);
-
-    parent_class = g_type_class_peek_parent(class);
-    object_class->finalize = hildon_find_object_dialog_finalize;
-
-    g_type_class_add_private(class, sizeof(HildonFindObjectDialogPrivate));
-}
-
-static void hildon_find_object_dialog_finalize(GObject * obj_self)
-{
-    HildonFindObjectDialog *self;
-    g_return_if_fail(HILDON_IS_FIND_OBJECT_DIALOG(obj_self));
-    self = HILDON_FIND_OBJECT_DIALOG(obj_self);
-
-    if (G_OBJECT_CLASS(parent_class)->finalize)
-        G_OBJECT_CLASS(parent_class)->finalize(obj_self);
-}
-
-static void
-add_to_history(GtkEntry * entry, HildonFindObjectDialog * dialog)
-{
-
-    GtkTreeModel *model;
-    GtkTreeIter iter;
-    gchar *new_text;
-    gchar *str_data;
-    gint string_pos = 0;
-    gboolean string_found = FALSE;
-    gint count = 0;
-    gboolean has_next;
-    HildonFindObjectDialogPrivate *priv =
-        HILDON_FIND_OBJECT_DIALOG_GET_PRIVATE(dialog);
-
-    new_text = g_strdup((gchar *) gtk_entry_get_text(GTK_ENTRY(entry)));
-    model = gtk_combo_box_get_model(GTK_COMBO_BOX(priv->combo));
-
-    if (strlen(new_text) == 0) {
-
-    } else {
-        has_next = gtk_tree_model_get_iter_first(model, &iter);
-        while (has_next) {
-            gtk_tree_model_get(model, &iter, 0, &str_data, -1);
-            count++;
-            if (strcasecmp(new_text, str_data) == 0) {
-                string_found = TRUE;
-                string_pos = count;
-            }
-            has_next = gtk_tree_model_iter_next(model, &iter);
-            g_free(str_data);
-        }
-        if ((string_found)) {
-            gtk_combo_box_remove_text(GTK_COMBO_BOX(priv->combo),
-                                      string_pos - 1);
-        } else if (count >= 4) {
-            gtk_combo_box_remove_text(GTK_COMBO_BOX(priv->combo), count - 1);
-        }
-    }
-
-    /* This has to be done like this, because otherwise gtkcombobox will
-       return wrong value to the user when getting the currently selected
-       item. */
-    gtk_combo_box_prepend_text(GTK_COMBO_BOX(priv->combo), new_text);
-    gtk_entry_set_text(GTK_ENTRY(entry), new_text);
-    g_free(new_text);
-}
-
-
-static void hildon_find_object_dialog_init(HildonFindObjectDialog * dialog)
-{
-
-    HildonFindObjectDialogPrivate *priv =
-        HILDON_FIND_OBJECT_DIALOG_GET_PRIVATE(dialog);
-
-    gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
-
-    gtk_window_set_title(GTK_WINDOW(dialog), _("Find"));
-
-    priv->findButton = GTK_BUTTON(gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                                        _("Find"),
-                                                        GTK_RESPONSE_OK));
-
-    priv->optionsButton =
-        GTK_BUTTON(gtk_button_new_with_label(_("Options")));
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area),
-                       GTK_WIDGET(priv->optionsButton), FALSE, TRUE, 0);
-
-    priv->closeButton =
-        GTK_BUTTON(gtk_dialog_add_button
-                   (GTK_DIALOG(dialog), _("Close"), GTK_RESPONSE_CANCEL));
-
-    priv->search = HILDON_SEARCH(hildon_search_new("gtk-find"));
-    priv->combo = GTK_COMBO_BOX_ENTRY(gtk_combo_box_entry_new_text());
-
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
-                       GTK_WIDGET(priv->search), FALSE, FALSE, 0);
-    gtk_container_add(GTK_CONTAINER(priv->search), GTK_WIDGET(priv->combo));
-
-    priv->label = GTK_LABEL(gtk_label_new(NULL));
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
-                       GTK_WIDGET(priv->label), FALSE, FALSE, 0);
-
-    gtk_window_resize(GTK_WINDOW(dialog),
-                      HILDON_FIND_OBJECT_DIALOG_WIDTH,
-                      HILDON_FIND_OBJECT_DIALOG_HEIGHT);
-
-    gtk_widget_show_all(GTK_DIALOG(dialog)->vbox);
-    gtk_widget_show_all(GTK_DIALOG(dialog)->action_area);
-
-}
-
-static void
-open_options_dialog(GtkWidget * widget, HildonFindObjectDialog * dialog)
-{
-
-    HildonFindObjectDialogPrivate *priv;
-    priv = HILDON_FIND_OBJECT_DIALOG_GET_PRIVATE(dialog);
-    g_return_if_fail(GTK_IS_DIALOG(priv->optionsDialog));
-
-    g_signal_connect(G_OBJECT(priv->optionsDialog), "response",
-                     G_CALLBACK(hildon_find_object_options_dialog_response_cb),
-                     dialog);
-
-    gtk_dialog_run(priv->optionsDialog);
-}
-static void
-hildon_find_object_dialog_response_cb(HildonFindObjectDialog * dialog,
-                                      gint response, gpointer data)
-{
-
-    HildonFindObjectDialogPrivate *priv =
-        HILDON_FIND_OBJECT_DIALOG_GET_PRIVATE(dialog);
-
-    if (response == GTK_RESPONSE_OK)
-        add_to_history(GTK_ENTRY(GTK_BIN(priv->combo)->child), dialog);
-}
-
-static void
-hildon_find_object_options_dialog_response_cb(GtkDialog * dialog,
-                                              gint response, gpointer data)
-{
-    gtk_widget_hide(GTK_WIDGET(dialog));
-    gtk_window_present(GTK_WINDOW(data));
-}
-
-/* Public functions */
-
-/**
- * hildon_find_object_dialog_set_label:
- * @dialog: the #HildonFindObjectDialog which label wants to be changed
- * @label: gchar pointer to a string 
- *
- * Sets the label beneath the combobox in a #HildonFindObjectDialog widget.
- */
-void
-hildon_find_object_dialog_set_label(HildonFindObjectDialog * dialog,
-                                    const gchar * label)
-{
-    HildonFindObjectDialogPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_FIND_OBJECT_DIALOG(dialog));
-    priv = HILDON_FIND_OBJECT_DIALOG_GET_PRIVATE(dialog);
-    gtk_label_set_text(priv->label, label);
-}
-
-GType hildon_find_object_dialog_get_type(void)
-{
-    static GType dialog_type = 0;
-
-    if (!dialog_type) {
-        static const GTypeInfo dialog_info = {
-            sizeof(HildonFindObjectDialogClass),
-            NULL,       /* base_init */
-            NULL,       /* base_finalize */
-            (GClassInitFunc) hildon_find_object_dialog_class_init,
-            NULL,       /* class_finalize */
-            NULL,       /* class_data */
-            sizeof(HildonFindObjectDialog),
-            0,  /* n_preallocs */
-            (GInstanceInitFunc) hildon_find_object_dialog_init
-        };
-
-        dialog_type = g_type_register_static(GTK_TYPE_DIALOG,
-                                             "HildonFindObjectDialog",
-                                             &dialog_info, 0);
-    }
-    return dialog_type;
-}
-
-/**
- * hildon_find_object_dialog_new:
- * @parent: the parent window of the dialog.
- *
- * Creates a new #HildonFindObjectDialog widget with Find and Close
- * buttons.
- *
- * Return value: the newly created #HildonFindObjectDialog
- */
-GtkWidget *hildon_find_object_dialog_new(GtkWindow * parent)
-{
-    HildonFindObjectDialog *self =
-        HILDON_FIND_OBJECT_DIALOG(g_object_new
-                                  (HILDON_TYPE_FIND_OBJECT_DIALOG, NULL));
-
-    HildonFindObjectDialogPrivate *priv =
-        HILDON_FIND_OBJECT_DIALOG_GET_PRIVATE(self);
-
-    g_signal_connect(G_OBJECT(self), "response",
-                     G_CALLBACK(hildon_find_object_dialog_response_cb), NULL);
-
-    gtk_container_remove(GTK_CONTAINER(GTK_DIALOG(self)->action_area),
-                         GTK_WIDGET(priv->optionsButton));
-
-    if (parent)
-        gtk_window_set_transient_for(GTK_WINDOW(self), parent);
-
-    return GTK_WIDGET(self);
-}
-
-/**
- * hildon_find_object_dialog_new_with_options:
- * @parent: the parent window of the dialog.
- * @dialog: the options dialog to be shown on press on the options button.
- *
- * Creates a new #HildonFindObjectDialog widget with Find, Options and 
- * Close buttons. Sets the options dialog to be transient for the find 
- * object dialog.
- *
- * Return value: the newly created #HildonFindObjectDialog
- */
-
-GtkWidget *hildon_find_object_dialog_new_with_options(GtkWindow * parent,
-                                                      GtkDialog * dialog)
-{
-    HildonFindObjectDialog *self =
-        HILDON_FIND_OBJECT_DIALOG(g_object_new
-                                  (HILDON_TYPE_FIND_OBJECT_DIALOG, NULL));
-    HildonFindObjectDialogPrivate *priv =
-        HILDON_FIND_OBJECT_DIALOG_GET_PRIVATE(self);
-
-    g_signal_connect(G_OBJECT(self), "response",
-                     G_CALLBACK(hildon_find_object_dialog_response_cb), NULL);
-
-    priv->optionsDialog = GTK_DIALOG(dialog);
-
-    g_signal_connect(G_OBJECT(priv->optionsButton), "clicked",
-                     G_CALLBACK(open_options_dialog), self);
-
-    if (parent)
-        gtk_window_set_transient_for(GTK_WINDOW(self), parent);
-
-    if (dialog)
-        gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(self));
-
-    return GTK_WIDGET(self);
-}
-
-/**
- * hildon_find_object_dialog_get_text:
- * @dialog: the dialog.
- *
- * Gets the text that's active in the combobox (i.e. the find string).
- *
- * Return value: a pointer to the find string.
- */
-
-const gchar *hildon_find_object_dialog_get_text(HildonFindObjectDialog *
-                                                dialog)
-{
-    HildonFindObjectDialogPrivate *priv =
-        HILDON_FIND_OBJECT_DIALOG_GET_PRIVATE(dialog);
-    return gtk_entry_get_text(GTK_ENTRY(GTK_BIN(priv->combo)->child));
-}
diff --git a/hildon-widgets/hildon-find-object-dialog.h b/hildon-widgets/hildon-find-object-dialog.h
deleted file mode 100644 (file)
index 2aca946..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005 Nokia Corporation.
- *
- * Contact: Luc Pionchon <luc.pionchon@nokia.com>
- *
- * 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
- *
- */
-
-#ifndef __HILDON_FIND_OBJECT_DIALOG_H__
-#define __HILDON_FIND_OBJECT_DIALOG_H__
-
-#ifndef __DEPRACATED__
-#define __DEPRACATED__
-#endif
-
-#include <gtk/gtkdialog.h>
-
-G_BEGIN_DECLS
-#define HILDON_TYPE_FIND_OBJECT_DIALOG \
-  ( hildon_find_object_dialog_get_type() )
-#define HILDON_FIND_OBJECT_DIALOG(obj) \
-  (GTK_CHECK_CAST (obj, HILDON_TYPE_FIND_OBJECT_DIALOG,\
-   HildonFindObjectDialog))
-#define HILDON_FIND_OBJECT_DIALOG_CLASS(klass) \
-  (GTK_CHECK_CLASS_CAST ((klass), HILDON_TYPE_FIND_OBJECT_DIALOG, \
-  HildonFindObjectDialogClass))
-#define HILDON_IS_FIND_OBJECT_DIALOG(obj) \
-  (GTK_CHECK_TYPE (obj, HILDON_TYPE_FIND_OBJECT_DIALOG))
-#define HILDON_IS_FIND_OBJECT_DIALOG_CLASS(klass) \
-  (GTK_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_FIND_OBJECT_DIALOG))
-typedef struct _HildonFindObjectDialog HildonFindObjectDialog;
-typedef struct _HildonFindObjectDialogClass HildonFindObjectDialogClass;
-
-struct _HildonFindObjectDialog {
-    GtkDialog parent;
-};
-
-struct _HildonFindObjectDialogClass {
-    GtkDialogClass parent_class;
-};
-
-GType hildon_find_object_dialog_get_type(void);
-
-GtkWidget *hildon_find_object_dialog_new(GtkWindow * parent);
-GtkWidget *hildon_find_object_dialog_new_with_options(GtkWindow * parent,
-                                                      GtkDialog * dialog);
-const gchar *hildon_find_object_dialog_get_text(HildonFindObjectDialog *
-                                                dialog);
-void hildon_find_object_dialog_set_label(HildonFindObjectDialog * dialog,
-                                         const gchar * label);
-
-G_END_DECLS
-#endif
diff --git a/hildon-widgets/hildon-find-replace-dialog.c b/hildon-widgets/hildon-find-replace-dialog.c
deleted file mode 100644 (file)
index 33e78fb..0000000
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005 Nokia Corporation.
- *
- * Contact: Luc Pionchon <luc.pionchon@nokia.com>
- *
- * 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
- *
- */
-
-/* HILDON DOC
- * @shortdesc: FindReplaceDialog is a dialog for setting options for
- * search/replace functionality in an application.
- * @longdesc: FindReplaceDialog is a dialog for setting options for
- * search/replace functionality in an application.
- * The dialog has three modes depending on what kind of data the search is
- * being made to (normal, read-only, immutable).
- * Also a options dialog for different search options can be added (will be
- * implemented later).
- */
-
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <errno.h>
-#include <string.h>
-#include <strings.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#include <hildon-find-replace-dialog.h>
-#include <hildon-search.h>
-#include <hildon-widgets/hildon-caption.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <libintl.h>
-#define _(String) dgettext(PACKAGE, String)
-
-static GtkDialogClass *parent_class;
-static gboolean show_replace_entry = TRUE;
-
-typedef struct _HildonFindReplaceDialogPrivate
-    HildonFindReplaceDialogPrivate;
-struct _HildonFindReplaceDialogPrivate {
-    GtkButton *findButton;
-    GtkButton *closeButton;
-    GtkButton *replaceButton;
-    GtkButton *optionsButton;
-
-    HildonCaption *findEntry;
-    HildonCaption *replaceEntry;
-
-    HildonReplaceType mode;
-
-    GtkDialog *optionsDialog;
-};
-
-#define HILDON_FIND_REPLACE_DIALOG_GET_PRIVATE(o)\
-        (G_TYPE_INSTANCE_GET_PRIVATE ((o),\
-         HILDON_TYPE_FIND_REPLACE_DIALOG,\
-         HildonFindReplaceDialogPrivate))
-
-static void
-hildon_find_replace_dialog_class_init(HildonFindReplaceDialogClass *class);
-static void hildon_find_replace_dialog_init(HildonFindReplaceDialog *widget);
-static void toggle_replace(GtkButton *button, gpointer data);
-static void
-open_options_dialog(GtkWidget *widget, HildonFindReplaceDialog *dialog);
-static void hildon_find_replace_dialog_response_cb(GtkDialog *dialog,
-                                                   gint response,
-                                                   gpointer data);
-static void hildon_find_replace_options_dialog_response_cb(GtkDialog *dialog,
-                                                           gint response,
-                                                           gpointer data);
-
-static void hildon_find_replace_dialog_response_cb(GtkDialog *dialog,
-                                                   gint response,
-                                                   gpointer data)
-{
-    g_signal_stop_emission_by_name(G_OBJECT(dialog), "response");
-    if (response == GTK_RESPONSE_OK)
-        g_print("user clicked ok in find/replace dialog\n");
-
-    gtk_widget_hide(GTK_WIDGET(dialog));
-}
-static void hildon_find_replace_options_dialog_response_cb(GtkDialog *dialog,
-                                                           gint response,
-                                                           gpointer data)
-{
-    g_signal_stop_emission_by_name(G_OBJECT(dialog), "response");
-    if (response == GTK_RESPONSE_OK)
-        g_print("user clicked ok in find/replace-options dialog\n");
-
-    gtk_widget_hide(GTK_WIDGET(dialog));
-    gtk_window_present(GTK_WINDOW(data));
-}
-
-static void
-open_options_dialog(GtkWidget *widget, HildonFindReplaceDialog *dialog)
-{
-    HildonFindReplaceDialogPrivate *priv;
-
-    priv = HILDON_FIND_REPLACE_DIALOG_GET_PRIVATE(dialog);
-
-    g_return_if_fail(GTK_IS_DIALOG(priv->optionsDialog));
-    g_signal_connect(G_OBJECT(priv->optionsDialog), "response",
-                     G_CALLBACK
-                     (hildon_find_replace_options_dialog_response_cb),
-                     dialog);
-    gtk_dialog_run(priv->optionsDialog);
-}
-
-static void toggle_replace(GtkButton *button, gpointer self)
-{
-    HildonFindReplaceDialog *dialog;
-    HildonFindReplaceDialogPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_FIND_REPLACE_DIALOG(self));
-
-    dialog = HILDON_FIND_REPLACE_DIALOG(self);
-    priv = HILDON_FIND_REPLACE_DIALOG_GET_PRIVATE(dialog);
-
-    if (show_replace_entry)
-    {
-        g_object_ref(priv->replaceEntry);
-        gtk_widget_hide(GTK_WIDGET(priv->replaceEntry));
-        show_replace_entry = FALSE;
-    }
-    else
-    {
-        gtk_widget_show(GTK_WIDGET(priv->replaceEntry));
-        show_replace_entry = TRUE;
-    }
-
-}
-
-static void
-hildon_find_replace_dialog_class_init(HildonFindReplaceDialogClass *class)
-{
-    parent_class = g_type_class_peek_parent(class);
-    g_type_class_add_private(class,
-                             sizeof(HildonFindReplaceDialogPrivate));
-}
-
-static void
-hildon_find_replace_dialog_init(HildonFindReplaceDialog *dialog)
-{
-    HildonFindReplaceDialogPrivate *priv =
-        HILDON_FIND_REPLACE_DIALOG_GET_PRIVATE(dialog);
-    GtkSizeGroup *group =
-        GTK_SIZE_GROUP(gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL));
-    GtkWidget *control;
-
-    gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
-    gtk_window_set_title(GTK_WINDOW(dialog), _("Find and Replace"));
-
-    priv->findButton = GTK_BUTTON(gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                                        _("Find"),
-                                                        GTK_RESPONSE_OK));
-
-    priv->replaceButton =
-        GTK_BUTTON(
-    gtk_dialog_add_button(GTK_DIALOG(dialog),_("Replace"), GTK_RESPONSE_NONE));
-    g_signal_connect(priv->replaceButton, "clicked",
-                     G_CALLBACK(toggle_replace), dialog);
-
-    priv->optionsButton =
-        GTK_BUTTON(
-    gtk_dialog_add_button(GTK_DIALOG(dialog),
-                       _("Options"), GTK_RESPONSE_NONE));
-
-    priv->closeButton =
-        GTK_BUTTON(gtk_dialog_add_button
-                   (GTK_DIALOG(dialog), _("Close"), GTK_RESPONSE_CANCEL));
-
-    control = gtk_entry_new();
-    priv->findEntry = HILDON_CAPTION(hildon_caption_new(GTK_SIZE_GROUP(group),
-                                     _("Find"), GTK_WIDGET(control), NULL,
-                                     HILDON_CAPTION_OPTIONAL));
-
-    control = gtk_entry_new();
-    priv->replaceEntry = HILDON_CAPTION(hildon_caption_new(group,
-                                        _("Replace with"), control, NULL,
-                                        HILDON_CAPTION_OPTIONAL));
-
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
-                       GTK_WIDGET(priv->findEntry), FALSE, FALSE, 0);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
-                       GTK_WIDGET(priv->replaceEntry), FALSE, FALSE, 0);
-
-    priv->optionsDialog = GTK_DIALOG(dialog);
-
-    gtk_widget_show_all(GTK_DIALOG(dialog)->vbox);
-    gtk_widget_show_all(GTK_DIALOG(dialog)->action_area);
-
-    gtk_widget_hide(GTK_WIDGET(priv->replaceEntry));
-    show_replace_entry = FALSE;
-}
-
-GType hildon_find_replace_dialog_get_type(void)
-{
-    static GType dialog_type = 0;
-
-    if (!dialog_type) {
-        static const GTypeInfo dialog_info = {
-            sizeof(HildonFindReplaceDialogClass),
-            NULL,       /* base_init */
-            NULL,       /* base_finalize */
-            (GClassInitFunc) hildon_find_replace_dialog_class_init,
-            NULL,       /* class_finalize */
-            NULL,       /* class_data */
-            sizeof(HildonFindReplaceDialog),
-            0,  /* n_preallocs */
-            (GInstanceInitFunc) hildon_find_replace_dialog_init
-        };
-        dialog_type = g_type_register_static(GTK_TYPE_DIALOG,
-                                             "HildonFindReplaceDialog",
-                                             &dialog_info, 0);
-    }
-
-    return dialog_type;
-}
-
-/**
- * hildon_find_replace_dialog_new:
- * @parent: the parent window of the dialog.
- * @type: type (HildonReplaceType) of replace dialog, can be one of: 
- * HILDON_REPLACE_IMMUTABLE, HILDON_REPLACE_READ_ONLY,
- * HILDON_REPLACE_NORMAL.
- * 
- * Creates a new #HildonFindReplaceDialog widget with Find and Close
- * buttons. This is the only thing that the dialog will do (plus a find
- * entry) if the mode is
- * HILDON_REPLACE_IMMUTABLE. Otherwise, if the parameter type
- * (HildonReplaceType) is 
- * HILDON_REPLACE_NORMAL or HILDON_REPLACE_READ_ONLY then a Replace button
- * fill be added. 
- * Pressing replace button will add a 'Replace with' field into the dialog.
- * If dialog is 
- * of type HILDON_REPLACE_READ_ONLY then the replace button will be
- * insensitive. 
- *
- * Return value: the newly created #HildonFindReplaceDialog
- */
-GtkWidget *hildon_find_replace_dialog_new(GtkWindow *parent,
-                                          HildonReplaceType type)
-{
-    HildonFindReplaceDialog *self =
-        HILDON_FIND_REPLACE_DIALOG(g_object_new(
-                                   HILDON_TYPE_FIND_REPLACE_DIALOG, NULL));
-
-    HildonFindReplaceDialogPrivate *priv =
-        HILDON_FIND_REPLACE_DIALOG_GET_PRIVATE(self);
-
-    priv->mode = type;
-    g_signal_connect(G_OBJECT(self), "response",
-                     G_CALLBACK(hildon_find_replace_dialog_response_cb),
-                     NULL);
-
-    gtk_widget_hide(GTK_WIDGET(priv->optionsButton));
-    if (priv->mode == HILDON_REPLACE_IMMUTABLE)
-        gtk_widget_hide(GTK_WIDGET(priv->replaceButton));
-    else if (priv->mode == HILDON_REPLACE_READ_ONLY)
-        gtk_widget_set_sensitive(GTK_WIDGET(priv->replaceButton), FALSE);
-
-    if (parent)
-        gtk_window_set_transient_for(GTK_WINDOW(self), parent);
-
-    return GTK_WIDGET(self);
-}
-
-/**
- * hildon_find_replace_dialog_new_with_options:
- * @parent: the parent window of the dialog.
- * @dialog: the options dialog.
- * @type: HildonReplaceType for mode.
- *
- * Creates a new #HildonFindReplaceDialog widget with Find,
- * Options and Close buttons.
- * This is the only thing that the dialog will do (plus a find entry)
- * if the mode is
- * HILDON_REPLACE_IMMUTABLE. Otherwise, if the parameter type
- * (HildonReplaceType) is 
- * HILDON_REPLACE_NORMAL or HILDON_REPLACE_READ_ONLY then a Replace button
- * fill be added. 
- * Pressing replace button will add a 'Replace with' field into the dialog.
- * If dialog is 
- * of type HILDON_REPLACE_READ_ONLY then the replace button will be
- * insensitive. 
- *
- * Options Dialog is a feature that will be implemented later. 
- * 
- * Return value: the newly created #HildonFindReplaceDialog
- */
-GtkWidget *hildon_find_replace_dialog_new_with_options(GtkWindow *parent,
-                                                       GtkDialog *dialog,
-                                                       HildonReplaceType type)
-{
-    HildonFindReplaceDialog *self = HILDON_FIND_REPLACE_DIALOG(g_object_new(
-                                    HILDON_TYPE_FIND_REPLACE_DIALOG, NULL));
-    HildonFindReplaceDialogPrivate *priv =
-        HILDON_FIND_REPLACE_DIALOG_GET_PRIVATE(self);
-
-    g_signal_connect(G_OBJECT(self), "response",
-                     G_CALLBACK(hildon_find_replace_dialog_response_cb), NULL);
-
-    priv->optionsDialog = GTK_DIALOG(dialog);
-    priv->mode = type;
-
-    if (priv->optionsDialog != NULL)
-        g_signal_connect(G_OBJECT(priv->optionsButton), "clicked",
-                         G_CALLBACK(open_options_dialog), self);
-    else
-        gtk_widget_hide(GTK_WIDGET(priv->optionsButton));
-
-    if (priv->mode == HILDON_REPLACE_IMMUTABLE)
-    {
-        gtk_widget_hide(GTK_WIDGET(priv->replaceEntry));
-        gtk_widget_hide(GTK_WIDGET(priv->replaceButton));
-    }
-    else if (priv->mode == HILDON_REPLACE_READ_ONLY)
-    {
-        gtk_widget_hide(GTK_WIDGET(priv->replaceEntry));
-        gtk_widget_set_sensitive(GTK_WIDGET(priv->replaceButton), FALSE);
-    }
-
-    if (parent)
-        gtk_window_set_transient_for(GTK_WINDOW(self), parent);
-
-    if (dialog)
-        gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(self));
-
-    return GTK_WIDGET(self);
-}
-
-/**
- * hildon_find_replace_dialog_get_text:
- * @dialog: the dialog.
- *
- * Gets the text that's in the find entry.
- *
- * Return value: a pointer to the find string.
- */
-const gchar *
-hildon_find_replace_dialog_get_text(HildonFindReplaceDialog *dialog)
-{
-    HildonFindReplaceDialogPrivate *priv =
-        HILDON_FIND_REPLACE_DIALOG_GET_PRIVATE(dialog);
-    return gtk_entry_get_text(GTK_ENTRY(
-                              hildon_caption_get_control(priv->findEntry)));
-}
-
-/**
- * hildon_find_replace_dialog_get_new_text:
- * @dialog: the dialog.
- * 
- * Gets the text that's in the replace entry.
- * 
- * Return value: a pointer to the replace string.
- */
-const gchar*
-hildon_find_replace_dialog_get_new_text(HildonFindReplaceDialog *dialog)
-{
-    HildonFindReplaceDialogPrivate *priv =
-        HILDON_FIND_REPLACE_DIALOG_GET_PRIVATE(dialog);
-    return gtk_entry_get_text(GTK_ENTRY(hildon_caption_get_control(
-                              priv->replaceEntry)));
-}
diff --git a/hildon-widgets/hildon-find-replace-dialog.h b/hildon-widgets/hildon-find-replace-dialog.h
deleted file mode 100644 (file)
index 1727ed4..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005 Nokia Corporation.
- *
- * Contact: Luc Pionchon <luc.pionchon@nokia.com>
- *
- * 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
- *
- */
-
-#ifndef __HILDON_FIND_REPLACE_DIALOG_H__
-#define __HILDON_FIND_REPLACE_DIALOG_H__
-
-#include <gtk/gtkdialog.h>
-
-G_BEGIN_DECLS
-#define HILDON_TYPE_FIND_REPLACE_DIALOG \
-  ( hildon_find_replace_dialog_get_type() )
-#define HILDON_FIND_REPLACE_DIALOG(obj) \
-  (GTK_CHECK_CAST (obj, HILDON_TYPE_FIND_REPLACE_DIALOG,\
-   HildonFindReplaceDialog))
-#define HILDON_FIND_REPLACE_DIALOG_CLASS(klass) \
-  (GTK_CHECK_CLASS_CAST ((klass), HILDON_TYPE_FIND_REPLACE_DIALOG, \
-  HildonFindReplaceDialogClass))
-#define HILDON_IS_FIND_REPLACE_DIALOG(obj) \
-  (GTK_CHECK_TYPE (obj, HILDON_TYPE_FIND_REPLACE_DIALOG))
-#define HILDON_IS_FIND_REPLACE_DIALOG_CLASS(klass) \
-  (GTK_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_FIND_REPLACE_DIALOG))
-typedef struct _HildonFindReplaceDialog HildonFindReplaceDialog;
-typedef struct _HildonFindReplaceDialogClass HildonFindReplaceDialogClass;
-
-/**
- * HildonReplaceType:
- * @HILDON_REPLACE_NORMAL: Replace mode is available.
- * @HILDON_REPLACE_READ_ONLY: Replace button is inactive. This is used when
- * content is read only.
- * @HILDON_REPLACE_IMMUTABLE: There is no replace button at all. This is
- * used (for example) for web pages.
- *
- * These values defines if replace button in dialog is available.
- */
-typedef enum {
-    HILDON_REPLACE_NORMAL = 0,
-    HILDON_REPLACE_READ_ONLY,
-    HILDON_REPLACE_IMMUTABLE
-} HildonReplaceType;
-
-struct _HildonFindReplaceDialog {
-    GtkDialog parent;
-};
-
-struct _HildonFindReplaceDialogClass {
-    GtkDialogClass parent_class;
-};
-
-GType hildon_find_replace_dialog_get_type(void);
-
-GtkWidget *hildon_find_replace_dialog_new(GtkWindow * parent,
-                                          HildonReplaceType type);
-GtkWidget *hildon_find_replace_dialog_new_with_options(GtkWindow * parent,
-                                                       GtkDialog * dialog,
-                                                       HildonReplaceType type);
-
-const gchar *hildon_find_replace_dialog_get_text(HildonFindReplaceDialog *
-                                                 dialog);
-const gchar
-    *hildon_find_replace_dialog_get_new_text(HildonFindReplaceDialog *
-                                             dialog);
-
-void hildon_find_replace_dialog_set_text(HildonFindReplaceDialog * dialog,
-                                         const gchar * text);
-void hildon_find_replace_dialog_set_new_text(HildonFindReplaceDialog *
-                                             dialog,
-                                             const gchar * new_text);
-
-G_END_DECLS
-#endif
index e9a9260..5ac96c9 100644 (file)
  *
  */
 
-/*
- * @file hildon-font-selection-dialog.c
- *
- * This file implements the HildonFontSelectionDialog widget
- *
- * A modification from the gtk_font_selection_dialog
-*/
-
 #include <stdlib.h>
 #include <string.h>
 
 #include <gtk/gtkvbox.h>
 #include <gtk/gtkliststore.h>
 #include <gtk/gtknotebook.h>
-#include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
+#include <glib.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "hildon-font-selection-dialog.h"
 #include <hildon-widgets/hildon-caption.h>
 #include <hildon-widgets/hildon-color-selector.h>
+#include <hildon-widgets/hildon-color-button.h>
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #include <libintl.h>
 #define _(String) dgettext(PACKAGE, String)
 
-#define PREVIEW_RESPONSE_ID 12345
+#define SUPERSCRIPT_RISE 3333
+#define SUBSCRIPT_LOW -3333
+#define ON_BIT 0x01
+#define OFF_BIT 0x02
+#define REFERENCE_LINE "Reference: " /*localized string?*/
 
 /*
  * These are what we use as the standard font sizes, for the size list.
  */
-static const guint16 font_sizes[] = {
-    8, 9, 10, 11, 12, 13, 14, 16, 18, 20, 22, 24, 26, 28,
-    32, 36, 40, 48, 56, 64, 72
+static const guint16 font_sizes[] = 
+{
+  6, 8, 10, 12, 16, 24, 32
 };
 
 #define HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(obj) \
-        (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
-        HILDON_TYPE_FONT_SELECTION_DIALOG, HildonFontSelectionDialogPrivate))
+(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
+                             HILDON_TYPE_FONT_SELECTION_DIALOG, \
+                             HildonFontSelectionDialogPrivate))
+
+/*None of designed api function works, so now it all comes down to 
+ *use properties to achieve what we are supposed to achieve*/
+enum
+{
+  PROP_FAMILY = 1,
+  PROP_FAMILY_SET,
+  PROP_SIZE,
+  PROP_SIZE_SET,
+  PROP_COLOR,
+  PROP_COLOR_SET,
+  PROP_BOLD,
+  PROP_BOLD_SET,
+  PROP_ITALIC,
+  PROP_ITALIC_SET,
+  PROP_UNDERLINE,
+  PROP_UNDERLINE_SET,
+  PROP_STRIKETHROUGH,
+  PROP_STRIKETHROUGH_SET,
+  PROP_POSITION,
+  PROP_POSITION_SET
+};
 
 typedef struct
 _HildonFontSelectionDialogPrivate HildonFontSelectionDialogPrivate;
-struct _HildonFontSelectionDialogPrivate {
-    GtkNotebook *notebook;
-    GtkWidget *vbox_tab[3];
-    GtkWidget *caption_control;
-    GtkSizeGroup *group;
-
-    gchar *preview_text;
-    guint keysnooper;
-
-/*Tab one*/
-    GtkWidget *cbx_font_type;
-    GtkWidget *cbx_font_size;
-    GtkWidget *font_color_box;
-    GtkWidget *font_color_button;
-    GdkColor c_table;
-    GtkWidget *e_table;
-
-/*Tab two*/
-    GtkWidget *chk_bold;
-    GtkWidget *chk_italic;
-    GtkWidget *chk_underline;
-
-/*Tab three*/
-    GtkWidget *chk_strikethrough;
-    GtkWidget *cbx_positioning;
-
-    gboolean both;      /* Most of the fonts has a bold-italic font type.
-                           (Not just Bold and Italic BUT --> Bold-italic) */
-/*     gboolean auto_resize;*/
-/*     gint dialog_width;*/
-
-    HildonPositioning positioning;      /* Current positioning */
-    PangoFontFamily *family;    /* Current family */
-    HildonFontFaceType face;    /* Current face number */
-    gint size;  /* Current size */
-
-/*Components for the preview dialog*/
-    GtkWidget *dlg_preview;
-    GtkWidget *lbl_preview;
-
-/*Every family*/
-    PangoFontFamily **families;
-    gint n_families;
-/*The faces for current family*/
-    PangoFontFace **faces;
-/*There's different names for the faces (Bold == Demi, etc.) -
-  So we have "a layer" to determine the correct one*/
-    HildonFontFaceType facetypes[4];
-};
 
-static void hildon_font_preview_dialog_close(GtkDialog * dialog,
-                                             gint response, gpointer data);
-static gboolean
-hildon_font_selection_dialog_preview_key_press(GtkWidget * widget,
-                                               GdkEventKey * event,
-                                               gpointer data);
+struct _HildonFontSelectionDialogPrivate 
+{  
+  GtkNotebook *notebook;
 
-/*Some tools from gtk_font_selection*/
-static int cmp_families(const void *a, const void *b);
-static int faces_sort_func(const void *a, const void *b);
-static int compare_font_descriptions(const PangoFontDescription * a,
-                                     const PangoFontDescription * b); 
-                                    
+  gchar *preview_text;
 
-static void 
-hildon_font_selection_dialog_check_button_clicked(GtkToggleButton *chk,
-               gpointer data);
-static void
-hildon_font_selection_dialog_show_preview(HildonFontSelectionDialog *
-                                          fontsel);
-static void
-hildon_font_selection_dialog_set_font_for_preview(HildonFontSelectionDialog
-                                                  * fontsel);
-static PangoAttrList
-    *hildon_font_selection_dialog_create_font(HildonFontSelectionDialog *
-                                              fontsel);
+  /*Tab one*/
+  GtkWidget *cbx_font_type;
+  GtkWidget *cbx_font_size;
+  GtkWidget *font_color_button;
 
-static void
-hildon_font_selection_dialog_show_available_positionings
-(HildonFontSelectionDialog * fontsel);
-static void
-hildon_font_selection_dialog_show_available_fonts(HildonFontSelectionDialog
-                                                  * fontseldiag);
-static void
-hildon_font_selection_dialog_show_available_styles
-(HildonFontSelectionDialog * fontsel);
-static void
-hildon_font_selection_dialog_show_available_sizes(HildonFontSelectionDialog
-                                                  * fontsel,
-                                                  gboolean first_time);
-static void
-hildon_font_selection_dialog_class_init(HildonFontSelectionDialogClass *
-                                        klass);
-static void hildon_font_selection_dialog_init(HildonFontSelectionDialog *
-                                              fontseldiag);
-static void hildon_font_selection_dialog_finalize(GObject * object);
-
-static void hildon_font_selection_dialog_preview_click(GtkDialog * dialog,
-                                                       gint response,
-                                                       gpointer data);
-static void hildon_font_selection_dialog_font_type_changed(GtkComboBox *
-                                                           cbox,
-                                                           gpointer
-                                                           userdata);
-static void
-hildon_font_selection_dialog_check_button_toggled(GtkToggleButton * chk,
-                                                  gpointer user_data);
-
-static void show_selector(GtkWidget * widget, GtkButton * b,
-                          gpointer data);
-static void set_event_box_color(GtkWidget * b, GdkColor * color);
-static gboolean color_key_press(GtkWidget * widget, GdkEventKey * event,
-                                gpointer data);
-static gint hildon_font_selection_dialog_key_snooper(GtkWidget * swidget,
-                                                     GdkEventKey * event,
-                                                     GtkWidget * widget);
+  /*Tab two*/
+  GtkWidget *chk_bold;
+  GtkWidget *chk_italic;
+  GtkWidget *chk_underline;
 
-static GtkDialogClass *font_selection_dialog_parent_class = NULL;
+  /*Tab three*/
+  GtkWidget *chk_strikethrough;
+  GtkWidget *cbx_positioning;
 
-/* property setter and getter */
-static void hildon_font_selection_dialog_set_property(GObject * object,
-               guint property_id,
-               const GValue * value,
-               GParamSpec * pspec);
-static void hildon_font_selection_dialog_get_property(GObject * object,
-               guint property_id,
-               GValue * value,
-               GParamSpec * pspec);
-
-enum {
-       PROP_SELECTOR_BOLD = 1,
-       PROP_SELECTOR_ITALIC,   /* add all needed properties here */
-       PROP_SELECTOR_UNDERLINE,
-       PROP_SELECTOR_STRIKETHROUGH
-};
+  /*Every family*/
+  PangoFontFamily **families;
+  gint n_families;
 
-enum {
-       PROP_SET,
-       PROP_INTERMEDIATE,
-       PROP_DIMMED,
-       PROP_UNSET
+  /*color_set is used to show whether the color is inconsistent
+   * The handler id is used to block the signal emission
+   * when we change the color setting*/
+  
+  gboolean color_set;
+  gulong color_modified_signal_handler;
 };
 
-
-GType hildon_font_selection_dialog_get_type(void)
+/*combo box active row indicator -2--inconsistent, -1--undefined 
+ * please make sure that you use settings_init settings_apply
+ * and settings_destroy, dont even try to touch this structure 
+ * without using the three above interface functions, of course
+ * if you know what you are doing, do as you please ;-)*/
+typedef struct
 {
-    static GType font_selection_dialog_type = 0;
-
-    if (!font_selection_dialog_type) {
-        static const GTypeInfo fontsel_diag_info = {
-            sizeof(HildonFontSelectionDialogClass),
-            NULL,       /* base_init */
-            NULL,       /* base_finalize */
-            (GClassInitFunc) hildon_font_selection_dialog_class_init,
-            NULL,       /* class_finalize */
-            NULL,       /* class_data */
-            sizeof(HildonFontSelectionDialog),
-            0,  /* n_preallocs */
-            (GInstanceInitFunc) hildon_font_selection_dialog_init,
-        };
-
-        font_selection_dialog_type =
-            g_type_register_static(GTK_TYPE_DIALOG,
-                                   "HildonFontSelectionDialog",
-                                   &fontsel_diag_info, 0);
-    }
+  HildonFontSelectionDialog
+               *fsd; /*pointer to our font selection dialog*/
+  
+  gint         family; /*combo box indicator*/
+  gint         size; /*combo box indicator*/
+  GdkColor     *color; /*free after read the setting*/
+  gboolean     color_inconsist;
+  gint         weight; /*bit mask*/
+  gint         style;  /*bit mask*/
+  gint         underline; /*bit mask*/
+  gint         strikethrough; /*bit mask*/
+  gint         position; /*combo box indicator*/
+
+}HildonFontSelectionDialogSettings;
 
-    return font_selection_dialog_type;
-}
-
-static void
-hildon_font_selection_dialog_class_init(HildonFontSelectionDialogClass *
-                                        klass)
-{
-    GObjectClass *gobject_class;
+static gboolean
+              hildon_font_selection_dialog_preview_key_press
+                                            (GtkWidget * widget,
+                                             GdkEventKey * event,
+                                             gpointer data);
 
-    font_selection_dialog_parent_class = g_type_class_peek_parent(klass);
-    gobject_class = G_OBJECT_CLASS(klass);
-    gobject_class->finalize = hildon_font_selection_dialog_finalize;
+/*Some tools from gtk_font_selection*/
+static int    cmp_families                   (const void *a, const void *b);
+
+static void   hildon_font_selection_dialog_show_preview
+                                             (HildonFontSelectionDialog 
+                                             *fontsel);
+                                            
+static PangoAttrList*
+              hildon_font_selection_dialog_create_attrlist
+                                            (HildonFontSelectionDialog 
+                                             *fontsel, guint start_index,
+                                             guint len);
+
+static void   hildon_font_selection_dialog_show_available_positionings
+                                             (HildonFontSelectionDialogPrivate
+                                             *priv);
+                                                
+static void   hildon_font_selection_dialog_show_available_fonts
+                                             (HildonFontSelectionDialog
+                                             *fontsel);
+                                                
+static void   hildon_font_selection_dialog_show_available_sizes
+                                             (HildonFontSelectionDialogPrivate
+                                             *priv);
+
+static void   hildon_font_selection_dialog_class_init
+                                             (HildonFontSelectionDialogClass 
+                                             *klass);
+                                                
+static void   hildon_font_selection_dialog_init
+                                             (HildonFontSelectionDialog 
+                                             *fontseldiag);
+
+static void   hildon_font_selection_dialog_finalize
+                                             (GObject * object);
+
+static void   hildon_font_selection_dialog_construct_notebook  
+                                             (HildonFontSelectionDialog
+                                             *fontsel);
+                                            
+static void   color_modified_cb              (HildonColorButton *button,
+                                             GParamSpec *pspec,
+                                             gpointer data);
+
+static void   check_tags                     (gpointer data,
+                                             gpointer user_data);
+
+static void   settings_init                  (HildonFontSelectionDialogSettings
+                                             *setttings,
+                                             HildonFontSelectionDialog
+                                             *fsd);
+
+static void   settings_apply                 (HildonFontSelectionDialogSettings
+                                             *setttings);
+
+static void   settings_destroy               (HildonFontSelectionDialogSettings
+                                             *setttings);
+
+static void   bit_mask_toggle                (gint mask, GtkToggleButton*
+                                             button, GObject *object, 
+                                             const gchar *prop, 
+                                             const gchar *prop_set);
+
+static void   combo_active                   (gint active, GtkComboBox *box,
+                                             GObject *object, 
+                                             const gchar *prop,
+                                             const gchar *prop_set);
+
+static void   add_preview_text_attr          (PangoAttrList *list, 
+                                             PangoAttribute *attr, 
+                                             guint start, 
+                                             guint len);
+
+static void   toggle_clicked                 (GtkButton *button, 
+                                             gpointer data);
+       
+                                            
+                                            
+static GtkDialogClass *font_selection_dialog_parent_class = NULL;
 
-    /* property stuff */
-    gobject_class->set_property = hildon_font_selection_dialog_set_property;
-    gobject_class->get_property = hildon_font_selection_dialog_get_property;
+GType hildon_font_selection_dialog_get_type(void)
+{
+  static GType font_selection_dialog_type = 0;
+
+  if (!font_selection_dialog_type) {
+    static const GTypeInfo fontsel_diag_info = {
+      sizeof(HildonFontSelectionDialogClass),
+      NULL,       /* base_init */
+      NULL,       /* base_finalize */
+      (GClassInitFunc) hildon_font_selection_dialog_class_init,
+      NULL,       /* class_finalize */
+      NULL,       /* class_data */
+      sizeof(HildonFontSelectionDialog),
+      0,  /* n_preallocs */
+      (GInstanceInitFunc) hildon_font_selection_dialog_init,
+    };
 
-    g_object_class_install_property (gobject_class, PROP_SELECTOR_BOLD, 
-                   g_param_spec_boolean ("is_bold_face", "BoldFace", 
-                                    "Whether the text is boldface or not",
-                           FALSE, G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
+    font_selection_dialog_type =
+      g_type_register_static(GTK_TYPE_DIALOG,
+                            "HildonFontSelectionDialog",
+                            &fontsel_diag_info, 0);
+  }
 
-    g_type_class_add_private(klass,
-        sizeof(struct _HildonFontSelectionDialogPrivate));
+  return font_selection_dialog_type;
 }
 
-
-static void hildon_font_selection_dialog_init(HildonFontSelectionDialog *
-                                              fontseldiag)
+static void
+hildon_font_selection_dialog_get_property (GObject      *object,
+                                          guint         prop_id,
+                                          GValue       *value,
+                                          GParamSpec   *pspec)
 {
-    HildonFontSelectionDialogPrivate *priv =
-        HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontseldiag);
-    int i;
-    for (i = 0; i < 4; ++i){
-           priv->facetypes[i] = -1;
-    }
-    
-    priv->positioning = HILDON_POSITIONING_NORMAL;
-    priv->size = 10;
-    priv->face = 0;
-    priv->families = NULL;
-    priv->notebook = GTK_NOTEBOOK(gtk_notebook_new());
-
-    for (i = 0; i < 3; i++)
-        priv->vbox_tab[i] = gtk_vbox_new(FALSE, 0);
-
-    priv->group =
-        GTK_SIZE_GROUP(gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL));
-
-/*Tab one*/
-    priv->cbx_font_type = gtk_combo_box_new_text();
-    hildon_font_selection_dialog_show_available_fonts(fontseldiag);
-    priv->caption_control = hildon_caption_new(priv->group,
-                                               _("ecdg_fi_font_font"),
-                                               priv->cbx_font_type,
-                                               NULL,
-                                               HILDON_CAPTION_OPTIONAL);
-    gtk_box_pack_start(GTK_BOX(priv->vbox_tab[0]), priv->caption_control,
-                       FALSE, FALSE, 0);
-
-    priv->cbx_font_size = gtk_combo_box_new_text();
-    hildon_font_selection_dialog_show_available_sizes(fontseldiag, TRUE);
-    priv->caption_control = hildon_caption_new(priv->group,
-                                               _("ecdg_fi_font_size"),
-                                               priv->cbx_font_size,
-                                               NULL,
-                                               HILDON_CAPTION_OPTIONAL);
-    gtk_box_pack_start(GTK_BOX(priv->vbox_tab[0]), priv->caption_control,
-                       FALSE, FALSE, 0);
-
-    priv->font_color_box = gtk_hbox_new(FALSE, 0);
-    g_object_set(G_OBJECT(priv->font_color_box), "can-focus", TRUE, NULL);
-    priv->font_color_button = gtk_event_box_new();
-    g_object_set(G_OBJECT(priv->font_color_button), "can-focus", TRUE,
-                 NULL);
-    g_signal_connect_swapped(GTK_WIDGET(priv->font_color_button),
-                             "button-release-event",
-                             G_CALLBACK(show_selector),
-                             (HildonFontSelectionDialog *) fontseldiag);
-    g_signal_connect_swapped(GTK_WIDGET(priv->font_color_box),
-                             "key-press-event",
-                             G_CALLBACK(color_key_press), fontseldiag);
-    gtk_box_pack_start(GTK_BOX(priv->font_color_box),
-                       priv->font_color_button, FALSE, FALSE, 0);
-    gtk_box_pack_start(GTK_BOX(priv->font_color_box), gtk_label_new(""),
-                       TRUE, TRUE, 0);
-
-    gtk_widget_set_size_request(GTK_WIDGET(priv->font_color_button), 20,
-                                20);
-    priv->c_table.red = 0;      /* (0,0,0) is black */
-    priv->c_table.green = 0;
-    priv->c_table.blue = 0;
-    set_event_box_color(GTK_WIDGET(priv->font_color_button),
-                        &priv->c_table);
-    priv->caption_control =
-        hildon_caption_new(priv->group, _("ecdg_fi_font_color_selector"),
-                           priv->font_color_box,
-                           NULL, HILDON_CAPTION_OPTIONAL);
-    gtk_box_pack_start(GTK_BOX(priv->vbox_tab[0]), priv->caption_control,
-                       FALSE, FALSE, 0);
-
-/*Tab two*/
-    priv->chk_bold = gtk_check_button_new();
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_bold), FALSE);
-    priv->caption_control = hildon_caption_new(priv->group,
-                                               _("ecdg_fi_font_bold"),
-                                               priv->chk_bold,
-                                               NULL,
-                                               HILDON_CAPTION_OPTIONAL);
-    gtk_box_pack_start(GTK_BOX(priv->vbox_tab[1]), priv->caption_control,
-                       FALSE, FALSE, 0);
-
-    priv->chk_italic = gtk_check_button_new();
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_italic),
-                                 FALSE);
-    priv->caption_control =
-        hildon_caption_new(priv->group, _("ecdg_fi_font_italic"),
-                           priv->chk_italic,
-                           NULL, HILDON_CAPTION_OPTIONAL);
-    gtk_box_pack_start(GTK_BOX(priv->vbox_tab[1]), priv->caption_control,
-                       FALSE, FALSE, 0);
-
-    priv->chk_underline = gtk_check_button_new();
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_underline),
-                                 FALSE);
-    priv->caption_control =
-        hildon_caption_new(priv->group, _("ecdg_fi_font_underline"),
-                           priv->chk_underline, NULL,
-                           HILDON_CAPTION_OPTIONAL);
-    gtk_box_pack_start(GTK_BOX(priv->vbox_tab[1]), priv->caption_control,
-                       FALSE, FALSE, 0);
-
-    /* Sets bold and italic checkboxes */
-    hildon_font_selection_dialog_show_available_styles(fontseldiag);
-
-/*Tab three*/
-    priv->chk_strikethrough = gtk_check_button_new();
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                 (priv->chk_strikethrough), FALSE);
-    priv->caption_control =
-        hildon_caption_new(priv->group, _("ecdg_fi_font_strikethrough"),
-                           priv->chk_strikethrough, NULL,
-                           HILDON_CAPTION_OPTIONAL);
-    gtk_box_pack_start(GTK_BOX(priv->vbox_tab[2]), priv->caption_control,
-                       FALSE, FALSE, 0);
-
-    priv->cbx_positioning = gtk_combo_box_new_text();
-    hildon_font_selection_dialog_show_available_positionings(fontseldiag);
-    priv->caption_control =
-        hildon_caption_new(priv->group, _("ecdg_fi_font_special"),
-                           priv->cbx_positioning, NULL,
-                           HILDON_CAPTION_OPTIONAL);
-    gtk_box_pack_start(GTK_BOX(priv->vbox_tab[2]), priv->caption_control,
-                       FALSE, FALSE, 0);
-
-    /* Populate notebook */
-    gtk_notebook_insert_page(priv->notebook, priv->vbox_tab[0], NULL, 0);
-    gtk_notebook_insert_page(priv->notebook, priv->vbox_tab[1], NULL, 1);
-    gtk_notebook_insert_page(priv->notebook, priv->vbox_tab[2], NULL, 2);
-    gtk_notebook_set_tab_label_text(priv->notebook, priv->vbox_tab[0],
-                                    _("ecdg_ti_font_dialog_style"));
-    gtk_notebook_set_tab_label_text(priv->notebook, priv->vbox_tab[1],
-                                    _("ecdg_ti_font_dialog_format"));
-    gtk_notebook_set_tab_label_text(priv->notebook, priv->vbox_tab[2],
-                                    _("ecdg_ti_font_dialog_other"));
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(fontseldiag)->vbox),
-                       GTK_WIDGET(priv->notebook), TRUE, TRUE, 0);
-    gtk_widget_show(GTK_WIDGET(priv->notebook));
-
-    /* Add dialog buttons */
-    gtk_dialog_add_button(GTK_DIALOG(fontseldiag),
-                          _("ecdg_bd_font_dialog_ok"),
-                          GTK_RESPONSE_OK);
-    gtk_dialog_add_button(GTK_DIALOG(fontseldiag),
-                          _("ecdg_bd_font_dialog_preview"),
-                          PREVIEW_RESPONSE_ID);
-    gtk_dialog_add_button(GTK_DIALOG(fontseldiag),
-                          _("ecdg_bd_font_dialog_cancel"),
-                          GTK_RESPONSE_CANCEL);
-
-/*Set default preview text*/
-    priv->preview_text = g_strdup(_("ecdg_fi_preview_font_preview_text"));
-
-/*Set response-handler*/
-    g_signal_connect(G_OBJECT(fontseldiag), "response",
-                     G_CALLBACK
-                     (hildon_font_selection_dialog_preview_click), NULL);
-
-/*If we change the font, we have to check all the possible styles for it
-  --> connecting signal*/
-    g_signal_connect(G_OBJECT(priv->cbx_font_type), "changed",
-                     G_CALLBACK
-                     (hildon_font_selection_dialog_font_type_changed),
-                     NULL);
-
-/*If we have a font, where is Bold and italic styles,
-  BUT the font does NOT have Bold-Italic style --> connecting signals*/
-    g_signal_connect(G_OBJECT(priv->chk_bold), "clicked",
-                     G_CALLBACK
-                     (hildon_font_selection_dialog_check_button_clicked),
-                     NULL);
-    g_signal_connect(G_OBJECT(priv->chk_italic), "clicked",
-                     G_CALLBACK
-                     (hildon_font_selection_dialog_check_button_clicked),
-                     NULL);
-
-    g_signal_connect(G_OBJECT(priv->chk_underline), "clicked",
-                     G_CALLBACK
-                     (hildon_font_selection_dialog_check_button_clicked),
-                     NULL);
-    g_signal_connect(G_OBJECT(priv->chk_strikethrough), "clicked",
-                     G_CALLBACK
-                     (hildon_font_selection_dialog_check_button_clicked),
-                     NULL);
-
-    
-    g_signal_connect(G_OBJECT(priv->chk_bold), "toggled",
-                     G_CALLBACK
-                     (hildon_font_selection_dialog_check_button_toggled),
-                     NULL);
-    g_signal_connect(G_OBJECT(priv->chk_italic), "toggled",
-                     G_CALLBACK
-                     (hildon_font_selection_dialog_check_button_toggled),
-                     NULL);
-
-/*Preview dialog init*/
-    priv->dlg_preview =
-        gtk_dialog_new_with_buttons(_("ecdg_ti_preview_font"), NULL,
-                                    GTK_DIALOG_MODAL |
-                                    GTK_DIALOG_DESTROY_WITH_PARENT,
-                                    GTK_STOCK_OK,
-                                    GTK_RESPONSE_ACCEPT,
-                                    NULL);
-    priv->lbl_preview = gtk_label_new(priv->preview_text);
-
-    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(priv->dlg_preview)->vbox),
-                      priv->lbl_preview);
-    gtk_dialog_set_has_separator(GTK_DIALOG(priv->dlg_preview), FALSE);
-    gtk_label_set_use_markup(GTK_LABEL(priv->lbl_preview), FALSE);
-    gtk_label_set_use_underline(GTK_LABEL(priv->lbl_preview), FALSE);
-
-/*Connect a signal to hide the preview dialog*/
-    g_signal_connect(G_OBJECT(priv->dlg_preview), "response",
-                     G_CALLBACK(hildon_font_preview_dialog_close),
-                     fontseldiag);
-/* set keypress handler (ESC hardkey) */
-    g_signal_connect(G_OBJECT(priv->dlg_preview), "key-press-event",
-                     G_CALLBACK
-                     (hildon_font_selection_dialog_preview_key_press),
-                     NULL);
-
-    gtk_window_set_title(GTK_WINDOW(fontseldiag), _("ecdg_ti_font"));
-
-
-    priv->keysnooper =
-        (guint) (gtk_key_snooper_install(
-            (GtkKeySnoopFunc) (hildon_font_selection_dialog_key_snooper),
-            GTK_WIDGET (fontseldiag)));
-    
-    
-    
-    
+  gint i;
+  GdkColor *color = NULL;
+  
+  HildonFontSelectionDialogPrivate *priv =
+    HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(
+       HILDON_FONT_SELECTION_DIALOG(object));
+  
+  
+  switch (prop_id)
+    {
+    case PROP_FAMILY:
+      i = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->cbx_font_type));
+      if(i >= 0 && i < priv->n_families)
+       g_value_set_string(value, 
+                          pango_font_family_get_name(priv->families[i]));
+      else
+       g_value_set_string(value, "Nokia Sans");
+      break;
+      
+    case PROP_FAMILY_SET:
+      i = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->cbx_font_type));
+      if(i >= 0 && i < priv->n_families)
+       g_value_set_boolean(value, TRUE);
+      else
+       g_value_set_boolean(value, FALSE);
+      break;
+      
+    case PROP_SIZE:
+      i = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->cbx_font_size));
+      if(i >= 0 && i < G_N_ELEMENTS(font_sizes))
+       g_value_set_int(value, font_sizes[i]);
+      else
+       g_value_set_int(value, 16);
+      break;
+      
+    case PROP_SIZE_SET:
+      i = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->cbx_font_size));
+      if(i >= 0 && i < G_N_ELEMENTS(font_sizes))
+       g_value_set_boolean(value, TRUE);
+      else
+       g_value_set_boolean(value, FALSE);
+      break;
+
+    case PROP_COLOR:
+      color = hildon_color_button_get_color
+       (HILDON_COLOR_BUTTON(priv->font_color_button));
+      g_value_set_boxed(value, (gconstpointer) color);
+      if(color != NULL)
+       gdk_color_free(color);
+      break;
+      
+    case PROP_COLOR_SET:
+      g_value_set_boolean(value, priv->color_set);
+      break;
+
+    case PROP_BOLD:
+      g_value_set_boolean(value, 
+       gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->chk_bold)));
+      break;
+
+    case PROP_BOLD_SET:
+      g_value_set_boolean(value,
+       !gtk_toggle_button_get_inconsistent
+       (GTK_TOGGLE_BUTTON(priv->chk_bold)));
+      break;
+      
+    case PROP_ITALIC:
+      g_value_set_boolean(value, 
+       gtk_toggle_button_get_active
+       (GTK_TOGGLE_BUTTON(priv->chk_italic)));
+      break;
+
+    case PROP_ITALIC_SET:
+      g_value_set_boolean(value,
+       !gtk_toggle_button_get_inconsistent
+       (GTK_TOGGLE_BUTTON(priv->chk_italic)));
+      break;
+      
+    case PROP_UNDERLINE:
+      g_value_set_boolean(value, 
+       gtk_toggle_button_get_active
+       (GTK_TOGGLE_BUTTON(priv->chk_underline)));
+      break;
+
+    case PROP_UNDERLINE_SET:
+      g_value_set_boolean(value,
+       !gtk_toggle_button_get_inconsistent
+       (GTK_TOGGLE_BUTTON(priv->chk_underline)));
+      break;
+      
+    case PROP_STRIKETHROUGH:
+      g_value_set_boolean(value, 
+       gtk_toggle_button_get_active
+       (GTK_TOGGLE_BUTTON(priv->chk_strikethrough)));
+      break;
+
+    case PROP_STRIKETHROUGH_SET:
+      g_value_set_boolean(value,
+       !gtk_toggle_button_get_inconsistent
+       (GTK_TOGGLE_BUTTON(priv->chk_strikethrough)));
+      break;
+
+    case PROP_POSITION:
+      i = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->cbx_positioning));
+      if(i == 1)/*super*/
+       g_value_set_int(value, 1);
+      else if(i == 2)/*sub*/
+       g_value_set_int(value, -1);
+      else
+       g_value_set_int(value, 0);
+      break;
+      
+    case PROP_POSITION_SET:
+      i = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->cbx_positioning));
+      if(i >= 0 && i < 3)
+       g_value_set_boolean(value, TRUE);
+      else
+       g_value_set_boolean(value, FALSE);
+      break;
     
-    for (i = 0; i < 3; i++)
-        gtk_widget_show_all(GTK_WIDGET(priv->vbox_tab[i]));
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
 }
 
-static void hildon_font_selection_dialog_set_property(GObject * object,
-               guint property_id,
-               const GValue * value,
-               GParamSpec * pspec)
+static void 
+hildon_font_selection_dialog_set_property (GObject         *object,
+                                          guint            prop_id,
+                                          const GValue    *value,
+                                          GParamSpec      *pspec)
 {
-       gboolean bold;
-       switch (property_id){
-               case PROP_SELECTOR_BOLD: /* add other cases and handling of them */
-                       bold = g_value_get_boolean (value);     
-                       break;
-               default:
-                       G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
-                       break;
+  gint i, size;
+  const gchar *str;
+  gboolean b;
+  GdkColor *color = NULL;
+  GdkColor black;
+  
+  HildonFontSelectionDialogPrivate *priv =
+    HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(
+       HILDON_FONT_SELECTION_DIALOG(object));
+  black.red = black.green = black.blue = 0;
+  
+  switch (prop_id)
+    {
+    case PROP_FAMILY:
+      str = g_value_get_string(value);
+      for(i = 0; i < priv->n_families; i++)
+       {
+         if(strcmp(str, pango_font_family_get_name(priv->families[i]))
+            == 0)
+           {
+             gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_font_type), i);
+             break;
+           }
        }
-}
-
-static void hildon_font_selection_dialog_get_property(GObject * object,
-               guint property_id,
-               GValue * value,
-               GParamSpec * pspec)
-{
-       switch (property_id){
-               case PROP_SELECTOR_BOLD:
-                       g_value_set_boolean(value, g_value_get_boolean(value)); 
-                       /* should set priv->bold? */
-                       break;
-               default:
-                       G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+      break;
+      
+    case PROP_FAMILY_SET:
+      b = g_value_get_boolean(value);
+      if(!b)
+       gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_font_type), -1);
+      break;
+    
+    case PROP_SIZE:
+      size = g_value_get_int(value);
+      for(i = 0; i < G_N_ELEMENTS(font_sizes); i++)
+       {
+         if(size == font_sizes[i])
+           {
+             gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_font_size), i);
+             break;
+           }
        }
+      break;
+      
+    case PROP_SIZE_SET:
+      b = g_value_get_boolean(value);
+      if(!b)
+       gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_font_size), -1);
+      break;
+
+    case PROP_COLOR:
+      color = (GdkColor *) g_value_get_boxed(value);
+      if(color != NULL)
+       hildon_color_button_set_color(HILDON_COLOR_BUTTON
+                                     (priv->font_color_button),
+                                     color);
+      else
+       hildon_color_button_set_color(HILDON_COLOR_BUTTON
+                                     (priv->font_color_button),
+                                     &black);
+      break;
+
+    case PROP_COLOR_SET:
+      priv->color_set = g_value_get_boolean(value);
+      if(!priv->color_set)
+       {
+         /*set color to black, but block our signal handler*/
+         g_signal_handler_block((gpointer) priv->font_color_button,
+                                priv->color_modified_signal_handler);
+         
+         hildon_color_button_set_color(HILDON_COLOR_BUTTON
+                                       (priv->font_color_button), 
+                                       &black);
+         
+         g_signal_handler_unblock((gpointer) priv->font_color_button,
+                                priv->color_modified_signal_handler);
+       }
+      break;
+
+    case PROP_BOLD:
+      /*this call will make sure that we dont get extra clicked signal*/
+      gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(priv->chk_bold),
+                                        FALSE);
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_bold),
+                                  g_value_get_boolean(value));
+      break;
+
+    case PROP_BOLD_SET:
+      gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(priv->chk_bold),
+                                        !g_value_get_boolean(value));
+      break;
+      
+    case PROP_ITALIC:
+      gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(priv->chk_italic),
+                                        FALSE);
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_italic),
+                                  g_value_get_boolean(value));
+      break;
+
+    case PROP_ITALIC_SET:
+      gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(priv->chk_italic),
+                                        !g_value_get_boolean(value));
+      break;
+      
+    case PROP_UNDERLINE:
+      gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON
+                                        (priv->chk_underline),
+                                        FALSE);
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_underline),
+                                  g_value_get_boolean(value));
+      break;
+
+    case PROP_UNDERLINE_SET:
+      gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(priv->chk_underline),
+                                        !g_value_get_boolean(value));
+      break;
+  
+    case PROP_STRIKETHROUGH:
+      gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON
+                                        (priv->chk_strikethrough),
+                                        FALSE);
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_strikethrough),
+                                  g_value_get_boolean(value));
+      break;
+
+    case PROP_STRIKETHROUGH_SET:
+      gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON
+                                        (priv->chk_strikethrough),
+                                        !g_value_get_boolean(value));
+      break;
+
+    case PROP_POSITION:
+      i = g_value_get_int(value);
+      if( i == 1 )
+       gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_positioning), 1);
+      else if(i == -1)
+       gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_positioning), 2);
+      else
+       gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_positioning), 0);
+      break;
+      
+    case PROP_POSITION_SET:
+      b = g_value_get_boolean(value);
+      if(!b)
+       gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_positioning), -1);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
 }
 
-static void hildon_font_preview_dialog_close(GtkDialog * dialog,
-                                             gint response, gpointer data)
+static void
+hildon_font_selection_dialog_class_init(HildonFontSelectionDialogClass *
+                                       klass)
 {
-    HildonFontSelectionDialog *d;
-    HildonFontSelectionDialogPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_FONT_SELECTION_DIALOG(data));
-    d = HILDON_FONT_SELECTION_DIALOG(data);
-    priv = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(d);
-    gtk_widget_hide(GTK_WIDGET(dialog));
-    gtk_window_present(GTK_WINDOW(data));
+  GObjectClass *gobject_class;
+
+  font_selection_dialog_parent_class = g_type_class_peek_parent(klass);
+  gobject_class = G_OBJECT_CLASS(klass);
+  gobject_class->finalize = hildon_font_selection_dialog_finalize;
+  gobject_class->get_property = hildon_font_selection_dialog_get_property;
+  gobject_class->set_property = hildon_font_selection_dialog_set_property;
+
+  g_object_class_install_property(gobject_class, PROP_FAMILY,
+                                 g_param_spec_string("family",
+                                 "Font family", "String defines"
+                                 " the font family", "Nokia Sans",
+                                 G_PARAM_READWRITE));
+  
+  g_object_class_install_property(gobject_class, PROP_FAMILY_SET,
+                                 g_param_spec_boolean ("family-set",
+                                 "family inconsistent state",
+                                 "Whether the family property"
+                                 " is inconsistent", FALSE,
+                                 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+  
+  g_object_class_install_property(gobject_class, PROP_SIZE,
+                                  g_param_spec_int ("size",
+                                  "Font size",
+                                  "Font size in Pt",
+                                  6, 32, 16,
+                                  G_PARAM_READWRITE));
+  
+  g_object_class_install_property(gobject_class, PROP_SIZE_SET,
+                                 g_param_spec_boolean ("size-set",
+                                 "size inconsistent state",
+                                 "Whether the size property"
+                                 " is inconsistent", FALSE,
+                                 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+  
+  g_object_class_install_property(gobject_class, PROP_COLOR,
+                                 g_param_spec_boxed ("color",
+                                 "text color",
+                                 "gdk color for the text",
+                                 GDK_TYPE_COLOR,
+                                 G_PARAM_READWRITE));
+
+  g_object_class_install_property(gobject_class, PROP_COLOR_SET,
+                                 g_param_spec_boolean ("color-set",
+                                 "color inconsistent state",
+                                 "Whether the color property"
+                                 " is inconsistent", FALSE,
+                                 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+  g_object_class_install_property(gobject_class, PROP_BOLD,
+                                 g_param_spec_boolean ("bold",
+                                 "text weight",
+                                 "Whether the text is bold",
+                                 FALSE,
+                                 G_PARAM_READWRITE));
+  
+  g_object_class_install_property(gobject_class, PROP_BOLD_SET,
+                                 g_param_spec_boolean ("bold-set",
+                                 "bold inconsistent state",
+                                 "Whether the bold"
+                                 " is inconsistent", FALSE,
+                                 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+  
+  g_object_class_install_property(gobject_class, PROP_ITALIC,
+                                 g_param_spec_boolean ("italic",
+                                 "text style",
+                                 "Whether the text is italic",
+                                 FALSE,
+                                 G_PARAM_READWRITE));
+  
+  g_object_class_install_property(gobject_class, PROP_ITALIC_SET,
+                                 g_param_spec_boolean ("italic-set",
+                                 "italic inconsistent state",
+                                 "Whether the italic"
+                                 " is inconsistent", FALSE,
+                                 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+  
+  g_object_class_install_property(gobject_class, PROP_UNDERLINE,
+                                 g_param_spec_boolean ("underline",
+                                 "text underline",
+                                 "Whether the text is underlined",
+                                 FALSE,
+                                 G_PARAM_READWRITE));
+  
+  g_object_class_install_property(gobject_class, PROP_UNDERLINE_SET,
+                                 g_param_spec_boolean ("underline-set",
+                                 "underline inconsistent state",
+                                 "Whether the underline"
+                                 " is inconsistent", FALSE,
+                                 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+  
+  g_object_class_install_property(gobject_class, PROP_STRIKETHROUGH,
+                                 g_param_spec_boolean ("strikethrough",
+                                 "strikethroughed text",
+                                 "Whether the text is strikethroughed",
+                                 FALSE,
+                                 G_PARAM_READWRITE));
+  
+  g_object_class_install_property(gobject_class, PROP_STRIKETHROUGH_SET,
+                                 g_param_spec_boolean ("strikethrough-set",
+                                 "strikethrough inconsistent state",
+                                 "Whether the strikethrough"
+                                 " is inconsistent", FALSE,
+                                 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+  
+  g_object_class_install_property(gobject_class, PROP_POSITION,
+                                  g_param_spec_int ("position",
+                                  "Font position",
+                                  "Font position super or subscript",
+                                  -1, 1, 0,
+                                  G_PARAM_READWRITE));
+  
+  g_object_class_install_property(gobject_class, PROP_POSITION_SET,
+                                 g_param_spec_boolean ("position-set",
+                                 "position inconsistent state",
+                                 "Whether the position"
+                                 " is inconsistent", FALSE,
+                                 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+  g_type_class_add_private(klass,
+                          sizeof(struct _HildonFontSelectionDialogPrivate));
 }
 
-static void set_event_box_color(GtkWidget * b, GdkColor * color)
-{
-    GdkColor c = { 0, 32000, 32000, 32000 };
-
-    g_return_if_fail(b);
 
-    if (!color) {
-        color = &c;
-    }
-
-    gtk_widget_modify_bg(b, GTK_STATE_NORMAL, color);
-    gtk_widget_modify_bg(b, GTK_STATE_ACTIVE, color);
-    gtk_widget_modify_bg(b, GTK_STATE_PRELIGHT, color);
-    gtk_widget_modify_bg(b, GTK_STATE_SELECTED, color);
-    gtk_widget_modify_bg(b, GTK_STATE_INSENSITIVE, color);
+static void 
+hildon_font_selection_dialog_init(HildonFontSelectionDialog *fontseldiag)
+{
+  HildonFontSelectionDialogPrivate *priv =
+    HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontseldiag);
+  GtkWidget *preview_button;
+  
+  priv->notebook = GTK_NOTEBOOK(gtk_notebook_new());
+
+  hildon_font_selection_dialog_construct_notebook(fontseldiag);
+  
+  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(fontseldiag)->vbox),
+                    GTK_WIDGET(priv->notebook), TRUE, TRUE, 0);
+  
+  /* Add dialog buttons */
+  gtk_dialog_add_button(GTK_DIALOG(fontseldiag),
+                       _("ecdg_bd_font_dialog_ok"),
+                       GTK_RESPONSE_OK);
+  
+  preview_button = gtk_button_new_with_label(_("ecdg_bd_font_dialog_preview"));
+  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(fontseldiag)->action_area), 
+                    preview_button, FALSE, TRUE, 0);
+  g_signal_connect_swapped(preview_button, "clicked",
+                          G_CALLBACK
+                          (hildon_font_selection_dialog_show_preview),
+                          fontseldiag);
+  gtk_widget_show(preview_button);
+
+  gtk_dialog_add_button(GTK_DIALOG(fontseldiag),
+                       _("ecdg_bd_font_dialog_cancel"),
+                       GTK_RESPONSE_CANCEL);
+
+  /*Set default preview text*/
+  priv->preview_text = g_strdup(_("ecdg_fi_preview_font_preview_text"));
+
+  gtk_window_set_title(GTK_WINDOW(fontseldiag), _("ecdg_ti_font"));
+  /*here is the line to make sure that notebook has the default focus*/
+  gtk_container_set_focus_child(GTK_CONTAINER(GTK_DIALOG(fontseldiag)->vbox),
+                               GTK_WIDGET(priv->notebook));
 }
 
-static gboolean color_key_press(GtkWidget * widget,
-                                GdkEventKey * event, gpointer data)
+static void 
+hildon_font_selection_dialog_construct_notebook (HildonFontSelectionDialog
+                                                *fontsel)
 {
-    if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter)
-        show_selector(widget, NULL, NULL);
-    return FALSE;
+  gint i;
+  GtkWidget *vbox_tab[3];
+  GtkWidget *font_color_box;
+  GtkWidget *caption_control;
+  GtkSizeGroup *group;
+  
+  HildonFontSelectionDialogPrivate *priv =
+    HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontsel);
+
+  for (i = 0; i < 3; i++)
+    vbox_tab[i] = gtk_vbox_new(TRUE, 0);
+
+  group =
+    GTK_SIZE_GROUP(gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL));
+  
+  /*Tab one*/
+  priv->cbx_font_type = gtk_combo_box_new_text();
+  hildon_font_selection_dialog_show_available_fonts(fontsel);
+  caption_control = hildon_caption_new(group,
+                                      _("ecdg_fi_font_font"),
+                                      priv->cbx_font_type,
+                                      NULL,
+                                      HILDON_CAPTION_OPTIONAL);
+  gtk_box_pack_start(GTK_BOX(vbox_tab[0]), caption_control,
+                    FALSE, FALSE, 0);
+
+  priv->cbx_font_size = gtk_combo_box_new_text();
+  hildon_font_selection_dialog_show_available_sizes(priv);
+  caption_control = hildon_caption_new(group,
+                                      _("ecdg_fi_font_size"),
+                                      priv->cbx_font_size,
+                                      NULL,
+                                      HILDON_CAPTION_OPTIONAL);
+  gtk_box_pack_start(GTK_BOX(vbox_tab[0]), caption_control,
+                    FALSE, FALSE, 0);
+
+  font_color_box = gtk_hbox_new(FALSE, 0);
+  priv->font_color_button = hildon_color_button_new();
+  priv->color_set = FALSE;
+  priv->color_modified_signal_handler = 
+    g_signal_connect(G_OBJECT(priv->font_color_button), "notify::color",
+                    G_CALLBACK(color_modified_cb), (gpointer) priv);
+  gtk_box_pack_start(GTK_BOX(font_color_box),
+                    priv->font_color_button, FALSE, FALSE, 0);
+  
+  /*dummy widget for packing purpose only*/
+  gtk_box_pack_start(GTK_BOX(font_color_box), gtk_label_new(""),
+                    TRUE, TRUE, 0);
+  
+  caption_control =
+    hildon_caption_new(group, _("ecdg_fi_font_color_selector"),
+                      font_color_box,
+                      NULL, HILDON_CAPTION_OPTIONAL);
+  
+  gtk_box_pack_start(GTK_BOX(vbox_tab[0]), caption_control,
+                    FALSE, FALSE, 0);
+
+  /*Tab two*/
+  priv->chk_bold = gtk_check_button_new();
+  caption_control = hildon_caption_new(group,
+                                      _("ecdg_fi_font_bold"),
+                                      priv->chk_bold,
+                                      NULL,
+                                      HILDON_CAPTION_OPTIONAL);
+  gtk_box_pack_start(GTK_BOX(vbox_tab[1]), caption_control,
+                    FALSE, FALSE, 0);
+  g_signal_connect(G_OBJECT(priv->chk_bold), "clicked", 
+                  G_CALLBACK(toggle_clicked), NULL);
+
+  priv->chk_italic = gtk_check_button_new();
+  caption_control =
+    hildon_caption_new(group, _("ecdg_fi_font_italic"),
+                      priv->chk_italic,
+                      NULL, HILDON_CAPTION_OPTIONAL);
+  gtk_box_pack_start(GTK_BOX(vbox_tab[1]), caption_control,
+                    FALSE, FALSE, 0);
+  g_signal_connect(G_OBJECT(priv->chk_italic), "clicked", 
+                  G_CALLBACK(toggle_clicked), NULL);
+
+  priv->chk_underline = gtk_check_button_new();
+  caption_control =
+    hildon_caption_new(group, _("ecdg_fi_font_underline"),
+                      priv->chk_underline, NULL,
+                      HILDON_CAPTION_OPTIONAL);
+  gtk_box_pack_start(GTK_BOX(vbox_tab[1]), caption_control,
+                    FALSE, FALSE, 0);
+  g_signal_connect(G_OBJECT(priv->chk_underline), "clicked", 
+                  G_CALLBACK(toggle_clicked), NULL);
+
+  /*Tab three*/
+  priv->chk_strikethrough = gtk_check_button_new();
+  caption_control =
+    hildon_caption_new(group, _("ecdg_fi_font_strikethrough"),
+                      priv->chk_strikethrough, NULL,
+                      HILDON_CAPTION_OPTIONAL);
+  gtk_box_pack_start(GTK_BOX(vbox_tab[2]), caption_control,
+                    FALSE, FALSE, 0);
+  g_signal_connect(G_OBJECT(priv->chk_strikethrough), "clicked", 
+                  G_CALLBACK(toggle_clicked), NULL);
+
+  priv->cbx_positioning = gtk_combo_box_new_text();
+  hildon_font_selection_dialog_show_available_positionings(priv);
+  caption_control =
+    hildon_caption_new(group, _("ecdg_fi_font_special"),
+                      priv->cbx_positioning, NULL,
+                      HILDON_CAPTION_OPTIONAL);
+  gtk_box_pack_start(GTK_BOX(vbox_tab[2]), caption_control,
+                    FALSE, FALSE, 0);
+  
+  /* Populate notebook */
+  gtk_notebook_insert_page(priv->notebook, vbox_tab[0], NULL, 0);
+  gtk_notebook_insert_page(priv->notebook, vbox_tab[1], NULL, 1);
+  gtk_notebook_insert_page(priv->notebook, vbox_tab[2], NULL, 2);
+  gtk_notebook_set_tab_label_text(priv->notebook, vbox_tab[0],
+                                 _("ecdg_ti_font_dialog_style"));
+  gtk_notebook_set_tab_label_text(priv->notebook, vbox_tab[1],
+                                 _("ecdg_ti_font_dialog_format"));
+  gtk_notebook_set_tab_label_text(priv->notebook, vbox_tab[2],
+                                 _("ecdg_ti_font_dialog_other"));
+  
+  gtk_widget_show_all(GTK_WIDGET(priv->notebook));
 }
 
-static void show_selector(GtkWidget * widget, GtkButton * b, gpointer data)
+static void 
+color_modified_cb(HildonColorButton *button, GParamSpec *pspec, gpointer data)
 {
-    GtkWidget *selector;
-
-    gint result;
-    HildonFontSelectionDialogPrivate *priv;
-    HildonFontSelectionDialog *fontseldiag;
-    GdkColor *color;
-
-    g_return_if_fail(widget);
-
-    selector = hildon_color_selector_new(NULL);
-
-    fontseldiag = HILDON_FONT_SELECTION_DIALOG(widget);
-    priv = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontseldiag);
-    hildon_color_selector_set_color(HILDON_COLOR_SELECTOR(selector),
-                                    &priv->c_table);
-    result = gtk_dialog_run(GTK_DIALOG(selector));
-
-    color =
-        hildon_color_selector_get_color(HILDON_COLOR_SELECTOR(selector));
-
-    gtk_widget_destroy(selector);
-    gtk_window_present(GTK_WINDOW(fontseldiag));
-
-    if (result != GTK_RESPONSE_OK)
-        return;
-
-    priv->c_table = *color;
-    set_event_box_color(GTK_WIDGET(priv->font_color_button),
-                        &priv->c_table);
-    gtk_widget_modify_fg(priv->lbl_preview, GTK_STATE_NORMAL,
-                         &priv->c_table);
-    gtk_widget_modify_fg(priv->lbl_preview, GTK_STATE_ACTIVE,
-                         &priv->c_table);
-    gtk_widget_modify_fg(priv->lbl_preview, GTK_STATE_PRELIGHT,
-                         &priv->c_table);
-    gtk_widget_modify_fg(priv->lbl_preview, GTK_STATE_SELECTED,
-                         &priv->c_table);
-    gtk_widget_modify_fg(priv->lbl_preview, GTK_STATE_INSENSITIVE,
-                         &priv->c_table);
+  HildonFontSelectionDialogPrivate *priv = 
+    (HildonFontSelectionDialogPrivate *) data;
 
+  priv->color_set = TRUE;
 }
 
-static void hildon_font_selection_dialog_finalize(GObject * object)
+static void 
+hildon_font_selection_dialog_finalize(GObject * object)
 {
-    HildonFontSelectionDialogPrivate *priv;
-    HildonFontSelectionDialog *fontsel;
+  HildonFontSelectionDialogPrivate *priv;
+  HildonFontSelectionDialog *fontsel;
 
-    g_return_if_fail(HILDON_IS_FONT_SELECTION_DIALOG(object));
-    fontsel = HILDON_FONT_SELECTION_DIALOG(object);
+  g_return_if_fail(HILDON_IS_FONT_SELECTION_DIALOG(object));
+  fontsel = HILDON_FONT_SELECTION_DIALOG(object);
 
-    priv = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontsel);
+  priv = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontsel);
+  
+  g_free(priv->preview_text);
+  g_free(priv->families);
 
-    gtk_key_snooper_remove(priv->keysnooper);
+  if (G_OBJECT_CLASS(font_selection_dialog_parent_class)->finalize)
+    G_OBJECT_CLASS(font_selection_dialog_parent_class)->finalize(object);
+}
 
-    if (priv->faces)
-        g_free(priv->faces);
-    if (priv->preview_text)
-        g_free(priv->preview_text);
-    if (priv->families)
-        g_free(priv->families);
+static int 
+cmp_families(const void *a, const void *b)
+{
+  const char *a_name =
+    pango_font_family_get_name(*(PangoFontFamily **) a);
+  const char *b_name =
+    pango_font_family_get_name(*(PangoFontFamily **) b);
 
-    if (G_OBJECT_CLASS(font_selection_dialog_parent_class)->finalize)
-        G_OBJECT_CLASS(font_selection_dialog_parent_class)->
-            finalize(object);
+  return g_utf8_collate(a_name, b_name);
 }
 
-static void 
-hildon_font_selection_dialog_check_button_clicked(GtkToggleButton *chk,
-               gpointer data){
+static gboolean
+hildon_font_selection_dialog_preview_key_press(GtkWidget * widget,
+                                              GdkEventKey * event,
+                                              gpointer data)
+{
+  g_return_val_if_fail(widget, FALSE);
+  g_return_val_if_fail(event, FALSE);
 
-       gboolean inconsistent = FALSE;
+  if (event->keyval == GDK_Escape) 
+    {
+      gtk_dialog_response(GTK_DIALOG(widget), GTK_RESPONSE_CANCEL);
+      return TRUE;
+    }
 
-       g_object_get(G_OBJECT(chk), "inconsistent", &inconsistent, NULL);
-       if (inconsistent)
-               g_object_set(G_OBJECT(chk), "active", TRUE, "inconsistent", FALSE, NULL);
+  return FALSE;
 }
 
-/*When we toggle either the bold or the italic togglebutton*/
 static void
-hildon_font_selection_dialog_check_button_toggled(GtkToggleButton * chk,
-                                                  gpointer user_data)
+add_preview_text_attr(PangoAttrList *list, PangoAttribute *attr, 
+                     guint start, guint len)
 {
-    HildonFontSelectionDialog *fontsel;
-    HildonFontSelectionDialogPrivate *priv;
-    gboolean bold, italic;
-
-    bold = italic = TRUE;
-
-    fontsel =
-        HILDON_FONT_SELECTION_DIALOG(gtk_widget_get_ancestor
-                                     (GTK_WIDGET(chk),
-                                      HILDON_TYPE_FONT_SELECTION_DIALOG));
-    priv = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontsel);
-       
-    if (priv->facetypes[HILDON_FONT_FACE_BOLD] == -1)
-           bold = FALSE;
-    if (priv->facetypes[HILDON_FONT_FACE_ITALIC] == -1)
-           italic = FALSE;
-    
-    if (!priv->both) {
-        if (GTK_WIDGET(chk) == priv->chk_bold) {
-            if (gtk_toggle_button_get_active(chk)) {
-                priv->face = HILDON_FONT_FACE_BOLD;
-               gtk_widget_set_sensitive(priv->chk_italic, FALSE);
-            } else {
-                priv->face = HILDON_FONT_FACE_NORMAL;
-               if (italic){
-                       gtk_widget_set_sensitive(priv->chk_italic, TRUE);
-               }
-            }
-        } else {
-            if (gtk_toggle_button_get_active(chk)) {
-                priv->face = HILDON_FONT_FACE_ITALIC;
-                gtk_widget_set_sensitive(priv->chk_bold, FALSE);
-            } else {
-                priv->face = HILDON_FONT_FACE_NORMAL;
-                if (bold){
-                       gtk_widget_set_sensitive(priv->chk_bold, TRUE);
-               }
-            }
-        }
-
-    } else
-        if (gtk_toggle_button_get_active
-            (GTK_TOGGLE_BUTTON(priv->chk_bold)))
-        if (gtk_toggle_button_get_active
-            (GTK_TOGGLE_BUTTON(priv->chk_italic)))
-            priv->face = HILDON_FONT_FACE_BOLD_ITALIC;
-        else
-            priv->face = HILDON_FONT_FACE_BOLD;
-    else if (gtk_toggle_button_get_active
-             (GTK_TOGGLE_BUTTON(priv->chk_italic)))
-        priv->face = HILDON_FONT_FACE_ITALIC;
-    else
-        priv->face = HILDON_FONT_FACE_NORMAL;
+  attr->start_index = start;
+  attr->end_index = start + len;
+  pango_attr_list_insert(list, attr);
 }
 
-/*Some gtk_fontsel general pango functions -- BEGIN*/
-
-static int compare_font_descriptions(const PangoFontDescription * a,
-                                     const PangoFontDescription * b)
+static PangoAttrList*
+hildon_font_selection_dialog_create_attrlist(HildonFontSelectionDialog *
+                                        fontsel, guint start_index, guint len)
 {
-    int val = strcmp(pango_font_description_get_family(a),
-                     pango_font_description_get_family(b));
+  PangoAttrList *list;
+  PangoAttribute *attr;
+  gint size, position;
+  gboolean family_set, size_set, color_set, bold, bold_set,
+           italic, italic_set, underline, underline_set,
+          strikethrough, strikethrough_set, position_set;
+  GdkColor *color = NULL;
+  gchar *family = NULL;
+
+  list = pango_attr_list_new();
+  g_object_get(G_OBJECT(fontsel),
+              "family", &family, "family-set", &family_set,
+              "size", &size, "size-set", &size_set,
+              "color", &color, "color-set", &color_set,
+              "bold", &bold, "bold-set", &bold_set,
+              "italic", &italic, "italic-set", &italic_set,
+              "underline", &underline, "underline-set", &underline_set,
+              "strikethrough", &strikethrough, "strikethrough-set", 
+              &strikethrough_set, "position", &position, 
+              "position-set", &position_set, NULL);
+
+  /*family*/
+  if(family_set)
+    {
+      attr = pango_attr_family_new(family);
+      add_preview_text_attr(list, attr, start_index, len);
+    }
+  g_free(family);
+  
+  /*size*/
+  if(size_set)
+    {
+      attr = pango_attr_size_new(size * PANGO_SCALE);
+      add_preview_text_attr(list, attr, start_index, len);
+    }
+  
+  /*color*/
+  if(color_set)
+    {
+      attr = pango_attr_foreground_new(color->red, color->green, color->blue);
+      add_preview_text_attr(list, attr, start_index, len);
+    }
+  
+  if(color != NULL)
+    gdk_color_free(color);
+  
+  /*weight*/
+  if(bold_set)
+    {
+      if(bold)
+        attr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
+      else
+       attr = pango_attr_weight_new(PANGO_WEIGHT_NORMAL);
 
-    if (val != 0)
-        return val;
+      add_preview_text_attr(list, attr, start_index, len);
+    }
+  
+  /*style*/
+  if(italic_set)
+    {
+      if(italic)
+        attr = pango_attr_style_new(PANGO_STYLE_ITALIC);
+      else
+       attr = pango_attr_style_new(PANGO_STYLE_NORMAL);
 
-    if (pango_font_description_get_weight(a) !=
-        pango_font_description_get_weight(b))
-        return pango_font_description_get_weight(a) -
-            pango_font_description_get_weight(b);
+      add_preview_text_attr(list, attr, start_index, len);
+    }
+  
+  /*underline*/
+  if(underline_set)
+    {
+      if(underline)
+        attr = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
+      else
+       attr = pango_attr_underline_new(PANGO_UNDERLINE_NONE);
 
-    if (pango_font_description_get_style(a) !=
-        pango_font_description_get_style(b))
-        return pango_font_description_get_style(a) -
-            pango_font_description_get_style(b);
+      add_preview_text_attr(list, attr, start_index, len);
+    }
+  
+  /*strikethrough*/
+  if(strikethrough_set)
+    {
+      if(strikethrough)
+        attr = pango_attr_strikethrough_new(TRUE);
+      else
+       attr = pango_attr_strikethrough_new(FALSE);
 
-    if (pango_font_description_get_stretch(a) !=
-        pango_font_description_get_stretch(b))
-        return pango_font_description_get_stretch(a) -
-            pango_font_description_get_stretch(b);
+      add_preview_text_attr(list, attr, start_index, len);
+    }
+  
+  /*position*/
+  if(position_set)
+    {
+      switch(position)
+       {
+       case 1: /*super*/
+         attr = pango_attr_rise_new(SUPERSCRIPT_RISE);
+         break;
+       case -1: /*sub*/
+         attr = pango_attr_rise_new(SUBSCRIPT_LOW);
+         break;
+       default: /*normal*/
+         attr = pango_attr_rise_new(0);
+         break;
+       }
 
-    if (pango_font_description_get_variant(a) !=
-        pango_font_description_get_variant(b))
-        return pango_font_description_get_variant(a) -
-            pango_font_description_get_variant(b);
+      add_preview_text_attr(list, attr, start_index, len);
+    }
+  
+  return list;
+}
 
-    return 0;
+static void
+hildon_font_selection_dialog_show_preview(HildonFontSelectionDialog *
+                                         fontsel)
+{
+  HildonFontSelectionDialogPrivate *priv =
+    HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontsel);
+  gint size;
+  gboolean family_set, size_set;
+  PangoAttribute *attr;
+  PangoAttrList *list;
+  GtkWidget *preview_dialog;
+  GtkWidget *preview_label;
+  gchar *str = NULL;
+  
+  /*Preview dialog init*/
+  preview_dialog=
+    gtk_dialog_new_with_buttons(_("ecdg_ti_preview_font"), NULL,
+                               GTK_DIALOG_MODAL |
+                               GTK_DIALOG_DESTROY_WITH_PARENT |
+                               GTK_DIALOG_NO_SEPARATOR,
+                               _("ecdg_bd_font_dialog_ok"),
+                               GTK_RESPONSE_ACCEPT,
+                               NULL);
+
+  str = g_strconcat(REFERENCE_LINE, priv->preview_text, 0);
+  preview_label = gtk_label_new(str);
+  g_free(str);
+  str = NULL;
+
+  gtk_container_add(GTK_CONTAINER(GTK_DIALOG(preview_dialog)->vbox),
+                   preview_label);
+
+  /* set keypress handler (ESC hardkey) */
+  g_signal_connect(G_OBJECT(preview_dialog), "key-press-event",
+                  G_CALLBACK
+                  (hildon_font_selection_dialog_preview_key_press),
+                  NULL);
+
+  /*Set the font*/
+  list = hildon_font_selection_dialog_create_attrlist(fontsel, 
+                               strlen(REFERENCE_LINE),
+                               strlen(priv->preview_text));
+
+  g_object_get(G_OBJECT(fontsel), "family", &str, "family-set",
+              &family_set, "size", &size, "size-set", &size_set,
+              NULL);
+  /*make reference text to have the same fontface and size*/
+  if(family_set)
+    {
+      attr = pango_attr_family_new(str);
+      add_preview_text_attr(list, attr, 0, strlen(REFERENCE_LINE));
+    }
+  g_free(str);
+  
+  /*size*/
+  if(size_set)
+    {
+      attr = pango_attr_size_new(size * PANGO_SCALE);
+      add_preview_text_attr(list, attr, 0, strlen(REFERENCE_LINE));
+    }
+  
+  gtk_label_set_attributes(GTK_LABEL(preview_label), list);
+  pango_attr_list_unref(list);
+  
+  /*And show the dialog*/
+  gtk_window_set_transient_for(GTK_WINDOW(preview_dialog), 
+                              GTK_WINDOW(fontsel));
+  gtk_widget_show_all(preview_dialog);
+  gtk_dialog_run(GTK_DIALOG(preview_dialog));
+  gtk_widget_destroy(preview_dialog);
 }
-static int faces_sort_func(const void *a, const void *b)
+
+static void
+hildon_font_selection_dialog_show_available_fonts(HildonFontSelectionDialog 
+                                                 *fontsel)
+
 {
-    PangoFontDescription *desc_a;
-    PangoFontDescription *desc_b;
-    int ord;
+  gint i;
+  
+  HildonFontSelectionDialogPrivate *priv =
+    HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontsel);
 
-    desc_a = pango_font_face_describe(*(PangoFontFace **) a);
-    desc_b = pango_font_face_describe(*(PangoFontFace **) b);
-    ord = compare_font_descriptions(desc_a, desc_b);
+  pango_context_list_families(gtk_widget_get_pango_context
+                             (GTK_WIDGET(fontsel)), &priv->families,
+                             &priv->n_families);
 
-    pango_font_description_free(desc_a);
-    pango_font_description_free(desc_b);
+  qsort(priv->families, priv->n_families, sizeof(PangoFontFamily *),
+       cmp_families);
 
-    return ord;
-}
-static int cmp_families(const void *a, const void *b)
-{
-    const char *a_name =
-        pango_font_family_get_name(*(PangoFontFamily **) a);
-    const char *b_name =
-        pango_font_family_get_name(*(PangoFontFamily **) b);
 
-    return g_utf8_collate(a_name, b_name);
+  for (i = 0; i < priv->n_families; i++) 
+    {
+      const gchar *name = pango_font_family_get_name(priv->families[i]);
+
+      gtk_combo_box_append_text(GTK_COMBO_BOX(priv->cbx_font_type),
+                               name);
+    }
 }
 
-/*The general pango functions -- END*/
 
-/*Run only once in the init*/
-static void hildon_font_selection_dialog_preview_click(GtkDialog * dialog,
-                                                       gint response,
-                                                       gpointer data)
+static void
+hildon_font_selection_dialog_show_available_positionings
+                                             (HildonFontSelectionDialogPrivate
+                                             *priv)
 {
-    if (response == PREVIEW_RESPONSE_ID) {
-        g_signal_stop_emission_by_name(G_OBJECT(dialog), "response");
-        hildon_font_selection_dialog_show_preview
-            (HILDON_FONT_SELECTION_DIALOG(dialog));
-    }
+  gtk_combo_box_append_text(GTK_COMBO_BOX(priv->cbx_positioning),
+                           _("ecdg_va_font_printpos_1"));
+  gtk_combo_box_append_text(GTK_COMBO_BOX(priv->cbx_positioning),
+                           _("ecdg_va_font_printpos_2"));
+  gtk_combo_box_append_text(GTK_COMBO_BOX(priv->cbx_positioning),
+                           _("ecdg_va_font_printpos_3"));
 }
 
-static gboolean
-hildon_font_selection_dialog_preview_key_press(GtkWidget * widget,
-                                               GdkEventKey * event,
-                                               gpointer data)
+/*Loads the sizes from a pre-allocated table*/
+static void
+hildon_font_selection_dialog_show_available_sizes
+                                             (HildonFontSelectionDialogPrivate
+                                             *priv)
 {
-    g_return_val_if_fail(widget, FALSE);
-    g_return_val_if_fail(event, FALSE);
-
-    if (event->keyval == GDK_Escape) {
-        gtk_dialog_response(GTK_DIALOG(widget), GTK_RESPONSE_CANCEL);
-        return TRUE;
-    }
+  gchar *size_str;
+  gint i;
 
-    return FALSE;
-}
+  for (i = 0; i < G_N_ELEMENTS(font_sizes); i++) 
+    {
+      size_str = g_strdup_printf ("%i %s",
+                                 font_sizes[i],
+                                 _("ecdg_va_font_size_trailer"));
 
-/*If the font type is changed -> update the components
-  (... We may not have a sensitive bold or/and italic toggle button)*/
-static void hildon_font_selection_dialog_font_type_changed(GtkComboBox *
-                                                           cbox,
-                                                           gpointer
-                                                           userdata)
-{
-    gint i;
-    GtkWidget *fontsel =
-        gtk_widget_get_ancestor(GTK_WIDGET(cbox),
-                                HILDON_TYPE_FONT_SELECTION_DIALOG);
-    HildonFontSelectionDialogPrivate *priv =
-        HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE
-        (HILDON_FONT_SELECTION_DIALOG(fontsel));
-    priv->family = priv->families[gtk_combo_box_get_active(cbox)];
-    for (i = 0; i < 4; ++i) {
-           priv->facetypes[i] = -1;
+      gtk_combo_box_append_text(GTK_COMBO_BOX(priv->cbx_font_size),
+                               size_str);
+      g_free (size_str);
     }
-    hildon_font_selection_dialog_show_available_styles
-        (HILDON_FONT_SELECTION_DIALOG(fontsel));
 }
 
-
-static PangoAttrList
-    *hildon_font_selection_dialog_create_font(HildonFontSelectionDialog *
-                                              fontsel)
+static
+void check_tags(gpointer data, gpointer user_data)
 {
-    PangoFontDescription *font_desc;
-    PangoAttrList *list;
-    PangoAttribute *attr;
-    int len;
-    HildonFontSelectionDialogPrivate *priv =
-        HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontsel);
-
-/*Setting size to a temporar variable*/
-    priv->size =
-        font_sizes[gtk_combo_box_get_active
-                   (GTK_COMBO_BOX(priv->cbx_font_size))];
-
-    list = pango_attr_list_new();
-    gtk_label_set_text(GTK_LABEL(priv->lbl_preview), priv->preview_text);
-    len = strlen(priv->preview_text);
-
-/*Create a font_desc attribute for the font*/
-
-    font_desc = pango_font_face_describe(priv->faces[priv->facetypes[priv->face]]);
-    pango_font_description_set_size(font_desc, priv->size * PANGO_SCALE);
-    pango_font_description_set_family(font_desc,
-                                      pango_font_family_get_name(priv->
-                                                                 family));
-
-    attr = pango_attr_font_desc_new(font_desc);
-    attr->start_index = 0;
-    attr->end_index = len;
-    pango_attr_list_insert(list, attr);
-
-/*Create an underline attribute for the font*/
-    if (gtk_toggle_button_get_active
-        (GTK_TOGGLE_BUTTON(priv->chk_underline))) {
-        attr = pango_attr_underline_new(PANGO_UNDERLINE_SINGLE);
-        attr->start_index = 0;
-        attr->end_index = len;
-        pango_attr_list_insert(list, attr);
+  gchar *font_family;
+  GdkColor *fore_color =  NULL;
+  gint p_size, p_weight, p_style, p_underline, p_rise;
+  gboolean b_st, ff_s, size_s, fgc_s, w_s, ss_s, u_s, sth_s, r_s;
+  
+  GtkTextTag *tag = (GtkTextTag*) data;
+  HildonFontSelectionDialogSettings *settings = 
+    (HildonFontSelectionDialogSettings *) user_data;
+  HildonFontSelectionDialogPrivate *priv = 
+    HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(settings->fsd);
+  
+  /*get all the properties*/
+  g_object_get(G_OBJECT(tag),
+              "family", &font_family, "family-set", &ff_s,
+              "size", &p_size, "size-set", &size_s,
+              "foreground-gdk", &fore_color, "foreground-set", &fgc_s,
+              "weight", &p_weight, "weight-set", &w_s,
+              "style", &p_style, "style-set", &ss_s,
+              "underline", &p_underline, "underline-set", &u_s,
+              "strikethrough", &b_st, "strikethrough-set", &sth_s, 
+              "rise", &p_rise, "rise-set", & r_s,
+              NULL);
+  
+  /*settings*/
+  if(ff_s)
+    {
+      gint new_f = -1;
+      gint i;
+      
+      for(i = 0; i < priv->n_families; i++)
+       {
+         if(strcmp(font_family, 
+                   pango_font_family_get_name(priv->families[i])) == 0)
+           {
+             new_f = i;
+             break;
+           }
+       }
+      
+      if(settings->family == -1)
+       settings->family = new_f;
+      else if(settings->family != -2 && 
+             settings->family != new_f)
+       settings->family = -2;/*inconsist*/
+
+      g_free(font_family);
     }
-
-/*Create a striketrough attribute for the font*/
-    if (gtk_toggle_button_get_active
-        (GTK_TOGGLE_BUTTON(priv->chk_strikethrough))) {
-        attr = pango_attr_strikethrough_new(TRUE);
-        attr->start_index = 0;
-        attr->end_index = len;
-        pango_attr_list_insert(list, attr);
+  
+  if(size_s)
+    {
+      gint new_size = -1;
+      gint i;
+      
+      for(i = 0; i < G_N_ELEMENTS(font_sizes); i++)
+       {
+         if(p_size == font_sizes[i] * PANGO_SCALE)
+           {
+             new_size = i;
+             break;
+           }
+       }
+      
+      if(settings->size == -1)
+       settings->size = new_size;
+      else if(settings->size != -2 && 
+             settings->size != new_size)
+       settings->size = -2;/*inconsist*/
+    }
+  
+  if(fgc_s && settings->color == NULL 
+     && !settings->color_inconsist)
+       settings->color = fore_color;
+  else if(fore_color != NULL)
+    {
+      if(!gdk_color_equal(fore_color, settings->color) 
+        && fgc_s)
+       settings->color_inconsist = TRUE;
+      
+      gdk_color_free(fore_color);
     }
 
-/*Create a positioning attribute for the font*/
-    attr = NULL;
-    switch (gtk_combo_box_get_active
-            (GTK_COMBO_BOX(priv->cbx_positioning))) {
-    case HILDON_POSITIONING_SUPER:
-        attr = pango_attr_rise_new(priv->size * (PANGO_SCALE / 2));
-        break;
-    case HILDON_POSITIONING_SUB:
-        attr = pango_attr_rise_new(-priv->size * (PANGO_SCALE / 2));
-        break;
-    };
-
-    if (attr) {
-        attr->start_index = 0;
-        attr->end_index = len;
-        pango_attr_list_insert(list, attr);
+  if(w_s)
+    settings->weight |= p_weight == PANGO_WEIGHT_NORMAL ? OFF_BIT : ON_BIT;
+  
+  if(ss_s)
+    settings->style |= p_style == PANGO_STYLE_NORMAL ? OFF_BIT : ON_BIT;
+  
+  if(u_s)
+    settings->underline |= 
+      p_underline == PANGO_UNDERLINE_NONE ? OFF_BIT : ON_BIT;
+  
+  if(sth_s)
+    settings->strikethrough |= b_st ? ON_BIT : OFF_BIT;
+
+  if(r_s)
+    {
+      gint new_rs = -1;
+      
+      if(p_rise == 0)
+       new_rs = 0;/*normal*/
+      else if (p_rise > 0)
+       new_rs = 1;/*super*/
+      else
+       new_rs = 2;/*sub*/
+
+      if(settings->position == -1)
+       settings->position = new_rs;
+      else if(settings->position != -2 && 
+             settings->position != new_rs)
+       settings->position = -2;/*inconsist*/
     }
-/*Create a color attribute for the font*/
-    attr =
-        pango_attr_foreground_new(priv->c_table.red, priv->c_table.green,
-                                  priv->c_table.blue);
-    attr->start_index = 0;
-    attr->end_index = len;
-    pango_attr_list_insert(list, attr);
-
-    return list;
 }
 
-static void
-hildon_font_selection_dialog_set_font_for_preview(HildonFontSelectionDialog
-                                                  * fsd)
+static
+void check_attrs(gpointer data, gpointer user_data)
 {
-/*set the attribute list for the preview label*/
-    HildonFontSelectionDialogPrivate *priv;
-    PangoAttrList *attr = hildon_font_selection_dialog_create_font(fsd);
+  PangoAttribute *attr = (PangoAttribute *) data;
+  HildonFontSelectionDialogSettings *settings = 
+    (HildonFontSelectionDialogSettings *) user_data;
+  HildonFontSelectionDialogPrivate *priv = 
+    HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(settings->fsd);
+  
+  gchar *family;
+  GdkColor color;
+  gint i;
+  gint size, weight, style, underline, strikethrough, rise;
+  gint new_f = -1, new_size = -1, new_rise = -1;
+
+  switch(attr->klass->type)
+    {
+    case PANGO_ATTR_FAMILY:
+      family = ((PangoAttrString *) attr)->value;
+
+      for(i = 0; i < priv->n_families; i++)
+       {
+         if(strcmp(family, 
+                   pango_font_family_get_name(priv->families[i])) == 0)
+           {
+             new_f = i;
+             break;
+           }
+       }
 
-    priv = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fsd);
-    gtk_label_set_attributes(GTK_LABEL(priv->lbl_preview), attr);
-    pango_attr_list_unref(attr);
+      if(settings->family == -1)
+       settings->family = new_f;
+      else if(settings->family != -2 && 
+             settings->family != new_f)
+       settings->family = -2;/*inconsist*/
+      
+      break;
+    case PANGO_ATTR_SIZE:
+      size = ((PangoAttrInt *) attr)->value;
+      
+      for(i = 0; i < G_N_ELEMENTS(font_sizes); i++)
+       {
+         if(size == font_sizes[i] * PANGO_SCALE)
+           {
+             new_size = i;
+             break;
+           }
+       }
+      
+      if(settings->size == -1)
+       settings->size = new_size;
+      else if(settings->size != -2 && 
+             settings->size != new_size)
+       settings->size = -2;/*inconsist*/
+
+      break;
+    case PANGO_ATTR_FOREGROUND:
+      color.red = ((PangoAttrColor *) attr)->color.red;
+      color.green = ((PangoAttrColor *) attr)->color.green;
+      color.blue = ((PangoAttrColor *) attr)->color.blue;
+
+      if(!settings->color_inconsist &&  settings->color == NULL)
+       settings->color = gdk_color_copy(&color);
+      else if(settings->color != NULL && 
+             !gdk_color_equal(&color, settings->color))
+       settings->color_inconsist = TRUE;
+
+      break;
+    case PANGO_ATTR_WEIGHT:
+      weight = ((PangoAttrInt *) attr)->value;
+
+      settings->weight |= weight == PANGO_WEIGHT_NORMAL ? OFF_BIT : ON_BIT;
+      
+      break;
+    case PANGO_ATTR_STYLE:
+      style = ((PangoAttrInt *) attr)->value;
+
+      settings->style |= style == PANGO_STYLE_NORMAL ? OFF_BIT : ON_BIT; 
+      
+      break;
+    case PANGO_ATTR_UNDERLINE:
+      underline = ((PangoAttrInt *) attr)->value;
+
+      settings->underline |= 
+       underline == PANGO_UNDERLINE_NONE ? OFF_BIT : ON_BIT;
+  
+      break;
+    case PANGO_ATTR_STRIKETHROUGH:
+      strikethrough = ((PangoAttrInt *) attr)->value;
+      
+      settings->strikethrough |= strikethrough ? ON_BIT : OFF_BIT;
+
+      break;
+    case PANGO_ATTR_RISE:
+      rise = ((PangoAttrInt *) attr)->value;
+      
+      if(rise == 0)
+       new_rise = 0;/*normal*/
+      else if (rise > 0)
+       new_rise = 1;/*super*/
+      else
+       new_rise = 2;/*sub*/
+
+      if(settings->position == -1)
+       settings->position = new_rise;
+      else if(settings->position != -2 && 
+             settings->position != new_rise)
+       settings->position = -2;/*inconsist*/
+
+      break;
+    default:
+      break;
+    }
+
+  pango_attribute_destroy(attr);
 }
 
-/*When the user clicks the preview button*/
 static void
-hildon_font_selection_dialog_show_preview(HildonFontSelectionDialog *
-                                          fontsel)
+settings_init(HildonFontSelectionDialogSettings *settings,
+             HildonFontSelectionDialog  *fsd)
 {
-    HildonFontSelectionDialogPrivate *priv =
-        HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontsel);
-
-/*Set the font*/
-    hildon_font_selection_dialog_set_font_for_preview(fontsel);
-
-/*Set a correct size for the label and for the window*/
-/*First we minimize the window, if we resize from larger font to smaller*/
-    gtk_window_resize(GTK_WINDOW(priv->dlg_preview), 1, 1);
-    gtk_widget_set_size_request(priv->lbl_preview, -1, priv->size*4);
-
-/*And show the dialog*/
-    gtk_widget_show_all(priv->dlg_preview);
-    gtk_dialog_run(GTK_DIALOG(priv->dlg_preview));
-    gtk_widget_hide(priv->dlg_preview);
+  settings->fsd = fsd;
+  settings->family = -1;
+  settings->size = -1;
+  settings->color = NULL;
+  settings->color_inconsist = FALSE;
+  settings->weight = 0;
+  settings->style = 0;
+  settings->underline = 0;
+  settings->strikethrough = 0;
+  settings->position = -1;
 }
 
-
-/*Run only once in the init --> Collect all the available fonts*/
 static void
-hildon_font_selection_dialog_show_available_fonts(HildonFontSelectionDialog
-                                                  * fontsel)
+bit_mask_toggle(gint mask, GtkToggleButton *button,
+               GObject *object, const gchar *prop,
+               const gchar *prop_set)
 {
-    PangoFontFamily *match_family = NULL;
-    gint i, match_row;
-    HildonFontSelectionDialogPrivate *priv =
-        HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontsel);
-    match_row = 0;
-
-    pango_context_list_families(gtk_widget_get_pango_context
-                                (GTK_WIDGET(fontsel)), &priv->families,
-                                &priv->n_families);
-    qsort(priv->families, priv->n_families, sizeof(PangoFontFamily *),
-          cmp_families);
-
-
-    for (i = 0; i < priv->n_families; i++) {
-        const gchar *name = pango_font_family_get_name(priv->families[i]);
+  
+  if(mask == 3)
+    gtk_toggle_button_set_inconsistent(button, TRUE);
+  else
+    {
+      gtk_toggle_button_set_inconsistent(button, FALSE);
 
-        gtk_combo_box_append_text(GTK_COMBO_BOX(priv->cbx_font_type),
-                                  name);
+      if(mask == 1)
+       gtk_toggle_button_set_active(button, TRUE);
+      else
+       gtk_toggle_button_set_active(button, FALSE);
 
-        if (i == 0 || !g_ascii_strcasecmp(name, "sans")) {
-            match_family = priv->families[i];
-            match_row = i;
-        }
+      g_object_notify(object, prop);
     }
 
-    priv->family = match_family;
-    gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_font_type),
-                             match_row);
+  g_object_notify(object, prop_set);
 }
 
-
 static void
-hildon_font_selection_dialog_show_available_positionings
-(HildonFontSelectionDialog * fontsel)
+combo_active(gint active, GtkComboBox *box, 
+            GObject *object, const gchar *prop, const gchar *prop_set)
 {
-    HildonFontSelectionDialogPrivate *priv =
-        HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontsel);
-
-    gtk_combo_box_append_text(GTK_COMBO_BOX(priv->cbx_positioning),
-                              _("ecdg_va_font_printpos_1"));
-    gtk_combo_box_append_text(GTK_COMBO_BOX(priv->cbx_positioning),
-                              _("ecdg_va_font_printpos_2"));
-    gtk_combo_box_append_text(GTK_COMBO_BOX(priv->cbx_positioning),
-                              _("ecdg_va_font_printpos_3"));
-    gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_positioning), 0);
-}
+  /*probaly not the best function, but we need all these
+   * parameters to keep things together*/
+  
+  if(active >= 0)
+    {
+      gtk_combo_box_set_active(box, active);
+      g_object_notify(object, prop);
+    }
+  else
+    gtk_combo_box_set_active(box, -1);
 
+  g_object_notify(object, prop_set);
+}
 
-/*Run after the hildon_font_selection_dialog_show_available_fonts
-  -function*/
 static void
-hildon_font_selection_dialog_show_available_styles
-(HildonFontSelectionDialog * fontsel)
+settings_apply(HildonFontSelectionDialogSettings *settings)
 {
-    gint n_faces, i;
-    PangoFontFace **faces;
-    gchar *familyname;
-    HildonFontSelectionDialogPrivate *priv =
-        HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontsel);
-    faces = priv->faces;
 
-    if (faces)
-        g_free(faces);
-
-    familyname = (gchar *)pango_font_family_get_name (priv->family);
-           
-/*Fetch and sort faces*/
-    pango_font_family_list_faces(priv->family, &faces, &n_faces);
-
-    qsort(faces, n_faces, sizeof(PangoFontFace *), faces_sort_func); 
-
-    priv->faces = faces;
-
-/*Set the checkbuttons to false ->
-  If we have italic or/and bold, we'll set that to true*/
-    gtk_widget_set_sensitive(priv->chk_bold, FALSE);
-    gtk_widget_set_sensitive(priv->chk_italic, FALSE);
-
-    priv->both = FALSE;
+  HildonFontSelectionDialogPrivate *priv = 
+    HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(settings->fsd);
+  
+  /*family*/
+  combo_active(settings->family, GTK_COMBO_BOX(priv->cbx_font_type),
+              G_OBJECT(settings->fsd), "family", "family-set");
+  
+  /*size*/
+  combo_active(settings->size, GTK_COMBO_BOX(priv->cbx_font_size),
+              G_OBJECT(settings->fsd), "size", "size-set");
+  
+  /*block our signal handler indicating color has been changed by
+   * the user before set the color, and unblock it after setting
+   * is done*/
+  
+  if(settings->color == NULL || settings->color_inconsist)
+    {
+      GdkColor black;
 
-/*Check all the faces we have for the selected font type*/
-    for (i = 0; i < n_faces; i++) {
-        const gchar *str = pango_font_face_get_face_name(faces[i]);
-       
-        
-       if (!(strcmp(str, "Bold Italic")) || !(strcmp(str, "Demi Italic"))
-            || !(strcmp(str, "Bold Oblique"))
-            || !(strcmp(str, "Demi Bold Italic"))) {
-            priv->facetypes[HILDON_FONT_FACE_BOLD_ITALIC] = i;
-            gtk_widget_set_sensitive(priv->chk_bold, TRUE);
-            gtk_widget_set_sensitive(priv->chk_italic, TRUE);
-            priv->both = TRUE;
-            i = n_faces;        /* IHOPE -- Regular/Normal (what ever name 
-                                   it has) is assumed to be first one */
-        } else if (g_str_has_prefix(str, "Bold")
-                   || g_str_has_prefix(str, "Demi")) {
-            priv->facetypes[HILDON_FONT_FACE_BOLD] = i;
-            gtk_widget_set_sensitive(priv->chk_bold, TRUE);
-        } else if (g_str_has_suffix(str, "Italic") ||
-                   g_str_has_suffix(str, "Oblique"))
-        {
-            priv->facetypes[HILDON_FONT_FACE_ITALIC] = i;
-            gtk_widget_set_sensitive(priv->chk_italic, TRUE);
-        }      
-       else if (i == 0)  {    /* First one is Regular, Normal, etc. */
-            priv->facetypes[HILDON_FONT_FACE_NORMAL] = i;
-       }
-    }
+      black.red = black.green = black.blue = 0;
+      g_signal_handler_block((gpointer) priv->font_color_button,
+                            priv->color_modified_signal_handler);
+      
+      g_object_set(G_OBJECT(settings->fsd), "color", &black, "color-set", 
+                  FALSE, NULL);
 
-/*If we had only one legal face (Regular), both are same ->
-  change both to TRUE*/
-    if (i == 1)
-        priv->both = TRUE;
-
-/*And then.. If a chk_button is not sensitive -> un_check it*/
-    if (!GTK_WIDGET_IS_SENSITIVE(priv->chk_bold))
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_bold),
-                                     FALSE);
-
-    if (!GTK_WIDGET_IS_SENSITIVE(priv->chk_italic))
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_italic),
-                                     FALSE);
-
-    if (priv->both) {
-        if (!GTK_WIDGET_IS_SENSITIVE(priv->chk_bold))
-            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                         (priv->chk_italic), FALSE);
-        else if (!GTK_WIDGET_IS_SENSITIVE(priv->chk_italic))
-            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_bold),
-                                         FALSE);
+      g_signal_handler_unblock((gpointer) priv->font_color_button,
+                              priv->color_modified_signal_handler);
     }
+  else 
+      g_object_set(G_OBJECT(settings->fsd), "color", settings->color, NULL);
+  
+  /*weight*/
+  bit_mask_toggle(settings->weight, GTK_TOGGLE_BUTTON(priv->chk_bold),
+                 G_OBJECT(settings->fsd), "bold", "bold-set");
+  
+  /*style*/
+  bit_mask_toggle(settings->style, GTK_TOGGLE_BUTTON(priv->chk_italic),
+                 G_OBJECT(settings->fsd), "italic", "italic-set");
+  
+  /*underline*/
+  bit_mask_toggle(settings->underline, 
+                 GTK_TOGGLE_BUTTON(priv->chk_underline), 
+                 G_OBJECT(settings->fsd), "underline", "underline-set");
+  
+  /*strikethrough*/
+  bit_mask_toggle(settings->strikethrough, 
+                 GTK_TOGGLE_BUTTON(priv->chk_strikethrough),
+                 G_OBJECT(settings->fsd), "strikethrough", 
+                 "strikethrough-set");
+
+  /*position*/
+  combo_active(settings->position, GTK_COMBO_BOX(priv->cbx_positioning),
+              G_OBJECT(settings->fsd), "position", "position-set");
 }
 
+static void
+settings_destroy(HildonFontSelectionDialogSettings *settings)
+{
+  if(settings->color != NULL)
+    gdk_color_free(settings->color);
+}
 
-/*Loads the sizes from a pre-allocated table*/
 static void
-hildon_font_selection_dialog_show_available_sizes(HildonFontSelectionDialog
-                                                  * fontsel,
-                                                  gboolean first_time)
+toggle_clicked(GtkButton *button, gpointer data)
 {
-    gint i;
-    GtkListStore *model;
-    HildonFontSelectionDialogPrivate *priv =
-        HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fontsel);
-
-    if (first_time) {
-        model = gtk_list_store_new(1, G_TYPE_INT);
-        gtk_combo_box_set_model(GTK_COMBO_BOX(priv->cbx_font_size),
-                                GTK_TREE_MODEL(model));
-        for (i = 0; i < G_N_ELEMENTS(font_sizes); i++) {
-            GtkTreeIter iter;
-
-            gtk_list_store_append(model, &iter);
-            /* 0 == First column in the combobox */
-            gtk_list_store_set(model, &iter, 0, font_sizes[i], -1);
-
-            if (i == 0 || font_sizes[i] * PANGO_SCALE == priv->size)
-                gtk_combo_box_set_active_iter(GTK_COMBO_BOX
-                                              (priv->cbx_font_size),
-                                              &iter);
-        }
+  GtkToggleButton *t_b = GTK_TOGGLE_BUTTON(button);
+
+  /*we have to remove the inconsistent state ourselves*/
+  if(gtk_toggle_button_get_inconsistent(t_b))
+    {
+      gtk_toggle_button_set_inconsistent(t_b, FALSE);
+      gtk_toggle_button_set_active(t_b, FALSE);
     }
 }
 
@@ -1117,45 +1541,46 @@ hildon_font_selection_dialog_show_available_sizes(HildonFontSelectionDialog
  * @parent: the parent window.
  * @title: the title of font selection dialog.
  *
- * if the title is left to %NULL, the title will be left
- * to DEFAULT == "Font".
+ * If NULL is passed for title, then default title
+ * "Font" will be used.
  *
  * Return value: a new #HildonFontSelectionDialog.
  */
-GtkWidget *hildon_font_selection_dialog_new(GtkWindow * parent,
-                                            const gchar * title)
+GtkWidget *
+hildon_font_selection_dialog_new(GtkWindow * parent,
+                                const gchar * title)
 {
-    HildonFontSelectionDialog *fontseldiag;
+  HildonFontSelectionDialog *fontseldiag;
 
-    fontseldiag = g_object_new(HILDON_TYPE_FONT_SELECTION_DIALOG,
-                               "has-separator", FALSE, NULL);
+  fontseldiag = g_object_new(HILDON_TYPE_FONT_SELECTION_DIALOG,
+                            "has-separator", FALSE, NULL);
 
-    if (title)
-        gtk_window_set_title(GTK_WINDOW(fontseldiag), title);
+  if (title)
+    gtk_window_set_title(GTK_WINDOW(fontseldiag), title);
 
-    if (parent)
-        gtk_window_set_transient_for(GTK_WINDOW(fontseldiag), parent);
+  if (parent)
+    gtk_window_set_transient_for(GTK_WINDOW(fontseldiag), parent);
 
-    return GTK_WIDGET(fontseldiag);
+  return GTK_WIDGET(fontseldiag);
 }
 
 /**
  * hildon_font_selection_dialog_get_preview_text:
  * @fsd: the font selection dialog.
  *
- * Gets the text in preview dialog.
- * The returned string must be freed by the user.
+ * Gets the text in preview dialog, which does not include the 
+ * reference text. The returned string must be freed by the user.
  *
  * Returns: a string pointer.
  */
 gchar *
 hildon_font_selection_dialog_get_preview_text(HildonFontSelectionDialog * fsd)
 {
-    HildonFontSelectionDialogPrivate *priv;
+  HildonFontSelectionDialogPrivate *priv;
 
-    g_return_val_if_fail(HILDON_IS_FONT_SELECTION_DIALOG(fsd), FALSE);
-    priv = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fsd);
-    return g_strdup(priv->preview_text);
+  g_return_val_if_fail(HILDON_IS_FONT_SELECTION_DIALOG(fsd), FALSE);
+  priv = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fsd);
+  return g_strdup(priv->preview_text);
 }
 
 /**
@@ -1163,19 +1588,19 @@ hildon_font_selection_dialog_get_preview_text(HildonFontSelectionDialog * fsd)
  * @fsd: the font selection dialog.
  * @text: the text to be set to the preview dialog.
  *
- * Sets the text to the preview dialog.
- * DEFAULT == "The quick brown fox jumped over the lazy dogs"
+ * The default preview text is
+ * "The quick brown fox jumped over the lazy dogs"
  */
 void
 hildon_font_selection_dialog_set_preview_text(HildonFontSelectionDialog *
-                                              fsd, const gchar * text)
+                                             fsd, const gchar * text)
 {
-    if (HILDON_IS_FONT_SELECTION_DIALOG(fsd)) ;
+  if (HILDON_IS_FONT_SELECTION_DIALOG(fsd)) ;
     {
-        HildonFontSelectionDialogPrivate *priv =
-            HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fsd);
-        g_free(priv->preview_text);
-        priv->preview_text = g_strdup(text);
+      HildonFontSelectionDialogPrivate *priv =
+       HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fsd);
+      g_free(priv->preview_text);
+      priv->preview_text = g_strdup(text);
     }
 }
 
@@ -1183,469 +1608,255 @@ hildon_font_selection_dialog_set_preview_text(HildonFontSelectionDialog *
  * hildon_font_selection_dialog_get_text_tag:
  * @fsd: the font selection dialog.
  *
- * Get the #GtkTextTag for selections.
+ * Get the #GtkTextTag for selections. This function
+ * is deprecated function. The best way to use
+ * the text tags is to reuse them as much as possible.
+ * The recommended way is to get the properties of font
+ * selection dialog on GTK_RESPONSE_OK, according to
+ * these property use the tags that you have pre-created.
  * 
- * Returns: a #GtkTextTag representing the choises selected (eg. font name, font size, bolding, italic, underlinening etc.)
+ * Returns: a #GtkTextTag having corresponding properties
+ * set. 
  */ 
-GtkTextTag * hildon_font_selection_dialog_get_text_tag (
-               HildonFontSelectionDialog *fsd)
+#ifndef HILDON_DISABLE_DEPRECATED
+GtkTextTag * 
+hildon_font_selection_dialog_get_text_tag (HildonFontSelectionDialog *fsd)
 {
-       GtkTextTag *tag = NULL;
-       gboolean bold, italic, strikethrough, underline;
-       gint i=-1, fontsize = 0, rise=0;
-       gchar *fontname;
-       HildonFontSelectionDialogPrivate *priv = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fsd);
-       bold=italic=strikethrough=underline=FALSE;
-
-       g_object_get(G_OBJECT(priv->chk_bold), "active", &bold, NULL);
-       g_object_get(G_OBJECT(priv->chk_italic), "active", &italic, NULL);
-       g_object_get(G_OBJECT(priv->chk_underline), "active", &underline, NULL);
-       g_object_get(G_OBJECT(priv->chk_strikethrough), "active", &strikethrough, NULL);
+  GtkTextTag *tag;
+  gint size, position;
+  gboolean family_set, size_set, color_set, bold, bold_set,
+           italic, italic_set, underline, underline_set,
+          strikethrough, strikethrough_set, position_set;
+  GdkColor *color = NULL;
+  gchar *family = NULL;
+
+  tag = gtk_text_tag_new(NULL);
+  
+  g_object_get(G_OBJECT(fsd),
+              "family", &family, "family-set", &family_set,
+              "size", &size, "size-set", &size_set,
+              "color", &color, "color-set", &color_set,
+              "bold", &bold, "bold-set", &bold_set,
+              "italic", &italic, "italic-set", &italic_set,
+              "underline", &underline, "underline-set", &underline_set,
+              "strikethrough", &strikethrough, "strikethrough-set", 
+              &strikethrough_set, "position", &position, 
+              "position-set", &position_set, NULL);
+  /*family*/
+  if(family_set)
+    g_object_set(G_OBJECT(tag), "family",
+                family, "family-set", TRUE, NULL);
+  else
+    g_object_set(G_OBJECT(tag), "family-set", FALSE, NULL);
+
+  g_free(family);
+  
+  /*size*/
+  if(size_set)
+    g_object_set(G_OBJECT(tag), "size", size * PANGO_SCALE, 
+                "size-set", TRUE, NULL);
+  else
+    g_object_set(G_OBJECT(tag), "size-set", FALSE, NULL);
+  
+  /*color*/
+  if(color_set)
+    g_object_set(G_OBJECT(tag), "foreground-gdk", color, 
+                "foreground-set", TRUE ,NULL);
+  else
+    g_object_set(G_OBJECT(tag), "foreground-set", FALSE, NULL);
+
+  if(color != NULL)
+    gdk_color_free(color);
+  
+  /*weight*/
+  if(bold_set)
+    {
+      if(bold)
+        g_object_set(G_OBJECT(tag), "weight", PANGO_WEIGHT_BOLD, NULL);
+      else
+        g_object_set(G_OBJECT(tag), "weight", PANGO_WEIGHT_NORMAL, NULL);
        
-       i = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->cbx_font_type));
-       fontname = (gchar *) pango_font_family_get_name(priv->families[i]);
+      g_object_set(G_OBJECT(tag), "weight-set", TRUE, NULL);
+    }
+  else
+    g_object_set(G_OBJECT(tag), "weight-set", FALSE, NULL);
+  
+  /*style*/
+  if(italic_set)
+    {
+      if(italic)
+        g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL);
+      else
+        g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_NORMAL, NULL);
        
-       fontsize = font_sizes[gtk_combo_box_get_active (GTK_COMBO_BOX(priv->cbx_font_size))];
-
-       switch (gtk_combo_box_get_active (GTK_COMBO_BOX(priv->cbx_positioning))) {
-               case HILDON_POSITIONING_SUPER:
-                    rise = (priv->size * (PANGO_SCALE / 2));
-                    break;
-               case HILDON_POSITIONING_SUB:
-                    rise = (-priv->size * (PANGO_SCALE / 2));
-                    break;
-               case HILDON_POSITIONING_NORMAL:
-                    rise = 0; break;
-       }; 
+      g_object_set(G_OBJECT(tag), "style-set", TRUE, NULL);
+    }
+  else
+    g_object_set(G_OBJECT(tag), "style-set", FALSE, NULL);
+  
+  /*underline*/
+  if(underline_set)
+    {
+      if(underline)
+        g_object_set(G_OBJECT(tag), "underline", PANGO_UNDERLINE_SINGLE, NULL);
+      else
+        g_object_set(G_OBJECT(tag), "underline", PANGO_UNDERLINE_NONE, NULL);
        
-        tag = gtk_text_tag_new(NULL);
-       if (fontname)
-               g_object_set(G_OBJECT(tag), "font", fontname, NULL);                    
-       g_object_set(G_OBJECT(tag), "size", fontsize*PANGO_SCALE, NULL);                
-       if (bold)
-               g_object_set(G_OBJECT(tag), "weight", PANGO_WEIGHT_BOLD, NULL);
-       if (italic)
-               g_object_set(G_OBJECT(tag), "style", PANGO_STYLE_ITALIC, NULL);
-       if (underline)
-               g_object_set(G_OBJECT(tag), "underline", TRUE, NULL);
-       if (strikethrough)
-               g_object_set(G_OBJECT(tag), "strikethrough", TRUE, NULL);
-       if (rise)
-               g_object_set(G_OBJECT(tag), "rise", rise, NULL);
+      g_object_set(G_OBJECT(tag), "underline-set", TRUE, NULL);
+    }
+  else
+    g_object_set(G_OBJECT(tag), "underline-set", FALSE, NULL);
+  
+  /*strikethrough*/
+  if(strikethrough_set)
+    {
+      if(strikethrough)
+        g_object_set(G_OBJECT(tag), "strikethrough", TRUE, NULL);
+      else
+        g_object_set(G_OBJECT(tag), "strikethrough", FALSE, NULL);
        
-       g_object_set(G_OBJECT(tag), "foreground-gdk", &priv->c_table, NULL);
-       return tag;
+      g_object_set(G_OBJECT(tag), "strikethrough-set", TRUE, NULL);
+    }
+  else
+    g_object_set(G_OBJECT(tag), "strikethrough-set", FALSE, NULL);
+  
+  /*position*/
+  if(position_set)
+    {
+      switch(position)
+       {
+       case 1: /*super*/
+         g_object_set(G_OBJECT(tag), "rise", SUPERSCRIPT_RISE, NULL);
+         break;
+       case -1: /*sub*/
+         g_object_set(G_OBJECT(tag), "rise", SUBSCRIPT_LOW, NULL);
+         break;
+       case 0: /*normal*/
+         g_object_set(G_OBJECT(tag), "rise", 0, NULL);
+         break;
+       }
+      g_object_set(G_OBJECT(tag), "rise-set", TRUE, NULL);
+    }
+  else
+    g_object_set(G_OBJECT(tag), "rise-set", FALSE, NULL);
+  
+  return tag;
 }
+#endif
 
 /** 
  * hildon_font_selection_dialog_set_buffer:
  * @fsd: the font selection dialog.
- * @buffer: a #GtkTextBuffer containing the text to which the selections will be applied. Applying is responsibility of application.
+ * @buffer: a #GtkTextBuffer containing the text to which the selections will 
+ * be applied. Applying is responsibility of application.
  *
- * Sets the textbuffer under editing. The dialog will look what selections (bolding/italic/font/fontsize etc.) are present in the 
- * buffer text and make these selections be default in the dialog.
+ * This is deprecated function. GtkTextBuffer is not enough
+ * to get the attributes of currently selected text. Please 
+ * inspect the attributes yourself, and set the properties of
+ * font selection dialog to reflect your inspection.
  * 
  */
-void hildon_font_selection_dialog_set_buffer (          
-               HildonFontSelectionDialog *fsd,
-               GtkTextBuffer *buffer)
+#ifndef HILDON_DISABLE_DEPRECATED
+void 
+hildon_font_selection_dialog_set_buffer (HildonFontSelectionDialog *fsd,
+                                        GtkTextBuffer *buffer)
 {
-       GtkTextIter begin, end;
-       GtkStyle *wstyle = NULL; 
-       gint size = 0, i;
-       gchar *font = NULL;     
-       gboolean bold_on, bold_off, italic_on, italic_off, underline_on, underline_off, 
-                strike_through_off, strike_through_on, superscript_on, superscript_off, subscript_on, subscript_off;
-       HildonFontSelectionDialogPrivate *priv;
-
-       priv = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fsd);
-       
-       /* bold_on and bold_off and the likes are used to recognize conflicts so that the checkbuttons can be put to 'inconsistent' state 
-        * NOTE: they are set initially to TRUE! */
-       bold_on = bold_off = italic_on = italic_off = underline_on = underline_off = TRUE;
-       strike_through_off = strike_through_on = superscript_on = superscript_off = subscript_on = subscript_off = TRUE;
-
-       /* go through the selection */
-       gtk_text_buffer_get_selection_bounds (buffer, &begin, &end);
-       priv->preview_text = gtk_text_buffer_get_slice(buffer, &begin, &end, FALSE);
-
-       if (!gtk_text_iter_equal(&begin, &end)) /* this fails if no selection */
-       {
-               gboolean tags_found = FALSE; /* this is needed so we know we need to get the default font */
-               GtkTextIter iter = begin;
-               
-               /* loop letter by letter */
-               while (!gtk_text_iter_equal(&iter, &end))
-               {
-                       GSList *tags;
-                       gboolean bset, iset, stset, ulset, rset, sset, fgset; /* these are flags for whether the property is set or not */
-                       
-                       gboolean strike_through, underline; /* these are the */
-                       gint weight=0, rise=0;              /* values of the */
-                       PangoStyle style;                   /* properties of one tag */
-                       
-                       gboolean b, i, st, ul, r, l, s, c; /* these booleans tell whether or not there was at least one tags in the
-                                                                 tags list with the corresponding property set */
-                       
-                       GdkColor *color;
-                       b = i = st = ul = r = l =s= c=FALSE;
-                       size = 0;
-                       bset=iset=strike_through=underline=stset=ulset=rset=FALSE; /* all are assumed to FALSE */
-                       
-                       tags = gtk_text_iter_get_tags(&iter); /* TODO: free the list! */
-                       if (tags) tags_found=TRUE;
-                       while (tags){
-                               /* TODO: positioning?? foreground color?? */
-
-                               g_object_get(G_OBJECT(tags->data), 
-                                               "weight-set", &bset, 
-                                               "style-set", &iset,
-                                               "strikethrough-set", &stset,
-                                               "underline-set", &ulset,
-                                               "rise-set", &rset,
-                                               "family", &font,
-                                               "foreground-set", &fgset, 
-                                               "size-set", &sset, 
-                                               NULL);
-                               
-                               if (bset){
-                                       g_object_get(G_OBJECT(tags->data), "weight", &weight, NULL);
-                                       if (weight > PANGO_WEIGHT_NORMAL)       
-                                               b = TRUE;
-                               }
-                               if (iset){
-                                       g_object_get(G_OBJECT(tags->data), "style", &style, NULL);
-                                       if (style == PANGO_STYLE_ITALIC)
-                                               i = TRUE;
-                               }
-                               if (stset){
-                                       g_object_get(G_OBJECT(tags->data), "strikethrough", &strike_through, NULL);
-                                       if (strike_through)
-                                               st = TRUE;
-                               }
-                               if (ulset){
-                                       g_object_get(G_OBJECT(tags->data), "underline", &underline, NULL);
-                                       if (underline)
-                                               ul = TRUE;
-                               }
-                               if (rset){
-                                       g_object_get(G_OBJECT(tags->data), "rise", &rise, NULL);
-                                       if (rise > 0) r=TRUE; 
-                                       else if (rise<0) l=TRUE; 
-                               }                       
-                               if (sset){
-                                       g_object_get(G_OBJECT(tags->data), "size", &size, NULL);
-                                       s = TRUE;
-                               }
-                               if (fgset){
-                                       g_object_get(G_OBJECT(tags->data), "foreground-gdk", &color, NULL);
-                                       c = TRUE;
-                               }
-                                                               
-                               tags = tags->next;
-                       }
-                       if (!b) bold_on = FALSE; /* if no tag in the tag list for this letter had bolding then bold_on should be false
-                                                   the idea is that if the next (or some letter later has bolding the we have
-                                                   bold_on = bolf_off = FALSE and thus we're in inconsistent state */
-                       else bold_off = FALSE;
-                       if (!i) italic_on = FALSE;
-                       else italic_off = FALSE;
-                       if (!st) strike_through_on = FALSE;
-                       else strike_through_off = FALSE;
-                       if (!ul) underline_on = FALSE;
-                       else underline_off = FALSE;
-                       if (!r) superscript_on = FALSE;
-                       else superscript_off = FALSE;
-                       if (!l) subscript_on = FALSE;
-                       else subscript_off = FALSE;
-                       
-                       if (!bold_on && !bold_off){
-                               g_object_set(GTK_TOGGLE_BUTTON(priv->chk_bold), 
-                                               "inconsistent", TRUE, 
-                                               NULL);
-                       }
-                       else {
-                               g_object_set(GTK_TOGGLE_BUTTON(priv->chk_bold), 
-                                               "inconsistent", FALSE,
-                                               "active", bold_on, 
-                                               NULL);
-                               if (!priv->both) gtk_widget_set_sensitive (GTK_WIDGET(priv->chk_italic), FALSE);
-                       }
-                       if (!italic_on && !italic_off){
-                               g_object_set(GTK_TOGGLE_BUTTON(priv->chk_italic), 
-                                               "inconsistent", TRUE, 
-                                               NULL);
-                       }
-                       else {
-                               g_object_set(GTK_TOGGLE_BUTTON(priv->chk_italic), 
-                                               "inconsistent", FALSE,
-                                               "active", italic_on, 
-                                               NULL);
-                               if (!priv->both) gtk_widget_set_sensitive (GTK_WIDGET(priv->chk_bold), FALSE);
-                       }
-                       if (!underline_on && !underline_off){
-                               g_object_set(GTK_TOGGLE_BUTTON(priv->chk_underline), 
-                                               "inconsistent", TRUE, 
-                                               NULL);
-                       }
-                       else {
-                               g_object_set(GTK_TOGGLE_BUTTON(priv->chk_underline), 
-                                               "inconsistent", FALSE,
-                                               "active", underline_on,                                 
-                                               NULL);
-                       }
-                       if (!strike_through_on && !strike_through_off) {
-                               g_object_set(GTK_TOGGLE_BUTTON(priv->chk_strikethrough),
-                                               "inconsistent", TRUE,
-                                               NULL);
-                       }
-                       else{
-                               g_object_set(GTK_TOGGLE_BUTTON(priv->chk_strikethrough),
-                                               "inconsistent", FALSE,
-                                               "active", strike_through_on,
-                                               NULL);
-                       }
-                       if ((!superscript_on && !superscript_off)||(!subscript_on && !subscript_off));
-                       else{
-                               if (superscript_on)
-                                       g_object_set(G_OBJECT(priv->cbx_positioning), "active", 1, NULL);
-                               else if (subscript_on)
-                                       g_object_set(G_OBJECT(priv->cbx_positioning), "active", 2, NULL);
-                               else 
-                                       g_object_set(G_OBJECT(priv->cbx_positioning), "active", 0, NULL);
-                       }
-                       if (c){
-                               priv->c_table = *color;
-                               set_event_box_color(priv->font_color_button, color);
-                       }
-                       if (!s){
-                               wstyle = gtk_rc_get_style_by_paths(gtk_settings_get_default(), NULL, NULL, GTK_TYPE_TEXT_VIEW);
-                               size = pango_font_description_get_size(wstyle->font_desc);
-                               wstyle = NULL;
-                       }
-                       gtk_text_iter_forward_cursor_position(&iter);
-                       
-               }
-               if (!tags_found){
-                       wstyle = gtk_rc_get_style_by_paths(gtk_settings_get_default(), NULL, NULL, GTK_TYPE_TEXT_VIEW);
-               }
-       }
-       else wstyle = gtk_rc_get_style_by_paths(gtk_settings_get_default(), NULL, NULL, GTK_TYPE_TEXT_VIEW);
-       if (wstyle)                                                                     
-       {                                                                                       
-               font = (gchar *) pango_font_description_get_family(wstyle->font_desc);  
-               size = pango_font_description_get_size(wstyle->font_desc);      
-       }
+  GtkTextIter begin, end, iter;
+  HildonFontSelectionDialogSettings settings;
+
+  gtk_text_buffer_get_selection_bounds(buffer, &begin, &end);
+  
+  settings_init(&settings, fsd);
+  
+  iter = begin;
+  if(gtk_text_iter_compare(&iter, &end) == 0)/*if no selection*/
+    {
+      GSList *slist;
+      
+      slist = gtk_text_iter_get_tags(&iter);
+      g_slist_foreach(slist, check_tags, (gpointer) &settings);
+      g_slist_free(slist);
+    }
 
-       for (i = 0; i < G_N_ELEMENTS(font_sizes); i++) {
-               if ((font_sizes[i]*PANGO_SCALE)==size)
-                       gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_font_size), i);
-       }
-       for (i = 0; i < priv->n_families; i++) {
-               const gchar *name = pango_font_family_get_name(priv->families[i]);
-               if (font && name && !strcmp(font, name))
-                       gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_font_type), i);
-       }
+  while(gtk_text_iter_compare(&iter, &end) < 0)
+    {
+      GSList *slist;
+      
+      slist = gtk_text_iter_get_tags(&iter);
+      g_slist_foreach(slist, check_tags, (gpointer) &settings);
+      g_slist_free(slist);
+      
+      if(!gtk_text_iter_forward_cursor_position(&iter))
+       break;
+    }
 
-}              
+  settings_apply(&settings);
+  settings_destroy(&settings);
+}
+#endif
 
 /**
  * hildon_font_selection_dialog_get_font:
  * @fsd: the font selection dialog.
  *
- * Gets the font from the dialog.
+ * This is a deprecated function, @PangoAttrList needs
+ * starting index, and end index on construction.
  *
  * Return value: pointer to @PangoAttrList.
  */
+#ifndef HILDON_DISABLE_DEPRECATED
 PangoAttrList
-    *hildon_font_selection_dialog_get_font(HildonFontSelectionDialog * fsd)
+*hildon_font_selection_dialog_get_font(HildonFontSelectionDialog * fsd)
 {
-    g_return_val_if_fail(HILDON_IS_FONT_SELECTION_DIALOG(fsd), FALSE);
-    return hildon_font_selection_dialog_create_font(fsd);
+  HildonFontSelectionDialogPrivate *priv
+    = HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fsd);
+  
+  g_return_val_if_fail(HILDON_IS_FONT_SELECTION_DIALOG(fsd), FALSE);
+  /*an approve of none working api, should have ask for start_index,
+   * and length in bytes of the string, currently using preview_text 
+   * length, KLUDGE!*/
+  
+  return hildon_font_selection_dialog_create_attrlist(fsd, 
+                               0, strlen(priv->preview_text));
 }
+#endif
 
 /**
  * hildon_font_selection_dialog_set_font:
  * @fsd: the font selection dialog.
  * @list: the pango attribute list.
  *
+ * This is a deprecated function.
+ * 
  * Sets the font to the dialog.
  */
-void hildon_font_selection_dialog_set_font(HildonFontSelectionDialog * fsd,
-                                           PangoAttrList * list)
+#ifndef HILDON_DISABLE_DEPRECATED
+void 
+hildon_font_selection_dialog_set_font(HildonFontSelectionDialog * fsd,
+                                     PangoAttrList * list)
 {
-    if (HILDON_IS_FONT_SELECTION_DIALOG(fsd)) {
-        gint i, tmp;
-        gchar *str;
-        PangoAttribute *attr;
-        PangoFontDescription *desc;
-        gboolean is_italic, is_bold;
-        PangoAttrIterator *iter;
-        HildonFontSelectionDialogPrivate *priv =
-            HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(fsd);
-        iter = pango_attr_list_get_iterator(list);
-        attr = pango_attr_iterator_get(iter, PANGO_ATTR_FONT_DESC);
-        desc = ((PangoAttrFontDesc *) attr)->desc;
-        str = (gchar *) g_strdup(pango_font_description_get_family(desc));
-
-        /* Set family */
-        for (i = 0; i < priv->n_families; i++) {
-            if (g_ascii_strcasecmp
-                (pango_font_family_get_name(priv->families[i]), str) == 0) {
-                priv->family = priv->families[i];
-                gtk_combo_box_set_active(GTK_COMBO_BOX
-                                         (priv->cbx_font_type), i);
-                i = priv->n_families;
-            }
-        }
-
-        is_italic = is_bold = FALSE;
-
-        /* If it's not normal -> it's italic */
-        if (pango_font_description_get_style(desc) != PANGO_STYLE_NORMAL) {
-            is_italic = TRUE;
-            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                         (priv->chk_italic), TRUE);
-        } else
-            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                         (priv->chk_italic), FALSE);
-
-        if (pango_font_description_get_weight(desc) > PANGO_WEIGHT_NORMAL) {
-            is_bold = TRUE;
-            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_bold),
-                                         TRUE);
-        } else
-            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_bold),
-                                         FALSE);
-
-        if (is_bold) {
-            if (is_italic)
-                priv->face = HILDON_FONT_FACE_BOLD_ITALIC;
-            else
-                priv->face = HILDON_FONT_FACE_BOLD;
-        } else if (is_italic)
-            priv->face = HILDON_FONT_FACE_ITALIC;
-        else
-            priv->face = HILDON_FONT_FACE_NORMAL;
-
-        /* Set size */
-        priv->size = pango_font_description_get_size(desc);
-        tmp = priv->size / PANGO_SCALE;
-        for (i = 0; i < G_N_ELEMENTS(font_sizes); i++) {
-            if (tmp == font_sizes[i]) {
-                gtk_combo_box_set_active(GTK_COMBO_BOX
-                                         (priv->cbx_font_size), i);
-                i = G_N_ELEMENTS(font_sizes) + 1;
-            }
-        }
-        /* If we went trough the whole for-loop -> set the size to 10 */
-        if (i == G_N_ELEMENTS(font_sizes))
-            gtk_combo_box_set_active(GTK_COMBO_BOX(priv->cbx_font_size),
-                                     10);
-
-        /* Set underline */
-        attr = pango_attr_iterator_get(iter, PANGO_ATTR_UNDERLINE);
-        if (attr) {
-            if (((PangoAttrInt *) attr)->value)
-                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                             (priv->chk_underline), TRUE);
-            else
-                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                             (priv->chk_underline), FALSE);
-        }
-        /* Set striketrought */
-        attr = pango_attr_iterator_get(iter, PANGO_ATTR_STRIKETHROUGH);
-        if (attr) {
-            if (((PangoAttrInt *) attr)->value)
-                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                             (priv->chk_strikethrough),
-                                             TRUE);
-            else
-                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                             (priv->chk_strikethrough),
-                                             FALSE);
-        }
-
-        /* Set positioning */
-        attr = pango_attr_iterator_get(iter, PANGO_ATTR_RISE);
-        if (attr) {
-            if (((PangoAttrInt *) attr)->value > 0)
-                gtk_combo_box_set_active(GTK_COMBO_BOX
-                                         (priv->cbx_positioning),
-                                         HILDON_POSITIONING_SUPER);
-            else if (((PangoAttrInt *)
-                      pango_attr_iterator_get(iter,
-                                              PANGO_ATTR_RISE))->value < 0)
-                gtk_combo_box_set_active(GTK_COMBO_BOX
-                                         (priv->cbx_positioning),
-                                         HILDON_POSITIONING_SUB);
-        }
-
-        /* Set color */
-        attr = pango_attr_iterator_get(iter, PANGO_ATTR_FOREGROUND);
-        if (attr) {
-            priv->c_table.red =
-                (guint) (((PangoAttrColor *) attr)->color).red;
-            priv->c_table.green =
-                (guint) (((PangoAttrColor *) attr)->color).green;
-            priv->c_table.blue =
-                (guint) (((PangoAttrColor *) attr)->color).blue;
-            set_event_box_color(GTK_WIDGET(priv->font_color_button),
-                                &priv->c_table);
-        }
-        pango_attr_iterator_destroy(iter);
+  PangoAttrIterator *iter;
+  HildonFontSelectionDialogSettings settings;
+
+  iter = pango_attr_list_get_iterator(list);
+  
+  settings_init(&settings, fsd);
+  
+  while(iter != NULL)
+    {
+      GSList *slist;
+      
+      slist = pango_attr_iterator_get_attrs(iter);
+      g_slist_foreach(slist, check_attrs, (gpointer) &settings);
+      g_slist_free(slist);
+      
+      if(!pango_attr_iterator_next(iter))
+       break;
     }
-}
 
-static gint hildon_font_selection_dialog_key_snooper(GtkWidget * swidget,
-                                                     GdkEventKey * event,
-                                                     GtkWidget * widget)
-{
-    HildonFontSelectionDialog *dialog =
-        HILDON_FONT_SELECTION_DIALOG(widget);
-    HildonFontSelectionDialogPrivate *priv =
-        HILDON_FONT_SELECTION_DIALOG_GET_PRIVATE(dialog);
-    if (event->type == GDK_KEY_RELEASE)
-        switch (event->keyval) {
-        case GDK_P:
-        case GDK_p:
-            gtk_dialog_response(GTK_DIALOG(widget), PREVIEW_RESPONSE_ID);
-            break;
-        case GDK_B:
-        case GDK_b:
-        {
-            gboolean state =
-                gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                             (priv->chk_bold));
-            if (GTK_WIDGET_IS_SENSITIVE (priv->chk_bold))
-              gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->chk_bold),
-                                           state ? FALSE : TRUE);
-            break;
-        }
-        case GDK_I:
-        case GDK_i:
-        {
-            gboolean state =
-                gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                             (priv->chk_italic));
-            if (GTK_WIDGET_IS_SENSITIVE (priv->chk_italic))
-              gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                           (priv->chk_italic),
-                                           state ? FALSE : TRUE);
-            break;
-        }
-        case GDK_U:
-        case GDK_u:
-        {
-            gboolean state =
-                gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                             (priv->chk_underline));
-            if (GTK_WIDGET_IS_SENSITIVE (priv->chk_underline))
-              gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                           (priv->chk_underline),
-                                           state ? FALSE : TRUE);
-            break;
-        }
-        }
-    return FALSE;
+  pango_attr_iterator_destroy(iter);
+
+  settings_apply(&settings);
+  settings_destroy(&settings);
 }
+#endif
index ff8edc3..1105fd9 100644 (file)
@@ -55,25 +55,13 @@ typedef struct _HildonFontSelectionDialog HildonFontSelectionDialog;
 typedef struct _HildonFontSelectionDialogClass
  HildonFontSelectionDialogClass;
 
-typedef enum {
-    HILDON_POSITIONING_NORMAL,
-    HILDON_POSITIONING_SUPER,
-    HILDON_POSITIONING_SUB
-} HildonPositioning;
-
-typedef enum {
-    HILDON_FONT_FACE_NORMAL,
-    HILDON_FONT_FACE_ITALIC,
-    HILDON_FONT_FACE_BOLD,
-    HILDON_FONT_FACE_BOLD_ITALIC
-} HildonFontFaceType;
-
-
-struct _HildonFontSelectionDialog {
+struct _HildonFontSelectionDialog
+{
     GtkDialog parent;
 };
 
-struct _HildonFontSelectionDialogClass {
+struct _HildonFontSelectionDialogClass
+{
     GtkDialogClass parent_class;
 
     /* Padding for future expansion */
@@ -83,31 +71,35 @@ struct _HildonFontSelectionDialogClass {
     void (*_gtk_reserved4) (void);
 };
 
-
-GType hildon_font_selection_dialog_get_type(void) G_GNUC_CONST;
-GtkWidget *hildon_font_selection_dialog_new(GtkWindow * parent,
-                                            const gchar * title);
-
-/*To set and to get a font, use these functions*/
-PangoAttrList
-    * hildon_font_selection_dialog_get_font(HildonFontSelectionDialog *
+#ifndef HILDON_DISABLE_DEPRECATED
+PangoAttrList* 
+hildon_font_selection_dialog_get_font(HildonFontSelectionDialog *
                                             fsd);
 void hildon_font_selection_dialog_set_font(HildonFontSelectionDialog *
                                            fsd, PangoAttrList * list);
+#endif
+
+
+GType   hildon_font_selection_dialog_get_type          (void) G_GNUC_CONST;
+
+GtkWidget*
+        hildon_font_selection_dialog_new               (GtkWindow * parent,
+                                                       const gchar * title);
 
-void hildon_font_selection_dialog_set_buffer(HildonFontSelectionDialog *fsd, GtkTextBuffer *buffer);
-GtkTextTag * hildon_font_selection_dialog_get_text_tag (HildonFontSelectionDialog *fsd);
 
+#ifndef HILDON_DISABLE_DEPRECATED
+void    hildon_font_selection_dialog_set_buffer        (HildonFontSelectionDialog *fsd, 
+                                                       GtkTextBuffer *buffer);
 
+GtkTextTag *
+        hildon_font_selection_dialog_get_text_tag      (HildonFontSelectionDialog *fsd);
 
-/* This returns the text in the lbl_preview. You should copy the returned
-   text if you need it. */
-gchar*
-hildon_font_selection_dialog_get_preview_text(HildonFontSelectionDialog * fsd);
+#endif
+       
+gchar*  hildon_font_selection_dialog_get_preview_text  (HildonFontSelectionDialog * fsd);
 
-/* This sets the text in the lbl_preview.*/
-void hildon_font_selection_dialog_set_preview_text
-    (HildonFontSelectionDialog * fsd, const gchar * text);
+void    hildon_font_selection_dialog_set_preview_text  (HildonFontSelectionDialog * fsd, 
+                                                       const gchar * text);
 
 #ifdef __cplusplus
 }
index 166cc35..d584d65 100644 (file)
  */
 
 /*
- * @file hildon-get-password-dialog.c
- *
- * This file contains the API implementation for Hildon Get Password
- * dialog.
- *  Get password dialog:
- *   @desc: Get Password Dialog is used to enter a password when accessing
- *   a password protected function 
- * 
- * Get old password dialog:
- *   @desc: Get Old Password is used to enter the current password 
- *          in order to either change or remove the existing password.
- *
- *  @seealso: #HildonSetPasswordDialog
+ * HILDON DOC
+ * @shortdesc: GetPasswordDialog is a dialog for getting the user
+ * password.
+ * @longdesc: GetPasswordDialog implements two specified dialogs,
+ * which are pretty much functionally the same, but have 
+ * different outlooks.
  */
+#include <glib.h>
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include <errno.h>
+#include <string.h>
+#include <strings.h>
+#include <unistd.h>
+#include <stdio.h>
 
-#include <gtk/gtkentry.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtkeditable.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+#include <hildon-lgpl/hildon-widgets/gtk-infoprint.h>
 
 #include <hildon-widgets/hildon-caption.h>
-#include "hildon-get-password-dialog.h"
+#include <hildon-widgets/hildon-get-password-dialog.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <libintl.h>
 #define _(String) dgettext(PACKAGE, String)
 
-static GtkDialogClass *parent_class;
+static GtkDialogClass * parent_class;
 
+typedef struct _HildonGetPasswordDialogPrivate 
+  HildonGetPasswordDialogPrivate;
 
-#define PASSWORD_DIALOG_WIDTH       370
-#define PASSWORD_DIALOG_HEIGHT      100
+struct _HildonGetPasswordDialogPrivate {
+  GtkButton *okButton;
+  GtkButton *cancelButton;
+  
+  GtkLabel *domainLabel;
+  HildonCaption *passwordEntry;
+};
 
-#define ENTER_PASSWORD_CHAR         _("ecdg_fi_verify_pwd_enter_pwd")
-#define OK_CHAR                     _("ecdg_bd_verify_password_dialog_ok")
-#define CANCEL_CHAR                 _("ecdg_bd_verify_password_dialog_cancel")
-#define PASSWORD_PROTECTED_CHAR     _("ecdg_bd_verify_password")
-#define ENTER_CURRENT_PASSWORD_CHAR _("ecdg_ti_get_old_password")
 
 #define HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE(obj) \
  (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
   HILDON_TYPE_GET_PASSWORD_DIALOG, HildonGetPasswordDialogPrivate));
 
-typedef struct _HildonGetPasswordDialogPrivate
-    HildonGetPasswordDialogPrivate;
-
 static void
 hildon_get_password_dialog_class_init(HildonGetPasswordDialogClass *
                                       class);
+
 static void hildon_get_password_dialog_init(HildonGetPasswordDialog *
                                             widget);
-static gboolean hildon_get_password_dialog_released(GtkWidget * widget,
-                                                    GdkEventButton * event,
-                                                    gpointer user_data);
-static gboolean special_key_listener(GtkWidget * widget,
-                                     GdkEventKey * event,
-                                     gpointer user_data);
 
 static void hildon_get_password_set_property(GObject * object,
                                              guint prop_id,
@@ -93,19 +84,15 @@ static void hildon_get_password_get_property(GObject * object,
                                              guint prop_id, GValue * value,
                                              GParamSpec * pspec);
 
-/* private struct */
-struct _HildonGetPasswordDialogPrivate {
-    /* Tab one */
-    GtkWidget *entry1;
-    GtkWidget *caption1;
+void hildon_get_password_dialog_set_domain(HildonGetPasswordDialog *dialog, 
+                                          gchar *domain);
 
-    /* OK/Cancel buttons */
-    GtkWidget *okButton;
-    GtkWidget *cancelButton;
-};
+static void _invalid_input(GtkWidget *widget, GtkInvalidInputType reason, 
+                          gpointer user_data);
 
 enum{
     PROP_NONE = 0,
+    PROP_DOMAIN,
     PROP_PASSWORD
 };
 
@@ -115,21 +102,26 @@ hildon_get_password_set_property(GObject * object,
                                  guint prop_id,
                                  const GValue * value, GParamSpec * pspec)
 {
-    HildonGetPasswordDialog *dialog = HILDON_GET_PASSWORD_DIALOG(object);
-    HildonGetPasswordDialogPrivate *priv;
-
-    priv = HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
-    
-    switch (prop_id) {
-    case PROP_PASSWORD:
-        gtk_entry_set_text(GTK_ENTRY(priv->entry1), g_value_get_string(value));
-        break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-        break;
-    }
+  HildonGetPasswordDialog *dialog = HILDON_GET_PASSWORD_DIALOG(object);
+  HildonGetPasswordDialogPrivate *priv;
+  
+  priv = HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
+  
+  switch (prop_id) {
+  case PROP_DOMAIN: /* Implemented othervise, here just for completeness */
+    gtk_label_set_text(priv->domainLabel, g_value_get_string(value));
+    break;
+  case PROP_PASSWORD:
+    gtk_entry_set_text(GTK_ENTRY
+                      (gtk_bin_get_child(GTK_BIN(priv->passwordEntry))),
+                      g_value_get_string(value));
+    break;
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+    break;
+  }
 }
-
+  
 static void
 hildon_get_password_get_property(GObject * object,
                                  guint prop_id,
@@ -142,35 +134,48 @@ hildon_get_password_get_property(GObject * object,
     priv = HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
     
     switch (prop_id) {
+    case PROP_DOMAIN:
+      string = gtk_label_get_text(priv->domainLabel);
+      g_value_set_string(value, string);
     case PROP_PASSWORD:
-        string = gtk_entry_get_text(GTK_ENTRY(priv->entry1));
-        g_value_set_string(value, string);
-        break;
+      string = gtk_entry_get_text(GTK_ENTRY(priv->passwordEntry));
+      g_value_set_string(value, string);
+      break;
     default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-        break;
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+      break;
     }
 }
 static void
 hildon_get_password_dialog_class_init(HildonGetPasswordDialogClass * class)
 {
-    GParamSpec *pspec1;
-    GObjectClass *object_class = G_OBJECT_CLASS(class);
-  
-    parent_class = g_type_class_peek_parent(class);
 
-    object_class->set_property = hildon_get_password_set_property;
-    object_class->get_property = hildon_get_password_get_property;
-
-    pspec1 = g_param_spec_string("password",
-                                "Password content",
-                                "Set content to dialog",
-                                "DEFAULT",
-                                G_PARAM_READWRITE);
+  GObjectClass *object_class = G_OBJECT_CLASS(class);
+  
+  parent_class = g_type_class_peek_parent(class);
+  
+  object_class->set_property = hildon_get_password_set_property;
+  object_class->get_property = hildon_get_password_get_property;
+  
+  g_object_class_install_property 
+    (object_class, 
+     PROP_DOMAIN, 
+     g_param_spec_string ("domain",
+                         "Domain",
+                         "Set domain(content) for optional label.",
+                         NULL,
+                         G_PARAM_WRITABLE));
+  
+  
+  g_object_class_install_property
+    (object_class, 
+     PROP_PASSWORD,
+     g_param_spec_string ("password",
+                         "Password",
+                         "Set content for password entry",
+                         "DEFAULT",
+                         G_PARAM_READWRITE));
 
-    g_object_class_install_property (object_class,
-                                    PROP_PASSWORD,pspec1);
-    
     g_type_class_add_private(class,
                              sizeof(HildonGetPasswordDialogPrivate));
 }
@@ -178,75 +183,50 @@ hildon_get_password_dialog_class_init(HildonGetPasswordDialogClass * class)
 static void
 hildon_get_password_dialog_init(HildonGetPasswordDialog * dialog)
 {
-    HildonGetPasswordDialogPrivate *priv;
-    GtkSizeGroup *group;
-
-    priv = HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
-
-    group = GTK_SIZE_GROUP(gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL));
+    GtkSizeGroup * group;
+    GtkWidget *control;
+  
+    HildonGetPasswordDialogPrivate *priv =
+      HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
+    group = GTK_SIZE_GROUP(gtk_size_group_new
+                          (GTK_SIZE_GROUP_HORIZONTAL));
 
     gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
 
     gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
 
-    /* create tab */
-    priv->entry1 = gtk_entry_new();
-    gtk_widget_show(priv->entry1);
-
-    priv->caption1 = hildon_caption_new(group,
-                                        ENTER_PASSWORD_CHAR,
-                                        priv->entry1,
-                                        NULL, HILDON_CAPTION_OPTIONAL);
-
-    gtk_entry_set_visibility(GTK_ENTRY(priv->entry1), FALSE);
+    
+    gtk_window_set_title(GTK_WINDOW(dialog), 
+                        _(HILDON_GET_PASSWORD_DIALOG_TITLE));
 
+    priv->domainLabel = GTK_LABEL(gtk_label_new(NULL));
+    
+    priv->okButton =
+      GTK_BUTTON(gtk_dialog_add_button(GTK_DIALOG(dialog),
+                                       _(HILDON_GET_PASSWORD_DIALOG_OK),
+                                       GTK_RESPONSE_OK));
+    priv->cancelButton =
+      GTK_BUTTON(gtk_dialog_add_button(GTK_DIALOG(dialog),
+                                       _(HILDON_GET_PASSWORD_DIALOG_CANCEL),
+                                       GTK_RESPONSE_CANCEL));
+
+    control = gtk_entry_new();
+    gtk_entry_set_visibility(GTK_ENTRY(control), FALSE);
+    priv->passwordEntry = HILDON_CAPTION
+      (hildon_caption_new(group,
+                         _(HILDON_GET_PASSWORD_DIALOG_PASSWORD ),
+                         control, NULL,
+                         HILDON_CAPTION_OPTIONAL));
+    hildon_caption_set_separator(HILDON_CAPTION(priv->passwordEntry), "");
+    
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
-                       priv->caption1, TRUE, TRUE, 0);
-    gtk_widget_show(priv->caption1);
-
-    /* Callback functions */
-    g_signal_connect(G_OBJECT(priv->entry1), "key-press-event",
-                     G_CALLBACK(special_key_listener), dialog);
-
-    g_signal_connect(priv->entry1, "button-release-event",
-                     G_CALLBACK(hildon_get_password_dialog_released),
-                     NULL);
-
-    /* Create the OK/CANCEL buttons */
-    priv->okButton = gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                           OK_CHAR, GTK_RESPONSE_OK);
-    priv->cancelButton = gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                               CANCEL_CHAR,
-                                               GTK_RESPONSE_CANCEL);
-    gtk_window_resize(GTK_WINDOW(dialog),
-                      PASSWORD_DIALOG_WIDTH, PASSWORD_DIALOG_HEIGHT);
-}
-
-static gboolean
-hildon_get_password_dialog_released(GtkWidget * widget,
-                                    GdkEventButton * event,
-                                    gpointer user_data)
-{
-    GtkEditable *editable = GTK_EDITABLE(widget);
-
-    gtk_editable_select_region(GTK_EDITABLE(editable), 0, -1);
-    gtk_widget_grab_focus(GTK_WIDGET(editable));
-
-    return FALSE;
-}
-
-static gboolean
-special_key_listener(GtkWidget * widget,
-                     GdkEventKey * event, gpointer user_data)
-{
-    HildonGetPasswordDialog *dialog =
-        HILDON_GET_PASSWORD_DIALOG(user_data);
-
-    if ((event->keyval == GDK_Return) || (event->keyval == GDK_KP_Enter)) {
-        gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
-    }
-
-    return FALSE;
+                       GTK_WIDGET(priv->domainLabel), FALSE, FALSE, 0);
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
+                       GTK_WIDGET(priv->passwordEntry), FALSE, FALSE, 0);
+    gtk_widget_show_all(GTK_DIALOG(dialog)->vbox);
+    
+    gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+  
 }
 
 /* Public functions */
@@ -301,11 +281,18 @@ GtkWidget *hildon_get_password_dialog_new(GtkWindow * parent,
          NULL);
 
     if (get_old_password_title == FALSE) {
-        gtk_window_set_title(GTK_WINDOW(dialog), PASSWORD_PROTECTED_CHAR);
-    } else {
-        gtk_window_set_title(GTK_WINDOW(dialog),
-                             ENTER_CURRENT_PASSWORD_CHAR);
-    }
+      HildonGetPasswordDialogPrivate *priv;
+      gtk_window_set_title(GTK_WINDOW(dialog), 
+                            _(HILDON_GET_PASSWORD_VERIFY_DIALOG_TITLE));
+               priv = HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
+       gtk_button_set_label(priv->okButton, 
+                            _(HILDON_GET_PASSWORD_VERIFY_DIALOG_OK));
+       gtk_button_set_label(priv->cancelButton, 
+                            _(HILDON_GET_PASSWORD_VERIFY_DIALOG_CANCEL));
+       hildon_caption_set_label(priv->passwordEntry,
+                                _(HILDON_GET_PASSWORD_VERIFY_DIALOG_PASSWORD)
+                                );
+    } /* The other logical strings are set in class init */
 
     if (parent != NULL) {
         gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
@@ -359,10 +346,112 @@ const gchar
 
     priv = HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
 
-    entry1 = GTK_ENTRY(hildon_caption_get_control
-                       (HILDON_CAPTION(priv->caption1)));
+    entry1 = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(
+                       priv->passwordEntry)));
 
     text1 = GTK_ENTRY(entry1)->text;
 
     return text1;
 }
+
+/**
+ * hildon_get_password_dialog_set_domain(GtkWidget *dialog, 
+ * @dialog: the dialog
+ * @domain: the domain or some other descriptive text to be set.
+ * 
+ * sets the optional descriptive text
+ */
+
+void hildon_get_password_dialog_set_domain(HildonGetPasswordDialog *dialog, 
+                                                gchar *domain)
+{
+  HildonGetPasswordDialogPrivate *priv =
+    HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
+  gtk_label_set_text(priv->domainLabel, domain);
+  
+}
+
+/**
+ * hildon_get_password_dialog_set_dialog_title
+ *        (HildonGetPasswordDialog *dialog, gchar *new_title) 
+ * @dialog: the dialog
+ * @new_ title: the text to be set as the dialog title.
+ * 
+ * sets the dialog title
+ */
+void hildon_get_password_dialog_set_title(HildonGetPasswordDialog *dialog,
+                                         gchar *new_title)
+
+{
+  g_return_if_fail (new_title !=NULL);
+  gtk_window_set_title(GTK_WINDOW(dialog), 
+                      new_title);
+
+}
+
+/**
+ * hildon_get_password_dialog_set_caption_label
+ *        (HildonGetPasswordDialog *dialog, gchar *new_caption) 
+ * @dialog: the dialog
+ * @new_caption: the text to be set as the caption label.
+ * 
+ * sets the password entry field's neigbouring label.
+ */
+
+
+void hildon_get_password_dialog_set_caption(HildonGetPasswordDialog *dialog,
+                                                 gchar *new_caption)
+{
+  
+
+  HildonGetPasswordDialogPrivate *priv =
+    HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE(dialog);  
+  g_return_if_fail (new_caption !=NULL);
+  hildon_caption_set_label(priv->passwordEntry, new_caption);
+
+}
+
+/**
+ * hildon_get_password_dialog_set_max_characters
+ *        (HildonGetPasswordDialog *dialog, gint max_characters,
+ *         gchar *error_ib_message) 
+ * @dialog: the dialog
+ * @max_characters: the maximum number of characters the password dialog
+ * accepts.
+ * @new_caption: the text to be set as the caption label.
+ * 
+ * sets the password entry field's neigbouring label.
+ */
+
+void hildon_get_password_dialog_set_max_characters (HildonGetPasswordDialog *dialog, gint max_characters )
+{
+
+  HildonGetPasswordDialogPrivate *priv =
+    HILDON_GET_PASSWORD_DIALOG_GET_PRIVATE(dialog);  
+
+  g_return_if_fail(max_characters >0);
+  g_return_if_fail(dialog);
+
+  gtk_entry_set_max_length(GTK_ENTRY
+                          (hildon_caption_get_control
+                           (priv->passwordEntry)),
+                          max_characters);
+
+  g_signal_connect(GTK_ENTRY
+                  (hildon_caption_get_control
+                   (priv->passwordEntry)),
+                  "invalid_input",
+                  G_CALLBACK(_invalid_input),
+                  NULL
+                  );
+
+}
+
+static void _invalid_input(GtkWidget *widget, GtkInvalidInputType reason, 
+                          gpointer user_data) 
+{
+  if (reason==GTK_INVALID_INPUT_MAX_CHARS_REACHED) {
+    gtk_infoprint(GTK_WINDOW(widget), _(HILDON_GET_PASSWORD_DIALOG_MAX_CHARS));
+  }
+
+}
index 4dfd051..c5d7ee6 100644 (file)
@@ -40,6 +40,25 @@ G_BEGIN_DECLS
   (GTK_CHECK_TYPE (obj, HILDON_TYPE_GET_PASSWORD_DIALOG))
 #define HILDON_IS_GET_PASSWORD_DIALOG_CLASS(klass) \
   (GTK_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_GET_PASSWORD_DIALOG))
+
+#define HILDON_GET_PASSWORD_DIALOG_TITLE "ecdg_ti_get_old_password"
+#define HILDON_GET_PASSWORD_DIALOG_PASSWORD \
+         "ecdg_fi_get_old_pwd_enter_pwd"
+#define HILDON_GET_PASSWORD_DIALOG_OK "ecdg_bd_get_old_password_dialog_ok"
+#define HILDON_GET_PASSWORD_DIALOG_CANCEL \
+         "ecdg_bd_get_old_password_dialog_cancel"
+
+#define HILDON_GET_PASSWORD_VERIFY_DIALOG_TITLE \
+         "ecdg_ti_verify_password"
+#define HILDON_GET_PASSWORD_VERIFY_DIALOG_PASSWORD \
+         "ecdg_fi_verify_pwd_enter_pwd"
+#define HILDON_GET_PASSWORD_VERIFY_DIALOG_OK \
+         "ecdg_bd_verify_password_dialog_ok"
+#define HILDON_GET_PASSWORD_VERIFY_DIALOG_CANCEL \
+         "ecdg_bd_verify_password_dialog_cancel"
+#define HILDON_GET_PASSWORD_DIALOG_MAX_CHARS \
+         "ckdg_ib_maximum_characters_reached"
+
 typedef struct _HildonGetPasswordDialog HildonGetPasswordDialog;
 typedef struct _HildonGetPasswordDialogClass HildonGetPasswordDialogClass;
 
@@ -58,7 +77,20 @@ GtkWidget *hildon_get_password_dialog_new(GtkWindow * parent,
 
 GtkWidget *hildon_get_password_dialog_new_with_default(GtkWindow *parent,
                                                       gchar *password,
-                                         gboolean get_old_password_title);
+                                                      gboolean get_old_password_title);
+
+void hildon_get_password_dialog_set_domain(HildonGetPasswordDialog *dialog, 
+                                          gchar *domain);
+
+void hildon_get_password_dialog_set_title(HildonGetPasswordDialog *dialog,
+                                         gchar *new_title);
+
+void hildon_get_password_dialog_set_caption(HildonGetPasswordDialog *dialog,
+                                                 gchar *new_caption);
+
+
+void hildon_get_password_dialog_set_max_characters(HildonGetPasswordDialog *dialog,
+                                                  gint max_characters);
 
 const gchar
     *hildon_get_password_dialog_get_password(HildonGetPasswordDialog *
index fded86a..04b15e4 100644 (file)
 #include <hildon-widgets/hildon-grid-item.h>
 
 G_BEGIN_DECLS
-    void _hildon_grid_item_set_label(HildonGridItem * item,
-                                     const gchar * label);
 
-void _hildon_grid_item_set_icon_size(HildonGridItem * item,
-                                     HildonGridItemIconSizeType icon_size);
-
-void _hildon_grid_item_set_label_pos(HildonGridItem * item,
-                                     HildonGridPositionType label_pos);
-void _hildon_grid_item_set_emblem_size(HildonGridItem * item,
-                                       const gint emblem_size);
 
-void _hildon_grid_item_set_label_spacing(HildonGridItem * item,
-                                         const gint hspacing,
-                                         const gint vspacing);
+void _hildon_grid_item_set_label(HildonGridItem *item,
+                                 const gchar *label);
 
-/*
- * These are not needed...
- *
-const gchar *_hildon_grid_item_get_label    (HildonGridItem *item);
+void _hildon_grid_item_set_emblem_size(HildonGridItem *item,
+                                       const gint emblem_size);
+void _hildon_grid_item_set_label_pos(HildonGridItem *item,
+                                     HildonGridPositionType label_pos);
 
-const HildonGridItemIconSizeType _hildon_grid_item_get_icon_size
-                                            (HildonGridItem *item);
+void _hildon_grid_item_set_icon_size(HildonGridItem *item,
+                                     HildonGridItemIconSizeType icon_size);
 
-const HildonGridPositionType _hildon_grid_item_set_label_pos
-                                            (HildonGridItem *item);
+void _hildon_grid_item_set_focus_margin(HildonGridItem *item,
+                                        const gint focus_margin);
+void _hildon_grid_item_set_label_height(HildonGridItem *item,
+                                        const gint label_height);
+void _hildon_grid_item_set_label_icon_margin(HildonGridItem *item,
+                                             const gint label_icon_margin);
+void _hildon_grid_item_set_icon_width(HildonGridItem *item,
+                                      const gint icon_width);
+void _hildon_grid_item_set_icon_height(HildonGridItem *item,
+                                       const gint icon_height);
+void _hildon_grid_item_set_label_height(HildonGridItem *item,
+                                       const gint label_height);
 
-const gint _hildon_grid_item_set_emblem_size    (HildonGridItem *item);
+void _hildon_grid_item_done_updating_settings(HildonGridItem *item);
 
-const gint _hildon_grid_item_get_label_spacing  (HildonGridItem *item,
-                                                 gint           *hspacing,
-                                                 gint           *vspacing);
- *
- */
 
 G_END_DECLS
+
 #endif /* ifndef HILDON_GRID_ITEM_PRIVATE_H_ */
index a0918b7..fe09a42 100644 (file)
@@ -30,6 +30,7 @@
  * emblem and a label. 
  *
  */
+
 /*
  * TODO:
  * - play with libtool to get _-functions private but accesable from grid
@@ -65,19 +66,17 @@ typedef struct _HildonGridItemPrivate HildonGridItemPrivate;
 
 
 /* Default icon. */
-#define DEFAULT_ICON_BASENAME   "Unknown"
+#define DEFAULT_ICON_BASENAME   "qgn_list_gene_unknown_file"
 #define HILDON_GRID_ICON_SIZE         26
 #define HILDON_GRID_EMBLEM_SIZE       16
 
-/* Use somewhat dirty alpha-thing for emblems. */
+/* Use some alpha-thing for emblems. */
 #define USE_DIRTY_ALPHA
 
 struct _HildonGridItemPrivate {
     gchar *icon_basename;
     gint icon_size;
     GtkWidget *icon;
-    gint icon_width;
-    gint icon_height;
 
     gchar *emblem_basename;
     gint emblem_size;
@@ -85,8 +84,22 @@ struct _HildonGridItemPrivate {
     GtkWidget *label;   /* TODO use pango! */
     HildonGridPositionType label_pos;
 
-    gint label_hspacing;
-    gint label_vspacing;
+    gint focus_margin;
+    gint label_height;
+    gint label_icon_margin;
+    gint column_margin;
+    gint icon_width;
+    gint icon_height;
+    gint row_height;
+
+    gint pending_icon_size;
+    gint pending_emblem_size;
+    HildonGridPositionType pending_label_pos;
+    gint pending_focus_margin;
+    gint pending_label_height;
+    gint pending_label_icon_margin;
+    gint pending_icon_width;
+    gint pending_icon_height;
 
     gboolean selected;
 };
@@ -114,6 +127,9 @@ static void hildon_grid_item_finalize(GObject * object);
 static void update_icon(HildonGridItem * item);
 static void set_label_justify(HildonGridItem * item);
 
+static void hildon_grid_item_set_icon_size(HildonGridItem *item,
+                                   HildonGridItemIconSizeType icon_size);
+
 
 static GtkContainerClass *parent_class = NULL;
 
@@ -150,8 +166,6 @@ hildon_grid_item_class_init(HildonGridItemClass *klass)
     GtkContainerClass *container_class;
     GObjectClass *gobject_class;
 
-/* g_message ("hildon_grid_item_class_init (%d)\n", (int) klass); */
-
     widget_class = GTK_WIDGET_CLASS(klass);
     gobject_class = G_OBJECT_CLASS(klass);
     container_class = GTK_CONTAINER_CLASS(klass);
@@ -178,19 +192,24 @@ hildon_grid_item_init(HildonGridItem *item)
     priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
 
     priv->icon_basename = NULL;
-    priv->icon_size = HILDON_GRID_ICON_SIZE;
+    priv->pending_icon_size = priv->icon_size = HILDON_GRID_ICON_SIZE;
     priv->icon = NULL;
 
     priv->emblem_basename = NULL;
-    priv->emblem_size = HILDON_GRID_EMBLEM_SIZE;
+    priv->pending_emblem_size = priv->emblem_size = HILDON_GRID_EMBLEM_SIZE;
 
     priv->label = NULL;
-    priv->label_pos = HILDON_GRID_ITEM_LABEL_POS_BOTTOM;
-    priv->label_hspacing = 0;
-    priv->label_vspacing = 0;
+    priv->pending_label_pos = priv->label_pos =
+        HILDON_GRID_ITEM_LABEL_POS_BOTTOM;
 
     priv->selected = FALSE;
 
+    priv->pending_focus_margin = priv->focus_margin = 6;
+    priv->pending_label_height = priv->label_height = 30;
+    priv->pending_label_icon_margin = priv->label_icon_margin = 6;
+    priv->pending_icon_width = priv->icon_width = 64;
+    priv->pending_icon_height = priv->icon_height = 54;
+    priv->pending_label_height = priv->label_height = 30;
 }
 
 /**
@@ -375,20 +394,19 @@ _hildon_grid_item_set_label(HildonGridItem *item, const gchar *label)
     gtk_label_set_label(GTK_LABEL(priv->label), label);
 }
 
-void
-_hildon_grid_item_set_icon_size(HildonGridItem              *item,
-                                HildonGridItemIconSizeType  icon_size)
+static void
+hildon_grid_item_set_icon_size(HildonGridItem             *item,
+                               HildonGridItemIconSizeType icon_size)
 {
     HildonGridItemPrivate *priv;
 
     g_return_if_fail(HILDON_IS_GRID_ITEM(item));
 
     priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    if (priv->icon_size == icon_size) {
+    if (priv->pending_icon_size == icon_size) {
         return;
     }
-    HILDON_GRID_ITEM_GET_PRIVATE(item)->icon_size = icon_size;
-    update_icon(HILDON_GRID_ITEM(item));
+    priv->pending_icon_size = icon_size;
 }
 
 
@@ -401,45 +419,110 @@ _hildon_grid_item_set_label_pos(HildonGridItem          *item,
     g_return_if_fail(HILDON_IS_GRID_ITEM(item));
 
     priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    if (priv->label_pos == label_pos) {
+    if (priv->pending_label_pos == label_pos) {
         return;
     }
-    priv->label_pos = label_pos;
-    set_label_justify(item);
-    /* No refresh here, grid will do it. */
+    priv->pending_label_pos = label_pos;
 }
 
+
 void
-_hildon_grid_item_set_label_spacing(HildonGridItem  *item,
-                                    const gint      hspacing,
-                                    const gint      vspacing)
+_hildon_grid_item_set_emblem_size(HildonGridItem *item, gint emblem_size)
 {
     HildonGridItemPrivate *priv;
 
     g_return_if_fail(HILDON_IS_GRID_ITEM(item));
 
     priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
+    if (priv->pending_emblem_size == emblem_size) {
+        return;
+    }
+    priv->pending_emblem_size = emblem_size;
+}
 
-    priv->label_hspacing = hspacing;
-    priv->label_vspacing = vspacing;
+
+void
+_hildon_grid_item_set_focus_margin(HildonGridItem *item,
+                                   const gint focus_margin)
+{
+    HildonGridItemPrivate *priv;
+
+    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
+
+    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
+    if (priv->pending_focus_margin == focus_margin) {
+        return;
+    }
+    priv->pending_focus_margin = focus_margin;
 }
 
 
 void
-_hildon_grid_item_set_emblem_size(HildonGridItem *item, gint emblem_size)
+_hildon_grid_item_set_label_height(HildonGridItem *item,
+                                   const gint label_height)
 {
     HildonGridItemPrivate *priv;
 
     g_return_if_fail(HILDON_IS_GRID_ITEM(item));
 
     priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    if (priv->emblem_size == emblem_size) {
+    if (priv->pending_label_height == label_height) {
+        return;
+    }
+    priv->pending_label_height = label_height;
+}
+
+
+void
+_hildon_grid_item_set_label_icon_margin(HildonGridItem *item,
+                                        const gint label_icon_margin)
+{
+    HildonGridItemPrivate *priv;
+
+    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
+
+    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
+    if (priv->pending_label_icon_margin == label_icon_margin) {
+        return;
+    }
+    priv->pending_label_icon_margin = label_icon_margin;
+}
+
+
+void
+_hildon_grid_item_set_icon_height(HildonGridItem *item,
+                                  const gint icon_height)
+{
+    HildonGridItemPrivate *priv;
+
+    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
+
+    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
+    if (priv->pending_icon_height == icon_height) {
+        return;
+    }
+    priv->pending_icon_height = icon_height;
+}
+
+
+void
+_hildon_grid_item_set_icon_width(HildonGridItem *item,
+                                 const gint icon_width)
+{
+    HildonGridItemPrivate *priv;
+
+    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
+
+    hildon_grid_item_set_icon_size(item, icon_width);
+
+    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
+    if (priv->pending_icon_width == icon_width) {
         return;
     }
-    priv->emblem_size = emblem_size;
-    update_icon(HILDON_GRID_ITEM(item));
+    priv->pending_icon_width = icon_width;
 }
 
+
 static void
 set_label_justify(HildonGridItem *item)
 {
@@ -490,8 +573,6 @@ hildon_grid_item_expose(GtkWidget *widget, GdkEventExpose *event)
 {
     HildonGridItem *item;
     HildonGridItemPrivate *priv;
-    GdkRectangle clip;
-    GtkWidget *focused;
 
     g_return_val_if_fail(widget, FALSE);
     g_return_val_if_fail(HILDON_IS_GRID_ITEM(widget), FALSE);
@@ -504,15 +585,40 @@ hildon_grid_item_expose(GtkWidget *widget, GdkEventExpose *event)
         return FALSE;
     }
     if (GTK_WIDGET_HAS_FOCUS(GTK_WIDGET(item))) {
+        GdkRectangle clip;
+        GtkWidget *focused;
+        
         if (priv->label != NULL) {
             focused = priv->label;
         } else {
             focused = priv->icon;
         }
-        clip.x = focused->allocation.x;
-        clip.y = focused->allocation.y;
-        clip.width = focused->allocation.width;
-        clip.height = focused->allocation.height;
+
+        switch (priv->label_pos) {
+        case HILDON_GRID_ITEM_LABEL_POS_BOTTOM:
+            clip.x = focused->allocation.x - priv->focus_margin;
+            clip.y = focused->allocation.y;
+            clip.width = focused->allocation.width + priv->focus_margin * 2;
+            clip.height = focused->allocation.height;
+            if (clip.x < widget->allocation.x ||
+                clip.width > widget->allocation.width) {
+                clip.x = widget->allocation.x;
+                clip.width = widget->allocation.width;
+            }
+            if (clip.y + clip.height >
+                widget->allocation.y + widget->allocation.height) {
+                clip.height = widget->allocation.y +
+                    widget->allocation.height - clip.y;
+            }
+            break;
+
+        case HILDON_GRID_ITEM_LABEL_POS_RIGHT:
+            clip.x = widget->allocation.x;
+            clip.y = widget->allocation.y;
+            clip.width = widget->allocation.width;
+            clip.height = widget->allocation.height;
+            break;
+        }
 
         gtk_paint_box(focused->style,
                       gtk_widget_get_toplevel(focused)->window,
@@ -545,18 +651,7 @@ hildon_grid_item_size_request(GtkWidget *widget, GtkRequisition *requisition)
     item = HILDON_GRID_ITEM(widget);
     priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
 
-    switch (priv->label_pos) {
-    case HILDON_GRID_ITEM_LABEL_POS_BOTTOM:
-        label_margin = priv->label_vspacing;
-        break;
-
-    case HILDON_GRID_ITEM_LABEL_POS_RIGHT:
-        label_margin = priv->label_hspacing;
-        break;
-    default:
-        label_margin = 0;
-        break;
-    }
+    label_margin = priv->focus_margin;
 
     gtk_widget_size_request(priv->icon, requisition);
     gtk_widget_size_request(priv->label, &label_req);
@@ -585,8 +680,6 @@ hildon_grid_item_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
     HildonGridItemPrivate *priv;
     GtkRequisition l_req;
     GtkAllocation i_alloc, l_alloc;
-    gint label_margin;
-    gint label_height;
 
     g_return_if_fail(widget);
     g_return_if_fail(allocation);
@@ -605,59 +698,41 @@ hildon_grid_item_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
         l_req.width = l_req.height = 0;
     }
 
-    label_height = l_req.height;
     switch (priv->label_pos) {
     case HILDON_GRID_ITEM_LABEL_POS_BOTTOM:
-        label_margin = priv->label_vspacing;
-
-        if (priv->icon_width > allocation->width) {
-            priv->icon_width = allocation->width;
-        }
-        if (priv->icon_height > allocation->height) {
-            priv->icon_height = allocation->height;
+        i_alloc.x = (allocation->width - priv->icon_width) / 2 +
+            allocation->x;
+        if (priv->label != NULL) {
+            i_alloc.y = allocation->y + (allocation->height -
+                                         priv->label_height -
+                                         priv->label_icon_margin -
+                                         priv->icon_height) / 2;
+        } else {
+            i_alloc.y = (allocation->height - priv->icon_height) / 2 +
+                allocation->y;
         }
-        i_alloc.x = (allocation->width - priv->icon_width) /
-            2 + allocation->x;
-        i_alloc.y = (allocation->height - priv->icon_height -
-                     label_height - label_margin) / 2 + allocation->y;
-        i_alloc.width = priv->icon_width;
-        i_alloc.height = priv->icon_height;
-
-        if (label_height > 0) {
-            if (l_req.height > allocation->height) {
-                l_req.height = allocation->height;
-            }
-            l_alloc.x = allocation->x;
-            l_alloc.y = i_alloc.y + priv->icon_height + label_margin;
-            l_alloc.width = allocation->width;
-            l_alloc.height = l_req.height;
+
+        if (priv->label != NULL) {
+            l_alloc.x = allocation->x + priv->focus_margin;
+            l_alloc.y = i_alloc.y + priv->icon_height +
+                priv->label_icon_margin;
+            l_alloc.width = allocation->width - priv->focus_margin * 2;
+            l_alloc.height = priv->label_height;
         }
         break;
 
     case HILDON_GRID_ITEM_LABEL_POS_RIGHT:
-        label_margin = priv->label_hspacing;
-
-        if (priv->icon_width > allocation->width) {
-            priv->icon_width = allocation->width;
-        }
-        if (priv->icon_height > allocation->height) {
-            priv->icon_height = allocation->height;
-        }
+        i_alloc.x = allocation->x + priv->focus_margin;
+        i_alloc.y = allocation->y +
+          (priv->label_height - priv->icon_height) / 2;
 
-        i_alloc.x = allocation->x;
-        i_alloc.y = (allocation->height - priv->icon_height) /
-            2 + allocation->y;
-        i_alloc.width = priv->icon_width;
-        i_alloc.height = priv->icon_height;
-
-        if (label_height > 0) {
-            l_alloc.x = priv->icon_width + label_margin + allocation->x;
-            l_alloc.y = (allocation->height - label_height) / 2
-                + allocation->y;
-
-            l_alloc.width = allocation->width - priv->icon_width
-                - label_margin;
-            l_alloc.height = MIN(l_req.height, allocation->height);
+        if (priv->label != NULL) {
+            l_alloc.x = allocation->x + priv->focus_margin +
+                priv->icon_width + priv->label_icon_margin;
+            l_alloc.y = allocation->y;
+            l_alloc.width = allocation->width - priv->focus_margin * 2 -
+                priv->label_icon_margin - priv->icon_width;
+            l_alloc.height = priv->label_height;
         }
         break;
     default:
@@ -666,6 +741,19 @@ hildon_grid_item_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
         break;
     }
 
+    if (i_alloc.y < allocation->y) {
+        i_alloc.height -= i_alloc.height - allocation->height;
+        i_alloc.y = allocation->y;
+    }
+    if (i_alloc.y + i_alloc.height > allocation->y + allocation->height) {
+        i_alloc.height-= i_alloc.y + i_alloc.height -
+            allocation->y - allocation->height;
+    }
+      
+
+    i_alloc.width = priv->icon_width;
+    i_alloc.height = priv->icon_height;
+
     if (priv->label != NULL) {
         gtk_widget_size_allocate(priv->label, &l_alloc);
     }
@@ -778,3 +866,69 @@ hildon_grid_item_get_emblem_type(HildonGridItem *item)
 
     return HILDON_GRID_ITEM_GET_PRIVATE(item)->emblem_basename;
 }
+
+
+
+void
+_hildon_grid_item_done_updating_settings(HildonGridItem *item)
+{
+    gboolean need_update_icon;
+    gboolean need_resize;
+
+    HildonGridItemPrivate *priv;
+    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
+    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
+
+    need_update_icon = need_resize = FALSE;
+    
+    if (priv->pending_icon_size != priv->icon_size) {
+        if (priv->pending_icon_size > 0) {
+            priv->icon_size = priv->pending_icon_size;
+        } else {
+            priv->icon_size = 1;
+        }
+        need_update_icon = TRUE;
+    }
+    if (priv->pending_emblem_size != priv->emblem_size) {
+        priv->emblem_size = priv->pending_emblem_size;
+        need_update_icon = TRUE;
+    }
+    if (priv->pending_label_pos != priv->label_pos) {
+        priv->label_pos = priv->pending_label_pos;
+        /* No refresh here, grid will do it. */
+        set_label_justify(item);
+    }
+    /*
+     * grid will take care of this
+     *
+    if (priv->pending_focus_margin != priv->focus_margin) {
+        priv->focus_margin = priv->pending_focus_margin;
+        need_resize = TRUE;
+    }
+    if (priv->pending_label_height != priv->label_height) {
+        priv->label_height = priv->pending_label_height;
+        need_resize = TRUE;
+    }
+    if (priv->pending_label_icon_margin != priv->label_icon_margin) {
+        priv->label_icon_margin = priv->pending_label_icon_margin;
+        need_resize = TRUE;
+    }
+    if (priv->pending_icon_height != priv->icon_height) {
+        priv->icon_height = priv->pending_icon_height;
+        need_resize = TRUE;
+    }
+    if (priv->pending_icon_width != priv->icon_width) {
+        priv->icon_width = priv->pending_icon_width;
+        need_resize = TRUE;
+    }
+     */
+
+    if (need_update_icon == TRUE) {
+        update_icon(HILDON_GRID_ITEM(item));
+    }
+    /*
+    if (need_resize == TRUE) {
+        gtk_widget_queue_resize(GTK_WIDGET(item));
+    }
+    */
+}
index fc526f0..c474da2 100644 (file)
@@ -55,6 +55,7 @@
 #include <gdk/gdkkeysyms.h>
 
 #include "hildon-grid-item-private.h"
+#include "hildon-marshalers.h"
 #include <hildon-widgets/hildon-grid.h>
 #include <hildon-widgets/hildon-grid-item.h>
 
 
 #define DEFAULT_STYLE   "largeicons-home"
 
-#define DEFAULT_WIDTH         128
-#define DEFAULT_HEIGHT         96
-#define DEFAULT_HSPACING        8
-#define DEFAULT_VSPACING        8
-#define DEFAULT_LABEL_HSPACING  4
-#define DEFAULT_LABEL_VSPACING  0
-
-#define DEFAULT_EMBLEM_SIZE    25
-#define DEFAULT_ICON_SIZE      64
 #define DEFAULT_N_COLUMNS       3
-#define DEFAULT_LABEL_POS       1
 #define GRID_LABEL_POS_PAD     16
 
 #define DRAG_SENSITIVITY        6
@@ -112,25 +103,19 @@ struct _HildonGridPrivate {
     GdkWindow *event_window;
 
     gchar *style;
-    /* We don't want to fetch style properties every single time. */
-    guint icon_size;
-    guint emblem_size;
-    guint num_columns;
-    HildonGridPositionType label_pos;
-    gint label_hspacing;
-    gint label_vspacing;
+    gint emblem_size;
     GtkWidget *empty_label;
 
-    guint widget_width;
-    guint widget_height;
-    guint widget_hspacing;
-    guint widget_vspacing;
-
-    guint saved_width;
-    guint saved_height;
-    guint saved_hspacing;
-    guint saved_vspacing;
-
+    gint item_width;
+    gint item_height;
+    gint h_margin;
+    gint v_margin;
+    gint focus_margin;
+    gint icon_label_margin;
+    gint icon_width;
+    gint num_columns;
+    HildonGridPositionType label_pos;
+    gint label_height;
 
     gint focus_index;
     guint click_x;
@@ -140,10 +125,10 @@ struct _HildonGridPrivate {
     gint area_height;
     gint area_rows;
     gint scrollbar_width;
-    gint visible_cols;
 
     gint first_index;
     GdkEventType last_button_event;
+    gint old_item_height;
 };
 
 
@@ -186,32 +171,30 @@ static void hildon_grid_get_property(GObject * object,
                                      guint prop_id,
                                      GValue * value, GParamSpec * pspec);
 
-static void _hildon_grid_set_empty_label(HildonGrid * grid,
-                                         const gchar * empty_label);
-static const gchar *_hildon_grid_get_empty_label(HildonGrid * grid);
-static void _hildon_grid_set_n_columns(HildonGrid * grid, gint num_cols);
-static void _hildon_grid_set_label_pos(HildonGrid * grid,
-                                       HildonGridPositionType label_pos);
-static void _hildon_grid_set_label_hspacing(HildonGrid * grid,
-                                            gint hspacing);
-static void _hildon_grid_set_label_vspacing(HildonGrid * grid,
-                                            gint vspacing);
-static void _hildon_grid_set_icon_size(HildonGrid * grid, gint icon_size);
-static void _hildon_grid_set_emblem_size(HildonGrid * grid,
-                                         gint emblem_size);
+static void hildon_grid_set_empty_label(HildonGrid *grid,
+                                        const gchar *empty_label);
+static const gchar *hildon_grid_get_empty_label(HildonGrid * grid);
+static void hildon_grid_set_num_columns(HildonGrid *grid, gint num_cols);
+static void hildon_grid_set_label_pos(HildonGrid *grid,
+                                      HildonGridPositionType label_pos);
+static void hildon_grid_set_focus_margin(HildonGrid *grid,
+                                         gint focus_margin);
+static void hildon_grid_set_icon_label_margin(HildonGrid *grid,
+                                              gint icon_label_margin);
+static void hildon_grid_set_icon_width(HildonGrid *grid, gint icon_width);
+static void hildon_grid_set_emblem_size(HildonGrid *grid, gint emblem_size);
+static void hildon_grid_set_label_height(HildonGrid *grid,
+                                         gint label_height);
 static void hildon_grid_destroy(GtkObject * self);
 static void hildon_grid_finalize(GObject * object);
 
 /* Signal handlers. */
 static gboolean hildon_grid_button_pressed(GtkWidget * widget,
-                                           GdkEventButton * event,
-                                           gpointer data);
+                                           GdkEventButton * event);
 static gboolean hildon_grid_button_released(GtkWidget * widget,
-                                            GdkEventButton * event,
-                                            gpointer data);
+                                            GdkEventButton * event);
 static gboolean hildon_grid_key_pressed(GtkWidget * widget,
-                                        GdkEventKey * event,
-                                        gpointer data);
+                                        GdkEventKey * event);
 static gboolean hildon_grid_scrollbar_moved(GtkWidget * widget,
                                             gpointer data);
 static gboolean hildon_grid_state_changed(GtkWidget * widget,
@@ -231,15 +214,6 @@ static gboolean update_contents(HildonGrid * grid);
 static void set_focus(HildonGrid * grid,
                       GtkWidget * widget, gboolean refresh_view);
 
-/* Our fancy little marshaler. */
-static void marshal_BOOLEAN__INT_INT_INT(GClosure * closure,
-                                         GValue * return_value,
-                                         guint n_param_values,
-                                         const GValue * param_values,
-                                         gpointer invocation_hint,
-                                         gpointer marshal_data);
-
-
 static GtkContainerClass *parent_class = NULL;
 static guint grid_signals[LAST_SIGNAL] = { 0 };
 
@@ -296,6 +270,9 @@ static void hildon_grid_class_init(HildonGridClass * klass)
     widget_class->size_request = hildon_grid_size_request;
     widget_class->size_allocate = hildon_grid_size_allocate;
     widget_class->tap_and_hold_setup = hildon_grid_tap_and_hold_setup;
+    widget_class->key_press_event = hildon_grid_key_pressed;
+    widget_class->button_press_event = hildon_grid_button_pressed;
+    widget_class->button_release_event = hildon_grid_button_released;
 
     container_class->add = hildon_grid_add;
     container_class->remove = hildon_grid_remove;
@@ -307,85 +284,73 @@ static void hildon_grid_class_init(HildonGridClass * klass)
         g_param_spec_string("empty_label",
                             "Empty label",
                             "Label to show when grid has no items",
-                            _("No icons"),
-                            G_PARAM_READWRITE));
+                            "", G_PARAM_READWRITE));
 
     gtk_widget_class_install_style_property(widget_class,
         g_param_spec_uint("item_width",
                           "Item width",
-                          "Total width of an item",
-                          1, G_MAXINT,
-                          DEFAULT_WIDTH,
-                          G_PARAM_READABLE));
+                          "Total width of an item (obsolete)",
+                          1, G_MAXINT, 212, G_PARAM_READABLE));
 
     gtk_widget_class_install_style_property(widget_class,
         g_param_spec_uint("item_height",
                           "Item height",
                           "Total height of an item",
-                          1, G_MAXINT, DEFAULT_HEIGHT,
-                          G_PARAM_READABLE));
+                          1, G_MAXINT, 96, G_PARAM_READABLE));
 
     gtk_widget_class_install_style_property(widget_class,
         g_param_spec_uint("item_hspacing",
                           "Item horizontal spacing",
-                          "Horizontal space between items",
-                          0, G_MAXINT, DEFAULT_HSPACING,
-                          G_PARAM_READABLE));
+                          "Margin between two columns and labels",
+                          0, G_MAXINT, 12, G_PARAM_READABLE));
 
     gtk_widget_class_install_style_property(widget_class,
         g_param_spec_uint("item_vspacing",
                           "Item vertical spacing",
-                          "Vertical space between items",
-                          0, G_MAXINT, DEFAULT_VSPACING,
-                          G_PARAM_READABLE));
+                          "Icon on right: Margin between rows / Icon at bottom: Vertical margin betweeb label and icon",
+                          0, G_MAXINT, 6, G_PARAM_READABLE));
 
     gtk_widget_class_install_style_property(widget_class,
         g_param_spec_uint("label_hspacing",
-                          "Horizontal label spacing",
-                          "Horizontal margin between item and label",
-                          0, G_MAXINT,
-                          DEFAULT_LABEL_HSPACING,
-                          G_PARAM_READABLE));
+                          "Focus margin",
+                          "Margin between focus edge and item edge",
+                          0, G_MAXINT, 6, G_PARAM_READABLE));
 
     gtk_widget_class_install_style_property(widget_class,
         g_param_spec_uint("label_vspacing",
                           "Vertical label spacing",
                           "Vertical margin between item and label",
-                          0, G_MAXINT,
-                          DEFAULT_LABEL_VSPACING,
-                          G_PARAM_READABLE));
+                          0, G_MAXINT, 6, G_PARAM_READABLE));
+
+    gtk_widget_class_install_style_property(widget_class,
+        g_param_spec_uint("label_height",
+                          "Label height",
+                          "Height of icon label",
+                          1, G_MAXINT, 30, G_PARAM_READABLE));
 
     gtk_widget_class_install_style_property(widget_class,
         g_param_spec_uint("n_columns",
                           "Columns",
                           "Number of columns",
-                          0, G_MAXINT,
-                          DEFAULT_N_COLUMNS,
-                          G_PARAM_READABLE));
+                          0, G_MAXINT, DEFAULT_N_COLUMNS, G_PARAM_READABLE));
 
     gtk_widget_class_install_style_property(widget_class,
         g_param_spec_uint("label_pos",
                           "Label position",
                           "Position of label related to the icon",
-                          1, 2,
-                          DEFAULT_LABEL_POS,
-                          G_PARAM_READABLE));
+                          1, 2, 1, G_PARAM_READABLE));
 
     gtk_widget_class_install_style_property(widget_class,
         g_param_spec_uint("icon_size",
                           "Icon size",
-                          "Size of the icon in pixels",
-                          1, G_MAXINT,
-                          DEFAULT_ICON_SIZE,
-                          G_PARAM_READABLE));
+                          "Size of the icon in pixels (width)",
+                          1, G_MAXINT, 64, G_PARAM_READABLE));
 
     gtk_widget_class_install_style_property(widget_class,
         g_param_spec_uint("emblem_size",
                           "Emblem size",
                           "Size of the emblem in pixels",
-                          1, G_MAXINT,
-                          DEFAULT_EMBLEM_SIZE,
-                          G_PARAM_READABLE));
+                          1, G_MAXINT, 25, G_PARAM_READABLE));
 
     /**
      * HildonGrid::activate-child:
@@ -413,7 +378,7 @@ static void hildon_grid_class_init(HildonGridClass * klass)
                      G_SIGNAL_RUN_LAST,
                      G_STRUCT_OFFSET(HildonGridClass, popup_context_menu),
                      g_signal_accumulator_true_handled, NULL,
-                     marshal_BOOLEAN__INT_INT_INT,
+                     _hildon_marshal_BOOLEAN__INT_INT_INT,
                      G_TYPE_BOOLEAN, 3,
                      G_TYPE_INT, G_TYPE_INT, G_TYPE_INT);
 }
@@ -421,14 +386,14 @@ static void hildon_grid_class_init(HildonGridClass * klass)
 
 
 /*
- * _hildon_grid_set_empty_label:
+ * hildon_grid_set_empty_label:
  * @grid:           #HildonGrid
  * @empty_label:    New label
  *
  * Sets empty label.
  */
 static void
-_hildon_grid_set_empty_label(HildonGrid * grid, const gchar * empty_label)
+hildon_grid_set_empty_label(HildonGrid * grid, const gchar * empty_label)
 {
     /* No need to worry about update -- label receives a signal for it. */
     gtk_label_set_label(GTK_LABEL(HILDON_GRID_GET_PRIVATE
@@ -444,54 +409,57 @@ _hildon_grid_set_empty_label(HildonGrid * grid, const gchar * empty_label)
  *
  * Return value: Label
  */
-static const gchar *_hildon_grid_get_empty_label(HildonGrid * grid)
+static const gchar *
+hildon_grid_get_empty_label(HildonGrid * grid)
 {
     return gtk_label_get_label(GTK_LABEL(HILDON_GRID_GET_PRIVATE
                                          (grid)->empty_label));
 }
 
 /*
- * _hildon_grid_set_n_columns:
+ * hildon_grid_set_num_columns:
  * @grid:       #HildonGrid
  * @columsn:    Number of columns
  *
  * Sets number of columns.
  */
-static void _hildon_grid_set_n_columns(HildonGrid * grid, gint columns)
+static void
+hildon_grid_set_num_columns(HildonGrid * grid, gint columns)
 {
-    GtkWidget *focus;
     HildonGridPrivate *priv;
 
     g_return_if_fail(HILDON_IS_GRID(grid));
-
     priv = HILDON_GRID_GET_PRIVATE(grid);
 
     if (priv->num_columns == columns) {
         return;
     }
 
-    priv->num_columns = columns;
+    if (columns != 0)
+        priv->num_columns = columns;
+    else
+        priv->num_columns = DEFAULT_N_COLUMNS;
+    
+    /* Update estimated row-count for jump_scrollbar... */
+    priv->area_rows = priv->area_height / priv->num_columns;
 
-    /* If number of columns is defined (non-zero), use it immediately. */
-    if (columns != 0) {
-        priv->visible_cols = columns;
-    }
-    focus = GTK_CONTAINER(grid)->focus_child;
+    /* Size could have changed. Scroll view so there's something to show. */
+    adjust_scrollbar_height(grid);
+    jump_scrollbar_to_focused(grid);
     gtk_widget_queue_resize(GTK_WIDGET(grid));
 }
 
 /*
- * _hildon_grid_set_label_pos:
+ * hildon_grid_set_label_pos:
  * @grid:       #HildonGrid
  * @label_pos:  Label position
  *
  * Sets icon label position.
  */
 static void
-_hildon_grid_set_label_pos(HildonGrid * grid,
-                           HildonGridPositionType label_pos)
+hildon_grid_set_label_pos(HildonGrid * grid,
+                          HildonGridPositionType label_pos)
 {
-    GtkRequisition req;
     HildonGridPrivate *priv;
     GList *list;
     GtkWidget *child;
@@ -511,86 +479,69 @@ _hildon_grid_set_label_pos(HildonGrid * grid,
 
         _hildon_grid_item_set_label_pos(HILDON_GRID_ITEM(child),
                                         label_pos);
-        gtk_widget_size_request(child, &req);
-        gtk_widget_queue_resize(child);
     }
 }
 
 /*
- * _hildon_grid_set_label_hspacing:
- * @grid:       #HildonGrid
- * @hspacing:   Horizontal spacing
+ * hildon_grid_set_focus_margin:
+ * @grid:         #HildonGrid
+ * @focus_margin: Focus margin
  *
- * Sets horizontal spacing for label.
+ * Sets margin between icon edge and label edge
  */
 static void
-_hildon_grid_set_label_hspacing(HildonGrid * grid, gint hspacing)
+hildon_grid_set_focus_margin(HildonGrid *grid, gint focus_margin)
 {
     HildonGridPrivate *priv;
     GList *list;
     GtkWidget *child;
 
     priv = HILDON_GRID_GET_PRIVATE(grid);
-    if (hspacing == priv->label_hspacing)
+    if (focus_margin == priv->focus_margin)
         return;
 
-    priv->label_hspacing = hspacing;
+    priv->focus_margin = focus_margin;
 
     /* Update children. */
     for (list = priv->children; list != NULL; list = list->next) {
         child = ((HildonGridChild *) list->data)->widget;
 
-        _hildon_grid_item_set_label_spacing(HILDON_GRID_ITEM(child),
-                                            priv->label_hspacing,
-                                            priv->label_vspacing);
-        if (priv->label_pos == HILDON_GRID_ITEM_LABEL_POS_RIGHT) {
-            gtk_widget_queue_resize(child);
-        }
+        _hildon_grid_item_set_focus_margin(HILDON_GRID_ITEM(child),
+                                           priv->focus_margin);
     }
 }
 
 
 /*
- * _hildon_grid_set_label_vspacing:
+ * hildon_grid_set_icon_label_margin:
  * @grid:       #HildonGrid
  * @hspacing:   Vertical spacing
  *
  * Sets vertical spacing for label.
+ * XXX
  */
 static void
-_hildon_grid_set_label_vspacing(HildonGrid * grid, gint vspacing)
+hildon_grid_set_icon_label_margin(HildonGrid *grid, gint icon_label_margin)
 {
     HildonGridPrivate *priv;
-    GList *list;
-    GtkWidget *child;
 
     priv = HILDON_GRID_GET_PRIVATE(grid);
-    if (vspacing == priv->label_vspacing)
+    if (icon_label_margin == priv->icon_label_margin)
         return;
 
-    priv->label_vspacing = vspacing;
-
-    /* Update children. */
-    for (list = priv->children; list != NULL; list = list->next) {
-        child = ((HildonGridChild *) list->data)->widget;
-
-        _hildon_grid_item_set_label_spacing(HILDON_GRID_ITEM(child),
-                                            priv->label_hspacing,
-                                            priv->label_vspacing);
-        if (priv->label_pos == HILDON_GRID_ITEM_LABEL_POS_BOTTOM) {
-            gtk_widget_queue_resize(child);
-        }
-    }
+    priv->icon_label_margin = icon_label_margin;
 }
 
+
 /*
- * _hildon_grid_set_icon_size:
+ * hildon_grid_set_icon_width:
  * @grid:       #HildonGrid
- * @icon_size:  Icon size
+ * @icon_size:  Icon size (width)
  *
  * Sets icon size (in pixels).
  */
-static void _hildon_grid_set_icon_size(HildonGrid * grid, gint icon_size)
+static void
+hildon_grid_set_icon_width(HildonGrid * grid, gint icon_width)
 {
     HildonGridPrivate *priv;
     GList *list;
@@ -598,30 +549,29 @@ static void _hildon_grid_set_icon_size(HildonGrid * grid, gint icon_size)
 
     priv = HILDON_GRID_GET_PRIVATE(grid);
 
-    if (icon_size == priv->icon_size)
+    if (icon_width == priv->icon_width)
         return;
 
-    priv->icon_size = icon_size;
+    priv->icon_width = icon_width;
 
     for (list = priv->children; list != NULL; list = list->next) {
         child = ((HildonGridChild *) list->data)->widget;
 
-        _hildon_grid_item_set_icon_size(HILDON_GRID_ITEM(child),
-                                        icon_size);
-        gtk_widget_queue_resize(child);
+        _hildon_grid_item_set_icon_width(HILDON_GRID_ITEM(child),
+                                         icon_width);
     }
 }
 
 
 /*
- * _hildon_grid_set_emblem_size:
+ * hildon_grid_set_emblem_size:
  * @grid:           #HildonGrid
  * @emblem_size:    Emblem size
  *
  * Sets emblem size (in pixels).
  */
 static void
-_hildon_grid_set_emblem_size(HildonGrid * grid, gint emblem_size)
+hildon_grid_set_emblem_size(HildonGrid *grid, gint emblem_size)
 {
     HildonGridPrivate *priv;
     GList *list;
@@ -639,10 +589,34 @@ _hildon_grid_set_emblem_size(HildonGrid * grid, gint emblem_size)
 
         _hildon_grid_item_set_emblem_size(HILDON_GRID_ITEM(child),
                                           emblem_size);
-        gtk_widget_queue_draw(child);
     }
 }
 
+
+static void
+hildon_grid_set_label_height(HildonGrid *grid,
+                             gint label_height)
+{
+    HildonGridPrivate *priv;
+    GList *list;
+    GtkWidget *child;
+
+    priv = HILDON_GRID_GET_PRIVATE(grid);
+
+    if (label_height == priv->label_height)
+        return;
+
+    priv->label_height = label_height;
+
+    for (list = priv->children; list != NULL; list = list->next) {
+        child = ((HildonGridChild *) list->data)->widget;
+
+        _hildon_grid_item_set_label_height(HILDON_GRID_ITEM(child),
+                                           label_height);
+    }
+}
+
+
 static GType hildon_grid_child_type(GtkContainer * container)
 {
     return GTK_TYPE_WIDGET;
@@ -658,7 +632,7 @@ static void hildon_grid_init(HildonGrid * grid)
     priv->focus_index = -1;
 
     priv->scrollbar = gtk_vscrollbar_new(NULL);
-    priv->empty_label = gtk_label_new(_("No items"));
+    priv->empty_label = gtk_label_new("");
     priv->style = NULL;
 
     priv->area_height = 1;
@@ -669,13 +643,16 @@ static void hildon_grid_init(HildonGrid * grid)
     priv->click_x = 0;
     priv->click_y = 0;
 
-    priv->visible_cols = DEFAULT_N_COLUMNS;
-    priv->widget_width = 1;
-    priv->widget_hspacing = 0;
-    priv->widget_height = 1;
-    priv->widget_vspacing = 0;
+    priv->item_height = 96;
+    priv->h_margin = 12;
+    priv->v_margin = 6;
+    priv->focus_margin = 6;
+    priv->icon_label_margin = 6;
+    priv->icon_width = 64;
+    priv->label_pos = HILDON_GRID_ITEM_LABEL_POS_BOTTOM;
 
     priv->old_sb_pos = -1;
+    priv->old_item_height = -1;
 
     gtk_widget_set_parent(priv->scrollbar, GTK_WIDGET(grid));
     gtk_widget_set_parent(priv->empty_label, GTK_WIDGET(grid));
@@ -691,8 +668,6 @@ static void hildon_grid_init(HildonGrid * grid)
     /* Signal for key press. */
     GTK_WIDGET_SET_FLAGS(GTK_WIDGET(grid), GTK_CAN_FOCUS);
     gtk_widget_set_events(GTK_WIDGET(grid), GDK_KEY_PRESS_MASK);
-    g_signal_connect(G_OBJECT(grid), "key-press-event",
-                     G_CALLBACK(hildon_grid_key_pressed), grid);
 
     GTK_WIDGET_UNSET_FLAGS(priv->scrollbar, GTK_CAN_FOCUS);
     hildon_grid_set_style(grid, DEFAULT_STYLE);
@@ -751,13 +726,6 @@ static void hildon_grid_realize(GtkWidget * widget)
 
     gtk_style_set_background(widget->style,
                              widget->window, GTK_STATE_NORMAL);
-
-    g_signal_connect(G_OBJECT(widget),
-                     "button-press-event",
-                     G_CALLBACK(hildon_grid_button_pressed), grid);
-    g_signal_connect(G_OBJECT(widget),
-                     "button-release-event",
-                     G_CALLBACK(hildon_grid_button_released), grid);
 }
 
 
@@ -797,8 +765,7 @@ static void hildon_grid_map(GtkWidget * widget)
 
     (*GTK_WIDGET_CLASS(parent_class)->map) (widget);
 
-    /* We don't really need the following... They never do anything I
-       think. */
+    /* We shouldn't really need the following...*/
     if (priv->scrollbar != NULL && GTK_WIDGET_VISIBLE(priv->scrollbar)) {
         if (!GTK_WIDGET_MAPPED(priv->scrollbar)) {
             gtk_widget_map(priv->scrollbar);
@@ -878,14 +845,14 @@ hildon_grid_expose(GtkWidget * widget, GdkEventExpose * event)
         ;       /* Nothing here. */
     }
 
-    for (; list != NULL && child_no < priv->first_index
-         + priv->visible_cols * priv->area_rows; list = list->next) {
+    for (; list != NULL && child_no < priv->first_index +
+         priv->num_columns * priv->area_rows; list = list->next) {
         gtk_container_propagate_expose(container,
                                        ((HildonGridChild *) list->data)
                                        ->widget, event);
     }
 
-    /* Kludge to keep focused item focused. Enjoy. */
+    /* Keep focused item focused. */
     if (container->focus_child != NULL
         && !GTK_WIDGET_HAS_FOCUS(container->focus_child)) {
         set_focus(grid, container->focus_child, FALSE);
@@ -938,7 +905,7 @@ hildon_grid_size_request(GtkWidget * widget, GtkRequisition * requisition)
 /*
  * hildon_grid_size_allocate:
  *
- * Supposedly called when size of grid changes and after view have moved so
+ * Supposingly called when size of grid changes and after view have moved so
  * that items need to be relocated.
  */
 static void
@@ -950,11 +917,10 @@ hildon_grid_size_allocate(GtkWidget * widget, GtkAllocation * allocation)
     GtkWidget *child;
     gint child_no;
     gint y_offset;
+    gint row_margin;
 
     GtkAllocation alloc;
     GtkRequisition req;
-    GtkRequisition c_req;
-    gint item_width, item_height;
 
     g_return_if_fail(widget);
     g_return_if_fail(allocation);
@@ -963,7 +929,6 @@ hildon_grid_size_allocate(GtkWidget * widget, GtkAllocation * allocation)
     priv = HILDON_GRID_GET_PRIVATE(grid);
     widget->allocation = *allocation;
 
-
     get_style_properties(grid);
 
     /* First of all, make sure GdkWindow is over our widget. */
@@ -971,8 +936,8 @@ hildon_grid_size_allocate(GtkWidget * widget, GtkAllocation * allocation)
         gdk_window_move_resize(priv->event_window,
                                widget->allocation.x,
                                widget->allocation.y,
-                               widget->allocation.width
-                               - priv->scrollbar_width,
+                               widget->allocation.width -
+                                  priv->scrollbar_width,
                                widget->allocation.height);
     }
     /* Show the label if there are no items. */
@@ -1023,39 +988,28 @@ hildon_grid_size_allocate(GtkWidget * widget, GtkAllocation * allocation)
         gtk_widget_hide(priv->empty_label);
     }
 
-    /* Get item size. */
-    item_width = priv->widget_width + priv->widget_hspacing;
-    item_height = priv->widget_height + priv->widget_vspacing;
-
     priv->area_height = allocation->height;
-    priv->area_rows = allocation->height / item_height;
-
+    priv->area_rows = allocation->height / priv->item_height;
 
     /* Adjust/show/hide scrollbar. */
     adjust_scrollbar_height(grid);
+    if (priv->old_item_height != priv->item_height) {
+        priv->old_item_height = priv->item_height;
+        jump_scrollbar_to_focused(grid);
+    }
 
-
-    /* Only one column? Lets use all the space we have. */
-    if (priv->visible_cols == 1) {
-        if (priv->scrollbar != NULL &&
-            GTK_WIDGET_VISIBLE(priv->scrollbar)) {
-            gtk_widget_get_child_requisition(priv->scrollbar, &req);
-        } else {
-            req.width = 0;
-        }
-
-        item_width = allocation->width - priv->scrollbar_width
-            - priv->widget_hspacing - req.width;
-        priv->widget_width = item_width;
+    /* Update item width. */
+    if (priv->num_columns == 1) {
+        priv->item_width = allocation->width - priv->scrollbar_width -
+            priv->h_margin - priv->scrollbar_width;
     } else {
-        priv->widget_width = priv->saved_width;
-        priv->widget_hspacing = priv->saved_hspacing;
-        item_width = priv->widget_width + priv->widget_hspacing;
+        priv->item_width = (allocation->width - priv->scrollbar_width) /
+            priv->num_columns;
     }
 
     priv->first_index =
-        (int) gtk_range_get_value(GTK_RANGE(priv->scrollbar))
-        / item_height * priv->visible_cols;
+        (int) gtk_range_get_value(GTK_RANGE(priv->scrollbar)) /
+        priv->item_height * priv->num_columns;
 
     /* Hide items before visible ones. */
     for (list = priv->children, child_no = 0;
@@ -1069,25 +1023,37 @@ hildon_grid_size_allocate(GtkWidget * widget, GtkAllocation * allocation)
     }
 
     /* Allocate visible items. */
-    for (y_offset = priv->first_index / priv->visible_cols * item_height;
-         list != NULL && child_no < priv->first_index
-         + priv->area_rows * priv->visible_cols;
+    alloc.width = priv->item_width - priv->h_margin;
+    switch (priv->label_pos) {
+    case HILDON_GRID_ITEM_LABEL_POS_BOTTOM:
+        row_margin = priv->icon_label_margin;
+        break;
+    case HILDON_GRID_ITEM_LABEL_POS_RIGHT:
+        row_margin = priv->v_margin;
+        break;
+    default:
+        row_margin = 0;
+        break;
+    }
+    alloc.height = priv->item_height - row_margin;
+
+    for (y_offset = priv->first_index / priv->num_columns * priv->item_height;
+         list != NULL && child_no < priv->first_index +
+         priv->area_rows * priv->num_columns;
          list = list->next, child_no++) {
         child = ((HildonGridChild *) list->data)->widget;
 
         if (!GTK_WIDGET_VISIBLE(child)) {
             gtk_widget_show(child);
         }
-        gtk_widget_get_child_requisition(child, &c_req);
 
         /* Don't update icons which are not visible... */
-        alloc.y = (child_no / priv->visible_cols) * item_height +
-            allocation->y - y_offset + priv->widget_vspacing;
-        alloc.x = (child_no % priv->visible_cols) * item_width
-            + allocation->x + priv->widget_hspacing;
-        alloc.width = priv->widget_width;
-        alloc.height = priv->widget_height;
+        alloc.y = (child_no / priv->num_columns) * priv->item_height +
+                  allocation->y - y_offset + row_margin;
+        alloc.x = (child_no % priv->num_columns) * priv->item_width +
+                 allocation->x;
 
+        _hildon_grid_item_done_updating_settings(HILDON_GRID_ITEM(child));
         gtk_widget_size_allocate(child, &alloc);
     }
 
@@ -1133,11 +1099,10 @@ static void hildon_grid_add(GtkContainer * container, GtkWidget * widget)
 
     _hildon_grid_item_set_label_pos(HILDON_GRID_ITEM(widget),
                                     priv->label_pos);
-    _hildon_grid_item_set_label_spacing(HILDON_GRID_ITEM(widget),
-                                        priv->label_hspacing,
-                                        priv->label_vspacing);
-    _hildon_grid_item_set_icon_size(HILDON_GRID_ITEM(widget),
-                                    priv->icon_size);
+    _hildon_grid_item_set_focus_margin(HILDON_GRID_ITEM(widget),
+                                       priv->focus_margin);
+    _hildon_grid_item_set_icon_width(HILDON_GRID_ITEM(widget),
+                                     priv->icon_width);
     _hildon_grid_item_set_emblem_size(HILDON_GRID_ITEM(widget),
                                       priv->emblem_size);
     priv->children = g_list_append(priv->children, child);
@@ -1155,8 +1120,8 @@ static void hildon_grid_add(GtkContainer * container, GtkWidget * widget)
      * If item was added in visible area, relocate items. Otherwise update
      * scrollbar and see if items need relocating.
      */
-    if (g_list_length(priv->children) < priv->first_index
-        + priv->area_rows * priv->visible_cols) {
+    if (g_list_length(priv->children) < priv->first_index +
+        priv->area_rows * priv->num_columns) {
         gtk_widget_queue_resize(GTK_WIDGET(grid));
     } else {
         gboolean updated;
@@ -1303,7 +1268,6 @@ set_focus(HildonGrid * grid, GtkWidget * widget, gboolean refresh_view)
     }
 
     if (view_updated) {
-        /* Don't just queue it, let's do it now! */
         hildon_grid_size_allocate(GTK_WIDGET(grid),
                                   &GTK_WIDGET(grid)->allocation);
     }
@@ -1401,7 +1365,7 @@ static void hildon_grid_finalize(GObject * object)
  */
 static gboolean
 hildon_grid_key_pressed(GtkWidget * widget,
-                        GdkEventKey * event, gpointer data)
+                        GdkEventKey * event)
 {
     GtkAdjustment *adjustment;
     GtkContainer *container;
@@ -1418,24 +1382,24 @@ hildon_grid_key_pressed(GtkWidget * widget,
 
     g_return_val_if_fail(widget, FALSE);
 
-    grid = HILDON_GRID(data);
+    grid = HILDON_GRID(widget);
     priv = HILDON_GRID_GET_PRIVATE(grid);
 
     /* 
-     * If focus was never lost (which is supposedly a bug), we could just
-     * see if an item is focused - if not, there's nothing else to focus...
+     * If focus was never lost, we could just see if an item is focused - 
+     * if not, there's nothing else to focus...
      */
 
     /* No items? */
     if (priv->children == NULL || g_list_length(priv->children) == 0)
-        return FALSE;
+        return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
 
     /* Focused item is dimmed? */
     /* If we have no focus, allow non-existing focus to move... */
     container = GTK_CONTAINER(grid);
     if (container->focus_child != NULL
         && !GTK_WIDGET_IS_SENSITIVE(container->focus_child)) {
-        return FALSE;
+        return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
     }
     /* At the moment we don't want to do anything here if alt or control
        or MODX is pressed, so return now. Shift + TAB are accepted (from
@@ -1468,11 +1432,11 @@ hildon_grid_key_pressed(GtkWidget * widget,
     }
 
     child_count = g_list_length(priv->children);
-    child_rows = (child_count - 1) / priv->visible_cols + 1;
+    child_rows = (child_count - 1) / priv->num_columns + 1;
 
     if (priv->focus_index != -1) {
-        x = priv->focus_index % priv->visible_cols;
-        y = priv->focus_index / priv->visible_cols;
+        x = priv->focus_index % priv->num_columns;
+        y = priv->focus_index / priv->num_columns;
     } else {
         x = y = 0;
     }
@@ -1488,11 +1452,9 @@ hildon_grid_key_pressed(GtkWidget * widget,
             return TRUE;
         }
 
-        t = MAX(priv->first_index / priv->visible_cols
-                - priv->area_rows, 0);
+        t = MAX(priv->first_index / priv->num_columns - priv->area_rows, 0);
         adjustment = gtk_range_get_adjustment(GTK_RANGE(priv->scrollbar));
-        adjustment->value = (gdouble) (t * (priv->widget_height
-                                            + priv->widget_vspacing));
+        adjustment->value = (gdouble) (t * priv->item_height);
         gtk_range_set_adjustment(GTK_RANGE(priv->scrollbar), adjustment);
         gtk_widget_queue_draw(priv->scrollbar);
         update_contents(grid);
@@ -1506,8 +1468,8 @@ hildon_grid_key_pressed(GtkWidget * widget,
 
     case GDK_KP_Page_Down:
     case GDK_Page_Down:
-        if (priv->first_index / priv->visible_cols
-            == child_rows - priv->area_rows) {
+        if (priv->first_index / priv->num_columns ==
+            child_rows - priv->area_rows) {
             if (priv->focus_index == child_count - 1) {
                 return TRUE;
             }
@@ -1516,11 +1478,10 @@ hildon_grid_key_pressed(GtkWidget * widget,
             return TRUE;
         }
 
-        t = MIN(priv->first_index / priv->visible_cols
-                + priv->area_rows, child_rows - priv->area_rows);
+        t = MIN(priv->first_index / priv->num_columns +
+                priv->area_rows, child_rows - priv->area_rows);
         adjustment = gtk_range_get_adjustment(GTK_RANGE(priv->scrollbar));
-        adjustment->value = (gdouble) (t * (priv->widget_height
-                                            + priv->widget_vspacing));
+        adjustment->value = (gdouble) (t * priv->item_height);
         gtk_range_set_adjustment(GTK_RANGE(priv->scrollbar), adjustment);
         gtk_widget_queue_draw(priv->scrollbar);
         update_contents(grid);
@@ -1537,25 +1498,25 @@ hildon_grid_key_pressed(GtkWidget * widget,
         if (y <= 0) {
             return TRUE;
         }
-        addition = -priv->visible_cols;
+        addition = -priv->num_columns;
         max_add = y;
         y--;
         break;
 
     case GDK_KP_Down:
     case GDK_Down:
-        if (y >= (child_count - 1) / priv->visible_cols) {
+        if (y >= (child_count - 1) / priv->num_columns) {
             return TRUE;
         }
-        t = child_count % priv->visible_cols;
+        t = child_count % priv->num_columns;
         if (t == 0) {
-            t = priv->visible_cols;
+            t = priv->num_columns;
         }
-        if (y == (child_count - 1) / priv->visible_cols - 1 && x >= t) {
+        if (y == (child_count - 1) / priv->num_columns - 1 && x >= t) {
             x = t - 1;
         }
         y++;
-        addition = priv->visible_cols;
+        addition = priv->num_columns;
         max_add = child_rows - y;
         break;
 
@@ -1571,7 +1532,7 @@ hildon_grid_key_pressed(GtkWidget * widget,
 
     case GDK_KP_Right:
     case GDK_Right:
-        if (x >= priv->visible_cols - 1) {
+        if (x >= priv->num_columns - 1) {
             return TRUE;
         }
         if (y == 0 && x >= child_count - 1) {
@@ -1579,8 +1540,8 @@ hildon_grid_key_pressed(GtkWidget * widget,
         }
         x++;
         addition = 1;
-        max_add = priv->visible_cols - x;
-        if (y * priv->visible_cols + x == child_count) {
+        max_add = priv->num_columns - x;
+        if (y * priv->num_columns + x == child_count) {
             y--;
         }
         break;
@@ -1592,11 +1553,11 @@ hildon_grid_key_pressed(GtkWidget * widget,
         return TRUE;
         break;
     default:
-        return FALSE;
+        return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
         break;
     }
 
-    focus_index = y * priv->visible_cols + x;
+    focus_index = y * priv->num_columns + x;
     new_focus = get_child_by_index(priv, focus_index);
 
     while (new_focus != NULL &&
@@ -1629,26 +1590,24 @@ hildon_grid_key_pressed(GtkWidget * widget,
  */
 static gboolean
 hildon_grid_button_pressed(GtkWidget * widget,
-                           GdkEventButton * event, gpointer data)
+                           GdkEventButton * event)
 {
     HildonGrid *grid;
     HildonGridPrivate *priv;
     GtkWidget *child;
     int child_no;
 
+    grid = HILDON_GRID(widget);
+    priv = HILDON_GRID_GET_PRIVATE(grid);
+
 /* Watch out for double/triple click press events */
 
     if (event->type == GDK_2BUTTON_PRESS ||
         event->type == GDK_3BUTTON_PRESS) {
-        grid = HILDON_GRID(data);
-        priv = HILDON_GRID_GET_PRIVATE(grid);
         priv->last_button_event = event->type;
         return FALSE;
     }
 
-    grid = HILDON_GRID(data);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
     priv->last_button_event = event->type;
 
     if (event->type != GDK_BUTTON_PRESS)
@@ -1684,17 +1643,17 @@ hildon_grid_button_pressed(GtkWidget * widget,
  */
 static gboolean
 hildon_grid_button_released(GtkWidget * widget,
-                            GdkEventButton * event, gpointer data)
+                            GdkEventButton * event)
 {
     HildonGrid *grid;
     HildonGridPrivate *priv;
     GtkWidget *child;
     int child_no;
 
-    grid = HILDON_GRID(data);
+    grid = HILDON_GRID(widget);
     priv = HILDON_GRID_GET_PRIVATE(grid);
 
-/* In case of double/triple click, silently ignore the release event */
+    /* In case of double/triple click, silently ignore the release event */
 
     if (priv->last_button_event == GDK_2BUTTON_PRESS ||
         priv->last_button_event == GDK_3BUTTON_PRESS) {
@@ -1743,8 +1702,6 @@ hildon_grid_scrollbar_moved(GtkWidget * widget, gpointer data)
     updated = update_contents(grid);
 
     /* 
-     * Kludge-time!
-     *
      * If grid changes focus while dragging scrollbar and pointer leaves
      * scrollbar, focus is moved to prev_focus... This prevents that.
      */
@@ -1777,11 +1734,11 @@ static gboolean update_contents(HildonGrid * grid)
 
     priv = HILDON_GRID_GET_PRIVATE(grid);
     new_row = (int) gtk_range_get_value(GTK_RANGE(priv->scrollbar))
-        / (priv->widget_height + priv->widget_vspacing);
+        / priv->item_height;
 
     if (new_row != priv->old_sb_pos) {
         priv->old_sb_pos = new_row;
-        priv->first_index = new_row * priv->visible_cols;
+        priv->first_index = new_row * priv->num_columns;
 
         return TRUE;
     }
@@ -1811,21 +1768,29 @@ static gboolean jump_scrollbar_to_focused(HildonGrid * grid)
     g_return_val_if_fail(priv->scrollbar != NULL, FALSE);
 
     /* Make sure "first widget" is something sensible. */
-    priv->first_index = priv->first_index / priv->visible_cols
-        * priv->visible_cols;
+    priv->first_index = priv->first_index -
+        priv->first_index % priv->num_columns;
 
     child_count = g_list_length(priv->children);
-    empty_grids = priv->visible_cols * priv->area_rows - child_count
-        + priv->first_index;
+    empty_grids = priv->num_columns * priv->area_rows - child_count +
+        priv->first_index;
 
     if (priv->focus_index < priv->first_index) {
-        new_row = priv->focus_index / priv->visible_cols;
-    } else if (priv->focus_index >= priv->first_index
-               + priv->area_rows * priv->visible_cols) {
-        new_row = priv->focus_index / priv->visible_cols -
+        new_row = priv->focus_index / priv->num_columns;
+    } else if (priv->focus_index >= priv->first_index +
+               priv->area_rows * priv->num_columns) {
+        gint last_top_row;
+        new_row = priv->focus_index / priv->num_columns -
             priv->area_rows + 1;
-    } else if (empty_grids >= priv->visible_cols) {
-        new_row = ((child_count - 1) / priv->visible_cols + 1)
+        last_top_row = child_count / priv->num_columns - priv->area_rows + 1;
+        if (child_count % priv->num_columns != 0) {
+            last_top_row++;
+        }
+        if (new_row > last_top_row) {
+            new_row = last_top_row;
+       }
+    } else if (empty_grids >= priv->num_columns) {
+        new_row = ((child_count - 1) / priv->num_columns + 1)
             - priv->area_rows;
         if (new_row < 0) {
             new_row = 0;
@@ -1836,10 +1801,9 @@ static gboolean jump_scrollbar_to_focused(HildonGrid * grid)
 
     /* Move scrollbar accordingly. */
     adjustment = gtk_range_get_adjustment(GTK_RANGE(priv->scrollbar));
-    adjustment->value = (gdouble) (new_row * (priv->widget_height
-                                              + priv->widget_vspacing));
+    adjustment->value = (gdouble) (new_row * priv->item_height);
     gtk_range_set_adjustment(GTK_RANGE(priv->scrollbar), adjustment);
-    priv->first_index = new_row * priv->visible_cols;
+    priv->first_index = new_row * priv->num_columns;
     priv->old_sb_pos = new_row;
 
     gtk_widget_queue_draw(priv->scrollbar);
@@ -1878,23 +1842,21 @@ static gboolean adjust_scrollbar_height(HildonGrid * grid)
 
     /* See if we need scrollbar at all. */
     if (priv->num_columns == 0) {
-        priv->visible_cols = MAX(1,
-                                 gridalloc->width /
-                                 (priv->widget_width +
-                                  priv->widget_hspacing));
+        priv->num_columns = DEFAULT_N_COLUMNS;
     } else {
-        priv->visible_cols = MAX(1, priv->num_columns);
+        priv->num_columns = MAX(1, priv->num_columns);
     }
 
     if (g_list_length(priv->children) != 0) {
-        need_rows = (g_list_length(priv->children) - 1)
-            / priv->visible_cols + 1;
+        need_rows = (g_list_length(priv->children) - 1) /
+            priv->num_columns + 1;
     } else {
         need_rows = 0;
     }
 
     if (need_rows <= priv->area_rows) {
         updated = priv->first_index != 0;
+       priv->scrollbar_width = 0;
 
         priv->first_index = 0;
         if (GTK_WIDGET_VISIBLE(priv->scrollbar)) {
@@ -1921,48 +1883,25 @@ static gboolean adjust_scrollbar_height(HildonGrid * grid)
     }
 
 
-    /* 
-     * If we're fitting as many columns as possible, 
-     * recount number of visible
-     * columns and recalculate number of needed rows accordingly.
-     */
-    if (priv->num_columns == 0) {
-        priv->visible_cols = MAX(1,
-                                 (gridalloc->width -
-                                  priv->scrollbar_width) /
-                                 (priv->widget_width +
-                                  priv->widget_hspacing));
-        need_rows = (g_list_length(priv->children) - 1) /
-            priv->visible_cols + 1;
-    }
-
-    need_pixels =
-        need_rows * (priv->widget_height + priv->widget_vspacing);
+    need_pixels = need_rows * priv->item_height;
 
     /* Once we know how much space we need, update the scrollbar. */
     adj = gtk_range_get_adjustment(GTK_RANGE(priv->scrollbar));
     old_upper = (int) adj->upper;
     adj->lower = 0.0;
     adj->upper = (gdouble) need_pixels;
-    adj->step_increment = (gdouble) (priv->widget_height
-                                     + priv->widget_vspacing);
-    adj->page_increment =
-        (gdouble) (priv->area_rows *
-                   (priv->widget_height + priv->widget_vspacing));
+    adj->step_increment = (gdouble) priv->item_height;
+    adj->page_increment = (gdouble) (priv->area_rows * priv->item_height);
     adj->page_size =
-        (gdouble) (priv->area_height /
-                   (priv->widget_height +
-                    priv->widget_vspacing) * (priv->widget_height +
-                                              priv->widget_vspacing));
+        (gdouble) (priv->area_height - priv->area_height % priv->item_height);
 
     /* Also update position if needed to show focused item. */
 
     gtk_range_set_adjustment(GTK_RANGE(priv->scrollbar), adj);
 
     /* Then set first_index. */
-    priv->first_index = (int) adj->value / (priv->widget_height +
-                                            priv->widget_vspacing) *
-        priv->visible_cols;
+    priv->first_index = (int) adj->value / priv->item_height *
+                              priv->num_columns;
 
     /* Finally, ask Gtk to redraw the scrollbar. */
     if (old_upper != (int) adj->upper) {
@@ -1984,24 +1923,21 @@ static gboolean adjust_scrollbar_height(HildonGrid * grid)
 static gint
 get_child_index_by_coord(HildonGridPrivate * priv, gint x, gint y)
 {
+    int xgap, ygap;
     int t;
 
-    if (x >
-        priv->visible_cols * (priv->widget_width + priv->widget_hspacing)
-        || x % (priv->widget_width + priv->widget_hspacing)
-        < priv->widget_hspacing
-        || y % (priv->widget_height + priv->widget_vspacing)
-        < priv->widget_vspacing) {
+    xgap = x % priv->item_width;
+    ygap = y % priv->item_height;
+
+    if (xgap > priv->item_width - priv->h_margin) { /*FIXME*/
         return -1;
     }
 
-    t = y / (priv->widget_height + priv->widget_vspacing) *
-        priv->visible_cols
-        + x / (priv->widget_width + priv->widget_hspacing)
-        + priv->first_index;
+    t = y / priv->item_height * priv->num_columns +
+        x / priv->item_width + priv->first_index;
 
-    if (t >= priv->first_index + priv->area_rows * priv->visible_cols
-        || t >= g_list_length(priv->children) || t < 0) {
+    if (t >= priv->first_index + priv->area_rows * priv->num_columns ||
+        t >= g_list_length(priv->children) || t < 0) {
         return -1;
     }
     return t;
@@ -2129,56 +2065,6 @@ const gchar *hildon_grid_get_style(HildonGrid * grid)
 }
 
 /*
- * For registering signal handler...
- */
-static void
-marshal_BOOLEAN__INT_INT_INT(GClosure * closure,
-                             GValue * return_value,
-                             guint n_param_values,
-                             const GValue * param_values,
-                             gpointer invocation_hint,
-                             gpointer marshal_data)
-{
-    typedef gboolean(*marshal_func_BOOLEAN__INT_INT_INT)
-     (gpointer data1, gint arg_1, gint arg_2, gint arg_3, gpointer data2);
-    register marshal_func_BOOLEAN__INT_INT_INT callback;
-    register GCClosure *cc = (GCClosure *) closure;
-    register gpointer data1, data2;
-    gboolean v_return;
-
-    g_return_if_fail(return_value != NULL);
-    g_return_if_fail(n_param_values == 4);
-
-    if (G_CCLOSURE_SWAP_DATA(closure)) {
-        data1 = closure->data;
-        data2 = g_value_peek_pointer(param_values + 0);
-    } else {
-        data1 = g_value_peek_pointer(param_values + 0);
-        data2 = closure->data;
-    }
-    callback = (marshal_func_BOOLEAN__INT_INT_INT)
-        (marshal_data ? marshal_data : cc->callback);
-
-    /* Doing this is somewhat ugly but it works. */
-    v_return = callback(data1,
-                        (int) (param_values + 1)->data[0].v_pointer,
-                        (int) (param_values + 2)->data[0].v_pointer,
-                        (int) (param_values + 3)->data[0].v_pointer,
-                        data2);
-    /* 
-     * And here's the original code from gtkmarshal.c:
-     * 
-     v_return = callback (data1,
-     g_marshal_value_peek_int (param_values + 1),
-     g_marshal_value_peek_int (param_values + 2),
-     g_marshal_value_peek_int (param_values + 3),
-     data2);
-     */
-
-    g_value_set_boolean(return_value, v_return);
-}
-
-/*
  * get_style_properties:
  * @grid:   #HildonGrid
  *
@@ -2187,41 +2073,54 @@ marshal_BOOLEAN__INT_INT_INT(GClosure * closure,
  */
 static void get_style_properties(HildonGrid * grid)
 {
-    gint icon_size;
+    GList *iter;
     gint num_columns;
     HildonGridPositionType label_pos;
-    gint label_hspacing;
-    gint label_vspacing;
     gint emblem_size;
 
-    HildonGridPrivate *priv;
+    gint h_margin, v_margin;
+    gint item_height;
+    gint icon_width;
+    gint focus_margin, icon_label_margin;
+    gint label_height;
 
+    HildonGridPrivate *priv;
     g_return_if_fail(HILDON_IS_GRID(grid));
-
     priv = HILDON_GRID_GET_PRIVATE(grid);
+
     gtk_widget_style_get(GTK_WIDGET(grid),
-                         "item_width", &priv->widget_width,
-                         "item_hspacing", &priv->widget_hspacing,
-                         "item_height", &priv->widget_height,
-                         "item_vspacing", &priv->widget_vspacing,
-                         "icon_size", &icon_size,
+                         "item_hspacing", &h_margin,
+                         "item_vspacing", &v_margin,
+                         "item_height", &item_height,
+                         "icon_size", &icon_width,
                          "n_columns", &num_columns,
                          "label_pos", &label_pos,
-                         "label_hspacing", &label_hspacing,
-                         "label_vspacing", &label_vspacing,
-                         "emblem_size", &emblem_size, NULL);
-
-    priv->saved_width = priv->widget_width;
-    priv->saved_height = priv->widget_height;
-    priv->saved_hspacing = priv->widget_hspacing;
-    priv->saved_vspacing = priv->widget_vspacing;
-
-    _hildon_grid_set_icon_size(grid, icon_size);
-    _hildon_grid_set_n_columns(grid, num_columns);
-    _hildon_grid_set_label_pos(grid, label_pos);
-    _hildon_grid_set_label_hspacing(grid, label_hspacing);
-    _hildon_grid_set_label_vspacing(grid, label_vspacing);
-    _hildon_grid_set_emblem_size(grid, emblem_size);
+                         "label_hspacing", &focus_margin,
+                         "label_vspacing", &icon_label_margin,
+                         "emblem_size", &emblem_size,
+                         "label_height", &label_height,
+                         NULL);
+
+    hildon_grid_set_icon_width(grid, icon_width);
+    hildon_grid_set_num_columns(grid, num_columns);
+    hildon_grid_set_label_pos(grid, label_pos);
+    hildon_grid_set_focus_margin(grid, focus_margin);
+    hildon_grid_set_icon_label_margin(grid, icon_label_margin);
+    hildon_grid_set_emblem_size(grid, emblem_size);
+    hildon_grid_set_label_height(grid, label_height);
+
+    priv->h_margin = h_margin;
+    priv->v_margin = v_margin;
+    priv->item_height = item_height;
+
+    iter = NULL;
+    /*
+    for (iter = priv->children; iter != NULL; iter = iter->next) {
+        HildonGridItem *child;
+        child = HILDON_GRID_ITEM(((HildonGridChild *) iter->data)->widget);
+        _hildon_grid_item_done_updating_settings(child);
+    }
+    */
 }
 
 
@@ -2284,7 +2183,7 @@ hildon_grid_set_property(GObject * object,
 
     switch (prop_id) {
     case PROP_EMPTY_LABEL:
-        _hildon_grid_set_empty_label(grid, g_value_get_string(value));
+        hildon_grid_set_empty_label(grid, g_value_get_string(value));
         break;
 
     default:
@@ -2300,7 +2199,7 @@ hildon_grid_get_property(GObject * object,
     switch (prop_id) {
     case PROP_EMPTY_LABEL:
         g_value_set_string(value,
-                           _hildon_grid_get_empty_label(HILDON_GRID
+                           hildon_grid_get_empty_label(HILDON_GRID
                                                         (object)));
         break;
 
diff --git a/hildon-widgets/hildon-marshalers.c b/hildon-widgets/hildon-marshalers.c
new file mode 100644 (file)
index 0000000..5281045
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * This file is part of hildon-libs
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ * Contact: Luc Pionchon <luc.pionchon@nokia.com>
+ *
+ * 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
+ *
+ */
+
+#include "hildon-marshalers.h"
+
+#include       <glib-object.h>
+
+
+#ifdef G_ENABLE_DEBUG
+#define g_marshal_value_peek_boolean(v)  g_value_get_boolean (v)
+#define g_marshal_value_peek_char(v)     g_value_get_char (v)
+#define g_marshal_value_peek_uchar(v)    g_value_get_uchar (v)
+#define g_marshal_value_peek_int(v)      g_value_get_int (v)
+#define g_marshal_value_peek_uint(v)     g_value_get_uint (v)
+#define g_marshal_value_peek_long(v)     g_value_get_long (v)
+#define g_marshal_value_peek_ulong(v)    g_value_get_ulong (v)
+#define g_marshal_value_peek_int64(v)    g_value_get_int64 (v)
+#define g_marshal_value_peek_uint64(v)   g_value_get_uint64 (v)
+#define g_marshal_value_peek_enum(v)     g_value_get_enum (v)
+#define g_marshal_value_peek_flags(v)    g_value_get_flags (v)
+#define g_marshal_value_peek_float(v)    g_value_get_float (v)
+#define g_marshal_value_peek_double(v)   g_value_get_double (v)
+#define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
+#define g_marshal_value_peek_param(v)    g_value_get_param (v)
+#define g_marshal_value_peek_boxed(v)    g_value_get_boxed (v)
+#define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
+#define g_marshal_value_peek_object(v)   g_value_get_object (v)
+#else /* !G_ENABLE_DEBUG */
+/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
+ *          Do not access GValues directly in your code. Instead, use the
+ *          g_value_get_*() functions
+ */
+#define g_marshal_value_peek_boolean(v)  (v)->data[0].v_int
+#define g_marshal_value_peek_char(v)     (v)->data[0].v_int
+#define g_marshal_value_peek_uchar(v)    (v)->data[0].v_uint
+#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
+#define g_marshal_value_peek_uint(v)     (v)->data[0].v_uint
+#define g_marshal_value_peek_long(v)     (v)->data[0].v_long
+#define g_marshal_value_peek_ulong(v)    (v)->data[0].v_ulong
+#define g_marshal_value_peek_int64(v)    (v)->data[0].v_int64
+#define g_marshal_value_peek_uint64(v)   (v)->data[0].v_uint64
+#define g_marshal_value_peek_enum(v)     (v)->data[0].v_long
+#define g_marshal_value_peek_flags(v)    (v)->data[0].v_ulong
+#define g_marshal_value_peek_float(v)    (v)->data[0].v_float
+#define g_marshal_value_peek_double(v)   (v)->data[0].v_double
+#define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
+#define g_marshal_value_peek_param(v)    (v)->data[0].v_pointer
+#define g_marshal_value_peek_boxed(v)    (v)->data[0].v_pointer
+#define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
+#define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
+#endif /* !G_ENABLE_DEBUG */
+
+
+/* BOOLEAN:INT (hildon-marshalers.list:26) */
+void
+_hildon_marshal_BOOLEAN__INT (GClosure     *closure,
+                              GValue       *return_value,
+                              guint         n_param_values,
+                              const GValue *param_values,
+                              gpointer      invocation_hint,
+                              gpointer      marshal_data)
+{
+  typedef gboolean (*GMarshalFunc_BOOLEAN__INT) (gpointer     data1,
+                                                 gint         arg_1,
+                                                 gpointer     data2);
+  register GMarshalFunc_BOOLEAN__INT callback;
+  register GCClosure *cc = (GCClosure*) closure;
+  register gpointer data1, data2;
+  gboolean v_return;
+
+  g_return_if_fail (return_value != NULL);
+  g_return_if_fail (n_param_values == 2);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_BOOLEAN__INT) (marshal_data ? marshal_data : cc->callback);
+
+  v_return = callback (data1,
+                       g_marshal_value_peek_int (param_values + 1),
+                       data2);
+
+  g_value_set_boolean (return_value, v_return);
+}
+
+/* BOOLEAN:INT,INT,INT (hildon-marshalers.list:27) */
+void
+_hildon_marshal_BOOLEAN__INT_INT_INT (GClosure     *closure,
+                                      GValue       *return_value,
+                                      guint         n_param_values,
+                                      const GValue *param_values,
+                                      gpointer      invocation_hint,
+                                      gpointer      marshal_data)
+{
+  typedef gboolean (*GMarshalFunc_BOOLEAN__INT_INT_INT) (gpointer     data1,
+                                                         gint         arg_1,
+                                                         gint         arg_2,
+                                                         gint         arg_3,
+                                                         gpointer     data2);
+  register GMarshalFunc_BOOLEAN__INT_INT_INT callback;
+  register GCClosure *cc = (GCClosure*) closure;
+  register gpointer data1, data2;
+  gboolean v_return;
+
+  g_return_if_fail (return_value != NULL);
+  g_return_if_fail (n_param_values == 4);
+
+  if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+      data1 = closure->data;
+      data2 = g_value_peek_pointer (param_values + 0);
+    }
+  else
+    {
+      data1 = g_value_peek_pointer (param_values + 0);
+      data2 = closure->data;
+    }
+  callback = (GMarshalFunc_BOOLEAN__INT_INT_INT) (marshal_data ? marshal_data : cc->callback);
+
+  v_return = callback (data1,
+                       g_marshal_value_peek_int (param_values + 1),
+                       g_marshal_value_peek_int (param_values + 2),
+                       g_marshal_value_peek_int (param_values + 3),
+                       data2);
+
+  g_value_set_boolean (return_value, v_return);
+}
+
diff --git a/hildon-widgets/hildon-marshalers.h b/hildon-widgets/hildon-marshalers.h
new file mode 100644 (file)
index 0000000..111bc2b
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * This file is part of hildon-libs
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ * Contact: Luc Pionchon <luc.pionchon@nokia.com>
+ *
+ * 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
+ *
+ */
+
+#ifndef ___hildon_marshal_MARSHAL_H__
+#define ___hildon_marshal_MARSHAL_H__
+
+#include       <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* BOOLEAN:INT (hildon-marshalers.list:26) */
+extern void _hildon_marshal_BOOLEAN__INT (GClosure     *closure,
+                                          GValue       *return_value,
+                                          guint         n_param_values,
+                                          const GValue *param_values,
+                                          gpointer      invocation_hint,
+                                          gpointer      marshal_data);
+
+/* BOOLEAN:INT,INT,INT (hildon-marshalers.list:27) */
+extern void _hildon_marshal_BOOLEAN__INT_INT_INT (GClosure     *closure,
+                                                  GValue       *return_value,
+                                                  guint         n_param_values,
+                                                  const GValue *param_values,
+                                                  gpointer      invocation_hint,
+                                                  gpointer      marshal_data);
+
+G_END_DECLS
+
+#endif /* ___hildon_marshal_MARSHAL_H__ */
+
diff --git a/hildon-widgets/hildon-marshalers.list b/hildon-widgets/hildon-marshalers.list
new file mode 100644 (file)
index 0000000..94cef5f
--- /dev/null
@@ -0,0 +1,27 @@
+# A copy of gtkmarshalers.list header for convenience
+# 
+# see glib-genmarshal(1) for a detailed description of the file format,
+# possible parameter types are:
+#   VOID        indicates   no   return   type,  or  no  extra
+#               parameters. if VOID is used as  the  parameter
+#               list, no additional parameters may be present.
+#   BOOLEAN     for boolean types (gboolean)
+#   CHAR        for signed char types (gchar)
+#   UCHAR       for unsigned char types (guchar)
+#   INT         for signed integer types (gint)
+#   UINT        for unsigned integer types (guint)
+#   LONG        for signed long integer types (glong)
+#   ULONG       for unsigned long integer types (gulong)
+#   ENUM        for enumeration types (gint)
+#   FLAGS       for flag enumeration types (guint)
+#   FLOAT       for single-precision float types (gfloat)
+#   DOUBLE      for double-precision float types (gdouble)
+#   STRING      for string types (gchar*)
+#   BOXED       for boxed (anonymous but reference counted) types (GBoxed*)
+#   POINTER     for anonymous pointer types (gpointer)
+#   OBJECT      for GObject or derived types (GObject*)
+#   NONE        deprecated alias for VOID
+#   BOOL        deprecated alias for BOOLEAN
+
+BOOLEAN:INT
+BOOLEAN:INT,INT,INT
index 39b4bbb..b1b05a2 100644 (file)
 
 static GtkDialogClass *parent_class;
 
-typedef struct _HildonNamePasswordDialogPrivate
-    HildonNamePasswordDialogPrivate;
+typedef struct _HildonNamePasswordDialogPrivate 
+  HildonNamePasswordDialogPrivate;
 
 struct _HildonNamePasswordDialogPrivate {
-    GtkButton *okButton;
-    GtkButton *closeButton;
-
-    HildonCaption *nameEntry;
-    HildonCaption *passwordEntry;
+  GtkButton *okButton;
+  GtkButton *closeButton;
+  
+  GtkLabel *domainLabel;
+  HildonCaption *nameEntry;
+  HildonCaption *passwordEntry;
 };
 
 #define HILDON_NAME_PASSWORD_DIALOG_GET_PRIVATE(o)  \
@@ -66,6 +67,7 @@ struct _HildonNamePasswordDialogPrivate {
 
 enum{
     PROP_NONE = 0,
+    PROP_CONTENT,
     PROP_NAME,
     PROP_PASSWORD
 };
@@ -92,15 +94,20 @@ hildon_name_password_dialog_set_property(GObject * object,
     priv = HILDON_NAME_PASSWORD_DIALOG_GET_PRIVATE(dialog);
     
     switch (prop_id) {
-    case PROP_NAME:
-        gtk_entry_set_text(GTK_ENTRY(
-                          hildon_caption_get_control(priv->nameEntry)), 
-                          g_value_get_string(value));
+    case PROP_CONTENT:
+       gtk_label_set_text(priv->domainLabel, g_value_get_string(value));
        break;
+    case PROP_NAME:
+      gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child
+                                  (GTK_BIN(
+                                           priv->nameEntry))), 
+                        g_value_get_string(value));
+      break;
     case PROP_PASSWORD:
-        gtk_entry_set_text(GTK_ENTRY(
-                      hildon_caption_get_control(priv->passwordEntry)),
-                          g_value_get_string(value));
+      gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child
+                                  (GTK_BIN(
+                                           priv->passwordEntry))), 
+                        g_value_get_string(value));
         break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
@@ -120,14 +127,21 @@ hildon_name_password_dialog_get_property(GObject * object,
     priv = HILDON_NAME_PASSWORD_DIALOG_GET_PRIVATE(dialog);
     
     switch (prop_id) {
+    case PROP_CONTENT:
+      string = gtk_label_get_text(priv->domainLabel);
+      g_value_set_string(value, string);
+      break;
     case PROP_NAME:
-        string = gtk_entry_get_text(GTK_ENTRY(
-               hildon_caption_get_control(priv->nameEntry)));
-       g_value_set_string(value, string);
-       break;
+      string = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child
+                                           (GTK_BIN(
+                                                    priv->nameEntry))));
+
+      g_value_set_string(value, string);
+      break;
     case PROP_PASSWORD:
-        string = gtk_entry_get_text(GTK_ENTRY(
-               hildon_caption_get_control(priv->passwordEntry)));
+     string = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child
+                                           (GTK_BIN(
+                                                    priv->passwordEntry))));
         g_value_set_string(value, string);
         break;
     default:
@@ -138,8 +152,6 @@ hildon_name_password_dialog_get_property(GObject * object,
 static void
 hildon_name_password_dialog_class_init(HildonNamePasswordDialogClass *class)
 {
-    GParamSpec *pspec1, *pspec2;
-  
     GObjectClass *object_class = G_OBJECT_CLASS(class);
     
     parent_class = g_type_class_peek_parent(class);
@@ -147,23 +159,31 @@ hildon_name_password_dialog_class_init(HildonNamePasswordDialogClass *class)
     object_class->set_property = hildon_name_password_dialog_set_property;
     object_class->get_property = hildon_name_password_dialog_get_property;
     
-    pspec1 = g_param_spec_string("name",
-                               "Name content",
-                               "Set content to dialog",
-                               "DEFAULT",
-                               G_PARAM_READWRITE);
-    
+    /* properties */
+    g_object_class_install_property(object_class, 
+                   PROP_CONTENT, 
+                   g_param_spec_string ("content",
+                           "Content",
+                           "Set content for content label.",
+                           NULL,
+                           G_PARAM_READWRITE));
+
     g_object_class_install_property(object_class,
-                                    PROP_NAME, pspec1);
-    
-    pspec2 = g_param_spec_string("password",
-                               "Pasword content",
-                               "Set content to dialog",
-                               "DEFAULT",
-                               G_PARAM_READWRITE);
+                    PROP_NAME, 
+                    g_param_spec_string ("name",
+                            "Name",
+                            "Set content for name entry.",
+                            "DEFAULT",
+                            G_PARAM_READWRITE));
     
-    g_object_class_install_property(object_class,
-                                    PROP_PASSWORD, pspec2);
+    g_object_class_install_property(object_class, 
+                    PROP_PASSWORD,
+                    g_param_spec_string ("password",
+                            "Password",
+                            "Set content for password entry",
+                            "DEFAULT",
+                            G_PARAM_READWRITE));
+
     g_type_class_add_private(class,
                              sizeof(HildonNamePasswordDialogPrivate));
 }
@@ -176,47 +196,51 @@ hildon_name_password_dialog_init(HildonNamePasswordDialog * dialog)
     GtkSizeGroup *group =
         GTK_SIZE_GROUP(gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL));
     GtkWidget *control;
-
+    
     gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
-    gtk_window_set_title(GTK_WINDOW(dialog), _("frw_ti_get_user_name_and_pwd"));
-
+    gtk_window_set_title(GTK_WINDOW(dialog), _(HILDON_NAME_PASSWORD_DIALOG_TITLE));
+    
+    priv->domainLabel = GTK_LABEL(gtk_label_new(NULL));
+    
     priv->okButton =
       GTK_BUTTON(gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                       _("frw_bd_get_user_name_and_pwd_ok"),
+                                       _(HILDON_NAME_PASSWORD_DIALOG_OK),
                                        GTK_RESPONSE_OK));
     priv->closeButton =
       GTK_BUTTON(gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                       _("frw_bd_get_user_name_and_pwd_cancel"),
+                                       _(HILDON_NAME_PASSWORD_DIALOG_CANCEL),
                                        GTK_RESPONSE_CANCEL));
 
     control = gtk_entry_new();
-    gtk_widget_show_all(control);
-    priv->nameEntry = HILDON_CAPTION(hildon_caption_new(group,
-                       _("frw_ti_get_user_name_and_pwd_enter_user_name"),
-                                                        control, NULL,
-                       HILDON_CAPTION_OPTIONAL));
+    priv->nameEntry = HILDON_CAPTION(hildon_caption_new
+                                    (group,
+                                     _(HILDON_NAME_PASSWORD_DIALOG_NAME ),
+                                     control, NULL,
+                                     HILDON_CAPTION_OPTIONAL));
+    hildon_caption_set_separator(priv->nameEntry, "");
 
     control = gtk_entry_new();
-    gtk_widget_show_all(control);
     gtk_entry_set_visibility(GTK_ENTRY(control), FALSE);
     priv->passwordEntry =
       HILDON_CAPTION(hildon_caption_new(group,
-                                        _("frw_ti_get_user_name_and_pwd_enter_pwd"),
+                                        _(HILDON_NAME_PASSWORD_DIALOG_PASSWORD),
                                         control,
                                         NULL,
                                         HILDON_CAPTION_OPTIONAL));
+    hildon_caption_set_separator(priv->passwordEntry, "");
 
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), 
+         GTK_WIDGET(priv->domainLabel), FALSE, FALSE, 0);
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), 
                        GTK_WIDGET(priv->nameEntry), FALSE, FALSE, 0);
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
                        GTK_WIDGET(priv->passwordEntry), FALSE, FALSE, 0);
 
-    gtk_widget_grab_focus(GTK_WIDGET(priv->nameEntry));
     gtk_widget_show_all(GTK_DIALOG(dialog)->vbox);
     gtk_widget_show_all(GTK_DIALOG(dialog)->action_area);
     gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+    
 }
-
 GType hildon_name_password_dialog_get_type(void)
 {
     static GType dialog_type = 0;
@@ -256,6 +280,7 @@ GtkWidget *hildon_name_password_dialog_new(GtkWindow * parent)
 
     if (parent)
         gtk_window_set_transient_for(GTK_WINDOW(self), parent);
+
     return self;
 }
 
@@ -283,7 +308,7 @@ GtkWidget *hildon_name_password_dialog_new_with_default
       g_object_set(G_OBJECT(self), "name", name, NULL);
     if(password != NULL)
       g_object_set(G_OBJECT(self), "password", password, NULL);
-    
+
     return self;
 }
 
@@ -301,7 +326,9 @@ const gchar *hildon_name_password_dialog_get_name(HildonNamePasswordDialog
     HildonNamePasswordDialogPrivate *priv =
         HILDON_NAME_PASSWORD_DIALOG_GET_PRIVATE(dialog);
     return gtk_entry_get_text(GTK_ENTRY(
-                              hildon_caption_get_control(priv->nameEntry)));
+                             (gtk_bin_get_child
+                              (GTK_BIN(
+                               priv->nameEntry)))));
 }
 
 /**
@@ -317,6 +344,25 @@ const gchar *hildon_name_password_dialog_get_password(HildonNamePasswordDialog
 {
     HildonNamePasswordDialogPrivate *priv =
         HILDON_NAME_PASSWORD_DIALOG_GET_PRIVATE(dialog);
-    return gtk_entry_get_text(GTK_ENTRY(hildon_caption_get_control(
-                              priv->passwordEntry)));
+    return gtk_entry_get_text(GTK_ENTRY
+                             (gtk_bin_get_child
+                              (GTK_BIN(
+                               (priv->passwordEntry)))));
+}
+
+/**
+ * hildon_name_password_dialog_set_domain(GtkWidget *dialog, 
+ * @dialog: the dialog
+ * @domain: the domain or some other descriptive text to be set.
+ * 
+ * sets the optional descriptive text
+ */
+
+void hildon_name_password_dialog_set_domain(HildonNamePasswordDialog *dialog, 
+                                                gchar *domain)
+{
+  HildonNamePasswordDialogPrivate *priv =
+    HILDON_NAME_PASSWORD_DIALOG_GET_PRIVATE(dialog);
+  gtk_label_set_text(priv->domainLabel, domain);
+  
 }
index 3fd8342..3ecdfec 100644 (file)
@@ -40,6 +40,16 @@ G_BEGIN_DECLS
   (GTK_CHECK_TYPE (obj, HILDON_TYPE_NAME_PASSWORD_DIALOG))
 #define HILDON_IS_NAME_PASSWORD_DIALOG_CLASS(klass) \
   (GTK_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_NAME_PASSWORD_DIALOG))
+
+#define HILDON_NAME_PASSWORD_DIALOG_TITLE "frw_ti_get_user_name_and_pwd"
+#define HILDON_NAME_PASSWORD_DIALOG_NAME \
+         "frw_ti_get_user_name_and_pwd_enter_user_name"
+#define HILDON_NAME_PASSWORD_DIALOG_PASSWORD \
+         "frw_ti_get_user_name_and_pwd_enter_pwd"
+#define HILDON_NAME_PASSWORD_DIALOG_OK "frw_bd_get_user_name_and_pwd_ok"
+#define HILDON_NAME_PASSWORD_DIALOG_CANCEL \
+         "frw_bd_get_user_name_and_pwd_cancel"
+
   
 typedef struct _HildonNamePasswordDialog HildonNamePasswordDialog;
 typedef struct _HildonNamePasswordDialogClass
@@ -61,11 +71,15 @@ GtkWidget *hildon_name_password_dialog_new_with_default(GtkWindow *parent,
                                                        gchar *name,
                                                        gchar *pass);
 
+
 const gchar *hildon_name_password_dialog_get_name(HildonNamePasswordDialog 
                                                   * dialog);
                                                   
 const gchar *hildon_name_password_dialog_get_password(HildonNamePasswordDialog
                                                       * dialog);
 
+void hildon_name_password_dialog_set_domain(HildonNamePasswordDialog *dialog, 
+                                                gchar *domain);
+
 G_END_DECLS
 #endif
index 2fcbece..7b3e4e7 100644 (file)
@@ -27,7 +27,7 @@
  *
  * This file contains API for conformation, information
  * and cancel notes. 
- *
+ * 
  * 9/2004 Removed animation type of cancel note as separate task.
  */
 
 #include <libintl.h>
 #include <hildon-widgets/hildon-defines.h>
 
-/* For now, we use D-BUS directly to request sound playback. This
-   should later be replaced with calls to a wrapper API. */
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <signal.h>
 
-#define DBUS_API_SUBJECT_TO_CHANGE
-#include <dbus/dbus.h>
+#include <esd.h>
 
 /* Can these be included from somewhere? */
 
 #define OSSO_MEDIA_INTERFACE "com.nokia.osso_media_server.sound"
 #define OSSO_MEDIA_PLAY_METHOD "play_sound"
 
-#define CONFIRMATION_SOUND_PATH "file:///usr/share/sounds/"\
+#define CONFIRMATION_SOUND_URI "file:///usr/share/sounds/"\
                                 "ui-confirmation_note.wav"
-#define INFORMATION_SOUND_PATH "file:///usr/share/sounds/"\
+#define CONFIRMATION_SOUND_PATH "/usr/share/sounds/ui-confirmation_note.wav"
+
+#define INFORMATION_SOUND_URI "file:///usr/share/sounds/"\
                                "ui-information_note.wav"
+#define INFORMATION_SOUND_PATH "/usr/share/sounds/ui-information_note.wav"
+
+#define HILDON_NOTE_CONFIRMATION_ICON        "qgn_note_confirm"
+#define HILDON_NOTE_INFORMATION_ICON         "qgn_note_info"
 
-#define HILDON_NOTE_CONFIRMATION_STOCK        "hildon-note-confirmation"
-#define HILDON_NOTE_INFORMATION_STOCK         "hildon-note-info"
-#define HILDON_NOTE_DELETE_CONFIRMATION_STOCK \
-        "hildon-note-delete-confirmation"
+/* Not exactly sure what this actually _should_ be, because there is
+   practically no documentation for the ESD... */
+
+#define ESD_NAME "hildon-note-instance"
 
 #define _(String) dgettext(PACKAGE, String)
 
 static GtkDialogClass *parent_class;
 
-#define HILDON_NOTE_TITLE  _("note")
-
 #define HILDON_NOTE_GET_PRIVATE(obj)\
  (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
   HILDON_TYPE_NOTE, HildonNotePrivate));
@@ -83,10 +88,12 @@ typedef struct _HildonNotePrivate HildonNotePrivate;
 static void hildon_note_class_init(HildonNoteClass * class);
 static void hildon_note_init(HildonNote * dialog);
 
+static void hildon_note_create (HildonNote *note);
 static void hildon_note_create_form(GtkDialog * dialog, GtkWidget * item,
                                     gboolean IsHorizontal);
 static void hildon_note_finalize(GObject * obj_self);
-static void hildon_note_map_event(GtkWidget * widget);
+static void hildon_note_realize (GtkWidget *widget);
+
 static GObject *hildon_note_constructor(GType type,
                                         guint n_construct_properties,
                                         GObjectConstructParam
@@ -99,46 +106,25 @@ static void hildon_note_get_property(GObject * object,
                                      guint prop_id,
                                      GValue * value, GParamSpec * pspec);
 
-/* common measurement */
-const int _HILDON_NOTE_BORDER_WIDTH = 20;       /* for top and bottom
-                                                   border is height, for
-                                                   left and right is
-                                                   width */
-const int _HILDON_NOTE_TEXT_HEIGHT = 26;
-
-/* height, width for confirmation notes and information notes
-   button height 47, text height =24?
-*/
-const int _HILDON_NOTE_CONFIRMATION_TEXT_MIN_WIDTH = 180; /*270-20-20-50*/
-const int _HILDON_NOTE_CONFIRMATION_TEXT_MAX_WIDTH = 370; /*460-20-20-50*/
-const int _HILDON_NOTE_CONFIRMATION_NOTATION_SIDE = 50;
-
-/* height, width for cancel notes with progress bar
- */
-const int _HILDON_NOTE_CANCEL_PROGRESS_HEIGHT = 153; /* 6+24+26+30+20+47 */
-const int _HILDON_NOTE_CANCEL_PROGRESS_WIDTH = 215;
-const int _HILDON_NOTE_PROGRESS_HEIGHT = 30;
-const int _HILDON_NOTE_PROGRESS_WIDTH = 215;
+static gboolean
+sound_handling(GtkWidget * widget, gpointer data);
 
-/* height, width for cancel notes with animation
- */
-const int _HILDON_NOTE_CANCEL_ANIME_HEIGHT = 177; /* 6+24+26+54+20+47 */
- /* This is more than in the specifications -> the specification width is 
-    not enough for the button.. (nor the text) */
-const int _HILDON_NOTE_CANCEL_ANIME_WIDTH = 181;
-const int _HILDON_NOTE_ANIME_HEIGHT = 54;
-const int _HILDON_NOTE_ANIME_WIDTH = 26;
+/* common measurement */
+const int _HILDON_NOTE_CONFIRMATION_TEXT_MAX_WIDTH = 319; 
 
 struct _HildonNotePrivate {
     GtkWidget *okButton;
     GtkWidget *cancelButton;
     GtkWidget *label;
+    GtkWidget *box;
 
-    gint note_n;
+    HildonNoteType note_n;
     GtkWidget *progressbar;
     gchar *icon;
 
     gchar *original_description;
+
+    gboolean constructed;
 };
 
 enum {
@@ -149,6 +135,8 @@ enum {
     PROP_HILDON_NOTE_PROGRESSBAR
 };
 
+gulong sound_signal_handler = 0;
+
 /* This function is just a modified version of two_lines_truncate
  * in gtk-infoprint.c */
 static void
@@ -212,7 +200,8 @@ hildon_note_five_line_truncate(const HildonNote * note, const gchar * text)
             PangoLayoutLine *line;
             gint index = 0;
 
-            if (pango_layout_get_line_count(layout) > 5) {
+            /* Here we ellipsize the last line... */
+            if (pango_layout_get_line_count(layout) > 1) {
                 gchar *templine = NULL;
 
                 line = pango_layout_get_line(layout, 0);
@@ -344,22 +333,35 @@ hildon_note_set_property(GObject * object,
 
     switch (prop_id) {
     case PROP_HILDON_NOTE_TYPE:
-        priv->note_n = g_value_get_int(value);
+        priv->note_n = g_value_get_enum(value);
+        if (priv->constructed) {
+            hildon_note_create (note);
+        }
         break;
+
     case PROP_HILDON_NOTE_DESCRIPTION:
         if (priv->note_n == HILDON_NOTE_PROGRESSBAR_TYPE)
             hildon_note_one_line_truncate(note, g_value_get_string(value));
         else
             hildon_note_five_line_truncate(note, g_value_get_string(value));
         break;
+
     case PROP_HILDON_NOTE_ICON:
-       if( priv->icon )
-           g_free(priv->icon);
+       if( priv->icon )
+               g_free(priv->icon);
         priv->icon = g_value_dup_string(value);
+        if (priv->constructed) {
+            hildon_note_create (note);
+        }
         break;
+
     case PROP_HILDON_NOTE_PROGRESSBAR:
         priv->progressbar = g_value_get_object(value);
+        if (priv->constructed) {
+            hildon_note_create (note);
+        }
         break;
+
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
@@ -377,8 +379,9 @@ hildon_note_get_property(GObject * object,
 
     switch (prop_id) {
     case PROP_HILDON_NOTE_TYPE:
-        g_value_set_int(value, g_value_get_int(value));
+        g_value_set_enum(value, priv->note_n);
         break;
+
     case PROP_HILDON_NOTE_DESCRIPTION:
         if (priv->original_description != NULL) {
             g_value_set_string(value, priv->original_description);
@@ -386,18 +389,49 @@ hildon_note_get_property(GObject * object,
             g_value_set_string(value, "");
         }
         break;
+
     case PROP_HILDON_NOTE_ICON:
         g_value_set_string(value, priv->icon);
         break;
+
     case PROP_HILDON_NOTE_PROGRESSBAR:
         g_value_set_object(value, priv->progressbar);
         break;
+
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
     }
 }
 
+GType hildon_note_type_get_type (void)
+{
+  static GType notetype = 0;
+  if (notetype == 0) {
+    static const GEnumValue values[] = {
+      { HILDON_NOTE_CONFIRMATION_TYPE,
+        "HILDON_NOTE_CONFIRMATION_TYPE", 
+        "confirmation" },
+      { HILDON_NOTE_CONFIRMATION_BUTTON_TYPE,
+        "HILDON_NOTE_CONFIRMATION_BUTTON_TYPE",
+        "confirmation-button" },
+      { HILDON_NOTE_INFORMATION_TYPE,
+        "HILDON_NOTE_INFORMATION_TYPE",
+        "note-information" },
+      { HILDON_NOTE_INFORMATION_THEME_TYPE,
+        "HILDON_NOTE_INFORMATION_THEME_TYPE",
+        "note-information-theme" },
+      { HILDON_NOTE_PROGRESSBAR_TYPE,
+        "HILDON_NOTE_PROGRESSBAR_TYPE",
+        "note-progressbar" },
+      { 0, NULL, NULL }
+    };
+    notetype = g_enum_register_static ("HildonNoteType", values);
+  }
+  return notetype;
+}
+
+
 GType hildon_note_get_type()
 {
     static GType dialog_type = 0;
@@ -414,7 +448,6 @@ GType hildon_note_get_type()
             0,  /* n_preallocs */
             (GInstanceInitFunc) hildon_note_init
         };
-
         dialog_type = g_type_register_static(GTK_TYPE_DIALOG,
                                              "HildonNote",
                                              &dialog_info, 0);
@@ -429,79 +462,14 @@ static GObject *hildon_note_constructor(GType type,
 {
     GObject *dialog;
     HildonNotePrivate *priv;
-    GtkWidget *item = NULL;
-    gboolean IsHorizontal = TRUE;
-
 
     dialog = G_OBJECT_CLASS(parent_class)->constructor
              (type, n_construct_properties, construct_properties);
     priv = HILDON_NOTE_GET_PRIVATE(dialog);
 
-    if (priv->note_n == HILDON_NOTE_CONFIRMATION_TYPE ||
-        priv->note_n == HILDON_NOTE_CONFIRMATION_BUTTON_TYPE ||
-        priv->note_n == HILDON_NOTE_INFORMATION_THEME_TYPE ||
-        priv->note_n == HILDON_NOTE_INFORMATION_TYPE) {
-        if (priv->note_n == HILDON_NOTE_CONFIRMATION_TYPE) {
-            /* ok button clickable with mouse or whatever */
-            priv->okButton = 
-                gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                      _("Ecdg_bd_confirmation_note_ok"),
-                                      GTK_RESPONSE_OK);
-            /* cancel button clickable with mouse or whatever */
-            priv->cancelButton =
-                gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                      _("Ecdg_bd_confirmation_note_cancel"),
-                                      GTK_RESPONSE_CANCEL);
+    hildon_note_create (HILDON_NOTE (dialog));
 
-        } else if (priv->note_n == HILDON_NOTE_INFORMATION_TYPE || 
-                  priv->note_n == HILDON_NOTE_INFORMATION_THEME_TYPE ) {
-            priv->okButton = NULL;
-            /* cancel button clickable with mouse or whatever */
-            priv->cancelButton =
-                gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                      _("Ecdg_bd_information_note_ok"),
-                                      GTK_RESPONSE_CANCEL);
-        }
-
-        gtk_widget_realize(GTK_WIDGET(dialog));
-        gdk_window_set_decorations(GTK_WIDGET(dialog)->window,
-                                   GDK_DECOR_BORDER);
-
-        if ((priv->note_n == HILDON_NOTE_INFORMATION_TYPE || priv->note_n == HILDON_NOTE_INFORMATION_THEME_TYPE) && 
-           priv->icon) {
-            item = gtk_image_new_from_icon_name(priv->icon,
-                                            HILDON_ICON_SIZE_BIG_NOTE);
-       }
-       else {
-            if (priv->note_n == HILDON_NOTE_CONFIRMATION_TYPE ||
-                priv->note_n == HILDON_NOTE_CONFIRMATION_BUTTON_TYPE) {
-                    item = gtk_image_new_from_icon_name
-                        ("qgn_note_confirm", 
-                         HILDON_ICON_SIZE_50); 
-            } else {
-                    item =
-                        gtk_image_new_from_icon_name
-                        ("qgn_note_info", 
-                         HILDON_ICON_SIZE_50);
-            }
-        }
-
-    } else {
-        priv->cancelButton = 
-            gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                  _("Ecdg_bd_cancel_note_cancel"),
-                                  GTK_RESPONSE_CANCEL);
-        IsHorizontal = FALSE;
-        priv->okButton = NULL;
-
-        item = priv->progressbar;
-
-        gtk_widget_realize(GTK_WIDGET(dialog));
-        gdk_window_set_decorations(GTK_WIDGET(dialog)->window,
-                                   GDK_DECOR_BORDER);
-    }
-
-    hildon_note_create_form(GTK_DIALOG(dialog), item, IsHorizontal);
+    priv->constructed = TRUE;
 
     return dialog;
 }
@@ -518,43 +486,59 @@ static void hildon_note_class_init(HildonNoteClass * class)
 
     object_class->finalize = hildon_note_finalize;
 
-    widget_class->map = hildon_note_map_event;
     object_class->set_property = hildon_note_set_property;
     object_class->get_property = hildon_note_get_property;
     object_class->constructor = hildon_note_constructor;
 
+    widget_class->realize = hildon_note_realize;
+
     g_object_class_install_property(object_class,
         PROP_HILDON_NOTE_TYPE,
-        g_param_spec_int("note_type",
-                         "note type",
-                         "Set type to dialog",
-                         0, 5, 5,
-                         G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
-
+        g_param_spec_enum("note_type",
+                          "note type",
+                          "The type of the note dialog",
+                          hildon_note_type_get_type(),
+                          HILDON_NOTE_CONFIRMATION_TYPE,
+                          G_PARAM_READWRITE));
+
+  /**
+   * HildonNote:description:
+   *
+   * Description for note.
+   */
     g_object_class_install_property(object_class,
         PROP_HILDON_NOTE_DESCRIPTION,
         g_param_spec_string("description",
                             "note description",
-                            "Description for note",
+                            "The text that appears in the note dialog",
                             "",
-                            G_PARAM_READABLE | G_PARAM_WRITABLE));
+                            G_PARAM_READWRITE));
 
+  /**
+   * HildonNote:icon:
+   *
+   * Icon for note.
+   */
     g_object_class_install_property(object_class,
         PROP_HILDON_NOTE_ICON,
         g_param_spec_string("icon",
                             "note icon",
-                            "Icon for note",
+                            "The name of the icon that appears in the note dialog",
                             "",
-                            G_PARAM_CONSTRUCT_ONLY
-                            | G_PARAM_READABLE
-                            | G_PARAM_WRITABLE));
+                            G_PARAM_READWRITE));
+
+  /**
+   * HildonNote:progressbar:
+   *
+   * Progresbar for note.
+   */
     g_object_class_install_property(object_class,
         PROP_HILDON_NOTE_PROGRESSBAR,
         g_param_spec_object("progressbar",
                             "Progressbar widget",
-                            "The progressbar for note",
+                            "The progressbar that appear in the note dialog",
                             GTK_TYPE_PROGRESS_BAR,
-                            G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+                            G_PARAM_READWRITE));
 }
 
 static void hildon_note_init(HildonNote * dialog)
@@ -564,124 +548,167 @@ static void hildon_note_init(HildonNote * dialog)
     priv->label = gtk_label_new(NULL);
     priv->original_description = NULL;
     priv->icon = NULL;
-
+    
     gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
     gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
-    gtk_window_set_title(GTK_WINDOW(dialog), HILDON_NOTE_TITLE);
+
+    /* Because ESD is synchronous, we wish to play sound after the
+       note is already on screen to avoid blocking its appearance */
+    sound_signal_handler = 
+      g_signal_connect_after(G_OBJECT(dialog), "expose-event",
+                            G_CALLBACK(sound_handling), dialog);
 }
 
-static void hildon_note_map_event(GtkWidget * widget)
+
+static void hildon_note_finalize(GObject * obj_self)
 {
-  DBusConnection *conn = NULL;
-  DBusMessage *msg = NULL;
-  DBusError err;
-  dbus_bool_t b;
-  HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE(widget);
+    HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE(obj_self);
 
-  GTK_WIDGET_CLASS (parent_class)->map(widget);
+    if(priv->icon)
+       g_free(priv->icon);
 
-  /* Is the type of the note such that we will have to play a sound? */
+    if (priv->original_description != NULL)
+        g_free(priv->original_description);
 
-  if (priv->note_n != HILDON_NOTE_INFORMATION_TYPE &&
-      priv->note_n != HILDON_NOTE_INFORMATION_THEME_TYPE &&
-      priv->note_n != HILDON_NOTE_CONFIRMATION_TYPE &&
-      priv->note_n != HILDON_NOTE_CONFIRMATION_BUTTON_TYPE)
-    {
-      return;
-    }
+    G_OBJECT_CLASS(parent_class)->finalize(obj_self);
+}
 
-  dbus_error_init(&err);
-  conn = dbus_bus_get(DBUS_BUS_SESSION, &err);
+static void
+hildon_note_realize (GtkWidget *widget)
+{
+    GTK_WIDGET_CLASS (parent_class)->realize (widget);
 
-  if (conn == NULL)
-    {
-      dbus_error_free(&err);
-      return;
-    }
+    gdk_window_set_decorations (widget->window, GDK_DECOR_BORDER);
+}
 
-  msg = dbus_message_new_method_call(OSSO_MEDIA_SERVICE, 
-                                    OSSO_MEDIA_PATH,
-                                    OSSO_MEDIA_INTERFACE, 
-                                    OSSO_MEDIA_PLAY_METHOD);
-  if (msg == NULL)
-    {
-      dbus_connection_unref(conn);
-      return;
-    }
+static void
+hildon_note_create (HildonNote *note)
+{
+    HildonNotePrivate *priv;
+    GtkWidget *item = NULL;
+    gboolean IsHorizontal = TRUE;
 
-  dbus_message_set_auto_activation(msg, FALSE);
-  dbus_message_set_no_reply(msg, TRUE);
+    priv = HILDON_NOTE_GET_PRIVATE (note);
 
-  if (priv->note_n == HILDON_NOTE_INFORMATION_TYPE ||
-      priv->note_n == HILDON_NOTE_INFORMATION_THEME_TYPE)
-    {
-      dbus_message_append_args(msg, DBUS_TYPE_STRING, INFORMATION_SOUND_PATH,
-                              DBUS_TYPE_INT32, 1, DBUS_TYPE_INVALID);
-    }
-  else if (priv->note_n == HILDON_NOTE_CONFIRMATION_TYPE ||
-          priv->note_n ==  HILDON_NOTE_CONFIRMATION_BUTTON_TYPE)
-    {
-      dbus_message_append_args(msg, DBUS_TYPE_STRING,
-                              CONFIRMATION_SOUND_PATH,
-                              DBUS_TYPE_INT32, 1, DBUS_TYPE_INVALID);
+    if (priv->okButton) {
+        gtk_container_remove (GTK_CONTAINER (priv->okButton->parent),
+                              priv->okButton);
+        priv->okButton = NULL;
     }
 
-  b = dbus_connection_send(conn, msg, NULL);
+    if (priv->cancelButton) {
+        gtk_container_remove (GTK_CONTAINER (priv->cancelButton->parent),
+                              priv->cancelButton);
+        priv->cancelButton = NULL;
+    }
 
-  if (!b)
-    {
-      dbus_message_unref(msg);
-      return;
+    if (priv->progressbar && priv->progressbar->parent) {
+        gtk_container_remove (GTK_CONTAINER (priv->progressbar->parent),
+                              priv->progressbar);
+        priv->progressbar = NULL;
     }
-  dbus_connection_flush(conn);
-  dbus_message_unref(msg);
-  
-}
 
-static void hildon_note_finalize(GObject * obj_self)
-{
-    HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE(obj_self);
+    if (priv->note_n == HILDON_NOTE_CONFIRMATION_TYPE ||
+        priv->note_n == HILDON_NOTE_CONFIRMATION_BUTTON_TYPE ||
+        priv->note_n == HILDON_NOTE_INFORMATION_THEME_TYPE ||
+        priv->note_n == HILDON_NOTE_INFORMATION_TYPE) {
 
-    if (G_OBJECT_CLASS(parent_class)->finalize)
-        G_OBJECT_CLASS(parent_class)->finalize(obj_self);
+        if (priv->note_n == HILDON_NOTE_CONFIRMATION_TYPE) {
+            /* ok button clickable with mouse or whatever */
+            priv->okButton = 
+                gtk_dialog_add_button(GTK_DIALOG(note),
+                                      _("Ecdg_bd_confirmation_note_ok"),
+                                      GTK_RESPONSE_OK);
+            /* cancel button clickable with mouse or whatever */
+            priv->cancelButton =
+                gtk_dialog_add_button(GTK_DIALOG(note),
+                                      _("Ecdg_bd_confirmation_note_cancel"),
+                                      GTK_RESPONSE_CANCEL);
 
-    if(priv->icon)
-       g_free(priv->icon);
+        } else if (priv->note_n == HILDON_NOTE_INFORMATION_TYPE || 
+                  priv->note_n == HILDON_NOTE_INFORMATION_THEME_TYPE ) {
+            priv->okButton = NULL;
+            /* cancel button clickable with mouse or whatever */
+            priv->cancelButton =
+                gtk_dialog_add_button(GTK_DIALOG(note),
+                                      _("Ecdg_bd_information_note_ok"),
+                                      GTK_RESPONSE_CANCEL);
+        }
 
-    if (priv->original_description != NULL)
-        g_free(priv->original_description);
+        if ((priv->note_n == HILDON_NOTE_INFORMATION_TYPE ||
+            priv->note_n == HILDON_NOTE_INFORMATION_THEME_TYPE) && 
+                 priv->icon)
+        {
+            item = gtk_image_new_from_icon_name(priv->icon,
+                                            HILDON_ICON_SIZE_BIG_NOTE);
+        }
+        else {
+          if (priv->note_n == HILDON_NOTE_CONFIRMATION_TYPE ||
+            priv->note_n == HILDON_NOTE_CONFIRMATION_BUTTON_TYPE)
+          {
+            item = gtk_image_new_from_icon_name(HILDON_NOTE_CONFIRMATION_ICON, 
+                                                HILDON_ICON_SIZE_BIG_NOTE);
+          } else {
+            item = gtk_image_new_from_icon_name(HILDON_NOTE_INFORMATION_ICON, 
+                                                HILDON_ICON_SIZE_BIG_NOTE);
+            }
+        }
+
+    } else {
+        priv->cancelButton = 
+            gtk_dialog_add_button(GTK_DIALOG(note),
+                                  _("Ecdg_bd_cancel_note_cancel"),
+                                  GTK_RESPONSE_CANCEL);
+        IsHorizontal = FALSE;
+
+        item = priv->progressbar;
+    }
+
+    hildon_note_create_form(GTK_DIALOG(note), item, IsHorizontal);
 }
 
 static void
 hildon_note_create_form(GtkDialog * dialog, GtkWidget * item,
                         gboolean IsHorizontal)
 {
-    GtkWidget *box;
     HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE(dialog);
 
+    g_object_ref (priv->label);
+
+    if (priv->label->parent) {
+        gtk_container_remove (GTK_CONTAINER (priv->label->parent), priv->label);
+    }
+
+    if (priv->box) {
+        gtk_container_remove (GTK_CONTAINER (priv->box->parent), priv->box);
+        priv->box = NULL;
+    }
+
     if (IsHorizontal) {
-        box = gtk_hbox_new(FALSE, 10);
-        gtk_container_add(GTK_CONTAINER(dialog->vbox), box);
+        priv->box = gtk_hbox_new(FALSE, 10);
+        gtk_container_add(GTK_CONTAINER(dialog->vbox), priv->box);
 
         if (item) {
             GtkWidget *alignment = gtk_alignment_new(0, 0, 0, 0);
 
-            gtk_box_pack_start(GTK_BOX(box), alignment, FALSE, FALSE, 0);
+            gtk_box_pack_start(GTK_BOX(priv->box), alignment, FALSE, FALSE, 0);
             gtk_container_add(GTK_CONTAINER(alignment), item);
         }
-        gtk_box_pack_start(GTK_BOX(box), priv->label, FALSE, FALSE, 0);
+        gtk_box_pack_start(GTK_BOX(priv->box), priv->label, FALSE, FALSE, 0);
 
     } else {
-        box = gtk_vbox_new(FALSE, 10);
-        gtk_container_add(GTK_CONTAINER(dialog->vbox), box);
-        gtk_box_pack_start(GTK_BOX(box), priv->label, FALSE, FALSE, 0);
+        priv->box = gtk_vbox_new(FALSE, 10);
+        gtk_container_add(GTK_CONTAINER(dialog->vbox), priv->box);
+        gtk_box_pack_start(GTK_BOX(priv->box), priv->label, FALSE, FALSE, 0);
 
         if (item) {
-            gtk_box_pack_start(GTK_BOX(box), item, FALSE, FALSE, 0);
+            gtk_box_pack_start(GTK_BOX(priv->box), item, FALSE, FALSE, 0);
         }
     }
     
-    gtk_widget_show_all(box);
+    gtk_widget_show_all(priv->box);
+
+    g_object_unref (priv->label);
 }
 
 /**
@@ -712,7 +739,7 @@ GtkWidget *hildon_note_new_confirmation_add_buttons(GtkWindow * parent,
         g_object_new(HILDON_TYPE_NOTE,
                      "note_type", HILDON_NOTE_CONFIRMATION_BUTTON_TYPE,
                      "description", description,
-                     "icon", "qgn_note_confirm", /*HILDON_NOTE_CONFIRMATION_STOCK, */
+                     "icon", HILDON_NOTE_CONFIRMATION_ICON, 
                      NULL);
 
     g_return_val_if_fail(conf_note, FALSE);
@@ -757,7 +784,7 @@ GtkWidget *hildon_note_new_confirmation(GtkWindow * parent,
                                         const gchar * description)
 {
     return hildon_note_new_confirmation_with_icon_name
-        (parent, description, "qgn_note_confirm"); /*HILDON_NOTE_CONFIRMATION_STOCK);*/
+        (parent, description, HILDON_NOTE_CONFIRMATION_ICON);
 }
 
 
@@ -1005,3 +1032,65 @@ void hildon_note_set_button_text(HildonNote * note, const gchar * text)
         gtk_button_set_label(GTK_BUTTON(priv->cancelButton), text);
     }
 }
+
+/**
+ * hildon_note_set_button_texts:
+ * @note: A #HildonNote
+ * @text: Sets the button text and if there is two buttons in dialog, 
+ *   the button texts will be &lt;textOk&gt;, &lt;textCancel&gt;.  
+ *
+ * Sets the button texts to be used by this hildon_note widget.
+ */
+void hildon_note_set_button_texts(HildonNote * note, const gchar * textOk,
+                                const gchar * textCancel)
+{
+    HildonNotePrivate *priv;
+
+    priv = HILDON_NOTE_GET_PRIVATE(HILDON_NOTE(note));
+    if (priv->okButton) {
+      gtk_button_set_label(GTK_BUTTON(priv->okButton), textOk);
+      gtk_button_set_label(GTK_BUTTON(priv->cancelButton),
+                          textCancel);
+    } else {
+      gtk_button_set_label(GTK_BUTTON(priv->cancelButton), textCancel);
+    }
+}
+
+
+
+static gboolean
+sound_handling(GtkWidget * widget, gpointer data)
+{
+  
+  HildonNotePrivate *priv = HILDON_NOTE_GET_PRIVATE(HILDON_NOTE(widget));
+
+  if (priv->note_n != HILDON_NOTE_INFORMATION_TYPE &&
+      priv->note_n != HILDON_NOTE_INFORMATION_THEME_TYPE &&
+      priv->note_n != HILDON_NOTE_CONFIRMATION_TYPE &&
+      priv->note_n != HILDON_NOTE_CONFIRMATION_BUTTON_TYPE)
+    {
+      g_signal_handler_disconnect(G_OBJECT(widget),
+                                 sound_signal_handler);
+      return FALSE;
+    }
+
+  if (priv->note_n == HILDON_NOTE_INFORMATION_TYPE ||
+      priv->note_n == HILDON_NOTE_INFORMATION_THEME_TYPE)
+    {
+      esd_play_file(ESD_NAME, INFORMATION_SOUND_PATH, 1);
+
+      g_signal_handler_disconnect(G_OBJECT(widget), sound_signal_handler);
+      return FALSE;
+    }
+
+    else if (priv->note_n == HILDON_NOTE_CONFIRMATION_TYPE ||
+          priv->note_n ==  HILDON_NOTE_CONFIRMATION_BUTTON_TYPE)
+    {
+      esd_play_file(ESD_NAME, CONFIRMATION_SOUND_PATH, 1);
+
+      g_signal_handler_disconnect(G_OBJECT(widget), sound_signal_handler);
+      return FALSE;
+    }
+  g_signal_handler_disconnect(G_OBJECT(widget), sound_signal_handler);
+  return FALSE;
+}
index 255875a..7c36564 100644 (file)
@@ -40,13 +40,14 @@ G_BEGIN_DECLS
 typedef struct _HildonNote HildonNote;
 typedef struct _HildonNoteClass HildonNoteClass;
 
-enum {
+typedef enum
+{
     HILDON_NOTE_CONFIRMATION_TYPE = 0,
     HILDON_NOTE_CONFIRMATION_BUTTON_TYPE,
     HILDON_NOTE_INFORMATION_TYPE,
     HILDON_NOTE_INFORMATION_THEME_TYPE,
     HILDON_NOTE_PROGRESSBAR_TYPE
-};
+} HildonNoteType;
 
 struct _HildonNote {
     GtkDialog parent;
@@ -105,7 +106,11 @@ GtkWidget *hildon_note_new_information_with_icon_theme(GtkWindow * parent,
                                                        
 void hildon_note_set_button_text(HildonNote * note, const gchar * text);
 
-GType hildon_note_get_type(void);
+void hildon_note_set_button_texts(HildonNote * note, const gchar * textOk,
+                                const gchar * textCancel);
+
+GType hildon_note_get_type(void) G_GNUC_CONST;
+GType hildon_note_type_get_type(void) G_GNUC_CONST;
 
 G_END_DECLS
 #endif /* __HILDON_NOTE_H__ */
index 0610c64..37c179c 100644 (file)
 #include <stdlib.h>
 
 #include "hildon-number-editor.h"
+#include "hildon-marshalers.h"
 #include <hildon-widgets/gtk-infoprint.h>
 #include "hildon-composite-widget.h"
+#include <hildon-widgets/hildon-input-mode-hint.h>
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
         (G_TYPE_INSTANCE_GET_PRIVATE ((obj), HILDON_TYPE_NUMBER_EDITOR, \
         HildonNumberEditorPrivate));
 
-enum
-{
-   MAXIMUM_VALUE_EXCEED,
-   MINIMUM_VALUE_EXCEED,
-   ERRONEOUS_VALUE
-};
-
-
 typedef struct _HildonNumberEditorPrivate HildonNumberEditorPrivate;
 
 static void
@@ -91,9 +85,6 @@ static void
 set_widget_allocation (GtkWidget *widget, GtkAllocation *alloc,
                        GtkAllocation *allocation);
 
-static int
-hildon_number_editor_get_font_width (GtkWidget *widget);
-
 static void
 hildon_number_editor_size_allocate (GtkWidget *widget,
                                     GtkAllocation *allocation);
@@ -114,9 +105,6 @@ static gboolean
 hildon_number_editor_button_released (GtkWidget *widget,
                                       GdkEvent *event,
                                       HildonNumberEditor *editor);
-static void
-construct_error_message (HildonNumberEditor *editor, gint type);
-
 static gboolean
 do_mouse_timeout (HildonNumberEditor *editor);
 
@@ -142,9 +130,20 @@ hildon_number_editor_finalize (GObject *self);
 static gboolean
 hildon_number_editor_mnemonic_activate( GtkWidget *widget,
                                         gboolean group_cycle );
+static gboolean
+hildon_number_editor_error_handler(HildonNumberEditor *editor,
+                                  HildonNumberEditorErrorType type);
+
+enum
+{
+  RANGE_ERROR,
+
+  LAST_SIGNAL
+};
 
 static GtkContainerClass *parent_class;
 
+static guint HildonNumberEditor_signal[LAST_SIGNAL] = {0};
 
 struct _HildonNumberEditorPrivate
 {
@@ -157,10 +156,7 @@ struct _HildonNumberEditorPrivate
     gint default_val;
     gint button_type;
     gint button_event_id;
-    gint entry_len;
-    gint entry_width;
 
-    gboolean rem_sign_space;
     gboolean negative;
 };
 
@@ -206,11 +202,21 @@ hildon_number_editor_class_init(HildonNumberEditorClass * editor_class)
     widget_class->mnemonic_activate = hildon_number_editor_mnemonic_activate;
     widget_class->focus = hildon_composite_widget_focus;
 
+    editor_class->error_handler = hildon_number_editor_error_handler;
+
     /* Because we derived our widget from GtkContainer, we should override 
        forall method */
     container_class->forall = hildon_number_editor_forall;
     GTK_OBJECT_CLASS(editor_class)->destroy = hildon_number_editor_destroy;
     G_OBJECT_CLASS(editor_class)->finalize = hildon_number_editor_finalize;
+
+    HildonNumberEditor_signal[RANGE_ERROR] =
+      g_signal_new("range_error", HILDON_TYPE_NUMBER_EDITOR,
+                  G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET
+                  (HildonNumberEditorClass, error_handler),
+                  g_signal_accumulator_true_handled, NULL,
+                  _hildon_marshal_BOOLEAN__INT,
+                  G_TYPE_BOOLEAN, 1, G_TYPE_INT);
 }
 
 static void
@@ -294,9 +300,7 @@ hildon_number_editor_init (HildonNumberEditor *editor)
     GTK_WIDGET_UNSET_FLAGS( priv->minus, GTK_CAN_FOCUS );
     GTK_WIDGET_UNSET_FLAGS( priv->plus, GTK_CAN_FOCUS );
     
-    priv->entry_width = 0;
     priv->button_event_id = -1;
-    priv->rem_sign_space = TRUE;
 
     gtk_widget_set_parent(priv->minus, GTK_WIDGET(editor));
     gtk_widget_set_parent(priv->num_entry, GTK_WIDGET(editor));
@@ -342,6 +346,9 @@ hildon_number_editor_init (HildonNumberEditor *editor)
                      G_CALLBACK(hildon_number_editor_button_released),
                      editor);
 
+    g_object_set( G_OBJECT(priv->num_entry),
+                  "input-mode", HILDON_INPUT_MODE_HINT_NUMERIC, NULL );
+    
     gtk_widget_show(priv->num_entry);
     gtk_widget_show(priv->minus);
     gtk_widget_show(priv->plus);
@@ -368,40 +375,6 @@ hildon_number_editor_entry_button_released (GtkWidget *widget,
   return FALSE;
 }
 
-static void
-construct_error_message (HildonNumberEditor *editor, gint type)
-{
-    gint min, max;
-    gchar *err_msg = NULL;
-    HildonNumberEditorPrivate *priv;
-
-    priv = HILDON_NUMBER_EDITOR_GET_PRIVATE(editor);
-    min = priv->start;
-    max = priv->end;
-
-    /* Construct different error message */
-    switch (type)
-      {
-        case MAXIMUM_VALUE_EXCEED:
-          err_msg = g_strdup_printf(_("Ckct_ib_maximum_value"), max, max);
-          break;
-        case MINIMUM_VALUE_EXCEED:
-          err_msg = g_strdup_printf(_("Ckct_ib_minimum_value"), min, min);
-          break;
-        case ERRONEOUS_VALUE:
-          err_msg =
-            g_strdup_printf(_("Ckct_ib_set_a_value_within_range"), min, max);
-          break;
-      }
-
-    if (err_msg)
-      {
-        gtk_infoprint(GTK_WINDOW(gtk_widget_get_ancestor(GTK_WIDGET(editor),
-                      GTK_TYPE_WINDOW)), err_msg);
-        g_free(err_msg);
-      }
-}
-
 static gboolean
 hildon_number_editor_button_released (GtkWidget *widget, GdkEvent *event,
                                       HildonNumberEditor *editor)
@@ -496,6 +469,7 @@ do_mouse_timeout (HildonNumberEditor *editor)
 static gboolean
 change_numbers (HildonNumberEditor *editor, gint type, gint cursor_pos)
 {
+    gboolean r;
     gint nvalue;
     gchar *snvalue;
     HildonNumberEditorPrivate *priv =
@@ -508,7 +482,8 @@ change_numbers (HildonNumberEditor *editor, gint type, gint cursor_pos)
             nvalue += 1;
         else
           {
-            construct_error_message(editor, MAXIMUM_VALUE_EXCEED);
+           g_signal_emit(editor, HildonNumberEditor_signal[RANGE_ERROR], 
+                         0, MAXIMUM_VALUE_EXCEED, &r);
             return FALSE;
           }
       }
@@ -519,7 +494,8 @@ change_numbers (HildonNumberEditor *editor, gint type, gint cursor_pos)
 
         else
           {
-            construct_error_message(editor, MINIMUM_VALUE_EXCEED);
+           g_signal_emit(editor, HildonNumberEditor_signal[RANGE_ERROR], 
+                         0, MINIMUM_VALUE_EXCEED, &r);
             return FALSE;
           }
       }
@@ -547,48 +523,52 @@ integer_to_string (gint nvalue)
 static void
 hildon_number_editor_entry_changed (GtkWidget *widget, gpointer data)
 {
-    HildonNumberEditor *editor;
-    HildonNumberEditorPrivate *priv;
-    gchar *tmpstr;
-    gint value;
-    gchar *tail = NULL;
+  HildonNumberEditor *editor;
+  HildonNumberEditorPrivate *priv;
+  gchar *tmpstr;
+  gint value;
+  gchar *tail = NULL;
+  gboolean r;
 
-    editor = HILDON_NUMBER_EDITOR(data);
-    priv = HILDON_NUMBER_EDITOR_GET_PRIVATE(editor);
+  editor = HILDON_NUMBER_EDITOR(data);
+  priv = HILDON_NUMBER_EDITOR_GET_PRIVATE(editor);
 
-    tmpstr = GTK_ENTRY(priv->num_entry)->text;
+  tmpstr = GTK_ENTRY(priv->num_entry)->text;
 
-    if (strlen(tmpstr) > 0)
-      {
-        tmpstr = NULL;
-        value = strtol(GTK_ENTRY(priv->num_entry)->text, &tail, 10);
-        if (!strncmp(tail, "\0", 1) || !strncmp(tail, "-", 1))
-          {    
-            if (atoi(GTK_ENTRY(priv->num_entry)->text) > priv->end)
-              {
-                construct_error_message(editor, MAXIMUM_VALUE_EXCEED);
-                tmpstr = integer_to_string(priv->end);
-                gtk_entry_set_text(GTK_ENTRY(priv->num_entry), tmpstr);
-                if (tmpstr)
-                    g_free(tmpstr);
-              }
-            else if (atoi(GTK_ENTRY(priv->num_entry)->text) < priv->start) {
-                construct_error_message(editor, MINIMUM_VALUE_EXCEED);
-                tmpstr = integer_to_string(priv->start);
-                gtk_entry_set_text(GTK_ENTRY(priv->num_entry), tmpstr);
-                if (tmpstr)
-                    g_free(tmpstr);
-              }
-          }
-        else
-          {
-            construct_error_message(editor, ERRONEOUS_VALUE);
-            tmpstr = integer_to_string(priv->start);
-            gtk_entry_set_text(GTK_ENTRY(priv->num_entry), tmpstr);
-            if (tmpstr)
-                g_free(tmpstr);
-          }
-      }
+  if (strlen(tmpstr) > 0)
+    {
+      tmpstr = NULL;
+      value = strtol(GTK_ENTRY(priv->num_entry)->text, &tail, 10);
+      if (!strncmp(tail, "\0", 1) || !strncmp(tail, "-", 1))
+       {    
+         if (atoi(GTK_ENTRY(priv->num_entry)->text) > priv->end)
+           {
+             g_signal_emit(editor,HildonNumberEditor_signal[RANGE_ERROR], 
+                           0, MAXIMUM_VALUE_EXCEED, &r);
+             tmpstr = integer_to_string(priv->end);
+             gtk_entry_set_text(GTK_ENTRY(priv->num_entry), tmpstr);
+             if (tmpstr)
+               g_free(tmpstr);
+           }
+         else if (atoi(GTK_ENTRY(priv->num_entry)->text) < priv->start) {
+           g_signal_emit(editor, HildonNumberEditor_signal[RANGE_ERROR], 
+                         0, MINIMUM_VALUE_EXCEED, &r);
+           tmpstr = integer_to_string(priv->start);
+           gtk_entry_set_text(GTK_ENTRY(priv->num_entry), tmpstr);
+           if (tmpstr)
+             g_free(tmpstr);
+         }
+       }
+      else
+       {
+         g_signal_emit(editor, HildonNumberEditor_signal[RANGE_ERROR], 
+                       0, ERRONEOUS_VALUE, &r);
+         tmpstr = integer_to_string(priv->start);
+         gtk_entry_set_text(GTK_ENTRY(priv->num_entry), tmpstr);
+         if (tmpstr)
+           g_free(tmpstr);
+       }
+    }
 }
 
 static void
@@ -602,29 +582,14 @@ hildon_number_editor_size_request (GtkWidget *widget,
     editor = HILDON_NUMBER_EDITOR(widget);
     priv = HILDON_NUMBER_EDITOR_GET_PRIVATE(editor);
 
-/* FIXME -- If it's needed to fix button sizes.. priv->minus and priv->plus
- * requisitions are right places to do that.
- */
-
     gtk_widget_size_request(priv->minus, &req);
-    *requisition = req;
+    requisition->width = req.width;
 
     gtk_widget_size_request(priv->num_entry, &req);
     requisition->width += req.width;
 
-    if (!priv->entry_width)
-      {
-        gint font_w = hildon_number_editor_get_font_width(priv->num_entry);
-
-        priv->entry_width = (priv->entry_len + 1) * font_w +
-            widget->style->xthickness * 2 -
-            (font_w / 2 * priv->rem_sign_space);
-        gtk_widget_set_size_request(priv->num_entry, priv->entry_width,
-                                    req.height);
-      }
-
     gtk_widget_size_request(priv->plus, &req);
-    requisition->width += priv->entry_len;
+    requisition->width += req.width;
 
     requisition->width += SPACE_BORDER * 2;
     requisition->height = NUMBER_EDITOR_HEIGHT;
@@ -652,27 +617,6 @@ set_widget_allocation (GtkWidget *widget, GtkAllocation *alloc,
     alloc->x += alloc->width;
 }
 
-static int
-hildon_number_editor_get_font_width (GtkWidget *widget)
-{
-    PangoContext *context;
-    PangoFontMetrics *metrics;
-    gint digit_width;
-
-    context = gtk_widget_get_pango_context(widget);
-    metrics = pango_context_get_metrics(context,
-                                        widget->style->font_desc,
-                                        pango_context_get_language
-                                        (context));
-
-    digit_width = pango_font_metrics_get_approximate_digit_width(metrics);
-    digit_width = PANGO_PIXELS(digit_width);
-
-    pango_font_metrics_unref(metrics);
-
-    return digit_width;
-}
-
 static void
 hildon_number_editor_size_allocate (GtkWidget *widget,
                                     GtkAllocation *allocation)
@@ -720,6 +664,7 @@ hildon_number_editor_entry_focusout (GtkWidget *widget, GdkEventFocus *event,
     HildonNumberEditor *editor;
     HildonNumberEditorPrivate *priv;
     gchar *str;
+    gboolean r;
 
     editor = HILDON_NUMBER_EDITOR(data);
     priv = HILDON_NUMBER_EDITOR_GET_PRIVATE(editor);
@@ -727,7 +672,8 @@ hildon_number_editor_entry_focusout (GtkWidget *widget, GdkEventFocus *event,
     /* empty entry, must infoprint error message */
     if (!strlen(GTK_ENTRY(priv->num_entry)->text))
       {
-        construct_error_message(editor, ERRONEOUS_VALUE);
+       g_signal_emit(editor, HildonNumberEditor_signal[RANGE_ERROR], 
+                     0, ERRONEOUS_VALUE, &r);
         /* Changing to default value */
         str = integer_to_string(priv->default_val);
         gtk_entry_set_text(GTK_ENTRY(priv->num_entry), str);
@@ -808,6 +754,44 @@ hildon_number_editor_entry_keypress (GtkWidget *widget, GdkEventKey *event,
    return ret_val;
 }
 
+static gboolean
+hildon_number_editor_error_handler(HildonNumberEditor *editor,
+                                  HildonNumberEditorErrorType type)
+{
+
+  gint min, max;
+  gchar *err_msg = NULL;
+  HildonNumberEditorPrivate *priv;
+
+  priv = HILDON_NUMBER_EDITOR_GET_PRIVATE(editor);
+  min = priv->start;
+  max = priv->end;
+
+  /* Construct different error message */
+  switch (type)
+    {
+    case MAXIMUM_VALUE_EXCEED:
+      err_msg = g_strdup_printf(_("Ckct_ib_maximum_value"), max, max);
+      break;
+    case MINIMUM_VALUE_EXCEED:
+      err_msg = g_strdup_printf(_("Ckct_ib_minimum_value"), min, min);
+      break;
+    case ERRONEOUS_VALUE:
+      err_msg =
+       g_strdup_printf(_("Ckct_ib_set_a_value_within_range"), min, max);
+      break;
+    }
+
+  if (err_msg)
+    {
+      gtk_infoprint(GTK_WINDOW(gtk_widget_get_ancestor(GTK_WIDGET(editor),
+                                                      GTK_TYPE_WINDOW)), err_msg);
+      g_free(err_msg);
+    }
+
+  return TRUE;
+}
+
 
 /**
  * hildon_number_editor_new:
@@ -843,7 +827,7 @@ hildon_number_editor_set_range (HildonNumberEditor *editor, gint min, gint max)
 {
     HildonNumberEditorPrivate *priv;
     gchar *str, *str2;
-    gint a, b;
+    gint a, b, entry_len;
 
     g_return_if_fail(HILDON_IS_NUMBER_EDITOR(editor));
 
@@ -870,23 +854,12 @@ hildon_number_editor_set_range (HildonNumberEditor *editor, gint min, gint max)
     b = strlen(str2);
 
     if (a >= b)
-      {
-        priv->entry_len = a;
-        priv->rem_sign_space = FALSE;
-      }
+        entry_len = a;
     else
-      {
-        priv->entry_len = b;
-        priv->rem_sign_space = TRUE;
-      }
+        entry_len = b;
     
-    /* reserving space for the minus sign */
-    if (priv->negative)
-        priv->entry_len++;
-
-/*  priv->entry_len = a >= b ? a : b;*/
 
-    priv->entry_width = 0;
+    gtk_entry_set_width_chars(GTK_ENTRY(priv->num_entry), entry_len);
 
     gtk_entry_set_text(GTK_ENTRY(priv->num_entry), str);
     gtk_widget_queue_resize(GTK_WIDGET(editor));
index f1ae4a0..ac803d0 100644 (file)
@@ -42,25 +42,39 @@ G_BEGIN_DECLS
 typedef struct _HildonNumberEditor HildonNumberEditor;
 typedef struct _HildonNumberEditorClass HildonNumberEditorClass;
 
-struct _HildonNumberEditor {
-    GtkContainer parent;
+struct _HildonNumberEditor 
+{
+  GtkContainer parent;
 };
 
-struct _HildonNumberEditorClass {
-    GtkContainerClass parent_class;
+typedef enum
+{
+  MAXIMUM_VALUE_EXCEED,
+  MINIMUM_VALUE_EXCEED,
+  ERRONEOUS_VALUE
+
+}HildonNumberEditorErrorType;
+
+struct _HildonNumberEditorClass 
+{
+  GtkContainerClass parent_class;
+  
+  gboolean     (*error_handler)        (HildonNumberEditor *editor, 
+                                        HildonNumberEditorErrorType type); 
 };
 
 /* Public API */
 
-GType hildon_number_editor_get_type(void);
+GType          hildon_number_editor_get_type   (void);
 
-GtkWidget *hildon_number_editor_new(gint min, gint max);
+GtkWidget*     hildon_number_editor_new        (gint min, gint max);
 
-void hildon_number_editor_set_range(HildonNumberEditor *editor, gint min,
-                                    gint max);
+void           hildon_number_editor_set_range  (HildonNumberEditor *editor, 
+                                                gint min, gint max);
 
-gint hildon_number_editor_get_value(HildonNumberEditor *editor);
-void hildon_number_editor_set_value(HildonNumberEditor *editor, gint value);
+gint           hildon_number_editor_get_value  (HildonNumberEditor *editor);
+void           hildon_number_editor_set_value  (HildonNumberEditor *editor, 
+                                                gint value);
 
 G_END_DECLS
 #endif /* __HILDON_NUMBER_EDITOR_H__ */
index dc97d37..9248857 100644 (file)
 #include <glib/gprintf.h>
 #include <string.h>
 #include <stdlib.h>
+#include <hildon-widgets/hildon-input-mode-hint.h>
 
-#include <hildon-widgets/hildon-range-editor.h>
+#include "hildon-range-editor.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
 #include <libintl.h>
-#define _(String) gettext(String)
+#define _(string) dgettext(PACKAGE, string)
 
 /* Alignment in entry box ( 0 = left, 1 = right ) */
 #define DEFAULT_ALIGNMENT 1
 /* Amount of padding to add to each side of the separator */
 #define DEFAULT_PADDING 3
 
-#define DEFAULT_SEPARATOR _("-")
-#define DEFAULT_START -999 /*_("-999")*/
-#define DEFAULT_END 999 /*_("999")*/
+#define DEFAULT_START -999
+#define DEFAULT_END 999
 #define DEFAULT_LENGTH 4
 
 #define HILDON_RANGE_EDITOR_GET_PRIVATE(obj) \
 
 typedef struct _HildonRangeEditorPrivate HildonRangeEditorPrivate;
 
+enum
+{
+  PROP_LOWER = 1,
+  PROP_HIGHER,
+  PROP_MIN,
+  PROP_MAX,
+  PROP_SEPARATOR
+};
+
 /*our parent class*/
 static GtkContainerClass *parent_class = NULL;
 
@@ -117,6 +126,11 @@ static gboolean
 hildon_range_editor_mnemonic_activate (GtkWidget *widget,
                                        gboolean group_cycling);
 
+static void hildon_range_editor_set_property( GObject *object, guint param_id,
+                                       const GValue *value, GParamSpec *pspec );
+static void hildon_range_editor_get_property( GObject *object, guint param_id,
+                                         GValue *value, GParamSpec *pspec );
+
 /* Private struct */
 struct _HildonRangeEditorPrivate
 {
@@ -132,6 +146,7 @@ struct _HildonRangeEditorPrivate
 static void
 hildon_range_editor_class_init  (HildonRangeEditorClass *editor_class)
 {
+    GObjectClass *gobject_class = G_OBJECT_CLASS(editor_class);
     GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(editor_class);
     GtkContainerClass *container_class = GTK_CONTAINER_CLASS(editor_class);
 
@@ -142,6 +157,8 @@ hildon_range_editor_class_init  (HildonRangeEditorClass *editor_class)
     g_type_class_add_private(editor_class,
                              sizeof(HildonRangeEditorPrivate));
 
+    gobject_class->set_property = hildon_range_editor_set_property;
+    gobject_class->get_property = hildon_range_editor_get_property;
     widget_class->size_request = hildon_range_editor_size_request;
     widget_class->size_allocate = hildon_range_editor_size_allocate;
 
@@ -165,7 +182,75 @@ hildon_range_editor_class_init  (HildonRangeEditorClass *editor_class)
                          DEFAULT_PADDING,
                          G_PARAM_READABLE));
 
-    return;
+  /**
+   * HildonRangeEditor:min:
+   *
+   * Minimum value in a range.
+   * Default: -999
+   */
+  g_object_class_install_property( gobject_class, PROP_MIN,
+                                   g_param_spec_int("min",
+                                   "Minimum value",
+                                   "Minimum value in a range",
+                                   G_MININT, G_MAXINT,
+                                   DEFAULT_START, G_PARAM_CONSTRUCT | 
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  /**
+   * HildonRangeEditor:max:
+   *
+   * Maximum value in a range.
+   * Default: 999
+   */
+  g_object_class_install_property( gobject_class, PROP_MAX,
+                                   g_param_spec_int("max",
+                                   "Maximum value",
+                                    "Maximum value in a range",
+                                   G_MININT, G_MAXINT,
+                                   DEFAULT_END, G_PARAM_CONSTRUCT | 
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  /**
+   * HildonRangeEditor:lower:
+   *
+   * Current value in the entry presenting lower end of selected range.
+   * Default: -999
+   */
+  g_object_class_install_property( gobject_class, PROP_LOWER,
+                                   g_param_spec_int("lower",
+                                   "Current lower value",
+           "Current value in the entry presenting lower end of selected range",
+                                   G_MININT, G_MAXINT,
+                                   DEFAULT_START, G_PARAM_CONSTRUCT | 
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  /**
+   * HildonRangeEditor:higher:
+   *
+   * Current value in the entry presenting higher end of selected range.
+   * Default: 999
+   */
+  g_object_class_install_property( gobject_class, PROP_HIGHER,
+                                   g_param_spec_int("higher",
+                                   "Current higher value",
+           "Current value in the entry presenting higher end of selected range",
+                                   G_MININT, G_MAXINT,
+                                   DEFAULT_END, G_PARAM_CONSTRUCT | 
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  /**
+   * HildonRangeEditor:separator:
+   *
+   * Separator string to separate range editor entries.
+   * Default: "-"
+   */
+  g_object_class_install_property( gobject_class, PROP_SEPARATOR,
+                                   g_param_spec_string("separator",
+                                   "Separator",
+                                    "Separator string to separate entries",
+                                   _("Ckct_wi_range_separator"),
+                                   G_PARAM_CONSTRUCT | 
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
 }
 
 static void
@@ -184,9 +269,9 @@ hildon_range_editor_init (HildonRangeEditor *editor)
     
     priv->start_entry = GTK_WIDGET(gtk_entry_new());
     priv->end_entry = GTK_WIDGET(gtk_entry_new());
-    priv->label = GTK_WIDGET(gtk_label_new(DEFAULT_SEPARATOR));
+    priv->label = GTK_WIDGET(gtk_label_new(_("Ckct_wi_range_separator")));
     priv->bp = FALSE;
-    
+
     /* Get values from gtkrc (or use defaults) */
     gtk_widget_style_get(GTK_WIDGET(editor),
                          "hildon_range_editor_entry_alignment",
@@ -204,13 +289,6 @@ hildon_range_editor_init (HildonRangeEditor *editor)
     gtk_entry_set_alignment(GTK_ENTRY(priv->end_entry),
                             range_editor_entry_alignment);
 
-/*    gtk_entry_set_text(GTK_ENTRY(priv->start_entry), DEFAULT_START);
-    gtk_entry_set_text(GTK_ENTRY(priv->end_entry), DEFAULT_END);
-    gtk_entry_set_max_length(GTK_ENTRY(priv->start_entry), DEFAULT_LENGTH);
-    gtk_entry_set_max_length(GTK_ENTRY(priv->end_entry), DEFAULT_LENGTH);
-    gtk_entry_set_width_chars(GTK_ENTRY(priv->start_entry), DEFAULT_LENGTH);
-    gtk_entry_set_width_chars(GTK_ENTRY(priv->end_entry), DEFAULT_LENGTH);
-  */  
     gtk_widget_set_parent(priv->start_entry, GTK_WIDGET(editor));
     gtk_widget_set_parent(priv->end_entry, GTK_WIDGET(editor));
     gtk_widget_set_parent(priv->label, GTK_WIDGET(editor));
@@ -240,15 +318,83 @@ hildon_range_editor_init (HildonRangeEditor *editor)
     g_signal_connect(G_OBJECT(priv->end_entry), "focus-out-event",
                      G_CALLBACK(hildon_range_editor_entry_focus_out), editor);
                        
+    g_object_set( G_OBJECT(priv->start_entry),
+                    "input-mode", HILDON_INPUT_MODE_HINT_NUMERIC, NULL );
+    g_object_set( G_OBJECT(priv->end_entry),
+                    "input-mode", HILDON_INPUT_MODE_HINT_NUMERIC, NULL );
+    
     gtk_widget_show(priv->start_entry);
     gtk_widget_show(priv->end_entry);
     gtk_widget_show(priv->label);
 
-    hildon_range_editor_set_limits(editor, DEFAULT_START, DEFAULT_END);
-    
     gtk_widget_pop_composite_child();
 }
 
+static void hildon_range_editor_set_property (GObject *object, guint param_id,
+                                       const GValue *value, GParamSpec *pspec)
+{
+  HildonRangeEditor *editor = HILDON_RANGE_EDITOR(object);
+  switch (param_id)
+  {
+    case PROP_LOWER:
+      hildon_range_editor_set_lower (editor, g_value_get_int (value));
+      break;
+
+    case PROP_HIGHER:
+      hildon_range_editor_set_higher (editor, g_value_get_int (value));
+      break;
+
+    case PROP_MIN:
+      hildon_range_editor_set_min (editor, g_value_get_int (value));
+      break;
+
+    case PROP_MAX:
+      hildon_range_editor_set_max (editor, g_value_get_int (value));
+      break;
+
+    case PROP_SEPARATOR:
+      hildon_range_editor_set_separator (editor,
+                                         g_value_get_string (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+  }
+}
+
+static void hildon_range_editor_get_property( GObject *object, guint param_id,
+                                         GValue *value, GParamSpec *pspec )
+{
+  HildonRangeEditor *editor = HILDON_RANGE_EDITOR(object);
+  switch (param_id)
+  {
+    case PROP_LOWER:
+      g_value_set_int (value, hildon_range_editor_get_lower (editor));
+      break;
+
+    case PROP_HIGHER:
+      g_value_set_int (value, hildon_range_editor_get_higher (editor));
+      break;
+
+    case PROP_MIN:
+      g_value_set_int (value, hildon_range_editor_get_min (editor));
+      break;
+
+    case PROP_MAX:
+      g_value_set_int (value, hildon_range_editor_get_max (editor));
+      break;
+
+    case PROP_SEPARATOR:
+      g_value_set_string (value, hildon_range_editor_get_separator (editor));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+  }
+}
+
 static gboolean
 hildon_range_editor_entry_focus_in (GtkEditable *editable,
                                     GdkEventFocus *event,
@@ -361,8 +507,7 @@ hildon_range_editor_size_request(GtkWidget *widget,
     requisition->width = mreq.width * 2 + lab_req.width +
                          widget->style->xthickness * 2;
     requisition->height = mreq.height + widget->style->ythickness * 2;
-    requisition->height = (requisition->height > lab_req.height) ?
-                           requisition->height : lab_req.height;
+    requisition->height = MAX (requisition->height, lab_req.height);
 }
 
 static void
@@ -466,12 +611,12 @@ hildon_range_editor_entry_keypress(GtkWidget *widget, GdkEventKey *event,
       gtk_widget_grab_focus(wdgt);
       if (widget == priv->start_entry)
       {
-        gtk_editable_set_position(GTK_EDITABLE(priv->end_entry), -1);
+        gtk_editable_set_position(GTK_EDITABLE(wdgt), -1);
         gtk_editable_select_region(GTK_EDITABLE(wdgt), 0, -1);
       }
       else
       {
-        gtk_editable_set_position(GTK_EDITABLE(priv->end_entry), 0);
+        gtk_editable_set_position(GTK_EDITABLE(wdgt), 0);
         gtk_editable_select_region(GTK_EDITABLE(wdgt), -1, 0);
       }
     }
@@ -549,16 +694,8 @@ hildon_range_editor_new (void)
 GtkWidget *
 hildon_range_editor_new_with_separator (gchar *separator)
 {
-    HildonRangeEditor *editor;
-    HildonRangeEditorPrivate *priv;
-
-    editor = g_object_new(HILDON_RANGE_EDITOR_TYPE, NULL);
-    priv = HILDON_RANGE_EDITOR_GET_PRIVATE(editor);
-
-    if (separator)
-      gtk_label_set_text(GTK_LABEL(priv->label), separator);
-
-    return GTK_WIDGET(editor);
+    return GTK_WIDGET (g_object_new (HILDON_RANGE_EDITOR_TYPE,
+                                     "separator", separator, NULL));
 }
 
 
@@ -575,28 +712,11 @@ hildon_range_editor_new_with_separator (gchar *separator)
 void
 hildon_range_editor_set_range (HildonRangeEditor *editor, gint start, gint end)
 {
-    HildonRangeEditorPrivate *priv;
-    gchar start_range[12];
-    gchar end_range[12];
-
-    g_return_if_fail(editor);
-    g_return_if_fail(HILDON_IS_RANGE_EDITOR(editor));
-
-    priv = HILDON_RANGE_EDITOR_GET_PRIVATE(editor);
-
-    if (priv->range_limits_start <= start && priv->range_limits_end >= start)
-      g_sprintf(start_range, "%d", start);
-    else
-      g_sprintf(start_range, "%d", priv->range_limits_start);
-
-    gtk_entry_set_text(GTK_ENTRY(priv->start_entry), start_range);
-    
-    if (priv->range_limits_start <= end && priv->range_limits_end >= end)
-      g_sprintf(end_range, "%d", end);
-    else
-      g_sprintf(end_range, "%d", priv->range_limits_end);
+    g_return_if_fail (editor);
+    g_return_if_fail (HILDON_IS_RANGE_EDITOR (editor));
 
-    gtk_entry_set_text(GTK_ENTRY(priv->end_entry), end_range);
+    hildon_range_editor_set_lower (editor, start);
+    hildon_range_editor_set_higher (editor, end);
 }
 
 
@@ -613,11 +733,12 @@ hildon_range_editor_get_range (HildonRangeEditor *editor, gint *start,
                                gint *end)
 {
     HildonRangeEditorPrivate *priv;
-    g_return_if_fail (HILDON_IS_RANGE_EDITOR(editor) || start || end);
-    priv = HILDON_RANGE_EDITOR_GET_PRIVATE(editor);
+    g_return_if_fail (editor);
+    g_return_if_fail (HILDON_IS_RANGE_EDITOR (editor) || start || end);
+    priv = HILDON_RANGE_EDITOR_GET_PRIVATE (editor);
 
-    *start = g_strtod(GTK_ENTRY(priv->start_entry)->text, NULL);
-    *end = g_strtod(GTK_ENTRY(priv->end_entry)->text, NULL);
+    *start = hildon_range_editor_get_lower (editor);
+    *end = hildon_range_editor_get_higher (editor);
 }
 
 
@@ -639,43 +760,184 @@ void
 hildon_range_editor_set_limits (HildonRangeEditor *editor, gint start,
                                 gint end)
 {
+    hildon_range_editor_set_min (editor, start);
+    hildon_range_editor_set_max (editor, end);
+}
+
+void
+hildon_range_editor_set_lower (HildonRangeEditor *editor, gint value)
+{
     HildonRangeEditorPrivate *priv;
-    gchar start_range[12];
-    gchar end_range[12];
-    gint lenght = 0;
-    gint at, bt;
-    
-    g_return_if_fail(editor);
-    g_return_if_fail(HILDON_IS_RANGE_EDITOR(editor));
+    gchar range[12];
+    g_return_if_fail (editor);
+    g_return_if_fail (HILDON_IS_RANGE_EDITOR (editor));
+    priv = HILDON_RANGE_EDITOR_GET_PRIVATE (editor);
 
-    priv = HILDON_RANGE_EDITOR_GET_PRIVATE(editor);
+    if (priv->range_limits_start <= value && priv->range_limits_end >= value)
+      g_sprintf (range, "%d", value);
+    else
+      g_sprintf (range, "%d", priv->range_limits_start);
+
+    gtk_entry_set_text (GTK_ENTRY (priv->start_entry), range);
+    g_object_notify (G_OBJECT (editor), "lower");
+}
+
+void
+hildon_range_editor_set_higher (HildonRangeEditor *editor, gint value)
+{
+    HildonRangeEditorPrivate *priv;
+    gchar range[12];
+    g_return_if_fail (editor);
+    g_return_if_fail (HILDON_IS_RANGE_EDITOR (editor));
+    priv = HILDON_RANGE_EDITOR_GET_PRIVATE (editor);
+
+    if (priv->range_limits_start <= value && priv->range_limits_end >= value)
+      g_sprintf (range, "%d", value);
+    else
+      g_sprintf (range, "%d", priv->range_limits_end);
 
-    if(start>end)
+    gtk_entry_set_text (GTK_ENTRY (priv->end_entry), range);
+    g_object_notify (G_OBJECT (editor), "higher");
+}
+
+gint
+hildon_range_editor_get_lower (HildonRangeEditor *editor)
+{
+    HildonRangeEditorPrivate *priv;
+    g_return_val_if_fail (editor, 0);
+    g_return_val_if_fail (HILDON_IS_RANGE_EDITOR (editor), 0);
+    priv = HILDON_RANGE_EDITOR_GET_PRIVATE (editor);
+
+    return (gint)g_strtod (GTK_ENTRY (priv->start_entry)->text, NULL);
+}
+
+gint
+hildon_range_editor_get_higher (HildonRangeEditor *editor)
+{
+    HildonRangeEditorPrivate *priv;
+    g_return_val_if_fail (editor, 0);
+    g_return_val_if_fail (HILDON_IS_RANGE_EDITOR (editor), 0);
+    priv = HILDON_RANGE_EDITOR_GET_PRIVATE (editor);
+
+    return (gint)g_strtod (GTK_ENTRY (priv->end_entry)->text, NULL);
+}
+
+void
+hildon_range_editor_set_min (HildonRangeEditor *editor, gint value)
+{
+    HildonRangeEditorPrivate *priv;
+    gchar end_range[12], start_range[12];
+    GtkEntry *start_entry, *end_entry;
+    gint length = 0;
+
+    g_return_if_fail (editor);
+    g_return_if_fail (HILDON_IS_RANGE_EDITOR (editor));
+
+    priv = HILDON_RANGE_EDITOR_GET_PRIVATE (editor);
+
+    g_sprintf (start_range, "%d", value);
+    start_entry = GTK_ENTRY (priv->start_entry);
+
+    if (priv->range_limits_end < value)
+      hildon_range_editor_set_max (editor, value);
+    else
     {
-      gint tmp = start;
-      start = end;
-      end = tmp;
+      g_sprintf (end_range, "%d", priv->range_limits_end);
+      end_entry = GTK_ENTRY (priv->end_entry);
+      length = MAX (strlen (start_range), strlen (end_range));
+
+      gtk_entry_set_width_chars (start_entry, length);
+      gtk_entry_set_max_length (start_entry, length);
+      gtk_entry_set_width_chars (end_entry, length);
+      gtk_entry_set_max_length (end_entry, length);
     }
-    
-    g_sprintf(start_range, "%d", start);
-    g_sprintf(end_range, "%d", end);
-    
-    at = strlen( start_range );
-    bt = strlen( end_range );
-    
-    if (at > bt)
-      lenght = at;
+
+    if (hildon_range_editor_get_lower (editor) < value)
+      gtk_entry_set_text (start_entry, start_range);
+
+    priv->range_limits_start = value;
+    g_object_notify (G_OBJECT (editor), "min");
+}
+
+void
+hildon_range_editor_set_max (HildonRangeEditor *editor, gint value)
+{
+    HildonRangeEditorPrivate *priv;
+    gchar start_range[12], end_range[12];
+    GtkEntry *start_entry, *end_entry;
+    gint length = 0;
+
+    g_return_if_fail (editor);
+    g_return_if_fail (HILDON_IS_RANGE_EDITOR (editor));
+
+    priv = HILDON_RANGE_EDITOR_GET_PRIVATE (editor);
+
+    g_sprintf (end_range, "%d", value);
+    end_entry = GTK_ENTRY (priv->end_entry);
+
+    if (priv->range_limits_start > value)
+      hildon_range_editor_set_min (editor, value);
     else
-      lenght = bt;
-    
-    gtk_entry_set_width_chars(GTK_ENTRY(priv->start_entry), lenght);
-    gtk_entry_set_max_length(GTK_ENTRY(priv->start_entry), lenght);
-    gtk_entry_set_text(GTK_ENTRY(priv->start_entry), start_range);
+    {
+      g_sprintf (start_range, "%d", priv->range_limits_start);
+      start_entry = GTK_ENTRY (priv->start_entry);
+      length = MAX (strlen (end_range), strlen (start_range));
+
+      gtk_entry_set_width_chars (start_entry, length);
+      gtk_entry_set_max_length (start_entry, length);
+      gtk_entry_set_width_chars (end_entry, length);
+      gtk_entry_set_max_length (end_entry, length);
+    }
+
+    if (hildon_range_editor_get_higher (editor) > value)
+      gtk_entry_set_text (end_entry, end_range);
+
+    priv->range_limits_end = value;
+    g_object_notify (G_OBJECT (editor), "max");
+}
+
+gint
+hildon_range_editor_get_min (HildonRangeEditor *editor)
+{
+    HildonRangeEditorPrivate *priv;
+    g_return_val_if_fail (editor, 0);
+    g_return_val_if_fail (HILDON_IS_RANGE_EDITOR (editor), 0);
+    priv = HILDON_RANGE_EDITOR_GET_PRIVATE (editor);
+
+    return priv->range_limits_start;
+}
 
-    gtk_entry_set_width_chars(GTK_ENTRY(priv->end_entry), lenght);
-    gtk_entry_set_max_length(GTK_ENTRY(priv->end_entry), lenght);
-    gtk_entry_set_text(GTK_ENTRY(priv->end_entry), end_range);
+gint
+hildon_range_editor_get_max (HildonRangeEditor *editor)
+{
+    HildonRangeEditorPrivate *priv;
+    g_return_val_if_fail (editor, 0);
+    g_return_val_if_fail (HILDON_IS_RANGE_EDITOR (editor), 0);
+    priv = HILDON_RANGE_EDITOR_GET_PRIVATE (editor);
+
+    return priv->range_limits_end;
+}
+
+void
+hildon_range_editor_set_separator (HildonRangeEditor *editor,
+                                   const gchar *separator)
+{
+    HildonRangeEditorPrivate *priv;
+    g_return_if_fail (editor);
+    g_return_if_fail (HILDON_IS_RANGE_EDITOR (editor));
+    priv = HILDON_RANGE_EDITOR_GET_PRIVATE (editor);
+
+    gtk_label_set_text (GTK_LABEL (priv->label), separator);
+    g_object_notify (G_OBJECT(editor), "separator");
+}
+
+const gchar *
+hildon_range_editor_get_separator (HildonRangeEditor *editor)
+{
+    HildonRangeEditorPrivate *priv;
+    g_return_val_if_fail (editor, 0);
+    g_return_val_if_fail (HILDON_IS_RANGE_EDITOR (editor), 0);
+    priv = HILDON_RANGE_EDITOR_GET_PRIVATE (editor);
 
-    priv->range_limits_start = start;
-    priv->range_limits_end = end;
+    return gtk_label_get_text (GTK_LABEL (priv->label));
 }
index b5a8d05..609e838 100644 (file)
@@ -75,5 +75,17 @@ void hildon_range_editor_get_range(HildonRangeEditor * editor,
 void hildon_range_editor_set_limits(HildonRangeEditor * editor,
                                     gint start, gint end);
 
+void hildon_range_editor_set_lower (HildonRangeEditor *editor, gint value);
+void hildon_range_editor_set_higher (HildonRangeEditor *editor, gint value);
+gint hildon_range_editor_get_lower (HildonRangeEditor *editor);
+gint hildon_range_editor_get_higher (HildonRangeEditor *editor);
+void hildon_range_editor_set_min (HildonRangeEditor *editor, gint value);
+void hildon_range_editor_set_max (HildonRangeEditor *editor, gint value);
+gint hildon_range_editor_get_min (HildonRangeEditor *editor);
+gint hildon_range_editor_get_max (HildonRangeEditor *editor);
+void hildon_range_editor_set_separator (HildonRangeEditor *editor,
+                                        const gchar *separator);
+const gchar *hildon_range_editor_get_separator (HildonRangeEditor *editor);
+
 G_END_DECLS
 #endif
index a697270..527db00 100644 (file)
 
 /* hildon-scroll-area.c
  *
- * The reason why this is not made as a widget:
- *  We can not create a widget which could return the correct child.
- *  (ie. by gtk_bin_get_child)
- *
- * There is a problem with signals. Signals are emited pretty requently
- * and so these handlers are runned pretty often. That has made some problems.
- * There is tons of different situations where the signals are emited
- * and to make a code which works in every situation and does not break
- * any other situation -> pretty crocky.
- *
-*/
-
+ */
 
 #include "hildon-scroll-area.h"
 #include <gtk/gtkscrolledwindow.h>
 #include <gtk/gtkfixed.h>
 #include <gtk/gtkadjustment.h>
 #include <gtk/gtkwidget.h>
-#include <gtk/gtkeventbox.h>
 #include <string.h>
 
-#define DEBUG_TEXT 0
-
-typedef struct {
-    GtkWidget *swouter;
+typedef struct
+  {
     GtkWidget *fixed;
     GtkWidget *swinner;
     GtkWidget *child;
-    GtkWidget *ebox;
 
     GtkAdjustment *outadj;
     GtkAdjustment *inadj;
 
-    gdouble last_value_diff;
-    gdouble last_page_size;
-    gdouble last_upper;
-    gdouble last_value;
-    gdouble out_last_value;
-
-    gint inner_changed:1;
-    gint inner_value_changed:1;
-
-} HildonScrollArea;
-
-
-static void hildon_scroll_area_outer_value_changed(GtkAdjustment *adjustment,
-                                                   HildonScrollArea *sc);
-static void hildon_scroll_area_inner_changed(GtkAdjustment *adjustment,
-                                             HildonScrollArea *sc);
-static void hildon_scroll_area_inner_value_changed(GtkAdjustment *adjustment,
-                                                   HildonScrollArea *sc);
-static gboolean hildon_scroll_area_event_box_press(GtkWidget *ebox,
-                                                   GdkEvent *event,
-                                                   HildonScrollArea *sc);
-static void hildon_scroll_area_size_allocate(GtkWidget *widget,
-                                            GtkAllocation *allocation,
-                                            HildonScrollArea *sc);
-
+  } HildonScrollArea;
+
+
+static void hildon_scroll_area_outer_value_changed (GtkAdjustment *adjustment,
+                                                   HildonScrollArea *sc);
+static void hildon_scroll_area_inner_value_changed (GtkAdjustment *adjustment,
+                                                   HildonScrollArea *sc);
+static void hildon_scroll_area_size_allocate (GtkWidget *widget,
+                                             GtkAllocation *allocation,
+                                             HildonScrollArea *sc);
+static void hildon_scroll_area_child_requisition (GtkWidget *widget,
+                                                 GtkRequisition *req,
+                                                 HildonScrollArea *sc);
+static void hildon_scroll_area_fixed_allocate (GtkWidget *widget,
+                                              GtkAllocation *allocation,
+                                              HildonScrollArea *sc);
+static void hildon_scroll_area_destroy (GtkObject *object,
+                                       HildonScrollArea *sc);
 /**
  * hildon_scroll_area_new:
  * @sw: #GtkWidget - #GtkScrolledWindow
  * @child: #GtkWidget - Child to be place inside the sw
  *
- * This is not a widget. It's a helper function to create
- * hildon specified scrolling method for Device.
+ * This is not a widget. It's a helper function to provide
+ * hildon specified scrolling for applications.
  * Puts and connects the @child to the @sw.
+ * A common situation where the scroll area should be used
+ * might be following.  A view containing @GtkTreeView based widget,
+ * (or any similar widget which has built-in @GtkScrolledWindow support)
+ * and eg. couple buttons.  Normaly @GtkScrolledWindow can not handle
+ * the situation so that the @GtkTreeView built-in support
+ * would work.  The scroll area is connecting this built-in system to
+ * the scrolled window and also noticing the buttons.  To use, one should
+ * create a box to which pack the buttons and the scroll area.
+ * The scroll area then contains the problematic widget eg. the @GtkTreeView.
+ * Then the box should be placed in the @GtkScrolledWindow.
+ * The function is currently assuming that the newly created scroll area
+ * hierarchy is not modified in anyway.  Or if it is, it may lead to
+ * unwanted problems.  Also assumed, that the @child will be packed
+ * to the @sw.
  *
  * Returns: a @GtkFixed
  */
-GtkWidget *hildon_scroll_area_new(GtkWidget *sw, GtkWidget *child)
+GtkWidget *hildon_scroll_area_new (GtkWidget *sw, GtkWidget *child)
 {
-    GtkWidget *swi;
-    GtkWidget *fixed;
-    HildonScrollArea *sc;
-
-    g_return_val_if_fail(GTK_IS_SCROLLED_WINDOW(sw)
-                         && GTK_IS_WIDGET(child), NULL);
-
-    swi = gtk_scrolled_window_new(NULL, NULL);
-    fixed = gtk_fixed_new();
-    sc = g_malloc(sizeof(HildonScrollArea));
-    memset(sc, 0, sizeof(HildonScrollArea));
-
-    sc->ebox = gtk_event_box_new();
-    gtk_widget_set_events(sc->ebox, GDK_BUTTON_PRESS_MASK);
-
-    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(swi),
-                                   GTK_POLICY_NEVER, GTK_POLICY_NEVER);
-
-    gtk_container_add(GTK_CONTAINER(swi), child);
-    gtk_fixed_put(GTK_FIXED(fixed), sc->ebox, 0, 0);
-    gtk_fixed_put(GTK_FIXED(fixed), swi, 0, 0);
-
-    sc->swouter = sw;
-    sc->fixed = fixed;
-    sc->swinner = swi;
-    sc->child = child;
-    sc->outadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw));
-    sc->inadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(swi));
-
-    g_signal_connect(G_OBJECT(sc->outadj), "value_changed",
-                     G_CALLBACK(hildon_scroll_area_outer_value_changed), sc);
-    g_signal_connect(G_OBJECT(sc->inadj), "changed",
-                     G_CALLBACK(hildon_scroll_area_inner_changed), sc);
-    g_signal_connect(G_OBJECT(sc->inadj), "value_changed",
-                     G_CALLBACK(hildon_scroll_area_inner_value_changed), sc);
-    g_signal_connect(G_OBJECT(sc->ebox), "button-press-event",
-                     G_CALLBACK(hildon_scroll_area_event_box_press), sc);
-    g_signal_connect_after(G_OBJECT(sw), "size-allocate",
-                     G_CALLBACK(hildon_scroll_area_size_allocate), sc);
-
-    gtk_widget_show_all(sw);
-    
-    gtk_widget_queue_resize(sw);
-    gtk_widget_queue_draw(sw);
-
-    return fixed;
+  GtkWidget *swi;
+  GtkWidget *fixed;
+  HildonScrollArea *sc;
+
+  g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (sw)
+                       && GTK_IS_WIDGET (child), NULL);
+
+  swi = gtk_scrolled_window_new (NULL, NULL);
+  fixed = gtk_fixed_new ();
+  sc = g_malloc (sizeof (HildonScrollArea));
+  memset (sc, 0, sizeof (HildonScrollArea));
+
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swi),
+                                 GTK_POLICY_NEVER, GTK_POLICY_NEVER);
+
+  gtk_container_add (GTK_CONTAINER (swi), child);
+  gtk_fixed_put (GTK_FIXED (fixed), swi, 0, 0);
+
+  sc->fixed = fixed;
+  sc->swinner = swi;
+  sc->child = child;
+  sc->outadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw));
+  sc->inadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (swi));
+
+  g_signal_connect_after (G_OBJECT (child), "size-request",
+                         G_CALLBACK (hildon_scroll_area_child_requisition), sc);
+
+  g_signal_connect_after (G_OBJECT (sc->outadj), "value_changed",
+                         G_CALLBACK (hildon_scroll_area_outer_value_changed), sc);
+  g_signal_connect_after (G_OBJECT (sc->inadj), "value_changed",
+                         G_CALLBACK (hildon_scroll_area_inner_value_changed), sc);
+
+  g_signal_connect_after (G_OBJECT (sw), "size-allocate",
+                         G_CALLBACK (hildon_scroll_area_size_allocate), sc);
+  g_signal_connect (G_OBJECT (sc->fixed), "size-allocate",
+                   G_CALLBACK (hildon_scroll_area_fixed_allocate), sc);
+  g_signal_connect (G_OBJECT (sw), "destroy",
+                   G_CALLBACK (hildon_scroll_area_destroy), sc);
+
+  gtk_widget_show_all (sw);
+  return fixed;
 }
 
-
-static void hildon_scroll_area_outer_value_changed(GtkAdjustment *adjustment,
-                                                   HildonScrollArea *sc)
+static void hildon_scroll_area_destroy (GtkObject *object,
+                                       HildonScrollArea *sc)
 {
-    if ((adjustment->value + adjustment->page_size) >
-        sc->fixed->allocation.y
-        && (sc->fixed->allocation.y + sc->fixed->allocation.height) >
-        adjustment->value) {
-        /* If the fixed is on the screen, we have to update it */
-        gtk_adjustment_value_changed(sc->inadj);
-    }
+  g_free (sc);
 }
 
-
-static void hildon_scroll_area_inner_changed(GtkAdjustment *adjustment,
-                                             HildonScrollArea *sc)
+static void hildon_scroll_area_fixed_allocate (GtkWidget *widget,
+                                              GtkAllocation *allocation,
+                                              HildonScrollArea *sc)
 {
-    GtkRequisition req;
-    gboolean refress = FALSE;
-    gboolean mid = FALSE;
-
-    if (sc->inner_changed)
-    {
-      #if DEBUG_TEXT
-      g_print("A\n");
-      #endif
-      sc->inner_changed = FALSE;
-      return;
-    }
-
-    /* If child wants less space than we have allocated */
-    gtk_widget_size_request(sc->child, &req);
-    if (req.height < sc->swinner->allocation.height)
-    {
-      #if DEBUG_TEXT
-      g_print("B");
-      #endif
-      adjustment->upper = adjustment->page_size = (gdouble) req.height;
-    }
-
-
-    /* If the amount of content is changed */
-    if (sc->last_upper != adjustment->upper)
-    {
-      #if DEBUG_TEXT
-      g_print("C");
-      #endif
-      if (adjustment->upper < adjustment->page_size)
-      {
-        #if DEBUG_TEXT
-        g_print("D");
-        #endif
-        /* Content is getting smaller than our page -> Shrinking page */
-        adjustment->page_size = adjustment->upper;
-      }
-      sc->last_upper = adjustment->upper;
-      refress = TRUE;
-    }
-
-    /* If the page size is changed */
-    if (sc->last_page_size != adjustment->page_size)
-    {
-      #if DEBUG_TEXT
-      g_print("E");
-      #endif
-        if (sc->outadj->value <= sc->fixed->allocation.y)
-        {
-        #if DEBUG_TEXT
-        g_print("F");
-        #endif
-            /* We are before the start of fixed */
-            adjustment->value = 0;
-            adjustment->page_size = sc->outadj->page_size -
-                (sc->fixed->allocation.y - sc->outadj->value);
-
-            if ((sc->fixed->allocation.y + sc->fixed->allocation.height) <
-                (sc->outadj->value + sc->outadj->page_size))
-            {
-              #if DEBUG_TEXT
-              g_print("G");
-              #endif
-                /* The fixed is at the center of screen */
-                mid = TRUE;
-            }
-        }
-        else if (sc->outadj->value >= sc->fixed->allocation.y)
-        {
-          #if DEBUG_TEXT
-          g_print("H");
-          #endif
-            if ((sc->fixed->allocation.y + sc->fixed->allocation.height) <
-                (sc->outadj->value + sc->outadj->page_size) &&
-                (adjustment->page_size - sc->last_page_size) <
-                MAX(sc->last_value_diff, 0))
-            {
-              #if DEBUG_TEXT
-              g_print("I");
-              #endif
-                /* We are over the end of fixed */
-                adjustment->value =
-                    sc->outadj->value - sc->fixed->allocation.y;
-                adjustment->page_size =
-                    (sc->fixed->allocation.y +
-                     sc->fixed->allocation.height) - sc->outadj->value;
-            }
-            else
-            {
-              #if DEBUG_TEXT
-              g_print("J");
-              #endif
-                /* We are wondering to the middle (This should happen only 
-                   when "getting IN" to the fixed) */
-                adjustment->value =
-                    sc->outadj->value - sc->fixed->allocation.y;
-                adjustment->page_size = sc->outadj->page_size;
-            }
-        }
-        refress = TRUE;
-        sc->last_page_size = adjustment->page_size;
-    }
-
-
-    /* Last time checks ->
-       Yes, system is working so randomly that this is needed
-       This is a hack in a way.. But so it shall be. */
-    if (adjustment->page_size > adjustment->upper)
-    {
-      #if DEBUG_TEXT
-      g_print("K");
-      #endif
-      adjustment->page_size = adjustment->upper;
-    }
-
-    /* If we made changes -> Refress */
-    if (refress)
-    {
-        gint new_width;
-        #if DEBUG_TEXT
-        g_print("L");
-        #endif
-        sc->inner_changed = TRUE;
-
-        if (sc->swinner->allocation.width <= sc->fixed->allocation.width &&
-            sc->fixed->allocation.width != 1)
-        {
-          #if DEBUG_TEXT
-          g_print("M");
-          #endif
-            new_width = sc->fixed->allocation.width;
-            if( !GTK_WIDGET_REALIZED(sc->swinner) )
-              gtk_widget_realize(sc->swinner);
-        }
-        else
-            new_width = -1;
-
-        if (adjustment->page_size <= 0)
-        {
-          #if DEBUG_TEXT
-          g_print("N");
-          #endif
-            gtk_widget_set_size_request(sc->swinner, new_width, -1);
-        }
-        else if( mid )
-        {
-            gtk_widget_set_size_request( sc->swinner, new_width,
-                                         sc->fixed->allocation.height );
-        }
-        else
-        {
-          #if DEBUG_TEXT
-          g_print("O");
-          #endif
-            gtk_widget_set_size_request(sc->swinner, new_width,
-                                        (gint) adjustment->page_size);
-        }
-
-        if (adjustment->upper <= 0)
-        {
-          #if DEBUG_TEXT
-          g_print("P");
-          #endif
-            gtk_widget_set_size_request(sc->fixed, -1, -1);
-        }
-        else
-            gtk_widget_set_size_request(sc->fixed, -1,
-                                        (gint) adjustment->upper);
-
-        if (mid)
-        {
-          #if DEBUG_TEXT
-          g_print("Q");
-          #endif
-            gtk_widget_set_size_request(sc->ebox, new_width,
-                                        sc->fixed->allocation.height);
-        }
-
-        gtk_adjustment_changed(adjustment);
-        gtk_adjustment_value_changed(adjustment);
-    }
-  #if DEBUG_TEXT
-  g_print("\n");
-  #endif
+  gtk_widget_set_size_request (sc->swinner, -1,
+                              MIN (sc->outadj->page_size, allocation->height));
 }
 
-
-static void hildon_scroll_area_inner_value_changed(GtkAdjustment *adjustment,
-                                                   HildonScrollArea *sc)
+static void hildon_scroll_area_child_requisition (GtkWidget *widget,
+                                                 GtkRequisition *req,
+                                                 HildonScrollArea *sc)
 {
-    gboolean refress = FALSE;
-
-    if (sc->inner_value_changed)
-    {
-        #if DEBUG_TEXT
-        g_print("1\n");
-        #endif
-        sc->inner_value_changed = FALSE;
-        return;
-    }
-
-    if (sc->out_last_value != sc->outadj->value)
-    {
-        #if DEBUG_TEXT
-        g_print("2");
-        #endif
-        /* Mouse movement comes here */
-        if (sc->outadj->value < sc->fixed->allocation.y)
-        {
-          #if DEBUG_TEXT
-          g_print("3");
-          #endif
-            /* We are before the top of fixed-> The value is 0 every time
-               But we may have to update the page size */
-            adjustment->value = 0;
-            if ((sc->outadj->value + sc->outadj->page_size) <
-                (sc->fixed->allocation.y + sc->fixed->allocation.height))
-            {
-              #if DEBUG_TEXT
-              g_print("4");
-              #endif
-
-                if ((sc->outadj->value + sc->outadj->page_size) <
-                    (sc->fixed->allocation.y))
-                {
-                  #if DEBUG_TEXT
-                  g_print("5");
-                  #endif
-                    /* The fixed is not on the screen -> go get it boy! */
-                    sc->outadj->value = sc->fixed->allocation.y +
-                        adjustment->value;
-                }
-
-
-                /* The top of fixed is positioned on the screen We have to 
-                   change the page size */
-                adjustment->page_size = sc->outadj->page_size -
-                    (sc->fixed->allocation.y - sc->outadj->value);
-            }
-            else
-            {
-              #if DEBUG_TEXT
-              g_print("6");
-              #endif
-                /* The fixed is small and it fits
-                   complitely on the screen */
-                adjustment->page_size = sc->outadj->page_size -
-                    ((sc->fixed->allocation.y - sc->outadj->value) +
-                     ((sc->outadj->value + sc->outadj->page_size) -
-                      (sc->fixed->allocation.y +
-                       sc->fixed->allocation.height)));
-            }
-        }
-        else if ((sc->outadj->value + sc->outadj->page_size) >
-                   (sc->fixed->allocation.y +
-                    sc->fixed->allocation.height))
-        {
-          #if DEBUG_TEXT
-          g_print("7");
-          #endif
-            if ((sc->outadj->value) >
-                (sc->fixed->allocation.y + sc->fixed->allocation.height))
-            {
-              #if DEBUG_TEXT
-              g_print("8");
-              #endif
-                /* The fixed is not on the screen */
-                sc->outadj->value = sc->fixed->allocation.y +
-                    adjustment->value;
-            }
-
+  gint new_req = MAX (req->height, sc->fixed->allocation.height);
+  gtk_widget_set_size_request (sc->fixed, -1, req->height);
+  gtk_widget_set_size_request (sc->swinner, -1,
+                              MIN (sc->outadj->page_size, new_req));
+}
 
-            /* We are after the bottom of fixed-> We have to change the
-               values */
-            adjustment->page_size =
-                (sc->fixed->allocation.y + sc->fixed->allocation.height) -
-                sc->outadj->value;
-            adjustment->value =
-                sc->fixed->allocation.height - adjustment->page_size;
-        }
-        else
-        {
-          #if DEBUG_TEXT
-          g_print("9");
-          #endif
-            /* We are at the center of fixed -> The page_size is always
-               same as the outers one */
-            adjustment->page_size = sc->outadj->page_size;
-            adjustment->value =
-                sc->outadj->value - sc->fixed->allocation.y;
-        }
-        sc->last_value = adjustment->value;
-        refress = TRUE;
-    }
+static void hildon_scroll_area_outer_value_changed (GtkAdjustment *adjustment,
+                                                    HildonScrollArea *sc)
+{
+  GtkRequisition req;
+  gtk_widget_size_request (sc->child, &req);
 
-    if (sc->last_value != adjustment->value)
+  if ((sc->outadj->value + sc->outadj->page_size) > sc->fixed->allocation.y
+      && sc->outadj->value <
+      (sc->fixed->allocation.y + req.height))
     {
-        #if DEBUG_TEXT
-        g_print("-10-");
-        #endif
-        /* We have changed from the last time */
-        if (adjustment->upper > sc->outadj->page_size)
-        {
-          #if DEBUG_TEXT
-          g_print("-11-");
-          #endif
-            /* If amount of content is greater than the page size, it will
-               be informed here. */
-            if (adjustment->page_size != sc->outadj->page_size)
-            {
-              #if DEBUG_TEXT
-              g_print("-12-");
-              #endif
-                if (sc->outadj->value < sc->fixed->allocation.y)
-                {
-                  #if DEBUG_TEXT
-                  g_print("-13-");
-                  #endif
-                    /* We are over the top of fixed */
-                    sc->outadj->value +=
-                        adjustment->value - sc->last_value;
-                    adjustment->page_size +=
-                        adjustment->value - sc->last_value;
-
-                    if (adjustment->page_size > sc->outadj->page_size)
-                    {
-                      #if DEBUG_TEXT
-                      g_print("-14-");
-                      #endif
-                      /* We see top of the widget, and keypress is asking
-                         to move out from the screen -> changing values. */
-                        adjustment->value = adjustment->page_size -
-                            sc->outadj->page_size;
-                        sc->outadj->value = sc->fixed->allocation.y +
-                            adjustment->value;
-                        adjustment->page_size = sc->outadj->page_size;
-                    }
-                    else
-                        adjustment->value = 0;
+      gdouble new_pos = 0;
 
-                }
-                else if ((sc->outadj->value + sc->outadj->page_size) >
-                           (sc->fixed->allocation.y +
-                            sc->fixed->allocation.height))
-                {
-                  #if DEBUG_TEXT
-                  g_print("-15-");
-                  #endif
-                    /* The bottom of fixed is on the screen */
-                    if (adjustment->value < sc->last_value)
-                    {
-                      #if DEBUG_TEXT
-                      g_print("-16-");
-                      #endif
-                        adjustment->page_size +=
-                            sc->last_value - adjustment->value;
-                        sc->outadj->value +=
-                            adjustment->value - sc->last_value;
-                    }
-                    else
-                    {
-                        adjustment->page_size = sc->outadj->page_size -
-                            ((sc->outadj->value + sc->outadj->page_size) -
-                             (sc->fixed->allocation.y +
-                              adjustment->upper));
+      new_pos = MAX (sc->outadj->value - sc->fixed->allocation.y, 0);
+      new_pos = MIN (new_pos,
+                    req.height - sc->inadj->page_size);
+      new_pos = MAX (new_pos, 0);
 
-
-                        if (adjustment->page_size >
-                            sc->outadj->page_size)
-                        {
-                          #if DEBUG_TEXT
-                          g_print("-17-");
-                          #endif
-                            sc->outadj->value +=
-                                adjustment->page_size -
-                                sc->outadj->page_size;
-                            adjustment->page_size = sc->outadj->page_size;
-                        }
-                        sc->last_page_size = adjustment->page_size;
-                        adjustment->value = sc->outadj->value -
-                            sc->fixed->allocation.y;
-                    }
-
-                    if (adjustment->page_size > sc->outadj->page_size)
-                    {
-                      #if DEBUG_TEXT
-                      g_print("-18-");
-                      #endif
-                        /* We went to the middle of fixed(?) */
-                        adjustment->page_size +=
-                            adjustment->value - sc->last_value;
-                        sc->outadj->value = sc->fixed->allocation.y +
-                            adjustment->value;
-                        adjustment->value =
-                            (sc->outadj->value - sc->fixed->allocation.y);
-
-                        adjustment->page_size = sc->outadj->page_size;
-                    }
-                }
-                else
-                {
-                  #if DEBUG_TEXT
-                  g_print("-19-");
-                  #endif
-                    /* We are in the center now */
-                    sc->outadj->value = sc->fixed->allocation.y +
-                        adjustment->value;
-                    adjustment->page_size = sc->outadj->page_size;
-                }
-            }
-            else
-            {
-              #if DEBUG_TEXT
-              g_print("-20-");
-              #endif
-                sc->outadj->value += adjustment->value - sc->last_value;
-            }
-            refress = TRUE;
-        }
-        else
-        {
-          #if DEBUG_TEXT
-          g_print("-21-");
-          #endif
-            if ((sc->outadj->value + sc->outadj->page_size) >
-                (sc->fixed->allocation.y + sc->fixed->allocation.height))
-            {
-              #if DEBUG_TEXT
-              g_print("-22-");
-              #endif
-                /* We are not going over the screen, from the bottom. */
-                if (sc->outadj->value < sc->fixed->allocation.y)
-                {
-                  #if DEBUG_TEXT
-                  g_print("-23-");
-                  #endif
-                    /* Whole fixed is inside the screen borders. -> We
-                       allocate some more space */
-                    sc->outadj->value +=
-                        adjustment->value - sc->last_value;
-                    adjustment->page_size += adjustment->value;
-                    adjustment->value = 0;
-                }
-                else
-                {
-                  #if DEBUG_TEXT
-                  g_print("-24-");
-                  #endif
-                    /* The fixed is at the top of screen, partly visible,
-                       partly out of the screen */
-                    sc->outadj->value += adjustment->value - sc->last_value;
-                    adjustment->page_size += sc->last_value - adjustment->value;
-                }
-                refress = TRUE;
-            }
-            else
-            {    /* We are going over the screen from the bottom */
-              #if DEBUG_TEXT
-              g_print("-25-");
-              #endif
-                if (sc->outadj->value < sc->fixed->allocation.y)
-                {
-                  #if DEBUG_TEXT
-                  g_print("-26-");
-                  #endif
-                    /* Top is not going over */
-                    sc->outadj->value += adjustment->value - sc->last_value;
-                    adjustment->page_size += adjustment->value;
-                    adjustment->value = 0;
-                    refress = TRUE;
-                }
-            }
-        }
-        sc->last_value_diff = adjustment->value - sc->last_value;
-        sc->last_value = adjustment->value;
-    }
-
-    if (refress)
-    {
-      #if DEBUG_TEXT
-      g_print("-27-");
-      #endif
-        sc->out_last_value = sc->outadj->value;
-        gtk_fixed_move(GTK_FIXED(sc->fixed), sc->swinner, 0,
-                       adjustment->value);
-
-        gtk_adjustment_changed(adjustment);
-        sc->inner_value_changed = TRUE;
-        gtk_adjustment_value_changed(adjustment);
+      gtk_fixed_move (GTK_FIXED (sc->fixed), sc->swinner, 0, new_pos);
+      gtk_adjustment_set_value (sc->inadj, new_pos);
     }
-#if DEBUG_TEXT
-g_print("-27-");
-#endif
 }
 
-static gboolean hildon_scroll_area_event_box_press(GtkWidget *ebox,
-                                                   GdkEvent *event,
-                                                   HildonScrollArea *sc)
+static void hildon_scroll_area_inner_value_changed (GtkAdjustment *adjustment,
+                                                   HildonScrollArea *sc)
 {
-    gtk_widget_grab_focus(sc->child);
-    return FALSE;
+  if (sc->outadj->value != sc->fixed->allocation.y + adjustment->value)
+    gtk_adjustment_set_value (sc->outadj,
+                             sc->fixed->allocation.y + adjustment->value);
 }
 
-static void hildon_scroll_area_size_allocate(GtkWidget *widget,
-                                            GtkAllocation *allocation,
-                                            HildonScrollArea *sc)
+static void hildon_scroll_area_size_allocate (GtkWidget *widget,
+                                             GtkAllocation *allocation,
+                                             HildonScrollArea *sc)
 {
-  g_signal_handlers_disconnect_by_func(widget, 
-                                       (void*)hildon_scroll_area_size_allocate,
-                                       sc );
-  gtk_widget_set_size_request(sc->child, sc->fixed->allocation.width, -1);
+  g_signal_handlers_disconnect_by_func (widget,
+                                       (void*)hildon_scroll_area_size_allocate,
+                                       sc);
+  gtk_widget_set_size_request (sc->child, sc->fixed->allocation.width, -1);
 }
-
diff --git a/hildon-widgets/hildon-search.c b/hildon-widgets/hildon-search.c
deleted file mode 100644 (file)
index 5ed5e55..0000000
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005 Nokia Corporation.
- *
- * Contact: Luc Pionchon <luc.pionchon@nokia.com>
- *
- * 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
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "hildon-search.h"
-
-#include <gtk/gtkimage.h>
-#include <gtk/gtkiconfactory.h>
-#include <gtk/gtkstock.h>
-#include <hildon-widgets/hildon-defines.h>
-
-#include <libintl.h>
-
-#define _(String) dgettext(PACKAGE, String)
-
-#define SEARCH_FIELD_HEIGHT 54
-#define SEARCH_CHILD_HEIGHT 30
-
-#define SEARCH_ICON_WIDTH  30   /* search stock icon size */
-#define SEARCH_ICON_HEIGHT 30
-#define SEARCH_ICON_RB 12
-#define SEARCH_ICON_TB 0
-
-#define SEARCH_TOP_BORDER    12
-#define SEARCH_BOTTOM_BORDER 12
-#define SEARCH_LEFT_BORDER   20
-#define SEARCH_RIGHT_BORDER  20
-
-#define HILDON_SEARCH_GET_PRIVATE(obj) \
-    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
-     HILDON_TYPE_SEARCH, HildonSearchPrivate));
-
-typedef struct _HildonSearchPrivate HildonSearchPrivate;
-
-static void hildon_search_class_init(HildonSearchClass * class);
-static void hildon_search_init(HildonSearch * search);
-static void hildon_search_forall(GtkContainer * container,
-                                 gboolean include_internals,
-                                 GtkCallback callback,
-                                 gpointer callback_data);
-static gboolean hildon_search_expose(GtkWidget * widget,
-                                     GdkEventExpose * event);
-static void hildon_search_size_request(GtkWidget * widget,
-                                       GtkRequisition * requisition);
-static void hildon_search_size_allocate(GtkWidget * widget,
-                                        GtkAllocation * allocation);
-static void hildon_search_finalize(GObject * object);
-static void hildon_search_destroy(GtkObject * object);
-static void
-hildon_search_set_property(GObject * object, guint property_id,
-                           const GValue * value, GParamSpec * pspec);
-static void
-hildon_search_get_property(GObject * object, guint property_id,
-                           GValue * value, GParamSpec * pspec);
-
-static GtkBinClass *parent_class = NULL;
-
-enum {
-    PROP_ICON_NAME = 1
-};
-
-struct _HildonSearchPrivate {
-    GtkWidget *image;
-    gchar *icon_name;
-};
-
-GType hildon_search_get_type(void)
-{
-    static GType hildon_search_type = 0;
-
-    if (!hildon_search_type) {
-        static const GTypeInfo hildon_search_info = {
-            sizeof(HildonSearchClass),
-            NULL,       /* base_init */
-            NULL,       /* base_finalize */
-            (GClassInitFunc) hildon_search_class_init,
-            NULL,       /* class_finalize */
-            NULL,       /* class_data */
-            sizeof(HildonSearch),
-            0,  /* n_preallocs */
-            (GInstanceInitFunc) hildon_search_init,
-            NULL,       /* value_table */
-        };
-
-        hildon_search_type = g_type_register_static(GTK_TYPE_BIN,
-                                                    "HildonSearch",
-                                                    &hildon_search_info,
-                                                    0);
-    }
-
-    return hildon_search_type;
-}
-
-/* private functions */
-static void hildon_search_class_init(HildonSearchClass * class)
-{
-    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(class);
-    GtkContainerClass *container_class = GTK_CONTAINER_CLASS(class);
-    GObjectClass *object_class = G_OBJECT_CLASS(class);
-
-    g_type_class_add_private(class, sizeof(HildonSearchPrivate));
-
-    parent_class = g_type_class_peek_parent(class);
-
-    object_class->finalize = hildon_search_finalize;
-    object_class->set_property = hildon_search_set_property;
-    object_class->get_property = hildon_search_get_property;
-    widget_class->expose_event = hildon_search_expose;
-    widget_class->size_request = hildon_search_size_request;
-    widget_class->size_allocate = hildon_search_size_allocate;
-    GTK_OBJECT_CLASS(class)->destroy = hildon_search_destroy;
-    container_class->forall = hildon_search_forall;
-
-    g_object_class_install_property(object_class, PROP_ICON_NAME,
-        g_param_spec_string("stock-icon-name",
-                            "Stock icon Name",
-                            "Set the stock icon name",
-                            NULL,
-                            G_PARAM_READWRITE));
-}
-
-static void
-hildon_search_set_property(GObject * object, guint property_id,
-                           const GValue * value, GParamSpec * pspec)
-{
-    HildonSearchPrivate *priv = HILDON_SEARCH_GET_PRIVATE(object);
-
-    switch (property_id) {
-    case PROP_ICON_NAME:
-    {
-        const gchar *image_text;
-
-        g_free(priv->icon_name);
-
-        /* This can be NULL in the first time */
-        if (priv->image) {        
-          gtk_widget_unparent(priv->image);
-        }
-
-        image_text = g_value_get_string(value);
-        if (!image_text)
-          image_text = GTK_STOCK_FIND;
-
-        priv->icon_name = g_strdup(image_text);
-        priv->image = gtk_image_new_from_stock(priv->icon_name,
-                                               HILDON_ICON_SIZE_WIDG);
-        gtk_widget_set_parent(priv->image, GTK_WIDGET(object));
-        gtk_widget_show(priv->image);
-    }
-        break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
-        break;
-    }
-}
-
-
-static void
-hildon_search_get_property(GObject * object, guint property_id,
-                           GValue * value, GParamSpec * pspec)
-{
-    HildonSearchPrivate *priv = HILDON_SEARCH_GET_PRIVATE(object);
-
-    switch (property_id) {
-    case PROP_ICON_NAME:
-        g_value_set_string(value, priv->icon_name);
-        break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
-        break;
-    }
-}
-
-static void hildon_search_init(HildonSearch * search)
-{
-    HildonSearchPrivate *priv = HILDON_SEARCH_GET_PRIVATE(search);
-
-    priv->image = NULL;
-    priv->icon_name = NULL;
-}
-
-static void hildon_search_finalize(GObject * object)
-{
-    HildonSearchPrivate *priv = HILDON_SEARCH_GET_PRIVATE(object);
-
-    if (priv->icon_name) {
-        g_free(priv->icon_name);
-    }
-    if (G_OBJECT_CLASS(parent_class)->finalize) {
-        G_OBJECT_CLASS(parent_class)->finalize(object);
-    }
-}
-
-static void hildon_search_destroy(GtkObject * object)
-{
-    HildonSearchPrivate *priv = HILDON_SEARCH_GET_PRIVATE(object);
-
-    if (priv->image) {
-        gtk_widget_unparent(priv->image);
-        priv->image = NULL;
-    }
-}
-
-/**
- * hildon_search_new:
- * @image : Name of the stock icon or NULL to be used 
- * as the optional icon in the Search dialog.
- * 
- * Creates a new Search widget without or with the optional image 
- * left of the search widget.
- * 
- * Return value: #GtkWidget pointer of #HildonSearch widget.
- */
-GtkWidget *hildon_search_new(const gchar * stockicon)
-{
-    HildonSearch *search = g_object_new(HILDON_TYPE_SEARCH,
-                                        "stock-icon-name", stockicon,
-                                        NULL);
-
-    return GTK_WIDGET(search);
-}
-
-static void hildon_search_forall(GtkContainer * container,
-                                 gboolean include_internals,
-                                 GtkCallback callback,
-                                 gpointer callback_data)
-{
-    GtkBin *bin = GTK_BIN(container);
-    HildonSearch *search = HILDON_SEARCH(container);
-    HildonSearchPrivate *priv = HILDON_SEARCH_GET_PRIVATE(search);
-
-    if (bin->child) {
-        (*callback) (bin->child, callback_data);
-    }
-
-    if (include_internals) {
-      (*callback) (priv->image, callback_data);
-    }
-}
-
-
-/**
- * hildon_search_set_image_stock:
- * @search: A pointer of #HildonSearch widget to work on
- * @stock_icon: Name of a stock icon to use as the optional image 
- * in the Search widget. This will change the previous one if it is set.
- *
- * Sets or changes the optional image left of the Search widget.
- */
-void hildon_search_set_image_stock(HildonSearch * search,
-                                   const gchar * stock_icon)
-{
-    g_return_if_fail(HILDON_IS_SEARCH(search));
-
-    g_object_set(search, "stock-icon-name", stock_icon, NULL);
-}
-
-static gboolean hildon_search_expose(GtkWidget * widget,
-                                     GdkEventExpose * event)
-{
-    if (GTK_WIDGET_DRAWABLE(widget)) {
-        gint x, y, width, height;
-
-        x = widget->allocation.x;
-        y = widget->allocation.y;
-        width = widget->allocation.width;
-        height = widget->allocation.height;
-
-        gtk_paint_box(widget->style, widget->window,
-                      GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
-                      NULL, widget, "search", x, y, width, height);
-
-        (*GTK_WIDGET_CLASS(parent_class)->expose_event) (widget, event);
-    }
-    return FALSE;
-}
-
-static void hildon_search_size_request(GtkWidget * widget,
-                                       GtkRequisition * requisition)
-{
-    HildonSearch *search;
-    HildonSearchPrivate *priv;
-    GtkBin *bin;
-    GtkRequisition child_requisition;
-
-    search = HILDON_SEARCH(widget);
-    bin = GTK_BIN(search);
-    priv = HILDON_SEARCH_GET_PRIVATE(search);
-
-    requisition->width = GTK_CONTAINER(search)->border_width * 2;
-    requisition->height = GTK_CONTAINER(search)->border_width * 2;
-
-    gtk_widget_size_request(priv->image, &child_requisition);
-
-    if (bin->child && GTK_WIDGET_VISIBLE(bin->child)) {
-        gtk_widget_size_request(bin->child, &child_requisition);
-        requisition->width += child_requisition.width;
-    }
-
-    requisition->width += SEARCH_LEFT_BORDER + SEARCH_RIGHT_BORDER +
-        SEARCH_ICON_WIDTH + SEARCH_ICON_RB;
-    requisition->height += SEARCH_CHILD_HEIGHT +
-        SEARCH_TOP_BORDER + SEARCH_BOTTOM_BORDER;
-}
-
-static void hildon_search_size_allocate(GtkWidget * widget,
-                                        GtkAllocation * allocation)
-{
-    HildonSearch *search;
-    HildonSearchPrivate *priv;
-    GtkBin *bin;
-    GtkAllocation child_allocation;
-
-    widget->allocation = *allocation;
-
-    if (widget->allocation.height > SEARCH_FIELD_HEIGHT)
-    {
-      widget->allocation.y += (widget->allocation.height - SEARCH_FIELD_HEIGHT) / 2;
-      widget->allocation.height = SEARCH_FIELD_HEIGHT;
-    }
-
-    search = HILDON_SEARCH(widget);
-    bin = GTK_BIN(search);
-    priv = HILDON_SEARCH_GET_PRIVATE(search);
-
-    child_allocation.x = widget->allocation.x + SEARCH_LEFT_BORDER;
-    child_allocation.y = widget->allocation.y + SEARCH_TOP_BORDER;
-    child_allocation.width = SEARCH_ICON_WIDTH;
-    child_allocation.height = SEARCH_ICON_HEIGHT;
-
-    gtk_widget_size_allocate(priv->image, &child_allocation);
-
-    if (bin->child && GTK_WIDGET_VISIBLE(bin->child)) {
-        child_allocation.x = widget->allocation.x + SEARCH_LEFT_BORDER +
-            SEARCH_ICON_WIDTH + SEARCH_ICON_RB;
-        child_allocation.y = widget->allocation.y + SEARCH_TOP_BORDER;
-        child_allocation.width = MAX(1, (gint) widget->allocation.width -
-                                     (SEARCH_LEFT_BORDER +
-                                      SEARCH_RIGHT_BORDER +
-                                      SEARCH_ICON_WIDTH + SEARCH_ICON_RB));
-        child_allocation.height =
-            MAX(1,
-                (gint) widget->allocation.height - (SEARCH_TOP_BORDER +
-                                             SEARCH_BOTTOM_BORDER));
-
-        gtk_widget_size_allocate(bin->child, &child_allocation);
-    }
-}
diff --git a/hildon-widgets/hildon-search.h b/hildon-widgets/hildon-search.h
deleted file mode 100644 (file)
index 2bd1920..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005 Nokia Corporation.
- *
- * Contact: Luc Pionchon <luc.pionchon@nokia.com>
- *
- * 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
- *
- */
-#ifndef __HILDON_SEARCH_H__
-#define __HILDON_SEARCH_H__
-
-#include <gdk/gdk.h>
-#include <gtk/gtkbin.h>
-
-G_BEGIN_DECLS
-#define HILDON_TYPE_SEARCH (hildon_search_get_type ())
-#define HILDON_SEARCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
-        HILDON_TYPE_SEARCH, HildonSearch))
-#define HILDON_SEARCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
-        HILDON_TYPE_SEARCH, HildonSearchClass))
-#define HILDON_IS_SEARCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
-        HILDON_TYPE_SEARCH))
-#define HILDON_IS_SEARCH_CLASS(klass)(G_TYPE_CHECK_CLASS_TYPE ((klass),\
-        HILDON_TYPE_SEARCH))
-#define HILDON_SEARCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
-        HILDON_TYPE_SEARCH, HildonSearchClass))
-/**
- * HildonSearch:
- * 
- * Contains only private data.
- */
-typedef struct _HildonSearch HildonSearch;
-typedef struct _HildonSearchClass HildonSearchClass;
-
-
-struct _HildonSearch {
-    GtkBin bin;
-};
-
-struct _HildonSearchClass {
-    GtkBinClass parent_class;
-};
-
-
-GType hildon_search_get_type(void);
-GtkWidget *hildon_search_new(const gchar * image);
-void hildon_search_set_image_stock(HildonSearch * search,
-                                   const gchar * stock_icon);
-
-G_END_DECLS
-#endif /* __HILDON_SEARCH_H__ */
index 71b4f75..39c39eb 100644 (file)
@@ -252,14 +252,14 @@ static void
 hildon_seekbar_set_property(GObject * object, guint prop_id,
                             const GValue * value, GParamSpec * pspec)
 {
-    GtkRange *range = GTK_RANGE(object);
+    HildonSeekbar *seekbar = HILDON_SEEKBAR(object);
 
     switch (prop_id) {
     case PROP_TOTAL_TIME:
-        range->adjustment->upper = g_value_get_double(value);
+        hildon_seekbar_set_total_time(seekbar, g_value_get_double(value));
         break;
     case PROP_POSITION:
-        range->adjustment->value = g_value_get_double(value);
+        hildon_seekbar_set_position(seekbar, g_value_get_double(value));
         break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
@@ -360,9 +360,16 @@ void hildon_seekbar_set_total_time(HildonSeekbar *seekbar, gint time)
         hildon_seekbar_set_fraction(seekbar,
                                     MIN(hildon_seekbar_get_fraction(seekbar),
                                         time));
+
+        g_object_freeze_notify (G_OBJECT(seekbar));
+
         hildon_seekbar_set_position(seekbar,
                                     MIN(hildon_seekbar_get_position(seekbar),
                                         time));
+
+        g_object_notify(G_OBJECT (seekbar), "total-time");
+
+        g_object_thaw_notify (G_OBJECT(seekbar));
     }
 }
 
@@ -458,6 +465,8 @@ void hildon_seekbar_set_position(HildonSeekbar *seekbar, gint time)
       if (value <= osso_gtk_range_get_stream_position (range)) {
         adj->value = value;
         gtk_adjustment_value_changed(adj);
+
+        g_object_notify(G_OBJECT(seekbar), "position");
       }
     }
 }
index 1cc4299..da5b0bd 100644 (file)
  *   @desc: Set Password Dialog is used to define a password, or change a
  *   password that cannot be removed.
  *   @seealso: #HildonGetPasswordDialog
+ *
  */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtksignal.h>
+
 #include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+#include <glib.h>
+
+#include <errno.h>
 #include <string.h>
+#include <strings.h>
+#include <unistd.h>
+#include <stdio.h>
 
 #include <hildon-widgets/hildon-caption.h>
 #include <hildon-widgets/gtk-infoprint.h>
-#include "hildon-set-password-dialog.h"
-#include "hildon-note.h"
+#include <hildon-widgets/hildon-set-password-dialog.h>
+#include <hildon-widgets/hildon-note.h>
+#include <hildon-widgets/hildon-defines.h>
 
 #include <libintl.h>
 #define _(String) dgettext(PACKAGE, String)
@@ -76,19 +81,13 @@ hildon_set_password_dialog_class_init(HildonSetPasswordDialogClass *
 static void hildon_set_password_dialog_init(HildonSetPasswordDialog *
                                             dialog);
 static void hildon_checbox_toggled(GtkWidget * widget, gpointer data);
+
 static void
 hildon_set_password_response_change(GtkDialog * d, gint arg1,
                                     GtkWindow * parent);
 static void
 hildon_set_password_response_set(GtkDialog * d, gint arg1,
                                  GtkWindow * parent);
-static gboolean
-hildon_set_password_dialog_released(GtkWidget * widget,
-                                    GdkEventButton * event,
-                                    gpointer user_data);
-static gboolean
-hildon_set_password_dialog_keypress(GtkWidget * widget,
-                                    GdkEventKey * event, gpointer data);
 
 static GObject *
 hildon_set_password_dialog_constructor(GType type,
@@ -107,18 +106,20 @@ static void hildon_set_password_get_property(GObject * object,
 
 struct _HildonSetPasswordDialogPrivate {
     /* Checkbox tab */
-    GtkWidget *caption;
+    GtkWidget *checkboxCaption;
     GtkWidget *checkbox;
 
+    GtkLabel *domainLabel;
+
     /* Tab one */
-    GtkWidget *entry1;
-    GtkWidget *caption1;
-    gchar *caption1_string;
+    GtkWidget *pwd1stEntry;
+    GtkWidget *pwd1stCaption;
+    gchar *pwd1stCaption_string;
 
     /* Tab two */
-    GtkWidget *entry2;
-    GtkWidget *caption2;
-    gchar *caption2_string;
+    GtkWidget *pwd2ndEntry;
+    GtkWidget *pwd2ndCaption;
+    gchar *pwd2ndCaption_string;
 
     /* OK/Cancel buttons */
     GtkWidget *okButton;
@@ -130,6 +131,7 @@ struct _HildonSetPasswordDialogPrivate {
 
 enum {
     PROP_NONE = 0,
+    PROP_DOMAIN,
     PROP_PASSWORD,
     PROP_HILDON_PASSWORD_DIALOG
 };
@@ -146,8 +148,11 @@ hildon_set_password_set_property(GObject * object,
     priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
     
     switch (prop_id) {
+    case PROP_DOMAIN:
+        gtk_label_set_text(priv->domainLabel, g_value_get_string(value));
+       break;
     case PROP_PASSWORD:
-        gtk_entry_set_text(GTK_ENTRY(priv->entry1), g_value_get_string(value));
+        gtk_entry_set_text(GTK_ENTRY(priv->pwd1stEntry), g_value_get_string(value));
         break;
     case PROP_HILDON_PASSWORD_DIALOG:
         priv->protection = g_value_get_boolean(value);
@@ -170,8 +175,11 @@ hildon_set_password_get_property(GObject * object,
     priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
     
     switch (prop_id) {
+    case PROP_DOMAIN:
+        string = gtk_label_get_text(priv->domainLabel);
+        g_value_set_string(value, string);
     case PROP_PASSWORD:
-        string = gtk_entry_get_text(GTK_ENTRY(priv->entry1));
+        string = gtk_entry_get_text(GTK_ENTRY(priv->pwd1stEntry));
         g_value_set_string(value, string);
         break;
     case PROP_HILDON_PASSWORD_DIALOG:
@@ -209,103 +217,98 @@ hildon_set_password_dialog_constructor(GType type,
 
     gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
 
+    priv->domainLabel = GTK_LABEL(gtk_label_new(NULL));
+
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
+                      GTK_WIDGET(priv->domainLabel), FALSE, FALSE, 0);
+
+    gtk_widget_show(GTK_WIDGET(priv->domainLabel));
+
+
     if (priv->protection == TRUE) {
         /* create checkbox */
-        priv->caption1_string = _("ckdg_fi_dialog_c_passwd_new_pwd");
-        priv->caption2_string = _("ckdg_fi_dialog_c_passwd_ver_pwd");
+        priv->pwd1stCaption_string = _(HILDON_SET_MODIFY_PASSWORD_DIALOG_PASSWORD);
+        priv->pwd2ndCaption_string = _(HILDON_SET_MODIFY_PASSWORD_DIALOG_VERIFY_PASSWORD);
 
         priv->checkbox = gtk_check_button_new();
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbox),
-                                     TRUE);
+
         gtk_widget_show(priv->checkbox);
 
-        priv->caption = hildon_caption_new(group,
-                                           _("ckdg_fi_dialog_c_passwd_pwd_protect"),
-                                           priv->checkbox,
-                                           NULL, HILDON_CAPTION_OPTIONAL);
+        priv->checkboxCaption = hildon_caption_new
+         (group,
+          _(HILDON_SET_MODIFY_PASSWORD_DIALOG_LABEL),
+          priv->checkbox,
+          NULL, HILDON_CAPTION_OPTIONAL);
+       hildon_caption_set_separator(HILDON_CAPTION(priv->checkboxCaption), "");
 
         gtk_signal_connect(GTK_OBJECT(priv->checkbox), "toggled",
                            G_CALLBACK(hildon_checbox_toggled), dialog);
+       
+        gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
+                           priv->checkboxCaption, TRUE, TRUE, 0);
+        gtk_widget_show(priv->checkboxCaption);
 
-        g_signal_connect(GTK_OBJECT(priv->checkbox),
-                         "key-press-event",
-                         G_CALLBACK(hildon_set_password_dialog_keypress),
-                         dialog);
+        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbox),
+                                     TRUE);
 
-        gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
-                           priv->caption, TRUE, TRUE, 0);
-        gtk_widget_show(priv->caption);
     } else {
-        priv->caption1_string = _("ecdg_fi_set_passwd_enter_pwd");
-        priv->caption2_string = _("ecdg_fi_set_passwd_confirm");
+        priv->pwd1stCaption_string = _(HILDON_SET_PASSWORD_DIALOG_PASSWORD);
+        priv->pwd2ndCaption_string = _(HILDON_SET_PASSWORD_DIALOG_VERIFY_PASSWORD);
     }
 
+
     /* create tab1 */
-    priv->entry1 = gtk_entry_new();
-    gtk_widget_show(priv->entry1);
+    priv->pwd1stEntry = gtk_entry_new();
+    gtk_widget_show(priv->pwd1stEntry);
 
-    priv->caption1 = hildon_caption_new(group,
-                                        priv->caption1_string,
-                                        priv->entry1,
+    priv->pwd1stCaption = hildon_caption_new(group,
+                                        priv->pwd1stCaption_string,
+                                        priv->pwd1stEntry,
                                         NULL, HILDON_CAPTION_OPTIONAL);
+    hildon_caption_set_separator(HILDON_CAPTION(priv->pwd1stCaption), "");
 
-    gtk_entry_set_visibility(GTK_ENTRY(priv->entry1), FALSE);
+    gtk_entry_set_visibility(GTK_ENTRY(priv->pwd1stEntry), FALSE);
 
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
-                       priv->caption1, TRUE, TRUE, 0);
-    gtk_widget_show(priv->caption1);
+                       priv->pwd1stCaption, TRUE, TRUE, 0);
+    gtk_widget_show(priv->pwd1stCaption);
 
     /* create tab2 */
-    priv->entry2 = gtk_entry_new();
-    gtk_widget_show(priv->entry2);
+    priv->pwd2ndEntry = gtk_entry_new();
+    gtk_widget_show(priv->pwd2ndEntry);
 
-    priv->caption2 = hildon_caption_new(group,
-                                        priv->caption2_string,
-                                        priv->entry2,
+    priv->pwd2ndCaption = hildon_caption_new(group,
+                                        priv->pwd2ndCaption_string,
+                                        priv->pwd2ndEntry,
                                         NULL, HILDON_CAPTION_OPTIONAL);
+    hildon_caption_set_separator(HILDON_CAPTION(priv->pwd2ndCaption), "");
 
-    gtk_entry_set_visibility(GTK_ENTRY(priv->entry2), FALSE);
+    gtk_entry_set_visibility(GTK_ENTRY(priv->pwd2ndEntry), FALSE);
 
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
-                       priv->caption2, TRUE, TRUE, 0);
-
-    gtk_widget_show(priv->caption2);
-
-    /* Callback functions */
-    g_signal_connect(priv->entry1, "button-release-event",
-                     G_CALLBACK(hildon_set_password_dialog_released),
-                     NULL);
-    g_signal_connect(priv->entry2, "button-release-event",
-                     G_CALLBACK(hildon_set_password_dialog_released),
-                     NULL);
-
-    gtk_signal_connect(GTK_OBJECT(priv->entry1),
-                       "key-press-event",
-                       G_CALLBACK(hildon_set_password_dialog_keypress),
-                       dialog);
-    gtk_signal_connect(GTK_OBJECT(priv->entry2),
-                       "key-press-event",
-                       G_CALLBACK(hildon_set_password_dialog_keypress),
-                       dialog);
+                       priv->pwd2ndCaption, TRUE, TRUE, 0);
+
+    gtk_widget_show(priv->pwd2ndCaption);
 
     gtk_window_set_title(GTK_WINDOW(dialog),
                          _(priv->protection
-                           ? "ckdg_ti_dialog_c_passwd_change_password"
-                           : "ecdg_ti_set_password"));
+                           ? HILDON_SET_MODIFY_PASSWORD_DIALOG_TITLE
+                           : HILDON_SET_PASSWORD_DIALOG_TITLE));
 
     /* Create the OK/CANCEL buttons */
-    priv->okButton = gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                           _(priv->protection
-                                             ? "ckdg_bd_change_password_dialog_ok"
-                                             : "ecdg_bd_set_password_dialog_ok"),
-                                           GTK_RESPONSE_OK);
-    priv->cancelButton = gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                               _(priv->protection
-                                                 ? "ckdg_bd_change_password_dialog_cancel"
-                                                 : "ecdg_bd_set_password_dialog_cancel"),
-                                               GTK_RESPONSE_CANCEL);
-
-    gtk_window_resize(GTK_WINDOW(dialog), 370, 110);
+    priv->okButton = gtk_dialog_add_button
+      (GTK_DIALOG(dialog),  _(priv->protection
+                             ? HILDON_SET_MODIFY_PASSWORD_DIALOG_OK
+                             : HILDON_SET_PASSWORD_DIALOG_OK),
+       GTK_RESPONSE_OK);
+    priv->cancelButton = gtk_dialog_add_button
+      (GTK_DIALOG(dialog), _(priv->protection
+                            ? HILDON_SET_MODIFY_PASSWORD_DIALOG_CANCEL
+                            : HILDON_SET_PASSWORD_DIALOG_CANCEL),
+       GTK_RESPONSE_CANCEL);
+    
+    /*    gtk_window_resize(GTK_WINDOW(dialog), 370, 110); */
+    /*    remove now, pixel perfection can address these majik thingys */
 
     gtk_widget_show(priv->okButton);
     gtk_widget_show(priv->cancelButton);
@@ -317,7 +320,7 @@ hildon_set_password_dialog_constructor(GType type,
 static void
 hildon_set_password_dialog_class_init(HildonSetPasswordDialogClass * class)
 {
-    GParamSpec *pspec1, *pspec2;
+
 
     GObjectClass *object_class = G_OBJECT_CLASS(class);
 
@@ -327,24 +330,31 @@ hildon_set_password_dialog_class_init(HildonSetPasswordDialogClass * class)
     object_class->get_property = hildon_set_password_get_property;
     object_class->constructor = hildon_set_password_dialog_constructor;
 
-    pspec1 = g_param_spec_boolean("modify_protection",
-                                 "Password type",
-                                 "Set type to dialog",
-                                 TRUE,
-                                 G_PARAM_CONSTRUCT_ONLY |
-                                 G_PARAM_READWRITE);
 
-    g_object_class_install_property(object_class,
-                                    PROP_HILDON_PASSWORD_DIALOG, pspec1);
-    
-    pspec2 = g_param_spec_string("password",
-                               "Pasword content",
-                               "Set content to dialog",
-                               "DEFAULT",
-                               G_PARAM_READWRITE);
-    
-    g_object_class_install_property(object_class,
-                                    PROP_PASSWORD, pspec2);
+    g_object_class_install_property(object_class, 
+                    PROP_DOMAIN, 
+                    g_param_spec_string ("domain",
+                                         "Domain",
+                                         "Set Domain (content) for domain label.",
+                                         NULL,
+                                         G_PARAM_READWRITE));
+
+    g_object_class_install_property(object_class, 
+                    PROP_HILDON_PASSWORD_DIALOG, 
+                    g_param_spec_boolean ("modify_protection",
+                                         "Password type",
+                                         "Set type to dialog",
+                                         TRUE, 
+                                         G_PARAM_CONSTRUCT_ONLY |
+                                         G_PARAM_READWRITE));
+
+    g_object_class_install_property(object_class, 
+                    PROP_PASSWORD, 
+                    g_param_spec_string ("password",
+                                         "Password content",
+                                         "Set content to dialog",
+                                         "DEFAULT",
+                                         G_PARAM_READWRITE));
 
     g_type_class_add_private(class,
                              sizeof(HildonSetPasswordDialogPrivate));
@@ -365,8 +375,8 @@ static void
 hildon_set_password_response_change(GtkDialog * dialog, gint arg1,
                                     GtkWindow * parent)
 {
-    GtkEntry *entry1;
-    GtkEntry *entry2;
+    GtkEntry *pwd1stEntry;
+    GtkEntry *pwd2ndEntry;
     gchar *text1;
     gchar *text2;
 
@@ -377,59 +387,69 @@ hildon_set_password_response_change(GtkDialog * dialog, gint arg1,
 
     priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
 
-    entry1 = GTK_ENTRY(hildon_caption_get_control
-                       (HILDON_CAPTION(priv->caption1)));
+    pwd1stEntry = GTK_ENTRY(gtk_bin_get_child
+                           (GTK_BIN(priv->pwd1stCaption)));
 
-    entry2 = GTK_ENTRY(hildon_caption_get_control
-                       (HILDON_CAPTION(priv->caption2)));
+    pwd2ndEntry = GTK_ENTRY(gtk_bin_get_child
+                           (GTK_BIN(priv->pwd2ndCaption)));
 
-    text1 = GTK_ENTRY(entry1)->text;
-    text2 = GTK_ENTRY(entry2)->text;
+    text1 = GTK_ENTRY(pwd1stEntry)->text;
+    text2 = GTK_ENTRY(pwd2ndEntry)->text;
     if (arg1 == GTK_RESPONSE_OK){
-        if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->checkbox))){
-           if(strcmp(text1, "" ) != 0){
-                if(strcmp (text1, text2) == 0){
-                    priv->protection = TRUE;
-                } else if(strcmp(text2, "" ) == 0){
-                    g_signal_stop_emission_by_name(G_OBJECT(dialog),
-                            "response");
-                    gtk_infoprint (NULL,
-                                  _("ckdg_ib_dialog_c_passwd_unmatched_pwd"));
-                    gtk_widget_grab_focus(GTK_WIDGET(entry2));
-                } else{
-                    g_signal_stop_emission_by_name(G_OBJECT(dialog),
-                            "response");
-                    gtk_entry_set_text(entry1, "");
-                    gtk_entry_set_text(entry2, "");
-                    gtk_infoprint (NULL,
-                                  _("ckdg_ib_dialog_c_passwd_unmatched_pwd"));
-                    gtk_widget_grab_focus(GTK_WIDGET(entry1));
-                }
-            } else {
-                g_signal_stop_emission_by_name(G_OBJECT(dialog), "response");
-                gtk_infoprint (NULL, _("ecdg_ib_password_is_empt"));
-            }
-        } else{
-           note = HILDON_NOTE(hildon_note_new_confirmation(
-                              GTK_WINDOW(dialog),
-                              _("ckdg_nc_dialog_c_passwd_remove_pwd")));
-           
-            hildon_note_set_button_text(HILDON_NOTE(note),
-                                    _("ckdg_bd_dialog_c_passwd_remove_button"));
-
-            i = gtk_dialog_run(GTK_DIALOG(note));
-
-            gtk_widget_destroy(GTK_WIDGET(note));
-
-            if (i == GTK_RESPONSE_OK)
-               priv->protection = FALSE;
-            else {
-               priv->protection = TRUE;
-                g_signal_stop_emission_by_name(G_OBJECT(dialog), "response");
-           }
-        }
-    }else{
-        priv->protection = TRUE;
+      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->checkbox))){
+       if(strcmp(text1, "" ) != 0){
+         if(strcmp (text1, text2) == 0){
+           priv->protection = TRUE;
+         } else if(strcmp(text2, "" ) == 0){
+           g_signal_stop_emission_by_name(G_OBJECT(dialog),
+                                          "response");
+           gtk_infoprint (NULL,
+                          _(HILDON_SET_PASSWORD_DIALOG_MISMATCH));
+           gtk_widget_grab_focus(GTK_WIDGET(pwd2ndEntry));
+         } else{
+           g_signal_stop_emission_by_name(G_OBJECT(dialog),
+                                          "response");
+           gtk_entry_set_text(pwd1stEntry, "");
+           gtk_entry_set_text(pwd2ndEntry, "");
+           gtk_infoprint (NULL,
+                          _(HILDON_SET_PASSWORD_DIALOG_MISMATCH));
+           gtk_widget_grab_focus(GTK_WIDGET(pwd1stEntry));
+         }
+       } else {
+         g_signal_stop_emission_by_name(G_OBJECT(dialog), "response");
+         if (strcmp(text2, "") == 0) {
+           gtk_infoprint (NULL, _(HILDON_SET_PASSWORD_DIALOG_EMPTY));
+         } else {
+           gtk_infoprint (NULL, _(HILDON_SET_PASSWORD_DIALOG_MISMATCH));
+           gtk_entry_set_text(pwd2ndEntry, "");
+         }
+         gtk_widget_grab_focus(GTK_WIDGET(pwd1stEntry));
+       }
+      } else{
+       note = HILDON_NOTE(hildon_note_new_confirmation
+                          (GTK_WINDOW(dialog),
+                           _(HILDON_SET_PASSWORD_DIALOG_REMOVE_PROTECTION
+                             )));
+      
+       hildon_note_set_button_texts
+         (HILDON_NOTE(note),
+          _(HILDON_REMOVE_PROTECTION_CONFIRMATION_REMOVE), 
+          _(HILDON_REMOVE_PROTECTION_CONFIRMATION_CANCEL));
+       
+       i = gtk_dialog_run(GTK_DIALOG(note));
+       
+       gtk_widget_destroy(GTK_WIDGET(note));
+       
+       if (i == GTK_RESPONSE_OK)
+         priv->protection = FALSE;
+       else {
+         priv->protection = TRUE;
+         g_signal_stop_emission_by_name(G_OBJECT(dialog), "response");
+       }
+      }
+
+    } else {
+      priv->protection = TRUE;
     }
 }
 
@@ -437,8 +457,8 @@ static void
 hildon_set_password_response_set(GtkDialog * dialog, gint arg1,
                                  GtkWindow * parent)
 {
-    GtkEntry *entry1;
-    GtkEntry *entry2;
+    GtkEntry *pwd1stEntry;
+    GtkEntry *pwd2ndEntry;
     gchar *text1;
     gchar *text2;
 
@@ -446,14 +466,14 @@ hildon_set_password_response_set(GtkDialog * dialog, gint arg1,
 
     priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
 
-    entry1 = GTK_ENTRY(hildon_caption_get_control
-                       (HILDON_CAPTION(priv->caption1)));
+    pwd1stEntry = GTK_ENTRY(gtk_bin_get_child
+                           (GTK_BIN(priv->pwd1stCaption)));
 
-    entry2 = GTK_ENTRY(hildon_caption_get_control
-                       (HILDON_CAPTION(priv->caption2)));
+    pwd2ndEntry = GTK_ENTRY(gtk_bin_get_child
+                           (GTK_BIN(priv->pwd2ndCaption)));
 
-    text1 = GTK_ENTRY(entry1)->text;
-    text2 = GTK_ENTRY(entry2)->text;
+    text1 = GTK_ENTRY(pwd1stEntry)->text;
+    text2 = GTK_ENTRY(pwd2ndEntry)->text;
 
     if (arg1 == GTK_RESPONSE_OK) {
         if (strcmp (text1, "") != 0) {
@@ -461,20 +481,24 @@ hildon_set_password_response_set(GtkDialog * dialog, gint arg1,
                 priv->protection = TRUE;
             } else if (strcmp (text2, "") == 0) {
                 g_signal_stop_emission_by_name(G_OBJECT(dialog), "response");
-                gtk_infoprint (NULL, _("ecdg_ib_password_is_empty"));
-                gtk_widget_grab_focus (GTK_WIDGET (priv->entry2));
+                gtk_infoprint (NULL, _(HILDON_SET_PASSWORD_DIALOG_MISMATCH));
+                gtk_widget_grab_focus (GTK_WIDGET (priv->pwd2ndEntry));
             } else {
                 g_signal_stop_emission_by_name(G_OBJECT(dialog), "response");
-               gtk_entry_set_text(entry1, "");
-               gtk_entry_set_text(entry2, "");
-               gtk_infoprint (NULL, _("ecdg_ib_passwords_do_not_match"));
-                gtk_widget_grab_focus(GTK_WIDGET(priv->entry1));
+               gtk_entry_set_text(pwd1stEntry, "");
+               gtk_entry_set_text(pwd2ndEntry, "");
+               gtk_infoprint (NULL, _(HILDON_SET_PASSWORD_DIALOG_MISMATCH ));
+                gtk_widget_grab_focus(GTK_WIDGET(priv->pwd1stEntry));
            }
         } else {
             g_signal_stop_emission_by_name(G_OBJECT(dialog), "response");
-            gtk_entry_set_text(entry2, "");
-            gtk_infoprint (NULL, _("ecdg_ib_password_is_empty"));
-            gtk_widget_grab_focus(GTK_WIDGET(priv->entry1));
+         if (strcmp(text2, "") == 0) {
+           gtk_infoprint (NULL, _(HILDON_SET_PASSWORD_DIALOG_EMPTY));
+         } else {
+           gtk_infoprint (NULL, _(HILDON_SET_PASSWORD_DIALOG_MISMATCH));
+           gtk_entry_set_text(pwd2ndEntry, "");
+         }
+         gtk_widget_grab_focus(GTK_WIDGET(pwd1stEntry));
         }
     } else { 
         priv->protection = FALSE;
@@ -490,63 +514,11 @@ static void hildon_checbox_toggled(GtkWidget * widget, gpointer data)
     priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
 
     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
-        gtk_widget_set_sensitive(GTK_WIDGET(priv->entry1), TRUE);
-        gtk_widget_set_sensitive(GTK_WIDGET(priv->entry2), TRUE);
-    } else {
-        gtk_widget_set_sensitive(GTK_WIDGET(priv->entry1), FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(priv->entry2), FALSE);
-    }
-}
-
-static gboolean
-hildon_set_password_dialog_released(GtkWidget * widget,
-                                    GdkEventButton * event,
-                                    gpointer user_data)
-{
-    GtkEditable *editable = GTK_EDITABLE(widget);
-
-    gtk_editable_select_region(GTK_EDITABLE(editable), 0, -1);
-    gtk_widget_grab_focus(GTK_WIDGET(editable));
-
-    return FALSE;
-}
-
-static gboolean
-hildon_set_password_dialog_keypress(GtkWidget * widget,
-                                    GdkEventKey * event, gpointer data)
-{
-    HildonSetPasswordDialog *dialog;
-    HildonSetPasswordDialogPrivate *priv;
-
-    dialog = HILDON_SET_PASSWORD_DIALOG(data);
-    priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
-
-    if ((widget == priv->checkbox) &&
-             ((event->keyval == GDK_Left) || (event->keyval == GDK_KP_Left)
-              || (event->keyval == GDK_Right)
-              || (event->keyval == GDK_KP_Right))) {
-        gtk_widget_grab_focus(priv->checkbox);
-
-        return TRUE;
-    } else if ((widget == priv->checkbox) &&
-               ((event->keyval == GDK_Return) ||
-                (event->keyval == GDK_KP_Enter))) {
-        if (gtk_toggle_button_get_active
-            (GTK_TOGGLE_BUTTON(priv->checkbox))) {
-            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbox),
-                                         FALSE);
-        } else {
-            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbox),
-                                         TRUE);
-        }
-        return TRUE;
-    } else if ((event->keyval == GDK_Return)
-               || (event->keyval == GDK_KP_Enter)) {
-        gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
-
-        return TRUE;
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->pwd1stEntry), TRUE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->pwd2ndEntry), TRUE);
     } else {
-        return FALSE;   /* pass the keypress on */
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->pwd1stEntry), FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->pwd2ndEntry), FALSE);
     }
 }
 
@@ -664,7 +636,7 @@ const gchar
 
     priv = HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
 
-    return GTK_ENTRY(priv->entry1)->text;
+    return GTK_ENTRY(priv->pwd1stEntry)->text;
 }
 
 /**
@@ -685,3 +657,20 @@ hildon_set_password_dialog_get_protected(HildonSetPasswordDialog * dialog)
 
     return priv->protection;
 }
+
+/**
+ * hildon_set_password_dialog_set_domain(GtkWidget *dialog, 
+ * @dialog: the dialog
+ * @domain: the domain or some other descriptive text to be set.
+ * 
+ * sets the optional descriptive text
+ */
+
+void hildon_set_password_dialog_set_domain(HildonSetPasswordDialog *dialog, 
+                                                gchar *domain)
+{
+  HildonSetPasswordDialogPrivate *priv =
+    HILDON_SET_PASSWORD_DIALOG_GET_PRIVATE(dialog);
+  gtk_label_set_text(priv->domainLabel, domain);
+  
+}
index 0ead920..07aaf91 100644 (file)
@@ -40,11 +40,46 @@ G_BEGIN_DECLS
   (GTK_CHECK_TYPE (obj, HILDON_TYPE_SET_PASSWORD_DIALOG))
 #define HILDON_IS_SET_PASSWORD_DIALOG_CLASS(klass) \
   (GTK_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_SET_PASSWORD_DIALOG))
-/**
- * HildonSetPasswordDialog:
- * 
- * Contains only private data.
- */
+
+#define HILDON_SET_PASSWORD_DIALOG_TITLE \
+         "ecdg_ti_set_password"
+#define HILDON_SET_PASSWORD_DIALOG_PASSWORD \
+         "ecdg_fi_set_passwd_enter_pwd"
+#define HILDON_SET_PASSWORD_DIALOG_VERIFY_PASSWORD \
+         "ecdg_fi_set_passwd_confirm"
+#define HILDON_SET_PASSWORD_DIALOG_OK \
+         "ecdg_bd_set_password_dialog_ok"
+#define HILDON_SET_PASSWORD_DIALOG_CANCEL \
+         "ecdg_bd_set_password_dialog_cancel"
+
+#define HILDON_SET_MODIFY_PASSWORD_DIALOG_TITLE \
+         "ckdg_ti_dialog_c_passwd_change_password"
+#define HILDON_SET_MODIFY_PASSWORD_DIALOG_LABEL \
+         "ckdg_fi_dialog_c_passwd_pwd_protect"
+#define HILDON_SET_MODIFY_PASSWORD_DIALOG_PASSWORD \
+         "ckdg_fi_dialog_c_passwd_new_pwd"
+#define HILDON_SET_MODIFY_PASSWORD_DIALOG_VERIFY_PASSWORD \
+         "ckdg_fi_dialog_c_passwd_ver_pwd"
+#define HILDON_SET_MODIFY_PASSWORD_DIALOG_OK \
+         "ckdg_bd_change_password_dialog_ok"
+#define HILDON_SET_MODIFY_PASSWORD_DIALOG_CANCEL \
+         "ckdg_bd_change_password_dialog_cancel"
+
+#define HILDON_SET_PASSWORD_DIALOG_MISMATCH \
+         "ecdg_ib_passwords_do_not_match"
+
+#define HILDON_SET_PASSWORD_DIALOG_EMPTY \
+         "ecdg_ib_password_is_empty"
+
+#define HILDON_SET_PASSWORD_DIALOG_REMOVE_PROTECTION \
+         "ckdg_nc_dialog_c_passwd_remove_pwd"
+
+#define HILDON_REMOVE_PROTECTION_CONFIRMATION_REMOVE \
+         "ckdg_bd_dialog_c_passwd_remove_button"
+
+#define HILDON_REMOVE_PROTECTION_CONFIRMATION_CANCEL \
+         "ckdg_bd_dialog_c_passwd_cancel_button"
+
 typedef struct _HildonSetPasswordDialog HildonSetPasswordDialog;
 typedef struct _HildonSetPasswordDialogClass HildonSetPasswordDialogClass;
 
@@ -56,9 +91,6 @@ struct _HildonSetPasswordDialogClass {
     GtkDialogClass parent_class;
 };
 
-/*
- * Public methods
- */
 
 GtkWidget *hildon_set_password_dialog_new(GtkWindow * parent,
                                           gboolean modify_protection);
@@ -77,5 +109,8 @@ const gchar
 gboolean hildon_set_password_dialog_get_protected(HildonSetPasswordDialog *
                                                   dialog);
 
+void hildon_set_password_dialog_set_domain(HildonSetPasswordDialog *dialog,
+                                          gchar *domain);
+
 G_END_DECLS
 #endif /* HILDON_SET_PASSWORD_DIALOG_H */
index d2a727b..25d332c 100644 (file)
@@ -29,6 +29,7 @@
  * @desc: The sort dialog is used to define the order in which item are 
  * shown in a list. Choise lists always display the current value when 
  * the dialog is opened. 
+ *
  */
 
 #ifdef HAVE_CONFIG_H
@@ -117,7 +118,7 @@ static void hildon_sort_dialog_init(HildonSortDialog * dialog)
     priv->combo1 = gtk_combo_box_new_text();
     priv->caption1 = hildon_caption_new(group, _("ckdg_fi_sort_field"), priv->combo1,
                                         NULL, HILDON_CAPTION_OPTIONAL);
-
+    hildon_caption_set_separator(HILDON_CAPTION(priv->caption1), "");
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
                        priv->caption1, FALSE, FALSE, 0);
 
@@ -131,7 +132,7 @@ static void hildon_sort_dialog_init(HildonSortDialog * dialog)
     priv->caption2 = hildon_caption_new(group, _("ckdg_fi_sort_order"),
                                         priv->combo2,
                                         NULL, HILDON_CAPTION_OPTIONAL);
-
+    hildon_caption_set_separator(HILDON_CAPTION(priv->caption2), "");
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
                        priv->caption2, FALSE, FALSE, 0);
 
@@ -219,7 +220,8 @@ gint hildon_sort_dialog_get_sort_key(HildonSortDialog * dialog)
     g_return_val_if_fail(HILDON_IS_SORT_DIALOG(dialog), -1);
 
     priv = HILDON_SORT_DIALOG_GET_PRIVATE(dialog);
-    combo_key = hildon_caption_get_control(HILDON_CAPTION(priv->caption1));
+    
+    combo_key = gtk_bin_get_child(GTK_BIN(priv->caption1));
     priv->sort_by_value =
         gtk_combo_box_get_active(GTK_COMBO_BOX(combo_key));
     return priv->sort_by_value;
@@ -241,7 +243,7 @@ GtkSortType hildon_sort_dialog_get_sort_order(HildonSortDialog * dialog)
     g_return_val_if_fail(HILDON_IS_SORT_DIALOG(dialog), 0);
 
     priv = HILDON_SORT_DIALOG_GET_PRIVATE(dialog);
-    combo_key = hildon_caption_get_control(HILDON_CAPTION(priv->caption2));
+    combo_key = gtk_bin_get_child(GTK_BIN(priv->caption2));
     priv->sort_order_type =
         gtk_combo_box_get_active(GTK_COMBO_BOX(combo_key));
     return priv->sort_order_type;
@@ -262,7 +264,7 @@ void hildon_sort_dialog_set_sort_key(HildonSortDialog * dialog, gint key)
     g_return_if_fail(HILDON_IS_SORT_DIALOG(dialog));
 
     priv = HILDON_SORT_DIALOG_GET_PRIVATE(dialog);
-    combo_key = hildon_caption_get_control(HILDON_CAPTION(priv->caption1));
+    combo_key = gtk_bin_get_child(GTK_BIN(priv->caption1));
     gtk_combo_box_set_active(GTK_COMBO_BOX(combo_key), key);
 }
 
@@ -283,8 +285,7 @@ hildon_sort_dialog_set_sort_order(HildonSortDialog * dialog,
     g_return_if_fail(HILDON_IS_SORT_DIALOG(dialog));
 
     priv = HILDON_SORT_DIALOG_GET_PRIVATE(dialog);
-    combo_order =
-        hildon_caption_get_control(HILDON_CAPTION(priv->caption2));
+    combo_order = gtk_bin_get_child(GTK_BIN(priv->caption2));
     gtk_combo_box_set_active(GTK_COMBO_BOX(combo_order), order);
 }
 
index 38e1984..9e549c9 100644 (file)
@@ -64,7 +64,9 @@
 #include <hildon-widgets/hildon-time-editor.h>
 #include <hildon-widgets/hildon-time-picker.h>
 #include <hildon-widgets/gtk-infoprint.h>
+#include <hildon-widgets/hildon-input-mode-hint.h>
 #include "hildon-composite-widget.h"
+#include "hildon-date-editor.h"
 
 #define _(String) dgettext(PACKAGE, String)
 
 is 12, we add 4 extra pixels so that the arabic locale works
 correctly. (With 12 only one digit would be shown in the entries).
 */
-#define TIME_EDITOR_LBORDER         6
-#define TIME_EDITOR_RBORDER         6
-#define TIME_EDITOR_HEIGHT         30
+#define TIME_EDITOR_LBORDER         2
+#define TIME_EDITOR_RBORDER         1
+#define TIME_EDITOR_HEIGHT         28
 #define TIME_EDITOR_CLOCK_BORDER    6
+#define ENTRY_BORDER               2
 #define ICON_WIDTH                 26
 #define ICON_HEIGHT                26
+#define ICON_PRESSED                4
 #define ICON_NAME                  "qgn_widg_timedit"
 #define ICON_SIZE                  "timepicker-size"
 #define HILDON_TIME_EDITOR_GET_PRIVATE(obj) \
@@ -86,10 +90,52 @@ correctly. (With 12 only one digit would be shown in the entries).
 #define MIN_DURATION 0
 #define MAX_DURATION (3600 * 99) + (60 * 59) + 59
 
+#define HILDON_TIME_EDITOR_TICKS_VALUE           0
+#define HILDON_TIME_EDITOR_SHOW_SECONDS          TRUE
+#define HILDON_TIME_EDITOR_DURATION_MODE         FALSE
+#define HILDON_TIME_EDITOR_DURATION_LOWER_VALUE  0
+#define HILDON_TIME_EDITOR_TIME_LOWER_VALUE      0
+#define HILDON_TIME_EDITOR_TIME_UPPER_VALUE      (3600 * 23) + (60 * 59) + 59
+#define HILDON_TIME_EDITOR_DURATION_UPPER_VALUE  (3600 * 99) + (60 * 59) + 59
+
+#define HOURS_MAX_24   23
+#define HOURS_MAX_12   12
+#define HOURS_MIN_24   0
+#define HOURS_MIN_12   1
+#define MINUTES_MAX 59
+#define SECONDS_MAX 59
+#define MINUTES_MIN 0
+#define SECONDS_MIN 0
+
 static GtkContainerClass *parent_class;
 
 typedef struct _HildonTimeEditorPrivate HildonTimeEditorPrivate;
 
+enum
+{
+       PROP_TICKS = 1,
+       PROP_DURATION_MODE,
+       PROP_DURATION_MIN,
+       PROP_DURATION_MAX,
+       PROP_SHOW_SECONDS
+};
+
+typedef enum
+{
+  VALIDATION_ERROR, /* should never be returned, translates as system error */
+  VALIDATION_OK,
+  VALIDATION_DURATION_MAX,
+  VALIDATION_DURATION_MIN,
+  VALIDATION_TIME_HOURS,
+  VALIDATION_TIME_MINUTES,
+  VALIDATION_TIME_SECONDS,
+  VALIDATION_LAST
+} HildonValidation;
+
+/***
+ * Widget functions
+ */
+
 static void
 hildon_time_editor_class_init(HildonTimeEditorClass * editor_class);
 
@@ -97,15 +143,35 @@ static void hildon_time_editor_init(HildonTimeEditor * editor);
 
 static void hildon_time_editor_finalize(GObject * obj_self);
 
+static void hildon_time_editor_set_property( GObject *object, guint param_id,
+                                       const GValue *value, GParamSpec *pspec );
+static void hildon_time_editor_get_property( GObject *object, guint param_id,
+                                         GValue *value, GParamSpec *pspec );
+
+static void
+hildon_time_editor_forall(GtkContainer * container,
+                          gboolean include_internals, GtkCallback callback,
+                          gpointer callback_data);
+                          
+static void hildon_time_editor_destroy(GtkObject * self);
+
+static void hildon_time_editor_add_style(void);
+
+static void
+set_widget_allocation(GtkWidget * widget, GtkAllocation * alloc,
+                      GtkAllocation * allocation);
+
+/***
+ * Signal handlers
+ */
+
 static gboolean
 hildon_time_editor_entry_focusout(GtkWidget * widget,
                                   GdkEventFocus * event, gpointer data);
-static void hildon_time_editor_entry_activate(GtkWidget * widget,
-                                              gpointer data);
-
-static void
-hildon_time_editor_entry_activate(GtkWidget * widget, gpointer data);
 
+static gboolean hildon_time_editor_entry_focusin(GtkWidget * widget,
+                                                 GdkEventFocus * event, 
+                                                 gpointer data);
 static gboolean
 hildon_time_editor_mnemonic_activate(GtkWidget * widget,
                                      gboolean group_cycling);
@@ -121,32 +187,24 @@ hildon_time_editor_entry_clicked(GtkWidget * widget,
                                  GdkEventButton * event, gpointer data);
 
 static void
+hildon_time_editor_entry_changed(GtkWidget * widget, gpointer user_data);
+
+
+static void
 hildon_time_editor_size_request(GtkWidget * widget,
                                 GtkRequisition * requisition);
 
 static void
 hildon_time_editor_size_allocate(GtkWidget * widget,
                                  GtkAllocation * allocation);
-static void
-hildon_time_editor_forall(GtkContainer * container,
-                          gboolean include_internals, GtkCallback callback,
-                          gpointer callback_data);
-static void hildon_time_editor_destroy(GtkObject * self);
 
 static gboolean
 hildon_time_editor_entry_keypress(GtkWidget * widget, GdkEventKey * event,
                                   gpointer data);
-static void hildon_time_editor_add_style(void);
-
-static void
-set_widget_allocation(GtkWidget * widget, GtkAllocation * alloc,
-                      GtkAllocation * allocation);
-static guint
-hildon_time_editor_check_duration_validity(HildonTimeEditor * editor);
 
-static void
-hildon_time_editor_duration_handle_error(HildonTimeEditor * editor,
-                                         guint type);
+/***
+ * Internal functions
+ */
 
 static gboolean hildon_time_editor_check_locale(HildonTimeEditor * editor);
 
@@ -156,16 +214,42 @@ void hildon_time_editor_tap_and_hold_setup(GtkWidget * widget,
                                            GtkCallback func,
                                            GtkWidgetTapAndHoldFlags flags);
 
-enum {
-    DURATION_MIN_EXCEED,
-    DURATION_MAX_EXCEED,
-    DURATION_OK
-};
+static void
+hildon_time_editor_get_max_values(HildonTimeEditor *editor,
+        guint * max_hours, guint * min_hours,
+        guint * max_minutes, guint * min_minutes,
+        guint * max_seconds, guint * min_seconds);
+        
+static void
+hildon_time_editor_validate (HildonTimeEditor *editor);
+
+static HildonValidation
+hildon_time_editor_validate_duration (HildonTimeEditor * editor, guint ticks);
+
+static HildonValidation
+hildon_time_editor_validate_time (HildonTimeEditor * editor,
+                                  guint hours,
+                                  guint minutes,
+                                  guint seconds,
+                                  gboolean mode_24h);
+
+/***
+ * Utility functions
+ */
+static void
+convert_to_12h (guint *h, guint *m, guint *s, gboolean *am);
+static void
+convert_to_24h (guint *h, guint *m, guint *s, gboolean am);
+
+static void ticks_to_time (guint ticks,
+                           guint *hours,
+                           guint *minutes,
+                    guint *seconds);
+
 
 struct _HildonTimeEditorPrivate {
-    gchar h_time[4];    /* These hold current */
-    gchar m_time[4];    /* time */
-    gchar s_time[4];
+    guint ticks;        /* Current duration in seconds */
     gchar *am_symbol;
     gchar *pm_symbol;
 
@@ -187,6 +271,8 @@ struct _HildonTimeEditorPrivate {
     gboolean clock_24h; /* whether to show a 24h clock */
     gboolean am;        /* TRUE == showing am, FALSE == pm */
     gboolean valid_value; /* If entry has an valid value */
+    
+    gboolean validated; /* If the current value has been validated */
 
     /* Duration editor ranges */
     guint duration_min;
@@ -237,9 +323,9 @@ static void hildon_time_editor_forall(GtkContainer * container,
     /* widget that are always shown */
     (*callback) (priv->h_entry, callback_data);
     (*callback) (priv->m_entry, callback_data);
-    (*callback) (priv->label, callback_data);
     (*callback) (priv->iconbutton, callback_data);
     (*callback) (priv->frame, callback_data);
+    (*callback) (priv->label, callback_data);
     (*callback) (priv->label2, callback_data);
     (*callback) (priv->s_entry, callback_data);
     (*callback) (priv->eventbox, callback_data);
@@ -284,6 +370,9 @@ static void hildon_time_editor_destroy(GtkObject * self)
         gtk_widget_unparent(priv->s_entry);
         priv->s_entry = NULL;
     }
+  
+    g_free (priv->am_symbol);
+    g_free (priv->pm_symbol);
 
     if (GTK_OBJECT_CLASS(parent_class)->destroy)
         GTK_OBJECT_CLASS(parent_class)->destroy(self);
@@ -302,6 +391,10 @@ hildon_time_editor_class_init(HildonTimeEditorClass * editor_class)
     g_type_class_add_private(editor_class,
                              sizeof(HildonTimeEditorPrivate));
 
+    object_class->get_property = hildon_time_editor_get_property;
+    object_class->set_property = hildon_time_editor_set_property;
+
+
     widget_class->mnemonic_activate = hildon_time_editor_mnemonic_activate;
     widget_class->size_request = hildon_time_editor_size_request;
     widget_class->size_allocate = hildon_time_editor_size_allocate;
@@ -313,6 +406,70 @@ hildon_time_editor_class_init(HildonTimeEditorClass * editor_class)
     GTK_OBJECT_CLASS(editor_class)->destroy = hildon_time_editor_destroy;
 
     object_class->finalize = hildon_time_editor_finalize;
+
+  /**
+   * HildonTimeEditor:ticks:
+   *
+   * TimeEditor current duration (or time since midnight) value.
+   */
+  g_object_class_install_property( object_class, PROP_TICKS,
+                                   g_param_spec_uint("ticks",
+                                   "Duration value",
+                                   "Current value of duration",
+                                   0, G_MAXUINT,
+                                   HILDON_TIME_EDITOR_TICKS_VALUE,
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  /**
+   * HildonTimeEditor:show_seconds:
+   *
+   * TimeEditor show_seconds property.
+   */
+  g_object_class_install_property( object_class, PROP_SHOW_SECONDS,
+                                   g_param_spec_boolean("show_seconds",
+                                   "Show seconds property",
+                                   "Controls whether the seconds are shown in the editor",
+                                   HILDON_TIME_EDITOR_SHOW_SECONDS,
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  /**
+   * HildonTimeEditor:duration_mode:
+   *
+   * TimeEditor duration mode indicator.
+   */
+  g_object_class_install_property( object_class, PROP_DURATION_MODE,
+                                   g_param_spec_boolean("duration_mode",
+                                   "Duration mode",
+                                   "Controls whether the TimeEditor is in duration mode",
+                                   HILDON_TIME_EDITOR_DURATION_MODE,
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  /**
+   * HildonTimeEditor:duration_min:
+   *
+   * TimeEditor minimum duration value.
+   */
+  g_object_class_install_property( object_class, PROP_DURATION_MIN,
+                                   g_param_spec_uint("duration_min",
+                                   "Minumum duration value",
+                                   "Smallest possible duration value",
+                                   0, G_MAXUINT,
+                                   HILDON_TIME_EDITOR_DURATION_LOWER_VALUE,
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  /**
+   * HildonTimeEditor:duration_max:
+   *
+   * TimeEditor maximum duration value.
+   */
+  g_object_class_install_property( object_class, PROP_DURATION_MAX,
+                                   g_param_spec_uint("duration_max",
+                                   "Maximum duration value",
+                                   "Largest possible duration value",
+                                   0, G_MAXUINT,
+                                   HILDON_TIME_EDITOR_DURATION_UPPER_VALUE,
+                                   G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
 }
 
 static
@@ -338,14 +495,13 @@ void hildon_time_editor_tap_and_hold_setup(GtkWidget * widget,
 static void hildon_time_editor_init(HildonTimeEditor * editor)
 {
     HildonTimeEditorPrivate *priv;
-    gchar hours[3] = "01";
-    gchar minutes[3] = "00";
-    gchar seconds[3] = "00";
+    guint ticks = 0;
 
     priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
     gtk_widget_push_composite_child();
     
+    priv->ticks = 0;
     priv->show_s = FALSE;
     priv->ampm_pos_after = TRUE;
     priv->clock_24h = TRUE;
@@ -355,36 +511,36 @@ static void hildon_time_editor_init(HildonTimeEditor * editor)
     priv->m_entry = gtk_entry_new();
     priv->s_entry = gtk_entry_new();
     priv->ampm = gtk_label_new(NULL);
-    priv->label = gtk_label_new(":");
-    priv->label2 = gtk_label_new(":");
+    priv->label = gtk_label_new(_("Ecdg_ti_time_editor_separator"));
+    priv->label2 = gtk_label_new(_("Ecdg_ti_time_editor_separator"));
     priv->icon = gtk_image_new_from_icon_name(ICON_NAME, HILDON_ICON_SIZE_26);
     priv->frame = gtk_frame_new(NULL);
     priv->eventbox = gtk_event_box_new();
     priv->valid_value = TRUE;
+    priv->validated = FALSE;
     
     GTK_WIDGET_SET_FLAGS(editor, GTK_NO_WINDOW);
     GTK_WIDGET_UNSET_FLAGS(priv->iconbutton, GTK_CAN_FOCUS);
     
     gtk_event_box_set_visible_window(GTK_EVENT_BOX(priv->eventbox), FALSE);
 
+    gtk_container_set_border_width(GTK_CONTAINER(priv->frame), 0);
+
     gtk_container_add(GTK_CONTAINER(priv->iconbutton), priv->icon);
     gtk_container_add(GTK_CONTAINER(priv->eventbox), priv->ampm);
 
     gtk_entry_set_has_frame(GTK_ENTRY(priv->h_entry), FALSE);
     gtk_entry_set_has_frame(GTK_ENTRY(priv->m_entry), FALSE);
     gtk_entry_set_has_frame(GTK_ENTRY(priv->s_entry), FALSE);
+    
+    g_object_set (G_OBJECT(priv->h_entry), "input-mode",
+                  HILDON_INPUT_MODE_HINT_NUMERIC, NULL);
+    g_object_set (G_OBJECT(priv->m_entry), "input-mode", 
+                  HILDON_INPUT_MODE_HINT_NUMERIC, NULL);
+    g_object_set (G_OBJECT(priv->s_entry), "input-mode",
+                  HILDON_INPUT_MODE_HINT_NUMERIC, NULL);
 
-    /* connect the activate signal to a function. */
-    g_signal_connect(G_OBJECT(priv->h_entry), "activate",
-                     G_CALLBACK(hildon_time_editor_entry_activate),
-                     editor);
-    g_signal_connect(G_OBJECT(priv->m_entry), "activate",
-                     G_CALLBACK(hildon_time_editor_entry_activate),
-                     editor);
-    g_signal_connect(G_OBJECT(priv->s_entry), "activate",
-                     G_CALLBACK(hildon_time_editor_entry_activate),
-                     editor);
-
+    
     /* clicked signal for am/pm label */
     g_signal_connect(G_OBJECT(priv->eventbox), "button_press_event",
                      G_CALLBACK(hildon_time_editor_ampm_clicked), editor);
@@ -394,16 +550,22 @@ static void hildon_time_editor_init(HildonTimeEditor * editor)
                      G_CALLBACK(hildon_time_editor_icon_clicked), editor);
 
     /* clicked signal for hour entry */
-    g_signal_connect(G_OBJECT(priv->h_entry), "button_release_event",
+    g_signal_connect(G_OBJECT(priv->h_entry), "button-release-event",
                      G_CALLBACK(hildon_time_editor_entry_clicked), editor);
+    g_signal_connect(G_OBJECT(priv->h_entry), "focus-in-event",
+                     G_CALLBACK(hildon_time_editor_entry_focusin), editor);
 
     /* clicked signal for minute entry */
-    g_signal_connect(G_OBJECT(priv->m_entry), "button_release_event",
+    g_signal_connect(G_OBJECT(priv->m_entry), "button-release-event",
                      G_CALLBACK(hildon_time_editor_entry_clicked), editor);
+    g_signal_connect(G_OBJECT(priv->m_entry), "focus-in-event",
+                     G_CALLBACK(hildon_time_editor_entry_focusin), editor);
 
     /* clicked signal for second entry */
-    g_signal_connect(G_OBJECT(priv->s_entry), "button_release_event",
+    g_signal_connect(G_OBJECT(priv->s_entry), "button-release-event",
                      G_CALLBACK(hildon_time_editor_entry_clicked), editor);
+    g_signal_connect(G_OBJECT(priv->s_entry), "focus-in-event",
+                     G_CALLBACK(hildon_time_editor_entry_focusin), editor);
 
     /* focus out events */
     g_signal_connect(G_OBJECT(priv->h_entry), "focus-out-event",
@@ -427,6 +589,17 @@ static void hildon_time_editor_init(HildonTimeEditor * editor)
                      G_CALLBACK(hildon_time_editor_entry_keypress),
                      editor);
 
+    /* changed signal sets time */
+    g_signal_connect_after (G_OBJECT(priv->h_entry), "changed",
+                      G_CALLBACK (hildon_time_editor_entry_changed), 
+                      editor);
+    g_signal_connect_after (G_OBJECT(priv->m_entry), "changed",
+                      G_CALLBACK (hildon_time_editor_entry_changed), 
+                      editor);
+    g_signal_connect_after (G_OBJECT(priv->s_entry), "changed",
+                      G_CALLBACK (hildon_time_editor_entry_changed), 
+                      editor);
+                      
     gtk_widget_set_parent(priv->iconbutton, GTK_WIDGET(editor));
     gtk_widget_set_parent(priv->label, GTK_WIDGET(editor));
 
@@ -458,39 +631,14 @@ static void hildon_time_editor_init(HildonTimeEditor * editor)
         stm = localtime(&tm);
 
         if (stm) {
-            if (!priv->clock_24h) {
-                /* Clock is showed in 24h format If hour is 12 we can be
-                   either in am or pm mode */
-                if (stm->tm_hour > 12) {
-                    priv->am = FALSE;
-                    sprintf(hours, "%2d", stm->tm_hour - 12);
-                } else if (stm->tm_hour < 12) {
-                    priv->am = TRUE;
-                    sprintf(hours, "%2d", stm->tm_hour);
-                } else if (stm->tm_hour == 12) {
-                    priv->am = FALSE;
-                    sprintf(hours, "%2d", stm->tm_hour);
-                }
-            } else
-                sprintf(hours, "%02d", stm->tm_hour);
-            sprintf(minutes, "%02d", stm->tm_min);
-            sprintf(seconds, "%02d", stm->tm_sec);
+            ticks = stm->tm_hour * 3600;
+            ticks = ticks + stm->tm_min * 60;
+            ticks = ticks + stm->tm_sec;
         }
     }
 
-    /* set current time (am/pm) */
-    gtk_label_set_label(GTK_LABEL(priv->ampm), priv->am ? priv->am_symbol :
-                        priv->pm_symbol);
-
-    /* Read time values to our internal struct */
-    g_snprintf(priv->h_time, 4, "%s", hours);
-    g_snprintf(priv->m_time, 4, "%s", minutes);
-    g_snprintf(priv->s_time, 4, "%s", seconds);
-
-    gtk_entry_set_text(GTK_ENTRY(priv->h_entry), hours);
-    gtk_entry_set_text(GTK_ENTRY(priv->m_entry), minutes);
-    gtk_entry_set_text(GTK_ENTRY(priv->s_entry), seconds);
-
+    hildon_time_editor_set_ticks (editor, ticks);
+    
     gtk_entry_set_max_length(GTK_ENTRY(priv->h_entry), 2);
     gtk_entry_set_width_chars(GTK_ENTRY(priv->h_entry), 2);
     gtk_entry_set_max_length(GTK_ENTRY(priv->m_entry), 2);
@@ -505,6 +653,72 @@ static void hildon_time_editor_init(HildonTimeEditor * editor)
     gtk_widget_pop_composite_child();
 }
 
+static void hildon_time_editor_set_property (GObject *object, guint param_id,
+                                      const GValue *value, GParamSpec *pspec)
+{
+  HildonTimeEditor *time_editor = HILDON_TIME_EDITOR(object);
+  switch (param_id)
+  {
+    case PROP_TICKS:
+      hildon_time_editor_set_ticks (time_editor, g_value_get_uint(value));
+      break;
+      
+    case PROP_SHOW_SECONDS:
+      hildon_time_editor_set_show_seconds (time_editor, g_value_get_boolean(value));
+      break;
+
+    case PROP_DURATION_MODE:
+      hildon_time_editor_set_duration_mode (time_editor, g_value_get_boolean(value));
+      break;
+
+    case PROP_DURATION_MIN:
+      hildon_time_editor_set_duration_min (time_editor, g_value_get_uint(value));
+      break;
+      
+    case PROP_DURATION_MAX:
+      hildon_time_editor_set_duration_max (time_editor, g_value_get_uint(value));
+      break;
+      
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+  }
+}
+
+static void hildon_time_editor_get_property (GObject *object, guint param_id,
+                                            GValue *value, GParamSpec *pspec)
+{
+  HildonTimeEditor *time_editor = HILDON_TIME_EDITOR(object);
+  switch (param_id)
+  {
+
+    case PROP_TICKS:
+      g_value_set_uint (value, hildon_time_editor_get_ticks (time_editor));
+      break;
+
+    case PROP_SHOW_SECONDS:
+      g_value_set_boolean (value, hildon_time_editor_get_show_seconds (time_editor));
+      break;
+
+    case PROP_DURATION_MODE:
+      g_value_set_boolean (value, hildon_time_editor_get_duration_mode (time_editor));
+      break;
+
+    case PROP_DURATION_MIN:
+      g_value_set_uint (value, hildon_time_editor_get_duration_min (time_editor));
+      break;
+
+    case PROP_DURATION_MAX:
+      g_value_set_uint (value, hildon_time_editor_get_duration_max (time_editor));
+      break;
+      
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+  }
+}
+
+
 static gboolean
 hildon_time_editor_mnemonic_activate( GtkWidget *widget,
                                       gboolean group_cycling)
@@ -557,474 +771,808 @@ static void hildon_time_editor_add_style(void)
                         "    style \"hildon-time-editor-icon\"");
 }
 
+static void ticks_to_time (guint ticks,
+                           guint *hours,
+                           guint *minutes,
+                           guint *seconds)
+{
+  guint h,m,s;
+
+  h = ticks / 3600;
+  m = (ticks - h*3600) / 60;
+  s = ticks - h*3600 - m*60;
+
+  *hours = h;
+  *minutes = m;
+  *seconds = s;
+
+}
+
 /**
- * hildon_time_editor_set_time:
- * @editor: the @HildonTimeEditor widget.
- * @hours: hours
- * @minutes: minutes
- * @seconds: seconds
+ * hildon_time_editor_set_ticks:
+ * @self: the @HildonTimeEditor widget.
+ * @ticks: The duration to set, in seconds.
  *
- * This function sets the time on an existing time editor. If the
- * time specified by the arguments is invalid, the function returns
- * without doing anything else. 
+ * Sets the current duration in seconds. This means seconds from
+ * midnight, if not in duration mode. In case of any errors, it tries
+ * to fix it.
+ * 
  **/
 
-void hildon_time_editor_set_time(HildonTimeEditor * editor, guint hours,
-                                 guint minutes, guint seconds)
+void hildon_time_editor_set_ticks (HildonTimeEditor * editor,
+                                   guint ticks)
 {
     HildonTimeEditorPrivate *priv;
-    gchar h_time[3];
-    gchar m_time[3];
-    gchar s_time[3];
+    HildonValidation validation;
+    guint h = 1;
+    guint m = 0;
+    guint s = 0;
+    gchar hours[3]   = "01";
+    gchar minutes[3] = "00";
+    gchar seconds[3] = "00";
 
-    g_return_if_fail(time);
+    g_return_if_fail(editor);
     g_return_if_fail(HILDON_IS_TIME_EDITOR(editor));
 
     priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
-    if ((priv->duration_mode && hours > 99) ||
-        (!priv->duration_mode && hours > 23) ||
-         minutes > 59 || seconds > 59)
-        return;
-
-    if (priv->clock_24h || priv->duration_mode)
-        sprintf(h_time, "%02u", hours);
-    else {
-        /* we are showing 12h clock and its after noon */
-        if (hours > 12) {
-            hours -= 12;
-            priv->am = FALSE;
-            gtk_label_set_text(GTK_LABEL(priv->ampm), priv->pm_symbol);
-        }
-        /* before noon */
-        else if (hours < 12) {
-            if (hours == 0)
-                hours = 12;
-            priv->am = TRUE;
-            gtk_label_set_text(GTK_LABEL(priv->ampm), priv->am_symbol);
-        } else if (hours == 12) {
-            priv->am = FALSE;
-            gtk_label_set_text(GTK_LABEL(priv->ampm), priv->pm_symbol);
+    /* Validate the value if it is not already validated */
+    if (!priv->validated) {
+        if (priv->duration_mode) {
+            validation = hildon_time_editor_validate_duration (editor, ticks);
+            switch(validation) {
+                case VALIDATION_DURATION_MIN:
+                    priv->ticks = priv->duration_min;
+                    break;
+                case VALIDATION_DURATION_MAX:
+                    priv->ticks = priv->duration_max;
+                    break;
+                default:
+                    priv->ticks = ticks;
+                    break;
+            }
+        } else {
+            ticks_to_time (ticks, &h, &m, &s);
+            validation = hildon_time_editor_validate_time (editor, h, m, s, TRUE);
+            switch (validation) {
+                case VALIDATION_TIME_HOURS:
+                    if (priv->clock_24h) {
+                        if (h > HOURS_MAX_24) {
+                            h = HOURS_MAX_24;
+                        } else if (h < HOURS_MIN_24) {
+                            h = HOURS_MIN_24;
+                        }
+                    } else {
+                        if (h > HOURS_MAX_12) {
+                            h = HOURS_MAX_12;
+                        } else if (h < HOURS_MIN_12) {
+                            h = HOURS_MIN_12;
+                        }
+                    }
+                    priv->ticks = (3600 * h) + (60 * m) + s;
+                    break;
+                case VALIDATION_TIME_MINUTES:
+                    if (m > MINUTES_MAX) {
+                        m = MINUTES_MAX;
+                    } else if (m < MINUTES_MIN) {
+                        m = MINUTES_MIN;
+                    }
+                    break;
+                case VALIDATION_TIME_SECONDS:
+                    if (s > SECONDS_MAX) {
+                        s = SECONDS_MAX;
+                    } else if (s < SECONDS_MIN) {
+                        s = SECONDS_MIN;
+                    }
+                    priv->ticks = (3600 * h) + (60 * m) + s;
+                    break;
+                default:
+                    priv->ticks = ticks;
+                    break;
+            }
         }
-
-
-        sprintf(h_time, "%2u", hours);
+    } else {
+      priv->ticks = ticks;
     }
-    sprintf(m_time, "%02u", minutes);
-    sprintf(s_time, "%02u", seconds);
-
-    gtk_entry_set_text(GTK_ENTRY(priv->h_entry), h_time);
-    gtk_entry_set_text(GTK_ENTRY(priv->m_entry), m_time);
-    gtk_entry_set_text(GTK_ENTRY(priv->s_entry), s_time);
+    
+    ticks_to_time (priv->ticks, &h, &m, &s);
+    
+    ticks_to_time (priv->ticks, &h, &m, &s);
+    
+    if (!priv->clock_24h && !priv->duration_mode)
+      {
+        convert_to_12h (&h, &m, &s, &priv->am);
+      }
+
+    g_snprintf(hours,   3, "%02u", h);
+    g_snprintf(minutes, 3, "%02u", m);
+    g_snprintf(seconds, 3, "%02u", s);
+    gtk_entry_set_text(GTK_ENTRY(priv->h_entry), hours);
+    gtk_entry_set_text(GTK_ENTRY(priv->m_entry), minutes);
+    gtk_entry_set_text(GTK_ENTRY(priv->s_entry), seconds);
+       
+    priv->valid_value = TRUE;
+    priv->validated = FALSE;
 
-    /* If in duration mode check time validity */
-    if (priv->duration_mode) {
-        guint response =
-            hildon_time_editor_check_duration_validity(editor);
-        if (response != DURATION_OK)
-            hildon_time_editor_duration_handle_error(editor, response);
-    }
+    /* set current time (am/pm) */
+    gtk_label_set_label(GTK_LABEL(priv->ampm), priv->am ? priv->am_symbol :
+                        priv->pm_symbol);
+    
+    g_object_notify (G_OBJECT (editor), "ticks");
 }
 
 /**
- * hildon_time_editor_get_time:
- * @editor: the @HildonTimeEditor widget.
- * @hours: hours
- * @minutes: minutes
- * @seconds: seconds
+ * hildon_time_editor_get_ticks:
+ * @self: the @HildonTimeEditor widget.
  *
- * Gets the time of the @HildonTimeEditor widget. 
+ * This function returns the current duration, in seconds.
+ * This means seconds from midnight, if not in duration mode.
+ * 
+ * Return value: Current duration in seconds. 
  **/
-
-void hildon_time_editor_get_time(HildonTimeEditor * editor,
-                                 guint * hours,
-                                 guint * minutes, guint * seconds)
+guint hildon_time_editor_get_ticks (HildonTimeEditor * editor)
 {
     HildonTimeEditorPrivate *priv;
 
-    g_return_if_fail(editor);
-    g_return_if_fail(HILDON_IS_TIME_EDITOR(editor));
+    g_return_val_if_fail(editor, 0);
+    g_return_val_if_fail(HILDON_IS_TIME_EDITOR(editor), 0);
 
     priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
-
-    *hours = atoi(GTK_ENTRY(priv->h_entry)->text);
-
-    if( !priv->duration_mode )
-    {
-       /* if using 12h clock and its after noon, add 12h hours to get 24h
-          clock */
-       if (!priv->clock_24h && !priv->am) {
-           if (*hours != 12)
-               *hours += 12;
-       }
-       if (*hours == 12 && priv->am)
-           *hours = 0;
-    }
-
-    *minutes = atoi(GTK_ENTRY(priv->m_entry)->text);
-    *seconds = atoi(GTK_ENTRY(priv->s_entry)->text);
+    
+    return (priv->ticks);
 }
 
 /**
- * hildon_time_editor_set_duration_range:
- * @editor: the @HildonTimeEditor widget.
- * @min_seconds: minimum allowed time in seconds
- * @max_seconds: maximum allowed time in seconds
+ * hildon_time_editor_set_show_seconds:
+ * @editor: The #HildonTimeEditor.
+ * @enable: Enable or disable showing of seconds.
+ *
+ * This function shows or hides the seconds field.
  *
- * Sets the duration editor time range of the @HildonTimeEditor widget.
  **/
 
-void hildon_time_editor_set_duration_range(HildonTimeEditor * editor,
-                                           guint min_seconds,
-                                           guint max_seconds)
+void hildon_time_editor_set_show_seconds (HildonTimeEditor * editor,
+                                        gboolean show_seconds)
 {
     HildonTimeEditorPrivate *priv;
-    guint hours, minutes, seconds;
 
     g_return_if_fail(editor);
-    g_return_if_fail(HILDON_IS_TIME_EDITOR(editor));
-
-    g_return_if_fail(min_seconds >= MIN_DURATION);
-    g_return_if_fail(max_seconds <= MAX_DURATION);
-    g_return_if_fail(min_seconds < max_seconds);
 
     priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
+    if (!priv->show_s && show_seconds) {
+        priv->show_s = TRUE;
 
-    if( !priv->duration_mode )
-      return;
+        gtk_widget_show(priv->s_entry);
+        gtk_widget_show(priv->label2);
+        
+    } else if (priv->show_s && !show_seconds) {
 
-    priv->duration_min = min_seconds;
-    priv->duration_max = max_seconds;
+        gtk_widget_hide(priv->s_entry);
+        gtk_widget_hide(priv->label2);
 
-    hours = (min_seconds / 3600);
-    seconds = min_seconds - (hours * 3600);
-    minutes = (seconds / 60);
-    seconds = seconds - (minutes * 60);
+        priv->show_s = FALSE;
+    } else
+        return;
 
-    /* Set minimum allowed value for duration editor */
-    hildon_time_editor_set_time(editor, hours, minutes, seconds);
+    gtk_widget_queue_resize(GTK_WIDGET(editor));
+    
+    g_object_notify (G_OBJECT (editor), "show_seconds");
 }
 
 /**
- * hildon_time_editor_get_duration_range:
- * @editor: the @HildonTimeEditor widget.
- * @min_seconds: pointer to guint
- * @max_seconds: pointer to guint
+ * hildon_time_editor_get_show_seconds:
+ * @self: the @HildonTimeEditor widget.
  *
- * Gets the duration editor time range of the @HildonTimeEditor widget.
+ * This function returns a boolean indicating the visibility of
+ * seconds in the @HildonTimeEditor
+ *
+ * Return value: TRUE if the seconds are visible. 
  **/
 
-void hildon_time_editor_get_duration_range(HildonTimeEditor * editor,
-                                           guint * min_seconds,
-                                           guint * max_seconds)
+gboolean hildon_time_editor_get_show_seconds (HildonTimeEditor * editor)
 {
     HildonTimeEditorPrivate *priv;
 
-    g_return_if_fail(editor);
-    g_return_if_fail(HILDON_IS_TIME_EDITOR(editor));
-
+    g_return_val_if_fail (HILDON_IS_TIME_EDITOR (editor), FALSE);
     priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
-    *min_seconds = priv->duration_min;
-    *max_seconds = priv->duration_max;
+    return (priv->show_s);
 }
 
-static gboolean hildon_time_editor_check_locale(HildonTimeEditor * editor)
+/**
+ * hildon_time_editor_set_duration_mode:
+ * @editor: The #HildonTimeEditor.
+ * @enable: Enable or disable duration editor mode
+ *
+ * This function sets the duration editor mode in which the maximum hours
+ * is 99 and the #HildonTimePicker is disabled.
+ *
+ **/
+void hildon_time_editor_set_duration_mode (HildonTimeEditor * editor,
+                                         gboolean duration_mode)
 {
     HildonTimeEditorPrivate *priv;
-    gchar *t_fm;
+
+    g_return_if_fail(editor);
 
     priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
-    priv->am_symbol = g_strdup(nl_langinfo(AM_STR));
-    priv->pm_symbol = g_strdup(nl_langinfo(PM_STR));
+    /* switch to duration editor mode */
+    if (duration_mode && !priv->duration_mode) {
+        priv->duration_mode = duration_mode;
+        hildon_time_editor_set_duration_range(editor, MIN_DURATION,
+                                              MAX_DURATION);
 
-    if (!strcmp(priv->am_symbol, ""))
-        return TRUE;
-    else {
-        t_fm = g_strdup(nl_langinfo(T_FMT_AMPM));
-        /* Check what format am/pm time should be */
-        if (!strncmp(t_fm, "%p", 2))
-            priv->ampm_pos_after = FALSE;
-        priv->am_symbol =
-            g_ascii_strdown((const gchar *) priv->am_symbol, -1);
-        priv->pm_symbol =
-            g_ascii_strdown((const gchar *) priv->pm_symbol, -1);
-       g_free(t_fm);
-        return FALSE;
+        if (!priv->clock_24h)
+            gtk_widget_hide(GTK_WIDGET(priv->ampm));
+
+        gtk_widget_hide(GTK_WIDGET(priv->eventbox));
+        gtk_widget_hide(GTK_WIDGET(priv->icon));
+
+        /* Show seconds for duration editor */
+        hildon_time_editor_set_show_seconds(editor, TRUE);
+    }
+    /* switch to time editor mode */
+    else if (!duration_mode && priv->duration_mode) {
+        guint ticks;
+        time_t tm;
+        struct tm *stm;
+            
+        priv->duration_mode = duration_mode;
+
+        if (!priv->clock_24h)
+            gtk_widget_show(GTK_WIDGET(priv->ampm));
+
+        gtk_widget_show(GTK_WIDGET(priv->eventbox));
+        gtk_widget_show(GTK_WIDGET(priv->icon));
+        
+
+        /* Put the ticks to match current time, anything set in the 
+         * duration mode is bound to be invalid or useless in time mode
+         */
+        
+        tm = time(NULL);
+        stm = localtime(&tm);
+
+        ticks = HILDON_TIME_EDITOR_TIME_LOWER_VALUE;
+        
+        if (stm) {
+            ticks = stm->tm_hour * 3600;
+            ticks = ticks + stm->tm_min * 60;
+            ticks = ticks + stm->tm_sec;
+        }
+        
+        hildon_time_editor_set_ticks (editor, ticks);
+        
     }
+    gtk_widget_queue_resize(GTK_WIDGET(editor));
+    
+    g_object_notify (G_OBJECT (editor), "duration_mode");
 }
 
-static
-guint hildon_time_editor_check_duration_validity(HildonTimeEditor * editor)
+/**
+ * hildon_time_editor_get_duration_mode:
+ * @self: the @HildonTimeEditor widget.
+ *
+ * This function returns a boolean indicating whether the @HildonTimeEditor
+ * is in the duration mode.
+ * 
+ * Return value: TRUE if the @HildonTimeEditor is in duration mode. 
+ **/
+
+gboolean hildon_time_editor_get_duration_mode (HildonTimeEditor * editor)
 {
     HildonTimeEditorPrivate *priv;
-    guint seconds;
 
+    g_return_val_if_fail (HILDON_IS_TIME_EDITOR (editor), FALSE);
     priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
-    /* Get current time */
-    seconds =
-        3600 * (guint) atoi(gtk_entry_get_text(GTK_ENTRY(priv->h_entry)))
-        + 60 * (guint) atoi(gtk_entry_get_text(GTK_ENTRY(priv->m_entry)))
-        + (guint) atoi(gtk_entry_get_text(GTK_ENTRY(priv->s_entry)));
-
-    if (seconds > priv->duration_max)
-        return DURATION_MAX_EXCEED;
-    else if (seconds < priv->duration_min)
-        return DURATION_MIN_EXCEED;
-    else
-        return DURATION_OK;
+    return (priv->duration_mode);
 }
 
-static gboolean hildon_time_editor_entry_focusout(GtkWidget * widget,
-                                                  GdkEventFocus * event,
-                                                  gpointer data)
-{
-    HildonTimeEditor *editor;
+/**
+ * hildon_time_editor_set_duration_min:
+ * @self: the @HildonTimeEditor widget.
+ * @duration_min: Mimimum allowed duration.
+ *
+ * Sets the minimum allowed duration for the duration mode.
+ * Note: Has no effect in time mode
+ **/
+
+void hildon_time_editor_set_duration_min (HildonTimeEditor * editor,
+                                          guint duration_min)
+{
     HildonTimeEditorPrivate *priv;
 
-    editor = HILDON_TIME_EDITOR(data);
-    priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
+    g_return_if_fail(editor);
+    g_return_if_fail(HILDON_IS_TIME_EDITOR(editor));
 
-    /* If entry is deleted we should restore previous value for it and
-       infoprint is showed */
-    if (!strcmp(GTK_ENTRY(widget)->text, "")) {
-        if (widget == priv->h_entry) {
-            if (!priv->duration_mode && priv->clock_24h) {
-                gtk_infoprintf(GTK_WINDOW
-                              (gtk_widget_get_ancestor
-                               (widget, GTK_TYPE_WINDOW)),
-                              _("Ckct_ib_set_a_value_within_range"), 0, 23);
-            } else if (!priv->duration_mode && !priv->clock_24h) {
-                gtk_infoprintf(GTK_WINDOW
-                              (gtk_widget_get_ancestor
-                               (widget, GTK_TYPE_WINDOW)),
-                              _("Ckct_ib_set_a_value_within_range"), 1, 12); 
-            } else if (priv->duration_mode) {
-                gtk_infoprintf(GTK_WINDOW
-                              (gtk_widget_get_ancestor
-                               (widget, GTK_TYPE_WINDOW)),
-                              _("Ckct_ib_set_a_value_within_range"), 0, 99);
-            }
-            gtk_entry_set_text(GTK_ENTRY(priv->h_entry), priv->h_time);
-            gtk_widget_grab_focus (widget);
-            gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
-            priv->valid_value = FALSE;
-        } else if (widget == priv->m_entry) {
-            gtk_infoprintf(GTK_WINDOW
-                          (gtk_widget_get_ancestor
-                           (widget, GTK_TYPE_WINDOW)),
-                          _("Ckct_ib_set_a_value_within_range"), 0, 59);
-            gtk_entry_set_text(GTK_ENTRY(priv->m_entry), priv->m_time);
-            gtk_widget_grab_focus (widget);
-            gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
-            priv->valid_value = FALSE;
-        } else {
-            gtk_infoprintf(GTK_WINDOW
-                          (gtk_widget_get_ancestor
-                           (widget, GTK_TYPE_WINDOW)),
-                          _("Ckct_ib_set_a_value_within_range"), 0, 59);
-            gtk_entry_set_text(GTK_ENTRY(priv->s_entry), priv->s_time);
-            gtk_widget_grab_focus (widget);
-            gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
-            priv->valid_value = FALSE;
-        }
-    }
+    g_return_if_fail(duration_min >= MIN_DURATION);
 
-    hildon_time_editor_entry_activate(widget, data);
+    priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
-    /* FIXME - Next part is a kludge. This can only be fixed by writing
-     *         some parts of the widget again.
-     *         Widget has went trough many changes in time, so it would be
-     *         smart to re-write the whole widget and remove this kind of
-     *         kludges at the same time.
-     */
-    if( GTK_WINDOW(gtk_widget_get_ancestor(widget,
-        GTK_TYPE_WINDOW))->focus_widget == widget )
+    if( !priv->duration_mode )
+      return;
+
+    priv->duration_min = duration_min;
+    
+    /* Clamp the current value to the minimum if necessary */
+    if (priv->ticks < duration_min)
     {
-      gtk_editable_select_region( GTK_EDITABLE(widget), 0, 2);
-      return TRUE; /*This has to be here! , I hope it wont break any other
-                     implementations runned after this*/
+        hildon_time_editor_set_ticks (editor, duration_min);
     }
-    return FALSE;
+    
+    g_object_notify (G_OBJECT (editor), "duration_min");
 }
 
-static void hildon_time_editor_entry_activate(GtkWidget * widget,
-                                              gpointer data)
+/**
+ * hildon_time_editor_get_duration_min:
+ * @self: the @HildonTimeEditor widget.
+ *
+ * This function returns the smallest duration the @HildonTimeEditor
+ * allows in the duration mode.
+ * 
+ * Return value: Mimimum allowed duration in seconds. 
+ **/
+guint hildon_time_editor_get_duration_min (HildonTimeEditor * editor)
 {
+    HildonTimeEditorPrivate *priv;
 
-    HildonTimeEditor *editor;
+    g_return_val_if_fail(editor, 0);
+    g_return_val_if_fail(HILDON_IS_TIME_EDITOR(editor), 0);
+
+    priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
+
+    if( !priv->duration_mode )
+      return (0);
+
+    return (priv->duration_min);
+}
+
+/**
+ * hildon_time_editor_set_duration_max:
+ * @self: the @HildonTimeEditor widget.
+ * @duration_min: Maximum allowed duration in seconds.
+ *
+ * Sets the maximum allowed duration in seconds for the duration mode.
+ * Note: Has no effect in time mode
+ * 
+ **/
+void hildon_time_editor_set_duration_max (HildonTimeEditor * editor,
+                                          guint duration_max)
+{
     HildonTimeEditorPrivate *priv;
-    gint val;
-    gchar str[3];
 
-    g_return_if_fail(widget);
-    g_return_if_fail(data);
+    g_return_if_fail(editor);
+    g_return_if_fail(HILDON_IS_TIME_EDITOR(editor));
+
+    g_return_if_fail(duration_max <= MAX_DURATION);
 
-    editor = HILDON_TIME_EDITOR(data);
     priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
-    /* check value of the entry */
-    val = atoi(GTK_ENTRY(widget)->text);
-
-    /* check limit of the hour entry */
-    if (widget == priv->h_entry) {
-        /* 24h clock or in duration editor mode */
-        if (priv->clock_24h || priv->duration_mode) {
-            /* too big */
-            if (!priv->duration_mode && val > 23) {
-                gtk_infoprintf(GTK_WINDOW
-                              (gtk_widget_get_ancestor
-                               (widget, GTK_TYPE_WINDOW)),
-                              _("Ckct_ib_maximum_value"), 23);
-                gtk_entry_set_text(GTK_ENTRY(widget), "23");
-                gtk_widget_grab_focus(widget);
-                gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
-                priv->valid_value = FALSE;
-            }
-            /* ok, pad with 0 */
-            /* too big */
-            else if (priv->duration_mode && val > 99) {
-                gtk_infoprintf(GTK_WINDOW
-                              (gtk_widget_get_ancestor
-                               (widget, GTK_TYPE_WINDOW)),
-                              _("Ckct_ib_maximum_value"), 99);
-                gtk_entry_set_text(GTK_ENTRY(widget), "99");
-                gtk_widget_grab_focus(widget);
-                gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
-                priv->valid_value = FALSE;
-            } else {
-                sprintf(str, "%02d", val);
-                gtk_entry_set_text(GTK_ENTRY(widget), str);
-            }
-        }
-        /* 12h clock */
-        else {
-            /* too big */
-            if (val > 12) {
-                gtk_infoprintf(GTK_WINDOW
-                              (gtk_widget_get_ancestor
-                               (widget, GTK_TYPE_WINDOW)),
-                              _("Ckct_ib_maximum_value"), 12);
-                gtk_entry_set_text(GTK_ENTRY(widget), "12");
-                gtk_widget_grab_focus(widget);
-                gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
-                priv->valid_value = FALSE;
-            }
-            /* ok, no padding */
-            else if (val < 1) {
-                gtk_infoprintf(GTK_WINDOW
-                              (gtk_widget_get_ancestor
-                               (widget, GTK_TYPE_WINDOW)),
-                              _("Ckct_ib_minimum_value"), 1);
-                gtk_entry_set_text(GTK_ENTRY(widget), "01");
-                gtk_widget_grab_focus(widget);
-                gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
-                priv->valid_value = FALSE;
-            } else {
-                sprintf(str, "%02d", val);
-                gtk_entry_set_text(GTK_ENTRY(widget), str);
-            }
-        }
+    if( !priv->duration_mode )
+      return;
 
+    priv->duration_max = duration_max;
+    
+    /* Clamp the current value to the maximum if necessary */
+    if (priv->ticks > duration_max)
+    {
+        hildon_time_editor_set_ticks (editor, duration_max);
     }
-    /* check limit of the minute entries */
-    else if (widget == priv->m_entry) {
-        /* too big */
-        if (val > 59) {
-            gtk_infoprintf(GTK_WINDOW
-                          (gtk_widget_get_ancestor
-                           (widget, GTK_TYPE_WINDOW)),
-                          _("Ckct_ib_maximum_value"), 59);
-            gtk_entry_set_text(GTK_ENTRY(widget), "59");
-            gtk_widget_grab_focus(widget);
-            gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
-            priv->valid_value = FALSE;
-        }
-        /* ok, pad with 0 */
-        else {
-            sprintf(str, "%02d", val);
-            gtk_entry_set_text(GTK_ENTRY(widget), str);
-        }
-    }
-    /* check limit of the seconds entries */
-    else if (widget == priv->s_entry) {
-        /* too big */
-        if (val > 59) {
-            gtk_infoprintf(GTK_WINDOW
-                          (gtk_widget_get_ancestor
-                           (widget, GTK_TYPE_WINDOW)),
-                          _("Ckct_ib_maximum_value"), 59);
-            gtk_entry_set_text(GTK_ENTRY(widget), "59");
-            gtk_widget_grab_focus(widget);
-            gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
-            priv->valid_value = FALSE;
-        }
-        /* ok, pad with 0 */
-        else {
-            sprintf(str, "%02d", val);
-            gtk_entry_set_text(GTK_ENTRY(widget), str);
-        }
-    }
-    /* Handle duration mode minimum and maximum range */
+    
+    g_object_notify (G_OBJECT (editor), "duration_max");
+}
+
+/**
+ * hildon_time_editor_get_duration_max:
+ * @self: the @HildonTimeEditor widget.
+ *
+ * This function returns the longest duration the @HildonTimeEditor
+ * allows in the duration mode.
+ * 
+ * Return value: Maximum allowed duration in seconds. 
+ **/
+guint hildon_time_editor_get_duration_max (HildonTimeEditor * editor)
+{
+    HildonTimeEditorPrivate *priv;
+
+    g_return_val_if_fail(editor, 0);
+    g_return_val_if_fail(HILDON_IS_TIME_EDITOR(editor), 0);
+
+    priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
+
+    if( !priv->duration_mode )
+      return (0);
+
+    return (priv->duration_max);
+}
+
+
+/**
+ * hildon_time_editor_set_time:
+ * @editor: the @HildonTimeEditor widget.
+ * @hours: hours
+ * @minutes: minutes
+ * @seconds: seconds
+ *
+ * This function sets the time on an existing time editor. If the
+ * time specified by the arguments is invalid, the function returns
+ * without doing anything else. The time is assumed to be in 24h format.
+ *  
+ **/
+
+void hildon_time_editor_set_time(HildonTimeEditor * editor, guint hours,
+                                 guint minutes, guint seconds)
+{
+    g_return_if_fail(HILDON_IS_TIME_EDITOR(editor));
+
+    hildon_time_editor_set_ticks (editor, hours * 3600 + minutes * 60 + seconds);
+
+}
+
+/**
+ * hildon_time_editor_get_time:
+ * @editor: the @HildonTimeEditor widget.
+ * @hours: hours
+ * @minutes: minutes
+ * @seconds: seconds
+ *
+ * Gets the time of the @HildonTimeEditor widget. The time returned is
+ * always in 24h format.
+ **/
+
+void hildon_time_editor_get_time(HildonTimeEditor * editor,
+                                 guint * hours,
+                                 guint * minutes, guint * seconds)
+{
+    HildonTimeEditorPrivate *priv;
+    
+    g_return_if_fail(editor);
+    g_return_if_fail(HILDON_IS_TIME_EDITOR(editor));
+
+    priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
+
+    ticks_to_time (hildon_time_editor_get_ticks (editor),
+                   hours, minutes, seconds);
+
+}
+
+/**
+ * hildon_time_editor_set_duration_range:
+ * @editor: the @HildonTimeEditor widget.
+ * @min_seconds: minimum allowed time in seconds
+ * @max_seconds: maximum allowed time in seconds
+ *
+ * Sets the duration editor time range of the @HildonTimeEditor widget.
+ **/
+
+void hildon_time_editor_set_duration_range(HildonTimeEditor * editor,
+                                           guint min_seconds,
+                                           guint max_seconds)
+{
+    HildonTimeEditorPrivate *priv;
+    guint tmp;
+    
+    g_return_if_fail(editor);
+    g_return_if_fail(HILDON_IS_TIME_EDITOR(editor));
+
+    priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
+    /* Swap values if reversed */
+    if (min_seconds > max_seconds)
+      {
+        tmp = max_seconds;
+        max_seconds = min_seconds;
+        min_seconds = tmp;
+      }
+    
+    hildon_time_editor_set_duration_max (editor, max_seconds);
+    hildon_time_editor_set_duration_min (editor, min_seconds);
+
     if (priv->duration_mode) {
-        guint response;
+        /* Set minimum allowed value for duration editor */
+        hildon_time_editor_set_ticks(editor, min_seconds);
+    }
+}
 
-        response = hildon_time_editor_check_duration_validity(editor);
-        if (response != DURATION_OK)
-        {
-            hildon_time_editor_duration_handle_error(editor, response);
-            /* We have to grab focus back, as the specification says. */
-            if( GTK_IS_EDITABLE(widget) )
-              gtk_widget_grab_focus( widget );
-        }
+/**
+ * hildon_time_editor_get_duration_range:
+ * @editor: the @HildonTimeEditor widget.
+ * @min_seconds: pointer to guint
+ * @max_seconds: pointer to guint
+ *
+ * Gets the duration editor time range of the @HildonTimeEditor widget.
+ **/
+
+void hildon_time_editor_get_duration_range(HildonTimeEditor * editor,
+                                           guint * min_seconds,
+                                           guint * max_seconds)
+{
+    HildonTimeEditorPrivate *priv;
+
+    g_return_if_fail(editor);
+    g_return_if_fail(HILDON_IS_TIME_EDITOR(editor));
+
+    priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
+
+    *min_seconds = priv->duration_min;
+    *max_seconds = priv->duration_max;
+}
+
+static gboolean hildon_time_editor_check_locale(HildonTimeEditor * editor)
+{
+    HildonTimeEditorPrivate *priv;
+    gchar *t_fm;
+
+    priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
+
+    priv->am_symbol = g_strdup(nl_langinfo(AM_STR));
+    priv->pm_symbol = g_strdup(nl_langinfo(PM_STR));
+
+    if (!strcmp(priv->am_symbol, ""))
+        return TRUE;
+    else {
+        t_fm = g_strdup(nl_langinfo(T_FMT_AMPM));
+        /* Check what format am/pm time should be */
+        if (!strncmp(t_fm, "%p", 2))
+            priv->ampm_pos_after = FALSE;
+        priv->am_symbol =
+            g_ascii_strdown((const gchar *) priv->am_symbol, -1);
+        priv->pm_symbol =
+            g_ascii_strdown((const gchar *) priv->pm_symbol, -1);
+        g_free(t_fm);
+        return FALSE;
     }
 }
 
-static void
-hildon_time_editor_duration_handle_error(HildonTimeEditor * editor,
-                                         guint type)
+static gboolean hildon_time_editor_entry_focusin(GtkWidget * widget,
+                                                 GdkEventFocus * event, 
+                                                 gpointer data)
+{
+    if (!GTK_ENTRY(widget)->button)
+        gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
+
+    return FALSE;
+}
+
+
+void
+hildon_time_editor_validate (HildonTimeEditor *editor)
 {
+    guint max_hours = 0;
+    guint min_hours = 0;
+    guint max_minutes = 0;
+    guint min_minutes = 0;
+    guint max_seconds = 0;
+    guint min_seconds = 0;
+
     HildonTimeEditorPrivate *priv;
-    guint hours, minutes, seconds, totalsecs;
-    gchar str[256], t_str[3];
+    HildonValidation validation;
+
+    GtkWindow *window;
+    guint h,m,s;
 
     priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
-    if (type == DURATION_MAX_EXCEED)
-        totalsecs = priv->duration_max;
-    else
-        totalsecs = priv->duration_min;
+    window = GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (editor),
+                                                  GTK_TYPE_WINDOW));
+
+    hildon_time_editor_get_max_values(editor, 
+            &max_hours, &min_hours, 
+            &max_minutes, &min_minutes, 
+            &max_seconds, &min_seconds);
+            
+    /* No empty values thank you */
+    if (strlen(GTK_ENTRY(priv->h_entry)->text) == 0)
+      {
+        if (!priv->duration_mode)
+          {
+            if (priv->clock_24h)
+              {
+                gtk_infoprintf(window,
+                               _("Ckct_ib_set_a_value_within_range"),
+                               0, 23);
+              }
+            else
+              {
+                gtk_infoprintf(window,
+                               _("Ckct_ib_set_a_value_within_range"),
+                               0, 12);
+              }
+          }
+        else
+          {
+            gtk_infoprintf(window,
+                           _("Ckct_ib_set_a_value_within_range"),
+                           min_hours, max_hours);
+          }
+        hildon_time_editor_set_ticks (editor, priv->ticks);
+        gtk_widget_grab_focus (priv->h_entry);
+      }
+    else if (strlen(GTK_ENTRY(priv->m_entry)->text) == 0)
+      {
+        if (!priv->duration_mode)
+          {
+            gtk_infoprintf(window,
+                           _("Ckct_ib_set_a_value_within_range"),
+                           0, 59);
+          }
+        else
+          {
+            gtk_infoprintf(window,
+                           _("Ckct_ib_set_a_value_within_range"),
+                           min_minutes, max_minutes);
+          }
+        hildon_time_editor_set_ticks (editor, priv->ticks);
+        gtk_widget_grab_focus (priv->m_entry);
+      }
+    else if (strlen(GTK_ENTRY(priv->s_entry)->text) == 0)
+      {
+        if (!priv->duration_mode)
+          {
+            gtk_infoprintf(window,
+                           _("Ckct_ib_set_a_value_within_range"),
+                           0, 59);
+          }
+        else
+          {
+            gtk_infoprintf(window,
+                           _("Ckct_ib_set_a_value_within_range"),
+                           min_seconds, max_seconds);
+          }
+        hildon_time_editor_set_ticks (editor, priv->ticks);
+        gtk_widget_grab_focus (priv->s_entry);
+      }
+    /* Do the validation dance! */
+    else 
+      {
+
+        h = (guint) atoi(gtk_entry_get_text(GTK_ENTRY(priv->h_entry)));
+        m = (guint) atoi(gtk_entry_get_text(GTK_ENTRY(priv->m_entry)));
+        s = (guint) atoi(gtk_entry_get_text(GTK_ENTRY(priv->s_entry)));
+      
+        if (priv->duration_mode)
+          {
+            validation = hildon_time_editor_validate_duration (editor,
+                                                               h*3600 + m*60 + s);
+          
+            switch (validation)
+              {
+                case VALIDATION_DURATION_MIN:
+                  gtk_infoprintf(window,
+                                 _("Ckct_ib_min_allowed_duration_hts"),
+                                 min_hours, min_minutes, min_seconds);
+                  hildon_time_editor_set_ticks (editor, priv->duration_min);
+                  break;
+                case VALIDATION_DURATION_MAX:
+                  gtk_infoprintf(window,
+                                 _("Ckct_ib_max_allowed_duration_hts"),
+                                 max_hours, max_minutes, max_seconds);
+                  hildon_time_editor_set_ticks (editor, priv->duration_max);
+                  break;
+                default:
+                  hildon_time_editor_set_ticks (editor, h*3600 + m*60 + s);
+                  break;
+              }
+          }
+        else
+          {
+            validation = hildon_time_editor_validate_time (editor, h, m, s, priv->clock_24h);
+            switch (validation)
+              {
+                case VALIDATION_TIME_HOURS:
+                  if (priv->clock_24h)
+                    {
+                      if (h > HOURS_MAX_24)
+                        {
+                          gtk_infoprintf(window,
+                                         _("Ckct_ib_maximum_value"),
+                                         HOURS_MAX_24);
+                          h = HOURS_MAX_24;
+                        }
+                      else
+                        {
+                          gtk_infoprintf(window,
+                                         _("Ckct_ib_minimum_value"),
+                                         HOURS_MIN_24);
+                          h = HOURS_MIN_24;
+                        }
+                    }
+                  else
+                    {
+                      if (h > HOURS_MAX_12)
+                        {
+                          gtk_infoprintf(window,
+                                         _("Ckct_ib_maximum_value"),
+                                         HOURS_MAX_12);
+                          h = HOURS_MAX_12;
+                        }
+                      else
+                        {
+                          gtk_infoprintf(window,
+                                         _("Ckct_ib_minimum_value"),
+                                         HOURS_MIN_12);
+                          h = HOURS_MIN_12;
+                        }
+                    }
+                  if (!priv->clock_24h)
+                    convert_to_24h (&h, &m, &s, priv->am);
+                  hildon_time_editor_set_time (editor, h, m, s);
+                  gtk_widget_grab_focus (priv->h_entry);
+                  gtk_editable_select_region(GTK_EDITABLE(priv->h_entry), 0, 2);
+                  break;
+                case VALIDATION_TIME_MINUTES:
+                  if (m > MINUTES_MAX)
+                    {
+                      gtk_infoprintf(window,
+                                     _("Ckct_ib_maximum_value"),
+                                     MINUTES_MAX);
+                      m = MINUTES_MAX;
+                    }
+                  else
+                    {
+                      gtk_infoprintf(window,
+                                     _("Ckct_ib_minimum_value"),
+                                     MINUTES_MIN);
+                      m = MINUTES_MIN;
+                    }
+                  if (!priv->clock_24h)
+                    convert_to_24h (&h, &m, &s, priv->am);
+                  hildon_time_editor_set_time (editor, h, m, s);
+                  gtk_widget_grab_focus (priv->m_entry);
+                  gtk_editable_select_region(GTK_EDITABLE(priv->m_entry), 0, 2);
+                  break;
+                case VALIDATION_TIME_SECONDS:
+                  if (s > SECONDS_MAX)
+                    {
+                      gtk_infoprintf(window,
+                                     _("Ckct_ib_maximum_value"),
+                                     SECONDS_MAX);
+                      s = SECONDS_MAX;
+                    }
+                  else
+                    {
+                      gtk_infoprintf(window,
+                                     _("Ckct_ib_minimum_value"),
+                                     SECONDS_MIN);
+                      s = SECONDS_MIN;
+                    }
+                  if (!priv->clock_24h)
+                    convert_to_24h (&h, &m, &s, priv->am);
+                  hildon_time_editor_set_time (editor, h, m, s);
+                  gtk_widget_grab_focus (priv->s_entry);
+                  gtk_editable_select_region(GTK_EDITABLE(priv->s_entry), 0, 2);
+                  break;
+                default:
+                  if (!priv->clock_24h)
+                    {
+                      convert_to_24h (&h, &m, &s, priv->am);
+                    }
+                  hildon_time_editor_set_time (editor, h, m, s);
+                  break;
+              }
+          }
+        
+      }
+}
 
-    hours = (totalsecs / 3600);
-    seconds = totalsecs - (hours * 3600);
-    minutes = (seconds / 60);
-    seconds = seconds - (minutes * 60);
+static gboolean hildon_time_editor_entry_focusout(GtkWidget * widget,
+                                                  GdkEventFocus * event,
+                                                  gpointer data)
+{
+  HildonTimeEditor *editor;
 
-    if (!type)
-        g_snprintf(str, 256,
-                   _("Minimum allowed duration is %02d:%02d:%02d\n"),
-                   hours, minutes, seconds);
-     
-    else
-        g_snprintf(str, 256,
-                   _("Maximum allowed duration is %02d:%02d:%02d\n"),
-                   hours, minutes, seconds);
+  editor = HILDON_TIME_EDITOR(data);
 
-    /* set correct values to duration editor */
-    sprintf(t_str, "%02u", hours);
-    gtk_entry_set_text(GTK_ENTRY(priv->h_entry), t_str);
-    sprintf(t_str, "%02u", minutes);
-    gtk_entry_set_text(GTK_ENTRY(priv->m_entry), t_str);
-    sprintf(t_str, "%02u", seconds);
-    gtk_entry_set_text(GTK_ENTRY(priv->s_entry), t_str);
-
-    /* show infoprint */
-    gtk_infoprint(GTK_WINDOW
-                  (gtk_widget_get_ancestor
-                  (GTK_WIDGET(editor), GTK_TYPE_WINDOW)), str);
+  hildon_time_editor_validate (editor);
+
+  return FALSE;
 }
 
 static gboolean
@@ -1032,20 +1580,29 @@ hildon_time_editor_ampm_clicked(GtkWidget * widget,
                                 GdkEventButton * event, gpointer data)
 {
     HildonTimeEditor *editor;
-    HildonTimeEditorPrivate *priv;
+    HildonTimeEditorPrivate *priv = NULL;
 
     g_return_val_if_fail(widget, FALSE);
     g_return_val_if_fail(data, FALSE);
 
+
     editor = HILDON_TIME_EDITOR(data);
     priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
+    /* validate to set the time and get infoprints
+     * if the user was editing the value
+     */
+    hildon_time_editor_validate (editor);
     if (priv->am) {
-        gtk_label_set_text(GTK_LABEL(priv->ampm), priv->pm_symbol);
-        priv->am = FALSE;
+      if (priv->ticks >= (12*3600))
+        {
+          hildon_time_editor_set_ticks (editor, priv->ticks - 12*3600);
+        } else 
+        {
+          hildon_time_editor_set_ticks (editor, priv->ticks + 12*3600);
+        }
     } else {
-        gtk_label_set_text(GTK_LABEL(priv->ampm), priv->am_symbol);
-        priv->am = TRUE;
+        hildon_time_editor_set_ticks (editor, priv->ticks - 12*3600);
     }
     return FALSE;
 }
@@ -1069,11 +1626,6 @@ hildon_time_editor_icon_clicked(GtkWidget * widget, gpointer data)
     if (priv->duration_mode)
         return FALSE;
 
-    /* Check that we have valid values in entries */
-    hildon_time_editor_entry_activate(priv->h_entry, data);
-    hildon_time_editor_entry_activate(priv->m_entry, data);
-    hildon_time_editor_entry_activate(priv->s_entry, data);
-
     parent = gtk_widget_get_ancestor(GTK_WIDGET(editor), GTK_TYPE_WINDOW);
     picker = hildon_time_picker_new(GTK_WINDOW(parent));
 
@@ -1099,16 +1651,17 @@ static gboolean hildon_time_editor_entry_clicked(GtkWidget * widget,
                                                  GdkEventButton * event,
                                                  gpointer data)
 {
-     HildonTimeEditor *editor;
-     HildonTimeEditorPrivate *priv;
+    HildonTimeEditor *editor;
+    HildonTimeEditorPrivate *priv;
+
+    editor = HILDON_TIME_EDITOR (data);
+    priv = HILDON_TIME_EDITOR_GET_PRIVATE (editor);
 
-     editor = HILDON_TIME_EDITOR (data);
-     priv = HILDON_TIME_EDITOR_GET_PRIVATE (editor);
-     
-     if (!priv->valid_value)
-       priv->valid_value = TRUE;
-     else
-       gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
+    /* If the focus has been grabbed back before the "clicked"
+     * signal gets processed, don't highlight the text
+     */
+    if (gtk_widget_is_focus (widget))
+        gtk_editable_select_region(GTK_EDITABLE(widget), 0, 2);
 
     return FALSE;
 }
@@ -1126,10 +1679,7 @@ static void hildon_time_editor_size_request(GtkWidget * widget,
     gtk_widget_size_request(priv->frame, &req);
     *requisition = req;
 
-    requisition->width = TIME_EDITOR_LBORDER +
-        TIME_EDITOR_RBORDER + TIME_EDITOR_CLOCK_BORDER +
-        widget->style->xthickness * 2;
-
+    requisition->width = TIME_EDITOR_LBORDER + TIME_EDITOR_RBORDER;
 
     gtk_widget_size_request(priv->h_entry, &req);
     requisition->width += req.width;
@@ -1140,8 +1690,12 @@ static void hildon_time_editor_size_request(GtkWidget * widget,
     gtk_widget_size_request(priv->label, &req);
     requisition->width += req.width;
 
-    gtk_widget_size_request(priv->iconbutton, &req);
-    requisition->width += req.width;
+    if (priv->iconbutton && GTK_WIDGET_VISIBLE(priv->iconbutton))
+    {
+        gtk_widget_size_request(priv->iconbutton, &req);
+        requisition->width += ICON_WIDTH + ICON_PRESSED + 
+                              TIME_EDITOR_CLOCK_BORDER;
+    }
 
     if (priv->show_s) {
         gtk_widget_size_request(priv->s_entry, &req);
@@ -1156,7 +1710,7 @@ static void hildon_time_editor_size_request(GtkWidget * widget,
         requisition->width += req.width + 4;
     }
 
-    requisition->height = TIME_EDITOR_HEIGHT;
+    requisition->height = TIME_EDITOR_HEIGHT + widget->style->ythickness * 2;
 }
 
 static void set_widget_allocation(GtkWidget * widget,
@@ -1182,141 +1736,134 @@ static void set_widget_allocation(GtkWidget * widget,
 static void hildon_time_editor_size_allocate(GtkWidget * widget,
                                              GtkAllocation * allocation)
 {
-        HildonTimeEditor *editor;
-        HildonTimeEditorPrivate *priv;
-        GtkAllocation alloc;
-        GtkRequisition child_requisition;
-        gint frame_w = 0, mod_w = 0;
+    HildonTimeEditor *editor;
+    HildonTimeEditorPrivate *priv;
+    GtkAllocation alloc;
+    GtkAllocation child_alloc;
+    GtkRequisition child_requisition;
+    gint mod_w = 0;
+    gint tmp;
 
-        editor = HILDON_TIME_EDITOR(widget);
-        priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
+    editor = HILDON_TIME_EDITOR(widget);
+    priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
-        widget->allocation = *allocation;
+    widget->allocation = *allocation;
 
-/*Init start values*/
-        alloc.y = widget->allocation.y + widget->style->ythickness;
-        
-        if (widget->allocation.height > TIME_EDITOR_HEIGHT) {
-            alloc.height =
-                TIME_EDITOR_HEIGHT - widget->style->ythickness * 2;
-            alloc.y +=
-                (widget->allocation.height - TIME_EDITOR_HEIGHT) / 2;
-        } else
-            alloc.height =
-                widget->allocation.height - widget->style->ythickness * 2;
-
-        if (alloc.height < 0)
-            alloc.height = 0;
-
-        gtk_widget_size_request(widget, &child_requisition);
-        if (allocation->width > child_requisition.width) {
-            mod_w = (allocation->width - child_requisition.width) / 2;
-            alloc.x = allocation->x + mod_w + widget->style->xthickness +
-                      TIME_EDITOR_LBORDER;
-        } else
-            alloc.x = allocation->x + widget->style->xthickness +
-                      TIME_EDITOR_LBORDER;
-
-        /* am/pm label */
-        if (!priv->duration_mode) {
-            if (!priv->clock_24h && !priv->ampm_pos_after) {
-                gint tmp = alloc.height;
-
-                alloc.x += 4;
-                alloc.y -= 5;
-                alloc.height = 27;
-                set_widget_allocation(priv->eventbox, &alloc,
-                                      &widget->allocation);
-                alloc.y += 5;
-                alloc.height = tmp;
-            }
-        }
-        
-        /* hour */
-        if (priv->h_entry && GTK_WIDGET_VISIBLE(priv->h_entry))
-            set_widget_allocation(priv->h_entry, &alloc,
-                                  &widget->allocation);
-
-/* -5/+5 just to make it look nice -- Hildon --
- * Same y -value for the label, does not just look good
- * This may be a kludge, or then not
- */
-        /* first label */
-        if (priv->label && GTK_WIDGET_VISIBLE(priv->label)) {
-            alloc.y -= 5;
-            set_widget_allocation(priv->label, &alloc,
-                                  &widget->allocation);
-            alloc.y += 5;
-        }
+    /*Init start values*/
+    alloc.y = widget->allocation.y + widget->style->ythickness;
 
-        /* minutes */
-        if (priv->m_entry && GTK_WIDGET_VISIBLE(priv->m_entry))
-            set_widget_allocation(priv->m_entry, &alloc,
-                                  &widget->allocation);
+    if (widget->allocation.height > (TIME_EDITOR_HEIGHT +
+                                     widget->style->ythickness * 2)) {
+        alloc.height = TIME_EDITOR_HEIGHT;
+        alloc.y +=
+            (widget->allocation.height - TIME_EDITOR_HEIGHT) / 2;
+    } else
+        alloc.height =
+            widget->allocation.height - widget->style->ythickness * 2;
 
-        if (priv->show_s) {
-            /* seconds label */
-            if (priv->label2) {
-                alloc.y -= 5;
-                set_widget_allocation(priv->label2, &alloc,
-                                      &widget->allocation);
-                alloc.y += 5;
-            }
+    if (alloc.height < 0)
+        alloc.height = 0;
 
-            /* seconds */
-            if (priv->s_entry)
-                set_widget_allocation(priv->s_entry, &alloc,
-                                      &widget->allocation);
-        }
+    gtk_widget_get_child_requisition(widget, &child_requisition);
+    if (allocation->width > child_requisition.width) {
+        mod_w = (allocation->width - child_requisition.width) / 2;
+        alloc.x = allocation->x + mod_w;
+    } else
+        alloc.x = allocation->x;
 
-        /* am/pm label after the rest */
-        if (!priv->duration_mode) {
-            if (!priv->clock_24h && priv->ampm_pos_after) {
-                gint tmp = alloc.height;
-
-                alloc.y -= 5;
-                alloc.height = 27;
-                set_widget_allocation(priv->eventbox, &alloc,
-                                      &widget->allocation);
-                alloc.y += 5;
-                alloc.height = tmp;
-                alloc.x += 4;
-            }
-        }
-        frame_w = alloc.x - widget->allocation.x + TIME_EDITOR_RBORDER;
-
-        /* icon */
-        if (priv->iconbutton && GTK_WIDGET_VISIBLE(priv->iconbutton)) {
-            alloc.x += TIME_EDITOR_CLOCK_BORDER;
-            alloc.height = ICON_HEIGHT;
-            alloc.width = ICON_WIDTH;
-            set_widget_allocation(priv->iconbutton, &alloc,
-                                  &widget->allocation);
-        }
 
-        /* frame */
-        if (allocation->width > child_requisition.width) {
-            alloc.x = allocation->x + mod_w;
-            alloc.width = frame_w - mod_w;
+    /** frame **/
+    if (priv->frame && GTK_WIDGET_VISIBLE(priv->frame))
+    {
+        alloc.width = child_requisition.width -
+            TIME_EDITOR_CLOCK_BORDER - ICON_WIDTH - ICON_PRESSED;
+        gtk_widget_size_allocate(priv->frame, &alloc);
+    }
 
-        } else {
-            alloc.x = allocation->x;
-            alloc.width = frame_w;
-        }
+    /** icon **/
+    if (priv->iconbutton && GTK_WIDGET_VISIBLE(priv->iconbutton)) {
+        gtk_widget_get_child_requisition(priv->iconbutton, 
+                &child_requisition);
 
-        gtk_widget_get_child_requisition(priv->frame, &child_requisition);
+        child_alloc.x = alloc.x + alloc.width + TIME_EDITOR_CLOCK_BORDER;
 
-        alloc.y = allocation->y;
-        
-        if (widget->allocation.height > TIME_EDITOR_HEIGHT) {
-            alloc.height = TIME_EDITOR_HEIGHT;
-            alloc.y +=
-                (widget->allocation.height - TIME_EDITOR_HEIGHT) / 2;
+        if(alloc.height > ICON_HEIGHT)
+            child_alloc.y = alloc.y + (alloc.height - ICON_HEIGHT) / 2 -1;
+        else
+            child_alloc.y = alloc.y;
+        child_alloc.height = ICON_HEIGHT + ICON_PRESSED / 2;
+        child_alloc.width = ICON_WIDTH + ICON_PRESSED;
+        gtk_widget_size_allocate(priv->iconbutton, &child_alloc);
+    }
 
-        } else
-            alloc.height = widget->allocation.height;
+    /* allocation of the entry widgets */
+    child_alloc.x = alloc.x + TIME_EDITOR_LBORDER;
+    child_alloc.y = alloc.y + ENTRY_BORDER;
+    child_alloc.height = TIME_EDITOR_HEIGHT - (ENTRY_BORDER * 2);
 
-        gtk_widget_size_allocate(priv->frame, &alloc);
+    /* am/pm label (when first) */
+    if (!priv->duration_mode) {
+        if (!priv->clock_24h && !priv->ampm_pos_after)
+            set_widget_allocation(priv->eventbox, &child_alloc,
+                    &widget->allocation);
+    }
+
+    /* hours */
+    if (priv->h_entry && GTK_WIDGET_VISIBLE(priv->h_entry))
+        set_widget_allocation(priv->h_entry, &child_alloc,
+                &widget->allocation);
+
+    /* first separator label */
+    if (priv->label && GTK_WIDGET_VISIBLE(priv->label))
+      {
+        /* Don't offset the labels from the top */
+        tmp = child_alloc.y;
+        child_alloc.y = 0;
+        child_alloc.height += tmp;
+        set_widget_allocation(priv->label, &child_alloc,
+                &widget->allocation);
+        child_alloc.height -= tmp;
+        child_alloc.y = tmp;
+      }
+    /* minutes */
+    if (priv->m_entry && GTK_WIDGET_VISIBLE(priv->m_entry))
+        set_widget_allocation(priv->m_entry, &child_alloc,
+                &widget->allocation);
+
+    if (priv->show_s) {
+        /* second separator label */
+        if (priv->label2)
+          {
+            /* Don't offset the labels from the top */
+            tmp = child_alloc.y;
+            child_alloc.y = 0;
+            child_alloc.height += tmp;
+            set_widget_allocation(priv->label2, &child_alloc,
+                    &widget->allocation);
+            child_alloc.height -= tmp;
+            child_alloc.y = tmp;
+          }
+
+        /* seconds */
+        if (priv->s_entry)
+            set_widget_allocation(priv->s_entry, &child_alloc,
+                    &widget->allocation);
+    }
+
+    /* am/pm label (when last) */
+    if (!priv->duration_mode) {
+        if (!priv->clock_24h && priv->ampm_pos_after)
+          {
+            /* Don't offset the labels from the top */
+            tmp = child_alloc.y;
+            child_alloc.y = 0;
+            child_alloc.height += tmp;
+            set_widget_allocation(priv->eventbox, &child_alloc,
+                    &widget->allocation);
+            child_alloc.height -= tmp;
+            child_alloc.y = tmp;
+          }
+    }
 }
 
 static gboolean hildon_time_editor_entry_keypress(GtkWidget * widget,
@@ -1336,13 +1883,17 @@ static gboolean hildon_time_editor_entry_keypress(GtkWidget * widget,
 
     pos = gtk_editable_get_position(GTK_EDITABLE(widget));
 
-    if (event->keyval == GDK_KP_Enter || event->keyval == GDK_Return) {
+    if (event->keyval == GDK_Return) {
         /* Check that we have correct values in entries */
-        hildon_time_editor_entry_activate(widget, data);
+        hildon_time_editor_validate (editor);
         _gtk_button_set_depressed(GTK_BUTTON(priv->iconbutton), TRUE);
         hildon_time_editor_icon_clicked(widget, data);
         _gtk_button_set_depressed(GTK_BUTTON(priv->iconbutton), FALSE);
+        return TRUE;
     }
+    
+    if  (event->keyval == GDK_KP_Enter)
+        return FALSE;
 
     /* We don't want wrap */
     if (event->keyval == GDK_KP_Left || event->keyval == GDK_Left) {
@@ -1368,10 +1919,13 @@ static gboolean hildon_time_editor_entry_keypress(GtkWidget * widget,
 
         c->key_press_event(widget, event);
 
-        /* Set time values to our internal struct */
-        g_snprintf(priv->h_time, 4, "%s", GTK_ENTRY(priv->h_entry)->text);
-        g_snprintf(priv->m_time, 4, "%s", GTK_ENTRY(priv->m_entry)->text);
-        g_snprintf(priv->s_time, 4, "%s", GTK_ENTRY(priv->s_entry)->text);
+        if (GTK_IS_ENTRY (widget))
+          {
+            if (strlen (gtk_entry_get_text (GTK_ENTRY (widget))) == 2)
+              {
+                hildon_time_editor_validate (editor);
+              }
+          }
 
         return TRUE;
     }
@@ -1488,84 +2042,267 @@ static gboolean hildon_time_editor_entry_keypress(GtkWidget * widget,
     return TRUE;
 }
 
-/**
- * hildon_time_editor_show_seconds:
- * @editor: The #HildonTimeEditor.
- * @enable: Enable or disable showing of seconds.
- *
- * This function shows or hides the seconds field.
- *
- **/
-void hildon_time_editor_show_seconds(HildonTimeEditor * editor,
-                                     gboolean enable)
+static HildonValidation
+hildon_time_editor_validate_duration (HildonTimeEditor * editor, guint ticks)
 {
-    HildonTimeEditorPrivate *priv;
+  HildonTimeEditorPrivate *priv;
 
-    g_return_if_fail(editor);
+  g_return_val_if_fail (editor, VALIDATION_ERROR);
 
-    priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
+  priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
-    if (!priv->show_s && enable) {
-        priv->show_s = TRUE;
+  if (ticks > priv->duration_max)
+    return VALIDATION_DURATION_MAX;
 
-        gtk_widget_show(priv->s_entry);
-        gtk_widget_show(priv->label2);
-        
-    } else if (priv->show_s && !enable) {
+  if (ticks < priv->duration_min)
+    return VALIDATION_DURATION_MIN;
 
-        gtk_widget_hide(priv->s_entry);
-        gtk_widget_hide(priv->label2);
+  return (VALIDATION_OK);
+}
 
-        priv->show_s = FALSE;
-    } else
-        return;
 
-    gtk_widget_queue_resize(GTK_WIDGET(editor));
+static HildonValidation
+hildon_time_editor_validate_time (HildonTimeEditor * editor,
+                                  guint hours,
+                                  guint minutes,
+                                  guint seconds,
+                                  gboolean mode_24h)
+{
+  HildonTimeEditorPrivate *priv;
+
+  g_return_val_if_fail (editor, VALIDATION_ERROR);
+
+  priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
+
+  priv->validated = FALSE;
+
+  if (mode_24h) {
+    if (hours < HOURS_MIN_24 || hours > HOURS_MAX_24)
+        return VALIDATION_TIME_HOURS;
+  } else {
+    if (hours < HOURS_MIN_12 || hours > HOURS_MAX_12)
+        return VALIDATION_TIME_HOURS;
+  }
+
+  if (minutes < MINUTES_MIN || minutes > MINUTES_MAX)
+    return VALIDATION_TIME_MINUTES;
+  
+  if (seconds < SECONDS_MIN || seconds > SECONDS_MAX)
+    return VALIDATION_TIME_SECONDS;
+
+  priv->validated = TRUE;
+  return (VALIDATION_OK);
 }
 
-/**
- * hildon_time_editor_enable_duration_mode:
- * @editor: The #HildonTimeEditor.
- * @enable: Enable or disable duration editor mode
- *
- * This function sets the duration editor mode in which the maximum hours
- * is 99 and the #HildonTimePicker is disabled.
- *
- **/
-void hildon_time_editor_enable_duration_mode(HildonTimeEditor * editor,
-                                             gboolean enable)
+static void
+hildon_time_editor_entry_changed(GtkWidget * widget, gpointer user_data)
 {
-    HildonTimeEditorPrivate *priv;
+  HildonTimeEditor *editor;
 
-    g_return_if_fail(editor);
+  editor = HILDON_TIME_EDITOR(user_data);
 
-    priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
+/*  hildon_time_editor_validate (editor);*/
+}
 
-    /* switch to duration editor mode */
-    if (enable && !priv->duration_mode) {
-        priv->duration_mode = enable;
-        hildon_time_editor_set_duration_range(editor, MIN_DURATION,
-                                              MAX_DURATION);
+/* NOTE: This function is mostly broken for the duration mode */
+static void
+hildon_time_editor_get_max_values(HildonTimeEditor *editor, 
+        guint * pmax_hours, guint * pmin_hours,
+        guint * pmax_minutes, guint * pmin_minutes,
+        guint * pmax_seconds, guint * pmin_seconds)
+{
+    guint max_hours;
+    guint max_minutes;
+    guint max_seconds;
+    guint min_hours;
+    guint min_minutes;
+    guint min_seconds;
 
-        if (!priv->clock_24h)
-            gtk_widget_hide(GTK_WIDGET(priv->ampm));
+    HildonTimeEditorPrivate *priv;
 
-        gtk_widget_hide(GTK_WIDGET(priv->eventbox));
-        gtk_widget_hide(GTK_WIDGET(priv->icon));
+    priv = HILDON_TIME_EDITOR_GET_PRIVATE(editor);
 
-        /* Show seconds for duration editor */
-        hildon_time_editor_show_seconds(editor, TRUE);
+    max_hours   = priv->duration_max / 3600;
+    max_minutes = (priv->duration_max - (max_hours * 3600)) / 60;
+    max_seconds = priv->duration_max - (max_hours * 3600) - (max_minutes * 60);
+    min_hours   = priv->duration_min / 3600;
+    min_minutes = (priv->duration_min - (min_hours * 3600)) / 60;
+    min_seconds = priv->duration_min - (min_hours * 3600) - (min_minutes * 60);
+
+    /* Determine max and min values for duration mode */
+    if (priv->duration_mode)
+    {
+      /* if the widget has focus, the value could be out of range, so
+         use the calculated values then
+       */
+      if (!gtk_widget_is_focus (priv->h_entry))
+        {
+          if ((guint) atoi(gtk_entry_get_text(GTK_ENTRY(priv->h_entry))) < max_hours)
+            {
+              max_minutes = 59;
+              max_seconds = 59;
+            }
+          if ((guint) atoi(gtk_entry_get_text(GTK_ENTRY(priv->h_entry))) > min_hours)
+            {
+              min_minutes = 0;
+              min_seconds = 0;
+            }
+        }
+      if (!gtk_widget_is_focus (priv->m_entry))
+        {
+          if ((guint) atoi(gtk_entry_get_text(GTK_ENTRY(priv->m_entry))) < max_minutes)
+            {
+              max_seconds = 59;
+            }
+          if ((guint) atoi(gtk_entry_get_text(GTK_ENTRY(priv->m_entry))) > min_minutes)
+            {
+              min_seconds = 0;
+            }
+        }
+    }
+    /* 24h clock mode */
+    else if (priv->clock_24h) {
+        max_hours = 23;
+        max_seconds = max_minutes = 59;
+        min_seconds = min_minutes = min_hours = 0;
+    }
+    /* 12h clock mode */
+    else {
+        max_hours = 12;
+        min_hours = 1;
+        max_seconds = max_minutes = 59;
+        min_seconds = min_minutes = 0;
     }
-    /* switch to time editor mode */
-    else if (!enable && priv->duration_mode) {
-        priv->duration_mode = enable;
 
-        if (!priv->clock_24h)
-            gtk_widget_show(GTK_WIDGET(priv->ampm));
+    *pmax_hours   = max_hours;
+    *pmax_minutes = max_minutes;
+    *pmax_seconds = max_seconds;
+    *pmin_hours   = min_hours;
+    *pmin_minutes = min_minutes;
+    *pmin_seconds = min_seconds;
+  
+}
 
-        gtk_widget_show(GTK_WIDGET(priv->eventbox));
-        gtk_widget_show(GTK_WIDGET(priv->icon));
+/*** 
+ * Utility functions
+ */
+
+static void
+convert_to_12h (guint *h, guint *m, guint *s, gboolean *am)
+{
+  /* Official time hack: As 12am and 12pm are technically invalid
+     times, we add a minute to 24h time 00:00 and subtract one from
+     24h time 12:00 when in 12h mode. This is a custom in railroads
+     airlines and insurance companies.
+   */
+  if (*h == 0 && *m == 0 && *s == 0)
+    {
+      *m++;
     }
-    gtk_widget_queue_resize(GTK_WIDGET(editor));
+  else if (*h == 12 && *m == 0 && *s == 0)
+    {
+      *h--;
+      *m = 59;
+    }
+  
+  /* 0000 to 0059
+   * add 12 hours
+   */
+  if (*h == 0)
+    {
+      *h += 12;
+      *am = TRUE;
+    }
+  /* 0100 to 1159
+   * straight to am
+   */
+  else if (*h >= 1 && *h < 12)
+    {
+      *am = TRUE;
+    }
+  /* 1200 to 1259
+   * straight to pm
+   */
+  else if (*h >= 12 && *h < 13)
+    {
+      *am = FALSE;
+    }
+  /* 1300 to 23:59
+   * subtract 12 hours
+   */
+  else if (*h >= 13 && *h < 24 )
+    {
+      *h -= 12;
+      *am = FALSE;
+    }
+}
+
+static void
+convert_to_24h (guint *h, guint *m, guint *s, gboolean am)
+{
+  /* Official time hack: As 12am and 12pm are technically invalid
+     times, we add a minute to 24h time 00:00 and subtract one from
+     24h time 12:00 when in 12h mode. This is a custom in railroads
+     airlines and insurance companies.
+   */
+  if (am && *h == 12 && *m == 0 && *s == 0)
+    {
+      *m++;
+    }
+  else if (!am && *h == 12 && *m == 0 && *s == 0)
+    {
+      *h--;
+      *m = 59;
+    }
+  
+  /* 12 midnight - 12:59 AM
+   * subtract 12 hours
+   */
+  if (*h == 12 && am)
+    {
+      *h -= 12;
+    }
+  /* 1:00 PM - 11:59 AM
+   * add 12 hours
+   */
+  else if (!am && *h >= 1 && *h < 12)
+    {
+      *h += 12;
+    }
+}
+
+/***
+ * Deprecated functions
+ */
+
+
+#ifndef HILDON_DISABLE_DEPRECATED
+
+/**
+ * hildon_time_editor_show_seconds:
+ * @editor: The #HildonTimeEditor.
+ * @enable: Enable or disable showing of seconds.
+ *
+ * This function is deprecated, use @hildon_time_editor_set_show_seconds instead.
+ *
+ **/
+void hildon_time_editor_show_seconds(HildonTimeEditor * editor,
+                                     gboolean enable)
+{
+    hildon_time_editor_set_show_seconds (editor, enable);
+}
+/**
+ * hildon_time_editor_enable_duration_mode:
+ * @editor: The #HildonTimeEditor.
+ * @enable: Enable or disable duration editor mode
+ *
+ * This function is deprecated, use @hildon_time_editor_set_duration_mode instead.
+ *
+ **/
+void hildon_time_editor_enable_duration_mode(HildonTimeEditor * editor,
+                                             gboolean enable)
+{
+    hildon_time_editor_set_duration_mode (editor, enable);
 }
 
+#endif /* HILDON_DISABLE_DEPRECATED */
index 70ceb26..b6a1fde 100644 (file)
@@ -48,20 +48,6 @@ struct _HildonTimeEditorClass {
     GtkContainerClass parent_class;
 };
 
-/**
- * HildonTimeEditorField:
- * @HILDON_TIME_EDITOR_HOUR_FIELD: select and highlight hour field.
- * @HILDON_TIME_EDITOR_MINUTE_FIELD: select and highlight minute field.
- * @HILDON_TIME_EDITOR_SECOND_FIELD: select and highlight second field.
- *
- * These values are used to indicate which editor field should be highlighted.
- */
-typedef enum {
-    HILDON_TIME_EDITOR_HOUR_FIELD,
-    HILDON_TIME_EDITOR_MINUTE_FIELD,
-    HILDON_TIME_EDITOR_SECOND_FIELD
-} HildonTimeEditorField;
-
 GType hildon_time_editor_get_type(void);
 GtkWidget *hildon_time_editor_new(void);
 
@@ -70,10 +56,13 @@ void hildon_time_editor_set_time(HildonTimeEditor * editor, guint hours,
 void hildon_time_editor_get_time(HildonTimeEditor * editor, guint * hours,
                                  guint * minutes, guint * seconds);
 
+#ifndef HILDON_DISABLE_DEPRECATED
+
 void hildon_time_editor_show_seconds(HildonTimeEditor * editor,
                                      gboolean enable);
 void hildon_time_editor_enable_duration_mode(HildonTimeEditor * editor,
                                              gboolean enable);
+#endif /* HILDON_DISABLE_DEPRECATED */
 
 void hildon_time_editor_set_duration_range(HildonTimeEditor * editor,
                                            guint min_seconds,
@@ -82,6 +71,27 @@ void hildon_time_editor_get_duration_range(HildonTimeEditor * editor,
                                            guint * min_seconds,
                                            guint * max_seconds);
 
+void hildon_time_editor_set_ticks (HildonTimeEditor * editor,
+                                          guint ticks);
+guint hildon_time_editor_get_ticks (HildonTimeEditor * editor);
+
+void hildon_time_editor_set_show_seconds (HildonTimeEditor * editor,
+                                          gboolean show_seconds);
+gboolean hildon_time_editor_get_show_seconds (HildonTimeEditor * editor);
+
+void hildon_time_editor_set_duration_mode (HildonTimeEditor * editor,
+                                           gboolean duration_mode);
+gboolean hildon_time_editor_get_duration_mode (HildonTimeEditor * editor);
+
+void hildon_time_editor_set_duration_min (HildonTimeEditor * editor,
+                                          guint duration_min);
+guint hildon_time_editor_get_duration_min (HildonTimeEditor * editor);
+
+void hildon_time_editor_set_duration_max (HildonTimeEditor * editor,
+                                          guint duration_max);
+guint hildon_time_editor_get_duration_max (HildonTimeEditor * editor);
+
+
 
 G_END_DECLS
 #endif
index d9cf297..dc07eea 100644 (file)
@@ -27,6 +27,7 @@
  * 
  * This file implements the HildonTimePicker widget. This widget
  * is used with HildonTimeEditor widget to set time.
+ *
  */
 
 /* HILDON DOC
@@ -38,8 +39,9 @@
  * @seealso: #HildonTimeEditor
  */
 
-#include <hildon-widgets/hildon-time-picker.h>
+#include "hildon-time-picker.h"
 #include <hildon-widgets/hildon-defines.h>
+#include <hildon-widgets/gtk-infoprint.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 #include <gdk/gdk.h>
 
 #define HILDON_TIME_PICKER_GET_PRIVATE(obj) \
     (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
-     HILDON_TYPE_TIME_PICKER, HildonTimePickerPriv));
+     HILDON_TYPE_TIME_PICKER, HildonTimePickerPrivate))
 
-typedef struct _HildonTimePickerPriv HildonTimePickerPriv;
+#define DEFAULT_HOURS 1
+#define DEFAULT_MINUTES 1
+#define DEFAULT_ARROW_WIDTH 26
+#define DEFAULT_ARROW_HEIGHT 26
+
+enum
+{
+  TABLE,
+
+  FRAME_HOURS,
+  FRAME_MMINUTES,
+  FRAME_LMINUTES,
+  FRAME_AMPM,
+
+  EBOX_HOURS,
+  EBOX_MMINUTES,
+  EBOX_LMINUTES,
+  EBOX_AMPM,
+
+  LABEL_HOURS,
+  LABEL_MMINUTES,
+  LABEL_LMINUTES,
+  LABEL_AMPM,
+  LABEL_COLON,
+
+  BUTTON_HOURS_UP,
+  BUTTON_HOURS_DOWN,
+  BUTTON_MMINUTES_UP,
+  BUTTON_MMINUTES_DOWN,
+  BUTTON_LMINUTES_UP,
+  BUTTON_LMINUTES_DOWN,
+
+  WIDGET_COUNT
+};
 
-/* 
- * Pointer parent class 
- */
 static GtkDialogClass *parent_class;
 
-/*< private >*/
-struct _HildonTimePickerPriv
+/*< private > m == minutes and h == hours
+              m == more significant and l == less significant
+              mm == minutes more significant (==tens of minutes) etc.*/
+struct _HildonTimePickerPrivate
 {
-    GtkWidget *ht_label;
-    GtkWidget *hs_label;
-    GtkWidget *mt_label;
-    GtkWidget *ms_label;
-    GtkWidget *h_frame;
-    GtkWidget *m_frame;
-    GtkWidget *ampm_frame;
-    GtkWidget *h_ebox;
-    GtkWidget *mt_ebox;
-    GtkWidget *ms_ebox;
-    GtkWidget *h_up;
-    GtkWidget *h_down;
-    GtkWidget *mt_up;
-    GtkWidget *mt_down;
-    GtkWidget *ms_up;
-    GtkWidget *ms_down;
-    GtkWidget *d_label;
-
-    /* Localisation stuff */
-    GtkWidget *ampm_button;   /* Eventbox to hold label */
-    GtkWidget *ampm_label;    /* Label to hold am or pm symbol */
-
-    gboolean ampm_pos_after;  /* Position eventbox before of after clock */
-    gboolean clock_24h; /* 12h or 24h time */
-    gboolean am;        /* Indicates before or after noon */
-
-    gchar *am_symbol;   /* Local symbol for am */
-    gchar *pm_symbol;   /* Local symbol for pm */
-
-    /* These are for timeout */
-    guint id;   /* key repeat timer id */
-    guint start_id;     /* key repeat start timer id */
-    GtkWidget *press_button;
+  GtkWidget *child[WIDGET_COUNT];
+
+  gchar *am_symbol;
+  gchar *pm_symbol;
+
+  guint key_repeat;
+  guint minutes;
+  gint mul;
+  guint timer_id;
+
+  guint c12h             : 1; /* 12 hour clock, show AM/PM */
+  guint ampm_pos         : 1; /* FALSE = AM/PM at left, TRUE = at right */
+  guint button_press     : 1;
+  guint start_key_repeat : 1;
+};
+
+enum
+{
+  PROP_MINUTES = 1,
+  PROP_AMPM
 };
 
-/* 
- * Private function prototype definitions 
- */
-static void
-hildon_time_picker_class_init (HildonTimePickerClass *picker_class);
 
 static void
-hildon_time_picker_init (HildonTimePicker *picker);
+hildon_time_picker_class_init( HildonTimePickerClass *klass );
 
 static void
-hildon_time_picker_finalize (GObject *obj_self);
+hildon_time_picker_init( HildonTimePicker *picker );
 
 static gboolean
-hildon_time_picker_key_press (GtkWidget *widget, GdkEventKey *event,
-                              gpointer data);
-
-static void
-hildon_time_picker_clicked (GtkButton *button, gpointer data);
+hildon_time_picker_timeout( gpointer data );
 
 static void
-hildon_time_picker_add_style (void);
+hildon_time_picker_change_time( HildonTimePicker *picker, guint minutes );
 
 static gboolean
-hildon_time_picker_timeout (gpointer data);
+hildon_time_picker_ampm_release( GtkWidget *widget, GdkEvent *event,
+                                 HildonTimePicker *picker );
 
 static gboolean
-hildon_time_picker_start_timer (gpointer data);
-
+hildon_time_picker_arrow_press( GtkWidget *widget, GdkEvent *event,
+                                HildonTimePicker *picker );
 static gboolean
-hildon_time_picker_button_press (GtkWidget *widget, GdkEventButton *event,
-                                 gpointer data);
+hildon_time_picker_arrow_release( GtkWidget *widget, GdkEvent *event,
+                                  HildonTimePicker *picker );
+
+static void
+hildon_time_picker_get_property( GObject *object, guint param_id,
+                                                  GValue *value, GParamSpec *pspec );
+
+static void
+hildon_time_picker_set_property( GObject *object, guint param_id,
+                                                  const GValue *value, GParamSpec *pspec );
 
 static gboolean
-hildon_time_picker_button_release (GtkWidget *widget, GdkEventButton *event,
-                                   gpointer data);
+hildon_time_picker_event_box_focus_in( GtkWidget *widget, GdkEvent *event,
+                                       gpointer data );
+
 static gboolean
-hildon_time_picker_focus_in (GtkWidget *widget, GdkEventFocus *event,
-                             gpointer data);
-static void
-hildon_time_picker_handle_hours (GtkButton *button, HildonTimePicker *tp);
+hildon_time_picker_event_box_focus_out( GtkWidget *widget, GdkEvent *event,
+                                        gpointer data );
 
 static gboolean
-hildon_time_picker_check_locale (HildonTimePicker *picker);
+hildon_time_picker_event_box_key_press( GtkWidget *widget,  GdkEventKey *event,
+                                        HildonTimePicker *picker );
 
 static gboolean
-hildon_time_picker_ampm_clicked (GtkWidget *widget, GdkEventButton *event,
-                                 gpointer data);
+hildon_time_picker_event_box_key_release( GtkWidget *widget,  GdkEventKey *event,
+                                          HildonTimePicker *picker );
 
 static gboolean
-hildon_time_picker_change_ampm_label (HildonTimePicker *picker);
+hildon_time_picker_event_box_press( GtkWidget *widget,  GdkEventKey *event,
+                                    gpointer data );
 
-/* 
- * Public functions start here
- */
-GType hildon_time_picker_get_type(void)
-{
-    static GType picker_type = 0;
+static void
+hildon_time_picker_map( GtkWidget *widget );
 
-    if (!picker_type)
-      {
-        static const GTypeInfo picker_info =
-          {
-            sizeof (HildonTimePickerClass),
-            NULL,       /* base_init */
-            NULL,       /* base_finalize */
-            (GClassInitFunc) hildon_time_picker_class_init,
-            NULL,       /* class_finalize */
-            NULL,       /* class_data */
-            sizeof (HildonTimePicker),
-            0,  /* n_preallocs */
-            (GInstanceInitFunc) hildon_time_picker_init,
-          };
-        picker_type = g_type_register_static (GTK_TYPE_DIALOG,
-                                             "HildonTimePicker",
-                                             &picker_info, 0);
-      }
-    return picker_type;
-}
 
-/**
- * hildon_time_picker_new:
- * @parent: parent window.
- *
- * Hildon Time Picker shows time picker dialog. Close button is placed
- * in dialog's action area and time picker is placed in dialogs vbox.
- * Actual time picker consists two #GtkLabel fields one for hour and
- * one for minutes, arrow buttons and an AM/PM button. A : is placed
- * between hour and minute fields.
- *
- * Return value: pointer to a new #HildonTimePicker widget.
- **/
-GtkWidget *hildon_time_picker_new(GtkWindow * parent)
+GType hildon_time_picker_get_type( void )
 {
-    GtkWidget *widget = g_object_new (HILDON_TYPE_TIME_PICKER, NULL);
+  static GType picker_type = 0;
 
-    if (parent)
+  if( !picker_type )
+  {
+    static const GTypeInfo picker_info =
       {
-        gtk_window_set_transient_for (GTK_WINDOW(widget), parent);
-      }
-
-    return GTK_WIDGET (widget);
+        sizeof(HildonTimePickerClass),
+        NULL,       /* base_init */
+        NULL,       /* base_finalize */
+        (GClassInitFunc)hildon_time_picker_class_init,
+        NULL,       /* class_finalize */
+        NULL,       /* class_data */
+        sizeof(HildonTimePicker),
+        0,          /* n_preallocs */
+        (GInstanceInitFunc)hildon_time_picker_init,
+      };
+    picker_type = g_type_register_static( GTK_TYPE_DIALOG, "HildonTimePicker",
+                                          &picker_info, 0 );
+  }
+  return picker_type;
 }
 
-/**
- * hildon_time_picker_set_time:
- * @picker: the #HildonTimePicker widget.
- * @hours: hours
- * @minutes: minutes
- *
- * Sets the time of the #HildonTimePicker widget.
- **/
-void hildon_time_picker_set_time(HildonTimePicker * picker,
-                                 guint hours, guint minutes)
-{
-    HildonTimePickerPriv *priv;
-    gchar h_str[3], m_str[3], mt_str[2], ms_str[2], ht_str[2], hs_str[2];
-
-    g_return_if_fail (picker);
-
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (picker);
 
-    if ((hours >= 0) && (hours < 24) && (minutes >= 0) && (minutes < 60))
-      {
-        /* If we are using 12h clock, convert the time and check if it's
-           after or before noon */
-        if (!priv->clock_24h)
-          {
-            if (hours > 12)
-              {
-                priv->am = FALSE;
-                hours = hours - 12;
-              }
-            else if (hours < 12)
-              {
-                priv->am = TRUE;
-                if (hours == 0)
-                  hours = 12;
-              }
-            else if (hours == 12)
-                priv->am = FALSE;
-            gtk_label_set_text (GTK_LABEL (priv->ampm_label),
-                                priv->am ? priv->am_symbol : priv->pm_symbol);
-          }
-
-        sprintf (h_str, "%02d", hours);
-        sprintf (m_str, "%02d", minutes);
-
-        mt_str[0] = m_str[0];
-        ms_str[0] = m_str[1];
-        ht_str[0] = h_str[0];
-        hs_str[0] = h_str[1];
-        mt_str[1] = ms_str[1] = ht_str[1] = hs_str[1] = '\0';
-
-        gtk_label_set_text (GTK_LABEL (priv->ht_label), ht_str);
-        gtk_label_set_text (GTK_LABEL (priv->hs_label), hs_str);
-        gtk_label_set_text (GTK_LABEL (priv->mt_label), mt_str);
-        gtk_label_set_text (GTK_LABEL (priv->ms_label), ms_str);
-      }
+static void
+hildon_time_picker_class_init( HildonTimePickerClass *klass )
+{
+  GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+  parent_class = g_type_class_peek_parent( klass );
+
+  gobject_class->get_property = hildon_time_picker_get_property;
+  gobject_class->set_property = hildon_time_picker_set_property;
+  widget_class->map = hildon_time_picker_map;
+
+  /**
+   * HildonTimePicker:minutes:
+   *
+   * Currently selected minutes.
+   */
+  g_object_class_install_property( gobject_class, PROP_MINUTES,
+                                   g_param_spec_uint("minutes",
+                                     "Current minutes",
+                                     "The selected minutes",
+                                     0, 1440, 0,
+                                     G_PARAM_READABLE | G_PARAM_WRITABLE) );
+
+  gtk_widget_class_install_style_property( widget_class,
+                                                              g_param_spec_uint("arrow-width",
+                                         _("Arrow width"),
+                                         _("Increase/decrease arrows width."),
+                                         0, G_MAXUINT,
+                                         DEFAULT_ARROW_WIDTH,
+                                         G_PARAM_READABLE) );
+
+  gtk_widget_class_install_style_property( widget_class,
+                                                              g_param_spec_uint("arrow-height",
+                                         _("Arrow height"),
+                                         _("Increase/decrease arrows height."),
+                                         0, G_MAXUINT,
+                                         DEFAULT_ARROW_HEIGHT,
+                                         G_PARAM_READABLE) );
+
+  g_type_class_add_private( klass, sizeof(HildonTimePickerPrivate) );
 }
 
-/**
- * hildon_time_picker_get_time:
- * @picker: the #HildonTimePicker widget.
- * @hours: hours
- * @minutes: minutes
- *
- * Gets the time of the #HildonTimePicker widget.
- **/
-void hildon_time_picker_get_time(HildonTimePicker * picker,
-                                 guint * hours, guint * minutes)
+static void hildon_time_picker_init( HildonTimePicker *picker )
 {
-    HildonTimePickerPriv *priv;
-
-    g_return_if_fail (picker);
-    g_return_if_fail (hours);
-    g_return_if_fail (minutes);
-
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (picker);
-
-    *hours = 10 * atoi (gtk_label_get_text (GTK_LABEL (priv->ht_label))) +
-        atoi (gtk_label_get_text (GTK_LABEL (priv->hs_label)));
-    *minutes = 10 * atoi (gtk_label_get_text (GTK_LABEL (priv->mt_label))) +
-        atoi (gtk_label_get_text (GTK_LABEL (priv->ms_label)));
-
-    /* If we use 12h clock, we convert time to 24h time, because all time
-       related APIs use 24h clock */
-    if (!priv->clock_24h && !priv->am)
-      {
-        if (*hours != 12)
-          *hours += 12;
-      }
-    if (!priv->clock_24h && *hours == 12 && priv->am)
-      *hours = 0;
+  HildonTimePickerPrivate *priv = HILDON_TIME_PICKER_GET_PRIVATE(picker);
+  GtkSettings *settings = NULL;
+  GtkDialog *dialog = GTK_DIALOG(picker);
+  GtkTable *table = NULL;
+  GtkWidget *maintocenter;
+  struct tm *local = NULL;
+  time_t stamp;
+  gint i = 0;
+  GtkSizeGroup *size_group;
+
+  picker->priv = priv;
+
+  gtk_widget_push_composite_child();
+
+  priv->child[TABLE] = gtk_table_new( 3, 6, FALSE );
+  table = GTK_TABLE(priv->child[TABLE]);
+
+  maintocenter = gtk_alignment_new( 0.5, 0, 0, 0 );
+
+  for( i = FRAME_HOURS; i <= FRAME_LMINUTES; i++ )
+  {
+    priv->child[i] = gtk_frame_new( NULL );
+    gtk_container_set_border_width( GTK_CONTAINER( priv->child[i] ), 0 );
+  }
+
+  for( i = BUTTON_HOURS_UP; i <= BUTTON_LMINUTES_DOWN; i++ )
+    priv->child[i] = gtk_button_new();
+
+  for( i = EBOX_HOURS; i <= EBOX_LMINUTES; i++ )
+    priv->child[i] = gtk_event_box_new();
+
+  for( i = LABEL_HOURS; i <= LABEL_LMINUTES; i++ )
+  {
+    priv->child[i] = gtk_label_new( "00" );
+    gtk_misc_set_padding( GTK_MISC( priv->child[i] ), 0, 1 );
+    gtk_widget_set_name( priv->child[i], "osso-LargeFont" );
+  }
+
+  priv->child[LABEL_COLON] = gtk_label_new(_("Ecdg_ti_time_picker_separator"));
+  gtk_widget_set_name( priv->child[LABEL_COLON], "osso-LargeFont" );
+
+  priv->minutes = 0;
+  priv->mul = 0;
+  priv->key_repeat = 0;
+  priv->start_key_repeat = FALSE;
+  priv->timer_id = 0;
+  priv->button_press = FALSE;
+
+  /* Load locales */
+  priv->am_symbol = nl_langinfo(AM_STR);
+  priv->pm_symbol = nl_langinfo(PM_STR);
+
+  priv->c12h = priv->am_symbol[0] == '\0' ? FALSE : TRUE;
+
+  stamp = time( NULL );
+  local = localtime( &stamp );
+
+  gtk_table_attach( table, priv->child[BUTTON_HOURS_UP], 1, 2, 0, 1,
+                    GTK_SHRINK, GTK_SHRINK, 0, 0 );
+  gtk_table_attach( table, priv->child[FRAME_HOURS], 1, 2, 1, 2,
+                    GTK_SHRINK, GTK_SHRINK, 0, 0 );
+  gtk_table_attach( table, priv->child[BUTTON_HOURS_DOWN], 1, 2, 2, 3,
+                    GTK_SHRINK, GTK_SHRINK, 0, 0 );
+  gtk_table_attach( table, priv->child[LABEL_COLON], 2, 3, 1, 2,
+                    GTK_SHRINK, GTK_SHRINK, 6, 0 );
+  gtk_table_attach( table, priv->child[BUTTON_MMINUTES_UP], 3, 4, 0, 1,
+                    GTK_SHRINK, GTK_SHRINK, 0, 0 );
+  gtk_table_attach( table, priv->child[FRAME_MMINUTES], 3, 4, 1, 2,
+                    GTK_FILL, GTK_SHRINK, 0, 0 );
+  gtk_table_attach( table, priv->child[BUTTON_MMINUTES_DOWN], 3, 4, 2, 3,
+                    GTK_SHRINK, GTK_SHRINK, 0, 0 );
+
+  gtk_table_attach( table, priv->child[BUTTON_LMINUTES_UP], 4, 5, 0, 1,
+                    GTK_SHRINK, GTK_SHRINK, 0, 0 );
+  gtk_table_attach( table, priv->child[FRAME_LMINUTES], 4, 5, 1, 2,
+                    GTK_FILL, GTK_SHRINK, 0, 0 );
+  gtk_table_attach( table, priv->child[BUTTON_LMINUTES_DOWN], 4, 5, 2, 3,
+                    GTK_SHRINK, GTK_SHRINK, 0, 0 );
+
+  gtk_table_set_row_spacing( table, 0, 6 );
+  gtk_table_set_row_spacing( table, 1, 6 );
+
+  size_group = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL );
+  gtk_size_group_add_widget( size_group, priv->child[BUTTON_MMINUTES_UP] );
+  gtk_size_group_add_widget( size_group, priv->child[FRAME_MMINUTES] );
+  gtk_size_group_add_widget( size_group, priv->child[BUTTON_MMINUTES_DOWN] );
+  gtk_size_group_add_widget( size_group, priv->child[BUTTON_LMINUTES_UP] );
+  gtk_size_group_add_widget( size_group, priv->child[FRAME_LMINUTES] );
+  gtk_size_group_add_widget( size_group, priv->child[BUTTON_LMINUTES_DOWN] );
+  g_object_unref( size_group ); /* Added widgets hold references */
+
+  if( priv->c12h )
+  {
+    GtkWidget *ampmtotop = NULL;
+    guint placement = 0;
+    priv->ampm_pos = strncmp(nl_langinfo(T_FMT_AMPM), "%p", 2) ? TRUE : FALSE;
+    ampmtotop = gtk_alignment_new( 0, 0.5, 0, 0 );
+    priv->child[FRAME_AMPM] = gtk_frame_new( NULL );
+    priv->child[EBOX_AMPM] = gtk_event_box_new();
+    priv->child[LABEL_AMPM] = gtk_label_new( priv->pm_symbol );
+
+    placement = priv->ampm_pos * 5;
+
+    gtk_container_add( GTK_CONTAINER(ampmtotop), priv->child[FRAME_AMPM] );
+    gtk_container_add( GTK_CONTAINER(priv->child[FRAME_AMPM]),
+                       priv->child[EBOX_AMPM] );
+    gtk_container_add( GTK_CONTAINER(priv->child[EBOX_AMPM]),
+                       priv->child[LABEL_AMPM] );
+    gtk_table_attach( table, ampmtotop, placement, placement + 1, 1, 2,
+                      GTK_SHRINK, GTK_SHRINK, 0, 0 );
+    gtk_table_set_col_spacing( table, placement - 1, 6 );
+
+    g_signal_connect( G_OBJECT(priv->child[EBOX_AMPM]), "button-release-event",
+                      (GCallback)hildon_time_picker_ampm_release, picker );
+    g_signal_connect( G_OBJECT(priv->child[EBOX_AMPM]), "focus-out-event",
+                      (GCallback)hildon_time_picker_event_box_focus_out,
+                      picker );
+    g_signal_connect( G_OBJECT(priv->child[EBOX_AMPM]), "focus-in-event",
+                      (GCallback)hildon_time_picker_event_box_focus_in, picker );
+    g_signal_connect( G_OBJECT(priv->child[EBOX_AMPM]), "key-release-event",
+                      (GCallback)hildon_time_picker_event_box_key_release,
+                      picker );
+    g_signal_connect( G_OBJECT(priv->child[EBOX_AMPM]), "key-press-event",
+                      (GCallback)hildon_time_picker_event_box_key_press,
+                      picker );
+
+    g_object_set( G_OBJECT(priv->child[EBOX_AMPM]), "can-focus", TRUE, NULL );
+    gtk_widget_set_events( priv->child[EBOX_AMPM],
+                           GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_PRESS_MASK );
+  }
+  else
+    priv->child[FRAME_AMPM] = priv->child[LABEL_AMPM] =
+                              priv->child[EBOX_AMPM] = NULL;
+
+  gtk_widget_pop_composite_child();
+
+  hildon_time_picker_set_time( picker, local->tm_hour, local->tm_min );
+
+  settings = gtk_settings_get_default();
+  g_object_get( settings, "gtk-update-timeout", &priv->key_repeat, NULL );
+
+  for( i = 0; i < 3; i++ )
+  {
+    gtk_container_add( GTK_CONTAINER(priv->child[FRAME_HOURS + i]),
+                       priv->child[EBOX_HOURS + i] );
+    gtk_container_add( GTK_CONTAINER(priv->child[EBOX_HOURS + i]),
+                       priv->child[LABEL_HOURS + i] );
+
+    /* Connect signals */
+    g_signal_connect( G_OBJECT(priv->child[EBOX_HOURS + i]), "key-release-event",
+                      (GCallback)hildon_time_picker_event_box_key_release,
+                      picker );
+    g_signal_connect( G_OBJECT(priv->child[EBOX_HOURS + i]), "key-press-event",
+                      (GCallback)hildon_time_picker_event_box_key_press,
+                      picker );
+    g_signal_connect( G_OBJECT(priv->child[EBOX_HOURS + i]), "focus-in-event",
+                      (GCallback)hildon_time_picker_event_box_focus_in, picker );
+    g_signal_connect( G_OBJECT(priv->child[EBOX_HOURS + i]), "focus-out-event",
+                      (GCallback)hildon_time_picker_event_box_focus_out,
+                      picker );
+    g_signal_connect( G_OBJECT(priv->child[EBOX_HOURS + i]),
+                      "button-press-event",
+                      (GCallback)hildon_time_picker_event_box_press, NULL );
+
+    /* Name the buttons */
+    gtk_widget_set_name( priv->child[BUTTON_HOURS_UP + i*2],
+                         "hildon-time-picker-up" );
+    gtk_widget_set_name( priv->child[BUTTON_HOURS_DOWN + i*2],
+                         "hildon-time-picker-down" );
+  }
+
+  for( i = BUTTON_HOURS_UP; i <= BUTTON_LMINUTES_DOWN; i++ )
+  {
+    g_object_set( G_OBJECT(priv->child[i]), "can-focus", FALSE, NULL );
+
+    /* Connect signals */
+    g_signal_connect( G_OBJECT(priv->child[i]), "button-press-event",
+                      (GCallback)hildon_time_picker_arrow_press, picker );
+    g_signal_connect( G_OBJECT(priv->child[i]), "button-release-event",
+                      (GCallback)hildon_time_picker_arrow_release, picker );
+  }
+
+  for( i = EBOX_HOURS; i <= EBOX_LMINUTES; i++ )
+  {
+    g_object_set( G_OBJECT(priv->child[i]), "can-focus", TRUE, NULL );
+
+    /* Set events */
+    gtk_widget_set_events( priv->child[i],
+                           GDK_FOCUS_CHANGE_MASK | GDK_BUTTON_PRESS_MASK );
+  }
+
+  gtk_window_set_modal( GTK_WINDOW(dialog), FALSE );
+  gtk_dialog_set_has_separator( dialog, FALSE );
+  gtk_dialog_add_button( dialog, _("ecdg_bd_time_picker_close"),
+                         GTK_RESPONSE_OK );
+
+  gtk_container_add( GTK_CONTAINER(maintocenter), priv->child[TABLE] );
+  gtk_box_pack_start( GTK_BOX(dialog->vbox), maintocenter, TRUE, FALSE, 0 );
+  gtk_widget_show_all( maintocenter );
 }
 
-/*
- * Private functions start here
- */
-
 static void
-hildon_time_picker_class_init(HildonTimePickerClass * picker_class)
+hildon_time_picker_set_property( GObject *object, guint param_id,
+                                                   const GValue *value, GParamSpec *pspec )
 {
-    GObjectClass *object_class = G_OBJECT_CLASS (picker_class);
-    parent_class = g_type_class_peek_parent (picker_class);
-    object_class->finalize = hildon_time_picker_finalize;
-
-    g_type_class_add_private (picker_class, sizeof (HildonTimePickerPriv));
-    hildon_time_picker_add_style();
+  HildonTimePicker *picker = HILDON_TIME_PICKER(object);
+
+  switch( param_id )
+  {
+    case PROP_MINUTES:
+      hildon_time_picker_change_time( picker, g_value_get_uint(value) );
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+  }
 }
 
-static void hildon_time_picker_init(HildonTimePicker * picker)
+static void
+hildon_time_picker_get_property( GObject *object, guint param_id,
+                                                   GValue *value, GParamSpec *pspec )
 {
-    HildonTimePickerPriv *priv;
-    GtkDialog *dlg;
-    GtkRequisition req;
-    PangoFontDescription *font;
-    GtkWidget *h_box, *hl_box, *ml_box, *mmain_box, *mup_box, *mmid_box,
-              *mdown_box, *w_box, *ampm_box, *event_box, *event_label;
-    GtkWidget *hu_img, *hd_img, *mtu_img, *mtd_img, *msu_img, *msd_img;
-    GtkSizeGroup *sgroup;
-    struct tm *local;
-    time_t stamp;
-
-    gint px, py;
-
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (picker);
-
-    priv->ampm_pos_after = TRUE;
-    priv->press_button = NULL;
-    priv->id = 0;
-
-    dlg = GTK_DIALOG (picker);
-    gtk_dialog_set_has_separator (dlg, FALSE);
-
-    priv->ht_label = gtk_label_new(NULL);
-    priv->hs_label = gtk_label_new(NULL);
-    priv->mt_label = gtk_label_new(NULL);
-    priv->ms_label = gtk_label_new(NULL);
-    priv->d_label = gtk_label_new (":");
-    priv->ampm_label = gtk_label_new (NULL);
-    event_label = gtk_label_new (NULL);
-
-/* +3/+1 -- Hildon specifications --
- * Forcing to the specification pixel cordinates
- */
-    px = py = 0;
-    gtk_misc_set_padding (GTK_MISC (priv->ht_label), 3, py + 1);
-    gtk_misc_set_padding (GTK_MISC (priv->hs_label), 3, py + 1);
-
-    gtk_misc_set_padding (GTK_MISC (priv->mt_label), 3, py + 1);
-    gtk_misc_set_padding (GTK_MISC (priv->ms_label), 3, py + 1);
-
-    gtk_misc_set_padding (GTK_MISC (priv->d_label), 0, py + 1);
-
-    priv->h_frame = gtk_frame_new (NULL);
-    priv->m_frame = gtk_frame_new (NULL);
-    priv->ampm_frame = gtk_frame_new (NULL);
-
-    priv->h_ebox = gtk_event_box_new();
-    priv->mt_ebox = gtk_event_box_new();
-    priv->ms_ebox = gtk_event_box_new();
-    priv->ampm_button = gtk_event_box_new();
-
-    GTK_WIDGET_SET_FLAGS (priv->h_ebox, GTK_CAN_FOCUS);
-    GTK_WIDGET_SET_FLAGS (priv->mt_ebox, GTK_CAN_FOCUS);
-    GTK_WIDGET_SET_FLAGS (priv->ms_ebox, GTK_CAN_FOCUS);
-    GTK_WIDGET_SET_FLAGS (priv->ampm_button, GTK_CAN_FOCUS);
-
-    gtk_widget_set_name (priv->ht_label, "timepickerlabel");
-    gtk_widget_set_name (priv->hs_label, "timepickerlabel");
-    gtk_widget_set_name (priv->mt_label, "timepickerlabel");
-    gtk_widget_set_name (priv->ms_label, "timepickerlabel");
-
-    gtk_widget_set_name (priv->h_ebox, "timepickerebox");
-    gtk_widget_set_name (priv->mt_ebox, "timepickerebox");
-    gtk_widget_set_name (priv->ms_ebox, "timepickerebox");
-    gtk_widget_set_name (priv->ampm_button, "timepickerebox");
-
-    gtk_widget_set_name (priv->h_frame, "numberframe");
-    gtk_widget_set_name (priv->m_frame, "numberframe");
-    
-    gtk_widget_set_name (priv->ampm_frame, "am_pm_frame");
-
-    hl_box = gtk_hbox_new (FALSE, 0);
-    ml_box = gtk_hbox_new (FALSE, 0);
-    ampm_box = gtk_vbox_new (FALSE, 0);
-
-    /* Hour box */
-    gtk_box_pack_start (GTK_BOX (hl_box), priv->ht_label, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (hl_box), priv->hs_label, FALSE, FALSE, 0);
-
-    gtk_container_add (GTK_CONTAINER (priv->h_frame), hl_box);
-    gtk_container_add (GTK_CONTAINER (priv->h_ebox), priv->h_frame);
-
-    /* Minutes box */
-    gtk_box_pack_start (GTK_BOX (ml_box), priv->mt_ebox, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (ml_box), priv->ms_ebox, FALSE, FALSE, 0);
-
-    gtk_container_add (GTK_CONTAINER (priv->mt_ebox), priv->mt_label);
-    gtk_container_add (GTK_CONTAINER (priv->ms_ebox), priv->ms_label);
-
-    gtk_container_add (GTK_CONTAINER (priv->m_frame), ml_box);
-
-    /* am/pm box */
-    gtk_box_pack_start (GTK_BOX (ampm_box), priv->ampm_label, FALSE, FALSE,
-                        0);
-
-    gtk_container_add (GTK_CONTAINER (priv->ampm_frame), ampm_box);
-    gtk_container_add (GTK_CONTAINER (priv->ampm_button), priv->ampm_frame);
-
-    /* Check locale settings */
-    priv->clock_24h = hildon_time_picker_check_locale (picker);
-
-    stamp = time(NULL);
-    local = localtime(&stamp);
-    hildon_time_picker_set_time(picker, local->tm_hour, local->tm_min);
-
-    sgroup = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
-
-    priv->h_up = gtk_button_new();
-    priv->h_down = gtk_button_new();
-    priv->mt_up = gtk_button_new();
-    priv->mt_down = gtk_button_new();
-    priv->ms_up = gtk_button_new();
-    priv->ms_down = gtk_button_new();
-
-    hu_img = 
-        gtk_image_new_from_stock ("hildon-picker-up", HILDON_ICON_SIZE_WIDG);
-    hd_img =
-        gtk_image_new_from_stock ("hildon-picker-down", HILDON_ICON_SIZE_WIDG);
-    mtu_img =
-        gtk_image_new_from_stock ("hildon-picker-up", HILDON_ICON_SIZE_WIDG);
-    mtd_img =
-        gtk_image_new_from_stock ("hildon-picker-down", HILDON_ICON_SIZE_WIDG);
-    msu_img =
-        gtk_image_new_from_stock ("hildon-picker-up", HILDON_ICON_SIZE_WIDG);
-    msd_img =
-        gtk_image_new_from_stock ("hildon-picker-down", HILDON_ICON_SIZE_WIDG);
-
-    gtk_container_add (GTK_CONTAINER (priv->h_up), hu_img);
-    gtk_container_add (GTK_CONTAINER (priv->h_down), hd_img);
-    gtk_container_add (GTK_CONTAINER (priv->mt_up), mtu_img);
-    gtk_container_add (GTK_CONTAINER (priv->mt_down), mtd_img);
-    gtk_container_add (GTK_CONTAINER (priv->ms_up), msu_img);
-    gtk_container_add (GTK_CONTAINER (priv->ms_down), msd_img);
-
-    gtk_widget_set_name (priv->h_up, "hildon-arrow-item");
-    gtk_widget_set_name (priv->h_down, "hildon-arrow-item");
-    gtk_widget_set_name (priv->mt_up, "hildon-arrow-item");
-    gtk_widget_set_name (priv->mt_down, "hildon-arrow-item");
-    gtk_widget_set_name (priv->ms_up, "hildon-arrow-item");
-    gtk_widget_set_name (priv->ms_down, "hildon-arrow-item");
-
-    h_box = gtk_vbox_new (FALSE, 0);
-    mmain_box = gtk_vbox_new (FALSE, 0);
-    mup_box = gtk_hbox_new (TRUE, 0);
-    mmid_box = gtk_hbox_new (FALSE, 0);
-    mdown_box = gtk_hbox_new (TRUE, 0);
-    event_box = gtk_vbox_new (FALSE, 0);
-    w_box = gtk_hbox_new (FALSE, 0);
-
-    /* Add widgets to same group... makes am/pm eventbox look good */
-    gtk_size_group_add_widget (sgroup, priv->h_up);
-    gtk_size_group_add_widget (sgroup, priv->mt_up);
-    gtk_size_group_add_widget (sgroup, priv->ms_up);
-    gtk_size_group_add_widget (sgroup, event_label);
-
-    gtk_box_pack_start (GTK_BOX (h_box), priv->h_up, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (h_box), priv->h_ebox, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (h_box), priv->h_down, FALSE, FALSE, 0);
-
-    gtk_box_pack_start (GTK_BOX (mmain_box), mup_box, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (mmain_box), mmid_box, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (mmain_box), mdown_box, FALSE, FALSE, 0);
-
-    gtk_box_pack_start (GTK_BOX (event_box), event_label, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (event_box), priv->ampm_button, FALSE, FALSE, 
-                        0);
-
-    gtk_box_pack_start (GTK_BOX (mup_box), priv->mt_up, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (mup_box), priv->ms_up, FALSE, FALSE, 0);
-
-    gtk_box_pack_start (GTK_BOX (mmid_box), priv->m_frame, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (mdown_box), priv->mt_down, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (mdown_box), priv->ms_down, FALSE, FALSE, 0);
-
-    /* Pack am/pm eventbox before time fields if locale says so */
-    if (!priv->clock_24h && !priv->ampm_pos_after)
-        gtk_box_pack_start (GTK_BOX (w_box), event_box, FALSE, FALSE, 12);
-
-    /* Pack other stuff */
-    gtk_box_pack_start (GTK_BOX (w_box), h_box, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (w_box), priv->d_label, FALSE, FALSE, 1);
-    gtk_box_pack_start (GTK_BOX (w_box), mmain_box, FALSE, FALSE, 0);
-
-    /* Pack am/pm eventbox after time fields if locale says so */
-    if (!priv->clock_24h && priv->ampm_pos_after)
-        gtk_box_pack_start (GTK_BOX (w_box), event_box, FALSE, FALSE, 12);
-
-    gtk_box_pack_start (GTK_BOX (dlg->vbox), w_box, FALSE, FALSE, 0);
-
-    gtk_widget_show_all (dlg->vbox);
-    gtk_dialog_add_button (dlg, _("ecdg_bd_time_picker_close"),
-                           GTK_RESPONSE_OK);
-
-    g_signal_connect (GTK_OBJECT (priv->h_up), "clicked",
-                      G_CALLBACK (hildon_time_picker_clicked), picker);
-    g_signal_connect (GTK_OBJECT (priv->h_up), "button-press-event",
-                      G_CALLBACK (hildon_time_picker_button_press), picker);
-    g_signal_connect (GTK_OBJECT (priv->h_up), "button-release-event",
-                      G_CALLBACK (hildon_time_picker_button_release), picker);
-
-    g_signal_connect (GTK_OBJECT (priv->h_down), "clicked",
-                      G_CALLBACK (hildon_time_picker_clicked), picker);
-    g_signal_connect (GTK_OBJECT (priv->h_down), "button-press-event",
-                      G_CALLBACK (hildon_time_picker_button_press), picker);
-    g_signal_connect (GTK_OBJECT (priv->h_down), "button-release-event",
-                      G_CALLBACK (hildon_time_picker_button_release), picker);
-
-    g_signal_connect (GTK_OBJECT (priv->mt_up), "clicked",
-                      G_CALLBACK (hildon_time_picker_clicked), picker);
-    g_signal_connect (GTK_OBJECT (priv->mt_up), "button-press-event",
-                      G_CALLBACK (hildon_time_picker_button_press), picker);
-    g_signal_connect (GTK_OBJECT (priv->mt_up), "button-release-event",
-                      G_CALLBACK (hildon_time_picker_button_release), picker);
-
-    g_signal_connect (GTK_OBJECT (priv->mt_down), "clicked",
-                      G_CALLBACK (hildon_time_picker_clicked), picker);
-    g_signal_connect (GTK_OBJECT (priv->mt_down), "button-press-event",
-                      G_CALLBACK (hildon_time_picker_button_press), picker);
-    g_signal_connect (GTK_OBJECT (priv->mt_down), "button-release-event",
-                      G_CALLBACK (hildon_time_picker_button_release), picker);
-
-    g_signal_connect (GTK_OBJECT (priv->ms_up), "clicked",
-                      G_CALLBACK (hildon_time_picker_clicked), picker);
-    g_signal_connect (GTK_OBJECT (priv->ms_up), "button-press-event",
-                      G_CALLBACK (hildon_time_picker_button_press), picker);
-    g_signal_connect (GTK_OBJECT (priv->ms_up), "button-release-event",
-                      G_CALLBACK (hildon_time_picker_button_release), picker);
-
-    g_signal_connect (GTK_OBJECT (priv->ms_down), "clicked",
-                      G_CALLBACK (hildon_time_picker_clicked), picker);
-    g_signal_connect (GTK_OBJECT (priv->ms_down), "button-press-event",
-                      G_CALLBACK (hildon_time_picker_button_press), picker);
-    g_signal_connect (GTK_OBJECT (priv->ms_down), "button-release-event",
-                      G_CALLBACK (hildon_time_picker_button_release),picker);
-
-    g_signal_connect (GTK_OBJECT (priv->h_ebox), "focus-in-event",
-                      G_CALLBACK (hildon_time_picker_focus_in), picker);
-    g_signal_connect (GTK_OBJECT (priv->mt_ebox), "focus-in-event",
-                      G_CALLBACK (hildon_time_picker_focus_in), picker);
-    g_signal_connect (GTK_OBJECT (priv->ms_ebox), "focus-in-event",
-                      G_CALLBACK (hildon_time_picker_focus_in), picker);
-    g_signal_connect (GTK_OBJECT (priv->ampm_button), "focus-in-event",
-                      G_CALLBACK (hildon_time_picker_focus_in), picker);
-
-    g_signal_connect (GTK_OBJECT (priv->h_ebox), "key-press-event",
-                      G_CALLBACK (hildon_time_picker_key_press), picker);
-    g_signal_connect (GTK_OBJECT (priv->mt_ebox), "key-press-event",
-                      G_CALLBACK (hildon_time_picker_key_press), picker);
-    g_signal_connect (GTK_OBJECT (priv->ms_ebox), "key-press-event",
-                      G_CALLBACK (hildon_time_picker_key_press), picker);
-    g_signal_connect (GTK_OBJECT (priv->ampm_button), "key-press-event",
-                      G_CALLBACK (hildon_time_picker_key_press), picker);
-
-    g_signal_connect (GTK_OBJECT (priv->h_ebox), "button-press-event",
-                      G_CALLBACK (hildon_time_picker_button_press), picker);
-    g_signal_connect (GTK_OBJECT (priv->mt_ebox), "button-press-event",
-                      G_CALLBACK (hildon_time_picker_button_press), picker);
-    g_signal_connect (GTK_OBJECT (priv->ms_ebox), "button-press-event",
-                      G_CALLBACK (hildon_time_picker_button_press), picker);
-    g_signal_connect (GTK_OBJECT (priv->ampm_button), "button-press-event",
-                      G_CALLBACK (hildon_time_picker_ampm_clicked), picker);
-
-    gtk_widget_realize (GTK_WIDGET (dlg));
-    gdk_window_set_decorations (GTK_WIDGET (dlg)->window, GDK_DECOR_BORDER);
-    gtk_window_set_modal (GTK_WINDOW (dlg), FALSE);
-
-    font = pango_font_description_copy (priv->ht_label->style->font_desc);
-
-    pango_font_description_set_size (font, 34 * PANGO_SCALE);
-    gtk_widget_modify_font (priv->d_label, font);
-
-    pango_font_description_set_size (font, 42 * PANGO_SCALE);
-    gtk_widget_modify_font (priv->mt_label, font);
-    gtk_widget_modify_font (priv->ms_label, font);
-    gtk_widget_modify_font (priv->ht_label, font);
-    gtk_widget_modify_font (priv->hs_label, font);
-
-    gtk_widget_size_request (priv->ht_label, &req);
-    req.height += 1;
-    gtk_widget_set_size_request (priv->ht_label, req.width, req.height);
-
-    gtk_widget_size_request (priv->hs_label, &req);
-    req.height += 1;
-    gtk_widget_set_size_request (priv->hs_label, req.width, req.height);
-
-    gtk_widget_size_request (priv->mt_label, &req);
-    req.height += 1;
-    gtk_widget_set_size_request (priv->mt_label, req.width, req.height);
-
-    gtk_widget_size_request (priv->ms_label, &req);
-    req.height += 1;
-    gtk_widget_set_size_request (priv->ms_label, req.width, req.height);
-
-    pango_font_description_free (font);
-
-    gtk_widget_grab_focus (priv->h_ebox);
-
+  HildonTimePickerPrivate *priv = HILDON_TIME_PICKER(object)->priv;
+
+  switch( param_id )
+  {
+    case PROP_MINUTES:
+      g_value_set_uint( value, priv->minutes );
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
+      break;
+  }
 }
 
 static void
-hildon_time_picker_finalize (GObject *obj_self)
+hildon_time_picker_map( GtkWidget *widget )
 {
-    HildonTimePicker *picker;
-    HildonTimePickerPriv *priv;
+  guint width, height;
+  gint i;
+  HildonTimePickerPrivate *priv = HILDON_TIME_PICKER(widget)->priv;
 
-    picker = HILDON_TIME_PICKER (obj_self);
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (picker);
+  gdk_window_set_decorations( widget->window, GDK_DECOR_BORDER );
 
-    /* free timers */
-    if (priv->start_id)
-        g_source_remove (priv->start_id);
+  gtk_widget_style_get( widget,
+                        "arrow-width", &width,
+                        "arrow-height", &height, NULL );
+  for( i=BUTTON_HOURS_UP; i <= BUTTON_LMINUTES_DOWN; i++)
+    gtk_widget_set_size_request( priv->child[i], width, height );
 
-    if (priv->id)
-        g_source_remove (priv->id);
+  GTK_WIDGET_CLASS(parent_class)->map( widget );
+}
 
-    g_free (priv->am_symbol);
-    g_free (priv->pm_symbol);
 
-    /* Call parent class finalize, if have one */
-    if (G_OBJECT_CLASS (parent_class)->finalize)
-        G_OBJECT_CLASS (parent_class)->finalize(obj_self);
+static gboolean
+hildon_time_picker_event_box_press( GtkWidget *widget,  GdkEventKey *event,
+                                    gpointer data )
+{
+  gtk_widget_grab_focus( widget );
+  return FALSE;
 }
 
 static gboolean
-hildon_time_picker_check_locale(HildonTimePicker *picker)
+hildon_time_picker_ampm_release( GtkWidget *widget, GdkEvent *event,
+                                 HildonTimePicker *picker )
 {
-    HildonTimePickerPriv *priv;
-
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (picker);
-
-    /* Now am/pm symbols always contain a copy. Value returned by
-        nl_langinfo must not be modified. */
-    priv->am_symbol = g_ascii_strdown (nl_langinfo (AM_STR), -1);
-    priv->pm_symbol = g_ascii_strdown (nl_langinfo (PM_STR), -1);
-
-    if (priv->am_symbol[0] == 0)
-        return TRUE;
-
-    /* Check what format am/pm time should be */
-    if (!strncmp (nl_langinfo (T_FMT_AMPM), "%p", 2))
-      priv->ampm_pos_after = FALSE;
-
-    return FALSE;
+  gtk_widget_grab_focus( widget );
+  hildon_time_picker_change_time( picker, picker->priv->minutes > 720 ?
+                                  picker->priv->minutes - 720 :
+                                  picker->priv->minutes + 720 );
+  return FALSE;
 }
 
 static gboolean
-hildon_time_picker_ampm_clicked(GtkWidget *widget, GdkEventButton *event,
-                                gpointer data)
+hildon_time_picker_arrow_press( GtkWidget *widget, GdkEvent *event,
+                                HildonTimePicker *picker )
 {
-    HildonTimePicker *picker;
-    HildonTimePickerPriv *priv;
-
-    g_return_val_if_fail (widget, FALSE);
-    g_return_val_if_fail (data, FALSE);
-
-    picker = HILDON_TIME_PICKER (data);
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (picker);
-
-    gtk_widget_grab_focus (widget);
-    hildon_time_picker_change_ampm_label (picker);
+  HildonTimePickerPrivate *priv = picker->priv;
+  gint newval = 0;
 
+  if( priv->button_press )
     return FALSE;
+
+  priv->start_key_repeat = priv->button_press = TRUE;
+
+  if( widget == priv->child[BUTTON_HOURS_UP] )
+  {
+    priv->mul = 60;
+    gtk_widget_grab_focus( priv->child[EBOX_HOURS] );
+  }
+  else if( widget == priv->child[BUTTON_MMINUTES_UP] )
+  {
+    priv->mul = 10;
+    gtk_widget_grab_focus( priv->child[EBOX_MMINUTES] );
+  }
+  else if( widget == priv->child[BUTTON_LMINUTES_UP] )
+  {
+    priv->mul = 1;
+    gtk_widget_grab_focus( priv->child[EBOX_LMINUTES] );
+  }
+  else if( widget == priv->child[BUTTON_HOURS_DOWN] )
+  {
+    priv->mul = -60;
+    gtk_widget_grab_focus( priv->child[EBOX_HOURS] );
+  }
+  else if( widget == priv->child[BUTTON_MMINUTES_DOWN] )
+  {
+    priv->mul = -10;
+    gtk_widget_grab_focus( priv->child[EBOX_MMINUTES] );
+  }
+  else
+  {
+    priv->mul = -1;
+    gtk_widget_grab_focus( priv->child[EBOX_LMINUTES] );
+  }
+
+  newval = priv->minutes + priv->mul;
+  if( newval < 0 )
+    newval += 1440;
+
+  hildon_time_picker_change_time( picker, newval );
+  priv->timer_id = g_timeout_add( priv->key_repeat * 3, hildon_time_picker_timeout, picker );
+  return FALSE;
 }
 
 static gboolean
-hildon_time_picker_change_ampm_label(HildonTimePicker * picker)
+hildon_time_picker_arrow_release( GtkWidget *widget, GdkEvent *event,
+                                  HildonTimePicker *picker )
 {
-    HildonTimePickerPriv *priv;
-
-    g_return_val_if_fail (picker, FALSE);
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (picker);
-
-    if (priv->am)
-      {
-        gtk_label_set_text (GTK_LABEL (priv->ampm_label), priv->pm_symbol);
-        priv->am = FALSE;
-      }
-    else
-      {
-        gtk_label_set_text (GTK_LABEL (priv->ampm_label), priv->am_symbol);
-        priv->am = TRUE;
-      }
-    return TRUE;
+  HildonTimePickerPrivate *priv = picker->priv;
+  if( priv->timer_id )
+  {
+    g_source_remove( priv->timer_id );
+    priv->timer_id = 0;
+  }
+  priv->button_press = FALSE;
+  return FALSE;
 }
 
 static gboolean
-hildon_time_picker_key_press (GtkWidget *widget, GdkEventKey *event,
-                             gpointer data)
+hildon_time_picker_event_box_focus_in( GtkWidget *widget, GdkEvent *event,
+                                       gpointer data )
 {
-    HildonTimePicker *tp;
-    HildonTimePickerPriv *priv;
+  gtk_widget_set_state( widget, GTK_STATE_SELECTED );
+  return FALSE;
+}
 
-    g_return_val_if_fail (data, FALSE);
-    g_return_val_if_fail (event, FALSE);
-    g_return_val_if_fail (widget, FALSE);
+static gboolean
+hildon_time_picker_event_box_focus_out( GtkWidget *widget, GdkEvent *event,
+                                        gpointer data )
+{
+  gtk_widget_set_state( widget, GTK_STATE_NORMAL );
+  return FALSE;
+}
 
-    tp = HILDON_TIME_PICKER (data);
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (tp);
+static gboolean
+hildon_time_picker_event_box_key_press( GtkWidget *widget, GdkEventKey *event,
+                                        HildonTimePicker *picker )
+{
+  HildonTimePickerPrivate *priv = picker->priv;
 
-    /* If ESC pressed we should close dialog and not select value */
+  if( priv->timer_id )
+    return TRUE;
 
-    /* We don't want wrap */
-    if ((event->keyval == GDK_KP_Left || event->keyval == GDK_Left)
-        && (widget == priv->h_ebox))
-      {
-        return TRUE;
-      }
-    else if ((event->keyval == GDK_KP_Right || event->keyval == GDK_Right)
-            && (widget == priv->ampm_button))
+  switch( event->keyval )
+  {
+    case GDK_Up:
+      if( widget == priv->child[EBOX_HOURS] )
       {
-        return TRUE;
+        hildon_time_picker_arrow_press( priv->child[BUTTON_HOURS_UP], NULL,
+                                        picker );
+        gtk_widget_set_state( priv->child[BUTTON_HOURS_UP], GTK_STATE_SELECTED );
       }
-
-    /* Handle ampm button */
-    if ((event->keyval == GDK_Up || event->keyval == GDK_Down)
-        && widget == priv->ampm_button)
+      else if( widget == priv->child[EBOX_MMINUTES] )
       {
-        hildon_time_picker_change_ampm_label (tp);
-        return TRUE;
+        hildon_time_picker_arrow_press( priv->child[BUTTON_MMINUTES_UP], NULL,
+                                        picker );
+        gtk_widget_set_state( priv->child[BUTTON_MMINUTES_UP],
+                              GTK_STATE_SELECTED );
       }
-
-    switch (event->keyval)
-    {
-      case GDK_Left:
-        if (widget == priv->h_ebox)
-            gtk_widget_grab_focus (priv->ampm_button);
-        else if (widget == priv->ampm_button)
-            gtk_widget_grab_focus (priv->ms_ebox);
-        else if (widget == priv->ms_ebox)
-            gtk_widget_grab_focus (priv->mt_ebox);
-        else
-            gtk_widget_grab_focus (priv->h_ebox);
-
-        return TRUE;
-
-      case GDK_Right:
-        if (widget == priv->h_ebox)
-            gtk_widget_grab_focus (priv->mt_ebox);
-        else if (widget == priv->mt_ebox)
-            gtk_widget_grab_focus (priv->ms_ebox);
-        else if (widget == priv->ms_ebox)
-            gtk_widget_grab_focus (priv->ampm_button);
-        else
-            gtk_widget_grab_focus (priv->h_ebox);
-
-        return TRUE;
-
-      case GDK_Up:
-        if (widget == priv->h_ebox)
-            hildon_time_picker_clicked (GTK_BUTTON (priv->h_up), data);
-        if (widget == priv->mt_ebox)
-            hildon_time_picker_clicked (GTK_BUTTON (priv->mt_up), data);
-        if (widget == priv->ms_ebox)
-            hildon_time_picker_clicked (GTK_BUTTON (priv->ms_up), data);
-
-        return TRUE;
-
-      case GDK_Down:
-        if (widget == priv->h_ebox)
-            hildon_time_picker_clicked (GTK_BUTTON (priv->h_down), data);
-        if (widget == priv->mt_ebox)
-            hildon_time_picker_clicked (GTK_BUTTON (priv->mt_down), data);
-        if (widget == priv->ms_ebox)
-            hildon_time_picker_clicked (GTK_BUTTON (priv->ms_down), data);
-
-        return TRUE;
-
-      case GDK_Escape:
-        gtk_dialog_response (GTK_DIALOG (data), GTK_RESPONSE_REJECT);
-        return TRUE;
-
-      case GDK_KP_Enter:
-      case GDK_Return:
-        gtk_dialog_response (GTK_DIALOG (data), GTK_RESPONSE_ACCEPT);
-        return TRUE;
-
-      default:
-        return TRUE;
-    }
-
-    return FALSE;
-}
-
-static void
-hildon_time_picker_clicked (GtkButton *button, gpointer data)
-{
-    gchar new_val[3];
-    gint val, tval;
-    HildonTimePicker *tp;
-    HildonTimePickerPriv *priv;
-
-    g_return_if_fail (button);
-    g_return_if_fail (data);
-
-    tp = HILDON_TIME_PICKER (data);
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (tp);
-
-    if (button == GTK_BUTTON (priv->h_up) ||
-        button == GTK_BUTTON (priv->h_down))
+      else if( widget == priv->child[EBOX_LMINUTES] )
       {
-        hildon_time_picker_handle_hours (button, tp);
+        hildon_time_picker_arrow_press( priv->child[BUTTON_LMINUTES_UP], NULL,
+                                        picker );
+        gtk_widget_set_state( priv->child[BUTTON_LMINUTES_UP],
+                              GTK_STATE_SELECTED );
       }
+      else
+        hildon_time_picker_ampm_release( priv->child[EBOX_AMPM], NULL, picker );
+      return TRUE;
 
-    if (button == GTK_BUTTON (priv->mt_up))
+    case GDK_Down:
+      if( widget == priv->child[EBOX_HOURS] )
       {
-        val = atoi (gtk_label_get_text (GTK_LABEL (priv->mt_label)));
-        val++;
-        if (val > 5)
-          {
-            val = 0;
-            hildon_time_picker_handle_hours (GTK_BUTTON (priv->h_up), tp);
-          }
-        sprintf (new_val, "%d", val);
-        gtk_label_set_text (GTK_LABEL (priv->mt_label), new_val);
-        gtk_widget_grab_focus (priv->mt_ebox);
+        hildon_time_picker_arrow_press( priv->child[BUTTON_HOURS_DOWN], NULL,
+                                        picker );
+        gtk_widget_set_state( priv->child[BUTTON_HOURS_DOWN],
+                              GTK_STATE_SELECTED );
       }
-
-    if (button == GTK_BUTTON (priv->mt_down))
+      else if( widget == priv->child[EBOX_MMINUTES] )
       {
-        val = atoi (gtk_label_get_text (GTK_LABEL (priv->mt_label)));
-        val--;
-
-        if (val < 0)
-          {
-            val = 5;
-            hildon_time_picker_handle_hours (GTK_BUTTON (priv->h_down), tp);
-          }
-
-        sprintf (new_val, "%d", val);
-        gtk_label_set_text (GTK_LABEL (priv->mt_label), new_val);
-        gtk_widget_grab_focus (priv->mt_ebox);
+        hildon_time_picker_arrow_press( priv->child[BUTTON_MMINUTES_DOWN], NULL,
+                                        picker );
+        gtk_widget_set_state( priv->child[BUTTON_MMINUTES_DOWN],
+                              GTK_STATE_SELECTED );
       }
-
-    if (button == GTK_BUTTON (priv->ms_up))
+      else if( widget == priv->child[EBOX_LMINUTES] )
       {
-        tval = atoi (gtk_label_get_text (GTK_LABEL (priv->mt_label)));
-        val = atoi (gtk_label_get_text (GTK_LABEL (priv->ms_label)));
-        val++;
-
-        if (val > 9)
-          {
-            val = 0;
-            tval++;
-
-            if (tval > 5)
-              {
-                tval = 0;
-                hildon_time_picker_handle_hours (GTK_BUTTON (priv->h_up), tp);
-              }
-            sprintf (new_val, "%d", tval);
-            gtk_label_set_text (GTK_LABEL (priv->mt_label), new_val);
-          }
-
-        sprintf (new_val, "%d", val);
-        gtk_label_set_text (GTK_LABEL (priv->ms_label), new_val);
-        gtk_widget_grab_focus (priv->ms_ebox);
+        hildon_time_picker_arrow_press( priv->child[BUTTON_LMINUTES_DOWN], NULL,
+                                        picker );
+        gtk_widget_set_state( priv->child[BUTTON_LMINUTES_DOWN],
+                              GTK_STATE_SELECTED );
       }
+      else
+        hildon_time_picker_ampm_release( priv->child[EBOX_AMPM], NULL, picker );
+      return TRUE;
 
-    if (button == GTK_BUTTON (priv->ms_down))
+    case GDK_Left:
+      if( priv->c12h )
       {
-        tval = atoi(gtk_label_get_text (GTK_LABEL (priv->mt_label)));
-        val = atoi(gtk_label_get_text (GTK_LABEL (priv->ms_label)));
-        val--;
-
-        if (val < 0)
-          {
-            val = 9;
-            tval--;
-
-            if (tval < 0)
-              {
-                tval = 5;
-                hildon_time_picker_handle_hours (GTK_BUTTON (priv->h_down),
-                                                 tp);
-              }
-            sprintf (new_val, "%d", tval);
-            gtk_label_set_text (GTK_LABEL (priv->mt_label), new_val);
-          }
-
-        sprintf (new_val, "%d", val);
-        gtk_label_set_text (GTK_LABEL (priv->ms_label), new_val);
-        gtk_widget_grab_focus (priv->ms_ebox);
+        if( !priv->ampm_pos )
+        {
+          if( widget == priv->child[EBOX_AMPM] )
+            return TRUE;
+        }
+        else if( widget == priv->child[EBOX_HOURS] )
+          return TRUE;
       }
-}
-
-static void
-hildon_time_picker_handle_hours (GtkButton *button, HildonTimePicker *tp)
-{
-    gchar new_val[3];
-    gint val;
-    HildonTimePickerPriv *priv;
-
-    g_return_if_fail (button);
+      else if( widget == priv->child[EBOX_HOURS] )
+        return TRUE;
 
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (tp);
+    break;
 
-    if (button == GTK_BUTTON (priv->h_up))
+    case GDK_Right:
+      if( priv->c12h )
       {
-        val = 10 * atoi (gtk_label_get_text (GTK_LABEL (priv->ht_label))) +
-            atoi (gtk_label_get_text (GTK_LABEL (priv->hs_label)));
-        val++;
-
-        if (priv->clock_24h && val > 23)
-            val = 0;
-        else if (!priv->clock_24h && val == 12 && priv->am)
-          {
-            gtk_label_set_text (GTK_LABEL (priv->ampm_label),
-                               priv->pm_symbol);
-            priv->am = FALSE;
-          }
-        else if (!priv->clock_24h && val == 12 && !priv->am)
-          {
-            gtk_label_set_text (GTK_LABEL (priv->ampm_label),
-                               priv->am_symbol);
-            priv->am = TRUE;
-          }
-        else if (!priv->clock_24h && val > 12)
-          val = 1;
-
-        sprintf (new_val, "%02d", val);
-        gtk_label_set_text (GTK_LABEL (priv->hs_label), &new_val[1]);
-        new_val[1] = '\0';
-        gtk_label_set_text (GTK_LABEL (priv->ht_label), new_val);
-        gtk_widget_grab_focus (priv->h_ebox);
+        if( priv->ampm_pos )
+        {
+          if( widget == priv->child[EBOX_AMPM] )
+            return TRUE;
+        }
+        else if( widget == priv->child[EBOX_LMINUTES] )
+          return TRUE;
       }
+      else if( widget == priv->child[EBOX_LMINUTES] )
+        return TRUE;
+    break;
+    
+    case GDK_Escape:
+      gtk_dialog_response (GTK_DIALOG (picker), GTK_RESPONSE_CANCEL);
+      return TRUE;
 
-    if (button == GTK_BUTTON (priv->h_down))
-      {
-        val = 10 * atoi (gtk_label_get_text (GTK_LABEL (priv->ht_label))) +
-            atoi (gtk_label_get_text (GTK_LABEL (priv->hs_label)));
-        val--;
-
-        if (priv->clock_24h && val < 0)
-            val = 23;
-        else if (!priv->clock_24h && val == 11 && priv->am)
-          {
-            gtk_label_set_text (GTK_LABEL (priv->ampm_label),
-                                priv->pm_symbol);
-            priv->am = FALSE;
-          }
-        else if (!priv->clock_24h && val == 11 && !priv->am)
-          {
-            gtk_label_set_text (GTK_LABEL (priv->ampm_label),
-                                priv->am_symbol);
-            priv->am = TRUE;
-          }
-        else if (!priv->clock_24h && val < 1)
-            val = 12;
-
-        sprintf (new_val, "%02d", val);
-        gtk_label_set_text (GTK_LABEL (priv->hs_label), &new_val[1]);
-        new_val[1] = '\0';
-        gtk_label_set_text (GTK_LABEL (priv->ht_label), new_val);
-        gtk_widget_grab_focus (priv->h_ebox);
-      }
-}
+    case GDK_Return:
+      gtk_dialog_response (GTK_DIALOG (picker), GTK_RESPONSE_OK);
+      return TRUE;
+  }
 
-static void
-hildon_time_picker_add_style (void)
-{
-    gtk_rc_parse_string ("  style \"hildon-arrow-item\" {"
-                         "    xthickness = 0"
-                         "    ythickness = 0"
-                         "    engine \"pixmap\" {"
-                         "      image {"
-                         "        function = BOX"
-                         "      }"
-                         "    }"
-                         "  }"
-                         "  widget \"*.hildon-arrow-item\""
-                         "    style \"hildon-arrow-item\"");
+  return FALSE;
 }
 
 static gboolean
-hildon_time_picker_timeout (gpointer data)
+hildon_time_picker_event_box_key_release( GtkWidget *widget, GdkEventKey *event,
+                                          HildonTimePicker *picker )
 {
-    HildonTimePicker *p;
-    HildonTimePickerPriv *priv;
-    GtkWidget *b;
-
-    if (!data)
-        return FALSE;
-
-    p = HILDON_TIME_PICKER (data);
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (p);
-
-    b = priv->press_button;
-
-    if (b)
-      {
-        hildon_time_picker_clicked (GTK_BUTTON(b), data);
-        return TRUE;
-      }
-
-    priv->id = 0;
-    return FALSE;
+  gint i;
+
+  switch( event->keyval )
+  {
+    case GDK_Up:
+      for( i = BUTTON_HOURS_UP; i <= BUTTON_LMINUTES_UP; i += 2 )
+        gtk_widget_set_state( picker->priv->child[i], GTK_STATE_NORMAL );
+      hildon_time_picker_arrow_release( widget, NULL, picker );
+    break;
+
+    case GDK_Down:
+      for( i = BUTTON_HOURS_DOWN; i <= BUTTON_LMINUTES_DOWN; i += 2 )
+        gtk_widget_set_state( picker->priv->child[i], GTK_STATE_NORMAL );
+      hildon_time_picker_arrow_release( widget, NULL, picker );
+      break;
+  }
+  return FALSE;
 }
 
 static gboolean
-hildon_time_picker_start_timer (gpointer data)
+hildon_time_picker_timeout( gpointer data )
 {
-    HildonTimePicker *p;
-    HildonTimePickerPriv *priv;
-    GtkSettings *settings;
-    guint interval;
+  HildonTimePicker *picker = NULL;
+  HildonTimePickerPrivate *priv = NULL;
+  gint newval = 0;
 
-    if (!data)
-        return FALSE;
+  if( !data )
+    return FALSE;
 
-    p = HILDON_TIME_PICKER (data);
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (p);
+  picker = HILDON_TIME_PICKER(data);
+  priv = picker->priv;
 
-    settings = gtk_settings_get_default();
-    g_object_get (settings, "gtk-update-timeout", &interval, NULL);
+  if( !picker->priv->timer_id )
+    return FALSE;
 
-    if ((priv->press_button) && (priv->id == 0))
-        priv->id = g_timeout_add (interval, hildon_time_picker_timeout, data);
+  newval = priv->minutes + priv->mul;
+  if( newval < 0 )
+    newval += 1440;
 
-    priv->start_id = 0;
+  hildon_time_picker_change_time( picker, newval );
 
+  if( priv->start_key_repeat )
+  {
+    priv->timer_id = g_timeout_add( priv->key_repeat, hildon_time_picker_timeout, picker );
+    priv->start_key_repeat = FALSE;
     return FALSE;
-}
+  }
 
-static gboolean
-hildon_time_picker_button_press (GtkWidget *widget, GdkEventButton *event,
-                                 gpointer data)
-{
-    HildonTimePicker *p;
-    HildonTimePickerPriv *priv;
+  return TRUE;
+}
 
-    g_return_val_if_fail (widget, FALSE);
-    g_return_val_if_fail (data, FALSE);
 
-    p = HILDON_TIME_PICKER (data);
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (p);
 
-    if ((widget == priv->h_ebox) || (widget == priv->ms_ebox) ||
-        (widget == priv->mt_ebox))
-      {
-        gtk_widget_grab_focus(widget);
-        return FALSE;
-      }
+static void
+hildon_time_picker_change_time( HildonTimePicker *picker, guint minutes )
+{
+  HildonTimePickerPrivate *priv = picker->priv;
+  gchar str[3] = "00";
+  guint hours = 0;
+  gboolean ampm = TRUE;
 
-    if ((widget == priv->h_up) || (widget == priv->h_down)
-        || (widget == priv->mt_up) || (widget == priv->mt_down)
-        || (widget == priv->ms_up) || (priv->ms_down))
-      {
-        GtkSettings *settings;
-        guint interval;
+  minutes %= 1440;
 
-        settings = gtk_settings_get_default();
-        g_object_get (settings, "gtk-initial-timeout", &interval, NULL);
+  if( priv->minutes == minutes )
+    return;
 
-        priv->press_button = widget;
-        if (priv->start_id != 0)
-            g_source_remove (priv->start_id);
-        priv->start_id =
-            g_timeout_add (interval, hildon_time_picker_start_timer, data);
-      }
+  priv->minutes = minutes;
 
-    if ((widget == priv->h_up) || (widget == priv->h_down))
-        gtk_widget_grab_focus (priv->h_ebox);
-    else if ((widget == priv->mt_up) || (widget == priv->mt_down))
-        gtk_widget_grab_focus (priv->mt_ebox);
-    else if ((widget == priv->ms_up) || (widget == priv->ms_down))
-        gtk_widget_grab_focus (priv->ms_ebox);
+  if( priv->c12h )
+  {
+    ampm = !((guint)(minutes / 720));
+    minutes %= 720;
+    if( minutes < 60 )
+      minutes += 720;
 
-    return FALSE;
-}
+    gtk_label_set_text( GTK_LABEL(priv->child[LABEL_AMPM]),
+                        ampm ? priv->am_symbol : priv->pm_symbol );
+  }
 
-static gboolean
-hildon_time_picker_button_release (GtkWidget *widget, GdkEventButton *event,
-                                   gpointer data)
-{
-    HildonTimePicker *p;
-    HildonTimePickerPriv *priv;
+  hours = minutes / 60;
+  minutes %= 60;
 
-    g_return_val_if_fail (widget, FALSE);
-    g_return_val_if_fail (data, FALSE);
+  sprintf( str, "%02d", hours );
+  gtk_label_set_text( GTK_LABEL(priv->child[LABEL_HOURS]), str );
 
-    p = HILDON_TIME_PICKER (data);
-    priv = HILDON_TIME_PICKER_GET_PRIVATE( p);
+  sprintf( str, "%02d", minutes );
+  gtk_label_set_text( GTK_LABEL(priv->child[LABEL_LMINUTES]), &str[1] );
 
-    /* Setting this to NULL will result hanler to fail and return FALSE.
-       Timeout will be removed if FALSE is returned. */
-    priv->press_button = NULL;
+  str[1] = '\0';
+  gtk_label_set_text( GTK_LABEL(priv->child[LABEL_MMINUTES]), &str[0] );
 
-    return FALSE;
+  g_object_notify( G_OBJECT(picker), "minutes" );
 }
 
-static gboolean
-hildon_time_picker_focus_in (GtkWidget *widget, GdkEventFocus *event,
-                             gpointer data)
+/**
+ * hildon_time_picker_new:
+ * @parent: parent window.
+ *
+ * Hildon Time Picker shows time picker dialog. Close button is placed
+ * in dialog's action area and time picker is placed in dialogs vbox.
+ * Actual time picker consists two #GtkLabel fields one for hour and
+ * one for minutes, arrow buttons and an AM/PM button. A : is placed
+ * between hour and minute fields.
+ *
+ * Return value: pointer to a new #HildonTimePicker widget.
+ **/
+GtkWidget *hildon_time_picker_new( GtkWindow *parent )
 {
-    HildonTimePicker *p;
-    HildonTimePickerPriv *priv;
+  GtkWidget *widget = g_object_new( HILDON_TYPE_TIME_PICKER, NULL );
 
-    g_return_val_if_fail (widget, FALSE);
-    g_return_val_if_fail (data, FALSE);
+  if( parent )
+    gtk_window_set_transient_for( GTK_WINDOW(widget), parent );
 
-    p = HILDON_TIME_PICKER (data);
-    priv = HILDON_TIME_PICKER_GET_PRIVATE (p);
+  return GTK_WIDGET(widget);
+}
 
-    if (widget == priv->h_ebox)
-      {
-        gtk_widget_set_state (priv->h_ebox, GTK_STATE_SELECTED);
-        gtk_widget_set_state (priv->ht_label, GTK_STATE_SELECTED);
-        gtk_widget_set_state (priv->hs_label, GTK_STATE_SELECTED);
-        gtk_widget_set_state (priv->mt_ebox, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ms_ebox, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->mt_label, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ms_label, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ampm_button, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ampm_label, GTK_STATE_NORMAL);
-      }
-    if (widget == priv->mt_ebox)
-      {
-        gtk_widget_set_state (priv->h_ebox, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ht_label, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->hs_label, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->mt_ebox, GTK_STATE_SELECTED);
-        gtk_widget_set_state (priv->ms_ebox, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->mt_label, GTK_STATE_SELECTED);
-        gtk_widget_set_state (priv->ms_label, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ampm_button, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ampm_label, GTK_STATE_NORMAL);
-      }
-    if (widget == priv->ms_ebox)
-      {
-        gtk_widget_set_state (priv->h_ebox, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ht_label, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->hs_label, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->mt_ebox, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ms_ebox, GTK_STATE_SELECTED);
-        gtk_widget_set_state (priv->mt_label, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ms_label, GTK_STATE_SELECTED);
-        gtk_widget_set_state (priv->ampm_button, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ampm_label, GTK_STATE_NORMAL);
-      }
-    if (widget == priv->ampm_button)
-      {
-        gtk_widget_set_state (priv->h_ebox, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ht_label, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->hs_label, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->mt_ebox, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ms_ebox, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->mt_label, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ms_label, GTK_STATE_NORMAL);
-        gtk_widget_set_state (priv->ampm_button, GTK_STATE_SELECTED);
-        gtk_widget_set_state (priv->ampm_label, GTK_STATE_SELECTED);
-      }
+/**
+ * hildon_time_picker_set_time:
+ * @picker: the #HildonTimePicker widget.
+ * @hours: hours
+ * @minutes: minutes
+ *
+ * Sets the time of the #HildonTimePicker widget.
+ **/
+void hildon_time_picker_set_time( HildonTimePicker *picker,
+                                  guint hours, guint minutes )
+{
+  g_return_if_fail( HILDON_IS_TIME_PICKER(picker) );
+  hildon_time_picker_change_time( picker, hours * 60 + minutes );
+}
 
-  return FALSE;
+/**
+ * hildon_time_picker_get_time:
+ * @picker: the #HildonTimePicker widget.
+ * @hours: hours
+ * @minutes: minutes
+ *
+ * Gets the time of the #HildonTimePicker widget.
+ **/
+void hildon_time_picker_get_time( HildonTimePicker *picker,
+                                  guint *hours, guint *minutes )
+{
+  guint current;
+  g_return_if_fail( HILDON_IS_TIME_PICKER(picker) );
+
+  current = picker->priv->minutes;
+  *hours = current / 60;
+  *minutes = current % 60;
 }
index 278cdc0..f1db2af 100644 (file)
@@ -27,6 +27,8 @@
 #include <gtk/gtkdialog.h>
 
 G_BEGIN_DECLS
+
+
 #define HILDON_TYPE_TIME_PICKER (hildon_time_picker_get_type())
 #define HILDON_TIME_PICKER(obj) (GTK_CHECK_CAST (obj, \
                                  HILDON_TYPE_TIME_PICKER, \
@@ -38,27 +40,35 @@ G_BEGIN_DECLS
                                     HILDON_TYPE_TIME_PICKER))
 #define HILDON_IS_TIME_PICKER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass),\
                                             HILDON_TYPE_TIME_PICKER))
+
+
 typedef struct _HildonTimePicker HildonTimePicker;
 typedef struct _HildonTimePickerClass HildonTimePickerClass;
+typedef struct _HildonTimePickerPrivate HildonTimePickerPrivate;
 
-/*< private >*/
-struct _HildonTimePicker {
-    GtkDialog parent;
+
+struct _HildonTimePicker
+{
+  GtkDialog parent;
+  HildonTimePickerPrivate *priv;
 };
 
-struct _HildonTimePickerClass {
-    GtkDialogClass parent_class;
+struct _HildonTimePickerClass
+{
+  GtkDialogClass parent_class;
 };
 
-GType hildon_time_picker_get_type(void);
 
-GtkWidget *hildon_time_picker_new(GtkWindow * parent);
+GType hildon_time_picker_get_type( void ) G_GNUC_CONST;
+
+GtkWidget *hildon_time_picker_new( GtkWindow *parent );
+
+void hildon_time_picker_set_time( HildonTimePicker *picker,
+                                  guint hours, guint minutes );
 
-void hildon_time_picker_set_time(HildonTimePicker * picker,
-                                 guint hours, guint minutes);
+void hildon_time_picker_get_time( HildonTimePicker *picker,
+                                  guint *hours, guint *minutes );
 
-void hildon_time_picker_get_time(HildonTimePicker * picker,
-                                 guint * hours, guint * minutes);
 
 G_END_DECLS
 #endif
index bba31fc..5183798 100644 (file)
@@ -58,7 +58,14 @@ static void hildon_volumebar_range_class_init(HildonVolumebarRangeClass *
                                               volumerange_class);
 static void hildon_volumebar_range_init(HildonVolumebarRange *
                                         volumerange);
-
+static void hildon_volumebar_range_set_property(GObject * object,
+                                               guint prop_id,
+                                               const GValue * value,
+                                               GParamSpec * pspec);
+static void hildon_volumebar_range_get_property(GObject * object,
+                                               guint prop_id,
+                                               GValue * value,
+                                               GParamSpec * pspec);
 static gint hildon_volumebar_range_button_press_event(GtkWidget * widget,
                                                       GdkEventButton *
                                                       event);
@@ -68,6 +75,11 @@ static gint hildon_volumebar_range_button_release_event(GtkWidget * widget,
 static gboolean hildon_volumebar_range_keypress(GtkWidget * widget,
                                                 GdkEventKey * event);
 
+enum {
+  PROP_NONE = 0,
+  PROP_LEVEL
+};
+
 GType 
 hildon_volumebar_range_get_type(void)
 {
@@ -97,6 +109,7 @@ hildon_volumebar_range_class_init(HildonVolumebarRangeClass *
                                  volumerange_class)
 {
     GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(volumerange_class);
+    GObjectClass *object_class = G_OBJECT_CLASS(volumerange_class);
 
     parent_class = g_type_class_peek_parent(volumerange_class);
 
@@ -106,6 +119,18 @@ hildon_volumebar_range_class_init(HildonVolumebarRangeClass *
         hildon_volumebar_range_button_release_event;
     widget_class->key_press_event = hildon_volumebar_range_keypress;
 
+    object_class->set_property = hildon_volumebar_range_set_property;
+    object_class->get_property = hildon_volumebar_range_get_property; 
+
+    g_object_class_install_property(object_class,
+                                   PROP_LEVEL,
+                                   g_param_spec_double("level",
+                                                       "Level",
+                                                       "Current volume level",
+                                                       VOLUMEBAR_RANGE_MINIMUM_VALUE,
+                                                       VOLUMEBAR_RANGE_MAXIMUM_VALUE,
+                                                       VOLUMEBAR_RANGE_INITIAL_VALUE,
+                                                       G_PARAM_READWRITE));
     return;
 }
 
@@ -119,6 +144,42 @@ hildon_volumebar_range_init(HildonVolumebarRange * volumerange)
   return;
 }
 
+static void
+hildon_volumebar_range_set_property(GObject * object,
+                                   guint prop_id,
+                                   const GValue * value,
+                                   GParamSpec * pspec)
+{
+    HildonVolumebarRange *range = HILDON_VOLUMEBAR_RANGE(object);
+
+    switch (prop_id) {
+    case PROP_LEVEL:
+        hildon_volumebar_range_set_level(range, g_value_get_double(value));
+       break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+       break;
+    }
+}
+
+static void
+hildon_volumebar_range_get_property(GObject * object,
+                                   guint prop_id,
+                                   GValue * value,
+                                   GParamSpec * pspec)
+{
+    HildonVolumebarRange *range = HILDON_VOLUMEBAR_RANGE(object);
+
+    switch (prop_id) {
+    case PROP_LEVEL:
+        g_value_set_double(value, hildon_volumebar_range_get_level(range));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+       break;
+    }
+}
+
 static
 gboolean hildon_volumebar_range_keypress(GtkWidget * widget,
                                          GdkEventKey * event)
index c52ac73..162b580 100644 (file)
  * This file contains the implementation of the Hildon Volumebar.
  * It is a base class for Hildon Vertical Volumebar and for
  * Hildon Horizontal Volumebar classes.
+ *
  */
+
+#include <gtk/gtkwindow.h>
 #include <gtk/gtksignal.h>
 #include <gdk/gdkkeysyms.h>
 
@@ -60,12 +63,11 @@ static void hildon_volumebar_get_property(GObject * object,
                                            GValue * value, 
                                            GParamSpec * pspec);
 
-static void mute_toggled (HildonVolumebar *self, gpointer data);
+static void mute_toggled (HildonVolumebar *self);
 
 static gboolean
 hildon_volumebar_key_press(GtkWidget * widget,
-                           GdkEventKey * event,
-                           gpointer data);
+                           GdkEventKey * event);
 
 
 enum 
@@ -78,7 +80,9 @@ enum
 enum {
     PROP_NONE = 0,
     PROP_HILDON_HAS_MUTE,
-    PROP_HILDON_FOCUSABLE
+    PROP_HILDON_FOCUSABLE,
+    PROP_HILDON_LEVEL,
+    PROP_HILDON_MUTE
 };
 
 static guint signals[LAST_SIGNAL] = { 0 };
@@ -121,7 +125,9 @@ hildon_volumebar_class_init(HildonVolumebarClass *volumebar_class)
 
     /* Because we derived our widget from GtkContainer, we should also
        override forall method */
+    volumebar_class->mute_toggled = mute_toggled;
     container_class->forall = hildon_child_forall;
+    GTK_WIDGET_CLASS(volumebar_class)->key_press_event = hildon_volumebar_key_press;
     GTK_OBJECT_CLASS(volumebar_class)->destroy = hildon_volumebar_destroy;
 
     signals[MUTE_TOGGLED_SIGNAL] = g_signal_new("mute_toggled",
@@ -167,6 +173,25 @@ hildon_volumebar_class_init(HildonVolumebarClass *volumebar_class)
                                     TRUE,
                                     G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
 
+    g_object_class_install_property(object_class,
+                                   PROP_HILDON_LEVEL,
+                                   g_param_spec_double("level",
+                                                       "Level",
+                                                       "Current volume level",
+                                                       0.0,
+                                                       100.0,
+                                                       50.0,
+                                                       G_PARAM_READWRITE));
+
+    g_object_class_install_property(object_class,
+                                   PROP_HILDON_MUTE,
+                                   g_param_spec_boolean("mute",
+                                                        "Mute",
+                                                        "Whether volume is muted",
+                                                        FALSE,
+                                                        G_PARAM_READWRITE));
+                                   
+
 }
 
 static void 
@@ -183,14 +208,6 @@ hildon_volumebar_init(HildonVolumebar * volumebar)
     
     priv->tbutton = GTK_TOGGLE_BUTTON(gtk_toggle_button_new());
     g_object_set (G_OBJECT (priv->tbutton), "can-focus", FALSE, NULL);
-    g_signal_connect (G_OBJECT (volumebar), "mute_toggled",
-                      G_CALLBACK (mute_toggled), NULL);
-    
-    /* set keypress handler (select hardkey) */
-    g_signal_connect(G_OBJECT(volumebar), "key-press-event",
-            G_CALLBACK(hildon_volumebar_key_press),
-            NULL);
-
 }
 
 static void
@@ -241,29 +258,28 @@ hildon_volumebar_set_property(GObject * object,
 {  
     HildonVolumebar *vbar = HILDON_VOLUMEBAR(object);
     HildonVolumebarPrivate *priv;
-    gboolean has_mute = TRUE;
 
     priv = HILDON_VOLUMEBAR_GET_PRIVATE(vbar)
 
     switch (prop_id) {
     case PROP_HILDON_HAS_MUTE:
-        has_mute = g_value_get_boolean(value);
-
-        if (has_mute)
-        {
+        if (g_value_get_boolean(value))
             gtk_widget_show(GTK_WIDGET(priv->tbutton));
-
-        }
         else
-        {
             gtk_widget_hide(GTK_WIDGET(priv->tbutton));
-        }
-        
         break;
     case PROP_HILDON_FOCUSABLE:
         g_object_set( G_OBJECT(priv->volumebar), "can-focus", 
                       g_value_get_boolean(value), NULL );
         break;
+    case PROP_HILDON_LEVEL:
+        hildon_volumebar_set_level(HILDON_VOLUMEBAR(priv->volumebar),
+                                  g_value_get_double(value));
+        break;
+    case PROP_HILDON_MUTE:
+        hildon_volumebar_set_mute(HILDON_VOLUMEBAR(priv->volumebar),
+                                 g_value_get_boolean(value));
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
 
@@ -276,16 +292,22 @@ hildon_volumebar_get_property(GObject * object,
                               guint prop_id, GValue * value, 
                               GParamSpec * pspec)
 {
-  HildonVolumebarPrivate *priv;
-  priv = HILDON_VOLUMEBAR_GET_PRIVATE(object)
+    HildonVolumebar *vb = HILDON_VOLUMEBAR(object);
+    HildonVolumebarPrivate *priv = HILDON_VOLUMEBAR_GET_PRIVATE(vb);
+
     switch (prop_id) {
     case PROP_HILDON_HAS_MUTE:
-        g_value_set_boolean(value, g_value_get_boolean(value));
+        g_value_set_boolean(value, GTK_WIDGET_VISIBLE(priv->tbutton));
         break;
-     case PROP_HILDON_FOCUSABLE:
-        g_value_set_boolean(value, g_value_get_boolean(value));
-        g_object_set( G_OBJECT(priv->volumebar), "can-focus", 
-                      g_value_get_boolean(value), NULL );
+    case PROP_HILDON_FOCUSABLE:
+        g_value_set_boolean(value, GTK_WIDGET_CAN_FOCUS(priv->volumebar));
+       break;
+    case PROP_HILDON_LEVEL:
+        g_value_set_double(value, hildon_volumebar_get_level(vb));
+       break;
+    case PROP_HILDON_MUTE:
+        g_value_set_boolean(value, hildon_volumebar_get_mute(vb));
+       break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
@@ -360,21 +382,37 @@ void
 hildon_volumebar_set_mute(HildonVolumebar * self, gboolean mute)
 {
     HildonVolumebarPrivate *priv;
-
+    gboolean focusable = TRUE;
+    
     g_return_if_fail(self);
 
     priv = HILDON_VOLUMEBAR_GET_PRIVATE(self);
     gtk_widget_set_sensitive(GTK_WIDGET(priv->volumebar), !mute);
     
+    focusable = GTK_WIDGET_CAN_FOCUS (GTK_WIDGET (priv->volumebar));
+    
     if (mute){   
-        g_object_set (G_OBJECT (priv->tbutton), "can-focus", TRUE, NULL);
-        gtk_widget_grab_focus (GTK_WIDGET(priv->tbutton));
+        if (focusable){
+
+            g_object_set (G_OBJECT (priv->tbutton), "can-focus", TRUE, NULL);
+            gtk_widget_grab_focus (GTK_WIDGET(priv->tbutton));
+        }
     }
     else
     {
         g_object_set (G_OBJECT (priv->tbutton), "can-focus", FALSE, NULL);
-        gtk_widget_grab_focus (GTK_WIDGET (self));
+        
+        if (focusable){
+            gtk_widget_grab_focus (GTK_WIDGET (self));
+        }
+        else{
+            GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (self), 
+                                                      GTK_TYPE_WINDOW);
+            gtk_window_set_focus (GTK_WINDOW (win), NULL);
+        }
     }
+
+    gtk_toggle_button_set_active(priv->tbutton, mute);
 }
 
 /**
@@ -424,7 +462,7 @@ hildon_volumebar_get_adjustment (HildonVolumebar * self)
 }
 
 static void
-mute_toggled (HildonVolumebar *self, gpointer data)
+mute_toggled (HildonVolumebar *self)
 {
   /* only call hildon_volumebar_set_mute. everything is done there */
   hildon_volumebar_set_mute (self, hildon_volumebar_get_mute(self));
@@ -432,8 +470,7 @@ mute_toggled (HildonVolumebar *self, gpointer data)
 
 static gboolean
 hildon_volumebar_key_press (GtkWidget * widget,
-                            GdkEventKey * event,
-                            gpointer data)
+                            GdkEventKey * event)
 {
     HildonVolumebarPrivate *priv;
     
@@ -442,11 +479,11 @@ hildon_volumebar_key_press (GtkWidget * widget,
 
     priv = HILDON_VOLUMEBAR_GET_PRIVATE(widget);
     
-    if (event->keyval == GDK_Return) {
+    if (event->keyval == GDK_Return && GTK_WIDGET_VISIBLE(priv->tbutton)) {
         gtk_toggle_button_set_active(priv->tbutton, 
                 !hildon_volumebar_get_mute(HILDON_VOLUMEBAR(widget)));
         return TRUE;
     }
 
-    return FALSE;
+    return GTK_WIDGET_CLASS(parent_class)->key_press_event(widget, event);
 }
index 97c0196..a5d5023 100644 (file)
@@ -61,7 +61,7 @@
 #include "hildon-weekday-picker.h"
 #include "hildon-composite-widget.h"
 
-#define _(String) gettext (String)
+#define _(string) dgettext(PACKAGE, string)
 
 #define HILDON_WEEKDAY_PICKER_GET_PRIVATE(obj) \
     (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
index c8599fe..2685854 100644 (file)
@@ -27,6 +27,8 @@
 #include <gtk/gtkimage.h>
 #include <gtk/gtkbox.h>
 #include <gtk/gtkhbox.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtkbutton.h>
 #include <hildon-widgets/hildon-defines.h>
 
 #include "hildon-wizard-dialog.h"
@@ -46,9 +48,8 @@ static void hildon_wizard_dialog_class_init(HildonWizardDialogClass *
 static void hildon_wizard_dialog_init(HildonWizardDialog * wizard_dialog);
 static void
 hildon_wizard_dialog_create_title(HildonWizardDialog * wizard_dialog);
-static void hildon_wizard_dialog_response(HildonWizardDialog *
-                                          wizard_dialog, gint response_id,
-                                          gpointer data);
+static void direction_button_clicked(GtkWidget *widget,
+                                     HildonWizardDialog *wizard_dialog);
 static void hildon_wizard_dialog_set_property(GObject * object,
                                               guint property_id,
                                               const GValue * value,
@@ -69,7 +70,9 @@ struct _HildonWizardDialogPrivate {
     gchar *wizard_name;
     GtkNotebook *notebook;
     GtkBox *box;
-    GtkImage *image;
+    GtkWidget *image;
+    GtkWidget *previous_button;
+    GtkWidget *next_button;
 };
 
 
@@ -142,37 +145,48 @@ static void hildon_wizard_dialog_init(HildonWizardDialog * wizard_dialog)
                                     HILDON_TYPE_WIZARD_DIALOG,
                                     HildonWizardDialogPrivate);
     GtkDialog *dialog = GTK_DIALOG(wizard_dialog);
+    GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
+    
+    gtk_dialog_set_has_separator(dialog, FALSE);
 
     wizard_dialog->priv = priv;
     priv->box = GTK_BOX(gtk_hbox_new(FALSE, 0));
-    priv->image = GTK_IMAGE(gtk_image_new_from_stock("hildon-wizard-icon",
-                                                     HILDON_ICON_SIZE_WIDG_WIZARD));
+    priv->image = gtk_image_new_from_icon_name("qgn_widg_wizard",
+                                              HILDON_ICON_SIZE_WIDG_WIZARD);
     priv->notebook = NULL;
     priv->wizard_name = NULL;
 
     gtk_box_pack_start_defaults(GTK_BOX(dialog->vbox),
                                 GTK_WIDGET(priv->box));
-    gtk_box_pack_start_defaults(GTK_BOX(priv->box),
-                                GTK_WIDGET(priv->image));
+    gtk_box_pack_start_defaults(GTK_BOX(priv->box), GTK_WIDGET(vbox));
+    gtk_box_pack_start(GTK_BOX(vbox),GTK_WIDGET(priv->image), FALSE, FALSE, 0);
 
     gtk_dialog_add_button(dialog, _("Ecdg_bd_wizard_cancel"),
                           HILDON_WIZARD_DIALOG_CANCEL);
-    gtk_dialog_add_button(dialog, _("Ecdg_bd_wizard_previous"),
-                          HILDON_WIZARD_DIALOG_PREVIOUS);
-    gtk_dialog_add_button(dialog, _("Ecdg_bd_wizard_next"),
-                          HILDON_WIZARD_DIALOG_NEXT);
+
+    priv->previous_button =
+        gtk_button_new_with_label(_("Ecdg_bd_wizard_previous"));
+    gtk_box_pack_start(GTK_BOX(dialog->action_area),
+                       priv->previous_button, FALSE, TRUE, 0);
+
+    g_signal_connect(priv->previous_button, "clicked",
+                     G_CALLBACK(direction_button_clicked), wizard_dialog);
+
+    priv->next_button =
+        gtk_button_new_with_label(_("Ecdg_bd_wizard_next"));
+    gtk_box_pack_start(GTK_BOX(dialog->action_area),
+                       priv->next_button, FALSE, TRUE, 0);
+
+    g_signal_connect(priv->next_button, "clicked",
+                     G_CALLBACK(direction_button_clicked), wizard_dialog);
+
     gtk_dialog_add_button(dialog, _("Ecdg_bd_wizard_finish"),
                           HILDON_WIZARD_DIALOG_FINISH);
 
-    g_signal_connect(G_OBJECT(dialog), "response",
-                     G_CALLBACK(hildon_wizard_dialog_response), NULL);
-
-    gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard_dialog),
-                                      HILDON_WIZARD_DIALOG_PREVIOUS,
-                                      FALSE);
     gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard_dialog),
                                       HILDON_WIZARD_DIALOG_FINISH,
                                       FALSE);
+    gtk_widget_set_sensitive(priv->previous_button, FALSE);
 
     hildon_wizard_dialog_create_title(wizard_dialog);
 }
@@ -196,8 +210,10 @@ hildon_wizard_dialog_set_property(GObject * object, guint property_id,
     case PROP_WIZARD_NOTEBOOK:
         priv->notebook = GTK_NOTEBOOK(g_value_get_object(value));
         gtk_notebook_set_show_tabs(priv->notebook, FALSE);
+        gtk_notebook_set_show_border(priv->notebook, FALSE);
         gtk_box_pack_start_defaults(GTK_BOX(priv->box),
                                     GTK_WIDGET(priv->notebook));
+        
         if (priv->wizard_name)
             hildon_wizard_dialog_create_title(HILDON_WIZARD_DIALOG
                                               (object));
@@ -281,62 +297,44 @@ hildon_wizard_dialog_create_title(HildonWizardDialog * wizard_dialog)
     g_free(str);
 }
 
-
-static void hildon_wizard_dialog_response(HildonWizardDialog *
-                                          wizard_dialog, gint response_id,
-                                          gpointer data)
+static void direction_button_clicked(GtkWidget *widget,
+                                     HildonWizardDialog *wizard_dialog)
 {
     HildonWizardDialogPrivate *priv = wizard_dialog->priv;
     GtkNotebook *notebook = priv->notebook;
     gint current = 0;
     gint last = gtk_notebook_get_n_pages(notebook) - 1;
 
-    switch (response_id) {
-    case HILDON_WIZARD_DIALOG_PREVIOUS:
+    if (widget == priv->previous_button)
+    {
         gtk_notebook_prev_page(notebook);
         current = gtk_notebook_get_current_page(notebook);
         if (current == 0)
         {
-            gtk_dialog_set_response_sensitive
-                (GTK_DIALOG(wizard_dialog),
-                 HILDON_WIZARD_DIALOG_PREVIOUS,
-                 FALSE);
+            gtk_widget_set_sensitive(priv->previous_button, FALSE);
             gtk_dialog_set_response_sensitive
                 (GTK_DIALOG(wizard_dialog),
                  HILDON_WIZARD_DIALOG_FINISH,
                  FALSE);
         }
         if (current != last)
-            gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard_dialog),
-                                              HILDON_WIZARD_DIALOG_NEXT,
-                                              TRUE);
-
-        g_signal_stop_emission_by_name(wizard_dialog, "response");
-        break;
-    case HILDON_WIZARD_DIALOG_NEXT:
+            gtk_widget_set_sensitive(priv->next_button, TRUE);
+    }
+    else /* Next button */
+    {
         gtk_notebook_next_page(notebook);
         current = gtk_notebook_get_current_page(notebook);
         if (gtk_notebook_get_current_page(notebook) != 0)
         {
-            gtk_dialog_set_response_sensitive
-                (GTK_DIALOG(wizard_dialog),
-                 HILDON_WIZARD_DIALOG_PREVIOUS,
-                 TRUE);
+            gtk_widget_set_sensitive(priv->previous_button, TRUE);
             gtk_dialog_set_response_sensitive
                 (GTK_DIALOG(wizard_dialog),
                  HILDON_WIZARD_DIALOG_FINISH,
                  TRUE);
         }
         if (current == last)
-            gtk_dialog_set_response_sensitive(GTK_DIALOG(wizard_dialog),
-                                              HILDON_WIZARD_DIALOG_NEXT,
-                                              FALSE);
-        g_signal_stop_emission_by_name(wizard_dialog, "response");
-        break;
-    case HILDON_WIZARD_DIALOG_CANCEL:
-    case HILDON_WIZARD_DIALOG_FINISH:
-        return;
-    };
+            gtk_widget_set_sensitive(priv->next_button, FALSE);
+    }
 
     if (current == last || current == 0)
         gtk_widget_show(GTK_WIDGET(priv->image));
index 77b4128..19e358f 100644 (file)
@@ -5,7 +5,7 @@ EXTRA_DIST = $(foreach po,$(languages),$(po).po) POTFILES.in README \
        debian/compat \
        debian/control \
        debian/rules \
-       debian/hildon-libs-l10n-engb.install
+       debian/hildon-libs-l10n-engb.install \
 
 %.mo: %.po
        msgfmt --statistics -v -o$(top_builddir)/po/$@ $(srcdir)/$<
@@ -14,10 +14,10 @@ all: $(foreach mo,$(languages),$(mo).mo)
 
 merge:
        for mo in $(languages); do \
-               xgettext -fPOTFILES --foreign-user -C -o$$mo.pot -k_; \
-               msgmerge -v $$mo.po $$mo.pot >messages.tmp; \
+               echo "Merging $$mo..."; \
+               msgmerge -v $$mo.po hildon-libs.pot >messages.tmp; \
                mv messages.tmp $$mo.po; \
-               rm $$mo.pot; \
+               msgfmt --statistics $$mo.po -o /dev/null; \
        done
 
 install-data-local: all
index aa2f848..43f5987 100644 (file)
@@ -59,8 +59,6 @@ CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOXYGEN_FOUND = @DOXYGEN_FOUND@
@@ -176,7 +174,7 @@ EXTRA_DIST = $(foreach po,$(languages),$(po).po) POTFILES.in README \
        debian/compat \
        debian/control \
        debian/rules \
-       debian/hildon-libs-l10n-engb.install
+       debian/hildon-libs-l10n-engb.install \
 
 subdir = po
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -336,10 +334,10 @@ all: $(foreach mo,$(languages),$(mo).mo)
 
 merge:
        for mo in $(languages); do \
-               xgettext -fPOTFILES --foreign-user -C -o$$mo.pot -k_; \
-               msgmerge -v $$mo.po $$mo.pot >messages.tmp; \
+               echo "Merging $$mo..."; \
+               msgmerge -v $$mo.po hildon-libs.pot >messages.tmp; \
                mv messages.tmp $$mo.po; \
-               rm $$mo.pot; \
+               msgfmt --statistics $$mo.po -o /dev/null; \
        done
 
 install-data-local: all
diff --git a/po/POTFILES b/po/POTFILES
deleted file mode 100644 (file)
index 5c90f5c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-add-home-dialog.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-calendar-popup.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-color-selector.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-controlbar.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-date-editor.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-file-details-dialog.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-file-handling-note.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-find-object-dialog.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-font-selection-dialog.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-get-password-dialog.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-grid.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-insert-object-dialog.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-name-password-dialog.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-note.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-number-editor.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-set-password-dialog.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-sort-dialog.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-telephone-editor.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-time-editor.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../hildon-widgets/hildon-time-picker.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../ut/hildon-clock-widgets_tests.c \
-       /home/ferenc/014/2_rebuild/hildon-libs-0.9.6/../ut/hildon-widgets_tests.c
index da60cdb..1eed9da 100644 (file)
@@ -1,25 +1,19 @@
 # List of source files containing translatable strings.
 
 # Package source files
-../hildon-widgets/hildon-add-home-dialog.c
-../hildon-widgets/hildon-calendar-popup.c
-../hildon-widgets/hildon-color-selector.c
-../hildon-widgets/hildon-controlbar.c
-../hildon-widgets/hildon-date-editor.c
-../hildon-widgets/hildon-file-details-dialog.c
-../hildon-widgets/hildon-file-handling-note.c
-../hildon-widgets/hildon-find-object-dialog.c
-../hildon-widgets/hildon-font-selection-dialog.c
-../hildon-widgets/hildon-get-password-dialog.c
-../hildon-widgets/hildon-grid.c
-../hildon-widgets/hildon-insert-object-dialog.c
-../hildon-widgets/hildon-name-password-dialog.c
-../hildon-widgets/hildon-note.c
-../hildon-widgets/hildon-number-editor.c
-../hildon-widgets/hildon-set-password-dialog.c
-../hildon-widgets/hildon-sort-dialog.c
-../hildon-widgets/hildon-telephone-editor.c
-../hildon-widgets/hildon-time-editor.c
-../hildon-widgets/hildon-time-picker.c
-../ut/hildon-clock-widgets_tests.c
-../ut/hildon-widgets_tests.c
+hildon-widgets/hildon-add-home-dialog.c
+hildon-widgets/hildon-calendar-popup.c
+hildon-widgets/hildon-color-popup.c
+hildon-widgets/hildon-color-selector.c
+hildon-widgets/hildon-date-editor.c
+hildon-widgets/hildon-file-details-dialog.c
+hildon-widgets/hildon-file-handling-note.c
+hildon-widgets/hildon-font-selection-dialog.c
+hildon-widgets/hildon-insert-object-dialog.c
+hildon-widgets/hildon-note.c
+hildon-widgets/hildon-number-editor.c
+hildon-widgets/hildon-range-editor.c
+hildon-widgets/hildon-sort-dialog.c
+hildon-widgets/hildon-time-editor.c
+hildon-widgets/hildon-time-picker.c
+hildon-widgets/hildon-wizard-dialog.c
index c17a550..83ba006 100644 (file)
--- a/po/README
+++ b/po/README
@@ -1,6 +1,13 @@
 How to make .po files up to date with the current sources?
 
-  1. make merge
+  1. intltool-update -m
+        This will check POTFILES.in for missing or unavailable files.
+        Missing files are list in 'missing' file and unavailable files in
+        'notexist' file.
+  2. intltool-update --pot
+        This creates a pot file.
+  3. make merge
+        Will update all the locale files.
 
 How to add a new locale?
 
@@ -9,5 +16,5 @@ How to add a new locale?
 
 How to add a new source file that contains gettext macros?
 
-  1. edit POTFILES and add your file there
+  1. edit POTFILES and add your file there (or check with intltool-update -m)
   2. make merge
index 785c834..8876493 100644 (file)
@@ -1,7 +1,7 @@
 Source: hildon-libs-l10n-src
 Section: x11
 Priority: optional
-Maintainer: Luc Piochon <luc.piochon@nokia.com>
+Maintainer: Luc Pionchon <luc.pionchon@nokia.com>
 Build-Depends: debhelper (>= 4.0.0), gettext
 Standards-Version: 3.6.0
 
diff --git a/po/debian/hildon-libs-l10n-engb.install b/po/debian/hildon-libs-l10n-engb.install
new file mode 100644 (file)
index 0000000..059d74a
--- /dev/null
@@ -0,0 +1 @@
+usr/share/locale/en_GB/LC_MESSAGES/hildon-libs.mo
index 48ccd01..89c544a 100644 (file)
@@ -9,6 +9,7 @@ msgstr ""
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2005-02-15 16:15+0200\n"
 "PO-Revision-Date: 2005-03-13 12:00+0200\n"
+"Last-Translator: \n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -61,6 +62,8 @@ msgstr "OK"
 msgid "ecdg_bd_colour_selector_cancel"
 msgstr "Cancel"
 
+msgid "ecdg_bd_colour_selector_modify"          
+msgstr "Modify"
 
 msgid "ecdg_bd_5bit_colour_selector_ok"
 msgstr "OK"
@@ -155,7 +158,7 @@ msgstr "(no details)"
 #: ../hildon-widgets/hildon-file-details-dialog.c:381
 #: ../hildon-widgets/hildon-file-details-dialog.c:411
 msgid "sfil_ti_file_details"
-msgstr "File details"
+msgstr "Details"
 
 #: ../hildon-widgets/hildon-file-details-dialog.c:466
 msgid "ckdg_va_properties_size_bytes"
@@ -165,41 +168,90 @@ msgstr "%d B"
 msgid "ckdg_va_properties_size_kb"
 msgstr "%d kB"
 
+# hildon-file-handling-note.c   
+msgid "sfil_nw_moving_file"     
+msgstr "Moving\n%s"     
+        
+msgid "sfil_bd_moving_file"     
+msgstr "Cancel"         
+        
+msgid "docm_nw_moving_files"    
+msgstr "Moving %d/%d\n%s"       
+        
+msgid "docm_bd_moving_files"    
+msgstr "Stop"   
+        
+msgid "docm_nw_saving_file"     
+msgstr "Saving\n%s"     
+        
+msgid "docm_bd_saving_file"     
+msgstr "Cancel"         
+        
+msgid "docm_nw_saving_files"    
+msgstr "Saving %d/%d\n%s"       
+        
+msgid "docm_bd_saving_files"    
+msgstr "Stop"   
+        
+msgid "docm_nw_opening_file"    
+msgstr "Opening\n%s"    
+        
+msgid "docm_bd_opening_file"    
+msgstr "Cancel"         
+        
+msgid "docm_nw_opening_files"   
+msgstr "Opening %d/%d\n%s"      
+        
+msgid "docm_bd_opening_files"   
+msgstr "Stop"   
+        
+msgid "docm_nw_deleting_file"   
+msgstr "Deleting\n%s"   
+        
+msgid "docm_bd_deleting_file"   
+msgstr "Cancel"         
+        
+msgid "docm_nw_deleting_files"          
+msgstr "Deleting %d/%d\n%s"     
+        
+msgid "docm_bd_deleting_files"          
+msgstr "Stop"
+
 #: ../hildon-widgets/hildon-time-picker.c:487
 msgid "ecdg_bd_time_picker_close"
 msgstr "Close"
 
 #: ../hildon-widgets/hildon-font-selection-dialog.c:228
 msgid "ecdg_fi_font_font"
-msgstr "Font face:"
+msgstr "Font face"
 
 #: ../hildon-widgets/hildon-font-selection-dialog.c:238
 msgid "ecdg_fi_font_size"
-msgstr "Font size:"
+msgstr "Font size"
 
 #: ../hildon-widgets/hildon-font-selection-dialog.c:270
 msgid "ecdg_fi_font_color_selector"
-msgstr "Color:"
+msgstr "Colour"
 
 #: ../hildon-widgets/hildon-font-selection-dialog.c:280
 msgid "ecdg_fi_font_bold"
-msgstr "Bold:"
+msgstr "Bold"
 
 #: ../hildon-widgets/hildon-font-selection-dialog.c:291
 msgid "ecdg_fi_font_italic"
-msgstr "Italic:"
+msgstr "Italic"
 
 #: ../hildon-widgets/hildon-font-selection-dialog.c:301
 msgid "ecdg_fi_font_underline"
-msgstr "Underline:"
+msgstr "Underline"
 
 #: ../hildon-widgets/hildon-font-selection-dialog.c:315
 msgid "ecdg_fi_font_strikethrough"
-msgstr "Strikethrough:"
+msgstr "Strikethrough"
 
 #: ../hildon-widgets/hildon-font-selection-dialog.c:324
 msgid "ecdg_fi_font_special"
-msgstr "Positioning:"
+msgstr "Positioning"
 
 #: ../hildon-widgets/hildon-font-selection-dialog.c:335
 msgid "ecdg_ti_font_dialog_style"
@@ -249,25 +301,8 @@ msgstr "Superscript"
 msgid "ecdg_va_font_printpos_3"
 msgstr "Subscript"
 
-#: ../hildon-widgets/hildon-get-password-dialog.c:44
-msgid "ecdg_fi_verify_pwd_enter_pwd"
-msgstr "Enter password:"
-
-#: ../hildon-widgets/hildon-get-password-dialog.c:45
-msgid "ecdg_bd_verify_password_dialog_ok"
-msgstr "OK"
-
-#: ../hildon-widgets/hildon-get-password-dialog.c:46
-msgid "ecdg_bd_verify_password_dialog_cancel"
-msgstr "Cancel"
-
-#: ../hildon-widgets/hildon-get-password-dialog.c:47
-msgid "ecdg_bd_verify_password"
-msgstr "Password protected"
-
-#: ../hildon-widgets/hildon-get-password-dialog.c:48
-msgid "ecdg_ti_get_old_password"
-msgstr "Enter current password"
+msgid "ecdg_va_font_size_trailer"
+msgstr "pt"
 
 #: ../hildon-widgets/hildon-insert-object-dialog.c:127
 msgid "ckdg_ti_insert_insert_objec"
@@ -285,26 +320,6 @@ msgstr "Insert existing"
 msgid "ckdg_bd_insert_cancel"
 msgstr "Cancel"
 
-#: ../hildon-widgets/hildon-name-password-dialog.c:68
-msgid "frw_ti_get_user_name_and_pwd"
-msgstr "Enter user name and password"
-
-#: ../hildon-widgets/hildon-name-password-dialog.c:72
-msgid "frw_bd_get_user_name_and_pwd_ok"
-msgstr "OK"
-
-#: ../hildon-widgets/hildon-name-password-dialog.c:76
-msgid "frw_bd_get_user_name_and_pwd_cancel"
-msgstr "Cancel"
-
-#: ../hildon-widgets/hildon-name-password-dialog.c:82
-msgid "frw_ti_get_user_name_and_pwd_enter_user_name"
-msgstr "Enter user name:"
-
-#: ../hildon-widgets/hildon-name-password-dialog.c:91
-msgid "frw_ti_get_user_name_and_pwd_enter_pwd"
-msgstr "Enter password:"
-
 #: ../hildon-widgets/hildon-number-editor.c:367
 #, c-format
 msgid "Ckct_ib_maximum_value"
@@ -318,71 +333,7 @@ msgstr "Minimum value is %d"
 #: ../hildon-widgets/hildon-number-editor.c:378
 #, c-format
 msgid "Ckct_ib_set_a_value_within_range"
-msgstr "Set a value between %d and %d"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:179
-msgid "ckdg_fi_dialog_c_passwd_new_pwd"
-msgstr "New password:"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:180
-msgid "ckdg_fi_dialog_c_passwd_ver_pwd"
-msgstr "Verify new password:"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:188
-msgid "ckdg_fi_dialog_c_passwd_pwd_protect"
-msgstr "Password protected:"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:204
-msgid "ecdg_fi_set_passwd_enter_pwd"
-msgstr "New password:"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:205
-msgid "ecdg_fi_set_passwd_confirm"
-msgstr "Verify new password:"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:258
-msgid "ckdg_ti_dialog_c_passwd_change_password"
-msgstr "Change password"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:259
-msgid "ecdg_ti_set_password"
-msgstr "Set password"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:264
-msgid "ckdg_bd_change_password_dialog_ok"
-msgstr "OK"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:265
-msgid "ecdg_bd_set_password_dialog_ok"
-msgstr "OK"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:269
-msgid "ckdg_bd_change_password_dialog_cancel"
-msgstr "Cancel"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:270
-msgid "ecdg_bd_set_password_dialog_cancel"
-msgstr "Cancel"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:362
-msgid "ckdg_nc_dialog_c_passwd_remove_pwd"
-msgstr "Remove password protection?"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:365
-msgid "ckdg_bd_dialog_c_passwd_remove_button"
-msgstr "Remove"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:423
-msgid "ecdg_ib_password_is_empty"
-msgstr "Enter a password"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:423
-msgid "ecdg_ib_passwords_do_not_match"
-msgstr "Passwords do not match"
-
-#: ../hildon-widgets/hildon-set-password-dialog.c:423
-msgid "ckdg_ib_dialog_c_passwd_unmatched_pwd"
-msgstr "Passwords do not match"
+msgstr "Value must be between %d and %d"
 
 #: ../hildon-widgets/hildon-sort-dialog.c:94
 msgid "ckdg_ti_sort"
@@ -402,7 +353,7 @@ msgstr "Descending"
 
 #: ../hildon-widgets/hildon-sort-dialog.c:111
 msgid "ckdg_fi_sort_order"
-msgstr "Sorting order:"
+msgstr "Order:"
 
 #: ../hildon-widgets/hildon-sort-dialog.c:123
 msgid "ckdg_bd_sort_dialog_ok"
@@ -436,3 +387,143 @@ msgstr "Next"
 msgid "Ecdg_bd_wizard_finish"
 msgstr "Finish"
 
+#: ../hildon-widgets/hildon-get-password-dialog.h
+msgid "ecdg_ti_get_old_password"
+msgstr "Current password"
+
+#: ../hildon-widgets/hildon-get-password-dialog.h
+msgid "ecdg_fi_get_old_pwd_enter_pwd"
+msgstr "Password:"
+
+#: ../hildon-widgets/hildon-get-password-dialog.h
+msgid "ecdg_bd_get_old_password_dialog_ok"
+msgstr "OK"
+
+#: ../hildon-widgets/hildon-get-password-dialog.h
+msgid "ecdg_bd_get_old_password_dialog_cancel"
+msgstr "Cancel"
+
+#: ../hildon-widgets/hildon-get-password-dialog.h
+msgid "ecdg_ti_verify_password"
+msgstr "Password protected"
+
+#: ../hildon-widgets/hildon-get-password-dialog.h
+msgid "ecdg_fi_verify_pwd_enter_pwd"
+msgstr "Password:"
+
+#: ../hildon-widgets/hildon-get-password-dialog.h
+msgid "ecdg_bd_verify_password_dialog_ok"
+msgstr "OK"
+
+#: ../hildon-widgets/hildon-get-password-dialog.h
+msgid "ecdg_bd_verify_password_dialog_cancel"
+msgstr "Cancel"
+
+#: ../hildon-widgets/hildon-name-password-dialog.h
+msgid "frw_ti_get_user_name_and_pwd"
+msgstr "User name and password"
+
+#: ../hildon-widgets/hildon-name-password-dialog.h
+msgid "frw_ti_get_user_name_and_pwd_enter_user_name"
+msgstr "User name:"
+
+#: ../hildon-widgets/hildon-name-password-dialog.h
+msgid "frw_ti_get_user_name_and_pwd_enter_pwd"
+msgstr "Password:"
+
+#: ../hildon-widgets/hildon-name-password-dialog.h
+msgid "frw_bd_get_user_name_and_pwd_ok"
+msgstr "OK"
+
+#: ../hildon-widgets/hildon-name-password-dialog.h
+msgid "frw_bd_get_user_name_and_pwd_cancel"
+msgstr "Cancel"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ecdg_ti_set_password"
+msgstr "Set password"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ecdg_fi_set_passwd_enter_pwd"
+msgstr "New password:"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ecdg_fi_set_passwd_confirm"
+msgstr "Verify password:"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ecdg_bd_set_password_dialog_ok"
+msgstr "OK"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ecdg_bd_set_password_dialog_cancel"
+msgstr "Cancel"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ckdg_ti_dialog_c_passwd_change_password"
+msgstr "Change password"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ckdg_fi_dialog_c_passwd_pwd_protect"
+msgstr "Password protected:"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ckdg_fi_dialog_c_passwd_new_pwd"
+msgstr "New password:"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ckdg_fi_dialog_c_passwd_ver_pwd"
+msgstr "Verify new password:"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ckdg_bd_change_password_dialog_ok"
+msgstr "OK"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ckdg_bd_change_password_dialog_cancel"
+msgstr "Cancel"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ecdg_ib_passwords_do_not_match"
+msgstr "Passwords do not match"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ecdg_ib_password_is_empty"
+msgstr "Enter a password"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ckdg_nc_dialog_c_passwd_remove_pwd"
+msgstr "Remove password protection?"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ckdg_bd_dialog_c_passwd_remove_button"
+msgstr "Remove"
+
+#: ../hildon-widgets/hildon-set-password-dialog.h
+msgid "ckdg_bd_dialog_c_passwd_cancel_button"
+msgstr "Cancel"
+
+msgid "Ckct_ib_min_allowed_duration_hts"
+msgstr "Minimum allowed duration is %02d:%02d:%02d"
+
+msgid "Ckct_ib_max_allowed_duration_hts"
+msgstr "Maximum allowed duration is %02d:%02d:%02d"
+
+msgid "Ckct_wi_range_separator"
+msgstr "-"
+
+msgid "Ecdg_ti_date_editor_separator"
+msgstr "/"
+
+msgid "Ckct_ib_date_does_not_exist"
+msgstr "Date does not exist"
+
+msgid "Ecdg_ti_time_editor_separator"
+msgstr ":"
+
+msgid "Ecdg_ti_time_picker_separator"
+msgstr ":"
+
+# determines the first day of the week (0 for Sunday, 1 for Monday etc.)
+msgid "week_start"
+msgstr "0"
index 5d3c35f..eeadab2 100644 (file)
@@ -59,8 +59,6 @@ CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DATADIRNAME = @DATADIRNAME@
-DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_LIBS = @DBUS_LIBS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOXYGEN_FOUND = @DOXYGEN_FOUND@
index 943bd0d..541116e 100644 (file)
@@ -1,5 +1,27 @@
-/* -*- mode: C; c-file-style: "stroustrup"; indent-tabs-mode: nil; -*- */
-/* Copyright (c) 2003 Nokia Oyj*/
+/*
+ * This file is part of hildon-libs
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ * Contact: Luc Pionchon <luc.pionchon@nokia.com>
+ *
+ * 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
+ *
+ */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -325,7 +347,11 @@ static int test03h()
   init_test();
 
   time_editor = HILDON_TIME_EDITOR( hildon_time_editor_new () );
+#ifndef HILDON_DISABLE_DEPRECATED
   hildon_time_editor_show_seconds( time_editor, TRUE );
+#else
+  hildon_time_editor_set_show_seconds (time_editor, TRUE);
+#endif
 
   return 1;
 }
@@ -335,9 +361,11 @@ static int test03i()
 {
   HildonTimeEditor *time_editor = NULL;
 
-  
-
+#ifndef HILDON_DISABLE_DEPRECATED
   hildon_time_editor_show_seconds( time_editor, TRUE );
+#else
+  hildon_time_editor_set_show_seconds (time_editor, TRUE);
+#endif
 
   return 1;
 }
index 25c3256..8406cb4 100644 (file)
@@ -1,3 +1,26 @@
+/*
+ * This file is part of hildon-libs
+ *
+ * Copyright (C) 2005 Nokia Corporation.
+ *
+ * Contact: Luc Pionchon <luc.pionchon@nokia.com>
+ *
+ * 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
+ *
+ */
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
 #include <gtk/gtk.h>
 
 #include "hildon-controlbar.h"
-#include "hildon-search.h"
 #include "hildon-seekbar.h"
 #include "hildon-note.h"
 #include <hildon-widgets/gtk-infoprint.h>
 #include <hildon-widgets/hildon-weekday-picker.h>
 #include <hildon-widgets/hildon-telephone-editor.h>
-#include <hildon-widgets/hildon-find-object-dialog.h>
 #include <hildon-widgets/hildon-range-editor.h>
 #include <hildon-widgets/hildon-sort-dialog.h>
 #include <hildon-widgets/hildon-get-password-dialog.h>
 #include <hildon-widgets/hildon-grid-item.h>
 #include <hildon-widgets/hildon-grid.h>
 #include <hildon-widgets/hildon-time-editor.h>
-#include <hildon-widgets/hildon-find-replace-dialog.h>
 #include <hildon-widgets/hildon-name-password-dialog.h>
 #include <hildon-widgets/hildon-file-details-dialog.h>
-
 #include <outo.h>
 
 /* Icon which must exist (HildonGridItem). */
@@ -100,11 +119,6 @@ int test6c(void);
 int test6d(void);
 int test6e(void);
 
-int test7a(void);
-int test7b(void);
-int test7c(void);
-int test7d(void);
-int test7e(void);
 int test8a(void);
 int test8b(void);
 int test8c(void);
@@ -210,8 +224,10 @@ int test25d(void);
 int test25e(void);
 
 /*FontSelectionDialog*/
+#ifndef HILDON_DISABLE_DEPRECATED
 int fsd_set_font(void);
 int fsd_get_font(void);
+#endif
 int fsd_set_pretext(void);
 int fsd_get_pretext(void);
 
@@ -314,8 +330,9 @@ int test39a(void);
 int test39b(void);
 
 /* file details dialog */
+#ifndef HILDON_DISABLE_DEPRECATED
 int test41a(void);
-
+#endif
 /* this has to be like this (not static). outo
    calls for this! */
 testcase *get_tests(void);
@@ -885,52 +902,6 @@ int test6e()
     return 1;
 }
 
-int test7a()
-{
-    GtkWidget *search;
-    
-    search = hildon_search_new( NULL );
-    assert(search);
-    return 1;
-}
-
-int test7b()
-{
-    GtkWidget *search;
-    
-    search = hildon_search_new( "some text" );
-    assert(search);
-    return 1;
-}
-
-int test7c()
-{
-    GtkWidget *search;
-    
-    search = hildon_search_new( "gtk-add" );
-    hildon_search_set_image_stock(HILDON_SEARCH(search), "soopaa");
-    assert(search);
-    return 1;
-}
-
-int test7d()
-{
-    GtkWidget *search;
-    
-    search = hildon_search_new( NULL );
-    hildon_search_set_image_stock(HILDON_SEARCH(search), "gtk-add");
-    return 1;
-}
-
-int test7e()
-{
-    GtkWidget *search;
-    
-    search = hildon_search_new( NULL );
-    gtk_widget_destroy(search);
-    return 1;
-}
-
 /* weekday_picker: new: ok */
 int test10a()
 {
@@ -1514,47 +1485,6 @@ int test19e()
     return 1;
 }
 
-/* find object dialog: new */
-int test20a(void){
-  GtkWidget *dialog;
-  dialog = hildon_find_object_dialog_new(NULL);
-  g_assert(dialog);
-  return 1;  
-}
-
-/* find object dialog: new with options */
-int test20b(void){
-  GtkWidget *dialog;
-  GtkWidget *options;
-  
-  options = gtk_dialog_new();
-  dialog = hildon_find_object_dialog_new_with_options(NULL,GTK_DIALOG(options));
-  gtk_widget_destroy(dialog);
-
-  return 1;
-}
-
-/* find object dialog: get_text */
-int test20c(void){
-  const gchar *string;
-  GtkWidget *dialog;
-
-  dialog = hildon_find_object_dialog_new(NULL);
-  string = hildon_find_object_dialog_get_text(HILDON_FIND_OBJECT_DIALOG(dialog));
-  g_assert(string);
-  return 1;
-}
-
-/* find object dialog: set_label */
-int test20d(void){
-  GtkWidget *dialog;
-
-  dialog = hildon_find_object_dialog_new(NULL);
-  hildon_find_object_dialog_set_label(HILDON_FIND_OBJECT_DIALOG(dialog),"labeltext");
-  
-  return 1;
-}
-
 /* find object options dialog: new */
 /*int test21a(void){
   GtkWidget *dialog;
@@ -2067,7 +1997,8 @@ int test25e()
     
     return 1;
 }
+
+#ifndef HILDON_DISABLE_DEPRECATED
 int fsd_get_font(void)
 {
        GtkWidget *fsd;
@@ -2087,7 +2018,7 @@ int fsd_set_font(void)
        hildon_font_selection_dialog_set_font(HILDON_FONT_SELECTION_DIALOG(fsd), list);
        return 1;
 }
-
+#endif
 int fsd_set_pretext(void)
 {
        GtkWidget *fsd;
@@ -2834,8 +2765,13 @@ int test35b (void){
 int test35c (void){
     GtkWidget *editor;
     editor = hildon_time_editor_new ();
+#ifndef HILDON_DISABLE_DEPRECATED    
     hildon_time_editor_show_seconds (HILDON_TIME_EDITOR (editor), 1);
     hildon_time_editor_show_seconds (HILDON_TIME_EDITOR (editor), 0);
+#else
+    hildon_time_editor_set_show_seconds (HILDON_TIME_EDITOR (editor), 1);
+    hildon_time_editor_set_show_seconds (HILDON_TIME_EDITOR (editor), 0);
+#endif
     return 1;
 }
 
@@ -2843,8 +2779,13 @@ int test35c (void){
 int test35d (void){
     GtkWidget *editor;
     editor = hildon_time_editor_new ();
+#ifndef HILDON_DISABLE_DEPRECATED    
     hildon_time_editor_enable_duration_mode (HILDON_TIME_EDITOR (editor),
                                              1);
+#else
+    hildon_time_editor_set_duration_mode (HILDON_TIME_EDITOR (editor),
+                                             1);
+#endif
     return 1;
 }
 
@@ -2855,8 +2796,13 @@ int test35e (void){
     GtkWidget *editor;
     guint min_seconds, max_seconds;
     editor = hildon_time_editor_new ();
+#ifndef HILDON_DISABLE_DEPRECATED    
     hildon_time_editor_enable_duration_mode (HILDON_TIME_EDITOR (editor),
                                              1);
+#else
+    hildon_time_editor_set_duration_mode (HILDON_TIME_EDITOR (editor),
+                                             1);
+#endif
     hildon_time_editor_set_duration_range (HILDON_TIME_EDITOR (editor),
                                            3600, 14500);
     hildon_time_editor_get_duration_range (HILDON_TIME_EDITOR (editor),
@@ -2870,10 +2816,17 @@ int test35e (void){
 int test35f (void){
     GtkWidget *editor;
     editor = hildon_time_editor_new ();
+#ifndef HILDON_DISABLE_DEPRECATED    
     hildon_time_editor_enable_duration_mode (HILDON_TIME_EDITOR (editor),
                                              1);
     hildon_time_editor_enable_duration_mode (HILDON_TIME_EDITOR (editor),
                                              0);
+#else
+    hildon_time_editor_set_duration_mode (HILDON_TIME_EDITOR (editor),
+                                             1);
+    hildon_time_editor_set_duration_mode (HILDON_TIME_EDITOR (editor),
+                                             0);
+#endif
     return 1;
 }
 
@@ -2901,8 +2854,13 @@ int test35h (void){
     GtkWidget *editor;
     guint min_seconds, max_seconds;
     editor = hildon_time_editor_new ();
+#ifndef HILDON_DISABLE_DEPRECATED
     hildon_time_editor_enable_duration_mode (HILDON_TIME_EDITOR (editor),
                                              1);
+#else
+    hildon_time_editor_set_duration_mode (HILDON_TIME_EDITOR (editor),
+                                             1);
+#endif
     hildon_time_editor_set_duration_range (HILDON_TIME_EDITOR (editor),
                                            3600, 14500);
     hildon_time_editor_get_duration_range (HILDON_TIME_EDITOR (editor),
@@ -2913,58 +2871,6 @@ int test35h (void){
 }
 
 
-/* find replace dialog: new */
-int test36a(void)
-{
-   
-     GtkWidget *dialog;
-     dialog = hildon_find_replace_dialog_new(NULL, HILDON_REPLACE_NORMAL);
-     g_assert(dialog);
-     return 1;
-}
-
-
-/* find replace dialog: new with options */
-int test36b(void)
-{
-   
-     GtkWidget *dialog;
-     GtkWidget *options;
-   
-     options = gtk_dialog_new();
-     dialog = hildon_find_replace_dialog_new_with_options(NULL,GTK_DIALOG(options), HILDON_REPLACE_NORMAL);
-     gtk_widget_destroy(dialog);
-   
-     return 1;
-}
-
-
-/* find replace dialog: get_text */
-int test36c(void)
-{
-   
-     const gchar *string;
-     GtkWidget *dialog;
-   
-     dialog = hildon_find_replace_dialog_new(NULL, HILDON_REPLACE_NORMAL);
-     string = hildon_find_replace_dialog_get_text(HILDON_FIND_REPLACE_DIALOG(dialog));
-     g_assert(string);
-     return 1;
-}
-
-/* find replace dialog: get_new_text */
-int test36d(void)
-{
-   
-     const gchar *string;
-     GtkWidget *dialog;
-   
-     dialog = hildon_find_replace_dialog_new(NULL, HILDON_REPLACE_NORMAL);
-     string = hildon_find_replace_dialog_get_new_text(HILDON_FIND_REPLACE_DIALOG(dialog));
-     g_assert(string);
-     return 1;
-}
-
 int test37a()
 {
      gtk_infoprint_temporarily_disable_wrap ();
@@ -3003,6 +2909,7 @@ int test39b()
    return 1;
 }
 
+#ifndef HILDON_DISABLE_DEPRECATED
 int test41a()
 {
   GtkWidget *fdialog;
@@ -3011,7 +2918,7 @@ int test41a()
   assert (HILDON_FILE_DETAILS_DIALOG (fdialog));
   return 1;
 }
-
+#endif
 testcase tcases[] =
 {
     {*test1a, "hildon_controlbar_new", EXPECT_OK},
@@ -3068,11 +2975,6 @@ testcase tcases[] =
     {*test6c, "hildon_volumebar_get/set_level", EXPECT_OK},
     {*test6d, "hildon_volumebar_get/set_mute", EXPECT_OK},
     {*test6e, "gtk_widget_destroy", EXPECT_OK},
-    {*test7a, "hildon_search_new", EXPECT_OK},
-    {*test7b, "hildon_search_new (fake icon)", EXPECT_OK},
-    {*test7c, "hildon_search_set_image (fake icon)", EXPECT_OK},
-    {*test7d, "hildon_search_set_image", EXPECT_OK},
-    {*test7e, "gtk_widget_destroy", EXPECT_OK},
     {*test10a, "hildon_weekday_picker_new", EXPECT_OK},
     {*test11a, "hildon_weekday_picker_{,un,is}set", EXPECT_OK},
     {*test11b, "hildon_weekday_picker_set: null", EXPECT_ASSERT},
@@ -3149,8 +3051,10 @@ testcase tcases[] =
     {*test25c, "set_password_dialog_new_get_password", EXPECT_OK},
     {*test25d, "set_password_dialog_new_get_protected", EXPECT_ASSERT},
     {*test25e, "gtk_widget_destroy", EXPECT_OK},
+#ifndef HILDON_DISABLE_DEPRECATED
     {*fsd_set_font, "FontSelectionDialog Set font", EXPECT_OK},
     {*fsd_get_font,"FontSelectionDialog Get font", EXPECT_OK},
+#endif
     {*fsd_set_pretext, "FontSelectionDialog Set preview text", EXPECT_OK},
     {*fsd_get_pretext, "FontSelectionDialog Get preview text", EXPECT_OK},
     {*test27a, "hildon_insert_object: new", EXPECT_OK},
@@ -3231,7 +3135,9 @@ testcase tcases[] =
     {*test37b, "gtk_banner_temporarily_disable_wrap", EXPECT_OK},
     {*test39a, "namepassword dialog get_name", EXPECT_OK},
     {*test39b, "namepassword dialog get_password", EXPECT_OK},
+#ifndef HILDON_DISABLE_DEPRECATED
     {*test41a, "hildon_file_details_dialog_new", EXPECT_OK},
+#endif
 /*    {*test38a, "gtk_confirmation_banner (sometext)", EXPECT_OK},
     {*test38a, "gtk_confirmation_banner (NULL)", EXPECT_OK},*/
    
diff --git a/ut/tmp b/ut/tmp
deleted file mode 100644 (file)
index e69de29..0000000