r686 - in trunk/src/target/OM-2007/applications: . openmoko-messenger openmoko-messenger/data openmoko-messenger/src

alex_tang at sita.openmoko.org alex_tang at sita.openmoko.org
Tue Feb 6 02:18:16 CET 2007


Author: alex_tang
Date: 2007-02-06 02:16:35 +0100 (Tue, 06 Feb 2007)
New Revision: 686

Added:
   trunk/src/target/OM-2007/applications/openmoko-messenger/
   trunk/src/target/OM-2007/applications/openmoko-messenger/AUTHORS
   trunk/src/target/OM-2007/applications/openmoko-messenger/COPYING
   trunk/src/target/OM-2007/applications/openmoko-messenger/ChangeLog
   trunk/src/target/OM-2007/applications/openmoko-messenger/INSTALL
   trunk/src/target/OM-2007/applications/openmoko-messenger/Makefile.am
   trunk/src/target/OM-2007/applications/openmoko-messenger/NEWS
   trunk/src/target/OM-2007/applications/openmoko-messenger/README
   trunk/src/target/OM-2007/applications/openmoko-messenger/autogen.sh
   trunk/src/target/OM-2007/applications/openmoko-messenger/configure.ac
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Address.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Attached.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Cancel.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Delete_Folder.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Delete_Message.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Drafts.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Email.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Folder.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/GetMail.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/InBox.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Makefile.am
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Mode_Forward.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Mode_Read.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Mode_Reply.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/New_Folder.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/New_Mail.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/New_SMS.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/OutBox.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/SearchResults.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Send.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Unread.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/Zip_ File.png
   trunk/src/target/OM-2007/applications/openmoko-messenger/data/folderlist
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/Makefile.am
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/callbacks.c
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/callbacks.h
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/detail-area.c
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/detail-area.h
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/folderlist
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/foldersdb.c
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/foldersdb.h
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/main.c
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/main.h
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/message.h
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-dialog-window.c
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-dialog-window.h
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-membership-window.c
   trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-membership-window.h
Log:
Openmoko messages for sending SMS/Email.


Added: trunk/src/target/OM-2007/applications/openmoko-messenger/AUTHORS
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/AUTHORS	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/AUTHORS	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,2 @@
+Alex Tang <alex at fic-sh.com.cn>
+

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/COPYING
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/COPYING	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/COPYING	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/ChangeLog	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/ChangeLog	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,2 @@
+Dec 5th,2006 add openmoko-messenger.c
+Dec 6th,2006 add msgermenu.c	msgermenu.h callbacks.c callbacks.h openmoko-messenger.h

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/INSTALL
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/INSTALL	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/INSTALL	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,236 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory.  After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PREFIX', the package will
+use PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the `--target=TYPE' option to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).  Here is a another example:
+
+     /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/Makefile.am	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/Makefile.am	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,2 @@
+SUBDIRS = src data
+

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/NEWS
===================================================================

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/README
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/README	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/README	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,5 @@
+This is an OpenMoko Stylus Application
+using the OpenMoko Application Framework.
+
+You can send messages via openmoko-messenger.
+Current version will only support SMS.

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/autogen.sh
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/autogen.sh	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/autogen.sh	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,4 @@
+#! /bin/sh
+autoreconf -v --install || exit 1
+glib-gettextize --force --copy || exit 1
+./configure --enable-maintainer-mode "$@"


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/autogen.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/configure.ac
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/configure.ac	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/configure.ac	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,24 @@
+AC_PREREQ(2.53)
+AC_INIT(openmoko-messenger, 1.0.0, http://www.openmoko.org/)
+AM_INIT_AUTOMAKE()
+AC_CONFIG_SRCDIR(src/main.c)
+AM_CONFIG_HEADER(config.h)
+AM_MAINTAINER_MODE
+
+AC_ISC_POSIX
+AC_PROG_CC
+AC_STDC_HEADERS
+AC_PROG_LIBTOOL
+
+# base deps
+PKG_CHECK_MODULES(OPENMOKO, openmoko-libs >= 0.0.1,,
+                 AC_MSG_ERROR([*** Required OpenMoko Libraries >= 0.0.1 not installed ***]))
+LIBS="$LIBS $GTK_LIBS"
+CFLAGS="$CFLAGS $OPENMOKO_CFLAGS"
+
+# output stuff
+AC_OUTPUT([
+Makefile
+src/Makefile
+data/Makefile
+])

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Address.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Address.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Attached.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Attached.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Cancel.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Cancel.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Delete_Folder.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Delete_Folder.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Delete_Message.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Delete_Message.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Drafts.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Drafts.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Email.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Email.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Folder.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Folder.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/GetMail.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/GetMail.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/InBox.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/InBox.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/data/Makefile.am	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/data/Makefile.am	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,24 @@
+resourcedir = $(pkgdatadir)
+resource_DATA = Email.png \
+								Mode_Reply.png \
+								Mode_Read.png \
+								Mode_Forward.png \
+								folderlist \
+								Delete_Folder.png \
+								Delete_Message.png \
+								Drafts.png \
+								Folder.png \
+								GetMail.png \
+								InBox.png \
+								New_Folder.png \
+								New_Mail.png \
+								New_SMS.png \
+								OutBox.png \
+								SearchResults.png \
+								Send.png \
+								Unread.png  \
+								Address.png  \
+								Attached.png \
+								Cancel.png
+								
+EXTRA_DIST = $(resource_DATA)

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Mode_Forward.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Mode_Forward.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Mode_Read.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Mode_Read.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Mode_Reply.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Mode_Reply.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/New_Folder.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/New_Folder.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/New_Mail.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/New_Mail.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/New_SMS.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/New_SMS.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/OutBox.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/OutBox.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/SearchResults.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/SearchResults.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Send.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Send.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Unread.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Unread.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Zip_ File.png
===================================================================
(Binary files differ)


Property changes on: trunk/src/target/OM-2007/applications/openmoko-messenger/data/Zip_ File.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/data/folderlist
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/data/folderlist	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/data/folderlist	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,5 @@
+Inbox
+Outbox
+Draft
+Sent
+Search Result

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/Makefile.am	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/Makefile.am	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,11 @@
+AM_CPPFLAGS = -DDATADIR=\"$(datadir)\" \
+              -DPKGDATADIR=\"$(pkgdatadir)\"
+
+INCLUDES = -DPKGDATADIR=\"$(pkgdatadir)\" @OPENMOKO_CFLAGS@ -Wall -std=c99 -pedantic
+
+bin_PROGRAMS = openmoko-messenger
+
+openmoko_messenger_SOURCES = main.c main.h foldersdb.c foldersdb.h callbacks.c callbacks.h detail-area.c detail-area.h sms-dialog-window.c sms-dialog-window.h sms-membership-window.c sms-membership-window.h
+
+openmoko_messenger_LDADD = @OPENMOKO_LIBS@
+

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/callbacks.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/callbacks.c	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/callbacks.c	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,474 @@
+#include "callbacks.h"
+#include "detail-area.h"
+#include <gtk/gtk.h>
+
+
+gboolean cb_filter_changed(GtkWidget* widget, gchar* text, MessengerData* d)
+{
+    g_debug("changed to %s folder",text);
+    d->currentfolder = g_strdup(text);
+    gtk_tree_model_filter_refilter (d->filter);
+    
+    return FALSE;
+}
+
+void cb_new_sms (GtkMenuItem* item, MessengerData* d)
+{
+    SmsDialogWindow* sms_window = sms_dialog_window_new();
+    sms_dialog_window_set_title (sms_window,"New SMS");
+    gtk_widget_show_all ( GTK_WIDGET(sms_window) );
+}
+
+void cb_new_mail (GtkMenuItem* item, MessengerData* d)
+{
+    SmsDialogWindow* sms_window = sms_dialog_window_new();
+    mail_dialog_window_set_title (sms_window,"New Email");
+    gtk_widget_show_all ( GTK_WIDGET(sms_window) );
+}
+
+void cb_new_folder (GtkMenuItem* item, MessengerData* d)
+{
+    g_debug ("new folder called");
+    MokoDialogWindow* nfWin = moko_dialog_window_new();
+    GtkWidget* nfBox = gtk_vbox_new (FALSE,10);
+    gtk_widget_set_size_request (nfBox, 480, -1);
+    GtkWidget* nfAlign = gtk_alignment_new (0,0,1,1);
+    gtk_alignment_set_padding (GTK_ALIGNMENT(nfAlign),100,NULL,30,10);
+    moko_dialog_window_set_title (nfWin, "New Folder");
+    
+    GtkWidget* nfLabel = gtk_label_new ("Please input new folder name:");
+    gtk_misc_set_alignment (GTK_MISC(nfLabel),0,0.5);
+    gtk_box_pack_start (GTK_BOX(nfBox), nfLabel, FALSE, TRUE, 0);
+
+    GtkWidget* hbox = gtk_hbox_new (FALSE,20);
+    d->nfEntry = gtk_entry_new ();
+    gtk_box_pack_start (GTK_BOX(hbox), d->nfEntry, FALSE, TRUE, 0);
+    GtkWidget* nfResetBtn = gtk_button_new_with_label ("Reset");
+    gtk_box_pack_start (GTK_BOX(hbox), nfResetBtn, FALSE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX(nfBox), hbox, FALSE, TRUE, 0);
+
+    hbox = gtk_hbox_new (FALSE,0);
+    GtkWidget* nfConfirmBtn = gtk_button_new_with_label ("OK");
+    gtk_box_pack_start (GTK_BOX(hbox), nfConfirmBtn, FALSE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX(nfBox), hbox, FALSE, TRUE, 0);
+    gtk_container_add (GTK_CONTAINER(nfAlign),nfBox);
+
+    moko_dialog_window_set_contents (nfWin, nfAlign);
+    g_signal_connect (G_OBJECT(nfConfirmBtn), 
+                      "clicked",
+		      G_CALLBACK(cb_nfBtn_clicked),
+		      d);
+    g_signal_connect (G_OBJECT(nfResetBtn),
+                      "clicked",
+		      G_CALLBACK(cb_nfResetBtn_clicked),
+		      d);
+    gtk_widget_show_all ( GTK_WIDGET(nfWin) );
+    
+}
+
+void cb_mode_read (GtkMenuItem* item, MessengerData* d)
+{
+    g_debug ("mode read");
+    message* msg;
+    GtkTreeSelection* selection = gtk_tree_view_get_selection( d->view );
+    GtkTreeView* view = gtk_tree_selection_get_tree_view( selection );
+    GtkTreeModel* model;
+    GtkTreeIter iter;
+    gboolean has_selection = gtk_tree_selection_get_selected( selection, &model, &iter );
+
+    gchar* name = NULL;
+    gchar* folder = NULL;
+    if ( has_selection )
+    	{
+    		msg = g_malloc(sizeof(message));
+        gtk_tree_model_get( model, &iter, COLUMN_FROM, &msg->name, -1 );
+        gtk_tree_model_get( model, &iter, COLUMN_SUBJECT, &msg->subject, -1 );
+        gtk_tree_model_get( model, &iter, COLUMN_FOLDER, &msg->folder, -1 );
+      }
+    else msg = NULL;
+    detail_read_message (d->details,msg);
+}
+
+void cb_mode_reply (GtkMenuItem* item, MessengerData* d)
+{
+    g_debug ("mode reply");
+    message* msg;
+    GtkTreeSelection* selection = gtk_tree_view_get_selection( d->view );
+    GtkTreeView* view = gtk_tree_selection_get_tree_view( selection );
+    GtkTreeModel* model;
+    GtkTreeIter iter;
+    gboolean has_selection = gtk_tree_selection_get_selected( selection, &model, &iter );
+
+    gchar* name = NULL;
+    gchar* folder = NULL;
+    if ( has_selection )
+    	{
+    		msg = g_malloc(sizeof(message));
+        gtk_tree_model_get( model, &iter, COLUMN_FROM, &msg->name, -1 );
+        gtk_tree_model_get( model, &iter, COLUMN_SUBJECT, &msg->subject, -1 );
+        gtk_tree_model_get( model, &iter, COLUMN_FOLDER, &msg->folder, -1 );
+      }
+    else msg = NULL;
+    
+}
+
+void cb_mode_forward (GtkMenuItem* item, MessengerData* d)
+{
+    g_debug ("mode forward");
+    message* msg;
+    GtkTreeSelection* selection = gtk_tree_view_get_selection( d->view );
+    GtkTreeView* view = gtk_tree_selection_get_tree_view( selection );
+    GtkTreeModel* model;
+    GtkTreeIter iter;
+    gboolean has_selection = gtk_tree_selection_get_selected( selection, &model, &iter );
+
+    gchar* name = NULL;
+    gchar* folder = NULL;
+    if ( has_selection )
+    	{
+    		msg = g_malloc(sizeof(message));
+        gtk_tree_model_get( model, &iter, 
+        										COLUMN_FROM, &msg->name, 
+        										COLUMN_SUBJECT, &msg->subject,
+        										COLUMN_FOLDER, &msg->folder,
+        										COLUMN_CONTENT, &msg->content,
+       										  -1 );
+      }
+    else msg = NULL;
+    detail_forward_message (d->details,msg);
+}
+
+void cb_delete_folder (GtkMenuItem* item, MessengerData* d)
+{
+    g_debug ("delete folder called");
+    GtkWidget* msgDialog;
+    
+    GtkWidget* menuitem = gtk_menu_get_attach_widget (d->filtmenu);
+		GtkWidget* menulabel = GTK_BIN(menuitem)->child;
+		gchar* oldName = g_strdup (gtk_label_get_text (GTK_LABEL(menulabel)));
+    if (!g_strcasecmp(oldName,"Inbox") ||
+			  !g_strcasecmp(oldName,"Outbox") ||
+			  !g_strcasecmp(oldName,"Draft") ||
+			  !g_strcasecmp(oldName,"Sent")){
+			  	
+			  msgDialog = gtk_message_dialog_new( moko_application_get_main_window(d->app),
+                                  GTK_DIALOG_DESTROY_WITH_PARENT,
+                                  GTK_MESSAGE_WARNING,
+                                  GTK_BUTTONS_CLOSE,
+                                  g_strdup_printf("Current folder '%s'\nis not a custom folder\nCan't delete",oldName) );
+		    gtk_dialog_run (GTK_DIALOG (msgDialog));
+		    gtk_widget_destroy (msgDialog);
+		}else{
+		    GtkWidget* dialog = gtk_message_dialog_new( moko_application_get_main_window(d->app),
+                                  GTK_DIALOG_DESTROY_WITH_PARENT,
+                                  GTK_MESSAGE_WARNING,
+                                  GTK_BUTTONS_OK_CANCEL,
+                                  g_strdup_printf("Are you sure to delete folder: %s",d->currentfolder));
+		    gint result = gtk_dialog_run (GTK_DIALOG (dialog));
+			  switch (result)
+			    {
+			      case GTK_RESPONSE_OK:
+			         g_debug ("clicked ok");
+			         delete_folder(d,oldName);
+			         break;
+			      case GTK_RESPONSE_CANCEL:
+			         g_debug ("clicked cancel");
+			         break;
+			      default:
+			         g_debug ("clicked default");
+			         break;
+			    }
+			  gtk_widget_destroy (dialog);
+  	}
+}
+
+void cb_delete_message (GtkMenuItem* item, MessengerData* d)
+{
+	  GtkTreeModel* model;
+    GtkTreeIter iter;
+    GtkTreeIter childiter;
+    GtkTreeSelection* selection;
+	  
+	  selection = gtk_tree_view_get_selection (d->view);
+	  gboolean has_selection = gtk_tree_selection_get_selected (selection, &model,&iter);
+	  if (has_selection){
+	  	gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(d->filter),&childiter,&iter);
+	  	gtk_list_store_remove (d->liststore, &childiter);
+	  }
+	  else {
+	  	GtkWidget* dialog = gtk_message_dialog_new( moko_application_get_main_window(d->app),
+                                  GTK_DIALOG_DESTROY_WITH_PARENT,
+                                  GTK_MESSAGE_WARNING,
+                                  GTK_BUTTONS_OK,
+                                  "No message selected");
+		    gint result = gtk_dialog_run (GTK_DIALOG (dialog));
+			  gtk_widget_destroy (dialog);
+	  }
+}
+
+void cb_mmitem_activate (GtkMenuItem* item, MessengerData* d)
+{
+    g_debug ("message membership");
+    if (d->mmWin == NULL){
+    	d->mmWin = sms_membership_window_new();
+    	sms_membership_window_set_menubox (SMS_MEMBERSHIP_WINDOW(d->mmWin), d->folderlist);
+    	sms_membership_window_set_messages (SMS_MEMBERSHIP_WINDOW(d->mmWin), d->liststore);
+    }
+    sms_membership_window_show ( d->mmWin );
+}
+
+void cb_frBtn_clicked (GtkButton* button, MessengerData* d)
+{
+		GSList *c;
+    GtkMenu* filtmenu;
+    gchar* folder;
+    
+		GtkWidget* menuitem = gtk_menu_get_attach_widget (d->filtmenu);
+		GtkWidget* menulabel = GTK_BIN(menuitem)->child;
+		gchar* oldName = g_strdup (gtk_label_get_text (GTK_LABEL(menulabel)));
+    gchar* newName = g_strdup (gtk_entry_get_text(GTK_ENTRY(d->frEntry)));
+		gtk_label_set_text (GTK_LABEL(menulabel),newName);
+		gtk_tree_model_filter_refilter (d->filter);
+		
+    c = d->folderlist;
+    for (; c; c = g_slist_next(c) ){
+        folder = (gchar*) c->data;
+	      if (!g_strcasecmp(folder,oldName)){
+	      	g_debug ("old %s, new %s", oldName, newName);
+	      	c->data = g_strdup(newName); 
+	      }
+    }
+    d->filtmenu = reload_filter_menu (d,d->folderlist);
+    MokoMenuBox* menubox = moko_paned_window_get_menubox( d->window );
+    g_signal_connect( G_OBJECT(menubox), "filter_changed", G_CALLBACK(cb_filter_changed), d );
+    moko_menu_box_set_filter_menu(menubox,d->filtmenu);
+    gtk_widget_show_all (menubox);
+}
+
+void cb_frResetBtn_clicked (GtkButton* button, GtkWidget* entry)
+{
+		gtk_entry_set_text(GTK_ENTRY(entry),"");
+}
+
+void cb_fnitem_activate (GtkMenuItem* item, MessengerData* d)
+{
+		g_debug ("folder rename called");
+		GtkWidget* menuitem = gtk_menu_get_attach_widget (d->filtmenu);
+		GtkWidget* menulabel = GTK_BIN(menuitem)->child;
+		gchar* oldName = g_strdup (gtk_label_get_text (GTK_LABEL(menulabel)));
+		if (!g_strcasecmp(oldName,"Inbox") ||
+			  !g_strcasecmp(oldName,"Outbox") ||
+			  !g_strcasecmp(oldName,"Draft") ||
+			  !g_strcasecmp(oldName,"Sent")){
+			  	
+			  GtkWidget* msgDialog = gtk_message_dialog_new( moko_application_get_main_window(d->app),
+                                  GTK_DIALOG_DESTROY_WITH_PARENT,
+                                  GTK_MESSAGE_WARNING,
+                                  GTK_BUTTONS_CLOSE,
+                                  g_strdup_printf("Current folder '%s'\nis not a custom folder\nCan't rename",oldName) );
+		    gtk_dialog_run (GTK_DIALOG (msgDialog));
+		    gtk_widget_destroy (msgDialog);
+		}else {
+		    MokoDialogWindow* frWin = moko_dialog_window_new();
+		    GtkWidget* frBox = gtk_vbox_new (FALSE,10);
+		    gtk_widget_set_size_request (frBox, 480, -1);
+		    GtkWidget* frAlign = gtk_alignment_new (0,0,1,1);
+		    gtk_alignment_set_padding (GTK_ALIGNMENT(frAlign),100,NULL,30,10);
+		    moko_dialog_window_set_title (frWin, "Folder Rename");
+		    
+		    GtkWidget* menuitem = gtk_menu_get_attach_widget (d->filtmenu);
+				GtkWidget* menulabel = GTK_BIN(menuitem)->child;
+		    GtkWidget* frLabel = gtk_label_new (g_strdup_printf("Please input new folder name for %s:", 
+		    					gtk_label_get_text (GTK_LABEL(menulabel))));
+		    gtk_misc_set_alignment (GTK_MISC(frLabel),0,0.5);
+		    gtk_box_pack_start (GTK_BOX(frBox), frLabel, FALSE, TRUE, 0);
+		
+		    GtkWidget* hbox = gtk_hbox_new (FALSE,20);
+		    d->frEntry = gtk_entry_new ();
+		    gtk_box_pack_start (GTK_BOX(hbox), d->frEntry, FALSE, TRUE, 0);
+		    GtkWidget* frResetBtn = gtk_button_new_with_label ("Reset");
+		    gtk_box_pack_start (GTK_BOX(hbox), frResetBtn, FALSE, TRUE, 0);
+		    gtk_box_pack_start (GTK_BOX(frBox), hbox, FALSE, TRUE, 0);
+		
+		    hbox = gtk_hbox_new (FALSE,0);
+		    GtkWidget* frConfirmBtn = gtk_button_new_with_label ("OK");
+		    gtk_box_pack_start (GTK_BOX(hbox), frConfirmBtn, FALSE, TRUE, 0);
+		    gtk_box_pack_start (GTK_BOX(frBox), hbox, FALSE, TRUE, 0);
+		    gtk_container_add (GTK_CONTAINER(frAlign),frBox);
+		
+		    moko_dialog_window_set_contents (frWin, frAlign);
+		    g_signal_connect (G_OBJECT(frConfirmBtn), 
+		                      "clicked",
+				      G_CALLBACK(cb_frBtn_clicked),
+				      d);
+		    g_signal_connect (G_OBJECT(frResetBtn),
+		                      "clicked",
+				      G_CALLBACK(cb_frResetBtn_clicked),
+				      d->frEntry);
+		    gtk_widget_show_all ( GTK_WIDGET(frWin) );
+   }
+}
+
+void cb_nfBtn_clicked (GtkButton* button, MessengerData* d)
+{
+    gchar* folder = g_strdup(gtk_entry_get_text(GTK_ENTRY(d->nfEntry)));
+    g_debug ("new folder %s",folder);
+    d->folderlist = g_slist_append (d->folderlist,folder);
+    d->filtmenu = reload_filter_menu (d,d->folderlist);
+    MokoMenuBox* menubox = moko_paned_window_get_menubox( d->window );
+    g_signal_connect( G_OBJECT(menubox), "filter_changed", G_CALLBACK(cb_filter_changed), d );
+    moko_menu_box_set_filter_menu(menubox,d->filtmenu);
+    gtk_widget_show_all (menubox);
+    /*foldersdb_update (d->folderlist);*/
+    update_folder_sensitive(d, d->folderlist);
+}
+
+void cb_nfResetBtn_clicked (GtkButton* button, MessengerData* d)
+{
+    gtk_entry_set_text(GTK_ENTRY(d->nfEntry),"");
+    g_debug ("reset entry");
+}
+
+void cb_dfBtn_clicked (GtkButton* button, MessengerData* d)
+{
+    GSList* c;
+
+    for( c =d->folderlist; c; c=g_slist_next(c))
+        {
+			    if(!g_strcasecmp((gchar*)c->data, d->currentfolder))
+			    {
+			        d->folderlist = g_slist_remove (d->folderlist, c->data);
+							break;
+			    }
+	 			}
+
+    d->filtmenu = reload_filter_menu (d,d->folderlist);
+    MokoMenuBox* menubox = moko_paned_window_get_menubox( d->window );
+    g_signal_connect( G_OBJECT(menubox), "filter_changed", G_CALLBACK(cb_filter_changed), d );
+    moko_menu_box_set_filter_menu(menubox,d->filtmenu);
+
+    /*set the default filter item to "Inbox" */
+    gchar* str = g_strdup("Inbox");
+    moko_menu_box_set_active_filter (menubox,str);
+    gtk_widget_show_all (menubox);
+    update_folder_sensitive (d, d->folderlist);
+    
+    /*result inform */
+    GtkWidget *dialog = gtk_message_dialog_new ((gtk_widget_get_parent_window(button)),
+                                  GTK_DIALOG_DESTROY_WITH_PARENT,
+                                  GTK_MESSAGE_INFO,
+                                  GTK_BUTTONS_CLOSE,
+                                  "Delete successful");
+    gtk_dialog_run (GTK_DIALOG (dialog));
+		gtk_widget_destroy (dialog);
+}
+
+void delete_folder (MessengerData* d, gchar* oldName)
+{
+		GSList* c;
+
+    for( c =d->folderlist; c; c=g_slist_next(c))
+        {
+			    if(!g_strcasecmp((gchar*)c->data, oldName))
+			    {
+			        d->folderlist = g_slist_remove (d->folderlist, c->data);
+							break;
+			    }
+	 			}
+
+    d->filtmenu = reload_filter_menu (d,d->folderlist);
+    MokoMenuBox* menubox = moko_paned_window_get_menubox( d->window );
+    g_signal_connect( G_OBJECT(menubox), "filter_changed", G_CALLBACK(cb_filter_changed), d );
+    moko_menu_box_set_filter_menu(menubox,d->filtmenu);
+
+    /*set the default filter item to "Inbox" */
+    gchar* str = g_strdup("Inbox");
+    moko_menu_box_set_active_filter (menubox,str);
+    gtk_widget_show_all (menubox);
+    update_folder_sensitive (d, d->folderlist);
+}
+
+void on_mmode_rdo_btn_clicked (gchar* folder)
+{
+    g_debug ("switch to %s folder", folder);
+}
+
+void cb_cursor_changed(GtkTreeSelection* selection, MessengerData* d)
+{
+		gchar* name = NULL;
+    gchar* folder = NULL;
+    GtkTreeModel* model;
+    GtkTreeIter iter;
+    GtkTreeIter childiter;
+    GtkTreeView* view;
+    message* msg;
+    GdkPixbuf* icon;
+    GError*   error = NULL;
+    
+	  g_debug( "openmoko-messenger: selection changed" );
+    view = gtk_tree_selection_get_tree_view( selection );
+    if ( gtk_tree_selection_get_selected( selection, &model, &iter ) )
+    	{
+    		msg = g_malloc(sizeof(message));
+        gtk_tree_model_get( model, &iter, COLUMN_FROM, &msg->name, -1 );
+        gtk_tree_model_get( model, &iter, COLUMN_SUBJECT, &msg->subject, -1 );
+        gtk_tree_model_get( model, &iter, COLUMN_FOLDER, &msg->folder, -1 );
+        gtk_tree_model_get( model, &iter, COLUMN_STATUS, &msg->status, -1);
+        
+        if (msg->status == UNREAD)
+        	{
+        		icon = gdk_pixbuf_new_from_file (PKGDATADIR "/Mode_Read.png", &error);
+        		msg->status = READ;
+        		gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(d->filter),&childiter,&iter);
+    				gtk_list_store_set (d->liststore, &childiter, 
+    														COLUMN_ICON, icon,
+    				 										COLUMN_STATUS, msg->status, 
+    				 										-1);
+        	}
+        detail_read_message (d->details,msg);
+      }
+}
+
+void
+on_btnsend_clicked                 (GtkButton       *button,
+                                    gpointer         user_data)
+{
+	g_printf("Button send clicked\n");
+}
+
+void
+on_btn_address_clicked                 (GtkButton       *button,
+                                        gpointer         user_data)
+{
+	g_printf("Button address clicked\n");
+}
+
+void cb_search_entry_changed (GtkEditable* editable, MessengerData* d)
+{
+	GtkWidget* search_entry = GTK_WIDGET(editable);
+	d->s_key = g_strdup (gtk_entry_get_text(search_entry));
+	gtk_tree_model_filter_refilter (d->filter);
+	g_debug ("search %s",d->s_key);
+}
+
+void cb_search_on (MessengerData* d)
+{
+	g_debug ("search on",d->s_key);
+	GtkWidget* menuitem = gtk_menu_get_attach_widget (d->filtmenu);
+	GtkWidget* menulabel = GTK_BIN(menuitem)->child;
+	gtk_label_set_text (GTK_LABEL(menulabel),"Search Result");
+	d->searchOn = TRUE;
+}
+
+void cb_search_off (MessengerData* d)
+{
+	g_debug ("search off",d->s_key);
+	GtkWidget* menuitem = gtk_menu_get_attach_widget (d->filtmenu);
+	GtkWidget* menulabel = GTK_BIN(menuitem)->child;
+	gtk_label_set_text (GTK_LABEL(menulabel),"Inbox");
+	d->searchOn = FALSE; 
+	GtkWidget* search_entry = moko_tool_box_get_entry (d->toolbox);
+	gtk_entry_set_text (search_entry, "");
+	d->s_key = "";
+	gtk_tree_model_filter_refilter (d->filter);
+}

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/callbacks.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/callbacks.h	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/callbacks.h	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,49 @@
+#ifndef _CALLBACKS_H_
+#define _CALLBACKS_H_
+
+#include <gtk/gtk.h>
+#include "sms-dialog-window.h"
+#include "sms-membership-window.h"
+#include "main.h"
+
+const static gint states[] = { UNREAD, READ, UNREAD, UNREAD, FORWARD,
+																	UNREAD, UNREAD, REPLIED, READ, UNREAD };
+const static gchar *names[] = { "John B.", "Jane Z.", "Carl O.", "Owen P.", "Jeremy F.",
+	                         "Michael M.", "Ute D.", "Akira T.", "Thomas F.", "Matthew J."};
+const static gchar *subjects[] = { "Hello Alex", "We need sms support", "I need u", "Help harald", "The gui is really cool",
+	                         "Can't u see", "2:00 pm", "Bugzillia page", "Hi there", "Target support"};
+const static gchar *folders[] = { "Inbox", "Outbox", "Sent", "Inbox", "Inbox",
+	                         "Inbox", "Inbox", "Inbox", "Inbox", "Inbox"};
+const static gchar *contents[] = {"Hello Alex", "We need sms support", "I need u", "Help harald", "The gui is really cool",
+	                         "Can't u see", "2:00 pm", "Bugzillia page", "Hi there", "Target support"};
+
+gboolean cb_filter_changed(GtkWidget* widget, gchar* text, MessengerData* d);
+
+void cb_new_sms (GtkMenuItem* item, MessengerData* d);
+void cb_new_mail (GtkMenuItem* item, MessengerData* d);
+void cb_new_folder (GtkMenuItem* item, MessengerData* d);
+void cb_mode_read (GtkMenuItem* item, MessengerData* d);
+void cb_mode_reply (GtkMenuItem* item, MessengerData* d);
+void cb_mode_forward (GtkMenuItem* item, MessengerData* d);
+void cb_delete_folder (GtkMenuItem* item, MessengerData* d);
+void cb_delete_message (GtkMenuItem* item, MessengerData* d);
+void cb_mmitem_activate (GtkMenuItem* item, MessengerData* d);
+void cb_fnitem_activate (GtkMenuItem* item, MessengerData* d);
+void cb_cursor_changed(GtkTreeSelection* selection, MessengerData* d);
+
+void cb_nfBtn_clicked (GtkButton* button, MessengerData* d);
+void cb_nfResetBtn_clicked (GtkButton* button, MessengerData* d);
+void cb_frBtn_clicked (GtkButton* button, MessengerData* d);
+void cb_frResetBtn_clicked (GtkButton* button, GtkWidget* entry);
+void cb_dfBtn_clicked (GtkButton* button, MessengerData* d);
+void on_mmode_rdo_btn_clicked (gchar* folder);
+void on_btnsend_clicked                 (GtkButton       *button,
+                                        gpointer         user_data);
+void on_btn_address_clicked							(GtkButton       *button,
+                                        gpointer         user_data);
+                                        
+void cb_search_entry_changed (GtkEditable* editable, MessengerData* d);
+void cb_search_on (MessengerData* d);
+void cb_search_off (MessengerData* d);
+#endif
+

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/detail-area.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/detail-area.c	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/detail-area.c	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,368 @@
+/* detail-area.c
+ *
+ * Authored By Alex Tang <alex at fic-sh.com.cn>
+ *
+ * Copyright (C) 2006 First International Company
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Public License as published by
+ * the Free Software Foundation; version 2.1 of the license.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date: 2006/10/05 17:38:14 $) [$Author: Alex $]
+ *
+ */ 
+
+#include "detail-area.h"
+#include "callbacks.h"
+#include "main.h"
+
+GtkWidget* detail_area_mode_edit (DetailArea *self);
+GtkWidget* detail_area_new_mail (DetailArea* self);
+GtkWidget* detail_area_mode_read (DetailArea* self);
+GtkWidget* detail_area_mode_membership (DetailArea* self);
+
+G_DEFINE_TYPE (DetailArea, detail_area, GTK_TYPE_SCROLLED_WINDOW)
+
+#define DETAIL_AREA_GET_PRIVATE(o)     (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_DETAIL_AREA, DetailAreaPrivate))
+
+typedef struct _DetailAreaPrivate{
+	
+} DetailAreaPrivate;
+
+/* parent class pointer */
+GtkWindowClass* parent_class = NULL;
+
+/* forward declarations */
+gboolean
+_expose_event_callback(GtkWidget *widget, GdkEventExpose *event, gpointer data)
+{
+	
+	return TRUE;
+}
+
+static void
+detail_area_dispose (GObject *object)
+{
+    if (G_OBJECT_CLASS (detail_area_parent_class)->dispose)
+        G_OBJECT_CLASS (detail_area_parent_class)->dispose (object);
+}
+
+static void
+detail_area_finalize (GObject *object)
+{
+    G_OBJECT_CLASS (detail_area_parent_class)->finalize (object);
+}
+    
+static void
+detail_area_class_init (DetailAreaClass *klass)
+{
+    /* hook parent */
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+    parent_class = g_type_class_peek_parent(klass);
+
+    /* register private data */
+    g_type_class_add_private (klass, sizeof (DetailAreaPrivate));
+
+    object_class->dispose = detail_area_dispose;
+    object_class->finalize = detail_area_finalize;
+    
+}
+
+static void
+detail_area_init (DetailArea *self)
+{
+   	gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(self), GTK_POLICY_NEVER, GTK_POLICY_NEVER );
+    
+    self->readAttributes = g_malloc (sizeof(ReadAttributes));
+    self->editAttributes = g_malloc (sizeof(EditAttributes));
+    self->notebook = GTK_NOTEBOOK( gtk_notebook_new() );
+    //gtk_notebook_append_page (self->notebook,detail_area_mode_edit(self),NULL);
+    //gtk_notebook_append_page (self->notebook,detail_area_new_mail(self),NULL);
+    gtk_notebook_append_page (self->notebook,detail_area_mode_read(self),NULL);
+    
+    //gtk_notebook_append_page (self->notebook,detail_area_mode_membership(self),NULL);
+    gtk_notebook_set_show_tabs (self->notebook,FALSE);
+    gtk_notebook_set_show_border (self->notebook,FALSE);
+    gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(self), GTK_WIDGET(self->notebook) );
+    
+}
+
+DetailArea*
+detail_area_new (void)
+{
+    return g_object_new(TYPE_DETAIL_AREA, NULL );
+}
+
+GtkWidget* detail_area_mode_edit (DetailArea* self)
+{
+    /* create detail box */
+    self->detailbox = GTK_VBOX(gtk_vbox_new(FALSE,0));
+    EditAttributes* editAttributes = self->editAttributes;
+
+    /* create tool box */
+    self->toolbox = GTK_HBOX(gtk_hbox_new(FALSE,0)); 
+    MokoToolBox* mokobox = MOKO_TOOL_BOX(moko_tool_box_new());
+    GtkHBox* toolbox = moko_tool_box_get_button_box(mokobox);
+    editAttributes->sendBtn = gtk_button_new_with_label("Send");
+    gtk_box_pack_start( GTK_BOX(toolbox), GTK_WIDGET(editAttributes->sendBtn), FALSE, FALSE, 0 );
+    editAttributes->addrBtn = gtk_button_new_with_label("Address");
+    gtk_box_pack_start( GTK_BOX(toolbox), GTK_WIDGET(editAttributes->addrBtn), FALSE, FALSE, 0 );
+
+    /* fill entry area */
+    self->entryarea = MOKO_FIXED(moko_fixed_new());
+    GtkAlignment* alignment = GTK_ALIGNMENT(gtk_alignment_new (0.5, 0.5, 1, 1));
+    gtk_alignment_set_padding (alignment, 5, 5, 5, 5);
+    GtkWidget* entrybox = gtk_hbox_new(FALSE,0);
+    GtkWidget* toLabel = gtk_label_new("To:");
+    gtk_widget_set_size_request (toLabel, 40, -1);
+    editAttributes->toEntry = gtk_entry_new();
+    gtk_widget_set_size_request (editAttributes->toEntry, 300, -1);
+    GtkWidget* inputLabel = gtk_label_new("(120/1)");
+    gtk_widget_set_size_request (inputLabel, 80, -1);
+    gtk_box_pack_start (GTK_BOX(entrybox),toLabel,FALSE,TRUE,0);
+    gtk_box_pack_start (GTK_BOX(entrybox),editAttributes->toEntry,FALSE,TRUE,0);
+    gtk_box_pack_start (GTK_BOX(entrybox),inputLabel,FALSE,TRUE,0);
+    gtk_container_add (GTK_CONTAINER(alignment), entrybox);
+
+    moko_fixed_set_cargo(MOKO_FIXED(self->entryarea),GTK_WIDGET(alignment));
+
+    /* fill textview */
+    editAttributes->txtView = GTK_TEXT_VIEW(gtk_text_view_new());
+    GtkWidget* viewAlign = gtk_alignment_new (0.5, 0.5, 1, 1);
+    gtk_alignment_set_padding (GTK_ALIGNMENT(viewAlign),0,0,0,50);
+    gtk_text_view_set_wrap_mode (editAttributes->txtView,GTK_WRAP_CHAR);
+    gtk_container_add (GTK_CONTAINER(viewAlign),GTK_WIDGET(editAttributes->txtView));
+
+    gtk_box_pack_start (GTK_BOX(self->detailbox),GTK_WIDGET(mokobox),FALSE,TRUE,0);
+    gtk_box_pack_start (GTK_BOX(self->detailbox),GTK_WIDGET(self->entryarea),FALSE,TRUE,0);
+    gtk_box_pack_start (GTK_BOX(self->detailbox),GTK_WIDGET(viewAlign),TRUE,TRUE,0);
+
+    return GTK_WIDGET(self->detailbox);
+}
+
+//TODO move mail function to edit mode
+GtkWidget* detail_area_new_mail (DetailArea* self) {
+    
+    /* create detail box */
+    self->detailbox = GTK_VBOX(gtk_vbox_new(FALSE,0));
+
+    /* create tool box */
+    self->toolbox = GTK_HBOX(gtk_hbox_new(FALSE,0));
+    MokoToolBox* mokobox = MOKO_TOOL_BOX(moko_tool_box_new());
+    GtkHBox* toolbox = moko_tool_box_get_button_box(mokobox);
+    GtkWidget* button = gtk_button_new_with_label("Send");
+    gtk_box_pack_start( GTK_BOX(toolbox), GTK_WIDGET(button), FALSE, FALSE, 0 );
+    button = gtk_button_new_with_label("Attach");
+    gtk_box_pack_start( GTK_BOX(toolbox), GTK_WIDGET(button), FALSE, FALSE, 0 );
+    button = gtk_button_new_with_label("Address");
+    gtk_box_pack_start( GTK_BOX(toolbox), GTK_WIDGET(button), FALSE, FALSE, 0 );
+
+    /* fill entry area */
+    self->entryarea = MOKO_FIXED(moko_fixed_new());
+    GtkAlignment* alignment = GTK_ALIGNMENT(gtk_alignment_new (0.5, 0.5, 1, 1));
+    gtk_alignment_set_padding (alignment, 5, 5, 5, 5);
+
+    GtkVBox* entrybox = GTK_VBOX(gtk_vbox_new(FALSE,0));
+    gtk_box_set_spacing (GTK_BOX(entrybox),2);
+    GtkWidget* hbox = gtk_hbox_new(FALSE,0);
+    GtkWidget* toLabel = gtk_label_new("To:");
+    gtk_widget_set_size_request (toLabel, 110, -1);
+    gtk_misc_set_alignment (GTK_MISC (toLabel),0.8,0.5);
+    GtkWidget* toEntry = gtk_entry_new();
+    gtk_widget_set_size_request (toEntry, 300, -1);
+    gtk_box_pack_start (GTK_BOX(hbox),GTK_WIDGET(toLabel),FALSE,TRUE,0);
+    gtk_box_pack_start (GTK_BOX(hbox),GTK_WIDGET(toEntry),FALSE,TRUE,0);
+    gtk_box_pack_start (GTK_BOX(entrybox),GTK_WIDGET(hbox),FALSE,TRUE,0);
+
+    hbox = gtk_hbox_new(FALSE,0);
+    GtkWidget* ccLabel = gtk_label_new("CC:");
+    gtk_widget_set_size_request (ccLabel, 110, -1);
+    gtk_misc_set_alignment (GTK_MISC (ccLabel),0.8,0.5);
+    GtkWidget* ccEntry = gtk_entry_new();
+    gtk_widget_set_size_request (ccEntry, 300, -1);
+    gtk_box_pack_start (GTK_BOX(hbox),ccLabel,FALSE,TRUE,0);
+    gtk_box_pack_start (GTK_BOX(hbox),ccEntry,FALSE,TRUE,0);
+    gtk_box_pack_start (GTK_BOX(entrybox),GTK_WIDGET(hbox),FALSE,TRUE,0);
+
+    hbox = gtk_hbox_new(FALSE,0);
+    GtkWidget* bccLabel = gtk_label_new("Bcc:");
+    gtk_widget_set_size_request (bccLabel, 110, -1);
+    gtk_misc_set_alignment (GTK_MISC (bccLabel),0.8,0.5);
+    GtkWidget* bccEntry = gtk_entry_new();
+    gtk_widget_set_size_request (bccEntry, 300, -1);
+    gtk_box_pack_start (GTK_BOX(hbox),bccLabel,FALSE,TRUE,0);
+    gtk_box_pack_start (GTK_BOX(hbox),bccEntry,FALSE,TRUE,0);
+    gtk_box_pack_start (GTK_BOX(entrybox),hbox,FALSE,TRUE,0);
+
+    hbox = gtk_hbox_new(FALSE,0);
+    GtkWidget* subjectLabel = gtk_label_new("Subject:");
+    gtk_widget_set_size_request (subjectLabel, 110, -1);
+    gtk_misc_set_alignment (GTK_MISC (subjectLabel),0.55,0.5);
+    GtkWidget* subjectEntry = gtk_entry_new();
+    gtk_widget_set_size_request (subjectEntry, 300, -1);
+    gtk_box_pack_start (GTK_BOX(hbox),subjectLabel,FALSE,TRUE,0);
+    gtk_box_pack_start (GTK_BOX(hbox),subjectEntry,FALSE,TRUE,0);
+    gtk_box_pack_start (GTK_BOX(entrybox),hbox,FALSE,TRUE,0);
+
+    gtk_container_add (GTK_CONTAINER(alignment), GTK_WIDGET(entrybox));
+
+    moko_fixed_set_cargo(self->entryarea,GTK_WIDGET(alignment));
+
+     /* fill textview */
+     /*self->textview = GTK_TEXT_VIEW(gtk_text_view_new ());
+     GtkWidget* viewAlign = gtk_alignment_new (0.5, 0.5, 1, 1);
+     gtk_alignment_set_padding (GTK_ALIGNMENT(viewAlign),0,0,0,50);
+     gtk_text_view_set_wrap_mode (self->textview,GTK_WRAP_CHAR);
+     gtk_container_add (GTK_CONTAINER(viewAlign),GTK_WIDGET(self->textview));
+
+     gtk_box_pack_start (GTK_BOX(self->detailbox),GTK_WIDGET(mokobox),FALSE,TRUE,0);
+     gtk_box_pack_start (GTK_BOX(self->detailbox),GTK_WIDGET(self->entryarea),FALSE,TRUE,0);
+     gtk_box_pack_start (GTK_BOX(self->detailbox),GTK_WIDGET(viewAlign),TRUE,TRUE,0);*/
+
+    return GTK_WIDGET(self->detailbox);
+}
+
+GtkWidget* detail_area_mode_read (DetailArea* self)
+{
+     /* create detail box */
+     self->detailbox = GTK_VBOX(gtk_vbox_new(FALSE,0));
+     
+     ReadAttributes* readAttributes = self->readAttributes;
+
+     GtkWidget* headerbox = gtk_vbox_new(FALSE,0);
+     GtkWidget* hbox = gtk_hbox_new(FALSE,0);
+     readAttributes->from_label = gtk_label_new ("Alex");
+     gtk_misc_set_alignment (GTK_MISC (readAttributes->from_label),1,0.5);
+     readAttributes->date_label = gtk_label_new ("Hello");
+     gtk_misc_set_alignment (GTK_MISC (readAttributes->date_label),1,0.5);
+     
+     GtkWidget* cellalign = gtk_alignment_new (0.5, 0.5, 1, 1);
+     gtk_alignment_set_padding (GTK_ALIGNMENT(cellalign), 5,5,5,5);
+     GtkWidget* label = gtk_label_new ("From:");      
+     gtk_misc_set_alignment (GTK_MISC (label),1,0.5);
+     gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
+     gtk_box_pack_start(GTK_BOX(hbox),readAttributes->from_label,FALSE,FALSE,0);
+     gtk_container_add(GTK_CONTAINER(cellalign),hbox);
+     gtk_box_pack_start(GTK_BOX(headerbox),cellalign,FALSE,FALSE,0);
+
+     cellalign = gtk_alignment_new (0.5, 0.5, 1, 1);
+     gtk_alignment_set_padding (GTK_ALIGNMENT(cellalign), 5,5,5,5);
+     hbox = gtk_hbox_new(FALSE,0);
+     label = gtk_label_new ("Date:");
+     gtk_misc_set_alignment (GTK_MISC (label),1,0.5);
+     gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);
+     gtk_box_pack_start(GTK_BOX(hbox),readAttributes->date_label,FALSE,FALSE,0);
+     gtk_container_add(GTK_CONTAINER(cellalign),hbox);
+     gtk_box_pack_start(GTK_BOX(headerbox),cellalign,FALSE,FALSE,0);
+
+     GtkWidget* hseparator = gtk_hseparator_new();
+     GtkWidget* detailAlign = gtk_alignment_new(0, 0, 0, 0);
+     gtk_alignment_set_padding (GTK_ALIGNMENT(detailAlign), 10, 10, 10, 50);
+     /*GtkWidget* details = gtk_label_new("this is the detail");*/
+     readAttributes->details = gtk_label_new( "Add your widget for showing details for the selected\n"
+     "\ndata entry here\n \n \n \n \n \n \n \nThis particular label\n \nis very long\n"
+     "\nto make the fullscreen\n \ntrigger more interesting\n \n \n");
+     gtk_widget_set_size_request (readAttributes->details,420,-1);
+     gtk_label_set_line_wrap (GTK_LABEL(readAttributes->details),TRUE);
+     gtk_misc_set_alignment (GTK_MISC (readAttributes->details),0.1,0.5);
+     gtk_container_add (GTK_CONTAINER(detailAlign),readAttributes->details);
+     gtk_box_pack_start(GTK_BOX(self->detailbox),headerbox,FALSE,TRUE,0);
+     gtk_box_pack_start(GTK_BOX(self->detailbox),hseparator,FALSE,TRUE,0);
+     gtk_box_pack_start(GTK_BOX(self->detailbox),detailAlign,FALSE,TRUE,0);
+     
+     return GTK_WIDGET(self->detailbox);
+}
+
+GtkWidget* detail_area_mode_membership (DetailArea* self)
+{
+
+    /* create detail box */
+    self->detailbox = GTK_VBOX(gtk_vbox_new(FALSE,0));
+    GtkWidget *title = gtk_label_new ("Message Membership");
+    gtk_misc_set_alignment (GTK_MISC(title),0.4,1);
+    gtk_box_pack_start (GTK_BOX(self->detailbox),title,FALSE,TRUE,0);
+
+    GSList *c;
+    GtkWidget *rdo_btn = NULL;
+    GSList *rdo_btn_group;
+    c = self->folderlist;
+
+    for (; c; c = g_slist_next(c) ) {
+        gchar* folder = (gchar*) c->data;
+	      g_debug( "find folder '%s'", folder );
+	      if(!g_strcasecmp(folder,"Inbox")){
+	         rdo_btn = gtk_radio_button_new_with_label (NULL, folder);
+	         rdo_btn_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rdo_btn));
+	         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rdo_btn), TRUE);
+        }
+	      else
+	         rdo_btn = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rdo_btn), folder);
+	
+	      g_signal_connect_swapped (G_OBJECT(rdo_btn), 
+	                                "released",
+			                            G_CALLBACK (on_mmode_rdo_btn_clicked),
+			                            c->data);
+	      gtk_box_pack_start (GTK_BOX (self->detailbox), rdo_btn, FALSE, TRUE, 0);
+    }
+
+    return GTK_WIDGET(self->detailbox);
+}
+
+void detail_new_sms (DetailArea* self)
+{
+		EditAttributes* editAttributes = self->editAttributes;
+		gtk_entry_set_text (GTK_ENTRY(editAttributes->toEntry),"");
+		GtkTextBuffer * buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (editAttributes->txtView));
+		gtk_text_buffer_set_text (buffer,"",0);
+		gtk_notebook_set_current_page (self->notebook,PAGE_EDIT_MODE);
+}
+
+void detail_read_message (DetailArea* self, message* msg)
+{
+		ReadAttributes* readAttributes = self->readAttributes;
+		if(msg != NULL)
+			{
+		    gtk_label_set_text(GTK_LABEL(readAttributes->from_label), msg->name);
+		    gtk_label_set_text(GTK_LABEL(readAttributes->date_label), msg->subject);
+		    gtk_label_set_text(GTK_LABEL(readAttributes->details), msg->folder);
+		    g_free(msg);
+		  }
+		else
+		  {
+			  gtk_label_set_text(GTK_LABEL(readAttributes->from_label), "");
+		    gtk_label_set_text(GTK_LABEL(readAttributes->date_label), "");
+		    gtk_label_set_text(GTK_LABEL(readAttributes->details), "please select a message");
+		  }
+		gtk_notebook_set_current_page (self->notebook,PAGE_MODE_READ);
+}
+
+void detail_reply_message (DetailArea* self, message* msg)
+{
+		EditAttributes* editAttributes = self->editAttributes;
+		if(msg != NULL)
+			{
+	  	  gtk_entry_set_text(GTK_ENTRY(editAttributes->toEntry), msg->name);
+	   	 g_free(msg);
+	 		}
+	 	GtkTextBuffer * buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (editAttributes->txtView));
+	 	gtk_text_buffer_set_text (buffer,"",0);
+		gtk_notebook_set_current_page (self->notebook,PAGE_EDIT_MODE);
+}
+
+void detail_forward_message (DetailArea* self, message* msg)
+{
+		EditAttributes* editAttributes = self->editAttributes;
+		if(msg != NULL)
+			{
+	  	  gtk_entry_set_text(GTK_ENTRY(editAttributes->toEntry), msg->name);
+	   	 g_free(msg);
+	 		}
+	  GtkTextBuffer * buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (editAttributes->txtView));
+	  gchar *fwdStr = g_strdup_printf("\n\n\n>%s",msg->content);
+		gtk_text_buffer_set_text (buffer,fwdStr,strlen(fwdStr));
+		gtk_notebook_set_current_page (self->notebook,PAGE_EDIT_MODE);
+}

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/detail-area.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/detail-area.h	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/detail-area.h	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,76 @@
+/*  detail-area.h
+ *  Authored By Alex Tang <alex at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006 First International Company
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2.1 of the license.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Public License for more details.
+ *  
+ *  Current Version: $Rev$ ($Date: 2006/10/05 17:38:14 $) [$Author: alex $]
+ */
+
+#ifndef _DETAIL_AREA_H
+#define _DETAIL_AREA_H
+
+#include <gtk/gtk.h>
+#include <glib-object.h>
+#include <libmokoui/moko-details-window.h>
+#include <libmokoui/moko-pixmap-button.h>
+#include <libmokoui/moko-tool-box.h>
+#include <libmokoui/moko-fixed.h>
+//#include "main.h"
+#include "message.h"
+
+#define TYPE_DETAIL_AREA detail_area_get_type()
+#define DETAIL_AREA(obj)     (G_TYPE_CHECK_INSTANCE_CAST ((obj), DETAIL_AREA, DetailArea))
+#define DETAIL_AREA_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), DETAIL_AREA, DetailAreaClass))
+#define IS_DETAIL_AREA(obj)     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DETAIL_AREA))
+#define IS_DETAIL_AREA_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DETAIL_AREA))
+#define DETAIL_AREA_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DETAIL_AREA, DetailAreaClass))
+
+typedef struct _Read_Attributes{
+	GtkWidget* from_label;
+	GtkWidget* date_label;
+	GtkWidget* details;
+}ReadAttributes;
+
+typedef struct _Edit_Attributes{
+	GtkWidget* sendBtn;
+	GtkWidget* addrBtn;
+	GtkWidget* toEntry;
+	GtkWidget* txtView;
+}EditAttributes;
+
+typedef struct _DetailArea{
+    MokoDetailsWindow parent;
+    GtkNotebook* notebook;
+    GtkVBox* detailbox;
+    GtkHBox* toolbox;
+    MokoFixed* entryarea;
+    GSList* folderlist;
+    guint* page;
+    ReadAttributes* readAttributes;
+    EditAttributes* editAttributes;
+}DetailArea;
+
+typedef struct _DetailAreaClass{
+    MokoDetailsWindowClass parent_class;
+}DetailAreaClass;
+
+GType detail_area_get_type();
+DetailArea* detail_area_new(void);
+
+void detail_new_sms (DetailArea* self);
+void detail_read_message (DetailArea* self, message* msg);
+void detail_reply_message (DetailArea* self, message* msg);
+void detail_forward_message (DetailArea* self, message* msg);
+
+G_END_DECLS
+
+#endif
+

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/folderlist
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/folderlist	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/folderlist	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,4 @@
+Inbox
+Outbox
+Draft
+Sent
\ No newline at end of file

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/foldersdb.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/foldersdb.c	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/foldersdb.c	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,95 @@
+#include "foldersdb.h"
+
+#include <stdio.h>
+
+G_DEFINE_TYPE (FoldersDB, foldersdb, G_TYPE_OBJECT);
+
+#define FOLDERSDB_PRIVATE(o)     (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_FOLDERSDB, FoldersDBPrivate))
+
+typedef struct _FoldersDBPrivate
+{
+} FoldersDBPrivate;
+
+static void
+foldersdb_dispose (GObject *object)
+{
+   if (G_OBJECT_CLASS (foldersdb_parent_class)->dispose)
+       G_OBJECT_CLASS (foldersdb_parent_class)->dispose (object);
+}
+
+static void
+foldersdb_finalize (GObject *object)
+{
+    G_OBJECT_CLASS (foldersdb_parent_class)->finalize (object);
+}
+
+static void
+foldersdb_class_init (FoldersDBClass *klass)
+{
+    g_debug( "foldersdb_class_init" );
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    /* register private data */
+    g_type_class_add_private (klass, sizeof (FoldersDBPrivate));
+
+    /* hook virtual methods */
+    /* ... */
+
+    /* install properties */
+    /* ... */
+
+    object_class->dispose = foldersdb_dispose;
+    object_class->finalize = foldersdb_finalize;
+
+    FILE* file = g_fopen( "folderlist", "r" );
+    g_assert( file ); //FIXME error handling, if folder file is not present
+    gchar line[256];
+    gchar *elem;
+    gchar *tok = "\n";
+
+    while( fgets(&line, sizeof(line), file) ) 
+    {
+        elem = g_strdup(strtok(&line, tok));
+        klass->folders = g_list_append(klass->folders, elem);
+    }
+
+    fclose( file );
+}
+
+static void
+foldersdb_init (FoldersDB *self)
+{
+}
+
+FoldersDB*
+foldersdb_new (void)
+{
+    return g_object_new (TYPE_FOLDERSDB, NULL);
+}
+
+GSList* foldersdb_get_folders(FoldersDB* self)
+{
+    FoldersDBClass* klass = FOLDERSDB_GET_CLASS(self);
+        return klass->folders;
+}
+
+void foldersdb_update ( GSList* folderlist )
+{
+    /*FILE* file = g_fopen( PKGDATADIR "/folderlist", "w" );*/
+    FILE* file = g_fopen( "folderlist", "w" );
+    g_assert( file );
+    GSList* c;
+    gchar *elem;
+
+    for( c =folderlist; c; c=g_slist_next(c))
+        {
+	    if(g_slist_next(c) != NULL)
+	        elem = g_strdup_printf( "%s\n", c->data);
+            else
+	        elem = g_strdup(c->data);
+	    fputs(elem, file);
+	}
+    fclose( file );
+}
+
+

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/foldersdb.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/foldersdb.h	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/foldersdb.h	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,54 @@
+/*
+ *  foldersdb.h
+ *
+ *  Authored By Alex Tang <alex at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006 First International Company
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2.1 of the license.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#ifndef __FOLDERsDB_H_
+#define __FOLDERsDB_H_ 
+
+#include <glib-object.h>
+#include <stdio.h>
+#include <string.h>
+
+G_BEGIN_DECLS
+
+#define TYPE_FOLDERSDB foldersdb_get_type()
+#define FOLDERSDB(obj)     (G_TYPE_CHECK_INSTANCE_CAST ((obj),     TYPE_FOLDERSDB, FoldersDB))
+#define FOLDERSDB_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass),     TYPE_FOLDERSDB, FoldersDBClass))
+#define IS_FOLDERSDB(obj)     (G_TYPE_CHECK_INSTANCE_TYPE ((obj),     TYPE_FOLDERSDB))
+#define IS_FOLDERSDB_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass),     TYPE_FOLDERSDB))
+#define FOLDERSDB_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj),     TYPE_FOLDERSDB, FoldersDBClass))
+
+typedef struct {
+    GObject parent;
+} FoldersDB;
+
+typedef struct {
+    GObjectClass parent_class;
+    GSList* folders;
+} FoldersDBClass;
+
+GType foldersdb_get_type (void);
+FoldersDB* foldersdb_new (void);
+GSList* foldersdb_get_folders(FoldersDB* self);
+void foldersdb_update ( GSList* folderlist );
+
+G_END_DECLS
+
+
+#endif // __FOLDERsDB_H_
+

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/main.c	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/main.c	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,368 @@
+/*
+ *  Messenger -- An messenger application for OpenMoko Framework
+ *
+ *  Authored By Alex Tang <alex at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006 First International Company
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2.1 of the license.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#include "main.h"
+#include "foldersdb.h"
+#include "detail-area.h"
+#include "callbacks.h"
+#include "message.h"
+
+#include <libmokoui/moko-application.h>
+#include <libmokoui/moko-paned-window.h>
+#include <libmokoui/moko-tool-box.h>
+#include <libmokoui/moko-tree-view.h>
+#include <libmokoui/moko-details-window.h>
+
+#include <gtk/gtk.h>
+
+int main( int argc, char** argv )
+{
+    g_debug( "openmoko-messenger starting up" );
+    /* Initialize GTK+ */
+    gtk_init( &argc, &argv );
+
+    MessengerData* d = g_new ( MessengerData, 1);
+    d->foldersdb = foldersdb_new();
+    d->app = MOKO_APPLICATION (moko_application_get_instance());
+    d->currentfolder = g_strdup("Inbox");
+    g_set_application_name( "Messenger" ); 
+    
+    /* ui */
+    setup_ui(d);
+
+		//disable mmitem 
+		update_folder_sensitive (d, d->folderlist);
+		
+    /* show everything and run main loop */
+    gtk_widget_show_all( GTK_WIDGET(d->window) );
+    gtk_main();
+
+    return 0;
+
+}
+
+void update_folder_sensitive (MessengerData* d, GSList* folderlist)
+{
+	if (g_slist_length (folderlist) > 4){
+			gtk_widget_set_sensitive (d->mmitem, TRUE);
+			gtk_widget_set_sensitive (d->fnitem, TRUE);
+		}
+		else{
+			gtk_widget_set_sensitive (d->mmitem, FALSE);
+			gtk_widget_set_sensitive (d->fnitem, FALSE);
+		}
+}
+
+GtkWidget* reload_filter_menu (MessengerData* d, GSList* folderlist)
+{
+    GSList *c;
+    GtkMenu* filtmenu;
+    filtmenu = GTK_MENU(gtk_menu_new());
+    c = folderlist;
+    for (; c; c = g_slist_next(c) ){
+        gchar* folder = (gchar*) c->data;
+	      g_debug( "adding folder '%s'", folder );
+        gtk_menu_shell_append( GTK_MENU_SHELL( filtmenu ), gtk_menu_item_new_with_label( folder ) );
+    }
+
+    return GTK_WIDGET(filtmenu);
+}
+
+void setup_ui( MessengerData* d )
+{
+     /* main window */
+     d->window = MOKO_PANED_WINDOW(moko_paned_window_new());
+		 d->mmWin = NULL;
+		 
+     /* application menu */
+     d->menu = GTK_MENU(gtk_menu_new()); 
+     d->mmitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Message Membership" ));/* message membershp item */
+     d->fnitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Folder Rename" ));/* folder rename item */
+     GtkMenuItem* accountitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Account" ));/* account item */
+     GtkMenuItem* helpitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Help" ));/* message membershp item */
+     GtkWidget* sepitem = gtk_separator_menu_item_new(); 
+     GtkMenuItem* closeitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Close" ));
+     g_signal_connect( G_OBJECT(closeitem), "activate", G_CALLBACK(main_quit), d );
+     g_signal_connect( G_OBJECT(d->mmitem), "activate", G_CALLBACK(cb_mmitem_activate), d );
+     g_signal_connect( G_OBJECT(d->fnitem), "activate", G_CALLBACK(cb_fnitem_activate), d );
+     gtk_menu_shell_append( GTK_MENU_SHELL(d->menu), GTK_WIDGET(d->mmitem) );
+     gtk_menu_shell_append( GTK_MENU_SHELL(d->menu), GTK_WIDGET(d->fnitem) );
+     gtk_menu_shell_append( GTK_MENU_SHELL(d->menu), GTK_WIDGET(accountitem) );
+     gtk_menu_shell_append( GTK_MENU_SHELL(d->menu), GTK_WIDGET(helpitem) );
+     gtk_menu_shell_append( GTK_MENU_SHELL(d->menu), GTK_WIDGET(sepitem) );
+     gtk_menu_shell_append( GTK_MENU_SHELL(d->menu), GTK_WIDGET(closeitem) );
+     moko_paned_window_set_application_menu( d->window, GTK_MENU(d->menu) );
+
+     /* filter menu */
+     d->filtmenu = GTK_MENU(gtk_menu_new());
+
+     d->folderlist = foldersdb_get_folders( d->foldersdb );
+     d->filtmenu = GTK_MENU(reload_filter_menu (d, d->folderlist));
+
+    moko_paned_window_set_filter_menu( d->window, d->filtmenu );
+    MokoMenuBox* menubox = moko_paned_window_get_menubox( d->window );
+    g_signal_connect( G_OBJECT(menubox), "filter_changed", G_CALLBACK(cb_filter_changed), d );
+
+     /* connect close event */
+     g_signal_connect( G_OBJECT(d->window), "delete_event", G_CALLBACK( main_quit ), d );
+
+    /* set navagation area */
+    populate_navigation_area( d );
+
+    /* set toolbox */
+    MokoPixmapButton* newButton;
+    MokoPixmapButton* modeButton;
+    MokoPixmapButton* getmailButton;
+    MokoPixmapButton* deleteButton;
+
+    GtkMenu* newMenu;
+    GtkMenu* modeMenu;
+    GtkMenu* deleteMenu;
+    
+    GtkWidget* image;
+
+    /* set tool bar */
+    d->toolbox = MOKO_TOOL_BOX(moko_tool_box_new_with_search());
+    //gtk_widget_grab_focus( GTK_WIDGET(d->toolbox) );
+    GtkWidget* searchEntry = moko_tool_box_get_entry (d->toolbox);
+    g_signal_connect( G_OBJECT(searchEntry), "changed", G_CALLBACK(cb_search_entry_changed), d ); 
+    g_signal_connect_swapped ( G_OBJECT(d->toolbox), "searchbox_visible", G_CALLBACK(cb_search_on), d ); 
+    g_signal_connect_swapped( G_OBJECT(d->toolbox), "searchbox_invisible", G_CALLBACK(cb_search_off), d ); 
+
+    /* set action buttons*/
+    deleteMenu = GTK_MENU( gtk_menu_new() );
+    GtkImageMenuItem* delMsgItem = GTK_IMAGE_MENU_ITEM(gtk_image_menu_item_new_with_label( "Delete Message" ));
+    GtkImageMenuItem* delFolderItem = GTK_IMAGE_MENU_ITEM(gtk_image_menu_item_new_with_label( "Delete Folder" ));
+    g_signal_connect( G_OBJECT(delFolderItem), "activate", G_CALLBACK(cb_delete_folder), d ); 
+    g_signal_connect( G_OBJECT(delMsgItem), "activate", G_CALLBACK(cb_delete_message), d ); 
+
+    gtk_menu_shell_append( GTK_MENU_SHELL(deleteMenu), GTK_WIDGET(delMsgItem) );
+    gtk_menu_shell_append( GTK_MENU_SHELL(deleteMenu), GTK_WIDGET(delFolderItem) );
+    gtk_widget_show_all (GTK_WIDGET(deleteMenu));
+    deleteButton = moko_tool_box_add_action_button( MOKO_TOOL_BOX(d->toolbox) );
+    image = gtk_image_new_from_file (PKGDATADIR "/Delete_Message.png");
+    moko_pixmap_button_set_center_image (MOKO_PIXMAP_BUTTON(deleteButton),image);
+    moko_pixmap_button_set_menu (MOKO_PIXMAP_BUTTON(deleteButton), deleteMenu);
+
+    getmailButton = moko_tool_box_add_action_button( MOKO_TOOL_BOX(d->toolbox) );
+    image = gtk_image_new_from_file (PKGDATADIR "/GetMail.png");
+    moko_pixmap_button_set_center_image ( MOKO_PIXMAP_BUTTON(getmailButton),image);
+
+    modeMenu = GTK_MENU( gtk_menu_new() );
+    GtkImageMenuItem* modeReadItem = GTK_IMAGE_MENU_ITEM(gtk_image_menu_item_new_with_label( "Mode Read" ));
+    GtkImageMenuItem* modeReplyItem = GTK_IMAGE_MENU_ITEM(gtk_image_menu_item_new_with_label( "Mode Reply" ));
+    GtkImageMenuItem* modeFwdItem = GTK_IMAGE_MENU_ITEM(gtk_image_menu_item_new_with_label( "Mode Forward" ));
+
+    gtk_menu_shell_append( GTK_MENU_SHELL(modeMenu), GTK_WIDGET(modeReadItem));
+    gtk_menu_shell_append( GTK_MENU_SHELL(modeMenu), GTK_WIDGET(modeReplyItem));
+    gtk_menu_shell_append( GTK_MENU_SHELL(modeMenu), GTK_WIDGET(modeFwdItem));
+    g_signal_connect( G_OBJECT(modeReadItem), "activate", G_CALLBACK(cb_mode_read), d );
+    g_signal_connect( G_OBJECT(modeReplyItem), "activate", G_CALLBACK(cb_mode_reply), d );
+    g_signal_connect( G_OBJECT(modeFwdItem), "activate", G_CALLBACK(cb_mode_forward), d );
+    gtk_widget_show_all (GTK_WIDGET(modeMenu));
+    modeButton = moko_tool_box_add_action_button( MOKO_TOOL_BOX(d->toolbox) );
+    image = gtk_image_new_from_file (PKGDATADIR "/Mode_Read.png");
+    moko_pixmap_button_set_center_image ( MOKO_PIXMAP_BUTTON(modeButton),image);
+    moko_pixmap_button_set_menu ( MOKO_PIXMAP_BUTTON(modeButton),GTK_MENU(modeMenu) );
+
+    newMenu = GTK_MENU( gtk_menu_new() );
+    GtkImageMenuItem* newMsgItem = GTK_IMAGE_MENU_ITEM ( gtk_image_menu_item_new_with_label( "New SMS") );
+    GtkImageMenuItem* newFolderItem = GTK_IMAGE_MENU_ITEM ( gtk_image_menu_item_new_with_label( "New Folder") );
+    GtkImageMenuItem* newMailItem = GTK_IMAGE_MENU_ITEM ( gtk_image_menu_item_new_with_label( "New Mail") );
+
+    gtk_menu_shell_append( GTK_MENU_SHELL(newMenu), GTK_WIDGET(newMsgItem));
+    gtk_menu_shell_append( GTK_MENU_SHELL(newMenu), GTK_WIDGET(newMailItem));
+    gtk_menu_shell_append( GTK_MENU_SHELL(newMenu), GTK_WIDGET(newFolderItem));
+    gtk_widget_show_all ( GTK_WIDGET(newMenu) );
+    g_signal_connect( G_OBJECT(newMsgItem), "activate", G_CALLBACK(cb_new_sms), d );
+    g_signal_connect( G_OBJECT(newMailItem), "activate", G_CALLBACK(cb_new_mail), d );
+    g_signal_connect( G_OBJECT(newFolderItem), "activate", G_CALLBACK(cb_new_folder), d );
+    newButton = moko_tool_box_add_action_button( MOKO_TOOL_BOX(d->toolbox) );
+    image = gtk_image_new_from_file (PKGDATADIR "/New_Mail.png");
+    moko_pixmap_button_set_center_image (MOKO_PIXMAP_BUTTON(newButton),image);
+    moko_pixmap_button_set_menu ( MOKO_PIXMAP_BUTTON(newButton),GTK_MENU(newMenu) );
+
+    moko_paned_window_add_toolbox( d->window, d->toolbox );
+
+    /* detail area */
+    populate_detail_area (d);
+    
+		//select the first column
+		gint index = 0;
+		GtkTreeSelection* tree_selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(d->view) );
+		GtkTreePath *path = gtk_tree_path_new_from_indices( index, -1 );
+		gtk_tree_selection_select_path( tree_selection, path );
+		gtk_tree_view_set_cursor( GTK_TREE_VIEW(d->view), path, NULL, FALSE ); 
+    gtk_widget_grab_focus (d->view);
+}
+
+int in_string(char *str, char *key)
+{
+  int length, key_length;
+  int m,n,i;
+
+  length = strlen(str);
+  key_length = strlen(key);
+
+  n=0;
+
+  for(m=0;m<length;m++)
+    {
+      if(str[m] == key[n])
+			{
+			  for(i=0;i<key_length;i++)
+			    if(str[m+i]!= key[i+n])
+			      break;
+		
+			  if(i == key_length)
+			    return 1;
+			  else
+			    {
+			      m = m+i+1;
+			      n=0;
+			    }
+			}
+    }
+  return 0;
+}
+
+gboolean filter_visible_function (GtkTreeModel* model, GtkTreeIter* iter, MessengerData* d)
+{
+	  gchar* folder;
+	  gchar* from;
+	  gchar* subject;
+	  gtk_tree_model_get (model, iter, COLUMN_FOLDER, &folder, -1);
+	  gtk_tree_model_get (model, iter, COLUMN_FROM, &from, -1);
+	  gtk_tree_model_get (model, iter, COLUMN_SUBJECT, &subject, -1);
+	  
+	  if (d->searchOn){
+	  	if ((strlen(d->s_key) > 0) && !in_string(from, d->s_key) && !in_string(subject, d->s_key))
+	  		return FALSE;
+	  }
+	  else {
+	  	gtk_menu_set_active (d->filtmenu,0);
+	  	if(g_strcasecmp(folder,d->currentfolder))
+	  				return FALSE;
+		}
+
+		return TRUE;
+}
+
+void
+cell_data_func (GtkTreeViewColumn *col,
+				GtkCellRenderer   *renderer,
+				GtkTreeModel      *model,
+				GtkTreeIter  	    *iter,
+				gpointer          user_data)
+{
+	gint status;
+	
+  gtk_tree_model_get(model, iter, COLUMN_STATUS, &status, -1);
+
+  if (status == UNREAD)
+      g_object_set(renderer, "weight", PANGO_WEIGHT_BOLD, "weight-set", TRUE, NULL);
+  else
+      g_object_set(renderer, "weight", PANGO_WEIGHT_BOLD, "weight-set", FALSE, NULL);
+}
+
+void populate_navigation_area( MessengerData* d )
+{
+		guint         i;
+    GdkPixbuf* icon;
+    GError*   error = NULL;
+    GtkTreeIter  iter;
+    
+    d->liststore = gtk_list_store_new( NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING );
+    d->filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (d->liststore),NULL);
+    d->view = MOKO_TREE_VIEW( moko_tree_view_new_with_model( GTK_TREE_MODEL (d->filter)) ); 
+    
+    for (i = 0;  i < G_N_ELEMENTS(names);  ++i)
+	  {
+		  gtk_list_store_append(d->liststore, &iter);
+			switch(states[i])
+			{
+				case UNREAD	:	icon = gdk_pixbuf_new_from_file (PKGDATADIR "/Unread.png", &error);break;
+				case READ	:	icon = gdk_pixbuf_new_from_file (PKGDATADIR "/Mode_Read.png", &error);break;
+				case REPLIED	:	icon = gdk_pixbuf_new_from_file (PKGDATADIR "/Mode_Reply.png", &error);break;
+				case FORWARD	:	icon = gdk_pixbuf_new_from_file (PKGDATADIR "/Mode_Forward.png", &error);break;
+			}
+		  gtk_list_store_set(d->liststore, &iter,
+		  									 COLUMN_ICON, icon,
+		                     COLUMN_FROM, names[i],
+		                     COLUMN_SUBJECT, subjects[i],
+		                     COLUMN_CONTENT, contents[i],
+		                     COLUMN_STATUS, states[i],
+		                     COLUMN_FOLDER, folders[i],
+		                     -1);
+	  }
+	  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (d->filter),
+    																				filter_visible_function,
+    																				d,
+    																				NULL);
+    																				
+    GtkCellRenderer* ren;
+    GtkTreeViewColumn* column = gtk_tree_view_column_new();
+	  gtk_tree_view_column_set_title(column, "From");
+	  
+    /* Add status picture */
+    ren = gtk_cell_renderer_pixbuf_new();
+    gtk_tree_view_column_pack_start(column, ren, FALSE);
+	  gtk_tree_view_column_set_attributes(column, ren,
+										  "pixbuf", COLUMN_ICON,
+										  NULL);
+		/* add message from name */
+    ren = gtk_cell_renderer_text_new();
+    gtk_tree_view_column_pack_start(column, ren, TRUE);
+		gtk_tree_view_column_set_attributes(column, ren,
+						  "text", COLUMN_FROM,
+						  NULL);
+		/* Bold if UNREAD */
+		gtk_tree_view_column_set_cell_data_func (column, ren, cell_data_func, d->liststore, NULL);
+    moko_tree_view_append_column( d->view, column );
+
+    ren = gtk_cell_renderer_text_new();
+    column = gtk_tree_view_column_new();
+		gtk_tree_view_column_set_title(column, "Subject");
+		gtk_tree_view_column_pack_start(column, ren, TRUE);
+		gtk_tree_view_column_set_attributes(column, ren,
+						  "text", COLUMN_SUBJECT,
+						  NULL);
+    gtk_tree_view_column_set_cell_data_func (column, ren, cell_data_func, d->liststore, NULL);
+    moko_tree_view_append_column( d->view, column );
+
+    GtkTreeSelection* selection = gtk_tree_view_get_selection( d->view );
+    g_signal_connect( G_OBJECT(selection), "changed", G_CALLBACK(cb_cursor_changed), d );
+    
+    moko_paned_window_set_upper_pane( d->window, GTK_WIDGET(moko_tree_view_put_into_scrolled_window(d->view)) );
+    gtk_widget_hide(d->mmWin);
+}
+
+void populate_detail_area( MessengerData* d )
+{
+   d->details = detail_area_new();
+   gtk_widget_show (d->details);
+   moko_paned_window_set_lower_pane( d->window, GTK_WIDGET(moko_details_window_put_in_box(d->details)));
+}
+
+void main_quit(GtkWidget* widget, GdkEvent* event, MessengerData* d)
+{
+    foldersdb_update (d->folderlist);
+    gtk_main_quit();
+}
+

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/main.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/main.h	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/main.h	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,90 @@
+/*
+ *  Messenger -- An messenger application for OpenMoko Framework
+ *
+ *  Authored By Alex Tang <alex at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006 First International Company
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2.1 of the license.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#ifndef __MAIN__H_
+#define __MAIN__H_
+
+#include <libmokoui/moko-application.h>
+#include <libmokoui/moko-paned-window.h>
+#include <libmokoui/moko-tool-box.h>
+#include <libmokoui/moko-tree-view.h>
+#include <gtk/gtkliststore.h>
+#include <gtk/gtktreemodelfilter.h>
+
+#include "foldersdb.h"
+#include "detail-area.h"
+
+typedef struct _MessengerData{
+    MokoApplication* app;
+    MokoPanedWindow* window;
+    GtkMenu* menu;
+    GtkMenu* filtmenu;
+    FoldersDB* foldersdb;
+    MokoToolBox* toolbox;
+    GtkListStore* liststore;
+    GtkTreeModelFilter* filter;
+    MokoTreeView* view;
+    DetailArea* details;
+    GSList* folderlist;
+    gchar* currentfolder;
+    gchar* s_key;
+    gboolean searchOn;
+    GtkWidget* nfEntry;
+    GtkWidget* frEntry;
+    GtkWidget* mmWin;
+    GtkWidget* mmitem;
+    GtkWidget* fnitem;
+}MessengerData;
+
+enum {
+		COLUMN_ICON,
+    COLUMN_FROM,
+    COLUMN_SUBJECT,
+    COLUMN_CONTENT,
+    COLUMN_STATUS,
+    COLUMN_FOLDER,
+    NUM_COLS,
+};
+
+enum {
+    PAGE_EDIT_MODE,
+    PAGE_NEW_MAIL,
+    PAGE_MODE_READ,
+    PAGE_MODE_REPLY,
+    PAGE_MODE_FORWARD,
+    PAGE_MODE_MMSHIP,
+    NUM_PAGES,
+};
+
+enum {
+		UNREAD,
+		READ,
+		REPLIED,
+		FORWARD,
+		NUM_STATES,
+};
+
+GtkWidget* reload_filter_menu (MessengerData* d, GSList* folderlist);
+void setup_ui( MessengerData* d );
+void populate_navigation_area( MessengerData* d );
+void populate_detail_area( MessengerData* d );
+void main_quit(GtkWidget* widget, GdkEvent* event, MessengerData* d);
+void update_folder_sensitive (MessengerData* d, GSList* folderlist);
+#endif
+

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/message.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/message.h	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/message.h	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,12 @@
+#ifndef _MESSAGE_H_
+#define _MESSAGE_H_
+
+typedef struct message{
+	gchar* name;
+	gchar* subject;
+	gchar* folder;
+	gchar* content;
+	gint	 status;
+}message;
+
+#endif

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-dialog-window.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-dialog-window.c	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-dialog-window.c	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,483 @@
+/*  sms-dialog-window.c
+ *  Authored By Alex Tang <alex at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006 First International Company
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2.1 of the license.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Public License for more details.
+ *  
+ *  Current Version: $Rev$ ($Date: 2006/10/05 17:38:14 $) [$Author: alex $]
+ */
+ 
+#include "sms-dialog-window.h"
+#include "main.h"
+#include <libmokoui/moko-pixmap-button.h>
+#include <libmokoui/moko-fixed.h>
+
+#include <gtk/gtkeventbox.h>
+#include <gtk/gtkdialog.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtktextview.h>
+#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtkviewport.h>
+
+#include <pango/pango-font.h>
+
+#include <glib/gmain.h>
+
+G_DEFINE_TYPE (SmsDialogWindow, sms_dialog_window, MOKO_TYPE_WINDOW)
+
+#define SMS_DIALOG_WINDOW_GET_PRIVATE(o)   (G_TYPE_INSTANCE_GET_PRIVATE ((o), SMS_TYPE_DIALOG_WINDOW, SmsDialogWindowPrivate))
+
+typedef struct _SmsDialogWindowPrivate SmsDialogWindowPrivate;
+
+struct _SmsDialogWindowPrivate
+{
+    GtkVBox* vbox;
+    GtkHBox* hbox;
+    GtkEventBox* eventbox;
+    GtkLabel* titleLabel;
+    GtkLabel* textInLabel;
+    MokoToolBox* toolbox;
+    MokoPixmapButton* closebutton;
+};
+
+typedef struct _SmsDialogRunInfo
+{
+    SmsDialogWindow *dialog;
+    gint response_id;
+    GMainLoop *loop;
+    gboolean destroyed;
+} SmsDialogRunInfo;
+
+static void sms_dialog_window_close(SmsDialogWindow* self);
+
+static void
+shutdown_loop (SmsDialogRunInfo *ri)
+{
+    if (g_main_loop_is_running (ri->loop))
+        g_main_loop_quit (ri->loop);
+}
+
+static void
+run_unmap_handler (SmsDialogWindow* dialog, gpointer data)
+{
+    SmsDialogRunInfo *ri = data;
+
+    shutdown_loop (ri);
+}
+
+static void
+run_response_handler (SmsDialogWindow* dialog,
+                              gint response_id,
+                              gpointer data)
+{
+    SmsDialogRunInfo *ri;
+
+    ri = data;
+
+    ri->response_id = response_id;
+
+    shutdown_loop (ri);
+}
+
+static gint
+        run_delete_handler (SmsDialogWindow* dialog,
+                            GdkEventAny *event,
+                            gpointer data)
+{
+    SmsDialogRunInfo *ri = data;
+
+    shutdown_loop (ri);
+
+    return TRUE; /* Do not destroy */
+}
+
+static void
+        run_destroy_handler (SmsDialogWindow* dialog, gpointer data)
+{
+    SmsDialogRunInfo *ri = data;
+
+    /* shutdown_loop will be called by run_unmap_handler */
+
+    ri->destroyed = TRUE;
+}
+
+
+static void
+sms_dialog_window_dispose(GObject* object)
+{
+    if (G_OBJECT_CLASS (sms_dialog_window_parent_class)->dispose)
+        G_OBJECT_CLASS (sms_dialog_window_parent_class)->dispose (object);
+}
+
+static void
+sms_dialog_window_finalize(GObject* object)
+{
+    G_OBJECT_CLASS (sms_dialog_window_parent_class)->finalize (object);
+}
+
+sms_dialog_window_class_init(SmsDialogWindowClass* klass)
+{
+    GObjectClass* object_class = G_OBJECT_CLASS(klass);
+
+    g_type_class_add_private (klass, sizeof(SmsDialogWindowPrivate));
+
+    object_class->dispose = sms_dialog_window_dispose;
+    object_class->finalize = sms_dialog_window_finalize;
+}
+
+SmsDialogWindow*
+sms_dialog_window_new(void)
+{
+    return g_object_new(SMS_TYPE_DIALOG_WINDOW, NULL);
+}
+
+static void
+sms_dialog_window_init(SmsDialogWindow* self)
+{
+    MokoWindow* parent = moko_application_get_main_window( moko_application_get_instance() );
+    if ( parent )
+    {
+        gtk_window_set_transient_for( GTK_WINDOW(self), parent );
+#ifndef DEBUG_THIS_FILE
+        gtk_window_set_modal( GTK_WINDOW(self), TRUE );
+#endif
+        gtk_window_set_destroy_with_parent( GTK_WINDOW(self), TRUE );
+    }
+}
+
+void sms_dialog_window_set_title(SmsDialogWindow* self, const gchar* title)
+{
+    SmsDialogWindowPrivate* priv = SMS_DIALOG_WINDOW_GET_PRIVATE(self);
+    if ( !priv->titleLabel )
+    {
+        priv->titleLabel = gtk_label_new( title );
+        priv->hbox = gtk_hbox_new( FALSE, 0 );
+        gtk_window_set_title( GTK_WINDOW(self), title );
+        gtk_widget_set_name( GTK_WIDGET(priv->titleLabel), "mokodialogwindow-title-label" );
+        gtk_box_pack_start( GTK_BOX(priv->hbox), GTK_WIDGET(priv->titleLabel), TRUE, TRUE, 0 );
+        PangoFontDescription* font_desc = pango_font_description_from_string ("Bold 10");
+        priv->textInLabel = gtk_label_new( "14(2)" );
+        gtk_widget_modify_font (priv->textInLabel, font_desc);
+        gtk_widget_set_name( GTK_WIDGET(priv->textInLabel), "mokodialogwindow-title-label" );
+        gtk_box_pack_start( GTK_BOX(priv->hbox), GTK_WIDGET(priv->textInLabel), FALSE, FALSE, 0);
+        priv->eventbox = gtk_event_box_new();
+        gtk_container_add( GTK_CONTAINER(priv->eventbox), GTK_WIDGET(priv->hbox) );
+        gtk_widget_set_name( GTK_WIDGET(priv->eventbox), "mokodialogwindow-title-labelbox" );
+        //FIXME get from theme
+        gtk_misc_set_padding( GTK_MISC(priv->titleLabel), 0, 6 );
+        gtk_widget_show( GTK_WIDGET(priv->titleLabel) );
+        gtk_widget_show( GTK_WIDGET(priv->eventbox) );
+    }
+    else
+    {
+        gtk_label_set_text( priv->titleLabel, title );
+        gtk_window_set_title( GTK_WINDOW(self), title );
+    }
+    if ( !priv->vbox )
+    {
+    		GtkImage* image;
+    		MokoPixmapButton* smsSendBtn;
+    		MokoPixmapButton* emailBtn;
+    		
+        priv->vbox = gtk_vbox_new( FALSE, 0 );
+        gtk_box_pack_start( GTK_BOX(priv->vbox), GTK_WIDGET(priv->eventbox), FALSE, FALSE, 0 );
+        
+        //Add toolbox
+        priv->hbox = gtk_hbox_new( FALSE, 0 );
+        priv->toolbox = moko_tool_box_new();
+        GtkHBox* btnBox = moko_tool_box_get_button_box (MOKO_TOOL_BOX(priv->toolbox));
+        priv->closebutton = moko_pixmap_button_new();
+        image = gtk_image_new_from_file (PKGDATADIR "/Cancel.png");
+        moko_pixmap_button_set_center_image ( MOKO_PIXMAP_BUTTON(priv->closebutton),image);
+        gtk_widget_set_name( GTK_WIDGET(priv->closebutton), "mokostylusbutton-black" );
+        gtk_box_pack_end (GTK_BOX(btnBox),priv->closebutton,FALSE,FALSE,280);
+        g_signal_connect_swapped( G_OBJECT(priv->closebutton), "clicked", G_CALLBACK(sms_dialog_window_close), self );
+
+        emailBtn = moko_tool_box_add_action_button (MOKO_TOOL_BOX(priv->toolbox));
+        gtk_widget_set_name( GTK_WIDGET(emailBtn), "mokostylusbutton-white" );
+        image = gtk_image_new_from_file (PKGDATADIR "/Address.png");
+        moko_pixmap_button_set_center_image ( MOKO_PIXMAP_BUTTON(emailBtn),image);
+        
+        smsSendBtn = moko_tool_box_add_action_button (MOKO_TOOL_BOX(priv->toolbox));
+        gtk_widget_set_name( GTK_WIDGET(smsSendBtn), "mokostylusbutton-white" );
+    		image = gtk_image_new_from_file (PKGDATADIR "/Send.png");
+   		 	moko_pixmap_button_set_center_image ( MOKO_PIXMAP_BUTTON(smsSendBtn),image);
+        
+        gtk_box_pack_start( GTK_BOX(priv->vbox), GTK_WIDGET(priv->toolbox), FALSE, FALSE, 0 );
+        gtk_container_add( GTK_CONTAINER(self), GTK_WIDGET(priv->vbox) );
+        
+        //Fill input entry
+		    GtkAlignment* alignment = GTK_ALIGNMENT(gtk_alignment_new (0.5, 0.5, 1, 1));
+		    gtk_alignment_set_padding (alignment, 10, 10, 50, 10);
+		    GtkWidget* entrybox = gtk_hbox_new(FALSE,0);
+		    GtkWidget* toLabel = gtk_label_new("To:");
+		    gtk_widget_set_size_request (toLabel, 40, -1);
+		    gtk_misc_set_alignment (GTK_MISC (toLabel),1,0.5);
+		    GtkWidget* toEntry = gtk_entry_new();
+		    gtk_widget_set_size_request (toEntry, 320, -1);
+		    gtk_box_pack_start (GTK_BOX(entrybox),toLabel,FALSE,TRUE,0);
+		    gtk_box_pack_start (GTK_BOX(entrybox),toEntry,FALSE,TRUE,0);
+		    gtk_container_add (GTK_CONTAINER(alignment), entrybox);
+		    gtk_box_pack_start( GTK_BOX(priv->vbox), GTK_WIDGET(alignment), FALSE, FALSE, 0 );
+		    
+		    /* fill textview */
+		    GtkTextView* txtView = GTK_TEXT_VIEW(gtk_text_view_new());
+		    GtkWidget* viewAlign = gtk_alignment_new (0.5, 0.5, 1, 1);
+		    gtk_alignment_set_padding (GTK_ALIGNMENT(viewAlign),10,10,30,30);
+		    GtkScrolledWindow* scolwin = gtk_scrolled_window_new (NULL, NULL);
+		    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scolwin), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+		    GtkViewport*  viewport = gtk_viewport_new (NULL, NULL);
+		    gtk_text_view_set_wrap_mode (txtView,GTK_WRAP_CHAR);
+		    gtk_container_add (GTK_CONTAINER(viewport),GTK_WIDGET(txtView));
+		    gtk_container_add (GTK_CONTAINER (scolwin), viewport);
+		    gtk_container_add (GTK_CONTAINER(viewAlign),GTK_WIDGET(scolwin));
+    		gtk_box_pack_start( GTK_BOX(priv->vbox), GTK_WIDGET(viewAlign), TRUE, TRUE, 0 );
+		    gtk_widget_show_all( GTK_WIDGET(priv->vbox) );
+    }
+}
+
+void mail_dialog_window_set_title(SmsDialogWindow* self, const gchar* title)
+{
+		SmsDialogWindowPrivate* priv = SMS_DIALOG_WINDOW_GET_PRIVATE(self);
+    if ( !priv->titleLabel )
+    {
+        priv->titleLabel = gtk_label_new( title );
+        gtk_window_set_title( GTK_WINDOW(self), title );
+        gtk_widget_set_name( GTK_WIDGET(priv->titleLabel), "mokodialogwindow-title-label" );
+        priv->eventbox = gtk_event_box_new();
+        gtk_container_add( GTK_CONTAINER(priv->eventbox), GTK_WIDGET(priv->hbox) );
+        gtk_widget_set_name( GTK_WIDGET(priv->eventbox), "mokodialogwindow-title-labelbox" );
+        //FIXME get from theme
+        gtk_misc_set_padding( GTK_MISC(priv->titleLabel), 0, 6 );
+        gtk_container_add (GTK_CONTAINER(priv->eventbox), priv->titleLabel);
+        gtk_widget_show( GTK_WIDGET(priv->titleLabel) );
+        gtk_widget_show( GTK_WIDGET(priv->eventbox) );
+    }
+    else
+    {
+        gtk_label_set_text( priv->titleLabel, title );
+        gtk_window_set_title( GTK_WINDOW(self), title );
+    }
+    if ( !priv->vbox )
+    {
+    		GtkImage* image;
+    		MokoPixmapButton* smsSendBtn;
+    		MokoPixmapButton* emailBtn;
+    		MokoPixmapButton* attachBtn;
+    		
+        priv->vbox = gtk_vbox_new( FALSE, 0 );
+        gtk_box_pack_start( GTK_BOX(priv->vbox), GTK_WIDGET(priv->eventbox), FALSE, FALSE, 0 );
+        
+        //Add toolbox
+        priv->hbox = gtk_hbox_new( FALSE, 0 );
+        priv->toolbox = moko_tool_box_new();
+        GtkHBox* btnBox = moko_tool_box_get_button_box (MOKO_TOOL_BOX(priv->toolbox));
+        priv->closebutton = moko_pixmap_button_new();
+        image = gtk_image_new_from_file (PKGDATADIR "/Cancel.png");
+        moko_pixmap_button_set_center_image ( MOKO_PIXMAP_BUTTON(priv->closebutton),image);
+        gtk_widget_set_name( GTK_WIDGET(priv->closebutton), "mokostylusbutton-black" );
+        gtk_box_pack_end (GTK_BOX(btnBox),priv->closebutton,FALSE,FALSE, 200);
+        g_signal_connect_swapped( G_OBJECT(priv->closebutton), "clicked", G_CALLBACK(sms_dialog_window_close), self );
+
+				attachBtn = moko_tool_box_add_action_button (MOKO_TOOL_BOX(priv->toolbox));
+				gtk_widget_set_name( GTK_WIDGET(attachBtn), "mokostylusbutton-white" );
+        image = gtk_image_new_from_file (PKGDATADIR "/Address.png");
+        moko_pixmap_button_set_center_image ( MOKO_PIXMAP_BUTTON(attachBtn),image);
+        
+        emailBtn = moko_tool_box_add_action_button (MOKO_TOOL_BOX(priv->toolbox));
+        gtk_widget_set_name( GTK_WIDGET(emailBtn), "mokostylusbutton-white" );
+        image = gtk_image_new_from_file (PKGDATADIR "/Attached.png");
+        moko_pixmap_button_set_center_image ( MOKO_PIXMAP_BUTTON(emailBtn),image);
+        
+        smsSendBtn = moko_tool_box_add_action_button (MOKO_TOOL_BOX(priv->toolbox));
+        gtk_widget_set_name( GTK_WIDGET(smsSendBtn), "mokostylusbutton-white" );
+    		image = gtk_image_new_from_file (PKGDATADIR "/Send.png");
+   		 	moko_pixmap_button_set_center_image ( MOKO_PIXMAP_BUTTON(smsSendBtn),image);
+        
+        gtk_box_pack_start( GTK_BOX(priv->vbox), GTK_WIDGET(priv->toolbox), FALSE, FALSE, 0 );
+        gtk_container_add( GTK_CONTAINER(self), GTK_WIDGET(priv->vbox) );
+        
+        //Fill input entry
+		    GtkAlignment* alignment = GTK_ALIGNMENT(gtk_alignment_new (0.5, 0.5, 1, 1));
+		    gtk_alignment_set_padding (alignment, 5, 5, 10, 10);
+		    GtkWidget* hbox = gtk_hbox_new(FALSE,0);
+		    PangoFontDescription* font_desc;
+		    font_desc = pango_font_description_from_string ("Bold 12");
+		    GtkWidget* toLabel = gtk_label_new("To:");
+		    gtk_widget_modify_font (toLabel, font_desc);
+		    gtk_widget_set_size_request (toLabel, 110, -1);
+		    gtk_misc_set_alignment (GTK_MISC (toLabel),0.9,0.5);
+		    GtkWidget* toEntry = gtk_entry_new();
+		    gtk_widget_set_size_request (toEntry, 320, -1);
+		    gtk_box_pack_start (GTK_BOX(hbox),toLabel,FALSE,TRUE,0);
+		    gtk_box_pack_start (GTK_BOX(hbox),toEntry,FALSE,TRUE,0);
+		    gtk_container_add (GTK_CONTAINER(alignment), hbox);
+		    gtk_box_pack_start( GTK_BOX(priv->vbox), GTK_WIDGET(alignment), FALSE, FALSE, 0 );
+		   
+		    alignment = GTK_ALIGNMENT(gtk_alignment_new (0.5, 0.5, 1, 1));
+		    gtk_alignment_set_padding (alignment, 5, 5, 10, 10);
+		    hbox = gtk_hbox_new(FALSE,0);
+		    GtkWidget* ccLabel = gtk_label_new("CC:");
+		    font_desc = pango_font_description_from_string ("Bold 12");
+		    gtk_widget_set_size_request (ccLabel, 110, -1);
+		    gtk_widget_modify_font (ccLabel, font_desc);
+		    gtk_misc_set_alignment (GTK_MISC (ccLabel),0.9,0.5);
+		    GtkWidget* ccEntry = gtk_entry_new();
+		    gtk_widget_set_size_request (ccEntry, 320, -1);
+		    gtk_box_pack_start (GTK_BOX(hbox),ccLabel,FALSE,TRUE,0);
+		    gtk_box_pack_start (GTK_BOX(hbox),ccEntry,FALSE,TRUE,0);
+		    gtk_container_add (GTK_CONTAINER(alignment), hbox);
+		    gtk_box_pack_start (GTK_BOX(priv->vbox),GTK_WIDGET(alignment),FALSE,TRUE,0);
+		    
+		    alignment = GTK_ALIGNMENT(gtk_alignment_new (0.5, 0.5, 1, 1));
+		    gtk_alignment_set_padding (alignment, 5, 5, 10, 10);
+		    hbox = gtk_hbox_new(FALSE,0);
+		    GtkWidget* bccLabel = gtk_label_new("Bcc:");
+		    font_desc = pango_font_description_from_string ("Bold 12");
+		    gtk_widget_set_size_request (bccLabel, 110, -1);
+		    gtk_widget_modify_font (bccLabel, font_desc);
+		    gtk_misc_set_alignment (GTK_MISC (bccLabel),0.9,0.5);
+		    GtkWidget* bccEntry = gtk_entry_new();
+		    gtk_widget_set_size_request (bccEntry, 320, -1);
+		    gtk_box_pack_start (GTK_BOX(hbox),bccLabel,FALSE,TRUE,0);
+		    gtk_box_pack_start (GTK_BOX(hbox),bccEntry,FALSE,TRUE,0);
+		    gtk_container_add (GTK_CONTAINER(alignment), hbox);
+		    gtk_box_pack_start (GTK_BOX(priv->vbox),GTK_WIDGET(alignment),FALSE,TRUE,0);
+		
+				alignment = GTK_ALIGNMENT(gtk_alignment_new (0.5, 0.5, 1, 1));
+		    gtk_alignment_set_padding (alignment, 5, 5, 10, 10);
+		    hbox = gtk_hbox_new(FALSE,0);
+		    GtkWidget* subjectLabel = gtk_label_new("Subject:");
+		    font_desc = pango_font_description_from_string ("Bold 12");
+		    gtk_widget_modify_font (subjectLabel, font_desc);
+		    gtk_widget_set_size_request (subjectLabel, 110, -1);
+		    gtk_misc_set_alignment (GTK_MISC (subjectLabel),0.9,0.5);
+		    GtkWidget* subjectEntry = gtk_entry_new();
+		    gtk_widget_set_size_request (subjectEntry, 320, -1);
+		    gtk_box_pack_start (GTK_BOX(hbox),subjectLabel,FALSE,TRUE,0);
+		    gtk_box_pack_start (GTK_BOX(hbox),subjectEntry,FALSE,TRUE,0);
+		    gtk_container_add (GTK_CONTAINER(alignment), hbox);
+		    gtk_box_pack_start (GTK_BOX(priv->vbox),GTK_WIDGET(alignment),FALSE,TRUE,0);
+		    
+		    /* fill textview */
+		    GtkWidget* txtView = GTK_TEXT_VIEW(gtk_text_view_new());
+		    GtkWidget* viewAlign = gtk_alignment_new (0.5, 0.5, 1, 1);
+		    gtk_alignment_set_padding (GTK_ALIGNMENT(viewAlign),10,10,30,30);
+		    GtkScrolledWindow* scolwin = gtk_scrolled_window_new (NULL, NULL);
+		    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scolwin), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
+		    GtkViewport*  viewport = gtk_viewport_new (NULL, NULL);
+		    gtk_text_view_set_wrap_mode (txtView,GTK_WRAP_CHAR);
+		    gtk_container_add (GTK_CONTAINER(viewport),GTK_WIDGET(txtView));
+		    gtk_container_add (GTK_CONTAINER (scolwin), viewport);
+		    gtk_container_add (GTK_CONTAINER(viewAlign),GTK_WIDGET(scolwin));
+    		gtk_box_pack_start( GTK_BOX(priv->vbox), GTK_WIDGET(viewAlign), TRUE, TRUE, 0 );
+		    gtk_widget_show_all( GTK_WIDGET(priv->vbox) );
+    }
+}
+
+void sms_dialog_window_set_contents(SmsDialogWindow* self, GtkWidget* contents)
+{
+    SmsDialogWindowPrivate* priv = SMS_DIALOG_WINDOW_GET_PRIVATE(self);
+    g_return_if_fail( priv->vbox );
+    gtk_box_pack_start( GTK_BOX(priv->vbox), contents, TRUE, TRUE, 0 );
+}
+
+static void sms_dialog_window_close(SmsDialogWindow* self)
+{
+    /* Synthesize delete_event to close dialog. */
+
+    GtkWidget *widget = GTK_WIDGET(self);
+    GdkEvent *event;
+
+    event = gdk_event_new( GDK_DELETE );
+
+    event->any.window = g_object_ref(widget->window);
+    event->any.send_event = TRUE;
+
+    gtk_main_do_event( event );
+    gdk_event_free( event );
+}
+
+guint sms_dialog_window_run(SmsDialogWindow* dialog)
+{
+    SmsDialogRunInfo ri = { NULL, GTK_RESPONSE_NONE, NULL, FALSE };
+    gboolean was_modal;
+    gulong response_handler;
+    gulong unmap_handler;
+    gulong destroy_handler;
+    gulong delete_handler;
+
+    g_return_val_if_fail (SMS_IS_DIALOG_WINDOW(dialog), -1);
+
+    g_object_ref (dialog);
+
+#ifndef DEBUG_THIS_FILE
+    was_modal = GTK_WINDOW (dialog)->modal;
+    if (!was_modal)
+        gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+#endif
+
+    if (!GTK_WIDGET_VISIBLE (dialog))
+        gtk_widget_show (GTK_WIDGET (dialog));
+
+    response_handler =
+            g_signal_connect (dialog,
+                              "response",
+                              G_CALLBACK (run_response_handler),
+                              &ri);
+
+    unmap_handler =
+            g_signal_connect (dialog,
+                              "unmap",
+                              G_CALLBACK (run_unmap_handler),
+                              &ri);
+
+    delete_handler =
+            g_signal_connect (dialog,
+                              "delete-event",
+                              G_CALLBACK (run_delete_handler),
+                              &ri);
+
+    destroy_handler =
+            g_signal_connect (dialog,
+                              "destroy",
+                              G_CALLBACK (run_destroy_handler),
+                              &ri);
+
+    ri.loop = g_main_loop_new (NULL, FALSE);
+
+    GDK_THREADS_LEAVE ();
+    g_main_loop_run (ri.loop);
+    GDK_THREADS_ENTER ();
+
+    g_main_loop_unref (ri.loop);
+    ri.loop = NULL;
+
+    if (!ri.destroyed)
+    {
+        if (!was_modal)
+            gtk_window_set_modal (GTK_WINDOW(dialog), FALSE);
+
+        g_signal_handler_disconnect (dialog, response_handler);
+        g_signal_handler_disconnect (dialog, unmap_handler);
+        g_signal_handler_disconnect (dialog, delete_handler);
+        g_signal_handler_disconnect (dialog, destroy_handler);
+    }
+
+    g_object_unref (dialog);
+
+    return ri.response_id;
+}
+
+/*void sms_dialog_window_set_title(SmsDialogWindow* self, message* msg)
+{
+}*/

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-dialog-window.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-dialog-window.h	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-dialog-window.h	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,52 @@
+/*  sms-dialog-window.h
+ *  Authored By Alex Tang <alex at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006 First International Company
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2.1 of the license.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Public License for more details.
+ *  
+ *  Current Version: $Rev$ ($Date: 2006/10/05 17:38:14 $) [$Author: alex $]
+ */
+ 
+#ifndef _SMS_DIALOG_WINDOW_H_
+#define _SMS_DIALOG_WINDOW_H_
+
+#include <libmokoui/moko-window.h>
+#include <libmokoui/moko-tool-box.h>
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define SMS_TYPE_DIALOG_WINDOW sms_dialog_window_get_type()
+#define SMS_DIALOG_WINDOW(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj),   SMS_TYPE_DIALOG_WINDOW, SmsDialogWindow))
+#define SMS_DIALOG_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass),   SMS_TYPE_DIALOG_WINDOW, SmsDialogWindowClass))
+#define SMS_IS_DIALOG_WINDOW(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj),   SMS_TYPE_DIALOG_WINDOW))
+#define SMS_IS_DIALOG_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass),   SMS_TYPE_DIALOG_WINDOW))
+#define SMS_DIALOG_WINDOW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj),   SMS_TYPE_DIALOG_WINDOW, SmsDialogWindowClass))
+
+typedef struct {
+    MokoWindow parent;
+} SmsDialogWindow;
+
+typedef struct {
+    MokoWindowClass parent_class;
+} SmsDialogWindowClass;
+
+GType sms_dialog_window_get_type();
+SmsDialogWindow* sms_dialog_window_new();
+
+void sms_dialog_window_set_title(SmsDialogWindow* self, const gchar* title);
+void mail_dialog_window_set_title(SmsDialogWindow* self, const gchar* title);
+void sms_dialog_window_set_contents(SmsDialogWindow* self, GtkWidget* contents);
+guint sms_dialog_window_run(SmsDialogWindow* self);
+
+G_END_DECLS
+
+#endif // _SMS_DIALOG_WINDOW_H_
\ No newline at end of file

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-membership-window.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-membership-window.c	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-membership-window.c	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,453 @@
+/*  sms-membership-window.c
+ *  Authored By Alex Tang <alex at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006 First International Company
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2.1 of the license.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Public License for more details.
+ *  
+ *  Current Version: $Rev$ ($Date: 2006/10/05 17:38:14 $) [$Author: alex $]
+ */
+ 
+#include "sms-membership-window.h"
+#include <libmokoui/moko-pixmap-button.h>
+#include <gtk/gtkeventbox.h>
+#include <gtk/gtkdialog.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtkviewport.h>
+
+#include <pango/pango-font.h>
+
+#include <glib/gmain.h>
+
+G_DEFINE_TYPE (SmsMembershipWindow, sms_membership_window, MOKO_TYPE_WINDOW)
+
+#define SMS_MEMBERSHIP_WINDOW_GET_PRIVATE(o)   (G_TYPE_INSTANCE_GET_PRIVATE ((o), SMS_TYPE_MEMBERSHIP_WINDOW, SmsMembershipWindowPrivate))
+
+typedef struct _SmsMembershipWindowPrivate SmsMembershipWindowPrivate;
+
+struct _SmsMembershipWindowPrivate
+{
+    GtkVBox* vbox;
+    GtkHBox* hbox;
+    GtkVBox* folderbox;
+    GtkEventBox* eventbox;
+    MokoMenuBox* menubox;
+    GtkLabel* titleLabel;
+    GtkLabel* fromLabel;
+    GtkLabel* subjectLabel;
+    GtkWidget* closebutton;
+    GtkTreeModelFilter* filter;
+    MokoTreeView* view;
+    GtkListStore* liststore;
+    gchar* currentfolder;
+    GSList* rdoBtnList;
+};
+
+typedef struct _SmsMembershipRunInfo
+{
+    SmsMembershipWindow *dialog;
+    gint response_id;
+    GMainLoop *loop;
+    gboolean destroyed;
+} SmsMembershipRunInfo;
+
+static void sms_membership_window_close(SmsMembershipWindow* self);
+
+static void
+shutdown_loop (SmsMembershipRunInfo *ri)
+{
+    if (g_main_loop_is_running (ri->loop))
+        g_main_loop_quit (ri->loop);
+}
+
+static void
+run_unmap_handler (SmsMembershipWindow* dialog, gpointer data)
+{
+    SmsMembershipRunInfo *ri = data;
+
+    shutdown_loop (ri);
+}
+
+static void
+run_response_handler (SmsMembershipWindow* dialog,
+                              gint response_id,
+                              gpointer data)
+{
+    SmsMembershipRunInfo *ri;
+
+    ri = data;
+
+    ri->response_id = response_id;
+
+    shutdown_loop (ri);
+}
+
+static gint
+        run_delete_handler (SmsMembershipWindow* dialog,
+                            GdkEventAny *event,
+                            gpointer data)
+{
+    SmsMembershipRunInfo *ri = data;
+
+    shutdown_loop (ri);
+
+    return TRUE; /* Do not destroy */
+}
+
+static void
+        run_destroy_handler (SmsMembershipWindow* dialog, gpointer data)
+{
+    SmsMembershipRunInfo *ri = data;
+
+    /* shutdown_loop will be called by run_unmap_handler */
+
+    ri->destroyed = TRUE;
+}
+
+
+static void
+sms_membership_window_dispose(GObject* object)
+{
+    if (G_OBJECT_CLASS (sms_membership_window_parent_class)->dispose)
+        G_OBJECT_CLASS (sms_membership_window_parent_class)->dispose (object);
+}
+
+static void
+sms_membership_window_finalize(GObject* object)
+{
+    G_OBJECT_CLASS (sms_membership_window_parent_class)->finalize (object);
+}
+
+sms_membership_window_class_init(SmsMembershipWindowClass* klass)
+{
+    GObjectClass* object_class = G_OBJECT_CLASS(klass);
+
+    g_type_class_add_private (klass, sizeof(SmsMembershipWindowPrivate));
+
+    object_class->dispose = sms_membership_window_dispose;
+    object_class->finalize = sms_membership_window_finalize;
+}
+
+SmsMembershipWindow*
+sms_membership_window_new(void)
+{
+    return g_object_new(SMS_TYPE_MEMBERSHIP_WINDOW, NULL);
+}
+
+static void sms_membership_window_close(SmsMembershipWindow* self)
+{
+    /* Synthesize delete_event to close dialog. */
+
+    GtkWidget *widget = GTK_WIDGET(self);
+    GdkEvent *event;
+
+    event = gdk_event_new( GDK_DELETE );
+
+    event->any.window = g_object_ref(widget->window);
+    event->any.send_event = TRUE;
+
+    gtk_main_do_event( event );
+    gdk_event_free( event );
+}
+
+gboolean membership_filter_changed(GtkWidget* widget, gchar* text, SmsMembershipWindow* self)
+{
+    g_debug("changed to %s folder",text);
+    SmsMembershipWindowPrivate* priv = SMS_MEMBERSHIP_WINDOW_GET_PRIVATE(self);
+    priv->currentfolder = g_strdup(text);
+    gtk_tree_model_filter_refilter (priv->filter);
+    
+    return FALSE;
+}
+
+void sms_membership_hide (GtkButton* closebutton,  SmsMembershipWindow* self)
+{
+	GtkWidget *widget = GTK_WIDGET(self);
+	gtk_widget_hide (widget);
+}
+
+void sms_membership_window_show (SmsMembershipWindow* self){
+	GtkWidget *widget = GTK_WIDGET(self);
+	gtk_widget_show (widget);
+}
+
+static void
+sms_membership_window_init(SmsMembershipWindow* self)
+{
+    MokoWindow* parent = moko_application_get_main_window( moko_application_get_instance() );
+    if ( parent )
+    {
+        gtk_window_set_transient_for( GTK_WINDOW(self), parent );
+#ifndef DEBUG_THIS_FILE
+        gtk_window_set_modal( GTK_WINDOW(self), TRUE );
+#endif
+        gtk_window_set_destroy_with_parent( GTK_WINDOW(self), TRUE );
+    }
+    
+    SmsMembershipWindowPrivate* priv = SMS_MEMBERSHIP_WINDOW_GET_PRIVATE(self);
+    priv->currentfolder = g_strdup("Inbox");
+    //Set title
+    priv->liststore = NULL;
+    priv->vbox = gtk_vbox_new( FALSE, 0 );
+    
+    priv->menubox = moko_menu_box_new();
+    gtk_box_pack_start( GTK_BOX(priv->vbox), GTK_WIDGET(priv->menubox), FALSE, FALSE, 0 );
+    
+    priv->titleLabel = gtk_label_new( "Message Membership" );
+    gtk_window_set_title( GTK_WINDOW(self), "Message Membership" );
+    gtk_widget_set_name( GTK_WIDGET(priv->titleLabel), "mokodialogwindow-title-label" );
+    priv->eventbox = gtk_event_box_new();
+    gtk_container_add( GTK_CONTAINER(priv->eventbox), GTK_WIDGET(priv->titleLabel) );
+    gtk_widget_set_name( GTK_WIDGET(priv->eventbox), "mokodialogwindow-title-labelbox" );
+    //FIXME get from theme
+    gtk_misc_set_padding( GTK_MISC(priv->titleLabel), 0, 6 );
+    gtk_widget_show( GTK_WIDGET(priv->titleLabel) );
+    gtk_widget_show( GTK_WIDGET(priv->eventbox) );
+    gtk_box_pack_start( GTK_BOX(priv->vbox), GTK_WIDGET(priv->eventbox), FALSE, FALSE, 0 );
+    priv->folderbox = gtk_vbox_new( FALSE, 0 );
+    //Set folder list
+    GtkHBox* closebox = gtk_hbox_new( FALSE, 0 );
+    PangoFontDescription* font_desc;
+		font_desc = pango_font_description_from_string ("bold 12");
+    priv->fromLabel = gtk_label_new( "AlexTang" );
+    gtk_widget_modify_font (priv->fromLabel, font_desc);
+    gtk_widget_set_size_request (priv->fromLabel, 250, -1);
+    gtk_misc_set_alignment (GTK_MISC(priv->fromLabel), 0, 0.5);
+    priv->subjectLabel = gtk_label_new( "Subject" );
+    gtk_widget_set_size_request (priv->subjectLabel, 250, -1);
+    gtk_misc_set_alignment (GTK_MISC(priv->subjectLabel), 0, 0.5);
+    //set header box: two labels and a closebutton
+    GtkVBox* headerbox = gtk_vbox_new( FALSE, 0 );
+    gtk_box_set_spacing (GTK_BOX(headerbox),5);
+    priv->closebutton = gtk_button_new_with_label ("Close");
+    gtk_widget_set_size_request (priv->closebutton, -1, 38);
+    GtkAlignment* alignment = GTK_ALIGNMENT(gtk_alignment_new (0.5, 0.5, 1, 1));
+    gtk_alignment_set_padding (alignment, 5, 5, 5, 5);
+    gtk_container_add (GTK_CONTAINER(alignment), priv->closebutton);
+    GtkWidget* hsep = gtk_hseparator_new();
+    gtk_widget_set_size_request (hsep, -1, 3);
+    //set folder box alignment fbAlign
+    GtkAlignment* fbAlign = GTK_ALIGNMENT(gtk_alignment_new (0.5, 0.5, 1, 1));
+    gtk_alignment_set_padding (fbAlign, 5, 5, 30, 30);
+    gtk_container_add( GTK_CONTAINER(fbAlign), GTK_WIDGET(priv->folderbox) );
+	  
+    gtk_box_pack_start( GTK_BOX(headerbox), GTK_WIDGET(priv->fromLabel), TRUE, TRUE, 0 );
+    gtk_box_pack_start( GTK_BOX(headerbox), GTK_WIDGET(priv->subjectLabel), TRUE, TRUE, 0 );
+    gtk_box_pack_start( GTK_BOX(closebox), GTK_WIDGET(headerbox), TRUE, FALSE, 0 );
+    gtk_box_pack_start( GTK_BOX(closebox), GTK_WIDGET(alignment), FALSE, FALSE, 0 );
+    gtk_box_pack_start( GTK_BOX(priv->folderbox), GTK_WIDGET(closebox), FALSE, FALSE, 0 );
+    gtk_box_pack_start( GTK_BOX(priv->folderbox), GTK_WIDGET(hsep), FALSE, FALSE, 0 );
+    gtk_box_pack_start( GTK_BOX(priv->vbox), GTK_WIDGET(fbAlign), FALSE, FALSE, 0 );
+    
+    gtk_widget_show_all( GTK_WIDGET(priv->vbox) );
+    gtk_container_add( GTK_CONTAINER(self), GTK_WIDGET(priv->vbox) );
+    g_signal_connect( G_OBJECT(priv->closebutton), "clicked", sms_membership_hide, self );
+    g_signal_connect( G_OBJECT(priv->menubox), "filter_changed", G_CALLBACK(membership_filter_changed), self );
+    
+}
+
+void membeship_rdo_btn_clicked ( GtkButton* button, SmsMembershipWindow* self)
+{
+	  g_debug (gtk_button_get_label(button));
+	  GtkTreeModel* model;
+    GtkTreeIter iter;
+    GtkTreeIter childiter;
+    GtkTreeSelection* selection;
+	  SmsMembershipWindowPrivate* priv = SMS_MEMBERSHIP_WINDOW_GET_PRIVATE(self);
+	  
+	  selection = gtk_tree_view_get_selection (priv->view);
+	  gboolean has_selection = gtk_tree_selection_get_selected (selection, &model,&iter);
+	  if (has_selection){
+	  	gchar* folder;
+	  	gtk_tree_model_get (model, &iter,
+		  	                  COLUMN_FOLDER, &folder,
+		                     -1);
+		  g_debug ("folder is %s",folder);
+		  gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(priv->filter),&childiter,&iter);
+	  	gtk_list_store_set(priv->liststore, &childiter,
+		  	                  COLUMN_FOLDER, gtk_button_get_label(button),
+		                     -1);
+		  g_debug (gtk_button_get_label(button));
+		  
+	  	gtk_tree_model_filter_refilter (priv->filter);
+	  }
+}
+
+void sms_membership_window_set_menubox(SmsMembershipWindow* self, GtkList* folderlist)
+{
+	  GtkWidget* appmenu;
+	  GtkWidget* filtmenu;
+	  
+	  SmsMembershipWindowPrivate* priv = SMS_MEMBERSHIP_WINDOW_GET_PRIVATE(self);
+	  
+	  /* application menu */
+    appmenu = NULL;
+    /*GtkMenuItem* mmitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Message Membership" ));
+    GtkMenuItem* fnitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Folder Rename" ));
+    GtkMenuItem* accountitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Account" ));
+    GtkMenuItem* helpitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Help" ));
+    GtkWidget* sepitem = gtk_separator_menu_item_new(); 
+    GtkMenuItem* closeitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Close" ));
+    gtk_menu_shell_append( GTK_MENU_SHELL(appmenu), GTK_WIDGET(mmitem) );
+    gtk_menu_shell_append( GTK_MENU_SHELL(appmenu), GTK_WIDGET(fnitem) );
+    gtk_menu_shell_append( GTK_MENU_SHELL(appmenu), GTK_WIDGET(accountitem) );
+    gtk_menu_shell_append( GTK_MENU_SHELL(appmenu), GTK_WIDGET(helpitem) );
+    gtk_menu_shell_append( GTK_MENU_SHELL(appmenu), GTK_WIDGET(sepitem) );
+    gtk_menu_shell_append( GTK_MENU_SHELL(appmenu), GTK_WIDGET(closeitem) );*/
+	  
+	  GtkVBox* rdobtnbox = gtk_vbox_new(FALSE, 0) ;
+	  GtkWidget *rdo_btn = NULL;
+    GSList *rdo_btn_group;
+    GSList* c = folderlist;
+    
+    filtmenu = GTK_MENU(gtk_menu_new());
+    for (; c; c = g_slist_next(c) ){
+    		//add folder to filter menu
+        gchar* folder = (gchar*) c->data;
+	      g_debug( "adding folder '%s'", folder );
+        gtk_menu_shell_append( GTK_MENU_SHELL( filtmenu ), gtk_menu_item_new_with_label( folder ) );
+        
+        //add folder to folder list
+        if(!g_strcasecmp(folder,"Inbox")){
+	         rdo_btn = gtk_radio_button_new_with_label (NULL, folder);
+	         rdo_btn_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rdo_btn));
+	         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rdo_btn), TRUE);
+        }
+	      else
+	         rdo_btn = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rdo_btn), folder);
+				priv->rdoBtnList = g_list_append (priv->rdoBtnList,rdo_btn);
+	      g_signal_connect    (G_OBJECT(rdo_btn), 
+	                                "released",
+			                            G_CALLBACK (membeship_rdo_btn_clicked),
+			                            self);
+	      gtk_box_pack_start (GTK_BOX (rdobtnbox), rdo_btn, FALSE, TRUE, 0);
+    }
+    //set radio button box alignment
+    GtkAlignment* alignment = GTK_ALIGNMENT(gtk_alignment_new (0.5, 0.5, 1, 1));
+    gtk_alignment_set_padding (alignment, 5, 5, 30, 5);
+    gtk_container_add( GTK_CONTAINER(alignment), GTK_WIDGET(rdobtnbox) );
+    gtk_box_pack_start (GTK_BOX (priv->folderbox), alignment, FALSE, TRUE, 0);
+    moko_menu_box_set_application_menu( priv->menubox, appmenu );
+	  moko_menu_box_set_filter_menu( priv->menubox, filtmenu );
+	  gtk_widget_show (priv->menubox);
+	  gtk_widget_show_all (priv->vbox);
+}
+
+void
+membership_cell_data_func (GtkTreeViewColumn *col,
+				GtkCellRenderer   *renderer,
+				GtkTreeModel      *model,
+				GtkTreeIter  	    *iter,
+				gpointer          user_data)
+{
+	gint status;
+	
+  gtk_tree_model_get(model, iter, COLUMN_STATUS, &status, -1);
+
+  if (status == UNREAD)
+      g_object_set(renderer, "weight", PANGO_WEIGHT_BOLD, "weight-set", TRUE, NULL);
+  else
+      g_object_set(renderer, "weight", PANGO_WEIGHT_BOLD, "weight-set", FALSE, NULL);
+}
+
+void membership_cursor_changed(GtkTreeSelection* selection, SmsMembershipWindow* self)
+{
+		SmsMembershipWindowPrivate* priv = SMS_MEMBERSHIP_WINDOW_GET_PRIVATE(self);
+		GtkTreeModel* model;
+    GtkTreeIter iter;
+    message* msg;
+    
+    if ( gtk_tree_selection_get_selected( selection, &model, &iter ) )
+    	{
+    		msg = g_malloc(sizeof(message));
+        gtk_tree_model_get( model, &iter, COLUMN_FROM, &msg->name, -1 );
+        gtk_tree_model_get( model, &iter, COLUMN_SUBJECT, &msg->subject, -1 );
+        gtk_tree_model_get( model, &iter, COLUMN_FOLDER, &msg->folder, -1 );
+        gtk_tree_model_get( model, &iter, COLUMN_STATUS, &msg->status, -1);
+        
+        gtk_label_set_text (priv->fromLabel, msg->name);
+        gtk_label_set_text (priv->subjectLabel, msg->subject);
+        g_debug ("radio list length: %d",g_slist_length(priv->rdoBtnList));
+        GSList* c;
+		    GtkWidget *elem;
+		
+		    for( c =priv->rdoBtnList; c; c=g_slist_next(c))
+		    {
+			    elem = c->data;
+			    if (!g_strcasecmp (msg->folder,gtk_button_get_label(GTK_BUTTON(elem)))){
+			    	gtk_toggle_button_set_active (elem, TRUE);
+			    	break;
+			    }
+				}
+      }
+}
+
+gboolean membership_filter_visible_function (GtkTreeModel* model, GtkTreeIter* iter, SmsMembershipWindow* self)
+{
+	  gchar* folder;
+	  SmsMembershipWindowPrivate* priv = SMS_MEMBERSHIP_WINDOW_GET_PRIVATE(self);
+	  gtk_tree_model_get (model, iter, COLUMN_FOLDER, &folder, -1);
+	  if(!g_strcasecmp(folder,priv->currentfolder))
+	  	return TRUE;
+    else return FALSE;
+}
+
+void sms_membership_window_set_messages (SmsMembershipWindow* self, GtkListStore* liststore)
+{
+	  GtkCellRenderer* ren;
+    GtkTreeViewColumn* column = gtk_tree_view_column_new();
+	  gtk_tree_view_column_set_title(column, "From");
+	  
+	  SmsMembershipWindowPrivate* priv = SMS_MEMBERSHIP_WINDOW_GET_PRIVATE(self);
+	  priv->liststore = liststore;
+	  priv->filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (priv->liststore),NULL);
+	  priv->view = MOKO_TREE_VIEW( moko_tree_view_new_with_model( GTK_TREE_MODEL (priv->filter)) ); 
+	  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (priv->filter),
+    																				membership_filter_visible_function,
+    																				self,
+    																				NULL);
+    /* Add status picture */
+    ren = gtk_cell_renderer_pixbuf_new();
+    gtk_tree_view_column_pack_start(column, ren, FALSE);
+	  gtk_tree_view_column_set_attributes(column, ren,
+										  "pixbuf", COLUMN_ICON,
+										  NULL);
+		/* add message from name */
+    ren = gtk_cell_renderer_text_new();
+    gtk_tree_view_column_pack_start(column, ren, TRUE);
+		gtk_tree_view_column_set_attributes(column, ren,
+						  "text", COLUMN_FROM,
+						  NULL);
+		/* Bold if UNREAD */
+		gtk_tree_view_column_set_cell_data_func (column, ren, membership_cell_data_func, liststore, NULL);
+    moko_tree_view_append_column( priv->view, column );
+
+    ren = gtk_cell_renderer_text_new();
+    column = gtk_tree_view_column_new();
+		gtk_tree_view_column_set_title(column, "Subject");
+		gtk_tree_view_column_pack_start(column, ren, TRUE);
+		gtk_tree_view_column_set_attributes(column, ren,
+						  "text", COLUMN_SUBJECT,
+						  NULL);
+    gtk_tree_view_column_set_cell_data_func (column, ren, membership_cell_data_func, priv->liststore, NULL);
+    moko_tree_view_append_column( priv->view, column );
+    
+    GtkWidget* treeViewAlign = gtk_alignment_new (0.5, 0.5, 1, 1);
+		gtk_alignment_set_padding (GTK_ALIGNMENT(treeViewAlign),10,10,10,10);
+		gtk_container_add (GTK_CONTAINER(treeViewAlign),GTK_WIDGET(moko_tree_view_put_into_scrolled_window(priv->view)));
+    gtk_box_pack_start (GTK_BOX (priv->vbox), GTK_WIDGET(treeViewAlign), TRUE, TRUE, 0);
+	  gtk_widget_show_all (priv->vbox);
+	  
+	  GtkTreeSelection* selection = gtk_tree_view_get_selection( priv->view );
+    g_signal_connect( G_OBJECT(selection), "changed", G_CALLBACK(membership_cursor_changed), self);
+}
+

Added: trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-membership-window.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-membership-window.h	2007-02-06 01:13:36 UTC (rev 685)
+++ trunk/src/target/OM-2007/applications/openmoko-messenger/src/sms-membership-window.h	2007-02-06 01:16:35 UTC (rev 686)
@@ -0,0 +1,60 @@
+/*  sms-membership-window.h
+ *  Authored By Alex Tang <alex at fic-sh.com.cn>
+ *
+ *  Copyright (C) 2006 First International Company
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Public License as published by
+ *  the Free Software Foundation; version 2.1 of the license.
+ *  
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Public License for more details.
+ *  
+ *  Current Version: $Rev$ ($Date: 2006/10/05 17:38:14 $) [$Author: alex $]
+ */
+ 
+#ifndef _SMS_MEMBERSHIP_WINDOW_H_
+#define _SMS_MEMBERSHIP_WINDOW_H_
+
+#include <libmokoui/moko-window.h>
+#include <libmokoui/moko-menu-box.h>
+#include <libmokoui/moko-tree-view.h>
+#include <gtk/gtklist.h>
+#include <gtk/gtkliststore.h>
+#include <gtk/gtkradiobutton.h>
+#include <gtk/gtktogglebutton.h>
+
+#include "main.h"
+#include "message.h"
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define SMS_TYPE_MEMBERSHIP_WINDOW sms_membership_window_get_type()
+#define SMS_MEMBERSHIP_WINDOW(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj),   SMS_TYPE_MEMBERSHIP_WINDOW, SmsMembershipWindow))
+#define SMS_MEMBERSHIP_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass),   SMS_TYPE_MEMBERSHIP_WINDOW, SmsMembershipWindowClass))
+#define SMS_IS_MEMBERSHIP_WINDOW(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj),   SMS_TYPE_MEMBERSHIP_WINDOW))
+#define SMS_IS_MEMBERSHIP_WINDOW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass),   SMS_TYPE_MEMBERSHIP_WINDOW))
+#define SMS_MEMBERSHIP_WINDOW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj),   SMS_TYPE_MEMBERSHIP_WINDOW, SmsMembershipWindowClass))
+
+typedef struct {
+    MokoWindow parent;
+} SmsMembershipWindow;
+
+typedef struct {
+    MokoWindowClass parent_class;
+} SmsMembershipWindowClass;
+
+GType sms_membership_window_get_type();
+SmsMembershipWindow* sms_membership_window_new();
+
+void sms_membership_window_set_menubox(SmsMembershipWindow* self, GtkList* folderlist);
+void sms_membership_window_set_messages (SmsMembershipWindow* self, GtkListStore* liststore);
+void sms_membership_window_show (SmsMembershipWindow* self);
+guint sms_membership_window_run(SmsMembershipWindow* self);
+
+G_END_DECLS
+
+#endif // _SMS_MEMBERSHIP_WINDOW_H_
+ 
\ No newline at end of file





More information about the commitlog mailing list