Galeon 1.2.7 patch replacing --server with --resident
Jean-Yves Lefort <[email protected]>
| Newsgroups | gmane.comp.web.galeon.devel |
|---|---|
| Message-ID | <[email protected]> |
(unnamed)
(text/plain, 1010 B)
Hi, The problem is that the actual server mode isn't convenient to use: galeon --server can be called only once, to start the server. So one can't have a wm menuitem or keybinding saying "open a new Galeon window and leave the app running even if we close the last window" unless he puts "galeon --server &" in his .xinitrc, or kludge a hazardous shell wrapper. Also, the quit menuitem doesn't terminate the the running shell: "galeon --quit" has to be used. The attached patch addresses the issue in an elegant way by replacing the --server option with an option named --resident. It will open a new Galeon shell and window normally, and will not quit the former unless the quit menuitem is selected, or "galeon --quit" is given. Further invocations of "galeon --resident" will use the existing shell to open a new window, by the way. Apply the patch to Galeon 1.2.7; feel free to do whatever you want of it. Greetings, Jean-Yves Lefort -- Jean-Yves Lefort [email protected] http://lefort.be.eu.org/
galeon-1.2.7-resident2.diff
(text/plain, 9.3 KB)
--- src/mozilla/ProgressListener2.cpp.orig Tue Jan 7 10:50:32 2003
+++ src/mozilla/ProgressListener2.cpp Tue Jan 7 10:51:15 2003
8 no more windows left, exit galeon */
if (g_list_length (all_windows) == 0 &&
- !galeon_server_mode && window_count == 0)
+ !galeon_resident_mode && window_count == 0)
{
galeon_exit (TRUE, TRUE);
}
--- src/session.c.orig Sun Jan 5 23:52:26 2003
+++ src/session.c Tue Jan 7 11:01:35 2003
@@ -76,7 +76,6 @@
static xmlDocPtr session_load (const gchar *filename);
static void session_resume (xmlDocPtr doc, gboolean use_bookmarks);
static void session_close_all_windows (void);
-static gint session_server_timeout_cb (gpointer data);
/** The global list of all GaleonWindow structures */
GList *all_windows = NULL;
@@ -571,8 +570,8 @@
window_count--;
/* quit if this was the last window to go and
- * we're not in server mode */
- if (all_embeds == NULL && !galeon_server_mode
+ * we're not in resident mode */
+ if (all_embeds == NULL && !galeon_resident_mode
&& window_count ==0)
{
galeon_exit (TRUE, TRUE);
@@ -609,9 +608,14 @@
if (all_windows != NULL)
{
- /* close all windows, this should quit */
+ /* close all windows, this will quit if !galeon_resident_mode */
session_close_all_windows ();
}
+
+ /* if we are in resident mode, session_close_all_windows() didn't
+ quit galeon, let's do it here */
+ if (galeon_resident_mode)
+ galeon_exit(TRUE, TRUE);
}
static void
@@ -695,19 +699,19 @@
if (session != NULL)
{
- gboolean old_server_mode;
- /* Switch to serveer mode to avoid exiting from galeon
+ gboolean old_resident_mode;
+ /* Switch to resident mode to avoid exiting from galeon
* when all windows are closed. This is a bit hacky...
*/
- old_server_mode = galeon_server_mode;
- galeon_server_mode = TRUE;
+ old_resident_mode = galeon_resident_mode;
+ galeon_resident_mode = TRUE;
/* close all windows */
session_close_all_windows ();
/* reopen windows... */
session_resume (session, FALSE);
xmlFreeDoc (session);
- /* restore server mode */
- galeon_server_mode = old_server_mode;
+ /* restore resident mode */
+ galeon_resident_mode = old_resident_mode;
return TRUE;
}
51val;
-}
-
-void
-session_server_start_timeout ()
-{
- if (quit_timeout_id > 0)
- session_server_stop_timeout ();
- if (all_embeds != NULL)
- return;
- if (galeon_server_timeout == 0)
- return;
-
- if (galeon_server_timeout < 10)
- /* I don't wnat strange races when closing an embed */
- galeon_server_timeout = 10;
-
- quit_timeout_id = gtk_timeout_add
- (galeon_server_timeout * 1000,
- session_server_timeout_cb,
- NULL);
-}
-
-void
-session_server_stop_timeout ()
-{
- if (quit_timeout_id == 0)
- return;
-
- gtk_timeout_remove (quit_timeout_id);
- quit_timeout_id = 0;
-}
-
-static gint
-session_server_timeout_cb (gpointer data)
-{
- if (all_embeds != NULL
- || window_count != 0)
- return FALSE;
-
- galeon_server_mode = FALSE;
-
- session_quit (FALSE);
- galeon_exit (TRUE, TRUE);
-
- /* not really important what we return here */
- return FALSE;
}
--- src/embed.c.orig Tue Jan 7 10:47:29 2003
+++ src/embed.c Tue Jan 7 10:47:48 2003
10l list of all embeds */
all_embeds = g_list_prepend (all_embeds, embed);
- /* don't quit, we have an embed */
- session_server_stop_timeout ();
-
/* no content for the location or title */
embed->location = NULL;
embed->parent_window = NULL;
--- src/main.c.orig Sun Jan 5 23:53:22 2003
+++ src/main.c Tue Jan 7 11:06:45 2003
@@ -84,8 +84,7 @@
void client_die_cb (GnomeClient *client, gpointer data);
/* global variables */
-gboolean galeon_server_mode = FALSE;
-gint galeon_server_timeout = -1;
+gboolean galeon_resident_mode = FALSE;
gboolean galeon_panel_mode = FALSE;
gboolean galeon_exiting = FALSE;
@@ -140,14 +139,9 @@
N_("Open as a panel applet"),
NULL },
#endif
- { "server", 's', POPT_ARG_NONE, &galeon_server_mode, 0,
- N_("Don't open any windows; instead act as a server "
- "for quick startup of new Galeon instances"),
+ { "resident", 'r', POPT_ARG_NONE, &galeon_resident_mode, 0,
+ N_("Don't exit Galeon when the last window is closed"),
NULL },
- { "server-timeout", 'e', POPT_ARG_INT, &galeon_server_timeout, 0,
- N_("Time of inactivity (in seconds) until the server "
- "shuts down itself. Defaults to one hour, use 0 to disable."),
- N_("TIME") },
{ "add-bookmark", 't', POPT_ARG_STRING, &bookmark_url,
0, N_("Add a bookmark (don't open any window)"),
N_("URL")},
@@ -159,7 +153,7 @@
N_("Close all Galeon windows"),
NULL },
{ "quit", 'q', POPT_ARG_NONE, &quit_option, 0,
- N_("Same as --close, but exits server mode too"),
+ N_("Same as --close, but exits Galeon too"),
NULL },
/* terminator, must be last */
@@ -220,20 +214,6 @@
, 0, &context);
}
- if (galeon_panel_mode && galeon_server_mode)
- {
- galeon_server_mode = FALSE;
- g_message (_("Panel mode. "
- "Ignoring server mode option."));
- }
-
- /* set the server timeout to an hour by default if the option
- * was not present */
- if (galeon_server_timeout < 0)
- {
- galeon_server_timeout = 1 * 60 * 60;
- }
-
/* load arguments that aren't regular options (urls to load) */
n_urls = translate_url_arguments (context, &url);
@@ -244,7 +224,7 @@
#endif
/* check if galeon is already running and use that instead */
- if (!galeon_panel_mode && !galeon_server_mode)
+ if (!galeon_panel_mode)
{
if (new_view_on_running_shell (n_urls, url))
{
@@ -317,17 +297,11 @@
g_strfreev (url);
/* check if browser exists, or create default one */
- if (!no_default && !galeon_server_mode && !galeon_panel_mode)
+ if (!no_default && !galeon_panel_mode)
{
create_default_browser ();
}
- /* start quit timeout if no window has been opened */
- if (galeon_server_mode && (all_embeds == NULL))
- {
- session_server_start_timeout ();
- }
-
/* start main loop */
#ifdef ENABLE_APPLET
if (galeon_panel_mode)
@@ -580,7 +554,7 @@
static gboolean
galeon_init (int argc, char *argv[])
{
- static gchar *restart_argv[] = { "galeon", "--server", "--server-timeout", "0", NULL };
+ static gchar *restart_argv[] = { "galeon", "--resident", NULL };
GnomeClient *session_client;
gboolean session_recovery;
gboolean vfs_success;
11sion-manager callbacks */
session_client = gnome_master_client ();
- gnome_client_set_restart_command
- (session_client, galeon_server_mode ? ( (galeon_server_timeout == 0) ? 4 : 2 ) : 1, restart_argv);
+ gnome_client_set_restart_command (session_client, 1, restart_argv);
gnome_client_set_restart_style (GNOME_CLIENT (session_client),
- (galeon_server_mode && (galeon_server_timeout == 0)) ?
+ galeon_resident_mode ?
GNOME_RESTART_IMMEDIATELY :
GNOME_RESTART_IF_RUNNING);
gtk_signal_connect (GTK_OBJECT (session_client), "save_yourself",
--- src/galeon.h.orig Sun Jan 5 23:57:19 2003
+++ src/galeon.h Tue Jan 7 10:33:16 2003
12 *charsets;
extern GList *sorted_charset_titles;
-/* are we in server mode? */
-extern gboolean galeon_server_mode;
-
-/* server mode timeout */
-extern gint galeon_server_timeout;
+/* are we in resident mode? */
+extern gboolean galeon_resident_mode;
/* are we in panel mode? */
extern gboolean galeon_panel_mode;
--- src/session.h.orig Tue Jan 7 10:36:01 2003
+++ src/session.h Tue Jan 7 10:36:11 2003
6istory_add (const gchar *filename);
void session_history_remove (const gchar *filename);
gboolean session_open_confirmation (void);
-void session_server_start_timeout (void);
-void session_server_stop_timeout (void);
--- src/window_callbacks.c.orig Tue Jan 7 10:36:37 2003
+++ src/window_callbacks.c Tue Jan 7 10:37:10 2003
8*/
if (g_list_length (all_windows) == 1 &&
- !galeon_server_mode && !galeon_panel_mode)
+ !galeon_resident_mode && !galeon_panel_mode)
{
/* exit the session */
session_quit (FALSE);
--- src/Galeon-impl.c.orig Tue Jan 7 10:41:15 2003
+++ src/Galeon-impl.c Tue Jan 7 10:42:00 2003
@@ -303,7 +303,7 @@
static CORBA_boolean
impl_Galeon_Browser_quit (impl_POA_Galeon_Browser * servant,
- CORBA_boolean disableServer, CORBA_Environment * ev)
+ CORBA_boolean disableResident, CORBA_Environment * ev)
{
CORBA_boolean retval = TRUE;
GList *l;
16 when we are already exiting */
if (galeon_exiting) return FALSE;
- if (disableServer == TRUE)
+ if (disableResident == TRUE)
{
- galeon_server_mode = FALSE;
+ galeon_resident_mode = FALSE;
}
if (all_windows == NULL)
{
/* make sure that we quit */
- if (!galeon_server_mode)
+ if (!galeon_resident_mode)
{
session_quit (FALSE);
galeon_exit (TRUE, TRUE);
--- src/GaleonAutomation.idl.orig Tue Jan 7 10:41:34 2003
+++ src/GaleonAutomation.idl Tue Jan 7 10:41:37 2003
11mpBookmark (in string url);
/**
- * Closes all opened windows. if disableServer is true,
- * server mode is disbaled (and Galeon exits)
+ * Closes all opened windows. if disableResident is true,
+ * resident mode is disabled (and Galeon exits)
*/
- boolean quit (in boolean disableServer);
+ boolean quit (in boolean disableResident);
boolean loadSession (in string filename);
};
--- src/mozcallbacks.c.orig Tue Jan 7 10:49:13 2003
+++ src/mozcallbacks.c Tue Jan 7 10:49:37 2003
@@ -1304,10 +1304,6 @@
memset (embed, 0, sizeof (GaleonEmbed));
g_free (embed);
embed = NULL;
-
- /* start the quit timeout */
- if (all_embeds == NULL)
- session_server_start_timeout ();
}
/**
signature.asc
(application/pgp-signature, 187 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+KvU7yzD7UaO4AGoRAvrJAJ46RI6ts7SGv5C+HV3I0ZhboDQqZgCeIxAo BH+Jv+8dicJX2Xk0IpDmSZA= =mVWS -----END PGP SIGNATURE-----