[gnome-builder] greeter: present upon app activation when necessary



commit 745584280b7a8fd90b736ea10c2f0e792047b3c5
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 10 14:58:59 2019 -0800

    greeter: present upon app activation when necessary
    
    If we don't have any windows visible, then we should show the greeter when
    the application is activated. This should improve "gapplication launch
    org.gnome.Builder" usage.

 src/plugins/greeter/gbp-greeter-application-addin.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/src/plugins/greeter/gbp-greeter-application-addin.c 
b/src/plugins/greeter/gbp-greeter-application-addin.c
index 7fd0a2d93..a0636f483 100644
--- a/src/plugins/greeter/gbp-greeter-application-addin.c
+++ b/src/plugins/greeter/gbp-greeter-application-addin.c
@@ -206,6 +206,20 @@ gbp_greeter_application_addin_unload (IdeApplicationAddin *addin,
   self->application = NULL;
 }
 
+static void
+gbp_greeter_application_addin_activate (IdeApplicationAddin *addin,
+                                        IdeApplication      *app)
+{
+  GtkWindow *window;
+
+  g_assert (IDE_IS_MAIN_THREAD ());
+  g_assert (GBP_IS_GREETER_APPLICATION_ADDIN (addin));
+  g_assert (IDE_IS_APPLICATION (app));
+
+  if (!(window = gtk_application_get_active_window (GTK_APPLICATION (app))))
+    present_greeter_with_surface (NULL, NULL, addin);
+}
+
 static void
 application_addin_iface_init (IdeApplicationAddinInterface *iface)
 {
@@ -213,6 +227,7 @@ application_addin_iface_init (IdeApplicationAddinInterface *iface)
   iface->unload = gbp_greeter_application_addin_unload;
   iface->add_option_entries = gbp_greeter_application_addin_add_option_entries;
   iface->handle_command_line = gbp_greeter_application_addin_handle_command_line;
+  iface->activate = gbp_greeter_application_addin_activate;
 }
 
 G_DEFINE_TYPE_WITH_CODE (GbpGreeterApplicationAddin, gbp_greeter_application_addin, G_TYPE_OBJECT,


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