Commit 480d2b63 authored by Robey Pointer's avatar Robey Pointer
Browse files

add corba 'restart' call to the IDL, and match it with command-line option...

add corba 'restart' call to the IDL, and match it with command-line option '--restart'; on restart, nautilus goes through all the exit code, then does an exec() on itself instead of exit()
parent 360710bc
2000-08-25 Robey Pointer <robey@eazel.com>
* src/nautilus-application.c: (nautilus_application_startup):
* src/nautilus-application.h:
* src/nautilus-first-time-druid.c: (druid_finished):
* src/nautilus-main.c: (main):
* src/nautilus-shell-interface.idl:
* src/nautilus-shell.c: (nautilus_shell_get_epv), (corba_quit),
(corba_restart):
Add corba 'restart' call to the IDL, and match it with
command-line option '--restart'. On restart, Nautilus goes
through all the exit code, then does an exec() on itself instead
of exit().
2000-08-25 John Sullivan <sullivan@eazel.com>
Fixed bug 1782 (File->Open after opening a folder crashes)
......
......@@ -292,6 +292,7 @@ nautilus_make_uri_list_from_strv (const char * const *strv)
gboolean
nautilus_application_startup (NautilusApplication *application,
gboolean kill_shell,
gboolean restart_shell,
gboolean stop_desktop,
gboolean start_desktop,
const char *urls[])
......@@ -411,6 +412,8 @@ nautilus_application_startup (NautilusApplication *application,
if (kill_shell) {
Nautilus_Shell_quit (shell, &ev);
} else if (restart_shell) {
Nautilus_Shell_restart (shell, &ev);
} else {
if (start_desktop) {
Nautilus_Shell_start_desktop (shell, &ev);
......
......@@ -56,6 +56,7 @@ GtkType nautilus_application_get_type (void);
NautilusApplication *nautilus_application_new (void);
gboolean nautilus_application_startup (NautilusApplication *application,
gboolean kill_shell,
gboolean restart_shell,
gboolean stop_desktop,
gboolean start_desktop,
const char *urls[]);
......
......@@ -139,7 +139,7 @@ druid_finished (GtkWidget *druid_page)
signup_uris[0] = NULL;
break;
}
nautilus_application_startup(save_application, FALSE, save_manage_desktop,
nautilus_application_startup(save_application, FALSE, FALSE, save_manage_desktop,
FALSE, (signup_uris[0] != NULL) ? &signup_uris[0] : NULL);
}
......
......@@ -48,6 +48,7 @@ int
main (int argc, char *argv[])
{
gboolean kill_shell;
gboolean restart_shell;
gboolean stop_desktop;
gboolean start_desktop;
gboolean perform_self_check;
......@@ -63,6 +64,7 @@ main (int argc, char *argv[])
{ "check", '\0', POPT_ARG_NONE, &perform_self_check, 0, N_("Perform high-speed self-check tests."), NULL },
#endif
{ "quit", '\0', POPT_ARG_NONE, &kill_shell, 0, N_("Quit Nautilus."), NULL },
{ "restart", '\0', POPT_ARG_NONE, &restart_shell, 0, N_("Restart Nautilus."), NULL },
{ "stop-desktop", '\0', POPT_ARG_NONE, &stop_desktop, 0, N_("Don't draw background and icons on desktop."), NULL },
{ "start-desktop", '\0', POPT_ARG_NONE, &start_desktop, 0, N_("Draw background and icons on desktop."), NULL },
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, &oaf_popt_options, 0, NULL, NULL },
......@@ -86,6 +88,7 @@ main (int argc, char *argv[])
/* Initialize the services that we use. */
kill_shell = FALSE;
restart_shell = FALSE;
stop_desktop = FALSE;
start_desktop = FALSE;
perform_self_check = FALSE;
......@@ -115,14 +118,19 @@ main (int argc, char *argv[])
if (kill_shell && args != NULL) {
fprintf(stderr, _("nautilus: --quit cannot be used with URIs.\n"));
} else if (restart_shell && args != NULL) {
fprintf(stderr, _("nautilus: --restart cannot be used with URIs.\n"));
} else if (kill_shell && start_desktop) {
fprintf(stderr, _("nautiluls: --quit and --start-desktop cannot be used together.\n"));
fprintf(stderr, _("nautilus: --quit and --start-desktop cannot be used together.\n"));
} else if (restart_shell && start_desktop) {
fprintf(stderr, _("nautilus: --restart and --start-desktop cannot be used together.\n"));
} else if (stop_desktop && start_desktop) {
fprintf(stderr, _("nautiluls: --stop-desktop and --start-desktop cannot be used together.\n"));
} else {
application = nautilus_application_new ();
if (nautilus_application_startup (application,
kill_shell,
restart_shell,
stop_desktop,
start_desktop,
args)) {
......@@ -133,8 +141,23 @@ main (int argc, char *argv[])
poptFreeContext(popt_context);
}
gnome_vfs_shutdown ();
/* if told to restart, exec() myself again */
if (getenv ("_NAUTILUS_RESTART")) {
char *my_path = argv[0];
char **argv_copy;
int i;
unsetenv ("_NAUTILUS_RESTART");
argv_copy = g_new0 (char *, argc+1);
for (i = 0; i < argc; i++) {
argv_copy[i] = argv[i];
}
argv_copy[argc] = NULL;
execvp(my_path, argv_copy);
}
return EXIT_SUCCESS;
}
......@@ -14,6 +14,7 @@ module Nautilus {
oneway void start_desktop ();
oneway void stop_desktop ();
oneway void quit ();
oneway void restart ();
};
};
......
......@@ -26,6 +26,7 @@
*/
#include <config.h>
#include <stdlib.h>
#include "nautilus-shell.h"
/* FIXME: This is a workaround for ORBit bug where including idl files
......@@ -63,6 +64,8 @@ static void corba_stop_desktop (PortableServer_Servant servant,
CORBA_Environment *ev);
static void corba_quit (PortableServer_Servant servant,
CORBA_Environment *ev);
static void corba_restart (PortableServer_Servant servant,
CORBA_Environment *ev);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusShell, nautilus_shell, BONOBO_OBJECT_TYPE)
......@@ -81,6 +84,7 @@ nautilus_shell_get_epv (void)
epv.start_desktop = corba_start_desktop;
epv.stop_desktop = corba_stop_desktop;
epv.quit = corba_quit;
epv.restart = corba_restart;
return &epv;
}
......@@ -296,3 +300,13 @@ corba_quit (PortableServer_Servant servant,
gtk_main_quit ();
}
}
static void
corba_restart (PortableServer_Servant servant,
CORBA_Environment *ev)
{
if (gtk_main_level () > 0) {
gtk_main_quit ();
}
setenv ("_NAUTILUS_RESTART", "yes", 1);
}
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