summaryrefslogtreecommitdiff
diff options
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2015-11-02 13:29:53 +0000
committerCI Train Bot <ci-train-bot@canonical.com>2015-11-02 13:29:53 +0000
commit09557d7c97d7de4890e1e911768ed68e795e91e6 (patch)
tree5557cb22760a930fb7ca2a04f3d4eb789cd9a294
parent255ee99f91554606bd00ca352a23c735dd81d676 (diff)
parent5f562bf5b78333ca2b4e434e6be0abadea27b800 (diff)
ApplicationLauncherIcon: if an app is not running and has no desktop file, add QL item to add to dash
This allows to generate a desktop file without sticking the icon Approved by: Andrea Azzarone (bzr r4035)
-rw-r--r--launcher/ApplicationLauncherIcon.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/launcher/ApplicationLauncherIcon.cpp b/launcher/ApplicationLauncherIcon.cpp
index ede26baf8..d3e7cca5a 100644
--- a/launcher/ApplicationLauncherIcon.cpp
+++ b/launcher/ApplicationLauncherIcon.cpp
@@ -1092,6 +1092,22 @@ AbstractLauncherIcon::MenuItemsVector ApplicationLauncherIcon::GetMenus()
if (IsRunning())
{
+ if (DesktopFile().empty() && !IsSticky())
+ {
+ /* Add to Dash */
+ glib::Object<DbusmenuMenuitem> menu_item(dbusmenu_menuitem_new());
+ dbusmenu_menuitem_property_set(menu_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Add to Dash"));
+ dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_ENABLED, true);
+ dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_VISIBLE, true);
+
+ _gsignals.Add<void, DbusmenuMenuitem*, unsigned>(menu_item, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
+ [this] (DbusmenuMenuitem*, unsigned) {
+ app_->CreateLocalDesktopFile();
+ });
+
+ result.push_back(menu_item);
+ }
+
if (!quit_item)
quit_item = _menu_items[MenuItemType::QUIT];