Merge lp:~uriboni/unity-2d/panel-size-policy-up-to-applets into lp:unity-2d/3.0

Proposed by Ugo Riboni
Status: Merged
Approved by: Alberto Mardegan
Approved revision: 674
Merged at revision: 674
Proposed branch: lp:~uriboni/unity-2d/panel-size-policy-up-to-applets
Merge into: lp:unity-2d/3.0
Diff against target: 106 lines (+7/-27)
4 files modified
data/com.canonical.Unity2d.gschema.xml (+0/-9)
libunity-2d-private/src/panelapplet.cpp (+1/-0)
panel/app/panelmanager.cpp (+5/-18)
panel/applets/appname/appnameapplet.cpp (+1/-0)
To merge this branch: bzr merge lp:~uriboni/unity-2d/panel-size-policy-up-to-applets
Reviewer Review Type Date Requested Status
Alberto Mardegan (community) Approve
Review via email: mp+71829@code.launchpad.net

Description of the change

Leave the size policy of panel applets up to the applets themselves, and put back the correct size policy for the appname applet.

To post a comment you must log in.
Revision history for this message
Alberto Mardegan (mardy) wrote :

Gorgeous! :-)

I just noted something else that we might want to do, just for safety:

 QWidget *applet = provider->createApplet();
 panel->addWidget(applet);

Add a "if (applet != 0)" check. But it's not affecting this bug report, and all current applets always return a proper widget, so we can have it done separately as an improvement.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/com.canonical.Unity2d.gschema.xml'
--- data/com.canonical.Unity2d.gschema.xml 2011-08-12 09:41:42 +0000
+++ data/com.canonical.Unity2d.gschema.xml 2011-08-17 09:23:55 +0000
@@ -26,14 +26,5 @@
26 only on the panel living in the leftmost screen.26 only on the panel living in the leftmost screen.
27 </description>27 </description>
28 </key>28 </key>
29 <key type="s" name="expanding">
30 <default>"appname"</default>
31 <summary>Applet that should expand to fill all unused space</summary>
32 <description>
33 If this property names a valid applet from the list in the applets property, then this
34 applet will be setup so that it tries to use all the panel space that remains empty after
35 the other applets have resized themselves to display their content.
36 </description>
37 </key>
38 </schema>29 </schema>
39</schemalist>30</schemalist>
4031
=== modified file 'libunity-2d-private/src/panelapplet.cpp'
--- libunity-2d-private/src/panelapplet.cpp 2011-08-16 12:58:45 +0000
+++ libunity-2d-private/src/panelapplet.cpp 2011-08-17 09:23:55 +0000
@@ -6,6 +6,7 @@
6PanelApplet::PanelApplet(QWidget* parent) :6PanelApplet::PanelApplet(QWidget* parent) :
7 QWidget(parent)7 QWidget(parent)
8{8{
9 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
9}10}
1011
11} // namespace Unity2d12} // namespace Unity2d
1213
=== modified file 'panel/app/panelmanager.cpp'
--- panel/app/panelmanager.cpp 2011-08-16 12:58:45 +0000
+++ panel/app/panelmanager.cpp 2011-08-17 09:23:55 +0000
@@ -47,7 +47,6 @@
4747
48static const char* PANEL_DCONF_SCHEMA = "com.canonical.Unity2d.Panel";48static const char* PANEL_DCONF_SCHEMA = "com.canonical.Unity2d.Panel";
49static const char* PANEL_DCONF_PROPERTY_APPLETS = "applets";49static const char* PANEL_DCONF_PROPERTY_APPLETS = "applets";
50static const char* PANEL_DCONF_PROPERTY_EXPAND = "expanding";
51static const char* PANEL_PLUGINS_DEV_DIR_ENV = "DEV_PLUGIN_PATH";50static const char* PANEL_PLUGINS_DEV_DIR_ENV = "DEV_PLUGIN_PATH";
5251
53static QPalette getPalette()52static QPalette getPalette()
@@ -116,7 +115,7 @@
116 return plugins;115 return plugins;
117}116}
118117
119static bool loadPanelConfiguration(QStringList& applets, QString& expanding)118static QStringList loadPanelConfiguration()
120{119{
121 QConf panelConfig(PANEL_DCONF_SCHEMA);120 QConf panelConfig(PANEL_DCONF_SCHEMA);
122121
@@ -125,16 +124,10 @@
125 qWarning() << "Missing or invalid panel applets configuration in dconf. Please check"124 qWarning() << "Missing or invalid panel applets configuration in dconf. Please check"
126 << "the property" << PANEL_DCONF_PROPERTY_APPLETS125 << "the property" << PANEL_DCONF_PROPERTY_APPLETS
127 << "in schema" << PANEL_DCONF_SCHEMA;126 << "in schema" << PANEL_DCONF_SCHEMA;
128 return false;127 return QStringList();
129 }128 }
130129
131 applets.append(appletsConfig.toStringList());130 return appletsConfig.toStringList();
132 qDebug() << "Configured plugins list is:" << applets;
133
134 expanding = panelConfig.property(PANEL_DCONF_PROPERTY_EXPAND).toString();
135 qDebug() << "Expanding applet is:" << expanding;
136
137 return true;
138}131}
139132
140static Unity2dPanel* instantiatePanel(int screen)133static Unity2dPanel* instantiatePanel(int screen)
@@ -148,9 +141,8 @@
148141
149 QHash<QString, PanelAppletProviderInterface*> plugins = loadPlugins();142 QHash<QString, PanelAppletProviderInterface*> plugins = loadPlugins();
150143
151 QString expandingApplet;144 QStringList panelConfiguration = loadPanelConfiguration();
152 QStringList panelConfiguration;145 qDebug() << "Configured plugins list is:" << panelConfiguration;
153 loadPanelConfiguration(panelConfiguration, expandingApplet);
154146
155 Q_FOREACH(QString appletName, panelConfiguration) {147 Q_FOREACH(QString appletName, panelConfiguration) {
156 bool onlyLeftmost = appletName.startsWith('!');148 bool onlyLeftmost = appletName.startsWith('!');
@@ -165,11 +157,6 @@
165 } else {157 } else {
166 if (screen == leftmost || !onlyLeftmost) {158 if (screen == leftmost || !onlyLeftmost) {
167 QWidget *applet = provider->createApplet();159 QWidget *applet = provider->createApplet();
168 if (appletName == expandingApplet) {
169 applet->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
170 } else {
171 applet->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
172 }
173 panel->addWidget(applet);160 panel->addWidget(applet);
174 }161 }
175 }162 }
176163
=== modified file 'panel/applets/appname/appnameapplet.cpp'
--- panel/applets/appname/appnameapplet.cpp 2011-08-16 10:56:09 +0000
+++ panel/applets/appname/appnameapplet.cpp 2011-08-17 09:23:55 +0000
@@ -216,6 +216,7 @@
216: d(new AppNameAppletPrivate)216: d(new AppNameAppletPrivate)
217{217{
218 d->q = this;218 d->q = this;
219 setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum);
219220
220 QPalette palette;221 QPalette palette;
221 palette.setColor(QPalette::WindowText, Qt::white);222 palette.setColor(QPalette::WindowText, Qt::white);

Subscribers

People subscribed via source and target branches

to all changes: