[gnome-boxes] Show machine name in display toolbar overlay
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Show machine name in display toolbar overlay
- Date: Thu, 20 Oct 2011 23:50:56 +0000 (UTC)
commit d30130cdd4097ee810274979ef32b8de71303bdd
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date: Fri Oct 21 01:50:34 2011 +0200
Show machine name in display toolbar overlay
src/app.vala | 11 +++++++++--
src/machine.vala | 33 +++++++--------------------------
2 files changed, 16 insertions(+), 28 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 2857415..c606838 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -225,6 +225,7 @@ private class Boxes.DisplayPage: GLib.Object {
private Gtk.Toolbar toolbar;
private uint toolbar_show_id;
private uint toolbar_hide_id;
+ private Gtk.Label title;
public DisplayPage (Boxes.App app) {
this.app = app;
@@ -266,6 +267,12 @@ private class Boxes.DisplayPage: GLib.Object {
toolbar.insert (back, 0);
toolbar.set_show_arrow (false);
+ title = new Gtk.Label ("Display");
+ var item = new Gtk.ToolItem ();
+ item.add (title);
+ item.set_expand (true);
+ toolbar.insert (item, -1);
+
toolbar.set_halign (Gtk.Align.FILL);
toolbar.set_valign (Gtk.Align.START);
@@ -308,10 +315,10 @@ private class Boxes.DisplayPage: GLib.Object {
}
}
- public void show_display (Gtk.Widget display) {
+ public void show_display (Boxes.Machine machine, Gtk.Widget display) {
remove_display ();
toolbar.hide ();
-
+ title.set_text (machine.name);
event_box.add (display);
event_box.show_all ();
app.notebook.page = Boxes.AppPage.DISPLAY;
diff --git a/src/machine.vala b/src/machine.vala
index 8cd6157..13e55be 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -40,7 +40,13 @@ private class Boxes.Machine: Boxes.CollectionItem {
show_id = _display.show.connect ((id) => {
app.ui_state = Boxes.UIState.DISPLAY;
try {
- machine_actor.show_display (display.get_display (0));
+ var widget = display.get_display (0);
+
+ Timeout.add (Boxes.App.duration, () => {
+ app.display_page.show_display (this, widget);
+ widget.grab_focus ();
+ return false;
+ });
} catch (Boxes.Error error) {
warning (error.message);
}
@@ -293,7 +299,6 @@ private class Boxes.MachineActor: Boxes.UI {
private Gtk.Label label;
private Gtk.VBox vbox; // and the vbox under it
private Gtk.Entry password_entry;
- private Gtk.Widget? display;
private Machine machine;
public MachineActor (Machine machine) {
@@ -347,29 +352,6 @@ private class Boxes.MachineActor: Boxes.UI {
screenshot.set_from_pixbuf (pixbuf);
}
- public void show_display (Gtk.Widget display) {
- if (this.display != null) {
- warning ("This box actor already contains a display");
- return;
- }
-
- /* before display was in the vbox, but there are scaling issues, so now on stage */
- this.display = display;
-
- // FIXME: there is flickering if we show it without delay
- // where does this rendering delay come from?
- Timeout.add (Boxes.App.duration, () => {
- machine.app.display_page.show_display (display);
- display.grab_focus ();
- return false;
- });
- }
-
- public void hide_display () {
- machine.app.display_page.remove_display ();
- display = null;
- }
-
public void set_password_needed (bool needed) {
password_entry.set_sensitive (needed);
password_entry.set_can_focus (needed);
@@ -404,7 +386,6 @@ private class Boxes.MachineActor: Boxes.UI {
}
case UIState.COLLECTION:
- hide_display ();
scale_screenshot ();
password_entry.set_can_focus (false);
password_entry.hide ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]