Send commitlog mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r1629 - trunk/src/target/kernel/patches
      ([EMAIL PROTECTED])
   2. r1630 - trunk/src/target/kernel/patches
      ([EMAIL PROTECTED])
   3. r1631 - in trunk/src/target/OM-2007: . applications
      applications/openmoko-footer applications/openmoko-messages
      applications/openmoko-rssreader applications/openmoko-today
      devel/qmake inputmethods/openmoko-keyboard ([EMAIL PROTECTED])
   4. r1632 - in trunk/src/target/OM-2007/applications: .
      openmoko-calculator openmoko-calculator/data
      openmoko-calculator/po openmoko-calculator/src
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: laforge
Date: 2007-04-02 19:34:25 +0200 (Mon, 02 Apr 2007)
New Revision: 1629

Modified:
   trunk/src/target/kernel/patches/gta01-pcf50606.patch
Log:
* resolve mutex deadlock in suspend path
* disable interrupt until we've been scheduled to serve last one
* make sure we cannot disable IOREG, since that powers PCF50606 I2C interface


Modified: trunk/src/target/kernel/patches/gta01-pcf50606.patch
===================================================================
--- trunk/src/target/kernel/patches/gta01-pcf50606.patch        2007-04-02 
16:46:49 UTC (rev 1628)
+++ trunk/src/target/kernel/patches/gta01-pcf50606.patch        2007-04-02 
17:34:25 UTC (rev 1629)
@@ -3,8 +3,8 @@
 Index: linux-2.6.20.4/drivers/i2c/chips/pcf50606.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.20.4/drivers/i2c/chips/pcf50606.c        2007-04-01 
13:09:02.000000000 +0200
-@@ -0,0 +1,1896 @@
++++ linux-2.6.20.4/drivers/i2c/chips/pcf50606.c        2007-04-02 
19:12:27.000000000 +0200
+@@ -0,0 +1,1921 @@
 +/* Philips PCF50606 Power Management Unit (PMU) driver
 + *
 + * (C) 2006 by OpenMoko, Inc.
@@ -106,6 +106,7 @@
 +      struct input_dev *input_dev;
 +      int allow_close;
 +      int onkey_seconds;
++      int irq;
 +#ifdef CONFIG_PM
 +      struct {
 +              u_int8_t dcdc1, dcdc2;
@@ -371,6 +372,10 @@
 +      if (reg >= __NUM_PCF50606_REGULATORS)
 +              return -EINVAL;
 +
++      /* IOREG cannot be powered off since it powers the PMU I2C */
++      if (reg == PCF50606_REGULATOR_IOREG)
++              return -EIO;
++
 +      addr = regulator_registers[reg];
 +
 +      if (on == 0)
@@ -731,6 +736,8 @@
 +      pcf->working = 0;
 +      input_sync(pcf->input_dev);
 +      put_device(&pcf->client.dev);
++
++      enable_irq(pcf->irq);
 +}
 +
 +static void pcf50606_schedule_work(struct pcf50606_data *pcf)
@@ -752,6 +759,10 @@
 +              irq, _pcf);
 +      pcf50606_schedule_work(pcf);
 +
++      /* Disable any further interrupts until we have processed
++       * the current one */
++      disable_irq(irq);
++
 +      return IRQ_HANDLED;
 +}
 +
@@ -1576,6 +1587,7 @@
 +
 +      mutex_init(&data->lock);
 +      INIT_WORK(&data->work, pcf50606_work);
++      data->irq = irq;
 +      data->working = 0;
 +      data->onkey_seconds = -1;
 +      data->pdata = pcf50606_pdev->dev.platform_data;
@@ -1792,8 +1804,21 @@
 +
 +      /* switch off power supplies that are not needed during suspend */
 +      for (i = 0; i < __NUM_PCF50606_REGULATORS; i++) {
-+              if (!(pcf->pdata->rails[i].flags & PMU_VRAIL_F_SUSPEND_ON))
-+                      pcf50606_onoff_set(pcf, i, 0);
++              if (!(pcf->pdata->rails[i].flags & PMU_VRAIL_F_SUSPEND_ON)) {
++                      u_int8_t tmp;
++
++                      /* IOREG powers the [EMAIL PROTECTED] interface so we 
cannot switch
++                       * it off */
++                      if (i == PCF50606_REGULATOR_IOREG)
++                              continue;
++
++                      DEBUGP("disabling pcf50606 regulator %u\n", i);
++                      /* we cannot use pcf50606_onoff_set() because we're
++                       * already under the mutex */
++                      tmp = __reg_read(pcf, regulator_registers[i]);
++                      tmp &= 0x1f;
++                      __reg_write(pcf, regulator_registers[i], tmp);
++              }
 +      }
 +
 +      pcf->standby_regs.int1m = __reg_read(pcf, PCF50606_REG_INT1M);




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-04-02 19:34:57 +0200 (Mon, 02 Apr 2007)
New Revision: 1630

Modified:
   trunk/src/target/kernel/patches/gta01-core.patch
Log:
* Ask PCF50606 to not disable CORE_1V8.  The PMU will do this as final step in 
hardware


Modified: trunk/src/target/kernel/patches/gta01-core.patch
===================================================================
--- trunk/src/target/kernel/patches/gta01-core.patch    2007-04-02 17:34:25 UTC 
(rev 1629)
+++ trunk/src/target/kernel/patches/gta01-core.patch    2007-04-02 17:34:57 UTC 
(rev 1630)
@@ -4,7 +4,7 @@
 Index: linux-2.6.20.4/arch/arm/mach-s3c2410/Kconfig
 ===================================================================
 --- linux-2.6.20.4.orig/arch/arm/mach-s3c2410/Kconfig  2007-04-01 
10:27:56.000000000 +0200
-+++ linux-2.6.20.4/arch/arm/mach-s3c2410/Kconfig       2007-04-01 
12:33:02.000000000 +0200
++++ linux-2.6.20.4/arch/arm/mach-s3c2410/Kconfig       2007-04-02 
17:07:44.000000000 +0200
 @@ -86,6 +86,14 @@
        help
           Say Y here if you are using the Armzone QT2410
@@ -23,7 +23,7 @@
 Index: linux-2.6.20.4/arch/arm/mach-s3c2410/Makefile
 ===================================================================
 --- linux-2.6.20.4.orig/arch/arm/mach-s3c2410/Makefile 2007-04-01 
10:27:56.000000000 +0200
-+++ linux-2.6.20.4/arch/arm/mach-s3c2410/Makefile      2007-04-01 
12:33:01.000000000 +0200
++++ linux-2.6.20.4/arch/arm/mach-s3c2410/Makefile      2007-04-02 
17:07:42.000000000 +0200
 @@ -89,5 +89,6 @@
  obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o
  obj-$(CONFIG_MACH_VSTMS)      += mach-vstms.o
@@ -34,8 +34,8 @@
 Index: linux-2.6.20.4/arch/arm/mach-s3c2410/mach-gta01.c
 ===================================================================
 --- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.20.4/arch/arm/mach-s3c2410/mach-gta01.c  2007-04-01 
12:36:42.000000000 +0200
-@@ -0,0 +1,706 @@
++++ linux-2.6.20.4/arch/arm/mach-s3c2410/mach-gta01.c  2007-04-02 
17:08:27.000000000 +0200
+@@ -0,0 +1,707 @@
 +/*
 + * linux/arch/arm/mach-s3c2410/mach-gta01.c
 + *
@@ -218,6 +218,7 @@
 +              },
 +              [PCF50606_REGULATOR_DCUD] = {
 +                      .name           = "core_1v8",
++                      .flags          = PMU_VRAIL_F_SUSPEND_ON,
 +                      .voltage        = {
 +                              .init   = 2100,
 +                              .max    = 2100,




--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-04-02 19:49:52 +0200 (Mon, 02 Apr 2007)
New Revision: 1631

Added:
   
trunk/src/target/OM-2007/applications/openmoko-rssreader/openmoko-rssreader.pro
   trunk/src/target/OM-2007/applications/openmoko-today/openmoko-today.pro
Modified:
   trunk/src/target/OM-2007/OM-2007.pro
   trunk/src/target/OM-2007/applications/applications.pro
   trunk/src/target/OM-2007/applications/openmoko-footer/openmoko-footer.pro
   trunk/src/target/OM-2007/applications/openmoko-messages/openmoko-messages.pro
   trunk/src/target/OM-2007/devel/qmake/openmoko-include.pro
   trunk/src/target/OM-2007/inputmethods/openmoko-keyboard/openmoko-keyboard.pro
Log:
update .pro file

Modified: trunk/src/target/OM-2007/OM-2007.pro
===================================================================
--- trunk/src/target/OM-2007/OM-2007.pro        2007-04-02 17:34:57 UTC (rev 
1630)
+++ trunk/src/target/OM-2007/OM-2007.pro        2007-04-02 17:49:52 UTC (rev 
1631)
@@ -1,3 +1,3 @@
 TEMPLATE = subdirs
-SUBDIRS = openmoko-libs examples applications panel-plugins daemons
+SUBDIRS = openmoko-libs examples inputmethods applications panel-plugins 
daemons
 

Modified: trunk/src/target/OM-2007/applications/applications.pro
===================================================================
--- trunk/src/target/OM-2007/applications/applications.pro      2007-04-02 
17:34:57 UTC (rev 1630)
+++ trunk/src/target/OM-2007/applications/applications.pro      2007-04-02 
17:49:52 UTC (rev 1631)
@@ -5,5 +5,6 @@
   openmoko-contacts \
   openmoko-dialer \
   openmoko-footer \
-  openmoko-messages
-
+  openmoko-messages \
+  openmoko-rssreader \
+  openmoko-today "

Modified: 
trunk/src/target/OM-2007/applications/openmoko-footer/openmoko-footer.pro
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-footer/openmoko-footer.pro   
2007-04-02 17:34:57 UTC (rev 1630)
+++ trunk/src/target/OM-2007/applications/openmoko-footer/openmoko-footer.pro   
2007-04-02 17:49:52 UTC (rev 1631)
@@ -9,6 +9,6 @@
 SERVICES = services.xml
 DEFINES += DBUS_API_SUBJECT_TO_CHANGE
 
-#MOKOCONFIG = mokoui
+MOKOCONFIG = mokoui
 include ( $(OPENMOKODIR)/devel/qmake/openmoko-include.pro )
 

Modified: 
trunk/src/target/OM-2007/applications/openmoko-messages/openmoko-messages.pro
===================================================================
--- 
trunk/src/target/OM-2007/applications/openmoko-messages/openmoko-messages.pro   
    2007-04-02 17:34:57 UTC (rev 1630)
+++ 
trunk/src/target/OM-2007/applications/openmoko-messages/openmoko-messages.pro   
    2007-04-02 17:49:52 UTC (rev 1631)
@@ -1,3 +1,8 @@
+TEMPLATE = app
+DEPENDPATH += src
+INCLUDEPATH += . src
+
+# Input
 HEADERS += src/callbacks.h \
            src/detail-area.h \
            src/foldersdb.h \
@@ -3,14 +8,17 @@
            src/main.h \
            src/message.h \
+           src/sms-contact-window.h \
            src/sms-dialog-window.h \
            src/sms-membership-window.h
-
 SOURCES += src/callbacks.c \
            src/detail-area.c \
            src/foldersdb.c \
            src/main.c \
+           src/sms-contact-window.c \
            src/sms-dialog-window.c \
            src/sms-membership-window.c
 
 MOKOCONFIG = mokoui
+PKGCONFIG += dbus-glib-1 libebook-1.2
 include ( $(OPENMOKODIR)/devel/qmake/openmoko-include.pro )
+

Added: 
trunk/src/target/OM-2007/applications/openmoko-rssreader/openmoko-rssreader.pro
===================================================================
--- 
trunk/src/target/OM-2007/applications/openmoko-rssreader/openmoko-rssreader.pro 
    2007-04-02 17:34:57 UTC (rev 1630)
+++ 
trunk/src/target/OM-2007/applications/openmoko-rssreader/openmoko-rssreader.pro 
    2007-04-02 17:49:52 UTC (rev 1631)
@@ -0,0 +1,17 @@
+######################################################################
+# Automatically generated by qmake (1.07a) Mon Apr 2 17:24:17 2007
+######################################################################
+
+TEMPLATE = app
+DEPENDPATH += src
+INCLUDEPATH += . src
+
+# Input
+HEADERS += src/application-data.h src/callbacks.h src/rfcdate.h
+SOURCES += src/callbacks.c src/main.c src/rfcdate.c
+
+MOKOCONFIG = mokoui
+PKGCONFIG += mrss gthread-2.0
+DEFINES += RSSREADER_LOCALE_DIR=\\\"/tmp/\\\"
+include ( $(OPENMOKODIR)/devel/qmake/openmoko-include.pro )
+

Added: trunk/src/target/OM-2007/applications/openmoko-today/openmoko-today.pro
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-today/openmoko-today.pro     
2007-04-02 17:34:57 UTC (rev 1630)
+++ trunk/src/target/OM-2007/applications/openmoko-today/openmoko-today.pro     
2007-04-02 17:49:52 UTC (rev 1631)
@@ -0,0 +1,20 @@
+######################################################################
+# Automatically generated by qmake (1.07a) Mon Apr 2 17:42:14 2007
+######################################################################
+
+TEMPLATE = app
+DEPENDPATH += src tests
+INCLUDEPATH += . src
+
+# Input
+HEADERS += src/today-events-area.h src/today-utils.h src/xutil.h
+SOURCES += src/today-events-area.c \
+           src/today-main.c \
+           src/today-utils.c \
+           src/xutil.c
+
+MOKOCONFIG = mokoui
+PKGCONFIG += libebook-1.2 libecal-1.2
+DEFINES += RSSREADER_LOCALE_DIR=\\\"/tmp/\\\"
+include ( $(OPENMOKODIR)/devel/qmake/openmoko-include.pro )
+

Modified: trunk/src/target/OM-2007/devel/qmake/openmoko-include.pro
===================================================================
--- trunk/src/target/OM-2007/devel/qmake/openmoko-include.pro   2007-04-02 
17:34:57 UTC (rev 1630)
+++ trunk/src/target/OM-2007/devel/qmake/openmoko-include.pro   2007-04-02 
17:49:52 UTC (rev 1631)
@@ -1,6 +1,14 @@
+#
+# Don't use this if your nickname is not mickeyl
+#
+
+
 CONFIG = debug warn_on link_pkgconfig console $$MOKOCONFIG
 PREFIX = /usr/local
 
+INCLUDEPATH += $(ADD_INCLUDE)
+LIBS += $(ADD_LIB)
+
 QMAKE_LINK              = gcc
 QMAKE_LINK_SHLIB        = gcc
 QMAKE_RPATH             =
@@ -89,3 +97,4 @@
 
 
 DEFINES += G_LOG_DOMAIN=\\\"$$TARGET\\\"
+DEFINES += GETTEXT_PACKAGE=\\\"$$TARGET\\\"

Modified: 
trunk/src/target/OM-2007/inputmethods/openmoko-keyboard/openmoko-keyboard.pro
===================================================================
--- 
trunk/src/target/OM-2007/inputmethods/openmoko-keyboard/openmoko-keyboard.pro   
    2007-04-02 17:34:57 UTC (rev 1630)
+++ 
trunk/src/target/OM-2007/inputmethods/openmoko-keyboard/openmoko-keyboard.pro   
    2007-04-02 17:49:52 UTC (rev 1631)
@@ -1,6 +1,8 @@
 MOKOCONFIG = mokoui
-PKGCONFIG += libfakekey
-DEFINES += FOO -UWANT_CAIRO
+PKGCONFIG += libfakekey expat
+QMAKE_CFLAGS += -UWANT_CAIRO -UHAVE_ALLOCA
+LIBS += -lexpat -lXft
+DEFINES += VERSION=1
 TEMPLATE = app
 DEPENDPATH += src examples
 INCLUDEPATH += . src
@@ -16,13 +18,11 @@
            src/matchbox-keyboard-key.c \
            src/matchbox-keyboard-layout.c \
            src/matchbox-keyboard-row.c \
-           src/matchbox-keyboard-ui-cairo-backend.c \
            src/matchbox-keyboard-ui-xft-backend.c \
            src/matchbox-keyboard-ui.c \
            src/matchbox-keyboard-xembed.c \
            src/matchbox-keyboard.c \
            src/util-list.c \
-           src/util.c \
-           examples/matchbox-keyboard-gtk-embed.c
+           src/util.c
 
 include ( $(OPENMOKODIR)/devel/qmake/openmoko-include.pro )




--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-04-02 20:54:48 +0200 (Mon, 02 Apr 2007)
New Revision: 1632

Added:
   trunk/src/target/OM-2007/applications/openmoko-calculator/
   trunk/src/target/OM-2007/applications/openmoko-calculator/AUTHORS
   trunk/src/target/OM-2007/applications/openmoko-calculator/Makefile.am
   trunk/src/target/OM-2007/applications/openmoko-calculator/README
   trunk/src/target/OM-2007/applications/openmoko-calculator/configure.ac
   trunk/src/target/OM-2007/applications/openmoko-calculator/data/
   trunk/src/target/OM-2007/applications/openmoko-calculator/data/Makefile.am
   
trunk/src/target/OM-2007/applications/openmoko-calculator/data/openmoko-calculator.desktop
   
trunk/src/target/OM-2007/applications/openmoko-calculator/data/openmoko-calculator.png
   
trunk/src/target/OM-2007/applications/openmoko-calculator/openmoko-calculator.pro
   trunk/src/target/OM-2007/applications/openmoko-calculator/po/
   trunk/src/target/OM-2007/applications/openmoko-calculator/po/Calculator.pot
   trunk/src/target/OM-2007/applications/openmoko-calculator/po/Makefile.in.in
   trunk/src/target/OM-2007/applications/openmoko-calculator/po/fr.po
   trunk/src/target/OM-2007/applications/openmoko-calculator/src/
   trunk/src/target/OM-2007/applications/openmoko-calculator/src/Makefile.am
   trunk/src/target/OM-2007/applications/openmoko-calculator/src/calc-main.c
   trunk/src/target/OM-2007/applications/openmoko-calculator/src/calc-main.h
Log:
initial import of openmoko-calculator 0.0.3 courtesy Rodolphe Ortalo <[EMAIL 
PROTECTED]>


Added: trunk/src/target/OM-2007/applications/openmoko-calculator/AUTHORS
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-calculator/AUTHORS   
2007-04-02 17:49:52 UTC (rev 1631)
+++ trunk/src/target/OM-2007/applications/openmoko-calculator/AUTHORS   
2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,3 @@
+Rodolphe Ortalo <[EMAIL PROTECTED]>
+Michael 'Mickey' Lauer <[EMAIL PROTECTED]>
+Tony Guan <[EMAIL PROTECTED]>

Added: trunk/src/target/OM-2007/applications/openmoko-calculator/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-calculator/Makefile.am       
2007-04-02 17:49:52 UTC (rev 1631)
+++ trunk/src/target/OM-2007/applications/openmoko-calculator/Makefile.am       
2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,2 @@
+AUTOMAKE_OPTIONS=foreign
+SUBDIRS = src data po
\ No newline at end of file

Added: trunk/src/target/OM-2007/applications/openmoko-calculator/README
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-calculator/README    
2007-04-02 17:49:52 UTC (rev 1631)
+++ trunk/src/target/OM-2007/applications/openmoko-calculator/README    
2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,11 @@
+Simple calculator, started based on the OpenMoko Finger Application
+example and the OpenMoko regular dialer UI, in the hope that it would
+be useful.
+
+Notes:
+ * Pango markup is used currently to manage font size for the display
+of for button labels, maybe styles would be more appropriate.
+
+Thanks for your attention,
+
+Rodolphe <[EMAIL PROTECTED]>

Added: trunk/src/target/OM-2007/applications/openmoko-calculator/configure.ac
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-calculator/configure.ac      
2007-04-02 17:49:52 UTC (rev 1631)
+++ trunk/src/target/OM-2007/applications/openmoko-calculator/configure.ac      
2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,32 @@
+AC_PREREQ(2.53)
+AC_INIT(openmoko-calculator, 0.0.3, [EMAIL PROTECTED])
+AM_INIT_AUTOMAKE()
+AC_CONFIG_SRCDIR(src/calc-main.c)
+AM_CONFIG_HEADER(config.h)
+AM_MAINTAINER_MODE
+
+AC_ISC_POSIX
+AC_PROG_CC
+AC_STDC_HEADERS
+AC_PROG_LIBTOOL
+
+dnl i18n support
+GETTEXT_PACKAGE=Calculator
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package])
+AC_SUBST(GETTEXT_PACKAGE)
+ALL_LINGUAS="fr"
+AM_GLIB_GNU_GETTEXT
+
+# 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 $OPENMOKO_LIBS"
+CFLAGS="$CFLAGS $OPENMOKO_CFLAGS"
+
+# output stuff
+AC_OUTPUT([
+Makefile
+src/Makefile
+po/Makefile.in
+data/Makefile
+])

Added: 
trunk/src/target/OM-2007/applications/openmoko-calculator/data/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-calculator/data/Makefile.am  
2007-04-02 17:49:52 UTC (rev 1631)
+++ trunk/src/target/OM-2007/applications/openmoko-calculator/data/Makefile.am  
2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,17 @@
+#
+# misc. data files
+#
+# None yet
+# dist_pkgdata_DATA = 
+
+#
+# desktop integration: .desktop file
+#
+desktopdir = $(datadir)/applications
+dist_desktop_DATA = openmoko-calculator.desktop
+
+#
+# desktop integration: application icon
+#
+appicondir = $(datadir)/icons
+dist_appicon_DATA = openmoko-calculator.png

Added: 
trunk/src/target/OM-2007/applications/openmoko-calculator/data/openmoko-calculator.desktop
===================================================================
--- 
trunk/src/target/OM-2007/applications/openmoko-calculator/data/openmoko-calculator.desktop
  2007-04-02 17:49:52 UTC (rev 1631)
+++ 
trunk/src/target/OM-2007/applications/openmoko-calculator/data/openmoko-calculator.desktop
  2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=OpenMoko Calculator
+Comment=Simple finger calculator
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Exec=openmoko-calculator
+Icon=openmoko-calculator.png
+Terminal=false
+SingleInstance=true
+StartupNotify=true

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


Property changes on: 
trunk/src/target/OM-2007/applications/openmoko-calculator/data/openmoko-calculator.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Added: 
trunk/src/target/OM-2007/applications/openmoko-calculator/openmoko-calculator.pro
===================================================================
--- 
trunk/src/target/OM-2007/applications/openmoko-calculator/openmoko-calculator.pro
   2007-04-02 17:49:52 UTC (rev 1631)
+++ 
trunk/src/target/OM-2007/applications/openmoko-calculator/openmoko-calculator.pro
   2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,10 @@
+TEMPLATE = app
+DEPENDPATH += src
+INCLUDEPATH += . src
+
+# Input
+HEADERS += src/calc-main.h
+SOURCES += src/calc-main.c
+
+MOKOCONFIG = mokoui
+include ( $(OPENMOKODIR)/devel/qmake/openmoko-include.pro )

Added: 
trunk/src/target/OM-2007/applications/openmoko-calculator/po/Calculator.pot
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-calculator/po/Calculator.pot 
2007-04-02 17:49:52 UTC (rev 1631)
+++ trunk/src/target/OM-2007/applications/openmoko-calculator/po/Calculator.pot 
2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,39 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <[EMAIL PROTECTED]>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-03-24 13:52+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <[EMAIL PROTECTED]>\n"
+"Language-Team: LANGUAGE <[EMAIL PROTECTED]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/calc-main.c:87
+msgid "Clear All"
+msgstr ""
+
+#: src/calc-main.c:87
+msgid "Clear"
+msgstr ""
+
+#: src/calc-main.c:91
+msgid "<big><b>.</b></big>"
+msgstr ""
+
+#. application object
+#. MokoApplication* app = MOKO_APPLICATION(moko_application_get_instance());
+#: src/calc-main.c:349
+msgid "Calculator"
+msgstr ""
+
+#: src/calc-main.c:356
+msgid "Close"
+msgstr ""

Added: 
trunk/src/target/OM-2007/applications/openmoko-calculator/po/Makefile.in.in
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-calculator/po/Makefile.in.in 
2007-04-02 17:49:52 UTC (rev 1631)
+++ trunk/src/target/OM-2007/applications/openmoko-calculator/po/Makefile.in.in 
2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,269 @@
+# Makefile for program source directory in GNU NLS utilities package.
+# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <[EMAIL PROTECTED]>
+#
+# This file file be copied and used freely without restrictions.  It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+#
+# - Modified by Owen Taylor <[EMAIL PROTECTED]> to use GETTEXT_PACKAGE
+#   instead of PACKAGE and to look for po2tbl in ./ not in intl/
+#
+# - Modified by jacob berkman <[EMAIL PROTECTED]> to install
+#   Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
+
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+
+SHELL = /bin/sh
[EMAIL PROTECTED]@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+datadir = @datadir@
+libdir = @libdir@
+localedir = $(libdir)/locale
+gnulocaledir = $(datadir)/locale
+gettextsrcdir = $(datadir)/glib-2.0/gettext/po
+subdir = po
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
+
+CC = @CC@
+GENCAT = @GENCAT@
+GMSGFMT = @GMSGFMT@
+MSGFMT = @MSGFMT@
+XGETTEXT = @XGETTEXT@
+MSGMERGE = msgmerge
+
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+
+INCLUDES = -I.. -I$(top_srcdir)/intl
+
+COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
+
+SOURCES = 
+POFILES = @POFILES@
+GMOFILES = @GMOFILES@
+DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
+$(POFILES) $(GMOFILES) $(SOURCES)
+
+POTFILES = \
+
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+INSTOBJEXT = @INSTOBJEXT@
+
+.SUFFIXES:
+.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
+
+.c.o:
+       $(COMPILE) $<
+
+.po.pox:
+       $(MAKE) $(GETTEXT_PACKAGE).pot
+       $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
+
+.po.mo:
+       $(MSGFMT) -o $@ $<
+
+.po.gmo:
+       file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
+         && rm -f $$file && $(GMSGFMT) -c -o $$file $<
+
+.po.cat:
+       sed -f ../intl/po2msg.sed < $< > $*.msg \
+         && rm -f $@ && $(GENCAT) $@ $*.msg
+
+
+all: [EMAIL PROTECTED]@
+
+all-yes: $(CATALOGS)
+all-no:
+
+$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
+       $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) 
--directory=$(top_srcdir) \
+         --add-comments --keyword=_ --keyword=N_ \
+          --flag=g_strdup_printf:1:c-format \
+          --flag=g_string_printf:2:c-format \
+          --flag=g_string_append_printf:2:c-format \
+          --flag=g_error_new:3:c-format \
+          --flag=g_set_error:4:c-format \
+          --flag=g_markup_printf_escaped:1:c-format \
+          --flag=g_log:3:c-format \
+          --flag=g_print:1:c-format \
+          --flag=g_printerr:1:c-format \
+          --flag=g_printf:1:c-format \
+          --flag=g_fprintf:2:c-format \
+          --flag=g_sprintf:2:c-format \
+          --flag=g_snprintf:3:c-format \
+          --flag=g_scanner_error:2:c-format \
+          --flag=g_scanner_warn:2:c-format \
+         --files-from=$(srcdir)/POTFILES.in \
+       && test ! -f $(GETTEXT_PACKAGE).po \
+          || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
+               && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
+
+install: install-exec install-data
+install-exec:
+install-data: [EMAIL PROTECTED]@
+install-data-no: all
+install-data-yes: all
+       if test -r "$(MKINSTALLDIRS)"; then \
+         $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
+       else \
+         $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
+       fi
+       @catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         case "$$cat" in \
+           *.gmo) destdir=$(gnulocaledir);; \
+           *)     destdir=$(localedir);; \
+         esac; \
+         lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+         dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
+         if test -r "$(MKINSTALLDIRS)"; then \
+           $(MKINSTALLDIRS) $$dir; \
+         else \
+           $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
+         fi; \
+         if test -r $$cat; then \
+           $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+           echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
+         else \
+           $(INSTALL_DATA) $(srcdir)/$$cat 
$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+           echo "installing $(srcdir)/$$cat as" \
+                "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
+         fi; \
+         if test -r $$cat.m; then \
+           $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+           echo "installing $$cat.m as 
$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
+         else \
+           if test -r $(srcdir)/$$cat.m ; then \
+             $(INSTALL_DATA) $(srcdir)/$$cat.m \
+               $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+             echo "installing $(srcdir)/$$cat as" \
+                  "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \
+           else \
+             true; \
+           fi; \
+         fi; \
+       done
+       if test "$(PACKAGE)" = "glib"; then \
+         if test -r "$(MKINSTALLDIRS)"; then \
+           $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
+         else \
+           $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
+         fi; \
+         $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
+                         $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
+       else \
+         : ; \
+       fi
+
+# Define this as empty until I found a useful application.
+installcheck:
+
+uninstall:
+       catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+         rm -f 
$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+         rm -f 
$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
+         rm -f 
$(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
+         rm -f 
$(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; 
\
+       done
+       if test "$(PACKAGE)" = "glib"; then \
+         rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
+       fi
+
+check: all
+
+dvi info tags TAGS ID:
+
+mostlyclean:
+       rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
+       rm -fr *.o
+
+clean: mostlyclean
+
+distclean: clean
+       rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
+
+maintainer-clean: distclean
+       @echo "This command is intended for maintainers to use;"
+       @echo "it deletes files that may require special tools to rebuild."
+       rm -f $(GMOFILES)
+
+distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
+dist distdir: update-po $(DISTFILES)
+       dists="$(DISTFILES)"; \
+       for file in $$dists; do \
+         ln $(srcdir)/$$file $(distdir) 2> /dev/null \
+           || cp -p $(srcdir)/$$file $(distdir); \
+       done
+
+update-po: Makefile
+       $(MAKE) $(GETTEXT_PACKAGE).pot
+       tmpdir=`pwd`; \
+       cd $(srcdir); \
+       catalogs='$(CATALOGS)'; \
+       for cat in $$catalogs; do \
+         cat=`basename $$cat`; \
+         lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
+         echo "$$lang:"; \
+         if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o 
$$tmpdir/$$lang.new.po; then \
+           if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
+             rm -f $$tmpdir/$$lang.new.po; \
+            else \
+             if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
+               :; \
+             else \
+               echo "msgmerge for $$lang.po failed: cannot move 
$$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
+               rm -f $$tmpdir/$$lang.new.po; \
+               exit 1; \
+             fi; \
+           fi; \
+         else \
+           echo "msgmerge for $$cat failed!"; \
+           rm -f $$tmpdir/$$lang.new.po; \
+         fi; \
+       done
+
+# POTFILES is created from POTFILES.in by stripping comments, empty lines
+# and Intltool tags (enclosed in square brackets), and appending a full
+# relative path to them
+POTFILES: POTFILES.in
+       ( if test 'x$(srcdir)' != 'x.'; then \
+           posrcprefix='$(top_srcdir)/'; \
+         else \
+           posrcprefix="../"; \
+         fi; \
+         rm -f [EMAIL PROTECTED] $@ \
+           && (sed -e '/^#/d'                                          \
+                   -e "s/^\[.*\] +//"                                  \
+                   -e '/^[     ]*$$/d'                                 \
+                   -e "[EMAIL PROTECTED]@      $$posrcprefix& \\\\@" < 
$(srcdir)/[EMAIL PROTECTED]     \
+               | sed -e '$$s/\\$$//') > [EMAIL PROTECTED] \
+           && chmod a-w [EMAIL PROTECTED] \
+           && mv [EMAIL PROTECTED] $@ )
+
+Makefile: Makefile.in.in ../config.status POTFILES
+       cd .. \
+         && CONFIG_FILES=$(subdir)/[EMAIL PROTECTED] CONFIG_HEADERS= \
+              $(SHELL) ./config.status
+
+# Tell versions [3.59,3.63) of GNU make not to export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: trunk/src/target/OM-2007/applications/openmoko-calculator/po/fr.po
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-calculator/po/fr.po  
2007-04-02 17:49:52 UTC (rev 1631)
+++ trunk/src/target/OM-2007/applications/openmoko-calculator/po/fr.po  
2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,39 @@
+# Template translation file.
+# Copyright (C) 2007 Rodolphe Ortalo
+# This file is distributed under the same license as the openmoko-calculator 
package.
+# Rodolphe Ortalo <[EMAIL PROTECTED]>, 2007
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: openmoko-calculator 0.0.2\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-03-24 13:52+0100\n"
+"PO-Revision-Date: 2007-03-23 21:34+0100\n"
+"Last-Translator: ortalo <[EMAIL PROTECTED]>\n"
+"Language-Team: French <[EMAIL PROTECTED]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#: src/calc-main.c:87
+msgid "Clear All"
+msgstr "RAZ"
+
+#: src/calc-main.c:87
+msgid "Clear"
+msgstr "Effacer"
+
+#: src/calc-main.c:91
+msgid "<big><b>.</b></big>"
+msgstr "<big><b>,</b></big>"
+
+#. application object
+#. MokoApplication* app = MOKO_APPLICATION(moko_application_get_instance());
+#: src/calc-main.c:349
+msgid "Calculator"
+msgstr "Calculatrice"
+
+#: src/calc-main.c:356
+msgid "Close"
+msgstr "Fermer"

Added: trunk/src/target/OM-2007/applications/openmoko-calculator/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-calculator/src/Makefile.am   
2007-04-02 17:49:52 UTC (rev 1631)
+++ trunk/src/target/OM-2007/applications/openmoko-calculator/src/Makefile.am   
2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,9 @@
+localedir = $(datadir)/locale
+
+AM_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" -DLOCALEDIR=\"$(localedir)\"
+AM_CFLAGS =  @OPENMOKO_CFLAGS@ -Wall -std=c99 -pedantic
+
+bin_PROGRAMS = openmoko-calculator
+
+openmoko_calculator_SOURCES = calc-main.c calc-main.h
+

Added: trunk/src/target/OM-2007/applications/openmoko-calculator/src/calc-main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-calculator/src/calc-main.c   
2007-04-02 17:49:52 UTC (rev 1631)
+++ trunk/src/target/OM-2007/applications/openmoko-calculator/src/calc-main.c   
2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,384 @@
+/*
+ *  Calculator -- OpenMoko simple Calculator
+ *
+ *  Authored by Rodolphe Ortalo <[EMAIL PROTECTED]>
+ *
+ *  Copyright (C) 2007 Rodolphe Ortalo
+ *
+ *  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 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 "calc-main.h"
+
+#include <stdio.h>
+#include <math.h>
+
+#include <libmokoui/moko-application.h>
+#include <libmokoui/moko-finger-tool-box.h>
+#include <libmokoui/moko-finger-window.h>
+#include <libmokoui/moko-finger-wheel.h>
+
+#include <gtk/gtkalignment.h>
+#include <gtk/gtkbutton.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtkmenu.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtk.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#define BOOL short unsigned int
+
+/* state of calculator */
+typedef struct {
+  double last_operand;
+  double current_operand;
+  double (*func)(const double,const double);
+  BOOL decimal_point;
+  unsigned short int n_digits;
+  unsigned short int n_fractional;
+} calc_state;
+
+enum operation {
+  notimplemented,
+  backspace, clearall, clear,
+  zero, one, two, three, four, five, six, seven, eight, nine, ten,
+  add, sub, mult, div, equal, minus, point } ;
+
+/*
+ * functions for operations
+ */
+static double noop_func (const double a, const double b) { return a; }
+static double add_func  (const double a, const double b) { return a+b; }
+static double sub_func  (const double a, const double b) { return a-b; }
+static double mult_func (const double a, const double b) { return a*b; }
+static double div_func  (const double a, const double b) { return a/b; }
+
+/*
+ * Internal variables
+ */
+static calc_state the_state = { .last_operand = 0.0,
+                               .current_operand = 0.0,
+                               .func = &add_func,
+                               .decimal_point = FALSE,
+                               .n_digits = 0,
+                               .n_fractional = 0, };
+static GtkWidget* displayed_label;
+
+#define CALC_ROWS 5
+#define CALC_COLS 4
+static const gchar *label[CALC_ROWS][CALC_COLS] = {
+    {N_("Clear All"), N_("Clear"), "<big><b>/</b></big>", 
"<big><b>*</b></big>" },
+    {"<big><b>7</b></big>", "<big><b>8</b></big>", "<big><b>9</b></big>", 
"<big><b>+</b></big>"},
+    {"<big><b>4</b></big>", "<big><b>5</b></big>", "<big><b>6</b></big>", 
"<big><b>-</b></big>"},
+    {"<big><b>1</b></big>", "<big><b>2</b></big>", "<big><b>3</b></big>", 
"<big><b>=</b></big>"},
+    {"<big><b>0</b></big>", N_("<big><b>.</b></big>"), 
"<big><b>+</b></big>/<big><b>-</b></big>", "none"},
+  };
+static enum operation ops[CALC_ROWS][CALC_COLS] = {
+    { clearall, clear, div, mult},
+    { seven, eight, nine, add},
+    { four, five, six, sub},
+    { one, two, three, equal},
+    { zero, point, minus, notimplemented},
+  };
+#if 1
+gchar *wnames[CALC_ROWS][CALC_COLS] = {
+  {"mokofingerbutton-orange", "mokofingerbutton-orange", 
"mokofingerbutton-dialer", "mokofingerbutton-dialer"},
+  {"mokofingerbutton-dialer", "mokofingerbutton-dialer", 
"mokofingerbutton-dialer", "mokofingerbutton-dialer"},
+  {"mokofingerbutton-dialer", "mokofingerbutton-dialer", 
"mokofingerbutton-dialer", "mokofingerbutton-dialer"},
+  {"mokofingerbutton-dialer", "mokofingerbutton-dialer", 
"mokofingerbutton-dialer", "mokofingerbutton-big"},
+  {"mokofingerbutton-dialer", "mokofingerbutton-dialer", 
"mokofingerbutton-dialer", "none"},
+};
+#else
+/* Alternative styling - more flashy */
+gchar *wnames[CALC_ROWS][CALC_COLS] = {
+  {"mokofingerbutton-black", "mokofingerbutton-black", 
"mokofingerbutton-orange", "mokofingerbutton-orange"},
+  {"mokofingerbutton-orange", "mokofingerbutton-orange", 
"mokofingerbutton-orange", "mokofingerbutton-orange"},
+  {"mokofingerbutton-orange", "mokofingerbutton-orange", 
"mokofingerbutton-orange", "mokofingerbutton-orange"},
+  {"mokofingerbutton-orange", "mokofingerbutton-orange", 
"mokofingerbutton-orange", "mokofingerbutton-black"},
+  {"mokofingerbutton-orange", "mokofingerbutton-orange", 
"mokofingerbutton-orange", "none"},
+};
+#endif
+
+/*
+ * Signal function and static helpers
+ */
+#define MAX_DISPLAY_CHARS 10
+#define MAX_DISPLAY_MARKUP (MAX_DISPLAY_CHARS+80)
+static gchar dispstring[MAX_DISPLAY_MARKUP+1];
+
+static void update_display(const double v)
+{
+  if (the_state.n_digits == 0) {
+    /* We are certainly displaying a computation result */
+    /* Manually build the display string ala %g */
+    double value = v;
+    int expof10;
+
+    expof10 = (int) log10((value>=0.)?(value):(-value));
+    value *= pow(10,-expof10);
+    if (expof10 >= MAX_DISPLAY_CHARS)
+      snprintf(dispstring,MAX_DISPLAY_MARKUP,"<span font_desc=\"48\" >%.*g 
<small>e</small><sup><big>%d</big></sup></span>",(MAX_DISPLAY_CHARS-2),value,expof10);
+    else
+      snprintf(dispstring,MAX_DISPLAY_MARKUP,"<span font_desc=\"48\" 
>%.*g</span>",MAX_DISPLAY_CHARS,v);
+  } else {
+    /* We display entered value including trailing 0s */
+    if (the_state.decimal_point == TRUE)
+      snprintf(dispstring,MAX_DISPLAY_MARKUP,"<span font_desc=\"48\" 
>%#.*f</span>",the_state.n_fractional,v);
+    else
+      snprintf(dispstring,MAX_DISPLAY_MARKUP,"<span font_desc=\"48\" 
>%.*f</span>",the_state.n_fractional,v);
+  }
+#if 1
+  calc_debug("cur = %.12lf  last = %.12lf", the_state.current_operand, 
the_state.last_operand);
+  calc_debug("n_digits = %i  n_fractional = %i  dec_point = %i", 
the_state.n_digits, the_state.n_fractional, the_state.decimal_point);
+  calc_debug(dispstring);
+#endif
+         
+  gtk_label_set_markup(GTK_LABEL(displayed_label), dispstring);
+}
+
+static void update_state_for_digit(const int v)
+{
+  if (the_state.func == &noop_func) {
+    /* renew a fresh calc */
+    the_state.last_operand = 0.0;
+    the_state.func = &add_func;
+  }
+  if (the_state.n_digits < MAX_DISPLAY_CHARS) {
+    the_state.n_digits++;
+    if (the_state.decimal_point == FALSE) {
+      the_state.current_operand *= 10.0;
+      the_state.current_operand += v
+       * (the_state.current_operand ? (the_state.current_operand / 
fabs(the_state.current_operand)) : 1.0);
+    } else {
+      the_state.n_fractional++;
+      the_state.current_operand += (v * pow(0.1,the_state.n_fractional))
+       * (the_state.current_operand ? (the_state.current_operand / 
fabs(the_state.current_operand)) : 1.0);
+    }
+  }
+  update_display(the_state.current_operand);
+}
+static void update_state_for_operation(double (*nextfunc)(const double,const 
double))
+{
+  the_state.last_operand = 
(*(the_state.func))(the_state.last_operand,the_state.current_operand);
+  the_state.current_operand = 0.0;
+  the_state.func = nextfunc;
+  the_state.decimal_point = FALSE;
+  the_state.n_digits = 0;
+  the_state.n_fractional = 0;
+  update_display(the_state.last_operand);
+}
+
+void calc_button_pressed( GtkButton* button, enum operation *k)
+{
+  calc_debug( "openmoko-calculator: button pressed" );
+  switch (*k) {
+  case zero:
+    update_state_for_digit(0);
+    break;
+  case one:
+    update_state_for_digit(1);
+    break;
+  case two:
+    update_state_for_digit(2);
+    break;
+  case three:
+    update_state_for_digit(3);
+    break;
+  case four:
+    update_state_for_digit(4);
+    break;
+  case five:
+    update_state_for_digit(5);
+    break;
+  case six:
+    update_state_for_digit(6);
+    break;
+  case seven:
+    update_state_for_digit(7);
+    break;
+  case eight:
+    update_state_for_digit(8);
+    break;
+  case nine:
+    update_state_for_digit(9);
+    break;
+  case minus:
+    the_state.current_operand *= -1;
+    update_display(the_state.current_operand);
+    break;
+  case point:
+    the_state.decimal_point = TRUE;
+    update_display(the_state.current_operand);
+    break;
+  case clearall:
+    the_state.last_operand = 0.0;
+    the_state.func = &add_func;
+  case clear:
+    the_state.current_operand = 0.0;
+    the_state.decimal_point = FALSE;
+    the_state.n_digits = 0;
+    the_state.n_fractional = 0;
+    update_display(the_state.current_operand);
+    break;
+  case add:
+    update_state_for_operation(&add_func);
+    break;
+  case sub:
+    update_state_for_operation(&sub_func);
+    break;
+  case mult:
+    update_state_for_operation(&mult_func);
+    break;
+  case div:
+    update_state_for_operation(&div_func);
+    break;
+#if 0
+    /* Not implemented to win one button slot and display a bigger = button */
+  case backspace:
+    break;
+#endif
+  case equal:
+    update_state_for_operation(&noop_func);
+    break;
+  case notimplemented:
+    g_debug("openmoko-calculator: operation not-implemented");
+    break;
+  default:
+    g_debug("openmoko-calculator: unknown operation (%i)!", *k);
+    break;
+  }
+}
+
+/*
+ * Convenience static function
+ */
+static GtkTable* calc_panel_init (void)
+{
+
+  GtkTable *table;
+  int i, j;
+
+  table = GTK_TABLE(gtk_table_new (CALC_ROWS, CALC_COLS, TRUE));
+  gtk_table_set_row_spacings(table, 10);
+  gtk_table_set_col_spacings(table, 10);
+
+  for (j = 0; j < CALC_COLS; j++)
+    for (i = 0; i < CALC_ROWS; i++)
+    {
+      GtkButton* button = GTK_BUTTON(gtk_button_new());
+      GtkWidget* blabel = gtk_label_new(NULL);
+      gtk_label_set_markup(GTK_LABEL(blabel),gettext(label[i][j]));
+      gtk_container_add(GTK_CONTAINER(button),blabel);
+
+      g_signal_connect (G_OBJECT(button), "clicked", 
G_CALLBACK(calc_button_pressed),&(ops[i][j]));
+      /* TODO: Check if this changes the aspect */
+      gtk_widget_set_name(GTK_WIDGET(button), wnames[i][j]);
+
+      if ((j == (CALC_COLS-1)) && (i == (CALC_ROWS-2))) {
+       /* Last button spans two cells vertically */
+       gtk_table_attach_defaults (table, GTK_WIDGET(button),
+                                  j, j + 1, i, i + 2);
+       i++;
+      } else {
+       gtk_table_attach_defaults (table, GTK_WIDGET(button),
+                                  j, j + 1, i, i + 1); 
+      }
+      gtk_widget_set_size_request (GTK_WIDGET(button), 20, 20);
+    }
+  return table;
+}
+
+/*
+ * Command line options definition
+ */
+static GOptionEntry entries[] = 
+{
+  /* No options right now except the default ones from GTK */
+  { NULL }
+};
+
+
+/*
+ * Main
+ */
+int main( int argc, char** argv )
+{
+    GtkHBox* hbox;
+    GtkVBox* vbox;
+    GtkTable* table;
+
+    calc_debug( "openmoko-calculator starting up" );
+    /* Initialize GTK+ */
+    gtk_init( &argc, &argv );
+    if (argc != 1)
+      {
+       /* Add init code. */
+       GError *error = NULL;
+       GOptionContext *context = g_option_context_new ("");
+       
+       g_option_context_add_main_entries (context, entries, NULL);
+       g_option_context_add_group (context, gtk_get_option_group (TRUE));
+       g_option_context_parse (context, &argc, &argv, &error);
+       
+       g_option_context_free (context);
+      }
+       
+    setlocale (LC_ALL, "");
+    bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+    textdomain (GETTEXT_PACKAGE);
+
+    /* application object */
+    /* MokoApplication* app = 
MOKO_APPLICATION(moko_application_get_instance()); */
+    g_set_application_name( _("Calculator") );
+
+    /* main window */
+    MokoFingerWindow* window = MOKO_FINGER_WINDOW(moko_finger_window_new());
+
+    /* application menu */
+    GtkMenu* appmenu = GTK_MENU(gtk_menu_new());
+    GtkMenuItem* closeitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( 
_("Close") ));
+    g_signal_connect( G_OBJECT(closeitem), "activate", 
G_CALLBACK(gtk_main_quit), NULL );
+    gtk_menu_shell_append( GTK_MENU_SHELL(appmenu), GTK_WIDGET(closeitem) );
+    moko_finger_window_set_application_menu( window, appmenu );
+
+    /* connect close event */
+    g_signal_connect( G_OBJECT(window), "delete_event", 
G_CALLBACK(gtk_main_quit), NULL );
+
+    /* contents */
+    hbox = GTK_HBOX(gtk_hbox_new(TRUE, 10)); /* The hbox is just to get some 
border space...! */
+    vbox = GTK_VBOX(gtk_vbox_new(FALSE, 10));
+
+    displayed_label = gtk_label_new("123");
+    gtk_misc_set_alignment(GTK_MISC(displayed_label), 1, 0);
+    update_display(0.0);
+    GtkWidget *eventbox1 = gtk_event_box_new ();
+    gtk_widget_set_name (eventbox1, "gtkeventbox-black");
+    gtk_container_add (GTK_CONTAINER (eventbox1), displayed_label);
+    gtk_box_pack_start( GTK_BOX(vbox), eventbox1, FALSE, FALSE, 10);
+
+    table = calc_panel_init();
+    gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(table), TRUE, TRUE, 10);
+
+    gtk_box_pack_start( GTK_BOX(hbox), GTK_WIDGET(vbox), TRUE, TRUE, 10);
+    moko_finger_window_set_contents(window, GTK_WIDGET(hbox));
+    
+    /* show everything and run main loop */
+    gtk_widget_show_all( GTK_WIDGET(window) );
+    calc_debug( "calculator entering main loop" );
+    gtk_main();
+    calc_debug( "calculator left main loop" );
+
+    return 0;
+}


Property changes on: 
trunk/src/target/OM-2007/applications/openmoko-calculator/src/calc-main.c
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/src/target/OM-2007/applications/openmoko-calculator/src/calc-main.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-calculator/src/calc-main.h   
2007-04-02 17:49:52 UTC (rev 1631)
+++ trunk/src/target/OM-2007/applications/openmoko-calculator/src/calc-main.h   
2007-04-02 18:54:48 UTC (rev 1632)
@@ -0,0 +1,38 @@
+/*
+ *  Calculator -- OpenMoko simple Calculator
+ *
+ *  Authored by Rodolphe Ortalo <[EMAIL PROTECTED]>
+ *
+ *  Copyright (C) 2007 Rodolphe Ortalo
+ *
+ *  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 CALC_MAIN_H
+#define CALC_MAIN_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#undef CALCULATOR_DEBUG
+
+/*
+ * calc_debug functions
+ */
+#ifdef CALCULATOR_DEBUG
+#define calc_debug(...) g_debug(__VA_ARGS__)
+#else
+#define calc_debug(...)
+#endif
+
+#endif /* CALC_MAIN_H */


Property changes on: 
trunk/src/target/OM-2007/applications/openmoko-calculator/src/calc-main.h
___________________________________________________________________
Name: svn:eol-style
   + native




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to