SF.net SVN: geany: [881] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Wed Oct 11 16:35:28 UTC 2006
Revision: 881
http://svn.sourceforge.net/geany/?rev=881&view=rev
Author: eht16
Date: 2006-10-11 09:35:21 -0700 (Wed, 11 Oct 2006)
Log Message:
-----------
Removed hard limit of session files.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/geany.h
trunk/src/keyfile.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-10-10 17:28:12 UTC (rev 880)
+++ trunk/ChangeLog 2006-10-11 16:35:21 UTC (rev 881)
@@ -1,3 +1,8 @@
+2006-10-11 Enrico Tröger <enrico.troeger at uvena.de>
+
+ * src/keyfile.c, src/geany.h: Removed hard limit of session files.
+
+
2006-10-10 Enrico Tröger <enrico.troeger at uvena.de>
* src/document.c: Connect only once to the "sci-notify" signal.
Modified: trunk/src/geany.h
===================================================================
--- trunk/src/geany.h 2006-10-10 17:28:12 UTC (rev 880)
+++ trunk/src/geany.h 2006-10-11 16:35:21 UTC (rev 881)
@@ -38,7 +38,6 @@
#define GEANY_FILEDEFS_SUBDIR "filedefs"
#define GEANY_CODENAME "Kintaro"
#define GEANY_HOMEPAGE "http://geany.uvena.de/"
-#define GEANY_SESSION_FILES 25
#define GEANY_MAX_TAGS_COUNT 1000
#define GEANY_CHECK_FILE_DELAY 30
#define GEANY_WORDCHARS "_#&abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\"
Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c 2006-10-10 17:28:12 UTC (rev 880)
+++ trunk/src/keyfile.c 2006-10-11 16:35:21 UTC (rev 881)
@@ -43,7 +43,7 @@
static gchar *scribble_text = NULL;
-static gchar *session_files[GEANY_SESSION_FILES];
+static GPtrArray *session_files = NULL;
static gint hpan_position;
static gint vpan_position;
@@ -56,9 +56,10 @@
guint i = 0, j = 0, max;
gint idx;
gboolean config_exists;
+ gboolean have_session_files;
GKeyFile *config = g_key_file_new();
gchar *configfile = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "geany.conf", NULL);
- gchar *data;
+ gchar *data, *tmp;
gchar *entry = g_malloc(14);
gchar *fname = g_malloc0(256);
gchar **recent_files = g_new0(gchar*, app->mru_length + 1);
@@ -205,9 +206,9 @@
if (cl_options.load_session)
{
- // store the last 15(or what ever GEANY_SESSION_FILES is set to) filenames, to reopen the next time
+ // store the filenames to reopen them the next time
max = gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook));
- for(i = 0; (i < max) && (j < GEANY_SESSION_FILES); i++)
+ for(i = 0; i < max; i++)
{
idx = document_get_n_idx(i);
if (idx >= 0 && doc_list[idx].file_name)
@@ -219,11 +220,23 @@
j++;
}
}
- // if open filenames less than GEANY_SESSION_FILES, delete existing saved entries in the list
- for(i = j; i < GEANY_SESSION_FILES; i++)
+ // if open filenames less than saved session files, delete existing entries in the list
+ have_session_files = TRUE;
+ i = j;
+ while (have_session_files)
{
g_snprintf(entry, 13, "FILE_NAME_%d", i);
- g_key_file_set_string(config, "files", entry, "");
+ tmp = g_key_file_get_string(config, "files", entry, NULL);
+ if (tmp == NULL)
+ {
+ have_session_files = FALSE;
+ }
+ else
+ {
+ g_key_file_remove_key(config, "files", entry, NULL);
+ g_free(tmp);
+ i++;
+ }
}
}
@@ -251,6 +264,7 @@
gboolean configuration_load()
{
gboolean config_exists;
+ gboolean have_session_files;
guint i, geo_len;
gint *geo;
gsize len = 0;
@@ -436,16 +450,21 @@
}
g_strfreev(recent_files);
- for(i = 0; i < GEANY_SESSION_FILES; i++)
+ session_files = g_ptr_array_new();
+ have_session_files = TRUE;
+ i = 0;
+ while (have_session_files)
{
g_snprintf(entry, 13, "FILE_NAME_%d", i);
- session_files[i] = g_key_file_get_string(config, "files", entry, &error);
- if (! session_files[i] || error)
+ tmp_string = g_key_file_get_string(config, "files", entry, &error);
+ if (! tmp_string || error)
{
g_error_free(error);
error = NULL;
- session_files[i] = NULL;
+ have_session_files = FALSE;
}
+ g_ptr_array_add(session_files, tmp_string);
+ i++;
}
g_key_file_free(config);
@@ -460,20 +479,21 @@
{
gint i;
guint x, pos, y, len;
- gchar *file, *locale_filename, **array;
+ gchar *file, *locale_filename, **array, *tmp;
gboolean ret = FALSE;
- i = app->tab_order_ltr ? 0 : GEANY_SESSION_FILES - 1;
- while(TRUE)
+ i = app->tab_order_ltr ? 0 : (session_files->len - 1);
+ while (TRUE)
{
- if (session_files[i] && *session_files[i])
+ tmp = g_ptr_array_index(session_files, i);
+ if (tmp && *tmp)
{
gint uid = -1;
x = 0;
y = 0;
// yes it is :, it should be a ;, but now it is too late to change it
- array = g_strsplit(session_files[i], ":", 3);
+ array = g_strsplit(tmp, ":", 3);
len = g_strv_length(array);
// read position
@@ -499,12 +519,12 @@
}
g_free(locale_filename);
}
- g_free(session_files[i]);
+ g_free(tmp);
if (app->tab_order_ltr)
{
i++;
- if (i >= GEANY_SESSION_FILES) break;
+ if (i >= session_files->len) break;
}
else
{
@@ -513,6 +533,7 @@
}
}
+ g_ptr_array_free(session_files, TRUE);
return ret;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list