2006-11-14 Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
authorMichael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
Tue, 14 Nov 2006 16:43:51 +0000 (16:43 +0000)
committerMichael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
Tue, 14 Nov 2006 16:43:51 +0000 (16:43 +0000)
* ./: Removing the whole lot of deprecated components.

24 files changed:
ChangeLog
src/Makefile.am
src/hildon-add-home-dialog.c [deleted file]
src/hildon-add-home-dialog.h [deleted file]
src/hildon-app-private.h [deleted file]
src/hildon-app.c [deleted file]
src/hildon-app.h [deleted file]
src/hildon-appview.c [deleted file]
src/hildon-appview.h [deleted file]
src/hildon-dialoghelp.c [deleted file]
src/hildon-dialoghelp.h [deleted file]
src/hildon-file-handling-note.c [deleted file]
src/hildon-file-handling-note.h [deleted file]
src/hildon-grid-item-private.h [deleted file]
src/hildon-grid-item.c [deleted file]
src/hildon-grid-item.h [deleted file]
src/hildon-grid.c [deleted file]
src/hildon-grid.h [deleted file]
src/hildon-scroll-area.c [deleted file]
src/hildon-scroll-area.h [deleted file]
src/hildon-system-sound.c [deleted file]
src/hildon-system-sound.h [deleted file]
src/hildon-telephone-editor.c [deleted file]
src/hildon-telephone-editor.h [deleted file]

index 360ca9b..34f6b41 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-11-14  Michael Dominic Kostrzewa  <michael.kostrzewa@nokia.com>
+
+       * ./: Removing the whole lot of deprecated components.  
+
 2006-11-14  Michael Dominic Kostrzewa  <michael.kostrzewa@nokia.com> 
 
        * ./: Some basic fixed to make the source actually buildable. Removing
index d7169f5..bad1739 100644 (file)
@@ -36,8 +36,6 @@ hildon-composite-widget.c \
        hildon-hvolumebar.h \
        hildon-vvolumebar.c \
        hildon-vvolumebar.h \
-       hildon-dialoghelp.c \
-       hildon-dialoghelp.h \
        hildon-calendar-popup.c \
        hildon-calendar-popup.h \
        hildon-date-editor.c \
@@ -49,8 +47,6 @@ hildon-composite-widget.c \
        hildon-time-picker.h \
        hildon-weekday-picker.c \
        hildon-weekday-picker.h \
-       hildon-telephone-editor.c \
-       hildon-telephone-editor.h \
        hildon-number-editor.c \
        hildon-number-editor.h \
        hildon-range-editor.c \
@@ -61,35 +57,18 @@ hildon-composite-widget.c \
        hildon-set-password-dialog.h \
        hildon-sort-dialog.c \
        hildon-sort-dialog.h \
-       hildon-add-home-dialog.c \
-       hildon-add-home-dialog.h \
        hildon-font-selection-dialog.c \
        hildon-font-selection-dialog.h \
-       hildon-grid.c \
-       hildon-grid.h \
-       hildon-grid-item.c \
-       hildon-grid-item.h \
-       hildon-grid-item-private.h \
-       hildon-file-handling-note.c \
-       hildon-file-handling-note.h \
        hildon-name-password-dialog.c \
        hildon-name-password-dialog.h \
-       hildon-scroll-area.c \
-       hildon-scroll-area.h \
        hildon-wizard-dialog.c \
        hildon-wizard-dialog.h \
        hildon-color-popup.c \
        hildon-color-popup.h \
        hildon-color-button.c \
        hildon-color-button.h \
-       hildon-system-sound.c \
-       hildon-system-sound.h \
-       hildon-app.c \
-       hildon-app.h \
        hildon-defines.c \
        hildon-defines.h \
-       hildon-appview.c \
-       hildon-appview.h \
        hildon-find-toolbar.c \
        hildon-find-toolbar.h \
        gtk-infoprint.c \
@@ -97,7 +76,6 @@ hildon-composite-widget.c \
        hildon-banner.c \
        hildon-banner.h \
        hildon-input-mode-hint.h \
-       hildon-app-private.h \
        hildon-caption.c \
        hildon-caption.h \
        hildon-window.c \
diff --git a/src/hildon-add-home-dialog.c b/src/hildon-add-home-dialog.c
deleted file mode 100644 (file)
index 9824677..0000000
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <libintl.h>
-
-#include "hildon-add-home-dialog.h"
-#include <hildon-widgets/hildon-caption.h>
-
-#define _(String) dgettext(PACKAGE, String)
-#define MAX_ERR_MSG 256
-#define HILDON_ADD_HOME_DIALOG_WIDTH 370
-#define HILDON_ADD_HOME_DIALOG_HEIGHT 100
-#define HILDON_MAX_TITLE_LENGTH 256
-#define HILDON_HOME_MAX_SHORTCUT_LEN 255
-
-#define HILDON_ADD_HOME_DIALOG_GET_PRIVATE(obj) \
-  (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
-                               HILDON_TYPE_ADD_HOME_DIALOG, \
-                               HildonAddHomeDialogPrivate));
-
-typedef struct _HildonAddHomeDialogPrivate HildonAddHomeDialogPrivate;
-
-static GtkDialogClass *parent_class;
-
-static const gchar *hildon_add_home_dialog_get_old_name(HildonAddHomeDialog * dialog);
-static void hildon_add_home_dialog_set_old_name(HildonAddHomeDialog * dialog, const gchar* name);
-static void hildon_add_home_dialog_set_new_name(HildonAddHomeDialog * dialog, const gchar* name);
-static void hildon_add_home_dialog_create_widgets(HildonAddHomeDialog * dialog, gboolean new_isrename);
-
-static void
-hildon_add_home_dialog_get_property(GObject * object,
-                                   guint prop_id,
-                                   GValue * value,
-                                   GParamSpec * pspec);
-static void
-hildon_add_home_dialog_set_property(GObject * object,
-                                   guint prop_id,
-                                   const GValue * value,
-                                   GParamSpec * pspec);
-static void
-hildon_add_home_dialog_class_init(HildonAddHomeDialogClass * class);
-static void hildon_add_home_dialog_init(HildonAddHomeDialog * dialog);
-
-/* private struct */
-
-struct _HildonAddHomeDialogPrivate {
-    GtkWidget *desc_label;
-    GtkWidget *name_entry; /* Used when isrename */
-    GtkWidget *name_label; /* Used when !isrename */
-    GtkWidget *caption_name_entry; /* Used when isrename */
-    GtkWidget *new_name_entry;
-    GtkWidget *caption_new_name_entry;
-    GtkSizeGroup *size_group;
-    GtkWidget *okButton;
-    GtkWidget *cancelButton;
-    gboolean isrename;
-};
-
-enum
-{
-  PROP_0,
-
-  PROP_NAME,
-  PROP_NEW_NAME,
-};
-
-/* Private functions */
-
-static void
-hildon_add_home_dialog_class_init(HildonAddHomeDialogClass * klass)
-{
-    GObjectClass * gobject_class = G_OBJECT_CLASS(klass);
-    parent_class = g_type_class_peek_parent(klass);
-
-    gobject_class->set_property = hildon_add_home_dialog_set_property;
-    gobject_class->get_property = hildon_add_home_dialog_get_property;
-
-    /**
-     * HildonAddHomeDialog:name
-     * 
-     * The name
-     */
-    g_object_class_install_property(gobject_class,
-                                   PROP_NAME,
-                                   g_param_spec_string ("name",
-                                                       ("Name"),
-                                                       ("The name."),
-                                                       NULL,
-                                                       G_PARAM_READWRITE));
-
-    /**
-     * HildonAddHomeDialog:new_name
-     * 
-     * The new name
-     */
-    g_object_class_install_property(gobject_class,
-                                   PROP_NEW_NAME,
-                                   g_param_spec_string ("new_name",
-                                                       ("New Name"),
-                                                       ("The new name."),
-                                                       NULL,
-                                                       G_PARAM_READWRITE));
-
-    g_type_class_add_private(klass, sizeof(HildonAddHomeDialogPrivate));
-}
-
-static void hildon_add_home_dialog_init(HildonAddHomeDialog * dialog)
-{
-    HildonAddHomeDialogPrivate *priv;
-
-    gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
-
-    priv = HILDON_ADD_HOME_DIALOG_GET_PRIVATE(dialog);
-    priv->name_entry = NULL;
-    priv->name_label = NULL;
-    priv->caption_name_entry = NULL;
-    priv->new_name_entry = NULL;
-    priv->isrename = FALSE;
-
-    priv->okButton = gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                           "addtoHome_button_ok",
-                                           GTK_RESPONSE_OK);
-    priv->cancelButton = gtk_dialog_add_button(GTK_DIALOG(dialog),
-                                               "addtoHome_button_cancel",
-                                               GTK_RESPONSE_CANCEL);
-
-    gtk_window_resize(GTK_WINDOW(dialog),
-                      HILDON_ADD_HOME_DIALOG_WIDTH,
-                      HILDON_ADD_HOME_DIALOG_HEIGHT);
-
-    gtk_widget_show_all(GTK_DIALOG(dialog)->vbox);
-    gtk_widget_show_all(GTK_DIALOG(dialog)->action_area);
-
-    priv->size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
-
-
-    /* add description text (only shown when isrename==true */
-    priv->desc_label = gtk_label_new(_("ckdg_ib_link_exists"));
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
-                           priv->desc_label, FALSE, FALSE, 0);
-
-    /* We don't use the hildon_caption_new() C convenience function, because it demands a non-NULL child widget (via gtk_container_add()). */
-    priv->caption_name_entry = GTK_WIDGET( g_object_new( HILDON_TYPE_CAPTION, "size_group", priv->size_group, "label", "addtoHome_editor_caption", "status", HILDON_CAPTION_OPTIONAL, NULL) );
-    gtk_widget_show(priv->caption_name_entry);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), priv->caption_name_entry,
-                       FALSE, FALSE, 0);
-
-
-    gtk_widget_show_all(GTK_DIALOG(dialog)->action_area);
-}
-
-/* Public functions */
-
-GType hildon_add_home_dialog_get_type(void)
-{
-    static GType dialog_type = 0;
-
-    if (!dialog_type) {
-        static const GTypeInfo dialog_info = {
-            sizeof(HildonAddHomeDialogClass),
-            NULL,       /* base_init */
-            NULL,       /* base_finalize */
-            (GClassInitFunc) hildon_add_home_dialog_class_init,
-            NULL,       /* class_finalize */
-            NULL,       /* class_data */
-            sizeof(HildonAddHomeDialog),
-            0,  /* n_preallocs */
-            (GInstanceInitFunc) hildon_add_home_dialog_init
-        };
-
-        dialog_type = g_type_register_static(GTK_TYPE_DIALOG,
-                                             "HildonAddHomeDialog",
-                                             &dialog_info, 0);
-    }
-    return dialog_type;
-}
-
-static void
-hildon_add_home_dialog_get_property (GObject    *object,
-                             guint       prop_id,
-                             GValue     *value,
-                             GParamSpec *pspec)
-{
-    HildonAddHomeDialog * dialog = HILDON_ADD_HOME_DIALOG(object);
-    HildonAddHomeDialogPrivate *priv = HILDON_ADD_HOME_DIALOG_GET_PRIVATE(dialog);
-  
-    switch(prop_id)
-    {
-        case PROP_NAME:
-        {
-            const gchar* name = NULL;
-            if(priv->isrename && priv->name_label)
-                name = gtk_entry_get_text(GTK_ENTRY(priv->name_label));
-            else if(!(priv->isrename) && priv->name_entry)
-                name = gtk_entry_get_text(GTK_ENTRY(priv->name_entry));
-
-            g_value_set_string (value, name);
-            break;
-        }
-        case PROP_NEW_NAME:
-        {
-            const gchar* new_name = NULL;
-            if(priv->isrename && priv->new_name_entry)
-                new_name = gtk_entry_get_text(GTK_ENTRY(priv->new_name_entry));
-
-            g_value_set_string (value, new_name);
-            break;
-        }
-        default:
-            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-            break;
-    }
-}
-
-static void
-hildon_add_home_dialog_set_window_title (HildonAddHomeDialog * dialog)
-{
-    HildonAddHomeDialogPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_ADD_HOME_DIALOG(dialog));
-    priv = HILDON_ADD_HOME_DIALOG_GET_PRIVATE(dialog);
-
-    /* Set up the window title */
-    if (priv->isrename)
-        gtk_window_set_title(GTK_WINDOW(dialog), _("ckdg_ti_rename_link"));
-    else
-        gtk_window_set_title(GTK_WINDOW(dialog), "addtoHome_dialog_title");
-}
-
-
-static void
-hildon_add_home_dialog_set_property (GObject      *object,
-                             guint         prop_id,
-                             const GValue *value,
-                             GParamSpec   *pspec)
-{
-    HildonAddHomeDialog * dialog = HILDON_ADD_HOME_DIALOG(object);
-    HildonAddHomeDialogPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_ADD_HOME_DIALOG(dialog));
-    priv = HILDON_ADD_HOME_DIALOG_GET_PRIVATE(dialog);
-
-    switch (prop_id)
-    {
-    case PROP_NAME:
-        hildon_add_home_dialog_set_old_name (dialog, g_value_get_string (value));
-        break;
-    case PROP_NEW_NAME:
-        hildon_add_home_dialog_set_new_name (dialog, g_value_get_string (value));
-        break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-        break;
-    }
-}
-
-/**
- * hildon_add_home_dialog_new:
- * @parent: parent window for the dialog
- * @name: name to show in the entry (or label, if @new_name is not NULL)
- * @new_name: name to show in the new name entry. If this is not NULL
- * the widget acts as a RenameShortcutDialog.
- *
- * Creates a new Add to Home dialog or Rename Shortcut dialog.
- *
- * Returns: the new dialog.
- */
-GtkWidget *hildon_add_home_dialog_new(GtkWindow * parent,
-                                      const gchar * name,
-                                      const gchar * new_name)
-{
-     HildonAddHomeDialog *dialog =
-       HILDON_ADD_HOME_DIALOG(g_object_new
-                             (HILDON_TYPE_ADD_HOME_DIALOG, "name", name, "new_name", new_name, NULL));
-
-    if (parent)
-        gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
-
-    return GTK_WIDGET(dialog);
-}
-
-/**
- * hildon_add_home_dialog_get_name:
- * @dialog: the dialog
- *
- * Returns: the string the user has entered in the entry
- */
-const gchar *hildon_add_home_dialog_get_name(HildonAddHomeDialog * dialog)
-{
-    HildonAddHomeDialogPrivate *priv;
-
-    g_return_val_if_fail(HILDON_IS_ADD_HOME_DIALOG(dialog), NULL);
-    priv = HILDON_ADD_HOME_DIALOG_GET_PRIVATE(dialog);
-
-    if (priv->isrename && priv->new_name_entry)
-        return gtk_entry_get_text(GTK_ENTRY(priv->new_name_entry));
-    else if(priv->name_entry)
-        return gtk_entry_get_text(GTK_ENTRY(priv->name_entry));
-    else
-        return NULL;
-}
-
-static const gchar *hildon_add_home_dialog_get_old_name(HildonAddHomeDialog * dialog)
-{
-    HildonAddHomeDialogPrivate *priv;
-
-    g_return_val_if_fail(HILDON_IS_ADD_HOME_DIALOG(dialog), NULL);
-    priv = HILDON_ADD_HOME_DIALOG_GET_PRIVATE(dialog);
-
-    if (priv->isrename && priv->name_label)
-        return gtk_label_get_text(GTK_LABEL(priv->name_label));
-    else if(!priv->isrename && priv->name_entry)
-        return gtk_entry_get_text(GTK_ENTRY(priv->name_entry));
-    else
-        return NULL;
-}
-
-static void hildon_add_home_dialog_set_old_name(HildonAddHomeDialog * dialog, const gchar* name)
-{
-    HildonAddHomeDialogPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_ADD_HOME_DIALOG(dialog));
-    priv = HILDON_ADD_HOME_DIALOG_GET_PRIVATE(dialog);
-
-    hildon_add_home_dialog_create_widgets(dialog, priv->isrename);
-
-    /* Set text in the widgets: */
-    if (priv->isrename)
-        gtk_label_set_text(GTK_LABEL(priv->name_label), name);
-    else
-        gtk_entry_set_text(GTK_ENTRY(priv->name_entry), name);
-}
-
-static void hildon_add_home_dialog_set_new_name(HildonAddHomeDialog * dialog, const gchar* new_name)
-{
-    HildonAddHomeDialogPrivate *priv;
-    gchar* name = NULL;
-    gboolean new_isrename = FALSE; 
-
-    g_return_if_fail(HILDON_IS_ADD_HOME_DIALOG(dialog));
-    priv = HILDON_ADD_HOME_DIALOG_GET_PRIVATE(dialog);
-
-    /* We get the old name, in case we need to set it again in a new widget. */
-    name = g_strdup( hildon_add_home_dialog_get_old_name(dialog) );
-    new_isrename = (new_name != NULL);
-
-    hildon_add_home_dialog_create_widgets(dialog, new_isrename);
-
-
-    /* Set text in the widgets: */
-    if(priv->isrename)
-    {
-        gtk_entry_set_text(GTK_ENTRY(priv->new_name_entry), new_name);
-        gtk_label_set_text(GTK_LABEL(priv->name_label), (name) ? name : "");
-    }
-    else
-    {
-        gtk_entry_set_text(GTK_ENTRY(priv->name_entry), (name) ? name : "");
-    }
-
-    if(name)
-      g_free(name);
-}
-
-static void hildon_add_home_dialog_create_widgets(HildonAddHomeDialog * dialog, gboolean new_isrename)
-{
-    HildonAddHomeDialogPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_ADD_HOME_DIALOG(dialog));
-    priv = HILDON_ADD_HOME_DIALOG_GET_PRIVATE(dialog);
-
-    /* Create and destroy widgets, depending on the mode.
-     * Note that we are making a small speed sacrifice (recreating the widgets) 
-     * in exchange for memory (creating all widgets and just hiding the ones we don't use.)
-     */
-
-    if(priv->isrename && !new_isrename)
-    {
-        /* Remove widgets that were used for isrename mode,
-           because we don't need them anymore. */
-        if(priv->new_name_entry)
-        {
-            gtk_widget_destroy(priv->new_name_entry);
-            priv->new_name_entry = NULL;
-        }
-
-        if(priv->caption_new_name_entry)
-        {
-            gtk_widget_destroy(priv->caption_new_name_entry);
-            priv->caption_new_name_entry = NULL;
-        }
-
-        if(priv->name_label) /* A label */
-        {
-           gtk_widget_destroy(priv->name_label);
-           priv->name_label = NULL;
-        }
-
-        if(priv->name_entry) /* A box with label inside */
-        {
-           gtk_widget_destroy(priv->name_entry);
-           priv->name_entry = NULL;
-        }
-    }
-    else if(!priv->isrename && new_isrename)
-    {
-        /* Remove widgets that were used only for !isrename mode,
-           because we don't need them anymore. */
-        if(priv->name_entry) /* An entry. */
-        {
-           gtk_widget_destroy(priv->name_entry);
-           priv->name_entry = NULL;
-        }
-    }
-
-    priv->isrename = new_isrename;
-
-    if(priv->isrename)
-    {
-        /* Create widgets needed for isrename mode: */
-
-        /* Create Entry (in a Caption) for the new name, and pack it into the dialog: */
-        if(!priv->new_name_entry)
-        {
-            priv->new_name_entry = gtk_entry_new();
-            gtk_widget_show(priv->new_name_entry);
-        }
-
-        if(!priv->caption_new_name_entry)
-        {
-            priv->caption_new_name_entry = hildon_caption_new(priv->size_group, _("ckdg_fi_rename_name"),
-                                           priv->new_name_entry, NULL,
-                                           HILDON_CAPTION_OPTIONAL);
-            gtk_widget_show(priv->caption_new_name_entry);
-            gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), GTK_WIDGET(priv->caption_new_name_entry),
-                               FALSE, FALSE, 0);
-        }
-
-        /* add description text */
-        if(priv->desc_label)
-          gtk_widget_show(priv->desc_label);
-
-        /* Create Label (in a Box) for the existing name: */
-        if(!priv->name_entry)
-        {
-            priv->name_label = gtk_label_new(NULL);
-            gtk_widget_show(priv->name_label);
-
-            priv->name_entry = gtk_hbox_new(FALSE, 0);
-            gtk_widget_show(priv->name_entry);
-            gtk_box_pack_start(GTK_BOX(priv->name_entry), priv->name_label, FALSE, FALSE,
-                           0);
-            gtk_container_add(GTK_CONTAINER(priv->caption_name_entry), GTK_WIDGET(priv->name_entry));
-        }
-    }
-    else
-    {
-        if(priv->desc_label)
-          gtk_widget_hide(priv->desc_label);
-
-        /* Create widgets needed for !isrename mode: */
-        if(!priv->name_entry)
-        {
-            priv->name_entry = gtk_entry_new();
-            gtk_widget_show(priv->name_entry);
-            gtk_container_add(GTK_CONTAINER(priv->caption_name_entry), GTK_WIDGET(priv->name_entry));
-        }
-    }
-
-    hildon_add_home_dialog_set_window_title(dialog);
-
-    priv->isrename = new_isrename;
-}
-
-void hildon_add_home_dialog_set_name(HildonAddHomeDialog * dialog, const gchar* name)
-{
-    HildonAddHomeDialogPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_ADD_HOME_DIALOG(dialog));
-    priv = HILDON_ADD_HOME_DIALOG_GET_PRIVATE(dialog);
-
-    hildon_add_home_dialog_create_widgets(dialog, priv->isrename);
-
-    /* Set text in the widgets: */
-    if (priv->isrename)
-        gtk_entry_set_text(GTK_ENTRY(priv->new_name_entry), name);
-    else
-        gtk_label_set_text(GTK_LABEL(priv->name_entry), name);
-}
-
diff --git a/src/hildon-add-home-dialog.h b/src/hildon-add-home-dialog.h
deleted file mode 100644 (file)
index bd3e1c2..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __HILDON_ADD_HOME_DIALOG_H__
-#define __HILDON_ADD_HOME_DIALOG_H__
-
-#include <gtk/gtkdialog.h>
-
-G_BEGIN_DECLS
-#define HILDON_TYPE_ADD_HOME_DIALOG \
-  ( hildon_add_home_dialog_get_type() )
-#define HILDON_ADD_HOME_DIALOG(obj) \
-  (GTK_CHECK_CAST (obj, HILDON_TYPE_ADD_HOME_DIALOG, HildonAddHomeDialog))
-#define HILDON_ADD_HOME_DIALOG_CLASS(klass) \
-  (GTK_CHECK_CLASS_CAST ((klass), HILDON_TYPE_ADD_HOME_DIALOG, \
-  HildonAddHomeDialogClass))
-#define HILDON_IS_ADD_HOME_DIALOG(obj) \
-  (GTK_CHECK_TYPE (obj, HILDON_TYPE_ADD_HOME_DIALOG))
-#define HILDON_IS_ADD_HOME_DIALOG_CLASS(klass) \
-  (GTK_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_ADD_HOME_DIALOG))
-typedef struct _HildonAddHomeDialog HildonAddHomeDialog;
-typedef struct _HildonAddHomeDialogClass HildonAddHomeDialogClass;
-
-struct _HildonAddHomeDialog {
-    GtkDialog parent;
-};
-
-struct _HildonAddHomeDialogClass {
-    GtkDialogClass parent_class;
-};
-
-GType hildon_add_home_dialog_get_type(void);
-
-GtkWidget *hildon_add_home_dialog_new(GtkWindow * parent,
-                                      const gchar * name,
-                                      const gchar * new_name);
-const gchar *hildon_add_home_dialog_get_name(HildonAddHomeDialog * dialog);
-
-G_END_DECLS
-#endif /* __HILDON_ADD_HOME_DIALOG_H__ */
diff --git a/src/hildon-app-private.h b/src/hildon-app-private.h
deleted file mode 100644 (file)
index 1441a0b..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-
-#ifndef HILDON_APP_PRIVATE_H
-#define HILDON_APP_PRIVATE_H
-
-G_BEGIN_DECLS
-
-enum {
-    TOPMOST_STATUS_ACQUIRE,
-    TOPMOST_STATUS_LOSE,
-    SWITCH_TO,
-    IM_CLOSE,
-    CLIPBOARD_COPY,
-    CLIPBOARD_CUT,
-    CLIPBOARD_PASTE,
-
-    HILDON_APP_LAST_SIGNAL
-};
-
-struct _HildonAppPrivate {
-    GList *children;
-    gchar *title;
-#ifndef HILDON_DISABLE_DEPRECATED
-    HildonZoomLevel zoom;
-#endif
-
-    /* Used to keep track of menu key press/release */
-    gint lastmenuclick;
-
-    gulong curr_view_id;
-    gulong view_id_counter;
-    GSList *view_ids;
-    gboolean scroll_control;
-
-    guint twoparttitle: 1;
-    guint is_topmost: 1;
-    gboolean killable;
-    gboolean autoregistration;
-
-    guint escape_timeout;
-    guint key_snooper;
-    
-    GtkUIManager *uim;
-    
-    guint active_menu_id;
-};
-
-typedef struct {
-  gpointer view_ptr;
-  unsigned long view_id;
-} view_item;
-
-G_END_DECLS
-
-#endif /* HILDON_APP_PRIVATE_H */
diff --git a/src/hildon-app.c b/src/hildon-app.c
deleted file mode 100644 (file)
index b7a24a7..0000000
+++ /dev/null
@@ -1,2270 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/**
- * SECTION:hildon-app
- * @short_description: A base widget to present application. Deprecated, use #HildonProgram instead.
- * @see_also: #HildonAppView
- *
- * #HildonApp is the base for any hildon application.
- * It controls basic looks and functionality of an application, like a title.
- *
- * This widget is deprecated use #HildonProgram instead.
- */
-
-#include <gdk/gdk.h>
-#include "hildon-app.h"
-#include "hildon-app-private.h"
-#include "hildon-appview.h"
-#include "gtk-infoprint.h"
-
-#include <gdk/gdkevents.h>
-#include <gdk/gdkkeysyms.h>
-#include <X11/Xatom.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkeditable.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkuimanager.h>
-#include <gtk/gtkactiongroup.h>
-#include <gtk/gtkdialog.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkcombobox.h>
-
-#include <libintl.h>
-#include <string.h>
-
-#include <libmb/mbutil.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#define TITLE_DELIMITER " - "
-
-/*
- * 'Magic' values for the titlebar menu area limits
- */
-#define MENUAREA_LEFT_LIMIT 80
-#define MENUAREA_RIGHT_LIMIT MENUAREA_LEFT_LIMIT + 307
-#define MENUAREA_TOP_LIMIT 0
-#define MENUAREA_BOTTOM_LIMIT 39
-
-#define KILLABLE "CANKILL"
-
-#define _(String) dgettext(PACKAGE, String)
-
-#define HILDON_APP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
-      HILDON_TYPE_APP, HildonAppPrivate));
-
-static GtkWindowClass *parent_class;
-static guint app_signals[HILDON_APP_LAST_SIGNAL] = { 0 };
-
-typedef struct _HildonAppPrivate HildonAppPrivate;
-
-static gboolean
-hildon_app_key_press (GtkWidget *widget, GdkEventKey *keyevent);
-static gboolean
-hildon_app_key_release (GtkWidget *widget, GdkEventKey *keyevent);
-static gboolean
-hildon_app_key_snooper (GtkWidget *widget, GdkEventKey *keyevent, HildonApp *app);
-static GdkFilterReturn
-hildon_app_event_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data);
-static void
-hildon_app_construct_title (HildonApp *self);
-static void
-hildon_app_finalize (GObject *obj_self);
-static void
-hildon_app_destroy (GtkObject *obj);
-static void
-hildon_app_init (HildonApp *self);
-static void
-hildon_app_class_init (HildonAppClass *app_class);
-static void
-hildon_app_real_topmost_status_acquire (HildonApp *self);
-static void
-hildon_app_real_topmost_status_lose (HildonApp *self);
-static void
-hildon_app_real_switch_to (HildonApp *self);
-static gboolean
-hildon_app_button (GtkWidget *widget, GdkEventButton *event);
-static GdkWindow *
-find_window (GdkWindow *window, gint by, gint co);
-static void
-hildon_app_clipboard_copy(HildonApp *self, GtkWidget *widget);
-static void
-hildon_app_clipboard_cut(HildonApp *self, GtkWidget *widget);
-static void
-hildon_app_clipboard_paste(HildonApp *self, GtkWidget *widget);
-static gboolean hildon_app_escape_timeout(gpointer data);
-       
-static void hildon_app_set_property(GObject * object, guint property_id,
-                                    const GValue * value, GParamSpec * pspec);
-static void hildon_app_get_property(GObject * object, guint property_id,
-                                    GValue * value, GParamSpec * pspec);
-
-static void hildon_app_add (GtkContainer *container, GtkWidget *child);
-static void hildon_app_remove (GtkContainer *container, GtkWidget *child);
-static void hildon_app_forall (GtkContainer *container, gboolean include_internals,
-                              GtkCallback callback, gpointer callback_data);
-
-enum {
-  PROP_0,
-  PROP_SCROLL_CONTROL,
-  /* FIXME: Zoom is deprecated, should be removed */
-  PROP_ZOOM,
-  PROP_TWO_PART_TITLE,
-  PROP_APP_TITLE,
-  PROP_KILLABLE,
-  PROP_AUTOREGISTRATION,
-  PROP_APPVIEW,
-  PROP_UI_MANAGER
-};
-
-static gpointer find_view(HildonApp *self, unsigned long view_id);
-
-/* FIXME: Zoom level is deprecated, should be removed */
-/**
- * hildon_zoom_level_get_type:
- *
- * Initialises, and returns the type of a hildon zoom level
- * 
- * Returns: GType of #HildonZoomLevel
- */
-
-GType
-hildon_zoom_level_get_type (void)
-{
-  static GType etype = 0;
-  if (etype == 0) {
-    static const GEnumValue values[] = {
-      { HILDON_ZOOM_SMALL, "HILDON_ZOOM_SMALL", "small" },
-      { HILDON_ZOOM_MEDIUM, "HILDON_ZOOM_MEDIUM", "medium" },
-      { HILDON_ZOOM_LARGE, "HILDON_ZOOM_LARGE", "large" },
-      { 0, NULL, NULL }
-    };
-    etype = g_enum_register_static ("HildonZoomLevel", values);
-  }
-  return etype;
-}
-
-GType hildon_app_get_type(void)
-{
-    static GType app_type = 0;
-
-    if (!app_type)
-      {
-        static const GTypeInfo app_info =
-          {
-            sizeof(HildonAppClass),
-            NULL,       /* base_init */
-            NULL,       /* base_finalize */
-            (GClassInitFunc) hildon_app_class_init,
-            NULL,       /* class_finalize */
-            NULL,       /* class_data */
-            sizeof(HildonApp),
-            0,  /* n_preallocs */
-            (GInstanceInitFunc) hildon_app_init,
-          };
-        app_type = g_type_register_static(GTK_TYPE_WINDOW,
-                                          "HildonApp", &app_info, 0);
-      }
-    return app_type;
-}
-
-/*
- * Sets or delete a custom property into the XServer, according
- * to the boolean value of HildonAppPrivate::killable
- */ 
-static void hildon_app_apply_killable(HildonApp *self)
-{
-    HildonAppPrivate *priv;
-    Atom killability_atom = XInternAtom (GDK_DISPLAY(),
-                                      "_HILDON_APP_KILLABLE", False);
-    priv = HILDON_APP_GET_PRIVATE (self);
-
-    g_assert (HILDON_IS_APP (self) );
-    g_assert(GTK_WIDGET_REALIZED(self));
-
-    if (priv->killable)
-    {
-      /* Set the atom to specific value, because perhaps in the future,
-              there may be other possible values? */
-      XChangeProperty(GDK_DISPLAY(),
-                     GDK_WINDOW_XID(GTK_WIDGET(self)->window),
-                     killability_atom, XA_STRING, 8,
-                     PropModeReplace, (unsigned char *)KILLABLE,
-                     strlen(KILLABLE));
-    }
-    else
-    {
-      XDeleteProperty(GDK_DISPLAY(),
-                     GDK_WINDOW_XID(GTK_WIDGET(self)->window),
-                     killability_atom);
-    }
-}
-
-/*
- * Updates the _NET_CLIENT_LIST property into the XServer.
- * It is the list of the views associated to the HildonApp.
- * It will be used by the Task Navigator in order to be able to show a list
- * of all the views, and let the user switch and navigate them.
- */
-static void hildon_app_apply_client_list(HildonApp *self)
-{
-  HildonAppPrivate *priv;
-  Window *win_array;
-  GSList *list_ptr;
-  int loopctr = 0;
-  Atom clientlist;
-
-  g_assert (HILDON_IS_APP (self) );
-  g_assert(GTK_WIDGET_REALIZED(self));
-
-  /* Get the client list handle */
-  clientlist = XInternAtom (GDK_DISPLAY(),
-    "_NET_CLIENT_LIST", False);
-
-  /* Allocate a new array for window IDs */
-  priv = HILDON_APP_GET_PRIVATE(self);
-  win_array = g_new(Window, g_slist_length(priv->view_ids));
-  
-  /* Fill the contents of the window array with current view IDs */
-  for (list_ptr = priv->view_ids; list_ptr; list_ptr = list_ptr->next)
-  {
-      win_array[loopctr] = 
-       (unsigned long)(((view_item *)(list_ptr->data))->view_id);
-      loopctr++;
-  }
-
-  /* Update the details of current view IDs to our X property */
-  XChangeProperty(GDK_DISPLAY(), GDK_WINDOW_XID(GTK_WIDGET(self)->window),
-                 clientlist, XA_WINDOW, 32, PropModeReplace,
-                 (unsigned char *)win_array,
-                 g_slist_length(priv->view_ids));
-
-  XFlush(GDK_DISPLAY());
-  g_free(win_array);
-}
-
-/*
- * Performs the standard gtk realize function.
- */
-static void hildon_app_realize(GtkWidget *widget)
-{
-    HildonApp *self;
-    HildonAppPrivate *priv;
-    GdkWindow *window;
-    Atom *old_atoms, *new_atoms;
-    gint atom_count;
-    Display *disp;
-
-    g_assert(widget != NULL);
-
-    self = HILDON_APP(widget);
-    priv = HILDON_APP_GET_PRIVATE(self);
-
-    /*
-     * Of course we need to realize the parent.
-     * parent_class got already initialised in the hildon_app_init function
-     */
-    GTK_WIDGET_CLASS(parent_class)->realize(widget);
-
-    /* some initialisation code */
-    hildon_app_apply_killable(self); 
-    hildon_app_construct_title(self);
-    hildon_app_apply_client_list(self);
-    hildon_app_notify_view_changed(self, hildon_app_get_appview(self));
-    window = widget->window;
-    disp = GDK_WINDOW_XDISPLAY(window);
-
-    /* Install a key snooper for the Home button - so that it works everywhere */
-    priv->key_snooper = gtk_key_snooper_install 
-        ((GtkKeySnoopFunc) hildon_app_key_snooper, widget);
-
-    /* Get the list of Atoms for the WM_PROTOCOLS property... */
-    XGetWMProtocols(disp, GDK_WINDOW_XID(window), &old_atoms, &atom_count);
-    new_atoms = g_new(Atom, atom_count + 1);
-
-    memcpy(new_atoms, old_atoms, sizeof(Atom) * atom_count);
-
-    /* ... creates a new Atom... */
-    new_atoms[atom_count++] =
-        XInternAtom(disp, "_NET_WM_CONTEXT_CUSTOM", False);
-
-    /* ... and finally update the property within the XServer */
-    XSetWMProtocols(disp, GDK_WINDOW_XID(window), new_atoms, atom_count);
-
-    XFree(old_atoms);
-    g_free(new_atoms);
-
-    /* Add the GDK_SUBSTRUCTURE_MASK (receive events about window configuration
-     * changes of child windows) to the window.
-     */
-    gdk_window_set_events(window, gdk_window_get_events(window) | GDK_SUBSTRUCTURE_MASK);
-}
-
-/*
- * Performs the standard gtk unrealize function.
- */
-static void hildon_app_unrealize(GtkWidget *widget)
-{
-  HildonAppPrivate *priv = HILDON_APP_GET_PRIVATE(widget);
-
-  if (priv->key_snooper)
-  {
-    /* removing the snooper that handles MENU key presses */
-    gtk_key_snooper_remove(priv->key_snooper);
-    priv->key_snooper = 0;
-  }
-
-  gdk_window_remove_filter(NULL, hildon_app_event_filter, widget);
-  GTK_WIDGET_CLASS(parent_class)->unrealize(widget);
-}
-
-/*
- * Class initialisation.
- */
-static void hildon_app_class_init (HildonAppClass *app_class)
-{
-    /* get convenience variables */
-    GObjectClass *object_class = G_OBJECT_CLASS(app_class);
-    GtkContainerClass *container_class = GTK_CONTAINER_CLASS (app_class);
-    GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS(app_class);
-    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(app_class);
-
-    /* set the global parent_class here */
-    parent_class = g_type_class_peek_parent(app_class);
-
-    g_type_class_add_private(app_class, sizeof(HildonAppPrivate));
-
-    /* now the object stuff */
-    object_class->finalize = hildon_app_finalize;
-    object_class->set_property = hildon_app_set_property;
-    object_class->get_property = hildon_app_get_property;
-
-    gtkobject_class->destroy = hildon_app_destroy;
-
-    widget_class->key_press_event = hildon_app_key_press;
-    widget_class->key_release_event = hildon_app_key_release;
-    widget_class->button_press_event = hildon_app_button;
-    widget_class->button_release_event = hildon_app_button;
-    widget_class->realize = hildon_app_realize;
-    widget_class->unrealize = hildon_app_unrealize;
-
-    container_class->add = hildon_app_add;
-    container_class->remove = hildon_app_remove;
-    container_class->forall = hildon_app_forall;
-
-    app_class->topmost_status_acquire =
-        hildon_app_real_topmost_status_acquire;
-    app_class->topmost_status_lose = hildon_app_real_topmost_status_lose;
-    app_class->switch_to = hildon_app_real_switch_to;
-
-    /* create the signals */
-    app_signals[TOPMOST_STATUS_ACQUIRE] =
-        g_signal_new("topmost_status_acquire",
-                     G_OBJECT_CLASS_TYPE(object_class),
-                     G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(HildonAppClass,
-                                     topmost_status_acquire), NULL, NULL,
-                     g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
-    app_signals[TOPMOST_STATUS_LOSE] =
-        g_signal_new("topmost_status_lose",
-                     G_OBJECT_CLASS_TYPE(object_class),
-                     G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(HildonAppClass, topmost_status_lose),
-                     NULL, NULL,
-                     g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
-    app_signals[SWITCH_TO] =
-      g_signal_new("switch_to",
-                  G_OBJECT_CLASS_TYPE(object_class),
-                  G_SIGNAL_RUN_FIRST,
-                  G_STRUCT_OFFSET(HildonAppClass, switch_to),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-                  
-    app_signals[IM_CLOSE] =
-      g_signal_new("im_close",
-                  G_OBJECT_CLASS_TYPE(object_class),
-                  G_SIGNAL_RUN_FIRST,
-                  G_STRUCT_OFFSET(HildonAppClass, im_close),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
-    app_signals[CLIPBOARD_COPY] =
-      g_signal_new("clipboard_copy",
-                  G_OBJECT_CLASS_TYPE(object_class),
-                  G_SIGNAL_RUN_FIRST,
-                  G_STRUCT_OFFSET(HildonAppClass, clipboard_copy),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
-                  GTK_TYPE_WIDGET);
-    app_signals[CLIPBOARD_CUT] =
-      g_signal_new("clipboard_cut",
-                  G_OBJECT_CLASS_TYPE(object_class),
-                  G_SIGNAL_RUN_FIRST,
-                  G_STRUCT_OFFSET(HildonAppClass, clipboard_cut),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
-                  GTK_TYPE_WIDGET);
-    app_signals[CLIPBOARD_PASTE] =
-      g_signal_new("clipboard_paste",
-                  G_OBJECT_CLASS_TYPE(object_class),
-                  G_SIGNAL_RUN_FIRST,
-                  G_STRUCT_OFFSET(HildonAppClass, clipboard_paste),
-                  NULL, NULL,
-                  g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
-                  GTK_TYPE_WIDGET);
-
-    /* properties */
-    g_object_class_install_property(object_class, PROP_SCROLL_CONTROL,
-        g_param_spec_boolean("scroll-control",
-                            "Scroll control",
-                            "Set the scroll control ON/OFF",
-                            TRUE, G_PARAM_READWRITE));
-
-    g_object_class_install_property(object_class, PROP_TWO_PART_TITLE,
-                                   g_param_spec_boolean("two-part-title",
-                                                        "Two part title",
-                                                        "Use two part title or not",
-                                                        FALSE, G_PARAM_READWRITE));
-#ifndef HILDON_DISABLE_DEPRECATED
-    g_object_class_install_property(object_class, PROP_ZOOM,
-                                   g_param_spec_enum ("zoom",
-                                                      "Zoom level",
-                                                      "Set the zoom level",
-                                                      HILDON_TYPE_ZOOM_LEVEL,
-                                                      HILDON_ZOOM_MEDIUM,
-                                                      G_PARAM_READWRITE));
-#endif
-    g_object_class_install_property(object_class, PROP_APP_TITLE,
-                                   g_param_spec_string ("app-title",
-                                                        "Application title",
-                                                        "Set the application title",
-                                                        "",
-                                                        G_PARAM_READWRITE));
-
-    g_object_class_install_property(object_class, PROP_KILLABLE,
-                                   g_param_spec_boolean("killable",
-                                                        "Killable",
-                                                        "Whether the application is killable or not",
-                                                        FALSE,
-                                                        G_PARAM_READWRITE));
-    g_object_class_install_property(object_class, PROP_AUTOREGISTRATION,
-                                   g_param_spec_boolean("autoregistration",
-                                                        "Autoregistration",
-                                                        "Whether the application views should be registered automatically",
-                                                        TRUE,
-                                                        G_PARAM_READWRITE));
-    g_object_class_install_property(object_class, PROP_APPVIEW,
-                                   g_param_spec_object("appview",
-                                                        "Appplication View",
-                                                        "The currently active application view",
-                                                        HILDON_TYPE_APPVIEW,
-                                                        G_PARAM_READWRITE));
-    g_object_class_install_property(object_class, PROP_UI_MANAGER,
-                                   g_param_spec_object("ui-manager",
-                                                        "UIManager",
-                                                        "The associated GtkUIManager for this app",
-                                                        GTK_TYPE_UI_MANAGER,
-                                                        G_PARAM_READWRITE));
-}
-
-/*
- * Performs the standard gtk finalize function, freeing allocated
- * memory and propagating the finalization to the parent.
- */
-static void
-hildon_app_finalize (GObject *obj)
-{
-  HildonAppPrivate *priv = NULL;
-  
-  g_assert (obj != NULL);
-
-  priv = HILDON_APP_GET_PRIVATE (obj);
-
-  g_free (priv->title);
-
-  if (G_OBJECT_CLASS(parent_class)->finalize)
-    G_OBJECT_CLASS(parent_class)->finalize(obj);
-
-  /* FIXME: This is legacy code, but cannot be removed 
-     without changing functionality */
-  gtk_main_quit ();
-}
-
-/*
- * Removes the long escape ("cancel" hw key) press timeout.
- */
-static void
-hildon_app_remove_timeout(HildonAppPrivate *priv)
-{
-  g_assert(priv != NULL);
-
-  if (priv->escape_timeout > 0)
-    {
-      g_source_remove (priv->escape_timeout);
-      priv->escape_timeout = 0;
-    }
-}
-
-/*
- * Frees all the resources and propagates the destroy call to the parent.
- */
-static void
-hildon_app_destroy (GtkObject *obj)
-{
-  HildonAppPrivate *priv = NULL;
-
-  g_assert (obj != NULL);
-  
-  priv = HILDON_APP_GET_PRIVATE (obj);
-
-  /* Just in case a GDK_Escape key was pressed shortly before the propagation
-   * of this event, it is safer to remove the timeout that will generate a
-   * GDK_DELETE key press. We are destroying the app, so we're not interested
-   * anymore in processing key presses.
-   */
-  hildon_app_remove_timeout(priv);
-
-  if (priv->uim != NULL)
-    {
-      g_object_unref (G_OBJECT (priv->uim));
-      priv->uim = NULL;
-    }
-
-  /* Free all the views */
-  if (priv->view_ids)
-    {
-      g_slist_foreach (priv->view_ids, (GFunc)g_free, NULL);
-      g_slist_free (priv->view_ids);
-      priv->view_ids = NULL;
-    }
-
-  if (GTK_OBJECT_CLASS (parent_class)->destroy)
-    GTK_OBJECT_CLASS (parent_class)->destroy(obj);
-}
-
-/*
- * Overrides gtk_container_forall, calling the callback function for each of
- * the children of HildonAppPrivate.
- */
-static void hildon_app_forall (GtkContainer *container, gboolean include_internals,
-                              GtkCallback callback, gpointer callback_data)
-{
-  HildonAppPrivate *priv = NULL;
-
-  g_return_if_fail (container != NULL);
-  g_return_if_fail (callback != NULL);
-
-  priv = HILDON_APP_GET_PRIVATE (container);
-
-  /* Note! we only have user added children, no internals */
-  g_list_foreach (priv->children, (GFunc)callback, callback_data);
-}
-
-/*
- * An accessor to set private properties of HildonAppPrivate.
- */
-static void hildon_app_set_property(GObject * object, guint property_id,
-                                    const GValue * value, GParamSpec * pspec)
-{
-    HildonAppPrivate *priv = HILDON_APP_GET_PRIVATE(object);
-
-    switch (property_id) {
-    case PROP_SCROLL_CONTROL:
-        priv->scroll_control = g_value_get_boolean(value);
-        break;
-#ifndef HILDON_DISABLE_DEPRECATED
-    case PROP_ZOOM:
-        hildon_app_set_zoom( HILDON_APP (object), g_value_get_enum (value) );
-        break; 
-#endif
-    case PROP_TWO_PART_TITLE:
-       hildon_app_set_two_part_title( HILDON_APP (object), 
-                                      g_value_get_boolean (value) );
-       break;
-     case PROP_APP_TITLE:
-       hildon_app_set_title( HILDON_APP (object), g_value_get_string (value));
-       break;
-    case PROP_KILLABLE:
-        hildon_app_set_killable( HILDON_APP (object), 
-                              g_value_get_boolean (value));
-       break;
-    case PROP_AUTOREGISTRATION:
-        hildon_app_set_autoregistration( HILDON_APP (object), 
-                              g_value_get_boolean (value));
-       break;
-    case PROP_APPVIEW:
-        hildon_app_set_appview( HILDON_APP (object), 
-                              HILDON_APPVIEW (g_value_get_object (value)));
-       break;
-    case PROP_UI_MANAGER:
-        hildon_app_set_ui_manager( HILDON_APP (object), 
-                                 GTK_UI_MANAGER (g_value_get_object (value)));
-       break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
-        break;
-    }
-}
-
-/*
- * An accessor to get private properties of HildonAppPrivate.
- */
-static void hildon_app_get_property(GObject * object, guint property_id,
-                                    GValue * value, GParamSpec * pspec)
-{
-    HildonAppPrivate *priv = HILDON_APP_GET_PRIVATE(object);
-
-    switch (property_id) {
-    case PROP_SCROLL_CONTROL:
-        g_value_set_boolean( value, priv->scroll_control );
-        break;
-#ifndef HILDON_DISABLE_DEPRECATED
-    case PROP_ZOOM:
-       g_value_set_enum( value, priv->zoom);
-       break;
-#endif
-    case PROP_TWO_PART_TITLE:
-       g_value_set_boolean( value, priv->twoparttitle);
-       break;
-    case PROP_APP_TITLE:
-       g_value_set_string (value, priv->title);
-       break;
-    case PROP_KILLABLE:
-       g_value_set_boolean (value, priv->killable);
-       break;
-    case PROP_AUTOREGISTRATION:
-       g_value_set_boolean (value, priv->autoregistration);
-       break;
-    case PROP_APPVIEW:
-       g_value_set_object (value, hildon_app_get_appview (HILDON_APP (object)));
-       break;
-    case PROP_UI_MANAGER:
-       g_value_set_object (value, hildon_app_get_ui_manager (HILDON_APP (object)));
-       break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
-        break;
-    }
-}
-
-/*
- * Adds a child widget to HildonApp.
- */
-static void hildon_app_add (GtkContainer *container, GtkWidget *child)
-{
-  HildonApp        *app  = NULL;
-  HildonAppPrivate *priv = NULL;
-  
-  g_return_if_fail (container != NULL);
-  g_return_if_fail (GTK_IS_WIDGET (child));
-
-  app  = HILDON_APP (container);
-  priv = HILDON_APP_GET_PRIVATE (app);
-
-  /* Check if child is already added here */
-  if (g_list_find (priv->children, child) != NULL)
-    return;
-
-  priv->children = g_list_append (priv->children, child);
-  GTK_BIN (container)->child = child;
-  gtk_widget_set_parent (child, GTK_WIDGET (app));
-
-  /* If the default direction (RTL/LTR) is different from the real
-   default, change it This happens if the locale has been changed
-   but this appview was orphaned and thus never got to know about
-   it. "default_direction" could be RTL, but the widget direction
-   of the view might still be LTR. Thats what we're fixing here. */
-
-  /* FIXME: This is legacy stuff */
-  if (gtk_widget_get_default_direction () !=
-      gtk_widget_get_direction (GTK_WIDGET (child)))
-    {
-        gtk_widget_set_direction (GTK_WIDGET (child),
-                             gtk_widget_get_default_direction ());
-    }
-
-  if (HILDON_IS_APPVIEW (child))
-    {
-      g_signal_connect_swapped (G_OBJECT (child), "title_change",
-                                G_CALLBACK (hildon_app_construct_title), app);
-      if (priv->autoregistration)
-        hildon_app_register_view (app, child);
-    }
-}
-
-/*
- * Removes a child widget from HildonApp.
- */
-static void hildon_app_remove (GtkContainer *container, GtkWidget *child)
-{
-  HildonAppPrivate *priv;
-  GtkBin *bin;
-  HildonApp *app;
-
-  g_return_if_fail (container != NULL);
-  g_return_if_fail (GTK_IS_WIDGET (child));
-
-  priv = HILDON_APP_GET_PRIVATE (container);
-  bin = GTK_BIN (container);
-  app = HILDON_APP (bin);
-
-  /* Make sure that child is found in the list */
-  if (g_list_find (priv->children, child) == NULL)
-    return;
-
-  priv->children = g_list_remove (priv->children, child);
-
-  if (HILDON_IS_APPVIEW (child))
-    {
-  /* FIXME: This is a compilation workaround for gcc > 3.3, since glib-2 API is buggy.
-   * see http://bugzilla.gnome.org/show_bug.cgi?id=310175 */
-
-G_GNUC_EXTENSION
-
-      g_signal_handlers_disconnect_by_func (G_OBJECT (child),
-                                            (gpointer)hildon_app_construct_title, app);
-
-      if (priv->autoregistration)
-        hildon_app_unregister_view (app, HILDON_APPVIEW (child));
-    }
-
-  /* If that was our visible child, we need to recalculate size.
-     We could chain up to parent as well... */
-  gtk_widget_unparent (child);
-
-  if (bin->child == child)
-    {
-      bin->child = NULL;
-      gtk_widget_queue_resize (GTK_WIDGET (bin));
-    }
-}
-
-
-/*
- * Long escape keypress handler.
- * Long press of the escape key means "close this window", so we fake a delete-event
- * for our GdkWindow to make it act the same as if the user had closed the window the
- * usual way. This allows any application code to gracefully exit.
- *
- * It returns FALSE in order to get called only once.
- */
-static gboolean
-hildon_app_escape_timeout(gpointer app)
-{
-       HildonAppPrivate *priv;
-       GdkEvent *event;
-
-       GDK_THREADS_ENTER ();
-
-       g_assert(GTK_WIDGET_REALIZED(app));
-
-       priv = HILDON_APP_GET_PRIVATE(app);
-
-  /* Send fake event, simulation a situation that user 
-     pressed 'x' from the corner */
-  event = gdk_event_new(GDK_DELETE);
-  ((GdkEventAny *)event)->window = GTK_WIDGET(app)->window;
-  gtk_main_do_event(event);
-  gdk_event_free(event);
-
-       priv->escape_timeout = 0;
-
-       GDK_THREADS_LEAVE ();
-       
-       return FALSE;   
-}
-
-/*
- * Looks for the visible window to whom the point of coordinates (co,by)
- * belongs. Search recursively all the children of the window.
- *
- * This functionality is only needed for scrollbar remote control.
- */
-static GdkWindow *find_window (GdkWindow *window, gint by, gint co)
-{
-  GdkWindow *child;
-  GList *children = gdk_window_peek_children (window);
-
-       /* If the window has no children, then the coordinates must match it */
-  if (!children)
-    return window;
-
-  if (!(child = (GdkWindow *)children->data))
-    return window;
-
-  do
-    {
-      /* It makes sense to process a child window only if it's visible and it's
-       * capable to get the GDK_BUTTON_PRESS_MASK event. */
-      if (gdk_window_is_visible (child) &&
-         gdk_window_get_events (child) & GDK_BUTTON_PRESS_MASK)
-       {
-         gint x, width, y, height;
-
-         gdk_window_get_geometry (child, &x, &y, &width, &height, NULL);
-      /* This checks that the the point of coordinates (co,by) is in the rectangle
-       * made by (x,y,x+width,y+height). If so, then we spotted which child of the
-       * original window is in the point (co,by). We can now recursively search
-       * its own children.
-       */
-         if (x < co && x + width > co && y < by && y + height > by)
-           return find_window (child, by, co);
-       }
-
-      /* If the window has no more children, then it's the one we're looking for */ 
-      if (!(children = g_list_next (children)))
-        return window;
-
-    } while ( (child = children->data));
-
-  return NULL;
-}
-
-/*
- * This is the callback function that gets called on a mouse button press
- * event. If the press is happens in a "sensitive border" area in the right side of
- * the window, the event is translated to the left edge of that border (which
- * usually will contain a scrollbar).
- *
- * This functionality is used for right-hand side scroll control feature (dragging on the
- * right edge of the window controls the rightmost scrollbar if present).
- */
-static gboolean
-hildon_app_button (GtkWidget *widget, GdkEventButton *event)
-{
-    HildonAppPrivate *priv = NULL;
-
-    /* FIXME: This is an estimate, but the AppView does not expose the
-    width of it's borders so we default to something */
-    gint sensitive_border = 31;
-
-    if (!GTK_WIDGET_REALIZED(widget))
-    {
-        return FALSE;
-    }
-    
-    priv = HILDON_APP_GET_PRIVATE (widget);
-
-    if (!priv->scroll_control)
-    {
-        return FALSE;
-    }
-    
-    /* We can easily get the location of the vertical scrollbar and get the exact
-    * area for the scroll_control *if* the setup is such that the HildonAppview
-    * contains a GtkScrolledWindow, so we check for it before defaulting to
-    * the previous guess. More complex situations are not feasible to autodetect.
-    * Applications should provide the GtkAdjustment to be changed for this to work
-    * flawlessly.
-    */
-    if (HILDON_IS_APPVIEW(GTK_BIN(widget)->child))
-    {
-        GtkBin *avbin = GTK_BIN(GTK_BIN(widget)->child);
-        if (GTK_IS_SCROLLED_WINDOW(avbin->child))
-        {
-            GtkScrolledWindow *win;
-            win = GTK_SCROLLED_WINDOW(avbin->child);
-            
-            if (GTK_WIDGET_VISIBLE(win->vscrollbar))
-            {
-                /* Calculate the distance between the AppView's right border and
-                 * the scrollbars center
-                 */
-                sensitive_border = (GTK_WIDGET(avbin)->allocation.x +
-                                                GTK_WIDGET(avbin)->allocation.width) -
-                                                (win->vscrollbar->allocation.x +
-                                                 win->vscrollbar->allocation.width / 2);
-            }
-        }
-    }
-
-    /* If the press event comes to the sensitive area, we send a fake event to the
-     * area we think the scrollbar is in to make it think the button press happened on it
-     */
-    if (event->x > widget->allocation.width - sensitive_border)
-    {
-        GdkWindow *window = NULL;
-        gint co = widget->allocation.width - sensitive_border;
-
-        /* We now need to know in which window the _modified_ coordinates are */
-        if ((window = find_window (widget->window, event->y, co)))
-        {
-            GdkEventButton nevent;
-
-            if (window == widget->window)
-                return FALSE;
-
-            /* Build a new event and associate the proper window to it */
-            nevent = *event;
-            nevent.x = 8;
-            nevent.window = window;
-            g_object_ref (nevent.window);
-            gtk_main_do_event ((GdkEvent*)&nevent);
-        }
-    }
-    return FALSE;
-}
-
-/*
- * Performs the initialisation of the widget.
- */
-static void
-hildon_app_init (HildonApp *self)
-{
-    HildonAppPrivate *priv;
-
-    priv = HILDON_APP_GET_PRIVATE(self);
-
-    /* init private */
-    priv->title = g_strdup("");
-#ifndef HILDON_DISABLE_DEPRECATED
-    priv->zoom = HILDON_ZOOM_MEDIUM;
-#endif
-    priv->twoparttitle = FALSE;
-    priv->lastmenuclick = 0;
-    priv->is_topmost = FALSE;
-    priv->curr_view_id = 0;
-    priv->view_id_counter = 1;
-    priv->view_ids = NULL;
-    priv->killable = FALSE;
-    priv->autoregistration = TRUE;
-    priv->scroll_control = TRUE;
-    priv->uim = NULL;
-    priv->active_menu_id = 0;
-
-    /* grab the events here since HildonApp isn't necessarily ever shown */
-    gdk_window_set_events(gdk_get_default_root_window(),
-                          gdk_window_get_events(gdk_get_default_root_window()) |
-                          GDK_PROPERTY_CHANGE_MASK);
-
-    /* For some reason, the titlebar menu has problems with the grab
-       (bugzilla bug 1527). This is part of somewhat ugly fix for it to
-       get it to work until a more satisfactory solution is found */
-    gdk_window_add_filter(NULL, hildon_app_event_filter, self);
-
-    gtk_widget_set_events (GTK_WIDGET(self), GDK_BUTTON_PRESS_MASK |
-                           GDK_BUTTON_RELEASE_MASK |
-                           GDK_POINTER_MOTION_MASK);
-}
-
-/*public functions */
-
-/**
- * hildon_app_new:
- *
- * Creates a new #HildonApp
- *
- * Returns: pointer to a new #HildonApp structure
- */
-GtkWidget *
-hildon_app_new (void)
-{
-    return GTK_WIDGET(g_object_new(HILDON_TYPE_APP, NULL));
-}
-
-/**
- * hildon_app_new_with_appview:
- * @appview : a #HildonAppView
- * 
- * Creates an app, and sets it's initial appview.
- * 
- * Returns: pointer to a new #HildonApp structure
- */
-GtkWidget *
-hildon_app_new_with_appview (HildonAppView *appview)
-{
-    GtkWidget *app;
-
-    g_return_val_if_fail (HILDON_IS_APPVIEW (appview), NULL);
-
-    app = hildon_app_new ();
-
-    hildon_app_set_appview(HILDON_APP(app), appview);
-    
-    return app;
-}
-
-/**
- * hildon_app_get_appview:
- * @self : a #HildonApp
- *
- * Gets the currently shown appview.
- * 
- * Returns: the currently shown appview in this HildonApp.
- *          If no appview is currently set for this HildonApp,
- *          returns NULL.
- */
-HildonAppView *
-hildon_app_get_appview (HildonApp *self)
-{
-  GtkBin *bin;
-
-  g_return_val_if_fail (HILDON_IS_APP (self), NULL);
-  bin = GTK_BIN (self);
-  if (HILDON_IS_APPVIEW (bin->child))
-    {
-      return HILDON_APPVIEW (bin->child);
-    }
-  
-  return NULL;
-}
-
-/**
- * hildon_app_set_appview:
- * @self : a #HildonApp
- * @appview : a #HildonAppView
- * 
- * Sets (switches to) appview.
- */
-void
-hildon_app_set_appview (HildonApp *app, HildonAppView *view)
-{
-  HildonAppPrivate *priv;
-  GtkBin *bin;
-  GtkWidget *widget; /*(view to be set)*/
-  gchar *menu_ui;
-
-  g_return_if_fail (HILDON_IS_APP (app));
-  g_return_if_fail (HILDON_IS_APPVIEW (view));
-
-  bin = GTK_BIN (app);
-  priv = HILDON_APP_GET_PRIVATE (app);
-  widget = GTK_WIDGET (view);
-
-  if (widget == bin->child)
-    return;
-
-  /* Make old appview dissapear */
-  if (bin->child)
-    {
-      gtk_widget_hide (bin->child);
-      g_signal_emit_by_name (bin->child, "switched_from", NULL);
-      
-      if (priv->active_menu_id > 0)
-      {
-        if (priv->uim != NULL)
-          {
-            gtk_ui_manager_remove_ui (priv->uim,
-                                      priv->active_menu_id);
-          }
-        priv->active_menu_id = 0;
-      }
-      
-      bin->child = NULL;
-    }
-
-  /* Ensure that new view is in our child list */
-  if (!g_list_find (priv->children, widget))
-    gtk_container_add (GTK_CONTAINER (app), widget);
-
-  bin->child = widget;
-
-  gtk_widget_show (widget);
-
-  /* UI manager support, merge menu for activated view */
-  g_object_get (G_OBJECT (view),
-                "menu-ui", &menu_ui,
-                NULL);
-
-  if (menu_ui && priv->uim)
-    {
-     
-      priv->active_menu_id =
-        gtk_ui_manager_add_ui_from_string (priv->uim, menu_ui, -1, NULL);
-      
-      gtk_ui_manager_ensure_update (priv->uim);
-
-    }
-
-  g_free (menu_ui);
-
-  g_signal_emit_by_name (widget, "switched_to", NULL);
-
-  /* Inform task navigator about changed view */
-  hildon_app_notify_view_changed (app, view);
-
-  /* Update title to show currently activated view */
-  hildon_app_construct_title (app);
-  gtk_widget_child_focus (widget, GTK_DIR_TAB_FORWARD);
-}
-
-/**
- * hildon_app_set_title:
- * @self : a #HildonApp
- * @newtitle : the new title assigned to the application
- *
- * Sets title of the application.
- */
-void
-hildon_app_set_title (HildonApp *self, const gchar *newtitle)
-{
-    HildonAppPrivate *priv;
-    gchar *oldstr;
-
-    g_return_if_fail(HILDON_IS_APP(self));
-
-    priv = HILDON_APP_GET_PRIVATE(self);
-    oldstr = priv->title;
-
-    if (newtitle)
-      {
-        priv->title = g_strdup(newtitle);
-        g_strstrip(priv->title);
-      }
-    else
-        priv->title = g_strdup("");
-
-    if (oldstr)
-        g_free(oldstr);
-
-    hildon_app_construct_title(self);
-}
-
-/**
- * hildon_app_get_title:
- * @self : a #HildonApp
- *
- * Gets the title of the application.
- *
- * Returns: the title currently assigned to the application. This
- *  value is not to be freed or modified by the calling application
- */
-const gchar *
-hildon_app_get_title (HildonApp *self)
-{
-    HildonAppPrivate *priv;
-
-    g_return_val_if_fail (HILDON_IS_APP(self), NULL);
-    priv = HILDON_APP_GET_PRIVATE(self);
-    return priv->title;
-}
-
-/* FIXME: Zoom is deprecated, remove */
-/**
- * hildon_app_set_zoom:
- * @self : a #HildonApp
- * @newzoom: the zoom level of type #HildonZoomLevel to be assigned to an
- *  application
- *
- * Sets the zoom level. Warning! This function is deprecated and
- * should not be used. It's lecacy stuff from ancient specs.
- */
-void
-hildon_app_set_zoom (HildonApp *self, HildonZoomLevel newzoom)
-{
-    HildonAppPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_APP(self));
-
-    priv = HILDON_APP_GET_PRIVATE(self);
-
-    if (newzoom != priv->zoom)
-      {
-        if (newzoom < HILDON_ZOOM_SMALL)
-          {
-            newzoom = HILDON_ZOOM_SMALL;
-            gtk_infoprint(GTK_WINDOW(self), _("ckct_ib_min_zoom_level_reached"));
-          }
-        else if (newzoom > HILDON_ZOOM_LARGE) {
-            newzoom = HILDON_ZOOM_LARGE;
-            gtk_infoprint(GTK_WINDOW(self), _("ckct_ib_max_zoom_level_reached"));
-          }
-        priv->zoom = newzoom;
-      }
-}
-
-/**
- * hildon_app_get_zoom:
- * @self : a #HildonApp
- *
- * Gets the zoom level. Warning! This function is deprecated and
- * should not be used. It's lecacy stuff from ancient specifications.
- *
- * Returns: the zoom level of the Hildon application. The
- *  returned zoom level is of type #HildonZoomLevel.
- */
-HildonZoomLevel
-hildon_app_get_zoom (HildonApp *self)
-{
-    HildonAppPrivate *priv;
-
-    g_return_val_if_fail(HILDON_IS_APP(self), HILDON_ZOOM_MEDIUM);
-    priv = HILDON_APP_GET_PRIVATE(self);
-    return priv->zoom;
-}
-
-/**
- * hildon_app_get_default_font:
- * @self : a #HildonApp
- *
- * Gets default font. Warning! This function is deprecated and should
- * not be used. It's legacy stuff from ancient version of specification.
- *
- * Returns: pointer to PangoFontDescription for the default,
- *  normal size font
- */
-PangoFontDescription *
-hildon_app_get_default_font (HildonApp *self)
-{
-    PangoFontDescription *font_desc = NULL;
-    GtkStyle *fontstyle = NULL;
-
-    g_return_val_if_fail(HILDON_IS_APP(self), NULL);
-
-    fontstyle =
-        gtk_rc_get_style_by_paths (gtk_widget_get_settings
-                                  (GTK_WIDGET(self)), NULL, NULL,
-                                   gtk_widget_get_type());
-
-    if (!fontstyle)
-      {
-        g_print("WARNING : default font not found. "
-                "Defaulting to swissa 19\n");
-        font_desc = pango_font_description_from_string("swissa 19");
-
-      }
-    else
-        font_desc = pango_font_description_copy(fontstyle->font_desc);
-
-    return font_desc;
-}
-
-/**
- * hildon_app_get_zoom_font:
- * @self : a #HildonApp
- *
- * Gets the description of the default font. Warning! This function
- * is deprecated and should not be used. It's legacy stuff from
- * ancient specs.
- * 
- * Returns: pointer to PangoFontDescription for the default,
- *  normal size font
- */
-PangoFontDescription *
-hildon_app_get_zoom_font (HildonApp *self)
-{
-    HildonAppPrivate *priv;
-    PangoFontDescription *font_desc = NULL;
-    gchar *style_name = 0;
-    GtkStyle *fontstyle = NULL;
-
-    g_return_val_if_fail(HILDON_IS_APP(self), NULL);
-
-    priv = HILDON_APP_GET_PRIVATE(self);
-    if (priv->zoom == HILDON_ZOOM_SMALL)
-        style_name = g_strdup("hildon-zoom-small");
-    else if (priv->zoom == HILDON_ZOOM_MEDIUM)
-        style_name = g_strdup("hildon-zoom-medium");
-    else if (priv->zoom == HILDON_ZOOM_LARGE)
-        style_name = g_strdup("hildon-zoom-large");
-    else
-      {
-        g_warning("Invalid Zoom Value\n");
-        style_name = g_strdup("");
-      }
-
-    fontstyle =
-        gtk_rc_get_style_by_paths (gtk_widget_get_settings
-                                  (GTK_WIDGET(self)), style_name, NULL,
-                                   G_TYPE_NONE);
-    g_free (style_name);
-
-    if (!fontstyle)
-      {
-        g_print("WARNING : theme specific zoomed font not found. "
-                "Defaulting to preset zoom-specific fonts\n");
-        if (priv->zoom == HILDON_ZOOM_SMALL)
-            font_desc = pango_font_description_from_string("swissa 16");
-        else if (priv->zoom == HILDON_ZOOM_MEDIUM)
-            font_desc = pango_font_description_from_string("swissa 19");
-        else if (priv->zoom == HILDON_ZOOM_LARGE)
-            font_desc = pango_font_description_from_string("swissa 23");
-      }
-    else
-        font_desc = pango_font_description_copy(fontstyle->font_desc);
-
-    return font_desc;
-}
-
- /*  FIXME: Zoom is deprecated, remove the code above */
-
-/**
- * hildon_app_set_two_part_title:
- * @self : a #HildonApp
- * @istwoparttitle : a gboolean indicating wheter to activate
- *  a title that has both the application title and application
- *  view title separated by a triangle
- * 
- * Sets the two part title.
- */
-void
-hildon_app_set_two_part_title (HildonApp *self, gboolean istwoparttitle)
-{
-    HildonAppPrivate *priv;
-    g_return_if_fail(HILDON_IS_APP(self));
-    priv = HILDON_APP_GET_PRIVATE(self);
-
-    if (istwoparttitle != priv->twoparttitle)
-      {
-        priv->twoparttitle = istwoparttitle;
-        hildon_app_construct_title(self);
-      }
-}
-
-/**
- * hildon_app_get_two_part_title:
- * @self : a #HildonApp
- *
- * Gets the 'twopart' represention of the title inside #HildonApp.
- * 
- * Returns: a boolean indicating wheter title shown has both
- *  application, and application view title separated by a triangle.
- */
-gboolean
-hildon_app_get_two_part_title (HildonApp *self)
-{
-    HildonAppPrivate *priv;
-
-    g_return_val_if_fail(HILDON_IS_APP(self), FALSE);
-    priv = HILDON_APP_GET_PRIVATE(self);
-    return priv->twoparttitle;
-}
-
-
-/* private functions */
-
-
-/*
- * Handles the key press of the Escape, Increase and Decrease keys. Other keys
- * are handled by the parent GtkWidgetClass.
- */
-static gboolean
-hildon_app_key_press (GtkWidget *widget, GdkEventKey *keyevent)
-{
-  HildonApp *app = HILDON_APP (widget);
-  HildonAppView *appview;
-  HildonAppPrivate *priv = HILDON_APP_GET_PRIVATE(app);
-
-  if (HILDON_IS_APPVIEW(GTK_BIN (app)->child))
-    {
-      appview = HILDON_APPVIEW (GTK_BIN (app)->child);
-    }
-  else
-    {
-      return FALSE;
-    }
-
-    if (keyevent->keyval == GDK_Escape && priv->escape_timeout == 0)
-      {
-        /* Call hildon_app_escape_timeout every 1500ms until it returns FALSE 
-         * and store the relative GSource id. Since hildon_app_escape_timeout
-         * can only return FALSE, the call will occurr only once.
-         */
-        priv->escape_timeout = g_timeout_add(1500, hildon_app_escape_timeout, app);
-      }
-
-    /* FIXME: Handling +/- keys here is not usefull. Applications
-              can equally easily handle the keypress themselves. */
-    else if (HILDON_KEYEVENT_IS_INCREASE_KEY (keyevent))
-      {
-        _hildon_appview_increase_button_state_changed (appview,
-                                                      keyevent->type);
-      }
-    else if (HILDON_KEYEVENT_IS_DECREASE_KEY (keyevent))
-      {
-        _hildon_appview_decrease_button_state_changed (appview,
-                                                       keyevent->type);
-      }
-
-    /* Activate default bindings and let the widget with focus to handle key */
-    return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, keyevent);
-}
-
-/*
- * Handles the key release event for the Escape, Toolbar and Fullscreen keys.
- */
-static gboolean
-hildon_app_key_release (GtkWidget *widget, GdkEventKey *keyevent)
-{
-  HildonApp *app = HILDON_APP (widget);
-  HildonAppView *appview;
-  HildonAppPrivate *priv = HILDON_APP_GET_PRIVATE(app);
-
-  if (HILDON_IS_APPVIEW(GTK_BIN (app)->child))
-    {
-      appview = HILDON_APPVIEW (GTK_BIN (app)->child);
-    }
-  else
-    {
-      return FALSE;
-    }
-
-    if (keyevent->keyval == GDK_Escape)
-      {
-        /*
-         * This will prevent the hildon_app_escape_timeout from being called.
-         * See hildon_app_escape_timeout and hildon_app_remove_timeout for more.
-         */
-        hildon_app_remove_timeout(priv);
-      }
-    else if (HILDON_KEYEVENT_IS_TOOLBAR_KEY (keyevent))
-      {
-        g_signal_emit_by_name(G_OBJECT(appview),
-                              "toolbar-toggle-request");
-      }
-     else if (HILDON_KEYEVENT_IS_FULLSCREEN_KEY (keyevent))
-       {
-         /* Emit the fullscreen_state_change directly, it'll save one step */
-         if (hildon_appview_get_fullscreen_key_allowed (appview))
-           {
-              gboolean fullscreen;
-              
-              fullscreen = hildon_appview_get_fullscreen(appview);
-              g_signal_emit_by_name(G_OBJECT(appview),
-                          "fullscreen_state_change",
-                          !fullscreen);
-           }
-       }
-
-    /* FIXME: Should the event be marked as handled if any of the three
-              above cases took an action */
-
-    /* Activate default bindings and let the widget with focus to handle key */
-    return GTK_WIDGET_CLASS (parent_class)->key_release_event (widget, keyevent);
-}
-
-/*
- * Handles the MENU key presses.
- */
-static gboolean
-hildon_app_key_snooper (GtkWidget *widget, GdkEventKey *keyevent, HildonApp *app)
-{
-    /* FIXME: Using normal keypress handler would be better choise. All
-              keyevents come to window anyway, so we would get the same
-              keys in that way as well, but we wouldn't need to struggle
-              with grabs (modal dialogs etc). */
-
-    /* Menu key handling is done here */
-    if ( HILDON_KEYEVENT_IS_MENU_KEY (keyevent) ) {
-           HildonAppView *appview;
-           HildonAppPrivate *priv;
-            GtkWidget *toplevel;
-            GtkWidget *focus = NULL;
-
-      /* Don't act on modal dialogs */
-      toplevel = gtk_widget_get_toplevel (widget);
-      focus = gtk_window_get_focus(GTK_WINDOW(app));
-
-      /* Don't act when comboboxes are active, if a togglebutton
-         (combobox) has the focus and it is active, we deactivate the
-         combobox and do nothing */ 
-      if (GTK_IS_TOGGLE_BUTTON (focus))
-        {
-          GtkWidget *parent = gtk_widget_get_parent (focus);
-          
-          if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (focus)) && 
-              GTK_IS_COMBO_BOX (parent)) 
-            {
-              gtk_combo_box_popdown (GTK_COMBO_BOX (parent));
-              return TRUE;
-            }
-        }
-
-      /* Don't act when a GtkWindow of a combobox is selected, this
-         can happen in some applications that change the properties of
-         the widget focus attribute, WARNING: we are using the name of
-         the hildon combobox widget to identify the window
-         (gtkcombobox.c, HILDON_COMBO_BOX_POPUP), if it changes we
-         must change this name */
-      if (GTK_IS_WINDOW (widget) && 
-          !g_ascii_strcasecmp("hildon-combobox-window", gtk_widget_get_name (widget)))
-        {
-          return TRUE;
-        }
-
-      if (GTK_IS_DIALOG (toplevel)
-          && gtk_window_get_modal (GTK_WINDOW (toplevel)))
-        {
-          return TRUE;
-        }
-                   
-           appview = HILDON_APPVIEW (GTK_BIN(app)->child);
-           priv = HILDON_APP_GET_PRIVATE(app);
-
-           if ( keyevent->type == GDK_KEY_PRESS ) {
-            /* Toggle menu on press, avoid key repeat */
-                   if ( priv->lastmenuclick == 0 ){
-                           priv->lastmenuclick = 1;
-                           if (_hildon_appview_toggle_menu(appview,
-                                           gtk_get_current_event_time()))
-                {
-                    return TRUE;
-                }
-                   }
-           } else if ( keyevent->type == GDK_KEY_RELEASE ) {
-            /* We got release, so next press is really a new press, 
-               not a repeat */
-                   if ( priv->lastmenuclick == 1 ) {
-                           priv->lastmenuclick = 0;
-                   }
-                   
-           } else {
-                   /* Unknown key event */
-                   return FALSE;
-           }
-
-            /* don't stop the key event so that it reaches GTK where it
-               closes all existing menus that might be open */
-           return FALSE;
-    }
-
-    return FALSE;
-}
-
-/*
- * Returns the message_type of the Atom registered with a certain name.
- */
-static int
-xclient_message_type_check(XClientMessageEvent *cm, const gchar *name)
-{
-  return cm->message_type == XInternAtom(GDK_DISPLAY(), name, FALSE);
-}
-
-/*
- * Returns the GtkWidget associated to a certain Window.
- */
-static GtkWidget *
-hildon_app_xwindow_lookup_widget(Window xwindow)
-{
-  GdkWindow *window;
-  gpointer widget;
-
-  window = gdk_xid_table_lookup(xwindow);
-  if (window == NULL)
-    return NULL;
-
-  gdk_window_get_user_data(window, &widget);
-  return widget;
-}
-
-/*
- * Let's search a actual main window using tranciency hints. 
- * Note that there can be several levels of menus/dialogs above
- * the actual main window.
- */
-static Window get_active_main_window(Window window)
-{
-  Window parent_window;
-  gint limit = 0;
-
-  gdk_error_trap_push ();
-
-  while (XGetTransientForHint(GDK_DISPLAY(), window, &parent_window))
-  {
-        /* The limit > TRANSIENCY_MAXITER ensures that we can't be stuck
-           here forever if we have circular transiencies for some reason.
-           Use of _MB_CURRENT_APP_WINDOW might be more elegant... */
-
-    if (!parent_window || parent_window == GDK_ROOT_WINDOW() ||
-       parent_window == window || limit > TRANSIENCY_MAXITER)
-      {
-       break;
-      }
-
-    limit++;
-    window = parent_window;
-  }
-  
-  gdk_flush ();
-
-  if (gdk_error_trap_pop ())
-    return 0;
-
-  return window;
-}
-
-/*
- * Filters every GDK event first.
- */
-static GdkFilterReturn
-hildon_app_event_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data)
-{
-    gint x,y;
-    HildonApp *app = data;
-    HildonAppPrivate *priv;
-    HildonAppView *appview = NULL;
-
-    XAnyEvent *eventti = xevent;
-
-    if (HILDON_IS_APPVIEW (GTK_BIN (app)->child))
-      {
-        appview = HILDON_APPVIEW (GTK_BIN (app)->child);
-      }
-
-    g_return_val_if_fail (app, GDK_FILTER_CONTINUE);
-    g_return_val_if_fail (HILDON_IS_APP(app), GDK_FILTER_CONTINUE);
-
-    priv = HILDON_APP_GET_PRIVATE(app);
-    if (eventti->type == ClientMessage)
-      {
-        XClientMessageEvent *cm = xevent;
-
-        /* Check if a message indicating a click on titlebar has been
-           received. Don't open it if mouse is grabbed (eg. modal dialog
-           was just opened).
-           _MB_GRAB_TRANSFER is emitted by MatchBox, and signals that a button
-           has just been released. */
-       if (xclient_message_type_check(cm, "_MB_GRAB_TRANSFER") &&
-            HILDON_IS_APPVIEW(appview) &&
-            gtk_grab_get_current() == NULL &&
-           !_hildon_appview_menu_visible(appview))
-        {
-          _hildon_appview_toggle_menu(appview, cm->data.l[0]);
-          return GDK_FILTER_REMOVE;
-        }
-        /* IM_CLOSE is input method specific hack that is really questionable */
-        else if (xclient_message_type_check(cm, "_HILDON_IM_CLOSE"))
-        {
-          g_signal_emit_by_name(app, "im_close", NULL);
-         return GDK_FILTER_REMOVE;
-        }
-        /* Task user changed the view through task navigator? */
-        else if (xclient_message_type_check(cm, "_NET_ACTIVE_WINDOW"))
-         {
-           unsigned long view_id = cm->window;
-            gpointer view_ptr = find_view(app, view_id);
-                                               
-            /* When getting a _NET_ACTIVE_WINDOW signal from the WM we need
-             * to bring the application to the front */
-            if (!priv->is_topmost)
-              g_signal_emit_by_name (G_OBJECT(app), "topmost_status_acquire");
-
-            if (HILDON_IS_APPVIEW(view_ptr))
-              /* Sets the current view to the "window" that the _NET_ACTIVE_WINDOW
-               * specified */
-              hildon_app_set_appview(app, (HILDON_APPVIEW(view_ptr)));
-            else
-              /* there was no view, so we have to switch to an actual application */
-              g_signal_emit_by_name (G_OBJECT(app), "switch_to", view_ptr);
-
-            /* FIXME: This is a hack. This was once just gtk_window_present, but
-                      was changed into this at some day!! */
-            if (GTK_WIDGET(app)->window)
-            {
-              mb_util_window_activate(GDK_DISPLAY(),
-                                      GDK_WINDOW_XID(GTK_WIDGET(app)->window));
-            }
-         }
-        /* FIXME: IM hack */
-        else if (xclient_message_type_check(cm, "_HILDON_IM_CLIPBOARD_COPY"))
-        {
-         Window xwindow = cm->data.l[0];
-         GtkWidget *widget = hildon_app_xwindow_lookup_widget(xwindow);
-
-         g_signal_emit_by_name (G_OBJECT(app), "clipboard_copy", widget);
-       }
-        /* FIXME: IM hack */
-        else if (xclient_message_type_check(cm, "_HILDON_IM_CLIPBOARD_CUT"))
-        {
-         Window xwindow = cm->data.l[0];
-         GtkWidget *widget = hildon_app_xwindow_lookup_widget(xwindow);
-
-         g_signal_emit_by_name (G_OBJECT(app), "clipboard_cut", widget);
-        }
-        /* FIXME: IM hack */
-        else if (xclient_message_type_check(cm, "_HILDON_IM_CLIPBOARD_PASTE"))
-        {
-         Window xwindow = cm->data.l[0];
-         GtkWidget *widget = hildon_app_xwindow_lookup_widget(xwindow);
-
-         g_signal_emit_by_name (G_OBJECT(app), "clipboard_paste", widget);
-        }
-      }
-    
-     if (eventti->type == ButtonPress)
-       {
-
-     /* FIXME: This is mysterious bugfix related to problems to open the
-        application menu (bugzilla N#3204) */
-        XButtonEvent *bev = (XButtonEvent *)xevent;
-
-        if (HILDON_IS_APPVIEW(appview) &&
-            _hildon_appview_menu_visible(appview) &&
-             !hildon_appview_get_fullscreen(appview))
-          {
-           x = bev->x_root;
-           y = bev->y_root;
-           if ( (x >= MENUAREA_LEFT_LIMIT) && (x <= MENUAREA_RIGHT_LIMIT) &&
-                (y >= MENUAREA_TOP_LIMIT) && (y <= MENUAREA_BOTTOM_LIMIT))
-             {
-                _hildon_appview_toggle_menu(appview, bev->time);
-               return GDK_FILTER_CONTINUE;
-             }
-         }
-       }
-    
-    /* FIXME: as above */
-    if (eventti->type == ButtonRelease)
-      {
-        if (HILDON_IS_APPVIEW(appview) &&
-            _hildon_appview_menu_visible(appview) &&
-            !hildon_appview_get_fullscreen(appview))
-          {
-           XButtonEvent *bev = (XButtonEvent *)xevent;
-           x = bev->x_root;
-           y = bev->y_root;
-           if ( (x >= MENUAREA_LEFT_LIMIT) && (x < MENUAREA_RIGHT_LIMIT) &&
-                (y >= MENUAREA_TOP_LIMIT) && (y <= MENUAREA_BOTTOM_LIMIT))
-             {
-               return GDK_FILTER_REMOVE;
-             }
-         }
-       return GDK_FILTER_CONTINUE;
-      }
-
-    /* Application stacking order changed */
-    if (eventti->type == PropertyNotify)
-      {
-        Atom active_app_atom =
-            XInternAtom (GDK_DISPLAY(), "_MB_CURRENT_APP_WINDOW", False);
-        XPropertyEvent *prop = xevent;
-
-        if ((prop->atom == active_app_atom)
-            && (prop->window == GDK_ROOT_WINDOW()))
-          {
-            Atom realtype;
-            int format;
-            int status;
-            unsigned long n;
-            unsigned long extra;
-            Window my_window;
-            union
-            {
-                Window *win;
-                unsigned char *char_pointer;
-            } win;
-
-            win.win = NULL;
-
-            status = XGetWindowProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
-                                        active_app_atom, 0L, 16L,
-                                        0, XA_WINDOW, &realtype, &format,
-                                        &n, &extra, &win.char_pointer);
-            if (!(status == Success && realtype == XA_WINDOW && format == 32
-                 && n == 1 && win.win != NULL))
-              {
-                if (win.win != NULL)
-                    XFree(win.char_pointer);
-                return GDK_FILTER_CONTINUE;
-              }
-
-            my_window = GDK_WINDOW_XID(GTK_WIDGET(app)->window);
-
-            /* Are we the topmost one? */
-            if (win.win[0] == my_window || 
-                get_active_main_window(win.win[0]) == my_window)
-              {
-                if (!priv->is_topmost)
-                    g_signal_emit_by_name (G_OBJECT(app),
-                                          "topmost_status_acquire");
-              }
-            else if (priv->is_topmost)
-            {
-              GtkWidget *focus = gtk_window_get_focus(GTK_WINDOW(app));
-
-              /* FIXME: IM hack, IM-module should do this in response to
-                        topmost_status_lose (emission hook?) */
-              if (GTK_IS_ENTRY(focus))
-                gtk_im_context_focus_out(GTK_ENTRY(focus)->im_context);
-              if (GTK_IS_TEXT_VIEW(focus))
-                gtk_im_context_focus_out(GTK_TEXT_VIEW(focus)->im_context);
-
-              g_signal_emit_by_name (app, "topmost_status_lose");
-            }
-
-            if (win.win != NULL)
-                XFree(win.char_pointer);
-          }
-      }
-
-    return GDK_FILTER_CONTINUE;
-      }
-
-/*
- * Sets the GTK Window title to the application's title, or 
- * combined appview/app title, if two part title is asked.
- */
-static void
-hildon_app_construct_title (HildonApp *self)
-{
-  g_return_if_fail (HILDON_IS_APP (self));
-
-  if (GTK_WIDGET_REALIZED(self))
-  {
-    HildonAppPrivate *priv;
-    GdkAtom subname;
-    gchar *concatenated_title = NULL;
-    HildonAppView *appview;
-
-    priv = HILDON_APP_GET_PRIVATE (self);
-    appview = hildon_app_get_appview(self);
-    
-    /* FIXME: The subname property is legacy stuff no longer supported by
-       Matchbox. However, it is still set for the convenience of
-       the Task Navigator. */
-    subname = gdk_atom_intern("_MB_WIN_SUB_NAME", FALSE);
-
-    if (!appview || !hildon_app_get_two_part_title(self) ||
-        g_utf8_strlen(hildon_appview_get_title(appview), -1) < 1 )
-      {
-        /* Set an invisible dummy value if there is no appview title */
-        gdk_property_change (GTK_WIDGET(self)->window, subname,
-                             gdk_atom_intern ("UTF8_STRING", FALSE),
-                             8, GDK_PROP_MODE_REPLACE, (guchar *) " \0", 1);
-        gtk_window_set_title (GTK_WINDOW(self), priv->title);
-      }
-    else
-      {
-        gdk_property_change (GTK_WIDGET(self)->window, subname,
-                            gdk_atom_intern ("UTF8_STRING", FALSE),
-                            8, GDK_PROP_MODE_REPLACE,
-                            (guchar *)hildon_appview_get_title(appview),
-                            strlen(hildon_appview_get_title (appview)));
-        concatenated_title = g_strjoin(TITLE_DELIMITER, priv->title,
-            hildon_appview_get_title(appview), NULL);
-        /* priv->title should always be non-null, but check anyway */
-       if (concatenated_title != NULL)
-        {
-          gtk_window_set_title (GTK_WINDOW(self), concatenated_title);
-          g_free(concatenated_title);
-        }
-      }
-  }    
-}
-
-/*
- * Callback function to the topmost_status_acquire signal emitted by
- * hildon_app_event_filter function. See it for more details.
- */
-void
-hildon_app_real_topmost_status_acquire (HildonApp *self)
-{
-  HildonAppPrivate *priv;
-  g_return_if_fail (HILDON_IS_APP (self));
-  priv = HILDON_APP_GET_PRIVATE (self);
-
-  /* FIXME: What is the logic not to update topmost status now? */
-  if (!GTK_BIN (self)->child)
-    return;
-
-  priv->is_topmost = TRUE;
-}
-
-/*
- * Callback function to the topmost_status_lose signal emitted by
- * hildon_app_event_filter function. See it for more details.
- */
-void
-hildon_app_real_topmost_status_lose (HildonApp *self)
-{
-  HildonAppPrivate *priv;
-  g_return_if_fail (HILDON_IS_APP (self));
-  priv = HILDON_APP_GET_PRIVATE (self);
-
-  /* FIXME: What is the logic not to update topmost status now? */
-  if (!GTK_BIN (self)->child)
-    return;
-
-  priv->is_topmost = FALSE;
-}
-
-void
-hildon_app_real_switch_to (HildonApp *self)
-{
-  g_return_if_fail (HILDON_IS_APP (self));
-  /* Do we have to do anything here? */
-}
-
-
-/**
- * hildon_app_set_autoregistration
- * @self : a #HildonApp
- * @auto_reg : whether the (app)view autoregistration should be active
- *
- * Controls the autoregistration/unregistration of (app)views.
- */
-
-void hildon_app_set_autoregistration(HildonApp *self, gboolean auto_reg)
-{
-  HildonAppPrivate *priv;
-  g_return_if_fail (HILDON_IS_APP (self));
-
-  priv = HILDON_APP_GET_PRIVATE (self);
-  priv->autoregistration = auto_reg;
-}
-
-
-/**
- * hildon_app_register_view:
- * @self : a #HildonApp
- * @view_ptr : pointer to the view instance to be registered
- *
- * Registers a new view. For appviews, this can be done automatically
- * if autoregistration is set.
- */
-
-void hildon_app_register_view(HildonApp *self, gpointer view_ptr)
-{
-  HildonAppPrivate *priv;
-  view_item *view_item_inst;
-
-  g_return_if_fail (HILDON_IS_APP (self) || view_ptr != NULL);
-
-  priv = HILDON_APP_GET_PRIVATE (self);  
-
-  if (hildon_app_find_view_id(self, view_ptr) == 0)
-  {
-    /* The pointer to the view was unique, so add it to the list */
-    view_item_inst = g_malloc(sizeof(view_item));
-    view_item_inst->view_id = priv->view_id_counter;
-    view_item_inst->view_ptr = view_ptr;
-
-    priv->view_id_counter++;
-
-    priv->view_ids = 
-      g_slist_append(priv->view_ids, view_item_inst);
-
-    /* Update the list of views */
-    if (GTK_WIDGET_REALIZED(self))
-      hildon_app_apply_client_list(self);
-  }
-}
-
-
-/**
- * hildon_app_register_view_with_id:
- * @self : a #HildonApp
- * @view_ptr : pointer to the view instance to be registered
- * @view_id : the ID of the view
- * 
- * Registers a new view. Allows the application to specify any ID.
- * 
- * Returns: TRUE if the view registration succeeded, FALSE otherwise.
- *          The probable cause of failure is that view with that ID
- *          already existed.
- */
-
-gboolean hildon_app_register_view_with_id(HildonApp *self,
-                                         gpointer view_ptr,
-                                         unsigned long view_id)
-{
-  view_item *view_item_inst;  
-  HildonAppPrivate *priv;
-  GSList *list_ptr = NULL;
-
-  g_return_val_if_fail (HILDON_IS_APP (self), FALSE);
-  g_return_val_if_fail (view_ptr, FALSE);
-
-  priv = HILDON_APP_GET_PRIVATE (self);
-  
-  list_ptr = priv->view_ids;
-
-  /* Check that the view is not already registered */
-  while (list_ptr)
-    {
-      if ( (gpointer)((view_item *)list_ptr->data)->view_ptr == view_ptr
-       && (unsigned long)((view_item *)list_ptr->data)->view_id == view_id)
-       {
-         return FALSE;
-       }
-      list_ptr = list_ptr->next;
-    }
-
-   /* The pointer to the view was unique, so add it to the list */
-  view_item_inst = g_malloc(sizeof(view_item));
-  view_item_inst->view_id = view_id;
-  view_item_inst->view_ptr = view_ptr;
-
-  priv->view_ids = 
-    g_slist_append(priv->view_ids, view_item_inst);
-
-  priv->view_id_counter++;
-
-  /* Finally, update the _NET_CLIENT_LIST property */
-  if (GTK_WIDGET_REALIZED(self))
-    hildon_app_apply_client_list(self);
-
-  return TRUE;
-}
-
-/**
- * hildon_app_unregister_view:
- * @self : a #HildonApp
- * @view_ptr : pointer to the view instance to be unregistered
- *
- * Unregisters a view from HildonApp. Done usually when a view is
- * destroyed. For appviews, this is can be automatically
- * if autoregistration is set.
- */
-void hildon_app_unregister_view(HildonApp *self, gpointer view_ptr)
-{
-  HildonAppPrivate *priv = NULL;
-  GSList *list_ptr = NULL;
-
-  g_return_if_fail (HILDON_IS_APP (self));
-  g_return_if_fail (view_ptr != NULL);
-  
-  priv = HILDON_APP_GET_PRIVATE (self);
-  
-  /* Search the view from the list */
-  list_ptr = priv->view_ids;
-  
-  while (list_ptr)
-    { 
-      if ( (gpointer)((view_item *)list_ptr->data)->view_ptr == view_ptr)
-             {
-            /* Found the view, kick it off */
-            g_free (list_ptr->data);
-                 priv->view_ids = g_slist_delete_link(priv->view_ids, list_ptr);
-                 break;
-              }
-      list_ptr = list_ptr->next;
-    }
-  
-  if (GTK_WIDGET_REALIZED(self))
-    hildon_app_apply_client_list(self);
-}
-
-
-/**
- * hildon_app_unregister_view_with_id:
- * @self: a #HildonApp
- * @view_id: the ID of the view that should be unregistered
- * 
- * Unregisters a view with specified ID, if it exists.
- */
-void hildon_app_unregister_view_with_id(HildonApp *self,
-                                       unsigned long view_id)
-{
-  HildonAppPrivate *priv;
-  GSList *list_ptr = NULL;
-  
-  g_return_if_fail (HILDON_IS_APP (self));
-  
-  priv = HILDON_APP_GET_PRIVATE (self);
-  
-  /* Search the view from the list */
-  list_ptr = priv->view_ids;
-  
-  while (list_ptr)
-    { 
-      if ( (unsigned long)((view_item *)list_ptr->data)->view_id == view_id)
-       {
-      /* Found view with given id, kick it off */
-         g_free (list_ptr->data);
-         priv->view_ids = g_slist_delete_link(priv->view_ids, list_ptr);
-         break;
-       }
-      list_ptr = list_ptr->next;
-    }
-
-  /* Update client list to reflect new situation. If we are not
-     realized, then nobody knows about us anyway... */
-  if (GTK_WIDGET_REALIZED(self))
-    hildon_app_apply_client_list(self);  
-}
-
-
-/**
- * hildon_app_notify_view_changed:
- * @self : a #HildonApp
- * @view_ptr : pointer to the view that is switched to
- * 
- * Updates the X property that contains the currently active view
- */
-void hildon_app_notify_view_changed(HildonApp *self, gpointer view_ptr)
-{
-  g_return_if_fail (HILDON_IS_APP (self));
-  g_return_if_fail (view_ptr != NULL);
-
-  /* We need GdkWindow before we can send X messages */ 
-  if (GTK_WIDGET_REALIZED(self))
-  {
-    gulong id = hildon_app_find_view_id(self, view_ptr);
-    Atom active_view = XInternAtom (GDK_DISPLAY(),
-                                "_NET_ACTIVE_WINDOW", False);
-
-    if (id) {
-      /* Set _NET_ACTIVE_WINDOW for our own toplevel to contain view id */
-      XChangeProperty(GDK_DISPLAY(), GDK_WINDOW_XID(GTK_WIDGET(self)->window),
-                     active_view, XA_WINDOW, 32, PropModeReplace,
-                     (unsigned char *)&id, 1);
-    XFlush(GDK_DISPLAY());
-    }
-  }
-}
-
-
-/**
- * hildon_app_find_view_id:
- * @self : a #HildonApp
- * @view_ptr : pointer to the view whose ID we want to acquire
- * 
- * Returns: the ID of the view, or 0 if not found
- *
- * Allows mapping of view pointer to its view ID. If NULL is passed
- * as the view pointer, returns the ID of the current view.
- */
-unsigned long hildon_app_find_view_id(HildonApp *self, gpointer view_ptr)
-{
-  HildonAppPrivate *priv;
-  GSList *iter;
-
-  priv = HILDON_APP_GET_PRIVATE (self);
-
-  /* If no view is given, find the ID for the currently visible view */
-  if (!view_ptr)
-    view_ptr = GTK_BIN (self)->child;
-  if (!view_ptr)
-    return 0;
-
-  /* Iterate through list and search for given view pointer */
-  for (iter = priv->view_ids; iter; iter = iter->next)
-  {
-    if ( (gpointer)((view_item *)iter->data)->view_ptr == view_ptr)
-         return (unsigned long)((view_item *)iter->data)->view_id;
-  }
-
-  return 0;
-}
-
-/**
- * hildon_app_set_killable:
- * @self : a #HildonApp
- * @killability : truth value indicating whether the app can be killed
- *                       
- * Updates information about whether the application can be killed or not by
- * Task Navigator (i.e. whether its statesave is up to date)
- */
-void hildon_app_set_killable(HildonApp *self, gboolean killability)
-{
-  HildonAppPrivate *priv = HILDON_APP_GET_PRIVATE (self);
-  g_return_if_fail (HILDON_IS_APP (self) );
-
-  if (killability != priv->killable)
-  {
-    priv->killable = killability;
-
-    /* If we have a window, then we can actually set this 
-       property. Otherwise we wait until we are realized */
-    if (GTK_WIDGET_REALIZED(self))
-      hildon_app_apply_killable(self);
-  }
-}
-
-
-/**
- * hildon_app_set_ui_manager:
- * @self : #HildonApp
- * @uim : #GtkUIManager to be set
- * 
- * Sets the #GtkUIManager assigned to the #HildonApp.
- * If @uim is NULL, unsets the current ui manager.
- * The @HildonApp holds a reference to the ui manager until
- * the @HildonApp is destroyed or unset.
- */
-void hildon_app_set_ui_manager(HildonApp *self, GtkUIManager *uim)
-{
-    HildonAppPrivate *priv;
-
-    g_return_if_fail(self && HILDON_IS_APP(self));
-    
-    priv = HILDON_APP_GET_PRIVATE (self);
-
-    /* Release old ui-manager object if such exists */    
-    if (priv->uim != NULL)
-      {
-        g_object_unref (G_OBJECT (priv->uim));
-      }
-    
-    priv->uim = uim;
-
-    /* If we got new ui-manager (it's perfectly valid not 
-       to give one), acquire reference to it */
-    if (priv->uim != NULL)
-      {
-        g_object_ref (G_OBJECT (uim));
-      }
-
-    g_object_notify (G_OBJECT(self), "ui-manager");
-}
-
-/**
- * hildon_app_get_ui_manager:
- * @self : #HildonApp
- * 
- * Gets the #GtkUIManager assigned to the #HildonApp.
- *
- * Returns: the #GtkUIManager assigned to this application
- * or null if no manager is assigned
- */
-GtkUIManager *hildon_app_get_ui_manager(HildonApp *self)
-{
-    HildonAppPrivate *priv;
-    
-    g_return_val_if_fail(self && HILDON_IS_APP(self), NULL);
-
-    priv = HILDON_APP_GET_PRIVATE (self);
-
-    return (priv->uim);
-}
-
-/*
- * Search for a view with the given id within HildonApp.
- * Returns a pointer to the found view, or NULL if not found.
- */
-static gpointer find_view(HildonApp *self, unsigned long view_id)
-{
-  HildonAppPrivate *priv;
-  GSList *iter;
-  
-  priv = HILDON_APP_GET_PRIVATE (self);
-
-  /* Iterate through the list of view ids and search given id */
-  for (iter = priv->view_ids; iter; iter = iter->next)
-  {
-    if ( (unsigned long)((view_item *)iter->data)->view_id == view_id)
-                 return (gpointer)((view_item *)iter->data)->view_ptr;
-  }
-
-  return NULL;
-}
diff --git a/src/hildon-app.h b/src/hildon-app.h
deleted file mode 100644 (file)
index bf41d04..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __HILDON_APP_H__
-#define __HILDON_APP_H__
-
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkuimanager.h>
-#include "hildon-appview.h"
-
-G_BEGIN_DECLS
-/**
- * HildonApp:
- *
- * Contains only private data not to be touched by outsiders. 
- */
-typedef struct _HildonApp HildonApp;
-typedef struct _HildonAppClass HildonAppClass;
-
-#define HILDON_TYPE_APP ( hildon_app_get_type() )
-
-#define HILDON_APP(obj) (GTK_CHECK_CAST (obj, HILDON_TYPE_APP, \
-            HildonApp))
-
-#define HILDON_APP_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \
-            HILDON_TYPE_APP, HildonAppClass))
-
-#define HILDON_IS_APP(obj) (GTK_CHECK_TYPE (obj, HILDON_TYPE_APP))
-
-#define HILDON_IS_APP_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \
-            HILDON_TYPE_APP))
-
-
-struct _HildonApp {
-    GtkWindow parent;
-};
-
-struct _HildonAppClass {
-    GtkWindowClass parent_class;
-    void (*topmost_status_acquire) (HildonApp *self);
-    void (*topmost_status_lose) (HildonApp *self);
-    void (*switch_to) (HildonApp *self); /* FIXME: Possible browser hack?? */
-    void (*im_close) (HildonApp *self);
-    void (*clipboard_copy) (HildonApp *self, GtkWidget *widget);
-    void (*clipboard_cut) (HildonApp *self, GtkWidget *widget);
-    void (*clipboard_paste) (HildonApp *self, GtkWidget *widget);
-};
-
-#ifndef HILDON_DISABLE_DEPRECATED
-/* Make these values >0 so that we can detect when someone sets SMALL-1
- * zoom level (enum seems to be unsigned int)
- */
-
-/**
- * HildonZoomLevel:
- * @HILDON_ZOOM_SMALL: Smallest font.
- * @HILDON_ZOOM_MEDIUM: Middle size font.
- * @HILDON_ZOOM_LARGE: Largest font.
- *
- * The Hildon zoom levels. Small meaning small font. Large meaning
- * large font. These font are specified in the gtkrc files.
- * This enum is deprecated and should not be used. It's just
- * lecagy stuff from ancient specs.
- */
-typedef enum /*< skip >*/
-{
-    HILDON_ZOOM_SMALL = 1,
-    HILDON_ZOOM_MEDIUM = 2,
-    HILDON_ZOOM_LARGE = 3
-} HildonZoomLevel;
-
-#define HILDON_TYPE_ZOOM_LEVEL (hildon_zoom_level_get_type ())
-
-GType hildon_zoom_level_get_type (void);
-#endif /* deprecated */
-
-
-/* You should use the correct ones from hildon-defines.h 
- *
- * FIXME: These should be removed when API changes are allowed, 
- * they are not used in hildon code anymore (but might be in external). 
- */ 
-#define HILDON_MENU_KEY         GDK_F4
-#define HILDON_HOME_KEY         GDK_F5
-#define HILDON_TOOLBAR_KEY      GDK_T
-#define HILDON_FULLSCREEN_KEY   GDK_F6
-#define HILDON_INCREASE_KEY     GDK_F7
-#define HILDON_DECREASE_KEY     GDK_F8
-#define HILDON_TOOLBAR_MODIFIERS (GDK_SHIFT_MASK | GDK_CONTROL_MASK)
-
-#define HILDON_KEYEVENT_IS_MENU_KEY(keyevent) (keyevent->keyval == HILDON_MENU_KEY)
-#define HILDON_KEYEVENT_IS_HOME_KEY(keyevent) (keyevent->keyval == HILDON_HOME_KEY)
-#define HILDON_KEYEVENT_IS_TOOLBAR_KEY(keyevent) ((keyevent->keyval == HILDON_TOOLBAR_KEY) && \
-                                                  (keyevent->state == HILDON_TOOLBAR_MODIFIERS))
-#define HILDON_KEYEVENT_IS_FULLSCREEN_KEY(keyevent) (keyevent->keyval == HILDON_FULLSCREEN_KEY)
-#define HILDON_KEYEVENT_IS_INCREASE_KEY(keyevent) (keyevent->keyval == HILDON_INCREASE_KEY)
-#define HILDON_KEYEVENT_IS_DECREASE_KEY(keyevent) (keyevent->keyval == HILDON_DECREASE_KEY)
-
-#define TRANSIENCY_MAXITER 50
-
-GType hildon_app_get_type(void) G_GNUC_CONST;
-GtkWidget *hildon_app_new(void);
-GtkWidget *hildon_app_new_with_appview(HildonAppView * appview);
-void hildon_app_set_appview(HildonApp * self, HildonAppView * appview);
-HildonAppView *hildon_app_get_appview(HildonApp * self);
-void hildon_app_set_title(HildonApp * self, const gchar * newtitle);
-const gchar *hildon_app_get_title(HildonApp * self);
-
-#ifndef HILDON_DISABLE_DEPRECATED
-void hildon_app_set_zoom(HildonApp * self, HildonZoomLevel newzoom);
-HildonZoomLevel hildon_app_get_zoom(HildonApp * self);
-PangoFontDescription *hildon_app_get_default_font(HildonApp * self);
-PangoFontDescription *hildon_app_get_zoom_font(HildonApp * self);
-#endif
-
-void hildon_app_set_two_part_title(HildonApp * self,
-                                   gboolean istwoparttitle);
-gboolean hildon_app_get_two_part_title(HildonApp * self);
-
-void hildon_app_set_autoregistration(HildonApp *self, gboolean auto_reg);
-void hildon_app_register_view(HildonApp *self, gpointer view_ptr);
-gboolean hildon_app_register_view_with_id(HildonApp *self,
-                                         gpointer view_ptr,
-                                         unsigned long view_id);
-void hildon_app_unregister_view(HildonApp *self, gpointer view_ptr);
-void hildon_app_unregister_view_with_id(HildonApp *self,
-                                       unsigned long view_id);
-unsigned long hildon_app_find_view_id(HildonApp *self, gpointer view_ptr);
-void hildon_app_notify_view_changed(HildonApp *self, gpointer view_ptr);
-
-void hildon_app_set_killable(HildonApp *self, gboolean killability);
-
-void hildon_app_set_ui_manager(HildonApp *self, GtkUIManager *uim);
-GtkUIManager *hildon_app_get_ui_manager(HildonApp *self);
-
-G_END_DECLS
-#endif /* __HILDON_APP_H__ */
diff --git a/src/hildon-appview.c b/src/hildon-appview.c
deleted file mode 100644 (file)
index 631eb1e..0000000
+++ /dev/null
@@ -1,1495 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/**
- * SECTION:hildon-appview
- * @short_description: A widget which present one view of an application
- * @see_also: #HildonApp
- *
- * #HildonAppView is a widget which presents one view of an application.
- * Application can have many different views and the appview helps to organize.
- * It has automatic fullscreen and menu handling. It also helps to handle 
- * components like a toolbar.
- */
-
-#include <memory.h>
-#include <string.h>
-#include <strings.h>
-#include <stdio.h>
-#include "hildon-app.h"
-#include <hildon-appview.h>
-#include <hildon-find-toolbar.h>
-
-#include <gtk/gtkadjustment.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkimcontext.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkcheckmenuitem.h>
-#include <gtk/gtkmenushell.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkprogressbar.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtkiconfactory.h>
-#include <gtk/gtk.h>
-#include <gdk/gdkkeysyms.h>
-#include <gdk/gdk.h>
-
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-
-
-#include <libintl.h>
-#define _(String) gettext(String)
-
-enum {
-  PROP_0,
-  PROP_CONNECTED_ADJUSTMENT,
-  PROP_FULLSCREEN_KEY_ALLOWED,
-  PROP_FULLSCREEN,
-  PROP_TITLE,
-  PROP_MENU_UI
-};
-
-/*The size of screen*/
-#define WINDOW_HEIGHT           480
-#define WINDOW_WIDTH            800
-
-#define NAVIGATOR_HEIGHT        WINDOW_HEIGHT
-
-#define APPVIEW_HEIGHT          396
-#define APPVIEW_WIDTH           672
-
-#define TOOLBAR_HEIGHT          40
-#define TOOLBAR_UP             9
-#define TOOLBAR_DOWN           9
-#define TOOLBAR_MIDDLE         10
-#define TOOLBAR_RIGHT          24
-#define TOOLBAR_LEFT           24
-#define TOOLBAR_WIDTH           APPVIEW_WIDTH
-
-#define WORKAREA_ATOM "_NET_WORKAREA"
-
-/* Non atom defines */
-#define _NET_WM_STATE_REMOVE    0       /* remove/unset property */
-#define _NET_WM_STATE_ADD       1       /* add/set property */
-
-/*Margins
- * These margins are set to be 5pixels smaller than in the specs
- * Inner things are allocation that extra space
- * */
-/*
-#define MARGIN_TOOLBAR_TOP 2
-#define MARGIN_TOOLBAR_BOTTOM 6
-#define MARGIN_TOOLBAR_LEFT 22
-#define MARGIN_TOOLBAR_RIGHT 23
-*/
-#define MARGIN_APPVIEW_TOP 0
-#define MARGIN_APPVIEW_BOTTOM 24
-#define MARGIN_APPVIEW_LEFT 24
-#define MARGIN_APPVIEW_RIGHT 24
-
-
-#define HILDON_APPVIEW_GET_PRIVATE(obj) \
-    (G_TYPE_INSTANCE_GET_PRIVATE ((obj),\
-     HILDON_TYPE_APPVIEW, HildonAppViewPrivate))
-
-/*Progressbar*/
-#define DEFAULT_WIDTH 20
-#define DEFAULT_HEIGHT 28
-#define BANNER_WIDTH DEFAULT_WIDTH
-#define BANNER_HEIGHT DEFAULT_HEIGHT
-
-static GtkBinClass *parent_class;
-
-static void hildon_appview_init(HildonAppView * self);
-static void hildon_appview_class_init(HildonAppViewClass * appview_class);
-
-static void hildon_appview_menupopupfunc(GtkMenu *menu, gint *x, gint *y,
-                                         gboolean *push_in,
-                                         GtkWidget *widget);
-static void hildon_appview_menupopupfuncfull(GtkMenu *menu, gint *x, gint *y,
-                                             gboolean *push_in,
-                                             GtkWidget *widget);
-static gboolean hildon_appview_expose(GtkWidget * widget,
-                                      GdkEventExpose * event);
-static void hildon_appview_forall(GtkContainer * container,
-                                  gboolean include_internals,
-                                  GtkCallback callback,
-                                  gpointer callback_data);
-static void hildon_appview_show_all(GtkWidget *widget);
-
-static void hildon_appview_size_allocate(GtkWidget * widget,
-                                         GtkAllocation * allocation);
-static void hildon_appview_size_request(GtkWidget * widget,
-                                        GtkRequisition * requisition);
-static void hildon_appview_finalize(GObject * obj_self);
-static void hildon_appview_set_property(GObject * object, guint property_id,
-                                    const GValue * value, GParamSpec * pspec);
-static void hildon_appview_get_property(GObject * object, guint property_id,
-                                    GValue * value, GParamSpec * pspec);
-static void hildon_appview_destroy(GtkObject *obj);
-static void hildon_appview_real_fullscreen_state_change(HildonAppView *
-                                                        self,
-                                                        gboolean
-                                                        fullscreen);
-static void hildon_appview_switched_to(HildonAppView * self);
-static void get_client_area(GtkWidget * widget,
-                            GtkAllocation * allocation);
-
-typedef void (*HildonAppViewSignal) (HildonAppView *, gint, gpointer);
-
-/* signals */
-enum {
-    TOOLBAR_CHANGED,
-    TOOLBAR_TOGGLE_REQUEST,
-    FULLSCREEN_STATE_CHANGE,
-    TITLE_CHANGE,
-    SWITCHED_TO,
-    SWITCHED_FROM,
-    INCREASE_BUTTON_EVENT,
-    DECREASE_BUTTON_EVENT,
-    HILDON_APPVIEW_LAST_SIGNAL
-};
-
-static guint appview_signals[HILDON_APPVIEW_LAST_SIGNAL] = { 0 };
-
-enum {
-    WIN_TYPE = 0,
-    WIN_TYPE_MESSAGE,
-    MAX_WIN_MESSAGES
-};
-
-struct _HildonAppViewPrivate {
-    GtkWidget *menu;
-    gchar *title;
-
-    GtkAllocation allocation;
-
-    guint fullscreen : 1;
-    guint fullscreenshortcutallowed : 1;
-
-    /* For future expansion.
-     * We might use the below variables for disabling keyrepeat if we need it someday. */
-    guint increase_button_pressed_down : 1;
-    guint decrease_button_pressed_down : 1;
-    gint visible_toolbars;
-    GtkAdjustment * connected_adjustment;
-
-    gchar *menu_ui;
-};
-
-/* FIXME: Extremely old Legacy code. I wonder why we need 
-          a custom marshaller in the first place. */
-static void hildon_appview_signal_marshal(GClosure * closure,
-                                          GValue * return_value,
-                                          guint n_param_values,
-                                          const GValue * param_values,
-                                          gpointer invocation_hint,
-                                          gpointer marshal_data)
-{
-    register HildonAppViewSignal callback;
-    register GCClosure *cc = (GCClosure *) closure;
-    register gpointer data1, data2;
-
-    g_assert(n_param_values == 2);
-
-    if (G_CCLOSURE_SWAP_DATA(closure)) {
-        data1 = closure->data;
-        data2 = g_value_peek_pointer(param_values + 0);
-    } else {
-        data1 = g_value_peek_pointer(param_values + 0);
-        data2 = closure->data;
-    }
-
-    callback =
-  /* FIXME: This is a compilation workaround for gcc > 3.3 since glib is buggy */ 
-  /* see http://bugzilla.gnome.org/show_bug.cgi?id=310175 */
-
-#ifdef __GNUC__
-  __extension__
-#endif
-        (HildonAppViewSignal) (marshal_data !=
-                               NULL ? marshal_data : cc->callback);
-
-    callback((HildonAppView *) data1,
-             (gint) g_value_get_int(param_values + 1), data2);
-}
-
-GType hildon_appview_get_type(void)
-{
-    static GType appview_type = 0;
-
-    if (!appview_type) {
-        static const GTypeInfo appview_info = {
-            sizeof(HildonAppViewClass),
-            NULL,       /* base_init */
-            NULL,       /* base_finalize */
-            (GClassInitFunc) hildon_appview_class_init,
-            NULL,       /* class_finalize */
-            NULL,       /* class_data */
-            sizeof(HildonAppView),
-            0,  /* n_preallocs */
-            (GInstanceInitFunc) hildon_appview_init,
-        };
-        appview_type = g_type_register_static(GTK_TYPE_BIN,
-                                              "HildonAppView",
-                                              &appview_info, 0);
-    }
-    return appview_type;
-}
-
-/*
- * Class initialisation.
- */
-static void hildon_appview_class_init(HildonAppViewClass * appview_class)
-{
-    /* Get convenience variables */
-    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(appview_class);
-    GObjectClass *object_class = G_OBJECT_CLASS(appview_class);
-    GtkContainerClass *container_class =
-        GTK_CONTAINER_CLASS(appview_class);
-
-    /* Set the global parent_class here */
-    parent_class = g_type_class_peek_parent(appview_class);
-
-    object_class->set_property = hildon_appview_set_property;
-    object_class->get_property = hildon_appview_get_property;
-
-    /* Set the widgets virtual functions */
-    widget_class->size_allocate = hildon_appview_size_allocate;
-    widget_class->size_request = hildon_appview_size_request;
-    widget_class->expose_event = hildon_appview_expose;
-    widget_class->show_all = hildon_appview_show_all;
-    /* widget_class->realize = hildon_appview_realize; */
-    
-    /* now the object stuff */
-    object_class->finalize = hildon_appview_finalize;
-
-    /* To the container */
-    container_class->forall = hildon_appview_forall;
-    
-    /* gtkobject stuff*/
-    GTK_OBJECT_CLASS(appview_class)->destroy = hildon_appview_destroy; 
-    
-    /* And own virtual functions */
-    appview_class->fullscreen_state_change =
-        hildon_appview_real_fullscreen_state_change;
-    appview_class->switched_to = hildon_appview_switched_to;
-
-    g_type_class_add_private(appview_class,
-                             sizeof(struct _HildonAppViewPrivate));
-
-    /* New signals */
-    appview_signals[TOOLBAR_CHANGED] =
-        g_signal_new("toolbar-changed",
-                     G_OBJECT_CLASS_TYPE(object_class),
-                     G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(HildonAppViewClass, toolbar_changed),
-                     NULL, NULL,
-                     g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
-    appview_signals[TOOLBAR_TOGGLE_REQUEST] =
-        g_signal_new("toolbar-toggle-request",
-                     G_OBJECT_CLASS_TYPE(object_class),
-                     G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(HildonAppViewClass,
-                                     toolbar_toggle_request), NULL, NULL,
-                     g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
-    appview_signals[FULLSCREEN_STATE_CHANGE] =
-        g_signal_new("fullscreen_state_change",
-                     G_OBJECT_CLASS_TYPE(object_class),
-                     G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(HildonAppViewClass,
-                                     fullscreen_state_change), NULL, NULL,
-                     hildon_appview_signal_marshal, G_TYPE_NONE, 1,
-                     G_TYPE_INT);
-
-    appview_signals[TITLE_CHANGE] =
-        g_signal_new("title_change",
-                     G_OBJECT_CLASS_TYPE(object_class),
-                     G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(HildonAppViewClass, title_change),
-                     NULL, NULL,
-                     g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
-    appview_signals[SWITCHED_TO] =
-        g_signal_new("switched_to",
-                     G_OBJECT_CLASS_TYPE(object_class),
-                     G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(HildonAppViewClass, switched_to),
-                     NULL, NULL,
-                     g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
-    appview_signals[SWITCHED_FROM] =
-        g_signal_new("switched_from",
-                     G_OBJECT_CLASS_TYPE(object_class),
-                     G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(HildonAppViewClass, switched_from),
-                     NULL, NULL,
-                     g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-
-    appview_signals[INCREASE_BUTTON_EVENT] =
-        g_signal_new("increase_button_event",
-                     G_OBJECT_CLASS_TYPE(object_class),
-                     G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(HildonAppViewClass, increase_button_event),
-                     NULL, NULL,
-                     g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1,
-                    G_TYPE_UINT);
-
-    appview_signals[DECREASE_BUTTON_EVENT] =
-        g_signal_new("decrease_button_event",
-                     G_OBJECT_CLASS_TYPE(object_class),
-                     G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET(HildonAppViewClass, decrease_button_event),
-                     NULL, NULL,
-                     g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1,
-                    G_TYPE_UINT);
-
-    /* New properties */                     
-    g_object_class_install_property(object_class, PROP_CONNECTED_ADJUSTMENT,
-        g_param_spec_object("connected-adjustment",
-                            "Connected GtkAdjustment",
-                            "The GtkAdjustment. The increase and decrease hardware buttons are mapped to this.",
-                           GTK_TYPE_ADJUSTMENT,
-                           G_PARAM_READWRITE));
-
-    g_object_class_install_property(object_class, PROP_FULLSCREEN_KEY_ALLOWED,
-                                   g_param_spec_boolean("fullscreen-key-allowed",
-                                                        "Fullscreen key allowed",
-                                                        "Whether the fullscreen key is allowed or not",
-                                                        FALSE,
-                                                        G_PARAM_READWRITE));
-
-    g_object_class_install_property(object_class, PROP_FULLSCREEN,
-                                   g_param_spec_boolean("fullscreen",
-                                                        "Fullscreen",
-                                                        "Whether the appview should be fullscreen or not",
-                                                        FALSE,
-                                                        G_PARAM_READWRITE));
-    g_object_class_install_property(object_class, PROP_TITLE,
-                                   g_param_spec_string("title",
-                                                       "Title",
-                                                       "Appview title",
-                                                       NULL,
-                                                       G_PARAM_READWRITE));
-    g_object_class_install_property(object_class, PROP_MENU_UI,
-                                   g_param_spec_string("menu-ui",
-                                                       "Menu UI string",
-                                                       "UI string for application view menu",
-                                                       NULL,
-                                                       G_PARAM_READWRITE));
-   widget_class = (GtkWidgetClass*) appview_class;
-}
-
-/*
- * Performs the initialisation of the widget.
- */
-static void hildon_appview_init(HildonAppView * self)
-{
-    HildonAppViewPrivate *priv = self->priv =
-        HILDON_APPVIEW_GET_PRIVATE(self);
-
-    /* the vbox is used to handle both the view's main body and how many
-     * toolbars as the user wants */
-
-    self->vbox = gtk_vbox_new(TRUE, TOOLBAR_MIDDLE);
-    /* TOOLBAR_MIDDLE is here properly used, as originally meant. In order to
-     * be free to use whatever distance between toolbars, it's crucial to mind
-     * that the relevant gtkrc file must contain the following border property
-     * for the "toolbar-frame-middle" property:  border = {24, 24, 5, 4}
-     */
-
-    gtk_widget_set_parent(self->vbox, GTK_WIDGET(self));
-    priv->menu = NULL;
-    priv->visible_toolbars = 0;
-
-    priv->title = g_strdup("");
-
-    priv->fullscreen = FALSE;
-    priv->fullscreenshortcutallowed = FALSE;
-    priv->increase_button_pressed_down = FALSE;
-    priv->decrease_button_pressed_down = FALSE;
-   
-    priv->connected_adjustment = NULL;
-}
-
-/*
- * Performs the standard gtk finalize function, freeing allocated
- * memory and propagating the finalization to the parent.
- */
-static void hildon_appview_finalize(GObject * obj_self)
-{
-    HildonAppView *self;
-    g_assert(HILDON_APPVIEW(obj_self));
-    self = HILDON_APPVIEW(obj_self);
-
-    if (self->priv->menu_ui)
-      g_free (self->priv->menu_ui);
-
-    if (self->priv->connected_adjustment != NULL)
-      g_object_remove_weak_pointer (G_OBJECT (self->priv->connected_adjustment),
-                                   (gpointer) &self->priv->connected_adjustment);
-
-    if (G_OBJECT_CLASS(parent_class)->finalize)
-        G_OBJECT_CLASS(parent_class)->finalize(obj_self);
-
-    g_free(self->priv->title);
-}
-
-/*
- * An accessor to set private properties of HildonAppView.
- */
-static void hildon_appview_set_property(GObject * object, guint property_id,
-                                    const GValue * value, GParamSpec * pspec)
-{
-    HildonAppView *appview = HILDON_APPVIEW (object);
-
-    switch (property_id) {
-    case PROP_CONNECTED_ADJUSTMENT:
-        hildon_appview_set_connected_adjustment (appview, g_value_get_object (value));
-       break;
-
-    case PROP_FULLSCREEN_KEY_ALLOWED:
-       hildon_appview_set_fullscreen_key_allowed (appview, g_value_get_boolean (value));
-       break;
-
-    case PROP_FULLSCREEN:
-       hildon_appview_set_fullscreen (appview, g_value_get_boolean (value));
-       break;
-
-    case PROP_TITLE:
-       hildon_appview_set_title (appview, g_value_get_string (value));
-       break;
-
-    case PROP_MENU_UI:
-       hildon_appview_set_menu_ui (appview, g_value_get_string (value));
-       break;
-    
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
-        break;
-    }
-}
-
-/*
- * An accessor to get private properties of HildonAppView.
- */
-static void hildon_appview_get_property(GObject * object, guint property_id,
-                                    GValue * value, GParamSpec * pspec)
-{
-    HildonAppViewPrivate *priv = HILDON_APPVIEW_GET_PRIVATE(object);
-
-    switch (property_id) {
-    case PROP_CONNECTED_ADJUSTMENT:
-        g_value_set_object (value, priv->connected_adjustment);
-       break;
-
-    case PROP_FULLSCREEN_KEY_ALLOWED:
-       g_value_set_boolean (value, priv->fullscreenshortcutallowed);
-       break;
-
-    case PROP_FULLSCREEN:
-       g_value_set_boolean (value, priv->fullscreen);
-       break;
-
-    case PROP_TITLE:
-       g_value_set_string (value, priv->title);
-       break;
-
-    case PROP_MENU_UI:
-       g_value_set_string (value, priv->menu_ui);
-       break;
-       
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
-        break;
-    }
-}
-
-/*
- * Used when the HildonAppView is exposed, this function gets a GtkBoxChild
- * as first argument, and a pointer to a gint as second argument. If such
- * GtkBoxChild is visible, the function increments the gint. It is used
- * in a loop, to compute the number of visible toolbars.
- */
-static void visible_toolbar(gpointer child, gpointer number_of_visible_toolbars) 
-{
-    if(GTK_WIDGET_VISIBLE(((GtkBoxChild *)child)->widget))
-      (*((gint *)number_of_visible_toolbars))++;
-}
-
-/*
- * Used in the paint_toolbar function to discover how many toolbars are
- * above the find toolbar. It's called in a loop that iterates through
- * all the children of the GtkVBox of the HildonAppView.
- */
-static void find_findtoolbar_index(gpointer child, gpointer number_of_visible_toolbars)
-{
-    gint *pass_bundle = (gint *)number_of_visible_toolbars;
-    
-    if(((GtkBoxChild *)child)->widget->allocation.y < pass_bundle[0]
-       && GTK_WIDGET_VISIBLE(((GtkBoxChild *)child)->widget))
-        pass_bundle[1]++;
-}
-
-/*
- * Used in the paint_toolbar function, it's get a GtkBoxChild as first argument
- * and a pointer to a GtkWidget as the second one, which will be addressed to
- * the find toolbar widget, if it is contained in the given GtkBoxChild.
- */
-static void find_findtoolbar(gpointer child, gpointer widget)
-{
-    if(HILDON_IS_FIND_TOOLBAR(((GtkBoxChild *)child)->widget)
-       && GTK_WIDGET_VISIBLE(((GtkBoxChild *)child)->widget))
-        (*((GtkWidget **)widget)) = ((GtkBoxChild *)child)->widget;
-}
-
-/*
- * Paints all the toolbar children of the GtkVBox of the HildonAppView.
- */
-static void paint_toolbar(GtkWidget *widget, GtkBox *box, 
-                         GdkEventExpose * event, 
-                         gboolean fullscreen)
-{
-    gint toolbar_num = 0; 
-    gint ftb_index = 0;
-    gint count;
-    GtkWidget *findtoolbar = NULL;
-    gchar toolbar_mode[40];
-
-    /* Iterate through all the children of the vbox of the HildonAppView.
-     * The visible_toolbar function increments toolbar_num if the toolbar
-     * is visible. After this loop, toobar_num will contain the number
-     * of the visible toolbars. */
-    g_list_foreach(box->children, visible_toolbar, 
-                  (gpointer) &toolbar_num);
-    if(toolbar_num <= 0)
-      return;
-
-    /* Loop through all the children of the GtkVBox of the HildonAppView.
-     * The find_findtoolbar function will assign a pointer to the find toolbar
-     * to "findtoolbar" argument. If the findtoolbar is not found, i.e. it
-     * isn't in the GtkVBox, then the "findtoolbar" argument will stay NULL */
-    g_list_foreach(box->children, find_findtoolbar, 
-                  (gpointer) &findtoolbar);
-    if(findtoolbar != NULL){
-        gint pass_bundle[2];
-        
-        /* an array for convient data passing
-         * the first member contains the y allocation
-         * of the find toolbar, and the second allocation
-         * contains the index(how many toolbars are above
-         * find toolbar) */
-        pass_bundle[0] = findtoolbar->allocation.y;
-        pass_bundle[1] = ftb_index;
-
-        /* computes how many toolbars are above the find toolbar, and the
-         * value is stored in pass_bundle[1] */
-        g_list_foreach(box->children, find_findtoolbar_index,
-                      (gpointer) pass_bundle);
-        ftb_index = pass_bundle[1];
-    }
-    /*upper border*/
-    sprintf(toolbar_mode, "toolbar%sframe-top", 
-           fullscreen ? "-fullscreen-" : "-");
-    gtk_paint_box(widget->style, widget->window,
-                 GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
-                 &event->area, widget, toolbar_mode,
-                 widget->allocation.x,
-                 GTK_WIDGET(box)->allocation.y -TOOLBAR_UP,
-                 widget->allocation.width, TOOLBAR_UP);
-    
-    /*top most toolbar painting*/
-    if(findtoolbar != NULL && ftb_index == 0 )
-    {
-        sprintf(toolbar_mode, "findtoolbar%s", 
-               fullscreen ? "-fullscreen" : "");
-        
-        gtk_paint_box(widget->style, widget->window,
-                     GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
-                     &event->area, widget, toolbar_mode,
-                     widget->allocation.x,
-                     GTK_WIDGET(box)->allocation.y,
-                     widget->allocation.width,
-                     TOOLBAR_HEIGHT);
-    }else{
-        sprintf(toolbar_mode, "toolbar%s", 
-               fullscreen ? "-fullscreen" : "");
-       gtk_paint_box(widget->style, widget->window,
-                     GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
-                     &event->area, widget, toolbar_mode,
-                     widget->allocation.x,
-                     GTK_WIDGET(box)->allocation.y,
-                     widget->allocation.width,
-                     TOOLBAR_HEIGHT);
-    }
-    /*multi toolbar painting*/
-    for(count = 0; count < toolbar_num - 1; count++)
-    {
-        sprintf(toolbar_mode, "toolbar%sframe-middle", 
-               fullscreen ? "-fullscreen-" : "-");
-        
-        gtk_paint_box(widget->style, widget->window,
-                 GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
-                 &event->area, widget, toolbar_mode,
-                 widget->allocation.x,
-                 GTK_WIDGET(box)->allocation.y + 
-                 (1 + count) * TOOLBAR_HEIGHT + 
-                 count * TOOLBAR_MIDDLE,
-                 widget->allocation.width,
-                 TOOLBAR_MIDDLE);
-
-       if(findtoolbar != NULL && count + 1 == ftb_index){
-            sprintf(toolbar_mode, "findtoolbar%s", 
-                   fullscreen ? "-fullscreen" : "");
-           
-           gtk_paint_box(widget->style, widget->window,
-                     GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
-                     &event->area, widget, toolbar_mode,
-                     widget->allocation.x,
-                     GTK_WIDGET(box)->allocation.y + 
-                     (1 + count) * (TOOLBAR_HEIGHT + TOOLBAR_MIDDLE),
-                     widget->allocation.width,
-                     TOOLBAR_HEIGHT);
-       }else{
-            sprintf(toolbar_mode, "toolbar%s", 
-                   fullscreen ? "-fullscreen" : "");
-           
-           gtk_paint_box(widget->style, widget->window,
-                     GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
-                     &event->area, widget, toolbar_mode,
-                     widget->allocation.x,
-                     GTK_WIDGET(box)->allocation.y + 
-                     (1 + count) * (TOOLBAR_HEIGHT + TOOLBAR_MIDDLE),
-                     widget->allocation.width,
-                     TOOLBAR_HEIGHT);
-       }
-    }
-    sprintf(toolbar_mode, "toolbar%sframe-bottom", 
-           fullscreen ? "-fullscreen-" : "-");
-    
-    gtk_paint_box(widget->style, widget->window,
-                 GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
-                 &event->area, widget, toolbar_mode,
-                 widget->allocation.x,
-                 GTK_WIDGET(box)->allocation.y + 
-                 GTK_WIDGET(box)->allocation.height,
-                 widget->allocation.width, TOOLBAR_DOWN);
-}
-
-/*
- * Callback function to an expose event.
- */
-static gboolean hildon_appview_expose(GtkWidget * widget,
-                                      GdkEventExpose * event)
-{
-    gint toolbar_num = 0;
-    GtkBox *box = GTK_BOX(HILDON_APPVIEW(widget)->vbox);
-
-    if(GTK_WIDGET_VISIBLE(box) && box->children != NULL)
-    {
-        HildonAppViewPrivate *priv = HILDON_APPVIEW_GET_PRIVATE(widget);
-
-        /* Iterate through all the children of the vbox of the HildonAppView.
-         * The visible_toolbar function increments toolbar_num if the toolbar
-         * is visible. After this loop, toobar_num will contain the number
-         * of the visible toolbars. */
-        g_list_foreach(box->children, visible_toolbar, 
-                (gpointer) &toolbar_num);
-
-        if( priv->visible_toolbars != toolbar_num)
-        {
-            /* If the code reaches this block, it means that a toolbar as 
-             * been added or removed since last time the view was drawn.
-             * Let's then compute the new height of the toolbars areas */
-            gint y_pos = 0;
-            /* the height difference */
-            gint change = (priv->visible_toolbars - toolbar_num) *
-                (TOOLBAR_HEIGHT+TOOLBAR_MIDDLE+TOOLBAR_UP);
-            if( change < 0 )
-                change = TOOLBAR_MIDDLE + TOOLBAR_UP;
-            /* the new y-coordinate for the toolbars area */
-            y_pos = HILDON_APPVIEW(widget)->vbox->allocation.y - change;
-
-            gtk_widget_queue_draw_area(widget, 0, y_pos, widget->allocation.width,
-                    change + HILDON_APPVIEW(widget)->vbox->allocation.height +
-                    TOOLBAR_DOWN);
-            priv->visible_toolbars = toolbar_num;
-        }
-    }
-
-
-    if (HILDON_APPVIEW(widget)->priv->fullscreen)
-    {
-        if (toolbar_num > 0)
-            paint_toolbar(widget, box, event, TRUE);
-    }
-    else
-    {
-        gint appview_height_decrement = 0;
-        if (toolbar_num > 0)
-        {
-            appview_height_decrement = toolbar_num * TOOLBAR_HEIGHT +
-                (toolbar_num - 1) * TOOLBAR_MIDDLE 
-                + TOOLBAR_UP + TOOLBAR_DOWN;
-
-            paint_toolbar(widget, box, event, FALSE);
-        }
-        else
-        {
-            appview_height_decrement = MARGIN_APPVIEW_BOTTOM;
-
-            gtk_paint_box(widget->style, widget->window,
-                    GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT,
-                    &event->area, widget, "bottom-border",
-                    widget->allocation.x,
-                    widget->allocation.y +
-                    (widget->allocation.height - MARGIN_APPVIEW_BOTTOM),
-                    widget->allocation.width, MARGIN_APPVIEW_BOTTOM);
-        }
-        gtk_paint_box( widget->style, widget->window,
-                GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT, 
-                &event->area,
-                widget, "left-border", widget->allocation.x,
-                widget->allocation.y, MARGIN_APPVIEW_LEFT,
-                widget->allocation.height - appview_height_decrement );
-        gtk_paint_box( widget->style, widget->window,
-                GTK_WIDGET_STATE(widget), GTK_SHADOW_OUT, 
-                &event->area,
-                widget, "right-border",
-                (widget->allocation.x +
-                 widget->allocation.width) -
-                MARGIN_APPVIEW_RIGHT, widget->allocation.y,
-                MARGIN_APPVIEW_RIGHT,
-                widget->allocation.height - appview_height_decrement );
-    }
-
-    GTK_WIDGET_CLASS(parent_class)->expose_event(widget, event);
-
-    return FALSE;
-}
-
-/*
- * Responds to the usual size_request signal.
- */
-static void hildon_appview_size_request(GtkWidget * widget,
-                                        GtkRequisition * requisition)
-{
-    HildonAppViewPrivate *priv = HILDON_APPVIEW(widget)->priv;
-    GtkWidget *child = GTK_BIN(widget)->child;
-
-    /* forward the size_request to the eventual child of the main container */
-    if (child)
-        gtk_widget_size_request(child, requisition);
-
-    /* forward the size_request to the eventual vbox (which may contain
-     * toolbars) */
-    if (HILDON_APPVIEW(widget)->vbox != NULL)
-        gtk_widget_size_request(HILDON_APPVIEW(widget)->vbox, requisition);
-
-    /* express the size_request for the view */
-    if (priv->fullscreen) {
-        requisition->height = WINDOW_HEIGHT;
-        requisition->width = WINDOW_WIDTH;
-    } else {
-        requisition->height = APPVIEW_HEIGHT;
-        requisition->width = APPVIEW_WIDTH;
-    }
-}
-
-/*
- * Computes size and position for the children of the view.
- */
-static void hildon_appview_size_allocate(GtkWidget * widget,
-                                         GtkAllocation * allocation)
-{
-    GtkAllocation box_allocation;
-    GtkAllocation alloc = *allocation;
-    gint border_width = GTK_CONTAINER(widget)->border_width;
-    GtkBin *bin = GTK_BIN(widget);
-    GtkBox *box = GTK_BOX(HILDON_APPVIEW(widget)->vbox);
-    gboolean at_least_one_visible_toolbar = FALSE;
-
-    if(!GTK_IS_WIDGET(bin->child)) return;
-
-    widget->allocation = *allocation;
-    
-    if (bin->child != NULL && GTK_IS_WIDGET(bin->child)) {
-        if (HILDON_APPVIEW(widget)->priv->fullscreen) {
-            alloc.x += border_width;
-            alloc.y += border_width;
-            alloc.width -= (border_width * 2);
-            alloc.height -= (border_width * 2);
-        } else {
-            alloc.x += border_width + MARGIN_APPVIEW_LEFT;
-            alloc.y += border_width + MARGIN_APPVIEW_TOP;
-            alloc.width -= (border_width * 2) + (MARGIN_APPVIEW_LEFT +
-                                      MARGIN_APPVIEW_RIGHT);
-            alloc.height -= (border_width * 2) + MARGIN_APPVIEW_TOP;
-        }
-    }
-
-    if (box->children != NULL) {
-        gint length = 0;
-        gint box_height = 0;
-        /* Iterate through all the children of the vbox of the HildonAppView.
-         * The visible_toolbar function increments toolbar_num if the toolbar
-         * is visible. After this loop, toobar_num will contain the number
-         * of the visible toolbars. */
-        g_list_foreach(box->children, visible_toolbar, 
-                    (gpointer) &length);
-        if(length > 0){
-            box_height = length * TOOLBAR_HEIGHT + 
-             (length - 1) * TOOLBAR_MIDDLE;
-       
-            if(bin->child != NULL) {
-                alloc.height = alloc.height - box_height - TOOLBAR_UP
-                 - TOOLBAR_DOWN;
-               at_least_one_visible_toolbar = TRUE;
-           }
-       
-            box_allocation.y = allocation->height - box_height - TOOLBAR_DOWN;
-            box_allocation.height = box_height;
-            box_allocation.x = allocation->x + TOOLBAR_LEFT;
-           box_allocation.width = allocation->width - TOOLBAR_LEFT - 
-             TOOLBAR_RIGHT;
-           gtk_widget_size_allocate(GTK_WIDGET(box), &box_allocation);
-        }
-    }
-    
-    /* The bottom skin graphics is visible only when there are no toolbars */
-    if ((HILDON_APPVIEW(widget)->priv->fullscreen == FALSE) &&
-       (at_least_one_visible_toolbar == FALSE))
-        alloc.height -= MARGIN_APPVIEW_BOTTOM;
-    
-    gtk_widget_size_allocate(GTK_WIDGET(bin->child), &alloc);
-}
-
-/*
- * Overrides gtk_container_forall, calling the callback function for each of
- * the children of HildonAppPrivate.
- */
-static void hildon_appview_forall(GtkContainer * container,
-                                  gboolean include_internals,
-                                  GtkCallback callback,
-                                  gpointer callback_data)
-{
-    HildonAppView *self = HILDON_APPVIEW(container);
-
-    g_assert(callback != NULL);
-
-    GTK_CONTAINER_CLASS(parent_class)->forall(container, include_internals,
-                                              callback, callback_data);
-    if(include_internals && self->vbox != NULL)
-        (* callback)(GTK_WIDGET(self->vbox), callback_data);
-}
-
-/**
- * Shows all the widgets in the container.
- */
-static void hildon_appview_show_all(GtkWidget *widget)
-{
-    HildonAppView *self = HILDON_APPVIEW(widget);
-    
-    /* Toolbar items */
-    gtk_widget_show_all(self->vbox);
-
-    /* Parent handless stuff inside appview */
-    GTK_WIDGET_CLASS(parent_class)->show_all(widget);
-}
-
-/*
- * Frees all the resources and propagates the destroy call to the parent.
- */
-static void hildon_appview_destroy(GtkObject *obj)
-{
-    HildonAppView *self = HILDON_APPVIEW(obj);
-    
-    if(self->vbox != NULL){
-        gtk_widget_unparent(self->vbox);
-        self->vbox = NULL;     
-    }
-
-    GTK_OBJECT_CLASS(parent_class)->destroy(obj);
-}
-
-/*******************/
-/*   Signals       */
-/*******************/
-
-/*Signal - When is changed to this appview, this is called*/
-static void hildon_appview_switched_to(HildonAppView * self)
-{
-    GtkWidget *parent;
-
-    g_assert(self && HILDON_IS_APPVIEW(self));
-
-    parent = gtk_widget_get_parent(GTK_WIDGET(self));
-    hildon_appview_set_fullscreen( self, self->priv->fullscreen );
-}
-
-/*Signal - When the fullscreen state is changed, this is called*/
-static void hildon_appview_real_fullscreen_state_change(HildonAppView *
-                                                        self,
-                                                        gboolean
-                                                        fullscreen)
-{
-    HildonAppViewPrivate *priv;
-    g_assert(self && HILDON_IS_APPVIEW(self));
-    priv = self->priv;
-
-    /* Ensure that state is really changed */
-    if( priv->fullscreen == fullscreen )
-      return;
-
-    if( fullscreen )
-      gtk_window_fullscreen( GTK_WINDOW(
-                             gtk_widget_get_parent(GTK_WIDGET(self))) );
-    else
-      gtk_window_unfullscreen( GTK_WINDOW(
-                             gtk_widget_get_parent(GTK_WIDGET(self))) );
-
-    priv->fullscreen = fullscreen;
-}
-
-/*******************/
-/*     General     */
-/*******************/
-
-
-/*
- * queries a window for the root window coordinates and size of its
- * client area (i.e. minus the title borders etc.)
- */
-static void get_client_area(GtkWidget * widget, GtkAllocation * allocation)
-{
-    GdkWindow *window = widget->window;
-    
-    if (window)
-      gdk_window_get_origin(window, &allocation->x, &allocation->y);
-    else
-      memset( allocation, 0, sizeof(GtkAllocation) );
-}
-
-/*The menu popuping needs a menu popup-function*/
-static void hildon_appview_menupopupfunc( GtkMenu *menu, gint *x, gint *y,
-                                          gboolean *push_in, GtkWidget *widget )
-{
-  GtkAllocation client_area = { 0, 0, 0, 0 };
-
-  get_client_area( GTK_WIDGET(widget), &client_area );
-
-  gtk_widget_style_get (GTK_WIDGET (menu), "horizontal-offset", x,
-                       "vertical-offset", y, NULL);
-   
-  *x += client_area.x;
-  *y += client_area.y;
-  
-}
-
-/* Similar to above, but used in fullscreen mode */
-static void hildon_appview_menupopupfuncfull( GtkMenu *menu, gint *x, gint *y,
-                                              gboolean *push_in, 
-                                              GtkWidget *widget )
-{
-  gtk_widget_style_get (GTK_WIDGET (menu), "horizontal-offset", x,
-                       "vertical-offset", y, NULL);
-
-  *x = MAX (0, *x);
-  *y = MAX (0, *y);
-}
-
-/*******************/
-/*public functions*/
-/*******************/
-
-
-/**
- * hildon_appview_new: 
- * @title:the application view title of the new @HildonAppView
- * 
- * Use this function to create a new application view. The title will 
- * be set only if two-part-title is enabled on the @HildonApp.
- * 
- * Returns: A #HildonAppView.
- **/
-GtkWidget *hildon_appview_new(const gchar * title)
-{
-    HildonAppView *newappview = g_object_new(HILDON_TYPE_APPVIEW, NULL);
-
-    hildon_appview_set_title(newappview, title);
-    return GTK_WIDGET(newappview);
-}
-
-/**
- * hildon_appview_add_with_scrollbar
- * @self : a @HildonAppView
- * @child : a @GtkWidget
- *
- * Adds the @child to the @self(HildonAppView) and creates a vertical 
- * scrollbar to it. Similar as adding first a #GtkScrolledWindow 
- * and then the @child to it.
- */
-void hildon_appview_add_with_scrollbar(HildonAppView * self,
-                                       GtkWidget * child)
-{
-    GtkScrolledWindow *scrolledw;
-
-    g_return_if_fail(HILDON_IS_APPVIEW(self));
-    g_return_if_fail(GTK_IS_WIDGET(child));
-    g_return_if_fail(child->parent == NULL);
-
-    scrolledw = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(NULL, NULL));
-    gtk_scrolled_window_set_policy(scrolledw, GTK_POLICY_NEVER,
-                                   GTK_POLICY_AUTOMATIC);
-    gtk_scrolled_window_set_shadow_type(scrolledw, GTK_SHADOW_NONE);
-
-    /* Check whether child widget supports adjustments */
-    if (GTK_WIDGET_GET_CLASS (child)->set_scroll_adjustments_signal)
-        gtk_container_add(GTK_CONTAINER(scrolledw), child);
-    else
-    {
-      if( GTK_IS_CONTAINER(child) )
-        gtk_container_set_focus_vadjustment( GTK_CONTAINER(child),
-                              gtk_scrolled_window_get_vadjustment(scrolledw) );
-        gtk_scrolled_window_add_with_viewport(scrolledw, child);
-    }
-
-    gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(scrolledw));
-}
-
-/**
- * hildon_appview_get_title:
- * @self : a #HildonAppView
- *
- * Gets the title of given #HildonAppView.
- *
- * Returns: the title of the application view
- */
-const gchar *hildon_appview_get_title(HildonAppView * self)
-{
-    g_return_val_if_fail(self && HILDON_IS_APPVIEW(self), "");
-    return self->priv->title;
-}
-
-/**
- * hildon_appview_set_title:
- * @self : a #HildonAppView
- * @newname : the new title of the application view.
- * 
- * Sets an title of an application view. The title is visible only if
- * two-part-title is enabled on the #HildonApp.
- * 
- */
-void hildon_appview_set_title(HildonAppView * self, const gchar * newname)
-{
-    gchar *oldtitle;
-
-    g_return_if_fail(self && HILDON_IS_APPVIEW(self));
-    oldtitle = self->priv->title;
-
-    if (newname != NULL)
-        self->priv->title = g_strdup(newname);
-    else
-        self->priv->title = g_strdup("");
-
-    g_free(oldtitle);
-    g_signal_emit_by_name(G_OBJECT(self), "title_change");
-}
-
-/**
- * hildon_appview_set_toolbar:
- * @self: a #HildonAppView
- * @toolbar: a #GtkToolbar
- *
- * Sets the #GtkToolbar to given #HildonAppView. This is, however, not a
- * recommended way to set your toolbars. When you have multi toolbars, calling
- * this function more than once will just replace the bottom most toolbar.
- * There is a #GtkVBox in #HildonAppView's public structure, the programmer
- * is responsible to pack his toolbars in the #GtkVBox, and #HildonAppView will
- * take care of putting them at the right place.
- * 
- */
-#ifndef HILDON_DISABLE_DEPRECATED
-void hildon_appview_set_toolbar(HildonAppView * self, GtkToolbar * toolbar)
-{
-    GtkBox *box = GTK_BOX(HILDON_APPVIEW(self)->vbox);
-    g_return_if_fail(self && HILDON_IS_APPVIEW(self));
-    if(toolbar != NULL)/*for failure checking*/
-        g_return_if_fail(GTK_IS_TOOLBAR(toolbar));
-    
-    /*if it is NULL, it unsets the last one, 
-     * if it is not null, it unsets the last one anyway*/
-    if(box->children != NULL){
-        GtkWidget *last_widget;
-       
-        last_widget = ((GtkBoxChild *)g_list_last
-                      (box->children)->data)->widget;
-        gtk_container_remove(GTK_CONTAINER(box), 
-                            last_widget);
-    }
-    
-    gtk_box_pack_end(box, GTK_WIDGET(toolbar), TRUE, TRUE, 0);
-    gtk_widget_queue_resize(GTK_WIDGET(self));
-    /*deprecated signal*/
-    g_signal_emit_by_name(G_OBJECT(self), "toolbar-changed");
-}
-#endif
-/**
- * hildon_appview_get_toolbar:
- * @self: a #HildonAppView
- *
- * This function will only 
- * return the last widget that has been packed into the #GtkVBox in the public
- * structure. Note this does not, however, mean that it is the bottom most
- * toolbar.
- * 
- * Return value: the #GtkToolbar assigned to this application view. 
- **/
-#ifndef HILDON_DISABLE_DEPRECATED
-GtkToolbar *hildon_appview_get_toolbar(HildonAppView * self)
-{
-    GtkBox *box = GTK_BOX(HILDON_APPVIEW(self)->vbox);
-    g_return_val_if_fail(self != NULL && HILDON_IS_APPVIEW(self), FALSE);
-    if(box != NULL && box->children != NULL)
-      return GTK_TOOLBAR(((GtkBoxChild*)
-                         g_list_last(box->children)->data)->widget);
-    else
-      return NULL;
-}
-#endif
-/**
- * hildon_appview_set_fullscreen:
- * @self: a #HildonAppView
- * @fullscreen: the new state of fullscreen mode. TRUE means fullscreen
- * will be set. FALSE the opposite.
- * 
- * Set the fullscreen state of given #HildonAppView class.
- */
-void hildon_appview_set_fullscreen(HildonAppView * self,
-                                   gboolean fullscreen)
-{
-    g_return_if_fail(self && HILDON_IS_APPVIEW(self));
-    g_signal_emit_by_name(G_OBJECT(self), "fullscreen_state_change",
-                          fullscreen);
-}
-
-/**
- * hildon_appview_get_fullscreen:
- * @self: a #HildonAppView
- *
- * Gets the current state of fullscreen mode.
- * 
- * Returns: the current state of fullscreen mode
- */
-gboolean hildon_appview_get_fullscreen(HildonAppView * self)
-{
-    g_return_val_if_fail(self && HILDON_IS_APPVIEW(self), FALSE);
-    return self->priv->fullscreen;
-}
-
-/**
- * hildon_appview_get_fullscreen_key_allowed:
- * @self: a #HildonAppView
- *
- * Check if fullscreening with a shortcut is allowed for given
- * #HildonAppView.
- * 
- * Returns: wheter it's possible to swith fullscreen on/off with
- *               a shortcut key
- */
-gboolean hildon_appview_get_fullscreen_key_allowed(HildonAppView * self)
-{
-    g_return_val_if_fail(self && HILDON_IS_APPVIEW(self), FALSE);
-    return self->priv->fullscreenshortcutallowed;
-}
-
-/**
- * hildon_appview_set_fullscreen_key_allowed:
- * @self: a #HildonAppView
- * @allow: wheter it's possible to swith fullscreen on/off with
- *               a shortcut key
- *
- * Sets given #HildonAppView whether to allow toggling fullscreen mode
- * with a shortcut key.
- */
-void hildon_appview_set_fullscreen_key_allowed(HildonAppView * self,
-                                               gboolean allow)
-{
-    g_return_if_fail(self && HILDON_IS_APPVIEW(self));
-    self->priv->fullscreenshortcutallowed = allow;
-}
-
-/**
- * hildon_appview_get_menu:
- * @self : #HildonAppView
- * 
- * Gets the #GtMenu assigned to the #HildonAppview.
- *
- * Returns: the #GtkMenu assigned to this application view
- */
-GtkMenu *hildon_appview_get_menu(HildonAppView * self)
-{
-    g_return_val_if_fail(self && HILDON_IS_APPVIEW(self), NULL);
-
-    if (self->priv->menu == NULL) {
-        /* Create hildonlike menu */
-        
-        GtkUIManager *uim;
-        GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (self));
-
-        /* Try to get appview menu from ui manager */        
-        if (parent && HILDON_IS_APP (parent))
-          {
-            uim = hildon_app_get_ui_manager (HILDON_APP (parent));
-            if (uim)
-              {
-                self->priv->menu =
-                  gtk_ui_manager_get_widget (uim, "/HildonApp");
-              }
-          }
-        
-        
-        if (self->priv->menu == NULL)
-          {
-            /* Fall back to oldskool menus */
-            self->priv->menu = GTK_WIDGET (g_object_new (GTK_TYPE_MENU, NULL));
-          }  
-          
-        gtk_widget_set_name(GTK_WIDGET(self->priv->menu),
-                            "menu_force_with_corners");
-        gtk_widget_show_all (self->priv->menu);
-    }
-
-    return GTK_MENU(self->priv->menu);
-}
-
-/**
- * _hildon_appview_toggle_menu:
- * @self : a #HildonAppView
- * @button_event_time :
- *
- * This function should be only called from @HildonApp.
- * Should be renamed to popup menu. Just the first parameter is used.
- * 
- * Returns: Whether or not something was done (whether or not we had
- * a menu)
- */
-gboolean _hildon_appview_toggle_menu(HildonAppView * self,
-                                 Time button_event_time)
-{
-    GList *children;
-
-    g_return_val_if_fail(self && HILDON_IS_APPVIEW(self), FALSE);
-
-    if (!self->priv->menu)
-        return FALSE;
-
-    if (GTK_WIDGET_VISIBLE(self->priv->menu)) {
-        gtk_menu_popdown(GTK_MENU(self->priv->menu));
-        gtk_menu_shell_deactivate(GTK_MENU_SHELL(self->priv->menu));
-        return TRUE;
-    }
-
-    /* Avoid opening an empty menu */
-    children = gtk_container_get_children(
-                        GTK_CONTAINER(hildon_appview_get_menu(self)));
-    if (children != NULL) {
-        GtkWidget *menu;
-
-        g_list_free(children);
-        menu = GTK_WIDGET(hildon_appview_get_menu(self));
-        if (self->priv->fullscreen) {
-            gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
-                           (GtkMenuPositionFunc)
-                           hildon_appview_menupopupfuncfull,
-                           self, 0, button_event_time);
-        } else {
-            gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
-                           (GtkMenuPositionFunc)
-                           hildon_appview_menupopupfunc,
-                           self, 0, button_event_time);
-        }
-        gtk_menu_shell_select_first(GTK_MENU_SHELL(menu), TRUE);
-        return TRUE;
-    }
-    return FALSE;
-
-}
-
-/**
- * _hildon_appview_menu_visible
- * @self:  a #HildonAppView
- * 
- * Checks whether the titlebar menu is currently visible
- * Returns: TRUE if the menu is visible, FALSE if not
- */
-
-gboolean _hildon_appview_menu_visible(HildonAppView * self)
-{
-    g_return_val_if_fail (HILDON_IS_APPVIEW (self), FALSE);
-    
-    return GTK_WIDGET_VISIBLE(GTK_WIDGET(hildon_appview_get_menu(self)));
-}
-
-/**
- * hildon_appview_set_connected_adjustment
- * @self :  #HildonAppView
- * @adjustment : a new #GtkAdjustment set to reach to increase
- *   / decrease hardware keys or NULL to unset
- * 
- * Sets a #GtkAdjustment which will change when increase/decrease buttons
- * are pressed.
- */
-void hildon_appview_set_connected_adjustment (HildonAppView * self,
-                                             GtkAdjustment * adjustment)
-{
-    g_return_if_fail (HILDON_IS_APPVIEW (self));
-
-    /* Disconnect old adjustment */
-    if (self->priv->connected_adjustment != NULL)
-      g_object_remove_weak_pointer (G_OBJECT (self->priv->connected_adjustment),
-                                   (gpointer) &self->priv->connected_adjustment);
-
-    /* Start using the new one */
-    self->priv->connected_adjustment = adjustment;
-    if (self->priv->connected_adjustment != NULL)
-        g_object_add_weak_pointer (G_OBJECT (self->priv->connected_adjustment),
-                                  (gpointer) &self->priv->connected_adjustment);
-}
-
-/**
- * hildon_appview_get_connected_adjustment
- * @self : a #HildonAppView
- * 
- * Retrieves the #GtkAdjustment which is connected to this application view
- * and is changed with increase / decrease hardware buttons.
- *
- * Returns: currently connectd #GtkAdjustment assigned to this
- *               application view or NULL if it's not set
- */
-GtkAdjustment * hildon_appview_get_connected_adjustment (HildonAppView * self)
-{
-    g_return_val_if_fail (HILDON_IS_APPVIEW (self), NULL);
-   
-    return self->priv->connected_adjustment;
-}
-
-
-/**
- * hildon_appview_set_menu_ui
- * @self : a #HildonAppView
- * @ui_string : a #GtkUIManager ui description string
- *
- * Sets the ui description (xml) from which the UIManager creates menus
- * (see @GtkUIManager for details on how to use it)
- */
-void hildon_appview_set_menu_ui(HildonAppView *self, const gchar *ui_string)
-{
-  g_return_if_fail (HILDON_IS_APPVIEW (self));
-  
-  if (ui_string)
-    {
-      if (self->priv->menu_ui)
-        g_free (self->priv->menu_ui);
-      
-      self->priv->menu_ui = g_strdup (ui_string);
-
-      /* FIXME: We should update the menu here, preferrably by a
-       * hildon_app_ensure_menu_update() which re-installs the menu ui
-       * and calls gtk_ui_manager_ensure_update()
-       */
-    }
-  else
-    {
-      /* Reset the UI */
-      if (self->priv->menu_ui)
-        {
-          g_free (self->priv->menu_ui);
-          self->priv->menu_ui = NULL;
-        }
-    }
-
-    g_object_notify (G_OBJECT(self), "menu-ui");
-}
-
-/**
- * hildon_appview_get_menu_ui
- * @self : a #HildonAppView
- *
- * Sets the ui description (xml) from which the UIManager creates menus
- * (see #GtkUIManager for details on how to use it)
- *
- * Returns: currently set ui description
- */
-const gchar *hildon_appview_get_menu_ui(HildonAppView *self)
-{
-  g_return_val_if_fail (HILDON_IS_APPVIEW (self), NULL);
-
-  return (self->priv->menu_ui);
-
-}
-
-/* Called when '+' hardkey is pressed/released */
-void _hildon_appview_increase_button_state_changed (HildonAppView * self,
-                                                   guint newkeytype)
-{
-  self->priv->increase_button_pressed_down = newkeytype;
-
-  /* Transform '+' press into adjustment update (usually scrollbar move) */
-  if ((self->priv->connected_adjustment != NULL) && (newkeytype == GDK_KEY_PRESS))
-    {
-      gfloat clampedvalue = CLAMP (gtk_adjustment_get_value (self->priv->connected_adjustment) + self->priv->connected_adjustment->step_increment,
-                                  self->priv->connected_adjustment->lower,
-                                  self->priv->connected_adjustment->upper - self->priv->connected_adjustment->page_size);
-      gtk_adjustment_set_value (self->priv->connected_adjustment, clampedvalue);                               
-    }   
-
-  g_signal_emit (G_OBJECT (self), appview_signals[INCREASE_BUTTON_EVENT], 0, newkeytype);
-}
-
-/* Called when '-' hardkey is pressed/released */
-void _hildon_appview_decrease_button_state_changed (HildonAppView * self,
-                                                   guint newkeytype)
-{
-  self->priv->decrease_button_pressed_down = newkeytype;
-
-  /* Transform '-' press into adjustment update (usually scrollbar move) */
-  if ((self->priv->connected_adjustment != NULL) && (newkeytype == GDK_KEY_PRESS))
-    {
-      gfloat clampedvalue = CLAMP (gtk_adjustment_get_value (self->priv->connected_adjustment) - self->priv->connected_adjustment->step_increment,
-                                  self->priv->connected_adjustment->lower,
-                                  self->priv->connected_adjustment->upper - self->priv->connected_adjustment->page_size);
-      gtk_adjustment_set_value (self->priv->connected_adjustment, clampedvalue);                               
-    }
-
-  g_signal_emit (G_OBJECT (self), appview_signals[DECREASE_BUTTON_EVENT], 0, newkeytype);
-}
diff --git a/src/hildon-appview.h b/src/hildon-appview.h
deleted file mode 100644 (file)
index bc802ab..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-
-#ifndef __HILDON_APPVIEW_H__
-#define __HILDON_APPVIEW_H__
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gtk/gtkbin.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtktoolbar.h>
-#include <gdk/gdkx.h>
-
-
-G_BEGIN_DECLS
-#define HILDON_TYPE_APPVIEW ( hildon_appview_get_type() )
-#define HILDON_APPVIEW(obj) \
-    (GTK_CHECK_CAST (obj, HILDON_TYPE_APPVIEW, HildonAppView))
-#define HILDON_APPVIEW_CLASS(klass) \
-    (GTK_CHECK_CLASS_CAST ((klass),\
-     HILDON_TYPE_APPVIEW, HildonAppViewClass))
-#define HILDON_IS_APPVIEW(obj) (GTK_CHECK_TYPE (obj, HILDON_TYPE_APPVIEW))
-#define HILDON_IS_APPVIEW_CLASS(klass) \
-    (GTK_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_APPVIEW))
-typedef struct _HildonAppView HildonAppView;
-typedef struct _HildonAppViewClass HildonAppViewClass;
-
-/**
- * HildonAppViewPrivate:
- *
- * This structure contains just internal data. It should not
- * be accessed directly.
- */
-typedef struct _HildonAppViewPrivate HildonAppViewPrivate;
-
-struct _HildonAppView {
-    GtkBin parent;
-
-    /*public*/
-    GtkWidget *vbox;
-
-    /*private*/
-    HildonAppViewPrivate *priv;
-};
-
-struct _HildonAppViewClass {
-    GtkBinClass parent_class;
-    void (*toolbar_changed) (HildonAppView * self);
-    void (*toolbar_toggle_request) (HildonAppView * self);
-    void (*fullscreen_state_change) (HildonAppView * self,
-                                     gboolean is_fullscreen);
-    void (*title_change) (HildonAppView * self);
-    void (*switched_to) (HildonAppView * self);
-    void (*switched_from) (HildonAppView * self);
-    void (*increase_button_event) (HildonAppView * self,
-                                    guint newkeytype);
-    void (*decrease_button_event) (HildonAppView * self,
-                                    guint newkeytype);
-};
-
-
-GType hildon_appview_get_type(void) G_GNUC_CONST;
-GtkWidget *hildon_appview_new(const gchar * title);
-void hildon_appview_add_with_scrollbar(HildonAppView * self,
-                                       GtkWidget * child);
-void hildon_appview_set_fullscreen_key_allowed(HildonAppView * self,
-                                               gboolean allow);
-gboolean hildon_appview_get_fullscreen_key_allowed(HildonAppView * self);
-
-gboolean hildon_appview_get_fullscreen(HildonAppView * self);
-void hildon_appview_set_fullscreen(HildonAppView * self,
-                                   gboolean fullscreen);
-GtkMenu *hildon_appview_get_menu(HildonAppView * self);
-#ifndef HILDON_DISABLE_DEPRECATED
-void hildon_appview_set_toolbar(HildonAppView * self,
-                                GtkToolbar * toolbar);
-GtkToolbar *hildon_appview_get_toolbar(HildonAppView * self);
-#endif
-void hildon_appview_set_title(HildonAppView * self, const gchar * newname);
-const gchar *hildon_appview_get_title(HildonAppView * self);
-
-gboolean _hildon_appview_toggle_menu(HildonAppView * self,
-                                 Time button_event_time);
-gboolean _hildon_appview_menu_visible(HildonAppView * self);
-
-void hildon_appview_set_connected_adjustment (HildonAppView * self,
-                                             GtkAdjustment * adjustment);
-GtkAdjustment * hildon_appview_get_connected_adjustment (HildonAppView * self);
-
-void _hildon_appview_increase_button_state_changed (HildonAppView * self,
-                                                   guint newkeytype);
-void _hildon_appview_decrease_button_state_changed (HildonAppView * self,
-                                                   guint newkeytype);
-
-void hildon_appview_set_menu_ui(HildonAppView *self, const gchar *ui_string);
-const gchar *hildon_appview_get_menu_ui(HildonAppView *self);
-
-G_END_DECLS
-#endif /* HILDON_APPVIEW_H */
diff --git a/src/hildon-dialoghelp.c b/src/hildon-dialoghelp.c
deleted file mode 100644 (file)
index 82f828f..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/**
- * SECTION:hildon-dialoghelp
- * @short_description: A helper which contains a button in a normal dialog to 
- * open a help if required
- * 
- * #HildonDialoghelp is a helper that provides an API for enabling or
- * disabling a help button in the titlebar area of normal dialogs that
- * are derived from GtkDialog. 
- */
-
-#include <stdlib.h>
-#include <gdk/gdkx.h>
-#include "hildon-dialoghelp.h"
-
-static guint help_signal = 0;
-
-static GdkFilterReturn
-handle_xevent(GdkXEvent * xevent, GdkEvent * event, gpointer dialog)
-{
-    XAnyEvent *eventti = xevent;
-
-    if (eventti->type == ClientMessage) {
-        Atom help_atom, wm_atom;
-        Display *disp;
-        XClientMessageEvent *cm;
-
-        disp = GDK_DISPLAY();
-        cm = xevent;
-
-        help_atom = XInternAtom(disp, "_NET_WM_CONTEXT_HELP", True);
-        wm_atom = XInternAtom(disp, "WM_PROTOCOLS", True);
-
-        if (cm->message_type == wm_atom && cm->data.l[0] == help_atom) {
-            /* XClientMessageEvent *cm = xevent; */
-            g_signal_emit(G_OBJECT(dialog), help_signal, 0);
-        }
-
-        return GDK_FILTER_REMOVE;       /* Event handled, don't process
-                                           further */
-    }
-
-    return GDK_FILTER_CONTINUE; /* Event not handled */
-}
-
-/**
- * gtk_dialog_help_enable:
- * @dialog: The dialog for which help is to be enabled.
- *
- * Enables context help button for a given dialog. The signal "help" can be
- * connected to handler by normal GTK methods. Note that this function
- * has to be called before the dialog is shown.
- *
- * The "help" signal itself has no other parameters than the dialog where
- * it is connected to, ie.:
- * void user_function(GtkDialog *dialog, gpointer user_data);
- */
-void gtk_dialog_help_enable(GtkDialog * dialog)
-{
-    GdkWindow *window;
-    GdkDisplay *display;
-    Atom *protocols;
-    Atom *list;
-    Atom helpatom;
-    int amount = 0;
-    int n = 0;
-    int i = 0;
-    int help_enabled = 0;
-    
-    /* Create help signal if it didn't exist */   
-    if (help_signal == 0) {
-        help_signal = g_signal_new("help", GTK_TYPE_DIALOG,
-                                   G_SIGNAL_ACTION, (guint) - 1, NULL,
-                                   NULL, g_cclosure_marshal_VOID__VOID,
-                                   G_TYPE_NONE, 0);
-    }
-
-    g_return_if_fail(GTK_IS_DIALOG(dialog));
-
-    gtk_widget_realize(GTK_WIDGET(dialog));
-    window = GTK_WIDGET(dialog)->window;
-    display = gdk_drawable_get_display (window);
-
-    /* Create a list of atoms stored in GdkWindow */
-    XGetWMProtocols(GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
-                   &list, &amount);
-    
-    protocols = (Atom *) malloc ((amount+1) * sizeof (Atom));
-    helpatom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_CONTEXT_HELP");
-
-    /* Enable the dialoghelp if help_atom is in the atoms' list */
-    for (i=0; i<amount; i++)
-    {
-           protocols[n++] = list[i];
-           if (list[i] == helpatom)
-           {
-                   help_enabled = 1;
-           }
-    }
-    XFree (list);
-
-    /* Add the help_atom to the atoms' list if it was not in it */ 
-    if (!help_enabled)
-    {
-           protocols[n++] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_CONTEXT_HELP");
-    }
-    
-    /* Replace the protocol property of the GdkWindow with the new atoms' list */
-    XSetWMProtocols (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), protocols, n);
-    free (protocols);
-    
-    /* Add a callback function as event filter */ 
-    gdk_window_add_filter(window, handle_xevent, dialog);
-}
-
-
-/**
- * gtk_dialog_help_disable:
- * @dialog: The dialog for which help is to be disabled.
- *
- * Disables context help button for the given dialog.
- **/
-void gtk_dialog_help_disable(GtkDialog * dialog)
-{
-    GdkWindow *window=NULL;
-    GdkDisplay *display;
-    Atom *protocols;
-    Atom *list;
-    Atom helpatom;
-    int amount = 0;
-    int n = 0;
-    int i = 0;
-    
-    g_return_if_fail(GTK_IS_DIALOG(dialog));
-
-    gtk_widget_realize(GTK_WIDGET(dialog));
-    window = GTK_WIDGET(dialog)->window;
-    display = gdk_drawable_get_display (window);
-
-    /* Create a list of atoms stored in GdkWindow */
-    XGetWMProtocols(GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
-                   &list, &amount);
-    
-    helpatom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_CONTEXT_HELP");
-    protocols = (Atom *) malloc (amount * sizeof (Atom));
-
-    /* Remove the help_atom if it is in the atoms' list */
-    for (i=0; i<amount; i++)
-    {
-           if (list[i] != helpatom)
-           {
-                   protocols[n++] = list[i];
-           }
-    }
-    XFree (list);
-    
-    /* Replace the protocol property of the GdkWindow with the new atoms' list */
-    XSetWMProtocols (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window), protocols, n);
-    free (protocols);
-
-    /* Remove the event filter */
-    gdk_window_remove_filter(window, handle_xevent, dialog);
-}
-
-
-
-
diff --git a/src/hildon-dialoghelp.h b/src/hildon-dialoghelp.h
deleted file mode 100644 (file)
index 54dc43f..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __HILDON_DIALOG_HELP_H__
-#define __HILDON_DIALOG_HELP_H__
-
-#include <gtk/gtkdialog.h>
-
-G_BEGIN_DECLS
-
-void gtk_dialog_help_enable  (GtkDialog * dialog);
-void gtk_dialog_help_disable (GtkDialog * dialog);
-
-G_END_DECLS
-
-#endif /* __HILDON_DIALOG_HELP_H__ */
diff --git a/src/hildon-file-handling-note.c b/src/hildon-file-handling-note.c
deleted file mode 100644 (file)
index 4b54c01..0000000
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/**
- * SECTION:hildon-file-handling-note
- * @short_description: Displaying the notification when a move 
- * operation is in progress. 
- * @see_also: #HildonFileHandlingNote
- * 
- * This is the notification displayed when a move operation is in
- * progress.  The notification uses a progress bar to indicate the
- * progress of the operation. For operation containing multiple items, a
- * separe progress bar is shown for each item. The notification has a
- * single button, which allows users to stop the move operation.
- */
-
-#include "hildon-note.h"
-#include "hildon-file-handling-note.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <gtk/gtk.h>
-#include <libintl.h>
-#include <glib.h>
-#include <glib-object.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* Note types */
-#define MOVING_TYPE 0
-#define DELETING_TYPE 1
-#define OPENING_TYPE 2
-#define SAVING_TYPE 3
-
-/*#define _(String) dgettext(PACKAGE, String)*/
-#define _(String) dgettext("hildon-fm", String) /* FIXME: this file should be moved to hildon-fm */
-
-#define HILDON_FILE_HANDLING_NOTE_GET_PRIVATE(obj)\
-        (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
-        HILDON_TYPE_FILE_HANDLING_NOTE, HildonFileHandlingNotePrivate));
-
-typedef struct _HildonFileHandlingNotePrivate
-    HildonFileHandlingNotePrivate;
-
-struct _HildonFileHandlingNotePrivate {
-    guint note_type;
-};
-
-
-static HildonNote *parent_class;
-
-
-/* standard forbids empty source file, therefore the ifdef must be
-   placed here. */
-
-static void
-hildon_file_handling_note_class_init(HildonFileHandlingNoteClass * class);
-
-static void hildon_file_handling_note_init(HildonFileHandlingNote *
-                                           dialog);
-
-static void hildon_file_handling_note_finalize(GObject * obj_self);
-
-
-
-
-GType hildon_file_handling_note_get_type()
-{
-    static GType dialog_type = 0;
-
-    if (!dialog_type) {
-        static const GTypeInfo dialog_info = {
-            sizeof(HildonFileHandlingNoteClass),
-            NULL,       /* base_init */
-            NULL,       /* base_finalize */
-            (GClassInitFunc) hildon_file_handling_note_class_init,
-            NULL,       /* class_finalize */
-            NULL,       /* class_data */
-            sizeof(HildonFileHandlingNote),
-            0,  /* n_preallocs */
-            (GInstanceInitFunc) hildon_file_handling_note_init
-        };
-
-        dialog_type = g_type_register_static(HILDON_TYPE_NOTE,
-                                             "HildonFileHandlingNote",
-                                             &dialog_info, 0);
-    }
-    return dialog_type;
-}
-
-static void
-hildon_file_handling_note_class_init(HildonFileHandlingNoteClass * class)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS(class);
-
-    parent_class = g_type_class_peek_parent(class);
-    g_type_class_add_private(class, sizeof(HildonFileHandlingNotePrivate));
-    object_class->finalize = hildon_file_handling_note_finalize;
-}
-
-static void hildon_file_handling_note_init(HildonFileHandlingNote * dialog)
-{
-    HildonFileHandlingNotePrivate *priv;
-
-    priv = HILDON_FILE_HANDLING_NOTE_GET_PRIVATE(dialog);
-    priv->note_type = OPENING_TYPE;
-}
-
-static void hildon_file_handling_note_finalize(GObject * obj_self)
-{
-    if (G_OBJECT_CLASS(parent_class)->finalize)
-        G_OBJECT_CLASS(parent_class)->finalize(obj_self);
-}
-
-/**
- * hildon_file_handling_note_set_counter_and_name:
- * @note: the #HildonFileHandlingNote widget
- * @current: progress, current item being processed
- * @maximum: maximum value for counter (number of items)
- * @name: filename
- *
- * This function sets current counter value, maximum
- * counter value and filename for dialog 
- *
- * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
- */
-void hildon_file_handling_note_set_counter_and_name(HildonFileHandlingNote
-                                                    * note, guint current,
-                                                    guint maximum,
-                                                    const gchar * name)
-{
-    gchar str[255];
-    HildonNote *p_note = HILDON_NOTE(note);
-    HildonFileHandlingNotePrivate *priv;
-
-    priv = HILDON_FILE_HANDLING_NOTE_GET_PRIVATE(note);
-
-    if (priv->note_type == MOVING_TYPE) {
-      if (maximum == 1)
-        {
-          g_snprintf(str, 255, _("sfil_nw_moving_file"), name);
-          hildon_note_set_button_text(p_note, _("sfil_bd_moving_file"));
-        } else {
-          g_snprintf(str, 255, _("docm_nw_moving_files"),
-                     current, maximum, name);
-          hildon_note_set_button_text(p_note, _("docm_bd_moving_files"));
-        }
-    } else if (priv->note_type == SAVING_TYPE) {
-      if (maximum == 1)
-        {
-          g_snprintf(str, 255, _("docm_nw_saving_file"), name);
-          hildon_note_set_button_text(p_note, _("docm_bd_saving_file"));
-        } else {
-          g_snprintf(str, 255, _("docm_nw_saving_files"),
-                   current, maximum, name);
-          hildon_note_set_button_text(p_note, _("docm_bd_saving_files"));
-        }
-    } else if (priv->note_type == OPENING_TYPE) {
-      if (maximum == 1)
-        {
-          g_snprintf(str, 255, _("docm_nw_opening_file"), name);
-          hildon_note_set_button_text(p_note, _("docm_bd_opening_file"));
-        } else {
-          g_snprintf(str, 255, _("docm_nw_opening_files"),
-                     current, maximum, name);
-          hildon_note_set_button_text(p_note, _("docm_bd_opening_files"));
-        }
-    } else if (priv->note_type == DELETING_TYPE) {
-      if (maximum == 1)
-        {
-          g_snprintf(str, 255, _("docm_nw_deleting_file"), name);
-          hildon_note_set_button_text(p_note, _("docm_bd_deleting_file"));
-        } else {
-          g_snprintf(str, 255, _("docm_nw_deleting_files"),
-                     current, maximum, name);
-          hildon_note_set_button_text(p_note, _("docm_bd_deleting_files"));
-        }
-    }
-
-    g_object_set(p_note, "description", str, NULL);
-}
-
-/**
- * hildon_file_handling_note_set_name:
- * @note: the @HildonFileHandlingNote widget
- * @name: filename
- *
- * This function sets the filename for dialog
- * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
- */
-void hildon_file_handling_note_set_name(HildonFileHandlingNote * note,
-                                        const gchar * name)
-{
-    gchar str[255];
-    HildonNote *p_note = HILDON_NOTE(note);
-    HildonFileHandlingNotePrivate *priv =
-        HILDON_FILE_HANDLING_NOTE_GET_PRIVATE(note);
-
-    if (priv->note_type == MOVING_TYPE) {
-        g_snprintf(str, 255, _("sfil_nw_moving_file"), name);
-    } else if (priv->note_type == SAVING_TYPE) {
-        g_snprintf(str, 255, _("docm_nw_saving_file"), name);
-    } else if (priv->note_type == OPENING_TYPE) {
-        g_snprintf(str, 255, _("docm_nw_opening_file"), name);
-    } else if (priv->note_type == DELETING_TYPE) {
-        g_snprintf(str, 255, _("docm_nw_deleting_file"), name);
-    }
-
-    g_object_set(p_note, "description", str, NULL);
-}
-
-/**
- * hildon_file_handling_note_set_fraction:
- * @note: the @HildonFileHandlingNote widget
- * @frac: value for progress bar
-
- * This function sets fraction value for
- * progress bar.
- * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
- */
-void hildon_file_handling_note_set_fraction(HildonFileHandlingNote * note,
-                                            gfloat frac)
-{
-    GtkWidget *progbar;
-
-    g_object_get(note, "progressbar", &progbar, NULL);
-    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progbar), frac);
-}
-
-/**
- * hildon_file_handling_note_new_moving:
- * @parent: parent GtkWindow 
- *
- * This function creates new dialog
- * which is "moving" type.
- *
- * Returns: a new #HildonFileHandlingNote
- * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
- */
-GtkWidget *hildon_file_handling_note_new_moving(GtkWindow * parent)
-{
-    GtkWidget *progbar;
-    HildonFileHandlingNote *file_note;
-    HildonFileHandlingNotePrivate *priv;
-
-    progbar = gtk_progress_bar_new();
-
-    file_note = g_object_new(HILDON_TYPE_FILE_HANDLING_NOTE,
-                             "note_type", HILDON_NOTE_PROGRESSBAR_TYPE,
-                             "description", _("sfil_nw_moving_file"), 
-                             "progressbar", progbar, NULL);
-
-    priv = HILDON_FILE_HANDLING_NOTE_GET_PRIVATE(file_note);
-    priv->note_type = MOVING_TYPE;
-
-    if (parent != NULL)
-        gtk_window_set_transient_for(GTK_WINDOW(file_note), parent);
-
-    return GTK_WIDGET(file_note);
-}
-
-/**
- * hildon_file_handling_note_new_deleting:
- * @parent: parent GtkWindow 
- *
- * This function creates new dialog
- * which is "deleting" type.
- *
- * Returns: a new #HildonFileHandlingNote
- * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
- */
-GtkWidget *hildon_file_handling_note_new_deleting(GtkWindow * parent)
-{
-    GtkWidget *progbar;
-    HildonFileHandlingNote *file_note;
-    HildonFileHandlingNotePrivate *priv;
-
-    progbar = gtk_progress_bar_new();
-
-    file_note = g_object_new(HILDON_TYPE_FILE_HANDLING_NOTE,
-                             "note_type", HILDON_NOTE_PROGRESSBAR_TYPE,
-                             "description", _("docm_nw_deleting_file"),
-                             "progressbar", progbar, NULL);
-
-    priv = HILDON_FILE_HANDLING_NOTE_GET_PRIVATE(file_note);
-    priv->note_type = DELETING_TYPE;
-
-    if (parent != NULL)
-        gtk_window_set_transient_for(GTK_WINDOW(file_note), parent);
-
-    return GTK_WIDGET(file_note);
-}
-
-/**
- * hildon_file_handling_note_new_opening:
- * @parent: parent GtkWindow 
- *
- * This function creates new dialog
- * which is "opening" type
- *
- * Returns: a new #HildonFileHandlingNote
- * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
- */
-GtkWidget *hildon_file_handling_note_new_opening(GtkWindow * parent)
-{
-    GtkWidget *progbar;
-    HildonFileHandlingNote *file_note;
-    HildonFileHandlingNotePrivate *priv;
-
-    progbar = gtk_progress_bar_new();
-
-    file_note = g_object_new(HILDON_TYPE_FILE_HANDLING_NOTE,
-                             "note_type", HILDON_NOTE_PROGRESSBAR_TYPE,
-                             "description", _("docm_nw_opening_file"),
-                             "progressbar", progbar, NULL);
-
-    priv = HILDON_FILE_HANDLING_NOTE_GET_PRIVATE(file_note);
-    priv->note_type = OPENING_TYPE;
-
-    if (parent != NULL)
-        gtk_window_set_transient_for(GTK_WINDOW(file_note), parent);
-
-    return GTK_WIDGET(file_note);
-}
-
-/**
- * hildon_file_handling_note_new_saving:
- * @parent: parent GtkWindow 
- *
- * This function creates new dialog
- * which is "saving" type.
- *
- * Returns: a new #HildonFileHandlingNote
- * DEPRECATED: use hildon-note instead of hildon-file-handling-note.
- */
-GtkWidget *hildon_file_handling_note_new_saving(GtkWindow * parent)
-{
-    GtkWidget *progbar;
-    HildonFileHandlingNote *file_note;
-    HildonFileHandlingNotePrivate *priv;
-
-    progbar = gtk_progress_bar_new();
-
-    file_note = g_object_new(HILDON_TYPE_FILE_HANDLING_NOTE,
-                             "note_type", HILDON_NOTE_PROGRESSBAR_TYPE,
-                             "description", _("docm_nw_saving_file"),
-                             "progressbar", progbar, NULL);
-
-    priv = HILDON_FILE_HANDLING_NOTE_GET_PRIVATE(file_note);
-    priv->note_type = SAVING_TYPE;
-
-    if (parent != NULL)
-        gtk_window_set_transient_for(GTK_WINDOW(file_note), parent);
-
-    return GTK_WIDGET(file_note);
-}
-
diff --git a/src/hildon-file-handling-note.h b/src/hildon-file-handling-note.h
deleted file mode 100644 (file)
index 4da000b..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-#ifndef __HILDON_FILE_HANDLING_NOTE_H__
-#define __HILDON_FILE_HANDLING_NOTE_H__
-
-
-#ifndef HILDON_DISABLE_DEPRECATED
-
-#include "hildon-note.h"
-
-G_BEGIN_DECLS
-#define HILDON_TYPE_FILE_HANDLING_NOTE \
-  ( hildon_file_handling_note_get_type() )
-#define HILDON_FILE_HANDLING_NOTE(obj) \
-  (GTK_CHECK_CAST (obj, HILDON_TYPE_FILE_HANDLING_NOTE,\
-   HildonFileHandlingNote))
-#define HILDON_FILE_HANDLING_NOTE_CLASS(klass) \
-  (GTK_CHECK_CLASS_CAST ((klass), HILDON_TYPE_FILE_HANDLING_NOTE,\
-   HildonFileHandlingNoteClass))
-#define HILDON_IS_FILE_HANDLING_NOTE(obj) (GTK_CHECK_TYPE (obj,\
-  HILDON_TYPE_FILE_HANDLING_NOTE))
-#define HILDON_IS_FILE_HANDLING_NOTE_CLASS(klass) \
-  (GTK_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_FILE_HANDLING_NOTE))
-typedef struct _HildonFileHandlingNote HildonFileHandlingNote;
-typedef struct _HildonFileHandlingNoteClass HildonFileHandlingNoteClass;
-
-struct _HildonFileHandlingNote {
-    HildonNote parent;
-};
-
-struct _HildonFileHandlingNoteClass {
-    HildonNoteClass parent_class;
-};
-
-/* Note creation functions */
-GtkWidget *hildon_file_handling_note_new_moving(GtkWindow * parent);
-GtkWidget *hildon_file_handling_note_new_deleting(GtkWindow * parent);
-GtkWidget *hildon_file_handling_note_new_opening(GtkWindow * parent);
-GtkWidget *hildon_file_handling_note_new_saving(GtkWindow * parent);
-
-/* Function for progressbar status setting */
-void hildon_file_handling_note_set_fraction(HildonFileHandlingNote * note,
-                                            gfloat frac);
-void hildon_file_handling_note_set_counter_and_name(HildonFileHandlingNote
-                                                    * note, guint current,
-                                                    guint maximum,
-                                                    const gchar * name);
-void hildon_file_handling_note_set_name(HildonFileHandlingNote * note,
-                                        const gchar * name);
-
-GType hildon_file_handling_note_get_type(void);
-
-G_END_DECLS
-#endif /* HILDON_DISABLE_DEPRECATED */
-
-#endif /* __HILDON_FILE_HANDLING_NOTE_H__ */
diff --git a/src/hildon-grid-item-private.h b/src/hildon-grid-item-private.h
deleted file mode 100644 (file)
index 23ed7db..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/*
- * @file hildon-grid-item-private.h
- *
- * This file is a private header file for he implementation of
- * HildonGridItem. HildonGridItem is an item mainly used in HildonGrid. It
- * has an icon, emblem and a label. This private header file exists so that
- * grid can call semi-public functions of an item.
- */
-
-#ifndef __HILDON_GRID_ITEM_PRIVATE_H__
-#define __HILDON_GRID_ITEM_PRIVATE_H__
-
-#include <hildon-widgets/hildon-grid-item.h>
-
-G_BEGIN_DECLS
-
-
-void _hildon_grid_item_set_label(HildonGridItem *item,
-                                 const gchar *label);
-
-void _hildon_grid_item_set_emblem_size(HildonGridItem *item,
-                                       const gint emblem_size);
-void _hildon_grid_item_set_label_pos(HildonGridItem *item,
-                                     HildonGridPositionType label_pos);
-
-void _hildon_grid_item_set_icon_size(HildonGridItem *item,
-                                     HildonGridItemIconSizeType icon_size);
-
-void _hildon_grid_item_set_focus_margin(HildonGridItem *item,
-                                        const gint focus_margin);
-void _hildon_grid_item_set_label_height(HildonGridItem *item,
-                                        const gint label_height);
-void _hildon_grid_item_set_label_icon_margin(HildonGridItem *item,
-                                             const gint label_icon_margin);
-void _hildon_grid_item_set_icon_width(HildonGridItem *item,
-                                      const gint icon_width);
-void _hildon_grid_item_set_icon_height(HildonGridItem *item,
-                                       const gint icon_height);
-void _hildon_grid_item_set_label_height(HildonGridItem *item,
-                                       const gint label_height);
-
-void _hildon_grid_item_done_updating_settings(HildonGridItem *item);
-
-
-G_END_DECLS
-
-#endif /* __HILDON_GRID_ITEM_PRIVATE_H__ */
diff --git a/src/hildon-grid-item.c b/src/hildon-grid-item.c
deleted file mode 100644 (file)
index 2edd68c..0000000
+++ /dev/null
@@ -1,1020 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/**
- * SECTION:hildon-grid-item
- * @short_description: Creating grid items used by #HildonGrid
- * @see_also: #HildonGrid
- *
- * HildonGridItem is used to create grid items used by #HildonGrid.  The
- * grid item consists of an icon and a label. Based on the displaying
- * mode employed by #HildonGrid, the label is justified to the right or
- * the bottom.
- */
-
-/*
- * TODO:
- * - play with libtool to get _-functions private but accesable from grid
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <gtk/gtklabel.h>
-#include <gtk/gtkicontheme.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtkmisc.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkenums.h>
-#include <pango/pango.h>
-
-#include "hildon-grid-item-private.h"
-#include <hildon-widgets/hildon-grid-item.h>
-
-#include <libintl.h>
-#define _(String) dgettext(PACKAGE, String)
-
-#define HILDON_GRID_ITEM_GET_PRIVATE(obj) \
-        (G_TYPE_INSTANCE_GET_PRIVATE ((obj), HILDON_TYPE_GRID_ITEM, \
-                                      HildonGridItemPrivate))
-
-typedef struct _HildonGridItemPrivate HildonGridItemPrivate;
-
-
-/* Default icon. */
-#define DEFAULT_ICON_BASENAME   "qgn_list_gene_unknown_file"
-#define HILDON_GRID_ICON_SIZE         26
-#define HILDON_GRID_EMBLEM_SIZE       16
-
-/* Use some alpha-thing for emblems. */
-#define USE_DIRTY_ALPHA
-
-struct _HildonGridItemPrivate {
-    gchar *icon_basename;
-    gint icon_size;
-    GtkWidget *icon;
-
-    gchar *emblem_basename;
-    gint emblem_size;
-
-    GtkWidget *label;   /* TODO use pango! */
-    HildonGridPositionType label_pos;
-
-    gint focus_margin;
-    gint label_height;
-    gint label_icon_margin;
-    gint column_margin;
-    gint icon_width;
-    gint icon_height;
-    gint row_height;
-
-    gint pending_icon_size;
-    gint pending_emblem_size;
-    HildonGridPositionType pending_label_pos;
-    gint pending_focus_margin;
-    gint pending_label_height;
-    gint pending_label_icon_margin;
-    gint pending_icon_width;
-    gint pending_icon_height;
-
-    gboolean selected;
-};
-
-enum{
-    PROP_NONE = 0,
-    PROP_EMBLEM_TYPE,
-    PROP_ICON_BASENAME
-};
-
-/* Prototypes. */
-static void hildon_grid_item_class_init(HildonGridItemClass * klass);
-static void hildon_grid_item_init(HildonGridItem * item);
-static gboolean hildon_grid_item_expose(GtkWidget * widget,
-                                        GdkEventExpose * event);
-static void hildon_grid_item_size_request(GtkWidget * widget,
-                                          GtkRequisition * requisition);
-static void hildon_grid_item_size_allocate(GtkWidget * widget,
-                                           GtkAllocation * allocation);
-static void hildon_grid_item_forall(GtkContainer * container,
-                                    gboolean include_int,
-                                    GtkCallback callback,
-                                    gpointer callback_data);
-static void hildon_grid_item_remove(GtkContainer * container,
-                                    GtkWidget * child);
-
-static void hildon_grid_item_finalize(GObject * object);
-
-static void update_icon(HildonGridItem * item);
-static void set_label_justify(HildonGridItem * item);
-
-static void hildon_grid_item_set_icon_size(HildonGridItem *item,
-                                   HildonGridItemIconSizeType icon_size);
-
-static void hildon_grid_item_set_property(GObject * object,
-                                             guint prop_id,
-                                             const GValue * value,
-                                             GParamSpec * pspec);
-
-static void hildon_grid_item_get_property(GObject * object,
-                                             guint prop_id, GValue * value,
-                                             GParamSpec * pspec);
-
-
-static GtkContainerClass *parent_class = NULL;
-
-/* Private functions */
-static void
-hildon_grid_item_set_property(GObject * object,
-                                 guint prop_id,
-                                 const GValue * value, GParamSpec * pspec)
-{
-  HildonGridItem *item = HILDON_GRID_ITEM(object);
-  HildonGridItemPrivate *priv;
-  
-  priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-  
-  switch (prop_id) {
-  case PROP_EMBLEM_TYPE:
-    hildon_grid_item_set_emblem_type(item, g_value_get_string(value));
-    break;
-  case PROP_ICON_BASENAME:
-    if(priv->icon_basename)
-      g_free(priv->icon_basename);
-
-    priv->icon_basename = g_strdup(g_value_get_string(value));
-    update_icon(item);
-
-    break;
-  default:
-    G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-    break;
-  }
-}
-  
-static void
-hildon_grid_item_get_property(GObject * object,
-                                 guint prop_id,
-                                 GValue * value, GParamSpec * pspec)
-{
-    HildonGridItem *item = HILDON_GRID_ITEM(object);
-    HildonGridItemPrivate *priv;
-    const gchar *string;
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    
-    switch (prop_id) {
-    case PROP_EMBLEM_TYPE:
-      string = hildon_grid_item_get_emblem_type(item);
-      g_value_set_string(value, string);
-      break;
-    case PROP_ICON_BASENAME:
-      g_value_set_string(value, priv->icon_basename);
-      break;
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-      break;
-    }
-}
-
-
-GType
-hildon_grid_item_get_type(void)
-{
-    static GType grid_item_type = 0;
-
-    if (!grid_item_type) {
-        static const GTypeInfo grid_item_info = {
-            sizeof(HildonGridItemClass),
-            NULL,       /* base_init */
-            NULL,       /* base_finalize */
-            (GClassInitFunc) hildon_grid_item_class_init,
-            NULL,       /* class_finalize */
-            NULL,       /* class_data */
-            sizeof(HildonGridItem),
-            0,  /* n_preallocs */
-            (GInstanceInitFunc) hildon_grid_item_init,
-        };
-        grid_item_type = g_type_register_static(GTK_TYPE_CONTAINER,
-                                                "HildonGridItem",
-                                                &grid_item_info, 0);
-    }
-
-    return grid_item_type;
-}
-
-static void
-hildon_grid_item_class_init(HildonGridItemClass *klass)
-{
-    GtkWidgetClass *widget_class;
-    GtkContainerClass *container_class;
-    GObjectClass *gobject_class;
-
-    widget_class = GTK_WIDGET_CLASS(klass);
-    gobject_class = G_OBJECT_CLASS(klass);
-    container_class = GTK_CONTAINER_CLASS(klass);
-
-    parent_class = g_type_class_peek_parent(klass);
-
-    g_type_class_add_private(klass, sizeof(HildonGridItemPrivate));
-
-    gobject_class->finalize = hildon_grid_item_finalize;
-
-    widget_class->expose_event = hildon_grid_item_expose;
-    widget_class->size_request = hildon_grid_item_size_request;
-    widget_class->size_allocate = hildon_grid_item_size_allocate;
-
-    container_class->forall = hildon_grid_item_forall;
-    container_class->remove = hildon_grid_item_remove;
-  
-    gobject_class->set_property = hildon_grid_item_set_property;
-    gobject_class->get_property = hildon_grid_item_get_property;
-  
-    g_object_class_install_property 
-      (gobject_class, 
-       PROP_EMBLEM_TYPE, 
-       g_param_spec_string ("emblem-type",
-                           "Emblem Type",
-                           "The emblem's basename",
-                           NULL,
-                           G_PARAM_WRITABLE));
-
-    g_object_class_install_property 
-      (gobject_class, 
-       PROP_ICON_BASENAME, 
-       g_param_spec_string ("icon-basename",
-          "Icon Basename",
-          "The icon's basename",
-          NULL,
-          G_PARAM_WRITABLE));
-  
-}
-
-static void
-hildon_grid_item_init(HildonGridItem *item)
-{
-    HildonGridItemPrivate *priv;
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-
-    priv->icon_basename = NULL;
-    priv->pending_icon_size = priv->icon_size = HILDON_GRID_ICON_SIZE;
-    priv->icon = NULL;
-
-    priv->emblem_basename = NULL;
-    priv->pending_emblem_size = priv->emblem_size = HILDON_GRID_EMBLEM_SIZE;
-
-    priv->label = NULL;
-    priv->pending_label_pos = priv->label_pos =
-        HILDON_GRID_ITEM_LABEL_POS_BOTTOM;
-
-    priv->selected = FALSE;
-
-    priv->pending_focus_margin = priv->focus_margin = 6;
-    priv->pending_label_height = priv->label_height = 30;
-    priv->pending_label_icon_margin = priv->label_icon_margin = 6;
-    priv->pending_icon_width = priv->icon_width = 64;
-    priv->pending_icon_height = priv->icon_height = 54;
-    priv->pending_label_height = priv->label_height = 30;
-
-
-    GTK_WIDGET_SET_FLAGS(GTK_WIDGET(item), GTK_CAN_FOCUS);
-
-    priv->label = gtk_label_new(NULL);
-    gtk_widget_set_name(priv->label, "hildon-grid-item-label");
-    gtk_widget_set_parent(priv->label, GTK_WIDGET(item));
-
-    update_icon(item);
-    set_label_justify(item);
-
-    gtk_widget_show(priv->label);
-}
-
-/**
- * hildon_grid_item_new:
- * @icon_basename:  icon base name
- *
- * Creates a new #HildonGridItem.
- *
- * Returns: a new #HildonGridItem
- */
-GtkWidget *
-hildon_grid_item_new(const gchar *icon_basename)
-{
-    HildonGridItem *item;
-
-    item = g_object_new(HILDON_TYPE_GRID_ITEM, "icon-basename", icon_basename, NULL);
-
-    return GTK_WIDGET(item);
-}
-
-/**
- * hildon_grid_item_new_with_label:
- * @icon_basename:  icon base name
- * @label:          text label for icon
- *
- * Creates a new #HildonGridItem with a specified label for the icon.
- *
- * Returns: a new #HildonGridItem
- */
-GtkWidget *
-hildon_grid_item_new_with_label(const gchar *icon_basename,
-                                const gchar *label)
-{
-    HildonGridItem *item;
-
-    item = g_object_new(HILDON_TYPE_GRID_ITEM,  "icon-basename", icon_basename, NULL);
-
-    hildon_grid_item_set_label(item, label);
-
-    return GTK_WIDGET(item);
-}
-
-
-static void
-update_icon(HildonGridItem *item)
-{
-    GtkIconTheme *icon_theme;
-    GdkPixbuf *icon;
-    GdkPixbuf *emblem_icon;
-    HildonGridItemPrivate *priv;
-    GError *error;
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-
-    if (priv->icon != NULL) {
-        if (GTK_WIDGET_VISIBLE(priv->icon))
-            gtk_widget_hide(priv->icon);
-        gtk_widget_unparent(priv->icon);
-    }
-
-    icon_theme = gtk_icon_theme_get_default();
-
-    /* Load icon. Fall to default if loading fails. */
-    icon = NULL;
-    if (priv->icon_basename)
-      {
-       error = NULL;
-       icon = gtk_icon_theme_load_icon(icon_theme,
-                                       priv->icon_basename,
-                                       priv->icon_size, 0, &error);
-       if (icon == NULL) {
-         g_warning("Couldn't load icon \"%s\": %s", priv->icon_basename,
-                   error->message);
-         g_error_free(error);
-       }
-      }
-
-    if (icon == NULL) {
-        error = NULL;
-        icon = gtk_icon_theme_load_icon(icon_theme,
-                                        DEFAULT_ICON_BASENAME,
-                                        priv->icon_size, 0, &error);
-        if (icon == NULL) {
-            g_warning("Couldn't load default icon: %s!\n", error->message);
-            g_error_free(error);
-        }
-    }
-    priv->icon_width = gdk_pixbuf_get_width(icon);
-    priv->icon_height = gdk_pixbuf_get_height(icon);
-
-
-    /* Load and merge emblem if one is specified. */
-    if (priv->emblem_basename != NULL) {
-        error = NULL;
-        emblem_icon = gtk_icon_theme_load_icon(icon_theme,
-                                               priv->emblem_basename,
-                                               priv->emblem_size,
-                                               0, &error);
-        if (emblem_icon == NULL) {
-            g_warning("Couldn't load emblem \"%s\": %s",
-                      priv->emblem_basename, error->message);
-            g_error_free(error);
-        } else {
-            gint icon_height;
-            gint width, height, y;
-
-#ifdef USE_DIRTY_ALPHA
-            GdkPixbuf *tmp;
-#endif
-
-            icon_height = gdk_pixbuf_get_height(icon);
-            width = MIN(gdk_pixbuf_get_width(emblem_icon),
-                        gdk_pixbuf_get_width(icon));
-            height = MIN(gdk_pixbuf_get_height(emblem_icon), icon_height);
-            y = icon_height - height;
-#ifndef USE_DIRTY_ALPHA
-            gdk_pixbuf_copy_area(emblem_icon, 0, 0, width, height,
-                                 icon, 0, y);
-#else
-            /* 
-             * Using composite to copy emblem to lower left corner creates
-             * some garbage on top of emblem. This way it can be avoided.
-             */
-            tmp = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE,
-                                 8, width, icon_height);
-            gdk_pixbuf_fill(tmp, 0x00000000);
-            gdk_pixbuf_copy_area(emblem_icon, 0, 0, width, height,
-                                 tmp, 0, y);
-            gdk_pixbuf_composite(tmp, icon,
-                                 0, 0, width, icon_height,
-                                 0.0, 0.0, 1.0, 1.0,
-                                 GDK_INTERP_NEAREST, 255);
-            g_object_unref(tmp);
-#endif /* ifndef else USE_DIRTY_ALPHA */
-            g_object_unref(emblem_icon);
-        }
-    }
-
-    priv->icon = gtk_image_new_from_pixbuf(icon);
-    g_object_unref(icon);
-
-    gtk_widget_set_parent(priv->icon, GTK_WIDGET(item));
-    gtk_widget_show(priv->icon);
-
-    gtk_widget_queue_draw(priv->icon);
-}
-
-void
-hildon_grid_item_set_label(HildonGridItem *item, const gchar *label)
-{
-    HildonGridItemPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
-
-    if (label == NULL)
-      label = "";
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    if (strcmp (gtk_label_get_label (GTK_LABEL (priv->label)), label) == 0)
-      return;
-    gtk_label_set_label(GTK_LABEL(priv->label), label);
-}
-
-static void
-hildon_grid_item_set_icon_size(HildonGridItem             *item,
-                               HildonGridItemIconSizeType icon_size)
-{
-    HildonGridItemPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    if (priv->pending_icon_size == icon_size) {
-        return;
-    }
-    priv->pending_icon_size = icon_size;
-}
-
-
-void
-_hildon_grid_item_set_label_pos(HildonGridItem          *item,
-                                HildonGridPositionType  label_pos)
-{
-    HildonGridItemPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    if (priv->pending_label_pos == label_pos) {
-        return;
-    }
-    priv->pending_label_pos = label_pos;
-}
-
-
-void
-_hildon_grid_item_set_emblem_size(HildonGridItem *item, gint emblem_size)
-{
-    HildonGridItemPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    if (priv->pending_emblem_size == emblem_size) {
-        return;
-    }
-    priv->pending_emblem_size = emblem_size;
-}
-
-
-void
-_hildon_grid_item_set_focus_margin(HildonGridItem *item,
-                                   const gint focus_margin)
-{
-    HildonGridItemPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    if (priv->pending_focus_margin == focus_margin) {
-        return;
-    }
-    priv->pending_focus_margin = focus_margin;
-}
-
-
-void
-_hildon_grid_item_set_label_height(HildonGridItem *item,
-                                   const gint label_height)
-{
-    HildonGridItemPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    if (priv->pending_label_height == label_height) {
-        return;
-    }
-    priv->pending_label_height = label_height;
-}
-
-
-void
-_hildon_grid_item_set_label_icon_margin(HildonGridItem *item,
-                                        const gint label_icon_margin)
-{
-    HildonGridItemPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    if (priv->pending_label_icon_margin == label_icon_margin) {
-        return;
-    }
-    priv->pending_label_icon_margin = label_icon_margin;
-}
-
-
-void
-_hildon_grid_item_set_icon_height(HildonGridItem *item,
-                                  const gint icon_height)
-{
-    HildonGridItemPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    if (priv->pending_icon_height == icon_height) {
-        return;
-    }
-    priv->pending_icon_height = icon_height;
-}
-
-
-void
-_hildon_grid_item_set_icon_width(HildonGridItem *item,
-                                 const gint icon_width)
-{
-    HildonGridItemPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
-
-    hildon_grid_item_set_icon_size(item, icon_width);
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    if (priv->pending_icon_width == icon_width) {
-        return;
-    }
-    priv->pending_icon_width = icon_width;
-}
-
-
-static void
-set_label_justify(HildonGridItem *item)
-{
-    HildonGridItemPrivate *priv;
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-
-    if (priv->label != NULL) {
-        switch (priv->label_pos) {
-        case HILDON_GRID_ITEM_LABEL_POS_BOTTOM:
-            gtk_misc_set_alignment(GTK_MISC(priv->label), 0.5, 0.5);
-            break;
-
-        case HILDON_GRID_ITEM_LABEL_POS_RIGHT:
-            gtk_misc_set_alignment(GTK_MISC(priv->label), 0.0, 0.5);
-            break;
-
-        default:
-            g_warning("Invalid position!");
-            break;
-        }
-    }
-}
-
-static void
-hildon_grid_item_remove(GtkContainer *container, GtkWidget *child)
-{
-    HildonGridItem *item;
-    HildonGridItemPrivate *priv;
-
-    item = HILDON_GRID_ITEM(container);
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-
-    g_return_if_fail(GTK_IS_WIDGET(child));
-    g_return_if_fail(child == priv->label || child == priv->icon);
-
-    if (child == priv->label) {
-        gtk_widget_unparent(child);
-        priv->label = NULL;
-    } else if (child == priv->icon) {
-        gtk_widget_unparent(child);
-        priv->icon = NULL;
-    }
-}
-
-static gboolean
-hildon_grid_item_expose(GtkWidget *widget, GdkEventExpose *event)
-{
-    HildonGridItem *item;
-    HildonGridItemPrivate *priv;
-
-    g_return_val_if_fail(widget, FALSE);
-    g_return_val_if_fail(HILDON_IS_GRID_ITEM(widget), FALSE);
-    g_return_val_if_fail(event, FALSE);
-
-    item = HILDON_GRID_ITEM(widget);
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-
-    if (priv->label == NULL && priv->icon == NULL) {
-        return FALSE;
-    }
-    if (GTK_WIDGET_HAS_FOCUS(GTK_WIDGET(item))) {
-        GdkRectangle clip;
-        GtkWidget *focused;
-        
-        if (priv->label != NULL) {
-            focused = priv->label;
-        } else {
-            focused = priv->icon;
-        }
-
-       /* Determine the coordinates and size of clip */ 
-        switch (priv->label_pos) {
-        case HILDON_GRID_ITEM_LABEL_POS_BOTTOM:
-            clip.x = focused->allocation.x - priv->focus_margin;
-            clip.y = focused->allocation.y;
-            clip.width = focused->allocation.width + priv->focus_margin * 2;
-            clip.height = focused->allocation.height;
-            if (clip.x < widget->allocation.x ||
-                clip.width > widget->allocation.width) {
-                clip.x = widget->allocation.x;
-                clip.width = widget->allocation.width;
-            }
-            if (clip.y + clip.height >
-                widget->allocation.y + widget->allocation.height) {
-                clip.height = widget->allocation.y +
-                    widget->allocation.height - clip.y;
-            }
-            break;
-
-        case HILDON_GRID_ITEM_LABEL_POS_RIGHT:
-            clip.x = widget->allocation.x;
-            clip.y = widget->allocation.y;
-            clip.width = widget->allocation.width;
-            clip.height = widget->allocation.height;
-            break;
-        }
-
-       /* Build painting box for the exposure event */
-        gtk_paint_box(focused->style,
-                      gtk_widget_get_toplevel(focused)->window,
-                      GTK_STATE_SELECTED,
-                      GTK_SHADOW_NONE,
-                      &clip, focused, "selected",
-                      clip.x, clip.y, clip.width, clip.height);
-    }
-
-    /* 
-     * Items are not exposed unless they are visible.
-     * -> No need to "optimize" by checking if they need exposing.
-     */
-    gtk_container_propagate_expose(GTK_CONTAINER(widget),
-                                   priv->icon, event);
-    gtk_container_propagate_expose(GTK_CONTAINER(widget),
-                                   priv->label, event);
-    return TRUE;
-}
-
-
-static void
-hildon_grid_item_size_request(GtkWidget *widget, GtkRequisition *requisition)
-{
-    HildonGridItem *item;
-    HildonGridItemPrivate *priv;
-    GtkRequisition label_req;
-    gint label_margin;
-
-    item = HILDON_GRID_ITEM(widget);
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-
-    label_margin = priv->focus_margin;
-
-    gtk_widget_size_request(priv->icon, requisition);
-    gtk_widget_size_request(priv->label, &label_req);
-
-    switch (priv->label_pos) {
-    case HILDON_GRID_ITEM_LABEL_POS_BOTTOM:
-        requisition->width = MAX(requisition->width, label_req.width);
-        requisition->height += label_req.height + label_margin;
-        break;
-
-    case HILDON_GRID_ITEM_LABEL_POS_RIGHT:
-        requisition->width += label_req.width + label_margin;
-        requisition->height = MAX(requisition->height, label_req.height);
-        break;
-    default:
-        g_warning("bad position");
-        return;
-        break;
-    }
-}
-
-static void
-hildon_grid_item_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
-{
-    HildonGridItem *item;
-    HildonGridItemPrivate *priv;
-    GtkRequisition l_req;
-    GtkAllocation i_alloc, l_alloc;
-
-    g_return_if_fail(widget);
-    g_return_if_fail(allocation);
-
-    item = HILDON_GRID_ITEM(widget);
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-    widget->allocation = *allocation;
-
-    /* If creating label and icon failed, don't show a thing... */
-    if (priv->label == NULL && priv->icon == NULL) {
-        return;
-    }
-    if (priv->label != NULL) {
-        gtk_widget_get_child_requisition(priv->label, &l_req);
-    } else {
-        l_req.width = l_req.height = 0;
-    }
-
-    /* Determine icon and label allocation based on label position */
-    switch (priv->label_pos) {
-    case HILDON_GRID_ITEM_LABEL_POS_BOTTOM:
-        i_alloc.x = (allocation->width - priv->icon_width) / 2 +
-            allocation->x;
-        if (priv->label != NULL) {
-            i_alloc.y = allocation->y + (allocation->height -
-                                         priv->label_height -
-                                         priv->label_icon_margin -
-                                         priv->icon_height) / 2;
-        } else {
-            i_alloc.y = (allocation->height - priv->icon_height) / 2 +
-                allocation->y;
-        }
-
-        if (priv->label != NULL) {
-            l_alloc.x = allocation->x + priv->focus_margin;
-            l_alloc.y = i_alloc.y + priv->icon_height +
-                priv->label_icon_margin;
-            l_alloc.width = allocation->width - priv->focus_margin * 2;
-            l_alloc.height = priv->label_height;
-        }
-        break;
-
-    case HILDON_GRID_ITEM_LABEL_POS_RIGHT:
-        i_alloc.x = allocation->x + priv->focus_margin;
-        i_alloc.y = allocation->y +
-          (priv->label_height - priv->icon_height) / 2;
-
-        if (priv->label != NULL) {
-            l_alloc.x = allocation->x + priv->focus_margin +
-                priv->icon_width + priv->label_icon_margin;
-            l_alloc.y = allocation->y;
-            l_alloc.width = allocation->width - priv->focus_margin * 2 -
-                priv->label_icon_margin - priv->icon_width;
-            l_alloc.height = priv->label_height;
-        }
-        break;
-    default:
-        g_warning("bad label position");
-        return;
-        break;
-    }
-
-    if (i_alloc.y < allocation->y) {
-        i_alloc.height -= i_alloc.height - allocation->height;
-        i_alloc.y = allocation->y;
-    }
-    if (i_alloc.y + i_alloc.height > allocation->y + allocation->height) {
-        i_alloc.height-= i_alloc.y + i_alloc.height -
-            allocation->y - allocation->height;
-    }
-      
-
-    i_alloc.width = priv->icon_width;
-    i_alloc.height = priv->icon_height;
-
-    if (priv->label != NULL) {
-        gtk_widget_size_allocate(priv->label, &l_alloc);
-    }
-    if (priv->icon != NULL) {
-        gtk_widget_size_allocate(priv->icon, &i_alloc);
-    }
-}
-
-static void
-hildon_grid_item_forall(GtkContainer    *container,
-                        gboolean        include_int,
-                        GtkCallback     callback,
-                        gpointer        callback_data)
-{
-    HildonGridItem *item;
-    HildonGridItemPrivate *priv;
-
-    g_return_if_fail(container);
-    g_return_if_fail(callback);
-
-    item = HILDON_GRID_ITEM(container);
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-
-    /* Connect callback functions to the item */
-    if (priv->icon != NULL) {
-        (*callback) (priv->icon, callback_data);
-    }
-    if (priv->label != NULL) {
-        (*callback) (priv->label, callback_data);
-    }
-}
-
-static void
-hildon_grid_item_finalize(GObject *object)
-{
-    HildonGridItem *item;
-    HildonGridItemPrivate *priv;
-
-    item = HILDON_GRID_ITEM(object);
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-
-    g_free(priv->icon_basename);
-    if (priv->emblem_basename != NULL) {
-        g_free(priv->emblem_basename);
-    }
-
-    G_OBJECT_CLASS(parent_class)->finalize(object);
-}
-
-#if 0
-static int hildon_time_get_font_width(GtkWidget * widget)
-{
-    PangoContext *context;
-    PangoFontMetrics *metrics;
-    gint digit_width;
-
-    context = gtk_widget_get_pango_context(widget);
-    metrics = pango_context_get_metrics(context,
-                                        widget->style->font_desc,
-                                        pango_context_get_language
-                                        (context));
-
-    digit_width = pango_font_metrics_get_approximate_digit_width(metrics);
-    digit_width = PANGO_PIXELS(digit_width);
-
-    pango_font_metrics_unref(metrics);
-
-    return digit_width;
-}
-#endif
-
-
-/**
- * hildon_grid_item_set_emblem_type:
- * @item:               #HildonGridItem
- * @emblem_basename:    emblem's basename
- *
- * Sets item emblem type.
- */
-void
-hildon_grid_item_set_emblem_type(HildonGridItem *item,
-                                 const gchar *emblem_basename)
-{
-    HildonGridItemPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
-
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-
-    if (priv->emblem_basename != NULL) {
-        g_free(priv->emblem_basename);
-    }
-
-    priv->emblem_basename = g_strdup(emblem_basename);
-
-    update_icon(item);
-
-    g_object_notify (G_OBJECT (item), "emblem-type");
-}
-
-/**
- * hildon_grid_item_get_emblem_type:
- * @item:   #HildonGridItem
- *
- * Returns: emblem's basename. Must not be changed or freed.
- */
-const gchar *
-hildon_grid_item_get_emblem_type(HildonGridItem *item)
-{
-    g_return_val_if_fail(HILDON_IS_GRID_ITEM(item), NULL);
-
-    return HILDON_GRID_ITEM_GET_PRIVATE(item)->emblem_basename;
-}
-
-
-
-void
-_hildon_grid_item_done_updating_settings(HildonGridItem *item)
-{
-    gboolean need_update_icon;
-    gboolean need_resize;
-
-    HildonGridItemPrivate *priv;
-    g_return_if_fail(HILDON_IS_GRID_ITEM(item));
-    priv = HILDON_GRID_ITEM_GET_PRIVATE(item);
-
-    need_update_icon = need_resize = FALSE;
-    
-    if (priv->pending_icon_size != priv->icon_size) {
-        if (priv->pending_icon_size > 0) {
-            priv->icon_size = priv->pending_icon_size;
-        } else {
-            priv->icon_size = 1;
-        }
-        need_update_icon = TRUE;
-    }
-    if (priv->pending_emblem_size != priv->emblem_size) {
-        priv->emblem_size = priv->pending_emblem_size;
-        need_update_icon = TRUE;
-    }
-    if (priv->pending_label_pos != priv->label_pos) {
-        priv->label_pos = priv->pending_label_pos;
-        /* No refresh here, grid will do it. */
-        set_label_justify(item);
-    }
-    /*
-     * grid will take care of this
-     *
-    if (priv->pending_focus_margin != priv->focus_margin) {
-        priv->focus_margin = priv->pending_focus_margin;
-        need_resize = TRUE;
-    }
-    if (priv->pending_label_height != priv->label_height) {
-        priv->label_height = priv->pending_label_height;
-        need_resize = TRUE;
-    }
-    if (priv->pending_label_icon_margin != priv->label_icon_margin) {
-        priv->label_icon_margin = priv->pending_label_icon_margin;
-        need_resize = TRUE;
-    }
-    if (priv->pending_icon_height != priv->icon_height) {
-        priv->icon_height = priv->pending_icon_height;
-        need_resize = TRUE;
-    }
-    if (priv->pending_icon_width != priv->icon_width) {
-        priv->icon_width = priv->pending_icon_width;
-        need_resize = TRUE;
-    }
-     */
-
-    if (need_update_icon == TRUE) {
-        update_icon(HILDON_GRID_ITEM(item));
-    }
-    /*
-    if (need_resize == TRUE) {
-        gtk_widget_queue_resize(GTK_WIDGET(item));
-    }
-    */
-}
diff --git a/src/hildon-grid-item.h b/src/hildon-grid-item.h
deleted file mode 100644 (file)
index 89a5984..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/*
- * @file hildon-grid-item.h
- *
- * This file is a header file for he implementation of HildonGridItem.
- * HildonGridItem is an item mainly used in HildonGrid. It has an icon,
- * emblem and a label.
- */
-
-#ifndef __HILDON_GRID_ITEM_H__
-#define __HILDON_GRID_ITEM_H__
-
-#include <gtk/gtkcontainer.h>
-#include <gtk/gtkitem.h>
-
-G_BEGIN_DECLS
-#define HILDON_TYPE_GRID_ITEM       (hildon_grid_item_get_type ())
-#define HILDON_GRID_ITEM(obj)       (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                                            HILDON_TYPE_GRID_ITEM, \
-                                            HildonGridItem))
-#define HILDON_GRID_ITEM_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass),\
-                                                HILDON_TYPE_GRID_ITEM, \
-                                                HildonGridItemClass))
-#define HILDON_IS_GRID_ITEM(obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                                            HILDON_TYPE_GRID_ITEM))
-#define HILDON_IS_GRID_ITEM_CLASS(klass) \
-        (G_TYPE_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_GRID_ITEM))
-#define HILDON_GRID_ITEM_GET_CLASS(obj) \
-        (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-         HILDON_TYPE_GRID_ITEM, HildonGridItemClass))
-
-typedef enum {
-    HILDON_GRID_ITEM_LABEL_POS_BOTTOM = 1,
-    HILDON_GRID_ITEM_LABEL_POS_RIGHT
-} HildonGridPositionType;
-
-typedef enum {
-    HILDON_GRID_ITEM_ICON_27x27 = 1,
-    HILDON_GRID_ITEM_ICON_128x128
-} HildonGridItemIconSizeType;
-
-
-typedef struct _HildonGridItem HildonGridItem;
-typedef struct _HildonGridItemClass HildonGridItemClass;
-
-
-struct _HildonGridItem {
-    GtkContainer parent;
-};
-
-struct _HildonGridItemClass {
-    GtkContainerClass parent_class;
-};
-
-
-
-GType hildon_grid_item_get_type(void);
-GtkWidget *hildon_grid_item_new(const gchar * icon_basename);
-GtkWidget *hildon_grid_item_new_with_label(const gchar * icon_basename,
-                                           const gchar * label);
-
-void hildon_grid_item_set_emblem_type(HildonGridItem * item,
-                                      const gchar * emblem_basename);
-const gchar *hildon_grid_item_get_emblem_type(HildonGridItem * item);
-void hildon_grid_item_set_label(HildonGridItem *item, const gchar *label);
-
-
-G_END_DECLS
-#endif /* __HILDON_GRID_ITEM_H__ */
diff --git a/src/hildon-grid.c b/src/hildon-grid.c
deleted file mode 100644 (file)
index 286c75e..0000000
+++ /dev/null
@@ -1,2348 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/**
- * SECTION:hildon-grid
- * @short_description: Being used where ever a number of single tap
- * activatable items need to be presented (e.g. Control Panel applets)
- * @see_also: #HildonGridItem
- *
- * HildonGrid is a set of application-defineable items that are presented in a
- * table. There are two modes for the form of the table; large icon mode
- * and small icon mode.
- *
- * In large icon mode, the Grid View items are presented with a large
- * icon and a label under it. In small icon mode, the items are
- * presented with a small icon and a label on the right side of the
- * icon.
- *
- * The label has a solid background as wide as the maximum text width.
- * This allows the text to have focus as well as be legible when
- * displayed upon a black or dark background image. Long names are
- * truncated with an ellipsis ("...") appended.
- */
-
-/*
- * TODO
- * - there must be a predefined place for the "no items" -label...
- * - performance :-)
- * - dimmed items & scrolling by scrollbar
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <gtk/gtklabel.h>
-#include <gtk/gtkrange.h>
-#include <gtk/gtkvscrollbar.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkenums.h>
-#include <gdk/gdkkeysyms.h>
-
-#include "hildon-grid-item-private.h"
-#include "hildon-marshalers.h"
-#include "hildon-app.h"
-#include <hildon-widgets/hildon-grid.h>
-#include <hildon-widgets/hildon-grid-item.h>
-
-#include <libintl.h>
-#define _(String) dgettext(PACKAGE, String)
-
-#define HILDON_GRID_GET_PRIVATE(obj) \
-        (G_TYPE_INSTANCE_GET_PRIVATE ((obj), HILDON_TYPE_GRID, \
-                                      HildonGridPrivate))
-
-
-#define DEFAULT_STYLE   "largeicons-home"
-
-#define DEFAULT_N_COLUMNS       3
-#define GRID_LABEL_POS_PAD     16
-
-#define DRAG_SENSITIVITY        6
-
-
-enum {
-    ACTIVATE_CHILD,
-    POPUP_CONTEXT,
-    LAST_SIGNAL
-};
-
-enum {
-    PROP_0,
-    PROP_EMPTY_LABEL,
-    PROP_STYLE,
-    PROP_SCROLLBAR_POS
-};
-
-
-typedef struct _HildonGridChild HildonGridChild;
-typedef struct _HildonGridPrivate HildonGridPrivate;
-
-
-struct _HildonGridChild {
-    GtkWidget *widget;
-};
-
-
-struct _HildonGridPrivate {
-    GList *children;
-    GtkWidget *scrollbar;
-    gint old_sb_pos;
-    GdkWindow *event_window;
-
-    gchar *style;
-    gint emblem_size;
-    GtkWidget *empty_label;
-
-    gint item_width;
-    gint item_height;
-    gint h_margin;
-    gint v_margin;
-    gint focus_margin;
-    gint icon_label_margin;
-    gint icon_width;
-    gint num_columns;
-    HildonGridPositionType label_pos;
-    gint label_height;
-
-    gint focus_index;
-    guint click_x;
-    guint click_y;
-
-    /* Handy variables outsize _allocate. */
-    gint area_height;
-    gint area_rows;
-    gint scrollbar_width;
-
-    gint first_index;
-    GdkEventType last_button_event;
-    gint old_item_height;
-};
-
-
-
-/* Prototypes. */
-static void hildon_grid_class_init(HildonGridClass * klass);
-static void hildon_grid_init(HildonGrid * grid);
-static void hildon_grid_realize(GtkWidget * widget);
-static void hildon_grid_unrealize(GtkWidget * widget);
-static void hildon_grid_map(GtkWidget * widget);
-static void hildon_grid_unmap(GtkWidget * widget);
-static gboolean hildon_grid_expose(GtkWidget * widget,
-                                   GdkEventExpose * event);
-static void hildon_grid_size_request(GtkWidget * widget,
-                                     GtkRequisition * requisition);
-static void hildon_grid_size_allocate(GtkWidget * widget,
-                                      GtkAllocation * allocation);
-static void hildon_grid_add(GtkContainer * container, GtkWidget * widget);
-static void hildon_grid_remove(GtkContainer * container,
-                               GtkWidget * widget);
-static void hildon_grid_set_focus_child(GtkContainer * container,
-                                        GtkWidget * widget);
-static void hildon_grid_forall(GtkContainer * container,
-                               gboolean include_internals,
-                               GtkCallback callback,
-                               gpointer callback_data);
-static void hildon_grid_tap_and_hold_setup(GtkWidget * widget,
-                                           GtkWidget * menu,
-                                           GtkCallback func,
-                                           GtkWidgetTapAndHoldFlags flags);
-
-static GType hildon_grid_child_type(GtkContainer * container);
-
-
-static void hildon_grid_set_property(GObject * object,
-                                     guint prop_id,
-                                     const GValue * value,
-                                     GParamSpec * pspec);
-static void hildon_grid_get_property(GObject * object,
-                                     guint prop_id,
-                                     GValue * value, GParamSpec * pspec);
-
-static void hildon_grid_set_empty_label(HildonGrid *grid,
-                                        const gchar *empty_label);
-static const gchar *hildon_grid_get_empty_label(HildonGrid * grid);
-static void hildon_grid_set_num_columns(HildonGrid *grid, gint num_cols);
-static void hildon_grid_set_label_pos(HildonGrid *grid,
-                                      HildonGridPositionType label_pos);
-static void hildon_grid_set_focus_margin(HildonGrid *grid,
-                                         gint focus_margin);
-static void hildon_grid_set_icon_label_margin(HildonGrid *grid,
-                                              gint icon_label_margin);
-static void hildon_grid_set_icon_width(HildonGrid *grid, gint icon_width);
-static void hildon_grid_set_emblem_size(HildonGrid *grid, gint emblem_size);
-static void hildon_grid_set_label_height(HildonGrid *grid,
-                                         gint label_height);
-static void hildon_grid_destroy(GtkObject * self);
-static void hildon_grid_finalize(GObject * object);
-
-/* Signal handlers. */
-static gboolean hildon_grid_button_pressed(GtkWidget * widget,
-                                           GdkEventButton * event);
-static gboolean hildon_grid_button_released(GtkWidget * widget,
-                                            GdkEventButton * event);
-static gboolean hildon_grid_key_pressed(GtkWidget * widget,
-                                        GdkEventKey * event);
-static gboolean hildon_grid_scrollbar_moved(GtkWidget * widget,
-                                            gpointer data);
-static gboolean hildon_grid_state_changed(GtkWidget * widget,
-                                          GtkStateType state,
-                                          gpointer data);
-
-/* Other internal functions. */
-static void get_style_properties(HildonGrid * grid);
-static gint get_child_index(HildonGridPrivate * priv, GtkWidget * child);
-static gint get_child_index_by_coord(HildonGridPrivate * priv,
-                                     gint x, gint y);
-static GtkWidget *get_child_by_index(HildonGridPrivate * priv, gint index);
-
-static gboolean jump_scrollbar_to_focused(HildonGrid * grid);
-static gboolean adjust_scrollbar_height(HildonGrid * grid);
-static gboolean update_contents(HildonGrid * grid);
-static void set_focus(HildonGrid * grid,
-                      GtkWidget * widget, gboolean refresh_view);
-
-static GtkContainerClass *parent_class = NULL;
-static guint grid_signals[LAST_SIGNAL] = { 0 };
-
-
-GType hildon_grid_get_type(void)
-{
-    static GType grid_type = 0;
-
-    if (!grid_type) {
-        static const GTypeInfo grid_info = {
-            sizeof(HildonGridClass),
-            NULL,       /* base_init */
-            NULL,       /* base_finalize */
-            (GClassInitFunc) hildon_grid_class_init,
-            NULL,       /* class_finalize */
-            NULL,       /* class_data */
-            sizeof(HildonGrid),
-            0,  /* n_preallocs */
-            (GInstanceInitFunc) hildon_grid_init,
-        };
-        grid_type = g_type_register_static(GTK_TYPE_CONTAINER,
-                                           "HildonGrid", &grid_info, 0);
-    }
-
-    return grid_type;
-}
-
-
-
-static void hildon_grid_class_init(HildonGridClass * klass)
-{
-    GObjectClass *gobject_class;
-    GtkWidgetClass *widget_class;
-    GtkContainerClass *container_class;
-
-    widget_class = GTK_WIDGET_CLASS(klass);
-    container_class = GTK_CONTAINER_CLASS(klass);
-    gobject_class = G_OBJECT_CLASS(klass);
-
-    parent_class = g_type_class_peek_parent(klass);
-
-    g_type_class_add_private(klass, sizeof(HildonGridPrivate));
-
-    GTK_OBJECT_CLASS(klass)->destroy = hildon_grid_destroy;
-    gobject_class->finalize = hildon_grid_finalize;
-    gobject_class->set_property = hildon_grid_set_property;
-    gobject_class->get_property = hildon_grid_get_property;
-
-    widget_class->realize = hildon_grid_realize;
-    widget_class->unrealize = hildon_grid_unrealize;
-    widget_class->map = hildon_grid_map;
-    widget_class->unmap = hildon_grid_unmap;
-    widget_class->expose_event = hildon_grid_expose;
-    widget_class->size_request = hildon_grid_size_request;
-    widget_class->size_allocate = hildon_grid_size_allocate;
-    widget_class->tap_and_hold_setup = hildon_grid_tap_and_hold_setup;
-    widget_class->key_press_event = hildon_grid_key_pressed;
-    widget_class->button_press_event = hildon_grid_button_pressed;
-    widget_class->button_release_event = hildon_grid_button_released;
-
-    container_class->add = hildon_grid_add;
-    container_class->remove = hildon_grid_remove;
-    container_class->forall = hildon_grid_forall;
-    container_class->child_type = hildon_grid_child_type;
-    container_class->set_focus_child = hildon_grid_set_focus_child;
-
-    /* Install properties to the class */
-    g_object_class_install_property(gobject_class, PROP_EMPTY_LABEL,
-        g_param_spec_string("empty_label",
-                            "Empty label",
-                            "Label to show when grid has no items",
-                            _("ckct_wi_grid_no_items"), G_PARAM_READWRITE));
-
-    g_object_class_install_property(gobject_class, PROP_STYLE,
-        g_param_spec_string("style",
-                            "Style",
-                            "Widget's Style. Setting style sets widget size, "
-                           "spacing, label position, number of columns, "
-                           "and icon sizeLabel to show when grid has no items",
-                            DEFAULT_STYLE, G_PARAM_READWRITE));
-
-    g_object_class_install_property(gobject_class, PROP_SCROLLBAR_POS,
-        g_param_spec_int("scrollbar-position",
-                         "Scrollbar Position",
-                         "View (scrollbar) position.",
-                         G_MININT, G_MAXINT, 0, G_PARAM_READWRITE));
-
-    gtk_widget_class_install_style_property(widget_class,
-        g_param_spec_uint("item_width",
-                          "Item width",
-                          "Total width of an item (obsolete)",
-                          1, G_MAXINT, 212, G_PARAM_READABLE));
-
-    gtk_widget_class_install_style_property(widget_class,
-        g_param_spec_uint("item_height",
-                          "Item height",
-                          "Total height of an item",
-                          1, G_MAXINT, 96, G_PARAM_READABLE));
-
-    gtk_widget_class_install_style_property(widget_class,
-        g_param_spec_uint("item_hspacing",
-                          "Item horizontal spacing",
-                          "Margin between two columns and labels",
-                          0, G_MAXINT, 12, G_PARAM_READABLE));
-
-    gtk_widget_class_install_style_property(widget_class,
-        g_param_spec_uint("item_vspacing",
-                          "Item vertical spacing",
-                          "Icon on right: Margin between rows / Icon at bottom: Vertical margin betweeb label and icon",
-                          0, G_MAXINT, 6, G_PARAM_READABLE));
-
-    gtk_widget_class_install_style_property(widget_class,
-        g_param_spec_uint("label_hspacing",
-                          "Focus margin",
-                          "Margin between focus edge and item edge",
-                          0, G_MAXINT, 6, G_PARAM_READABLE));
-
-    gtk_widget_class_install_style_property(widget_class,
-        g_param_spec_uint("label_vspacing",
-                          "Vertical label spacing",
-                          "Vertical margin between item and label",
-                          0, G_MAXINT, 6, G_PARAM_READABLE));
-
-    gtk_widget_class_install_style_property(widget_class,
-        g_param_spec_uint("label_height",
-                          "Label height",
-                          "Height of icon label",
-                          1, G_MAXINT, 30, G_PARAM_READABLE));
-
-    gtk_widget_class_install_style_property(widget_class,
-        g_param_spec_uint("n_columns",
-                          "Columns",
-                          "Number of columns",
-                          0, G_MAXINT, DEFAULT_N_COLUMNS, G_PARAM_READABLE));
-
-    gtk_widget_class_install_style_property(widget_class,
-        g_param_spec_uint("label_pos",
-                          "Label position",
-                          "Position of label related to the icon",
-                          1, 2, 1, G_PARAM_READABLE));
-
-    gtk_widget_class_install_style_property(widget_class,
-        g_param_spec_uint("icon_size",
-                          "Icon size",
-                          "Size of the icon in pixels (width)",
-                          1, G_MAXINT, 64, G_PARAM_READABLE));
-
-    gtk_widget_class_install_style_property(widget_class,
-        g_param_spec_uint("emblem_size",
-                          "Emblem size",
-                          "Size of the emblem in pixels",
-                          1, G_MAXINT, 25, G_PARAM_READABLE));
-
-    /**
-     * HildonGrid::activate-child:
-     *
-     * Emitted when a child (@HildonGridItem) is activated either by
-     * tapping on it or by pressing enter.
-     */
-    grid_signals[ACTIVATE_CHILD] =
-        g_signal_new("activate-child",
-                     G_OBJECT_CLASS_TYPE(gobject_class),
-                     G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                     G_STRUCT_OFFSET(HildonGridClass, activate_child),
-                     NULL, NULL,
-                     g_cclosure_marshal_VOID__OBJECT,
-                     G_TYPE_NONE, 1, HILDON_TYPE_GRID_ITEM);
-
-    /**
-     * HildonGrid::popup-context-menu:
-     *
-     * Emitted when popup-menu is supposed to open. Used for tap-and-hold.
-     */
-    grid_signals[POPUP_CONTEXT] =
-        g_signal_new("popup-context-menu",
-                     G_OBJECT_CLASS_TYPE(gobject_class),
-                     G_SIGNAL_RUN_LAST,
-                     G_STRUCT_OFFSET(HildonGridClass, popup_context_menu),
-                     NULL, NULL,
-                     _hildon_marshal_VOID__OBJECT,
-                     G_TYPE_NONE, 1, HILDON_TYPE_GRID_ITEM);
-}
-
-
-
-/*
- * hildon_grid_set_empty_label:
- * @grid:           #HildonGrid
- * @empty_label:    New label
- *
- * Sets empty label.
- */
-static void
-hildon_grid_set_empty_label(HildonGrid * grid, const gchar * empty_label)
-{
-    /* No need to worry about update -- label receives a signal for it. */
-    gtk_label_set_label(GTK_LABEL(HILDON_GRID_GET_PRIVATE
-                                  (grid)->empty_label),
-                        empty_label == NULL ? "" : empty_label);
-}
-
-/*
- * _hildon_grid_get_empty_label:
- * @grid:   #HildonGrid
- *
- * Returns: empty label. Label must not be modified nor freed.
- */
-static const gchar *
-hildon_grid_get_empty_label(HildonGrid * grid)
-{
-    return gtk_label_get_label(GTK_LABEL(HILDON_GRID_GET_PRIVATE
-                                         (grid)->empty_label));
-}
-
-/*
- * hildon_grid_set_num_columns:
- * @grid:       #HildonGrid
- * @columns:    Number of columns
- *
- * Sets number of columns.
- */
-static void
-hildon_grid_set_num_columns(HildonGrid * grid, gint columns)
-{
-    HildonGridPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID(grid));
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    if (priv->num_columns == columns) {
-        return;
-    }
-
-    if (columns != 0)
-        priv->num_columns = columns;
-    else
-        priv->num_columns = DEFAULT_N_COLUMNS;
-    
-    /* Update estimated row-count for jump_scrollbar... */
-    priv->area_rows = MAX(priv->area_height / priv->num_columns, 1);
-
-    /* Size could have changed. Scroll view so there's something to show. */
-    adjust_scrollbar_height(grid);
-    jump_scrollbar_to_focused(grid);
-    gtk_widget_queue_resize(GTK_WIDGET(grid));
-}
-
-/*
- * hildon_grid_set_label_pos:
- * @grid:       #HildonGrid
- * @label_pos:  Label position
- *
- * Sets icon label position.
- */
-static void
-hildon_grid_set_label_pos(HildonGrid * grid,
-                          HildonGridPositionType label_pos)
-{
-    HildonGridPrivate *priv;
-    GList *list;
-    GtkWidget *child;
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    if (label_pos == priv->label_pos)
-        return;
-
-    /* gtknotebook doesn't check if we use valid values -- why should
-       we?-) */
-
-    priv->label_pos = label_pos;
-
-    /* Set label position to each HildonGridItem */
-    for (list = priv->children; list != NULL; list = list->next) {
-        child = ((HildonGridChild *) list->data)->widget;
-
-        _hildon_grid_item_set_label_pos(HILDON_GRID_ITEM(child),
-                                        label_pos);
-    }
-}
-
-/*
- * hildon_grid_set_focus_margin:
- * @grid:         #HildonGrid
- * @focus_margin: Focus margin
- *
- * Sets margin between icon edge and label edge
- */
-static void
-hildon_grid_set_focus_margin(HildonGrid *grid, gint focus_margin)
-{
-    HildonGridPrivate *priv;
-    GList *list;
-    GtkWidget *child;
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-    if (focus_margin == priv->focus_margin)
-        return;
-
-    priv->focus_margin = focus_margin;
-
-    /* Update children. */
-    for (list = priv->children; list != NULL; list = list->next) {
-        child = ((HildonGridChild *) list->data)->widget;
-
-        _hildon_grid_item_set_focus_margin(HILDON_GRID_ITEM(child),
-                                           priv->focus_margin);
-    }
-}
-
-
-/*
- * hildon_grid_set_icon_label_margin:
- * @grid:       #HildonGrid
- * @hspacing:   Vertical spacing
- *
- * Sets vertical spacing for label.
- * XXX
- */
-static void
-hildon_grid_set_icon_label_margin(HildonGrid *grid, gint icon_label_margin)
-{
-    HildonGridPrivate *priv;
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-    if (icon_label_margin == priv->icon_label_margin)
-        return;
-
-    priv->icon_label_margin = icon_label_margin;
-}
-
-
-/*
- * hildon_grid_set_icon_width:
- * @grid:       #HildonGrid
- * @icon_size:  Icon size (width)
- *
- * Sets icon size (in pixels).
- */
-static void
-hildon_grid_set_icon_width(HildonGrid * grid, gint icon_width)
-{
-    HildonGridPrivate *priv;
-    GList *list;
-    GtkWidget *child;
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    if (icon_width == priv->icon_width)
-        return;
-
-    priv->icon_width = icon_width;
-
-    for (list = priv->children; list != NULL; list = list->next) {
-        child = ((HildonGridChild *) list->data)->widget;
-
-        _hildon_grid_item_set_icon_width(HILDON_GRID_ITEM(child),
-                                         icon_width);
-    }
-}
-
-
-/*
- * hildon_grid_set_emblem_size:
- * @grid:           #HildonGrid
- * @emblem_size:    Emblem size
- *
- * Sets emblem size (in pixels).
- */
-static void
-hildon_grid_set_emblem_size(HildonGrid *grid, gint emblem_size)
-{
-    HildonGridPrivate *priv;
-    GList *list;
-    GtkWidget *child;
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    if (emblem_size == priv->emblem_size)
-        return;
-
-    priv->emblem_size = emblem_size;
-
-    for (list = priv->children; list != NULL; list = list->next) {
-        child = ((HildonGridChild *) list->data)->widget;
-
-        _hildon_grid_item_set_emblem_size(HILDON_GRID_ITEM(child),
-                                          emblem_size);
-    }
-}
-
-
-static void
-hildon_grid_set_label_height(HildonGrid *grid,
-                             gint label_height)
-{
-    HildonGridPrivate *priv;
-    GList *list;
-    GtkWidget *child;
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    if (label_height == priv->label_height)
-        return;
-
-    priv->label_height = label_height;
-
-    for (list = priv->children; list != NULL; list = list->next) {
-        child = ((HildonGridChild *) list->data)->widget;
-
-        _hildon_grid_item_set_label_height(HILDON_GRID_ITEM(child),
-                                           label_height);
-    }
-}
-
-
-static GType hildon_grid_child_type(GtkContainer * container)
-{
-    return GTK_TYPE_WIDGET;
-}
-
-static void hildon_grid_init(HildonGrid * grid)
-{
-    HildonGridPrivate *priv;
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    GTK_CONTAINER(grid)->focus_child = NULL;
-    priv->focus_index = -1;
-
-    priv->scrollbar = gtk_vscrollbar_new(NULL);
-    priv->empty_label = gtk_label_new(_("ckct_wi_grid_no_items"));
-    priv->style = NULL;
-
-    priv->area_height = 1;
-    priv->area_rows = 1;
-    priv->children = NULL;
-
-    priv->first_index = 0;
-    priv->click_x = 0;
-    priv->click_y = 0;
-
-    priv->item_height = 96;
-    priv->h_margin = 12;
-    priv->v_margin = 6;
-    priv->focus_margin = 6;
-    priv->icon_label_margin = 6;
-    priv->icon_width = 64;
-    priv->label_pos = HILDON_GRID_ITEM_LABEL_POS_BOTTOM;
-
-    priv->old_sb_pos = -1;
-    priv->old_item_height = -1;
-
-    gtk_widget_set_parent(priv->scrollbar, GTK_WIDGET(grid));
-    gtk_widget_set_parent(priv->empty_label, GTK_WIDGET(grid));
-
-    priv->last_button_event = GDK_NOTHING;
-
-    GTK_WIDGET_SET_FLAGS(grid, GTK_NO_WINDOW);
-
-    /* Signal for scrollbar. */
-    g_signal_connect(G_OBJECT(priv->scrollbar), "value-changed",
-                     G_CALLBACK(hildon_grid_scrollbar_moved), grid);
-
-    /* Signal for key press. */
-    GTK_WIDGET_SET_FLAGS(GTK_WIDGET(grid), GTK_CAN_FOCUS);
-    gtk_widget_set_events(GTK_WIDGET(grid), GDK_KEY_PRESS_MASK);
-
-    GTK_WIDGET_UNSET_FLAGS(priv->scrollbar, GTK_CAN_FOCUS);
-    hildon_grid_set_style(grid, DEFAULT_STYLE);
-}
-
-/**
- * hildon_grid_new:
- *
- * Creates a new #HildonGrid.
- *
- * Returns: a new #HildonGrid
- */
-GtkWidget *hildon_grid_new(void)
-{
-
-    HildonGrid *grid;
-
-    grid = g_object_new(HILDON_TYPE_GRID, NULL);
-
-    return GTK_WIDGET(grid);
-}
-
-
-static void hildon_grid_realize(GtkWidget * widget)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    GdkWindowAttr attr;
-    gint attr_mask;
-
-
-    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
-
-    grid = HILDON_GRID(widget);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    /* Create GdkWindow for catching events. */
-    attr.x = widget->allocation.x;
-    attr.y = widget->allocation.y;
-    attr.width = widget->allocation.width - priv->scrollbar_width;
-    attr.height = widget->allocation.height;
-    attr.window_type = GDK_WINDOW_CHILD;
-    attr.event_mask = gtk_widget_get_events(widget)
-        | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK;
-
-    widget->window = gtk_widget_get_parent_window(widget);
-    g_object_ref(widget->window);
-
-    attr.wclass = GDK_INPUT_ONLY;
-    attr_mask = GDK_WA_X | GDK_WA_Y;
-
-    priv->event_window = gdk_window_new(widget->window, &attr, attr_mask);
-    gdk_window_set_user_data(priv->event_window, widget);
-
-    widget->style = gtk_style_attach(widget->style, widget->window);
-
-    gtk_style_set_background(widget->style,
-                             widget->window, GTK_STATE_NORMAL);
-}
-
-
-static void hildon_grid_unrealize(GtkWidget * widget)
-{
-    HildonGridPrivate *priv;
-
-    priv = HILDON_GRID_GET_PRIVATE(HILDON_GRID(widget));
-
-    if (priv->event_window != NULL) {
-        gdk_window_set_user_data(priv->event_window, NULL);
-        gdk_window_destroy(priv->event_window);
-        priv->event_window = NULL;
-    }
-
-    if (GTK_WIDGET_CLASS(parent_class)->unrealize) {
-        (*GTK_WIDGET_CLASS(parent_class)->unrealize) (widget);
-    }
-}
-
-
-
-static void hildon_grid_map(GtkWidget * widget)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    GList *list;
-    GtkWidget *child;
-
-    g_return_if_fail(HILDON_IS_GRID(widget));
-
-    if (!GTK_WIDGET_VISIBLE(widget))
-        return;
-
-    grid = HILDON_GRID(widget);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    (*GTK_WIDGET_CLASS(parent_class)->map) (widget);
-
-    /* We shouldn't really need the following...*/
-    if (priv->scrollbar != NULL && GTK_WIDGET_VISIBLE(priv->scrollbar)) {
-        if (!GTK_WIDGET_MAPPED(priv->scrollbar)) {
-            gtk_widget_map(priv->scrollbar);
-        }
-    }
-
-    if (priv->empty_label != NULL &&
-        GTK_WIDGET_VISIBLE(priv->empty_label)) {
-        if (!GTK_WIDGET_MAPPED(priv->empty_label)) {
-            gtk_widget_map(priv->empty_label);
-        }
-    }
-
-    for (list = priv->children; list != NULL; list = list->next) {
-        child = ((HildonGridChild *) list->data)->widget;
-
-        if (GTK_WIDGET_VISIBLE(child)) {
-            if (!GTK_WIDGET_MAPPED(child)) {
-                gtk_widget_map(child);
-            }
-        }
-    }
-    /* END OF don't really need */
-
-    /* Also make event window visible. */
-    gdk_window_show(priv->event_window);
-}
-
-
-
-static void hildon_grid_unmap(GtkWidget * widget)
-{
-    HildonGridPrivate *priv;
-
-    priv = HILDON_GRID_GET_PRIVATE(HILDON_GRID(widget));
-
-    if (priv->event_window != NULL) {
-        gdk_window_hide(priv->event_window);
-    }
-
-    (*GTK_WIDGET_CLASS(parent_class)->unmap) (widget);
-}
-
-
-
-static gboolean
-hildon_grid_expose(GtkWidget * widget, GdkEventExpose * event)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    GtkContainer *container;
-    GList *list;
-    gint child_no;
-
-    g_return_val_if_fail(widget, FALSE);
-    g_return_val_if_fail(HILDON_IS_GRID(widget), FALSE);
-    g_return_val_if_fail(event, FALSE);
-
-    grid = HILDON_GRID(widget);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-    container = GTK_CONTAINER(grid);
-
-    /* If grid has no children,
-     * propagate the expose event to the label is one exists */ 
-    if (priv->children == NULL || g_list_length(priv->children) == 0) {
-        if (priv->empty_label != NULL) {
-            gtk_container_propagate_expose(container,
-                                           priv->empty_label, event);
-        }
-        return FALSE;
-    }
-
-    /* Only expose visible children. */
-
-    /* Jump over invisible. */
-    for (list = priv->children, child_no = 0;
-         list != NULL && child_no < priv->first_index;
-         list = list->next, child_no++) {
-        ;       /* Nothing here. */
-    }
-
-    for (; list != NULL && child_no < priv->first_index +
-         priv->num_columns * priv->area_rows; list = list->next) {
-        gtk_container_propagate_expose(container,
-                                       ((HildonGridChild *) list->data)
-                                       ->widget, event);
-    }
-
-    /* Keep focused item focused. */
-    if (container->focus_child != NULL
-        && !GTK_WIDGET_HAS_FOCUS(container->focus_child)) {
-        set_focus(grid, container->focus_child, FALSE);
-    }
-    if (priv->scrollbar_width > 0 && priv->scrollbar != NULL) {
-        gtk_container_propagate_expose(container, priv->scrollbar, event);
-    }
-
-    return FALSE;
-}
-
-
-static void
-hildon_grid_size_request(GtkWidget * widget, GtkRequisition * requisition)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    GList *list;
-    GtkWidget *child;
-    GtkRequisition req;
-
-    g_return_if_fail(widget);
-    g_return_if_fail(requisition);
-
-    grid = HILDON_GRID(widget);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    /* Want as big as possible. */
-    requisition->width = 0x7fff;        /* Largest possible gint16 */
-    requisition->height = 0x7fff;       /* Largest possible gint16 */
-
-    if (priv->children == NULL) {
-        if (priv->empty_label != NULL &&
-            GTK_WIDGET_VISIBLE(priv->empty_label)) {
-            gtk_widget_size_request(priv->empty_label, &req);
-        }
-    }
-
-    if (priv->scrollbar != NULL && GTK_WIDGET_VISIBLE(priv->scrollbar)) {
-        gtk_widget_size_request(priv->scrollbar, &req);
-    }
-
-    for (list = priv->children; list != NULL; list = list->next) {
-        child = ((HildonGridChild *) list->data)->widget;
-
-        gtk_widget_size_request(child, &req);
-    }
-}
-
-/*
- * hildon_grid_size_allocate:
- *
- * Supposingly called when size of grid changes and after view have moved so
- * that items need to be relocated.
- */
-static void
-hildon_grid_size_allocate(GtkWidget * widget, GtkAllocation * allocation)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    GList *list;
-    GtkWidget *child;
-    gint child_no;
-    gint y_offset;
-    gint row_margin;
-
-    GtkAllocation alloc;
-    GtkRequisition req;
-
-    g_return_if_fail(widget);
-    g_return_if_fail(allocation);
-
-    grid = HILDON_GRID(widget);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-    widget->allocation = *allocation;
-
-    get_style_properties(grid);
-
-    /* First of all, make sure GdkWindow is over our widget. */
-    if (priv->event_window != NULL) {
-        gdk_window_move_resize(priv->event_window,
-                               widget->allocation.x,
-                               widget->allocation.y,
-                               widget->allocation.width -
-                                  priv->scrollbar_width,
-                               widget->allocation.height);
-    }
-    /* Show the label if there are no items. */
-    if (priv->children == NULL) {
-        /* 
-         * We probably don't need this as scrollbar should be hidden when
-         * removing items, but one can never be too sure...
-         */
-        if (priv->scrollbar != NULL &&
-            GTK_WIDGET_VISIBLE(priv->scrollbar)) {
-            priv->scrollbar_width = 0;
-            gtk_widget_hide(priv->scrollbar);
-        }
-
-        /* Show label if creating one actually worked. */
-        if (priv->empty_label != NULL) {
-            gtk_widget_get_child_requisition(priv->empty_label, &req);
-
-            /* ...for sure we must have a position for the label here... */
-            alloc.x = allocation->x + GRID_LABEL_POS_PAD;
-            alloc.y = allocation->y + GRID_LABEL_POS_PAD;
-            alloc.width = MIN(req.width, allocation->width -
-                              GRID_LABEL_POS_PAD);
-            alloc.height = MIN(req.height, allocation->height -
-                               GRID_LABEL_POS_PAD);
-
-            /* Make sure we don't use negative values. */
-            if (alloc.width < 0) {
-                alloc.width = 0;
-            }
-            if (alloc.height < 0) {
-                alloc.height = 0;
-            }
-
-            gtk_widget_size_allocate(priv->empty_label, &alloc);
-
-            if (!GTK_WIDGET_VISIBLE(priv->empty_label)) {
-                gtk_widget_show(priv->empty_label);
-            }
-        }
-
-        return;
-    }
-
-    /* As we have some items, hide label if it was visible. */
-    if (priv->empty_label != NULL &&
-        GTK_WIDGET_VISIBLE(priv->empty_label)) {
-        gtk_widget_hide(priv->empty_label);
-    }
-
-    priv->area_height = allocation->height;
-    priv->area_rows = allocation->height / priv->item_height;
-
-    /* Adjust/show/hide scrollbar. */
-    adjust_scrollbar_height(grid);
-    if (priv->old_item_height != priv->item_height) {
-        priv->old_item_height = priv->item_height;
-        jump_scrollbar_to_focused(grid);
-    }
-
-    /* Update item width. */
-    if (priv->num_columns == 1) {
-        priv->item_width = allocation->width - priv->scrollbar_width -
-            priv->h_margin - priv->scrollbar_width;
-    } else {
-        priv->item_width = (allocation->width - priv->scrollbar_width) /
-            priv->num_columns;
-    }
-
-    priv->first_index =
-        (int) gtk_range_get_value(GTK_RANGE(priv->scrollbar)) /
-        priv->item_height * priv->num_columns;
-
-    /* Hide items before visible ones. */
-    for (list = priv->children, child_no = 0;
-         list != NULL && child_no < priv->first_index;
-         list = list->next, child_no++) {
-        child = ((HildonGridChild *) list->data)->widget;
-
-        if (GTK_WIDGET_VISIBLE(child)) {
-            gtk_widget_hide(child);
-        }
-    }
-
-    /* Allocate visible items. */
-    alloc.width = priv->item_width - priv->h_margin;
-    switch (priv->label_pos) {
-    case HILDON_GRID_ITEM_LABEL_POS_BOTTOM:
-        row_margin = priv->icon_label_margin;
-        break;
-    case HILDON_GRID_ITEM_LABEL_POS_RIGHT:
-        row_margin = priv->v_margin;
-        break;
-    default:
-        row_margin = 0;
-        break;
-    }
-    alloc.height = priv->item_height - row_margin;
-
-    for (y_offset = priv->first_index / priv->num_columns * priv->item_height;
-         list != NULL && child_no < priv->first_index +
-         priv->area_rows * priv->num_columns;
-         list = list->next, child_no++) {
-        child = ((HildonGridChild *) list->data)->widget;
-
-        if (!GTK_WIDGET_VISIBLE(child)) {
-            gtk_widget_show(child);
-        }
-
-        /* Don't update icons which are not visible... */
-        alloc.y = (child_no / priv->num_columns) * priv->item_height +
-                  allocation->y - y_offset + row_margin;
-        alloc.x = (child_no % priv->num_columns) * priv->item_width +
-                 allocation->x;
-
-        _hildon_grid_item_done_updating_settings(HILDON_GRID_ITEM(child));
-        gtk_widget_size_allocate(child, &alloc);
-    }
-
-    /* Hide items after visible items. */
-    for (; list != NULL; list = list->next) {
-        child = ((HildonGridChild *) list->data)->widget;
-
-        if (GTK_WIDGET_VISIBLE(child)) {
-            gtk_widget_hide(child);
-        }
-    }
-}
-
-
-
-/**
- * hildon_grid_add:
- * @container:  container (#HildonGrid) to add HildonGridItem into
- * @widget:     #GtkWidget (#HildonGridItem) to add
- *
- * Adds a new HildonGridItem into HildonGrid.
- */
-static void hildon_grid_add(GtkContainer * container, GtkWidget * widget)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    HildonGridChild *child;
-
-
-    g_return_if_fail(HILDON_IS_GRID(container));
-    g_return_if_fail(HILDON_IS_GRID_ITEM(widget));
-
-    grid = HILDON_GRID(container);
-    priv = HILDON_GRID_GET_PRIVATE(HILDON_GRID(grid));
-    GTK_WIDGET_SET_FLAGS(widget, GTK_NO_WINDOW);
-
-    child = g_new(HildonGridChild, 1);
-    if (child == NULL) {
-        g_critical("no memory for child - not adding");
-        return;
-    }
-    child->widget = widget;
-
-    _hildon_grid_item_set_label_pos   (HILDON_GRID_ITEM(widget), priv->label_pos);
-    _hildon_grid_item_set_focus_margin(HILDON_GRID_ITEM(widget), priv->focus_margin);
-    _hildon_grid_item_set_icon_width  (HILDON_GRID_ITEM(widget), priv->icon_width);
-    _hildon_grid_item_set_emblem_size (HILDON_GRID_ITEM(widget), priv->emblem_size);
-
-    /* Add the new item to the grid */
-    priv->children = g_list_append(priv->children, child);
-    gtk_widget_set_parent(widget, GTK_WIDGET(grid));
-
-    /* Property changes (child's set_sensitive) */
-    g_signal_connect_after(G_OBJECT(widget), "state-changed",
-                           G_CALLBACK(hildon_grid_state_changed), grid);
-
-    /* Matches both empty grid and all-dimmed grid. */
-    if (GTK_CONTAINER(grid)->focus_child == NULL)
-        set_focus(grid, widget, TRUE);
-
-    /* 
-     * If item was added in visible area, relocate items. Otherwise update
-     * scrollbar and see if items need relocating.
-     */
-    if (g_list_length(priv->children) < priv->first_index +
-        priv->area_rows * priv->num_columns) {
-        gtk_widget_queue_resize(GTK_WIDGET(grid));
-    } else {
-        gboolean updated;
-
-        updated = adjust_scrollbar_height(grid);
-        /* Basically this other test is useless -- shouldn't need to jump. 
-         */
-        updated |= jump_scrollbar_to_focused(grid);
-
-        if (updated) {
-            gtk_widget_queue_resize(GTK_WIDGET(grid));
-        }
-    }
-}
-
-/**
- * hildon_grid_remove:
- * @container:  container (#HildonGrid) to remove #HildonGridItem from
- * @widget:     widget (#HildonGridItem) to be removed
- *
- * Removes HildonGridItem from HildonGrid.
- */
-static void
-hildon_grid_remove(GtkContainer * container, GtkWidget * widget)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    HildonGridChild *child;
-    GtkWidget *child_widget;
-    GList *list;
-    gint index, old_index;
-    gboolean deleted;
-    gboolean updated;
-
-    g_return_if_fail(HILDON_IS_GRID(container));
-    g_return_if_fail(HILDON_IS_GRID_ITEM(widget));
-
-    grid = HILDON_GRID(container);
-    priv = HILDON_GRID_GET_PRIVATE(container);
-
-    old_index = priv->focus_index;
-    updated = GTK_WIDGET_VISIBLE(widget);
-
-    for (list = priv->children, index = 0, deleted = FALSE;
-         list != NULL; list = list->next, index++) {
-        child = (HildonGridChild *) list->data;
-        child_widget = child->widget;
-
-       /* Remove the Item if it is found in the grid */
-        if (child_widget == widget) {
-            gtk_widget_unparent(child_widget);
-            priv->children = g_list_remove_link(priv->children, list);
-            g_list_free(list);
-            g_free(child);
-
-            deleted = TRUE;
-
-            break;
-        }
-    }
-
-    /* Emit warning if the item is not found */
-    if (!deleted) {
-        g_warning("tried to remove unexisting item");
-        return;
-    }
-
-    /* Move focus somewhere. */
-    if (old_index == index) {
-        if (old_index == g_list_length(priv->children)) {
-            if (index == 0) {
-                set_focus(grid, NULL, TRUE);
-            } else {
-                set_focus(grid,
-                          get_child_by_index(priv, old_index - 1), TRUE);
-            }
-        } else {
-            set_focus(grid, get_child_by_index(priv, old_index), TRUE);
-        }
-    } else {
-        set_focus(grid, GTK_CONTAINER(grid)->focus_child, TRUE);
-    }
-
-    updated |= adjust_scrollbar_height(grid);
-    updated |= jump_scrollbar_to_focused(grid);
-
-    if (updated) {
-        gtk_widget_queue_resize(GTK_WIDGET(grid));
-    }
-}
-
-/**
- * hildon_grid_set_focus_child:
- * @container:  HildonGrid
- * @widget:     HildonGridItem
- *
- * Sets focus.
- */
-static void
-hildon_grid_set_focus_child(GtkContainer * container, GtkWidget * widget)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID(container));
-    g_return_if_fail(HILDON_IS_GRID_ITEM(widget) || widget == NULL);
-
-    grid = HILDON_GRID(container);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    if (GTK_CONTAINER(grid)->focus_child == widget || widget == NULL)
-        return;
-
-    set_focus(grid, widget, TRUE);
-}
-
-
-
-static void
-set_focus(HildonGrid * grid, GtkWidget * widget, gboolean refresh_view)
-{
-    HildonGridPrivate *priv;
-    GtkContainer *container;
-    gboolean view_updated;
-
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-    container = GTK_CONTAINER(grid);
-
-    /* If widget is NULL -> unfocus */ 
-    if (widget == NULL && container->focus_child != NULL)
-        GTK_WIDGET_UNSET_FLAGS(container->focus_child, GTK_HAS_FOCUS);
-
-    GTK_CONTAINER(grid)->focus_child = widget;
-    if (widget == NULL) {
-        priv->focus_index = -1;
-        return;
-    }
-
-    /* Get the child index which the user wanted to focus */
-    priv->focus_index = get_child_index(priv, widget);
-
-    gtk_widget_grab_focus(widget);
-
-    if (refresh_view) {
-        view_updated = jump_scrollbar_to_focused(grid);
-    } else {
-        view_updated = FALSE;
-    }
-
-    if (view_updated) {
-        hildon_grid_size_allocate(GTK_WIDGET(grid),
-                                  &GTK_WIDGET(grid)->allocation);
-    }
-}
-
-static void
-hildon_grid_forall(GtkContainer * container,
-                   gboolean include_internals,
-                   GtkCallback callback, gpointer callback_data)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    GList *list;
-
-    g_return_if_fail(container);
-    g_return_if_fail(callback);
-
-    grid = HILDON_GRID(container);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    /* Connect callback functions */
-    if (include_internals) {
-        if (priv->scrollbar != NULL) {
-            (*callback) (priv->scrollbar, callback_data);
-        }
-        if (priv->empty_label != NULL) {
-            (*callback) (priv->empty_label, callback_data);
-        }
-    }
-
-    for (list = priv->children; list != NULL; list = list->next) {
-        (*callback) (((HildonGridChild *) list->data)->widget,
-                     callback_data);
-    }
-}
-
-static void hildon_grid_destroy(GtkObject * self)
-{
-    HildonGridPrivate *priv;
-
-    g_return_if_fail(self != NULL);
-    g_return_if_fail(HILDON_IS_GRID(self));
-
-    priv = HILDON_GRID_GET_PRIVATE(self);
-
-    if (GTK_WIDGET(self)->window != NULL) {
-        g_object_unref(G_OBJECT(GTK_WIDGET(self)->window));
-    }
-
-    gtk_container_forall(GTK_CONTAINER(self),
-                         (GtkCallback) gtk_object_ref, NULL);
-    gtk_container_forall(GTK_CONTAINER(self),
-                         (GtkCallback) gtk_widget_unparent, NULL);
-
-    GTK_OBJECT_CLASS(parent_class)->destroy(self);
-}
-
-static void hildon_grid_finalize(GObject * object)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-
-    grid = HILDON_GRID(object);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    gtk_container_forall(GTK_CONTAINER(object),
-                         (GtkCallback) gtk_object_unref, NULL);
-
-    if (priv->style != NULL) {
-        g_free(priv->style);
-    }
-    if (G_OBJECT_CLASS(parent_class)->finalize) {
-        G_OBJECT_CLASS(parent_class)->finalize(object);
-    }
-}
-
-/*
- * hildon_grid_key_pressed:
- * @widget: Widget where we get the signal from
- * @event:  EventKey
- * @data:   #HildonGrid
- *
- * Handle user key press (keyboard navigation).
- *
- * And here's how it works if some items are dimmed (moving to right):
- * . . . .      . . # .     . 2 # .     . # . .
- * . 1 # 2      . 1 # #     1 # # #     1 # # #
- * . . .        . . 2       . . .       . 2 .
- *
- * '.' = item,
- * '#' = dimmed item, 
- * '1' = starting position,
- * '2' = final position
- *
- * ...although only the first example is implemented right now.
- *
- * Return value: Signal handled
- */
-static gboolean
-hildon_grid_key_pressed(GtkWidget * widget,
-                        GdkEventKey * event)
-{
-    GtkAdjustment *adjustment;
-    GtkContainer *container;
-    GtkWidget *new_focus;
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    gboolean shift;
-    gint keyval;
-    gint x, y;
-    gint focus_index;
-    gint child_count, child_rows;
-    gint t;
-    gint addition, max_add;
-
-    g_return_val_if_fail(widget, FALSE);
-
-    grid = HILDON_GRID(widget);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    /* 
-     * If focus was never lost, we could just see if an item is focused - 
-     * if not, there's nothing else to focus...
-     */
-
-    /* No items? */
-    if (priv->children == NULL || g_list_length(priv->children) == 0)
-        return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
-
-    /* Focused item is dimmed? */
-    /* If we have no focus, allow non-existing focus to move... */
-    container = GTK_CONTAINER(grid);
-    if (container->focus_child != NULL
-        && !GTK_WIDGET_IS_SENSITIVE(container->focus_child)) {
-        return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
-    }
-    /* At the moment we don't want to do anything here if alt or control
-       or MODX is pressed, so return now. Shift + TAB are accepted (from
-       hildon-table-grid) And right now modifiers do not make any
-       difference... */
-
-    /* Said somewhere that "foo = a == b" is not desirable. */
-    if (event->state & GDK_SHIFT_MASK) {
-        shift = TRUE;
-    } else {
-        shift = FALSE;
-    }
-
-    keyval = event->keyval;
-    if (gtk_widget_get_default_direction() == GTK_TEXT_DIR_RTL) {
-        switch (event->keyval) {
-        case GDK_Left:
-            keyval = GDK_Right;
-            break;
-        case GDK_KP_Left:
-            keyval = GDK_KP_Right;
-            break;
-        case GDK_Right:
-            keyval = GDK_Left;
-            break;
-        case GDK_KP_Right:
-            keyval = GDK_KP_Left;
-            break;
-        }
-    }
-
-    child_count = g_list_length(priv->children);
-    child_rows = (child_count - 1) / priv->num_columns + 1;
-
-    if (priv->focus_index != -1) {
-        x = priv->focus_index % priv->num_columns;
-        y = priv->focus_index / priv->num_columns;
-    } else {
-        x = y = 0;
-    }
-
-    switch (keyval) {
-    case GDK_KP_Page_Up:
-    case GDK_Page_Up:
-        if (priv->first_index == 0) {
-            if (priv->focus_index == 0) {
-                return TRUE;
-            }
-            set_focus(grid, get_child_by_index(priv, 0), TRUE);
-            return TRUE;
-        }
-
-        t = MAX(priv->first_index / priv->num_columns - priv->area_rows, 0);
-        adjustment = gtk_range_get_adjustment(GTK_RANGE(priv->scrollbar));
-        adjustment->value = (gdouble) (t * priv->item_height);
-        gtk_range_set_adjustment(GTK_RANGE(priv->scrollbar), adjustment);
-        gtk_widget_queue_draw(priv->scrollbar);
-        update_contents(grid);
-
-        /* Want to update now. */
-        hildon_grid_size_allocate(GTK_WIDGET(grid),
-                                  &GTK_WIDGET(grid)->allocation);
-
-        return TRUE;
-        break;
-
-    case GDK_KP_Page_Down:
-    case GDK_Page_Down:
-        if (priv->first_index / priv->num_columns ==
-            child_rows - priv->area_rows) {
-            if (priv->focus_index == child_count - 1) {
-                return TRUE;
-            }
-            set_focus(grid, get_child_by_index(priv, child_count - 1),
-                      TRUE);
-            return TRUE;
-        }
-
-        t = MIN(priv->first_index / priv->num_columns +
-                priv->area_rows, child_rows - priv->area_rows);
-        adjustment = gtk_range_get_adjustment(GTK_RANGE(priv->scrollbar));
-        adjustment->value = (gdouble) (t * priv->item_height);
-        gtk_range_set_adjustment(GTK_RANGE(priv->scrollbar), adjustment);
-        gtk_widget_queue_draw(priv->scrollbar);
-        update_contents(grid);
-
-        /* Want to update now. */
-        hildon_grid_size_allocate(GTK_WIDGET(grid),
-                                  &GTK_WIDGET(grid)->allocation);
-
-        return TRUE;
-        break;
-
-    case GDK_KP_Up:
-    case GDK_Up:
-        if (y <= 0) {
-            return TRUE;
-        }
-        addition = -priv->num_columns;
-        max_add = y;
-        y--;
-        break;
-
-    case GDK_KP_Down:
-    case GDK_Down:
-        if (y >= (child_count - 1) / priv->num_columns) {
-            return TRUE;
-        }
-        t = child_count % priv->num_columns;
-        if (t == 0) {
-            t = priv->num_columns;
-        }
-        if (y == (child_count - 1) / priv->num_columns - 1 && x >= t) {
-            x = t - 1;
-        }
-        y++;
-        addition = priv->num_columns;
-        max_add = child_rows - y;
-        break;
-
-    case GDK_KP_Left:
-    case GDK_Left:
-        if (x <= 0) {
-            return TRUE;
-        }
-        addition = -1;
-        max_add = x;
-        x--;
-        break;
-
-    case GDK_KP_Right:
-    case GDK_Right:
-        if (x >= priv->num_columns - 1) {
-            return TRUE;
-        }
-        if (y == 0 && x >= child_count - 1) {
-            return TRUE;
-        }
-        x++;
-        addition = 1;
-        max_add = priv->num_columns - x;
-        if (y * priv->num_columns + x == child_count) {
-            y--;
-        }
-        break;
-    case GDK_KP_Enter:
-    case GDK_Return:
-        hildon_grid_activate_child(grid,
-                                   HILDON_GRID_ITEM
-                                   (GTK_CONTAINER(grid)->focus_child));
-        return TRUE;
-        break;
-    default:
-        return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
-        break;
-    }
-
-    focus_index = y * priv->num_columns + x;
-    new_focus = get_child_by_index(priv, focus_index);
-
-    while (new_focus != NULL &&
-           focus_index < child_count && !GTK_WIDGET_SENSITIVE(new_focus)) {
-        max_add--;
-
-        if (max_add == 0) {
-            return TRUE;
-        }
-        focus_index += addition;
-        new_focus = get_child_by_index(priv, focus_index);
-    }
-
-    if (new_focus != NULL) {
-        set_focus(grid, new_focus, TRUE);
-    }
-    return TRUE;
-}
-
-
-/*
- * hildon_grid_button_pressed:
- * @widget: Widget where signal is coming from
- * @event:  #EventButton
- * @data:   #HildonGrid
- *
- * Handle mouse button press.
- *
- * Return value: Signal handled
- */
-static gboolean
-hildon_grid_button_pressed(GtkWidget * widget,
-                           GdkEventButton * event)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    GtkWidget *child;
-    int child_no;
-
-    grid = HILDON_GRID(widget);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-/* Watch out for double/triple click press events */
-
-    if (event->type == GDK_2BUTTON_PRESS ||
-        event->type == GDK_3BUTTON_PRESS) {
-        priv->last_button_event = event->type;
-        return FALSE;
-    }
-
-    priv->last_button_event = event->type;
-
-    if (event->type != GDK_BUTTON_PRESS)
-        return FALSE;
-
-
-    child_no = get_child_index_by_coord(priv, event->x, event->y);
-
-    if (child_no == -1 || child_no >= g_list_length(priv->children))
-        return FALSE;
-
-    child = get_child_by_index(priv, child_no);
-    if (!GTK_WIDGET_IS_SENSITIVE(child))
-        return FALSE;
-
-    priv->click_x = event->x;
-    priv->click_y = event->y;
-
-    return FALSE;
-}
-
-/*
- * hildon_grid_button_released:
- * @widget: Widget the signal is coming from
- * @event:  #EventButton
- * @data:   #HildonGrid
- *
- * Handle mouse button release.
- *
- * Return value: Signal handled
- */
-static gboolean
-hildon_grid_button_released(GtkWidget * widget,
-                            GdkEventButton * event)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    GtkWidget *child;
-    int child_no;
-    gboolean already_selected;
-
-    grid = HILDON_GRID(widget);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    /* In case of double/triple click, silently ignore the release event */
-
-    if (priv->last_button_event == GDK_2BUTTON_PRESS ||
-        priv->last_button_event == GDK_3BUTTON_PRESS) {
-        priv->last_button_event = event->type;
-        return FALSE;
-    }
-
-    child_no = get_child_index_by_coord(priv, event->x, event->y);
-
-    if (child_no == -1 || child_no >= g_list_length(priv->children)) {
-        return FALSE;
-    }
-    child = get_child_by_index(priv, child_no);
-    if (!GTK_WIDGET_IS_SENSITIVE(child)) {
-        return FALSE;
-    }
-    if (abs(priv->click_x - event->x) >= DRAG_SENSITIVITY
-        && abs(priv->click_y - event->y) >= DRAG_SENSITIVITY) {
-        return FALSE;
-    }
-
-    /* Check if this element was already selected */
-    already_selected = (priv->focus_index == child_no);
-
-    set_focus(grid, child, TRUE);
-    priv->last_button_event = event->type;
-
-    /* If this is not the first click in this element, activate it */
-    if (already_selected)
-      hildon_grid_activate_child(grid, HILDON_GRID_ITEM(child));
-
-    return FALSE;
-}
-
-/*
- * hildon_grid_scrollbar_moved:
- * @widget: Widget which sent the signal
- * @data:   #HildonGrid
- *
- * Update HildonGrid contents when scrollbar is moved.
- *
- * Return value: Signal handeld
- */
-static gboolean
-hildon_grid_scrollbar_moved(GtkWidget * widget, gpointer data)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    gboolean updated = FALSE;
-
-    grid = HILDON_GRID(data);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-    updated = update_contents(grid);
-
-    /* 
-     * If grid changes focus while dragging scrollbar and pointer leaves
-     * scrollbar, focus is moved to prev_focus... This prevents that.
-     */
-    gtk_window_set_prev_focus_widget(GTK_WINDOW
-                                     (gtk_widget_get_toplevel(widget)),
-                                     GTK_CONTAINER(grid)->focus_child);
-
-    if (updated)
-        /* Don't just queue it, let's do it now! */
-        hildon_grid_size_allocate(GTK_WIDGET(grid),
-                                  &GTK_WIDGET(grid)->allocation);
-
-    return TRUE;
-}
-
-
-/*
- * update_contents:
- * @grid:   #HildonGrid
- *
- * Update the view if scrollbar has moved so that first visible row
- * should've changed. Returns true if location actually changed.
- *
- * Return value: Content changed
- */
-static gboolean update_contents(HildonGrid * grid)
-{
-    HildonGridPrivate *priv;
-    gint new_row;
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-    new_row = (int) gtk_range_get_value(GTK_RANGE(priv->scrollbar))
-        / priv->item_height;
-
-    if (new_row != priv->old_sb_pos) {
-        priv->old_sb_pos = new_row;
-        priv->first_index = new_row * priv->num_columns;
-
-        return TRUE;
-    }
-    return FALSE;
-}
-
-/*
- * jump_scrollbar_to_focused:
- * @grid:   #HildonGrid
- *
- * Moves scrollbar position so that focused item will be shown 
- * in visible area.
- * Returns TRUE if visible position of widgets have changed.
- *
- * Return value: Content changed
- */
-static gboolean jump_scrollbar_to_focused(HildonGrid * grid)
-{
-    HildonGridPrivate *priv;
-    GtkAdjustment *adjustment;
-    gint child_count;
-    gint empty_grids;
-    gint new_row;
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-    /* If we don't have scrollbar, let the focus be broken, too. */
-    g_return_val_if_fail(priv->scrollbar != NULL, FALSE);
-
-    /* Make sure "first widget" is something sensible. */
-    priv->first_index = priv->first_index -
-        priv->first_index % priv->num_columns;
-
-    child_count = g_list_length(priv->children);
-    empty_grids = priv->num_columns * priv->area_rows - child_count +
-        priv->first_index;
-
-    /* Determine the position of the new row */ 
-    if (priv->focus_index < priv->first_index) {
-        new_row = priv->focus_index / priv->num_columns;
-    } else if (priv->focus_index >= priv->first_index +
-               priv->area_rows * priv->num_columns) {
-        gint last_top_row;
-        new_row = priv->focus_index / priv->num_columns -
-            priv->area_rows + 1;
-        last_top_row = child_count / priv->num_columns - priv->area_rows + 1;
-        if (child_count % priv->num_columns != 0) {
-            last_top_row++;
-        }
-        if (new_row > last_top_row) {
-            new_row = last_top_row;
-       }
-    } else if (empty_grids >= priv->num_columns) {
-        new_row = ((child_count - 1) / priv->num_columns + 1)
-            - priv->area_rows;
-        if (new_row < 0) {
-            new_row = 0;
-        }
-    } else {
-        return FALSE;
-    }
-
-    /* Move scrollbar accordingly. */
-    adjustment = gtk_range_get_adjustment(GTK_RANGE(priv->scrollbar));
-    adjustment->value = (gdouble) (new_row * priv->item_height);
-    gtk_range_set_adjustment(GTK_RANGE(priv->scrollbar), adjustment);
-    priv->first_index = new_row * priv->num_columns;
-    priv->old_sb_pos = new_row;
-
-    gtk_widget_queue_draw(priv->scrollbar);
-
-    return TRUE;
-}
-
-
-/*
- * adjust_scrollbar_height:
- * @grid:   HildonGridPrivate
- *
- * Return value: View should change
- *
- * Adjust scrollbar according the #HildonGrid contents. 
- * Show/hide scrollbar if
- * appropriate. Also sets priv->first_index.
- */
-static gboolean adjust_scrollbar_height(HildonGrid * grid)
-{
-    HildonGridPrivate *priv;
-    GtkRequisition req;
-    GtkAdjustment *adj;
-    GtkAllocation alloc;
-    GtkAllocation *gridalloc;
-    gint old_upper;
-    gint need_rows;
-    gint need_pixels;
-    gboolean updated;
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-    g_return_val_if_fail(priv->scrollbar != NULL, FALSE);
-
-    updated = FALSE;
-    gridalloc = &GTK_WIDGET(grid)->allocation;
-
-    /* See if we need scrollbar at all. */
-    if (priv->num_columns == 0) {
-        priv->num_columns = DEFAULT_N_COLUMNS;
-    } else {
-        priv->num_columns = MAX(1, priv->num_columns);
-    }
-
-    if (g_list_length(priv->children) != 0) {
-        need_rows = (g_list_length(priv->children) - 1) /
-            priv->num_columns + 1;
-    } else {
-        need_rows = 0;
-    }
-
-    if (need_rows <= priv->area_rows) {
-        updated = priv->first_index != 0;
-       priv->scrollbar_width = 0;
-
-        priv->first_index = 0;
-        if (GTK_WIDGET_VISIBLE(priv->scrollbar)) {
-            GtkWidget *parent = gtk_widget_get_toplevel (GTK_WIDGET (grid));
-            if (HILDON_IS_APP (parent))
-                g_object_set (parent, "scroll-control", FALSE, NULL);
-            gtk_widget_hide(priv->scrollbar);
-            updated = TRUE;
-        }
-
-        return updated;
-    }
-
-    /* All right then, we need scrollbar. Place scrollbar on the screen. */
-    gtk_widget_get_child_requisition(priv->scrollbar, &req);
-    priv->scrollbar_width = req.width;
-
-    alloc.width = req.width;
-    alloc.height = gridalloc->height;
-    alloc.x = gridalloc->width - req.width + gridalloc->x;
-    alloc.y = gridalloc->y;
-    gtk_widget_size_allocate(priv->scrollbar, &alloc);
-
-    if (!GTK_WIDGET_VISIBLE(priv->scrollbar)) {
-        GtkWidget *parent = gtk_widget_get_toplevel (GTK_WIDGET (grid));
-        if (HILDON_IS_APP (parent))
-            g_object_set (parent, "scroll-control", TRUE, NULL);
-        gtk_widget_show(priv->scrollbar);
-        updated = TRUE;
-    }
-
-
-    need_pixels = need_rows * priv->item_height;
-
-    /* Once we know how much space we need, update the scrollbar. */
-    adj = gtk_range_get_adjustment(GTK_RANGE(priv->scrollbar));
-    old_upper = (int) adj->upper;
-    adj->lower = 0.0;
-    adj->upper = (gdouble) need_pixels;
-    adj->step_increment = (gdouble) priv->item_height;
-    adj->page_increment = (gdouble) (priv->area_rows * priv->item_height);
-    adj->page_size =
-        (gdouble) (priv->area_height - priv->area_height % priv->item_height);
-
-    /* Also update position if needed to show focused item. */
-
-    gtk_range_set_adjustment(GTK_RANGE(priv->scrollbar), adj);
-
-    /* Then set first_index. */
-    priv->first_index = (int) adj->value / priv->item_height *
-                              priv->num_columns;
-
-    /* Finally, ask Gtk to redraw the scrollbar. */
-    if (old_upper != (int) adj->upper) {
-        gtk_widget_queue_draw(priv->scrollbar);
-    }
-    return updated;
-}
-
-/*
- * get_child_index_by_coord:
- * @priv:   HildonGridPrivate
- * @x:      X-coordinate
- * @y:      Y-coordinate
- *
- * Returns index of child at given coordinates, -1 if no child.
- *
- * Return value: Index
- */
-static gint
-get_child_index_by_coord(HildonGridPrivate * priv, gint x, gint y)
-{
-    int xgap, ygap;
-    int t;
-
-    if (priv->item_width==0 || priv->item_height==0) {
-      return -1;
-    }
-
-    xgap = x % priv->item_width;
-    ygap = y % priv->item_height;
-
-    if (xgap > priv->item_width - priv->h_margin) { /*FIXME*/
-        return -1;
-    }
-    
-    /* Event may come from outside of the grid. Skipping those events */
-    if (x >= priv->item_width * priv->num_columns)
-        return -1;
-
-    t = y / priv->item_height * priv->num_columns +
-        x / priv->item_width + priv->first_index;
-
-    if (t >= priv->first_index + priv->area_rows * priv->num_columns ||
-        t >= g_list_length(priv->children) || t < 0) {
-        return -1;
-    }
-    return t;
-}
-
-/*
- * get_child_by_index:
- * @priv:   HildonGridPrivate
- * @index:  Index of child
- *
- * Returns child that is #th in HildonGrid or NULL if child was not found
- * among the children.
- *
- * Return value: GtkWidget
- */
-static GtkWidget *get_child_by_index(HildonGridPrivate * priv, gint index)
-{
-    GList *list;
-    int i = 0;
-
-    if (index >= g_list_length(priv->children) || index < 0) {
-        return NULL;
-    }
-    for (list = priv->children, i = 0; list != NULL;
-         list = list->next, i++) {
-        if (index == i) {
-            return ((HildonGridChild *) list->data)->widget;
-        }
-    }
-
-    g_warning("no such child");
-    return NULL;
-}
-
-/*
- * get_child_index:
- * @priv:   HildonGridPrivate
- * @child:  #GtkWidget to look for
- *
- * Returns index of a child or -1 if child was not found among the
- * children.
- *
- * Return value: Index
- */
-static gint get_child_index(HildonGridPrivate * priv, GtkWidget * child)
-{
-    GList *list;
-    gint index;
-
-    if (child == NULL)
-        return -1;
-
-    for (list = priv->children, index = 0;
-         list != NULL; list = list->next, index++) {
-        if (((HildonGridChild *) list->data)->widget == child) {
-            return index;
-        }
-    }
-
-    g_warning("no such child");
-    return -1;
-}
-
-
-/**
- * hildon_grid_activate_child:
- * @grid:   #HildonGrid
- * @item:   #HildonGridItem
- *
- * Sends a signal to indicate that this HildonGridItem is activated.
- */
-void hildon_grid_activate_child(HildonGrid * grid, HildonGridItem * item)
-{
-    g_return_if_fail(HILDON_IS_GRID(grid));
-
-    g_signal_emit(grid, grid_signals[ACTIVATE_CHILD], 0, item);
-}
-
-
-
-/**
- * hildon_grid_set_style:
- * @grid:       #HildonGrid
- * @style_name: style name
- *
- * Sets style. Setting style sets widget size, spacing, label position,
- * number of columns, and icon size.
- */
-void hildon_grid_set_style(HildonGrid * grid, const gchar * style_name)
-{
-    HildonGridPrivate *priv;
-
-    g_return_if_fail(HILDON_IS_GRID(grid));
-
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-    if (priv->style != NULL) {
-        g_free((gpointer) priv->style);
-    }
-    if (style_name != NULL) {
-        priv->style = g_strdup(style_name);
-    } else {
-        priv->style = NULL;
-    }
-
-    gtk_widget_set_name(GTK_WIDGET(grid), style_name);
-    get_style_properties(grid);
-
-    gtk_widget_queue_resize(GTK_WIDGET(grid));
-}
-
-/**
- * hildon_grid_get_style:
- * @grid:   #HildonGrid
- *
- * Returns the name of style currently used in HildonGrid.
- *
- * Returns: style name
- */
-const gchar *hildon_grid_get_style(HildonGrid * grid)
-{
-    g_return_val_if_fail(HILDON_IS_GRID(grid), NULL);
-
-    return gtk_widget_get_name(GTK_WIDGET(grid));
-}
-
-/*
- * get_style_properties:
- * @grid:   #HildonGrid
- *
- * Gets widget size and other properties from gtkrc. If some properties
- * have changed, notify children of this, too.
- */
-static void get_style_properties(HildonGrid * grid)
-{
-    GList *iter;
-    gint num_columns;
-    HildonGridPositionType label_pos;
-    gint emblem_size;
-
-    gint h_margin, v_margin;
-    gint item_height;
-    gint icon_width;
-    gint focus_margin, icon_label_margin;
-    gint label_height;
-
-    HildonGridPrivate *priv;
-    g_return_if_fail(HILDON_IS_GRID(grid));
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-    gtk_widget_style_get(GTK_WIDGET(grid),
-                         "item_hspacing", &h_margin,
-                         "item_vspacing", &v_margin,
-                         "item_height", &item_height,
-                         "icon_size", &icon_width,
-                         "n_columns", &num_columns,
-                         "label_pos", &label_pos,
-                         "label_hspacing", &focus_margin,
-                         "label_vspacing", &icon_label_margin,
-                         "emblem_size", &emblem_size,
-                         "label_height", &label_height,
-                         NULL);
-
-    hildon_grid_set_icon_width(grid, icon_width);
-    hildon_grid_set_num_columns(grid, num_columns);
-    hildon_grid_set_label_pos(grid, label_pos);
-    hildon_grid_set_focus_margin(grid, focus_margin);
-    hildon_grid_set_icon_label_margin(grid, icon_label_margin);
-    hildon_grid_set_emblem_size(grid, emblem_size);
-    hildon_grid_set_label_height(grid, label_height);
-
-    priv->h_margin = h_margin;
-    priv->v_margin = v_margin;
-    priv->item_height = item_height;
-
-    iter = NULL;
-    /*
-    for (iter = priv->children; iter != NULL; iter = iter->next) {
-        HildonGridItem *child;
-        child = HILDON_GRID_ITEM(((HildonGridChild *) iter->data)->widget);
-        _hildon_grid_item_done_updating_settings(child);
-    }
-    */
-}
-
-
-
-/**
- * hildon_grid_set_scrollbar_pos:
- * @grid:           #HildonGrid
- * @scrollbar_pos:  new position (in pixels)
- *
- * Sets view (scrollbar) to specified position.
- */
-void hildon_grid_set_scrollbar_pos(HildonGrid * grid, gint scrollbar_pos)
-{
-    HildonGridPrivate *priv;
-    GtkAdjustment *adjustment;
-
-    g_return_if_fail(HILDON_IS_GRID(grid));
-
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-    adjustment = gtk_range_get_adjustment(GTK_RANGE(priv->scrollbar));
-    adjustment->value = (gdouble) scrollbar_pos;
-
-    gtk_range_set_adjustment(GTK_RANGE(priv->scrollbar), adjustment);
-
-    g_object_notify (G_OBJECT (grid), "scrollbar-position");
-
-    /* If grid isn't drawable, updating anything could mess up focus. */
-    if (!GTK_WIDGET_DRAWABLE(GTK_WIDGET(grid)))
-        return;
-
-    update_contents(grid);
-}
-
-/**
- * hildon_grid_get_scrollbar_pos:
- * @grid:   #HildonGrid
- *
- * Returns: position of scrollbar (in pixels).
- */
-gint hildon_grid_get_scrollbar_pos(HildonGrid * grid)
-{
-    GtkAdjustment *adjustment;
-
-    g_return_val_if_fail(HILDON_IS_GRID(grid), -1);
-
-    adjustment = gtk_range_get_adjustment(GTK_RANGE
-                                          (HILDON_GRID_GET_PRIVATE
-                                           (grid)->scrollbar));
-    return (int) adjustment->value;
-}
-
-static void
-hildon_grid_set_property(GObject * object,
-                         guint prop_id,
-                         const GValue * value, GParamSpec * pspec)
-{
-    HildonGrid *grid;
-
-    grid = HILDON_GRID(object);
-
-    switch (prop_id) {
-    case PROP_EMPTY_LABEL:
-        hildon_grid_set_empty_label(grid, g_value_get_string(value));
-        break;
-
-    case PROP_STYLE:
-        hildon_grid_set_style(grid, g_value_get_string(value));
-        break;
-
-    case PROP_SCROLLBAR_POS:
-        hildon_grid_set_scrollbar_pos(grid, g_value_get_int(value));
-        break;
-
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-        break;
-    }
-}
-
-static void
-hildon_grid_get_property(GObject * object,
-                         guint prop_id, GValue * value, GParamSpec * pspec)
-{
-    HildonGrid *grid;
-
-    grid = HILDON_GRID(object);
-
-    switch (prop_id) {
-    case PROP_EMPTY_LABEL:
-        g_value_set_string(value, hildon_grid_get_empty_label(grid));
-        break;
-
-    case PROP_STYLE:
-        g_value_set_string(value, hildon_grid_get_style(grid));
-        break;
-
-    case PROP_SCROLLBAR_POS:
-        g_value_set_int(value, hildon_grid_get_scrollbar_pos(grid));
-        break;
-
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-        break;
-    }
-}
-
-static gboolean
-hildon_grid_state_changed(GtkWidget * widget,
-                          GtkStateType state, gpointer data)
-{
-    HildonGrid *grid;
-    HildonGridPrivate *priv;
-    GList *list;
-    GtkWidget *current;
-    GtkWidget *prev_focusable, *next_focusable;
-    gboolean found_old;
-
-    g_return_val_if_fail(HILDON_IS_GRID(data), FALSE);
-    g_return_val_if_fail(HILDON_IS_GRID_ITEM(widget), FALSE);
-
-    grid = HILDON_GRID(data);
-    priv = HILDON_GRID_GET_PRIVATE(grid);
-
-
-    if (GTK_WIDGET_IS_SENSITIVE(widget))
-        return FALSE;
-
-    prev_focusable = next_focusable = NULL;
-    found_old = FALSE;
-
-    for (list = priv->children; list != NULL; list = list->next) {
-        current = ((HildonGridChild *) list->data)->widget;
-
-        if (GTK_WIDGET_IS_SENSITIVE(current)) {
-            if (found_old) {
-                next_focusable = current;
-                break;
-            } else {
-                prev_focusable = current;
-            }
-        } else if (current == widget) {
-            found_old = TRUE;
-        }
-    }
-
-    if (next_focusable == NULL) {
-        next_focusable = prev_focusable;
-    }
-
-    gtk_container_set_focus_child(GTK_CONTAINER(grid), next_focusable);
-
-    return FALSE;
-}
-
-
-
-static void
-hildon_grid_tap_and_hold_setup(GtkWidget * widget,
-                               GtkWidget * menu,
-                               GtkCallback func,
-                               GtkWidgetTapAndHoldFlags flags)
-{
-    g_return_if_fail(HILDON_IS_GRID(widget) && GTK_IS_MENU(menu));
-
-    parent_class->parent_class.tap_and_hold_setup
-        (widget, menu, func, flags | GTK_TAP_AND_HOLD_NO_INTERNALS);
-}
diff --git a/src/hildon-grid.h b/src/hildon-grid.h
deleted file mode 100644 (file)
index 4863566..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/*
- * @file hildon-grid.h
- *
- * This file is a header file for hildon-grid.c, the implementation of
- * #HildonGrid. #HildonGrid is used in views like Home and Control Panel
- * which have single-tap activated items.
- */
-
-#ifndef __HILDON_GRID_H__
-#define __HILDON_GRID_H__
-
-#include <gtk/gtkcontainer.h>
-#include <hildon-widgets/hildon-grid-item.h>
-
-G_BEGIN_DECLS
-#define HILDON_TYPE_GRID            (hildon_grid_get_type ())
-#define HILDON_GRID(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                                            HILDON_TYPE_GRID, \
-                                            HildonGrid))
-#define HILDON_GRID_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), \
-                                            HILDON_TYPE_GRID, \
-                                            HildonGridClass))
-#define HILDON_IS_GRID(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                                            HILDON_TYPE_GRID))
-#define HILDON_IS_GRID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-                                            HILDON_TYPE_GRID))
-#define HILDON_GRID_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-                                            HILDON_TYPE_GRID, \
-                                            HildonGridClass))
-typedef struct _HildonGrid HildonGrid;
-typedef struct _HildonGridClass HildonGridClass;
-
-
-
-struct _HildonGrid {
-    GtkContainer parent;
-};
-
-struct _HildonGridClass {
-    GtkContainerClass parent_class;
-
-    void (*activate_child) (HildonGrid * grid, HildonGridItem * item);
-    void (*popup_context_menu) (HildonGrid * grid, HildonGridItem * item);
-};
-
-GType hildon_grid_get_type(void);
-GtkWidget *hildon_grid_new(void);
-
-/*
- * Use GtkContainer API:
- *
- * void        gtk_container_set_focus_child   (GtkContainer    *container,
- *                                              GtkWidget       *child);
- *
- * GTK_CONTAINER (grid)->focus_child can be used to get focused child.
- */
-
-void hildon_grid_set_style(HildonGrid * grid, const gchar * style_name);
-const gchar *hildon_grid_get_style(HildonGrid * grid);
-
-void hildon_grid_set_scrollbar_pos(HildonGrid * grid, gint scrollbar_pos);
-gint hildon_grid_get_scrollbar_pos(HildonGrid * grid);
-
-
-/*
- * We are going to use gtk_container_add/remove, so these are internal.
- * If GridView is not visible, it won't update the view, so it should be
- * hidden when doing massive modifications.
- *
- * 
- * Use GtkContainer API:
- *
- * void        gtk_container_add               (GtkContainer    *container,
- *                                              GtkWidget       *widget);
- *
- * void        gtk_container_remove            (GtkContainer    *container,
- *                                              GtkWidget       *widget);
- */
-
-void hildon_grid_activate_child(HildonGrid * grid, HildonGridItem * item);
-
-G_END_DECLS
-#endif /* __HILDON_GRID_H__ */
diff --git a/src/hildon-scroll-area.c b/src/hildon-scroll-area.c
deleted file mode 100644 (file)
index ff484be..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/**
- * SECTION:hildon-scroll-area
- * @short_description: A helper to create Maemo specific views,
- * which are using scrollable area
- *
- * #GtkScrollArea combines a large widget that needs scrolling (like a
- * text editor or a tree view) and other widgets that wouldn't fit one
- * the screen normally without scrolling (like entries, toolbars etc.)
- * into one scrollable area.
- */
-
-#include "hildon-scroll-area.h"
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkfixed.h>
-#include <gtk/gtkadjustment.h>
-#include <gtk/gtkwidget.h>
-#include <string.h>
-
-typedef struct
-  {
-    GtkWidget *fixed;
-
-    /* Scrolled windows */
-    GtkWidget *swouter;
-    GtkWidget *swinner;
-
-    /* Widget that's being contained */
-    GtkWidget *child;
-
-    /* Vertical adjustment for scrolled windows */
-    GtkAdjustment *outadj;
-    GtkAdjustment *inadj;
-
-  } HildonScrollArea;
-
-
-static void hildon_scroll_area_outer_value_changed (GtkAdjustment *adjustment,
-                                                   HildonScrollArea *sc);
-static void hildon_scroll_area_inner_value_changed (GtkAdjustment *adjustment,
-                                                   HildonScrollArea *sc);
-static void hildon_scroll_area_size_allocate (GtkWidget *widget,
-                                             GtkAllocation *allocation,
-                                             HildonScrollArea *sc);
-static void hildon_scroll_area_child_requisition (GtkWidget *widget,
-                                                 GtkRequisition *req,
-                                                 HildonScrollArea *sc);
-static void hildon_scroll_area_fixed_allocate (GtkWidget *widget,
-                                              GtkAllocation *allocation,
-                                              HildonScrollArea *sc);
-
-static int calculate_size (GtkWidget *widget);
-
-/**
- * hildon_scroll_area_new:
- * @sw: #GtkWidget - #GtkScrolledWindow
- * @child: #GtkWidget - child to be place inside the sw
- *
- * This is not a widget. It's a helper function to create
- * hildon-specific scrolling methods.
- * A common situation where the scroll area should be used
- * might be following.  A view containing @GtkTreeView based widget,
- * (or any similar widget which has built-in @GtkScrolledWindow support)
- * and eg. couple buttons.  Normaly @GtkScrolledWindow can not handle
- * the situation so that the @GtkTreeView built-in support
- * would work.  The scroll area is connecting this built-in system to
- * the scrolled window and also noticing the buttons.  To use, one should
- * create a box to which pack the buttons and the scroll area.
- * The scroll area then contains the problematic widget eg. the @GtkTreeView.
- * Then the box should be placed in the @GtkScrolledWindow.
- * The function is currently assuming that the newly created scroll area
- * hierarchy is not modified in anyway.  Or if it is, it may lead to
- * unwanted problems.  Also assumed, that the @child will be packed
- * to the @sw.
- *
- * Returns: a @GtkFixed
- */
-GtkWidget *hildon_scroll_area_new (GtkWidget *sw, GtkWidget *child)
-{
-  GtkWidget *swi;
-  GtkWidget *fixed;
-  HildonScrollArea *sc;
-
-  g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (sw)
-                       && GTK_IS_WIDGET (child), NULL);
-
-  swi = gtk_scrolled_window_new (NULL, NULL);
-  fixed = gtk_fixed_new ();
-  sc = g_malloc (sizeof (HildonScrollArea));
-  memset (sc, 0, sizeof (HildonScrollArea));
-
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swi),
-                                 GTK_POLICY_NEVER, GTK_POLICY_NEVER);
-
-  gtk_container_add (GTK_CONTAINER (swi), child);
-  gtk_fixed_put (GTK_FIXED (fixed), swi, 0, 0);
-
-  sc->fixed = fixed;
-  sc->swouter = sw;
-  sc->swinner = swi;
-  sc->child = child;
-  sc->outadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw));
-  sc->inadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (swi));
-
-  g_signal_connect_after (G_OBJECT (child), "size-request",
-                         G_CALLBACK (hildon_scroll_area_child_requisition), sc);
-
-  g_signal_connect_after (G_OBJECT (sc->outadj), "value_changed",
-                         G_CALLBACK (hildon_scroll_area_outer_value_changed), sc);
-  g_signal_connect_after (G_OBJECT (sc->inadj), "value_changed",
-                         G_CALLBACK (hildon_scroll_area_inner_value_changed), sc);
-
-  g_signal_connect_after (G_OBJECT (sw), "size-allocate",
-                         G_CALLBACK (hildon_scroll_area_size_allocate), sc);
-  g_signal_connect (G_OBJECT (sc->fixed), "size-allocate",
-                   G_CALLBACK (hildon_scroll_area_fixed_allocate), sc);
-  g_signal_connect_swapped (G_OBJECT (sw), "destroy",
-                   G_CALLBACK (g_free), sc);
-
-  gtk_widget_show_all (sw);
-  return fixed;
-}
-
-static void hildon_scroll_area_fixed_allocate (GtkWidget *widget,
-                                              GtkAllocation *allocation,
-                                              HildonScrollArea *sc)
-{
-  gtk_widget_set_size_request (sc->swinner, -1,
-                              MIN (sc->outadj->page_size, allocation->height));
-}
-
-
-static int calculate_size (GtkWidget *widget)
-{
-  int size = 0;
-
-  if (GTK_IS_TEXT_VIEW (widget))
-    return 0;
-
-  if (GTK_IS_CONTAINER (widget)) {
-    GList *children = gtk_container_get_children (GTK_CONTAINER (widget));
-    while (children != NULL) {
-      GtkWidget *wid = GTK_WIDGET (children->data);
-      gint sz = calculate_size (wid);
-      if ((GTK_WIDGET_VISIBLE (wid))) {
-        size += sz;
-      }
-
-      children = g_list_next (children);
-    }
-  } else { 
-    size = widget->allocation.height;
-  }
-
-  return size;
-}
-
-static void hildon_scroll_area_child_requisition (GtkWidget *widget,
-                                                 GtkRequisition *req,
-                                                 HildonScrollArea *sc)
-{
-  /* Limit height to fixed height */
-  gint new_req = MAX (req->height, sc->fixed->allocation.height);
-  gint adjust_factor = calculate_size (sc->swouter) * 0.7;
-  
-  adjust_factor = MAX (0, adjust_factor - sc->outadj->value);
-  new_req = MIN (sc->outadj->page_size - adjust_factor, new_req);
-
-  gtk_widget_set_size_request (sc->fixed, -1, req->height);
-  /* Request inner scrolled window at most page size */
-  gtk_widget_set_size_request (sc->swinner, -1, new_req);
-}
-
-static void hildon_scroll_area_outer_value_changed (GtkAdjustment *adjustment,
-                                                    HildonScrollArea *sc)
-{
-  GtkRequisition req;
-  gtk_widget_size_request (sc->child, &req);
-
-  /* Update inner adjustment position based on outer one, update fixed position */
-  if ((sc->outadj->value + sc->outadj->page_size) > sc->fixed->allocation.y
-      && sc->outadj->value < (sc->fixed->allocation.y + req.height))
-    {
-      gdouble new_pos = 0;
-
-      new_pos = MAX (sc->outadj->value - sc->fixed->allocation.y, 0);
-      new_pos = MIN (new_pos, req.height - sc->inadj->page_size);
-      new_pos = MAX (new_pos, 0);
-
-      gtk_fixed_move (GTK_FIXED (sc->fixed), sc->swinner, 0, new_pos);
-      gtk_adjustment_set_value (sc->inadj, new_pos);
-    }
-}
-
-static void hildon_scroll_area_inner_value_changed (GtkAdjustment *adjustment,
-                                                   HildonScrollArea *sc)
-{
-  /* Update outer adjustment based on inner adjustment position */
-  if (sc->outadj->value != sc->fixed->allocation.y + adjustment->value)
-    gtk_adjustment_set_value (sc->outadj,
-                             sc->fixed->allocation.y + adjustment->value);
-}
-
-__inline__ static gint calculate_width (HildonScrollArea *sc)
-{
-  GtkScrolledWindow *scwin = GTK_SCROLLED_WINDOW (sc->swouter);
-  return (scwin->hscrollbar_visible * scwin->hscrollbar->allocation.width);
-}
-
-static void hildon_scroll_area_size_allocate (GtkWidget *widget,
-                                             GtkAllocation *allocation,
-                                             HildonScrollArea *sc)
-{
-  gtk_widget_set_size_request (sc->fixed, calculate_width (sc), sc->fixed->allocation.height);
-  gtk_widget_set_size_request (sc->child, sc->fixed->allocation.width, -1);
-}
diff --git a/src/hildon-scroll-area.h b/src/hildon-scroll-area.h
deleted file mode 100644 (file)
index ce1c725..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/*
- * The reason why this is not made as a widget:
- *  We can not create a widget which could return the correct child.
- *  (ie. by gtk_bin_get_child)
- */
-
-#ifndef __HILDON_SCROLL_AREA_H__
-#define __HILDON_SCROLL_AREA_H__
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-    GtkWidget * hildon_scroll_area_new(GtkWidget * sw, GtkWidget * child);
-
-G_END_DECLS
-#endif /* __HILDON_SCROLL_AREA_H__ */
diff --git a/src/hildon-system-sound.c b/src/hildon-system-sound.c
deleted file mode 100644 (file)
index 38d29fd..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/**
- * SECTION:hildon-system-sound
- * @short_description: An esd-based utility function for playing a sound
- * 
- * HildonSystemSound is an esd-based utility function for playing a sound 
- * from the system sounds directory with volume taken from GConf.
- */
-
-#include <gconf/gconf-client.h>
-#include <esd.h>
-#include "hildon-system-sound.h"
-
-#define ALARM_GCONF_PATH "/apps/osso/sound/system_alert_volume"
-
-/**
- * hildon_play_system_sound:
- * @sample: sound file to play
- * 
- * Plays the given sample using esd sound daemon.
- * Volume level is received from gconf. 
- */
-void hildon_play_system_sound(const gchar *sample)
-{
-  GConfClient *client;
-  GConfValue *value;
-  gint volume, scale, sock, sample_id;
-
-  client = gconf_client_get_default();
-  value = gconf_client_get(client, ALARM_GCONF_PATH, NULL);
-
-  /* We want error cases to match full volume, not silence, so
-     we do not want to use gconf_client_get_int */
-  if (!value || value->type != GCONF_VALUE_INT)
-    volume = 2;
-  else
-    volume = gconf_value_get_int(value);
-
-  if (value)
-    gconf_value_free(value);
-  g_object_unref(client);
-
-  switch (volume)
-  {
-    case 0:
-      return;
-    case 1:
-      scale = 0x80;
-      break;
-    case 2:
-    default:
-      scale = 0xff;
-      break;
-  };
-    
-  sock = esd_open_sound(NULL);
-  if (sock <= 0)
-    return;
-
-  sample_id = esd_file_cache(sock, g_get_prgname(), sample);
-  if (sample_id < 0) {
-    close(sock);
-    return;
-  }
-  
-  esd_set_default_sample_pan(sock, sample_id, scale, scale);
-  esd_sample_play(sock, sample_id);
-  esd_sample_free(sock, sample_id);
-  close(sock);
-}
diff --git a/src/hildon-system-sound.h b/src/hildon-system-sound.h
deleted file mode 100644 (file)
index 666a8bb..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-#ifndef __HILDON_SYSTEM_SOUND_H__
-#define __HILDON_SYSTEM_SOUND_H__
-
-G_BEGIN_DECLS
-
-void hildon_play_system_sound(const gchar *sample);
-
-G_END_DECLS
-#endif /* __HILDON_SYSTEM_SOUND_H__ */
diff --git a/src/hildon-telephone-editor.c b/src/hildon-telephone-editor.c
deleted file mode 100644 (file)
index a18acad..0000000
+++ /dev/null
@@ -1,1436 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/**
- * SECTION:hildon-telephone-editor.c
- * @short_description: A widget which allows users to enter telephone numbers 
- *
- * A single-line editor which allows user to enter a telephone number. 
- * There are two modes to choose from (coerce/free format). 
- * Coerce format has three fields which are placed horizontally. 
- * The fields are: country code, area code and number. When nothing is 
- * entered in the fields, assisting text is displayed. Tapping on the 
- * field highlights the field and allows users to input numbers.
- *
- * The widget is used where a user should enter a phone number. Free format 
- * should be used wherever possible as it enables the user to enter the 
- * phone number in the format she likes. Free format also supports DTMF 
- * strings as a part of the phone number. The format can not be changed 
- * at runtime.  
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-#include <libintl.h>
-#include <string.h>
-#include "hildon-telephone-editor.h"
-#include "hildon-composite-widget.h"
-
-#define _(String) gettext (String)
-#define HILDON_TELEPHONE_EDITOR_GET_PRIVATE(obj) \
-        (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
-        HILDON_TELEPHONE_EDITOR_TYPE, HildonTelephoneEditorPriv));
-
-#define AREA_LEN 4
-#define COUNTRY_LEN 7
-#define NUMBER_LEN 10
-
-#define AREA_STR "Area"
-#define COUNTRY_STR "Country"
-#define NUMBER_STR "Number"
-
-typedef struct _HildonTelephoneEditorPriv HildonTelephoneEditorPriv;
-
-enum {
-    PROP_0,
-    PROP_COUNTRY_STR,
-    PROP_AREA_STR,
-    PROP_NUMBER_STR,
-    PROP_SHOW_BORDER,
-    PROP_SHOW_PLUS,
-    PROP_FORMAT
-};
-
-/*< private >*/
-struct _HildonTelephoneEditorPriv {
-    HildonTelephoneEditorFormat format; /* format of the editor */
-
-    gboolean edited_country;    /* is the country edited */
-    gboolean edited_area;       /* is the area edited */
-    gboolean edited_number;     /* is the number edited */
-
-    gboolean editable_country;  /* is the country editable */
-    gboolean editable_area;     /* is the area editable */
-    gboolean editable_number;   /* is the number editable */
-
-    gboolean show_plus; /* show '+' sign in country */
-    gboolean show_border;       /* show border around the widget */
-
-    GtkWidget *frame;   /* frame for border lines */
-    GtkWidget *plus;    /* + in front of country code */
-    GtkWidget *plus_event;      /* event box for the + -label */
-    GtkWidget *country; /* country code */
-    GtkWidget *area;    /* area code */
-    GtkWidget *number;  /* telephone number */
-
-    gint j;
-};
-
-
-static GtkContainerClass *parent_class;
-
-static void
-hildon_telephone_editor_class_init(HildonTelephoneEditorClass *
-                                   editor_class);
-
-static void 
-hildon_telephone_editor_init(HildonTelephoneEditor * editor);
-
-static void
-hildon_telephone_editor_forall(GtkContainer * container,
-                               gboolean include_internals,
-                               GtkCallback callback,
-                               gpointer callback_data);
-static void 
-hildon_telephone_editor_destroy(GtkObject * self);
-
-static void
-hildon_telephone_editor_size_allocate(GtkWidget * widget,
-                                      GtkAllocation * allocation);
-
-static void
-hildon_telephone_editor_size_request(GtkWidget * widget,
-                                     GtkRequisition * requisition);
-
-static gboolean
-hildon_telephone_editor_button_release(GtkWidget * widget,
-                                     GdkEventButton * event,
-                                     gpointer data);
-static void
-hildon_telephone_editor_focus_dest_entry(GtkWidget * widget,
-                                         gboolean edited,
-                                         gboolean move_left);
-static gboolean
-hildon_telephone_editor_entry_keypress(GtkWidget * widget,
-                                       GdkEventKey * event, gpointer data);
-
-static gboolean
-hildon_telephone_editor_mnemonic_activate( GtkWidget *widget,
-                                           gboolean group_cycling);
-
-static void
-hildon_telephone_editor_set_property(GObject * object,
-                                     guint prop_id,
-                                     const GValue * value,
-                                     GParamSpec * pspec);
-static void
-hildon_telephone_editor_get_property(GObject * object,
-                                     guint prop_id,
-                                     GValue * value, GParamSpec * pspec);
-
-GType hildon_telephone_editor_get_type(void)
-{
-    static GType editor_type = 0;
-
-    if (!editor_type) {
-        static const GTypeInfo editor_info = {
-            sizeof(HildonTelephoneEditorClass),
-            NULL,       /* base_init */
-            NULL,       /* base_finalize */
-            (GClassInitFunc) hildon_telephone_editor_class_init,
-            NULL,       /* class_finalize */
-            NULL,       /* class_data */
-            sizeof(HildonTelephoneEditor),
-            0,  /* n_preallocs */
-            (GInstanceInitFunc) hildon_telephone_editor_init,
-        };
-        editor_type = g_type_register_static(GTK_TYPE_CONTAINER,
-                                             "HildonTelephoneEditor",
-                                             &editor_info, 0);
-    }
-    return editor_type;
-}
-
-static void
-hildon_telephone_editor_class_init(HildonTelephoneEditorClass *
-                                   editor_class)
-{
-    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(editor_class);
-    GtkContainerClass *container_class = GTK_CONTAINER_CLASS(editor_class);
-    GObjectClass *object_class = G_OBJECT_CLASS(editor_class);
-
-    parent_class = g_type_class_peek_parent(editor_class);
-
-    g_type_class_add_private(editor_class, sizeof(HildonTelephoneEditorPriv));
-
-    widget_class->size_request = hildon_telephone_editor_size_request;
-    widget_class->size_allocate = hildon_telephone_editor_size_allocate;
-    container_class->forall = hildon_telephone_editor_forall;
-    widget_class->mnemonic_activate = hildon_telephone_editor_mnemonic_activate;
-    widget_class->focus = hildon_composite_widget_focus;
-    object_class->set_property = hildon_telephone_editor_set_property;
-    object_class->get_property = hildon_telephone_editor_get_property;
-
-    GTK_OBJECT_CLASS(editor_class)->destroy = hildon_telephone_editor_destroy;
-
-    /* Install properties */
-    g_object_class_install_property(object_class, PROP_COUNTRY_STR,
-        g_param_spec_string("country",
-                            ("Country string"),
-                            ("Country string"),
-                            COUNTRY_STR, G_PARAM_READWRITE));
-
-    g_object_class_install_property(object_class, PROP_AREA_STR,
-        g_param_spec_string("area",
-                            ("Area string"),
-                            ("Area string"),
-                            AREA_STR, G_PARAM_READWRITE));
-
-    g_object_class_install_property(object_class, PROP_NUMBER_STR,
-        g_param_spec_string("number",
-                            ("Number string"),
-                            ("Number string"),
-                            NUMBER_STR, G_PARAM_READWRITE));
-
-    g_object_class_install_property(object_class, PROP_SHOW_BORDER,
-        g_param_spec_boolean ("show-border",
-                             "Show Border",
-                             "Wether to show the border around the widget",
-                             TRUE, G_PARAM_READWRITE));
-
-    g_object_class_install_property(object_class, PROP_SHOW_PLUS,
-        g_param_spec_boolean ("show-plus",
-                             "Show Plus",
-                             "Wether to show the plus sign in front of"
-                             " coerce format's country field",
-                             TRUE, G_PARAM_READWRITE));
-
-    g_object_class_install_property(object_class, PROP_FORMAT,
-        g_param_spec_int("set-format",
-                         ("Format"),
-                         ("Sets telephoneditor format"),
-                         HILDON_TELEPHONE_EDITOR_FORMAT_FREE,
-                         HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA,
-                         0, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
-}
-
-static void
-hildon_telephone_editor_init(HildonTelephoneEditor * editor)
-{
-    HildonTelephoneEditorPriv *priv;
-    gboolean use_frames = FALSE;       /* in entries, for debug purposes */
-
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    priv->frame = gtk_frame_new(NULL);
-    priv->plus = gtk_label_new("+");
-    priv->plus_event = gtk_event_box_new();
-    priv->country = gtk_entry_new();
-    priv->area = gtk_entry_new();
-    priv->number = gtk_entry_new();
-    priv->edited_country = FALSE;
-    priv->edited_area = FALSE;
-    priv->edited_number = FALSE;
-    priv->show_plus = TRUE;
-    priv->show_border = TRUE;
-    priv->editable_country = TRUE;
-    priv->editable_area = TRUE;
-    priv->editable_number = TRUE;
-
-    gtk_container_add(GTK_CONTAINER(priv->plus_event), priv->plus);
-
-    gtk_entry_set_has_frame(GTK_ENTRY(priv->country), use_frames);
-    gtk_entry_set_has_frame(GTK_ENTRY(priv->area), use_frames);
-    gtk_entry_set_has_frame(GTK_ENTRY(priv->number), use_frames);
-
-    gtk_widget_set_parent(priv->frame, GTK_WIDGET(editor));
-    gtk_widget_set_parent(priv->plus_event, GTK_WIDGET(editor));
-    
-    hildon_telephone_editor_set_widths(editor, COUNTRY_LEN, AREA_LEN,
-                                       NUMBER_LEN);
-
-    /* set signals for country entry */
-    gtk_signal_connect(GTK_OBJECT(priv->country), "button_release_event",
-                       G_CALLBACK(hildon_telephone_editor_button_release),
-                       editor);
-
-    gtk_signal_connect(GTK_OBJECT(priv->country), "key-press-event",
-                       G_CALLBACK(hildon_telephone_editor_entry_keypress),
-                       editor);
-
-    /* set signals for plus label */
-    gtk_signal_connect(GTK_OBJECT(priv->plus_event), "button_press_event",
-                       G_CALLBACK(hildon_telephone_editor_button_release),
-                       editor);
-
-    /* set signals for area entry */
-    gtk_signal_connect(GTK_OBJECT(priv->area), "button_release_event",
-                       G_CALLBACK(hildon_telephone_editor_button_release),
-                       editor);
-
-    gtk_signal_connect(GTK_OBJECT(priv->area), "key-press-event",
-                       G_CALLBACK(hildon_telephone_editor_entry_keypress),
-                       editor);
-
-    /* set signals for number entry */
-    gtk_signal_connect(GTK_OBJECT(priv->number), "button_release_event",
-                       G_CALLBACK(hildon_telephone_editor_button_release),
-                       editor);
-
-    gtk_signal_connect(GTK_OBJECT(priv->number), "key-press-event",
-                       G_CALLBACK(hildon_telephone_editor_entry_keypress),
-                       editor);
-
-    GTK_WIDGET_SET_FLAGS(editor, GTK_NO_WINDOW);
-
-    gtk_widget_show(priv->number);
-    gtk_widget_show(priv->area);
-    gtk_widget_show(priv->country);
-    gtk_widget_show_all(priv->frame);
-    gtk_widget_show_all(priv->plus_event);
-}
-
-/**
- * hildon_telephone_editor_new:
- * @format: format of the editor
- *
- * Creates a new #HildonTelephoneEditor. The editor can be in a free
- * format where the user can type in country code, area code and the
- * phone number and can type in other characters than just digits. In
- * coerse format the editor has fields where the user can input only
- * digits. See #HildonTelephoneEditorFormat for the different coerse
- * formats.
- * 
- * Returns: new #HildonTelephoneEditor
- */
-GtkWidget *
-hildon_telephone_editor_new(HildonTelephoneEditorFormat format)
-{
-
-    HildonTelephoneEditor *editor;
-
-    editor =
-        g_object_new(HILDON_TELEPHONE_EDITOR_TYPE, "set-format", format,
-                     "set-country", _(COUNTRY_STR), "set-area",
-                     _(AREA_STR), "set-number", _(NUMBER_STR), NULL);
-
-    return GTK_WIDGET(editor);
-}
-
-/**
- * hildon_telephone_editor_new_with_strings:
- * @format: format of the editor
- * @country: default text for the country field
- * @area: default text for the area field
- * @number: default text for the number field
- *
- * Creates a new #HildonTelephoneEditor. See hildon_telephone_editor_new
- * for details.
- * 
- * Returns: new #HildonTelephoneEditor
- */
-GtkWidget *
-hildon_telephone_editor_new_with_strings(HildonTelephoneEditorFormat
-                                              format,
-                                              const gchar * country,
-                                              const gchar * area,
-                                              const gchar * number)
-{
-    HildonTelephoneEditor *editor;
-
-    editor =
-        g_object_new(HILDON_TELEPHONE_EDITOR_TYPE, "set-format", format,
-                     "set-country", country, "set-area", area,
-                     "set-number", number, NULL);
-
-    return GTK_WIDGET(editor);
-}
-
-static void 
-hildon_telephone_editor_get_property(GObject * object,
-                                                 guint prop_id,
-                                                 GValue * value,
-                                                 GParamSpec * pspec)
-{
-    HildonTelephoneEditor *editor;
-    HildonTelephoneEditorPriv *priv;
-
-    editor = HILDON_TELEPHONE_EDITOR (object);
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(object);
-
-    switch (prop_id) {
-    case PROP_COUNTRY_STR:
-        g_value_set_string(value,
-               hildon_telephone_editor_get_country(editor));
-        break;
-    case PROP_AREA_STR:
-        g_value_set_string(value, 
-               hildon_telephone_editor_get_area(editor));
-        break;
-    case PROP_NUMBER_STR:
-        g_value_set_string(value,
-                   hildon_telephone_editor_get_number(editor));
-        break;
-    case PROP_SHOW_BORDER:
-        g_value_set_boolean(value, 
-               hildon_telephone_editor_get_show_border(editor));
-        break;
-    case PROP_SHOW_PLUS:
-        g_value_set_boolean(value, 
-               hildon_telephone_editor_get_show_plus(editor));
-        break;
-    case PROP_FORMAT:
-        g_value_set_int(value, priv->format);
-        break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-        break;
-    }
-}
-
-static void 
-hildon_telephone_editor_set_property(GObject * object,
-                                                 guint prop_id,
-                                                 const GValue * value,
-                                                 GParamSpec * pspec)
-{
-    HildonTelephoneEditor *editor;
-    HildonTelephoneEditorPriv *priv;
-   
-    editor = HILDON_TELEPHONE_EDITOR (object);
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(object);
-
-    switch (prop_id) {
-    case PROP_COUNTRY_STR:
-        hildon_telephone_editor_set_country(editor,
-                           _(g_value_get_string(value)));
-        break;
-    case PROP_AREA_STR:
-        hildon_telephone_editor_set_area(editor,
-                           _(g_value_get_string(value)));
-        break;
-    case PROP_NUMBER_STR:
-        hildon_telephone_editor_set_number(editor,
-                           _(g_value_get_string(value)));
-        break;
-    case PROP_SHOW_BORDER:
-        hildon_telephone_editor_set_show_border(
-               editor, g_value_get_boolean(value));
-        break;
-    case PROP_SHOW_PLUS:
-        hildon_telephone_editor_set_show_plus(
-               editor, g_value_get_boolean(value));
-        break;
-    case PROP_FORMAT:
-        priv->format = g_value_get_int(value);
-        if (priv->format != HILDON_TELEPHONE_EDITOR_FORMAT_FREE)
-            gtk_entry_set_text(GTK_ENTRY(priv->number), _(NUMBER_STR));
-
-        /* set proper fields according to selected format */
-        switch (priv->format) {
-        case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE:
-            gtk_widget_set_parent(priv->number, GTK_WIDGET(object));
-        case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA:
-            gtk_widget_set_parent(priv->area, GTK_WIDGET(object));
-        case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY:
-            gtk_widget_set_parent(priv->country, GTK_WIDGET(object));
-            break;
-        case HILDON_TELEPHONE_EDITOR_FORMAT_FREE:
-            gtk_widget_set_parent(priv->number, GTK_WIDGET(object));
-            break;
-        default:
-            g_assert_not_reached();
-        }
-        break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-        break;
-    }
-}
-
-static gboolean
-hildon_telephone_editor_mnemonic_activate( GtkWidget *widget,
-                                  gboolean group_cycling)
-{
-  HildonTelephoneEditorPriv *priv;
-  priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(widget);
-
-  if (!GTK_CONTAINER(widget)->focus_child)
-  {
-    if (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_FREE)
-    {
-      gtk_widget_grab_focus(priv->number);
-
-      if (priv->editable_number && !priv->edited_number)
-        gtk_editable_select_region(GTK_EDITABLE(priv->number), 0, -1);
-    }
-    else
-    {
-      if (priv->editable_country)
-      {
-        gtk_widget_grab_focus(priv->country);
-        if (!priv->edited_country)
-          gtk_editable_select_region(GTK_EDITABLE(priv->country), 0, -1);
-      }
-      else if ((priv->editable_area) && (priv->format !=
-               HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY))
-      {
-        gtk_widget_grab_focus(priv->area);
-        if (!priv->edited_area)
-          gtk_editable_select_region(GTK_EDITABLE(priv->area), 0, -1);
-      }
-      else if ((priv->editable_number) && (priv->format ==
-               HILDON_TELEPHONE_EDITOR_FORMAT_COERCE))
-      {
-        gtk_widget_grab_focus(priv->number);
-        if (!priv->edited_number)
-          gtk_editable_select_region(GTK_EDITABLE(priv->number), 0, -1);
-      }
-      else
-        gtk_widget_grab_focus(priv->country);
-    }
-  }
-  return TRUE;
-}
-
-static void 
-hildon_telephone_editor_forall(GtkContainer * container,
-                                           gboolean include_internals,
-                                           GtkCallback callback,
-                                           gpointer callback_data)
-{
-    HildonTelephoneEditor *editor;
-    HildonTelephoneEditorPriv *priv;
-
-    editor = HILDON_TELEPHONE_EDITOR(container);
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    g_return_if_fail(container);
-    g_return_if_fail(callback);
-
-    if (!include_internals)
-        return;
-
-    switch (priv->format) {
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE:
-        (*callback) (priv->number, callback_data);
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA:
-        (*callback) (priv->area, callback_data);
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY:
-        (*callback) (priv->country, callback_data);
-        break;
-    case HILDON_TELEPHONE_EDITOR_FORMAT_FREE:
-        (*callback) (priv->number, callback_data);
-        break;
-    default:
-        g_return_if_reached();
-    }
-
-    if (priv->show_plus)
-        (*callback) (priv->plus_event, callback_data);
-
-    if (priv->show_border)
-        (*callback) (priv->frame, callback_data);
-
-}
-
-static void 
-hildon_telephone_editor_destroy(GtkObject * self)
-{
-    HildonTelephoneEditorPriv *priv;
-
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(self);
-
-    switch (priv->format) {
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE:
-        if (priv->number) {
-            gtk_widget_unparent(priv->number);
-            priv->number = NULL;
-        }
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA:
-        if (priv->area) {
-            gtk_widget_unparent(priv->area);
-            priv->area = NULL;
-        }
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY:
-        if (priv->country) {
-            gtk_widget_unparent(priv->country);
-            priv->country = NULL;
-        }
-        break;
-    case HILDON_TELEPHONE_EDITOR_FORMAT_FREE:
-        if (priv->number) {
-            gtk_widget_unparent(priv->number);
-            priv->number = NULL;
-        }
-        break;
-    default:
-        g_return_if_reached();
-    }
-
-    if (priv->plus_event) {
-        gtk_widget_unparent(priv->plus_event);
-        priv->plus_event = NULL;
-    }
-    if (priv->frame) {
-        gtk_widget_unparent(priv->frame);
-        priv->frame = NULL;
-    }
-    if (GTK_OBJECT_CLASS(parent_class)->destroy)
-        GTK_OBJECT_CLASS(parent_class)->destroy(self);
-}
-
-static void 
-hildon_telephone_editor_size_request(GtkWidget *widget,
-                                     GtkRequisition *requisition)
-{
-    HildonTelephoneEditor *editor;
-    HildonTelephoneEditorPriv *priv;
-    GtkRequisition req;
-
-    g_return_if_fail(requisition);
-
-    editor = HILDON_TELEPHONE_EDITOR(widget);
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    if (priv->show_border)
-        gtk_widget_size_request(priv->frame, requisition);
-
-    requisition->width = 0;
-    requisition->height = 0;
-
-    switch (priv->format)
-    {
-      case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE:
-        gtk_widget_size_request(priv->number, &req);
-        requisition->width += req.width;
-        if (requisition->height < req.height)
-            requisition->height = req.height;
-
-      case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA:
-        gtk_widget_size_request(priv->area, &req);
-        requisition->width += req.width;
-        if (requisition->height < req.height)
-            requisition->height = req.height;
-
-      case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY:
-        gtk_widget_size_request(priv->country, &req);
-        requisition->width += req.width;
-        if (requisition->height < req.height)
-            requisition->height = req.height;
-
-        break;
-      case HILDON_TELEPHONE_EDITOR_FORMAT_FREE:
-        gtk_widget_size_request(priv->number, &req);
-        requisition->width += req.width;
-        if (requisition->height < req.height)
-            requisition->height = req.height;
-
-        break;
-      default:
-        g_return_if_reached();
-    }
-
-    if (priv->show_plus)
-    {
-        gtk_widget_size_request(priv->plus_event, &req);
-        requisition->width += req.width;
-        if (requisition->height < req.height)
-            requisition->height = req.height;
-    }
-
-    requisition->width += GTK_CONTAINER(priv->frame)->border_width * 2;
-    requisition->height += GTK_CONTAINER(priv->frame)->border_width * 2;
-}
-
-static void 
-hildon_telephone_editor_size_allocate(GtkWidget *widget,
-                                      GtkAllocation *allocation)
-{
-    HildonTelephoneEditor *editor;
-    HildonTelephoneEditorPriv *priv;
-    gint header_x = 6, frame_w = 12;
-    GtkAllocation alloc, country_alloc, area_alloc, number_alloc;
-    GtkRequisition requisition, country_requisition, area_requisition,
-        number_requisition;
-
-    g_return_if_fail(widget);
-    g_return_if_fail(allocation);
-
-    if (allocation->height < 0 )
-      allocation->height = 0;
-    
-    widget->allocation = *allocation;
-    
-    header_x += allocation->x;
-    editor = HILDON_TELEPHONE_EDITOR(widget);
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-
-    if (priv->show_plus &&
-        priv->format != HILDON_TELEPHONE_EDITOR_FORMAT_FREE) {
-        gtk_widget_get_child_requisition(priv->plus_event, &requisition);
-
-        alloc.x = header_x;
-        alloc.y = allocation->y + 1;
-        alloc.width = requisition.width;
-        alloc.height = requisition.height;
-
-        header_x += alloc.width;
-        gtk_widget_size_allocate(priv->plus_event, &alloc);
-        frame_w += alloc.width;
-    }
-    
-    gtk_widget_get_child_requisition(priv->number, &number_requisition);
-
-    number_alloc.width = number_requisition.width;
-
-    number_alloc.height = allocation->height - 4 -
-                          GTK_CONTAINER(priv->frame)->border_width * 2;
-
-    /* get sizes */
-    switch (priv->format) {
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE:
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA:
-        gtk_widget_get_child_requisition(priv->area, &area_requisition);
-
-        area_alloc.width = area_requisition.width;
-        area_alloc.height = number_alloc.height;
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY:
-        gtk_widget_get_child_requisition(priv->country, &country_requisition);
-
-        country_alloc.width = country_requisition.width;
-        country_alloc.height = number_alloc.height;
-        break;
-    case HILDON_TELEPHONE_EDITOR_FORMAT_FREE:
-        break;
-    default:
-        g_return_if_reached();
-    }
-
-
-    /* allocate in coerce formats */
-    switch (priv->format) {
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE:
-        number_alloc.x = header_x + country_alloc.width + area_alloc.width;
-        number_alloc.y = allocation->y + 1;
-
-        gtk_widget_size_allocate(priv->number, &number_alloc);
-        frame_w += number_alloc.width;
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA:
-        area_alloc.x = header_x + country_alloc.width;
-        area_alloc.y = allocation->y + 1;
-
-        gtk_widget_size_allocate(priv->area, &area_alloc);
-        frame_w += area_alloc.width;
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY:
-        country_alloc.x = header_x;
-        country_alloc.y = allocation->y + 1;
-
-        gtk_widget_size_allocate(priv->country, &country_alloc);
-        frame_w += country_alloc.width;
-        break;
-    case HILDON_TELEPHONE_EDITOR_FORMAT_FREE:
-        number_alloc.x = header_x;
-        number_alloc.y = allocation->y + 1;
-
-        gtk_widget_size_allocate(priv->number, &number_alloc);
-        frame_w += number_alloc.width;
-        break;
-    default:
-        g_return_if_reached();
-    }
-
-    if (priv->show_border)
-    {
-        alloc.x = allocation->x;
-        alloc.y = allocation->y;
-
-        alloc.width = frame_w - 4;
-
-        alloc.height = allocation->height;
-        gtk_widget_size_allocate( GTK_WIDGET(priv->frame), &alloc );
-    }
-}
-
-static gboolean
-hildon_telephone_editor_button_release(GtkWidget * widget,
-                                     GdkEventButton * event, gpointer data)
-{
-  gtk_editable_select_region(GTK_EDITABLE(widget), 0, -1);
-  return FALSE;
-}
-
-static void 
-hildon_telephone_editor_focus_dest_entry(GtkWidget * widget,
-                                                     gboolean edited,
-                                                     gboolean move_left)
-{
-    /* full coerse mode, wrap to field */
-    gtk_widget_grab_focus(widget);
-
-    if (move_left)
-        gtk_editable_set_position(GTK_EDITABLE(widget), -1);
-    else
-        gtk_editable_set_position(GTK_EDITABLE(widget), 0);
-    /* new field not yet edited, select all */
-    if (!edited)
-        gtk_editable_select_region(GTK_EDITABLE(widget), 0, -1);
-}
-
-static gboolean
-hildon_telephone_editor_entry_keypress(GtkWidget * widget,
-                                       GdkEventKey * event, gpointer data)
-{
-    HildonTelephoneEditor *editor;
-    HildonTelephoneEditorPriv *priv;
-    gint pos, width;
-    gint cpos, start, end;
-
-    g_return_val_if_fail(widget, FALSE);
-    g_return_val_if_fail(event, FALSE);
-    g_return_val_if_fail(data, FALSE);
-
-    editor = HILDON_TELEPHONE_EDITOR(data);
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-    cpos = gtk_editable_get_position(GTK_EDITABLE(widget));
-    gtk_editable_get_selection_bounds(GTK_EDITABLE(widget), &start, &end);
-
-    if( event->keyval == GDK_Up || event->keyval == GDK_KP_Up ||
-        event->keyval == GDK_Down || event->keyval == GDK_KP_Down )
-      return FALSE;
-
-    /* Wrap around should not happen; that's why following code */
-    switch (priv->format) {
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE:
-        if (((event->keyval == GDK_Left || event->keyval == GDK_KP_Left) &&
-             (widget == priv->country) && ((cpos == 0) ||
-             ((start == 0 && end == strlen(GTK_ENTRY(priv->country)->text)))))
-            ||
-            ((event->keyval == GDK_Right || event->keyval == GDK_KP_Right)
-             && (widget == priv->number)
-             && (cpos >= strlen(GTK_ENTRY(priv->number)->text))))
-            return TRUE;
-        break;
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA:
-        if (((event->keyval == GDK_Left || event->keyval == GDK_KP_Left) &&
-             (widget == priv->country) && ((cpos == 0) ||
-                                           ((start == 0
-                                             && end ==
-                                             strlen(GTK_ENTRY
-                                                    (priv->country)->
-                                                    text)))))
-            ||
-            ((event->keyval == GDK_Right || event->keyval == GDK_KP_Right)
-             && (widget == priv->area)
-             && (cpos >= strlen(GTK_ENTRY(priv->area)->text))))
-            return TRUE;
-        break;
-    case HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY:
-        break;
-    case HILDON_TELEPHONE_EDITOR_FORMAT_FREE:
-        break;
-    }
-
-    /* valid key pressed */
-    if (event->keyval == GDK_Left || event->keyval == GDK_KP_Left ||
-        event->keyval == GDK_Right || event->keyval == GDK_KP_Right ||
-        event->keyval == GDK_BackSpace || event->keyval == GDK_Delete ||
-        event->keyval == GDK_KP_Delete ||
-        (event->keyval >= GDK_0 && event->keyval <= GDK_9) ||
-        (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_FREE &&
-         (event->keyval == GDK_slash || event->keyval == GDK_space ||
-          event->keyval == GDK_parenleft || event->keyval == GDK_parenright
-          || event->keyval == GDK_period || event->keyval == GDK_hyphen
-          || event->keyval == GDK_plus || event->keyval == GDK_asterisk
-          || event->keyval == GDK_KP_Multiply
-          || event->keyval == GDK_KP_Add || event->keyval == GDK_numbersign
-          || event->keyval == GDK_question || event->keyval == GDK_KP_Subtract
-          || event->keyval == GDK_minus)))
-    {
-        if ((event->keyval >= GDK_0 && event->keyval <= GDK_9) ||
-            (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_FREE &&
-             (event->keyval == GDK_slash || event->keyval == GDK_space ||
-              event->keyval == GDK_parenleft ||
-              event->keyval == GDK_parenright ||
-              event->keyval == GDK_period || event->keyval == GDK_hyphen ||
-              event->keyval == GDK_plus || event->keyval == GDK_asterisk ||
-              event->keyval == GDK_KP_Add ||
-              event->keyval == GDK_KP_Multiply ||
-              event->keyval == GDK_numbersign ||
-              event->keyval == GDK_question ||
-              event->keyval == GDK_KP_Subtract || 
-              event->keyval == GDK_minus)))
-        {
-            if (widget == priv->country)
-                priv->edited_country = TRUE;
-            if (widget == priv->area)
-                priv->edited_area = TRUE;
-            if (widget == priv->number)
-                priv->edited_number = TRUE;
-        }
-
-        pos = gtk_editable_get_position(GTK_EDITABLE(widget));
-
-        /* going left */
-        if (event->keyval == GDK_Left || event->keyval == GDK_KP_Left) {
-            /* not yet on the left edge and the widget is edited */
-            if (pos != 0 &&
-                ((widget == priv->country && priv->edited_country == TRUE)
-                 || (widget == priv->area && priv->edited_area == TRUE)
-                 || (widget == priv->number
-                     && priv->edited_number == TRUE)))
-                return FALSE;
-
-            /* left edge of number field */
-            if (widget == priv->number) {
-                /* Stop signal handler, if only number field exists */
-                if (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_FREE)
-                    return TRUE;
-                else {
-                    /* Grab the focus to the area field, if it is editable 
-                     */
-                    if (priv->editable_area) {
-                        hildon_telephone_editor_focus_dest_entry
-                            (priv->area, priv->edited_area, TRUE);
-                    }
-                    /* Grab the focus to the country field, if it is
-                       editable */
-                    else if (priv->editable_country) {
-                        hildon_telephone_editor_focus_dest_entry
-                            (priv->country, priv->edited_country, TRUE);
-                    } else
-                        return TRUE;
-                }
-            }
-
-            /* left edge of area field */
-            if (widget == priv->area) { /* grab the focus to the country
-                                           field, if it is editable */
-                if (priv->editable_country) {
-                    hildon_telephone_editor_focus_dest_entry
-                        (priv->country, priv->edited_country, TRUE);
-                } else
-                    return TRUE;
-            }
-
-            /* left edge of country field, let's wrap */
-            if (widget == priv->country) {
-                /* Stop the signal handler, if only country field exists */
-                if (priv->format ==
-                    HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY)
-                    return TRUE;
-                /* wrap to area, if in AREA mode */
-                else if (priv->format ==
-                         HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA) {
-                    hildon_telephone_editor_focus_dest_entry
-                        (priv->area, priv->edited_area, TRUE);
-                }
-
-                else {
-                    hildon_telephone_editor_focus_dest_entry
-                        (priv->number, priv->edited_number, TRUE);
-                }
-            }
-        }
-        /* going right */
-        else if (event->keyval == GDK_Right || event->keyval == GDK_KP_Right) {
-            width = g_utf8_strlen(gtk_entry_get_text(GTK_ENTRY(widget)), -1);
-
-            /* not yet on the rigth edge and the widget is edited */
-            if (pos != width &&
-                ((widget == priv->country && priv->edited_country == TRUE)
-                 || (widget == priv->area && priv->edited_area == TRUE)
-                 || (widget == priv->number
-                     && priv->edited_number == TRUE)))
-                return FALSE;
-
-            /* rigth edge of number field */
-            if (widget == priv->number) {
-                /* Stop signal handler, if only number field exists */
-                if (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_FREE)
-                    return TRUE;
-                else {
-                    hildon_telephone_editor_focus_dest_entry
-                        (priv->country, priv->edited_country, FALSE);
-                }
-            }
-
-            /* rigth edge of area field */
-            if (widget == priv->area) {
-                /* area mode, wrap to country field */
-                if (priv->format ==
-                    HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA) {
-                    hildon_telephone_editor_focus_dest_entry
-                        (priv->country, priv->edited_country, FALSE);
-                }
-                /* grab the focus to the number field, if it is editable */
-                else if (priv->editable_number) {
-                    hildon_telephone_editor_focus_dest_entry
-                        (priv->number, priv->edited_number, FALSE);
-                } else
-                    return TRUE;
-            }
-
-            /* rigth edge of country field */
-            if (widget == priv->country) {
-                /* wrap around, if only country field exists */
-                if (priv->format ==
-                    HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY)
-                    return TRUE;
-
-                /* area mode, move to area field */
-                else if (priv->format ==
-                         HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA ||
-                         priv->format ==
-                         HILDON_TELEPHONE_EDITOR_FORMAT_COERCE) {
-                    /* grab the focus to the area field, if it is editable 
-                     */
-                    if (priv->editable_area) {
-                        hildon_telephone_editor_focus_dest_entry
-                            (priv->area, priv->edited_area, FALSE);
-                    }
-                    /* grab the focus to the area field, if it is editable 
-                     */
-                    else if ((priv->format ==
-                              HILDON_TELEPHONE_EDITOR_FORMAT_COERCE) &&
-                             priv->editable_number) {
-                        hildon_telephone_editor_focus_dest_entry
-                            (priv->number, priv->edited_number, FALSE);
-                    } else
-                        return TRUE;
-                }
-
-                else {
-                    hildon_telephone_editor_focus_dest_entry
-                        (priv->number, priv->edited_number, FALSE);
-                }
-            }
-        }
-        return FALSE;
-    }
-    return TRUE;
-}
-
-/**
- * hildon_telephone_editor_set_editable:
- * @hte: #HildonTelephoneEditor
- * @country: set the editable status of the country field in coarce format
- * @area: set the editable status of the area field in coarce format
- * @number: set the editable status of the number field in coarce format
- * 
- * Specify wheter the fields in coerse format are editable or
- * not. This function is ignored if the editor is in free mode. The
- * number or area and number parameters are ignored if the editor is
- * in HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA or
- * HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY formats,
- * respectively. 
- */
-void 
-hildon_telephone_editor_set_editable(HildonTelephoneEditor * editor,
-                                          gboolean country,
-                                          gboolean area, gboolean number)
-{
-    HildonTelephoneEditorPriv *priv;
-
-    g_return_if_fail(editor);
-
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    priv->editable_country = country;
-    priv->editable_area = area;
-    priv->editable_number = number;
-
-    if (priv->country)
-    {
-        gtk_editable_set_editable(GTK_EDITABLE(priv->country), country);
-        gtk_widget_set_sensitive(GTK_WIDGET(priv->plus), country);
-    }
-
-    if (priv->area)
-        gtk_editable_set_editable(GTK_EDITABLE(priv->area), area);
-
-    if (priv->number)
-        gtk_editable_set_editable(GTK_EDITABLE(priv->number), number);
-}
-
-/**
- * hildon_telephone_editor_set_widths:
- * @hte: #HildonTelephoneEditor
- * @country: width (characters) of the country field in coarce mode
- * @area: width (characters) of the area field in coarce mode
- * @number: width (characters) of the number field in coarce mode
- *
- * Set widths of the fields in coecse format. Country and area parameters
- * are ignored, if the editor is in free mode. The number or area and number
- * parameters are ignored if the editor is in
- * HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA or
- * HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY mode, respectively.
- */
-void 
-hildon_telephone_editor_set_widths(HildonTelephoneEditor * editor,
-                                        guint country,
-                                        guint area, guint number)
-{
-    HildonTelephoneEditorPriv *priv;
-
-    g_return_if_fail(editor);
-
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    if (priv->country) {
-        /*gtk_entry_set_max_length(GTK_ENTRY(priv->country), country);*/
-        gtk_entry_set_width_chars(GTK_ENTRY(priv->country), country);
-    }
-
-    if (priv->area) {
-        /*gtk_entry_set_max_length(GTK_ENTRY(priv->area), area);*/
-        gtk_entry_set_width_chars(GTK_ENTRY(priv->area), area);
-    }
-
-    if (priv->number) {
-        /*gtk_entry_set_max_length(GTK_ENTRY(priv->number), number);*/
-        gtk_entry_set_width_chars(GTK_ENTRY(priv->number), number);
-    }
-
-}
-
-/**
- * hildon_telephone_editor_set_show_plus:
- * @hte: #HildonTelephoneEditor
- * @show: show the plus sign
- *
- * Show or hide the plus sign in front of coerce format's country field. 
- */
-void 
-hildon_telephone_editor_set_show_plus(HildonTelephoneEditor * editor,
-                                           gboolean show)
-{
-    HildonTelephoneEditorPriv *priv;
-
-    g_return_if_fail(editor);
-
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    /* do nothing in FREE format */
-    if (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_FREE)
-        return;
-
-    if (show && !priv->show_plus) {
-        priv->show_plus = TRUE;
-        gtk_widget_set_parent(priv->plus_event, GTK_WIDGET(editor));
-        gtk_widget_show(priv->plus_event);
-    } else if (!show && priv->show_plus) {
-        gtk_widget_hide(priv->plus_event);
-        gtk_widget_unparent(priv->plus_event);
-        priv->show_plus = FALSE;
-    }
-}
-
-/**
- * hildon_telephone_editor_get_show_plus:
- * @hte: #HildonTelephoneEditor
- *
- * Get the visibility status of the plus sign in
- * front of coerce format's country field.
- *
- * Returns: gboolean
- */
-gboolean 
-hildon_telephone_editor_get_show_plus(HildonTelephoneEditor *
-                                               editor)
-{
-    HildonTelephoneEditorPriv *priv;
-    g_return_val_if_fail(editor, FALSE);
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    /* no plus in FREE format */
-    if (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_FREE)
-        return FALSE;
-    return priv->show_plus;
-}
-
-/**
- * hildon_telephone_editor_set_show_border:
- * @hte: #HildonTelephoneEditor
- * @show: show the border
- *
- * Show or hide the border around the widget
- */
-void 
-hildon_telephone_editor_set_show_border(HildonTelephoneEditor *
-                                             editor, gboolean show)
-{
-    HildonTelephoneEditorPriv *priv;
-    g_return_if_fail(editor);
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    if (show && !priv->show_border) {
-        priv->show_border = TRUE;
-        gtk_widget_set_parent(priv->frame, GTK_WIDGET(editor));
-        gtk_widget_show(priv->frame);
-    } else if (!show && priv->show_border) {
-        gtk_widget_hide(priv->frame);
-        gtk_widget_unparent(priv->frame);
-        priv->show_border = FALSE;
-    }
-}
-
-/**
- * hildon_telephone_editor_get_show_border:
- * @hte: #HildonTelephoneEditor
- *
- * Get the visibility status of the border around the widget.
- *
- * Returns: gboolean
- */
-gboolean
-hildon_telephone_editor_get_show_border(HildonTelephoneEditor * editor)
-{
-    HildonTelephoneEditorPriv *priv;
-    g_return_val_if_fail(editor, FALSE);
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    return priv->show_border;
-}
-
-/**
- * hildon_telephone_editor_get_country:
- * @hte: #HildonTelephoneEditor
- *
- * Get text in the country field in coarse format. This function must
- * not be called if in free mode.
- *
- * Returns: pointer to the text in the country field. It must not
- * be changed or freed.
- */
-const gchar *
-hildon_telephone_editor_get_country(HildonTelephoneEditor *
-                                                 editor)
-{
-    HildonTelephoneEditorPriv *priv;
-    g_return_val_if_fail(editor, NULL);
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    /* return NULL if in FREE format */
-    if (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_FREE)
-        return NULL;
-
-    return gtk_entry_get_text(GTK_ENTRY(priv->country));
-}
-
-/**
- * hildon_telephone_editor_set_country:
- * @hte: #HildonTelephoneEditor
- * @country: text to be set in country field
- *
- * Set text in the country field in coarse format. This function must
- * not be called if in free mode.
- */
-void 
-hildon_telephone_editor_set_country(HildonTelephoneEditor * editor,
-                                         const gchar * country)
-{
-    HildonTelephoneEditorPriv *priv;
-    const gchar *p;
-    gunichar u;
-
-    g_return_if_fail(editor);
-    g_return_if_fail(country);
-
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    /* do nothing in FREE format */
-    if (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_FREE)
-        return;
-
-    if (!priv->country)
-        return;
-
-    p = country;
-    g_return_if_fail(g_utf8_validate(p, -1, NULL));
-
-    /* allow only digits */
-    do {
-        u = g_utf8_get_char(p);
-        if (!g_unichar_isdigit(*p))
-            return;
-
-        p = g_utf8_next_char(p);
-    } while (*p);
-
-    gtk_entry_set_text(GTK_ENTRY(priv->country), country);
-}
-
-/**
- * hildon_telephone_editor_get_area:
- * @hte: #HildonTelephoneEditor
- *
- * Get text in the area field in coarse format. This function must not
- * be called if in free mode or in
- * HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY mode.
- *
- * Returns: pointer to the text in the area field. It must not be
- * changed or freed.
- */
-const gchar *
-hildon_telephone_editor_get_area(HildonTelephoneEditor *
-                                              editor)
-{
-    HildonTelephoneEditorPriv *priv;
-    g_return_val_if_fail(editor, NULL);
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    /* return NULL if in FREE format or if in COERCE_COUNTRY format */
-    if (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_FREE)
-        return NULL;
-    if (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY)
-        return NULL;
-
-    return gtk_entry_get_text(GTK_ENTRY(priv->area));
-}
-
-/**
- * hildon_telephone_editor_set_area:
- * @hte: #HildonTelephoneEditor
- * @area: text to be set in area field
- *
- * Set text in the area field in coarse format. This function must not
- * be called if in free mode or in
- * HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY mode.
- */
-void
-hildon_telephone_editor_set_area(HildonTelephoneEditor * editor,
-                                      const gchar * area)
-{
-    HildonTelephoneEditorPriv *priv;
-    const gchar *p;
-    gunichar u;
-
-    g_return_if_fail(editor);
-    g_return_if_fail(area);
-
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    /* do nothing in FREE format */
-    if (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_FREE)
-        return;
-
-    if (!priv->area)
-        return;
-
-    p = area;
-    g_return_if_fail(g_utf8_validate(p, -1, NULL));
-
-    /* allow only digits */
-    do {
-        u = g_utf8_get_char(p);
-        if (!g_unichar_isdigit(u))
-            return;
-
-        p = g_utf8_next_char(p);
-    } while (*p);
-
-    gtk_entry_set_text(GTK_ENTRY(priv->area), area);
-}
-
-/**
- * hildon_telephone_editor_get_number:
- * @hte: #HildonTelephoneEditor
- *
- * Get text in the number field in all formats. In free mode, this
- * functions returns the whole phone number. In coarce mode, it returns
- * only the number field. This function must not be called if
- * the editor is in HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA or
- * HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY modes.
- *
- * Returns: pointer to text in the number field. It must not be
- * changed or freed.
- */
-const gchar *
-hildon_telephone_editor_get_number(HildonTelephoneEditor *
-                                                editor)
-{
-    HildonTelephoneEditorPriv *priv;
-    g_return_val_if_fail(editor, NULL);
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    return gtk_entry_get_text(GTK_ENTRY(priv->number));
-}
-
-/**
- * hildon_telephone_editor_set_number:
- * @hte: #HildonTelephoneEditor
- * @number: text to be set to number field
- *
- * Set text in the number field in all formats. In free mode this
- * functions sets the whole phone number. In coerce mode, it sets
- * only the number field. This function must not be called if
- * the editor is in HILDON_TELEPHONE_EDITOR_FORMAT_COERSE_AREA or
- * HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY modes.
- */
-void 
-hildon_telephone_editor_set_number(HildonTelephoneEditor * editor,
-                                        const gchar * number)
-{
-    HildonTelephoneEditorPriv *priv;
-    const gchar *p;
-    gunichar u;
-
-    g_return_if_fail(editor);
-    g_return_if_fail(number);
-
-    priv = HILDON_TELEPHONE_EDITOR_GET_PRIVATE(editor);
-
-    if (!priv->number)
-        return;
-
-    p = number;
-    g_return_if_fail(g_utf8_validate(p, -1, NULL));
-
-    /* allow only digits in coerce format or some other in free format */
-    do {
-        u = g_utf8_get_char(p);
-        if (g_unichar_isdigit(u) ||
-            (priv->format == HILDON_TELEPHONE_EDITOR_FORMAT_FREE &&
-             (u == '+' ||
-              u == 'p' ||
-              u == 'w' ||
-              u == '(' ||
-              u == ')' ||
-              u == '/' ||
-              u == ' ' ||
-              u == '.' || u == '-' || u == '*' || u == '#' || u == '?')))
-            p = g_utf8_next_char(p);
-        else
-            return;
-
-    } while (*p);
-
-    gtk_entry_set_text(GTK_ENTRY(priv->number), number);
-}
diff --git a/src/hildon-telephone-editor.h b/src/hildon-telephone-editor.h
deleted file mode 100644 (file)
index 7cba96b..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * This file is part of hildon-libs
- *
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
- *
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __HILDON_TELEPHONE_EDITOR_H__
-#define __HILDON_TELEPHONE_EDITOR_H__
-
-#include <gtk/gtkcontainer.h>
-
-G_BEGIN_DECLS
-/**
- * HILDON_TELEPHONE_EDITOR_TYPE:
- *
- * Macro for getting type of telephone editor.
- */
-#define HILDON_TELEPHONE_EDITOR_TYPE \
-  ( hildon_telephone_editor_get_type() )
-#define HILDON_TELEPHONE_EDITOR(obj) \
-  (GTK_CHECK_CAST (obj, HILDON_TELEPHONE_EDITOR_TYPE, \
-  HildonTelephoneEditor))
-#define HILDON_TELEPHONE_EDITOR_CLASS(klass) \
-  (GTK_CHECK_CLASS_CAST ((klass), HILDON_TELEPHONE_EDITOR_TYPE, \
-  HildonTelephoneEditorClass))
-#define HILDON_IS_TELEPHONE_EDITOR(obj) \
-  (GTK_CHECK_TYPE (obj, HILDON_TELEPHONE_EDITOR_TYPE))
-#define HILDON_IS_TELEPHONE_EDITOR_CLASS(klass) \
-  (GTK_CHECK_CLASS_TYPE ((klass), HILDON_TELEPHONE_EDITOR_TYPE))
-/**
- * HildonTelephoneEditorFormat:
- * @HILDON_TELEPHONE_EDITOR_FORMAT_FREE: Free format.
- * @HILDON_TELEPHONE_EDITOR_FORMAT_COERCE: Coerce format, three fields.
- * @HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY: Coerce format, only
- * country field.
- * @HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA: Coerce format, country
- * and area fields.
- * 
- * Define all possible format modes for the HildonTelephoneEditor.
- *
- */
-    typedef enum {
-    HILDON_TELEPHONE_EDITOR_FORMAT_FREE = 0,
-    HILDON_TELEPHONE_EDITOR_FORMAT_COERCE,
-    HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_COUNTRY,
-    HILDON_TELEPHONE_EDITOR_FORMAT_COERCE_AREA
-} HildonTelephoneEditorFormat;
-
-
-/**
- * HildonTelephoneEditor:
- *
- * Internal struct for telephone editor.
- */
-typedef struct _HildonTelephoneEditor HildonTelephoneEditor;
-typedef struct _HildonTelephoneEditorClass HildonTelephoneEditorClass;
-
-/*< private >*/
-struct _HildonTelephoneEditor {
-    GtkContainer parent;
-};
-
-struct _HildonTelephoneEditorClass {
-    GtkContainerClass parent_class;
-};
-
-GType hildon_telephone_editor_get_type(void);
-
-GtkWidget *hildon_telephone_editor_new(HildonTelephoneEditorFormat format);
-GtkWidget
-    *hildon_telephone_editor_new_with_strings(HildonTelephoneEditorFormat
-                                              format,
-                                              const gchar * country,
-                                              const gchar * area,
-                                              const gchar * number);
-void hildon_telephone_editor_set_editable(HildonTelephoneEditor * hte,
-                                          gboolean country, gboolean area,
-                                          gboolean number);
-
-void hildon_telephone_editor_set_show_plus(HildonTelephoneEditor * hte,
-                                           gboolean show);
-
-gboolean hildon_telephone_editor_get_show_plus(HildonTelephoneEditor *
-                                               hte);
-
-void hildon_telephone_editor_set_show_border(HildonTelephoneEditor * hte,
-                                             gboolean show);
-
-gboolean hildon_telephone_editor_get_show_border(HildonTelephoneEditor *
-                                                 hte);
-
-
-void hildon_telephone_editor_set_widths(HildonTelephoneEditor * hte,
-                                        guint country,
-                                        guint area, guint number);
-
-const gchar *hildon_telephone_editor_get_country(HildonTelephoneEditor *
-                                                 hte);
-
-void hildon_telephone_editor_set_country(HildonTelephoneEditor * hte,
-                                         const gchar * country);
-
-const gchar *hildon_telephone_editor_get_area(HildonTelephoneEditor * hte);
-
-void hildon_telephone_editor_set_area(HildonTelephoneEditor * hte,
-                                      const gchar * area);
-
-const gchar *hildon_telephone_editor_get_number(HildonTelephoneEditor *
-                                                hte);
-
-void hildon_telephone_editor_set_number(HildonTelephoneEditor * hte,
-                                        const gchar * number);
-
-G_END_DECLS
-#endif /* __HILDON_TELEPHONE_EDITOR_H__ */