Mercurial > pidgin
comparison src/session.c @ 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 | 56360561af5e |
| children | 50224ac8184d |
comparison
equal
deleted
inserted
replaced
| 8600:0349e319e1c0 | 8601:cfb11d9a46fd |
|---|---|
| 135 "ICE initialized.\n"); | 135 "ICE initialized.\n"); |
| 136 } | 136 } |
| 137 | 137 |
| 138 /* my magic utility function */ | 138 /* my magic utility function */ |
| 139 | 139 |
| 140 static gchar **session_make_command(gchar *client_id) { | 140 static gchar **session_make_command(gchar *client_id, gchar *config_dir) { |
| 141 gint i = 2; | 141 gint i = 2; |
| 142 gint j = 0; | 142 gint j = 0; |
| 143 gchar **ret; | 143 gchar **ret; |
| 144 | 144 |
| 145 if (client_id) i += 2; | 145 if (client_id) i += 2; |
| 146 i += 2; /* we will specify gaim's user dir */ | 146 if (config_dir) i += 2; /* we will specify gaim's user dir */ |
| 147 | 147 |
| 148 ret = g_new(gchar *, i); | 148 ret = g_new(gchar *, i); |
| 149 ret[j++] = g_strdup(myself); | 149 ret[j++] = g_strdup(myself); |
| 150 | 150 |
| 151 if (client_id) { | 151 if (client_id) { |
| 152 ret[j++] = g_strdup("--session"); | 152 ret[j++] = g_strdup("--session"); |
| 153 ret[j++] = g_strdup(client_id); | 153 ret[j++] = g_strdup(client_id); |
| 154 } | 154 } |
| 155 | 155 |
| 156 ret[j++] = g_strdup("--config"); | 156 if (config_dir) { |
| 157 ret[j++] = g_strdup(gaim_user_dir()); | 157 ret[j++] = g_strdup("--config"); |
| 158 ret[j++] = g_strdup(config_dir); | |
| 159 } | |
| 158 | 160 |
| 159 ret[j++] = NULL; | 161 ret[j++] = NULL; |
| 160 | 162 |
| 161 return ret; | 163 return ret; |
| 162 } | 164 } |
| 272 | 274 |
| 273 #endif /* USE_SM */ | 275 #endif /* USE_SM */ |
| 274 | 276 |
| 275 /* setup functions */ | 277 /* setup functions */ |
| 276 | 278 |
| 277 void session_init(gchar *argv0, gchar *previous_id) { | 279 void session_init(gchar *argv0, gchar *previous_id, gchar *config_dir) { |
| 278 #ifdef USE_SM | 280 #ifdef USE_SM |
| 279 SmcCallbacks callbacks; | 281 SmcCallbacks callbacks; |
| 280 gchar *client_id = NULL; | 282 gchar *client_id = NULL; |
| 281 gchar error[ERROR_LENGTH] = ""; | 283 gchar error[ERROR_LENGTH] = ""; |
| 282 gchar *tmp = NULL; | 284 gchar *tmp = NULL; |
| 356 | 358 |
| 357 myself = g_strdup(argv0); | 359 myself = g_strdup(argv0); |
| 358 gaim_debug(GAIM_DEBUG_MISC, "Session Management", | 360 gaim_debug(GAIM_DEBUG_MISC, "Session Management", |
| 359 "Using %s as command\n", myself); | 361 "Using %s as command\n", myself); |
| 360 | 362 |
| 361 cmd = session_make_command(NULL); | 363 cmd = session_make_command(NULL, config_dir); |
| 362 session_set_array(session, SmCloneCommand, cmd); | 364 session_set_array(session, SmCloneCommand, cmd); |
| 363 g_strfreev(cmd); | 365 g_strfreev(cmd); |
| 364 | 366 |
| 365 /* this is currently useless, but gnome-session warns 'the following applications will not | 367 /* this is currently useless, but gnome-session warns 'the following applications will not |
| 366 save their current status' bla bla if we don't have it and the user checks 'Save Session' | 368 save their current status' bla bla if we don't have it and the user checks 'Save Session' |
| 369 cmd[0] = g_strdup("/bin/true"); | 371 cmd[0] = g_strdup("/bin/true"); |
| 370 cmd[1] = NULL; | 372 cmd[1] = NULL; |
| 371 session_set_array(session, SmDiscardCommand, cmd); | 373 session_set_array(session, SmDiscardCommand, cmd); |
| 372 g_strfreev(cmd); | 374 g_strfreev(cmd); |
| 373 | 375 |
| 374 cmd = session_make_command(client_id); | 376 cmd = session_make_command(client_id, config_dir); |
| 375 session_set_array(session, SmRestartCommand, cmd); | 377 session_set_array(session, SmRestartCommand, cmd); |
| 376 g_strfreev(cmd); | 378 g_strfreev(cmd); |
| 377 | 379 |
| 378 g_free(client_id); | 380 g_free(client_id); |
| 379 #endif /* USE_SM */ | 381 #endif /* USE_SM */ |
