static void remove_otg_popup(const struct popup_ops *ops, char *path)
{
int len;
- char *popup_path;
+ char *popup_path = NULL;
if (ops == &storage_mounted_ops)
popup_path = added_path;
{
app_control_h app_control;
- int ret, i, type_len;
+ int ret = -1, i, type_len;
type_len = ARRAY_SIZE(app_type);
for (i = 0 ; i < ARRAY_SIZE(app_type) ; i++) {
break;
}
if (i == type_len) {
- _E("Invalid type (%d)", type);
+ _E("Invalid type(%d).", type);
return;
}
else if (type == 1)
ret = app_control_set_app_id(app_control, GALLERY_APPNAME);
else {
- _E("No matched type(%d)", type);
- return;
+ _E("No matched type(%d).", type);
+ goto out;
}
if (ret != APP_CONTROL_ERROR_NONE) {
- (void)app_control_destroy(app_control);
- return;
+ _E("Failed to set app id.");
+ goto out;
}
ret = app_control_send_launch_request(app_control, NULL, NULL);
if (ret != APP_CONTROL_ERROR_NONE)
- _E("Failed to send launch request");
+ _E("Fail to send launch request.");
- (void)app_control_destroy(app_control);
+out:
+ if (app_control) {
+ (void)app_control_destroy(app_control);
+ app_control = NULL;
+ }
}
static void storage_browse(const struct popup_ops *ops)
DEVICED_IFACE_USBHOST,
SIGNAL_NAME_UNMOUNT, "s", param);
if (ret < 0)
- _E("FAIL: broadcast_dbus_signal()");
+ _E("Failed to broadcast_dbus_signal().");
memset(removed_path, 0, sizeof(removed_path));
static int storage_mounted_launch(bundle *b, const struct popup_ops *ops)
{
- int ret;
- struct object_ops *obj;
char *path;
if (!ops)
return -1;
- ret = get_object_by_ops(ops, &obj);
- if (ret < 0) {
- _E("Failed to get object (%d)", ret);
- return -2;
- }
-
- path = (char *)bundle_get_val(obj->b, USB_MOUNT_PATH);
+ path = (char *)bundle_get_val(b, USB_MOUNT_PATH);
if (!path) {
- _E("Failed to get mount path");
- return -3;
+ _E("Failed to get mount path.");
+ return -2;
}
- _I("USB storage mount path (%s)", path);
+ _I("USB storage mount path(%s).", path);
snprintf(added_path, sizeof(added_path), "%s", path);
return 0;
}
static int unmount_storage_launch(bundle *b, const struct popup_ops *ops)
{
- int ret;
- struct object_ops *obj;
char *path;
if (!ops)
return -1;
- ret = get_object_by_ops(ops, &obj);
- _D("ops = %s obj = %s", ops, obj);
- if (ret < 0) {
- _E("Failed to get object (%d)", ret);
- return -2;
- }
-
- path = (char *)bundle_get_val(obj->b, USB_MOUNT_PATH);
+ path = (char *)bundle_get_val(b, USB_MOUNT_PATH);
if (!path) {
- _E("Failed to get mount path");
- return -3;
+ _E("Failed to get mount path.");
+ return -2;
}
remove_otg_popup(&storage_mounted_ops, path);
path = (char *)bundle_get_val(b, USB_MOUNT_PATH);
if (!path) {
- _E("Failed to get mount path");
+ _E("Failed to get mount path.");
return -ENOENT;
}