Commit af9b20f5cce096a1897d0d9455d6ef5b6e90770d

Authored by Perry Werneck
1 parent 654f2082

Playing with gsettings.

@@ -226,8 +226,7 @@ Debug: \ @@ -226,8 +226,7 @@ Debug: \
226 $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@ 226 $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@
227 227
228 $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@: \ 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 @$(MKDIR) $(@D) 231 @$(MKDIR) $(@D)
233 @echo $< ... 232 @echo $< ...
@@ -238,7 +237,8 @@ $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@: \ @@ -238,7 +237,8 @@ $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@: \
238 $(LIBS) 237 $(LIBS)
239 238
240 run: \ 239 run: \
241 - $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@ 240 + $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@ \
  241 + gschemas.compiled
242 242
243 @LD_LIBRARY_PATH=$(BINDBG) \ 243 @LD_LIBRARY_PATH=$(BINDBG) \
244 $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@ 244 $(BINDBG)/$(PACKAGE_NAME)@EXEEXT@
schemas/application.gschema.xml
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!--
  3 +
  4 +
  5 +-->
  6 +
1 <schemalist> 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 </schemalist> 19 </schemalist>
14 -  
src/main/main.c
@@ -48,12 +48,29 @@ int main (int argc, char **argv) { @@ -48,12 +48,29 @@ int main (int argc, char **argv) {
48 #ifdef DEBUG 48 #ifdef DEBUG
49 { 49 {
50 GError * error = NULL; 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 #endif // DEBUG 75 #endif // DEBUG
59 76