diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-09-13 10:53:30 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-09-13 10:53:30 -0700 |
commit | 3d4be85f3521869f2703d9efb6b25c78ef90adea (patch) | |
tree | d766e704402d2aed260e491e649a333f59b11504 | |
parent | c74f58786d0a031a184b0933ddd19f7c48031bcc (diff) | |
download | subsurface-3d4be85f3521869f2703d9efb6b25c78ef90adea.tar.gz |
Prevent the preferences dialog from getting focus with file selector open
The idea is based on Lubomir's code but the implementation is radically
different. Instead of having the preferences dialog be referenced by a
global variable we simply look up the appropriate ancestor of the current
widget.
Inspired-by: "Lubomir I. Ivanov" <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | gtk-gui.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -493,7 +493,7 @@ static void event_toggle(GtkWidget *w, gpointer _data) static void pick_default_file(GtkWidget *w, GtkButton *button) { - GtkWidget *fs_dialog; + GtkWidget *fs_dialog, *preferences; const char *current_default; char *current_def_file, *current_def_dir; GtkFileFilter *filter; @@ -505,6 +505,9 @@ static void pick_default_file(GtkWidget *w, GtkButton *button) GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); + preferences = gtk_widget_get_ancestor(w, GTK_TYPE_DIALOG); + gtk_window_set_accept_focus(GTK_WINDOW(preferences), FALSE); + current_default = subsurface_default_filename(); current_def_dir = path_and_file(current_default, ¤t_def_file); @@ -537,6 +540,7 @@ static void pick_default_file(GtkWidget *w, GtkButton *button) free(current_def_dir); free(current_def_file); gtk_widget_destroy(fs_dialog); + gtk_window_set_accept_focus(GTK_WINDOW(preferences), TRUE); } static void preferences_dialog(GtkWidget *w, gpointer data) |