aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark McLoughlin <mark@skynet.ie>2003-10-17 17:51:34 +0800
committerMark McLoughlin <markmc@src.gnome.org>2003-10-17 17:51:34 +0800
commit38ae2cf3b7edcea303f297ef16560fd4acea21cf (patch)
tree2a14d641e20aba940ee3f6c79084b41e50991b10
parent2b0803f30d3e3c2474a5114ee5e1478b153c92de (diff)
downloadgsoc2013-epiphany-38ae2cf3b7edcea303f297ef16560fd4acea21cf.tar
gsoc2013-epiphany-38ae2cf3b7edcea303f297ef16560fd4acea21cf.tar.gz
gsoc2013-epiphany-38ae2cf3b7edcea303f297ef16560fd4acea21cf.tar.bz2
gsoc2013-epiphany-38ae2cf3b7edcea303f297ef16560fd4acea21cf.tar.lz
gsoc2013-epiphany-38ae2cf3b7edcea303f297ef16560fd4acea21cf.tar.xz
gsoc2013-epiphany-38ae2cf3b7edcea303f297ef16560fd4acea21cf.tar.zst
gsoc2013-epiphany-38ae2cf3b7edcea303f297ef16560fd4acea21cf.zip
Change the behaviour of --nautilus-view such that the process doesn't exit
2003-10-16 Mark McLoughlin <mark@skynet.ie> Change the behaviour of --nautilus-view such that the process doesn't exit until the last control has been destroyed. The previous behaviour caused intermittent activation failure when the process timed out and died before the view could be created - bug #124768. * src/ephy-main.c: (ephy_main_start): don't unref the shell when started with --nautilus-view. (ephy_main_dummy_url_argument), (ephy_main_translate_url_arguments): create a dummy argument when no arguments are supplied which will cause the default window to be opened. * src/ephy-shell.c: (ephy_nautilus_view_all_controls_dead): unref the shell here causing the process to exit. (ephy_nautilus_view_init_factory): setup the all_controls_dead callback. (ephy_nautilus_view_new): instrument the control.
-rw-r--r--ChangeLog23
-rw-r--r--src/ephy-main.c40
-rw-r--r--src/ephy-shell.c24
3 files changed, 66 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c33e5ef3..f93750288 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2003-10-16 Mark McLoughlin <mark@skynet.ie>
+
+ Change the behaviour of --nautilus-view such that the process
+ doesn't exit until the last control has been destroyed. The
+ previous behaviour caused intermittent activation failure
+ when the process timed out and died before the view could be
+ created - bug #124768.
+
+ * src/ephy-main.c:
+ (ephy_main_start): don't unref the shell when started with
+ --nautilus-view.
+ (ephy_main_dummy_url_argument),
+ (ephy_main_translate_url_arguments): create a dummy argument
+ when no arguments are supplied which will cause the default
+ window to be opened.
+
+ * src/ephy-shell.c:
+ (ephy_nautilus_view_all_controls_dead): unref the shell
+ here causing the process to exit.
+ (ephy_nautilus_view_init_factory): setup the all_controls_dead
+ callback.
+ (ephy_nautilus_view_new): instrument the control.
+
2003-10-17 Ettore Perazzoli <ettore@ximian.com>
* src/bookmarks/ephy-bookmarks-editor.c
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 3f2864839..c514532e3 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -238,20 +238,7 @@ ephy_main_start (gpointer data)
(gaserver, quit_option, &corba_env);
}
/* provided with urls? */
- else if (n_urls == 0 &&
- !open_as_nautilus_view)
- {
- /* no, open a default window */
- GNOME_EphyAutomation_loadurl
- (gaserver, "",
- open_fullscreen,
- open_in_existing,
- open_in_new_window,
- open_in_new_tab,
- !noraise,
- &corba_env);
- }
- else
+ else if (!open_as_nautilus_view)
{
/* open all of the urls */
for (i = 0; i < n_urls; i++)
@@ -267,8 +254,11 @@ ephy_main_start (gpointer data)
}
}
- /* Unref so it will exit if no more used */
- if (first_instance)
+ /* Unref so it will exit if no more used
+ * If started with --nautilus-view, only exit when the
+ * last view has been destroyed.
+ */
+ if (first_instance && !open_as_nautilus_view)
{
g_object_unref (G_OBJECT(ephy_shell));
}
@@ -307,6 +297,18 @@ ephy_main_automation_init (void)
}
}
+/* dummy argument to open a default window */
+static gint
+ephy_main_dummy_url_argument (gchar ***urls)
+{
+ *urls = g_new0 (gchar *, 2);
+
+ (*urls)[0] = g_strdup ("");
+ (*urls)[1] = NULL;
+
+ return 1;
+}
+
/**
* translate_url_arguments: gather URL arguments and expand them fully
* with realpath if they're filenames
@@ -321,8 +323,7 @@ ephy_main_translate_url_arguments (poptContext context, gchar ***urls)
/* any context remaining? */
if (context == NULL)
{
- *urls = NULL;
- return 0;
+ return ephy_main_dummy_url_argument (urls);
}
/* get the args and check */
@@ -330,8 +331,7 @@ ephy_main_translate_url_arguments (poptContext context, gchar ***urls)
if (args == NULL)
{
poptFreeContext (context);
- *urls = NULL;
- return 0;
+ return ephy_main_dummy_url_argument (urls);
}
/* count args */
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 0fb93ec20..351660e4b 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -492,22 +492,44 @@ ephy_shell_new_tab (EphyShell *shell,
#ifdef ENABLE_NAUTILUS_VIEW
static void
+ephy_nautilus_view_all_controls_dead (void)
+{
+ if (!bonobo_control_life_get_count ())
+ {
+ g_object_unref (G_OBJECT (ephy_shell));
+ }
+}
+
+static void
ephy_nautilus_view_init_factory (EphyShell *gs)
{
BonoboGenericFactory *ephy_nautilusview_factory;
+
ephy_nautilusview_factory = bonobo_generic_factory_new
(EPHY_NAUTILUS_VIEW_OAFIID,
(BonoboFactoryCallback) ephy_nautilus_view_new, gs);
if (!BONOBO_IS_GENERIC_FACTORY (ephy_nautilusview_factory))
+ {
g_warning ("Couldn't create the factory!");
+ return;
+ }
+ bonobo_control_life_set_callback (ephy_nautilus_view_all_controls_dead);
}
static BonoboObject *
ephy_nautilus_view_new (BonoboGenericFactory *factory, const char *id,
EphyShell *gs)
{
- return ephy_nautilus_view_new_component (gs);
+ EphyNautilusView *view;
+
+ view = EPHY_NAUTILUS_VIEW (
+ ephy_nautilus_view_new_component (gs));
+
+ bonobo_control_life_instrument (
+ nautilus_view_get_bonobo_control (NAUTILUS_VIEW (view)));
+
+ return BONOBO_OBJECT (view);
}
#endif