diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index 177a973349..f023823f78 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -1,3 +1,8 @@ +2012-12-04 Murilo Pinoti Belluzzo (mbelluzzo) + + * Add elm_app_name_set/get(): Formal application name string. + * Add elm_app_destkop_entry_set/get(): Path to '.desktop' file. + 2012-12-03 Gustavo Sverzut Barbieri (k-s) * Add elm_need_edbus(), deprecate elm_need_e_dbus(), integrating diff --git a/legacy/elementary/src/lib/elm_app.h b/legacy/elementary/src/lib/elm_app.h index 86dba27648..6f11d09052 100644 --- a/legacy/elementary/src/lib/elm_app.h +++ b/legacy/elementary/src/lib/elm_app.h @@ -76,6 +76,28 @@ */ EAPI void elm_app_info_set(void *mainfunc, const char *dom, const char *checkfile); +/** + * Set a formal name to be used with the elm application. + * + * @param name Application name. + * + * @since 1.8 + */ +EAPI void elm_app_name_set(const char *name); + +/** + * Set the path to the '.desktop' file to be associated + * with the elm application. + * + * @param path The path to the '.desktop' file + * + * @warning Since this path is very environment dependent, + * this will hold whatever value is passed to it. + * + * @since 1.8 + */ +EAPI void elm_app_desktop_entry_set(const char *path); + /** * Provide information on the @b fallback application's binaries * directory, in scenarios where they get overridden by @@ -143,6 +165,25 @@ EAPI void elm_app_compile_data_dir_set(const char *dir); */ EAPI void elm_app_compile_locale_set(const char *dir); +/** + * Retrieve the application formal name, as set by elm_app_name_set(). + * + * @return The application formal name. + * + * @since 1.8 + */ +EAPI const char *elm_app_name_get(void); + +/** + * Retrieve the path to the '.desktop' file, as set by + * elm_app_desktop_entry_set(). + * + * @return The '.desktop' file path. + * + * @since 1.8 + */ +EAPI const char *elm_app_desktop_entry_get(void); + /** * Retrieve the application's run time prefix directory, as set by * elm_app_info_set() and the way (environment) the application was diff --git a/legacy/elementary/src/lib/elm_main.c b/legacy/elementary/src/lib/elm_main.c index c151603c4c..9a581d8276 100644 --- a/legacy/elementary/src/lib/elm_main.c +++ b/legacy/elementary/src/lib/elm_main.c @@ -119,6 +119,8 @@ _elm_emotion_shutdown(void) } static void *app_mainfunc = NULL; +static const char *app_name = NULL; +static const char *app_desktop_entry = NULL; static const char *app_domain = NULL; static const char *app_checkfile = NULL; @@ -230,6 +232,18 @@ elm_shutdown(void) while (_elm_win_deferred_free) ecore_main_loop_iterate(); // wrningz :( // _prefix_shutdown(); + if (app_name) + { + eina_stringshare_del(app_name); + app_name = NULL; + } + + if (app_desktop_entry) + { + eina_stringshare_del(app_desktop_entry); + app_desktop_entry = NULL; + } + elm_quicklaunch_sub_shutdown(); elm_quicklaunch_shutdown(); return _elm_init_count; @@ -243,6 +257,18 @@ elm_app_info_set(void *mainfunc, const char *dom, const char *checkfile) eina_stringshare_replace(&app_checkfile, checkfile); } +EAPI void +elm_app_name_set(const char *name) +{ + eina_stringshare_replace(&app_name, name); +} + +EAPI void +elm_app_desktop_entry_set(const char *path) +{ + eina_stringshare_replace(&app_desktop_entry, path); +} + EAPI void elm_app_compile_bin_dir_set(const char *dir) { @@ -267,6 +293,22 @@ elm_app_compile_locale_set(const char *dir) eina_stringshare_replace(&app_compile_locale_dir, dir); } +EAPI const char * +elm_app_name_get(void) +{ + if (app_name) return app_name; + + return ""; +} + +EAPI const char * +elm_app_desktop_entry_get(void) +{ + if (app_desktop_entry) return app_desktop_entry; + + return ""; +} + EAPI const char * elm_app_prefix_dir_get(void) { @@ -455,7 +497,11 @@ elm_quicklaunch_init(int argc, _elm_exit_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _elm_signal_exit, NULL); - if (argv) _elm_appname = strdup(ecore_file_file_get(argv[0])); + if (argv) + { + _elm_appname = strdup(ecore_file_file_get(argv[0])); + elm_app_name_set(_elm_appname); + } pfx = eina_prefix_new(argv ? argv[0] : NULL, elm_quicklaunch_init, "ELM", "elementary", "config/profile.cfg",