[gnome-screenshot] Implement g_application_activate()



commit 5045c39673dc809b8d1b8d3009ddc9d05e3ba35f
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Thu Jun 26 11:59:44 2014 -0500

    Implement g_application_activate()
    
    GLib-GIO-WARNING **: Your application does not implement
    g_application_activate() and has no handlers connected to
    the 'activate' signal.  It should do one of these.
    
    Also, there's no point in creating the app menu each time we want to
    take a screenshot, so move that here.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732220

 src/screenshot-application.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/screenshot-application.c b/src/screenshot-application.c
index 0295d6c..b5b3eae 100644
--- a/src/screenshot-application.c
+++ b/src/screenshot-application.c
@@ -773,8 +773,6 @@ static void
 screenshot_application_startup (GApplication *app)
 {
   ScreenshotApplication *self = SCREENSHOT_APPLICATION (app);
-  GtkBuilder *builder;
-  GMenuModel *menu;
 
   G_APPLICATION_CLASS (screenshot_application_parent_class)->startup (app);
 
@@ -782,11 +780,18 @@ screenshot_application_startup (GApplication *app)
 
   g_action_map_add_action_entries (G_ACTION_MAP (self), action_entries,
                                    G_N_ELEMENTS (action_entries), self);
+}
+
+static void
+screenshot_application_activate (GApplication *app)
+{
+  GtkBuilder *builder;
+  GMenuModel *menu;
 
   builder = gtk_builder_new ();
   gtk_builder_add_from_resource (builder, "/org/gnome/screenshot/screenshot-app-menu.ui", NULL);
   menu = G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"));
-  gtk_application_set_app_menu (GTK_APPLICATION (self), menu);
+  gtk_application_set_app_menu (GTK_APPLICATION (app), menu);
 
   g_object_unref (builder);
   g_object_unref (menu);
@@ -815,6 +820,7 @@ screenshot_application_class_init (ScreenshotApplicationClass *klass)
   aclass->handle_local_options = screenshot_application_handle_local_options;
   aclass->command_line = screenshot_application_command_line;
   aclass->startup = screenshot_application_startup;
+  aclass->activate = screenshot_application_activate;
 
   g_type_class_add_private (klass, sizeof (ScreenshotApplicationPriv));
 }


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