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.

https://bugzilla.gnome.org/show_bug.cgi?id=712620
parent d92b660e
......@@ -1208,30 +1208,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 ();
......@@ -1260,6 +1255,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
......@@ -1328,6 +1340,12 @@ update_dbus_opened_locations (NautilusApplication *self)
g_return_if_fail (NAUTILUS_IS_APPLICATION (self));
priv = nautilus_application_get_instance_private (self);
/* Children of nautilus application could not handle the dbus, so don't
* do anything in that case */
if (!priv->fdb_manager)
return;
for (l = priv->windows; l != NULL; l = l->next) {
window = l->data;
......
......@@ -84,6 +84,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__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment