[shotwell] Make toolbar a GtkOverlay instead of a popup
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell] Make toolbar a GtkOverlay instead of a popup
- Date: Sat, 21 May 2016 20:51:09 +0000 (UTC)
commit 1910f06c867424df7c9254f7ac4eed9432e976ea
Author: Jens Georg <mail jensge org>
Date: Sat May 21 22:41:41 2016 +0200
Make toolbar a GtkOverlay instead of a popup
Signed-off-by: Jens Georg <mail jensge org>
https://bugzilla.gnome.org/show_bug.cgi?id=756126
src/AppWindow.vala | 48 +++++++++++++-----------------------------------
1 files changed, 13 insertions(+), 35 deletions(-)
---
diff --git a/src/AppWindow.vala b/src/AppWindow.vala
index 743c72e..dcb88fd 100644
--- a/src/AppWindow.vala
+++ b/src/AppWindow.vala
@@ -9,7 +9,8 @@ public class FullscreenWindow : PageWindow {
public const int TOOLBAR_DISMISSAL_SEC = 2;
public const int TOOLBAR_CHECK_DISMISSAL_MSEC = 500;
- private Gtk.Window toolbar_window = new Gtk.Window(Gtk.WindowType.POPUP);
+ private Gtk.Overlay overlay = new Gtk.Overlay();
+ private Gtk.Toolbar toolbar = null;
private Gtk.ToolButton close_button = new Gtk.ToolButton(null, null);
private Gtk.ToggleToolButton pin_button = new Gtk.ToggleToolButton();
private bool is_toolbar_shown = false;
@@ -59,8 +60,12 @@ public class FullscreenWindow : PageWindow {
close_button.set_tooltip_text(_("Leave fullscreen"));
close_button.clicked.connect(on_close);
- Gtk.Toolbar toolbar = page.get_toolbar();
+ toolbar = page.get_toolbar();
toolbar.set_show_arrow(false);
+ toolbar.valign = Gtk.Align.END;
+ toolbar.halign = Gtk.Align.CENTER;
+ toolbar.expand = false;
+ toolbar.opacity = Resources.TRANSIENT_WINDOW_OPACITY;
if (page is SlideshowPage) {
// slideshow page doesn't own toolbar to hide it, subscribe to signal instead
@@ -75,14 +80,9 @@ public class FullscreenWindow : PageWindow {
toolbar.insert(close_button, -1);
- // set up toolbar along bottom of screen
- toolbar_window.set_screen(get_screen());
- toolbar_window.set_border_width(0);
- toolbar_window.add(toolbar);
-
- toolbar_window.realize.connect(on_toolbar_realized);
-
- add(page);
+ add(overlay);
+ overlay.add(page);
+ overlay.add_overlay (toolbar);
// call to set_default_size() saves one repaint caused by changing
// size from default to full screen. In slideshow mode, this change
@@ -159,7 +159,6 @@ public class FullscreenWindow : PageWindow {
private void on_close() {
Config.Facade.get_instance().set_pin_toolbar_state(is_toolbar_dismissal_enabled);
hide_toolbar();
- toolbar_window = null;
AppWindow.get_instance().end_fullscreen();
}
@@ -213,7 +212,7 @@ public class FullscreenWindow : PageWindow {
devmgr.get_client_pointer().get_position(null, null, out py);
int wy;
- toolbar_window.get_window().get_geometry(null, out wy, null, null);
+ toolbar.get_window().get_geometry(null, out wy, null, null);
return (py >= wy);
}
@@ -232,26 +231,8 @@ public class FullscreenWindow : PageWindow {
return false;
}
- private void on_toolbar_realized() {
- Gtk.Requisition req;
- toolbar_window.get_preferred_size(null, out req);
-
- // place the toolbar in the center of the monitor along the bottom edge
- Gdk.Rectangle monitor = get_monitor_geometry();
- int tx = monitor.x + (monitor.width - req.width) / 2;
- if (tx < 0)
- tx = 0;
-
- int ty = monitor.y + monitor.height - req.height;
- if (ty < 0)
- ty = 0;
-
- toolbar_window.move(tx, ty);
- toolbar_window.set_opacity(Resources.TRANSIENT_WINDOW_OPACITY);
- }
-
private void invoke_toolbar() {
- toolbar_window.show_all();
+ toolbar.show_all();
is_toolbar_shown = true;
@@ -262,9 +243,6 @@ public class FullscreenWindow : PageWindow {
if (!is_toolbar_shown)
return false;
- if (toolbar_window == null)
- return false;
-
// if dismissal is disabled, keep open but keep checking
if ((!is_toolbar_dismissal_enabled))
return true;
@@ -296,7 +274,7 @@ public class FullscreenWindow : PageWindow {
}
private void hide_toolbar() {
- toolbar_window.hide();
+ toolbar.hide();
is_toolbar_shown = false;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]