summaryrefslogtreecommitdiff
path: root/src
diff options
authorNeil Jagdish Patel <neil.patel@canonical.com>2010-01-19 17:45:01 +0000
committerNeil Jagdish Patel <neil.patel@canonical.com>2010-01-19 17:45:01 +0000
commit8eed99bf9b885fcda61ea06eb6a1cc2889924cbb (patch)
tree0d82a58d7a18491b1b957ee90be32207459b9004 /src
parentb782b961ab6c2f7cb55594bfd470dc6fd6ff23a6 (diff)
Pass model to bar
(bzr r61.2.2)
Diffstat (limited to 'src')
-rw-r--r--src/places/bar-view.vala14
-rw-r--r--src/places/places-view.vala102
2 files changed, 61 insertions, 55 deletions
diff --git a/src/places/bar-view.vala b/src/places/bar-view.vala
index e757d7436..444b651e5 100644
--- a/src/places/bar-view.vala
+++ b/src/places/bar-view.vala
@@ -102,6 +102,8 @@ namespace Unity.Places.Bar
public class View : Ctk.Box
{
+ public Places.Model model { get; construct; }
+
public int IconSize = 0;
public int FirstPlaceIconPosition = 0;
public int PlaceIconSpacing = 0;
@@ -122,7 +124,7 @@ namespace Unity.Places.Bar
public signal void sig_devices_active_icon_index (int i);
public signal void sig_trash_active_icon_index ();
- public override void allocate (Clutter.ActorBox box,
+ public override void allocate (Clutter.ActorBox box,
Clutter.AllocationFlags flags)
{
Clutter.ActorBox base_box = {0, 0, 0, 0};
@@ -133,7 +135,7 @@ namespace Unity.Places.Bar
base.allocate (base_box, flags);
int i;
-
+
base_box.x1 = FirstPlaceIconPosition;
for (i = 0; i < this.PlacesIconArray.size; i++)
{
@@ -177,7 +179,7 @@ namespace Unity.Places.Bar
this.Separator.allocate (base_box, flags);
}
- public View ()
+ public View (Places.Model model)
{
PlaceIcon place;
int i;
@@ -185,11 +187,13 @@ namespace Unity.Places.Bar
Ctk.EffectGlow glow;
Clutter.Color white = {255, 255, 255, 255};
+ Object (model:model);
+
this.homogeneous = false;
this.orientation = Ctk.Orientation.HORIZONTAL; // this sucks
this.PlacesIconArray = new Gee.ArrayList<PlaceIcon> ();
- this.DevicesIconArray = new Gee.ArrayList<PlaceIcon> ();
+ this.DevicesIconArray = new Gee.ArrayList<PlaceIcon> ();
// populate places-bar with hard-coded contents for the moment
place = new PlaceIcon (icon_size, "Home",
@@ -288,7 +292,7 @@ namespace Unity.Places.Bar
return this.DevicesIconArray.size;
}
-
+
public bool on_enter ()
{
/* stdout.printf ("on_enter() called\n"); */
diff --git a/src/places/places-view.vala b/src/places/places-view.vala
index 45ecdee09..219cc1a8d 100644
--- a/src/places/places-view.vala
+++ b/src/places/places-view.vala
@@ -200,6 +200,58 @@ namespace Unity.Places
public Model model { get; construct; }
+ public View (Model model)
+ {
+ int i;
+ int NunItems;
+ PlacesBackground background;
+
+ Object (model:model);
+
+ this.PlacesBackgroundArray = new Gee.ArrayList<PlacesBackground> ();
+ this.DevicesBackgroundArray = new Gee.ArrayList<PlacesBackground> ();
+
+ this.current_tab_index = 0;
+ this.orientation = Ctk.Orientation.VERTICAL;
+
+ this.bar_view = new Unity.Places.Bar.View (this.model);
+ this.bar_view.sig_places_active_icon_index.connect(this.on_signal_active_icon);
+ this.bar_view.sig_devices_active_icon_index.connect(this.on_signal_device_active_icon);
+ this.bar_view.sig_trash_active_icon_index.connect(this.on_signal_trash_active_icon);
+
+ this.default_view = new Unity.Places.Default.View ();
+
+ NunItems = this.bar_view.get_number_of_places ();
+ for (i = 0; i < NunItems; i++)
+ {
+ background = new PlacesBackground ();
+ this.add_actor (background);
+ this.PlacesBackgroundArray.add (background);
+ background.hide ();
+ }
+ this.PlacesBackgroundArray[0].show ();
+
+ NunItems = this.bar_view.get_number_of_devices ();
+ for (i = 0; i < NunItems; i++)
+ {
+ background = new PlacesBackground ();
+ this.add_actor (background);
+ this.DevicesBackgroundArray.add (background);
+ background.hide ();
+ }
+
+ TrashBackground = new PlacesBackground ();
+ this.add_actor (TrashBackground);
+ TrashBackground.hide ();
+
+
+ this.add_actor (this.bar_view);
+ this.add_actor (this.default_view);
+
+ Ctk.Padding padding = { 0.0f, 0.0f, 0.0f, 12.0f };
+ this.set_padding (padding);
+ }
+
/* These parameters are temporary until we get the right metrics for
* the places bar
*/
@@ -264,56 +316,6 @@ namespace Unity.Places
}
- public View (Model model)
- {
- int i;
- int NunItems;
- PlacesBackground background;
-
- Object (model:model);
-
- this.PlacesBackgroundArray = new Gee.ArrayList<PlacesBackground> ();
- this.DevicesBackgroundArray = new Gee.ArrayList<PlacesBackground> ();
-
- this.current_tab_index = 0;
- this.orientation = Ctk.Orientation.VERTICAL;
- this.bar_view = new Unity.Places.Bar.View ();
- this.bar_view.sig_places_active_icon_index.connect(this.on_signal_active_icon);
- this.bar_view.sig_devices_active_icon_index.connect(this.on_signal_device_active_icon);
- this.bar_view.sig_trash_active_icon_index.connect(this.on_signal_trash_active_icon);
-
- this.default_view = new Unity.Places.Default.View ();
-
- NunItems = this.bar_view.get_number_of_places ();
- for (i = 0; i < NunItems; i++)
- {
- background = new PlacesBackground ();
- this.add_actor (background);
- this.PlacesBackgroundArray.add (background);
- background.hide ();
- }
- this.PlacesBackgroundArray[0].show ();
-
- NunItems = this.bar_view.get_number_of_devices ();
- for (i = 0; i < NunItems; i++)
- {
- background = new PlacesBackground ();
- this.add_actor (background);
- this.DevicesBackgroundArray.add (background);
- background.hide ();
- }
-
- TrashBackground = new PlacesBackground ();
- this.add_actor (TrashBackground);
- TrashBackground.hide ();
-
-
- this.add_actor (this.bar_view);
- this.add_actor (this.default_view);
-
- Ctk.Padding padding = { 0.0f, 0.0f, 0.0f, 12.0f };
- this.set_padding (padding);
- }
public void set_size_and_position (int bar_x,
int bar_y,