diff options
author | Sam Spilsbury <sam.spilsbury@canonical.com> | 2011-07-15 05:50:17 +0800 |
---|---|---|
committer | Sam Spilsbury <sam.spilsbury@canonical.com> | 2011-07-15 05:50:17 +0800 |
commit | 0a46b1c16b67bbccb74c6244a1f2ea046980e770 (patch) | |
tree | ee4eb4aca45aea94056d85ae2f95da276950c5f8 | |
parent | fff0e2a2b330fe02610d2798edc5dbd9b547f98a (diff) | |
download | compizconfig-backend-gsettings-0a46b1c16b67bbccb74c6244a1f2ea046980e770.tar.gz compizconfig-backend-gsettings-0a46b1c16b67bbccb74c6244a1f2ea046980e770.tar.bz2 |
Move strings describing schema id's and paths to #define's
-rw-r--r-- | src/gsettings.c | 42 | ||||
-rw-r--r-- | src/gsettings.h | 7 |
2 files changed, 26 insertions, 23 deletions
diff --git a/src/gsettings.c b/src/gsettings.c index c4dfb17..1d24d6d 100644 --- a/src/gsettings.c +++ b/src/gsettings.c @@ -50,12 +50,25 @@ static GList *watchedGnomeSettings = NULL; char *currentProfile = NULL; +/* some forward declarations */ +static void writeIntegratedOption (CCSContext *context, + CCSSetting *setting, + int index); + +typedef struct _SpecialOptionGSettings { + const char* settingName; + const char* pluginName; + const char* schemaName; + const char* keyName; + const char* type; +} SpecialOption; + static gchar * getSchemaNameForPlugin (const char *plugin) { gchar *schemaName = NULL; - schemaName = g_strconcat (SCHEMA_ID, ".", plugin, NULL); + schemaName = g_strconcat (COMPIZ_SCHEMA_ID, ".", plugin, NULL); return schemaName; } @@ -191,19 +204,6 @@ getSettingsObjectForCCSSetting (CCSSetting *setting) return getSettingsObjectForPluginWithPath (setting->parent->name, pathName, setting->parent->context); } -/* some forward declarations */ -static void writeIntegratedOption (CCSContext *context, - CCSSetting *setting, - int index); - -typedef struct _SpecialOptionGSettings { - const char* settingName; - const char* pluginName; - const char* schemaName; - const char* keyName; - const char* type; -} SpecialOption; - static Bool isIntegratedOption (CCSSetting *setting, int *index) @@ -939,7 +939,7 @@ updateCurrentProfileName (char *profile) { GVariant *profiles; char *prof; - char *profilePath = "/org/freedesktop/compizconfig/profile/"; + char *profilePath = COMPIZ_PROFILEPATH; char *currentProfilePath; GVariant *newProfiles; GVariantBuilder *newProfilesBuilder; @@ -975,7 +975,7 @@ updateCurrentProfileName (char *profile) currentProfile = strdup (profile); currentProfilePath = g_strconcat (profilePath, profile, "/", NULL); - currentProfileSettings = g_settings_new_with_path ("org.freedesktop.compizconfig.profile", profilePath); + currentProfileSettings = g_settings_new_with_path (PROFILE_SCHEMA_ID, profilePath); g_free (currentProfilePath); @@ -1027,12 +1027,12 @@ processEvents (unsigned int flags) static Bool initBackend (CCSContext * context) { - const char *profilePath = "/org/freedesktop/compizconfig/profile/"; + const char *profilePath = PROFILEPATH; char *currentProfilePath; g_type_init (); - compizconfigSettings = g_settings_new ("org.freedesktop.compizconfig"); + compizconfigSettings = g_settings_new (COMPIZCONFIG_SCHEMA_ID); #ifdef USE_GCONF initGConfClient (context); @@ -1040,7 +1040,7 @@ initBackend (CCSContext * context) currentProfile = getCurrentProfileName (); currentProfilePath = g_strconcat (profilePath, currentProfile, "/", NULL); - currentProfileSettings = g_settings_new_with_path ("org.freedesktop.compizconfig.profile", currentProfilePath); + currentProfileSettings = g_settings_new_with_path (PROFILE_SCHEMA_ID, currentProfilePath); g_free (currentProfilePath); @@ -1175,8 +1175,8 @@ deleteProfile (CCSContext *context, GVariantBuilder *newProfilesBuilder; char *plugin, *prof; GVariantIter *iter; - char *profileSettingsPath = g_strconcat ("/org/freedesktop/compizconfig/profile/", profile, "/", NULL); - GSettings *profile_settings = g_settings_new_with_path ("org.freedesktop.compizconfig.profile", profileSettingsPath);; + char *profileSettingsPath = g_strconcat (PROFILEPATH, profile, "/", NULL); + GSettings *profile_settings = g_settings_new_with_path (PROFILE_SCHEMA_ID, profileSettingsPath); plugins = g_settings_get_value (currentProfileSettings, "plugins-with-set-keys"); profiles = g_settings_get_value (compizconfigSettings, "existing-profiles"); diff --git a/src/gsettings.h b/src/gsettings.h index 125bc65..c432d17 100644 --- a/src/gsettings.h +++ b/src/gsettings.h @@ -57,10 +57,13 @@ #define CompNumLockMask (1 << 21) #define CompScrollLockMask (1 << 22) -#define SCHEMA_ID "org.freedesktop.compiz" +#define COMPIZ_SCHEMA_ID "org.freedesktop.compiz" +#define COMPIZCONFIG_SCHEMA_ID "org.freedesktop.compizconfig" +#define PROFILE_SCHEMA_ID "org.freedesktop.compizconfig.profile" #define METACITY "/apps/metacity" #define COMPIZ "/apps/compiz-1" -#define COMPIZCONFIG "/apps/compizconfig-1" +#define COMPIZ_PROFILEPATH COMPIZ "/profiles" +#define COMPIZCONFIG "/org/freedesktop/compizconfig" #define PROFILEPATH COMPIZCONFIG "/profiles" #define DEFAULTPROF "Default" #define CORE_NAME "core" |