42 | 42 |
gint current_icon_id;
|
43 | 43 |
gchar *sortable_name;
|
44 | 44 |
|
|
45 |
gboolean should_activate;
|
|
46 |
gboolean should_replace_tooltip;
|
45 | 47 |
gboolean is_ai;
|
46 | 48 |
};
|
47 | 49 |
|
|
62 | 64 |
|
63 | 65 |
should = g_strv_contains ((const gchar * const *) whitelist, item->sortable_name);
|
64 | 66 |
g_strfreev (whitelist);
|
|
67 |
|
|
68 |
return should;
|
|
69 |
}
|
|
70 |
|
|
71 |
static gboolean
|
|
72 |
should_replace_tooltip (SnItem *item)
|
|
73 |
{
|
|
74 |
gboolean should;
|
|
75 |
|
|
76 |
gchar **ids = g_settings_get_strv (xapp_settings,
|
|
77 |
REPLACE_TOOLTIP_KEY);
|
|
78 |
|
|
79 |
should = g_strv_contains ((const gchar * const *) ids, item->sortable_name);
|
|
80 |
g_strfreev (ids);
|
65 | 81 |
|
66 | 82 |
return should;
|
67 | 83 |
}
|
|
549 | 565 |
item->menu = GTK_WIDGET (dbusmenu_gtkmenu_new ((gchar *) g_dbus_proxy_get_name (item->sn_item_proxy), menu_path));
|
550 | 566 |
g_object_ref_sink (item->menu);
|
551 | 567 |
|
552 | |
if (item->is_ai && !should_activate (item))
|
|
568 |
if (item->is_ai && !item->should_activate)
|
553 | 569 |
{
|
554 | 570 |
xapp_status_icon_set_primary_menu (item->status_icon, GTK_MENU (item->menu));
|
555 | 571 |
}
|
|
585 | 601 |
static void
|
586 | 602 |
update_tooltip (SnItem *item)
|
587 | 603 |
{
|
588 | |
g_autoptr(GVariant) tt_var;
|
589 | |
|
590 | |
tt_var = get_property (item, "ToolTip");
|
|
604 |
g_autoptr(GVariant) tt_var = NULL;
|
|
605 |
|
|
606 |
if (!item->should_replace_tooltip)
|
|
607 |
{
|
|
608 |
tt_var = get_property (item, "ToolTip");
|
|
609 |
}
|
591 | 610 |
|
592 | 611 |
if (tt_var)
|
593 | 612 |
{
|
|
738 | 757 |
{
|
739 | 758 |
if (item->is_ai)
|
740 | 759 |
{
|
741 | |
if (should_activate (item))
|
|
760 |
if (item->should_activate)
|
742 | 761 |
{
|
743 | 762 |
sn_item_interface_call_secondary_activate (SN_ITEM_INTERFACE (item->sn_item_proxy), x, y, NULL, NULL, NULL);
|
744 | 763 |
return;
|
|
816 | 835 |
assign_sortable_name (SnItem *item,
|
817 | 836 |
XAppStatusIcon *status_icon)
|
818 | 837 |
{
|
819 | |
gchar *sortable_name;
|
820 | |
|
821 | |
sortable_name = sn_item_interface_dup_id (SN_ITEM_INTERFACE (item->sn_item_proxy));
|
822 | |
|
823 | |
if (sortable_name == NULL)
|
824 | |
{
|
825 | |
sortable_name = get_string_property (item, "Title");
|
826 | |
}
|
|
838 |
gchar *init_name, *normalized, *sortable_name;
|
|
839 |
|
|
840 |
init_name = sn_item_interface_dup_id (SN_ITEM_INTERFACE (item->sn_item_proxy));
|
|
841 |
|
|
842 |
if (init_name == NULL)
|
|
843 |
{
|
|
844 |
init_name = get_string_property (item, "Title");
|
|
845 |
}
|
|
846 |
|
|
847 |
normalized = g_utf8_normalize (init_name,
|
|
848 |
-1,
|
|
849 |
G_NORMALIZE_DEFAULT);
|
|
850 |
|
|
851 |
sortable_name = g_utf8_strdown (normalized, -1);
|
827 | 852 |
|
828 | 853 |
g_debug ("Sort name for %s is '%s'", g_dbus_proxy_get_name (G_DBUS_PROXY (item->sn_item_proxy)), sortable_name);
|
829 | 854 |
xapp_status_icon_set_name (status_icon, sortable_name);
|
830 | 855 |
|
831 | 856 |
item->sortable_name = sortable_name;
|
|
857 |
|
|
858 |
g_free (init_name);
|
|
859 |
g_free (normalized);
|
832 | 860 |
}
|
833 | 861 |
|
834 | 862 |
static void
|
|
867 | 895 |
g_signal_connect (item->status_icon, "state-changed", G_CALLBACK (xapp_icon_state_changed), item);
|
868 | 896 |
|
869 | 897 |
assign_sortable_name (item, item->status_icon);
|
|
898 |
|
|
899 |
item->should_activate = should_activate (item);
|
|
900 |
item->should_replace_tooltip = should_replace_tooltip (item);
|
870 | 901 |
|
871 | 902 |
update_status (item);
|
872 | 903 |
update_menu (item);
|