extensionPrefs: Avoid a runtime warning

Since 5b3fb024be, the main window is only shown when not launched
with a valid UUID. As GtkDialog isn't meant to be used standalone,
we currently trigger a (harmless but annoying) warning in case
the main window isn't shown; we can avoid the warning by setting
up the preference dialog manually instead of using the GtkDialog
convenience class.

https://bugzilla.gnome.org/show_bug.cgi?id=781545
This commit is contained in:
Florian Müllner 2017-04-20 17:00:10 +02:00
parent 7a20683728
commit 06fdf2fdc8

View File

@ -5,6 +5,7 @@ const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
const Gdk = imports.gi.Gdk;
const Pango = imports.gi.Pango;
const Format = imports.format;
@ -92,9 +93,11 @@ const Application = new Lang.Class({
widget = this._buildErrorUI(extension, e);
}
let dialog = new Gtk.Dialog({ use_header_bar: true,
modal: true,
title: extension.metadata.name });
let dialog = new Gtk.Window({ modal: !this._skipMainWindow,
type_hint: Gdk.WindowTypeHint.DIALOG });
dialog.set_titlebar(new Gtk.HeaderBar({ show_close_button: true,
title: extension.metadata.name,
visible: true }));
if (this._skipMainWindow) {
this.application.add_window(dialog);
@ -107,7 +110,7 @@ const Application = new Lang.Class({
}
dialog.set_default_size(600, 400);
dialog.get_content_area().add(widget);
dialog.add(widget);
dialog.show();
},