diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-03-24 16:18:12 +0000 |
---|---|---|
committer | CI bot <ps-jenkins@lists.canonical.com> | 2014-03-24 16:18:12 +0000 |
commit | 45abbf3db686fd87ed5eb3eef38618ffe0eedb8a (patch) | |
tree | e23159158aaa9d0879c3571aac61ec230638186a /src/menu.cpp | |
parent | 7a6e36e548f574ba1e6ea49af63b2ce0397a848f (diff) | |
parent | f88a1cf792c1b8786db5f447fed148fcd2166d07 (diff) | |
download | ayatana-indicator-datetime-45abbf3db686fd87ed5eb3eef38618ffe0eedb8a.tar.gz ayatana-indicator-datetime-45abbf3db686fd87ed5eb3eef38618ffe0eedb8a.tar.bz2 ayatana-indicator-datetime-45abbf3db686fd87ed5eb3eef38618ffe0eedb8a.zip |
Change the desktop menu's settings menuitem's label to match the spec. Fixes: 1296585
Diffstat (limited to 'src/menu.cpp')
-rw-r--r-- | src/menu.cpp | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/src/menu.cpp b/src/menu.cpp index 2bfc4aa..6cd1585 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -234,22 +234,28 @@ private: GMenuModel* create_calendar_section(Profile profile) { - const bool allow_activation = (profile == Desktop) - || (profile == Phone); const bool show_calendar = m_state->settings->show_calendar.get() && ((profile == Desktop) || (profile == DesktopGreeter)); auto menu = g_menu_new(); + const char * action_name; + + if (profile == Phone) + action_name = "indicator.phone.open-calendar-app"; + else if (profile == Desktop) + action_name = "indicator.desktop.open-calendar-app"; + else + action_name = nullptr; + // add a menuitem that shows the current date auto label = m_state->clock->localtime().format(_("%A, %e %B %Y")); auto item = g_menu_item_new (label.c_str(), nullptr); auto v = get_serialized_calendar_icon(); g_menu_item_set_attribute_value (item, G_MENU_ATTRIBUTE_ICON, v); - if (allow_activation) + if (action_name != nullptr) { v = g_variant_new_int64(0); - const char* action = "indicator.activate-planner"; - g_menu_item_set_action_and_target_value (item, action, v); + g_menu_item_set_action_and_target_value (item, action_name, v); } g_menu_append_item(menu, item); g_object_unref(item); @@ -262,11 +268,8 @@ private: g_menu_item_set_action_and_target_value (item, "indicator.calendar", v); g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.calendar"); - if (allow_activation) - { - g_menu_item_set_attribute (item, "activation-action", - "s", "indicator.activate-planner"); - } + if (action_name != nullptr) + g_menu_item_set_attribute (item, "activation-action", "s", action_name); g_menu_append_item (menu, item); g_object_unref (item); } @@ -279,6 +282,15 @@ private: const int MAX_APPTS = 5; std::set<std::string> added; + const char * action_name; + + if (profile == Phone) + action_name = "indicator.phone.open-appointment"; + else if ((profile == Desktop) && m_actions->desktop_has_calendar_app()) + action_name = "indicator.desktop.open-appointment"; + else + action_name = nullptr; + for (const auto& appt : m_upcoming) { // don't show duplicates @@ -312,15 +324,11 @@ private: if (!appt.color.empty()) g_menu_item_set_attribute (menu_item, "x-canonical-color", "s", appt.color.c_str()); - - if (profile == Phone) - g_menu_item_set_action_and_target_value (menu_item, - "indicator.activate-appointment", - g_variant_new_string (appt.uid.c_str())); - else if (m_actions->can_open_planner()) - g_menu_item_set_action_and_target_value (menu_item, - "indicator.activate-planner", - g_variant_new_int64 (unix_time)); + + if (action_name != nullptr) + g_menu_item_set_action_and_target_value (menu_item, action_name, + g_variant_new_string (appt.uid.c_str())); + g_menu_append_item (menu, menu_item); g_object_unref (menu_item); } @@ -334,11 +342,11 @@ private: { add_appointments (menu, profile); - if (m_actions->can_open_planner()) + if (m_actions->desktop_has_calendar_app()) { // add the 'Add Event…' menuitem auto menu_item = g_menu_item_new(_("Add Event…"), nullptr); - const gchar* action_name = "indicator.activate-planner"; + const gchar* action_name = "indicator.desktop.open-calendar-app"; auto v = g_variant_new_int64(0); g_menu_item_set_action_and_target_value(menu_item, action_name, v); g_menu_append_item(menu, menu_item); @@ -347,7 +355,7 @@ private: } else if (profile==Phone) { - auto menu_item = g_menu_item_new (_("Clock"), "indicator.activate-phone-clock-app"); + auto menu_item = g_menu_item_new (_("Clock"), "indicator.phone.open-alarm-app"); g_menu_item_set_attribute_value (menu_item, G_MENU_ATTRIBUTE_ICON, get_serialized_alarm_icon()); g_menu_append_item (menu, menu_item); g_object_unref (menu_item); @@ -389,15 +397,17 @@ private: GMenuModel* create_settings_section(Profile profile) { auto menu = g_menu_new(); + const char * action_name; if (profile == Desktop) - { - g_menu_append (menu, _("Date & Time Settings…"), "indicator.activate-desktop-settings"); - } + action_name = "indicator.desktop.open-settings-app"; else if (profile == Phone) - { - g_menu_append (menu, _("Time & Date settings…"), "indicator.activate-phone-settings"); - } + action_name = "indicator.phone.open-settings-app"; + else + action_name = nullptr; + + if (action_name != nullptr) + g_menu_append (menu, _("Time & Date settings…"), action_name); return G_MENU_MODEL (menu); } |