/*! * Default Constructor. * \param app_name for example "An example" * \param app_id for example "org.freedesktop.libcanberra.Test" * \param app_icon_name for example "libcanberra-test" */ Canberra(const char* app_name = NULL, const char* app_id = NULL, const char* app_icon_name = NULL) { ca_context_create(&m_ctx); /* Set a few application-global properties */ if (app_name) { ca_context_change_props(m_ctx, CA_PROP_APPLICATION_NAME, app_name, NULL); } if (app_id) { ca_context_change_props(m_ctx, CA_PROP_APPLICATION_ID, app_id, NULL); } if (app_icon_name) { ca_context_change_props(m_ctx, CA_PROP_APPLICATION_ICON_NAME, app_icon_name, NULL); } }
static PyObject* osk_audio_disable(PyObject* self, PyObject* args) { OskAudio* audio = (OskAudio*) self; ca_context_change_props(audio->ca, CA_PROP_CANBERRA_ENABLE, "0", NULL); Py_RETURN_NONE; }
static void play_music() { static ca_context *notification = NULL; const char *file = "/usr/share/sounds/login.wav"; if (!notification) { ca_context_create(¬ification); ca_context_change_props( notification, CA_PROP_APPLICATION_NAME, "Dawati Alarm Notify", NULL); } ca_context_play(notification, 0, CA_PROP_MEDIA_FILENAME, file, NULL); }
static PyObject* osk_audio_set_theme(PyObject* self, PyObject* args) { OskAudio* audio = (OskAudio*) self; const char* theme; int ret; if (!PyArg_ParseTuple(args, "s", &theme)) return NULL; ret = ca_context_change_props(audio->ca, CA_PROP_CANBERRA_XDG_THEME_NAME, theme, NULL); if (ret < 0) { PyErr_SetString(OSK_EXCEPTION, ca_strerror(ret)); return NULL; } Py_RETURN_NONE; }