~gerboland/unity-2d/panel-bad-pixels

« back to all changes in this revision

Viewing changes to panel/applets/appname/menubarwidget.cpp

  • Committer: Tarmac
  • Author(s): Marco Trevisan (Treviño)
  • Date: 2011-09-08 15:00:00 UTC
  • mfrom: (637.1.5 unity-2d)
  • Revision ID: tarmac-20110908150000-hf82ubnp2vj1fnh4
To implement the Desktop DX Indicators Review blueprint [1] and to implement the system indicators ordering requested by design team [2], I've redesigned the way the indicators work in unity.

This need to change both unity-panel-service, UnityCore and unity-2d-panel, and basically it works by making the panel-service to compute a "priority" for each indicator entry and then making the panel to show the indicator entries in the correct order.

This needs the UnityCore code available in the lp:~3v1n0/unity/indicators-redesign branch.

More informations are available in the unity merge request:
 https://code.launchpad.net/~3v1n0/unity/indicators-redesign/+merge/70818

[1] https://blueprints.launchpad.net/ubuntu/+spec/desktop-dx-o-indicators-review
[2] https://wiki.ubuntu.com/MenuBar#System_status_menus_.28system_indicators.29

PS: Unfortunately I will go in holiday on August 11th, so I hope you could review it quickly to allow me to fix the eventual issues.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
    QString name = QString::fromStdString(indicator->name());
67
67
    if (name == "libappmenu.so") {
68
68
        indicator->on_entry_added.connect(sigc::mem_fun(this, &MenuBarWidget::onEntryAdded));
 
69
        indicator->on_entry_removed.connect(sigc::mem_fun(this, &MenuBarWidget::onEntryRemoved));
69
70
    }
70
71
}
71
72
 
82
83
    m_layout->insertWidget(m_layout->count() - 1, widget);
83
84
}
84
85
 
 
86
void MenuBarWidget::onEntryRemoved(const std::string& entry_id)
 
87
{
 
88
    Q_FOREACH(IndicatorEntryWidget* widget, m_widgetList)
 
89
    {
 
90
        if (widget->entry()->id() == entry_id) {
 
91
            disconnect(widget, SIGNAL(isEmptyChanged()));
 
92
            widget->hide();
 
93
            m_layout->removeWidget(widget);
 
94
            m_indicatorsManager->removeIndicatorEntryWidget(widget);
 
95
            m_widgetList.removeOne(widget);
 
96
            updateIsEmpty();
 
97
            break;
 
98
        }
 
99
    }
 
100
}
 
101
 
85
102
void MenuBarWidget::updateIsEmpty()
86
103
{
87
104
    bool empty = true;