SF.net SVN: geany: [2488] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Apr 16 11:34:34 UTC 2008


Revision: 2488
          http://geany.svn.sourceforge.net/geany/?rev=2488&view=rev
Author:   ntrel
Date:     2008-04-16 04:34:34 -0700 (Wed, 16 Apr 2008)

Log Message:
-----------
Make pressing escape in the sidebar focus the editor.
Group toolbar GtkEntry escape key checks into a common callback.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/NEWS
    trunk/geany.glade
    trunk/src/callbacks.c
    trunk/src/callbacks.h
    trunk/src/interface.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-04-15 15:11:05 UTC (rev 2487)
+++ trunk/ChangeLog	2008-04-16 11:34:34 UTC (rev 2488)
@@ -1,3 +1,10 @@
+2008-04-16  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/interface.c, src/callbacks.c, src/callbacks.h, NEWS, geany.glade:
+   Make pressing escape in the sidebar focus the editor.
+   Group toolbar GtkEntry escape key checks into a common callback.
+
+
 2008-04-15  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * doc/images/pref_dialog_gen.png:

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2008-04-15 15:11:05 UTC (rev 2487)
+++ trunk/NEWS	2008-04-16 11:34:34 UTC (rev 2488)
@@ -14,6 +14,7 @@
     * Make Next Error and Next Message commands add positions to the
       navigation queue, so the user can move backwards through the list items
       and return to where they were.
+    * Make pressing escape in the sidebar focus the editor.
 
     Interface:
     * When closing a tab when using left-to-right tabs, focus the next

Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade	2008-04-15 15:11:05 UTC (rev 2487)
+++ trunk/geany.glade	2008-04-16 11:34:34 UTC (rev 2488)
@@ -1498,6 +1498,7 @@
 	  <property name="toolbar_style">GTK_TOOLBAR_ICONS</property>
 	  <property name="tooltips">True</property>
 	  <property name="show_arrow">True</property>
+	  <signal name="key_press_event" handler="on_escape_key_press_event" last_modification_time="Thu, 03 Apr 2008 16:47:57 GMT"/>
 
 	  <child>
 	    <widget class="GtkMenuToolButton" id="menutoolbutton1">
@@ -1903,7 +1904,6 @@
 		  <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>
@@ -1963,7 +1963,6 @@
 		  <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>
@@ -2061,6 +2060,7 @@
 		  <property name="enable_popup">False</property>
 		  <signal name="switch_page" handler="on_tv_notebook_switch_page" last_modification_time="Sun, 20 Nov 2005 00:41:15 GMT"/>
 		  <signal name="switch_page" handler="on_tv_notebook_switch_page_after" after="yes" last_modification_time="Tue, 16 Oct 2007 07:03:41 GMT"/>
+		  <signal name="key_press_event" handler="on_escape_key_press_event" last_modification_time="Thu, 03 Apr 2008 16:44:50 GMT"/>
 
 		  <child>
 		    <widget class="GtkScrolledWindow" id="scrolledwindow2">

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2008-04-15 15:11:05 UTC (rev 2487)
+++ trunk/src/callbacks.c	2008-04-16 11:34:34 UTC (rev 2488)
@@ -658,20 +658,6 @@
 }
 
 
-gboolean
-on_entry1_key_press_event              (GtkWidget       *widget,
-                                        GdkEventKey     *event,
-                                        gpointer         user_data)
-{
-	if (event->keyval == GDK_Escape)
-	{
-		keybindings_send_command(GEANY_KEY_GROUP_FOCUS, GEANY_KEYS_FOCUS_EDITOR);
-		return TRUE;
-	}
-	return FALSE;
-}
-
-
 /* search text */
 void
 on_toolbutton18_clicked                (GtkToolButton   *toolbutton,
@@ -1285,15 +1271,6 @@
 }
 
 
-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)
@@ -2170,3 +2147,17 @@
 #endif
 }
 
+
+gboolean
+on_escape_key_press_event              (GtkWidget       *widget,
+                                        GdkEventKey     *event,
+                                        gpointer         user_data)
+{
+	/* make pressing escape in the sidebar and toolbar focus the editor */
+	if (event->keyval == GDK_Escape && event->state == 0)
+	{
+		keybindings_send_command(GEANY_KEY_GROUP_FOCUS, GEANY_KEYS_FOCUS_EDITOR);
+		return TRUE;
+	}
+	return FALSE;
+}

Modified: trunk/src/callbacks.h
===================================================================
--- trunk/src/callbacks.h	2008-04-15 15:11:05 UTC (rev 2487)
+++ trunk/src/callbacks.h	2008-04-16 11:34:34 UTC (rev 2488)
@@ -562,17 +562,6 @@
                                         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);
-
 void
 on_tv_notebook_switch_page_after       (GtkNotebook     *notebook,
                                         GtkNotebookPage *page,
@@ -599,3 +588,8 @@
 void
 on_tools1_activate                     (GtkMenuItem     *menuitem,
                                         gpointer         user_data);
+
+gboolean
+on_escape_key_press_event              (GtkWidget       *widget,
+                                        GdkEventKey     *event,
+                                        gpointer         user_data);

Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c	2008-04-15 15:11:05 UTC (rev 2487)
+++ trunk/src/interface.c	2008-04-16 11:34:34 UTC (rev 2488)
@@ -1579,6 +1579,9 @@
   g_signal_connect ((gpointer) menu_info1, "activate",
                     G_CALLBACK (on_info1_activate),
                     NULL);
+  g_signal_connect ((gpointer) toolbar1, "key_press_event",
+                    G_CALLBACK (on_escape_key_press_event),
+                    NULL);
   g_signal_connect ((gpointer) menutoolbutton1, "clicked",
                     G_CALLBACK (on_toolbutton_new_clicked),
                     NULL);
@@ -1636,18 +1639,12 @@
   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);
@@ -1660,6 +1657,9 @@
   g_signal_connect_after ((gpointer) notebook3, "switch_page",
                           G_CALLBACK (on_tv_notebook_switch_page_after),
                           NULL);
+  g_signal_connect ((gpointer) notebook3, "key_press_event",
+                    G_CALLBACK (on_escape_key_press_event),
+                    NULL);
   g_signal_connect ((gpointer) notebook1, "switch_page",
                     G_CALLBACK (on_notebook1_switch_page),
                     NULL);


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