SF.net SVN: geany: [1723] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Wed Jul 18 15:35:52 UTC 2007
Revision: 1723
http://geany.svn.sourceforge.net/geany/?rev=1723&view=rev
Author: ntrel
Date: 2007-07-18 08:35:52 -0700 (Wed, 18 Jul 2007)
Log Message:
-----------
Make pressing escape focus the editor when using incremental search
or the Goto Line entries.
Add keybindings_cmd() to mimic a keybinding action.
Modified Paths:
--------------
trunk/ChangeLog
trunk/geany.glade
trunk/src/callbacks.c
trunk/src/callbacks.h
trunk/src/interface.c
trunk/src/keybindings.c
trunk/src/keybindings.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-07-18 12:25:18 UTC (rev 1722)
+++ trunk/ChangeLog 2007-07-18 15:35:52 UTC (rev 1723)
@@ -5,6 +5,11 @@
* src/navqueue.c:
Fix possible segfault when a file is closed and using go forward.
Fix 2 possible memory leaks when files have been closed.
+ * src/interface.c, src/keybindings.c, src/keybindings.h,
+ src/callbacks.c, src/callbacks.h, geany.glade:
+ Make pressing escape focus the editor when using incremental search
+ or the Goto Line entries.
+ Add keybindings_cmd() to mimic a keybinding action.
2007-07-17 Nick Treleaven <nick.treleaven at btinternet.com>
Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade 2007-07-18 12:25:18 UTC (rev 1722)
+++ trunk/geany.glade 2007-07-18 15:35:52 UTC (rev 1723)
@@ -1823,6 +1823,7 @@
<property name="activates_default">False</property>
<signal name="activate" handler="on_entry1_activate" last_modification_time="Sat, 30 Apr 2005 23:58:03 GMT"/>
<signal name="changed" handler="on_entry1_changed" last_modification_time="Tue, 03 May 2005 09:18:59 GMT"/>
+ <signal name="key_press_event" handler="on_entry1_key_press_event" last_modification_time="Wed, 18 Jul 2007 14:55:05 GMT"/>
</widget>
</child>
</widget>
@@ -1882,6 +1883,7 @@
<property name="activates_default">False</property>
<property name="width_chars">8</property>
<signal name="activate" handler="on_entry_goto_line_activate" last_modification_time="Sun, 26 Feb 2006 17:07:52 GMT"/>
+ <signal name="key_press_event" handler="on_entry_goto_line_key_press_event" last_modification_time="Wed, 18 Jul 2007 15:09:25 GMT"/>
</widget>
</child>
</widget>
Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c 2007-07-18 12:25:18 UTC (rev 1722)
+++ trunk/src/callbacks.c 2007-07-18 15:35:52 UTC (rev 1723)
@@ -622,6 +622,20 @@
}
+gboolean
+on_entry1_key_press_event (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer user_data)
+{
+ if (event->keyval == GDK_Escape)
+ {
+ keybindings_cmd(GEANY_KEYS_SWITCH_EDITOR);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
// search text
void
on_toolbutton18_clicked (GtkToolButton *toolbutton,
@@ -1248,6 +1262,15 @@
}
+gboolean
+on_entry_goto_line_key_press_event (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer user_data)
+{
+ return on_entry1_key_press_event(widget, event, user_data);
+}
+
+
void
on_toolbutton_goto_clicked (GtkToolButton *toolbutton,
gpointer user_data)
@@ -2110,4 +2133,3 @@
return FALSE;
}
-
Modified: trunk/src/callbacks.h
===================================================================
--- trunk/src/callbacks.h 2007-07-18 12:25:18 UTC (rev 1722)
+++ trunk/src/callbacks.h 2007-07-18 15:35:52 UTC (rev 1723)
@@ -583,3 +583,13 @@
GdkEventMotion *event,
gpointer user_data);
+
+gboolean
+on_entry1_key_press_event (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer user_data);
+
+gboolean
+on_entry_goto_line_key_press_event (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer user_data);
Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c 2007-07-18 12:25:18 UTC (rev 1722)
+++ trunk/src/interface.c 2007-07-18 15:35:52 UTC (rev 1723)
@@ -1576,12 +1576,18 @@
g_signal_connect ((gpointer) entry1, "changed",
G_CALLBACK (on_entry1_changed),
NULL);
+ g_signal_connect ((gpointer) entry1, "key_press_event",
+ G_CALLBACK (on_entry1_key_press_event),
+ NULL);
g_signal_connect ((gpointer) toolbutton18, "clicked",
G_CALLBACK (on_toolbutton18_clicked),
NULL);
g_signal_connect ((gpointer) entry_goto_line, "activate",
G_CALLBACK (on_entry_goto_line_activate),
NULL);
+ g_signal_connect ((gpointer) entry_goto_line, "key_press_event",
+ G_CALLBACK (on_entry_goto_line_key_press_event),
+ NULL);
g_signal_connect ((gpointer) toolbutton25, "clicked",
G_CALLBACK (on_toolbutton_goto_clicked),
NULL);
Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c 2007-07-18 12:25:18 UTC (rev 1722)
+++ trunk/src/keybindings.c 2007-07-18 15:35:52 UTC (rev 1723)
@@ -697,6 +697,13 @@
}
+/* Mimic a keybinding action */
+void keybindings_cmd(GeanyKeyCommand cmd_id)
+{
+ keys[cmd_id]->cb_func(cmd_id);
+}
+
+
/* These are the callback functions, either each group or each shortcut has it's
* own function. */
@@ -1211,3 +1218,4 @@
{
navqueue_go_forward();
}
+
Modified: trunk/src/keybindings.h
===================================================================
--- trunk/src/keybindings.h 2007-07-18 12:25:18 UTC (rev 1722)
+++ trunk/src/keybindings.h 2007-07-18 15:35:52 UTC (rev 1723)
@@ -45,7 +45,7 @@
} binding;
-enum
+typedef enum
{
GEANY_KEYS_MENU_NEW = 0,
GEANY_KEYS_MENU_OPEN,
@@ -149,16 +149,18 @@
GEANY_KEYS_EDIT_COMPLETECONSTRUCT,
GEANY_KEYS_EDIT_SUPPRESSCOMPLETION,
GEANY_MAX_KEYS
-};
+}
+GeanyKeyCommand;
binding *keys[GEANY_MAX_KEYS];
-
void keybindings_init(void);
void keybindings_free(void);
+void keybindings_cmd(GeanyKeyCommand cmd_id);
+
/* just write the content of the keys array to the config file */
void keybindings_write_to_file(void);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list