aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-03-14 23:31:45 +0800
committerChristian Persch <chpe@src.gnome.org>2005-03-14 23:31:45 +0800
commit0d8dd611e669275c40f3113d22b97d467e3545c4 (patch)
treea356f30de9ab565c1e4ad1bb8bea1f8d9192d26f /lib
parent0551f379b4ec62e5399422b0f2034313fd3daf76 (diff)
downloadgsoc2013-epiphany-0d8dd611e669275c40f3113d22b97d467e3545c4.tar
gsoc2013-epiphany-0d8dd611e669275c40f3113d22b97d467e3545c4.tar.gz
gsoc2013-epiphany-0d8dd611e669275c40f3113d22b97d467e3545c4.tar.bz2
gsoc2013-epiphany-0d8dd611e669275c40f3113d22b97d467e3545c4.tar.lz
gsoc2013-epiphany-0d8dd611e669275c40f3113d22b97d467e3545c4.tar.xz
gsoc2013-epiphany-0d8dd611e669275c40f3113d22b97d467e3545c4.tar.zst
gsoc2013-epiphany-0d8dd611e669275c40f3113d22b97d467e3545c4.zip
Remove custom search, and use gtktreeview typeaheadfind. Fixes bug
2005-03-14 Christian Persch <chpe@cvs.gnome.org> * lib/ephy-gui.c: (ephy_gui_is_middle_click): * lib/ephy-gui.h: * lib/widgets/ephy-node-view.c: (ephy_node_view_key_press_cb), (ephy_node_view_add_column), (ephy_node_view_init): Remove custom search, and use gtktreeview typeaheadfind. Fixes bug #118107.
Diffstat (limited to 'lib')
-rw-r--r--lib/ephy-gui.c57
-rw-r--r--lib/ephy-gui.h4
-rw-r--r--lib/widgets/ephy-node-view.c27
3 files changed, 12 insertions, 76 deletions
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c
index 954f4c993..7cf082320 100644
--- a/lib/ephy-gui.c
+++ b/lib/ephy-gui.c
@@ -277,60 +277,9 @@ ephy_gui_help (GtkWindow *parent,
}
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;
-}
-
-gboolean
ephy_gui_is_middle_click (void)
{
- gboolean new_tab = FALSE;
+ gboolean is_middle_click = FALSE;
GdkEvent *event;
event = gtk_get_current_event ();
@@ -348,14 +297,14 @@ ephy_gui_is_middle_click (void)
if ((button == 1 && ((state & modifiers) == GDK_CONTROL_MASK)) ||
(button == 2))
{
- new_tab = TRUE;
+ is_middle_click = TRUE;
}
}
gdk_event_free (event);
}
- return new_tab;
+ return is_middle_click;
}
void
diff --git a/lib/ephy-gui.h b/lib/ephy-gui.h
index 226f262f9..6668a4598 100644
--- a/lib/ephy-gui.h
+++ b/lib/ephy-gui.h
@@ -57,10 +57,6 @@ GtkWindowGroup *ephy_gui_ensure_window_group (GtkWindow *window);
gboolean ephy_gui_is_middle_click (void);
-gboolean ephy_gui_select_row_by_key (GtkTreeView *treeview,
- gint column,
- guint32 unicode);
-
gboolean ephy_gui_confirm_overwrite_file (GtkWidget *parent,
const char *filename);
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index 9a4291bdc..a0d229d64 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -69,8 +69,6 @@ struct _EphyNodeViewPrivate
gboolean remove_if_cancelled;
int editable_property;
- int searchable_data_column;
-
gboolean drag_started;
int drag_button;
int drag_x;
@@ -567,9 +565,7 @@ ephy_node_view_key_press_cb (GtkTreeView *treeview,
GdkEventKey *event,
EphyNodeView *view)
{
- guint32 unicode;
-
- unicode = gdk_keyval_to_unicode (event->keyval);
+ gboolean handled = FALSE;
if (event->keyval == GDK_space ||
event->keyval == GDK_Return ||
@@ -582,15 +578,11 @@ ephy_node_view_key_press_cb (GtkTreeView *treeview,
selection = gtk_tree_view_get_selection (treeview);
gtk_tree_selection_selected_foreach
(selection, path_toggled, view);
+ handled = TRUE;
}
}
- else if (view->priv->searchable_data_column != -1 && unicode)
- {
- return ephy_gui_select_row_by_key
- (treeview, view->priv->searchable_data_column, unicode);
- }
- return FALSE;
+ return handled;
}
static void
@@ -1205,12 +1197,6 @@ ephy_node_view_add_column (EphyNodeView *view,
G_CALLBACK (renderer_editing_canceled_cb), view);
}
- if ((flags & EPHY_NODE_VIEW_SEARCHABLE) &&
- (view->priv->searchable_data_column == -1))
- {
- view->priv->searchable_data_column = column;
- }
-
gtk_tree_view_column_pack_start (gcolumn, renderer, TRUE);
gtk_tree_view_column_set_attributes (gcolumn, renderer,
"text", column,
@@ -1237,6 +1223,12 @@ ephy_node_view_add_column (EphyNodeView *view,
gtk_tree_view_column_set_sort_column_id (gcolumn, column);
}
+ if (flags & EPHY_NODE_VIEW_SEARCHABLE)
+ {
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (view), column);
+ gtk_tree_view_set_enable_search (GTK_TREE_VIEW (view), TRUE);
+ }
+
if (ret != NULL)
*ret = gcolumn;
@@ -1283,7 +1275,6 @@ ephy_node_view_init (EphyNodeView *view)
view->priv = EPHY_NODE_VIEW_GET_PRIVATE (view);
view->priv->toggle_column = -1;
- view->priv->searchable_data_column = -1;
view->priv->priority_column = -1;
view->priv->priority_prop_id = 0;
view->priv->sort_column = -1;