aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2013-02-04 10:14:57 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2013-02-04 10:14:57 +0000
commitac9d6f6027bd562e1b941f3db76fc40028144976 (patch)
tree154be5c518ce4d19c1463f4d2ba6af6553821392
parentadd support for edje files in filepreview widget (diff)
downloadenlightenment-ac9d6f6027bd562e1b941f3db76fc40028144976.tar.gz
a really horrendous commit to fix a typo in the xkb changes last week which caused config to be saved wrong
no configs were harmed in the making of this SVN revision: 83586
-rw-r--r--src/bin/e_config.c420
-rw-r--r--src/bin/e_config.h2
2 files changed, 245 insertions, 177 deletions
diff --git a/src/bin/e_config.c b/src/bin/e_config.c
index a8a029dc3..0545aaea6 100644
--- a/src/bin/e_config.c
+++ b/src/bin/e_config.c
@@ -109,80 +109,34 @@ _e_config_profile_name_get(Eet_File *ef)
return s;
}
-/* externally accessible functions */
-EINTERN int
-e_config_init(void)
+static void
+_e_config_edd_shutdown(void)
{
- E_EVENT_CONFIG_ICON_THEME = ecore_event_type_new();
- E_EVENT_CONFIG_MODE_CHANGED = ecore_event_type_new();
- E_EVENT_CONFIG_LOADED = ecore_event_type_new();
-
- /* if environment var set - use this profile name */
- _e_config_profile = eina_stringshare_add(getenv("E_CONF_PROFILE"));
-
- if (!_e_config_profile)
- {
- Eet_File *ef;
- char buf[PATH_MAX];
-
- /* try user profile config */
- e_user_dir_concat_static(buf, "config/profile.cfg");
- ef = eet_open(buf, EET_FILE_MODE_READ);
- if (ef)
- {
- _e_config_profile = _e_config_profile_name_get(ef);
- eet_close(ef);
- ef = NULL;
- }
- if (!_e_config_profile)
- {
- int i;
-
- for (i = 1; i <= _e_config_revisions; i++)
- {
- e_user_dir_snprintf(buf, sizeof(buf), "config/profile.%i.cfg", i);
- ef = eet_open(buf, EET_FILE_MODE_READ);
- if (ef)
- {
- _e_config_profile = _e_config_profile_name_get(ef);
- eet_close(ef);
- ef = NULL;
- if (_e_config_profile) break;
- }
- }
- if (!_e_config_profile)
- {
- /* use system if no user profile config */
- e_prefix_data_concat_static(buf, "data/config/profile.cfg");
- ef = eet_open(buf, EET_FILE_MODE_READ);
- }
- }
- if (ef)
- {
- _e_config_profile = _e_config_profile_name_get(ef);
- eet_close(ef);
- ef = NULL;
- }
- if (!_e_config_profile)
- {
- /* no profile config - try other means */
- char *lnk = NULL;
+ E_CONFIG_DD_FREE(_e_config_edd);
+ E_CONFIG_DD_FREE(_e_config_module_edd);
+ E_CONFIG_DD_FREE(_e_config_font_default_edd);
+ E_CONFIG_DD_FREE(_e_config_font_fallback_edd);
+ E_CONFIG_DD_FREE(_e_config_theme_edd);
+ E_CONFIG_DD_FREE(_e_config_path_append_edd);
+ E_CONFIG_DD_FREE(_e_config_desktop_bg_edd);
+ E_CONFIG_DD_FREE(_e_config_desklock_bg_edd);
+ E_CONFIG_DD_FREE(_e_config_desktop_name_edd);
+ E_CONFIG_DD_FREE(_e_config_desktop_window_profile_edd);
+ E_CONFIG_DD_FREE(_e_config_remember_edd);
+ E_CONFIG_DD_FREE(_e_config_gadcon_edd);
+ E_CONFIG_DD_FREE(_e_config_gadcon_client_edd);
+ E_CONFIG_DD_FREE(_e_config_shelf_edd);
+ E_CONFIG_DD_FREE(_e_config_shelf_desk_edd);
+ E_CONFIG_DD_FREE(_e_config_mime_icon_edd);
+ E_CONFIG_DD_FREE(_e_config_syscon_action_edd);
+ E_CONFIG_DD_FREE(_e_config_env_var_edd);
+ E_CONFIG_DD_FREE(_e_config_xkb_layout_edd);
+ E_CONFIG_DD_FREE(_e_config_xkb_option_edd);
+}
- /* check symlink - if default is a symlink to another dir */
- e_prefix_data_concat_static(buf, "data/config/default");
- lnk = ecore_file_readlink(buf);
- /* if so use just the filename as the profile - must be a local link */
- if (lnk)
- {
- _e_config_profile = eina_stringshare_add(ecore_file_file_get(lnk));
- free(lnk);
- }
- else
- _e_config_profile = eina_stringshare_add("default");
- }
- if (!getenv("E_CONF_PROFILE"))
- e_util_env_set("E_CONF_PROFILE", _e_config_profile);
- }
+static void
+_e_config_edd_init(Eina_Bool old)
+{
_e_config_gadcon_client_edd = E_CONFIG_DD_NEW("E_Config_Gadcon_Client", E_Config_Gadcon_Client);
#undef T
@@ -330,86 +284,6 @@ e_config_init(void)
#define D _e_config_font_fallback_edd
E_CONFIG_VAL(D, T, name, STR);
- _e_config_bindings_mouse_edd = E_CONFIG_DD_NEW("E_Config_Binding_Mouse",
- E_Config_Binding_Mouse);
-#undef T
-#undef D
-#define T E_Config_Binding_Mouse
-#define D _e_config_bindings_mouse_edd
- E_CONFIG_VAL(D, T, context, INT);
- E_CONFIG_VAL(D, T, modifiers, INT);
- E_CONFIG_VAL(D, T, action, STR);
- E_CONFIG_VAL(D, T, params, STR);
- E_CONFIG_VAL(D, T, button, UCHAR);
- E_CONFIG_VAL(D, T, any_mod, UCHAR);
-
- _e_config_bindings_key_edd = E_CONFIG_DD_NEW("E_Config_Binding_Key",
- E_Config_Binding_Key);
-#undef T
-#undef D
-#define T E_Config_Binding_Key
-#define D _e_config_bindings_key_edd
- E_CONFIG_VAL(D, T, context, INT);
- E_CONFIG_VAL(D, T, modifiers, INT);
- E_CONFIG_VAL(D, T, key, STR);
- E_CONFIG_VAL(D, T, action, STR);
- E_CONFIG_VAL(D, T, params, STR);
- E_CONFIG_VAL(D, T, any_mod, UCHAR);
-
- _e_config_bindings_edge_edd = E_CONFIG_DD_NEW("E_Config_Binding_Edge",
- E_Config_Binding_Edge);
-#undef T
-#undef D
-#define T E_Config_Binding_Edge
-#define D _e_config_bindings_edge_edd
- E_CONFIG_VAL(D, T, context, INT);
- E_CONFIG_VAL(D, T, modifiers, INT);
- E_CONFIG_VAL(D, T, action, STR);
- E_CONFIG_VAL(D, T, params, STR);
- E_CONFIG_VAL(D, T, edge, UCHAR);
- E_CONFIG_VAL(D, T, any_mod, UCHAR);
- E_CONFIG_VAL(D, T, delay, FLOAT);
-
- _e_config_bindings_signal_edd = E_CONFIG_DD_NEW("E_Config_Binding_Signal",
- E_Config_Binding_Signal);
-#undef T
-#undef D
-#define T E_Config_Binding_Signal
-#define D _e_config_bindings_signal_edd
- E_CONFIG_VAL(D, T, context, INT);
- E_CONFIG_VAL(D, T, signal, STR);
- E_CONFIG_VAL(D, T, source, STR);
- E_CONFIG_VAL(D, T, modifiers, INT);
- E_CONFIG_VAL(D, T, any_mod, UCHAR);
- E_CONFIG_VAL(D, T, action, STR);
- E_CONFIG_VAL(D, T, params, STR);
-
- _e_config_bindings_wheel_edd = E_CONFIG_DD_NEW("E_Config_Binding_Wheel",
- E_Config_Binding_Wheel);
-#undef T
-#undef D
-#define T E_Config_Binding_Wheel
-#define D _e_config_bindings_wheel_edd
- E_CONFIG_VAL(D, T, context, INT);
- E_CONFIG_VAL(D, T, direction, INT);
- E_CONFIG_VAL(D, T, z, INT);
- E_CONFIG_VAL(D, T, modifiers, INT);
- E_CONFIG_VAL(D, T, any_mod, UCHAR);
- E_CONFIG_VAL(D, T, action, STR);
- E_CONFIG_VAL(D, T, params, STR);
-
- _e_config_bindings_acpi_edd = E_CONFIG_DD_NEW("E_Config_Binding_Acpi",
- E_Config_Binding_Acpi);
-#undef T
-#undef D
-#define T E_Config_Binding_Acpi
-#define D _e_config_bindings_acpi_edd
- E_CONFIG_VAL(D, T, context, INT);
- E_CONFIG_VAL(D, T, type, INT);
- E_CONFIG_VAL(D, T, status, INT);
- E_CONFIG_VAL(D, T, action, STR);
- E_CONFIG_VAL(D, T, params, STR);
-
_e_config_remember_edd = E_CONFIG_DD_NEW("E_Remember", E_Remember);
#undef T
#undef D
@@ -958,9 +832,18 @@ e_config_init(void)
E_CONFIG_VAL(D, T, xkb.only_label, INT);
E_CONFIG_VAL(D, T, xkb.default_model, STR);
- E_CONFIG_SUB(D, T, xkb.current_layout, _e_config_xkb_option_edd);
- E_CONFIG_SUB(D, T, xkb.sel_layout, _e_config_xkb_option_edd);
- E_CONFIG_SUB(D, T, xkb.lock_layout, _e_config_xkb_option_edd);
+ if (old)
+ {
+ E_CONFIG_SUB(D, T, xkb.current_layout, _e_config_xkb_option_edd);
+ E_CONFIG_SUB(D, T, xkb.sel_layout, _e_config_xkb_option_edd);
+ E_CONFIG_SUB(D, T, xkb.lock_layout, _e_config_xkb_option_edd);
+ }
+ else
+ {
+ E_CONFIG_SUB(D, T, xkb.current_layout, _e_config_xkb_layout_edd);
+ E_CONFIG_SUB(D, T, xkb.sel_layout, _e_config_xkb_layout_edd);
+ E_CONFIG_SUB(D, T, xkb.lock_layout, _e_config_xkb_layout_edd);
+ }
E_CONFIG_VAL(D, T, xkb.selected_layout, STR);
E_CONFIG_VAL(D, T, xkb.cur_layout, STR);
E_CONFIG_VAL(D, T, xkb.desklock_layout, STR);
@@ -969,6 +852,164 @@ e_config_init(void)
E_CONFIG_VAL(D, T, exe_always_single_instance, UCHAR);
E_CONFIG_VAL(D, T, use_desktop_window_profile, INT);
+}
+
+/* externally accessible functions */
+EINTERN int
+e_config_init(void)
+{
+ E_EVENT_CONFIG_ICON_THEME = ecore_event_type_new();
+ E_EVENT_CONFIG_MODE_CHANGED = ecore_event_type_new();
+ E_EVENT_CONFIG_LOADED = ecore_event_type_new();
+
+ /* if environment var set - use this profile name */
+ _e_config_profile = eina_stringshare_add(getenv("E_CONF_PROFILE"));
+
+ if (!_e_config_profile)
+ {
+ Eet_File *ef;
+ char buf[PATH_MAX];
+
+ /* try user profile config */
+ e_user_dir_concat_static(buf, "config/profile.cfg");
+ ef = eet_open(buf, EET_FILE_MODE_READ);
+ if (ef)
+ {
+ _e_config_profile = _e_config_profile_name_get(ef);
+ eet_close(ef);
+ ef = NULL;
+ }
+ if (!_e_config_profile)
+ {
+ int i;
+
+ for (i = 1; i <= _e_config_revisions; i++)
+ {
+ e_user_dir_snprintf(buf, sizeof(buf), "config/profile.%i.cfg", i);
+ ef = eet_open(buf, EET_FILE_MODE_READ);
+ if (ef)
+ {
+ _e_config_profile = _e_config_profile_name_get(ef);
+ eet_close(ef);
+ ef = NULL;
+ if (_e_config_profile) break;
+ }
+ }
+ if (!_e_config_profile)
+ {
+ /* use system if no user profile config */
+ e_prefix_data_concat_static(buf, "data/config/profile.cfg");
+ ef = eet_open(buf, EET_FILE_MODE_READ);
+ }
+ }
+ if (ef)
+ {
+ _e_config_profile = _e_config_profile_name_get(ef);
+ eet_close(ef);
+ ef = NULL;
+ }
+ if (!_e_config_profile)
+ {
+ /* no profile config - try other means */
+ char *lnk = NULL;
+
+ /* check symlink - if default is a symlink to another dir */
+ e_prefix_data_concat_static(buf, "data/config/default");
+ lnk = ecore_file_readlink(buf);
+ /* if so use just the filename as the profile - must be a local link */
+ if (lnk)
+ {
+ _e_config_profile = eina_stringshare_add(ecore_file_file_get(lnk));
+ free(lnk);
+ }
+ else
+ _e_config_profile = eina_stringshare_add("default");
+ }
+ if (!getenv("E_CONF_PROFILE"))
+ e_util_env_set("E_CONF_PROFILE", _e_config_profile);
+ }
+
+ _e_config_bindings_mouse_edd = E_CONFIG_DD_NEW("E_Config_Binding_Mouse",
+ E_Config_Binding_Mouse);
+#undef T
+#undef D
+#define T E_Config_Binding_Mouse
+#define D _e_config_bindings_mouse_edd
+ E_CONFIG_VAL(D, T, context, INT);
+ E_CONFIG_VAL(D, T, modifiers, INT);
+ E_CONFIG_VAL(D, T, action, STR);
+ E_CONFIG_VAL(D, T, params, STR);
+ E_CONFIG_VAL(D, T, button, UCHAR);
+ E_CONFIG_VAL(D, T, any_mod, UCHAR);
+
+ _e_config_bindings_key_edd = E_CONFIG_DD_NEW("E_Config_Binding_Key",
+ E_Config_Binding_Key);
+#undef T
+#undef D
+#define T E_Config_Binding_Key
+#define D _e_config_bindings_key_edd
+ E_CONFIG_VAL(D, T, context, INT);
+ E_CONFIG_VAL(D, T, modifiers, INT);
+ E_CONFIG_VAL(D, T, key, STR);
+ E_CONFIG_VAL(D, T, action, STR);
+ E_CONFIG_VAL(D, T, params, STR);
+ E_CONFIG_VAL(D, T, any_mod, UCHAR);
+
+ _e_config_bindings_edge_edd = E_CONFIG_DD_NEW("E_Config_Binding_Edge",
+ E_Config_Binding_Edge);
+#undef T
+#undef D
+#define T E_Config_Binding_Edge
+#define D _e_config_bindings_edge_edd
+ E_CONFIG_VAL(D, T, context, INT);
+ E_CONFIG_VAL(D, T, modifiers, INT);
+ E_CONFIG_VAL(D, T, action, STR);
+ E_CONFIG_VAL(D, T, params, STR);
+ E_CONFIG_VAL(D, T, edge, UCHAR);
+ E_CONFIG_VAL(D, T, any_mod, UCHAR);
+ E_CONFIG_VAL(D, T, delay, FLOAT);
+
+ _e_config_bindings_signal_edd = E_CONFIG_DD_NEW("E_Config_Binding_Signal",
+ E_Config_Binding_Signal);
+#undef T
+#undef D
+#define T E_Config_Binding_Signal
+#define D _e_config_bindings_signal_edd
+ E_CONFIG_VAL(D, T, context, INT);
+ E_CONFIG_VAL(D, T, signal, STR);
+ E_CONFIG_VAL(D, T, source, STR);
+ E_CONFIG_VAL(D, T, modifiers, INT);
+ E_CONFIG_VAL(D, T, any_mod, UCHAR);
+ E_CONFIG_VAL(D, T, action, STR);
+ E_CONFIG_VAL(D, T, params, STR);
+
+ _e_config_bindings_wheel_edd = E_CONFIG_DD_NEW("E_Config_Binding_Wheel",
+ E_Config_Binding_Wheel);
+#undef T
+#undef D
+#define T E_Config_Binding_Wheel
+#define D _e_config_bindings_wheel_edd
+ E_CONFIG_VAL(D, T, context, INT);
+ E_CONFIG_VAL(D, T, direction, INT);
+ E_CONFIG_VAL(D, T, z, INT);
+ E_CONFIG_VAL(D, T, modifiers, INT);
+ E_CONFIG_VAL(D, T, any_mod, UCHAR);
+ E_CONFIG_VAL(D, T, action, STR);
+ E_CONFIG_VAL(D, T, params, STR);
+
+ _e_config_bindings_acpi_edd = E_CONFIG_DD_NEW("E_Config_Binding_Acpi",
+ E_Config_Binding_Acpi);
+#undef T
+#undef D
+#define T E_Config_Binding_Acpi
+#define D _e_config_bindings_acpi_edd
+ E_CONFIG_VAL(D, T, context, INT);
+ E_CONFIG_VAL(D, T, type, INT);
+ E_CONFIG_VAL(D, T, status, INT);
+ E_CONFIG_VAL(D, T, action, STR);
+ E_CONFIG_VAL(D, T, params, STR);
+
+ _e_config_edd_init(EINA_FALSE);
_e_config_binding_edd = E_CONFIG_DD_NEW("E_Config_Bindings", E_Config_Bindings);
#undef T
@@ -993,33 +1034,14 @@ EINTERN int
e_config_shutdown(void)
{
eina_stringshare_del(_e_config_profile);
- E_CONFIG_DD_FREE(_e_config_edd);
E_CONFIG_DD_FREE(_e_config_binding_edd);
- E_CONFIG_DD_FREE(_e_config_module_edd);
- E_CONFIG_DD_FREE(_e_config_font_default_edd);
- E_CONFIG_DD_FREE(_e_config_font_fallback_edd);
- E_CONFIG_DD_FREE(_e_config_theme_edd);
E_CONFIG_DD_FREE(_e_config_bindings_mouse_edd);
E_CONFIG_DD_FREE(_e_config_bindings_key_edd);
E_CONFIG_DD_FREE(_e_config_bindings_edge_edd);
E_CONFIG_DD_FREE(_e_config_bindings_signal_edd);
E_CONFIG_DD_FREE(_e_config_bindings_wheel_edd);
E_CONFIG_DD_FREE(_e_config_bindings_acpi_edd);
- E_CONFIG_DD_FREE(_e_config_path_append_edd);
- E_CONFIG_DD_FREE(_e_config_desktop_bg_edd);
- E_CONFIG_DD_FREE(_e_config_desklock_bg_edd);
- E_CONFIG_DD_FREE(_e_config_desktop_name_edd);
- E_CONFIG_DD_FREE(_e_config_desktop_window_profile_edd);
- E_CONFIG_DD_FREE(_e_config_remember_edd);
- E_CONFIG_DD_FREE(_e_config_gadcon_edd);
- E_CONFIG_DD_FREE(_e_config_gadcon_client_edd);
- E_CONFIG_DD_FREE(_e_config_shelf_edd);
- E_CONFIG_DD_FREE(_e_config_shelf_desk_edd);
- E_CONFIG_DD_FREE(_e_config_mime_icon_edd);
- E_CONFIG_DD_FREE(_e_config_syscon_action_edd);
- E_CONFIG_DD_FREE(_e_config_env_var_edd);
- E_CONFIG_DD_FREE(_e_config_xkb_layout_edd);
- E_CONFIG_DD_FREE(_e_config_xkb_option_edd);
+ _e_config_edd_shutdown();
//E_CONFIG_DD_FREE(_e_config_randr_serialized_setup_edd);
return 1;
}
@@ -1071,8 +1093,54 @@ e_config_load(void)
e_config = e_config_domain_load("e", _e_config_edd);
}
}
- if (!e_config)
+ while (!e_config)
{
+ _e_config_edd_shutdown();
+ _e_config_edd_init(EINA_TRUE);
+ e_config = e_config_domain_load("e", _e_config_edd);
+ /* I made a c&p error here and fucked the world, so this ugliness
+ * will be my public mark of shame until E19 :/
+ * -zmike, 2013
+ */
+ if (e_config)
+ {
+ Eina_List *l;
+ E_Config_XKB_Layout *cl;
+ int set = 0;
+
+ /* this is essentially CONFIG_VERSION_CHECK(7) */
+ INF("Performing config upgrade to %d.%d", 1, 7);
+ _e_config_edd_shutdown();
+ _e_config_edd_init(EINA_FALSE);
+ set += !!e_config->xkb.current_layout;
+ set += !!e_config->xkb.sel_layout;
+ set += !!e_config->xkb.lock_layout;
+ EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl)
+ {
+ if (e_config->xkb.current_layout && (e_config->xkb.current_layout->name == cl->name))
+ {
+ e_config->xkb.current_layout->model = eina_stringshare_ref(cl->model);
+ e_config->xkb.current_layout->variant = eina_stringshare_ref(cl->variant);
+ set--;
+ }
+ if (e_config->xkb.sel_layout && (e_config->xkb.sel_layout->name == cl->name))
+ {
+ e_config->xkb.sel_layout->model = eina_stringshare_ref(cl->model);
+ e_config->xkb.sel_layout->variant = eina_stringshare_ref(cl->variant);
+ set--;
+ }
+ if (e_config->xkb.lock_layout && (e_config->xkb.lock_layout->name == cl->name))
+ {
+ e_config->xkb.lock_layout->model = eina_stringshare_ref(cl->model);
+ e_config->xkb.lock_layout->variant = eina_stringshare_ref(cl->variant);
+ set--;
+ }
+ if (!set) break;
+ }
+ break;
+ }
+#undef T
+#undef D
e_config_profile_set("default");
if (!reload) e_config_profile_del(e_config_profile_get());
e_config_save_block_set(1);
diff --git a/src/bin/e_config.h b/src/bin/e_config.h
index eaecdab30..30a6d3df4 100644
--- a/src/bin/e_config.h
+++ b/src/bin/e_config.h
@@ -40,7 +40,7 @@ typedef struct E_Config_Bindings E_Config_Bindings;
/* increment this whenever a new set of config values are added but the users
* config doesn't need to be wiped - simply new values need to be put in
*/
-#define E_CONFIG_FILE_GENERATION 6
+#define E_CONFIG_FILE_GENERATION 7
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH * 1000000) + E_CONFIG_FILE_GENERATION)
#define E_CONFIG_BINDINGS_VERSION 0 // DO NOT INCREMENT UNLESS YOU WANT TO WIPE ALL BINDINGS!!!!!