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 | |
| parent | 8a228e42abb4ed7c0c678dd66053ea7027712af0 (diff) | |
Start of window buttons bits
(bzr r403.3.1)
| -rw-r--r-- | .bzrignore | 3 | ||||
| -rw-r--r-- | unity-private/Makefile.am | 3 | ||||
| -rw-r--r-- | unity-private/panel/panel-view.vala | 7 | ||||
| -rw-r--r-- | unity-private/panel/panel-window-buttons.vala | 87 |
4 files changed, 99 insertions, 1 deletions
diff --git a/.bzrignore b/.bzrignore index 1ccf8edb5..a84c44826 100644 --- a/.bzrignore +++ b/.bzrignore @@ -331,3 +331,6 @@ unity-private/launcher/quicklist-radio-menu-item.c unity-private/launcher/quicklist-seperator-menu-item.c unity-private/places/places-place-entry-scroller-child.c unity-private/places/places-trash-controller.c +unity/unity-place-activation.c +unity/unity-place-browser.c +unity-private/panel/panel-window-buttons.c diff --git a/unity-private/Makefile.am b/unity-private/Makefile.am index 50a92bbe5..8ff4ec260 100644 --- a/unity-private/Makefile.am +++ b/unity-private/Makefile.am @@ -84,7 +84,8 @@ panel_sources = \ panel/panel-menu-manager.vala \ panel/panel-menubar.vala \ panel/panel-tray.vala \ - panel/panel-view.vala + panel/panel-view.vala \ + panel/panel-window-buttons.vala places_sources = \ places/places-controller.vala \ 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; + } + } +} |
