summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-07-15 05:55:30 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-07-15 05:55:30 +0800
commit12e267452e11b9fb31960a8c965ec797b70aeebc (patch)
tree15c3f5a18773e4f22204cb3fcf9dfa73877c3736
parentfcea48cc8c78af202e7b104223220a997d0c1171 (diff)
downloadcompizconfig-backend-gsettings-12e267452e11b9fb31960a8c965ec797b70aeebc.tar.gz
compizconfig-backend-gsettings-12e267452e11b9fb31960a8c965ec797b70aeebc.tar.bz2
Replace by a #define where appropriate
-rw-r--r--src/gsettings.c24
-rw-r--r--src/gsettings.h10
2 files changed, 12 insertions, 22 deletions
diff --git a/src/gsettings.c b/src/gsettings.c
index 6ecf913..eeacf8c 100644
--- a/src/gsettings.c
+++ b/src/gsettings.c
@@ -199,7 +199,7 @@ static GSettings *
getSettingsObjectForCCSSetting (CCSSetting *setting)
{
KEYNAME(setting->parent->context->screenNum);
- PATHNAME;
+ PATHNAME (setting->parent->name, keyName);
return getSettingsObjectForPluginWithPath (setting->parent->name, pathName, setting->parent->context);
}
@@ -480,7 +480,7 @@ readOption (CCSSetting * setting)
char *cleanSettingName = translateKeyForGSettings (setting->name);
KEYNAME(setting->parent->context->screenNum);
- PATHNAME;
+ PATHNAME (setting->parent->name, keyName);
/* first check if the key is set */
gsettingsValue = g_settings_get_value (settings, cleanSettingName);
@@ -786,7 +786,7 @@ resetOptionToDefault (CCSSetting * setting)
char *cleanSettingName = translateKeyForGSettings (setting->name);
KEYNAME (setting->parent->context->screenNum);
- PATHNAME;
+ PATHNAME (setting->parent->name, keyName);
g_settings_reset (settings, cleanSettingName);
@@ -800,7 +800,7 @@ writeOption (CCSSetting * setting)
GSettings *settings = getSettingsObjectForCCSSetting (setting);
char *cleanSettingName = translateKeyForGSettings (setting->name);
KEYNAME (setting->parent->context->screenNum);
- PATHNAME;
+ PATHNAME (setting->parent->name, keyName);
switch (setting->type)
{
@@ -1185,19 +1185,9 @@ deleteProfile (CCSContext *context,
while (g_variant_iter_loop (iter, "s", &plugin))
{
GSettings *settings;
- char pathName[BUFSIZE];
-
-
- /* FIXME: We should not be hardcoding to screen0 in this case */
- if (!plugin ||
- strcmp (plugin, "core") == 0) \
- snprintf (pathName, BUFSIZE,
- "%s/%s/plugins/%s/%s/options/", COMPIZ, profile, plugin,
- "screen0");
- else
- snprintf (pathName, BUFSIZE,
- "%s/%s/plugins/%s/%s/options/", COMPIZ, profile, plugin,
- "screen0");
+
+ KEYNAME (context->screenNum);
+ PATHNAME (plugin, keyName);
settings = getSettingsObjectForPluginWithPath (plugin, pathName, context);
diff --git a/src/gsettings.h b/src/gsettings.h
index 5220a6d..ee0d51c 100644
--- a/src/gsettings.h
+++ b/src/gsettings.h
@@ -75,16 +75,16 @@
#define KEYNAME(sn) char keyName[BUFSIZE]; \
snprintf (keyName, BUFSIZE, "screen%i", sn);
-#define PATHNAME char pathName[BUFSIZE]; \
- if (!setting->parent->name || \
- strcmp (setting->parent->name, "core") == 0) \
+#define PATHNAME(p,k) char pathName[BUFSIZE]; \
+ if (!p || \
+ strcmp (p, "core") == 0) \
snprintf (pathName, BUFSIZE, \
"%s/%s/plugins/%s/%s/options/", COMPIZ, currentProfile, \
- setting->parent->name, keyName); \
+ p, k); \
else \
snprintf(pathName, BUFSIZE, \
"%s/%s/plugins/%s/%s/options/", COMPIZ, currentProfile, \
- setting->parent->name, keyName);
+ p, k);
#define _GNU_SOURCE