Skip to content
Advertisement

Tag: glib

Generate Gsettings schema files in linux

I am using Gsettings schema and have com.test.gschema.xml file. Now some keys inside the schema are enum and thus I require com.test.enums.xml file. Now I am using CMakeLists and thus can’t use gsettings_ENUM_NAMESPACE and gsettings_ENUM_FILES. On searching I found out that we can make use of glib-mkenums utility but I tried generating the *.enums.xml file using it by providing it

Extract pointer to data from GPtrArray

I’m using GPtrArray structure to hold pointers to chunks of dynamically allocated memory. As I need as simple as possible and correct freeing of memory I set callback g_ptr_array_new_with_free_func () which will free one element of pointer array. Thus when I call g_ptr_array_free() for all elements of array is called callback which correctly freeing allocated memory. Here is some pseudo

Advertisement