[gnome-builder/wip/file-marks] app: save file-marks on application shutdown.



commit 831d83539828f68e1a145e328753bd586371d824
Author: Christian Hergert <christian hergert me>
Date:   Wed Oct 8 14:42:31 2014 -0700

    app: save file-marks on application shutdown.

 src/app/gb-application.c |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/src/app/gb-application.c b/src/app/gb-application.c
index f7114ae..9324606 100644
--- a/src/app/gb-application.c
+++ b/src/app/gb-application.c
@@ -376,11 +376,11 @@ gb_application_register_actions (GbApplication *self)
 static void
 gb_application_startup (GApplication *app)
 {
-  GbApplication *self;
+  GbApplication *self = (GbApplication *)app;
 
   ENTRY;
 
-  self = GB_APPLICATION (app);
+  g_assert (GB_IS_APPLICATION (self));
 
   g_resources_register (gb_get_resource ());
   g_application_set_resource_base_path (app, "/org/gnome/builder");
@@ -396,6 +396,30 @@ gb_application_startup (GApplication *app)
 }
 
 static void
+gb_application_shutdown (GApplication *app)
+{
+  GbApplication *self = (GbApplication *)app;
+  GbEditorFileMarks *marks;
+  GError *error = NULL;
+
+  ENTRY;
+
+  g_assert (GB_IS_APPLICATION (self));
+
+  marks = gb_editor_file_marks_get_default ();
+
+  if (!gb_editor_file_marks_save (marks, NULL, &error))
+    {
+      g_warning ("%s", error->message);
+      g_clear_error (&error);
+    }
+
+  G_APPLICATION_CLASS (gb_application_parent_class)->shutdown (app);
+
+  EXIT;
+}
+
+static void
 gb_application_constructed (GObject *object)
 {
   ENTRY;
@@ -418,6 +442,7 @@ gb_application_class_init (GbApplicationClass *klass)
 
   app_class->activate = gb_application_activate;
   app_class->startup = gb_application_startup;
+  app_class->shutdown = gb_application_shutdown;
   app_class->open = gb_application_open;
 
   EXIT;


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