Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Archive
gcompris
Commits
a11bfd7c
Commit
a11bfd7c
authored
Aug 16, 2005
by
Yves Combe
Browse files
python bindings, fix name (gcompris_get_locales_list) and bug.
parent
646f4f89
Changes
7
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
a11bfd7c
2005-08-17 Yves Combe <yves@ycombe.net>
python bindings, fix name (gcompris_get_locales_list) and bug.
* src/boards/colors.c: (colors_config_start):
* src/boards/py-mod-gcompris.c: (py_gcompris_combo_locales),
(py_gcompris_get_locales_list):
* src/boards/python/pythontest.py:
* src/gcompris/board_config.c: (gcompris_get_locales_list),
(gcompris_combo_locales):
* src/gcompris/board_config.h:
* src/gcompris/gcompris.c: (gcompris_set_locale):
2005-08-17 Yves Combe <yves@ycombe.net>
pass gcompris_combo_box init and returned values to string.
...
...
src/boards/colors.c
View file @
a11bfd7c
...
...
@@ -172,7 +172,7 @@ colors_config_start(GcomprisBoard *agcomprisBoard,
g_hash_table_destroy
(
table
);
GList
*
locales
=
gcompris_locales_list
();
GList
*
locales
=
gcompris_
get_
locales_list
();
GList
*
locale
=
locales
;
gchar
*
actual_lang
=
g_strdup
(
gcompris_get_locale
());
...
...
src/boards/py-mod-gcompris.c
View file @
a11bfd7c
...
...
@@ -1296,6 +1296,46 @@ py_gcompris_separator(PyObject* self, PyObject* args)
}
static
PyObject
*
py_gcompris_combo_locales
(
PyObject
*
self
,
PyObject
*
args
)
{
gchar
*
key
;
gchar
*
init
;
/* Parse arguments */
if
(
!
PyArg_ParseTuple
(
args
,
"ss:gcompris_radio_buttons"
,
&
key
,
&
init
))
return
NULL
;
return
(
PyObject
*
)
pygobject_new
((
GObject
*
)
\
gcompris_combo_locales
(
key
,
init
));
}
static
PyObject
*
py_gcompris_get_locales_list
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
pylist
;
GList
*
result
,
*
list
;
/* Parse arguments */
if
(
!
PyArg_ParseTuple
(
args
,
":gcompris.get_locales_list"
))
return
NULL
;
/* Call the corresponding C function */
result
=
gcompris_get_locales_list
();
pylist
=
PyList_New
(
0
);
for
(
list
=
result
;
list
!=
NULL
;
list
=
list
->
next
){
PyList_Append
(
pylist
,
PyString_FromString
(
list
->
data
));
}
Py_INCREF
(
pylist
);
return
pylist
;
}
/****************************************************/
...
...
@@ -1347,6 +1387,8 @@ static PyMethodDef PythonGcomprisModule[] = {
{
"radio_buttons"
,
py_gcompris_radio_buttons
,
METH_VARARGS
,
"gcompris_radio_buttons"
},
{
"spin_int"
,
py_gcompris_spin_int
,
METH_VARARGS
,
"gcompris_spin_int"
},
{
"separator"
,
py_gcompris_separator
,
METH_VARARGS
,
"gcompris_separator"
},
{
"combo_locales"
,
py_gcompris_combo_locales
,
METH_VARARGS
,
"gcompris_combo_locales"
},
{
"get_locales_list"
,
py_gcompris_get_locales_list
,
METH_VARARGS
,
"gcompris_get_locales_list"
},
{
NULL
,
NULL
,
0
,
NULL
}
};
...
...
src/boards/python/pythontest.py
View file @
a11bfd7c
...
...
@@ -396,6 +396,10 @@ class Gcompris_pythontest:
self
.
init_conf_str
(
'pattern'
,
'circle'
)
)
print
gcompris
.
get_locales_list
()
gcompris
.
combo_locales
(
'locale'
,
'fr'
)
# Get value from config_dict or value passed
def
init_conf
(
self
,
key
,
value
):
if
self
.
config_dict
.
has_key
(
key
):
...
...
src/gcompris/board_config.c
View file @
a11bfd7c
/* gcompris - board_config.c
*
* Time-stamp: <2005/08/17 0
0:04
:4
3
yves>
* Time-stamp: <2005/08/17 0
1:29
:4
7
yves>
*
* Copyright (C) 2001 Pascal Georges
*
...
...
@@ -489,13 +489,14 @@ GtkHSeparator *gcompris_separator()
/* L10n */
/***********************************************/
GList
*
gcompris_locales_list
(){
GList
*
gcompris_
get_
locales_list
(){
gchar
*
textdomain
;
GDir
*
textdomain_dir
;
GError
**
error
;
textdomain
=
bindtextdomain
(
"gcompris"
,
NULL
);
GError
**
error
=
NULL
;
//textdomain = bindtextdomain ("gcompris", NULL);
textdomain
=
PACKAGE_LOCALE_DIR
;
GList
*
locales
=
NULL
;
textdomain_dir
=
g_dir_open
(
textdomain
,
0
,
error
);
...
...
@@ -517,8 +518,6 @@ GList *gcompris_locales_list(){
g_free
(
catalog
);
}
g_free
(
textdomain
);
g_dir_close
(
textdomain_dir
);
return
locales
;
...
...
@@ -526,8 +525,8 @@ GList *gcompris_locales_list(){
GtkComboBox
*
gcompris_combo_locales
(
gchar
*
key
,
gchar
*
init
)
{
gcompris_combo_box
(
_
(
"Select the language
\n
to use in the board"
),
gcompris_locales_list
(),
return
gcompris_combo_box
(
_
(
"Select the language to use in the board"
),
gcompris_
get_
locales_list
(),
key
,
init
);
}
...
...
src/gcompris/board_config.h
View file @
a11bfd7c
/* gcompris - board_config.h
*
* Time-stamp: <2005/08/1
6 23:25:14
yves>
* Time-stamp: <2005/08/1
7 01:06:21
yves>
*
* Copyright (C) 2001 Pascal Georges
*
...
...
@@ -64,7 +64,7 @@ GtkSpinButton *gcompris_spin_int(const gchar *label,
GtkHSeparator
*
gcompris_separator
();
GList
*
gcompris_locales_list
();
GList
*
gcompris_
get_
locales_list
();
GtkComboBox
*
gcompris_combo_locales
(
gchar
*
key
,
gchar
*
init
);
...
...
src/gcompris/gcompris.c
View file @
a11bfd7c
/* gcompris - gcompris.c
*
* Time-stamp: <2005/08/1
6
0
0:43:08
yves>
* Time-stamp: <2005/08/1
7
0
1:08:31
yves>
*
* Copyright (C) 2000-2003 Bruno Coudoin
*
...
...
@@ -802,7 +802,7 @@ void gcompris_set_locale(gchar *locale)
gcompris_locale
=
g_strdup
(
setlocale
(
LC_MESSAGES
,
locale
));
if
(
!
gcompris_locale
)
gcompris_locale
=
g_strdup
(
locale
);
setlocale
(
"
LC_ALL
"
,
""
);
setlocale
(
LC_ALL
,
""
);
#endif
if
(
gcompris_locale
!=
NULL
&&
strcmp
(
locale
,
gcompris_locale
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment