[nautilus/wip/csoriano/destktop-split2: 23/27] application: add common startup code



commit 683cfc2ca91902cc923a1f815b6d57f57fdf37bf
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 +
 2 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index c0296e7..7fce4d6 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -1209,30 +1209,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 ();
 
@@ -1261,6 +1256,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__ */


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