Merge lp:~marcobiscaro2112/unity/fixes-733349 into lp:unity

Proposed by Marco Biscaro on 2011-05-18
Status: Superseded
Proposed branch: lp:~marcobiscaro2112/unity/fixes-733349
Merge into: lp:unity
Diff against target: 228 lines (+89/-11)
7 files modified
src/BamfLauncherIcon.cpp (+49/-5)
src/BamfLauncherIcon.h (+2/-0)
src/Launcher.cpp (+14/-0)
src/Launcher.h (+5/-0)
src/LauncherIcon.cpp (+0/-3)
src/unityshell.cpp (+4/-2)
unityshell.xml.in (+15/-1)
To merge this branch: bzr merge lp:~marcobiscaro2112/unity/fixes-733349
Reviewer Review Type Date Requested Status
Mirco Müller (community) 2011-05-18 Disapprove on 2011-05-25
Review via email: mp+61473@code.launchpad.net

Description of the change

Implementation of what was discussed here: https://bugs.launchpad.net/ayatana-design/+bug/733349/comments/58

This option is disabled by default, and can be enabled through ccsm.

To post a comment you must log in.
Mirco Müller (macslow) wrote :

While the code looks ok, compiles and works as advertised, it will not be approved - thus merged into trunk - as long as the design and user-interaction discussion does not agree with this. At least this is something that can be considered to be part of a future user-testing session and see how this behaviour is received compared to the current one.

On a general note... adding numerous options, which divert from the default, causes the introduction of code-paths note exercised as much as others (default) ones. Thus code-rot is a potential danger here... where options could cause unknown/undiscovered side-effects, because they just have not been tested as much.

Mirco Müller (macslow) :
review: Disapprove
Marco Biscaro (marcobiscaro2112) wrote :

I understand this point of view, but disagree in this case.

At moment, there are 78 people which manifested as affected by this bug. And I'm sure that are many more. If we add this functionality now, there is a lot of time to people test it before oneiric (and even more time before the next LTS).

Otherwise, if we keep this thought in mind, unity will not evolve: it will not turn better, it will not turn more customizable, it will not turn more familiar. And it's this that users expect. :)

Please, consider this.

Magnes (magnesus2) wrote :

Where is the "the design and user-interaction discussion" and how can we participate? Why people that are affected by this bug are not part of it? Why are you trowing out ready solution that doesn't break anything and is turned off by default?

1189. By Marco Biscaro on 2011-12-20

Reverted changes

1190. By Marco Biscaro on 2011-12-20

Merge with trunk

1191. By Marco Biscaro on 2011-12-20

Implementing minimization when launcher icon is clicked (LP: #733349).

Reference: https://bugs.launchpad.net/ayatana-design/+bug/733349/comments/58

Unmerged revisions

1191. By Marco Biscaro on 2011-12-20

Implementing minimization when launcher icon is clicked (LP: #733349).

Reference: https://bugs.launchpad.net/ayatana-design/+bug/733349/comments/58

1190. By Marco Biscaro on 2011-12-20

Merge with trunk

1189. By Marco Biscaro on 2011-12-20

Reverted changes

1188. By Marco Biscaro on 2011-05-18

Implementing minimization when launcher icon is clicked (LP: #733349).

Reference: https://bugs.launchpad.net/ayatana-design/+bug/733349/comments/58

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-04-18 17:56:31 +0000
3+++ src/BamfLauncherIcon.cpp 2011-05-18 20:41:09 +0000
4@@ -65,10 +65,10 @@
5
6 /* Behaviour:
7 * 1) Nothing running -> launch application
8- * 2) Running and active -> spread application
9+ * 2) Running and active -> spread application or minimize if enabled and there is only one window
10 * 3) Running and not active -> focus application
11 * 4) Spread is active and different icon pressed -> change spread
12- * 5) Spread is active -> Spread de-activated, and fall through
13+ * 5) Spread is active -> Spread de-activated, and minimize all windows, if enabled
14 */
15
16 if (!running) // #1 above
17@@ -81,8 +81,17 @@
18 }
19 else if (scaleWasActive)
20 {
21- if (active || // #5 above
22- !Spread (0, false)) // #4 above
23+ if (active) // #5 above
24+ {
25+ PluginAdapter::Default ()->TerminateScale ();
26+ _launcher->SetLastSpreadIcon (NULL);
27+
28+ if (_launcher->GetMinimizeAll ()) // minimize all, if it is active
29+ {
30+ MinimizeAllWindows ();
31+ }
32+ }
33+ else if (!Spread (0, false)) // #4 above
34 {
35 PluginAdapter::Default ()->TerminateScale ();
36 Focus ();
37@@ -95,7 +104,19 @@
38 }
39 else if (active && !scaleWasActive) // #2 above
40 {
41- Spread (0, false);
42+ GList *children;
43+
44+ children = bamf_view_get_children (BAMF_VIEW (m_App));
45+ if (g_list_length (children) > 1) // if there is more than 1 window, open spread view
46+ {
47+ Spread (0, false);
48+ }
49+ else if (_launcher->GetMinimizeAll ()) // minimize the only window, if it is active
50+ {
51+ MinimizeAllWindows ();
52+ }
53+
54+ g_list_free (children);
55 }
56
57 ubus_server_send_message (ubus_server_get_default (), UBUS_LAUNCHER_ACTION_DONE, NULL);
58@@ -1102,3 +1123,26 @@
59 break;
60 }
61 }
62+
63+void
64+BamfLauncherIcon::MinimizeAllWindows ()
65+{
66+ GList *children, *l;
67+ BamfView *view;
68+
69+ children = bamf_view_get_children (BAMF_VIEW (m_App));
70+
71+ for (l = children; l; l = l->next)
72+ {
73+ view = (BamfView *) l->data;
74+
75+ if (BAMF_IS_WINDOW (view))
76+ {
77+ guint32 xid = bamf_window_get_xid (BAMF_WINDOW (view));
78+
79+ WindowManager::Default ()->Minimize (xid);
80+ }
81+ }
82+
83+ g_list_free (children);
84+}
85
86=== modified file 'src/BamfLauncherIcon.h'
87--- src/BamfLauncherIcon.h 2011-04-07 21:46:48 +0000
88+++ src/BamfLauncherIcon.h 2011-05-18 20:41:09 +0000
89@@ -121,6 +121,8 @@
90 gpointer data);
91
92 static gboolean OnDndHoveredTimeout (gpointer data);
93+
94+ void MinimizeAllWindows ();
95 };
96
97 #endif // BAMFLAUNCHERICON_H
98
99=== modified file 'src/Launcher.cpp'
100--- src/Launcher.cpp 2011-05-17 04:06:05 +0000
101+++ src/Launcher.cpp 2011-05-18 20:41:09 +0000
102@@ -471,6 +471,8 @@
103 SettingsChanged (_settings, (gchar *)"shows-on-edge", this);
104
105 SetDndEnabled (false, true);
106+
107+ _minimize_all = false;
108 }
109
110 Launcher::~Launcher()
111@@ -4248,3 +4250,15 @@
112 {
113 g_debug ("Lost the name %s on the session bus\n", name);
114 }
115+
116+bool
117+Launcher::GetMinimizeAll ()
118+{
119+ return _minimize_all;
120+}
121+
122+void
123+Launcher::SetMinimizeAll (bool minimize_all)
124+{
125+ _minimize_all = minimize_all;
126+}
127
128=== modified file 'src/Launcher.h'
129--- src/Launcher.h 2011-04-20 03:59:36 +0000
130+++ src/Launcher.h 2011-05-18 20:41:09 +0000
131@@ -175,6 +175,9 @@
132 sigc::signal<void, LauncherIcon *> launcher_removerequest;
133 sigc::signal<void> selection_change;
134 sigc::signal<void> hidden_changed;
135+
136+ bool GetMinimizeAll ();
137+ void SetMinimizeAll (bool minimizeAll);
138 protected:
139 // Introspectable methods
140 const gchar* GetName ();
141@@ -560,6 +563,8 @@
142 guint32 _settings_changed_id;
143
144 guint _ubus_handles[5];
145+
146+ bool _minimize_all;
147 };
148
149 #endif // LAUNCHER_H
150
151=== modified file 'src/LauncherIcon.cpp'
152--- src/LauncherIcon.cpp 2011-05-13 03:33:19 +0000
153+++ src/LauncherIcon.cpp 2011-05-18 20:41:09 +0000
154@@ -189,9 +189,6 @@
155 void
156 LauncherIcon::Activate ()
157 {
158- if (PluginAdapter::Default ()->IsScaleActive())
159- PluginAdapter::Default ()->TerminateScale ();
160-
161 ActivateLauncherIcon ();
162 }
163
164
165=== modified file 'src/unityshell.cpp'
166--- src/unityshell.cpp 2011-05-04 13:18:37 +0000
167+++ src/unityshell.cpp 2011-05-18 20:41:09 +0000
168@@ -754,15 +754,16 @@
169 panelController->SetBFBSize (optionGetIconSize()+18);
170 launcher->SetIconSize (optionGetIconSize()+6, optionGetIconSize());
171 PlacesController::SetLauncherSize (optionGetIconSize()+18);
172-
173 break;
174 case UnityshellOptions::AutohideAnimation:
175 launcher->SetAutoHideAnimation ((Launcher::AutoHideAnimation) optionGetAutohideAnimation ());
176 break;
177-
178 case UnityshellOptions::DashBlurExperimental:
179 PlacesSettings::GetDefault ()->SetDashBlurType ((PlacesSettings::DashBlurType)optionGetDashBlurExperimental ());
180 break;
181+ case UnityshellOptions::LauncherMinimizeAll:
182+ launcher->SetMinimizeAll (optionGetLauncherMinimizeAll ());
183+ break;
184 default:
185 break;
186 }
187@@ -936,6 +937,7 @@
188 optionSetPanelFirstMenuInitiate (boost::bind (&UnityScreen::showPanelFirstMenuKeyInitiate, this, _1, _2, _3));
189 optionSetPanelFirstMenuTerminate(boost::bind (&UnityScreen::showPanelFirstMenuKeyTerminate, this, _1, _2, _3));
190 optionSetLauncherRevealEdgeInitiate (boost::bind (&UnityScreen::launcherRevealEdgeInitiate, this, _1, _2, _3));
191+ optionSetLauncherMinimizeAllNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2));
192
193 for (unsigned int i = 0; i < G_N_ELEMENTS (_ubus_handles); i++)
194 _ubus_handles[i] = 0;
195
196=== modified file 'unityshell.xml.in'
197--- unityshell.xml.in 2011-04-11 08:01:24 +0000
198+++ unityshell.xml.in 2011-05-18 20:41:09 +0000
199@@ -187,7 +187,6 @@
200 <_name>Fade and Slide</_name>
201 </desc>
202 </option>
203-
204 <option name="dash_blur_experimental" type="int">
205 <_short>Dash Blur</_short>
206 <_long>Type of blur in the Dash</_long>
207@@ -203,6 +202,21 @@
208 <_name>Static Blur</_name>
209 </desc>
210 </option>
211+ <option name="launcher_minimize_all" type="int">
212+ <_short>Minimize all</_short>
213+ <_long>Minimize all windows of the application when the launcher icon is clicked.</_long>
214+ <min>0</min>
215+ <max>1</max>
216+ <default>0</default>
217+ <desc>
218+ <value>0</value>
219+ <_name>Do not minimize</_name>
220+ </desc>
221+ <desc>
222+ <value>1</value>
223+ <_name>Minimize all</_name>
224+ </desc>
225+ </option>
226 </group>
227 </options>
228 </plugin>