Re: [PATCH] enable nautilus to run as a daemon without any window created
- From: Alexander Larsson <alexl redhat com>
- To: JF Ding <jfding gmail com>
- Cc: nautilus-list gnome org
- Subject: Re: [PATCH] enable nautilus to run as a daemon without any window created
- Date: Tue, 21 Apr 2009 09:03:06 +0200
On Tue, 2009-04-21 at 14:55 +0800, JF Ding wrote:
>
>
>
> +
> <key>/schemas/apps/nautilus/preferences/daemon_enable</key>
> +
> <applyto>/apps/nautilus/preferences/daemon_enable</applyto>
>
> +#define
> NAUTILUS_PREFERENCES_DAEMON_ENABLE
> "preferences/daemon_enable"
>
> A better name would be "daemon_mode"
>
> +static gboolean allow_daemon = FALSE;
>
> Same here, call it "daemon_mode".
>
> About the variable names, including gconf key and the two new vars,
> the name does be indicating the usage.
> In fact, in my first design, the name of gconf key is "daemon_mode",
> but I think it is not precise, because the key
> is to indicate whether nautilus can run as a daemon. I rename it to
> "daemon_enable".
> The static global "allow_daemon", the same cause.
> And the stack variable in main(), "daemon_mode" to be sync with
> command line option "--daemon", its meaning
> is whether it run in "daemon mode", which will not created desktop and
> default window.
> I hope this can be explained clearly. Of course I will rename them if
> you cannot agree with the usage of them.
Well, I disagree with all that because I think having the command line
option at all is a bad idea. We should just have a gconf key.
> @@ -139,6 +141,12 @@ nautilus_main_event_loop_quit (gboolean
> explicit)
> while (event_loop_registrants != NULL) {
> gtk_object_destroy
> (event_loop_registrants->data);
> }
> +
> + /* To quit all instances, disable daemon */
> + if (allow_daemon) {
> + allow_daemon = FALSE;
> + eel_gtk_main_quit_all ();
> + }
> }
>
> static void
>
> Only do this if explicit is TRUE. It is always true atm, but
> that may
> change.
>
> These lines is for quit by "--quit" option. If the first instance of
> nautilus run with allow_daemon TRUE,
> and another new nautilus instance send CLOSE message to it, the code
> will reach here, and must reset allow_daemon
> to FALSE and go quit. Maybe it's not so neat here, any suggestion?
I'm well aware of this. I'm talking about the "gboolean explicit"
argument to this function. This is set to TRUE when the user explicitly
requested to quit, for instance when using --quit. If this is not set we
should not quit the daemon.
>
> + { "daemon", '\0', 0, G_OPTION_ARG_NONE,
> &daemon_mode,
> + N_("Start Nautilus as a daemon for media
> automount."), NULL },
>
> I don't understand why you added the command line argument. It
> seems to
> just
>
> --daemon option will suppress any window explicitly. And can run as
> daemon without
> gconf key settings.
This only explains what it does, not why its a good idea or why you
would ever use it instead of a gconf key.
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]