aboutsummaryrefslogtreecommitdiffstats
path: root/lib/widgets
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2004-06-22 03:25:41 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2004-06-22 03:25:41 +0800
commitbcc276fa99bbded1b5b42503dfb2feca30c48e24 (patch)
tree07f68b570bba65521d8870eeb9fd3832b9d3a497 /lib/widgets
parent54d27764848058ad591478a56a67ec49bee20efe (diff)
downloadgsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.tar
gsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.tar.gz
gsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.tar.bz2
gsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.tar.lz
gsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.tar.xz
gsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.tar.zst
gsoc2013-epiphany-bcc276fa99bbded1b5b42503dfb2feca30c48e24.zip
Factor out the helper to select a treeview row by column and use it also
2004-06-21 Marco Pesenti Gritti <marco@gnome.org> * lib/ephy-gui.c: (ephy_gui_help), (ephy_gui_select_row_by_key): * lib/widgets/ephy-node-view.c: (ephy_node_view_key_press_cb): * src/bookmarks/ephy-topics-selector.c: (topic_key_pressed): Factor out the helper to select a treeview row by column and use it also in the topic selector. * lib/ephy-gui.h: * src/bookmarks/ephy-bookmarks-editor.c: * src/bookmarks/ephy-new-bookmark.c: * src/ephy-history-window.c: * src/pdm-dialog.c: * src/ppview-toolbar.c: * src/prefs-dialog.c: * src/window-commands.c: * embed/downloader-view.c: Remove braindead gtk.h inclusion and deal with fallout headers.
Diffstat (limited to 'lib/widgets')
-rw-r--r--lib/widgets/ephy-node-view.c62
1 files changed, 8 insertions, 54 deletions
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index 3cf8294a2..3b037d3db 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -35,6 +35,7 @@
#include "ephy-tree-model-sort.h"
#include "eggtreemultidnd.h"
#include "ephy-dnd.h"
+#include "ephy-gui.h"
#include "ephy-marshal.h"
#include "string.h"
@@ -661,62 +662,15 @@ ephy_node_view_row_activated_cb (GtkTreeView *treeview,
g_signal_emit (G_OBJECT (view), ephy_node_view_signals[NODE_ACTIVATED], 0, node);
}
-
-static gboolean
-ephy_node_view_select_node_by_key (EphyNodeView *view, GdkEventKey *event)
-{
- GtkTreeIter iter, last_iter;
- GtkTreePath *path;
- GValue value = {0, };
- gchar *string;
- gchar *event_string;
- gboolean found = FALSE;
- gchar outbuf[6];
- gint length;
-
- length = g_unichar_to_utf8 (gdk_keyval_to_unicode (event->keyval), outbuf);
- event_string = g_utf8_casefold (outbuf, length);
-
- if (!gtk_tree_model_get_iter_first (view->priv->sortmodel, &iter))
- {
- g_free (event_string);
- return FALSE;
- }
-
- do
- {
- last_iter = iter;
- gtk_tree_model_get_value (view->priv->sortmodel, &iter,
- view->priv->searchable_data_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 (view->priv->sortmodel, &iter));
-
- if (!found)
- {
- iter = last_iter;
- }
-
- path = gtk_tree_model_get_path (view->priv->sortmodel, &iter);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), path, NULL, FALSE);
- gtk_tree_path_free (path);
- g_free (event_string);
-
- return TRUE;
-}
-
static gboolean
ephy_node_view_key_press_cb (GtkTreeView *treeview,
GdkEventKey *event,
EphyNodeView *view)
{
+ guint32 unicode;
+
+ unicode = gdk_keyval_to_unicode (event->keyval);
+
if ((event->state & GDK_SHIFT_MASK) &&
(event->keyval == GDK_F10))
{
@@ -724,10 +678,10 @@ ephy_node_view_key_press_cb (GtkTreeView *treeview,
return TRUE;
}
- else if (view->priv->searchable_data_column != -1 &&
- gdk_keyval_to_unicode (event->keyval))
+ else if (view->priv->searchable_data_column != -1 && unicode)
{
- return ephy_node_view_select_node_by_key (view, event);
+ return ephy_gui_select_row_by_key
+ (treeview, view->priv->searchable_data_column, unicode);
}
return FALSE;