Added "shift" modifier versions of keybings for GtkFileChooser "folder-up"/"folder-down" bindings.

Also updated documentation, closes bug 322926
This commit is contained in:
Tristan Van Berkom 2011-01-29 20:06:25 +09:00
parent c01c018fde
commit ddb4b3ebe2
2 changed files with 41 additions and 20 deletions

View File

@ -222,18 +222,25 @@
* <row>
* <entry>up-folder</entry>
* <entry>
* <keycombo><keycap>Alt</keycap><keycap>Up</keycap></keycombo>
* <keycombo><keycap>Alt</keycap><keycap>Up</keycap></keycombo>;
* <keycombo><keycap>Alt</keycap><keycap>Shift</keycap><keycap>Up</keycap></keycombo>
* <footnote>
* Both the individual Up key and the numeric
* keypad's Up key are supported.
* </footnote>
* ;
* </footnote>;
* <keycap>Backspace</keycap>
* </entry>
* </row>
* <row>
* <entry>down-folder</entry>
* <entry><keycombo><keycap>Alt</keycap><keycap>Down</keycap></keycombo></entry>
* <entry>
* <keycombo><keycap>Alt</keycap><keycap>Down</keycap></keycombo>;
* <keycombo><keycap>Alt</keycap><keycap>Shift</keycap><keycap>Down</keycap></keycombo>
* <footnote>
* Both the individual Down key and the numeric
* keypad's Down key are supported.
* </footnote>
* </entry>
* </row>
* <row>
* <entry>home-folder</entry>

View File

@ -465,6 +465,22 @@ G_DEFINE_TYPE_WITH_CODE (GtkFileChooserDefault, _gtk_file_chooser_default, GTK_T
G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER_EMBED,
gtk_file_chooser_embed_default_iface_init));
static void
add_normal_and_shifted_binding (GtkBindingSet *binding_set,
guint keyval,
GdkModifierType modifiers,
const gchar *signal_name)
{
gtk_binding_entry_add_signal (binding_set,
keyval, modifiers,
signal_name, 0);
gtk_binding_entry_add_signal (binding_set,
keyval, modifiers | GDK_SHIFT_MASK,
signal_name, 0);
}
static void
_gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
{
@ -617,27 +633,25 @@ _gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
GDK_KEY_v, GDK_CONTROL_MASK,
"location-popup-on-paste",
0);
gtk_binding_entry_add_signal (binding_set,
GDK_KEY_Up, GDK_MOD1_MASK,
"up-folder",
0);
gtk_binding_entry_add_signal (binding_set,
GDK_KEY_BackSpace, 0,
"up-folder",
0);
gtk_binding_entry_add_signal (binding_set,
GDK_KEY_KP_Up, GDK_MOD1_MASK,
"up-folder",
0);
gtk_binding_entry_add_signal (binding_set,
GDK_KEY_Down, GDK_MOD1_MASK,
"down-folder",
0);
gtk_binding_entry_add_signal (binding_set,
GDK_KEY_KP_Down, GDK_MOD1_MASK,
"down-folder",
0);
add_normal_and_shifted_binding (binding_set,
GDK_KEY_Up, GDK_MOD1_MASK,
"up-folder");
add_normal_and_shifted_binding (binding_set,
GDK_KEY_KP_Up, GDK_MOD1_MASK,
"up-folder");
add_normal_and_shifted_binding (binding_set,
GDK_KEY_Down, GDK_MOD1_MASK,
"down-folder");
add_normal_and_shifted_binding (binding_set,
GDK_KEY_KP_Down, GDK_MOD1_MASK,
"down-folder");
gtk_binding_entry_add_signal (binding_set,
GDK_KEY_Home, GDK_MOD1_MASK,