From c51830f45399047e5f3b93a2101d778a2f87cf18 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Sat, 29 Aug 2009 20:36:28 -0400 Subject: [PATCH] Do not emit action-activated signal when there are not actions selected This was causing problems for epiphanys location entry, reported in bug 593481. --- gtk/gtkentry.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 7bf5c29396..866a88fa78 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -9389,6 +9389,9 @@ keypress_completion_out: event->keyval == GDK_KP_Enter || event->keyval == GDK_Return) { + GtkTreeIter iter; + GtkTreeModel *model = NULL; + GtkTreeSelection *sel; gboolean retval = TRUE; _gtk_entry_reset_im_context (GTK_ENTRY (widget)); @@ -9396,9 +9399,6 @@ keypress_completion_out: if (completion->priv->current_selected < matches) { - GtkTreeIter iter; - GtkTreeModel *model = NULL; - GtkTreeSelection *sel; gboolean entry_set; sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->tree_view)); @@ -9430,15 +9430,18 @@ keypress_completion_out: } else if (completion->priv->current_selected - matches >= 0) { - GtkTreePath *path; + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->action_view)); + if (gtk_tree_selection_get_selected (sel, &model, &iter)) + { + GtkTreePath *path; - _gtk_entry_reset_im_context (GTK_ENTRY (widget)); - - path = gtk_tree_path_new_from_indices (completion->priv->current_selected - matches, -1); - - g_signal_emit_by_name (completion, "action-activated", - gtk_tree_path_get_indices (path)[0]); - gtk_tree_path_free (path); + path = gtk_tree_path_new_from_indices (completion->priv->current_selected - matches, -1); + g_signal_emit_by_name (completion, "action-activated", + gtk_tree_path_get_indices (path)[0]); + gtk_tree_path_free (path); + } + else + retval = FALSE; } g_free (completion->priv->completion_prefix);