}
+static GVariant *dbus_get_storage_level(GDBusConnection *conn,
+ const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
+ GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
+{
+ int path_id;
+ enum memnoti_level level;
+ char *value;
+
+ g_variant_get(param, "(i)", &path_id);
+
+ if (path_id == TZ_SYS_USER)
+ level = storage_internal_info.current_noti_level;
+ else if (path_id == TZ_SYS_OPT)
+ level = storage_opt_info.current_noti_level;
+ else if (path_id == TZ_SYS_TMP)
+ level = storage_tmp_info.current_noti_level;
+ else
+ level = -1;
+
+ if (level == MEMNOTI_LEVEL_WARNING)
+ value = "warning";
+ else if (level == MEMNOTI_LEVEL_CRITICAL)
+ value = "critical";
+ else if (level == MEMNOTI_LEVEL_FULL)
+ value = "full";
+ else if (level == MEMNOTI_LEVEL_NORMAL)
+ value = "normal";
+ else
+ value = "Not supported path";
+
+ return g_variant_new("(s)", value);
+}
+
static const dbus_method_s storage_methods[] = {
- { "getstorage", NULL, "tt", dbus_getstatus },
- { "GetStatus", "s", "tt", dbus_get_storage_status},
- { "GetStatvfs", "s", "ttttttttttt", dbus_getstatvfs },
+ { "getstorage", NULL, "tt", dbus_getstatus },
+ { "GetStatus", "s", "tt", dbus_get_storage_status },
+ { "GetStatvfs", "s", "ttttttttttt", dbus_getstatvfs },
+ { "GetStorageLevel", "i", "s", dbus_get_storage_level },
/* Add methods here */
};