Revision: 5042
http://geany.svn.sourceforge.net/geany/?rev=5042&view=rev
Author: statc
Date: 2010-06-17 14:55:33 +0000 (Thu, 17 Jun 2010)
Log Message:
-----------
Use g_strdup() when storing a string command-line value in a global structure.
This will prevent modification and deallocation of original value, needed by SM implementation.
Modified Paths:
--------------
branches/sm/src/main.c
Modified: branches/sm/src/main.c
===================================================================
--- branches/sm/src/main.c 2010-06-17 14:55:15 UTC (rev 5041)
+++ branches/sm/src/main.c 2010-06-17 14:55:33 UTC (rev 5042)
@@ -583,7 +583,7 @@
if (alternate_config)
{
geany_debug("alternate config: %s", alternate_config);
- app->configdir = alternate_config;
+ app->configdir = g_strdup(alternate_config);
}
else
{
@@ -613,12 +613,12 @@
socket_info.ignore_socket = cl_options.new_instance;
if (cl_options.socket_filename)
{
- socket_info.file_name = cl_options.socket_filename;
+ socket_info.file_name = g_strdup(cl_options.socket_filename);
}
#endif
#ifdef HAVE_VTE
- vte_info.lib_vte = lib_vte;
+ vte_info.lib_vte = g_strdup(lib_vte);
#endif
cl_options.ignore_global_tags = ignore_global_tags;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5040
http://geany.svn.sourceforge.net/geany/?rev=5040&view=rev
Author: statc
Date: 2010-06-17 14:54:46 +0000 (Thu, 17 Jun 2010)
Log Message:
-----------
Update for previous revision: do not load filenames from session files when they are not needed
Modified Paths:
--------------
branches/sm/src/main.c
branches/sm/src/main.h
branches/sm/src/project.c
branches/sm/src/project.h
Modified: branches/sm/src/main.c
===================================================================
--- branches/sm/src/main.c 2010-06-17 14:54:23 UTC (rev 5039)
+++ branches/sm/src/main.c 2010-06-17 14:54:46 UTC (rev 5040)
@@ -856,7 +856,7 @@
}
-static void load_session_project_file(void)
+static void load_session_project_file(gboolean load_filenames)
{
gchar *locale_filename;
@@ -865,7 +865,7 @@
locale_filename = utils_get_locale_from_utf8(project_prefs.session_file);
if (NZV(locale_filename))
- project_load_file(locale_filename);
+ project_load_file(locale_filename, load_filenames);
g_free(locale_filename);
g_free(project_prefs.session_file); /* no longer needed */
@@ -888,7 +888,7 @@
}
-void main_load_project_from_command_line(const gchar *locale_filename, gboolean use_session)
+void main_load_project_from_command_line(const gchar *locale_filename, gboolean load_files)
{
gchar *pfile = NULL;
@@ -899,10 +899,10 @@
if (pfile != NULL)
{
- if (use_session)
+ if (load_files)
project_load_file_with_session(pfile);
else
- project_load_file(pfile);
+ project_load_file(pfile, FALSE);
}
g_free(pfile);
@@ -920,16 +920,18 @@
if (cl_options.project)
{
- /* when being restored by session manager, do not open file names from project session file,
- * because required file names are passed via command-line and handled by open_cl_files() */
+ /* Do not load project session files if we are being restored by session manager:
+ * corresponding file names are passed via command-line and will be handled by open_cl_files() */
main_load_project_from_command_line(cl_options.project, !restoring);
load_default_session = FALSE;
}
if (load_default_session)
{
- /* load filenames from the default session into global session_files variable */
- load_session_project_file();
+ /* Load project session file (if any) writing its filenames into global session_files variable.
+ * Don't load filenames when being restored by session manager: in that case file names are
+ * passed via command line and will be opened by open_cl_files() */
+ load_session_project_file(!restoring);
/* load files into tabs, as they are found in the session_files variable */
if (!restoring)
configuration_open_files();
Modified: branches/sm/src/main.h
===================================================================
--- branches/sm/src/main.h 2010-06-17 14:54:23 UTC (rev 5039)
+++ branches/sm/src/main.h 2010-06-17 14:54:46 UTC (rev 5040)
@@ -84,6 +84,6 @@
gboolean main_is_realized(void);
-void main_load_project_from_command_line(const gchar *locale_filename, gboolean use_session);
+void main_load_project_from_command_line(const gchar *locale_filename, gboolean load_files);
#endif
Modified: branches/sm/src/project.c
===================================================================
--- branches/sm/src/project.c 2010-06-17 14:54:23 UTC (rev 5039)
+++ branches/sm/src/project.c 2010-06-17 14:54:46 UTC (rev 5040)
@@ -81,7 +81,7 @@
static gboolean update_config(const PropertyDialogElements *e);
static void on_file_save_button_clicked(GtkButton *button, PropertyDialogElements *e);
-static gboolean load_config(const gchar *filename);
+static gboolean load_config(const gchar *filename, gboolean load_filenames);
static gboolean write_config(gboolean emit_signal, GeanyProjectSettingsTypes flags);
static void on_name_entry_changed(GtkEditable *editable, PropertyDialogElements *e);
static void on_entries_changed(GtkEditable *editable, PropertyDialogElements *e);
@@ -201,7 +201,7 @@
gboolean project_load_file_with_session(const gchar *locale_file_name)
{
- if (project_load_file(locale_file_name))
+ if (project_load_file(locale_file_name, TRUE))
{
if (project_prefs.project_session)
{
@@ -949,11 +949,11 @@
}
-gboolean project_load_file(const gchar *locale_file_name)
+gboolean project_load_file(const gchar *locale_file_name, gboolean load_filenames)
{
g_return_val_if_fail(locale_file_name != NULL, FALSE);
- if (load_config(locale_file_name))
+ if (load_config(locale_file_name, load_filenames))
{
ui_set_statusbar(TRUE, _("Project \"%s\" opened."), app->project->name);
ui_add_recent_project_file(app->project->file_name);
@@ -974,7 +974,7 @@
* At this point there should not be an already opened project in Geany otherwise it will just
* return.
* The filename is expected in the locale encoding. */
-static gboolean load_config(const gchar *filename)
+static gboolean load_config(const gchar *filename, gboolean load_filenames)
{
GKeyFile *config;
GeanyProject *p;
@@ -1014,8 +1014,12 @@
configuration_save_default_session();
/* now close all open files */
document_close_all(FALSE);
- /* read session files so they can be opened with configuration_open_files() */
- configuration_load_session_files(config, FALSE);
+
+ if (load_filenames)
+ {
+ /* read session files so they can be opened with configuration_open_files() */
+ configuration_load_session_files(config, FALSE);
+ }
}
g_signal_emit_by_name(geany_object, "project-open", config);
g_key_file_free(config);
Modified: branches/sm/src/project.h
===================================================================
--- branches/sm/src/project.h 2010-06-17 14:54:23 UTC (rev 5039)
+++ branches/sm/src/project.h 2010-06-17 14:54:46 UTC (rev 5040)
@@ -87,7 +87,7 @@
gboolean project_ask_close(void);
-gboolean project_load_file(const gchar *locale_file_name);
+gboolean project_load_file(const gchar *locale_file_name, gboolean load_filenames);
gboolean project_load_file_with_session(const gchar *locale_file_name);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5037
http://geany.svn.sourceforge.net/geany/?rev=5037&view=rev
Author: statc
Date: 2010-06-17 14:53:39 +0000 (Thu, 17 Jun 2010)
Log Message:
-----------
Slight code improvement: do not open geany.conf in configuration_save_default_session() if nothing is to be written
Modified Paths:
--------------
branches/sm/src/keyfile.c
branches/sm/src/project.c
Modified: branches/sm/src/keyfile.c
===================================================================
--- branches/sm/src/keyfile.c 2010-06-17 14:53:18 UTC (rev 5036)
+++ branches/sm/src/keyfile.c 2010-06-17 14:53:39 UTC (rev 5037)
@@ -924,15 +924,17 @@
*/
void configuration_save_default_session(void)
{
- GKeyFile *config;
- gchar *configfile;
- open_config(&config, &configfile);
+ if (cl_options.load_session)
+ {
+ GKeyFile *config;
+ gchar *configfile;
+ open_config(&config, &configfile);
- if (cl_options.load_session)
configuration_save_session_files(config);
- write_config(config, configfile);
- close_config(config, configfile);
+ write_config(config, configfile);
+ close_config(config, configfile);
+ }
}
Modified: branches/sm/src/project.c
===================================================================
--- branches/sm/src/project.c 2010-06-17 14:53:18 UTC (rev 5036)
+++ branches/sm/src/project.c 2010-06-17 14:53:39 UTC (rev 5037)
@@ -1011,8 +1011,7 @@
if (project_prefs.project_session)
{
/* save current (non-project) session (it could has been changed since program startup) */
- if (!cl_options.new_instance)
- configuration_save_default_session();
+ configuration_save_default_session();
/* now close all open files */
document_close_all(FALSE);
/* read session files so they can be opened with configuration_open_files() */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.