[maemo-commits] [maemo-commits] r13818 - in projects/haf/trunk/hildon-1: . examples src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Sep 14 14:48:49 EEST 2007
Author: mdk
Date: 2007-09-14 14:48:48 +0300 (Fri, 14 Sep 2007)
New Revision: 13818

Modified:
   projects/haf/trunk/hildon-1/ChangeLog
   projects/haf/trunk/hildon-1/examples/hildon-find-toolbar-example.c
   projects/haf/trunk/hildon-1/src/hildon-find-toolbar.c
   projects/haf/trunk/hildon-1/src/hildon-find-toolbar.h
Log:
FIxing the default history-append handler to actually continue firing the other handlers if connected. Adding a new function: hildon_find_toolbar_get_last_index that gets the index of the most recently added (last) item. Fixes: NB#52301.


Modified: projects/haf/trunk/hildon-1/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-1/ChangeLog	2007-09-14 11:44:30 UTC (rev 13817)
+++ projects/haf/trunk/hildon-1/ChangeLog	2007-09-14 11:48:48 UTC (rev 13818)
@@ -1,3 +1,13 @@
+2007-09-14  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
+
+	* examples/hildon-find-toolbar-example.c:
+	* src/hildon-find-toolbar.c:
+	* src/hildon-find-toolbar.h: FIxing the default history-append handler to
+	actually continue firing the other handlers if connected. Adding a new
+	function:
+	hildon_find_toolbar_get_last_index that gets the index of the most
+	recently added (last) item. Fixes: NB#52301.
+
 2007-09-10  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
 
 	* src/hildon-caption.c: Applying a patch by Tommi to fix the focus

Modified: projects/haf/trunk/hildon-1/examples/hildon-find-toolbar-example.c
===================================================================
--- projects/haf/trunk/hildon-1/examples/hildon-find-toolbar-example.c	2007-09-14 11:44:30 UTC (rev 13817)
+++ projects/haf/trunk/hildon-1/examples/hildon-find-toolbar-example.c	2007-09-14 11:48:48 UTC (rev 13818)
@@ -28,6 +28,18 @@
 #include                                        <gtk/gtk.h>
 #include                                        "hildon.h"
 
+HildonFindToolbar *toolbar = NULL;
+
+gboolean
+on_history_append                               (void);
+
+gboolean
+on_history_append                               (void)
+{
+    hildon_find_toolbar_set_active (toolbar, hildon_find_toolbar_get_last_index (toolbar));
+    return FALSE;
+}
+
 int
 main                                            (int argc, 
                                                  char **args)
@@ -52,10 +64,11 @@
     gtk_list_store_append (store, &iter);
     gtk_list_store_set (store, &iter, 0, "Third", -1);
 
-    HildonFindToolbar *toolbar = HILDON_FIND_TOOLBAR (hildon_find_toolbar_new_with_model ("Find", store, 0));
+    toolbar = HILDON_FIND_TOOLBAR (hildon_find_toolbar_new_with_model ("Find", store, 0));
     hildon_find_toolbar_set_active (toolbar, 0);
     
     g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);
+    g_signal_connect_after (G_OBJECT (toolbar), "history-append", G_CALLBACK (on_history_append), NULL);
     
     hildon_window_add_toolbar (HILDON_WINDOW (window), GTK_TOOLBAR (toolbar));
     gtk_widget_show_all (GTK_WIDGET (toolbar));

Modified: projects/haf/trunk/hildon-1/src/hildon-find-toolbar.c
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-find-toolbar.c	2007-09-14 11:44:30 UTC (rev 13817)
+++ projects/haf/trunk/hildon-1/src/hildon-find-toolbar.c	2007-09-14 11:48:48 UTC (rev 13818)
@@ -465,7 +465,7 @@
 
     g_free (string);
 
-    return TRUE;
+    return FALSE;
 }
 
 static void
@@ -711,7 +711,7 @@
 #endif
 
     entry_combo_box_container = gtk_tool_item_new ();
-    alignment = gtk_alignment_new (0, 0.5, 1, 0);
+    alignment = GTK_ALIGNMENT (gtk_alignment_new (0, 0.5, 1, 0));
 
     gtk_tool_item_set_expand (entry_combo_box_container, TRUE);
     gtk_container_add (GTK_CONTAINER (alignment),
@@ -921,3 +921,33 @@
     return gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->entry_combo_box), iter);
 }
 
+/**
+ * hildon_find_toolbar_get_last_index
+ * @toolbar: A find toolbar to query
+ *
+ * Returns the index of the last (most recently added) item in the toolbar.
+ * Can be used to set this item active in the history-append signal.
+ *
+ * 
+ * Returns: Index of the last entry
+ *
+ */
+gint32
+hildon_find_toolbar_get_last_index              (HildonFindToolbar *toolbar)
+{
+    HildonFindToolbarPrivate *priv;
+
+    g_return_val_if_fail (HILDON_IS_FIND_TOOLBAR (toolbar), FALSE);
+    priv = HILDON_FIND_TOOLBAR_GET_PRIVATE (toolbar);
+
+    gint i = 0;
+    GtkTreeIter iter;
+
+    gtk_tree_model_get_iter_first (hildon_find_toolbar_get_list_model (priv), &iter);
+
+    while (gtk_tree_model_iter_next (hildon_find_toolbar_get_list_model (priv), &iter))
+        i++;
+
+    return i;
+}
+

Modified: projects/haf/trunk/hildon-1/src/hildon-find-toolbar.h
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-find-toolbar.h	2007-09-14 11:44:30 UTC (rev 13817)
+++ projects/haf/trunk/hildon-1/src/hildon-find-toolbar.h	2007-09-14 11:48:48 UTC (rev 13818)
@@ -103,6 +103,9 @@
 hildon_find_toolbar_get_active_iter             (HildonFindToolbar *toolbar, 
                                                  GtkTreeIter *iter);
 
+gint32
+hildon_find_toolbar_get_last_index              (HildonFindToolbar *toolbar);
+
 G_END_DECLS
 
 #endif                                          /* __HILDON_FIND_TOOLBAR_H__ */


More information about the maemo-commits mailing list