summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2018-10-04 15:44:18 (EDT)
committer P. J. McDermott <pj@pehjota.net>2018-10-05 08:17:07 (EDT)
commitf2fca78034485e9d52ebd9df64657a78c8470d22 (patch)
tree46d28beff22bc479d5e9679be8d7c1101962df9f /src
parentec66f247f08737567e88a342442b65e03026632b (diff)
downloadmarquee-f2fca78034485e9d52ebd9df64657a78c8470d22.zip
marquee-f2fca78034485e9d52ebd9df64657a78c8470d22.tar.gz
marquee-f2fca78034485e9d52ebd9df64657a78c8470d22.tar.bz2
MqWindow: Add close tab accelerator
Diffstat (limited to 'src')
-rw-r--r--src/window.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c
index 3d077a9..6ec501a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -293,9 +293,20 @@ mq_window_class_init(MqWindowClass *klass)
obj_properties);
}
+static gboolean
+accel_close_tab(G_GNUC_UNUSED GtkAccelGroup *accel_group,
+ G_GNUC_UNUSED GObject *acceleratable, G_GNUC_UNUSED guint keyval,
+ G_GNUC_UNUSED GdkModifierType modifier, MqNotebook *notebook)
+{
+ mq_notebook_remove_current_page(notebook);
+ return TRUE;
+}
+
static void
mq_window_init(MqWindow *window)
{
+ GtkAccelGroup *accel_group;
+
window->fullscreen = FALSE;
g_signal_connect(window, "notify::is-maximized",
@@ -311,6 +322,12 @@ mq_window_init(MqWindow *window)
window->notebook = mq_notebook_new(window);
gtk_container_add(GTK_CONTAINER(window), window->notebook);
+
+ accel_group = gtk_accel_group_new();
+ gtk_accel_group_connect(accel_group, GDK_KEY_W, GDK_CONTROL_MASK, 0,
+ g_cclosure_new(G_CALLBACK(accel_close_tab), window->notebook,
+ NULL));
+ gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
}
MqWindow *