Beispiel #1
0
static PyObject *
App_get_property(App *self, const gchar *prop_name)
{
	g_return_val_if_fail(self != NULL, NULL);
	g_return_val_if_fail(prop_name != NULL, NULL);

	if (!self->app)
	{
		PyErr_SetString(PyExc_RuntimeError,
			"App instance not initialized properly");
		return NULL;
	}

	if (g_str_equal(prop_name, "configdir") && self->app->configdir)
		return PyString_FromString(self->app->configdir);
#if ENABLE_PRIVATE
	else if (g_str_equal(prop_name, "datadir") && self->app->datadir)
		return PyString_FromString(self->app->datadir);
	else if (g_str_equal(prop_name, "docdir") && self->app->docdir)
		return PyString_FromString(self->app->docdir);
#endif
	else if (g_str_equal(prop_name, "debug_mode") && self->app->debug_mode)
	{
		if (self->app->debug_mode)
			Py_RETURN_TRUE;
		else
			Py_RETURN_FALSE;
	}
	else if (g_str_equal(prop_name, "project") && self->app->project)
		return (PyObject *) GEANYPY_NEW(Project);

	Py_RETURN_NONE;
}
static void on_project_save(GObject *geany_object, GKeyFile *config, SignalManager *man)
{
	PyObject *py_proj = (PyObject *) GEANYPY_NEW(Project);
	g_signal_emit_by_name(man->obj, "project-save", py_proj);
	Py_XDECREF(py_proj);
}