diff options
| author | Gord Allott <gord.allott@canonical.com> | 2010-01-22 14:42:25 +0000 |
|---|---|---|
| committer | Gord Allott <gord.allott@canonical.com> | 2010-01-22 14:42:25 +0000 |
| commit | 57dfceed655717a8e57a8c6139178cbd1e49b66c (patch) | |
| tree | 4911598e04737f4437f8c8d70d4de338ce032661 /src | |
| parent | 054b592321999a3148e9ebf241336829736ae195 (diff) | |
adds launcher pinning/unpinning to the launcher
fixes glow bug (bzr r69.1.1)
Diffstat (limited to 'src')
| -rw-r--r-- | src/quicklauncher/application-model.vala | 40 | ||||
| -rw-r--r-- | src/quicklauncher/launcher-view.vala | 20 |
2 files changed, 50 insertions, 10 deletions
diff --git a/src/quicklauncher/application-model.vala b/src/quicklauncher/application-model.vala index 9233442eb..0cba9b83c 100644 --- a/src/quicklauncher/application-model.vala +++ b/src/quicklauncher/application-model.vala @@ -80,6 +80,43 @@ namespace Unity.Quicklauncher.Models } } + public class LauncherPinningShortcut : Object, ShortcutItem + { + public ApplicationModel app_model {get; construct;} + public string name { + get { + if (this.app_model.is_sticky) + { + return "Remove from Launcher"; + } + else + { + return "Add to Launcher"; + } + } + } + + public LauncherPinningShortcut (ApplicationModel model) + { + Object (app_model: model); + } + + construct + { + + } + + public string get_name () + { + return this.name; + } + + public void activated () + { + this.app_model.is_sticky = !this.app_model.is_sticky; + } + } + public class ApplicationModel : Object, LauncherModel { private Gdk.Pixbuf _icon; @@ -216,6 +253,9 @@ namespace Unity.Quicklauncher.Models open_entry.name = "Open.."; ret_list.add (open_entry); + var pin_entry = new LauncherPinningShortcut (this); + ret_list.add (pin_entry); + return ret_list; } diff --git a/src/quicklauncher/launcher-view.vala b/src/quicklauncher/launcher-view.vala index 92e396e3f..3c2d95bf1 100644 --- a/src/quicklauncher/launcher-view.vala +++ b/src/quicklauncher/launcher-view.vala @@ -48,7 +48,7 @@ namespace Unity.Quicklauncher private Gee.ArrayList<ShortcutItem> offline_shortcuts; private Gee.ArrayList<ShortcutItem> shortcut_actions; - + private QuicklistController? quicklist_controller; private Ctk.EffectGlow effect_icon_glow; @@ -212,13 +212,13 @@ namespace Unity.Quicklauncher }; effect_icon_glow.set_background_texture (honeycomb_mask); effect_icon_glow.set_color (c); - effect_icon_glow.set_factor (0.0f); + effect_icon_glow.set_opacity (0.0f); this.icon.add_effect (effect_icon_glow); this.icon.do_queue_redraw (); this.anim_throbber = effect_icon_glow.animate ( Clutter.AnimationMode.EASE_IN_OUT_SINE, SHORT_DELAY, - "factor", 1.0f); + "opacity", 1.0f); Signal.connect_after (this.anim_throbber, "completed", (Callback)do_anim_throbber_loop, this); @@ -233,7 +233,7 @@ namespace Unity.Quicklauncher { // we are still starting so do another loop float factor = 0.0f; - if (self.effect_icon_glow.factor < 0.5) + if (self.effect_icon_glow.opacity < 0.5) { factor = 1.0f; } @@ -241,19 +241,19 @@ namespace Unity.Quicklauncher self.anim_throbber = self.effect_icon_glow.animate ( Clutter.AnimationMode.EASE_IN_OUT_SINE, SHORT_DELAY, - "factor", factor); + "opacity", factor); Signal.connect_after (self.anim_throbber, "completed", (Callback)do_anim_throbber_loop, self); } else { // we should fadeout if we are too bright, otherwise remove effect - if (self.effect_icon_glow.factor >= 0.1) + if (self.effect_icon_glow.opacity >= 0.1) { self.anim_throbber = self.effect_icon_glow.animate ( Clutter.AnimationMode.EASE_IN_OUT_SINE, SHORT_DELAY, - "factor", 0.0); + "opacity", 0.0); } else { @@ -386,20 +386,20 @@ namespace Unity.Quicklauncher /* menu handling */ private void build_quicklist () - { + { this.offline_shortcuts = this.model.get_menu_shortcuts (); this.shortcut_actions = this.model.get_menu_shortcut_actions (); foreach (ShortcutItem shortcut in this.offline_shortcuts) { this.quicklist_controller.add_action (shortcut, true); } - + foreach (ShortcutItem shortcut in this.shortcut_actions) { this.quicklist_controller.add_action (shortcut, false); } } - + private bool on_released (Clutter.Event src) { var bevent = src.button; |
