diff options
| author | Neil Jagdish Patel <njpatel@Pulse> | 2010-07-29 23:25:10 +0100 |
|---|---|---|
| committer | Neil Jagdish Patel <njpatel@Pulse> | 2010-07-29 23:25:10 +0100 |
| commit | 646c8c5f17eaba65a18d05909889649cf8904e27 (patch) | |
| tree | 539eef5301143a8b75c50bb351df2531d15edaa4 /unity-private/panel | |
| parent | 8a228e42abb4ed7c0c678dd66053ea7027712af0 (diff) | |
Start of window buttons bits
(bzr r403.3.1)
Diffstat (limited to 'unity-private/panel')
| -rw-r--r-- | unity-private/panel/panel-view.vala | 7 | ||||
| -rw-r--r-- | unity-private/panel/panel-window-buttons.vala | 87 |
2 files changed, 94 insertions, 0 deletions
diff --git a/unity-private/panel/panel-view.vala b/unity-private/panel/panel-view.vala index 5777d8612..38e60f80d 100644 --- a/unity-private/panel/panel-view.vala +++ b/unity-private/panel/panel-view.vala @@ -30,6 +30,7 @@ namespace Unity.Panel Background bground; HomeButton home_button; + WindowButtons window_buttons; MenuBar menu_bar; SystemTray system_tray; IndicatorBar indicator_bar; @@ -62,6 +63,10 @@ namespace Unity.Panel pack (home_button, false, true); home_button.show (); + window_buttons = new WindowButtons (); + pack (window_buttons, false, true); + window_buttons.show (); + menu_bar = new MenuBar (); pack (menu_bar, true, true); menu_bar.show (); @@ -111,6 +116,7 @@ namespace Unity.Panel { if (menu_bar.indicator_object_view is Clutter.Actor) menu_bar.indicator_object_view.hide (); + window_buttons.hide (); bground.hide (); system_tray.hide (); indicator_bar.set_indicator_mode (mode); @@ -126,6 +132,7 @@ namespace Unity.Panel { if (menu_bar.indicator_object_view is Clutter.Actor) menu_bar.indicator_object_view.show (); + window_buttons.show (); bground.show (); system_tray.show (); indicator_bar.set_indicator_mode (mode); diff --git a/unity-private/panel/panel-window-buttons.vala b/unity-private/panel/panel-window-buttons.vala new file mode 100644 index 000000000..111a8be38 --- /dev/null +++ b/unity-private/panel/panel-window-buttons.vala @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2010 Canonical Ltd + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * Authored by Neil Jagdish Patel <neil.patel@canonical.com> + * + */ + +namespace Unity.Panel +{ + public class WindowButtons : Ctk.Box + { + private WindowButton close; + private WindowButton minimise; + private WindowButton maximise; + + public WindowButtons () + { + Object (orientation:Ctk.Orientation.HORIZONTAL, + spacing:4, + homogeneous:false); + } + + construct + { + } + + private override void get_preferred_width (float for_height, + out float min_width, + out float nat_width) + { + min_width = 70.0f; + nat_width = min_width; + } + } + + public class WindowButton : Ctk.Button + { + public static const string AMBIANCE = "/usr/share/themes/Ambiance/metacity-1"; + + public string filename { get; construct; } + + public WindowButton (string filename) + { + Object (filename:filename); + } + + construct + { + try { + + var bg = new Clutter.Texture.from_file (AMBIANCE + "/" + filename + ".png"); + set_background_for_state (Ctk.ActorState.STATE_NORMAL, bg); + + } catch (Error e) { + warning (@"Unable to load window button theme: You need Ambiance installed: $(e.message)"); + } + } + + private override void get_preferred_width (float for_height, + out float min_width, + out float nat_width) + { + min_width = 20.0f; + nat_width = min_width; + } + + private override void get_preferred_height (float for_width, + out float min_height, + out float nat_height) + { + min_height = 18.0f; + nat_height = min_height; + } + } +} |
