[latexila/wip/app-menu] app: implement the app.manage-build-tools action



commit 1b7672c2359ce45269cbab9f8d7c7c0f137f492c
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Dec 18 15:11:04 2015 +0100

    app: implement the app.manage-build-tools action

 src/build_tools_preferences.vala |    4 ++--
 src/latexila_app.vala            |   11 +++++++++++
 src/main_window_build_tools.vala |    2 +-
 3 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/build_tools_preferences.vala b/src/build_tools_preferences.vala
index 672e134..7dc877a 100644
--- a/src/build_tools_preferences.vala
+++ b/src/build_tools_preferences.vala
@@ -41,7 +41,7 @@ public class BuildToolsPreferences : GLib.Object
     private TreeView _default_view;
     private TreeView _personal_view;
 
-    public BuildToolsPreferences (MainWindow main_window)
+    public BuildToolsPreferences (Window parent_window)
     {
         _default_store = get_new_store ();
         _personal_store = get_new_store ();
@@ -52,7 +52,7 @@ public class BuildToolsPreferences : GLib.Object
 
         _dialog = GLib Object  new (typeof (Gtk.Dialog), "use-header-bar", true, null)
             as Gtk.Dialog;
-        _dialog.set_transient_for (main_window);
+        _dialog.set_transient_for (parent_window);
         _dialog.destroy_with_parent = true;
         _dialog.title = _("Build Tools");
 
diff --git a/src/latexila_app.vala b/src/latexila_app.vala
index 5e7cb40..00633e8 100644
--- a/src/latexila_app.vala
+++ b/src/latexila_app.vala
@@ -121,6 +121,17 @@ public class LatexilaApp : Gtk.Application
             PreferencesDialog.show_me (this.active_window);
             release ();
         });
+
+        /* Manage build tools */
+        SimpleAction build_tools_action = new SimpleAction ("manage-build-tools", null);
+        add_action (build_tools_action);
+
+        build_tools_action.activate.connect (() =>
+        {
+            hold ();
+            new BuildToolsPreferences (this.active_window);
+            release ();
+        });
     }
 
     public static LatexilaApp get_instance ()
diff --git a/src/main_window_build_tools.vala b/src/main_window_build_tools.vala
index 9c7f414..419386c 100644
--- a/src/main_window_build_tools.vala
+++ b/src/main_window_build_tools.vala
@@ -480,6 +480,6 @@ public class MainWindowBuildTools
 
     public void on_preferences ()
     {
-        new BuildToolsPreferences (_main_window);
+        LatexilaApp.get_instance ().activate_action ("manage-build-tools", null);
     }
 }


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