diff options
author | Diego Escalante Urrelo <descalante@igalia.com> | 2010-10-11 07:11:06 +0800 |
---|---|---|
committer | Diego Escalante Urrelo <descalante@igalia.com> | 2010-10-11 08:17:59 +0800 |
commit | 1aa8043ce4334bd6344b36a26d8604b085930c95 (patch) | |
tree | 66184e6a75ba64b2b09706fbd23b448429fd73ef /src | |
parent | 4bdb490a0b722c58db30b2ecfcf9be9af7f9f4ab (diff) | |
download | gsoc2013-epiphany-1aa8043ce4334bd6344b36a26d8604b085930c95.tar.gz gsoc2013-epiphany-1aa8043ce4334bd6344b36a26d8604b085930c95.tar.zst gsoc2013-epiphany-1aa8043ce4334bd6344b36a26d8604b085930c95.zip |
ephy-extensions-manager: improve toggle load code
g_variant_builder_end is not needed after using the builder with
g_settings_set.
Bug #631839
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-extensions-manager.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c index df06b97dd..850de7fa0 100644 --- a/src/ephy-extensions-manager.c +++ b/src/ephy-extensions-manager.c @@ -114,8 +114,8 @@ ephy_extensions_manager_toggle_load (EphyExtensionsManager *manager, { char **exts; GVariantBuilder builder; - gboolean dirty = FALSE; int i; + gboolean found = FALSE; g_return_if_fail (EPHY_IS_EXTENSIONS_MANAGER (manager)); g_return_if_fail (identifier != NULL); @@ -131,24 +131,23 @@ ephy_extensions_manager_toggle_load (EphyExtensionsManager *manager, g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY); for (i = 0; exts[i]; i++) { + /* Ignore the extension if we are removing it. */ if (g_strcmp0 (exts[i], identifier) == 0) { - dirty = TRUE; - if (status) - break; - else + found = TRUE; + if (!status) continue; } g_variant_builder_add (&builder, "s", exts[i]); } - if (!dirty) - g_settings_set (EPHY_SETTINGS_MAIN, - EPHY_PREFS_ENABLED_EXTENSIONS, - "as", &builder); + if (status && !found) + g_variant_builder_add (&builder, "s", identifier); - g_variant_builder_end (&builder); + g_settings_set (EPHY_SETTINGS_MAIN, + EPHY_PREFS_ENABLED_EXTENSIONS, + "as", &builder); } /** |