[gnome-shell/gnome-3-24] extensionPrefs: Avoid a runtime warning



commit b0fa5e56965cc4860988b7c84f4ccb1342bbfe13
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Apr 20 17:00:10 2017 +0200

    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

 js/extensionPrefs/main.js |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js
index 6c536aa..457ab6c 100644
--- a/js/extensionPrefs/main.js
+++ b/js/extensionPrefs/main.js
@@ -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();
     },
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]