[gnome-photos] application, main: Avoid hard coding the WM_CLASS



commit c037b848d431e8c6439e6739d94c0ff9a2345e9f
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Jan 5 20:09:27 2018 +0100

    application, main: Avoid hard coding the WM_CLASS
    
    GApplication:application-id is a construct property, so the
    constructed virtual method is the earliest that it can be accessed.
    This is still pretty early in the startup sequence since things like
    gtk_init are only going to be invoked later in the startup virtual
    method.

 src/photos-application.c | 14 ++++++++++++++
 src/photos-main.c        |  2 --
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 69fa4666..b22e8d5c 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -2118,6 +2118,19 @@ photos_application_startup (GApplication *application)
 }
 
 
+static void
+photos_application_constructed (GObject *object)
+{
+  PhotosApplication *self = PHOTOS_APPLICATION (object);
+  const gchar *app_id;
+
+  G_OBJECT_CLASS (photos_application_parent_class)->constructed (object);
+
+  app_id = g_application_get_application_id (G_APPLICATION (self));
+  g_set_prgname (app_id);
+}
+
+
 static void
 photos_application_dispose (GObject *object)
 {
@@ -2245,6 +2258,7 @@ photos_application_class_init (PhotosApplicationClass *class)
   GObjectClass *object_class = G_OBJECT_CLASS (class);
   GApplicationClass *application_class = G_APPLICATION_CLASS (class);
 
+  object_class->constructed = photos_application_constructed;
   object_class->dispose = photos_application_dispose;
   object_class->finalize = photos_application_finalize;
   application_class->activate = photos_application_activate;
diff --git a/src/photos-main.c b/src/photos-main.c
index ebcd4327..daf8b959 100644
--- a/src/photos-main.c
+++ b/src/photos-main.c
@@ -55,8 +55,6 @@ main (gint argc, gchar *argv[])
 
     photos_debug_init ();
 
-    g_set_prgname ("org.gnome.Photos");
-
     app = photos_application_new ();
     if (g_getenv ("GNOME_PHOTOS_PERSIST") != NULL)
       g_application_hold (app);


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