[gnome-boxes] app-window: Move DisplayPage under below_bin stack
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] app-window: Move DisplayPage under below_bin stack
- Date: Thu, 27 Feb 2014 20:55:17 +0000 (UTC)
commit 2bd5fbfe911d5d3d6c8ea02601bbf92cf2c1f1f0
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Thu Feb 27 19:48:02 2014 +0000
app-window: Move DisplayPage under below_bin stack
This simplifies the widget hierarchy quite a bit and fixes the issue of
notifications going invisible on switch to display page.
data/ui/app-window.ui | 182 +++++++++++++++++++++-------------------------
data/ui/display-page.ui | 16 ----
src/app-window.vala | 28 -------
src/display-page.vala | 9 +--
src/machine.vala | 2 +-
src/notificationbar.vala | 5 +-
6 files changed, 88 insertions(+), 154 deletions(-)
---
diff --git a/data/ui/app-window.ui b/data/ui/app-window.ui
index 81d6417..03b632d 100644
--- a/data/ui/app-window.ui
+++ b/data/ui/app-window.ui
@@ -8,35 +8,33 @@
|
|-> main_vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
| |
- | |-> stack = new Gtk.Stack ();
- | |
- | |-> vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
- | | |
- | | |-> searchbar = new Searchbar ();
- | | |
- | | |-> notification_overlay = new Gtk.Overlay ();
- | | |
- | | |-> notificationbar = Boxes.Notificationbar
- | | |
- |-> below_bin = new Gtk.Stack ();
- |
- |-> view = new Boxes.CollectionView ();
- |
- |-> hbox = new Gtk.Box
- | |
- | |-> sidebar_revealer = new Gtk.Revealer
- | |
- | |-> content_bin_actor = Gtk.Stack
- | |
- | |-> wizard = new Boxes.Wizard ();
- | |
- | |-> properties = new Boxes.Properties ();
- |
- |-> empty_boxes = new Boxes.EmptyBoxes ();
- | |
- | |-> display_page = new Boxes.DisplayPage (); // should probably be below_bin child
+ | |-> vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
+ | |
+ | |-> searchbar = new Searchbar ();
+ | |
+ | |-> notification_overlay = new Gtk.Overlay ();
+ | |
+ | |-> notificationbar = Boxes.Notificationbar ();
+ | |
+ |-> below_bin = new Gtk.Stack ();
+ |
+ |-> view = new Boxes.CollectionView ();
+ |
+ |-> below_bin_hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
+ | |
+ | |-> sidebar_revealer = new Gtk.Revealer ();
+ | |
+ | |-> content_bin = Gtk.Stack ();
+ | |
+ | |-> wizard = new Boxes.Wizard ();
+ | |
+ | |-> properties = new Boxes.Properties ();
+ |
+ |-> empty_boxes = new Boxes.EmptyBoxes ();
+ | |
+ | |-> display_page = new Boxes.DisplayPage ();
|
- |-> selectionbar = new Boxes.Selectionbar ();
+ |-> selectionbar = new Boxes.Selectionbar (); // should probably be vbox child
|
|-> topbar = new Boxes.Topbar (); // as titlebar
@@ -58,123 +56,111 @@
<property name="spacing">0</property>
<child>
- <object class="GtkStack" id="stack">
+ <object class="GtkBox" id="vbox">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="transition-type">slide-left-right</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">0</property>
+ <property name="halign">fill</property>
+ <property name="valign">fill</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<child>
- <object class="GtkBox" id="vbox">
+ <object class="BoxesSearchbar" id="searchbar">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">0</property>
- <property name="halign">fill</property>
- <property name="valign">fill</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
+ </object>
+ </child>
- <child>
- <object class="BoxesSearchbar" id="searchbar">
+ <child>
+ <object class="GtkOverlay" id="notification_overlay">
+ <property name="visible">True</property>
+
+ <child type="overlay">
+ <object class="BoxesNotificationbar" id="notificationbar">
<property name="visible">True</property>
</object>
</child>
<child>
- <object class="GtkOverlay" id="notification_overlay">
+ <object class="GtkStack" id="below_bin">
<property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="transition-type">crossfade</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
- <child type="overlay">
- <object class="BoxesNotificationbar" id="notificationbar">
+ <child>
+ <object class="BoxesEmptyBoxes" id="empty_boxes">
<property name="visible">True</property>
</object>
+ <packing>
+ <property name="name">empty-boxes</property>
+ </packing>
</child>
<child>
- <object class="GtkStack" id="below_bin">
+ <object class="BoxesCollectionView" id="view">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="transition-type">crossfade</property>
+ </object>
+ <packing>
+ <property name="name">collection-view</property>
+ </packing>
+ </child>
+
+ <child>
+ <object class="GtkBox" id="below_bin_hbox">
+ <property name="visible">True</property>
+ <property name="orientation">horizontal</property>
+ <property name="halign">fill</property>
+ <property name="valign">fill</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
- <object class="BoxesEmptyBoxes" id="empty_boxes">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="name">empty-boxes</property>
- </packing>
- </child>
-
- <child>
- <object class="BoxesCollectionView" id="view">
+ <object class="BoxesSidebar" id="sidebar">
<property name="visible">True</property>
</object>
- <packing>
- <property name="name">collection-view</property>
- </packing>
</child>
<child>
- <object class="GtkBox" id="below_bin_hbox">
+ <object class="GtkStack" id="content_bin">
<property name="visible">True</property>
- <property name="orientation">horizontal</property>
- <property name="halign">fill</property>
- <property name="valign">fill</property>
+ <property name="homogeneous">False</property>
+ <property name="transition-type">slide-left</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
- <object class="BoxesSidebar" id="sidebar">
+ <object class="BoxesWizard" id="wizard">
<property name="visible">True</property>
</object>
</child>
<child>
- <object class="GtkStack" id="content_bin">
+ <object class="BoxesProperties" id="properties">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="transition-type">slide-left</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
-
- <child>
- <object class="BoxesWizard" id="wizard">
- <property name="visible">True</property>
- </object>
- </child>
-
- <child>
- <object class="BoxesProperties" id="properties">
- <property name="visible">True</property>
- </object>
- </child>
</object>
</child>
</object>
- <packing>
- <property name="name">below-bin-hbox</property>
- </packing>
</child>
</object>
+ <packing>
+ <property name="name">below-bin-hbox</property>
+ </packing>
</child>
- </object>
- </child>
- </object>
- <packing>
- <property name="name">main-page</property>
- </packing>
- </child>
+ <child>
+ <object class="BoxesDisplayPage" id="display_page">
+ <property name="visible">True</property>
+ </object>
- <child>
- <object class="BoxesDisplayPage" id="display_page">
- <property name="visible">True</property>
+ <packing>
+ <property name="name">display-page</property>
+ </packing>
+ </child>
+ </object>
+ </child>
</object>
-
- <packing>
- <property name="name">display-page</property>
- </packing>
</child>
</object>
</child>
diff --git a/data/ui/display-page.ui b/data/ui/display-page.ui
index aaf2fe2..a5fcfe0 100644
--- a/data/ui/display-page.ui
+++ b/data/ui/display-page.ui
@@ -65,22 +65,6 @@
<property name="height">1</property>
</packing>
</child>
-
- <child>
- <object class="GtkGrid" id="notification_grid">
- <property name="visible">True</property>
- <property name="valign">start</property>
- <property name="halign">center</property>
- <property name="vexpand">True</property>
- </object>
-
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
</object>
<packing>
diff --git a/src/app-window.vala b/src/app-window.vala
index db3fff8..2cae20a 100644
--- a/src/app-window.vala
+++ b/src/app-window.vala
@@ -2,29 +2,10 @@
using Gtk;
using Gdk;
-private enum Boxes.AppPage {
- MAIN,
- DISPLAY
-}
-
[GtkTemplate (ui = "/org/gnome/Boxes/ui/app-window.ui")]
private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
public UIState previous_ui_state { get; protected set; }
public UIState ui_state { get; protected set; }
- public AppPage page {
- get {
- if (stack.get_visible_child_name () == "display-page")
- return AppPage.DISPLAY;
- else
- return AppPage.MAIN;
- }
- set {
- if (value == AppPage.DISPLAY)
- stack.set_visible_child_name ("display-page");
- else
- stack.set_visible_child_name ("main-page");
- }
- }
[CCode (notify = false)]
public bool fullscreened {
@@ -39,8 +20,6 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
private bool maximized { get { return WindowState.MAXIMIZED in get_window ().get_state (); } }
[GtkChild]
- private Gtk.Stack stack;
- [GtkChild]
public Searchbar searchbar;
[GtkChild]
public Topbar topbar;
@@ -127,10 +106,6 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
settings.set_value ("window-position", new int[] { x, y });
}
- private void set_main_ui_state () {
- stack.set_visible_child_name ("main-page");
- }
-
private void ui_state_changed () {
// The order is important for some widgets here (e.g properties must change its state before wizard
so it can
// flush any deferred changes for wizard to pick-up when going back from properties to wizard
(review).
@@ -138,9 +113,6 @@ private class Boxes.AppWindow: Gtk.ApplicationWindow, Boxes.UI {
ui.set_state (ui_state);
}
- if (ui_state != UIState.DISPLAY)
- set_main_ui_state ();
-
if (ui_state != UIState.COLLECTION)
searchbar.search_mode_enabled = false;
diff --git a/src/display-page.vala b/src/display-page.vala
index 0d22403..743be4e 100644
--- a/src/display-page.vala
+++ b/src/display-page.vala
@@ -13,8 +13,6 @@ private class Boxes.DisplayPage: Gtk.Box {
private DisplayToolbar overlay_toolbar;
[GtkChild]
private EventBox overlay_toolbar_box;
- [GtkChild]
- private Grid notification_grid;
private uint toolbar_hide_id;
private uint toolbar_show_id;
private ulong cursor_id;
@@ -49,10 +47,6 @@ private class Boxes.DisplayPage: Gtk.Box {
toolbar.bind_property ("subtitle", overlay_toolbar, "subtitle", BindingFlags.SYNC_CREATE);
}
- public void add_notification (Widget w) {
- notification_grid.attach (w, 0, 0, 1, 1);
- }
-
private void update_toolbar_visible() {
if (App.window.fullscreened && can_grab_mouse)
toolbar.visible = true;
@@ -142,7 +136,8 @@ private class Boxes.DisplayPage: Gtk.Box {
return false;
});
- App.window.page = Boxes.AppPage.DISPLAY;
+ App.window.below_bin.set_visible_child_name ("display-page");
+
widget.grab_focus ();
}
diff --git a/src/machine.vala b/src/machine.vala
index dcc50c7..17d5cce 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -500,7 +500,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
break;
case Boxes.UIState.DISPLAY:
if (previous_ui_state == UIState.PROPERTIES)
- App.window.page = Boxes.AppPage.DISPLAY;
+ App.window.below_bin.set_visible_child_name ("display-page");
break;
diff --git a/src/notificationbar.vala b/src/notificationbar.vala
index 51a2fc4..44d1a38 100644
--- a/src/notificationbar.vala
+++ b/src/notificationbar.vala
@@ -78,10 +78,7 @@ private class Boxes.Notificationbar: Gtk.Grid {
}
private void add_notification (Widget w) {
- if (App.window.page == AppPage.MAIN)
- attach (w, 0, 0, 1, 1);
- else
- App.window.display_page.add_notification (w);
+ attach (w, 0, 0, 1, 1);
}
private Gd.Notification display (string message,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]