diff --git a/src/bin/e_utils.c b/src/bin/e_utils.c index 55e7e48a4..da25724f8 100644 --- a/src/bin/e_utils.c +++ b/src/bin/e_utils.c @@ -1475,3 +1475,69 @@ _e_util_image_import_handle_free(E_Util_Image_Import_Handle *handle) E_FREE(handle); } +static int +_e_util_conf_timer_old(void *data) +{ + char *module_name = data; + char buf[4096]; + char *msg = + _("Configuration data needed " + "upgrading. Your old configuration
has been" + " wiped and a new set of defaults initialized. " + "This
will happen regularly during " + "development, so don't report a
bug. " + "This simply means the module needs " + "new configuration
data by default for " + "usable functionality that your old
" + "configuration simply lacks. This new set of " + "defaults will fix
that by adding it in. " + "You can re-configure things now to your
" + "liking. Sorry for the inconvenience.
"); + + snprintf(buf, sizeof(buf),N_("%s Configuration Updated"), module_name); + e_util_dialog_internal(buf, msg); + E_FREE(module_name); + + return 0; +} + +static int +_e_util_conf_timer_new(void *data) +{ + char *module_name = data; + char buf[4096]; + char *msg = + _("Your module configuration is NEWER " + "than the module version. This is " + "very
strange. This should not happen unless" + " you downgraded
the module or " + "copied the configuration from a place where" + "
a newer version of the module " + "was running. This is bad and
as a " + "precaution your configuration has been now " + "restored to
defaults. Sorry for the " + "inconvenience.
"); + + snprintf(buf, sizeof(buf),N_("%s Configuration Updated"), module_name); + e_util_dialog_internal(buf, msg); + E_FREE(module_name); + + return 0; +} + +EAPI Eina_Bool +e_util_module_config_check(const char *module_name, int conf, int epoch, int version) +{ + if ((conf >> 16) < epoch) + { + ecore_timer_add(1.0, _e_util_conf_timer_old, strdup(module_name)); + return EINA_FALSE; + } + else if (conf > version) + { + ecore_timer_add(1.0, _e_util_conf_timer_new, strdup(module_name)); + return EINA_FALSE; + } + + return EINA_TRUE; +} diff --git a/src/bin/e_utils.h b/src/bin/e_utils.h index f4940cf85..dfe56bc40 100644 --- a/src/bin/e_utils.h +++ b/src/bin/e_utils.h @@ -71,6 +71,7 @@ EAPI int e_util_dir_check(const char *dir); EAPI void e_util_defer_object_del(E_Object *obj); EAPI const char *e_util_winid_str_get(Ecore_X_Window win); EAPI void e_util_win_auto_resize_fill(E_Win *win); +EAPI Eina_Bool e_util_module_config_check(const char *module_name, int conf, int epoch, int version); EAPI E_Dialog *e_util_image_import_settings_new(const char *path, void (*cb)(void *data, const char *path, Eina_Bool ok, Eina_Bool external, int quality, E_Image_Import_Mode mode), const void *data); EAPI E_Util_Image_Import_Handle *e_util_image_import(const char *image_path, const char *edje_path, const char *edje_group, Eina_Bool external, int quality, E_Image_Import_Mode mode, void (*cb)(void *data, Eina_Bool ok, const char *image_path, const char *edje_path), const void *data);