[gnome-shell] workspace: Make close button respect button_layout
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] workspace: Make close button respect button_layout
- Date: Tue, 7 Jun 2011 18:55:13 +0000 (UTC)
commit ea1e5a5210bbade987fb63b7f40dffe6d250d433
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Jun 7 12:27:52 2011 +0200
workspace: Make close button respect button_layout
Make the close button in the overview follow the user preference
for the window button layout.
https://bugzilla.gnome.org/show_bug.cgi?id=620105
js/ui/workspace.js | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 1650e7f..9c1acd1 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -1,6 +1,7 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter;
+const GConf = imports.gi.GConf;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
@@ -27,6 +28,8 @@ const CLOSE_BUTTON_FADE_TIME = 0.1;
const DRAGGING_WINDOW_OPACITY = 100;
+const BUTTON_LAYOUT_KEY = '/desktop/gnome/shell/windows/button_layout';
+
// Define a layout scheme for small window counts. For larger
// counts we fall back to an algorithm. We need more schemes here
// unless we have a really good algorithm.
@@ -435,9 +438,20 @@ WindowOverlay.prototype = {
let button = this.closeButton;
let title = this.title;
+ let gconf = GConf.Client.get_default();
+ let layout = gconf.get_string(BUTTON_LAYOUT_KEY);
+ let rtl = St.Widget.get_default_direction() == St.TextDirection.RTL;
+
+ let split = layout.split(":");
+ let side;
+ if (split[0].indexOf("close") > -1)
+ side = rtl ? St.Side.RIGHT : St.Side.LEFT;
+ else
+ side = rtl ? St.Side.LEFT : St.Side.RIGHT;
+
let buttonX;
let buttonY = cloneY - (button.height - button._overlap);
- if (St.Widget.get_default_direction() == St.TextDirection.RTL)
+ if (side == St.Side.LEFT)
buttonX = cloneX - (button.width - button._overlap);
else
buttonX = cloneX + (cloneWidth - button._overlap);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]