Commit af9b20f5cce096a1897d0d9455d6ef5b6e90770d
1 parent
654f2082
Exists in
master
and in
4 other branches
Playing with gsettings.
Showing
3 changed files
with
37 additions
and
15 deletions
Show diff stats
Makefile.in
... | ... | @@ -226,8 +226,7 @@ Debug: \ |
226 | 226 | $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@ |
227 | 227 | |
228 | 228 | $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@: \ |
229 | - $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC).o) \ | |
230 | - gschemas.compiled | |
229 | + $(foreach SRC, $(basename $(SOURCES)), $(OBJDBG)/$(SRC).o) | |
231 | 230 | |
232 | 231 | @$(MKDIR) $(@D) |
233 | 232 | @echo $< ... |
... | ... | @@ -238,7 +237,8 @@ $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@: \ |
238 | 237 | $(LIBS) |
239 | 238 | |
240 | 239 | run: \ |
241 | - $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@ | |
240 | + $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@ \ | |
241 | + gschemas.compiled | |
242 | 242 | |
243 | 243 | @LD_LIBRARY_PATH=$(BINDBG) \ |
244 | 244 | $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@ | ... | ... |
schemas/application.gschema.xml
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- | |
3 | + | |
4 | + | |
5 | +--> | |
6 | + | |
1 | 7 | <schemalist> |
2 | 8 | |
3 | - <schema id="br.com.bb.pw3270" gettext-domain="pw3270"> | |
9 | + <schema path="/br/com/bb/pw3270/application/" id="br.com.bb.pw3270"> | |
4 | 10 | |
5 | - <key type="b" name="enable-something"> | |
6 | - <default>false</default> | |
7 | - <summary>Enable something</summary> | |
8 | - <description>Enables something important in the application</description> | |
9 | - </key> | |
11 | + <key name="ui-style" type="u"> | |
12 | + <default>1</default> | |
13 | + <summary>UI Style</summary> | |
14 | + <description>The ID of the current user interface style</description> | |
15 | + </key> | |
10 | 16 | |
11 | - </schema> | |
17 | + </schema> | |
12 | 18 | |
13 | 19 | </schemalist> |
14 | - | ... | ... |
src/main/main.c
... | ... | @@ -48,12 +48,29 @@ int main (int argc, char **argv) { |
48 | 48 | #ifdef DEBUG |
49 | 49 | { |
50 | 50 | GError * error = NULL; |
51 | - GSettingsSchemaSource * source = g_settings_schema_source_new_from_directory(".",NULL,TRUE,&error); | |
51 | + GSettingsSchemaSource * source = | |
52 | + g_settings_schema_source_new_from_directory( | |
53 | + ".", | |
54 | + NULL, | |
55 | + TRUE, | |
56 | + &error | |
57 | + ); | |
52 | 58 | |
53 | - if(!source && error) { | |
54 | - g_error(error->message); | |
55 | - } | |
59 | + g_assert_no_error(error); | |
56 | 60 | |
61 | + GSettingsSchema * schema = | |
62 | + g_settings_schema_source_lookup( | |
63 | + source, | |
64 | + "br.com.bb.pw3270", | |
65 | + TRUE); | |
66 | + | |
67 | + g_settings_schema_source_unref(source); | |
68 | + | |
69 | + GSettings * settings = g_settings_new_full(schema, NULL, "/br/com/bb/pw3270/application/"); | |
70 | + | |
71 | + debug("ui-style=%u",g_settings_get_uint(settings,"ui-style")); | |
72 | + | |
73 | + g_object_unref(settings); | |
57 | 74 | } |
58 | 75 | #endif // DEBUG |
59 | 76 | ... | ... |