/* Return TRUE to tell the event loop we want to be called again */
return MS_MEDIA_ERR_NONE;
}
-
-int media_db_update_send_v2(int pid, /* mandatory */
- media_item_type_e item, /* mandatory */
- media_item_update_type_e update_type, /* mandatory */
- char* path, /* mandatory */
- char* uuid, /* optional */
- media_type_e media_type, /* optional */
- char *mime_type /* optional */
- )
-{
- GVariant *message = NULL;
- GDBusConnection *bus = NULL;
- GError *error = NULL;
-
- bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
- if (!bus) {
- MSAPI_DBG("Failed to get gdbus connection: %s", error->message);
- g_error_free(error);
- return MS_MEDIA_ERR_INTERNAL;
- }
-
- if (item == MS_MEDIA_ITEM_FILE) {
- MSAPI_DBG("FILE CHANGED");
- if (uuid != NULL && mime_type != NULL) {
- /* fill all datas */
- message = g_variant_new("(iiissis)", item, pid, update_type, path, uuid, media_type, mime_type);
- } else {
- MSAPI_DBG_ERR("uuid or mime_type is NULL");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
- } else if (item == MS_MEDIA_ITEM_DIRECTORY) {
- MSAPI_DBG("DIRECTORY CHANGED");
- /* fill all datas */
- if (uuid != NULL) {
- message = g_variant_new("(iiiss)", item, pid, update_type, path, uuid);
- } else {
- message = g_variant_new("(iiis)", item, pid, update_type, path);
- }
- } else {
- MSAPI_DBG("this request is wrong");
- }
-
- gboolean emmiting = g_dbus_connection_emit_signal(
- bus,
- NULL,
- MS_MEDIA_DBUS_PATH,
- MS_MEDIA_DBUS_INTERFACE,
- MS_MEDIA_DBUS_NAME,
- message,
- &error);
- if (!emmiting) {
- MSAPI_DBG_ERR("g_dbus_connection_emit_signal failed : %s", error ? error->message : "none");
- if (error) {
- MSAPI_DBG_ERR("Error in g_dbus_connection_emit_signal");
- g_object_unref(bus);
- g_error_free(error);
- }
- return MS_MEDIA_ERR_INTERNAL;
- }
- MSAPI_DBG("success send notification");
-
- gboolean flush = FALSE;
- flush = g_dbus_connection_flush_sync(bus, NULL, &error);
- if (!flush) {
- MSAPI_DBG_ERR("g_dbus_connection_flush_sync failed");
- if (error) {
- MSAPI_DBG_ERR("error : [%s]", error->message);
- g_object_unref(bus);
- g_error_free(error);
- return MS_MEDIA_ERR_INTERNAL;
- }
- }
-
- g_object_unref(bus);
-
- /* Return TRUE to tell the event loop we want to be called again */
- return MS_MEDIA_ERR_NONE;
-}
-