summaryrefslogtreecommitdiff
path: root/unity-private/places
diff options
authorNeil Jagdish Patel <neil.patel@canonical.com>2010-08-26 09:42:40 +0100
committerNeil Jagdish Patel <neil.patel@canonical.com>2010-08-26 09:42:40 +0100
commitbdfb1d28fc0d743b23d8681e8fdc879a9b264062 (patch)
treea2f9f066bc344eea3966cb4920b2a5b7a7095734 /unity-private/places
parent206487a3905dbe24b1eff58b09e170460c7d3319 (diff)
Add states to groups view
Fixes LP: #607784 (bzr r455.1.11)
Diffstat (limited to 'unity-private/places')
-rw-r--r--unity-private/places/places-button.vala38
-rw-r--r--unity-private/places/places-default-renderer-group.vala28
2 files changed, 40 insertions, 26 deletions
diff --git a/unity-private/places/places-button.vala b/unity-private/places/places-button.vala
index bdf062401..6c06602d1 100644
--- a/unity-private/places/places-button.vala
+++ b/unity-private/places/places-button.vala
@@ -22,14 +22,33 @@ namespace Unity.Places
{
public class Button : Ctk.Button
{
+ public enum NormalState
+ {
+ NONE,
+ UNDERLINE
+ }
+
public delegate void ButtonOutlineFunc (Cairo.Context cr,
int width,
int height);
- private CairoCanvas bg;
- private Ctk.EffectGlow? glow;
public ButtonOutlineFunc outline_func;
+ private NormalState _normal_state = NormalState.NONE;
+ public NormalState normal_state {
+ get { return _normal_state; }
+ set {
+ if (_normal_state != value)
+ {
+ _normal_state = value;
+ bg.update ();
+ }
+ }
+ }
+
+ private CairoCanvas bg;
+ private Ctk.EffectGlow? glow;
+
public Button ()
{
Object ();
@@ -96,13 +115,22 @@ namespace Unity.Places
cr.set_operator (Cairo.Operator.CLEAR);
cr.paint ();
- if (state == Ctk.ActorState.STATE_NORMAL)
- return;
-
cr.set_operator (Cairo.Operator.OVER);
cr.set_line_width (1.5);
cr.translate (0.5, 0.5);
+ if (state == Ctk.ActorState.STATE_NORMAL)
+ {
+ if (_normal_state == NormalState.UNDERLINE)
+ {
+ cr.move_to (x, height - 1);
+ cr.line_to (x + width, height - 1);
+ cr.set_source_rgba (1.0, 1.0, 1.0, 0.3);
+ cr.stroke ();
+ }
+ return;
+ }
+
outline_func (cr, width, height);
if (state == Ctk.ActorState.STATE_NORMAL)
diff --git a/unity-private/places/places-default-renderer-group.vala b/unity-private/places/places-default-renderer-group.vala
index d7ca597b8..8dd52d5d1 100644
--- a/unity-private/places/places-default-renderer-group.vala
+++ b/unity-private/places/places-default-renderer-group.vala
@@ -54,12 +54,11 @@ namespace Unity.Places
}
private Ctk.VBox vbox;
- private Ctk.Button title_button;
+ private Button title_button;
private Ctk.HBox title_box;
private Ctk.Image icon;
private Ctk.Text text;
private Expander expander;
- private Ctk.Button sep;
private Ctk.IconView renderer;
private MoreResultsButton? more_results_button;
@@ -101,18 +100,17 @@ namespace Unity.Places
add_actor (vbox);
vbox.show ();
- title_button = new Ctk.Button (Ctk.Orientation.HORIZONTAL);
+ title_button = new Button ();
+ title_button.normal_state = Button.NormalState.UNDERLINE;
+ title_button.orientation = Ctk.Orientation.HORIZONTAL;
title_button.padding = { 4.0f, 6.0f, 4.0f, 6.0f };
vbox.pack (title_button, false, false);
title_button.show ();
- var title_bg = new StripeTexture (null);
- title_button.set_background_for_state (Ctk.ActorState.STATE_PRELIGHT,
- title_bg);
title_button.notify["state"].connect (() => {
- if (title_button.state == Ctk.ActorState.STATE_PRELIGHT)
- sep.opacity = 0;
+ if (title_button.state == Ctk.ActorState.STATE_ACTIVE)
+ text.color = { 50, 50, 50, 200 };
else
- sep.opacity = 255;
+ text.color = { 255, 255, 255, 255 };
unowned GLib.SList<unowned Ctk.Effect> effects = title_button.get_effects ();
foreach (unowned Ctk.Effect effect in effects)
@@ -142,17 +140,6 @@ namespace Unity.Places
title_box.pack (expander, false, true);
expander.show ();
- sep = new Ctk.Button (Ctk.Orientation.HORIZONTAL);
- var rect = new Clutter.Rectangle.with_color ({ 255, 255, 255, 70 });
- sep.add_actor (rect);
- rect.height = 1.0f;
- vbox.pack (sep, false, false);
- sep.show ();
- glow = new Ctk.EffectGlow ();
- glow.set_factor (1.0f);
- glow.set_margin (5);
- //sep.add_effect (glow);
-
title_button.clicked.connect (() => {
if (n_results <= renderer.get_n_cols () || allow_expand == false)
return;
@@ -228,7 +215,6 @@ namespace Unity.Places
if (group_renderer == "UnityFolderGroupRenderer")
{
title_button.hide ();
- sep.hide ();
bin_state = ExpandingBinState.EXPANDED;
}