typioca: 2.7.0 -> 2.8.0
[NixPkgs.git] / pkgs / test / make-hardcode-gsettings-patch / fixtures / example-project-patched / main.c
blob7822a42b840a7f82973cfb98eac6275c50aeb837
1 #include <gio/gio.h>
2 #include <glib-object.h>
4 void schema_id_literal() {
5 GSettings *settings;
7 g_autoptr(GSettingsSchemaSource) schema_source;
8 g_autoptr(GSettingsSchema) schema;
9 schema_source = g_settings_schema_source_new_from_directory("@EDS@", g_settings_schema_source_get_default(), TRUE, NULL);
10 schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution-data-server.addressbook", FALSE);
11 settings = g_settings_new_full(schema, NULL, NULL);
13 g_object_unref(settings);
16 #define SELF_UID_PATH_ID "org.gnome.evolution-data-server.addressbook"
17 int schema_id_from_constant() {
18 GSettings *settings;
20 g_autoptr(GSettingsSchemaSource) schema_source;
21 g_autoptr(GSettingsSchema) schema;
22 schema_source = g_settings_schema_source_new_from_directory("@EDS@", g_settings_schema_source_get_default(), TRUE, NULL);
23 schema = g_settings_schema_source_lookup(schema_source, SELF_UID_PATH_ID, FALSE);
24 settings = g_settings_new_full(schema, NULL, NULL);
26 g_object_unref(settings);
29 void schema_id_autoptr() {
30 g_autoptr(GSettings) settings = NULL;
32 g_autoptr(GSettingsSchemaSource) schema_source;
33 g_autoptr(GSettingsSchema) schema;
34 schema_source = g_settings_schema_source_new_from_directory("@EVO@", g_settings_schema_source_get_default(), TRUE, NULL);
35 schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution.calendar", FALSE);
36 settings = g_settings_new_full(schema, NULL, NULL);
40 void schema_id_with_backend() {
41 GSettings *settings;
43 g_autoptr(GSettingsSchemaSource) schema_source;
44 g_autoptr(GSettingsSchema) schema;
45 schema_source = g_settings_schema_source_new_from_directory("@EDS@", g_settings_schema_source_get_default(), TRUE, NULL);
46 schema = g_settings_schema_source_lookup(schema_source, "org.gnome.evolution-data-server.addressbook", FALSE);
47 settings = g_settings_new_full(schema, g_settings_backend_get_default(), NULL);
49 g_object_unref(settings);
52 void schema_id_with_backend_and_path() {
53 GSettings *settings;
55 g_autoptr(GSettingsSchemaSource) schema_source;
56 g_autoptr(GSettingsSchema) schema;
57 schema_source = g_settings_schema_source_new_from_directory("@SEANAUT@", g_settings_schema_source_get_default(), TRUE, NULL);
58 schema = g_settings_schema_source_lookup(schema_source, "org.gnome.seahorse.nautilus.window", FALSE);
59 settings = g_settings_new_full(schema, g_settings_backend_get_default(), "/org/gnome/seahorse/nautilus/windows/123/");
61 g_object_unref(settings);
64 void schema_id_with_path() {
65 GSettings *settings;
67 g_autoptr(GSettingsSchemaSource) schema_source;
68 g_autoptr(GSettingsSchema) schema;
69 schema_source = g_settings_schema_source_new_from_directory("@SEANAUT@", g_settings_schema_source_get_default(), TRUE, NULL);
70 schema = g_settings_schema_source_lookup(schema_source, "org.gnome.seahorse.nautilus.window", FALSE);
71 settings = g_settings_new_full(schema, NULL, "/org/gnome/seahorse/nautilus/windows/123/");
73 g_object_unref(settings);
76 int main() {
77 schema_id_literal();
78 schema_id_from_constant();
79 schema_id_autoptr();
80 schema_id_with_backend();
81 schema_id_with_backend_and_path();
82 schema_id_with_path();
84 return 0;