[gnome-builder] app: set GApplication:base_resource_path



commit bea2d2c991521cea6f83a298f506eec7b62fd4de
Author: Christian Hergert <christian hergert me>
Date:   Tue Sep 9 18:17:33 2014 -0700

    app: set GApplication:base_resource_path

 src/app/gb-application.c |   24 ++++++++++++++++++++++--
 src/main.c               |   10 ++++------
 2 files changed, 26 insertions(+), 8 deletions(-)
---
diff --git a/src/app/gb-application.c b/src/app/gb-application.c
index 0f976e2..7df7237 100644
--- a/src/app/gb-application.c
+++ b/src/app/gb-application.c
@@ -29,6 +29,12 @@
 
 G_DEFINE_TYPE (GbApplication, gb_application, GTK_TYPE_APPLICATION)
 
+GbApplication *
+gb_application_new (void)
+{
+  return g_object_new (GB_TYPE_APPLICATION, NULL);
+}
+
 static void
 theme_changed (GtkSettings *settings)
 {
@@ -185,13 +191,25 @@ gb_application_startup (GApplication *app)
 }
 
 static void
+gb_application_constructed (GObject *object)
+{
+  if (G_OBJECT_CLASS (gb_application_parent_class)->constructed)
+    G_OBJECT_CLASS (gb_application_parent_class)->constructed (object);
+
+  g_application_set_resource_base_path (G_APPLICATION (object),
+                                        "/org/gnome/builder");
+}
+
+static void
 gb_application_class_init (GbApplicationClass *klass)
 {
-  GApplicationClass *app_class;
+  GApplicationClass *app_class = G_APPLICATION_CLASS (klass);
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   ENTRY;
 
-  app_class = G_APPLICATION_CLASS (klass);
+  object_class->constructed = gb_application_constructed;
+
   app_class->activate = gb_application_activate;
   app_class->startup = gb_application_startup;
 
@@ -202,5 +220,7 @@ static void
 gb_application_init (GbApplication *application)
 {
   ENTRY;
+  g_application_set_application_id (G_APPLICATION (application),
+                                    "org.gnome.Builder");
   EXIT;
 }
diff --git a/src/main.c b/src/main.c
index 5a4a345..7f9b37c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -27,7 +27,7 @@ int
 main (int   argc,
       char *argv[])
 {
-  GApplication *app;
+  GbApplication *app;
   int ret;
 
   g_set_prgname ("gnome-builder");
@@ -35,12 +35,10 @@ main (int   argc,
 
   gb_log_init (TRUE, NULL);
 
-  app = g_object_new (GB_TYPE_APPLICATION,
-                      "application-id", "org.gnome.Builder",
-                      NULL);
-  g_application_set_default (app);
+  app = gb_application_new ();
+  g_application_set_default (G_APPLICATION (app));
 
-  ret = g_application_run (app, argc, argv);
+  ret = g_application_run (G_APPLICATION (app), argc, argv);
 
   g_clear_object (&app);
 


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