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



commit 85d7cb6fd388544019588163000714874c1a2f85
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 use to be a GtkDialog which
    support the "close" signal by default, which was leveraged
    to implement close on Esc, However as GtkWindow doesn't
    support "close" signal natively, and PropertiesWindow now
    Subclasses GtkWindow, it's been seperately defined and attached
    to a signal handler to restore the functionality.

 src/nautilus-properties-window.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 92652ad5c..fc550e301 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -5566,6 +5566,13 @@ nautilus_properties_window_class_init (NautilusPropertiesWindowClass *klass)
     widget_class->destroy = real_destroy;
 
     binding_set = gtk_binding_set_by_class (klass);
+    g_signal_new ("close",
+                  G_OBJECT_CLASS_TYPE (klass),
+                  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                  0, NULL, NULL,
+                  NULL,
+                  G_TYPE_NONE, 0);
+
     gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "close", 0);
 
     gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/nautilus/ui/nautilus-properties-window.ui");
@@ -5658,4 +5665,5 @@ static void
 nautilus_properties_window_init (NautilusPropertiesWindow *window)
 {
     gtk_widget_init_template (GTK_WIDGET (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]