[latexila/wip/app-menu: 8/8] Set GtkWindow:application property before showing the GtkWindow



commit b74768f97fe27185cc8ab5f081e9153bf769f7cf
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Dec 18 14:35:57 2015 +0100

    Set GtkWindow:application property before showing the GtkWindow
    
    Otherwise the app-menu is not shown, only the Quit action appears.

 src/latexila_app.vala |    6 +-----
 src/main_window.vala  |    5 +++--
 2 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/src/latexila_app.vala b/src/latexila_app.vala
index 8455ee1..8a0335d 100644
--- a/src/latexila_app.vala
+++ b/src/latexila_app.vala
@@ -251,11 +251,7 @@ public class LatexilaApp : Gtk.Application
             window.save_state ();
         }
 
-        MainWindow new_window = new MainWindow ();
-        add_window (new_window);
-        new_window.show ();
-
-        return new_window;
+        return new MainWindow (this);
     }
 
     public void open_documents (File[] files)
diff --git a/src/main_window.vala b/src/main_window.vala
index 684c7d9..9d70b0d 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -19,7 +19,7 @@
 
 using Gtk;
 
-public class MainWindow : Window
+public class MainWindow : ApplicationWindow
 {
     // for the menu and the toolbar
     // name, icon-name, label, accelerator, tooltip, callback
@@ -149,8 +149,9 @@ public class MainWindow : Window
     /*************************************************************************/
     // Construction
 
-    public MainWindow ()
+    public MainWindow (LatexilaApp app)
     {
+        Object (application: app);
         this.title = "LaTeXila";
 
         initialize_ui_manager ();


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