+2007-09-14 Michael Dominic Kostrzewa <michael.kostrzewa@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@nokia.com>
* src/hildon-caption.c: Applying a patch by Tommi to fix the focus
#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)
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));
g_free (string);
- return TRUE;
+ return FALSE;
}
static void
#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),
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;
+}
+
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__ */