Revision: 785 http://svn.sourceforge.net/geany/?rev=785&view=rev Author: ntrel Date: 2006-09-03 12:19:56 -0700 (Sun, 03 Sep 2006)
Log Message: ----------- Open a new instance without loading session files if socket already exists and no filenames are specified on the command-line
Modified Paths: -------------- trunk/ChangeLog trunk/src/main.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-09-03 13:30:12 UTC (rev 784) +++ trunk/ChangeLog 2006-09-03 19:19:56 UTC (rev 785) @@ -1,3 +1,10 @@ +2006-09-03 Nick Treleaven nick.treleaven@btinternet.com + + * src/main.c: Open a new instance without loading session files if + socket already exists and no filenames are specified + on the command-line. + + 2006-09-03 Enrico Tröger enrico.troeger@uvena.de
* src/utils.c: Save All button is also active when only one file is
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2006-09-03 13:30:12 UTC (rev 784) +++ trunk/src/main.c 2006-09-03 19:19:56 UTC (rev 785) @@ -96,6 +96,7 @@ #endif
static gboolean debug_mode = FALSE; +static gboolean load_session = TRUE; static gboolean ignore_global_tags = FALSE; static gboolean no_msgwin = FALSE; static gboolean show_version = FALSE; @@ -508,14 +509,20 @@ socket_info.lock_socket = socket_init(argc, argv); if (socket_info.lock_socket < 0) { - g_free(app->configdir); - g_free(app->datadir); - g_free(app->docdir); - g_free(app); - return 0; + // Socket exists + if (argc > 1) // filenames were sent to first instance, so quit + { + g_free(app->configdir); + g_free(app->datadir); + g_free(app->docdir); + g_free(app); + return 0; + } + // Start a new instance if no command line strings were passed + socket_info.ignore_socket = TRUE; + load_session = FALSE; } } - #endif
gtk_init(&argc, &argv); @@ -603,7 +610,7 @@ } } } - else if (app->pref_main_load_session) + else if (app->pref_main_load_session && load_session) { if (! configuration_open_files()) { @@ -702,13 +709,13 @@ #endif
// remote command mode, here we have another running instance and want to use it - geany_debug("using running instance of Geany"); - if (argc > 1) { gint i; gchar *filename;
+ geany_debug("using running instance of Geany"); + socket_fd_write_all(sock, "open\n", 5);
for(i = 1; i < argc && argv[i] != NULL; i++) @@ -956,13 +963,12 @@ else geany_debug("got data from socket, but it does not look like a filename"); } + gtk_window_deiconify(GTK_WINDOW(app->window)); + gtk_window_present(GTK_WINDOW(app->window)); }
socket_fd_close(sock);
- gtk_window_deiconify(GTK_WINDOW(app->window)); - gtk_window_present(GTK_WINDOW(app->window)); - return TRUE; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.