Revision: 2542 http://geany.svn.sourceforge.net/geany/?rev=2542&view=rev Author: ntrel Date: 2008-04-29 05:00:13 -0700 (Tue, 29 Apr 2008)
Log Message: ----------- Refactor get_session_file_string() from configuration_save_session_files().
Modified Paths: -------------- branches/custom-filetypes/ChangeLog branches/custom-filetypes/src/keyfile.c
Modified: branches/custom-filetypes/ChangeLog =================================================================== --- branches/custom-filetypes/ChangeLog 2008-04-29 11:30:19 UTC (rev 2541) +++ branches/custom-filetypes/ChangeLog 2008-04-29 12:00:13 UTC (rev 2542) @@ -2,6 +2,9 @@
* src/keyfile.c, src/keyfile.h, src/main.c: Refactor open_session_file() from configuration_open_files(). + * src/keyfile.c: + Refactor get_session_file_string() from + configuration_save_session_files().
2008-04-28 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: branches/custom-filetypes/src/keyfile.c =================================================================== --- branches/custom-filetypes/src/keyfile.c 2008-04-29 11:30:19 UTC (rev 2541) +++ branches/custom-filetypes/src/keyfile.c 2008-04-29 12:00:13 UTC (rev 2542) @@ -115,6 +115,27 @@ }
+static gchar *get_session_file_string(gint idx) +{ + gchar *fname; + filetype *ft = doc_list[idx].file_type; + + if (ft == NULL) /* can happen when saving a new file when quitting */ + ft = filetypes[GEANY_FILETYPES_ALL]; + + fname = g_strdup_printf("%d;%d;%d;%d;%d;%d;%d;%s;", + sci_get_current_position(doc_list[idx].sci), + ft->uid, + doc_list[idx].readonly, + encodings_get_idx_from_charset(doc_list[idx].encoding), + doc_list[idx].use_tabs, + doc_list[idx].auto_indent, + doc_list[idx].line_wrapping, + doc_list[idx].file_name); + return fname; +} + + void configuration_save_session_files(GKeyFile *config) { gint idx, npage; @@ -133,20 +154,9 @@ if (idx >= 0 && g_path_is_absolute(DOC_FILENAME(idx))) { gchar *fname; - filetype *ft = doc_list[idx].file_type;
- if (ft == NULL) /* can happen when saving a new file when quitting */ - ft = filetypes[GEANY_FILETYPES_ALL]; g_snprintf(entry, 13, "FILE_NAME_%d", j); - fname = g_strdup_printf("%d;%d;%d;%d;%d;%d;%d;%s;", - sci_get_current_position(doc_list[idx].sci), - ft->uid, - doc_list[idx].readonly, - encodings_get_idx_from_charset(doc_list[idx].encoding), - doc_list[idx].use_tabs, - doc_list[idx].auto_indent, - doc_list[idx].line_wrapping, - doc_list[idx].file_name); + fname = get_session_file_string(idx); g_key_file_set_string(config, "files", entry, fname); g_free(fname); j++;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.