Merge lp:~unity-team/unity/unity.fix-723877 into lp:unity

Proposed by Mirco Müller
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 1009
Proposed branch: lp:~unity-team/unity/unity.fix-723877
Merge into: lp:unity
Diff against target: 100 lines (+48/-3)
2 files modified
src/BamfLauncherIcon.cpp (+46/-2)
src/BamfLauncherIcon.h (+2/-1)
To merge this branch: bzr merge lp:~unity-team/unity/unity.fix-723877
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+54581@code.launchpad.net

Description of the change

Adds separators and application-name label to the quicklist again. The application-name label also allows to start/focus the app... just like the launcher-icon itself. Fixes LP: #723877

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

Sweet!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/BamfLauncherIcon.cpp'
2--- src/BamfLauncherIcon.cpp 2011-03-14 20:48:50 +0000
3+++ src/BamfLauncherIcon.cpp 2011-03-23 18:29:10 +0000
4@@ -719,11 +719,27 @@
5 }
6 }
7
8+static void
9+OnAppLabelActivated (DbusmenuMenuitem* sender,
10+ guint timestamp,
11+ gpointer data)
12+{
13+ BamfLauncherIcon* self = NULL;
14+
15+ if (!data)
16+ return;
17+
18+ self = (BamfLauncherIcon*) data;
19+ self->ActivateLauncherIcon ();
20+}
21+
22 std::list<DbusmenuMenuitem *>
23 BamfLauncherIcon::GetMenus ()
24 {
25 std::map<std::string, DbusmenuClient *>::iterator it;
26 std::list<DbusmenuMenuitem *> result;
27+ bool first_separator_needed = false;
28+ DbusmenuMenuitem* item = NULL;
29
30 for (it = _menu_clients.begin (); it != _menu_clients.end (); it++)
31 {
32@@ -738,6 +754,8 @@
33 if (!item)
34 continue;
35
36+ first_separator_needed = true;
37+
38 result.push_back (item);
39 }
40 }
41@@ -754,10 +772,36 @@
42 if (!item)
43 continue;
44
45+ first_separator_needed = true;
46+
47 result.push_back (item);
48 }
49-
50- }
51+ }
52+
53+ if (first_separator_needed)
54+ {
55+ item = dbusmenu_menuitem_new ();
56+ dbusmenu_menuitem_property_set (item,
57+ DBUSMENU_MENUITEM_PROP_TYPE,
58+ DBUSMENU_CLIENT_TYPES_SEPARATOR);
59+ result.push_back (item);
60+ }
61+
62+ item = dbusmenu_menuitem_new ();
63+ dbusmenu_menuitem_property_set (item,
64+ DBUSMENU_MENUITEM_PROP_LABEL,
65+ bamf_view_get_name (BAMF_VIEW (m_App)));
66+ dbusmenu_menuitem_property_set_bool (item,
67+ DBUSMENU_MENUITEM_PROP_ENABLED,
68+ true);
69+ g_signal_connect (item, "item-activated", (GCallback) OnAppLabelActivated, this);
70+ result.push_back (item);
71+
72+ item = dbusmenu_menuitem_new ();
73+ dbusmenu_menuitem_property_set (item,
74+ DBUSMENU_MENUITEM_PROP_TYPE,
75+ DBUSMENU_CLIENT_TYPES_SEPARATOR);
76+ result.push_back (item);
77
78 EnsureMenuItemsReady ();
79
80
81=== modified file 'src/BamfLauncherIcon.h'
82--- src/BamfLauncherIcon.h 2011-02-11 17:03:24 +0000
83+++ src/BamfLauncherIcon.h 2011-03-23 18:29:10 +0000
84@@ -42,6 +42,8 @@
85 const char* DesktopFile ();
86 bool IsSticky ();
87
88+ void ActivateLauncherIcon ();
89+
90 protected:
91 void OnMouseClick (int button);
92 std::list<DbusmenuMenuitem *> GetMenus ();
93@@ -58,7 +60,6 @@
94 void OnDndEnter ();
95 void OnDndLeave ();
96
97- void ActivateLauncherIcon ();
98 void OpenInstanceLauncherIcon ();
99
100 std::list<char *> ValidateUrisForLaunch (std::list<char *> uris);