mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-24 18:25:50 +00:00
rename-file-popover-controller: Stop using key-press-event
This commit is contained in:
parent
902ce37f57
commit
7077841501
|
@ -233,22 +233,35 @@ name_entry_on_undo (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
name_entry_on_key_pressed (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
name_entry_on_event (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkEventKey *key_event;
|
||||
NautilusRenameFilePopoverController *self;
|
||||
guint keyval;
|
||||
GdkModifierType state;
|
||||
|
||||
if (gdk_event_get_event_type (event) != GDK_KEY_PRESS)
|
||||
{
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
key_event = (GdkEventKey *) event;
|
||||
self = NAUTILUS_RENAME_FILE_POPOVER_CONTROLLER (user_data);
|
||||
|
||||
if (key_event->keyval == GDK_KEY_F2)
|
||||
if (G_UNLIKELY (!gdk_event_get_keyval (event, &keyval)))
|
||||
{
|
||||
g_return_val_if_reached (GDK_EVENT_PROPAGATE);
|
||||
}
|
||||
if (G_UNLIKELY (!gdk_event_get_state (event, &state)))
|
||||
{
|
||||
g_return_val_if_reached (GDK_EVENT_PROPAGATE);
|
||||
}
|
||||
|
||||
if (keyval == GDK_KEY_F2)
|
||||
{
|
||||
return name_entry_on_f2_pressed (widget, self);
|
||||
}
|
||||
else if (key_event->keyval == GDK_KEY_z &&
|
||||
(key_event->state & GDK_CONTROL_MASK) != 0)
|
||||
else if (keyval == GDK_KEY_z && (state & GDK_CONTROL_MASK) != 0)
|
||||
{
|
||||
return name_entry_on_undo (widget, self);
|
||||
}
|
||||
|
@ -361,8 +374,8 @@ nautilus_rename_file_popover_controller_show_for_file (NautilusRenameFilePopov
|
|||
self);
|
||||
|
||||
self->key_press_event_handler_id = g_signal_connect (self->name_entry,
|
||||
"key-press-event",
|
||||
G_CALLBACK (name_entry_on_key_pressed),
|
||||
"event",
|
||||
G_CALLBACK (name_entry_on_event),
|
||||
self);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (self->name_label),
|
||||
|
|
Loading…
Reference in a new issue