[five-or-more] Fix quit action



commit 65b91743aa28eefb241e6c7e502918094675fa62
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Jul 30 23:04:06 2016 -0500

    Fix quit action
    
    Currently the Quit menu item or Ctrl+Q does nothing the first time you
    use it, and just triggers a stream of criticals on subsequent uses,
    because Quit only frees program resources, it's not actually wired into
    shutdown. Fix this.

 src/five-or-more.c |   25 ++++++++++---------------
 1 files changed, 10 insertions(+), 15 deletions(-)
---
diff --git a/src/five-or-more.c b/src/five-or-more.c
index 7d8d6b7..f2f52be 100644
--- a/src/five-or-more.c
+++ b/src/five-or-more.c
@@ -1457,25 +1457,12 @@ game_props_callback (GSimpleAction *action,
   gtk_dialog_run (GTK_DIALOG (pref_dialog));
 }
 
-static void cleanup ()
-{
-  int i = 0;
-
-  for (i = 0; i < G_N_ELEMENTS (preview_images); i++)
-    if (preview_pixbufs[i])
-      g_object_unref (preview_pixbufs[i]);
-
-  g_clear_object (&ball_preimage);
-  g_object_unref (highscores);
-
-}
-
 void
 game_quit_callback (GSimpleAction *action,
                     GVariant *parameter,
                     gpointer user_data)
 {
-  cleanup ();
+  g_application_quit (G_APPLICATION (user_data));
 }
 
 void
@@ -1689,10 +1676,18 @@ activate_cb (GApplication *application)
 static void
 shutdown_cb (GApplication *application)
 {
+  int i = 0;
+
+  for (i = 0; i < G_N_ELEMENTS (preview_images); i++)
+    if (preview_pixbufs[i])
+      g_object_unref (preview_pixbufs[i]);
+
+  g_clear_object (&ball_preimage);
+  g_object_unref (highscores);
+
   g_settings_set_int (settings, "window-width", window_width);
   g_settings_set_int (settings, "window-height", window_height);
   g_settings_set_boolean (settings, "window-is-maximized", window_is_maximized);
-  cleanup ();
 }
 
 int


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