Re: Allow Escape to toggle window in gnome-dictionary-applet



Hi,

On Fri, 2006-03-03 at 12:26 -0500, Brent Smith wrote:
> Emmanuele Bassi wrote:
> > [Cc:-ing the documentation team]
> > 
> > Hi all,
> > 
> > in order to fix bug #330584 [1], the dictionary applet in HEAD now
> > allows the user to press Escape to dismiss the definitions window.
> > 
> > Since we are late in the release process, I'm asking the release team
> > (and the documentation team) if I can put this into the 2.14 soon-to-be
> > stable branch, in order to have this feature/fix in time for the 2.14.0
> > release.

> If we can get a patch to add this to the documentation as well, then
> it's an approval from me.

Attached there's the patch for the fix, including the mention of the Esc
key method inside the user's manual.

If it's fine for everyone, I'm going to commit it to the stable branch
later localtime(tonight) or tomorrow at most.

Thanks.

Ciao,
 Emmanuele.

-- 
Emmanuele Bassi - <ebassi gmail com>
Log: http://log.emmanuelebassi.net
Index: help/C/gnome-dictionary.xml
===================================================================
RCS file: /cvs/gnome/gnome-utils/gnome-dictionary/help/C/gnome-dictionary.xml,v
retrieving revision 1.9
diff -u -u -p -r1.9 gnome-dictionary.xml
--- help/C/gnome-dictionary.xml	16 Jan 2006 00:35:47 -0000	1.9
+++ help/C/gnome-dictionary.xml	3 Mar 2006 17:43:34 -0000
@@ -430,7 +430,7 @@
       Click <guibutton>Clear</guibutton> to clear the definitions.</para>
       
       <para>You can make the window disappear by left-clicking on the dictionary
-      icon.</para>
+      icon or pressing <keycap>Esc</keycap>.</para>
 
     </sect2>
     
Index: src/gdict-applet.c
===================================================================
RCS file: /cvs/gnome/gnome-utils/gnome-dictionary/src/gdict-applet.c,v
retrieving revision 1.18.2.2
diff -u -u -p -r1.18.2.2 gdict-applet.c
--- src/gdict-applet.c	24 Feb 2006 15:40:43 -0000	1.18.2.2
+++ src/gdict-applet.c	3 Mar 2006 17:43:34 -0000
@@ -26,6 +26,7 @@
 #include <string.h>
 
 #include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gtk/gtk.h>
 #include <gconf/gconf-client.h>
@@ -313,6 +314,23 @@ gdict_applet_set_menu_items_sensitive (G
 				NULL);
 }
 
+static gboolean
+window_key_press_event_cb (GtkWidget   *widget,
+			   GdkEventKey *event,
+			   gpointer     user_data)
+{
+  if (event->keyval == GDK_Escape)
+    {
+      GdictApplet *applet = GDICT_APPLET (user_data);
+
+      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (applet->priv->toggle), FALSE);
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
 static void
 gdict_applet_build_window (GdictApplet *applet)
 {
@@ -331,6 +349,9 @@ gdict_applet_build_window (GdictApplet *
     }
   
   window = gtk_aligned_window_new (priv->toggle);
+  g_signal_connect (window, "key-press-event",
+		    G_CALLBACK (window_key_press_event_cb),
+		    applet);
 
   frame = gtk_frame_new (NULL);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);


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