Commit f1320c9c authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Close properties dialog on escape (#515620) Patch from Cosimo Cecchi

2008-02-14  Alexander Larsson  <alexl@redhat.com>

        * src/file-manager/fm-properties-window.[ch]:
	Close properties dialog on escape (#515620)
	Patch from Cosimo Cecchi



svn path=/trunk/; revision=13749
parent 1fc6acc0
2008-02-14 Alexander Larsson <alexl@redhat.com>
* src/file-manager/fm-properties-window.[ch]:
Close properties dialog on escape (#515620)
Patch from Cosimo Cecchi
2008-02-14 Alexander Larsson <alexl@redhat.com> 2008-02-14 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-file-operations.c: * libnautilus-private/nautilus-file-operations.c:
......
...@@ -191,6 +191,13 @@ enum { ...@@ -191,6 +191,13 @@ enum {
COLUMN_COUNT COLUMN_COUNT
}; };
enum {
CLOSE,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL];
typedef struct { typedef struct {
GList *original_files; GList *original_files;
GList *target_files; GList *target_files;
...@@ -5397,11 +5404,44 @@ select_image_button_callback (GtkWidget *widget, ...@@ -5397,11 +5404,44 @@ select_image_button_callback (GtkWidget *widget,
gtk_widget_hide (dialog); gtk_widget_hide (dialog);
} }
static void
fm_properties_window_close (FMPropertiesWindow *pwindow)
{
/* Synthesize delete_event to close dialog. */
GtkWidget *widget = GTK_WIDGET (pwindow);
GdkEvent *event;
event = gdk_event_new (GDK_DELETE);
event->any.window = g_object_ref (widget->window);
event->any.send_event = TRUE;
gtk_main_do_event (event);
gdk_event_free (event);
}
static void static void
fm_properties_window_class_init (FMPropertiesWindowClass *class) fm_properties_window_class_init (FMPropertiesWindowClass *class)
{ {
GtkBindingSet *binding_set;
G_OBJECT_CLASS (class)->finalize = real_finalize; G_OBJECT_CLASS (class)->finalize = real_finalize;
GTK_OBJECT_CLASS (class)->destroy = real_destroy; GTK_OBJECT_CLASS (class)->destroy = real_destroy;
class->close = fm_properties_window_close;
signals[CLOSE] =
g_signal_new ("close",
G_OBJECT_CLASS_TYPE (class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (FMPropertiesWindowClass, close),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
binding_set = gtk_binding_set_by_class (class);
gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0,
"close", 0);
} }
static void static void
......
...@@ -51,6 +51,9 @@ struct FMPropertiesWindow { ...@@ -51,6 +51,9 @@ struct FMPropertiesWindow {
struct FMPropertiesWindowClass { struct FMPropertiesWindowClass {
GtkWindowClass parent_class; GtkWindowClass parent_class;
/* Keybinding signals */
void (* close) (FMPropertiesWindow *window);
}; };
typedef struct FMPropertiesWindowClass FMPropertiesWindowClass; typedef struct FMPropertiesWindowClass FMPropertiesWindowClass;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment