mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-25 10:20:18 -06:00
Use a single key for check position names instead of a series of
manufactured key names, one key per name. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15739 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
f04508e009
commit
13f1be4d84
@ -8,9 +8,7 @@ Show_Boxes = false
|
||||
|
||||
[Check Positions]
|
||||
Height = 252.0
|
||||
Name_1 = Top
|
||||
Name_2 = Middle
|
||||
Name_3 = Bottom
|
||||
Names = Top;Middle;Bottom
|
||||
|
||||
[Check Items]
|
||||
Type_1 = PAYEE
|
||||
|
@ -8,9 +8,7 @@ Show_Boxes = false
|
||||
|
||||
[Check Positions]
|
||||
Height = 204.0
|
||||
Name_1 = Top
|
||||
Name_2 = Middle
|
||||
Name_3 = Bottom
|
||||
Names = Top;Middle;Bottom
|
||||
|
||||
[Check Items]
|
||||
Type_1 = PAYEE
|
||||
|
@ -8,9 +8,7 @@ Show_Boxes = false
|
||||
|
||||
[Check Positions]
|
||||
Height = 252.0
|
||||
Name_1 = Top
|
||||
Name_2 = Middle
|
||||
Name_3 = Bottom
|
||||
Names = Top;Middle;Bottom
|
||||
|
||||
[Check Items]
|
||||
Type_1 = PAYEE
|
||||
|
@ -8,9 +8,7 @@ Show_Boxes = false
|
||||
|
||||
[Check Positions]
|
||||
Height = 204.0
|
||||
Name_1 = Top
|
||||
Name_2 = Middle
|
||||
Name_3 = Bottom
|
||||
Names = Top;Middle;Bottom
|
||||
|
||||
[Check Items]
|
||||
Type_1 = PAYEE
|
||||
|
@ -87,7 +87,7 @@
|
||||
#define KF_KEY_ALIGN "Align"
|
||||
#define KF_KEY_SHOW_GRID "Show_Grid"
|
||||
#define KF_KEY_SHOW_BOXES "Show_Boxes"
|
||||
#define KF_KEY_NAME "Name"
|
||||
#define KF_KEY_NAMES "Names"
|
||||
#define KF_KEY_HEIGHT "Height"
|
||||
#define KF_KEY_TYPE "Type"
|
||||
#define KF_KEY_COORDS "Coords"
|
||||
@ -798,8 +798,9 @@ format_read_multicheck_info(const gchar * file,
|
||||
{
|
||||
GError *error = NULL;
|
||||
GSList *list = NULL;
|
||||
gchar *key, *name;
|
||||
int i;
|
||||
gchar *key, **names;
|
||||
gsize length;
|
||||
gint i;
|
||||
|
||||
key = g_strdup_printf("%s", KF_KEY_HEIGHT);
|
||||
format->height = g_key_file_get_double(key_file, KF_GROUP_POS, key, &error);
|
||||
@ -813,32 +814,30 @@ format_read_multicheck_info(const gchar * file,
|
||||
g_warning("Check file %s, error reading group %s, key %s: %s",
|
||||
file, KF_GROUP_POS, key, error->message);
|
||||
g_free(key);
|
||||
return list;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 1;; i++) {
|
||||
key = g_strdup_printf("%s_%d", KF_KEY_NAME, i);
|
||||
name = g_key_file_get_string(key_file, KF_GROUP_POS, key, &error);
|
||||
if (error) {
|
||||
if ((error->domain == G_KEY_FILE_ERROR)
|
||||
&& ((error->code == G_KEY_FILE_ERROR_GROUP_NOT_FOUND)
|
||||
|| (error->code == G_KEY_FILE_ERROR_KEY_NOT_FOUND))) {
|
||||
/* This is the expected exit from this function. */
|
||||
g_free(key);
|
||||
return list;
|
||||
}
|
||||
g_warning("Check file %s, error reading group %s, key %s: %s",
|
||||
file, KF_GROUP_POS, key, error->message);
|
||||
g_free(key);
|
||||
return list;
|
||||
names = g_key_file_get_string_list(key_file, KF_GROUP_POS, KF_KEY_NAMES,
|
||||
&length, &error);
|
||||
if (error) {
|
||||
if ((error->domain == G_KEY_FILE_ERROR)
|
||||
&& ((error->code == G_KEY_FILE_ERROR_GROUP_NOT_FOUND)
|
||||
|| (error->code == G_KEY_FILE_ERROR_KEY_NOT_FOUND))) {
|
||||
/* This is the expected exit from this function. */
|
||||
g_free(key);
|
||||
return NULL;
|
||||
}
|
||||
g_warning("Check file %s, error reading group %s, key %s: %s",
|
||||
file, KF_GROUP_POS, key, error->message);
|
||||
g_free(key);
|
||||
|
||||
list = g_slist_append(list, name);
|
||||
return list;
|
||||
}
|
||||
|
||||
/* Should never be reached. */
|
||||
for (i = 0; i < length; i++)
|
||||
list = g_slist_append(list, g_strdup(names[i]));
|
||||
|
||||
g_strfreev(names);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user