[gnome-boxes] display-toolbar: Drop use of AppWindow singleton
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] display-toolbar: Drop use of AppWindow singleton
- Date: Fri, 8 Aug 2014 16:22:59 +0000 (UTC)
commit fa191b4f1978efcbe3b8140e07b9ada63359c3ca
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri Jul 18 08:11:00 2014 +0200
display-toolbar: Drop use of AppWindow singleton
Instead of using the AppWindow singleton, DisplayToolbar now has its own
reference to AppWindow that it receives through a parameter to setup_ui().
This is needed to drop the use of AppWindow singleton and therefore to
make multiple windows possible.
https://bugzilla.gnome.org/show_bug.cgi?id=732098
src/display-page.vala | 3 +++
src/display-toolbar.vala | 16 +++++++++++-----
src/topbar.vala | 1 +
3 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/display-page.vala b/src/display-page.vala
index 144ce17..f4dc9ce 100644
--- a/src/display-page.vala
+++ b/src/display-page.vala
@@ -51,6 +51,9 @@ private class Boxes.DisplayPage: Gtk.Box {
toolbar.bind_property ("title", overlay_toolbar, "title", BindingFlags.SYNC_CREATE);
toolbar.bind_property ("subtitle", overlay_toolbar, "subtitle", BindingFlags.SYNC_CREATE);
+
+ toolbar.setup_ui (window);
+ overlay_toolbar.setup_ui (window);
}
private void update_toolbar_visible() {
diff --git a/src/display-toolbar.vala b/src/display-toolbar.vala
index ac82be3..2de6165 100644
--- a/src/display-toolbar.vala
+++ b/src/display-toolbar.vala
@@ -17,6 +17,8 @@ private class Boxes.DisplayToolbar: Gtk.HeaderBar {
[GtkChild]
private Gtk.Button props;
+ private AppWindow window;
+
public DisplayToolbar (bool overlay, bool handle_drag) {
Object (overlay: overlay,
handle_drag: handle_drag);
@@ -44,13 +46,17 @@ private class Boxes.DisplayToolbar: Gtk.HeaderBar {
}
App.app.notify["fullscreened"].connect_after ( () => {
- if (App.window.fullscreened)
+ if (window.fullscreened)
fullscreen_image.icon_name = "view-restore-symbolic";
else
fullscreen_image.icon_name = "view-fullscreen-symbolic";
});
}
+ public void setup_ui (AppWindow window) {
+ this.window = window;
+}
+
private bool button_down;
private int button_down_x;
private int button_down_y;
@@ -88,7 +94,7 @@ private class Boxes.DisplayToolbar: Gtk.HeaderBar {
// Break out when the dragged distance is 40 pixels
if (dx * dx + dy * dy > 40 * 40) {
button_down = false;
- App.window.fullscreened = false;
+ window.fullscreened = false;
var window = get_toplevel () as Gtk.Window;
int old_width;
@@ -114,16 +120,16 @@ private class Boxes.DisplayToolbar: Gtk.HeaderBar {
[GtkCallback]
private void on_back_clicked () {
- App.window.set_state (UIState.COLLECTION);
+ window.set_state (UIState.COLLECTION);
}
[GtkCallback]
private void on_fullscreen_clicked () {
- App.window.fullscreened = !App.window.fullscreened;
+ window.fullscreened = !window.fullscreened;
}
[GtkCallback]
private void on_props_clicked () {
- App.window.set_state (UIState.PROPERTIES);
+ window.set_state (UIState.PROPERTIES);
}
}
diff --git a/src/topbar.vala b/src/topbar.vala
index 00cf2ad..a96dfcc 100644
--- a/src/topbar.vala
+++ b/src/topbar.vala
@@ -111,6 +111,7 @@ private class Boxes.Topbar: Gtk.Stack, Boxes.UI {
collection_toolbar.setup_ui (window);
selection_toolbar.setup_ui (window);
+ display_toolbar.setup_ui (window);
}
private void ui_state_changed () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]