From fab51b477ad295de8ae5e030ceef09104feea09b Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Tue, 11 Aug 2020 12:07:23 +0200 Subject: Replace x-canonical attributes --- README.md | 22 ++++++++++----------- include/notifications/notifications.h | 8 ++++---- src/engine-eds.cpp | 4 ++-- src/menu.cpp | 22 ++++++++++----------- src/notifications.cpp | 2 +- tests/test-eds-ics-missing-trigger.ics.in | 4 ++-- tests/test-eds-ics-nonrepeating-events.ics.in | 2 +- tests/test-eds-ics-repeating-events.ics.in | 2 +- tests/test-menus.cpp | 28 +++++++++++++-------------- tests/test-snap.cpp | 2 +- 10 files changed, 48 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 785f3f9..59ce0f4 100644 --- a/README.md +++ b/README.md @@ -54,26 +54,26 @@ ## CUSTOM MENUITEMS * Calendar - - x-canonical-type s "org.ayatana.indicator.calendar" + - x-ayatana-type s "org.ayatana.indicator.calendar" * Alarm - label s short summary of the appointment - - x-canonical-type s "org.ayatana.indicator.alarm" - - x-canonical-time x the date of the appointment - - x-canonical-time-format s strftime format string + - x-ayatana-type s "org.ayatana.indicator.alarm" + - x-ayatana-time x the date of the appointment + - x-ayatana-time-format s strftime format string * Appointment - label s short summary of the appointment - - x-canonical-type s "org.ayatana.indicator.appointment" - - x-canonical-color s color of the appt's type, to give a visual cue - - x-canonical-time x the date of the appointment - - x-canonical-time-format s strftime format string + - x-ayatana-type s "org.ayatana.indicator.appointment" + - x-ayatana-color s color of the appt's type, to give a visual cue + - x-ayatana-time x the date of the appointment + - x-ayatana-time-format s strftime format string * Location - label s the location's name, eg "Oklahoma City" - - x-canonical-type s "org.ayatana.indicator.location" - - x-canonical-timezone s timezone that the location is in - - x-canonical-time-format s strftime format string + - x-ayatana-type s "org.ayatana.indicator.location" + - x-ayatana-timezone s timezone that the location is in + - x-ayatana-time-format s strftime format string diff --git a/include/notifications/notifications.h b/include/notifications/notifications.h index 0de1e23..e3c4389 100644 --- a/include/notifications/notifications.h +++ b/include/notifications/notifications.h @@ -58,10 +58,10 @@ public: /* Add a notification hint. These keys may be dependent on the notification server. */ void add_hint (const std::string& name); - static constexpr char const * HINT_SNAP {"x-canonical-snap-decisions"}; - static constexpr char const * HINT_NONSHAPED_ICON {"x-canonical-non-shaped-icon"}; - static constexpr char const * HINT_AFFIRMATIVE_HINT {"x-canonical-private-affirmative-tint"}; - static constexpr char const * HINT_REJECTION_TINT {"x-canonical-private-rejection-tint"}; + static constexpr char const * HINT_SNAP {"x-ayatana-snap-decisions"}; + static constexpr char const * HINT_NONSHAPED_ICON {"x-ayatana-non-shaped-icon"}; + static constexpr char const * HINT_AFFIRMATIVE_HINT {"x-ayatana-private-affirmative-tint"}; + static constexpr char const * HINT_REJECTION_TINT {"x-ayatana-private-rejection-tint"}; /* Add an action button. This may fail if the Engine doesn't support actions. diff --git a/src/engine-eds.cpp b/src/engine-eds.cpp index f8a4ce8..3120b3f 100644 --- a/src/engine-eds.cpp +++ b/src/engine-eds.cpp @@ -35,8 +35,8 @@ namespace ayatana { namespace indicator { namespace datetime { -static constexpr char const * TAG_ALARM {"x-canonical-alarm"}; -static constexpr char const * TAG_DISABLED {"x-canonical-disabled"}; +static constexpr char const * TAG_ALARM {"x-ayatana-alarm"}; +static constexpr char const * TAG_DISABLED {"x-ayatana-disabled"}; static constexpr char const * X_PROP_ACTIVATION_URL {"X-CANONICAL-ACTIVATION-URL"}; diff --git a/src/menu.cpp b/src/menu.cpp index b8e9728..5469dd1 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -88,7 +88,7 @@ protected: update_header(); }); m_formatter->header_format.changed().connect([this](const std::string&){ - update_section(Locations); // need to update x-canonical-time-format + update_section(Locations); // need to update x-ayatana-time-format }); m_formatter->relative_format_changed.connect([this](){ update_section(Appointments); // uses formatter.relative_format() @@ -219,7 +219,7 @@ private: // add submenu to the header const auto detailed_action = std::string("indicator.") + name() + "-header"; auto header = g_menu_item_new(nullptr, detailed_action.c_str()); - g_menu_item_set_attribute(header, "x-canonical-type", "s", + g_menu_item_set_attribute(header, "x-ayatana-type", "s", "org.ayatana.indicator.root"); g_menu_item_set_attribute(header, "submenu-action", "s", "indicator.calendar-active"); @@ -270,7 +270,7 @@ private: item = g_menu_item_new ("[calendar]", nullptr); v = g_variant_new_int64(0); g_menu_item_set_action_and_target_value (item, "indicator.calendar", v); - g_menu_item_set_attribute (item, "x-canonical-type", + g_menu_item_set_attribute (item, "x-ayatana-type", "s", "org.ayatana.indicator.calendar"); if (action_name != nullptr) g_menu_item_set_attribute (item, "activation-action", "s", action_name); @@ -313,21 +313,21 @@ private: auto unix_time = g_date_time_to_unix(begin); auto menu_item = g_menu_item_new (appt.summary.c_str(), nullptr); - g_menu_item_set_attribute (menu_item, "x-canonical-time", "x", unix_time); - g_menu_item_set_attribute (menu_item, "x-canonical-time-format", "s", fmt.c_str()); + g_menu_item_set_attribute (menu_item, "x-ayatana-time", "x", unix_time); + g_menu_item_set_attribute (menu_item, "x-ayatana-time-format", "s", fmt.c_str()); if (appt.is_ubuntu_alarm()) { - g_menu_item_set_attribute (menu_item, "x-canonical-type", "s", "org.ayatana.indicator.alarm"); + g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.alarm"); g_menu_item_set_attribute_value(menu_item, G_MENU_ATTRIBUTE_ICON, get_serialized_alarm_icon()); } else { - g_menu_item_set_attribute (menu_item, "x-canonical-type", "s", "org.ayatana.indicator.appointment"); + g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.appointment"); } if (!appt.color.empty()) - g_menu_item_set_attribute (menu_item, "x-canonical-color", "s", appt.color.c_str()); + g_menu_item_set_attribute (menu_item, "x-ayatana-color", "s", appt.color.c_str()); if (action_name != nullptr) g_menu_item_set_action_and_target_value (menu_item, action_name, @@ -386,9 +386,9 @@ private: const auto fmt = m_formatter->relative_format(zone_now.get()); auto detailed_action = g_strdup_printf("indicator.set-location::%s %s", zone.c_str(), name.c_str()); auto i = g_menu_item_new (name.c_str(), detailed_action); - g_menu_item_set_attribute(i, "x-canonical-type", "s", "org.ayatana.indicator.location"); - g_menu_item_set_attribute(i, "x-canonical-timezone", "s", zone.c_str()); - g_menu_item_set_attribute(i, "x-canonical-time-format", "s", fmt.c_str()); + g_menu_item_set_attribute(i, "x-ayatana-type", "s", "org.ayatana.indicator.location"); + g_menu_item_set_attribute(i, "x-ayatana-timezone", "s", zone.c_str()); + g_menu_item_set_attribute(i, "x-ayatana-time-format", "s", fmt.c_str()); g_menu_append_item (menu, i); g_object_unref(i); g_free(detailed_action); diff --git a/src/notifications.cpp b/src/notifications.cpp index 051653d..f8782de 100644 --- a/src/notifications.cpp +++ b/src/notifications.cpp @@ -314,7 +314,7 @@ private: // as the name indicates, don't use this directly: use server_caps() instead mutable std::set m_lazy_caps; - static constexpr char const * HINT_TIMEOUT {"x-canonical-snap-decisions-timeout"}; + static constexpr char const * HINT_TIMEOUT {"x-ayatana-snap-decisions-timeout"}; }; /*** diff --git a/tests/test-eds-ics-missing-trigger.ics.in b/tests/test-eds-ics-missing-trigger.ics.in index 0b7881f..01a306c 100644 --- a/tests/test-eds-ics-missing-trigger.ics.in +++ b/tests/test-eds-ics-missing-trigger.ics.in @@ -8,7 +8,7 @@ UID:20150617T211838Z-6217-32011-2036-1@ubuntu-phablet DTSTAMP:20150617T211838Z DTSTART:20150618T100000 SUMMARY:One Time Alarm -CATEGORIES:x-canonical-alarm +CATEGORIES:x-ayatana-alarm CREATED:20150617T211838Z LAST-MODIFIED:20150617T211838Z BEGIN:VALARM @@ -28,7 +28,7 @@ DTSTAMP:20150617T211913Z DTSTART:20150618T100100 RRULE:FREQ=DAILY SUMMARY:Recurring Alarm -CATEGORIES:x-canonical-alarm +CATEGORIES:x-ayatana-alarm CREATED:20150617T211913Z LAST-MODIFIED:20150617T211913Z BEGIN:VALARM diff --git a/tests/test-eds-ics-nonrepeating-events.ics.in b/tests/test-eds-ics-nonrepeating-events.ics.in index be95ed1..6e45450 100644 --- a/tests/test-eds-ics-nonrepeating-events.ics.in +++ b/tests/test-eds-ics-nonrepeating-events.ics.in @@ -8,7 +8,7 @@ UID:20150520T000726Z-3878-32011-1770-81@ubuntu-phablet DTSTAMP:20150520T223932Z DTSTART:20150520T200000 SUMMARY:Alarm -CATEGORIES:x-canonical-alarm +CATEGORIES:x-ayatana-alarm SEQUENCE:1 LAST-MODIFIED:20150520T223932Z BEGIN:VALARM diff --git a/tests/test-eds-ics-repeating-events.ics.in b/tests/test-eds-ics-repeating-events.ics.in index 7c728c6..51679a3 100644 --- a/tests/test-eds-ics-repeating-events.ics.in +++ b/tests/test-eds-ics-repeating-events.ics.in @@ -9,7 +9,7 @@ DTSTAMP:20150508T211449Z DTSTART:20150508T164000 RRULE:FREQ=WEEKLY;BYDAY=FR SUMMARY:Alarm -CATEGORIES:x-canonical-alarm +CATEGORIES:x-ayatana-alarm CREATED:20150507T211449Z LAST-MODIFIED:20150507T211449Z BEGIN:VALARM diff --git a/tests/test-menus.cpp b/tests/test-menus.cpp index dd19487..8650201 100644 --- a/tests/test-menus.cpp +++ b/tests/test-menus.cpp @@ -62,7 +62,7 @@ protected: // check that there's a header menuitem EXPECT_EQ(1,g_menu_model_get_n_items(menu_model)); gchar* str = nullptr; - g_menu_model_get_item_attribute(menu_model, 0, "x-canonical-type", "s", &str); + g_menu_model_get_item_attribute(menu_model, 0, "x-ayatana-type", "s", &str); EXPECT_STREQ("org.ayatana.indicator.root", str); g_clear_pointer(&str, g_free); g_menu_model_get_item_attribute(menu_model, 0, G_MENU_ATTRIBUTE_ACTION, "s", &str); @@ -131,7 +131,7 @@ protected: // look at the calendar menuitem if (calendar_expected) { - g_menu_model_get_item_attribute(section, 1, "x-canonical-type", "s", &str); + g_menu_model_get_item_attribute(section, 1, "x-ayatana-type", "s", &str); EXPECT_STREQ("org.ayatana.indicator.calendar", str); g_clear_pointer(&str, g_free); @@ -205,27 +205,27 @@ private: int index, const Appointment& appt) { - // confirm it has the right x-canonical-type + // confirm it has the right x-ayatana-type gchar * str = nullptr; - g_menu_model_get_item_attribute(section, index, "x-canonical-type", "s", &str); + g_menu_model_get_item_attribute(section, index, "x-ayatana-type", "s", &str); if (appt.is_ubuntu_alarm()) EXPECT_STREQ("org.ayatana.indicator.alarm", str); else EXPECT_STREQ("org.ayatana.indicator.appointment", str); g_clear_pointer(&str, g_free); - // confirm it has a nonempty x-canonical-time-format - g_menu_model_get_item_attribute(section, index, "x-canonical-time-format", "s", &str); + // confirm it has a nonempty x-ayatana-time-format + g_menu_model_get_item_attribute(section, index, "x-ayatana-time-format", "s", &str); EXPECT_TRUE(str && *str); g_clear_pointer(&str, g_free); // confirm the color hint, if it exists, - // is in the x-canonical-color attribute + // is in the x-ayatana-color attribute if (appt.color.empty()) { EXPECT_FALSE(g_menu_model_get_item_attribute(section, index, - "x-canonical-color", + "x-ayatana-color", "s", &str)); } @@ -233,7 +233,7 @@ private: { EXPECT_TRUE(g_menu_model_get_item_attribute(section, index, - "x-canonical-color", + "x-ayatana-color", "s", &str)); EXPECT_EQ(appt.color, str); @@ -398,18 +398,18 @@ protected: { gchar* str = nullptr; - // confirm that the x-canonical-type is right - g_menu_model_get_item_attribute(section, i, "x-canonical-type", "s", &str); + // confirm that the x-ayatana-type is right + g_menu_model_get_item_attribute(section, i, "x-ayatana-type", "s", &str); EXPECT_STREQ("org.ayatana.indicator.location", str); g_clear_pointer(&str, g_free); // confirm that the timezones match the ones in the vector - g_menu_model_get_item_attribute(section, i, "x-canonical-timezone", "s", &str); + g_menu_model_get_item_attribute(section, i, "x-ayatana-timezone", "s", &str); EXPECT_EQ(locations[i].zone(), str); g_clear_pointer(&str, g_free); - // confirm that x-canonical-time-format has some kind of time format string - g_menu_model_get_item_attribute(section, i, "x-canonical-time-format", "s", &str); + // confirm that x-ayatana-time-format has some kind of time format string + g_menu_model_get_item_attribute(section, i, "x-ayatana-time-format", "s", &str); EXPECT_TRUE(str && *str && (strchr(str,'%')!=nullptr)); g_clear_pointer(&str, g_free); } diff --git a/tests/test-snap.cpp b/tests/test-snap.cpp index 1904bef..8a310e4 100644 --- a/tests/test-snap.cpp +++ b/tests/test-snap.cpp @@ -84,7 +84,7 @@ protected: static constexpr char const * SIGNAL_CLOSED {"NotificationClosed"}; - static constexpr char const * HINT_TIMEOUT {"x-canonical-snap-decisions-timeout"}; + static constexpr char const * HINT_TIMEOUT {"x-ayatana-snap-decisions-timeout"}; static constexpr char const * AS_BUSNAME {"org.freedesktop.Accounts"}; static constexpr char const * AS_INTERFACE {"com.ubuntu.touch.AccountsService.Sound"}; -- cgit v1.2.3