[gnome-boxes] Add properties button to selection toolbar
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Add properties button to selection toolbar
- Date: Fri, 26 Oct 2012 15:00:39 +0000 (UTC)
commit 9f02dc44d59d3aeda4333611078b2ef7f3573e31
Author: Alexander Larsson <alexl redhat com>
Date: Fri Oct 26 11:14:55 2012 +0200
Add properties button to selection toolbar
This allows showing the properties view for both running and
non-running boxes.
https://bugzilla.gnome.org/show_bug.cgi?id=677714
src/app.vala | 11 +++++++++++
src/selectionbar.vala | 16 ++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index cec1d13..b74ada5 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -634,6 +634,17 @@ private class Boxes.App: Boxes.UI {
owned get { return view.get_selected_items (); }
}
+ public void show_properties () {
+ var selected_items = view.get_selected_items ();
+
+ // Show for the first selected item
+ foreach (var item in selected_items) {
+ current_item = item;
+ ui_state = UIState.PROPERTIES;
+ break;
+ }
+ }
+
public void remove_selected_items () {
var selected_items = view.get_selected_items ();
var num_selected = selected_items.length ();
diff --git a/src/selectionbar.vala b/src/selectionbar.vala
index 9e9db62..af0eee6 100644
--- a/src/selectionbar.vala
+++ b/src/selectionbar.vala
@@ -11,6 +11,7 @@ private class Boxes.Selectionbar: GLib.Object {
private Gtk.ToggleButton favorite_btn;
private Gtk.Button pause_btn;
private Gtk.ToggleButton remove_btn;
+ private Gtk.Button properties_btn;
public Selectionbar () {
toolbar = new Gtk.Toolbar ();
@@ -78,6 +79,14 @@ private class Boxes.Selectionbar: GLib.Object {
remove_btn.clicked.connect (() => {
App.app.remove_selected_items ();
});
+
+ properties_btn = new Gtk.Button ();
+ rightbox.add (properties_btn);
+ properties_btn.image = new Gtk.Image.from_icon_name ("preferences-system-symbolic", Gtk.IconSize.MENU);
+ properties_btn.clicked.connect (() => {
+ App.app.show_properties ();
+ });
+
toolbar.show_all ();
actor.reactive = true;
@@ -89,6 +98,7 @@ private class Boxes.Selectionbar: GLib.Object {
App.app.notify["selected-items"].connect (() => {
update_visible ();
update_favorite_btn ();
+ update_properties_btn ();
});
}
@@ -121,6 +131,12 @@ private class Boxes.Selectionbar: GLib.Object {
favorite_btn.sensitive = sensitive;
}
+ private void update_properties_btn () {
+ var sensitive = App.app.selected_items.length () == 1;
+
+ properties_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]