Kaydet (Commit) 07dd9217 authored tarafından Enrico Tröger's avatar Enrico Tröger

Allow selecting items in the symbol list by pressing Enter or Space.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2386 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst e895402c
......@@ -17,6 +17,8 @@
* src/win32.c:
Fix crash on Windows due to missing error message when a process
spawning fails.
* src/treeviews.c:
Allow selecting items in the symbol list by pressing Enter or Space.
2008-03-21 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
......
......@@ -39,6 +39,7 @@
#include "symbols.h"
#include "navqueue.h"
#include <gdk/gdkkeysyms.h>
SidebarTreeviews tv;
......@@ -82,6 +83,8 @@ static void on_openfiles_hide_item_clicked(GtkMenuItem *menuitem, gpointer user_
static gboolean on_taglist_tree_selection_changed(GtkTreeSelection *selection);
static gboolean on_treeviews_button_press_event(GtkWidget *widget, GdkEventButton *event,
gpointer user_data);
static gboolean on_treeviews_key_press_event(GtkWidget *widget, GdkEventKey *event,
gpointer user_data);
static void on_list_document_activate(GtkCheckMenuItem *item, gpointer user_data);
static void on_list_symbol_activate(GtkCheckMenuItem *item, gpointer user_data);
......@@ -117,6 +120,8 @@ static void prepare_taglist(GtkWidget *tree, GtkTreeStore *store)
gtk_tree_view_set_model(GTK_TREE_VIEW(tree), GTK_TREE_MODEL(store));
g_signal_connect(G_OBJECT(tree), "button-press-event",
G_CALLBACK(on_treeviews_button_press_event), GINT_TO_POINTER(TREEVIEW_SYMBOL));
g_signal_connect(G_OBJECT(tree), "key-press-event",
G_CALLBACK(on_treeviews_key_press_event), GINT_TO_POINTER(TREEVIEW_SYMBOL));
gtk_tree_view_set_enable_search(GTK_TREE_VIEW(tree), FALSE);
......@@ -648,6 +653,23 @@ static gboolean on_taglist_tree_selection_changed(GtkTreeSelection *selection)
}
static gboolean on_treeviews_key_press_event(GtkWidget *widget, GdkEventKey *event,
gpointer user_data)
{
if (event->keyval == GDK_Return ||
event->keyval == GDK_ISO_Enter ||
event->keyval == GDK_KP_Enter ||
event->keyval == GDK_space)
{
GtkTreeSelection *select = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
/* delay the query of selection state because this callback is executed before GTK
* changes the selection (g_signal_connect_after would be better but it doesn't work) */
g_idle_add((GSourceFunc) on_taglist_tree_selection_changed, select);
}
return FALSE;
}
static gboolean on_treeviews_button_press_event(GtkWidget *widget, GdkEventButton *event,
gpointer user_data)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment