r3310 - in trunk/src/target/OM-2007.2/applications/openmoko-dialer2: . src src/common src/dialer src/phone-kit

thomas at sita.openmoko.org thomas at sita.openmoko.org
Wed Oct 31 14:49:16 CET 2007


Author: thomas
Date: 2007-10-31 14:49:04 +0100 (Wed, 31 Oct 2007)
New Revision: 3310

Added:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/Makefile.am
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/dialer-defines.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-contacts.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-contacts.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-dialer-panel.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-dialer-panel.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-dialer-textview.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-dialer-textview.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-digit-button.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-digit-button.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/moko-history.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/moko-history.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/moko-keypad.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/moko-keypad.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/moko-tips.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/moko-tips.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/dialer-main.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer-dbus.xml
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-notify.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-notify.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-sound.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-sound.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-talking.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-talking.h
Removed:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer-defines.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer-main.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-dbus.xml
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-panel.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-panel.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-digit-button.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-digit-button.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-history.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-history.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.h
Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/configure.ac
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am
Log:
* configure.ac:
* src/*:

Begin seperation of dialer and phone management


Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,3 +1,10 @@
+2007-10-31  Thomas Wood <thomas at openedhand.com>
+
+	* configure.ac:
+	* src/*:
+
+	Begin seperation of dialer and phone management
+
 2007-10-30  Thomas Wood  <thomas at openedhand.com>
 
 	* src/moko-dialer.c: (on_talking_reject_call): Stop ringing notification

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/configure.ac
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/configure.ac	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/configure.ac	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,7 +1,7 @@
 AC_PREREQ(2.53)
 AC_INIT(openmoko-dialer, 0.1, http://www.openmoko.org/)
 AM_INIT_AUTOMAKE()
-AC_CONFIG_SRCDIR(src/dialer-main.c)
+AC_CONFIG_SRCDIR(src/phone-kit/dialer-main.c)
 AM_CONFIG_HEADER(config.h)
 AM_MAINTAINER_MODE
 
@@ -52,5 +52,8 @@
 AC_OUTPUT([
 Makefile
 src/Makefile
+src/common/Makefile
+src/dialer/Makefile
+src/phone-kit/Makefile
 data/Makefile
 ])

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,46 +1,3 @@
-bin_PROGRAMS = openmoko-dialer
+SUBDIRS = common dialer phone-kit
 
-openmoko_dialer_SOURCES = \
-	dialer-defines.h		\
-	dialer-main.c			\
-	moko-contacts.c			\
-	moko-contacts.h			\
-	moko-dialer.c			\
-	moko-dialer.h			\
-	moko-dialer-glue.h		\
-	moko-dialer-panel.c		\
-	moko-dialer-panel.h		\
-	moko-dialer-textview.c		\
-	moko-dialer-textview.h		\
-	moko-digit-button.c		\
-	moko-digit-button.h		\
-	moko-history.c			\
-	moko-history.h			\
-	moko-keypad.c			\
-	moko-keypad.h			\
-	moko-notify.c			\
-	moko-notify.h			\
-	moko-talking.c			\
-	moko-talking.h			\
-	moko-tips.c			\
-	moko-tips.h			\
-	moko-sound.c			\
-	moko-sound.h
 
-openmoko_dialer_CPPFLAGS = -DDATADIR=\"$(datadir)\" \
-              -DPKGDATADIR=\"$(pkgdatadir)\"
-openmoko_dialer_CFLAGS = -Wall @DIALER_CFLAGS@
-
-openmoko_dialer_LDADD = @DIALER_LIBS@
-
-moko-dialer-glue.h: moko-dialer-dbus.xml
-	$(LIBTOOL) --mode=execute $(DBUS_GLIB_BIN)/dbus-binding-tool --prefix=moko_dialer --mode=glib-server --output=$@ $<
-	
-BUILT_SOURCES =                         \
-        moko-dialer-glue.h
-
-EXTRA_DIST =                            \
-        moko-dialer-dbus.xml
-
-
-

Added: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/Makefile.am
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/Makefile.am	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/Makefile.am	2007-10-31 13:49:04 UTC (rev 3310)
@@ -0,0 +1,12 @@
+AM_CPPFLAGS = -DDATADIR=\"$(datadir)\" -DPKGDATADIR=\"$(pkgdatadir)\"
+AM_CFLAGS = -Wall @DIALER_CFLAGS@
+
+AM_LDFLAGS = @DIALER_LIBS@
+
+noinst_LIBRARIES = libdialer-common.a
+
+libdialer_common_a_SOURCES = \
+	moko-contacts.c moko-contacts.h \
+	moko-dialer-panel.c moko-dialer-panel.h \
+	moko-dialer-textview.c moko-dialer-textview.h \
+	moko-digit-button.c moko-digit-button.h

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/dialer-defines.h (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer-defines.h)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-contacts.c (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-contacts.h (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.h)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-dialer-panel.c (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-panel.c)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-dialer-panel.h (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-panel.h)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-dialer-textview.c (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.c)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-dialer-textview.h (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.h)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-digit-button.c (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-digit-button.c)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/common/moko-digit-button.h (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-digit-button.h)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/moko-history.c (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-history.c)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/moko-history.h (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-history.h)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/moko-keypad.c (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/moko-keypad.h (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.h)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/moko-tips.c (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.c)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer/moko-tips.h (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.h)

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer-defines.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer-defines.h	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer-defines.h	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,25 +0,0 @@
-/*
- *  dialer-defines.h; Program wide variables.
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef DIALER_DEFINES_H_
-#define DIALER_DEFINES_H_
-
-#define AUTOCOMPLETE_N_CHARS 4
-
-#endif /* DIALER_DEFINES_H_ */

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer-main.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer-main.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer-main.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,206 +0,0 @@
-/*  
- *  Copyright (C) 2007 Openmoko, Inc.
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  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 Lesser Public License for more details.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gtk/gtk.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-bindings.h>
-
-#include <moko-stock.h>
-
-#include "moko-dialer.h"
-
-#define DIALER_NAMESPACE "org.openmoko.Dialer"
-#define DIALER_OBJECT "/org/openmoko/Dialer"
-
-static gboolean show_dialer;
-static gboolean show_missed;
-static gchar *number = NULL;
-
-static GOptionEntry entries[] = {
-  {"show-dialer", 's', 0, G_OPTION_ARG_NONE, &show_dialer,
-   "Show the dialer at startup", "N"},
-
-  {"show-missed", 'm', 0, G_OPTION_ARG_NONE, &show_missed,
-   "Show the history window filtered by the missed, none.", "N"},
-  
-  {"dial", 'd', 0, G_OPTION_ARG_STRING, &number,
-   "Dial the specified number.", "N"},
-
-  {NULL}
-};
-
-
-static void
-_show_dialer (DBusGConnection *conn)
-{
-  DBusGProxy *proxy = NULL;
-  GError *error = NULL;
-
-  proxy = dbus_g_proxy_new_for_name (conn,
-                                      DIALER_NAMESPACE,
-                                      DIALER_OBJECT,
-                                      DIALER_NAMESPACE);
-
-  if (!proxy)
-    return;
-  
-  dbus_g_proxy_call (proxy, "ShowDialer", &error,
-                     G_TYPE_INVALID, G_TYPE_INVALID);
-  if (error)
-    g_warning (error->message);
-
-}
-
-static void
-_show_missed (DBusGConnection *conn)
-{
-  DBusGProxy *proxy = NULL;
-  GError *error = NULL;
-
-  proxy = dbus_g_proxy_new_for_name (conn,
-                                      DIALER_NAMESPACE,
-                                      DIALER_OBJECT,
-                                      DIALER_NAMESPACE);
-
-  if (!proxy)
-    return;
-  
-  dbus_g_proxy_call (proxy, "ShowMissedCalls", &error,
-                     G_TYPE_INVALID, G_TYPE_INVALID);
-  if (error)
-    g_warning (error->message);
-
-}
-
-static void
-_dial_number (DBusGConnection *conn)
-{
-  DBusGProxy *proxy = NULL;
-  GError *error = NULL;
-
-  proxy = dbus_g_proxy_new_for_name (conn,
-                                      DIALER_NAMESPACE,
-                                      DIALER_OBJECT,
-                                      DIALER_NAMESPACE);
-
-  if (!proxy)
-    return;
-  
-  dbus_g_proxy_call (proxy, "Dial", &error,
-                     G_TYPE_STRING, number,
-                     G_TYPE_INVALID, G_TYPE_INVALID);
-  if (error)
-    g_warning (error->message);
-
-}
-int
-main (int argc, char **argv)
-{
-  MokoDialer *dialer;
-  DBusGConnection *connection;
-  DBusGProxy *proxy;
-  GError *error = NULL;
-  guint32 ret;
-  /*gchar *out = NULL, *err = NULL;*/
-
-  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);
-  }
-
-  /* initialise type system */
-  g_type_init ();
-
-  /* Try and setup our DBus service */
-  connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
-  if (connection == NULL)
-  {
-    g_warning ("Failed to make a connection to the session bus: %s", 
-               error->message);
-    g_error_free (error);
-    return 1;
-  }
-  proxy = dbus_g_proxy_new_for_name (connection, 
-                                     DBUS_SERVICE_DBUS,
-                                     DBUS_PATH_DBUS, 
-                                     DBUS_INTERFACE_DBUS);
-  if (!org_freedesktop_DBus_request_name (proxy,
-                                          DIALER_NAMESPACE,
-                                          0, &ret, &error))
-  {
-    /* Error requesting the name */
-    g_warning ("There was an error requesting the name: %s\n",error->message);
-    g_error_free (error);
-
-    gdk_init (&argc, &argv);
-    gdk_notify_startup_complete ();
-
-    return 1;
-  }
-  if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
-  {
-    /* Someone else hase registered the object */
-
-    if (show_missed)
-      _show_missed (connection);
-    else if (number)
-      _dial_number (connection);
-    else
-      _show_dialer (connection);
-
-    dbus_g_connection_unref (connection);
-
-    gdk_init (&argc, &argv);
-    gdk_notify_startup_complete ();
-    return 0;
-  }
-
-
-  /* Initialize Threading & GTK+ */
-  gtk_init (&argc, &argv);
-  moko_stock_register ();
-
-   /* Create the MokoDialer object */
-  dialer = moko_dialer_get_default ();
-
-  /* Add the object onto the bus */
-  dbus_g_connection_register_g_object (connection, 
-                                       DIALER_OBJECT,
-                                       G_OBJECT (dialer));
-
-  /* application object */
-  g_set_application_name ("OpenMoko Dialer");
- 
-  if (number)
-    moko_dialer_dial (dialer, number, NULL);
-  else if (show_missed)
-    moko_dialer_show_missed_calls (dialer, NULL);
-  else if (show_dialer)
-    moko_dialer_show_dialer (dialer, NULL);
-
-  gtk_main ();
-  
-  return 0;
-}

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,480 +0,0 @@
-/*
- *  moko-contacts; A rework of the dialers contact list, some e-book code taken
- *  from the orignal dialer contacts.c (written by tonyguan at fic-sh.com.cn)
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include <glib.h>
-#include <stdio.h>
-#include <string.h>
-#include <libebook/e-book.h>
-
-#include "moko-contacts.h"
-
-#include "dialer-defines.h"
-
-G_DEFINE_TYPE (MokoContacts, moko_contacts, G_TYPE_OBJECT)
-
-#define MOKO_CONTACTS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
-        MOKO_TYPE_CONTACTS, MokoContactsPrivate))
-typedef struct _Digit Digit;
-
-struct _Digit
-{
-  Digit *digits[11];
-  Digit *parent;
-  GList *results;
-
-};
-
-struct _MokoContactsPrivate
-{
-  EBook      *book;
-
-  GList      *contacts;
-  GList      *entries;
-  GHashTable *prefixes;
-
-  Digit *start;
-};
-
-static Digit*
-new_digit (Digit *parent)
-{
-  Digit *ret;
-  gint i;
-  
-  ret = g_slice_new0 (Digit);
-  ret->parent = parent;
-  ret->results = NULL;
-
-  for (i = 0; i <11; i++)
-    ret->digits[i] = NULL;
-  
-  return ret;
-}
-
-/* Auto-complete data type */
-static void
-add_number (Digit **start, MokoContactEntry *entry)
-{
-  gint len, i;
-  Digit *cur;
-
-  if (*start == NULL)
-    *start = new_digit (NULL);
-
-  cur = *start;
-
-  len = strlen  (entry->number);
-  for (i = 0; i < len; i++)
-  {
-    gchar c = entry->number[i];
-    gint n = c - '0';
-
-    if (n < 0 || n > 9)
-      n = 10;
-
-    if (cur->digits[n])
-    {
-      cur = cur->digits[n];
-      if (g_list_length (cur->results) < 3)
-        cur->results = g_list_append (cur->results, entry);
-      continue;
-    }
-    else
-    {
-      cur->digits[n] = new_digit (cur);
-      cur = cur->digits[n];
-      cur->results = g_list_append (cur->results, entry);
-    }
-  }
-}
-
-GList*
-moko_contacts_fuzzy_lookup (MokoContacts *contacts, const gchar *number)
-{
-  MokoContactsPrivate *priv;
-  gint len, i;
-  Digit *cur;
-  
-  g_return_val_if_fail (MOKO_IS_CONTACTS (contacts), NULL);
-  priv = contacts->priv;
-
-  cur = priv->start;
-
-  if (!cur)
-    return NULL;
-  
-  if (!number)
-    return NULL;
-
-  len = strlen (number);
-
-  for (i = 0; i < len; i++)
-  {
-    gchar c = number[i];
-    gint n = c - '0';
-
-    if (n < 0 || n > 9)
-      n = 10;
-
-    if (!cur->digits[n])
-      return NULL;
-
-    cur = cur->digits[n];
-    if ((i+1) == len)
-      return cur->results;
-  }
-
-  return NULL;
-}
-
-
-void
-moko_contacts_get_photo (MokoContacts *contacts, MokoContact *m_contact)
-{
-  MokoContactsPrivate *priv;
-  EContact *e_contact;
-  EContactPhoto *photo;
-  GError *err = NULL;
-  GdkPixbufLoader *loader;
-  
-  g_return_if_fail (MOKO_IS_CONTACTS (contacts));
-  g_return_if_fail (m_contact);
-  priv = contacts->priv;
-  
-  if (!e_book_get_contact (priv->book, m_contact->uid, &e_contact, &err))
-  {
-    g_warning ("%s\n", err->message);
-    m_contact->photo = gdk_pixbuf_new_from_file (PKGDATADIR"/person.png", NULL);
-	if (m_contact->photo)
-      g_object_ref (m_contact->photo); 
-    return;
-  }
-  
-  photo = e_contact_get (e_contact, E_CONTACT_PHOTO);
-  if (!photo)
-  {
-    m_contact->photo = gdk_pixbuf_new_from_file (PKGDATADIR"/person.png", NULL);
-	if (m_contact->photo)
-      g_object_ref (m_contact->photo);
-    return;
- 
-  }
-  
-  loader = gdk_pixbuf_loader_new ();
-  gdk_pixbuf_loader_write (loader, 
-                           photo->data.inlined.data,
-                           photo->data.inlined.length,
-                           NULL);
-  gdk_pixbuf_loader_close (loader, NULL);
-  m_contact->photo = gdk_pixbuf_loader_get_pixbuf (loader);
-
-  if (GDK_IS_PIXBUF (m_contact->photo))
-    g_object_ref (m_contact->photo);
-  else 
-  {
-    m_contact->photo = gdk_pixbuf_new_from_file (PKGDATADIR"/person.png", NULL);
-	if (m_contact->photo)
-    	g_object_ref (m_contact->photo); 
-  }  
-  
-  g_object_unref (loader);
-}
-
-MokoContactEntry*
-moko_contacts_lookup (MokoContacts *contacts, const gchar *number)
-{
-  MokoContactsPrivate *priv;
-  MokoContactEntry *entry;
-
-  g_return_val_if_fail (MOKO_IS_CONTACTS (contacts), NULL);
-  g_return_val_if_fail (number, NULL);
-  priv = contacts->priv;
-  
-  entry =  g_hash_table_lookup (priv->prefixes, number);
-
-  if (entry && !GDK_IS_PIXBUF (entry->contact->photo))
-    moko_contacts_get_photo (contacts, entry->contact);
-
-  return entry;
-}
-
-
-
-/* This takes the raw number from econtact, and spits out a 'normalised' 
- * version which does not contain any ' ' or '-' charecters. The reason for
- * this is that when inputing numbers into the dialer, you cannot add these
- * characters, but you can in contacts, which means the strings will not match
- * and autocomplete will not work
- */
-static gchar*
-normalize (const gchar *string)
-{
-  gint len = strlen (string);
-  gchar buf[len];
-  gint i;
-  gint j = 0;
-
-  for (i = 0; i < len; i++)
-  {
-    gchar c = string[i];
-    if (c != ' ' && c != '-')
-    {
-      buf[j] = c;
-      j++;
-    }
-  }
-  buf[j] = '\0';
-  return g_strdup (buf);
-}
-
-/* Calbacks */
-static void
-moko_contacts_add_contact (MokoContacts *contacts, EContact *e_contact)
-{
-  MokoContactsPrivate *priv;
-  MokoContact *m_contact = NULL;
-  const gchar *name;
-  GList *attributes, *params, *numbers;
-
-  g_return_if_fail (MOKO_IS_CONTACTS (contacts));
-  g_return_if_fail (E_IS_CONTACT (e_contact));
-  priv = contacts->priv;
-
-  name = e_contact_get_const (e_contact, E_CONTACT_FULL_NAME);
-  if (!name || (g_utf8_strlen (name, -1) <= 0))
-    name = "Unknown";
-    
-  /* Create the contact & append to the list */
-  m_contact = g_new0 (MokoContact, 1);
-  m_contact->name = g_strdup (name);
-  m_contact->uid = e_contact_get (e_contact, E_CONTACT_UID);
-  m_contact->photo = NULL;
-
-  priv->contacts = g_list_append (priv->contacts, m_contact);
-   
-  /* Now go through the numbers,creating MokoNumber for them */
-  for (attributes = e_vcard_get_attributes (E_VCARD(e_contact)); attributes; attributes = attributes->next)
-  {
-    MokoContactEntry  *entry;
-    const gchar *phone;
-    const char *attr;
-
-    attr = e_vcard_attribute_get_name (attributes->data);
-    if (!strcmp (attr, EVC_TEL))
-    {
-      for (numbers = e_vcard_attribute_get_values (attributes->data); numbers; numbers = numbers->next)
-      {
-        phone = g_strdup (numbers->data);
-	 if (phone)
-        {
-          entry = g_new0 (MokoContactEntry, 1);
-
-          params = e_vcard_attribute_get_param (attributes->data, "TYPE");
-          if (params)
-            entry->desc = g_strdup (params->data);
-
-          entry->number = normalize (phone);
-          entry->contact = m_contact;
-
-          priv->entries = g_list_append (priv->entries, (gpointer)entry);
-          g_hash_table_insert (priv->prefixes, 
-                               g_strdup (entry->number), 
-                               (gpointer)entry);
-          add_number (&priv->start, entry);
-        }
-      }
-    }
-  }
-}
-
-static void
-on_ebook_contacts_added (EBookView    *view, 
-                        GList        *c_list, 
-                        MokoContacts *contacts)
-{
-  MokoContactsPrivate *priv;
-  GList *c;
-
-  g_return_if_fail (MOKO_IS_CONTACTS (contacts));
-  priv = contacts->priv;
-
-  for (c = c_list; c != NULL; c = c->next)
-    moko_contacts_add_contact (contacts, E_CONTACT (c->data));
-}
-
-static void
-on_ebook_contacts_changed (EBookView    *view,
-                           GList        *c_list,
-                           MokoContacts *contacts)
-{
-  g_debug ("Contacts changed");
-}
-
-static void
-on_ebook_contacts_removed (EBookView    *view,
-                           GList        *c_list,
-                           MokoContacts *contacts)
-{
-  g_debug ("Contacts removed");
-}
-
-/* GObject functions */
-static void
-moko_contacts_dispose (GObject *object)
-{
-  G_OBJECT_CLASS (moko_contacts_parent_class)->dispose (object);
-}
-
-static void
-free_digit (Digit *digit)
-{
-  gint i;
-
-  for (i = 0; i < 11; i++)
-  {
-    if (digit->digits[i])
-      free_digit (digit->digits[i]);
-  }
-  g_list_free (digit->results);
-  g_slice_free (Digit, digit);
-}
-
-static void
-moko_contacts_finalize (GObject *contacts)
-{
-  MokoContactsPrivate *priv;
-  GList *l;
-  
-  g_return_if_fail (MOKO_IS_CONTACTS (contacts));
-  priv = MOKO_CONTACTS (contacts)->priv;
-
-  g_hash_table_destroy (priv->prefixes);
-
-  for (l = priv->contacts; l != NULL; l = l->next)
-  {
-    MokoContact *contact = (MokoContact*)l->data;
-    if (contact)
-    {
-      g_free (contact->uid);
-      g_free (contact->name);
-      if (G_IS_OBJECT (contact->photo))
-        g_object_unref (contact->photo);
-    }
-  }
-  g_list_free (priv->contacts);
-  
-  for (l = priv->entries; l != NULL; l = l->next)
-  {
-    MokoContactEntry *entry = (MokoContactEntry*)l->data;
-    if (entry)
-    {
-      g_free (entry->desc);
-      g_free (entry->number);
-      entry->contact = NULL;
-    }
-  }
-  g_list_free (priv->entries);
-
-  if (priv->start)
-  {
-    free_digit (priv->start);
-  } 
-
-  G_OBJECT_CLASS (moko_contacts_parent_class)->finalize (contacts);
-}
-
-
-static void
-moko_contacts_class_init (MokoContactsClass *klass)
-{
-  GObjectClass *obj_class = G_OBJECT_CLASS (klass);
-
-  obj_class->finalize = moko_contacts_finalize;
-  obj_class->dispose = moko_contacts_dispose;
-
-  g_type_class_add_private (obj_class, sizeof (MokoContactsPrivate)); 
-}
-
-static void
-moko_contacts_init (MokoContacts *contacts)
-{
-  MokoContactsPrivate *priv;
-  EBook *book;
-  EBookView *view;
-  EBookQuery *query;
-  GList *contact, *c;
-
-  priv = contacts->priv = MOKO_CONTACTS_GET_PRIVATE (contacts);
-
-  priv->contacts = NULL;
-  priv->entries = NULL;
-  priv->start = NULL;
-  priv->prefixes = g_hash_table_new ((GHashFunc)g_str_hash,
-                                     (GEqualFunc)g_str_equal);
-  
-  query = e_book_query_any_field_contains ("");
-
-  /* Open the system book and check that it is valid */
-  book = priv->book = e_book_new_system_addressbook (NULL);
-  if (!book)
-  {
-    g_warning ("Failed to create system book\n");
-    return;
-  }
-  if (!e_book_open (book, TRUE, NULL))
-  {
-    g_warning ("Failed to open system book\n");
-    return;
-  }
-  if (!e_book_get_contacts (book, query, &contact, NULL))
-  {
-    g_warning ("Failed to get contacts from system book\n");
-    return;
-  }
-  
-  /* Go through the contacts, creating the contact structs, and entry structs*/
-  for (c = contact; c != NULL; c = c->next)
-  {
-    moko_contacts_add_contact (contacts, E_CONTACT (c->data));
-  }
-
-  /* Connect to the ebookviews signals */
-  if (e_book_get_book_view (book, query, NULL, 0, &view, NULL))
-  {
-    g_signal_connect (G_OBJECT (view), "contacts-added",
-                      G_CALLBACK (on_ebook_contacts_added), (gpointer)contacts);
-    g_signal_connect (G_OBJECT (view), "contacts-changed",
-                    G_CALLBACK (on_ebook_contacts_changed), (gpointer)contacts);
-    g_signal_connect (G_OBJECT (view), "contacts-removed",
-                    G_CALLBACK (on_ebook_contacts_removed), (gpointer)contacts);
-  }
-}
-
-MokoContacts*
-moko_contacts_get_default (void)
-{
-  static MokoContacts *contacts = NULL;
-  
-  if (contacts == NULL)
-    contacts = g_object_new (MOKO_TYPE_CONTACTS, 
-                             NULL);
-
-  return contacts;
-}

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.h	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.h	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,102 +0,0 @@
-/*
- *  moko-contacts; A rework of the dialers contact list, some e-book code taken
- *  from the orignal dialer contacts.c (written by tonyguan at fic-sh.com.cn)
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _HAVE_MOKO_CONTACTS_H
-#define _HAVE_MOKO_CONTACTS_H
-
-#include <glib.h>
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define MOKO_TYPE_CONTACTS (moko_contacts_get_type ())
-
-#define MOKO_CONTACTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-        MOKO_TYPE_CONTACTS, MokoContacts))
-
-#define MOKO_CONTACTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
-        MOKO_TYPE_CONTACTS, MokoContactsClass))
-
-#define MOKO_IS_CONTACTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-        MOKO_TYPE_CONTACTS))
-
-#define MOKO_IS_CONTACTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-        MOKO_TYPE_CONTACTS))
-
-#define MOKO_CONTACTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-        MOKO_TYPE_CONTACTS, MokoContactsClass))
-
-typedef struct _MokoContacts MokoContacts;
-typedef struct _MokoContactsClass MokoContactsClass;
-typedef struct _MokoContactsPrivate MokoContactsPrivate;
-typedef struct _MokoContact MokoContact;
-typedef struct _MokoContactEntry MokoContactEntry;
-
-struct _MokoContacts
-{
-  GObject         parent;
-
-  /*< private >*/
-  MokoContactsPrivate   *priv;
-};
-
-struct _MokoContactsClass 
-{
-  /*< private >*/
-  GObjectClass    parent_class;
-  
- /* future padding */
-  void (*_moko_contacts_1) (void);
-  void (*_moko_contacts_2) (void);
-  void (*_moko_contacts_3) (void);
-  void (*_moko_contacts_4) (void);
-};
-
-struct _MokoContact
-{
-  gchar       *uid;
-  gchar       *name;
-  GdkPixbuf   *photo;
-};
-
-struct _MokoContactEntry
-{
-  gchar       *desc;
-  gchar       *number;
-  MokoContact *contact;
-};
-
-GType moko_contacts_get_type (void) G_GNUC_CONST;
-
-MokoContacts*
-moko_contacts_get_default (void);
-
-MokoContactEntry*
-moko_contacts_lookup (MokoContacts *contacts, const gchar *number);
-
-GList*
-moko_contacts_fuzzy_lookup (MokoContacts *contacts, const gchar *number);
-
-void
-moko_contacts_get_photo (MokoContacts *contacts, MokoContact *m_contact);
-
-G_END_DECLS
-
-#endif /* _HAVE_MOKO_CONTACTS_H */

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-dbus.xml
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-dbus.xml	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-dbus.xml	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-<node name="/org/openmoko/Dialer">
-<interface name="org.openmoko.Dialer">
-<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="moko_dialer"/>
-	
-	<method name="ShowDialer">
-	</method>
-	
-	<method name="ShowMissedCalls">
-	</method>
-	
-  <method name="GetStatus">
-    <arg type="i" name="status" direction="out" />
-  </method>
-
-  <method name="Dial">
-    <arg type="s" name="number" direction="in" />
-  </method>
-
-  <method name="HangUp">
-    <arg type="s" name="message" direction="in" />
-  </method>
-
-	<signal name="IncomingCall">
-		<arg type="s" name="number"/>
-	</signal>
-	<signal name="OutgoingCall">
-		<arg type="s" name="number" />
-	</signal>
-
-	<signal name="Talking">
-	</signal>
-
-	<signal name="HungUp">
-	</signal>
-
-	<signal name="Rejected">
-	</signal>
-
-</interface>
-</node>

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-panel.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-panel.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-panel.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,208 +0,0 @@
-/*  moko-dialer-pannel.c
- *
- *  Authored by Tony Guan<tonyguan at fic-sh.com.cn>
- *
- *  Copyright (C) 2006 FIC Shanghai Lab
- *
- *  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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date) [$Author: Tony Guan $]
- */
-#include "moko-dialer-panel.h"
-
-#include "moko-digit-button.h"
-
-G_DEFINE_TYPE (MokoDialerPanel, moko_dialer_panel, GTK_TYPE_VBOX)
-
-#define NOVALUE '\0'
-
-enum
-{
-  CLICKED_SIGNAL,
-  HOLD_SIGNAL,
-  LAST_SIGNAL
-};
-
-//forward definition
-     static gboolean moko_dialer_panel_pressed (MokoDigitButton * button,
-                                                GdkEventButton * event,
-                                                MokoDialerPanel *panel);
-
-     static gint moko_dialer_panel_signals[LAST_SIGNAL] = { 0 };
-
-
-typedef struct
-{
-  gchar value;
-  MokoDialerPanel *panel;
-} HoldTimeoutData;
-
-static void
-moko_dialer_panel_class_init (MokoDialerPanelClass * class)
-{
-/*
-  GtkVBoxClass* vbox_class;
-
-  vbox_class= (GtkVBoxClass*) class;
-*/
-
-  GtkObjectClass *object_class;
-
-  object_class = (GtkObjectClass *) class;
-  class->moko_dialer_panel_input = NULL;
-  class->moko_dialer_panel_hold = NULL;
-
-  moko_dialer_panel_signals[CLICKED_SIGNAL] =
-    g_signal_new ("user_input",
-                  G_OBJECT_CLASS_TYPE (object_class),
-                  G_SIGNAL_RUN_FIRST,
-                  G_STRUCT_OFFSET (MokoDialerPanelClass,
-                                   moko_dialer_panel_input), NULL, NULL,
-                  g_cclosure_marshal_VOID__CHAR, G_TYPE_NONE, 1,
-                  g_type_from_name ("gchar"));
-
-  moko_dialer_panel_signals[HOLD_SIGNAL] =
-    g_signal_new ("user_hold",
-                  G_OBJECT_CLASS_TYPE (object_class),
-                  G_SIGNAL_RUN_FIRST,
-                  G_STRUCT_OFFSET (MokoDialerPanelClass,
-                                   moko_dialer_panel_hold), NULL, NULL,
-                  g_cclosure_marshal_VOID__CHAR, G_TYPE_NONE, 1,
-                  g_type_from_name ("gchar"));
-
-}
-
-
-static void
-moko_dialer_panel_init (MokoDialerPanel * moko_dialer_panel)
-{
-  gchar *left[4][3] = {
-    {"1", "2", "3"},
-    {"4", "5", "6"},
-    {"7", "8", "9"},
-    {"*", "0", "#"}
-  };
-
-  gchar *right[4][3] = {
-    {"", "ABC", "DEF"},
-    {"GHI", "JKL", "MNO"},
-    {"PQRS", "TUV", "WXYZ"},
-    {"+", "p", "w"}
-  };
-
-  gchar leftchar[4][3] = {
-    {'1', '2', '3'},
-    {'4', '5', '6'},
-    {'7', '8', '9'},
-    {'*', '0', '#'}
-  };
-
-  gchar rightchar[4][3] = {
-    {NOVALUE, NOVALUE, NOVALUE},
-    {NOVALUE, NOVALUE, NOVALUE},
-    {NOVALUE, NOVALUE, NOVALUE},
-    {'+', 'p', 'w'}
-  };
-
-
-  GtkWidget *table;
-  gint i, j;
-
-  table = gtk_table_new (4, 3, TRUE);
-  gtk_container_add (GTK_CONTAINER (moko_dialer_panel), table);
-  gtk_widget_show (table);
-
-
-
-  for (i = 0; i < 4; i++)
-    for (j = 0; j < 3; j++)
-    {
-
-      moko_dialer_panel->buttons[i][j] =
-        moko_digit_button_new_with_labels (left[i][j], right[i][j]);
-
-      moko_digit_button_set_numbers (moko_dialer_panel->buttons[i][j],
-                                     leftchar[i][j], rightchar[i][j]);
-
-      gtk_table_attach_defaults (GTK_TABLE (table),
-                                 moko_dialer_panel->buttons[i][j], j, j + 1,
-                                 i, i + 1);
-
-      g_signal_connect ((gpointer) moko_dialer_panel->buttons[i][j],
-                        "button_press_event", 
-                        G_CALLBACK (moko_dialer_panel_pressed),
-                        moko_dialer_panel);
-      g_signal_connect ((gpointer) moko_dialer_panel->buttons[i][j],
-                        "button_release_event",
-                        G_CALLBACK (moko_dialer_panel_pressed),
-                        moko_dialer_panel);
-
-      gtk_widget_show (moko_dialer_panel->buttons[i][j]);
-    }
-
-}
-
-static gboolean
-moko_dialer_panel_hold_timeout (HoldTimeoutData *data)
-{
-  g_signal_emit (data->panel, moko_dialer_panel_signals[HOLD_SIGNAL], 0, data->value);
-
-  g_free (data);
-  return FALSE;
-}
-
-static gboolean
-moko_dialer_panel_pressed (MokoDigitButton *button, 
-                           GdkEventButton *event,
-                           MokoDialerPanel *panel)
-{
-  static gint hold_timeout_source = 0;
-
-  if (event->type == GDK_BUTTON_PRESS)
-  {
-    HoldTimeoutData *timeout_data;
-    gchar value = NOVALUE;
-
-    /* Normal 'clicked' event */
-    value = moko_digit_button_get_left (button);
-    g_signal_emit (panel, moko_dialer_panel_signals[CLICKED_SIGNAL], 0, value);
-
-    /* Set up for a tap-and-hold event */
-    value = moko_digit_button_get_right (button);
-
-    /* this button doesn't have a "hold" value */
-    if (value == NOVALUE)
-      return FALSE;
-
-    timeout_data = g_new0 (HoldTimeoutData, 1);
-
-    timeout_data->panel = panel;
-    timeout_data->value = value;
-
-    hold_timeout_source = g_timeout_add (800, (GSourceFunc) moko_dialer_panel_hold_timeout, timeout_data);
-
-  }
-  else if (event->type == GDK_BUTTON_RELEASE)
-  {
-    if (hold_timeout_source != 0)
-      g_source_remove (hold_timeout_source);
-  }
-  return FALSE;
-}
-
-GtkWidget *
-moko_dialer_panel_new ()
-{
-  MokoDialerPanel *dp;
-
-  dp = (MokoDialerPanel *) g_object_new (MOKO_TYPE_DIALER_PANEL, NULL);
-  return GTK_WIDGET (dp);
-
-}

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-panel.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-panel.h	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-panel.h	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,69 +0,0 @@
-/* moko-dialer-panel.h
- *
- *  Authored by Tony Guan<tonyguan at fic-sh.com.cn>
- *
- *  Copyright (C) 2006 FIC Shanghai Lab
- *
- *  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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date) [$Author: Tony Guan $]
- */
-#ifndef _MOKO_DIALER_PANEL_H_
-#define _MOKO_DIALER_PANEL_H_
-
-
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkvbox.h>
-#include "moko-digit-button.h"
-#include <glib-object.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
-
-G_BEGIN_DECLS
-#define MOKO_TYPE_DIALER_PANEL                (moko_dialer_panel_get_type())
-#define MOKO_DIALER_PANEL (obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_TYPE_DIALER_PANEL, MokoDialerPanel))
-#define MOKO_DIALER_PANEL_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass),MOKO_TYPE_DIALER_PANEL,MokoDialerPanelClass))
-#define MOKO_IS_DIALER_PANEL(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_TYPE_DIALER_PANEL))
-#define MOKO_IS_DIALER_PANEL_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_DIALER_PANEL))
-#define MOKO_DIALER_PANEL_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), MOKO_TYPE_DIALER_PANEL, MokoDialerPanelClass))
-typedef struct _MokoDialerPanelClass MokoDialerPanelClass;
-
-typedef struct _MokoDialerPanel MokoDialerPanel;
-struct _MokoDialerPanel
-{
-  GtkVBox vbox;
-  GtkWidget *buttons[4][3];
-};
-
-struct _MokoDialerPanelClass
-{
-  GtkVBoxClass parent_class;
-  void (*moko_dialer_panel_input) (MokoDialerPanel * moko_dialer_panel,
-                                   gchar parac);
-  void (*moko_dialer_panel_hold) (MokoDialerPanel * moko_dialer_panel,
-                                  gchar parac);
-};
-
-
-void moko_dialer_panel_clear (MokoDialerPanel * moko_dialer_panel);
-
-GType moko_dialer_panel_get_type (void);
-
-GtkWidget *moko_dialer_panel_new ();
-
-
-
-
-
-G_END_DECLS
-#endif //

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,544 +0,0 @@
-/*  moko-dialer-textview.c
- *
- *  Authored by:
- *    Tony Guan<tonyguan at fic-sh.com.cn>
- *    OpenedHand Ltd. <info at openedhand.com>
- *
- *  Copyright (C) 2006 FIC Shanghai Lab
- *
- *  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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date) [$Author: Tony Guan $]
- 
- */
-
-#include <string.h>
-
-#include "moko-dialer-textview.h"
-#include "error.h"
-
-G_DEFINE_TYPE (MokoDialerTextview, moko_dialer_textview, GTK_TYPE_TEXT_VIEW)
-     enum
-     {
-       CLICKED_SIGNAL,
-       HOLD_SIGNAL,
-       LAST_SIGNAL
-     };
-
-static void
-moko_dialer_textview_class_init (MokoDialerTextviewClass * class)
-{
-
-  GtkWidgetClass *widget_class;
-
-  widget_class = GTK_WIDGET_CLASS (class);
-
-
-  gtk_widget_class_install_style_property (widget_class,
-      g_param_spec_int (
-        "small_font",
-        "Small Font",
-        "Smallest font size for the display",
-        0,
-        128,
-        10,
-        G_PARAM_READABLE | G_PARAM_WRITABLE));
-  gtk_widget_class_install_style_property (widget_class,
-      g_param_spec_int (
-        "medium_font",
-        "Medium Font",
-        "Medium font size for the display",
-        0,
-        128,
-        15,
-        G_PARAM_READABLE | G_PARAM_WRITABLE));
-  gtk_widget_class_install_style_property (widget_class,
-      g_param_spec_int (
-        "large_font",
-        "Large Font",
-        "Largest font size for the display",
-        0,
-        128,
-        20,
-        G_PARAM_READABLE | G_PARAM_WRITABLE));
-
-
-
-}
-
-
-static void
-moko_dialer_textview_realize (MokoDialerTextview *moko_dialer_textview, gpointer user_data)
-{
-  /* Get the initial size of the textview and make sure it does not become
-   * smaller. This will prevent the widget resizing if the font size
-   * is reduced later on
-   */
-  GtkRequisition r;
-  gtk_widget_size_request (GTK_WIDGET (moko_dialer_textview), &r);
-  gtk_widget_set_size_request (GTK_WIDGET (moko_dialer_textview), r.width, r.height);
-
-}
-
-static void
-moko_dialer_textview_init (MokoDialerTextview * moko_dialer_textview)
-{
-
-  GtkTextView *textview = 0;
-  GtkTextBuffer *buffer;
-  gint large;
-
-  textview = &moko_dialer_textview->textview;
-  buffer = gtk_text_view_get_buffer (textview);
-  moko_dialer_textview->font_desc_textview = NULL;
-  moko_dialer_textview->tag_for_inputed = NULL;
-  moko_dialer_textview->tag_for_cursor = NULL;
-  moko_dialer_textview->tag_for_autofilled = NULL;
-
-  GTK_WIDGET_UNSET_FLAGS (textview, GTK_CAN_FOCUS);
-  gtk_text_view_set_editable (GTK_TEXT_VIEW (textview), FALSE);
-  gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (textview), FALSE);
-  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview), GTK_WRAP_CHAR);
-  gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview), FALSE);
-  gtk_text_view_set_left_margin (GTK_TEXT_VIEW (textview), 1);
-  gtk_text_view_set_right_margin (GTK_TEXT_VIEW (textview), 1);
-
-
-
-  PangoFontDescription *font_desc_textview = NULL;
-  font_desc_textview = pango_font_description_new ();
-
-  /* get font sizes */
-  gtk_widget_style_get (GTK_WIDGET (moko_dialer_textview), "large_font", &large, NULL);
-
-  /* set the default font for the textview. */
-  pango_font_description_set_size (font_desc_textview, large * PANGO_SCALE);
-  gtk_widget_modify_font (GTK_WIDGET (moko_dialer_textview), font_desc_textview);
-
-  if (font_desc_textview)
-  {
-    /* save it to the structure for later usage. */
-    moko_dialer_textview->font_desc_textview = font_desc_textview;
-  }
-  moko_dialer_textview->tag_for_cursor =
-    gtk_text_buffer_create_tag (buffer, "tag_cursor", "weight",
-                                "PANGO_WEIGHT_BOLD", NULL);
-  moko_dialer_textview->sensed = FALSE;
-
-
-  g_signal_connect (moko_dialer_textview, "realize", G_CALLBACK (moko_dialer_textview_realize), NULL);
-}
-
-
-GtkWidget *
-moko_dialer_textview_new ()
-{
-  MokoDialerTextview *dp;
-
-  dp = (MokoDialerTextview *) g_object_new (MOKO_TYPE_DIALER_TEXTVIEW, NULL);
-  return GTK_WIDGET (dp);
-
-}
-
-/**
- * @brief moko_dialer_textview_set_color(MokoDialerTextview *moko_dialer_textview)
- *
- * set the text left to the cursor to black, and right to red.
- *
- * @param moko_dialer_textview the display area
- * @param len the char length,if it exceeds 13,then automatically decrease the size.
- * @return  void
- * @retval void
- */
-
-void
-moko_dialer_textview_set_color (MokoDialerTextview * moko_dialer_textview)
-{
-
-  GtkTextBuffer *buffer;
-  GtkTextIter start, cursoriter_1, cursoriter;
-  GtkTextIter end;
-  gint small = 10, medium = 10, large = 10;
-
-  PangoLayout *pl;
-  gchar *text;
-  int pl_w, pl_h, textview_w, textview_h;
-  GdkWindow *textview_window;
-  gboolean centre_v = TRUE;
-
-  /* Obtaining the buffer associated with the widget. */
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (moko_dialer_textview));
-
-  gtk_text_buffer_get_iter_at_mark (buffer,
-                                    &cursoriter,
-                                    gtk_text_buffer_get_insert (buffer));
-
-  gtk_text_buffer_get_start_iter (buffer, &start);
-  gtk_text_buffer_get_end_iter (buffer, &end);
-
-  text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
-
-  /* no need to continue if we don't have any text */
-  if (!text)
-    return;
-  if (text && (strlen (text) < 1))
-    return;
-
-  gint cur = gtk_text_iter_get_offset (&cursoriter);
-
-  if (cur > 0)
-  {
-    gtk_text_buffer_remove_all_tags (buffer, &start, &end);
-
-    gtk_text_buffer_get_iter_at_offset (buffer, &cursoriter_1, cur - 1);
-//    gtk_text_buffer_apply_tag (buffer,
-//                               moko_dialer_textview->tag_for_inputed,
-//                               &start, &cursoriter);
-//    gtk_text_buffer_apply_tag (buffer,
-//                               moko_dialer_textview->tag_for_autofilled,
-//                               &cursoriter, &end);
-    gtk_text_buffer_apply_tag (buffer, moko_dialer_textview->tag_for_cursor,
-                               &cursoriter_1, &cursoriter);
-
-  }
-  else
-  {                             // cur==0
-//    gtk_text_buffer_apply_tag (buffer,
-//                               moko_dialer_textview->tag_for_autofilled,
-//                               &cursoriter, &end);
-  }
-
-  /* get font sizes */
-  gtk_widget_style_get (GTK_WIDGET (moko_dialer_textview), "small_font", &small, NULL);
-  gtk_widget_style_get (GTK_WIDGET (moko_dialer_textview), "medium_font", &medium, NULL);
-  gtk_widget_style_get (GTK_WIDGET (moko_dialer_textview), "large_font", &large, NULL);
-
-  /* create a pango layout to try different text sizes on */
-  pl = pango_layout_new (gtk_widget_get_pango_context (GTK_WIDGET (moko_dialer_textview)));
-  pango_layout_set_text (pl, text, -1);
-
-  /* get the textview width */
-  textview_window = gtk_text_view_get_window (GTK_TEXT_VIEW (moko_dialer_textview), GTK_TEXT_WINDOW_WIDGET);
-  gdk_drawable_get_size (textview_window, &textview_w, &textview_h);
-
-  /* try large size */
-  pango_font_description_set_size (moko_dialer_textview->font_desc_textview, large * PANGO_SCALE);
-  pango_layout_set_font_description (pl, moko_dialer_textview->font_desc_textview);
-  pango_layout_get_pixel_size (pl, &pl_w, &pl_h);
-
-  if (pl_w >= textview_w)
-  {
-    /* try medium size */
-    pango_font_description_set_size (moko_dialer_textview->font_desc_textview, medium * PANGO_SCALE);
-    pango_layout_set_font_description (pl, moko_dialer_textview->font_desc_textview);
-    pango_layout_get_pixel_size (pl, &pl_w, &pl_h);
-
-    /* set size to small if medium does not fit */
-    if (pl_w >= textview_w)
-    {
-      pango_font_description_set_size (moko_dialer_textview->font_desc_textview, small * PANGO_SCALE);
-      centre_v = FALSE;
-    }
-  }
-
-  /* we only want to centre the text vertically for large and medium fonts */
-  if (centre_v)
-  {
-    int padding = 0;
-    padding = MAX(0, (textview_h - pl_h) / 2);
-    gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (moko_dialer_textview), padding);
-    gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (moko_dialer_textview), padding);
-  }
-  else
-  {
-    gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (moko_dialer_textview), 0);
-    gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (moko_dialer_textview), 0);
-  }
-
-  gtk_widget_modify_font (GTK_WIDGET (moko_dialer_textview),
-                          moko_dialer_textview->font_desc_textview);
-
-  gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW (moko_dialer_textview),
-                                      gtk_text_buffer_get_insert (buffer));
-
-}
-
-
-
- /**
- * @brief moko_dialer_textview_insert  
- *
- * This function should be called upon the keypad is clicked in dialer window.
- *
- * @param button the button hit.
- * @param number the number to be added to the display.
- * @return  int
- * @retval 
- */
-
-gint
-moko_dialer_textview_insert (MokoDialerTextview * moko_dialer_textview,
-                             const gchar * number)
-{
-
-  gint len = 0;
-
-  GtkTextBuffer *buffer;
-  GtkTextIter start;
-  GtkTextIter end;
-  GtkTextIter selectioniter, insertiter;
-  GtkTextMark *selectmark, *insertmark;
-
-  /* Obtaining the buffer associated with the widget. */
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (moko_dialer_textview));
-
-  selectmark = gtk_text_buffer_get_selection_bound (buffer);
-  insertmark = gtk_text_buffer_get_insert (buffer);
-
-  /* get current cursor iterator */
-  gtk_text_buffer_get_iter_at_mark (buffer, &insertiter, insertmark);
-  gtk_text_buffer_get_iter_at_mark (buffer, &selectioniter, selectmark);
-
-  /* to see whether there is a selection range. */
-  if (gtk_text_iter_get_offset (&insertiter) !=
-      gtk_text_iter_get_offset (&selectioniter))
-  {
-    /* first delete the range */
-    gtk_text_buffer_delete (buffer, &selectioniter, &insertiter);
-    insertmark = gtk_text_buffer_get_insert (buffer);
-    gtk_text_buffer_get_iter_at_mark (buffer, &insertiter, insertmark);
-  }
-
-  gtk_text_buffer_get_start_iter (buffer, &start);
-  gtk_text_buffer_get_end_iter (buffer, &end);
-
-
-  len = gtk_text_buffer_get_char_count (buffer);
-  gtk_text_buffer_insert_at_cursor (buffer, number,
-                                    g_utf8_strlen (number, -1));
-  len = len + g_utf8_strlen (number, -1);
-
-  /* reget the cursor iter. */
-  insertmark = gtk_text_buffer_get_insert (buffer);
-  /* get current cursor iterator */
-  gtk_text_buffer_get_iter_at_mark (buffer, &insertiter, insertmark);
-  /* get the inputed string lengh. */
-  len = gtk_text_iter_get_offset (&insertiter);
-
-  moko_dialer_textview_set_color (moko_dialer_textview);
-  return len;
-}
-
-
-//get the input section of the textview 
-//if ALL=true, get whole text
-//else only get the inputed digits.
-gchar *
-moko_dialer_textview_get_input (MokoDialerTextview * moko_dialer_textview,
-                                gboolean all_text)
-{
-  GtkTextBuffer *buffer;
-  GtkTextIter start;
-  GtkTextIter end;
-  GtkTextIter insertiter;
-  GtkTextMark *insertmark;
-
-  /* Obtaining the buffer associated with the widget. */
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (moko_dialer_textview));
-
-  // get current cursor iterator
-  insertmark = gtk_text_buffer_get_insert (buffer);
-  gtk_text_buffer_get_iter_at_mark (buffer, &insertiter, insertmark);
-
-  //get start & end iterator
-  gtk_text_buffer_get_start_iter (buffer, &start);
-  gtk_text_buffer_get_end_iter (buffer, &end);
-
-  /* FIXME: Should this check all_text too? */
-  if (gtk_text_iter_get_offset (&insertiter) ==
-      gtk_text_iter_get_offset (&start))
-  {
-    return NULL;
-  }
-
-  if (all_text)
-    /* Get the entire buffer text. */
-    return gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
-  else
-    return gtk_text_buffer_get_text (buffer, &start, &insertiter, FALSE);
-
-}
-
-//delete all the input 
-int
-moko_dialer_textview_empty (MokoDialerTextview * moko_dialer_textview)
-{
-  GtkTextBuffer *buffer;
-
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (moko_dialer_textview));
-
-  gtk_text_buffer_set_text (buffer, "", -1);
-  return 1;
-}
-
-///delete the selection or one character.
-int
-moko_dialer_textview_delete (MokoDialerTextview * moko_dialer_textview)
-{
-  GtkTextBuffer *buffer;
-  GtkTextIter selectioniter, insertiter;
-  GtkTextMark *selectmark, *insertmark;
-  gint len;
-
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (moko_dialer_textview));
-
-  selectmark = gtk_text_buffer_get_selection_bound (buffer);
-  insertmark = gtk_text_buffer_get_insert (buffer);
-//get current cursor iterator
-  gtk_text_buffer_get_iter_at_mark (buffer, &insertiter, insertmark);
-  gtk_text_buffer_get_iter_at_mark (buffer, &selectioniter, selectmark);
-  // to see whether there is a selection range.
-  if (gtk_text_iter_get_offset (&insertiter) !=
-      gtk_text_iter_get_offset (&selectioniter))
-  {
-    // yes, first delete the range.
-    gtk_text_buffer_delete (buffer, &selectioniter, &insertiter);
-  }
-  else
-  {
-    // no selection, then just perform backspace.
-    gtk_text_buffer_backspace (buffer, &insertiter, TRUE, TRUE);
-  }
-
-//now we get the inputed string length. 
-  insertmark = gtk_text_buffer_get_insert (buffer);
-  // get current cursor iterator
-  gtk_text_buffer_get_iter_at_mark (buffer, &insertiter, insertmark);
-  len = gtk_text_iter_get_offset (&insertiter);
-
-  /* update colours */
-  moko_dialer_textview_set_color (moko_dialer_textview);
-
-  return 1;
-
-}
-
-//autofill the string to the inputed digits string on the textview
-
-int
-moko_dialer_textview_fill_it (MokoDialerTextview * moko_dialer_textview,
-                              gchar * string)
-{
-  GtkTextBuffer *buffer;
-  GtkTextIter start;
-  GtkTextIter end;
-  GtkTextIter insertiter;
-  GtkTextMark *insertmark;
-  gint offset;
-  gint offsetend;
-  gint offsetstart;
-
-//DBG_ENTER();
-//DBG_MESSAGE("Sensative string:%s",string);
-
-/* Obtaining the buffer associated with the widget. */
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (moko_dialer_textview));
-
-//get current cursor iterator
-  insertmark = gtk_text_buffer_get_insert (buffer);
-  gtk_text_buffer_get_iter_at_mark (buffer, &insertiter, insertmark);
-//get start & end iterator
-  gtk_text_buffer_get_start_iter (buffer, &start);
-  gtk_text_buffer_get_end_iter (buffer, &end);
-  offsetend = gtk_text_iter_get_offset (&end);
-  offset = gtk_text_iter_get_offset (&insertiter);
-//if startpos=endpos, that means we didn't input anything
-//so we just insert the text.
-
-  offsetstart = gtk_text_iter_get_offset (&start);
-  if (offsetend == offsetstart)
-  {
-
-    gtk_text_buffer_set_text (buffer, string, -1);
-
-    gtk_text_buffer_get_start_iter (buffer, &start);
-    gtk_text_buffer_place_cursor (buffer, &start);
-    moko_dialer_textview_set_color (moko_dialer_textview);
-    moko_dialer_textview->sensed = TRUE;
-    // gtk_widget_grab_focus(text_view);
-    return 1;
-
-  }
-
-/* Get the entire buffer text. */
-
-//codestring = gtk_text_buffer_get_text (buffer, &start, &insertiter, FALSE);
-
-  gtk_text_buffer_delete (buffer, &insertiter, &end);
-
-
-//reget current cursor iterator
-  insertmark = gtk_text_buffer_get_insert (buffer);
-  gtk_text_buffer_get_iter_at_mark (buffer, &insertiter, insertmark);
-
-//here we have to call the get sensentivestring to get "139" or something.
-//gtk_text_buffer_insert_with_tags_by_name(buffer,&insertiter,"139",3,tag_name);
-  if (string != 0)
-  {
-    gint len;
-    len = g_utf8_strlen (string, -1);
-    if (len > 0)
-    {
-      gtk_text_buffer_insert (buffer, &insertiter, string, len);
-
-      //reget current cursor iterator
-      insertmark = gtk_text_buffer_get_insert (buffer);
-      gtk_text_buffer_get_iter_at_mark (buffer, &insertiter, insertmark);
-      gtk_text_iter_set_offset (&insertiter, offset);
-      // set the private data of sensed.
-    }
-  }
-
-//setback the cursor position
-  gtk_text_buffer_place_cursor (buffer, &insertiter);
-
-  moko_dialer_textview_set_color (moko_dialer_textview);
-
-//gtk_widget_grab_focus(text_view);
-//g_free (codestring );
-
-//DBG_LEAVE();
-  return 1;
-}
-
-gint
-moko_dialer_textview_confirm_it (MokoDialerTextview * moko_dialer_textview,
-                                 const gchar * string)
-{
-
-  GtkTextBuffer *buffer;
-  GtkTextIter end;
-
-  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (moko_dialer_textview));
-
-
-  gtk_text_buffer_set_text (buffer, string, -1);
-
-
-  gtk_text_buffer_get_end_iter (buffer, &end);
-//set the cursor to the end of the buffer
-  gtk_text_buffer_place_cursor (buffer, &end);
-
-  moko_dialer_textview_set_color (moko_dialer_textview);
-//
-
-  return 1;
-
-}

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.h	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-textview.h	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,80 +0,0 @@
-/* moko-dialer-textview.h
- *
- *  Authored by Tony Guan<tonyguan at fic-sh.com.cn>
- *
- *  Copyright (C) 2006 FIC Shanghai Lab
- *
- *  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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date) [$Author: Tony Guan $]
- */
-#ifndef _MOKO_DIALER_TEXTVIEW_H_
-#define _MOKO_DIALER_TEXTVIEW_H_
-
-
-
-
-#include <gdk/gdk.h>
-#include <gtk/gtkvbox.h>
-#include <glib-object.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtktextview.h>
-
-G_BEGIN_DECLS
-#define MOKO_TYPE_DIALER_TEXTVIEW                (moko_dialer_textview_get_type())
-#define MOKO_DIALER_TEXTVIEW(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_TYPE_DIALER_TEXTVIEW, MokoDialerTextview))
-#define MOKO_DIALER_TEXTVIEW_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass),MOKO_TYPE_DIALER_TEXTVIEW,MokoDialerTextviewClass))
-#define MOKO_IS_DIALER_TEXTVIEW(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_TYPE_DIALER_TEXTVIEW))
-#define MOKO_IS_DIALER_TEXTVIEW_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_DIALER_TEXTVIEW))
-#define MOKO_DIALER_TEXTVIEW_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), MOKO_TYPE_DIALER_TEXTVIEW, MokoDialerTextviewClass))
-typedef struct _MokoDialerTextviewClass MokoDialerTextviewClass;
-
-typedef struct _MokoDialerTextview MokoDialerTextview;
-
-struct _MokoDialerTextview
-{
-  GtkTextView textview;         /* the main widget */
-  PangoFontDescription *font_desc_textview;     /* the font description of this textview */
-  GtkTextTag *tag_for_inputed;  /* the formating tag for the digits user already inputed */
-  GtkTextTag *tag_for_cursor;   /* the formatting tag  for the right digit user just inputed. */
-  GtkTextTag *tag_for_autofilled; /* the formatting tag for the autofilled digits if any. */
-  gboolean sensed;
-};
-
-struct _MokoDialerTextviewClass
-{
-  GtkTextViewClass parent_class;
-};
-
-
-GType moko_dialer_textview_get_type (void);
-
-GtkWidget *moko_dialer_textview_new ();
-
-int moko_dialer_textview_insert (MokoDialerTextview * moko_dialer_textview,
-                                 const gchar * number);
-
-gchar *moko_dialer_textview_get_input (MokoDialerTextview *
-                                       moko_dialer_textview,
-                                       gboolean all_text);
-int moko_dialer_textview_empty (MokoDialerTextview * moko_dialer_textview);
-int moko_dialer_textview_fill_it (MokoDialerTextview * moko_dialer_textview,
-                                  gchar * string);
-int moko_dialer_textview_delete (MokoDialerTextview * moko_dialer_textview);
-void moko_dialer_textview_set_color (MokoDialerTextview *
-                                     moko_dialer_textview);
-gint moko_dialer_textview_confirm_it (MokoDialerTextview *
-                                      moko_dialer_textview,
-                                      const gchar * string);
-
-G_END_DECLS
-#endif

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,910 +0,0 @@
-/*
- *  moko-dialer; a GObject wrapper for the dialer.
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include <gtk/gtk.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-bindings.h>
-
-#include <moko-gsmd-connection.h>
-#include <moko-journal.h>
-#include <moko-stock.h>
-
-#include "moko-dialer.h"
-
-#include "moko-contacts.h"
-#include "moko-history.h"
-#include "moko-keypad.h"
-#include "moko-notify.h"
-#include "moko-talking.h"
-#include "moko-sound.h"
-
-G_DEFINE_TYPE (MokoDialer, moko_dialer, G_TYPE_OBJECT)
-
-#define MOKO_DIALER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
-        MOKO_TYPE_DIALER, MokoDialerPrivate))
-
-#define GSM_REGISTER_TIMEOUT 10000 /* Ten seconds after powering up */
-
-struct _MokoDialerPrivate
-{
-  gint                status;
-  gchar               *incoming_clip;
-
-  /* Main Widgets */
-  GtkWidget          *window;
-  GtkWidget          *notebook;
-  
-  /* Pages of the notebook */
-  GtkWidget          *talking;
-  GtkWidget          *keypad;
-  GtkWidget          *history;
-
-  /* Special objects */
-  MokoGsmdConnection *connection;
-  MokoJournal        *journal;
-  MokoContacts       *contacts;
-  MokoNotify         *notify;
-
-  /* The shared MokoJournalEntry which is constantly created */
-  MokoJournalEntry   *entry; 
-  MokoTime           *time;
-
-  /* Registration variables */
-  MokoGsmdConnectionNetregType registered;
-  MokoGSMLocation     gsm_location;
-};
-
-enum
-{
-  INCOMING_CALL,
-  OUTGOING_CALL,
-  TALKING,
-  HUNG_UP,
-  REJECTED,
-  
-  LAST_SIGNAL
-};
-
-static guint dialer_signals[LAST_SIGNAL] = {0, };
-
-static void  on_keypad_dial_clicked (MokoKeypad  *keypad,
-                                     const gchar *number,
-                                     MokoDialer  *dialer);
-
-/* DBus functions */
-gboolean
-moko_dialer_show_dialer (MokoDialer *dialer, GError *error)
-{
-  MokoDialerPrivate *priv;
-  g_return_val_if_fail (MOKO_IS_DIALER (dialer), FALSE);
-  priv = dialer->priv;
- 
-  gtk_widget_show (priv->window);
-  gtk_window_present (GTK_WINDOW (priv->window));
-  return TRUE;
-}
-
-
-gboolean
-moko_dialer_show_missed_calls (MokoDialer *dialer, GError *error)
-{
-  MokoDialerPrivate *priv;
-
-  g_return_val_if_fail (MOKO_IS_DIALER (dialer), FALSE);
-  priv = dialer->priv;
-  
-  /* Filter history on missed calls */
-  
-  moko_history_set_filter (MOKO_HISTORY (priv->history), HISTORY_FILTER_MISSED);
-
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), -1);
-  
-  gtk_widget_show (priv->window);
-  gtk_window_present (GTK_WINDOW (priv->window));
-
-  return TRUE;
-}
-
-static gboolean
-moko_dialer_get_status (MokoDialer *dialer, gint *OUT_status, GError *error)
-{
-  MokoDialerPrivate *priv;
-  
-  g_return_val_if_fail (MOKO_IS_DIALER (dialer), FALSE);
-  priv = dialer->priv;
-
-  *OUT_status = priv->status;
-
-  return TRUE;
-}
-
-gboolean
-moko_dialer_dial (MokoDialer *dialer, const gchar *number, GError *error)
-{
-  MokoDialerPrivate *priv;
-
-  g_return_val_if_fail (MOKO_IS_DIALER (dialer), FALSE);
-  g_return_val_if_fail (number != NULL, FALSE);
-  g_return_val_if_fail (moko_dialer_show_dialer (dialer, NULL), FALSE);
-  priv = dialer->priv;
-
-  moko_dialer_show_dialer (dialer, NULL);
-  on_keypad_dial_clicked (NULL, number, dialer);
-  return TRUE;
-}
-
-static gboolean
-moko_dialer_hang_up (MokoDialer *dialer, const gchar *message, GError *error)
-{
-  g_return_val_if_fail (MOKO_IS_DIALER (dialer), FALSE);
-  
-  /* FIXME: Create a dialog and let the user know that another program is
-   * requesting the connection be dropped, and why ($message).
-   */
-  return TRUE;
-}
-
-/* </dbus functions> */
- 
-void
-moko_dialer_outgoing_call (MokoDialer *dialer, const gchar *number)
-{
-  ;
-}
-
-
-void
-moko_dialer_talking (MokoDialer *dialer)
-{
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  dialer->priv->status = DIALER_STATUS_TALKING;
-
-  g_signal_emit (G_OBJECT (dialer), dialer_signals[TALKING], 0);
-}
-
-void
-moko_dialer_hung_up (MokoDialer *dialer)
-{
-  MokoDialerPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv; 
-  
-  priv->status = DIALER_STATUS_NORMAL;
-
-  if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook)) == 3)
-    gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), 0);
-  
-  moko_gsmd_connection_voice_hangup (priv->connection);   
-  g_signal_emit (G_OBJECT (dialer), dialer_signals[HUNG_UP], 0);
-  
-}
-
-void
-moko_dialer_rejected (MokoDialer *dialer)
-{
-  MokoDialerPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
-  
-  priv->status = DIALER_STATUS_NORMAL;
-
-  /* Stop the notification */
-  moko_notify_stop (priv->notify);  
-
-  if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook)) == 3)
-    gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), 0);
-  
-  moko_gsmd_connection_voice_hangup (priv->connection);  
-  
-  g_signal_emit (G_OBJECT (dialer), dialer_signals[REJECTED], 0);
-}
-
-/* Callbacks from widgets */
-static void
-on_keypad_dial_clicked (MokoKeypad  *keypad,
-                        const gchar *number,
-                        MokoDialer  *dialer)
-{
-  GtkWidget *dlg;
-  MokoDialerPrivate *priv;
-  MokoContactEntry *entry = NULL;
-  
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
-
-  if (!number) {
-    gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 1);
-    moko_history_set_filter (MOKO_HISTORY (priv->history), HISTORY_FILTER_DIALED);
-    return;
-  }
-
-  /* check current dialer state */
-  if (0 || priv->status != DIALER_STATUS_NORMAL)
-  {
-    gchar *strings[] = {
-      "Normal",
-      "Incoming Call",
-      "Dialing",
-      "Outgoing Call"
-    };
-    dlg = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
-        "Cannot dial when dialer is busy.\nCurrent status = %s", strings[priv->status]);
-    gtk_dialog_run (GTK_DIALOG (dlg));
-    gtk_widget_destroy (dlg);
-
-    g_warning ("Cannot dial when dialer is busy: %d\n", priv->status);
-
-    return;
-  }
-  priv->status = DIALER_STATUS_DIALING;
-
-  /* check for network connection */
-  if (priv->registered != MOKO_GSMD_CONNECTION_NETREG_HOME
-      && priv->registered != MOKO_GSMD_CONNECTION_NETREG_ROAMING
-      && priv->registered != MOKO_GSMD_CONNECTION_NETREG_DENIED)
-  {
-    gchar *strings[] = {
-      "None",
-      "Home network registered",
-      "Searching for network",
-      "Network registration denied",
-      "",
-      "Roaming network registered"
-    };
-
-    dlg = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
-        "Cannot dial number. %s", strings[priv->registered]);
-    gtk_dialog_run (GTK_DIALOG (dlg));
-    gtk_widget_destroy (dlg);
-
-    /* no point continuing if we're not connected to a network! */
-    priv->status = DIALER_STATUS_NORMAL;
-    return;
-  }
-
-  entry = moko_contacts_lookup (moko_contacts_get_default (), number);
-
-  /* Prepare a voice journal entry */
-  if (priv->journal)
-  {
-    priv->entry = moko_journal_entry_new (VOICE_JOURNAL_ENTRY);
-    moko_journal_entry_set_direction (priv->entry, DIRECTION_OUT);
-    moko_journal_entry_set_source (priv->entry, "Openmoko Dialer");
-    moko_journal_entry_set_gsm_location (priv->entry, &priv->gsm_location);
-    moko_journal_voice_info_set_distant_number (priv->entry, number);
-    if (entry && entry->contact->uid)
-      moko_journal_entry_set_contact_uid (priv->entry, entry->contact->uid);
-  }
-  moko_talking_outgoing_call (MOKO_TALKING (priv->talking), number, entry);
-
-  gtk_notebook_insert_page (GTK_NOTEBOOK (priv->notebook), priv->talking,
-                            gtk_image_new_from_file (PKGDATADIR"/phone.png"),
-                            0);
-  gtk_container_child_set (GTK_CONTAINER (priv->notebook), priv->talking,
-                           "tab-expand", TRUE,
-                           NULL);
-  
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 0);
-
-  gtk_window_present (GTK_WINDOW (priv->window));
-
-  moko_keypad_set_talking (MOKO_KEYPAD (priv->keypad), TRUE);
-
-  moko_gsmd_connection_voice_dial (priv->connection, number);
-
-  g_signal_emit (G_OBJECT (dialer), dialer_signals[OUTGOING_CALL], 0, number);
-}
-
-static void
-on_keypad_pin_entry (MokoKeypad  *keypad,
-                     const gchar *in_pin,
-                     MokoDialer  *dialer)
-{
-  MokoDialerPrivate *priv;
-  gchar *pin;
-  
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
-
-  pin = g_strdup (in_pin);
-
-  g_debug ("Sending pin %s", pin);
-  moko_gsmd_connection_send_pin (priv->connection, pin);
-
-  moko_keypad_set_pin_mode (MOKO_KEYPAD (priv->keypad), FALSE);
-  g_free (pin);
-}
-
-
-static void
-on_talking_accept_call (MokoTalking *talking, MokoDialer *dialer)
-{
-  MokoDialerPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
-  
-  if (priv->status != DIALER_STATUS_INCOMING)
-    return;
-
-  moko_gsmd_connection_voice_accept (priv->connection);
-  priv->status = DIALER_STATUS_TALKING;
-
-  /* Stop the notification */
-  moko_notify_stop (priv->notify);  
-  
-  g_signal_emit (G_OBJECT (dialer), dialer_signals[TALKING], 0);
-}
-
-static void
-on_talking_reject_call (MokoTalking *talking, MokoDialer *dialer)
-{
-
-  MokoDialerPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
-
-  moko_gsmd_connection_voice_hangup (priv->connection);
-  priv->status = DIALER_STATUS_NORMAL;
-  
-  gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), 0);
- 
-  /* Finalise and add the journal entry */
-  if (priv->journal && priv->entry)
-  {
-    priv->time = moko_time_new_today ();
-    moko_journal_entry_set_dtstart (priv->entry, priv->time);
-    moko_journal_entry_set_dtend (priv->entry, priv->time);
-    moko_journal_voice_info_set_was_missed (priv->entry, TRUE);
-    moko_journal_add_entry (priv->journal, priv->entry);
-    moko_journal_write_to_storage (priv->journal);
-    priv->entry = NULL;
-    priv->time = NULL;
-  }
-
-  g_signal_emit (G_OBJECT (dialer), dialer_signals[REJECTED], 0);
-  moko_keypad_set_talking (MOKO_KEYPAD (priv->keypad), FALSE);
-  moko_notify_stop (priv->notify);
-}
-
-static void
-on_talking_cancel_call (MokoTalking *talking, MokoDialer *dialer)
-{
-  MokoDialerPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
-  
-  moko_gsmd_connection_voice_hangup (priv->connection);
-  
-  priv->status = DIALER_STATUS_NORMAL;
-  gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), 0);
-  
-  g_signal_emit (G_OBJECT (dialer), dialer_signals[HUNG_UP], 0);
-  moko_keypad_set_talking (MOKO_KEYPAD (priv->keypad), FALSE);
-}
-
-static void
-on_talking_silence (MokoTalking *talking, MokoDialer *dialer)
-{
-  MokoDialerPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
-
-  moko_notify_stop (priv->notify);
-}
-
-static void
-on_talking_speaker_toggle (MokoTalking *talking, 
-                           gboolean     speaker_phone,
-                           MokoDialer  *dialer)
-{
-  /* Toggle speaker phone */
-  static int on_speaker = FALSE;
-
-  if (on_speaker)
-    moko_sound_profile_set(SOUND_PROFILE_GSM_HANDSET);
-  else
-    moko_sound_profile_set(SOUND_PROFILE_GSM_SPEAKER_OUT);
-
-  on_speaker = !on_speaker;
-
-  g_debug ("Speaker toggled");
-}
-
-static void
-on_keypad_digit_pressed (MokoKeypad *keypad,
-                         const gchar digit,
-                         MokoDialer *dialer)
-{
-  MokoDialerPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
-
-  if ((digit == '+') || (digit == 'w') || (digit == 'p'))
-    return;
-
-  if (priv->status == DIALER_STATUS_TALKING)
-    moko_gsmd_connection_voice_dtmf (priv->connection, digit);
-}
-
-static void
-on_history_dial_number (MokoHistory *history,
-                        const gchar *number,
-                        MokoDialer  *dialer)
-{
-  on_keypad_dial_clicked (NULL, number, dialer);
-}
-
-/* Callbacks for MokoGsmdConnection */
-static void
-on_network_registered (MokoGsmdConnection *conn, 
-                       int type, 
-                       int lac,  
-                       int cell,
-                       MokoDialer *dialer)
-{
-  MokoDialerPrivate *priv;
-  
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
-
-  switch (type)
-  {
-    case MOKO_GSMD_CONNECTION_NETREG_NONE:
-    case MOKO_GSMD_CONNECTION_NETREG_SEARCHING:
-      /* Do nothing */
-      g_debug ("Searching for network");
-      break;
-    case MOKO_GSMD_CONNECTION_NETREG_DENIED:
-      /* This may be a pin issue*/
-      break;
-    case MOKO_GSMD_CONNECTION_NETREG_HOME:
-    case MOKO_GSMD_CONNECTION_NETREG_ROAMING:
-      g_debug ("Network registered: LocationAreaCode: %x. CellID: %x.", lac, cell);
-      priv->gsm_location.lac = lac;
-      priv->gsm_location.cid = cell;
-      break;
-    default:
-      g_warning ("Unhandled register event type = %d\n", type);
-   };
-
-  priv->registered = type;
-}
-
-static void
-on_incoming_call (MokoGsmdConnection *conn, int type, MokoDialer *dialer)
-{
-  MokoDialerPrivate *priv;
-  
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
-
-  /* We sometimes get the signals multiple times */
-  if (priv->status == DIALER_STATUS_INCOMING  
-        || priv->status == DIALER_STATUS_TALKING)
-  {
-    /*g_debug ("We are already showing the incoming page");*/
-    return;
-  }
-  priv->status = DIALER_STATUS_INCOMING;
-
-  if (priv->incoming_clip)
-    g_free (priv->incoming_clip);
-  priv->incoming_clip = NULL;
-
-  /* Prepare a voice journal entry */
-  if (priv->journal)
-  {
-    priv->entry = moko_journal_entry_new (VOICE_JOURNAL_ENTRY);
-    moko_journal_entry_set_direction (priv->entry, DIRECTION_IN);
-    moko_journal_entry_set_source (priv->entry, "Openmoko Dialer");
-    moko_journal_entry_set_gsm_location (priv->entry, &priv->gsm_location);
-  }
-  /* Set up the user interface */
-  moko_talking_incoming_call (MOKO_TALKING (priv->talking), NULL, NULL);
-
-  gtk_notebook_insert_page (GTK_NOTEBOOK (priv->notebook), priv->talking,
-                            gtk_image_new_from_file (PKGDATADIR"/phone.png"),
-                            0);
-  gtk_container_child_set (GTK_CONTAINER (priv->notebook), priv->talking,
-                           "tab-expand", TRUE,
-                           NULL); 
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 0);
-  
-  gtk_window_present (GTK_WINDOW (priv->window));
-
-  /* Start the notification */
-  moko_notify_start (priv->notify);
-
-  g_signal_emit (G_OBJECT (dialer), dialer_signals[INCOMING_CALL], 0, NULL);
-}
-
-static void
-on_incoming_clip (MokoGsmdConnection *conn,
-                  const gchar        *number,
-                  MokoDialer         *dialer)
-{
-  MokoDialerPrivate *priv;
-  MokoContactEntry *entry;
-
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
-
-  if (priv->incoming_clip && (strcmp (number, priv->incoming_clip) == 0))
-  {
-    return;
-  }
-
-  priv->incoming_clip = g_strdup (number);
-  
-  entry = moko_contacts_lookup (moko_contacts_get_default (), number);
-  moko_talking_set_clip (MOKO_TALKING (priv->talking), number, entry);
-
-  /* Add the info to the journal entry */
-  if (priv->journal && priv->entry)
-  {
-    moko_journal_voice_info_set_distant_number (priv->entry, number);
-    if (entry)
-      moko_journal_entry_set_contact_uid (priv->entry, entry->contact->uid);
-  }
-  g_signal_emit (G_OBJECT (dialer), dialer_signals[INCOMING_CALL], 
-                 0, number);
-  g_debug ("Incoming Number = %s", number);
-}
-
-static void
-on_pin_requested (MokoGsmdConnection *conn, int type, MokoDialer *dialer)
-{
-  MokoDialerPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
-  
-  moko_keypad_set_pin_mode (MOKO_KEYPAD (priv->keypad), TRUE);
-  moko_dialer_show_dialer (dialer, NULL);
-  g_debug ("Pin Requested");
-
-}
-
-static void
-on_call_progress_changed (MokoGsmdConnection *conn, 
-                          int type, 
-                          MokoDialer *dialer)
-{
-  MokoDialerPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_DIALER (dialer));
-  priv = dialer->priv;
- 
-  switch (type) 
-  {
-    case MOKO_GSMD_PROG_DISCONNECT:
-    case MOKO_GSMD_PROG_RELEASE:
-      /* Finalise and add the journal entry */
-      if (priv->journal && priv->entry)
-      {
-        priv->time = moko_time_new_today ();
-        moko_journal_entry_set_dtend (priv->entry, priv->time);
-
-        if (priv->status == DIALER_STATUS_INCOMING)
-        {
-          moko_journal_entry_set_dtstart (priv->entry, priv->time);
-          moko_journal_voice_info_set_was_missed (priv->entry, TRUE);
-        }
-
-        moko_journal_add_entry (priv->journal, priv->entry);
-        moko_journal_write_to_storage (priv->journal);
-        priv->entry = NULL;
-        priv->time = NULL;
-      }
-
-      moko_dialer_hung_up (dialer);
-      moko_keypad_set_talking (MOKO_KEYPAD (priv->keypad), FALSE);
-
-      if (priv->incoming_clip)
-        g_free (priv->incoming_clip);
-      priv->incoming_clip = NULL;
-
-      moko_notify_stop (priv->notify);
-      g_debug ("mokogsmd disconnect");
-      break;
-    
-    case MOKO_GSMD_PROG_REJECT:
-      moko_dialer_rejected (dialer);
-      moko_keypad_set_talking (MOKO_KEYPAD (priv->keypad), FALSE);
-      g_debug ("mokogsmd reject");
-      break;
-    
-    case MOKO_GSMD_PROG_CONNECTED:
-      if (priv->status != DIALER_STATUS_TALKING)
-        moko_dialer_talking (dialer);
-      moko_talking_accepted_call (MOKO_TALKING (priv->talking), NULL, NULL);
-      moko_keypad_set_talking (MOKO_KEYPAD (priv->keypad), TRUE);
-
-      /* Update a journal entry */
-      if (priv->journal && priv->entry)
-      {
-        priv->time = moko_time_new_today ();
-        moko_journal_entry_set_dtstart (priv->entry, priv->time);
-      }
-      g_debug ("mokogsmd connected");
-      break;
-    case MOKO_GSMD_PROG_SETUP:
-      g_debug ("mokogsmd setup");
-      break;
-    case MOKO_GSMD_PROG_ALERT:
-      g_debug ("mokogsmd alert");
-      break;
-    case  MOKO_GSMD_PROG_CALL_PROCEED:
-      g_debug ("mokogsmd proceed");
-      break;
-    case MOKO_GSMD_PROG_SYNC:
-      g_debug ("mokogsmd sync");
-      break;
-    case  MOKO_GSMD_PROG_PROGRESS:
-      g_debug ("mokogsmd progress");
-      break;
-    case MOKO_GSMD_PROG_UNKNOWN:
-    default:
-      g_debug ("mokogsmd unknown");
-      break;
-  }
-}
-
-/* GObject functions */
-static void
-moko_dialer_dispose (GObject *object)
-{
-  MokoDialer *dialer;
-  MokoDialerPrivate *priv;
-
-  dialer = MOKO_DIALER (object);
-  priv = dialer->priv;
-
-  /* Close journal */
-  if (priv->journal)
-  {
-    moko_journal_write_to_storage (priv->journal);
-    moko_journal_close (priv->journal);
-  }
-  G_OBJECT_CLASS (moko_dialer_parent_class)->dispose (object);
-}
-
-static void
-moko_dialer_finalize (GObject *dialer)
-{
-  G_OBJECT_CLASS (moko_dialer_parent_class)->finalize (dialer);
-}
-
-#include "moko-dialer-glue.h"
-
-static void
-moko_dialer_class_init (MokoDialerClass *klass)
-{
-  GObjectClass *obj_class = G_OBJECT_CLASS (klass);
-
-  obj_class->finalize = moko_dialer_finalize;
-  obj_class->dispose = moko_dialer_dispose;
-
-  /* add class signals */
-  dialer_signals[INCOMING_CALL] =
-    g_signal_new ("incoming_call", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoDialerClass, incoming_call),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__STRING,
-                  G_TYPE_NONE, 
-                  1, G_TYPE_STRING);
-
-  dialer_signals[OUTGOING_CALL] =
-    g_signal_new ("outgoing_call", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoDialerClass, outgoing_call),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__STRING,
-                  G_TYPE_NONE, 
-                  1, G_TYPE_STRING);
-
-   dialer_signals[TALKING] =
-    g_signal_new ("talking", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoDialerClass, talking),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE, 0);
-
-   dialer_signals[HUNG_UP] =
-    g_signal_new ("hung_up", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoDialerClass, hung_up),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE, 0);
-
-   dialer_signals[REJECTED] =
-    g_signal_new ("rejected", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoDialerClass, rejected),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE, 0);
-
-  g_type_class_add_private (obj_class, sizeof (MokoDialerPrivate)); 
-  dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass), 
-                                   &dbus_glib_moko_dialer_object_info);
-}
-
-static void
-dialer_display_error (GError *err)
-{
-  GtkWidget *dlg;
-
-  if (!err)
-    return;
-
-  dlg = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Dialer: %s", err->message);
-  gtk_dialog_run (GTK_DIALOG (dlg));
-  gtk_widget_destroy (dlg);
-}
-
-static void
-moko_dialer_init (MokoDialer *dialer)
-{
-  MokoDialerPrivate *priv;
-  MokoGsmdConnection *conn;
-  GError *err = NULL;
-
-  priv = dialer->priv = MOKO_DIALER_GET_PRIVATE (dialer);
-
-  /* create the dialer_data struct */
-  priv->status = DIALER_STATUS_NORMAL;
-  
-  /* clear incoming clip */
-  priv->incoming_clip = NULL;
-
-  /* Initialise the contacts list */
-  //contact_init_contact_data (&(priv->data->g_contactlist));
-
-  /* Init the gsmd connection, and power it up */
-  conn = priv->connection = moko_gsmd_connection_new ();
-  moko_gsmd_connection_set_antenna_power (conn, TRUE, &err);
-
-  dialer_display_error (err);
-  if (err && err->code == MOKO_GSMD_ERROR_CONNECT)
-    exit (1); /* no point continuing if we can't connect to gsmd? */
-
- 
-  /* Connect to the gsmd signals */
-  g_signal_connect (G_OBJECT (conn), "network-registration", 
-                    G_CALLBACK (on_network_registered), (gpointer)dialer);
-  g_signal_connect (G_OBJECT (conn), "incoming-call", 
-                    G_CALLBACK (on_incoming_call), (gpointer)dialer);
-  g_signal_connect (G_OBJECT (conn), "incoming-clip",
-                    G_CALLBACK (on_incoming_clip), (gpointer)dialer);
-  g_signal_connect (G_OBJECT (conn), "pin-requested", 
-                    G_CALLBACK (on_pin_requested), (gpointer)dialer);
-  g_signal_connect (G_OBJECT (conn), "call-progress", 
-                    G_CALLBACK (on_call_progress_changed), (gpointer)dialer);
-
-  /* FIXME:
-   *  moko_gsmd_connection_get_network_status always seems to return 0 here */
-  priv->registered = MOKO_GSMD_CONNECTION_NETREG_SEARCHING;
-  moko_gsmd_connection_network_register (conn);
- 
-  /* Set up the journal */
-  priv->journal = moko_journal_open_default ();
-  if (!priv->journal || !moko_journal_load_from_storage (priv->journal))
-  {
-    g_warning ("Cannot load journal");
-    priv->journal = NULL;
-  }
-  else
-    g_debug ("Journal Loaded");
-
-  /* Load the contacts store */
-  priv->contacts = moko_contacts_get_default ();
-
-  /* Load the notification object */
-  priv->notify = moko_notify_new ();
-
-  /* Create the window */
-  priv->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  g_signal_connect (G_OBJECT (priv->window), "delete-event",
-                    (GCallback) gtk_widget_hide_on_delete, NULL);
-  gtk_window_set_title (GTK_WINDOW (priv->window), "Dialer");
-
-  /* Notebook */
-  priv->notebook = gtk_notebook_new ();
-  gtk_notebook_set_tab_pos (GTK_NOTEBOOK (priv->notebook), GTK_POS_BOTTOM);
-  gtk_container_add (GTK_CONTAINER (priv->window), priv->notebook);
-
-  /* Talking: We don't actually add it to the notebook yet, as it is only added
-   * as/when needed. Therefore we just create it, and ref it (so it will 
-   * survive reparenting.
-   */
-  priv->talking = moko_talking_new (priv->journal);
-  g_object_ref (G_OBJECT (priv->talking));
-  gtk_widget_show_all (priv->talking);
-  g_signal_connect (G_OBJECT (priv->talking), "accept_call",
-                    G_CALLBACK (on_talking_accept_call), (gpointer)dialer);
-  g_signal_connect (G_OBJECT (priv->talking), "reject_call",
-                    G_CALLBACK (on_talking_reject_call), (gpointer)dialer);
-  g_signal_connect (G_OBJECT (priv->talking), "cancel_call",
-                    G_CALLBACK (on_talking_cancel_call), (gpointer)dialer);
-  g_signal_connect (G_OBJECT (priv->talking), "silence",
-                    G_CALLBACK (on_talking_silence), (gpointer)dialer);
-  g_signal_connect (G_OBJECT (priv->talking), "speaker_toggle",
-                    G_CALLBACK (on_talking_speaker_toggle), (gpointer)dialer);
-
-  /* Keypad */
-  priv->keypad = moko_keypad_new ();
-  g_signal_connect (G_OBJECT (priv->keypad), "dial_number",
-                    G_CALLBACK (on_keypad_dial_clicked), (gpointer)dialer);
-  g_signal_connect (G_OBJECT (priv->keypad), "pin_entry",
-                    G_CALLBACK (on_keypad_pin_entry), (gpointer)dialer);
-  g_signal_connect (G_OBJECT (priv->keypad), "digit_pressed",
-                    G_CALLBACK (on_keypad_digit_pressed), (gpointer)dialer);
-  gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->keypad,
-                            gtk_image_new_from_file (PKGDATADIR"/dtmf.png"));
-  gtk_container_child_set (GTK_CONTAINER (priv->notebook), priv->keypad,
-                          "tab-expand", TRUE,
-                          NULL);
-
-  /* History */
-  priv->history = moko_history_new (priv->journal);
-  g_signal_connect (G_OBJECT (priv->history), "dial_number",
-                    G_CALLBACK (on_history_dial_number), (gpointer)dialer);
-  gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->history,
-                            gtk_image_new_from_stock (MOKO_STOCK_CALL_HISTORY,
-                                                      GTK_ICON_SIZE_BUTTON));
-  gtk_container_child_set (GTK_CONTAINER (priv->notebook), priv->history,
-                           "tab-expand", TRUE,
-                           NULL);
-
-  gtk_widget_show_all (priv->notebook);
-  gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 0);
-}
-
-MokoDialer*
-moko_dialer_get_default (void)
-{
-  static MokoDialer *dialer = NULL;
-  if (dialer)
-    return dialer;
-  
-  dialer = g_object_new (MOKO_TYPE_DIALER, NULL);
-
-  return dialer;
-}

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.h	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.h	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,122 +0,0 @@
-/*
- *  moko-dialer; a GObject wrapper for the dialer which exports method and
- *  signals over dbus
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _HAVE_MOKO_DIALER_H
-#define _HAVE_MOKO_DIALER_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define MOKO_TYPE_DIALER (moko_dialer_get_type ())
-
-#define MOKO_DIALER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-        MOKO_TYPE_DIALER, MokoDialer))
-
-#define MOKO_DIALER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
-        MOKO_TYPE_DIALER, MokoDialerClass))
-
-#define MOKO_IS_DIALER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-        MOKO_TYPE_DIALER))
-
-#define MOKO_IS_DIALER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-        MOKO_TYPE_DIALER))
-
-#define MOKO_DIALER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-        MOKO_TYPE_DIALER, MokoDialerClass))
-
-typedef struct _MokoDialer MokoDialer;
-typedef struct _MokoDialerClass MokoDialerClass;
-typedef struct _MokoDialerPrivate MokoDialerPrivate;
-
-enum
-{
-  DIALER_STATUS_NORMAL=0,
-  DIALER_STATUS_INCOMING,
-  DIALER_STATUS_DIALING,
-  DIALER_STATUS_TALKING
-
-};
-
-struct _MokoDialer
-{
-  GObject         parent;
-
-  /*< private >*/
-  MokoDialerPrivate   *priv;
-};
-
-struct _MokoDialerClass 
-{
-  /*< private >*/
-  GObjectClass    parent_class;
-  
-  /* signals */
-
-    /* Initiating a connection */
-  void (*incoming_call) (MokoDialer *dialer, const gchar *number);
-  void (*outgoing_call) (MokoDialer *dialer, const gchar *number);
-  
-    /* Connected, either user accepted the call, or the outgoing call was
-     * successful
-     */
-  void (*talking)       (MokoDialer *dialer);
-
-    /* Finished a call */
-  void (*hung_up)       (MokoDialer *dialer);
-  void (*rejected)      (MokoDialer *dialer);  
-    
-  /* future padding */
-  void (*_moko_dialer_1) (void);
-  void (*_moko_dialer_2) (void);
-  void (*_moko_dialer_3) (void);
-  void (*_moko_dialer_4) (void);
-}; 
-
-GType moko_dialer_get_type (void) G_GNUC_CONST;
-
-MokoDialer*        
-moko_dialer_get_default (void);
-
-gboolean
-moko_dialer_show_dialer (MokoDialer *dialer, GError *error);
-
-gboolean
-moko_dialer_show_missed_calls (MokoDialer *dialer, GError *error);
-
-gboolean
-moko_dialer_dial (MokoDialer *dialer, const gchar *number, GError *error);
-
-void
-moko_dialer_outgoing_call (MokoDialer *dialer, const gchar *number);
-
-void
-moko_dialer_talking (MokoDialer *dialer);
-
-void
-moko_dialer_hung_up (MokoDialer *dialer);
-
-void
-moko_dialer_rejected (MokoDialer *dialer);
-
-G_END_DECLS
-
-#endif /* _HAVE_MOKO_DIALER_H */

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-digit-button.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-digit-button.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-digit-button.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,146 +0,0 @@
-/*  moko-button-digit.c
- *
- *  Authored by Tony Guan<tonyguan at fic-sh.com.cn>
- *
- *  Copyright (C) 2006 FIC Shanghai Lab
- *
- *  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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date) [$Author: Tony Guan $]
- */
-
-#include "moko-digit-button.h"
-#include <gtk/gtkwindow.h>
-#include <gtk/gtk.h>
-#include <gtk/gtkbutton.h>
-
-
-G_DEFINE_TYPE (MokoDigitButton, moko_digit_button, GTK_TYPE_BUTTON)
-
-#define MOKO_DIGIT_BUTTON_GET_PRIVATE(o)   (G_TYPE_INSTANCE_GET_PRIVATE ((o), MOKO_TYPE_DIGIT_BUTTON, MokoDigitButtonPrivate))
-struct _MokoDigitButtonPrivate
-{
-  GtkWidget *labelDigit;
-  GtkWidget *labelAcrobat;
-  gchar leftclickdigit;
-  gchar rightclickdigit;
-};
-
-
-
-typedef struct _MokoDigitButtonPrivate MokoDigitButtonPrivate;
-
-GtkWidget
-*moko_digit_button_new ()
-{
-  return moko_digit_button_new_with_labels ("1", "ABC");
-}
-
-
-/**
- * @brief new a MokoDigitButton with the 2 strings.
- * @param string_digit  the left digit part of the button. such as '1','2'...'0'
- * @param string_acrobat  the right acrobat part of the button, such as 'ABC' etc.
- */
-GtkWidget *
-moko_digit_button_new_with_labels (const gchar * string_digit,
-                                   const gchar * string_acrobat)
-{
-  gchar *str;
-  MokoDigitButton *digitbutton =
-    (MokoDigitButton *) g_object_new (MOKO_TYPE_DIGIT_BUTTON, NULL);
-
-  gtk_widget_show (GTK_WIDGET (digitbutton));
-  GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (digitbutton), GTK_CAN_FOCUS);
-
-  GtkWidget *alignment = gtk_alignment_new (0.5, 0.5, 0, 0);
-  gtk_container_add (GTK_CONTAINER (digitbutton), alignment);
-  gtk_widget_show (alignment);
-
-  GtkWidget *hbox = gtk_vbox_new (FALSE, 0);
-  gtk_container_add (GTK_CONTAINER (alignment), hbox);
-
-
-  GtkWidget *labelDigit = gtk_label_new (NULL);
-  str = g_markup_printf_escaped ("<span size=\"xx-large\">%s</span>", string_digit);
-  gtk_label_set_markup (GTK_LABEL (labelDigit), str);
-  gtk_box_pack_start (GTK_BOX (hbox), labelDigit, TRUE, TRUE, 0);
-  g_free (str);
-
-  GtkWidget *labelAcrobat = gtk_label_new (NULL);
-  str = g_markup_printf_escaped ("<small>%s</small>", string_acrobat);
-  gtk_label_set_markup (GTK_LABEL (labelAcrobat), str);
-  g_free (str);
-  gtk_container_add (GTK_CONTAINER (hbox), labelAcrobat);
-
-  gtk_widget_set_name (GTK_WIDGET (digitbutton), "mokodialerdigitbutton");
-
-  MokoDigitButtonPrivate *priv =
-    (MokoDigitButtonPrivate *) MOKO_DIGIT_BUTTON_GET_PRIVATE (digitbutton);
-
-  priv->labelDigit = labelDigit;
-  priv->labelAcrobat = labelAcrobat;
-
-  gtk_widget_show_all (alignment);
-
-  return GTK_WIDGET (digitbutton);
-
-}
-
-gboolean
-moko_digit_button_set_numbers (GtkWidget * widget, gchar left, gchar right)
-{
-
-  g_return_val_if_fail (MOKO_IS_DIGIT_BUTTON (widget), FALSE);
-  MokoDigitButtonPrivate *priv =
-    (MokoDigitButtonPrivate *) MOKO_DIGIT_BUTTON_GET_PRIVATE (widget);
-  g_return_val_if_fail (priv != NULL, FALSE);
-
-  priv->leftclickdigit = left;
-  priv->rightclickdigit = right;
-  return TRUE;
-}
-
-static void
-moko_digit_button_class_init (MokoDigitButtonClass * klass)
-{
-  g_type_class_add_private (klass, sizeof (MokoDigitButtonPrivate));
-  return;
-}
-
-/**
- * @brief  set the digit button digit field to be -1.
- */
-static void
-moko_digit_button_init (MokoDigitButton * self)
-{
-
-  MokoDigitButtonPrivate *priv = MOKO_DIGIT_BUTTON_GET_PRIVATE (self);
-  priv->labelDigit = 0;
-  priv->labelAcrobat = 0;
-  priv->leftclickdigit = -1;
-  priv->rightclickdigit = -1;
-  return;
-}
-
-gchar
-moko_digit_button_get_left (MokoDigitButton * button)
-{
-  MokoDigitButtonPrivate *priv = MOKO_DIGIT_BUTTON_GET_PRIVATE (button);
-  return (priv->leftclickdigit);
-}
-
-gchar
-moko_digit_button_get_right (MokoDigitButton * button)
-{
-  MokoDigitButtonPrivate *priv = MOKO_DIGIT_BUTTON_GET_PRIVATE (button);
-  return (priv->rightclickdigit);
-}
-

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-digit-button.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-digit-button.h	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-digit-button.h	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,62 +0,0 @@
-/*  moko-button-digit.h
- *
- *  Authored by Tony Guan<tonyguan at fic-sh.com.cn>
- *
- *  Copyright (C) 2006 FIC Shanghai Lab
- *
- *  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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date) [$Author: Tony Guan $]
- */
-
-#ifndef _MOKO_DIGIT_BUTTON_H_
-#define _MOKO_DIGIT_BUTTON_H_
-
-#include <gtk/gtkbutton.h>
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-#define MOKO_TYPE_DIGIT_BUTTON                 (moko_digit_button_get_type())
-#define MOKO_DIGIT_BUTTON(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOKO_TYPE_DIGIT_BUTTON, MokoDigitButton))
-#define MOKO_DIGIT_BUTTON_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), MOKO_TYPE_DIGIT_BUTTON, MokoDigitButtonClass))
-#define MOKO_IS_DIGIT_BUTTON(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOKO_TYPE_DIGIT_BUTTON))
-#define MOKO_IS_DIGIT_BUTTON_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), MOKO_TYPE_DIGIT_BUTTON))
-#define MOKO_DIGIT_BUTTON_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), MOKO_TYPE_DIGIT_BUTTON, MokoDigitButtonClass))
-typedef struct _MokoDigitButtonClass MokoDigitButtonClass;
-
-typedef struct _MokoDigitButton MokoDigitButton;
-struct _MokoDigitButton
-{
-  GtkButton gtkbutton;
-};
-
-struct _MokoDigitButtonClass
-{
-  GtkButtonClass parent_class;
-};
-
-
-GType moko_digit_button_get_type (void);
-
-gboolean moko_digit_button_set_numbers (GtkWidget * widget, gchar left,
-                                        gchar right);
-
-GtkWidget *moko_digit_button_new_with_labels (const gchar * label1,
-                                              const gchar * label2);
-
-GtkWidget *moko_digit_button_new ();
-
-gchar moko_digit_button_get_right (MokoDigitButton * button);
-
-gchar moko_digit_button_get_left (MokoDigitButton * button);
-
-G_END_DECLS
-#endif // _MOKO_FINGER_WHEEL_H_

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-history.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-history.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-history.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,685 +0,0 @@
-/*
- *  moko-history; a Call History view; Adapted from the original 
- *  dialer-window-history code authored by Tony Guan <tonyguan at fic-sh.com.cn>
- *  and OpenedHand Ltd.
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include <gtk/gtk.h>
-
-#include <string.h>
-
-#include <moko-gsmd-connection.h>
-#include <moko-journal.h>
-#include <moko-stock.h>
-#include <moko-finger-scroll.h>
-
-#include "moko-contacts.h"
-#include "moko-history.h"
-
-G_DEFINE_TYPE (MokoHistory, moko_history, GTK_TYPE_VBOX)
-
-#define MOKO_HISTORY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
-        MOKO_TYPE_HISTORY, MokoHistoryPrivate))
-
-#define HISTORY_MAX_ENTRIES 50
-
-#define HISTORY_CALL_INCOMING_ICON "moko-history-call-in"
-#define HISTORY_CALL_OUTGOING_ICON "moko-history-call-out"
-#define HISTORY_CALL_MISSED_ICON   "moko-history-call-missed"
- 
-enum
-{
-  CALL_INCOMING = 0,
-  CALL_OUTGOING,
-  CALL_MISSED,
-
-  N_CALL_TYPES
-};
-
-static gchar *icon_names[N_CALL_TYPES]  = {"moko-history-call-in",
-                                           "moko-history-call-out",
-                                           "moko-history-call-missed"};
-static GdkPixbuf *icons[N_CALL_TYPES] = {NULL, NULL, NULL};
-  
-struct _MokoHistoryPrivate
-{
-  MokoJournal       *journal;
-
-  GtkWidget         *treeview;
-  GtkWidget         *combo;
-
-  GtkTreeModel      *main_model;
-  GtkTreeModel      *sort_model;
-  GtkTreeModel      *filter_model;
-
-};
-
-enum
-{
-  DIAL_NUMBER,
-
-  LAST_SIGNAL
-};
-
-static guint history_signals[LAST_SIGNAL] = {0, };
-
-enum
-{
-  PROP_JOURNAL=1
-};
-
-enum history_columns 
-{
-  NUMBER_COLUMN = 0,
-  DSTART_COLUMN,
-  ICON_NAME_COLUMN,
-  DISPLAY_TEXT_COLUMN,
-  CALL_TYPE_COLUMN,
-  ENTRY_POINTER_COLUMN
-};
-
-void
-moko_history_set_filter (MokoHistory *history, gint filter)
-{
-  MokoHistoryPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_HISTORY (history));
-  priv = history->priv;
-
-  gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo), filter);
-}
-
-static void
-on_dial_clicked (GtkWidget *button, MokoHistory *history)
-{
-  MokoHistoryPrivate *priv;
-  GtkTreeSelection *selection;
-  GtkTreeView *treeview;
-  GtkTreeIter iter;
-  GtkTreeModel *model;
-  gchar *number;
- 
-  g_return_if_fail (MOKO_IS_HISTORY (history));
-  priv = history->priv;
-
-  treeview = GTK_TREE_VIEW (priv->treeview);
-  selection = gtk_tree_view_get_selection (treeview);
-  model = gtk_tree_view_get_model (treeview);
-
-  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
-    return;
-
-  gtk_tree_model_get (model, &iter, NUMBER_COLUMN, &number, -1);
-
-  g_signal_emit (G_OBJECT (history), history_signals[DIAL_NUMBER], 0, number);
-
-  g_free (number);
-}
-
-static void
-on_sms_clicked (GtkWidget *button, MokoHistory *history)
-{
-  g_debug ("sms clicked");
-}
-
-static void
-on_delete_clicked (GtkWidget *button, MokoHistory *history)
-{
-  MokoHistoryPrivate *priv;
-  GtkWidget *dialog;
-  GtkTreeIter iter0;
-  GtkTreeIter iter1;
-  GtkTreeIter iter2;
-  GtkTreeModel *filtered;
-  GtkTreeModel *sorted;
-  GtkTreeModel *store;
-  GtkTreeSelection *selection;
-  GtkTreeView *treeview;
-  GtkTreePath *path;
-  const gchar *uid;
-  gint result = 0;
-
-  g_return_if_fail (MOKO_IS_HISTORY (history));
-  priv = history->priv;
-
-  treeview = GTK_TREE_VIEW (priv->treeview);
-  selection = gtk_tree_view_get_selection (treeview);
-
-  if (!gtk_tree_selection_get_selected (selection, &filtered, &iter0))
-    return;
-
-  gtk_tree_model_get (filtered, &iter0, ENTRY_POINTER_COLUMN, &uid, -1);
-
-  /* Create a dialog */
-  dialog = gtk_message_dialog_new (GTK_WINDOW (
-                                   gtk_widget_get_ancestor(GTK_WIDGET (history),
-                                                            GTK_TYPE_WINDOW)),
-                                   0,
-                                   GTK_MESSAGE_QUESTION,
-                                   GTK_BUTTONS_NONE,
-                      "Are you sure you want to permanantly delete this call?"
-                                   );
-
-  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-                          "Don't Delete", GTK_RESPONSE_CANCEL,
-                          GTK_STOCK_DELETE, GTK_RESPONSE_YES,
-                          NULL);
-  gtk_widget_set_name (dialog, "mokomessagedialog");
-  gtk_container_set_border_width (GTK_CONTAINER (dialog), 0);
-
-  /* Just some tests
-  gtk_widget_set_size_request (dialog, 
-                               GTK_WIDGET (history)->allocation.width,
-                               GTK_WIDGET (history)->allocation.height);
-
-  gtk_window_move (GTK_WINDOW (dialog),
-                   GTK_WIDGET (history)->allocation.x,
-                   GTK_WIDGET (history)->allocation.y);
-  */
-  
-  result = gtk_dialog_run (GTK_DIALOG (dialog));
-  switch (result)
-  {
-    case GTK_RESPONSE_YES:
-      break;
-    default:
-      gtk_widget_destroy (dialog);
-      return;
-      break;
-  }
-
-  /* Remove the entry from the journal */
-  if (moko_journal_remove_entry_by_uid (priv->journal, uid))
-    moko_journal_write_to_storage (priv->journal);
-
-  /* Remove the row from the list store */
-  path = gtk_tree_model_get_path (filtered, &iter0);
-  sorted = priv->sort_model;
-  gtk_tree_model_filter_convert_iter_to_child_iter (
-                                              GTK_TREE_MODEL_FILTER (filtered),
-                                              &iter1, &iter0);
-
-  store = priv->main_model;
-  gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (sorted),
-                                                  &iter2, &iter1);
-  gtk_list_store_remove (GTK_LIST_STORE (store), &iter2);
-  gtk_tree_view_set_cursor (treeview, path, 0, 0);
-
-  /* Clean up */
-  gtk_tree_path_free (path);
-  gtk_widget_destroy (dialog);
-}
-
-
-static gboolean
-history_add_entry (GtkListStore *store, MokoJournalEntry *entry)
-{
-  GtkTreeIter iter;
-  const gchar *uid, *number;
-  MokoContactEntry *contacts;
-  GdkPixbuf *icon = NULL;
-  const gchar *display_text;
-  time_t dstart;
-  MessageDirection direction;
-  gboolean was_missed;
-  const MokoTime *time;
-  gint type;
-
-  uid = moko_journal_entry_get_uid (entry);
-  moko_journal_entry_get_direction (entry, &direction);
-  time = moko_journal_entry_get_dtstart (entry);
-  dstart = moko_time_as_timet (time);
-  
-  was_missed = moko_journal_voice_info_get_was_missed (entry);
-  number = moko_journal_voice_info_get_distant_number (entry);
-
-  /* Load the correct icon */
-  if (direction == DIRECTION_OUT)
-  {
-    icon = icons[CALL_OUTGOING];
-    type = HISTORY_FILTER_DIALED;
-  }
-  else
-  {
-    if (was_missed)
-    {
-      icon = icons[CALL_MISSED];
-      type = HISTORY_FILTER_MISSED;
-    }
-    else
-    {
-      icon = icons[CALL_INCOMING];
-      type = HISTORY_FILTER_RECEIVED;
-    }
-  }
-
-  /* display text should be the contact name or the number dialed */
-  contacts = moko_contacts_lookup (moko_contacts_get_default (), number);   
-  if (contacts)
-    display_text = contacts->contact->name;
-  else
-  {
-    if (number == NULL || !strcmp(number, "") || !strcmp(number, "NULL"))
-      display_text = "Unknown number";
-    else
-      display_text = number;
-  }
-
-  if (display_text == NULL || uid == NULL)
-  {
-    /*g_debug ("Not adding");
-    return FALSE;*/
-  }
-  gtk_list_store_insert_with_values (store, &iter, 0,
-    NUMBER_COLUMN, number,
-    DSTART_COLUMN, dstart,
-    ICON_NAME_COLUMN, icon,
-    DISPLAY_TEXT_COLUMN, display_text,
-    CALL_TYPE_COLUMN, type,
-    ENTRY_POINTER_COLUMN, uid,
-    -1);
-
-  return TRUE;
-}
-
-static void
-on_entry_added_cb (MokoJournal *journal,
-                   MokoJournalEntry *entry,
-                   MokoHistory *history)
-{
-  MokoHistoryPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_HISTORY (history));
-  priv = history->priv;
-
-  if (moko_journal_entry_get_entry_type (entry) != VOICE_JOURNAL_ENTRY)
-    return;
-
-  history_add_entry (GTK_LIST_STORE (priv->main_model), entry);
-}
-
-static gboolean
-moko_history_filter_visible_func (GtkTreeModel *model, 
-                                  GtkTreeIter  *iter,
-                                  MokoHistory  *history)
-{
-  MokoHistoryPrivate *priv;
-  gint type;
-  gint active;
-
-  g_return_val_if_fail (MOKO_IS_HISTORY (history), TRUE);
-  priv = history->priv;
-
-  active = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->combo));
-
-  if (active == HISTORY_FILTER_ALL)
-    return TRUE;
-
-  gtk_tree_model_get (model, iter, CALL_TYPE_COLUMN, &type, -1);
-
-  if (active == type)
-    return TRUE;
-
-  return FALSE;
-}
-
-static void
-on_filter_changed (GtkWidget *combo, MokoHistory *history)
-{
-  MokoHistoryPrivate *priv;
-  GtkTreeView *treeview;
-  GtkTreeIter iter;
-  GtkTreeModel *model;
-  GtkTreePath *path;
-
-  g_return_if_fail (MOKO_IS_HISTORY (history));
-  priv = history->priv;
-
-  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->filter_model));
-
-
-  treeview = GTK_TREE_VIEW (priv->treeview);
-  model = gtk_tree_view_get_model (treeview);
-
-  if (!gtk_tree_model_get_iter_first (model, &iter))
-    return;
-  path = gtk_tree_model_get_path (model, &iter);
-  gtk_tree_view_set_cursor (treeview, path, NULL, FALSE);
-  gtk_tree_path_free (path);
-
-}
-
-static gint
-sort_by_date (MokoJournalEntry *a, MokoJournalEntry *b)
-{
-  const MokoTime *at, *bt;
-  time_t ta, tb;
-
-  at = moko_journal_entry_get_dtstart (a);
-  bt = moko_journal_entry_get_dtstart (b);
-
-  ta = moko_time_as_timet (at);
-  tb = moko_time_as_timet (bt);
-
-  return (gint)difftime (ta, tb);
-}
-
-static void
-moko_history_load_entries (MokoHistory *history)
-{
-  MokoHistoryPrivate *priv;
-  GtkListStore *store;
-  GtkTreeModel *sorted;
-  GtkTreeModel *filtered;
-  GtkTreeViewColumn *col;
-  GtkCellRenderer *renderer;
-  MokoJournalEntry *entry;
-  gint i, j, n_entries;
-  GList *entries = NULL, *e;
-
-  g_return_if_fail (MOKO_IS_HISTORY (history));
-  priv = history->priv;
-
-  /* Create the columns */
-  col = gtk_tree_view_column_new ();
-
-  renderer = gtk_cell_renderer_pixbuf_new ();
-  gtk_tree_view_column_pack_start (col, renderer, FALSE);
-  gtk_tree_view_column_set_attributes (col, renderer, 
-                                       "pixbuf", ICON_NAME_COLUMN,
-                                       NULL);
-
-  renderer = gtk_cell_renderer_text_new ();
-  gtk_tree_view_column_pack_start (col, renderer, TRUE);
-  gtk_tree_view_column_set_attributes (col, renderer,
-                                       "text", DISPLAY_TEXT_COLUMN,
-                                       NULL);
-  gtk_tree_view_append_column (GTK_TREE_VIEW (priv->treeview), col);
-
-  /* Set up the list store */
-  store = gtk_list_store_new (6, G_TYPE_STRING,
-                                 G_TYPE_INT,
-                                 GDK_TYPE_PIXBUF,
-                                 G_TYPE_STRING,
-                                 G_TYPE_INT,
-                                 G_TYPE_STRING);
-  priv->main_model = GTK_TREE_MODEL (store);
-
-  sorted = gtk_tree_model_sort_new_with_model (priv->main_model);
-  priv->sort_model = sorted;
-  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sorted), 
-                                       DSTART_COLUMN,
-                                       GTK_SORT_DESCENDING);
-
-  /* Set up the filtered column */
-  filtered = gtk_tree_model_filter_new (sorted, NULL);
-  priv->filter_model = filtered;
-  gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filtered),
-               (GtkTreeModelFilterVisibleFunc) moko_history_filter_visible_func,
-                                          history,
-                                          NULL);
-  gtk_tree_view_set_model (GTK_TREE_VIEW (priv->treeview), filtered);
-
-  g_signal_connect (priv->journal, "entry_added",
-                    G_CALLBACK (on_entry_added_cb), (gpointer)history);
-  
-  n_entries = moko_journal_get_nb_entries (priv->journal);
-  if (n_entries < 1)
-  {
-    g_debug ("The Journal is empty");
-    return;
-  }
-
-  i = j = 0;
-  for (i = 0; i < n_entries; i++)
-  {
-    moko_journal_get_entry_at (priv->journal, i, &entry);
-    
-    /* We are not interested in anything other than voice entries */
-    if (moko_journal_entry_get_entry_type (entry) != VOICE_JOURNAL_ENTRY)
-      continue;
-
-    entries = g_list_insert_sorted (entries, 
-                                    (gpointer)entry, 
-                                    (GCompareFunc)sort_by_date);
-  }
-
-  for (e = entries; e != NULL; e = e->next)
-  {
-    if (history_add_entry (store, e->data))
-      j++;
-  }
-}
-
-/* GObject functions */
-static void
-moko_history_dispose (GObject *object)
-{
-  G_OBJECT_CLASS (moko_history_parent_class)->dispose (object);
-}
-
-static void
-moko_history_finalize (GObject *history)
-{
-  G_OBJECT_CLASS (moko_history_parent_class)->finalize (history);
-}
-
-static void
-moko_history_set_property (GObject      *object,
-                           guint         prop_id,
-                           const GValue *value,
-                           GParamSpec   *pspec)
-{
-  MokoHistoryPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_HISTORY (object));
-  priv = (MOKO_HISTORY (object))->priv;
-
-  switch (prop_id)
-  {
-    case PROP_JOURNAL:
-      priv->journal = (MokoJournal *)g_value_get_pointer (value);
-      if (priv->journal)
-        moko_history_load_entries (MOKO_HISTORY (object));
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-moko_history_get_property (GObject    *object, 
-                           guint       prop_id,
-                           GValue     *value,
-                           GParamSpec *pspec)
-{
-  MokoHistoryPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_HISTORY (object));
-  priv = (MOKO_HISTORY (object))->priv;
-
-  switch (prop_id)
-  {
-    case PROP_JOURNAL:
-      g_value_set_pointer (value, priv->journal);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-  }
-}
-
-static void
-moko_history_class_init (MokoHistoryClass *klass)
-{
-  GObjectClass *obj_class = G_OBJECT_CLASS (klass);
-
-  obj_class->finalize = moko_history_finalize;
-  obj_class->dispose = moko_history_dispose;
-  obj_class->set_property = moko_history_set_property;
-  obj_class->get_property = moko_history_get_property;
-
-  g_object_class_install_property (
-    obj_class,
-    PROP_JOURNAL,
-    g_param_spec_pointer ("journal",
-                         "MokoJournal",
-                         "A MokoJournal Object",
-                         G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
-  history_signals[DIAL_NUMBER] =
-    g_signal_new ("dial_number", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoHistoryClass, dial_number),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__STRING,
-                  G_TYPE_NONE, 
-                  1, G_TYPE_STRING);
-
-  g_type_class_add_private (obj_class, sizeof (MokoHistoryPrivate)); 
-}
-
-static void
-moko_history_init (MokoHistory *history)
-{
-  MokoHistoryPrivate *priv;
-  GtkIconTheme *theme;
-  gint i;
-  GtkListStore *store;
-  GtkTreeIter iter;
-  GtkWidget *toolbar, *combo, *treeview, *image, *scroll;
-  GtkToolItem *item;
-  GtkCellRenderer *renderer;
-  GdkPixbuf *icon;
-
-
-  priv = history->priv = MOKO_HISTORY_GET_PRIVATE (history);
-
-  /* Create the icons */
-  theme = gtk_icon_theme_get_default ();
-  for (i = 0; i < N_CALL_TYPES; i++)
-  {
-    icons[i] = gtk_icon_theme_load_icon (theme,
-                                         icon_names[i],
-                                         GTK_ICON_SIZE_MENU,
-                                         0, NULL);
-  }
-
-  /* Toolbar */
-  toolbar = gtk_toolbar_new ();
-  gtk_box_pack_start (GTK_BOX (history), toolbar, FALSE, FALSE, 0);
-
-  icon = gdk_pixbuf_new_from_file (PKGDATADIR"/phone.png", NULL);
-  image = gtk_image_new_from_pixbuf (icon);
-  item = gtk_tool_button_new (image, "Dial");
-  gtk_tool_item_set_expand (item, TRUE);
-  g_signal_connect (G_OBJECT (item), "clicked", 
-                    G_CALLBACK (on_dial_clicked), (gpointer)history);
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
-
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), gtk_separator_tool_item_new (), 1);
-  
-  icon = gdk_pixbuf_new_from_file (PKGDATADIR"/sms.png", NULL);
-  image = gtk_image_new_from_pixbuf (icon);
-  item = gtk_tool_button_new (image, "SMS");
-  gtk_tool_item_set_expand (item, TRUE);
-  g_signal_connect (G_OBJECT (item), "clicked", 
-                    G_CALLBACK (on_sms_clicked), (gpointer)history); 
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 2);
-
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), gtk_separator_tool_item_new (), 3);
-  
-  item = gtk_tool_button_new_from_stock (GTK_STOCK_DELETE);
-  gtk_tool_item_set_expand (item, TRUE);
-  g_signal_connect (G_OBJECT (item), "clicked", 
-                    G_CALLBACK (on_delete_clicked), (gpointer)history); 
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 4);
-  
-  /* Filter combo */
-  store = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT);
-  
-  icon = gdk_pixbuf_new_from_file (PKGDATADIR"/received.png", NULL);
-  gtk_list_store_insert_with_values (store, &iter, 0, 
-                                     0, icon, 
-                                     1, "Call History - Received",
-                                     2, HISTORY_FILTER_RECEIVED,
-                                     -1);  
-  icon = gdk_pixbuf_new_from_file (PKGDATADIR"/dialed.png", NULL);
-  gtk_list_store_insert_with_values (store, &iter, 0, 
-                                     0, icon, 
-                                     1, "Call History - Dialed",
-                                     2, HISTORY_FILTER_DIALED,
-                                     -1);  
-
-  icon = gdk_pixbuf_new_from_file (PKGDATADIR"/missed.png", NULL);
-  gtk_list_store_insert_with_values (store, &iter, 0, 
-                                     0, icon, 
-                                     1, "Call History - Missed",
-                                     2, HISTORY_FILTER_MISSED,
-                                     -1);
-  icon = gdk_pixbuf_new_from_file (PKGDATADIR"/all.png", NULL);
-  gtk_list_store_insert_with_values (store, &iter, 0, 
-                                     0, icon, 
-                                     1, "Call History - All",
-                                     2, HISTORY_FILTER_ALL,
-                                     -1);
-  
-  combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
-  priv->combo  = combo;
-  gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
-  g_signal_connect (G_OBJECT (combo), "changed", 
-                    G_CALLBACK (on_filter_changed), history);
-  
-  renderer = gtk_cell_renderer_pixbuf_new ();
-  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
-  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, 
-                                  "pixbuf", 0,
-                                  NULL);
-
-  renderer = gtk_cell_renderer_text_new ();
-  g_object_set (G_OBJECT (renderer), "xpad", 10, NULL);
-  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
-  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
-                                  "text", 1,
-                                  NULL);
-
-  gtk_box_pack_start (GTK_BOX (history), combo, FALSE, FALSE, 0);
-
-  /* Treeview */
-  scroll = moko_finger_scroll_new ();
-  gtk_box_pack_start (GTK_BOX (history), scroll, TRUE, TRUE, 0);
-
-  treeview = priv->treeview = gtk_tree_view_new ();
-  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
-  gtk_container_add (GTK_CONTAINER (scroll), treeview);
-
-  gtk_widget_show_all (GTK_WIDGET (history));
-}
-
-GtkWidget*
-moko_history_new (MokoJournal *journal)
-{
-  MokoHistory *history = NULL;
-    
-  history = g_object_new (MOKO_TYPE_HISTORY,
-                          "journal", journal,
-                          NULL);
-
-  return GTK_WIDGET (history);
-}

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-history.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-history.h	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-history.h	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,86 +0,0 @@
-/*
- *  moko-history; a GObject wrapper for the history which exports method and
- *  signals over dbus
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _HAVE_MOKO_HISTORY_H
-#define _HAVE_MOKO_HISTORY_H
-
-#include <gtk/gtk.h>
-#include <moko-journal.h>
-
-G_BEGIN_DECLS
-
-#define MOKO_TYPE_HISTORY (moko_history_get_type ())
-
-#define MOKO_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-        MOKO_TYPE_HISTORY, MokoHistory))
-
-#define MOKO_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
-        MOKO_TYPE_HISTORY, MokoHistoryClass))
-
-#define MOKO_IS_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-        MOKO_TYPE_HISTORY))
-
-#define MOKO_IS_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-        MOKO_TYPE_HISTORY))
-
-#define MOKO_HISTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-        MOKO_TYPE_HISTORY, MokoHistoryClass))
-
-typedef struct _MokoHistory MokoHistory;
-typedef struct _MokoHistoryClass MokoHistoryClass;
-typedef struct _MokoHistoryPrivate MokoHistoryPrivate;
-
-struct _MokoHistory
-{
-  GtkVBox         parent;
-
-  /*< private >*/
-  MokoHistoryPrivate   *priv;
-};
-
-struct _MokoHistoryClass 
-{
-  /*< private >*/
-  GtkVBoxClass    parent_class;
-
-  /* signals */
-  void (*dial_number) (MokoHistory *history, const gchar *number);
-
-};
-
-typedef enum {
-  HISTORY_FILTER_ALL = 0,
-  HISTORY_FILTER_MISSED,
-  HISTORY_FILTER_DIALED,
-  HISTORY_FILTER_RECEIVED
-
-} MokoHistoryFilter;
-
-GType moko_history_get_type (void) G_GNUC_CONST;
-
-GtkWidget*        
-moko_history_new (MokoJournal *journal);
-
-void
-moko_history_set_filter (MokoHistory *history,  gint filter);
-
-G_END_DECLS
-
-#endif /* _HAVE_MOKO_HISTORY_H */

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,435 +0,0 @@
-/*
- *  moko-keypad; The keypads keypad
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include <gtk/gtk.h>
-#include <gtk/gtk.h>
-
-#include <moko-stock.h>
-
-#include "moko-keypad.h"
-
-#include "moko-contacts.h"
-#include "moko-dialer-textview.h"
-#include "moko-dialer-panel.h"
-#include "moko-tips.h"
-
-G_DEFINE_TYPE (MokoKeypad, moko_keypad, GTK_TYPE_VBOX)
-
-#define MOKO_KEYPAD_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
-        MOKO_TYPE_KEYPAD, MokoKeypadPrivate))
-
-struct _MokoKeypadPrivate
-{
-  gboolean      pin_mode;
-
-  GtkWidget     *tips;
-  GtkWidget     *textview;
-  GtkWidget     *panel;
-  GtkWidget     *delete;
-  GtkWidget     *dial;
-  GtkWidget     *dial_label;
-
-  GtkWidget     *dialbox;
-};
-
-enum
-{
-  DIAL_NUMBER,
-  PIN_ENTRY,
-  DIGIT_PRESSED,
-
-  LAST_SIGNAL
-};
-
-static guint keypad_signals[LAST_SIGNAL] = {0, };
-
-static GtkWidget*
-_get_window (GtkWidget *widget)
-{
-  GtkWidget *parent = NULL;
-
-  while ((parent = widget->parent))
-  {
-    if (GTK_IS_WINDOW (parent))
-      break;
-    widget = parent;
-  }
-  if (GTK_IS_WINDOW (parent))
-    return parent;
-  else
-    return NULL;
-}
-
-void
-moko_keypad_set_pin_mode (MokoKeypad *keypad, gboolean pin_mode)
-{
-  MokoKeypadPrivate *priv;
-  GtkWidget *window;
-
-  g_return_if_fail (MOKO_IS_KEYPAD (keypad));
-  priv = keypad->priv;
-
-  if (priv->pin_mode == pin_mode)
-    return;
-
-  priv->pin_mode = pin_mode;
-  
-  if (pin_mode)
-  {
-    window = _get_window (GTK_WIDGET (keypad));
-    if (GTK_IS_WINDOW (window))
-      gtk_window_set_title (GTK_WINDOW (window), "Enter Pin");
-    gtk_label_set_markup (GTK_LABEL (priv->dial_label), "Send\nPin");
-  }
-  else
-  {
-    window = _get_window (GTK_WIDGET (keypad));
-    if (GTK_IS_WINDOW (window))
-      gtk_window_set_title (GTK_WINDOW (window), "Dialer");
-    gtk_label_set_markup (GTK_LABEL (priv->dial_label), "Dial");
-  }
-
-}
-
-void
-moko_keypad_set_display_text (MokoKeypad *keypad, const gchar *text)
-{
-  MokoKeypadPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_KEYPAD (keypad));
-  priv = keypad->priv;
-
-  moko_dialer_textview_empty (MOKO_DIALER_TEXTVIEW (priv->textview));
-  moko_dialer_textview_insert (MOKO_DIALER_TEXTVIEW (priv->textview), text);
-}
-
-void
-moko_keypad_set_talking (MokoKeypad *keypad, gboolean talking)
-{
-  MokoKeypadPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_KEYPAD (keypad));
-  priv = keypad->priv;
-
-  if (talking)
-    gtk_widget_hide (priv->dialbox);
-  else
-    gtk_widget_show_all (priv->dialbox);
-}
-
-/* Callbacks */
-static void
-on_tip_selected (MokoTips *tips, MokoContactEntry *entry, MokoKeypad *keypad)
-{
-  MokoKeypadPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_KEYPAD (keypad));
-  g_return_if_fail (entry);
-  priv = keypad->priv;
-
-  moko_dialer_textview_empty (MOKO_DIALER_TEXTVIEW (priv->textview));
-  moko_dialer_textview_insert (MOKO_DIALER_TEXTVIEW (priv->textview),
-                               entry->number);
-
-  g_debug ("%s", entry->number);
-  g_signal_emit (G_OBJECT (keypad), keypad_signals[DIAL_NUMBER], 
-                 0, entry->number);
-}
-
-static void
-on_dial_clicked (GtkWidget *button, MokoKeypad *keypad)
-{
-  MokoKeypadPrivate *priv;
-  const gchar *number;
-
-  g_return_if_fail (MOKO_IS_KEYPAD (keypad));
-  priv = keypad->priv;
-
-  number = moko_dialer_textview_get_input (
-                                        MOKO_DIALER_TEXTVIEW (priv->textview), 
-                                        TRUE);
- if (priv->pin_mode) {
-   g_signal_emit (G_OBJECT (keypad), keypad_signals[PIN_ENTRY], 0, number);
-   moko_dialer_textview_empty (MOKO_DIALER_TEXTVIEW (priv->textview));
- } else
-   g_signal_emit (G_OBJECT (keypad), keypad_signals[DIAL_NUMBER], 0, number);
- 
-}
-
-static gboolean
-moko_keypad_hold_timeout (MokoDialerTextview *textview)
-{
-  moko_dialer_textview_empty (textview);
-  return FALSE;
-}
-
-static gboolean
-on_delete_event (GtkWidget *button, GdkEventButton *event, MokoKeypad *keypad)
-{
-  MokoKeypadPrivate *priv;
-  MokoDialerTextview *textview;
-  GList *matches;
-  static gint hold_timeout_source = 0;
-
-  g_return_val_if_fail (MOKO_IS_KEYPAD (keypad), FALSE);
-  priv = keypad->priv;
-
-  textview = MOKO_DIALER_TEXTVIEW (priv->textview);
-
-  if (event->type == GDK_BUTTON_PRESS)
-  {
-    moko_dialer_textview_delete (textview);
-    hold_timeout_source = g_timeout_add (800, (GSourceFunc) moko_keypad_hold_timeout, textview);
-    return FALSE;
-  }
-  else if (event->type == GDK_BUTTON_RELEASE)
-  {
-    g_source_remove (hold_timeout_source);
-  }
-
-  if (!priv->pin_mode)
-  {
-    /* Some autocomplete stuff */
-    matches = moko_contacts_fuzzy_lookup (moko_contacts_get_default (),
-                                          moko_dialer_textview_get_input (
-                                          MOKO_DIALER_TEXTVIEW (priv->textview),
-                                          TRUE));
-    moko_tips_set_matches (MOKO_TIPS (priv->tips), matches);
-  }
-  
-  return FALSE;
-}
-
-static void
-on_panel_user_input (MokoDialerPanel *panel, 
-                      const gchar      digit, 
-                      MokoKeypad      *keypad)
-{
-  MokoKeypadPrivate *priv;
-  gchar buf[2];
-  GList *matches = NULL;
-
-  g_return_if_fail (MOKO_IS_KEYPAD (keypad));
-  priv = keypad->priv;
-
-  /* Phones use '#' for PIN 'entered' signal */
-  if (priv->pin_mode && digit == '#')
-  { 
-    on_dial_clicked (NULL, keypad);
-    return;
-  }   
-
-  /* Create a string to insert into the textview */
-  buf[0] = digit;
-  buf[1] = '\0';
-
-  moko_dialer_textview_insert (MOKO_DIALER_TEXTVIEW (priv->textview), buf);
-
-  if (!priv->pin_mode)
-  {
-    /* Some autocomplete stuff */
-    matches = moko_contacts_fuzzy_lookup (moko_contacts_get_default (),
-                                          moko_dialer_textview_get_input (
-                                          MOKO_DIALER_TEXTVIEW (priv->textview), 
-                                          TRUE));
-    moko_tips_set_matches (MOKO_TIPS (priv->tips), matches);
-    g_signal_emit (G_OBJECT (keypad), keypad_signals[DIGIT_PRESSED], 0, digit);
- }
-}
-
-static void
-on_panel_user_hold (MokoDialerPanel *panel, 
-                     const gchar      digit, 
-                     MokoKeypad      *keypad)
-{
-  MokoKeypadPrivate *priv;
-  gchar buf[3];
-  GList *matches = NULL;
-
-  g_return_if_fail (MOKO_IS_KEYPAD (keypad));
-  priv = keypad->priv;
-
-  /* Phones use '#' for PIN 'entered' signal */
-  if (priv->pin_mode && digit == '#')
-  { 
-    on_dial_clicked (NULL, keypad);
-    return;
-  }   
-
-  /* Create a string to insert into the textview */
-  buf[0] = digit;
-  buf[1] = '\0';
-
-  moko_dialer_textview_delete (MOKO_DIALER_TEXTVIEW (priv->textview));
-  moko_dialer_textview_insert (MOKO_DIALER_TEXTVIEW (priv->textview), buf);
-
-  if (!priv->pin_mode)
-  {
-    /* Some autocomplete stuff */
-    matches = moko_contacts_fuzzy_lookup (moko_contacts_get_default (),
-                                          moko_dialer_textview_get_input (
-                                          MOKO_DIALER_TEXTVIEW (priv->textview), 
-                                          TRUE));
-    moko_tips_set_matches (MOKO_TIPS (priv->tips), matches);
-    g_signal_emit (G_OBJECT (keypad), keypad_signals[DIGIT_PRESSED], 0, digit);
-  }
-}
-
-/* GObject functions */
-static void
-moko_keypad_dispose (GObject *object)
-{
-  G_OBJECT_CLASS (moko_keypad_parent_class)->dispose (object);
-}
-
-static void
-moko_keypad_finalize (GObject *keypad)
-{
-  G_OBJECT_CLASS (moko_keypad_parent_class)->finalize (keypad);
-}
-
-
-static void
-moko_keypad_class_init (MokoKeypadClass *klass)
-{
-  GObjectClass *obj_class = G_OBJECT_CLASS (klass);
-
-  obj_class->finalize = moko_keypad_finalize;
-  obj_class->dispose = moko_keypad_dispose;
-
-  keypad_signals[DIAL_NUMBER] =
-    g_signal_new ("dial_number", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoKeypadClass, dial_number),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__STRING,
-                  G_TYPE_NONE, 
-                  1, G_TYPE_STRING);
-
- keypad_signals[PIN_ENTRY] =
-    g_signal_new ("pin_entry", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoKeypadClass, pin_entry),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__STRING,
-                  G_TYPE_NONE, 
-                  1, G_TYPE_STRING);
-
-  keypad_signals[DIGIT_PRESSED] =
-    g_signal_new ("digit_pressed", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoKeypadClass, digit_pressed),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__CHAR,
-                  G_TYPE_NONE, 
-                  1, G_TYPE_CHAR);
-
-  g_type_class_add_private (obj_class, sizeof (MokoKeypadPrivate)); 
-}
-
-static void
-moko_keypad_init (MokoKeypad *keypad)
-{
-  MokoKeypadPrivate *priv;
-  GtkWidget *hbox, *vbox;
-  GtkStockItem stock_item;
-  GtkWidget *bvbox, *icon, *label, *align;
-
-  priv = keypad->priv = MOKO_KEYPAD_GET_PRIVATE (keypad);
-
-  /* The autocomplete tips */
-  priv->tips = moko_tips_new ();
-  g_signal_connect (priv->tips, "selected", 
-                    G_CALLBACK (on_tip_selected), (gpointer)keypad);
-  gtk_box_pack_start (GTK_BOX (keypad), priv->tips, FALSE, FALSE, 0);
-
-  /* The textview */
-  priv->textview = moko_dialer_textview_new ();
-  gtk_box_pack_start (GTK_BOX (keypad), priv->textview, FALSE, FALSE, 0);
-
-  hbox = gtk_hbox_new (FALSE, 0);
-  gtk_box_pack_start (GTK_BOX (keypad), hbox, TRUE, TRUE, 0);
-
-  /* Dialing pad */
-  priv->panel = moko_dialer_panel_new ();
-  g_signal_connect (G_OBJECT (priv->panel), "user_input",
-                    G_CALLBACK (on_panel_user_input), (gpointer)keypad);
-  g_signal_connect (G_OBJECT (priv->panel), "user_hold",
-                    G_CALLBACK (on_panel_user_hold), (gpointer)keypad);
-
-  gtk_box_pack_start (GTK_BOX (hbox), priv->panel, TRUE, TRUE, 0);
-
-  priv->dialbox = vbox = gtk_vbox_new (FALSE, 0);
-  gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
-  
-  /* Delete button */
-  priv->delete = gtk_button_new ();
-  g_signal_connect (priv->delete, "button-press-event",
-                    G_CALLBACK (on_delete_event), (gpointer)keypad);
-  g_signal_connect (priv->delete, "button-release-event",
-                    G_CALLBACK (on_delete_event), (gpointer)keypad);  
-  
-  bvbox = gtk_vbox_new (FALSE, 0);
-  
-  icon = gtk_image_new_from_stock (GTK_STOCK_GO_BACK, GTK_ICON_SIZE_BUTTON);
-  gtk_box_pack_start (GTK_BOX (bvbox), icon, FALSE, FALSE, 0);
-  
-  label = gtk_label_new ("Delete");
-  gtk_box_pack_start (GTK_BOX (bvbox), label, FALSE, FALSE, 0);
-  
-  gtk_container_add (GTK_CONTAINER (priv->delete), bvbox);
-  gtk_widget_set_name (priv->delete, "mokofingerbutton-orange");
-  gtk_box_pack_start (GTK_BOX (vbox), priv->delete, FALSE, FALSE, 0);
-  
-  /* Dial button */
-  priv->dial = gtk_button_new ();
-  g_signal_connect (G_OBJECT (priv->dial), "clicked",
-                    G_CALLBACK (on_dial_clicked), (gpointer)keypad);
-  bvbox = gtk_vbox_new (FALSE, 0);
-  align = gtk_alignment_new (0.5, 0.5, 1, 0);
-  
-  icon = gtk_image_new_from_stock (MOKO_STOCK_CALL_DIAL, GTK_ICON_SIZE_BUTTON);
-  gtk_box_pack_start (GTK_BOX (bvbox), icon, FALSE, FALSE, 0);
-  
-  gtk_stock_lookup (MOKO_STOCK_CALL_DIAL, &stock_item);
-  label = gtk_label_new (stock_item.label);
-  priv->dial_label = label;
-  gtk_box_pack_start (GTK_BOX (bvbox), label, FALSE, FALSE, 0);
-  
-  gtk_container_add (GTK_CONTAINER (align), bvbox);
-  gtk_container_add (GTK_CONTAINER (priv->dial), align);
-  gtk_widget_set_name (priv->dial, "mokofingerbutton-black");
-  gtk_box_pack_start (GTK_BOX (vbox), priv->dial, TRUE, TRUE, 0);
- }
-
-GtkWidget*
-moko_keypad_new (void)
-{
-  MokoKeypad *keypad = NULL;
-  
-  keypad = g_object_new (MOKO_TYPE_KEYPAD, 
-                         "homogeneous", FALSE,
-                         "spacing", 0,
-                         NULL);
-
-  return GTK_WIDGET (keypad);
-}

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.h	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.h	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,84 +0,0 @@
-/*
- *  moko-keypad; The keypads keypad.
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _HAVE_MOKO_KEYPAD_H
-#define _HAVE_MOKO_KEYPAD_H
-
-#include <glib.h>
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define MOKO_TYPE_KEYPAD (moko_keypad_get_type ())
-
-#define MOKO_KEYPAD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-        MOKO_TYPE_KEYPAD, MokoKeypad))
-
-#define MOKO_KEYPAD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
-        MOKO_TYPE_KEYPAD, MokoKeypadClass))
-
-#define MOKO_IS_KEYPAD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-        MOKO_TYPE_KEYPAD))
-
-#define MOKO_IS_KEYPAD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-        MOKO_TYPE_KEYPAD))
-
-#define MOKO_KEYPAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-        MOKO_TYPE_KEYPAD, MokoKeypadClass))
-
-typedef struct _MokoKeypad MokoKeypad;
-typedef struct _MokoKeypadClass MokoKeypadClass;
-typedef struct _MokoKeypadPrivate MokoKeypadPrivate;
-
-struct _MokoKeypad
-{
-  GtkVBox         parent;
-
-  /*< private >*/
-  MokoKeypadPrivate   *priv;
-};
-
-struct _MokoKeypadClass 
-{
-  /*< private >*/
-  GtkVBoxClass    parent_class;
-  
-  /* signals */
-  void (*dial_number) (MokoKeypad *keypad, const gchar *number);
-  void (*pin_entry) (MokoKeypad *keypad, const gchar *number);
-  void (*digit_pressed) (MokoKeypad *keypad, const gchar digit);
-
-  /* future padding */
-  void (*_moko_keypad_1) (void);
-  void (*_moko_keypad_2) (void);
-  void (*_moko_keypad_3) (void);
-  void (*_moko_keypad_4) (void);
-}; 
-
-GType moko_keypad_get_type (void) G_GNUC_CONST;
-
-GtkWidget* moko_keypad_new (void);
-
-void moko_keypad_set_pin_mode (MokoKeypad *keypad, gboolean pin_mode);
-void moko_keypad_set_talking (MokoKeypad *keypad, gboolean talking);
-void moko_keypad_set_display_text (MokoKeypad *keypad, const gchar *text);
-
-G_END_DECLS
-
-#endif /* _HAVE_MOKO_KEYPAD_H */

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,346 +0,0 @@
-/*
- *  moko-notify; a Notification object. This deals with notifying the user
- *  of an incoming call.
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include <glib.h>
-#include <glib/gstdio.h>
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "moko-notify.h"
-
-#include <pulse/pulseaudio.h>
-
-G_DEFINE_TYPE (MokoNotify, moko_notify, G_TYPE_OBJECT)
-
-#define MOKO_NOTIFY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
-        MOKO_TYPE_NOTIFY, MokoNotifyPrivate))
-
-#define DEFAULT_RINGTONE "/default_ringtone.ogg"
-#define SYS_BRIGHTNESS "/sys/class/backlight/gta01-bl"
-#define SYS_VIBRATE "/sys/class/leds/gta01:vibrator"
-
-struct _MokoNotifyPrivate
-{
-  gboolean    started;
-
-  /* Sound stuff */
-  pa_context *pac;
-  pa_operation *operation;
-};
-/*
-enum
-{
-  NOTHING,
-
-  LAST_SIGNAL
-};
-
-static guint notify_signals[LAST_SIGNAL] = {0, };
-*/
-static void moko_notify_start_ringtone (MokoNotify *notify);
-
-/*
- * Check the current screen brightness, raise it if necessary
- */
-static void
-moko_notify_check_brightness (void)
-{
-  gint fd;
-  gchar buf[50];
-  GIOChannel *dev;
-  gsize bytes = 0;
-  GError *err = NULL;
-
-  fd = g_open (SYS_BRIGHTNESS"/brightness", O_RDWR, 0);
-  if (fd == -1)
-  {
-    g_warning ("Unable to open brightness device");
-    return;
-  }
-
-  /* The reading is for a 'smooth' brightness from current to max */
-  dev = g_io_channel_unix_new (fd);
-  if (g_io_channel_read_chars (dev, buf, 50, &bytes, &err)
-        == G_IO_STATUS_NORMAL)
-  {
-    buf[bytes] = '\0';
-    /*g_debug ("Current brightness = %s", buf); */
-  }
-  else
-  {
-    g_warning (err->message);
-    g_error_free (err);
-  }
-  err = NULL;
-  if (g_io_channel_write_chars (dev, "5000", -1, &bytes, &err)
-        != G_IO_STATUS_NORMAL)
-  {
-    g_warning (err->message);
-    g_error_free (err);
-  }
-  g_io_channel_shutdown (dev, TRUE, NULL);
-  close (fd);
-}
-
-static gboolean
-play (MokoNotify *notify)
-{
-  moko_notify_start_ringtone (notify);
-  g_debug ("1500 timeout");
-  return FALSE;
-}
-
-static gboolean
-play_timeout (MokoNotify *notify)
-{
-  MokoNotifyPrivate *priv;
-
-  g_return_val_if_fail (MOKO_IS_NOTIFY (notify), FALSE);
-  priv = notify->priv;
-
-  if (!priv->pac)
-    return FALSE;
-
-  if (!priv->operation)
-  {
-    g_debug ("No operation");
-    return FALSE;
-  }
-  if (!priv->started)
-  {
-    pa_operation_cancel (priv->operation);
-    g_debug ("Cancelling early");
-    return FALSE;
-  }
-  if (pa_operation_get_state (priv->operation) == PA_OPERATION_DONE)
-  {
-    g_timeout_add (1500, (GSourceFunc)play, (gpointer)notify);
-    g_debug ("Playing done");
-    return FALSE;
-  }
-  g_debug ("Not finshed yet");
-  return TRUE;
-}
-
-static void
-moko_notify_start_ringtone (MokoNotify *notify)
-{
-  MokoNotifyPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_NOTIFY (notify));
-  priv = notify->priv;
-
-  if (!priv->pac || !priv->started)
-    return;
-
-  priv->operation = pa_context_play_sample (priv->pac,
-                                            "ringtone",
-                                            NULL,
-                                            PA_VOLUME_NORM,
-                                            NULL,
-                                            NULL);
-  g_timeout_add (500, (GSourceFunc)play_timeout, (gpointer)notify);
-  g_debug ("Playing");
-}
-
-static void
-moko_notify_stop_ringtone (MokoNotify *notify)
-{
-  MokoNotifyPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_NOTIFY (notify));
-  priv = notify->priv;
-
-  if (priv->operation)
-  {
-    pa_operation_cancel (priv->operation);
-    g_debug ("Cancelling");
-  }
-
-  priv->operation = NULL;
-}
-
-static void
-moko_notify_start_vibrate (void)
-{
-  gint fd;
-  gchar buf[100];
-  gint len;
-
-  /* Set the trigger state */
-  fd = g_open (SYS_VIBRATE"/trigger", O_WRONLY, 0);
-  if (fd == -1)
-  {
-    g_warning ("Unable to open vibration device");
-    return;
-  }
-  len = g_sprintf (buf, "%s", "timer");
-  write (fd, buf, len);
-  close (fd);
-
-  /* Set the 'on' delay */
-  fd = g_open (SYS_VIBRATE"/delay_on", O_WRONLY, 0);
-  if (fd == -1)
-  {
-    g_warning ("Unable to open timer 'delay_on'");
-    return;
-  }
-  len = g_sprintf (buf, "%d", 500);
-  write (fd, buf, len);
-  close (fd);
-
-  /* Set the 'off' delay, this also starts the vibration */
-  fd = g_open (SYS_VIBRATE"/delay_off", O_WRONLY, 0);
-  if (fd == -1)
-  {
-    g_warning ("Unable to open timer 'delay_off'");
-    return;
-  }
-  len = g_sprintf (buf, "%d", 1000);
-  write (fd, buf, len);
-  close (fd);
-}
-
-static void
-moko_notify_stop_vibrate (void)
-{
-  gint fd;
-  gchar buf[100];
-  gint len;
-
-  /* Set the trigger state to none*/
-  fd = g_open (SYS_VIBRATE"/trigger", O_WRONLY, 0);
-  if (fd == -1)
-  {
-    g_warning ("Unable to open vibration device");
-    return;
-  }
-  len = g_sprintf (buf, "%s", "none");
-  write (fd, buf, len);
-  close (fd);
-}
-
-/* We need to do a few things here:
- *  1. If the backlight is dimmed down, undim it
- *  2. Start playing the ringtone
- *  3. Start the vibration alert
- */
-void
-moko_notify_start (MokoNotify *notify)
-{
-  MokoNotifyPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_NOTIFY (notify));
-  priv = notify->priv;
-
-  if (priv->started)
-    return;
-  priv->started = TRUE;
-
-  moko_notify_check_brightness ();
-  moko_notify_start_vibrate ();
-  moko_notify_start_ringtone (notify);
-}
-
-/* Stop the ringtone and the vibration alert */
-void
-moko_notify_stop (MokoNotify *notify)
-{
-  MokoNotifyPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_NOTIFY (notify));
-  priv = notify->priv;
-
-  if (!priv->started)
-    return;
-  priv->started = FALSE;
-
-  moko_notify_stop_vibrate ();
-  moko_notify_stop_ringtone (notify);
-}
-
-/* GObject functions */
-static void
-moko_notify_dispose (GObject *object)
-{
-  G_OBJECT_CLASS (moko_notify_parent_class)->dispose (object);
-}
-
-static void
-moko_notify_finalize (GObject *notify)
-{
-  G_OBJECT_CLASS (moko_notify_parent_class)->finalize (notify);
-}
-
-static void
-moko_notify_class_init (MokoNotifyClass *klass)
-{
-  GObjectClass *obj_class = G_OBJECT_CLASS (klass);
-
-  obj_class->finalize = moko_notify_finalize;
-  obj_class->dispose = moko_notify_dispose;
-
-  g_type_class_add_private (obj_class, sizeof (MokoNotifyPrivate));
-}
-
-static void
-moko_notify_init (MokoNotify *notify)
-{
-  MokoNotifyPrivate *priv;
-  pa_threaded_mainloop *mainloop = NULL;
-  pa_mainloop_api *mapi = NULL;
-
-  priv = notify->priv = MOKO_NOTIFY_GET_PRIVATE (notify);
-
-  priv->started = FALSE;
-  priv->pac = NULL;
-
-  /* Start up pulse audio */
-  mainloop = pa_threaded_mainloop_new ();
-  if (!mainloop)
-  {
-    g_warning ("Unable to create PulseAudio mainloop.");
-    return;
-  }
-  mapi = pa_threaded_mainloop_get_api (mainloop);
-  priv->pac = pa_context_new (mapi, "Openmoko Dialer");
-  if (!priv->pac)
-  {
-    g_warning ("Could create the PulseAudio context");
-    return;
-  }
-  pa_context_connect (priv->pac, NULL, 0, NULL);
-  pa_threaded_mainloop_start (mainloop);
-}
-
-MokoNotify*
-moko_notify_new (void)
-{
-  MokoNotify *notify = NULL;
-
-  notify = g_object_new (MOKO_TYPE_NOTIFY, NULL);
-
-  return notify;
-}
-

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.h	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.h	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,77 +0,0 @@
-/*
- *  moko-notify; a Notification object. This deals with notifying the user
- *  of an incoming call.
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _HAVE_MOKO_NOTIFY_H
-#define _HAVE_MOKO_NOTIFY_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define MOKO_TYPE_NOTIFY (moko_notify_get_type ())
-
-#define MOKO_NOTIFY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-        MOKO_TYPE_NOTIFY, MokoNotify))
-
-#define MOKO_NOTIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
-        MOKO_TYPE_NOTIFY, MokoNotifyClass))
-
-#define MOKO_IS_NOTIFY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-        MOKO_TYPE_NOTIFY))
-
-#define MOKO_IS_NOTIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-        MOKO_TYPE_NOTIFY))
-
-#define MOKO_NOTIFY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-        MOKO_TYPE_NOTIFY, MokoNotifyClass))
-
-typedef struct _MokoNotify MokoNotify;
-typedef struct _MokoNotifyClass MokoNotifyClass;
-typedef struct _MokoNotifyPrivate MokoNotifyPrivate;
-
-struct _MokoNotify
-{
-  GObject              parent;
-
-  /*< private >*/
-  MokoNotifyPrivate   *priv;
-};
-
-struct _MokoNotifyClass 
-{
-  /*< private >*/
-  GObjectClass    parent_class;
-}; 
-
-GType moko_notify_get_type (void) G_GNUC_CONST;
-
-MokoNotify*        
-moko_notify_new (void);
-
-void
-moko_notify_start (MokoNotify *notify);
-
-void
-moko_notify_stop (MokoNotify *notify);
-
-G_END_DECLS
-
-#endif /* _HAVE_MOKO_NOTIFY_H */

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,41 +0,0 @@
-/*
- *  moko-sound; Crude hack to switch audio profiles until we have a proper solution
- *
- *  by Daniel Willmann <daniel at totalueberwachung.de>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include "moko-dialer.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-char *sound_profile_filenames[] = { "/etc/gsmhandset.state",
-  "/etc/gsmheadset.state",
-  "/etc/gsmspeakerout.state",
-  "/etc/stereoout.state"};
-
-void moko_sound_profile_set(int profile) {
-  char command[100];
-  snprintf(command, 100, "alsactl -f %s restore", sound_profile_filenames[profile]);
-  system(command);
-}
-
-void moko_sound_profile_save(int profile) {
-  char command[100];
-  snprintf(command, 100, "alsactl -f %s store", sound_profile_filenames[profile]);
-  system(command);
-}
-

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.h	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.h	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,31 +0,0 @@
-/*
- *  moko-sound; Crude hack to switch audio profiles until we have a proper solution
- *
- *  by Daniel Willmann <daniel at totalueberwachung.de>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _HAVE_MOKO_SOUND_H
-#define _HAVE_MOKO_SOUND_H
-
-enum { SOUND_PROFILE_GSM_HANDSET,
-SOUND_PROFILE_GSM_HEADSET,
-SOUND_PROFILE_GSM_SPEAKER_OUT,
-SOUND_PROFILE_STEREO_OUT };
-
-void moko_sound_profile_set(int profile);
-void moko_sound_profile_save(int profile);
-
-#endif /* _HAVE_MOKO_SOUND_H */

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,523 +0,0 @@
-/*
- *  moko-talking; a GObject wrapper for the talking/incoming/outgoing page.
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include <gtk/gtk.h>
-
-#include <moko-journal.h>
-#include <moko-stock.h>
-
-#include "moko-sound.h"
-#include "moko-talking.h"
-
-G_DEFINE_TYPE (MokoTalking, moko_talking, GTK_TYPE_VBOX)
-
-#define MOKO_TALKING_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
-        MOKO_TYPE_TALKING, MokoTalkingPrivate))
-
-#define N_PICS 5
-
-struct _MokoTalkingPrivate
-{
-  MokoJournal        *journal;
-
-  GtkWidget          *incoming_bar;
-  GtkWidget          *main_bar;
-
-  GtkWidget          *title;
-  GtkWidget          *duration;
-  GtkWidget          *icon;
-
-  GtkWidget          *person;
-  GtkWidget          *status;
-
-  GdkPixbuf          *talking[N_PICS];
-  GdkPixbuf          *incoming[4];
-  GdkPixbuf          *outgoing[4];
-
-  GTimer             *dtimer;
-  guint               timeout;
-};
-
-enum
-{
-  ACCEPT_CALL = 0,
-  REJECT_CALL,
-  CANCEL_CALL,
-  SILENCE,
-  SPEAKER_TOGGLE,
-
-  LAST_SIGNAL
-};
-
-static guint talking_signals[LAST_SIGNAL] = {0, };
-
-
-void
-moko_talking_set_clip (MokoTalking      *talking, 
-                       const gchar      *number,
-                       MokoContactEntry *entry)
-{
-  MokoTalkingPrivate *priv;
-  gchar *markup;
-  
-  g_return_if_fail (MOKO_IS_TALKING (talking));
-  priv = talking->priv;
-
-  if (number == NULL)
-    number = "Unknown number";
-
-  if (entry)
-    markup = g_strdup_printf ("<b>%s</b>\n%s", entry->contact->name, number);
-  else
-    markup = g_strdup (number);
-
-  gtk_label_set_markup (GTK_LABEL (priv->status), markup);
-  
-  if (entry && GDK_IS_PIXBUF (entry->contact->photo))
-    gtk_image_set_from_pixbuf (GTK_IMAGE (priv->person), entry->contact->photo);
-  else
-    gtk_image_set_from_file (GTK_IMAGE (priv->person),
-                             PKGDATADIR"/unkown.png");
-
-  g_free (markup);
-}
-
-static gboolean
-incoming_timeout (MokoTalking *talking)
-{
-  MokoTalkingPrivate *priv;
-  static gint i = 0;
-
-  g_return_val_if_fail (MOKO_IS_TALKING (talking), FALSE);
-  priv = talking->priv;
-
-  gtk_image_set_from_pixbuf (GTK_IMAGE (priv->icon), 
-                             priv->incoming[i]);
-  
-  i++;
-  if (i == 4)
-    i = 0;
-  
-  return TRUE;
-}
-
-void
-moko_talking_incoming_call (MokoTalking      *talking, 
-                            const gchar      *number,
-                            MokoContactEntry *entry)
-{
-  MokoTalkingPrivate *priv;
-
-  g_return_if_fail (MOKO_IS_TALKING (talking));
-  priv = talking->priv;
-
-  gtk_widget_hide (priv->main_bar);
-  gtk_widget_show_all (priv->incoming_bar);
-
-  gtk_label_set_text (GTK_LABEL (priv->title), "Incoming Call");
-  gtk_label_set_text (GTK_LABEL (priv->duration), "");
-  gtk_image_set_from_file (GTK_IMAGE (priv->icon), 
-                           PKGDATADIR"/incoming_3.png");
-
-  gtk_label_set_text (GTK_LABEL (priv->status), number);
-  gtk_image_set_from_file (GTK_IMAGE (priv->person),
-                           PKGDATADIR"/unkown.png");
-  g_source_remove (priv->timeout);
-  priv->timeout = g_timeout_add (1000, 
-                                 (GSourceFunc)incoming_timeout,
-                                 (gpointer)talking);
-}
-
-static gboolean
-outgoing_timeout (MokoTalking *talking)
-{
-  MokoTalkingPrivate *priv;
-  static gint i = 0;
-
-  g_return_val_if_fail (MOKO_IS_TALKING (talking), FALSE);
-  priv = talking->priv;
-
-  gtk_image_set_from_pixbuf (GTK_IMAGE (priv->icon), 
-                             priv->outgoing[i]);
-  
-  i++;
-  if (i == 4)
-    i = 0;
-  
-  return TRUE;
-}
-
-void
-moko_talking_outgoing_call (MokoTalking      *talking, 
-                            const gchar      *number,
-                            MokoContactEntry *entry)
-{
-  MokoTalkingPrivate *priv;
-  gchar *markup = NULL;
-
-  g_return_if_fail (MOKO_IS_TALKING (talking));
-  priv = talking->priv;
-
-  gtk_widget_hide (priv->incoming_bar);
-  gtk_widget_show_all (priv->main_bar);
-
-  moko_sound_profile_set(SOUND_PROFILE_GSM_HANDSET);
-
-  if (entry)
-    markup = g_strdup_printf ("<b>%s</b>\n%s", entry->contact->name, number);
-  else
-    markup = g_strdup (number);
-
-  gtk_label_set_text (GTK_LABEL (priv->title), "Outgoing Call");
-  gtk_label_set_text (GTK_LABEL (priv->duration), "");
-
-  gtk_label_set_markup (GTK_LABEL (priv->status), markup);
-  
-  if (entry && GDK_IS_PIXBUF (entry->contact->photo))
-    gtk_image_set_from_pixbuf (GTK_IMAGE (priv->person), entry->contact->photo);
-  else
-    gtk_image_set_from_file (GTK_IMAGE (priv->person),
-                             PKGDATADIR"/unkown.png");
-
-  g_source_remove (priv->timeout);
-  priv->timeout = g_timeout_add (1000, 
-                                 (GSourceFunc)outgoing_timeout,
-                                 (gpointer)talking);
-
-  g_free (markup);
-}
-
-static gboolean
-talking_timeout (MokoTalking *talking)
-{
-  MokoTalkingPrivate *priv;
-  gdouble elapsed;
-  gint hour, min, sec;
-  gchar *markup = NULL;
-  static gint i = 0;
-
-  g_return_val_if_fail (MOKO_IS_TALKING (talking), FALSE);
-  priv = talking->priv;
-
-  if (priv->dtimer)
-  {
-    elapsed = g_timer_elapsed(priv->dtimer, NULL);
-
-    hour = (gint) (elapsed / 3600);
-    min = (gint) ((elapsed - 3600 * hour) / 60);
-    sec = (gint) (elapsed - 3600 * hour - 60 * min);
-
-    markup = g_strdup_printf ("%02d:%02d:%02d", hour, min, sec);
-    gtk_label_set_markup (GTK_LABEL (priv->duration), markup);
-  }
-
-  gtk_image_set_from_pixbuf (GTK_IMAGE (priv->icon), 
-                             priv->talking[i]);
-  
-  i++;
-  if (i == 5)
-    i = 0;
-  
-  g_free(markup);
-  return TRUE;
-}
-  
-void
-moko_talking_accepted_call (MokoTalking      *talking, 
-                            const gchar      *number,
-                            MokoContactEntry *entry)
-{
-  MokoTalkingPrivate *priv;
-  gchar *markup = NULL;
-
-  g_return_if_fail (MOKO_IS_TALKING (talking));
-  priv = talking->priv;
-
-  gtk_widget_hide (priv->incoming_bar);
-  gtk_widget_show_all (priv->main_bar);
-
-  moko_sound_profile_set(SOUND_PROFILE_GSM_HANDSET);
-
-  if (entry)
-    markup = g_strdup_printf ("<b>%s</b>\n%s", entry->contact->name, number);
-  else
-    markup = g_strdup (number);
-
-  gtk_label_set_text (GTK_LABEL (priv->title), "Talking");
-  gtk_label_set_text (GTK_LABEL (priv->duration), "00:00:00");
-  gtk_image_set_from_file (GTK_IMAGE (priv->icon), 
-                           PKGDATADIR"/talking_3.png");
-
-  /* start call duration timer */
-  if (priv->dtimer)
-    g_timer_destroy(priv->dtimer);
-  priv->dtimer = g_timer_new();
-
-  /* We don't change the status or person widgets, as incoming call has already
-   * set them for us.
-   */
-  g_source_remove (priv->timeout);
-  priv->timeout = g_timeout_add (1000, 
-                                 (GSourceFunc)talking_timeout,
-                                 (gpointer)talking);
-
-  g_free (markup);
-}
-
-
-/* Toolbar callbacks */
-static void
-on_answer_clicked (GtkToolButton *button, MokoTalking *talking)
-{
-  g_signal_emit (G_OBJECT (talking), talking_signals[ACCEPT_CALL], 0);
-}
-
-static void
-on_reject_clicked (GtkToolButton *button, MokoTalking *talking)
-{
-  g_source_remove (talking->priv->timeout);
-  g_signal_emit (G_OBJECT (talking), talking_signals[REJECT_CALL], 0);
-}
-
-static void
-on_silence_clicked (GtkToolButton *button, MokoTalking *talking)
-{
-  g_source_remove (talking->priv->timeout);
-  g_signal_emit (G_OBJECT (talking), talking_signals[SILENCE], 0);
-}
-
-static void
-on_cancel_clicked (GtkToolButton *button, MokoTalking *talking)
-{
-  /* stop call duration timer */
-  if (talking->priv->dtimer)
-    g_timer_destroy(talking->priv->dtimer);
-
-  g_source_remove (talking->priv->timeout);
-  moko_sound_profile_set(SOUND_PROFILE_STEREO_OUT);
-  g_signal_emit (G_OBJECT (talking), talking_signals[CANCEL_CALL], 0);
-}
-
-static void
-on_speaker_toggled (GtkToggleToolButton *toggle, MokoTalking *talking)
-{
-  g_signal_emit (G_OBJECT (talking), talking_signals[SPEAKER_TOGGLE],
-                0, gtk_toggle_tool_button_get_active (toggle));
-}
-
-/* GObject functions */
-static void
-moko_talking_dispose (GObject *object)
-{
-  G_OBJECT_CLASS (moko_talking_parent_class)->dispose (object);
-}
-
-static void
-moko_talking_finalize (GObject *talking)
-{
-  G_OBJECT_CLASS (moko_talking_parent_class)->finalize (talking);
-}
-
-static void
-moko_talking_class_init (MokoTalkingClass *klass)
-{
-  GObjectClass *obj_class = G_OBJECT_CLASS (klass);
-
-  obj_class->finalize = moko_talking_finalize;
-  obj_class->dispose = moko_talking_dispose;
-
-
-   talking_signals[ACCEPT_CALL] =
-    g_signal_new ("accept_call", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoTalkingClass,  accept_call),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE, 0);
-
-   talking_signals[REJECT_CALL] =
-    g_signal_new ("reject_call", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoTalkingClass,  reject_call),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE, 0);
-
-   talking_signals[CANCEL_CALL] =
-    g_signal_new ("cancel_call", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoTalkingClass,  cancel_call),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE, 0);
-   talking_signals[SILENCE] =
-    g_signal_new ("silence", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoTalkingClass,  silence),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID,
-                  G_TYPE_NONE, 0);
-
-   talking_signals[SPEAKER_TOGGLE] =
-    g_signal_new ("speaker_toggle", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoTalkingClass,  speaker_toggle),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__BOOLEAN,
-                  G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-
-  g_type_class_add_private (obj_class, sizeof (MokoTalkingPrivate)); 
-}
-
-static void
-moko_talking_init (MokoTalking *talking)
-{
-  MokoTalkingPrivate *priv;
-  GtkWidget *toolbar, *image, *vbox, *hbox, *label, *align, *frame;
-  GtkWidget *duration;
-  GtkToolItem *item;
-  gint i;
-
-  priv = talking->priv = MOKO_TALKING_GET_PRIVATE (talking);
-  
-  priv->incoming_bar = toolbar = gtk_toolbar_new ();
-  gtk_box_pack_start (GTK_BOX (talking), toolbar, FALSE, FALSE, 0);
-
-  item = gtk_tool_button_new_from_stock (MOKO_STOCK_CALL_ANSWER);
-  gtk_tool_item_set_expand (item, TRUE);
-  g_signal_connect (item, "clicked", G_CALLBACK (on_answer_clicked), talking);
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
-
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), gtk_separator_tool_item_new (), 1);
-
-  item = gtk_tool_button_new_from_stock (MOKO_STOCK_CALL_IGNORE);
-  gtk_tool_item_set_expand (item, TRUE);
-  g_signal_connect (item, "clicked", G_CALLBACK (on_silence_clicked), talking);
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 2);
-
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), gtk_separator_tool_item_new (), 3);
-
-  item = gtk_tool_button_new_from_stock (MOKO_STOCK_CALL_REJECT);
-  gtk_tool_item_set_expand (item, TRUE);
-  g_signal_connect (item, "clicked", G_CALLBACK (on_reject_clicked), talking);
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 4);
-
-  /* Outgoing call and talking share the same toolbar */
-  priv->main_bar = toolbar = gtk_toolbar_new ();
-  gtk_box_pack_start (GTK_BOX (talking), toolbar, FALSE, FALSE, 0);
-
-  item = gtk_toggle_tool_button_new_from_stock (MOKO_STOCK_SPEAKER);
-  gtk_tool_item_set_expand (item, TRUE);
-  g_signal_connect (item, "toggled", G_CALLBACK (on_speaker_toggled), talking);
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
-
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), gtk_separator_tool_item_new (), 1);
-
-  item = gtk_tool_button_new_from_stock (MOKO_STOCK_CALL_HANGUP);
-  gtk_tool_item_set_expand (item, TRUE);
-  g_signal_connect (item, "clicked", G_CALLBACK (on_cancel_clicked), talking);
-  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 2);  
-
-  /* The title label and image */
-  vbox = gtk_vbox_new (FALSE, 0);
-  gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
-  gtk_box_pack_start (GTK_BOX (talking), vbox, FALSE, FALSE, 0);
-  
-  priv->title = label = gtk_label_new ("Incoming Call");
-  gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
-  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
-  align = gtk_alignment_new (0.5, 0.5, 0, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 8);
-
-  priv->icon = image = gtk_image_new ();
-  gtk_container_add (GTK_CONTAINER (align), image);
-
-  priv->duration = duration = gtk_label_new ("00:00:00");
-  gtk_misc_set_alignment (GTK_MISC (duration), 0.5, 0.5);
-  gtk_box_pack_start (GTK_BOX (vbox), duration, FALSE, FALSE, 0);
-
-  /* The status area */
-  align = gtk_alignment_new (0.5, 0.5, 1, 0 );
-  gtk_box_pack_start (GTK_BOX (talking), align, TRUE, TRUE, 0);
-
-  frame = gtk_frame_new (NULL);
-  gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
-  gtk_container_add (GTK_CONTAINER (align), frame);
-
-  hbox = gtk_hbox_new (FALSE, 12);
-  gtk_container_add (GTK_CONTAINER (frame), hbox);
-
-  priv->person = image = gtk_image_new ();
-  gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
-
-  priv->status = label = gtk_label_new ("01923 820 124");
-  gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
-
-  /* Load the pixbufs */
-  for (i = 0; i < N_PICS; i++)
-  {
-    if (i == 0)
-      priv->talking[i] = gdk_pixbuf_new_from_file (PKGDATADIR"/talking.png",
-                                                   NULL);
-    else
-    {
-      gchar *name = g_strdup_printf ("%s/talking_%d.png", PKGDATADIR, i-1);
-      priv->talking[i] = gdk_pixbuf_new_from_file (name, NULL);
-      g_free (name);
-    }
-    if (G_IS_OBJECT (priv->talking[i]))
-      g_object_ref (priv->talking[i]);
-  }
-  for (i = 0; i < N_PICS-1; i++)
-  {
-    gchar *name = g_strdup_printf ("%s/outgoing_%d.png", PKGDATADIR, i);
-    priv->outgoing[i] = gdk_pixbuf_new_from_file (name, NULL);
-    g_free (name);
-    if (G_IS_OBJECT (priv->outgoing[i]))
-      g_object_ref (priv->outgoing[i]);
-  }
-  for (i = 0; i < N_PICS-1; i++)
-  {
-    gchar *name = g_strdup_printf ("%s/incoming_%d.png", PKGDATADIR, i);
-    priv->incoming[i] = gdk_pixbuf_new_from_file (name, NULL);
-    g_free (name);
-    if (G_IS_OBJECT (priv->incoming[i]))
-      g_object_ref (priv->incoming[i]);
-
-  }
-
-}
-
-GtkWidget*
-moko_talking_new (MokoJournal *journal)
-{
-  MokoTalking *talking = NULL;
-    
-  talking = g_object_new (MOKO_TYPE_TALKING, NULL);
-
-  talking->priv->journal = journal;
-
-  return GTK_WIDGET (talking);
-}

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.h	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.h	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,99 +0,0 @@
-/*
- *  moko-talking; a GObject wrapper for the talking/incoming/outgoing page
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _HAVE_MOKO_TALKING_H
-#define _HAVE_MOKO_TALKING_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include "moko-contacts.h"
-
-G_BEGIN_DECLS
-
-#define MOKO_TYPE_TALKING (moko_talking_get_type ())
-
-#define MOKO_TALKING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-        MOKO_TYPE_TALKING, MokoTalking))
-
-#define MOKO_TALKING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
-        MOKO_TYPE_TALKING, MokoTalkingClass))
-
-#define MOKO_IS_TALKING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-        MOKO_TYPE_TALKING))
-
-#define MOKO_IS_TALKING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-        MOKO_TYPE_TALKING))
-
-#define MOKO_TALKING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-        MOKO_TYPE_TALKING, MokoTalkingClass))
-
-typedef struct _MokoTalking MokoTalking;
-typedef struct _MokoTalkingClass MokoTalkingClass;
-typedef struct _MokoTalkingPrivate MokoTalkingPrivate;
-
-struct _MokoTalking
-{
-  GtkVBox         parent;
-
-  /*< private >*/
-  MokoTalkingPrivate   *priv;
-};
-
-struct _MokoTalkingClass 
-{
-  /*< private >*/
-  GtkVBoxClass    parent_class;
-
-  /* Signals */
-  void (*accept_call) (MokoTalking *talking);
-  void (*reject_call) (MokoTalking *talking);
-  void (*cancel_call) (MokoTalking *talking);
-  void (*silence) (MokoTalking *talking);
-  void (*speaker_toggle) (MokoTalking *talking, gboolean speaker_phone);
-}; 
-
-GType moko_talking_get_type (void) G_GNUC_CONST;
-
-GtkWidget*        
-moko_talking_new (MokoJournal *journal);
-
-void
-moko_talking_incoming_call (MokoTalking      *talking, 
-                            const gchar      *number,
-                            MokoContactEntry *entry);
-
-void
-moko_talking_outgoing_call (MokoTalking      *talking, 
-                            const gchar      *number,
-                            MokoContactEntry *entry);
-
-void
-moko_talking_accepted_call (MokoTalking      *talking, 
-                            const gchar      *number,
-                            MokoContactEntry *entry);
-
-void
-moko_talking_set_clip (MokoTalking      *talking, 
-                       const gchar      *number,
-                       MokoContactEntry *entry);
-
-G_END_DECLS
-
-#endif /* _HAVE_MOKO_TALKING_H */

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,198 +0,0 @@
-/*
- *  moko-tips; The autocomplete tips
- *  
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#include <gtk/gtk.h>
-#include <moko-stock.h>
-
-#include "moko-tips.h"
-
-#include <gtk/gtk.h>
-#include "moko-contacts.h"
-
-G_DEFINE_TYPE (MokoTips, moko_tips, GTK_TYPE_HBOX)
-
-#define MOKO_TIPS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
-        MOKO_TYPE_TIPS, MokoTipsPrivate))
-
-#define N_TIPS 3
-
-struct _MokoTipsPrivate
-{
-  GtkWidget     *image;
-  GtkWidget     *tips[N_TIPS];
-};
-
-enum
-{
-  SELECTED = 1,
-
-  LAST_SIGNAL
-};
-
-static guint tips_signals[LAST_SIGNAL] = {0, };
-
-void
-moko_tips_set_matches (MokoTips *tips, GList *list)
-{
-  MokoTipsPrivate *priv;
-  gint i;
-
-  g_return_if_fail (MOKO_IS_TIPS (tips));
-  priv = tips->priv;
-
-  for (i = 0; i < N_TIPS; i++)
-  {
-    MokoContactEntry *entry = NULL;
-    GtkWidget *label = gtk_bin_get_child (GTK_BIN (priv->tips[i]));
-
-    entry = (MokoContactEntry*)g_list_nth_data (list, i);
-
-    if (entry && entry->contact)
-    {
-      gtk_label_set_text (GTK_LABEL (label), entry->contact->name);
-      if (i == 0)
-      {
-        GdkPixbuf *scaled = NULL;
-
-        if (!entry->contact->photo)
-          moko_contacts_get_photo (moko_contacts_get_default (), 
-                                   entry->contact);
-        
-        if (!entry->contact->photo)
-        {
-          gtk_image_clear (GTK_IMAGE (priv->image));
-          continue;
-        }
-        scaled = gdk_pixbuf_scale_simple (entry->contact->photo,
-                                          36, 36,
-                                          GDK_INTERP_BILINEAR);
-        
-        gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), scaled);
-      }
-      gtk_widget_show (label);
-    }
-    else
-    {
-      gtk_widget_hide (label);
-      gtk_label_set_text (GTK_LABEL (label), "");
-      if (i == 0)
-      {
-        gtk_image_clear (GTK_IMAGE (priv->image));
-        gtk_widget_show (label);
-      }
-
-    }
-    g_object_set_data (G_OBJECT (priv->tips[i]), "entry", entry);
-  }
-}
-
-/* Callbacks */
-static gboolean
-on_tip_selected (GtkWidget *eb, GdkEventButton *event, MokoTips *tips)
-{
-  MokoTipsPrivate *priv;
-  MokoContactEntry *entry;
-
-  g_return_val_if_fail (MOKO_IS_TIPS (tips), FALSE);
-  priv = tips->priv;
-  
-  entry = (MokoContactEntry*)g_object_get_data (G_OBJECT (eb), "entry");
-
-  if (entry && entry->contact)
-   g_signal_emit ((gpointer) tips, tips_signals[SELECTED], 0, entry);
-
-  return FALSE;
-}
-
-/* GObject functions */
-static void
-moko_tips_dispose (GObject *object)
-{
-  G_OBJECT_CLASS (moko_tips_parent_class)->dispose (object);
-}
-
-static void
-moko_tips_finalize (GObject *tips)
-{
-  G_OBJECT_CLASS (moko_tips_parent_class)->finalize (tips);
-}
-
-
-static void
-moko_tips_class_init (MokoTipsClass *klass)
-{
-  GObjectClass *obj_class = G_OBJECT_CLASS (klass);
-
-  obj_class->finalize = moko_tips_finalize;
-  obj_class->dispose = moko_tips_dispose;
-
-  tips_signals[SELECTED] =
-    g_signal_new ("selected", 
-                  G_TYPE_FROM_CLASS (obj_class),
-                  G_SIGNAL_RUN_LAST,
-                  G_STRUCT_OFFSET (MokoTipsClass, selected),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__POINTER,
-                  G_TYPE_NONE,
-                  1, G_TYPE_POINTER);
-  g_type_class_add_private (obj_class, sizeof (MokoTipsPrivate)); 
-}
-
-static void
-moko_tips_init (MokoTips *tips)
-{
-  MokoTipsPrivate *priv;
-  GtkWidget *hbox;
-  gint i = 0;
-  
-  priv = tips->priv = MOKO_TIPS_GET_PRIVATE (tips);
-
-  priv->image = gtk_image_new ();
-  gtk_box_pack_start (GTK_BOX (tips), priv->image, FALSE, FALSE, 0);
-
-  hbox = gtk_hbox_new (TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (tips), hbox, TRUE, TRUE, 0);
-
-  for (i = 0; i < N_TIPS; i++)
-  {
-    GtkWidget *eb, *label;
-    priv->tips[i] = eb = gtk_event_box_new ();
-    g_signal_connect (eb, "button-release-event",
-                      G_CALLBACK (on_tip_selected), (gpointer)tips);
-    gtk_box_pack_start (GTK_BOX (hbox), eb, TRUE, TRUE, 0);   
-
-    label = gtk_label_new ("");
-    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-    //gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
-    gtk_container_add (GTK_CONTAINER (eb), label);
-  }
-}
-
-GtkWidget*
-moko_tips_new (void)
-{
-  MokoTips *tips = NULL;
-  
-  tips = g_object_new (MOKO_TYPE_TIPS, 
-                         "homogeneous", FALSE,
-                         "spacing", 0,
-                         NULL);
-
-  return GTK_WIDGET (tips);
-}

Deleted: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.h	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.h	2007-10-31 13:49:04 UTC (rev 3310)
@@ -1,84 +0,0 @@
-/*
- *  moko-tips; The autocomplete tips.
- *
- *  Authored by OpenedHand Ltd <info at openedhand.com>
- *
- *  Copyright (C) 2006-2007 OpenMoko Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- *  Current Version: $Rev$ ($Date$) [$Author$]
- */
-
-#ifndef _HAVE_MOKO_TIPS_H
-#define _HAVE_MOKO_TIPS_H
-
-#include <glib.h>
-#include <gtk/gtk.h>
-
-#include "moko-contacts.h"
-
-G_BEGIN_DECLS
-
-#define MOKO_TYPE_TIPS (moko_tips_get_type ())
-
-#define MOKO_TIPS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-        MOKO_TYPE_TIPS, MokoTips))
-
-#define MOKO_TIPS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
-        MOKO_TYPE_TIPS, MokoTipsClass))
-
-#define MOKO_IS_TIPS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-        MOKO_TYPE_TIPS))
-
-#define MOKO_IS_TIPS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-        MOKO_TYPE_TIPS))
-
-#define MOKO_TIPS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-        MOKO_TYPE_TIPS, MokoTipsClass))
-
-typedef struct _MokoTips MokoTips;
-typedef struct _MokoTipsClass MokoTipsClass;
-typedef struct _MokoTipsPrivate MokoTipsPrivate;
-
-struct _MokoTips
-{
-  GtkHBox         parent;
-
-  /*< private >*/
-  MokoTipsPrivate   *priv;
-};
-
-struct _MokoTipsClass 
-{
-  /*< private >*/
-  GtkHBoxClass    parent_class;
-  
-  /* signals */
-  void (*selected) (MokoTips *tips, MokoContactEntry *entry);
-
-  /* future padding */
-  void (*_moko_tips_1) (void);
-  void (*_moko_tips_2) (void);
-  void (*_moko_tips_3) (void);
-  void (*_moko_tips_4) (void);
-}; 
-
-GType moko_tips_get_type (void) G_GNUC_CONST;
-
-GtkWidget*        
-moko_tips_new (void);
-
-void
-moko_tips_set_matches (MokoTips *tips, GList *list);
-
-G_END_DECLS
-
-#endif /* _HAVE_MOKO_TIPS_H */

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/dialer-main.c (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer-main.c)
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/dialer-main.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/dialer-main.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -0,0 +1,127 @@
+/*  
+ *  Copyright (C) 2007 Openmoko, Inc.
+ *
+ *  Authored by OpenedHand Ltd <info at openedhand.com>
+ *
+ *  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 Lesser Public License for more details.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <gtk/gtk.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-bindings.h>
+#include <glib-object.h>
+
+#include <moko-stock.h>
+
+#include "moko-dialer.h"
+
+#define DIALER_NAMESPACE "org.openmoko.Dialer"
+#define DIALER_OBJECT "/org/openmoko/Dialer"
+
+static gchar *number = NULL;
+
+static void
+_dial_number (DBusGConnection *conn)
+{
+  DBusGProxy *proxy = NULL;
+  GError *error = NULL;
+
+  proxy = dbus_g_proxy_new_for_name (conn,
+                                      DIALER_NAMESPACE,
+                                      DIALER_OBJECT,
+                                      DIALER_NAMESPACE);
+
+  if (!proxy)
+    return;
+  
+  dbus_g_proxy_call (proxy, "Dial", &error,
+                     G_TYPE_STRING, number,
+                     G_TYPE_INVALID, G_TYPE_INVALID);
+  if (error)
+    g_warning (error->message);
+
+}
+
+int
+main (int argc, char **argv)
+{
+  MokoDialer *dialer;
+  DBusGConnection *connection;
+  DBusGProxy *proxy;
+  GError *error = NULL;
+  guint32 ret;
+
+  /* initialise type system */
+  g_type_init ();
+
+  /* Try and setup our DBus service */
+  connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+  if (connection == NULL)
+  {
+    g_warning ("Failed to make a connection to the session bus: %s", 
+               error->message);
+    g_error_free (error);
+    return 1;
+  }
+  proxy = dbus_g_proxy_new_for_name (connection, 
+                                     DBUS_SERVICE_DBUS,
+                                     DBUS_PATH_DBUS, 
+                                     DBUS_INTERFACE_DBUS);
+  if (!org_freedesktop_DBus_request_name (proxy,
+                                          DIALER_NAMESPACE,
+                                          0, &ret, &error))
+  {
+    /* Error requesting the name */
+    g_warning ("There was an error requesting the name: %s\n",error->message);
+    g_error_free (error);
+
+    gdk_init (&argc, &argv);
+    gdk_notify_startup_complete ();
+
+    return 1;
+  }
+  if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+  {
+    /* Someone else has registered the object */
+    if (number)
+      _dial_number (connection);
+
+    dbus_g_connection_unref (connection);
+
+    gdk_init (&argc, &argv);
+    gdk_notify_startup_complete ();
+    return 0;
+  }
+
+
+  /* Initialize Threading & GTK+ */
+  gtk_init (&argc, &argv);
+  moko_stock_register ();
+
+   /* Create the MokoDialer object */
+  dialer = moko_dialer_get_default ();
+
+  /* Add the object onto the bus */
+  dbus_g_connection_register_g_object (connection, 
+                                       DIALER_OBJECT,
+                                       G_OBJECT (dialer));
+
+  /* application object */
+  g_set_application_name ("OpenMoko Dialer");
+ 
+  if (number)
+    moko_dialer_dial (dialer, number, NULL);
+
+  gtk_main ();
+  
+  return 0;
+}

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer-dbus.xml (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-dbus.xml)
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer-dbus.xml	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer-dbus.xml	2007-10-31 13:49:04 UTC (rev 3310)
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<node name="/org/openmoko/Dialer">
+<interface name="org.openmoko.Dialer">
+<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="moko_dialer"/>
+  <method name="GetStatus">
+    <arg type="i" name="status" direction="out" />
+  </method>
+
+  <method name="Dial">
+    <arg type="s" name="number" direction="in" />
+  </method>
+
+  <method name="HangUp">
+    <arg type="s" name="message" direction="in" />
+  </method>
+
+  <signal name="IncomingCall">
+    <arg type="s" name="number"/>
+  </signal>
+  <signal name="OutgoingCall">
+    <arg type="s" name="number" />
+  </signal>
+
+  <signal name="Talking">
+  </signal>
+
+  <signal name="HungUp">
+  </signal>
+
+  <signal name="Rejected">
+  </signal>
+
+</interface>
+</node>

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer.c (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.c)
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.c	2007-10-31 06:42:58 UTC (rev 3309)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer.c	2007-10-31 13:49:04 UTC (rev 3310)
@@ -0,0 +1,760 @@
+/*
+ *  moko-dialer; a GObject wrapper for the dialer.
+ *
+ *  Authored by OpenedHand Ltd <info at openedhand.com>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#include <gtk/gtk.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-bindings.h>
+
+#include <moko-gsmd-connection.h>
+#include <moko-journal.h>
+#include <moko-stock.h>
+
+#include "moko-dialer.h"
+
+#include "moko-contacts.h"
+#include "moko-notify.h"
+#include "moko-talking.h"
+#include "moko-sound.h"
+
+G_DEFINE_TYPE (MokoDialer, moko_dialer, G_TYPE_OBJECT)
+
+#define MOKO_DIALER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
+        MOKO_TYPE_DIALER, MokoDialerPrivate))
+
+struct _MokoDialerPrivate
+{
+  gint                status;
+  gchar               *incoming_clip;
+
+  /* Main Widgets */
+  GtkWidget          *window;
+  GtkWidget          *notebook;
+  
+  /* Pages of the notebook */
+  GtkWidget          *talking;
+  GtkWidget          *keypad;
+  GtkWidget          *history;
+
+  /* Special objects */
+  MokoGsmdConnection *connection;
+  MokoJournal        *journal;
+  MokoContacts       *contacts;
+  MokoNotify         *notify;
+
+  /* The shared MokoJournalEntry which is constantly created */
+  MokoJournalEntry   *entry; 
+  MokoTime           *time;
+
+  /* Registration variables */
+  MokoGsmdConnectionNetregType registered;
+  MokoGSMLocation     gsm_location;
+};
+
+enum
+{
+  INCOMING_CALL,
+  OUTGOING_CALL,
+  TALKING,
+  HUNG_UP,
+  REJECTED,
+  
+  LAST_SIGNAL
+};
+
+static guint dialer_signals[LAST_SIGNAL] = {0, };
+
+/* DBus functions */
+
+static gboolean
+moko_dialer_get_status (MokoDialer *dialer, gint *OUT_status, GError *error)
+{
+  MokoDialerPrivate *priv;
+  
+  g_return_val_if_fail (MOKO_IS_DIALER (dialer), FALSE);
+  priv = dialer->priv;
+
+  *OUT_status = priv->status;
+
+  return TRUE;
+}
+
+gboolean
+moko_dialer_dial (MokoDialer *dialer, const gchar *number, GError *error)
+{
+  MokoDialerPrivate *priv;
+
+  g_return_val_if_fail (MOKO_IS_DIALER (dialer), FALSE);
+  g_return_val_if_fail (number != NULL, FALSE);
+  priv = dialer->priv;
+
+  /* FIXME: Dial the number! */
+
+  return TRUE;
+}
+
+static gboolean
+moko_dialer_hang_up (MokoDialer *dialer, const gchar *message, GError *error)
+{
+  g_return_val_if_fail (MOKO_IS_DIALER (dialer), FALSE);
+  
+  /* FIXME: Create a dialog and let the user know that another program is
+   * requesting the connection be dropped, and why ($message).
+   */
+  return TRUE;
+}
+
+/* </dbus functions> */
+ 
+void
+moko_dialer_outgoing_call (MokoDialer *dialer, const gchar *number)
+{
+  ;
+}
+
+
+void
+moko_dialer_talking (MokoDialer *dialer)
+{
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  dialer->priv->status = DIALER_STATUS_TALKING;
+
+  g_signal_emit (G_OBJECT (dialer), dialer_signals[TALKING], 0);
+}
+
+void
+moko_dialer_hung_up (MokoDialer *dialer)
+{
+  MokoDialerPrivate *priv;
+
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv; 
+  
+  priv->status = DIALER_STATUS_NORMAL;
+
+  if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook)) == 3)
+    gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), 0);
+  
+  moko_gsmd_connection_voice_hangup (priv->connection);   
+  g_signal_emit (G_OBJECT (dialer), dialer_signals[HUNG_UP], 0);
+  
+}
+
+void
+moko_dialer_rejected (MokoDialer *dialer)
+{
+  MokoDialerPrivate *priv;
+
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv;
+  
+  priv->status = DIALER_STATUS_NORMAL;
+
+  /* Stop the notification */
+  moko_notify_stop (priv->notify);  
+
+  if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (priv->notebook)) == 3)
+    gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), 0);
+  
+  moko_gsmd_connection_voice_hangup (priv->connection);  
+  
+  g_signal_emit (G_OBJECT (dialer), dialer_signals[REJECTED], 0);
+}
+
+
+#if 0
+static void
+on_keypad_pin_entry (MokoKeypad  *keypad,
+                     const gchar *in_pin,
+                     MokoDialer  *dialer)
+{
+  MokoDialerPrivate *priv;
+  gchar *pin;
+  
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv;
+
+  pin = g_strdup (in_pin);
+
+  g_debug ("Sending pin %s", pin);
+  moko_gsmd_connection_send_pin (priv->connection, pin);
+
+  moko_keypad_set_pin_mode (MOKO_KEYPAD (priv->keypad), FALSE);
+  g_free (pin);
+}
+#endif
+
+static void
+on_talking_accept_call (MokoTalking *talking, MokoDialer *dialer)
+{
+  MokoDialerPrivate *priv;
+
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv;
+  
+  if (priv->status != DIALER_STATUS_INCOMING)
+    return;
+
+  moko_gsmd_connection_voice_accept (priv->connection);
+  priv->status = DIALER_STATUS_TALKING;
+
+  /* Stop the notification */
+  moko_notify_stop (priv->notify);  
+  
+  g_signal_emit (G_OBJECT (dialer), dialer_signals[TALKING], 0);
+}
+
+static void
+on_talking_reject_call (MokoTalking *talking, MokoDialer *dialer)
+{
+
+  MokoDialerPrivate *priv;
+
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv;
+
+  moko_gsmd_connection_voice_hangup (priv->connection);
+  priv->status = DIALER_STATUS_NORMAL;
+  
+  gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), 0);
+ 
+  /* Finalise and add the journal entry */
+  if (priv->journal && priv->entry)
+  {
+    priv->time = moko_time_new_today ();
+    moko_journal_entry_set_dtstart (priv->entry, priv->time);
+    moko_journal_entry_set_dtend (priv->entry, priv->time);
+    moko_journal_voice_info_set_was_missed (priv->entry, TRUE);
+    moko_journal_add_entry (priv->journal, priv->entry);
+    moko_journal_write_to_storage (priv->journal);
+    priv->entry = NULL;
+    priv->time = NULL;
+  }
+
+  g_signal_emit (G_OBJECT (dialer), dialer_signals[REJECTED], 0);
+  moko_notify_stop (priv->notify);
+}
+
+static void
+on_talking_cancel_call (MokoTalking *talking, MokoDialer *dialer)
+{
+  MokoDialerPrivate *priv;
+
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv;
+  
+  moko_gsmd_connection_voice_hangup (priv->connection);
+  
+  priv->status = DIALER_STATUS_NORMAL;
+  gtk_notebook_remove_page (GTK_NOTEBOOK (priv->notebook), 0);
+  
+  g_signal_emit (G_OBJECT (dialer), dialer_signals[HUNG_UP], 0);
+}
+
+static void
+on_talking_silence (MokoTalking *talking, MokoDialer *dialer)
+{
+  MokoDialerPrivate *priv;
+
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv;
+
+  moko_notify_stop (priv->notify);
+}
+
+static void
+on_talking_speaker_toggle (MokoTalking *talking, 
+                           gboolean     speaker_phone,
+                           MokoDialer  *dialer)
+{
+  /* Toggle speaker phone */
+  static int on_speaker = FALSE;
+
+  if (on_speaker)
+    moko_sound_profile_set(SOUND_PROFILE_GSM_HANDSET);
+  else
+    moko_sound_profile_set(SOUND_PROFILE_GSM_SPEAKER_OUT);
+
+  on_speaker = !on_speaker;
+
+  g_debug ("Speaker toggled");
+}
+#if 0
+static void
+on_keypad_digit_pressed (MokoKeypad *keypad,
+                         const gchar digit,
+                         MokoDialer *dialer)
+{
+  MokoDialerPrivate *priv;
+
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv;
+
+  if ((digit == '+') || (digit == 'w') || (digit == 'p'))
+    return;
+
+  if (priv->status == DIALER_STATUS_TALKING)
+    moko_gsmd_connection_voice_dtmf (priv->connection, digit);
+}
+#endif
+/* Callbacks for MokoGsmdConnection */
+static void
+on_network_registered (MokoGsmdConnection *conn, 
+                       int type, 
+                       int lac,  
+                       int cell,
+                       MokoDialer *dialer)
+{
+  MokoDialerPrivate *priv;
+  
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv;
+
+  switch (type)
+  {
+    case MOKO_GSMD_CONNECTION_NETREG_NONE:
+    case MOKO_GSMD_CONNECTION_NETREG_SEARCHING:
+      /* Do nothing */
+      g_debug ("Searching for network");
+      break;
+    case MOKO_GSMD_CONNECTION_NETREG_DENIED:
+      /* This may be a pin issue*/
+      break;
+    case MOKO_GSMD_CONNECTION_NETREG_HOME:
+    case MOKO_GSMD_CONNECTION_NETREG_ROAMING:
+      g_debug ("Network registered: LocationAreaCode: %x. CellID: %x.", lac, cell);
+      priv->gsm_location.lac = lac;
+      priv->gsm_location.cid = cell;
+      break;
+    default:
+      g_warning ("Unhandled register event type = %d\n", type);
+   };
+
+  priv->registered = type;
+}
+
+static void
+on_incoming_call (MokoGsmdConnection *conn, int type, MokoDialer *dialer)
+{
+  MokoDialerPrivate *priv;
+  
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv;
+
+  /* We sometimes get the signals multiple times */
+  if (priv->status == DIALER_STATUS_INCOMING  
+        || priv->status == DIALER_STATUS_TALKING)
+  {
+    /*g_debug ("We are already showing the incoming page");*/
+    return;
+  }
+  priv->status = DIALER_STATUS_INCOMING;
+
+  if (priv->incoming_clip)
+    g_free (priv->incoming_clip);
+  priv->incoming_clip = NULL;
+
+  /* Prepare a voice journal entry */
+  if (priv->journal)
+  {
+    priv->entry = moko_journal_entry_new (VOICE_JOURNAL_ENTRY);
+    moko_journal_entry_set_direction (priv->entry, DIRECTION_IN);
+    moko_journal_entry_set_source (priv->entry, "Openmoko Dialer");
+    moko_journal_entry_set_gsm_location (priv->entry, &priv->gsm_location);
+  }
+  /* Set up the user interface */
+  moko_talking_incoming_call (MOKO_TALKING (priv->talking), NULL, NULL);
+
+  gtk_notebook_insert_page (GTK_NOTEBOOK (priv->notebook), priv->talking,
+                            gtk_image_new_from_file (PKGDATADIR"/phone.png"),
+                            0);
+  gtk_container_child_set (GTK_CONTAINER (priv->notebook), priv->talking,
+                           "tab-expand", TRUE,
+                           NULL); 
+  gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 0);
+  
+  gtk_window_present (GTK_WINDOW (priv->window));
+
+  /* Start the notification */
+  moko_notify_start (priv->notify);
+
+  g_signal_emit (G_OBJECT (dialer), dialer_signals[INCOMING_CALL], 0, NULL);
+}
+
+static void
+on_incoming_clip (MokoGsmdConnection *conn,
+                  const gchar        *number,
+                  MokoDialer         *dialer)
+{
+  MokoDialerPrivate *priv;
+  MokoContactEntry *entry;
+
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv;
+
+  if (priv->incoming_clip && (strcmp (number, priv->incoming_clip) == 0))
+  {
+    return;
+  }
+
+  priv->incoming_clip = g_strdup (number);
+  
+  entry = moko_contacts_lookup (moko_contacts_get_default (), number);
+  moko_talking_set_clip (MOKO_TALKING (priv->talking), number, entry);
+
+  /* Add the info to the journal entry */
+  if (priv->journal && priv->entry)
+  {
+    moko_journal_voice_info_set_distant_number (priv->entry, number);
+    if (entry)
+      moko_journal_entry_set_contact_uid (priv->entry, entry->contact->uid);
+  }
+  g_signal_emit (G_OBJECT (dialer), dialer_signals[INCOMING_CALL], 
+                 0, number);
+  g_debug ("Incoming Number = %s", number);
+}
+
+static void
+on_pin_requested (MokoGsmdConnection *conn, int type, MokoDialer *dialer)
+{
+  MokoDialerPrivate *priv;
+
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv;
+  
+  g_debug ("Pin Requested");
+}
+
+static void
+on_call_progress_changed (MokoGsmdConnection *conn, 
+                          int type, 
+                          MokoDialer *dialer)
+{
+  MokoDialerPrivate *priv;
+
+  g_return_if_fail (MOKO_IS_DIALER (dialer));
+  priv = dialer->priv;
+ 
+  switch (type) 
+  {
+    case MOKO_GSMD_PROG_DISCONNECT:
+    case MOKO_GSMD_PROG_RELEASE:
+      /* Finalise and add the journal entry */
+      if (priv->journal && priv->entry)
+      {
+        priv->time = moko_time_new_today ();
+        moko_journal_entry_set_dtend (priv->entry, priv->time);
+
+        if (priv->status == DIALER_STATUS_INCOMING)
+        {
+          moko_journal_entry_set_dtstart (priv->entry, priv->time);
+          moko_journal_voice_info_set_was_missed (priv->entry, TRUE);
+        }
+
+        moko_journal_add_entry (priv->journal, priv->entry);
+        moko_journal_write_to_storage (priv->journal);
+        priv->entry = NULL;
+        priv->time = NULL;
+      }
+
+      moko_dialer_hung_up (dialer);
+
+      if (priv->incoming_clip)
+        g_free (priv->incoming_clip);
+      priv->incoming_clip = NULL;
+
+      moko_notify_stop (priv->notify);
+      g_debug ("mokogsmd disconnect");
+      break;
+    
+    case MOKO_GSMD_PROG_REJECT:
+      moko_dialer_rejected (dialer);
+      g_debug ("mokogsmd reject");
+      break;
+    
+    case MOKO_GSMD_PROG_CONNECTED:
+      if (priv->status != DIALER_STATUS_TALKING)
+        moko_dialer_talking (dialer);
+      moko_talking_accepted_call (MOKO_TALKING (priv->talking), NULL, NULL);
+
+      /* Update a journal entry */
+      if (priv->journal && priv->entry)
+      {
+        priv->time = moko_time_new_today ();
+        moko_journal_entry_set_dtstart (priv->entry, priv->time);
+      }
+      g_debug ("mokogsmd connected");
+      break;
+    case MOKO_GSMD_PROG_SETUP:
+      g_debug ("mokogsmd setup");
+      break;
+    case MOKO_GSMD_PROG_ALERT:
+      g_debug ("mokogsmd alert");
+      break;
+    case  MOKO_GSMD_PROG_CALL_PROCEED:
+      g_debug ("mokogsmd proceed");
+      break;
+    case MOKO_GSMD_PROG_SYNC:
+      g_debug ("mokogsmd sync");
+      break;
+    case  MOKO_GSMD_PROG_PROGRESS:
+      g_debug ("mokogsmd progress");
+      break;
+    case MOKO_GSMD_PROG_UNKNOWN:
+    default:
+      g_debug ("mokogsmd unknown");
+      break;
+  }
+}
+
+/* GObject functions */
+static void
+moko_dialer_dispose (GObject *object)
+{
+  MokoDialer *dialer;
+  MokoDialerPrivate *priv;
+
+  dialer = MOKO_DIALER (object);
+  priv = dialer->priv;
+
+  /* Close journal */
+  if (priv->journal)
+  {
+    moko_journal_write_to_storage (priv->journal);
+    moko_journal_close (priv->journal);
+  }
+  G_OBJECT_CLASS (moko_dialer_parent_class)->dispose (object);
+}
+
+static void
+moko_dialer_finalize (GObject *dialer)
+{
+  G_OBJECT_CLASS (moko_dialer_parent_class)->finalize (dialer);
+}
+
+#include "moko-dialer-glue.h"
+
+static void
+moko_dialer_class_init (MokoDialerClass *klass)
+{
+  GObjectClass *obj_class = G_OBJECT_CLASS (klass);
+
+  obj_class->finalize = moko_dialer_finalize;
+  obj_class->dispose = moko_dialer_dispose;
+
+  /* add class signals */
+  dialer_signals[INCOMING_CALL] =
+    g_signal_new ("incoming_call", 
+                  G_TYPE_FROM_CLASS (obj_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (MokoDialerClass, incoming_call),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__STRING,
+                  G_TYPE_NONE, 
+                  1, G_TYPE_STRING);
+
+  dialer_signals[OUTGOING_CALL] =
+    g_signal_new ("outgoing_call", 
+                  G_TYPE_FROM_CLASS (obj_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (MokoDialerClass, outgoing_call),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__STRING,
+                  G_TYPE_NONE, 
+                  1, G_TYPE_STRING);
+
+   dialer_signals[TALKING] =
+    g_signal_new ("talking", 
+                  G_TYPE_FROM_CLASS (obj_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (MokoDialerClass, talking),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
+
+   dialer_signals[HUNG_UP] =
+    g_signal_new ("hung_up", 
+                  G_TYPE_FROM_CLASS (obj_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (MokoDialerClass, hung_up),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
+
+   dialer_signals[REJECTED] =
+    g_signal_new ("rejected", 
+                  G_TYPE_FROM_CLASS (obj_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (MokoDialerClass, rejected),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
+
+  g_type_class_add_private (obj_class, sizeof (MokoDialerPrivate)); 
+  dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (klass), 
+                                   &dbus_glib_moko_dialer_object_info);
+}
+
+static void
+dialer_display_error (GError *err)
+{
+  GtkWidget *dlg;
+
+  if (!err)
+    return;
+
+  dlg = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Dialer: %s", err->message);
+  gtk_dialog_run (GTK_DIALOG (dlg));
+  gtk_widget_destroy (dlg);
+}
+
+static void
+moko_dialer_init (MokoDialer *dialer)
+{
+  MokoDialerPrivate *priv;
+  MokoGsmdConnection *conn;
+  GError *err = NULL;
+
+  priv = dialer->priv = MOKO_DIALER_GET_PRIVATE (dialer);
+
+  /* create the dialer_data struct */
+  priv->status = DIALER_STATUS_NORMAL;
+  
+  /* clear incoming clip */
+  priv->incoming_clip = NULL;
+
+  /* Initialise the contacts list */
+  //contact_init_contact_data (&(priv->data->g_contactlist));
+
+  /* Init the gsmd connection, and power it up */
+  conn = priv->connection = moko_gsmd_connection_new ();
+  moko_gsmd_connection_set_antenna_power (conn, TRUE, &err);
+
+  dialer_display_error (err);
+  if (err && err->code == MOKO_GSMD_ERROR_CONNECT)
+    exit (1); /* no point continuing if we can't connect to gsmd? */
+
+ 
+  /* Connect to the gsmd signals */
+  g_signal_connect (G_OBJECT (conn), "network-registration", 
+                    G_CALLBACK (on_network_registered), (gpointer)dialer);
+  g_signal_connect (G_OBJECT (conn), "incoming-call", 
+                    G_CALLBACK (on_incoming_call), (gpointer)dialer);
+  g_signal_connect (G_OBJECT (conn), "incoming-clip",
+                    G_CALLBACK (on_incoming_clip), (gpointer)dialer);
+  g_signal_connect (G_OBJECT (conn), "pin-requested", 
+                    G_CALLBACK (on_pin_requested), (gpointer)dialer);
+  g_signal_connect (G_OBJECT (conn), "call-progress", 
+                    G_CALLBACK (on_call_progress_changed), (gpointer)dialer);
+
+  /* FIXME:
+   *  moko_gsmd_connection_get_network_status always seems to return 0 here */
+  priv->registered = MOKO_GSMD_CONNECTION_NETREG_SEARCHING;
+  moko_gsmd_connection_network_register (conn);
+ 
+  /* Set up the journal */
+  priv->journal = moko_journal_open_default ();
+  if (!priv->journal || !moko_journal_load_from_storage (priv->journal))
+  {
+    g_warning ("Cannot load journal");
+    priv->journal = NULL;
+  }
+  else
+    g_debug ("Journal Loaded");
+
+  /* Load the contacts store */
+  priv->contacts = moko_contacts_get_default ();
+
+  /* Load the notification object */
+  priv->notify = moko_notify_new ();
+
+  /* Create the window */
+  priv->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  g_signal_connect (G_OBJECT (priv->window), "delete-event",
+                    (GCallback) gtk_widget_hide_on_delete, NULL);
+  gtk_window_set_title (GTK_WINDOW (priv->window), "Dialer");
+
+  /* Notebook */
+  priv->notebook = gtk_notebook_new ();
+  gtk_notebook_set_tab_pos (GTK_NOTEBOOK (priv->notebook), GTK_POS_BOTTOM);
+  gtk_container_add (GTK_CONTAINER (priv->window), priv->notebook);
+
+  /* Talking: We don't actually add it to the notebook yet, as it is only added
+   * as/when needed. Therefore we just create it, and ref it (so it will 
+   * survive reparenting.
+   */
+  priv->talking = moko_talking_new (priv->journal);
+  g_object_ref (G_OBJECT (priv->talking));
+  gtk_widget_show_all (priv->talking);
+  g_signal_connect (G_OBJECT (priv->talking), "accept_call",
+                    G_CALLBACK (on_talking_accept_call), (gpointer)dialer);
+  g_signal_connect (G_OBJECT (priv->talking), "reject_call",
+                    G_CALLBACK (on_talking_reject_call), (gpointer)dialer);
+  g_signal_connect (G_OBJECT (priv->talking), "cancel_call",
+                    G_CALLBACK (on_talking_cancel_call), (gpointer)dialer);
+  g_signal_connect (G_OBJECT (priv->talking), "silence",
+                    G_CALLBACK (on_talking_silence), (gpointer)dialer);
+  g_signal_connect (G_OBJECT (priv->talking), "speaker_toggle",
+                    G_CALLBACK (on_talking_speaker_toggle), (gpointer)dialer);
+#if 0
+  /* Keypad */
+  priv->keypad = moko_keypad_new ();
+  g_signal_connect (G_OBJECT (priv->keypad), "dial_number",
+                    G_CALLBACK (on_keypad_dial_clicked), (gpointer)dialer);
+  g_signal_connect (G_OBJECT (priv->keypad), "pin_entry",
+                    G_CALLBACK (on_keypad_pin_entry), (gpointer)dialer);
+  g_signal_connect (G_OBJECT (priv->keypad), "digit_pressed",
+                    G_CALLBACK (on_keypad_digit_pressed), (gpointer)dialer);
+  gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->keypad,
+                            gtk_image_new_from_file (PKGDATADIR"/dtmf.png"));
+  gtk_container_child_set (GTK_CONTAINER (priv->notebook), priv->keypad,
+                          "tab-expand", TRUE,
+                          NULL);
+
+  /* History */
+  priv->history = moko_history_new (priv->journal);
+  g_signal_connect (G_OBJECT (priv->history), "dial_number",
+                    G_CALLBACK (on_history_dial_number), (gpointer)dialer);
+  gtk_notebook_append_page (GTK_NOTEBOOK (priv->notebook), priv->history,
+                            gtk_image_new_from_stock (MOKO_STOCK_CALL_HISTORY,
+                                                      GTK_ICON_SIZE_BUTTON));
+  gtk_container_child_set (GTK_CONTAINER (priv->notebook), priv->history,
+                           "tab-expand", TRUE,
+                           NULL);
+
+  gtk_widget_show_all (priv->notebook);
+  gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), 0);
+#endif
+}
+
+MokoDialer*
+moko_dialer_get_default (void)
+{
+  static MokoDialer *dialer = NULL;
+  if (dialer)
+    return dialer;
+  
+  dialer = g_object_new (MOKO_TYPE_DIALER, NULL);
+
+  return dialer;
+}

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-dialer.h (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.h)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-notify.c (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.c)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-notify.h (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-notify.h)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-sound.c (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.c)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-sound.h (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.h)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-talking.c (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.c)

Copied: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/phone-kit/moko-talking.h (from rev 3309, trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.h)





More information about the commitlog mailing list