#include <unistd.h>
#include <grp.h>
#include <X11/Xlib.h>
+#include <ail.h>
#include "util_log.h"
#include "crash-popup.h"
#define KEY_ESC_ON_KEYBOARD "Escape"
+static char *appname[256];
+
/**
* callback function of ECORE_EVENT_KEY_DOWN
*/
elm_shutdown();
elm_exit();
}
+
+static ail_cb_ret_e appinfo_get_name_func(const ail_appinfo_h appinfo, void *user_data)
+{
+ char *str;
+ ail_cb_ret_e ret = AIL_CB_RET_CONTINUE;
+
+ ret = ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &str);
+ if (str) {
+ snprintf(appname, sizeof(appname), "%s", str);
+ ret = AIL_CB_RET_CANCEL;
+ }
+
+ return ret;
+}
+
+static int get_appname_by_exepath(const char *exepath)
+{
+ ail_filter_h f;
+ ail_error_e ret;
+ int count, r;
+
+ if (!exepath)
+ return -EINVAL;
+
+ ret = ail_filter_new(&f);
+ if (ret != AIL_ERROR_OK) {
+ _E("FAIL: ail_filter_new()");
+ return -EINVAL;
+ }
+
+ ret = ail_filter_add_str(f, AIL_PROP_EXEC_STR, exepath);
+ if (ret != AIL_ERROR_OK) {
+ _E("FAIL: ail_filter_add_str()");
+ r = -EINVAL;
+ goto out;
+ }
+
+ ret = ail_filter_count_appinfo(f, &count);
+ if (ret != AIL_ERROR_OK) {
+ _E("FAIL: ail_filter_count_appinfo()");
+ r = -EINVAL;
+ goto out;
+ }
+
+ if (count < 1) {
+ _E("There is no app matching to the exepath");
+ r = -EINVAL;
+ goto out;
+ }
+
+ ret = ail_filter_list_appinfo_foreach(f, appinfo_get_name_func, NULL);
+ if (ret != AIL_ERROR_OK) {
+ _E("FAIL: ail_filter_list_appinfo_foreach()");
+ r = -EINVAL;
+ goto out;
+ }
+
+ r = 0;
+
+out:
+ ail_filter_destroy(f);
+ return r;
+}
+
static void add_sorry_popup(struct appdata *ad)
{
Evas_Object *pu, *bt1;
char buf[512] = {0, };
- char *r;
+ char *name;
+ int ret;
+
+ ret = get_appname_by_exepath(ad->exepath);
+ if (ret < 0)
+ name = ad->appname;
+ else
+ name = appname;
snprintf(buf, sizeof(buf),
- _("IDS_ST_BODY_PS_HAS_CLOSED_UNEXPECTEDLY"), ad->appname);
+ _("IDS_ST_BODY_PS_HAS_CLOSED_UNEXPECTEDLY"), name);
pu = elm_popup_add(ad->win);
elm_object_text_set(pu, buf);
bt1 = elm_button_add(pu);
setuid(pw->pw_uid);
_D("argc(%d)\n", argc);
- if (argc < 2) {
+ if (argc < 3) {
_D("argc is (%d) wrong argument\n", argc);
return -1;
}
appcore_measure_time_from("APP_START_TIME"));
memset(&ad, 0x0, sizeof(struct appdata));
snprintf(ad.appname, sizeof(ad.appname), "%s", argv[1]);
+ snprintf(ad.exepath, sizeof(ad.exepath), "%s", argv[2]);
ops.data = &ad;
return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
}