[nautilus/wip/csoriano/destktop-split2: 1/3] application: add common startup code



commit 26b9f92b6d8310fd11d21ed0f16660bd27bd9601
Author: Carlos Soriano <csoriano gnome org>
Date:   Wed Mar 16 16:17:32 2016 +0100

    application: add common startup code
    
    So children of nautilus application can chain up to it.
    We leave out the parts that children won't be interested in, like
    the bus manager which only nautilus is owner.
    So far is only used for the opened locations, so it's fine.

 src/nautilus-application.c         |   30 +++++++++++++++++++++---------
 src/nautilus-application.h         |    1 +
 src/nautilus-desktop-application.c |    2 +-
 3 files changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 374a2a1..9bfee01 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -1070,30 +1070,25 @@ on_application_shutdown (GApplication *application,
         g_list_free (notification_ids);
 }
 
-static void
-nautilus_application_startup (GApplication *app)
+void
+nautilus_application_startup_common (NautilusApplication *self)
 {
-       NautilusApplication *self = NAUTILUS_APPLICATION (app);
         NautilusApplicationPrivate *priv;
 
        nautilus_profile_start (NULL);
-
         priv = nautilus_application_get_instance_private (self);
 
-       g_application_set_resource_base_path (app, "/org/gnome/nautilus");
+       g_application_set_resource_base_path (G_APPLICATION (self), "/org/gnome/nautilus");
 
        /* chain up to the GTK+ implementation early, so gtk_init()
         * is called for us.
         */
-       G_APPLICATION_CLASS (nautilus_application_parent_class)->startup (app);
+       G_APPLICATION_CLASS (nautilus_application_parent_class)->startup (G_APPLICATION (self));
 
        gtk_window_set_default_icon_name ("system-file-manager");
 
        setup_theme_extensions ();
 
-       /* create DBus manager */
-       priv->fdb_manager = nautilus_freedesktop_dbus_new ();
-
        /* initialize preferences and create the global GSettings objects */
        nautilus_global_preferences_init ();
 
@@ -1121,6 +1116,23 @@ nautilus_application_startup (GApplication *app)
        nautilus_profile_end (NULL);
 
         g_signal_connect (self, "shutdown", G_CALLBACK (on_application_shutdown), NULL);
+
+}
+
+static void
+nautilus_application_startup (GApplication *app)
+{
+       NautilusApplication *self = NAUTILUS_APPLICATION (app);
+        NautilusApplicationPrivate *priv;
+
+       nautilus_profile_start (NULL);
+        priv = nautilus_application_get_instance_private (self);
+
+       /* create DBus manager */
+       priv->fdb_manager = nautilus_freedesktop_dbus_new ();
+        nautilus_application_startup_common (self);
+
+       nautilus_profile_end (NULL);
 }
 
 static gboolean
diff --git a/src/nautilus-application.h b/src/nautilus-application.h
index f6f8b8c..514a13d 100644
--- a/src/nautilus-application.h
+++ b/src/nautilus-application.h
@@ -85,6 +85,7 @@ GtkWidget * nautilus_application_connect_server (NautilusApplication *applicatio
 void nautilus_application_search (NautilusApplication *application,
                                   const gchar         *uri,
                                   const gchar         *text);
+void nautilus_application_startup_common (NautilusApplication *application);
 G_END_DECLS
 
 #endif /* __NAUTILUS_APPLICATION_H__ */
diff --git a/src/nautilus-desktop-application.c b/src/nautilus-desktop-application.c
index f160977..7be01d7 100644
--- a/src/nautilus-desktop-application.c
+++ b/src/nautilus-desktop-application.c
@@ -122,7 +122,7 @@ nautilus_desktop_application_startup (GApplication *app)
   NautilusDesktopApplication *self = NAUTILUS_DESKTOP_APPLICATION (app);
 
   g_print ("startup desktop\n");
-  G_APPLICATION_CLASS (nautilus_desktop_application_parent_class)->startup (app);
+  nautilus_application_startup_common (NAUTILUS_APPLICATION (app));
 
   init_desktop (self);
 }


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