aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ephy-gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ephy-gui.c')
-rw-r--r--lib/ephy-gui.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c
index 7fa42634b..09ef4ef4a 100644
--- a/lib/ephy-gui.c
+++ b/lib/ephy-gui.c
@@ -31,6 +31,10 @@
#include <libgnome/gnome-help.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtkmessagedialog.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtkimage.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkstock.h>
/* Styles for tab labels */
GtkStyle *loading_text_style = NULL;
@@ -159,3 +163,54 @@ ephy_gui_help (GtkWindow *parent,
g_error_free (err);
}
}
+
+gboolean
+ephy_gui_select_row_by_key (GtkTreeView *treeview, gint column, guint32 unicode)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter, last_iter;
+ GtkTreePath *path;
+ GValue value = {0, };
+ char *string;
+ char *event_string;
+ gboolean found = FALSE;
+ char outbuf[6];
+ int length;
+
+ model = gtk_tree_view_get_model (treeview);
+
+ length = g_unichar_to_utf8 (unicode, outbuf);
+ event_string = g_utf8_casefold (outbuf, length);
+
+ if (!gtk_tree_model_get_iter_first (model, &iter))
+ {
+ g_free (event_string);
+ return FALSE;
+ }
+
+ do
+ {
+ last_iter = iter;
+ gtk_tree_model_get_value (model, &iter, column, &value);
+
+ string = g_utf8_casefold (g_value_get_string (&value), -1);
+ g_utf8_strncpy (string, string, 1);
+ found = (g_utf8_collate (string, event_string) == 0);
+
+ g_free (string);
+ g_value_unset (&value);
+ }
+ while (!found && gtk_tree_model_iter_next (model, &iter));
+
+ if (!found)
+ {
+ iter = last_iter;
+ }
+
+ path = gtk_tree_model_get_path (model, &iter);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (treeview), path, NULL, FALSE);
+ gtk_tree_path_free (path);
+ g_free (event_string);
+
+ return TRUE;
+}