[gnome-builder] gui: show greeter upon closing last project



commit f9e8020e981a1e7d1929b95da9170e34fa9ffaaa
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jan 11 11:08:25 2019 -0800

    gui: show greeter upon closing last project

 src/libide/gui/ide-workbench.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/gui/ide-workbench.c b/src/libide/gui/ide-workbench.c
index ef5198def..ad836b707 100644
--- a/src/libide/gui/ide-workbench.c
+++ b/src/libide/gui/ide-workbench.c
@@ -1266,6 +1266,30 @@ ide_workbench_action_inspector (IdeWorkbench *self,
   gtk_window_set_interactive_debugging (TRUE);
 }
 
+static void
+ide_workbench_action_close_cb (GObject      *object,
+                               GAsyncResult *result,
+                               gpointer      user_data)
+{
+  IdeWorkbench *self = (IdeWorkbench *)object;
+
+  g_assert (IDE_IS_MAIN_THREAD ());
+  g_assert (IDE_IS_WORKBENCH (self));
+  g_assert (G_IS_ASYNC_RESULT (result));
+  g_assert (user_data == NULL);
+
+  if (ide_workbench_unload_finish (self, result, NULL))
+    {
+      IdeApplication *app = IDE_APPLICATION_DEFAULT;
+      GtkWindow *active;
+
+      if (!(active = gtk_application_get_active_window (GTK_APPLICATION (app))))
+        g_application_activate (G_APPLICATION (app));
+      else
+        ide_gtk_window_present (active);
+    }
+}
+
 static void
 ide_workbench_action_close (IdeWorkbench *self,
                             GVariant     *param)
@@ -1274,7 +1298,10 @@ ide_workbench_action_close (IdeWorkbench *self,
   g_assert (param == NULL);
 
   if (self->unloaded == FALSE)
-    ide_workbench_unload_async (self, NULL, NULL, NULL);
+    ide_workbench_unload_async (self,
+                                NULL,
+                                ide_workbench_action_close_cb,
+                                NULL);
 }
 
 static void


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