[nautilus/wip/apoos-maximus/gsoc2020: 2/27] properties-window: Restore close on press 'Esc' functionality




commit 8a75d84ba893d80d1482703b1cce40f3e006ebba
Author: Apoorv Sachan <apoorv 99 sachan gmail com>
Date:   Sat Aug 1 17:51:33 2020 +0530

    properties-window: Restore close on press 'Esc' functionality
    
    NautilusPropertiesWindow usec to be a GtkDialog subclass, inheriting
    the "close" signal, which was leveraged to implement close on Esc.
    
    However as GtkWindow doesn't feature a "close" signal natively, and
    NautilusPropertiesWindow now subclasses GtkWindow, it needs to be
    seperately defined and attached to a signal handler to restore the
    functionality.

 src/nautilus-properties-window.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 4a4b0f435..8e3b23d03 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -5786,6 +5786,12 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *class)
     GTK_WIDGET_CLASS (class)->destroy = real_destroy;
 
     binding_set = gtk_binding_set_by_class (class);
+    g_signal_new ("close",
+                  G_OBJECT_CLASS_TYPE (class),
+                  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                  0, NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
     gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0,
                                   "close", 0);
 }
@@ -5793,4 +5799,5 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *class)
 static void
 nautilus_properties_window_init (NautilusPropertiesWindow *window)
 {
+    g_signal_connect (window, "close", G_CALLBACK (gtk_window_close), NULL);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]