[latexila/wip/build-tools-revamp: 1/2] Fix the saving of the personal build tools



commit f7a3d05606d0e53bc8c7883dc32197be63638095
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed May 7 22:05:40 2014 +0200

    Fix the saving of the personal build tools
    
    Hold the application alive when the personal build tools are saved.
    And do the save (asynchronously) when the BuildToolsPreferences dialog
    is closed.

 src/build_tools_preferences.vala                |    1 +
 src/latexila_app.vala                           |    1 -
 src/liblatexila/latexila-build-tools-personal.c |    8 ++++++--
 3 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/build_tools_preferences.vala b/src/build_tools_preferences.vala
index 528ed9d..5e90867 100644
--- a/src/build_tools_preferences.vala
+++ b/src/build_tools_preferences.vala
@@ -67,6 +67,7 @@ public class BuildToolsPreferences : GLib.Object
 
         _dialog.run ();
         _dialog.destroy ();
+        Latexila.BuildToolsPersonal.get_instance ().save ();
     }
 
     private void init_views ()
diff --git a/src/latexila_app.vala b/src/latexila_app.vala
index 03a138c..3ad0692 100644
--- a/src/latexila_app.vala
+++ b/src/latexila_app.vala
@@ -45,7 +45,6 @@ public class LatexilaApp : Gtk.Application
         {
             hold ();
             Projects.get_default ().save ();
-            Latexila.BuildToolsPersonal.get_instance ().save ();
             MostUsedSymbols.get_default ().save ();
             Gtk.AccelMap.save (get_accel_filename ());
             release ();
diff --git a/src/liblatexila/latexila-build-tools-personal.c b/src/liblatexila/latexila-build-tools-personal.c
index 54f3643..e2262c4 100644
--- a/src/liblatexila/latexila-build-tools-personal.c
+++ b/src/liblatexila/latexila-build-tools-personal.c
@@ -147,13 +147,14 @@ save_cb (GFile                      *xml_file,
   build_tools->priv->xml_file_contents = NULL;
 
   g_object_unref (build_tools);
+  g_application_release (g_application_get_default ());
 }
 
 /**
  * latexila_build_tools_personal_save:
  * @build_tools: the #LatexilaBuildToolsPersonal instance.
  *
- * Saves the personal build tools into the XML file.
+ * Saves asynchronously the personal build tools into the XML file.
  */
 void
 latexila_build_tools_personal_save (LatexilaBuildToolsPersonal *build_tools)
@@ -187,8 +188,11 @@ latexila_build_tools_personal_save (LatexilaBuildToolsPersonal *build_tools)
 
   g_string_append (contents, "</tools>\n");
 
-  /* Avoid finalization of build_tools during the async operation. */
+  /* Avoid finalization of build_tools during the async operation. And keep the
+   * application running.
+   */
   g_object_ref (build_tools);
+  g_application_hold (g_application_get_default ());
 
   xml_file = get_xml_file ();
 


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