RE: An annoyingly regular 1.0.50 pep talk



Hi

> Or, write a patch.  You have to update the session capplet to set some
> config variable (in the same family as the other config options), and
> change gsm/manager.c to respect this setting.

Dammit! I'd just skimmed my way through the gsm code and identified
manager.c as the file in question when I got your mail telling me that. Doh!
(However, it did mean I learnt how to use LXR - damn fine tool).

I don't have a copy of the session capplet in source form locally atm (and
it's just gone into expensive rate calls herein the UK), but I think I've
patched manager.c correctly (it compiles cleanly, but I'm not running the
CVS gnome here, so I can't test it).
I looked at adding an option like SmFixedCwd to go along with
SmCurrentDirectory, but that would make the setting per app (I think). That
is all well and good, but you hit the problem of potentially having to
set/unset that option for every app that has ever had it's details saved by
the session manager, so I went with a global setting that will either have
all apps start from the cwd of your choice or whatever is in the
~/.gnome/session you are running.

Here is the patch (against a CVS tree updated about 8-9 hours ago) for
gnome-core/gsm/manager.c:
__________________________________

--- gsm.orig/manager.c	Fri Sep 17 09:07:00 1999
+++ gsm/manager.c	Fri Sep 17 09:35:55 1999
@@ -260,12 +260,17 @@
 run_command (Client* client, const gchar* command)
 {
   int argc, envc, envpc, pid = -1;
-  char **argv, *dir, **envv, **envp, *restart_info;
+  gboolean def = 0;
+  char **argv, *dir = NULL, **envv, **envp, *restart_info;

   if (find_vector_property (client, command, &argc, &argv))
     {
-      if (!find_string_property (client, SmCurrentDirectory, &dir))
-	dir = NULL;
+      dir =
gnome_config_get_string_with_default("/session-options/Options/FixedCwd=",
&def);
+      if (def)
+        {
+          if(dir) g_free(dir); /* Is this needed? */
+          find_string_property (client, SmCurrentDirectory, &dir);
+        }

       if (find_vector_property (client, SmEnvironment, &envc, &envv)
 	  && envc > 0
__________________________________

It stores the variable as "FixedCwd" in the session-options file that should
already exist (it has a couple of Options already in it that are session
management related, so it seemed like as good a place as any to put it).

All the someone needs to do is put an extra option in the session capplet
that will set or unset this variable to either the user's home dir or
another dir of their choice. If no-one else wants to do it, I'll grab the
capplet later on and modify that too, then you can blame only me for it
sucking ;)

Phew!

---
 _____ _         _       _____
| __  | |___ ___| |_ ___|   __|_ _ ___        Chris "Ng" Jones
| __ -| | .'|  _| '_|___|__   | | |   |  chris@black-sun.co.uk
|_____|_|__,|___|_,_|   |_____|___|_|_|    www.black-sun.co.uk
            S o f t w a r e

 "Linux is beating Windows" - David Cole, Microsoft Executive



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]