[MPlayer-cvslog] r38320 - trunk/gui/dialog/fileselect.c
ib
subversion at mplayerhq.hu
Tue Oct 5 12:55:31 EEST 2021
Author: ib
Date: Tue Oct 5 12:55:31 2021
New Revision: 38320
Log:
Realize canceling the file sector dialog through an accelerator group.
Let the accelerator group handle the escape key instead of handling
the key press event ourselves. Accelerator groups are already used
for this purpose in all other dialogs.
This way, the escape key is now also recognized everywhere in the file
selector dialog and not only in the file list.
Modified:
trunk/gui/dialog/fileselect.c
Modified: trunk/gui/dialog/fileselect.c
==============================================================================
--- trunk/gui/dialog/fileselect.c Tue Oct 5 12:51:40 2021 (r38319)
+++ trunk/gui/dialog/fileselect.c Tue Oct 5 12:55:31 2021 (r38320)
@@ -701,13 +701,6 @@ static gboolean fs_key_release_event(Gtk
(void)user_data;
switch (event->key.keyval) {
- case GDK_Escape:
-
- if (GTK_IS_SCROLLED_WINDOW(widget))
- gtk_button_clicked(GTK_BUTTON(fsCancel));
-
- break;
-
case GDK_Return:
if (GTK_IS_SCROLLED_WINDOW(widget))
@@ -746,6 +739,7 @@ static void fs_Destroy(void)
static GtkWidget *CreateFileSelect(void)
{
gint x, y;
+ GtkAccelGroup *accel_group;
GtkWidget *vbox4;
GtkWidget *hbox4;
GtkWidget *vseparator1;
@@ -756,6 +750,8 @@ static GtkWidget *CreateFileSelect(void)
GtkWidget *upimage;
GdkPixbuf *uppixbuf;
+ accel_group = gtk_accel_group_new();
+
FileSelector = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize(FileSelector, 512, 440);
gtk_window_set_title(GTK_WINDOW(FileSelector), MSGTR_GUI_SelectFile);
@@ -834,6 +830,8 @@ static GtkWidget *CreateFileSelect(void)
fsOk = gtkAddButton(MSGTR_GUI_Ok, hbuttonbox3);
fsCancel = gtkAddButton(MSGTR_GUI_Cancel, hbuttonbox3);
+ gtk_widget_add_accelerator(fsCancel, "clicked", accel_group, GDK_Escape, 0, GTK_ACCEL_VISIBLE);
+
gtk_signal_connect(GTK_OBJECT(FileSelector), "destroy", GTK_SIGNAL_FUNC(fs_Destroy), NULL);
gtk_signal_connect(GTK_OBJECT(fsFNameListWindow), "key-release-event", GTK_SIGNAL_FUNC(fs_key_release_event), NULL);
@@ -850,6 +848,8 @@ static GtkWidget *CreateFileSelect(void)
gtk_signal_connect(GTK_OBJECT(fsFNameList), "select-row", (GtkSignalFunc)fs_fsFNameList_select_row, NULL);
gtk_signal_connect(GTK_OBJECT(fsFNameList), "event", (GtkSignalFunc)fs_fsFNameList_event, NULL);
+ gtk_window_add_accel_group(GTK_WINDOW(FileSelector), accel_group);
+
return FileSelector;
}
More information about the MPlayer-cvslog
mailing list