[libgda] GdaBrowser: DEL key deletes query execution history items



commit ba791dca913c6db8360754112ef5e998cbcc1822
Author: Vivien Malerba <malerba gnome-db org>
Date:   Fri Sep 4 21:56:01 2009 +0200

    GdaBrowser: DEL key deletes query execution history items

 tools/browser/query-exec/query-editor.c |   35 +++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/tools/browser/query-exec/query-editor.c b/tools/browser/query-exec/query-editor.c
index 357cc99..1dc65f6 100644
--- a/tools/browser/query-exec/query-editor.c
+++ b/tools/browser/query-exec/query-editor.c
@@ -231,20 +231,29 @@ event_after (GtkWidget *text_view, GdkEvent *ev, QueryEditor *editor)
 		if (tags) 
 			g_slist_free (tags);
 	}
-	else if ((ev->type == GDK_KEY_PRESS) && 
-		 (((((GdkEventKey*) ev)->keyval == GDK_Up)) || ((((GdkEventKey*) ev)->keyval == GDK_Down)))) {
-		HistItemData *nfocus = NULL;
-		if (editor->priv->hist_focus) {
-			if (((GdkEventKey*) ev)->keyval == GDK_Up)
-				nfocus = get_prev_hist_data (editor, editor->priv->hist_focus);
-			else
-				nfocus = get_next_hist_data (editor, editor->priv->hist_focus);
-			if (!nfocus)
-				nfocus = editor->priv->hist_focus;
+	else if (ev->type == GDK_KEY_PRESS) {
+		GdkEventKey *evkey = ((GdkEventKey*) ev);
+		if ((evkey->keyval == GDK_Up) || (evkey->keyval == GDK_Down)) {
+			HistItemData *nfocus = NULL;
+			if (editor->priv->hist_focus) {
+				if (((GdkEventKey*) ev)->keyval == GDK_Up)
+					nfocus = get_prev_hist_data (editor, editor->priv->hist_focus);
+				else
+					nfocus = get_next_hist_data (editor, editor->priv->hist_focus);
+				if (!nfocus)
+					nfocus = editor->priv->hist_focus;
+			}
+			
+			focus_on_hist_data (editor, nfocus);
+			return TRUE;
+		}
+		else if ((evkey->keyval == GDK_Delete) && editor->priv->hist_focus) {
+			if (editor->priv->hist_focus->item)
+				query_editor_del_current_history_item (editor);
+			else if (editor->priv->hist_focus->batch)
+				query_editor_del_history_batch (editor, editor->priv->hist_focus->batch);
+			return TRUE;
 		}
-
-		focus_on_hist_data (editor, nfocus);
-		return TRUE;
 	}
 	else
 		return FALSE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]