tags 915538 + patch
thanks

I have made a patch for this, it doesn't add the option to the GUI
however, but only to the config file.

/Andreas Rönnquist
[email protected]
From: =?utf-8?q?Andreas_R=C3=B6nnquist?= <[email protected]>
Date: Tue, 4 Dec 2018 16:37:15 +0100
Subject: Add option to not close using ESC

---
 src/mainwindow.cc | 11 ++++++++---
 src/mainwindow.h  |  1 +
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index b45ab59..1cb6246 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -121,6 +121,8 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
         int width  = g_key_file_get_integer(config, "window", "width", NULL);
         int height = g_key_file_get_integer(config, "window", "height", NULL);
 
+        closeUsingEsc = g_key_file_get_boolean(config, "window", "closeUsingEsc", NULL);
+
         int default_width, default_height;
         get_default_size(default_width, default_height);
         if (width >= default_width && height >= default_height)
@@ -195,9 +197,11 @@ void MainWindow::on_realize() {
 
 bool MainWindow::on_key_press_event(GdkEventKey* event) {
 
-    if (GDK_KEY_Escape == event->keyval) {
-        Gtk::Main::quit();
-        return true;
+    if (closeUsingEsc) {
+      if (GDK_KEY_Escape == event->keyval) {
+          Gtk::Main::quit();
+          return true;
+      }
     }
     if (event->state & GDK_CONTROL_MASK) {
         switch (event->keyval) {
@@ -238,6 +242,7 @@ MainWindow::~MainWindow() {
     g_key_file_set_integer(config, "window", "sourceOutputType", sourceOutputTypeComboBox->get_active_row_number());
     g_key_file_set_integer(config, "window", "sinkType", sinkTypeComboBox->get_active_row_number());
     g_key_file_set_integer(config, "window", "sourceType", sourceTypeComboBox->get_active_row_number());
+    g_key_file_set_boolean(config, "window", "closeUsingEsc", closeUsingEsc);
 
     gsize filelen;
     GError *err = NULL;
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 5c501f7..5954a86 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -102,6 +102,7 @@ public:
     Glib::ustring defaultSinkName, defaultSourceName;
 
     bool canRenameDevices;
+    bool closeUsingEsc = true;
 
 protected:
     virtual void on_realize();
_______________________________________________
pkg-pulseaudio-devel mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-pulseaudio-devel

Reply via email to