[devhelp] Implement GApplication::activate



commit cd718f90ba4a466ebb576a3d9490d747c89891ad
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 23 12:58:07 2015 -0400

    Implement GApplication::activate
    
    A GtkApplication is expected to present a window when
    org.freedesktop.Application.Activate is called. This is
    needed to make DBus activation work properly.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728384

 src/dh-app.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/dh-app.c b/src/dh-app.c
index e776e19..f69b0b2 100644
--- a/src/dh-app.c
+++ b/src/dh-app.c
@@ -382,6 +382,17 @@ dh_app_startup (GApplication *application)
         dh_book_manager_populate (priv->book_manager);
 }
 
+static void
+dh_app_activate (GApplication *application)
+{
+        DhApp *app = DH_APP (application);
+        GtkWidget *window;
+
+        window = dh_window_new (app);
+        gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (window));
+        gtk_widget_show_all (window);
+}
+
 /******************************************************************************/
 
 DhApp *
@@ -498,6 +509,7 @@ dh_app_class_init (DhAppClass *klass)
         GApplicationClass *application_class = G_APPLICATION_CLASS (klass);
 
         application_class->startup = dh_app_startup;
+        application_class->activate = dh_app_activate;
         application_class->handle_local_options = dh_app_handle_local_options;
         application_class->command_line = dh_app_command_line;
 


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