[epiphany] ephy-extensions-manager: improve toggle load code
- From: Diego Escalante Urrelo <diegoe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] ephy-extensions-manager: improve toggle load code
- Date: Tue, 12 Oct 2010 02:49:10 +0000 (UTC)
commit 1aa8043ce4334bd6344b36a26d8604b085930c95
Author: Diego Escalante Urrelo <descalante igalia com>
Date: Sun Oct 10 18:11:06 2010 -0500
ephy-extensions-manager: improve toggle load code
g_variant_builder_end is not needed after using the builder with
g_settings_set.
Bug #631839
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 df06b97..850de7f 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);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]