changeset 1537:d9e918eb917c

Implementing CTRL-W to close advanced exif window In fact, this implements keypress event handling in the advanced exif window to handle CTRL-W event.
author mow
date Sat, 11 Apr 2009 16:34:25 +0000
parents b1e622788c4a
children a310abd44894
files src/advanced_exif.c src/advanced_exif.h
diffstat 2 files changed, 24 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/advanced_exif.c	Fri Apr 10 13:54:08 2009 +0000
+++ b/src/advanced_exif.c	Sat Apr 11 16:34:25 2009 +0000
@@ -301,14 +301,11 @@
 	gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column);
 }
 
-void advanced_exif_close(GtkWidget *window)
+void advanced_exif_close(ExifWin *ew)
 {
-	ExifWin *ew;
-
-	ew = g_object_get_data(G_OBJECT(window), "advanced_exif_data");
 	if (!ew) return;
 
-	gtk_widget_destroy(ew->vbox);
+	gtk_widget_destroy(ew->window);
 }
 
 static void advanced_exif_destroy(GtkWidget *widget, gpointer data)
@@ -359,6 +356,25 @@
 	return ret;
 }
 
+static gboolean advanced_exif_keypress(GtkWidget *widget, GdkEventKey *event, gpointer data)
+{
+	ExifWin *ew = data;
+	gboolean stop_signal = FALSE;
+
+	if (event->state & GDK_CONTROL_MASK)
+		{
+		switch (event->keyval)
+			{
+			case 'W': case 'w':
+				advanced_exif_close(ew);
+				stop_signal = TRUE;
+				break;
+			}
+		} // if (event->state & GDK_CONTROL...
+
+	return stop_signal;
+} // static gboolean advanced_exif_...
+
 GtkWidget *advanced_exif_new(void)
 {
 	ExifWin *ew;
@@ -437,6 +453,9 @@
 	g_signal_connect(G_OBJECT(ew->listview), "drag_begin",
 			 G_CALLBACK(advanced_exif_dnd_begin), ew);
 
+	g_signal_connect(G_OBJECT(ew->window), "key_press_event",
+			 G_CALLBACK(advanced_exif_keypress), ew);
+
 	ew->scrolled = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(ew->scrolled), GTK_SHADOW_IN);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ew->scrolled),
--- a/src/advanced_exif.h	Fri Apr 10 13:54:08 2009 +0000
+++ b/src/advanced_exif.h	Sat Apr 11 16:34:25 2009 +0000
@@ -16,7 +16,6 @@
 
 
 GtkWidget *advanced_exif_new(void);
-void advanced_exif_close(GtkWidget *bar);
 
 void advanced_exif_set_fd(GtkWidget *bar, FileData *fd);