app: force the action search dialog above its parent window...

... and set it modal to prevent interaction with other GIMP windows.
This commit is contained in:
Jehan 2014-11-29 23:53:18 +01:00
parent 73e4828556
commit 23de02b8c2
1 changed files with 13 additions and 0 deletions

View File

@ -123,6 +123,10 @@ action_search_dialog_create (Gimp *gimp)
if (! private)
{
GtkWidget *action_search_dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
GdkScreen *screen = gdk_screen_get_default ();
GdkWindow *gdk_parent = gdk_screen_get_active_window (screen);
gpointer parent_widget;
GtkWindow *parent;
GtkWidget *main_vbox;
private = g_slice_new0 (SearchDialog);
@ -136,6 +140,15 @@ action_search_dialog_create (Gimp *gimp)
"gimp-action-search-dialog");
gtk_window_set_title (GTK_WINDOW (action_search_dialog),
_("Search Actions"));
gtk_window_set_modal (GTK_WINDOW (action_search_dialog), TRUE);
/* The user data for a GdkWindow is its associated widget. */
gdk_window_get_user_data (gdk_parent, &parent_widget);
parent = GTK_WINDOW(gtk_widget_get_toplevel (GTK_WIDGET (parent_widget)));
/* NOTE: gtk_window_set_keep_above() would be easier but would render
* the search dialog above any windows, even non-GIMP related, which
* some early testers found annoying.
* Setting it transient forces it above a single parent instead. */
gtk_window_set_transient_for (GTK_WINDOW (action_search_dialog), parent);
main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
gtk_container_add (GTK_CONTAINER (action_search_dialog), main_vbox);