summaryrefslogtreecommitdiff
path: root/unity-private/panel
diff options
authorNeil Jagdish Patel <njpatel@Pulse>2010-07-29 23:51:38 +0100
committerNeil Jagdish Patel <njpatel@Pulse>2010-07-29 23:51:38 +0100
commit2ecbede658258d2e2056fcce244e8a313e846d8b (patch)
treefd081bce16001a53a0051c7b378a9e272678d3c5 /unity-private/panel
parentf22775e164913c6b9738d73f652a9e3db56f2814 (diff)
Hook up to bamf somewhat
(bzr r403.3.3)
Diffstat (limited to 'unity-private/panel')
-rw-r--r--unity-private/panel/panel-window-buttons.vala57
1 files changed, 53 insertions, 4 deletions
diff --git a/unity-private/panel/panel-window-buttons.vala b/unity-private/panel/panel-window-buttons.vala
index 111a8be38..961f28caa 100644
--- a/unity-private/panel/panel-window-buttons.vala
+++ b/unity-private/panel/panel-window-buttons.vala
@@ -25,22 +25,51 @@ namespace Unity.Panel
private WindowButton minimise;
private WindowButton maximise;
+ private unowned Bamf.Matcher matcher;
+
public WindowButtons ()
{
Object (orientation:Ctk.Orientation.HORIZONTAL,
- spacing:4,
+ spacing:2,
homogeneous:false);
}
construct
{
+ close = new WindowButton ("close.png");
+ pack (close, false, false);
+ close.show ();
+
+ minimise = new WindowButton ("minimize.png");
+ pack (minimise, false, false);
+ minimise.show ();
+
+ maximise = new WindowButton ("maximize.png");
+ pack (maximise, false, false);
+ maximise.show ();
+
+ matcher = Bamf.Matcher.get_default ();
+ matcher.active_window_changed.connect (on_active_window_changed);
+ }
+
+ private void on_active_window_changed (GLib.Object? object,
+ GLib.Object? object1)
+ {
+ Bamf.View? old_view = object as Bamf.View;
+ Bamf.View? new_view = object1 as Bamf.View;
+
+ if (new_view is Bamf.Window)
+ {
+ string name = new_view.get_name ();
+ debug ("Active window changed: %s", name);
+ }
}
private override void get_preferred_width (float for_height,
out float min_width,
out float nat_width)
{
- min_width = 70.0f;
+ min_width = 72.0f;
nat_width = min_width;
}
}
@@ -50,6 +79,7 @@ namespace Unity.Panel
public static const string AMBIANCE = "/usr/share/themes/Ambiance/metacity-1";
public string filename { get; construct; }
+ public Clutter.Actor bg;
public WindowButton (string filename)
{
@@ -60,12 +90,31 @@ namespace Unity.Panel
{
try {
- var bg = new Clutter.Texture.from_file (AMBIANCE + "/" + filename + ".png");
- set_background_for_state (Ctk.ActorState.STATE_NORMAL, bg);
+ bg = new Ctk.Image.from_filename (20, AMBIANCE + "/" + filename);
+ add_actor (bg);
+ bg.show ();
} catch (Error e) {
warning (@"Unable to load window button theme: You need Ambiance installed: $(e.message)");
}
+
+ notify["state"].connect (() => {
+ switch (state)
+ {
+ case Ctk.ActorState.STATE_NORMAL:
+ bg.opacity = 255;
+ break;
+
+ case Ctk.ActorState.STATE_PRELIGHT:
+ bg.opacity = 120;
+ break;
+
+ case Ctk.ActorState.STATE_ACTIVE:
+ default:
+ bg.opacity = 50;
+ break;
+ }
+ });
}
private override void get_preferred_width (float for_height,