changeset 8601:cfb11d9a46fd

[gaim-migrate @ 9352] the results of discussions between robot101 and datallah committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 06 Apr 2004 16:27:52 +0000
parents 0349e319e1c0
children 6046b0b6abd0
files src/main.c src/session.c src/ui.h
diffstat 3 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.c	Tue Apr 06 15:38:02 2004 +0000
+++ b/src/main.c	Tue Apr 06 16:27:52 2004 +0000
@@ -604,7 +604,7 @@
 {
 	int opt_acct = 0, opt_help = 0, opt_version = 0, opt_login = 0, opt_nologin = 0, dologin_ret = -1;
 	char *opt_user_arg = NULL, *opt_login_arg = NULL;
-	char *opt_session_arg = NULL;
+	char *opt_session_arg = NULL, *opt_config_dir_arg = NULL;
 	char *plugin_search_paths[3];
 #if HAVE_SIGNAL_H
 	int sig_indx;	/* for setting up signal catching */
@@ -775,6 +775,7 @@
 			break;
 		case 'c':	/* use specified config dir */
 			set_gaim_user_dir(optarg);
+			opt_config_dir_arg = g_strdup(optarg);
 			break;
 		case 's':	/* use existing session ID */
 			opt_session_arg = g_strdup(optarg);
@@ -865,12 +866,17 @@
 	ui_main();
 
 #ifdef USE_SM
-	session_init(argv[0], opt_session_arg);
+	session_init(argv[0], opt_session_arg, opt_config_dir_arg);
 #endif
 	if (opt_session_arg != NULL) {
 		g_free(opt_session_arg);
 		opt_session_arg = NULL;
-	};
+	}
+	
+	if (opt_config_dir_arg != NULL) {
+		g_free(opt_config_dir_arg);
+		opt_config_dir_arg = NULL;
+	}
 
 	/* set the default username */
 	if (opt_user_arg != NULL) {
--- a/src/session.c	Tue Apr 06 15:38:02 2004 +0000
+++ b/src/session.c	Tue Apr 06 16:27:52 2004 +0000
@@ -137,13 +137,13 @@
 
 /* my magic utility function */
 
-static gchar **session_make_command(gchar *client_id) {
+static gchar **session_make_command(gchar *client_id, gchar *config_dir) {
 	gint i = 2;
 	gint j = 0;
 	gchar **ret;
 
 	if (client_id) i += 2;
-	i += 2; /* we will specify gaim's user dir */
+	if (config_dir)	i += 2; /* we will specify gaim's user dir */
 
 	ret = g_new(gchar *, i);
 	ret[j++] = g_strdup(myself);
@@ -153,8 +153,10 @@
 		ret[j++] = g_strdup(client_id);
 	}
 
-	ret[j++] = g_strdup("--config");
-	ret[j++] = g_strdup(gaim_user_dir());
+	if (config_dir) {
+		ret[j++] = g_strdup("--config");
+		ret[j++] = g_strdup(config_dir);
+	}
 
 	ret[j++] = NULL;
 
@@ -274,7 +276,7 @@
 
 /* setup functions */
 
-void session_init(gchar *argv0, gchar *previous_id) {
+void session_init(gchar *argv0, gchar *previous_id, gchar *config_dir) {
 #ifdef USE_SM
 	SmcCallbacks callbacks;
 	gchar *client_id = NULL;
@@ -358,7 +360,7 @@
 	gaim_debug(GAIM_DEBUG_MISC, "Session Management",
 			   "Using %s as command\n", myself);
 
-	cmd = session_make_command(NULL);
+	cmd = session_make_command(NULL, config_dir);
 	session_set_array(session, SmCloneCommand, cmd);
 	g_strfreev(cmd);
 
@@ -371,7 +373,7 @@
 	session_set_array(session, SmDiscardCommand, cmd);
 	g_strfreev(cmd);
 
-	cmd = session_make_command(client_id);
+	cmd = session_make_command(client_id, config_dir);
 	session_set_array(session, SmRestartCommand, cmd);
 	g_strfreev(cmd);
 
--- a/src/ui.h	Tue Apr 06 15:38:02 2004 +0000
+++ b/src/ui.h	Tue Apr 06 16:27:52 2004 +0000
@@ -148,7 +148,7 @@
 extern int find_queue_total_by_name(char *);
 
 /* Functions in session.c */
-extern void session_init(gchar *, gchar *);
+extern void session_init(gchar *, gchar *, gchar *);
 extern void session_end();
 
 /* Functions in themes.c */