[gnome-boxes] selectionbar: Use a standard toolbar
- From: Arnel A. Borja <arnelborja src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] selectionbar: Use a standard toolbar
- Date: Fri, 30 Aug 2013 13:49:53 +0000 (UTC)
commit b55b7cdbb3dab80419f5fcdda0b7e9a3c6edc434
Author: Arnel A. Borja <arnelborja src gnome org>
Date: Thu Aug 29 23:42:43 2013 +0800
selectionbar: Use a standard toolbar
Use a standard toolbar at the bottom instead of an overlaid toolbar.
Add a revealer to slide up and down the toolbar.
This is to follow the new design for Content Selection Pattern at
https://wiki.gnome.org/GnomeOS/Design/Whiteboards/SelectionPattern
https://bugzilla.gnome.org/show_bug.cgi?id=706818
src/app.vala | 13 ++++++----
src/selectionbar.vala | 64 ++++++++++---------------------------------------
2 files changed, 21 insertions(+), 56 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 567f6e9..a98c717 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -526,16 +526,22 @@ private class Boxes.App: Boxes.UI {
return false;
});
+ var main_vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
+ window.add (main_vbox);
+
notebook = new Gtk.Notebook ();
notebook.show_border = false;
notebook.show_tabs = false;
- window.add (notebook);
+ main_vbox.add (notebook);
embed = new ClutterWidget ();
notebook.append_page (embed, null);
display_page = new DisplayPage ();
notebook.append_page (display_page.widget, null);
+ selectionbar = new Selectionbar ();
+ main_vbox.add (selectionbar);
+
stage = embed.get_stage () as Clutter.Stage;
stage.set_background_color (gdk_rgba_to_clutter_color (get_boxes_bg_color ()));
@@ -567,7 +573,6 @@ private class Boxes.App: Boxes.UI {
searchbar = new Searchbar ();
topbar = new Topbar ();
notificationbar = new Notificationbar ();
- selectionbar = new Selectionbar ();
wizard = new Wizard ();
properties = new Properties ();
empty_boxes = new EmptyBoxes ();
@@ -651,17 +656,15 @@ private class Boxes.App: Boxes.UI {
hbox_actor.add_child (content_bin_actor);
below_bin_actor.add_child (notificationbar.actor);
- below_bin_actor.add_child (selectionbar.actor);
content_bin_actor.add (wizard.actor);
content_bin_actor.add (properties.actor);
below_bin_actor.insert_child_below (empty_boxes.actor, null);
properties.actor.hide ();
- selectionbar.actor.hide ();
empty_boxes.actor.hide ();
- notebook.show_all ();
+ main_vbox.show_all ();
ui_state = UIState.COLLECTION;
}
diff --git a/src/selectionbar.vala b/src/selectionbar.vala
index 0ce1ab0..4490214 100644
--- a/src/selectionbar.vala
+++ b/src/selectionbar.vala
@@ -2,51 +2,21 @@
using Clutter;
using Gtk;
-private class Boxes.Selectionbar: GLib.Object {
- public Clutter.Actor actor { get { return gtk_actor; } }
- public static const int default_toolbar_width = 500;
-
- private GtkClutter.Actor gtk_actor;
- private Gtk.Toolbar toolbar;
+private class Boxes.Selectionbar: Gtk.Revealer {
+ private Gtk.HeaderBar headerbar;
private Gtk.ToggleButton favorite_btn;
private Gtk.Button pause_btn;
private Gtk.Button remove_btn;
private Gtk.Button properties_btn;
public Selectionbar () {
- toolbar = new Gtk.Toolbar ();
- toolbar.show_arrow = false;
- toolbar.icon_size = Gtk.IconSize.LARGE_TOOLBAR;
- toolbar.set_size_request (default_toolbar_width, -1);
-
- toolbar.get_style_context ().add_class ("osd");
-
- var leftbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
- var leftgroup = new Gtk.ToolItem ();
- leftgroup.add (leftbox);
- toolbar.insert(leftgroup, -1);
-
- var separator = new Gtk.SeparatorToolItem();
- separator.set_expand (true);
- separator.draw = false;
- toolbar.insert(separator, -1);
-
- var rightbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
- var rightgroup = new Gtk.ToolItem ();
- rightgroup.add (rightbox);
- toolbar.insert(rightgroup, -1);
-
- gtk_actor = new GtkClutter.Actor.with_contents (toolbar);
- gtk_actor.get_widget ().get_style_context ().add_class ("boxes-bg");
- gtk_actor.opacity = 0;
- gtk_actor.set_margin_bottom (32);
- gtk_actor.x_align = Clutter.ActorAlign.CENTER;
- gtk_actor.y_align = Clutter.ActorAlign.END;
- gtk_actor.x_expand = true;
- gtk_actor.y_expand = true;
+ transition_type = Gtk.RevealerTransitionType.SLIDE_UP;
+
+ headerbar = new Gtk.HeaderBar ();
+ add (headerbar);
favorite_btn = new Gtk.ToggleButton ();
- leftbox.add (favorite_btn);
+ headerbar.pack_start (favorite_btn);
favorite_btn.image = new Gtk.Image.from_icon_name ("emblem-favorite-symbolic", Gtk.IconSize.MENU);
favorite_btn.clicked.connect (() => {
foreach (var item in App.app.selected_items) {
@@ -58,7 +28,7 @@ private class Boxes.Selectionbar: GLib.Object {
});
pause_btn = new Gtk.Button ();
- leftbox.add (pause_btn);
+ headerbar.pack_start (pause_btn);
pause_btn.image = new Gtk.Image.from_icon_name ("media-playback-pause-symbolic", Gtk.IconSize.MENU);
pause_btn.clicked.connect (() => {
foreach (var item in App.app.selected_items) {
@@ -78,20 +48,18 @@ private class Boxes.Selectionbar: GLib.Object {
});
remove_btn = new Gtk.Button.from_stock (Gtk.Stock.DELETE);
- rightbox.add (remove_btn);
+ headerbar.pack_start (remove_btn);
remove_btn.clicked.connect (() => {
App.app.remove_selected_items ();
});
properties_btn = new Gtk.Button.from_stock (Gtk.Stock.PROPERTIES);
- rightbox.add (properties_btn);
+ headerbar.pack_end (properties_btn);
properties_btn.clicked.connect (() => {
App.app.show_properties ();
});
- toolbar.show_all ();
-
- actor.reactive = true;
+ show_all ();
App.app.notify["selection-mode"].connect (() => {
update_visible ();
@@ -108,9 +76,9 @@ private class Boxes.Selectionbar: GLib.Object {
private void update_visible () {
if (!App.app.selection_mode)
- visible = false;
+ reveal_child = false;
else
- visible = App.app.selected_items.length () > 0;
+ reveal_child = App.app.selected_items.length () > 0;
}
private void update_favorite_btn () {
@@ -181,10 +149,4 @@ private class Boxes.Selectionbar: GLib.Object {
remove_btn.sensitive = sensitive;
}
-
- private bool visible {
- set {
- fade_actor (actor, value ? 255 : 0);
- }
- }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]