diff options
| author | Neil Jagdish Patel <neil.patel@canonical.com> | 2010-01-24 20:10:23 +0000 |
|---|---|---|
| committer | Neil Jagdish Patel <neil.patel@canonical.com> | 2010-01-24 20:10:23 +0000 |
| commit | 86f7ae9d58eb87f78f60f11d79a2e5abea341b46 (patch) | |
| tree | b7ce587a1d71f9183ea061b2df84e69466eb32ea /src | |
| parent | 302e3a06d0bd71c8edb8f67289ebe9b6b4fe699d (diff) | |
[panel-tray] Order icons by creation time
modified: mutter-plugin/plugin.vala src/panel/panel-tray.vala (bzr r55.2.12)
Diffstat (limited to 'src')
| -rw-r--r-- | src/panel/panel-tray.vala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/panel/panel-tray.vala b/src/panel/panel-tray.vala index 64252e6a3..24da7077d 100644 --- a/src/panel/panel-tray.vala +++ b/src/panel/panel-tray.vala @@ -27,6 +27,8 @@ namespace Unity.Panel.Tray private TrayManager manager; private Clutter.Stage stage; + private int n_icons = 0; + public View () { Object (orientation:Ctk.Orientation.HORIZONTAL, @@ -53,11 +55,26 @@ namespace Unity.Panel.Tray return false; } + private int order_icons (Clutter.Actor a, Clutter.Actor b) + { + weak string stra = (string)a.get_data ("n_icon"); + weak string strb = (string)b.get_data ("n_icon"); + + return strcmp ((stra != null) ? stra : "", + (strb != null) ? strb : ""); + } + private void on_tray_icon_added (Clutter.Actor icon) { this.add_actor (icon); icon.set_size (22, 22); icon.show (); + + icon.set_data ("n_icon", (void*)"%d".printf (this.n_icons)); + + this.sort_children ((CompareFunc)this.order_icons); + + this.n_icons++; } private void on_tray_icon_removed (Clutter.Actor icon) |
