diff --git a/src/taskbar/taskbaritem.cpp b/src/taskbar/taskbaritem.cpp index 2c2c7af..35bb841 100644 --- a/src/taskbar/taskbaritem.cpp +++ b/src/taskbar/taskbaritem.cpp @@ -58,12 +58,10 @@ namespace Nickvision::Taskbar #elif defined(__linux__) if (m_connection) { - GDBusMessage* message{ g_dbus_message_new_signal(m_objectPath.c_str(), "com.canonical.Unity.LauncherEntry", "Update") }; - GVariant* params[2]{ g_variant_new_string(m_appUri.c_str()), g_variant_new_dict_entry(g_variant_new_string("progress-visible"), g_variant_new_boolean(m_progressState >= ProgressState::Normal)) }; + GVariant* params[2]{ g_variant_new_string(m_appUri.c_str()), g_variant_new("a{sv}", "progress-visible", m_progressState >= ProgressState::Normal) }; GVariant* tuple{ g_variant_new_tuple(params, 2) }; - g_dbus_message_set_body(message, tuple); - g_dbus_connection_send_message(m_connection, message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, nullptr, nullptr); - g_object_unref(G_OBJECT(message)); + g_dbus_connection_emit_signal(m_connection, m_objectPath.c_str(), "com.canonical.Unity.LauncherEntry", "Update", tuple, nullptr); + g_variant_unref(tuple); } #endif } @@ -87,12 +85,10 @@ namespace Nickvision::Taskbar #elif defined(__linux__) if (m_connection) { - GDBusMessage* message{ g_dbus_message_new_signal(m_objectPath.c_str(), "com.canonical.Unity.LauncherEntry", "Update") }; - GVariant* params[2]{ g_variant_new_string(m_appUri.c_str()), g_variant_new_dict_entry(g_variant_new_string("progress"), g_variant_new_double(m_progress)) }; + GVariant* params[2]{ g_variant_new_string(m_appUri.c_str()), g_variant_new("a{sv}", "progress", m_progress) }; GVariant* tuple{ g_variant_new_tuple(params, 2) }; - g_dbus_message_set_body(message, tuple); - g_dbus_connection_send_message(m_connection, message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, nullptr, nullptr); - g_object_unref(G_OBJECT(message)); + g_dbus_connection_emit_signal(m_connection, m_objectPath.c_str(), "com.canonical.Unity.LauncherEntry", "Update", tuple, nullptr); + g_variant_unref(tuple); } #endif } @@ -121,12 +117,10 @@ namespace Nickvision::Taskbar #elif defined(__linux__) if (m_connection) { - GDBusMessage* message{ g_dbus_message_new_signal(m_objectPath.c_str(), "com.canonical.Unity.LauncherEntry", "Update") }; - GVariant* params[2]{ g_variant_new_string(m_appUri.c_str()), g_variant_new_dict_entry(g_variant_new_string("urgent"), g_variant_new_boolean(m_urgent)) }; + GVariant* params[2]{ g_variant_new_string(m_appUri.c_str()), g_variant_new("a{sv}", "urgent", m_urgent) }; GVariant* tuple{ g_variant_new_tuple(params, 2) }; - g_dbus_message_set_body(message, tuple); - g_dbus_connection_send_message(m_connection, message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, nullptr, nullptr); - g_object_unref(G_OBJECT(message)); + g_dbus_connection_emit_signal(m_connection, m_objectPath.c_str(), "com.canonical.Unity.LauncherEntry", "Update", tuple, nullptr); + g_variant_unref(tuple); } #endif } @@ -173,12 +167,10 @@ namespace Nickvision::Taskbar #elif defined(__linux__) if (m_connection) { - GDBusMessage* message{ g_dbus_message_new_signal(m_objectPath.c_str(), "com.canonical.Unity.LauncherEntry", "Update") }; - GVariant* params[2]{ g_variant_new_string(m_appUri.c_str()), g_variant_new_dict_entry(g_variant_new_string("count-visible"), g_variant_new_boolean(m_countVisible)) }; + GVariant* params[2]{ g_variant_new_string(m_appUri.c_str()), g_variant_new("a{sv}", "count-visible", m_countVisible) }; GVariant* tuple{ g_variant_new_tuple(params, 2) }; - g_dbus_message_set_body(message, tuple); - g_dbus_connection_send_message(m_connection, message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, nullptr, nullptr); - g_object_unref(G_OBJECT(message)); + g_dbus_connection_emit_signal(m_connection, m_objectPath.c_str(), "com.canonical.Unity.LauncherEntry", "Update", tuple, nullptr); + g_variant_unref(tuple); } #endif } @@ -197,12 +189,10 @@ namespace Nickvision::Taskbar #ifdef __linux__ if (m_connection) { - GDBusMessage* message{ g_dbus_message_new_signal(m_objectPath.c_str(), "com.canonical.Unity.LauncherEntry", "Update") }; - GVariant* params[2]{ g_variant_new_string(m_appUri.c_str()), g_variant_new_dict_entry(g_variant_new_string("count"), g_variant_new_int64(m_count)) }; + GVariant* params[2]{ g_variant_new_string(m_appUri.c_str()), g_variant_new("a{sv}", "count", m_count) }; GVariant* tuple{ g_variant_new_tuple(params, 2) }; - g_dbus_message_set_body(message, tuple); - g_dbus_connection_send_message(m_connection, message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, nullptr, nullptr); - g_object_unref(G_OBJECT(message)); + g_dbus_connection_emit_signal(m_connection, m_objectPath.c_str(), "com.canonical.Unity.LauncherEntry", "Update", tuple, nullptr); + g_variant_unref(tuple); } #endif }