diff options
| author | Neil Jagdish Patel <neil.patel@canonical.com> | 2010-01-19 22:49:20 +0000 |
|---|---|---|
| committer | Neil Jagdish Patel <neil.patel@canonical.com> | 2010-01-19 22:49:20 +0000 |
| commit | f797362fa443f0d16a9521b8c04eb32d164794cb (patch) | |
| tree | c0ea2db1e3eefbca1bc64467141d39c6a8a18fc6 /src | |
| parent | 8eed99bf9b885fcda61ea06eb6a1cc2889924cbb (diff) | |
[places-bar] Make it use the model
modified: src/places/bar-view.vala src/places/places-view.vala unknown: src/places/places-controller.c src/places/places-model.c src/places/places-place.c src/places/places-view.c src/quicklauncher/quicklist-controller.c src/quicklauncher/quicklist-view.c (bzr r61.2.3)
Diffstat (limited to 'src')
| -rw-r--r-- | src/places/bar-view.vala | 179 | ||||
| -rw-r--r-- | src/places/places-view.vala | 4 |
2 files changed, 78 insertions, 105 deletions
diff --git a/src/places/bar-view.vala b/src/places/bar-view.vala index 444b651e5..df0f3b507 100644 --- a/src/places/bar-view.vala +++ b/src/places/bar-view.vala @@ -124,6 +124,82 @@ namespace Unity.Places.Bar public signal void sig_devices_active_icon_index (int i); public signal void sig_trash_active_icon_index (); + public View (Places.Model model) + { + int i; + int icon_size = 48; + Ctk.EffectGlow glow; + Clutter.Color white = {255, 255, 255, 255}; + + Object (model:model); + this.model.place_added.connect (this.on_place_added); + + this.homogeneous = false; + this.orientation = Ctk.Orientation.HORIZONTAL; // this sucks + + this.PlacesIconArray = new Gee.ArrayList<PlaceIcon> (); + this.DevicesIconArray = new Gee.ArrayList<PlaceIcon> (); + + /* create all image-actors for icons */ + for (i = 0; i < this.DevicesIconArray.size ; i++) + { + glow = new Ctk.EffectGlow (); + glow.set_color (white); + glow.set_factor (1.0f); + glow.set_margin (6); + this.DevicesIconArray[i].view.add_effect (glow); + + this.pack (this.DevicesIconArray[i].view, false, false); + this.DevicesIconArray[i].view.enter_event.connect (this.on_enter); + this.DevicesIconArray[i].view.leave_event.connect (this.on_leave); + this.DevicesIconArray[i].view.button_press_event.connect (this.on_button_press); + } + + { + TrashIcon = new PlaceIcon (icon_size, "Trash", + TRASH_FILE, + "Your piece of waste"); + glow = new Ctk.EffectGlow (); + glow.set_color (white); + glow.set_factor (1.0f); + glow.set_margin (6); + this.TrashIcon.view.add_effect (glow); + + this.pack (this.TrashIcon.view, false, false); + this.TrashIcon.view.enter_event.connect (this.on_enter); + this.TrashIcon.view.leave_event.connect (this.on_leave); + this.TrashIcon.view.button_press_event.connect (this.on_button_press); + } + + Separator = new PlacesVSeparator (); + this.pack (this.Separator, false, false); + + this.show_all (); + } + + private void on_place_added (Place place) + { + int icon_size = 48; + Clutter.Color white = {255, 255, 255, 255}; + + var icon = new PlaceIcon (icon_size, + place.name, + place.icon_name, + ""); + this.PlacesIconArray.add (icon); + + var glow = new Ctk.EffectGlow (); + glow.set_color (white); + glow.set_factor (1.0f); + glow.set_margin (6); + icon.view.add_effect (glow); + + this.pack (icon.view, false, false); + icon.view.enter_event.connect (this.on_enter); + icon.view.leave_event.connect (this.on_leave); + icon.view.button_press_event.connect (this.on_button_press); + } + public override void allocate (Clutter.ActorBox box, Clutter.AllocationFlags flags) { @@ -179,109 +255,6 @@ namespace Unity.Places.Bar this.Separator.allocate (base_box, flags); } - public View (Places.Model model) - { - PlaceIcon place; - int i; - int icon_size = 48; - 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> (); - - // populate places-bar with hard-coded contents for the moment - place = new PlaceIcon (icon_size, "Home", - HOME_FILE, - "Default View"); - this.PlacesIconArray.add (place); - - place = new PlaceIcon (icon_size, "Files", - FILES_FILE, - "Your files stored locally"); - this.PlacesIconArray.add (place); - - place = new PlaceIcon (icon_size, "Applications", - APPS_FILE, - "Programs installed locally"); - this.PlacesIconArray.add (place); - - place = new PlaceIcon (icon_size, "Music", - MUSIC_FILE, - "Soothing sounds and vibes"); - this.PlacesIconArray.add (place); - - place = new PlaceIcon (icon_size, "People", - PEOPLE_FILE, - "Friends, pals, mates and folks"); - this.PlacesIconArray.add (place); - - place = new PlaceIcon (icon_size, "Photos", - PHOTOS_FILE, - "Pretty pictures presented by pixels"); - this.PlacesIconArray.add (place); - - /*place = new PlaceIcon (icon_size, "Trash", - TRASH_FILE, - "Your piece of waste"); - this.PlacesIconArray.add (place);*/ - - /* create all image-actors for icons */ - for (i = 0; i < this.PlacesIconArray.size ; i++) - { - glow = new Ctk.EffectGlow (); - glow.set_color (white); - glow.set_factor (1.0f); - glow.set_margin (6); - this.PlacesIconArray[i].view.add_effect (glow); - - this.pack (this.PlacesIconArray[i].view, false, false); - this.PlacesIconArray[i].view.enter_event.connect (this.on_enter); - this.PlacesIconArray[i].view.leave_event.connect (this.on_leave); - this.PlacesIconArray[i].view.button_press_event.connect (this.on_button_press); - } - - for (i = 0; i < this.DevicesIconArray.size ; i++) - { - glow = new Ctk.EffectGlow (); - glow.set_color (white); - glow.set_factor (1.0f); - glow.set_margin (6); - this.DevicesIconArray[i].view.add_effect (glow); - - this.pack (this.DevicesIconArray[i].view, false, false); - this.DevicesIconArray[i].view.enter_event.connect (this.on_enter); - this.DevicesIconArray[i].view.leave_event.connect (this.on_leave); - this.DevicesIconArray[i].view.button_press_event.connect (this.on_button_press); - } - - { - TrashIcon = new PlaceIcon (icon_size, "Trash", - TRASH_FILE, - "Your piece of waste"); - glow = new Ctk.EffectGlow (); - glow.set_color (white); - glow.set_factor (1.0f); - glow.set_margin (6); - this.TrashIcon.view.add_effect (glow); - - this.pack (this.TrashIcon.view, false, false); - this.TrashIcon.view.enter_event.connect (this.on_enter); - this.TrashIcon.view.leave_event.connect (this.on_leave); - this.TrashIcon.view.button_press_event.connect (this.on_button_press); - } - - Separator = new PlacesVSeparator (); - this.pack (this.Separator, false, false); - - this.show_all (); - } - public int get_number_of_places () { return this.PlacesIconArray.size; diff --git a/src/places/places-view.vala b/src/places/places-view.vala index 219cc1a8d..a77403ea3 100644 --- a/src/places/places-view.vala +++ b/src/places/places-view.vala @@ -220,7 +220,7 @@ namespace Unity.Places 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++) { @@ -230,7 +230,7 @@ namespace Unity.Places background.hide (); } this.PlacesBackgroundArray[0].show (); - +*/ NunItems = this.bar_view.get_number_of_devices (); for (i = 0; i < NunItems; i++) { |
