1 #if defined(HAVE_CONFIG_H) && !defined(GEANYPY_WINDOWS)
2 # include "config.h"
3 #endif
4 
5 #include "geanypy.h"
6 
7 
8 static PyObject *
Main_is_realized(PyObject * module)9 Main_is_realized(PyObject *module)
10 {
11 	if (main_is_realized())
12 		Py_RETURN_TRUE;
13 	else
14 		Py_RETURN_FALSE;
15 }
16 
17 
18 static PyObject *
Main_locale_init(PyObject * module,PyObject * args,PyObject * kwargs)19 Main_locale_init(PyObject *module, PyObject *args, PyObject *kwargs)
20 {
21 	gchar *locale_dir = NULL, *package = NULL;
22 	static gchar *kwlist[] = { "locale_dir", "gettext_package", NULL };
23 
24 	if (PyArg_ParseTupleAndKeywords(args, kwargs, "ss", kwlist, &locale_dir, &package))
25 	{
26 		if (locale_dir && package)
27 			main_locale_init(locale_dir, package);
28 	}
29 
30 	Py_RETURN_NONE;
31 }
32 
33 
34 static PyObject *
Main_reload_configuration(PyObject * module)35 Main_reload_configuration(PyObject *module)
36 {
37 	main_reload_configuration();
38 	Py_RETURN_NONE;
39 }
40 
41 
42 static
43 PyMethodDef MainModule_methods[] = {
44 	{ "is_realized", (PyCFunction) Main_is_realized, METH_NOARGS,
45 		"Checks whether the main gtk.Window has been realized." },
46 	{ "locale_init", (PyCFunction) Main_locale_init, METH_KEYWORDS,
47 		"Initializes the gettext translation system." },
48 	{ "reload_configuration", (PyCFunction) Main_reload_configuration, METH_NOARGS,
49 		"Reloads most of Geany's configuration files without restarting." },
50 	{ NULL }
51 };
52 
53 
initmain(void)54 PyMODINIT_FUNC initmain(void)
55 {
56 	Py_InitModule3("main", MainModule_methods, "Main program related functions.");
57 }
58