[anjal] Handle Ctrl+W to close tabs in composer, conv and folder view.
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [anjal] Handle Ctrl+W to close tabs in composer, conv and folder view.
- Date: Wed, 2 Dec 2009 13:21:05 +0000 (UTC)
commit ce6de058f277edcce30e47702ca3b5db0ff68e65
Author: Srinivasa Ragavan <sragavan gnome org>
Date: Wed Dec 2 18:50:05 2009 +0530
Handle Ctrl+W to close tabs in composer, conv and folder view.
src/mail-composer-view.c | 23 +++++++++++++++++++++++
src/mail-conv-view.c | 10 ++++++++++
src/mail-folder-view.c | 9 ++++++++-
3 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/src/mail-composer-view.c b/src/mail-composer-view.c
index aab908c..8798b73 100644
--- a/src/mail-composer-view.c
+++ b/src/mail-composer-view.c
@@ -135,6 +135,28 @@ composer_send_close_cb (struct _EMsgComposer *composer, MailComposerView *mcv)
g_signal_emit (mcv, signals[VIEW_CLOSE], 0);
}
+static gboolean
+mcv_key_pressed (GtkWidget *w, GdkEventKey *event, MailComposerView *mcv)
+{
+ gboolean ctrl = event->state & GDK_CONTROL_MASK ? TRUE : FALSE;
+ switch (event->keyval) {
+ case GDK_w:
+ case GDK_W:
+ {
+ if (!ctrl)
+ return FALSE;
+ g_signal_emit (mcv, signals[VIEW_CLOSE], 0);
+
+ return TRUE;
+ }
+
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
void
mail_composer_view_construct (MailComposerView *shell, struct _EMsgComposer *new_composer)
{
@@ -162,6 +184,7 @@ mail_composer_view_construct (MailComposerView *shell, struct _EMsgComposer *new
g_object_set_data ((GObject *)img, "pbuf", icon);
g_signal_connect (img, "expose-event", G_CALLBACK(mcv_btn_expose), shell);
+ g_signal_connect (shell, "key-press-event", G_CALLBACK(mcv_key_pressed), shell);
shell->tab_label = gtk_hbox_new (FALSE, 0);
w = gtk_label_new (_("New email"));
diff --git a/src/mail-conv-view.c b/src/mail-conv-view.c
index a592e31..2fe6961 100644
--- a/src/mail-conv-view.c
+++ b/src/mail-conv-view.c
@@ -91,6 +91,7 @@ mcv_key_press (GtkWidget *widget, GdkEventKey *event)
{
MailConvView *shell = (MailConvView *)widget;
MailConvViewPrivate *priv = shell->priv;
+ gboolean ctrl = event->state & GDK_CONTROL_MASK ? TRUE : FALSE;
switch (event->keyval) {
/* case GDK_KP_Right:
@@ -164,6 +165,15 @@ mcv_key_press (GtkWidget *widget, GdkEventKey *event)
return TRUE;
}
+ case GDK_w:
+ case GDK_W:
+ {
+ if (!ctrl)
+ return FALSE;
+ g_signal_emit (shell, signals[VIEW_CLOSE], 0);
+
+ return TRUE;
+ }
default:
return FALSE;
};
diff --git a/src/mail-folder-view.c b/src/mail-folder-view.c
index bc4db31..0b20fa9 100644
--- a/src/mail-folder-view.c
+++ b/src/mail-folder-view.c
@@ -1463,7 +1463,8 @@ static gboolean
mfv_key_pressed (GtkWidget *w, GdkEventKey *event, MailFolderView *mfv)
{
gboolean shift = event->state & GDK_SHIFT_MASK ? TRUE : FALSE;
-
+ gboolean ctrl = event->state & GDK_CONTROL_MASK ? TRUE : FALSE;
+
switch (event->keyval) {
case GDK_D:
case GDK_d:
@@ -1480,6 +1481,12 @@ mfv_key_pressed (GtkWidget *w, GdkEventKey *event, MailFolderView *mfv)
case GDK_m:
mfv_read(mfv, !shift);
break;
+ case GDK_w:
+ case GDK_W:
+ if (!ctrl)
+ return FALSE;
+ g_signal_emit (mfv, signals[VIEW_CLOSE], 0);
+ break;
default:
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]