From 58db7b1f622ba4eecdf7e88de921f388c9d40b95 Mon Sep 17 00:00:00 2001 From: Jonathan Blandford Date: Sun, 7 Mar 2004 19:38:49 +0000 Subject: [PATCH] stop activate from unselecting rows when pressed in multiple-selection Sun Mar 7 14:34:04 2004 Jonathan Blandford * gtk/gtkfilechooserdefault.c (trap_activate_cb): stop activate from unselecting rows when pressed in multiple-selection mode. --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtkfilechooserdefault.c | 37 +++++++++++++++++++++++++++++++++++++ 6 files changed, 62 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7f2d4b5891..316f70108a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Mar 7 14:34:04 2004 Jonathan Blandford + + * gtk/gtkfilechooserdefault.c (trap_activate_cb): stop activate + from unselecting rows when pressed in multiple-selection mode. + 2004-03-07 Hans Breuer * gdk/win32/gdkproperty-win32.c (gdk_screen_get_setting) : diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 7f2d4b5891..316f70108a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Sun Mar 7 14:34:04 2004 Jonathan Blandford + + * gtk/gtkfilechooserdefault.c (trap_activate_cb): stop activate + from unselecting rows when pressed in multiple-selection mode. + 2004-03-07 Hans Breuer * gdk/win32/gdkproperty-win32.c (gdk_screen_get_setting) : diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 7f2d4b5891..316f70108a 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Sun Mar 7 14:34:04 2004 Jonathan Blandford + + * gtk/gtkfilechooserdefault.c (trap_activate_cb): stop activate + from unselecting rows when pressed in multiple-selection mode. + 2004-03-07 Hans Breuer * gdk/win32/gdkproperty-win32.c (gdk_screen_get_setting) : diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 7f2d4b5891..316f70108a 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Sun Mar 7 14:34:04 2004 Jonathan Blandford + + * gtk/gtkfilechooserdefault.c (trap_activate_cb): stop activate + from unselecting rows when pressed in multiple-selection mode. + 2004-03-07 Hans Breuer * gdk/win32/gdkproperty-win32.c (gdk_screen_get_setting) : diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 7f2d4b5891..316f70108a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Sun Mar 7 14:34:04 2004 Jonathan Blandford + + * gtk/gtkfilechooserdefault.c (trap_activate_cb): stop activate + from unselecting rows when pressed in multiple-selection mode. + 2004-03-07 Hans Breuer * gdk/win32/gdkproperty-win32.c (gdk_screen_get_setting) : diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index ad5f0a80a4..4736737696 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -1843,6 +1843,41 @@ shortcuts_pane_create (GtkFileChooserDefault *impl, return vbox; } +static gboolean +trap_activate_cb (GtkWidget *widget, + GdkEventKey *event, + gpointer data) +{ + GtkFileChooserDefault *impl; + + impl = (GtkFileChooserDefault *) data; + + if (event->keyval == GDK_Return + || event->keyval == GDK_ISO_Enter + || event->keyval == GDK_KP_Enter + || event->keyval == GDK_space) + { + GtkWidget *toplevel; + + toplevel = gtk_widget_get_toplevel (widget); + if (GTK_IS_WINDOW (toplevel)) + { + GtkWindow *window; + + window = GTK_WINDOW (toplevel); + + if (window && + widget != window->default_widget && + !(widget == window->focus_widget && + (!window->default_widget || !GTK_WIDGET_SENSITIVE (window->default_widget)))) + gtk_window_activate_default (window); + } + return TRUE; + } + return FALSE; +} + + /* Creates the widgets for the file list */ static GtkWidget * create_file_list (GtkFileChooserDefault *impl) @@ -1867,6 +1902,8 @@ create_file_list (GtkFileChooserDefault *impl) gtk_container_add (GTK_CONTAINER (swin), impl->browse_files_tree_view); g_signal_connect (impl->browse_files_tree_view, "row-activated", G_CALLBACK (list_row_activated), impl); + g_signal_connect (impl->browse_files_tree_view, "key-press-event", + G_CALLBACK (trap_activate_cb), impl); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->browse_files_tree_view),