* examples/Makefile.am, * examples/hildon-pannable-area-buttons-scroll-example.c...
authorAlejandro G. Castro <alex@igalia.com>
Fri, 14 Nov 2008 12:00:59 +0000 (12:00 +0000)
committerAlejandro G. Castro <alex@igalia.com>
Fri, 14 Nov 2008 12:00:59 +0000 (12:00 +0000)
ChangeLog
examples/Makefile.am
examples/hildon-pannable-area-buttons-scroll-example.c [new file with mode: 0644]
examples/hildon-pannable-area-example-2.c [deleted file]
examples/hildon-pannable-area-example-3.c [deleted file]
examples/hildon-pannable-area-example-4.c [deleted file]
examples/hildon-pannable-area-example.c [deleted file]
examples/hildon-pannable-area-gesture-signals-example.c [new file with mode: 0644]
examples/hildon-pannable-area-scroll-jump-example.c [new file with mode: 0644]
examples/hildon-pannable-area-tree-view-example.c [new file with mode: 0644]

index 9ab2b76..ca3c1ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-11-14  Alejandro G. Castro         <alex@igalia.com>
+
+       * examples/Makefile.am,
+       * examples/hildon-pannable-area-buttons-scroll-example.c,
+       * examples/hildon-pannable-area-gesture-signals-example.c,
+       * examples/hildon-pannable-area-scroll-jump-example.c,
+       * examples/hildon-pannable-area-tree-view-example.c:
+       Renamed the pannable area examples, now they have more meaningful
+       names.
+
 2008-11-13  Alejandro Pinheiro  <apinheiro@igalia.com>
 
        * src/hildon-touch-selector.c:
index 3f2e55c..9148e11 100644 (file)
@@ -17,10 +17,10 @@ EXAMPLES                            = hildon-window-example                         \
                                          hildon-find-toolbar-example                   \
                                          hildon-edit-toolbar-example                   \
                                          hildon-wizard-dialog-example                  \
-                                         hildon-pannable-area-example                  \
-                                         hildon-pannable-area-example-2                \
-                                         hildon-pannable-area-example-3                \
-                                         hildon-pannable-area-example-4                \
+                                         hildon-pannable-area-tree-view-example        \
+                                         hildon-pannable-area-scroll-jump-example      \
+                                         hildon-pannable-area-buttons-scroll-example   \
+                                         hildon-pannable-area-gesture-signals-example  \
                                          hildon-logical-color-example                  \
                                          hildon-app-menu-example                       \
                                          hildon-stackable-window-example               \
@@ -323,26 +323,26 @@ hildon_hvolumebar_timer_example_CFLAGS            = $(HILDON_OBJ_CFLAGS)                  \
                                                  $(EXTRA_CFLAGS)
 hildon_hvolumebar_timer_example_SOURCES                = hildon-hvolumebar-timer-example.c
 
-# Hildon pannable area
-hildon_pannable_area_example_LDADD             = $(HILDON_OBJ_LIBS)
-hildon_pannable_area_example_CFLAGS            = $(HILDON_OBJ_CFLAGS)                  \
-                                                 $(EXTRA_CFLAGS)
-hildon_pannable_area_example_SOURCES           = hildon-pannable-area-example.c
+# Hildon pannable area tree view example
+hildon_pannable_area_tree_view_example_LDADD           = $(HILDON_OBJ_LIBS)
+hildon_pannable_area_tree_view_example_CFLAGS          = $(HILDON_OBJ_CFLAGS)                  \
+                                                          $(EXTRA_CFLAGS)
+hildon_pannable_area_tree_view_example_SOURCES         = hildon-pannable-area-tree-view-example.c
 
-# Hildon pannable area 2
-hildon_pannable_area_example_2_LDADD           = $(HILDON_OBJ_LIBS)
-hildon_pannable_area_example_2_CFLAGS          = $(HILDON_OBJ_CFLAGS)
-hildon_pannable_area_example_2_SOURCES         = hildon-pannable-area-example-2.c
+# Hildon pannable area scroll jump example
+hildon_pannable_area_scroll_jump_example_LDADD         = $(HILDON_OBJ_LIBS)
+hildon_pannable_area_scroll_jump_example_CFLAGS                = $(HILDON_OBJ_CFLAGS)
+hildon_pannable_area_scroll_jump_example_SOURCES       = hildon-pannable-area-scroll-jump-example.c
 
-# Hildon pannable area 3
-hildon_pannable_area_example_3_LDADD           = $(HILDON_OBJ_LIBS)
-hildon_pannable_area_example_3_CFLAGS          = $(HILDON_OBJ_CFLAGS)
-hildon_pannable_area_example_3_SOURCES         = hildon-pannable-area-example-3.c
+# Hildon pannable area buttons scroll example
+hildon_pannable_area_buttons_scroll_example_LDADD              = $(HILDON_OBJ_LIBS)
+hildon_pannable_area_buttons_scroll_example_CFLAGS             = $(HILDON_OBJ_CFLAGS)
+hildon_pannable_area_buttons_scroll_example_SOURCES            = hildon-pannable-area-buttons-scroll-example.c
 
-# Hildon pannable area 4
-hildon_pannable_area_example_4_LDADD           = $(HILDON_OBJ_LIBS)
-hildon_pannable_area_example_4_CFLAGS          = $(HILDON_OBJ_CFLAGS)
-hildon_pannable_area_example_4_SOURCES         = hildon-pannable-area-example-4.c
+# Hildon pannable area gesture signals example
+hildon_pannable_area_gesture_signals_example_LDADD             = $(HILDON_OBJ_LIBS)
+hildon_pannable_area_gesture_signals_example_CFLAGS            = $(HILDON_OBJ_CFLAGS)
+hildon_pannable_area_gesture_signals_example_SOURCES           = hildon-pannable-area-gesture-signals-example.c
 
 # Hildon pannable area touch list
 hildon_pannable_area_touch_list_example_LDADD  = $(HILDON_OBJ_LIBS)
@@ -477,10 +477,10 @@ examples_DATA                             = Makefile.static                               \
                                          hildon-wizard-dialog-example.c                \
                                          hildon-hvolumebar-timer-example.c             \
                                          hildon-toolbar-seekbar-example.c              \
-                                         hildon-pannable-area-example.c                \
-                                         hildon-pannable-area-example-2.c              \
-                                         hildon-pannable-area-example-3.c              \
-                                         hildon-pannable-area-example-4.c              \
+                                         hildon-pannable-area-tree-view-example        \
+                                         hildon-pannable-area-scroll-jump-example      \
+                                         hildon-pannable-area-buttons-scroll-example   \
+                                         hildon-pannable-area-gesture-signals-example  \
                                          hildon-pannable-area-touch-list-example.c     \
                                          hildon-pannable-area-touch-grid-example.c     \
                                          hildon-logical-color-example.c                \
diff --git a/examples/hildon-pannable-area-buttons-scroll-example.c b/examples/hildon-pannable-area-buttons-scroll-example.c
new file mode 100644 (file)
index 0000000..2b64980
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * This file is a part of hildon examples
+ *
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * Based in hildon-pannable-area-example.c
+ * by Karl Lattimer <karl.lattimer@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, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include                                        <stdio.h>
+#include                                        <stdlib.h>
+#include                                        <glib.h>
+#include                                        <gtk/gtk.h>
+#include                                        "hildon.h"
+
+GtkWidget *btn;
+
+static void
+on_button_clicked (GtkWidget *widget, gpointer data)
+{
+    g_debug ("Button %d clicked", GPOINTER_TO_INT (data));
+    btn = widget;
+}
+
+static void
+find_button_clicked (GtkButton *button,
+                    gpointer user_data)
+{
+       HildonPannableArea *panarea;
+
+       panarea = HILDON_PANNABLE_AREA (user_data);
+
+       hildon_pannable_area_scroll_to_child (panarea, btn);
+}
+
+int
+main (int argc, char **args)
+{
+    int i;
+    HildonProgram *program;
+    GtkWidget *window, *panarea, *button;
+    GtkWidget *hbox, *vbox;
+
+    gtk_init (&argc, &args);
+
+    program = hildon_program_get_instance ();
+
+    /* Create the main window */
+    window = hildon_window_new ();
+    hildon_program_add_window (program, HILDON_WINDOW (window));
+    gtk_container_set_border_width (GTK_CONTAINER (window), 5);
+
+    /* Create a VBox and pack some buttons */
+    vbox = gtk_vbox_new (FALSE, 1);
+    for (i = 0; i < 80; i++) {
+            gchar *label = g_strdup_printf ("Button number %d", i);
+
+            button = gtk_button_new_with_label (label);
+            gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
+            g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (on_button_clicked), GINT_TO_POINTER (i));
+            g_free (label);
+    }
+
+    /* Put everything in a pannable area */
+    panarea = hildon_pannable_area_new ();
+    hildon_pannable_area_add_with_viewport(HILDON_PANNABLE_AREA (panarea), GTK_WIDGET (vbox));
+
+    vbox = gtk_vbox_new (FALSE, 10);
+    hbox = gtk_hbox_new (FALSE, 10);
+
+    button = gtk_button_new_with_label ("Find the latest clicked button");
+    g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (find_button_clicked), panarea);
+    gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+
+    g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);
+
+    gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 10);
+    gtk_box_pack_start (GTK_BOX (vbox), panarea, TRUE, TRUE, 0);
+
+    gtk_container_add (GTK_CONTAINER (window), vbox);
+
+    gtk_widget_show_all (GTK_WIDGET (window));
+
+    gtk_main ();
+
+    return 0;
+}
diff --git a/examples/hildon-pannable-area-example-2.c b/examples/hildon-pannable-area-example-2.c
deleted file mode 100644 (file)
index 4e6723a..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * This file is a part of hildon examples
- *
- * Copyright (C) 2008 Nokia Corporation, all rights reserved.
- *
- * Based in hildon-pannable-area-example.c
- * by Karl Lattimer <karl.lattimer@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, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include                                        <stdio.h>
-#include                                        <stdlib.h>
-#include                                        <glib.h>
-#include                                        <gtk/gtk.h>
-#include                                        <string.h>
-#include                                        "hildon.h"
-
-enum { PIXBUF_COLUMN, TEXT_COLUMN, N_COLUMNS };
-
-typedef struct {
-  GtkWidget *scroll_entry;
-  GtkWidget *jump_entry;
-  GtkWidget *panarea;
-  GtkWidget *treeview;
-} SearchContext;
-
-SearchContext *ctx;
-
-static void
-search_button_clicked (GtkButton *button,
-                      gpointer user_data)
-{
-  GtkTreeModel *model;
-  const gchar *s1;
-  gchar *s2;
-  gboolean found;
-  GtkTreeIter iter;
-  GtkTreePath *path;
-  GdkRectangle rect;
-  gint y;
-  gboolean jump_or_scroll;
-
-  jump_or_scroll = *((gboolean *) user_data);
-
-  if (jump_or_scroll)
-    {
-      s1 = gtk_entry_get_text (GTK_ENTRY (ctx->scroll_entry));
-    }
-  else
-    {
-      s1 = gtk_entry_get_text (GTK_ENTRY (ctx->jump_entry));
-    }
-
-  model = gtk_tree_view_get_model (GTK_TREE_VIEW (ctx->treeview));
-
-  gtk_tree_model_get_iter_first (model, &iter);
-
-  do {
-    gtk_tree_model_get (model, &iter, TEXT_COLUMN, &s2, -1);
-    found = (strcmp (s1, s2) == 0);
-    g_free (s2);
-  } while (found != TRUE && gtk_tree_model_iter_next (model, &iter));
-
-  if (found) {
-    GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW (ctx->treeview));
-
-    path = gtk_tree_model_get_path (model, &iter);
-
-    gtk_tree_view_get_background_area (GTK_TREE_VIEW (ctx->treeview),
-                                       path, NULL, &rect);
-    gtk_tree_view_convert_bin_window_to_tree_coords (GTK_TREE_VIEW (ctx->treeview),
-                                                     0, rect.y, NULL, &y);
-    g_print ("text found in (0, %d)\n", y);
-
-    gtk_tree_selection_select_path (selection, path);
-    if (jump_or_scroll)
-      {
-        hildon_pannable_area_scroll_to (HILDON_PANNABLE_AREA (ctx->panarea),
-                                        -1, y);
-      }
-    else
-      {
-        hildon_pannable_area_jump_to (HILDON_PANNABLE_AREA (ctx->panarea),
-                                      -1, y);
-      }
-
-    gtk_tree_path_free (path);
-  }
-}
-
-int
-main (int argc, char **args)
-{
-  int i;
-  HildonProgram *program;
-  GtkWidget *window, *tv, *panarea, *button;
-  GtkTreeViewColumn *col;
-  GtkCellRenderer *renderer;
-  GtkListStore *store;
-  GtkWidget *hbox, *vbox;
-  GtkWidget *entry;
-  gboolean scroll = TRUE;
-  gboolean jump = FALSE;
-  GSList *stocks, *item;
-
-  gtk_init (&argc, &args);
-
-  program = hildon_program_get_instance ();
-
-  /* Create the main window */
-  window = hildon_window_new ();
-  hildon_program_add_window (program, HILDON_WINDOW (window));
-  gtk_container_set_border_width (GTK_CONTAINER (window), 5);
-
-  /* Create a treeview */
-  tv = gtk_tree_view_new ();
-
-  col = gtk_tree_view_column_new ();
-  gtk_tree_view_column_set_title (col, "Title");
-
-  renderer = gtk_cell_renderer_pixbuf_new ();
-  gtk_cell_renderer_set_fixed_size (renderer, 48, 48);
-  gtk_tree_view_column_pack_start (col, renderer, FALSE);
-  gtk_tree_view_column_set_attributes (col, renderer, "stock-id", PIXBUF_COLUMN, NULL);
-
-  renderer = gtk_cell_renderer_text_new ();
-  gtk_tree_view_column_pack_start (col, renderer, FALSE);
-  gtk_tree_view_column_set_attributes (col, renderer, "text", TEXT_COLUMN, NULL);
-  gtk_tree_view_append_column (GTK_TREE_VIEW(tv), col);
-
-  /* Add some rows to the treeview */
-  stocks = gtk_stock_list_ids ();
-  item = stocks;
-  store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
-  for (i = 0; i < 100; i++) {
-    GtkTreeIter iter;
-    GtkStockItem stock_item;
-    gchar *stock_id;
-
-    stock_id = (gchar *)item->data;
-    gtk_stock_lookup (stock_id, &stock_item);
-    gtk_list_store_append (store, &iter);
-    gtk_list_store_set (store, &iter, PIXBUF_COLUMN, stock_id, TEXT_COLUMN, stock_item.label, -1);
-
-    item = item->next? item->next : stocks;
-  }
-  gtk_tree_view_set_model (GTK_TREE_VIEW (tv), GTK_TREE_MODEL (store));
-  g_object_unref (store);
-
-  g_slist_foreach (stocks, (GFunc)g_free, NULL);
-  g_slist_free (stocks);
-
-  /* Put everything in a pannable area */
-  panarea = hildon_pannable_area_new ();
-  gtk_container_add (GTK_CONTAINER (panarea), GTK_WIDGET (tv));
-
-  ctx = g_new0 (SearchContext, 1);
-
-  vbox = gtk_vbox_new (FALSE, 5);
-  hbox = gtk_hbox_new (FALSE, 5);
-  button = gtk_button_new_from_stock (GTK_STOCK_FIND);
-
-  entry = gtk_entry_new ();
-  gtk_entry_set_text (GTK_ENTRY (entry), "Enter some text to scroll");
-
-  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (search_button_clicked), &scroll);
-
-  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-  gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 10);
-
-  ctx->scroll_entry = entry;
-
-  hbox = gtk_hbox_new (FALSE, 5);
-  button = gtk_button_new_from_stock (GTK_STOCK_FIND);
-
-  entry = gtk_entry_new ();
-  gtk_entry_set_text (GTK_ENTRY (entry), "Enter some text to jump");
-
-  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (search_button_clicked), &jump);
-
-  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-  gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 10);
-
-  ctx->jump_entry = entry;
-  ctx->treeview = tv;
-  ctx->panarea = panarea;
-
-  g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);
-
-  gtk_box_pack_start (GTK_BOX (vbox), panarea, TRUE, TRUE, 0);
-
-  gtk_container_add (GTK_CONTAINER (window), vbox);
-
-  gtk_widget_show_all (GTK_WIDGET (window));
-
-  gtk_main ();
-
-  return 0;
-}
diff --git a/examples/hildon-pannable-area-example-3.c b/examples/hildon-pannable-area-example-3.c
deleted file mode 100644 (file)
index 2b64980..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * This file is a part of hildon examples
- *
- * Copyright (C) 2008 Nokia Corporation, all rights reserved.
- *
- * Based in hildon-pannable-area-example.c
- * by Karl Lattimer <karl.lattimer@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, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include                                        <stdio.h>
-#include                                        <stdlib.h>
-#include                                        <glib.h>
-#include                                        <gtk/gtk.h>
-#include                                        "hildon.h"
-
-GtkWidget *btn;
-
-static void
-on_button_clicked (GtkWidget *widget, gpointer data)
-{
-    g_debug ("Button %d clicked", GPOINTER_TO_INT (data));
-    btn = widget;
-}
-
-static void
-find_button_clicked (GtkButton *button,
-                    gpointer user_data)
-{
-       HildonPannableArea *panarea;
-
-       panarea = HILDON_PANNABLE_AREA (user_data);
-
-       hildon_pannable_area_scroll_to_child (panarea, btn);
-}
-
-int
-main (int argc, char **args)
-{
-    int i;
-    HildonProgram *program;
-    GtkWidget *window, *panarea, *button;
-    GtkWidget *hbox, *vbox;
-
-    gtk_init (&argc, &args);
-
-    program = hildon_program_get_instance ();
-
-    /* Create the main window */
-    window = hildon_window_new ();
-    hildon_program_add_window (program, HILDON_WINDOW (window));
-    gtk_container_set_border_width (GTK_CONTAINER (window), 5);
-
-    /* Create a VBox and pack some buttons */
-    vbox = gtk_vbox_new (FALSE, 1);
-    for (i = 0; i < 80; i++) {
-            gchar *label = g_strdup_printf ("Button number %d", i);
-
-            button = gtk_button_new_with_label (label);
-            gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
-            g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (on_button_clicked), GINT_TO_POINTER (i));
-            g_free (label);
-    }
-
-    /* Put everything in a pannable area */
-    panarea = hildon_pannable_area_new ();
-    hildon_pannable_area_add_with_viewport(HILDON_PANNABLE_AREA (panarea), GTK_WIDGET (vbox));
-
-    vbox = gtk_vbox_new (FALSE, 10);
-    hbox = gtk_hbox_new (FALSE, 10);
-
-    button = gtk_button_new_with_label ("Find the latest clicked button");
-    g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (find_button_clicked), panarea);
-    gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
-
-    g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);
-
-    gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 10);
-    gtk_box_pack_start (GTK_BOX (vbox), panarea, TRUE, TRUE, 0);
-
-    gtk_container_add (GTK_CONTAINER (window), vbox);
-
-    gtk_widget_show_all (GTK_WIDGET (window));
-
-    gtk_main ();
-
-    return 0;
-}
diff --git a/examples/hildon-pannable-area-example-4.c b/examples/hildon-pannable-area-example-4.c
deleted file mode 100644 (file)
index 75fc852..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * This file is a part of hildon examples
- *
- * Copyright (C) 2008 Nokia Corporation, all rights reserved.
- *
- * Author: Karl Lattimer <karl.lattimer@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, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include                                        <stdio.h>
-#include                                        <stdlib.h>
-#include                                        <glib.h>
-#include                                        <gtk/gtk.h>
-#include                                        "hildon.h"
-
-enum { TEXT_COLUMN, OPTIONAL_COLUMN, N_COLUMNS };
-
-typedef struct {
-  GtkWidget *treeview;
-} HiddenColContext;
-
-HiddenColContext *ctx;
-
-static void
-horizontal_movement (HildonPannableArea *area,
-                     HildonMovementDirection direction,
-                    gdouble x, gdouble y, gpointer user_data)
-{
-  GtkTreePath *path;
-  GdkRectangle rect;
-  gint col_x;
-  GtkTreeViewColumn *col = GTK_TREE_VIEW_COLUMN (user_data);
-  GtkWidget *child = hildon_pannable_get_child_widget_at (area, x, y);
-
-  g_print ("widget %p treeview %p\n", child, ctx->treeview);
-
-  if (child == ctx->treeview) {
-    if (direction == HILDON_MOVEMENT_LEFT){
-
-      path = gtk_tree_path_new_first ();
-
-      gtk_tree_view_get_background_area (GTK_TREE_VIEW (ctx->treeview),
-                                         path, col, &rect);
-
-      gtk_tree_view_convert_bin_window_to_tree_coords (GTK_TREE_VIEW (ctx->treeview),
-                                                       rect.x, 0, &col_x, NULL);
-
-      gtk_tree_path_free (path);
-
-      hildon_pannable_area_scroll_to (area, col_x, -1);
-    }
-    else {
-      hildon_pannable_area_scroll_to (area, 0, -1);
-    }
-  }
-
-  g_print ("horizontal_movement %lf, %lf\n", x, y);
-}
-
-static void
-vertical_movement (HildonPannableArea *area,
-                   HildonMovementDirection direction,
-                  gdouble x, gdouble y,
-                   gpointer user_data)
-{
-  g_print ("vertical_movement: %lf, %lf\n", x, y);
-}
-
-static void
-get_sawtooth_label (gchar **label, guint num)
-{
-  static gchar *sawtooth = NULL;
-  gchar *label_aux, *sawtooth_aux;
-
-  if (num % 5 != 0) {
-    sawtooth_aux = g_strconcat (" ", sawtooth, NULL);
-    g_free (sawtooth);
-
-    sawtooth = sawtooth_aux;
-  } else {
-    sawtooth = g_strdup (" ");
-  }
-
-  label_aux = g_strconcat (sawtooth, *label, NULL);
-  g_free (*label);
-
-  *label = label_aux;
-}
-
-int
-main (int argc, char **args)
-{
-    int i;
-    HildonProgram *program;
-    GtkWidget *window, *tv, *panarea;
-    GtkTreeViewColumn *col;
-    GtkCellRenderer *renderer;
-    GtkListStore *store;
-
-    gtk_init (&argc, &args);
-
-    program = hildon_program_get_instance ();
-
-    ctx = g_new0 (HiddenColContext, 1);
-
-    /* Create the main window */
-    window = hildon_window_new ();
-    hildon_program_add_window (program, HILDON_WINDOW (window));
-
-    gtk_container_set_border_width (GTK_CONTAINER (window), 5);
-
-    /* Create a treeview */
-    tv = gtk_tree_view_new ();
-    ctx->treeview = tv;
-
-    renderer = gtk_cell_renderer_text_new ();
-    col = gtk_tree_view_column_new_with_attributes ("Title", renderer, "text", TEXT_COLUMN, NULL);
-    gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
-
-    gtk_tree_view_column_set_fixed_width (col, 700);
-
-    gtk_tree_view_append_column (GTK_TREE_VIEW(tv), col);
-
-    col = gtk_tree_view_column_new_with_attributes ("Title", renderer, "text", OPTIONAL_COLUMN, NULL);
-    gtk_tree_view_append_column (GTK_TREE_VIEW(tv), col);
-
-    /* Add some rows to the treeview */
-    store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
-    for (i = 0; i < 100; i++) {
-            GtkTreeIter iter;
-            gchar *label = g_strdup_printf ("Row number %d", i);
-            gchar *label_optional = g_strdup_printf ("< >");
-
-            get_sawtooth_label (&label, i);
-
-            gtk_list_store_append (store, &iter);
-            gtk_list_store_set (store, &iter, TEXT_COLUMN, label, -1);
-            gtk_list_store_set (store, &iter, OPTIONAL_COLUMN, label_optional, -1);
-            g_free (label);
-            g_free (label_optional);
-    }
-    gtk_tree_view_set_model (GTK_TREE_VIEW (tv), GTK_TREE_MODEL (store));
-    g_object_unref (store);
-
-    /* Put everything in a pannable area */
-    panarea = hildon_pannable_area_new ();
-    g_object_set (panarea, "mov_mode", HILDON_MOVEMENT_MODE_VERT,
-                  "hovershoot_max", 0,
-                  "hscrollbar_policy", GTK_POLICY_NEVER, NULL);
-
-    gtk_container_add (GTK_CONTAINER (panarea), GTK_WIDGET (tv));
-    gtk_container_add (GTK_CONTAINER (window), panarea);
-
-    g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);
-
-    g_signal_connect (G_OBJECT (panarea), "horizontal_movement", G_CALLBACK (horizontal_movement), col);
-    g_signal_connect (G_OBJECT (panarea), "vertical_movement", G_CALLBACK (vertical_movement), NULL);
-
-    gtk_widget_show_all (GTK_WIDGET (window));
-
-    gtk_main ();
-
-    return 0;
-}
diff --git a/examples/hildon-pannable-area-example.c b/examples/hildon-pannable-area-example.c
deleted file mode 100644 (file)
index 008a740..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * This file is a part of hildon examples
- *
- * Copyright (C) 2008 Nokia Corporation, all rights reserved.
- *
- * Author: Karl Lattimer <karl.lattimer@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, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include                                        <stdio.h>
-#include                                        <stdlib.h>
-#include                                        <glib.h>
-#include                                        <gtk/gtk.h>
-#include                                        "hildon.h"
-
-enum { TEXT_COLUMN, N_COLUMNS };
-
-static void
-get_sawtooth_label (gchar **label, guint num)
-{
-  static gchar *sawtooth = NULL;
-  gchar *label_aux, *sawtooth_aux;
-  
-  if (num % 5 != 0) {
-    sawtooth_aux = g_strconcat (" ", sawtooth, NULL);
-    g_free (sawtooth);
-    
-    sawtooth = sawtooth_aux;
-  } else {
-    if (sawtooth)
-      g_free (sawtooth);
-
-    sawtooth = g_strdup (" ");
-  }
-  
-  label_aux = g_strconcat (sawtooth, *label, NULL);
-  g_free (*label);
-  
-  *label = label_aux;
-}
-
-int
-main (int argc, char **args)
-{
-    int i;
-    HildonProgram *program;
-    GtkWidget *window, *tv, *panarea;
-    GtkTreeViewColumn *col;
-    GtkCellRenderer *renderer;
-    GtkListStore *store;
-
-    gtk_init (&argc, &args);
-
-    program = hildon_program_get_instance ();
-
-    /* Create the main window */
-    window = hildon_window_new ();
-    hildon_program_add_window (program, HILDON_WINDOW (window));
-
-    gtk_container_set_border_width (GTK_CONTAINER (window), 5);
-
-    /* Create a treeview */
-    tv = gtk_tree_view_new ();
-    renderer = gtk_cell_renderer_text_new ();
-    col = gtk_tree_view_column_new_with_attributes ("Title", renderer, "text", TEXT_COLUMN, NULL);
-    gtk_tree_view_append_column (GTK_TREE_VIEW(tv), col);
-
-    /* Add some rows to the treeview */
-    store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING);
-    for (i = 0; i < 100; i++) {
-            GtkTreeIter iter;
-            gchar *label = g_strdup_printf ("Row number %d", i);
-            
-            get_sawtooth_label (&label, i);
-
-            gtk_list_store_append (store, &iter);
-            gtk_list_store_set (store, &iter, TEXT_COLUMN, label, -1);
-            g_free (label);
-    }
-    gtk_tree_view_set_model (GTK_TREE_VIEW (tv), GTK_TREE_MODEL (store));
-    g_object_unref (store);
-
-    /* Put everything in a pannable area */
-    panarea = hildon_pannable_area_new ();
-    gtk_container_add (GTK_CONTAINER (panarea), GTK_WIDGET (tv));
-    gtk_container_add (GTK_CONTAINER (window), panarea);
-
-    g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);
-
-    gtk_widget_show_all (GTK_WIDGET (window));
-
-    gtk_main ();
-
-    return 0;
-}
diff --git a/examples/hildon-pannable-area-gesture-signals-example.c b/examples/hildon-pannable-area-gesture-signals-example.c
new file mode 100644 (file)
index 0000000..75fc852
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * This file is a part of hildon examples
+ *
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * Author: Karl Lattimer <karl.lattimer@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, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include                                        <stdio.h>
+#include                                        <stdlib.h>
+#include                                        <glib.h>
+#include                                        <gtk/gtk.h>
+#include                                        "hildon.h"
+
+enum { TEXT_COLUMN, OPTIONAL_COLUMN, N_COLUMNS };
+
+typedef struct {
+  GtkWidget *treeview;
+} HiddenColContext;
+
+HiddenColContext *ctx;
+
+static void
+horizontal_movement (HildonPannableArea *area,
+                     HildonMovementDirection direction,
+                    gdouble x, gdouble y, gpointer user_data)
+{
+  GtkTreePath *path;
+  GdkRectangle rect;
+  gint col_x;
+  GtkTreeViewColumn *col = GTK_TREE_VIEW_COLUMN (user_data);
+  GtkWidget *child = hildon_pannable_get_child_widget_at (area, x, y);
+
+  g_print ("widget %p treeview %p\n", child, ctx->treeview);
+
+  if (child == ctx->treeview) {
+    if (direction == HILDON_MOVEMENT_LEFT){
+
+      path = gtk_tree_path_new_first ();
+
+      gtk_tree_view_get_background_area (GTK_TREE_VIEW (ctx->treeview),
+                                         path, col, &rect);
+
+      gtk_tree_view_convert_bin_window_to_tree_coords (GTK_TREE_VIEW (ctx->treeview),
+                                                       rect.x, 0, &col_x, NULL);
+
+      gtk_tree_path_free (path);
+
+      hildon_pannable_area_scroll_to (area, col_x, -1);
+    }
+    else {
+      hildon_pannable_area_scroll_to (area, 0, -1);
+    }
+  }
+
+  g_print ("horizontal_movement %lf, %lf\n", x, y);
+}
+
+static void
+vertical_movement (HildonPannableArea *area,
+                   HildonMovementDirection direction,
+                  gdouble x, gdouble y,
+                   gpointer user_data)
+{
+  g_print ("vertical_movement: %lf, %lf\n", x, y);
+}
+
+static void
+get_sawtooth_label (gchar **label, guint num)
+{
+  static gchar *sawtooth = NULL;
+  gchar *label_aux, *sawtooth_aux;
+
+  if (num % 5 != 0) {
+    sawtooth_aux = g_strconcat (" ", sawtooth, NULL);
+    g_free (sawtooth);
+
+    sawtooth = sawtooth_aux;
+  } else {
+    sawtooth = g_strdup (" ");
+  }
+
+  label_aux = g_strconcat (sawtooth, *label, NULL);
+  g_free (*label);
+
+  *label = label_aux;
+}
+
+int
+main (int argc, char **args)
+{
+    int i;
+    HildonProgram *program;
+    GtkWidget *window, *tv, *panarea;
+    GtkTreeViewColumn *col;
+    GtkCellRenderer *renderer;
+    GtkListStore *store;
+
+    gtk_init (&argc, &args);
+
+    program = hildon_program_get_instance ();
+
+    ctx = g_new0 (HiddenColContext, 1);
+
+    /* Create the main window */
+    window = hildon_window_new ();
+    hildon_program_add_window (program, HILDON_WINDOW (window));
+
+    gtk_container_set_border_width (GTK_CONTAINER (window), 5);
+
+    /* Create a treeview */
+    tv = gtk_tree_view_new ();
+    ctx->treeview = tv;
+
+    renderer = gtk_cell_renderer_text_new ();
+    col = gtk_tree_view_column_new_with_attributes ("Title", renderer, "text", TEXT_COLUMN, NULL);
+    gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
+
+    gtk_tree_view_column_set_fixed_width (col, 700);
+
+    gtk_tree_view_append_column (GTK_TREE_VIEW(tv), col);
+
+    col = gtk_tree_view_column_new_with_attributes ("Title", renderer, "text", OPTIONAL_COLUMN, NULL);
+    gtk_tree_view_append_column (GTK_TREE_VIEW(tv), col);
+
+    /* Add some rows to the treeview */
+    store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
+    for (i = 0; i < 100; i++) {
+            GtkTreeIter iter;
+            gchar *label = g_strdup_printf ("Row number %d", i);
+            gchar *label_optional = g_strdup_printf ("< >");
+
+            get_sawtooth_label (&label, i);
+
+            gtk_list_store_append (store, &iter);
+            gtk_list_store_set (store, &iter, TEXT_COLUMN, label, -1);
+            gtk_list_store_set (store, &iter, OPTIONAL_COLUMN, label_optional, -1);
+            g_free (label);
+            g_free (label_optional);
+    }
+    gtk_tree_view_set_model (GTK_TREE_VIEW (tv), GTK_TREE_MODEL (store));
+    g_object_unref (store);
+
+    /* Put everything in a pannable area */
+    panarea = hildon_pannable_area_new ();
+    g_object_set (panarea, "mov_mode", HILDON_MOVEMENT_MODE_VERT,
+                  "hovershoot_max", 0,
+                  "hscrollbar_policy", GTK_POLICY_NEVER, NULL);
+
+    gtk_container_add (GTK_CONTAINER (panarea), GTK_WIDGET (tv));
+    gtk_container_add (GTK_CONTAINER (window), panarea);
+
+    g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);
+
+    g_signal_connect (G_OBJECT (panarea), "horizontal_movement", G_CALLBACK (horizontal_movement), col);
+    g_signal_connect (G_OBJECT (panarea), "vertical_movement", G_CALLBACK (vertical_movement), NULL);
+
+    gtk_widget_show_all (GTK_WIDGET (window));
+
+    gtk_main ();
+
+    return 0;
+}
diff --git a/examples/hildon-pannable-area-scroll-jump-example.c b/examples/hildon-pannable-area-scroll-jump-example.c
new file mode 100644 (file)
index 0000000..4e6723a
--- /dev/null
@@ -0,0 +1,216 @@
+/*
+ * This file is a part of hildon examples
+ *
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * Based in hildon-pannable-area-example.c
+ * by Karl Lattimer <karl.lattimer@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, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include                                        <stdio.h>
+#include                                        <stdlib.h>
+#include                                        <glib.h>
+#include                                        <gtk/gtk.h>
+#include                                        <string.h>
+#include                                        "hildon.h"
+
+enum { PIXBUF_COLUMN, TEXT_COLUMN, N_COLUMNS };
+
+typedef struct {
+  GtkWidget *scroll_entry;
+  GtkWidget *jump_entry;
+  GtkWidget *panarea;
+  GtkWidget *treeview;
+} SearchContext;
+
+SearchContext *ctx;
+
+static void
+search_button_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+  GtkTreeModel *model;
+  const gchar *s1;
+  gchar *s2;
+  gboolean found;
+  GtkTreeIter iter;
+  GtkTreePath *path;
+  GdkRectangle rect;
+  gint y;
+  gboolean jump_or_scroll;
+
+  jump_or_scroll = *((gboolean *) user_data);
+
+  if (jump_or_scroll)
+    {
+      s1 = gtk_entry_get_text (GTK_ENTRY (ctx->scroll_entry));
+    }
+  else
+    {
+      s1 = gtk_entry_get_text (GTK_ENTRY (ctx->jump_entry));
+    }
+
+  model = gtk_tree_view_get_model (GTK_TREE_VIEW (ctx->treeview));
+
+  gtk_tree_model_get_iter_first (model, &iter);
+
+  do {
+    gtk_tree_model_get (model, &iter, TEXT_COLUMN, &s2, -1);
+    found = (strcmp (s1, s2) == 0);
+    g_free (s2);
+  } while (found != TRUE && gtk_tree_model_iter_next (model, &iter));
+
+  if (found) {
+    GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW (ctx->treeview));
+
+    path = gtk_tree_model_get_path (model, &iter);
+
+    gtk_tree_view_get_background_area (GTK_TREE_VIEW (ctx->treeview),
+                                       path, NULL, &rect);
+    gtk_tree_view_convert_bin_window_to_tree_coords (GTK_TREE_VIEW (ctx->treeview),
+                                                     0, rect.y, NULL, &y);
+    g_print ("text found in (0, %d)\n", y);
+
+    gtk_tree_selection_select_path (selection, path);
+    if (jump_or_scroll)
+      {
+        hildon_pannable_area_scroll_to (HILDON_PANNABLE_AREA (ctx->panarea),
+                                        -1, y);
+      }
+    else
+      {
+        hildon_pannable_area_jump_to (HILDON_PANNABLE_AREA (ctx->panarea),
+                                      -1, y);
+      }
+
+    gtk_tree_path_free (path);
+  }
+}
+
+int
+main (int argc, char **args)
+{
+  int i;
+  HildonProgram *program;
+  GtkWidget *window, *tv, *panarea, *button;
+  GtkTreeViewColumn *col;
+  GtkCellRenderer *renderer;
+  GtkListStore *store;
+  GtkWidget *hbox, *vbox;
+  GtkWidget *entry;
+  gboolean scroll = TRUE;
+  gboolean jump = FALSE;
+  GSList *stocks, *item;
+
+  gtk_init (&argc, &args);
+
+  program = hildon_program_get_instance ();
+
+  /* Create the main window */
+  window = hildon_window_new ();
+  hildon_program_add_window (program, HILDON_WINDOW (window));
+  gtk_container_set_border_width (GTK_CONTAINER (window), 5);
+
+  /* Create a treeview */
+  tv = gtk_tree_view_new ();
+
+  col = gtk_tree_view_column_new ();
+  gtk_tree_view_column_set_title (col, "Title");
+
+  renderer = gtk_cell_renderer_pixbuf_new ();
+  gtk_cell_renderer_set_fixed_size (renderer, 48, 48);
+  gtk_tree_view_column_pack_start (col, renderer, FALSE);
+  gtk_tree_view_column_set_attributes (col, renderer, "stock-id", PIXBUF_COLUMN, NULL);
+
+  renderer = gtk_cell_renderer_text_new ();
+  gtk_tree_view_column_pack_start (col, renderer, FALSE);
+  gtk_tree_view_column_set_attributes (col, renderer, "text", TEXT_COLUMN, NULL);
+  gtk_tree_view_append_column (GTK_TREE_VIEW(tv), col);
+
+  /* Add some rows to the treeview */
+  stocks = gtk_stock_list_ids ();
+  item = stocks;
+  store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
+  for (i = 0; i < 100; i++) {
+    GtkTreeIter iter;
+    GtkStockItem stock_item;
+    gchar *stock_id;
+
+    stock_id = (gchar *)item->data;
+    gtk_stock_lookup (stock_id, &stock_item);
+    gtk_list_store_append (store, &iter);
+    gtk_list_store_set (store, &iter, PIXBUF_COLUMN, stock_id, TEXT_COLUMN, stock_item.label, -1);
+
+    item = item->next? item->next : stocks;
+  }
+  gtk_tree_view_set_model (GTK_TREE_VIEW (tv), GTK_TREE_MODEL (store));
+  g_object_unref (store);
+
+  g_slist_foreach (stocks, (GFunc)g_free, NULL);
+  g_slist_free (stocks);
+
+  /* Put everything in a pannable area */
+  panarea = hildon_pannable_area_new ();
+  gtk_container_add (GTK_CONTAINER (panarea), GTK_WIDGET (tv));
+
+  ctx = g_new0 (SearchContext, 1);
+
+  vbox = gtk_vbox_new (FALSE, 5);
+  hbox = gtk_hbox_new (FALSE, 5);
+  button = gtk_button_new_from_stock (GTK_STOCK_FIND);
+
+  entry = gtk_entry_new ();
+  gtk_entry_set_text (GTK_ENTRY (entry), "Enter some text to scroll");
+
+  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (search_button_clicked), &scroll);
+
+  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 10);
+
+  ctx->scroll_entry = entry;
+
+  hbox = gtk_hbox_new (FALSE, 5);
+  button = gtk_button_new_from_stock (GTK_STOCK_FIND);
+
+  entry = gtk_entry_new ();
+  gtk_entry_set_text (GTK_ENTRY (entry), "Enter some text to jump");
+
+  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (search_button_clicked), &jump);
+
+  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 10);
+
+  ctx->jump_entry = entry;
+  ctx->treeview = tv;
+  ctx->panarea = panarea;
+
+  g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);
+
+  gtk_box_pack_start (GTK_BOX (vbox), panarea, TRUE, TRUE, 0);
+
+  gtk_container_add (GTK_CONTAINER (window), vbox);
+
+  gtk_widget_show_all (GTK_WIDGET (window));
+
+  gtk_main ();
+
+  return 0;
+}
diff --git a/examples/hildon-pannable-area-tree-view-example.c b/examples/hildon-pannable-area-tree-view-example.c
new file mode 100644 (file)
index 0000000..008a740
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * This file is a part of hildon examples
+ *
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * Author: Karl Lattimer <karl.lattimer@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, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include                                        <stdio.h>
+#include                                        <stdlib.h>
+#include                                        <glib.h>
+#include                                        <gtk/gtk.h>
+#include                                        "hildon.h"
+
+enum { TEXT_COLUMN, N_COLUMNS };
+
+static void
+get_sawtooth_label (gchar **label, guint num)
+{
+  static gchar *sawtooth = NULL;
+  gchar *label_aux, *sawtooth_aux;
+  
+  if (num % 5 != 0) {
+    sawtooth_aux = g_strconcat (" ", sawtooth, NULL);
+    g_free (sawtooth);
+    
+    sawtooth = sawtooth_aux;
+  } else {
+    if (sawtooth)
+      g_free (sawtooth);
+
+    sawtooth = g_strdup (" ");
+  }
+  
+  label_aux = g_strconcat (sawtooth, *label, NULL);
+  g_free (*label);
+  
+  *label = label_aux;
+}
+
+int
+main (int argc, char **args)
+{
+    int i;
+    HildonProgram *program;
+    GtkWidget *window, *tv, *panarea;
+    GtkTreeViewColumn *col;
+    GtkCellRenderer *renderer;
+    GtkListStore *store;
+
+    gtk_init (&argc, &args);
+
+    program = hildon_program_get_instance ();
+
+    /* Create the main window */
+    window = hildon_window_new ();
+    hildon_program_add_window (program, HILDON_WINDOW (window));
+
+    gtk_container_set_border_width (GTK_CONTAINER (window), 5);
+
+    /* Create a treeview */
+    tv = gtk_tree_view_new ();
+    renderer = gtk_cell_renderer_text_new ();
+    col = gtk_tree_view_column_new_with_attributes ("Title", renderer, "text", TEXT_COLUMN, NULL);
+    gtk_tree_view_append_column (GTK_TREE_VIEW(tv), col);
+
+    /* Add some rows to the treeview */
+    store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING);
+    for (i = 0; i < 100; i++) {
+            GtkTreeIter iter;
+            gchar *label = g_strdup_printf ("Row number %d", i);
+            
+            get_sawtooth_label (&label, i);
+
+            gtk_list_store_append (store, &iter);
+            gtk_list_store_set (store, &iter, TEXT_COLUMN, label, -1);
+            g_free (label);
+    }
+    gtk_tree_view_set_model (GTK_TREE_VIEW (tv), GTK_TREE_MODEL (store));
+    g_object_unref (store);
+
+    /* Put everything in a pannable area */
+    panarea = hildon_pannable_area_new ();
+    gtk_container_add (GTK_CONTAINER (panarea), GTK_WIDGET (tv));
+    gtk_container_add (GTK_CONTAINER (window), panarea);
+
+    g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);
+
+    gtk_widget_show_all (GTK_WIDGET (window));
+
+    gtk_main ();
+
+    return 0;
+}