Skip to content

Commit

Permalink
Taskbar - Fix Linux Dbus
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Jan 28, 2024
1 parent e12a2dc commit fddb8e1
Showing 1 changed file with 15 additions and 25 deletions.
40 changes: 15 additions & 25 deletions src/taskbar/taskbaritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit fddb8e1

Please sign in to comment.