summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 *