gnome-applets r11321 - trunk/mixer
- From: callum svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-applets r11321 - trunk/mixer
- Date: Wed, 4 Mar 2009 09:34:19 +0000 (UTC)
Author: callum
Date: Wed Mar 4 09:34:19 2009
New Revision: 11321
URL: http://svn.gnome.org/viewvc/gnome-applets?rev=11321&view=rev
Log:
Hide the mixer dock when the escape key is pressed. Bug 572427.
Modified:
trunk/mixer/ChangeLog
trunk/mixer/dock.c
Modified: trunk/mixer/dock.c
==============================================================================
--- trunk/mixer/dock.c (original)
+++ trunk/mixer/dock.c Wed Mar 4 09:34:19 2009
@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "dock.h"
@@ -39,6 +40,9 @@
static gboolean cb_button_release (GtkWidget *widget,
GdkEventButton *button,
gpointer data);
+static gboolean cb_key_press (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data);
static GtkWindowClass *parent_class = NULL;
@@ -127,6 +131,8 @@
NULL);
dock->orientation = orientation;
dock->model = parent;
+ g_signal_connect (dock, "key_press_event", G_CALLBACK (cb_key_press),
+ NULL);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
@@ -275,6 +281,25 @@
return TRUE;
}
+static gboolean
+cb_key_press (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data)
+{
+
+ /* Trap the escape key to popdown the dock. */
+ if (event->keyval == GDK_Escape) {
+ /* This is trickier than it looks. The main applet is watching for
+ * this widget to loose focus. Hiding the widget causes a
+ * focus-loss, thus the applet gets the focus-out signal and all
+ * the book-keeping gets done (like setting the applet button
+ * hilight) without an explicit callback. */
+ gtk_widget_hide (widget);
+ }
+
+ return FALSE;
+}
+
/*
* Set the adjustment for the slider.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]