Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1#include <gio/gio.h> 2#include <glib-object.h> 3 4void schema_id_literal() { 5 GSettings *settings; 6 settings = g_settings_new("org.gnome.evolution-data-server.addressbook"); 7 g_object_unref(settings); 8} 9 10#define SELF_UID_PATH_ID "org.gnome.evolution-data-server.addressbook" 11int schema_id_from_constant() { 12 GSettings *settings; 13 settings = g_settings_new(SELF_UID_PATH_ID); 14 g_object_unref(settings); 15} 16 17void schema_id_autoptr() { 18 g_autoptr(GSettings) settings = NULL; 19 settings = g_settings_new("org.gnome.evolution.calendar"); 20} 21 22void schema_id_with_backend() { 23 GSettings *settings; 24 settings = g_settings_new_with_backend("org.gnome.evolution-data-server.addressbook", g_settings_backend_get_default()); 25 g_object_unref(settings); 26} 27 28void schema_id_with_backend_and_path() { 29 GSettings *settings; 30 settings = g_settings_new_with_backend_and_path("org.gnome.seahorse.nautilus.window", g_settings_backend_get_default(), "/org/gnome/seahorse/nautilus/windows/123/"); 31 g_object_unref(settings); 32} 33 34void schema_id_with_path() { 35 GSettings *settings; 36 settings = g_settings_new_with_path("org.gnome.seahorse.nautilus.window", "/org/gnome/seahorse/nautilus/windows/123/"); 37 g_object_unref(settings); 38} 39 40int main() { 41 schema_id_literal(); 42 schema_id_from_constant(); 43 schema_id_autoptr(); 44 schema_id_with_backend(); 45 schema_id_with_backend_and_path(); 46 schema_id_with_path(); 47 48 return 0; 49}