bug 8128; fix progress meters for transient parent

This commit is contained in:
prculley 2017-01-01 08:58:06 -06:00 committed by Nick Hall
parent 813361179f
commit f46350d595
2 changed files with 13 additions and 3 deletions

View File

@ -152,6 +152,12 @@ class ProgressMeter:
self.__dialog.vbox.set_spacing(10)
self.__dialog.vbox.set_border_width(24)
self.__dialog.set_size_request(400, 125)
if not parent: # if we don't have an explicit parent, try to find one
for win in Gtk.Window.list_toplevels():
if win.is_active():
parent = win
break
# if we still don't have a parent, give up
if parent:
self.__dialog.set_transient_for(parent)
self.__dialog.set_modal(True)

View File

@ -494,13 +494,17 @@ class GtkProgressDialog(Gtk.Dialog):
:type title: string
"""
Gtk.Dialog.__init__(self)
parent = None
if len(window_params) >= 2:
self.set_transient_for(window_params[1])
else:
parent = window_params[1] # we got an explicit parent
else: # try to find an active window
for win in Gtk.Window.list_toplevels():
if win.is_active():
self.set_transient_for(win)
parent = win
break
# if we still don't have a parent, give up
if parent:
self.set_transient_for(parent)
if len(window_params) >= 3:
flags = window_params[2]
if Gtk.DialogFlags.MODAL & flags: