mirror of
https://github.com/tstellar/bygfoot.git
synced 2025-02-07 15:18:41 +01:00
Constants editing.
This commit is contained in:
parent
0f99a20978
commit
aeb6c714e2
@ -727,7 +727,7 @@ enum
|
|||||||
};
|
};
|
||||||
|
|
||||||
GtkTreeModel*
|
GtkTreeModel*
|
||||||
treeview2_create_constants(const GArray *list, gint type)
|
treeview2_create_constants(const GPtrArray *list, gint type)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("treeview2_create_constants\n");
|
printf("treeview2_create_constants\n");
|
||||||
@ -761,20 +761,20 @@ treeview2_create_constants(const GArray *list, gint type)
|
|||||||
if(type == CONSTANTS_TYPE_INT)
|
if(type == CONSTANTS_TYPE_INT)
|
||||||
gtk_list_store_set(ls, &iter,
|
gtk_list_store_set(ls, &iter,
|
||||||
0, i,
|
0, i,
|
||||||
1, g_array_index(list, Option, i).name,
|
1, ((Option*)g_ptr_array_index(list, i))->name,
|
||||||
2, g_array_index(list, Option, i).value,
|
2, ((Option*)g_ptr_array_index(list, i))->value,
|
||||||
-1);
|
-1);
|
||||||
else if(type == CONSTANTS_TYPE_FLOAT)
|
else if(type == CONSTANTS_TYPE_FLOAT)
|
||||||
gtk_list_store_set(ls, &iter,
|
gtk_list_store_set(ls, &iter,
|
||||||
0, i,
|
0, i,
|
||||||
1, g_array_index(list, Option, i).name,
|
1, ((Option*)g_ptr_array_index(list, i))->name,
|
||||||
2, (gfloat)g_array_index(list, Option, i).value / OPTION_FLOAT_DIVISOR,
|
2, (gfloat)((Option*)g_ptr_array_index(list, i))->value / OPTION_FLOAT_DIVISOR,
|
||||||
-1);
|
-1);
|
||||||
else
|
else
|
||||||
gtk_list_store_set(ls, &iter,
|
gtk_list_store_set(ls, &iter,
|
||||||
0, i,
|
0, i,
|
||||||
1, g_array_index(list, Option, i).name,
|
1, ((Option*)g_ptr_array_index(list, i))->name,
|
||||||
2, g_array_index(list, Option, i).string_value,
|
2, ((Option*)g_ptr_array_index(list, i))->string_value,
|
||||||
-1);
|
-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,26 +821,29 @@ treeview2_show_constants(void)
|
|||||||
printf("treeview2_show_constants\n");
|
printf("treeview2_show_constants\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gint i, j;
|
gint i;
|
||||||
GtkTreeView *treeview[4] =
|
GtkTreeView *treeview[4] =
|
||||||
{GTK_TREE_VIEW(lookup_widget(window.constants, "treeview_constants_integer")),
|
{GTK_TREE_VIEW(lookup_widget(window.constants, "treeview_constants_integer")),
|
||||||
GTK_TREE_VIEW(lookup_widget(window.constants, "treeview_constants_float")),
|
GTK_TREE_VIEW(lookup_widget(window.constants, "treeview_constants_float")),
|
||||||
GTK_TREE_VIEW(lookup_widget(window.constants, "treeview_constants_string")),
|
GTK_TREE_VIEW(lookup_widget(window.constants, "treeview_constants_string")),
|
||||||
GTK_TREE_VIEW(lookup_widget(window.constants, "treeview_constants_app"))};
|
GTK_TREE_VIEW(lookup_widget(window.constants, "treeview_constants_app"))};
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GArray *list[4] =
|
GPtrArray *list[4] =
|
||||||
{g_array_new(FALSE, FALSE, sizeof(Option)),
|
{g_ptr_array_new(),
|
||||||
g_array_new(FALSE, FALSE, sizeof(Option)),
|
g_ptr_array_new(),
|
||||||
g_array_new(FALSE, FALSE, sizeof(Option)),
|
g_ptr_array_new(),
|
||||||
constants_app.list};
|
g_ptr_array_new()};
|
||||||
|
|
||||||
for(i = 0; i < constants.list->len; i++)
|
for(i = 0; i < constants.list->len; i++)
|
||||||
if(g_str_has_prefix(g_array_index(constants.list, Option, i).name, "int_"))
|
if(g_str_has_prefix(g_array_index(constants.list, Option, i).name, "int_"))
|
||||||
g_array_append_val(list[CONSTANTS_TYPE_INT], g_array_index(constants.list, Option, i));
|
g_ptr_array_add(list[CONSTANTS_TYPE_INT], &g_array_index(constants.list, Option, i));
|
||||||
else if(g_str_has_prefix(g_array_index(constants.list, Option, i).name, "float_"))
|
else if(g_str_has_prefix(g_array_index(constants.list, Option, i).name, "float_"))
|
||||||
g_array_append_val(list[CONSTANTS_TYPE_FLOAT], g_array_index(constants.list, Option, i));
|
g_ptr_array_add(list[CONSTANTS_TYPE_FLOAT], &g_array_index(constants.list, Option, i));
|
||||||
else
|
else
|
||||||
g_array_append_val(list[CONSTANTS_TYPE_STRING], g_array_index(constants.list, Option, i));
|
g_ptr_array_add(list[CONSTANTS_TYPE_STRING], &g_array_index(constants.list, Option, i));
|
||||||
|
|
||||||
|
for(i = 0; i < constants_app.list->len; i++)
|
||||||
|
g_ptr_array_add(list[CONSTANTS_TYPE_APP], &g_array_index(constants_app.list, Option, i));
|
||||||
|
|
||||||
for(i = 0; i < 4; i++)
|
for(i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
@ -850,15 +853,6 @@ treeview2_show_constants(void)
|
|||||||
gtk_tree_view_set_model(treeview[i], model);
|
gtk_tree_view_set_model(treeview[i], model);
|
||||||
g_object_unref(model);
|
g_object_unref(model);
|
||||||
|
|
||||||
/* if(i < 4) */
|
g_ptr_array_free(list[i], TRUE);
|
||||||
/* { */
|
|
||||||
/* for(j = 0; j < list[i]->len; j++) */
|
|
||||||
/* { */
|
|
||||||
/* g_free(g_array_index(list[i], Option, j).name); */
|
|
||||||
/* g_free(g_array_index(list[i], Option, j).string_value); */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
/* g_array_free(list[i], TRUE); */
|
|
||||||
/* } */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ void
|
|||||||
treeview2_show_news(void);
|
treeview2_show_news(void);
|
||||||
|
|
||||||
GtkTreeModel*
|
GtkTreeModel*
|
||||||
treeview2_create_constants(const GArray *list, gint type);
|
treeview2_create_constants(const GPtrArray *list, gint type);
|
||||||
|
|
||||||
void
|
void
|
||||||
treeview2_set_up_constants(GtkTreeView *treeview);
|
treeview2_set_up_constants(GtkTreeView *treeview);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user