[gnome-shell] Add the workspaces view key to the gconf schema
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Add the workspaces view key to the gconf schema
- Date: Mon, 22 Feb 2010 22:02:29 +0000 (UTC)
commit e5ba414f2d8b1ec5a183d21ed03511a8d46ee974
Author: Dan Winship <danw gnome org>
Date: Sat Feb 13 16:39:13 2010 -0500
Add the workspaces view key to the gconf schema
Also rename the key to make it less ambiguous, and change its value
from an int to a string.
https://bugzilla.gnome.org/show_bug.cgi?id=609871
data/gnome-shell.schemas | 15 +++++++++++++++
js/ui/workspacesView.js | 26 ++++++++++++++++----------
2 files changed, 31 insertions(+), 10 deletions(-)
---
diff --git a/data/gnome-shell.schemas b/data/gnome-shell.schemas
index 462a62e..bc3dd42 100644
--- a/data/gnome-shell.schemas
+++ b/data/gnome-shell.schemas
@@ -164,6 +164,21 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/desktop/gnome/shell/overview/workspaces_view</key>
+ <applyto>/desktop/gnome/shell/overview/workspaces_view</applyto>
+ <owner>gnome-shell</owner>
+ <type>string</type>
+ <default>single</default>
+ <locale name="C">
+ <short>Overview workspace view mode</short>
+ <long>
+ The selected workspace view mode in the overview.
+ Supported values are "single" and "grid".
+ </long>
+ </locale>
+ </schema>
+
</schemalist>
</gconfschemafile>
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index e129a76..5f03607 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -25,10 +25,13 @@ const WORKSPACE_SWITCH_TIME = 0.25;
// Note that mutter has a compile-time limit of 36
const MAX_WORKSPACES = 16;
+// The values here are also used for gconf, and the key and value
+// names must match
const WorkspacesViewType = {
- SINGLE: 0,
- MOSAIC: 1
+ SINGLE: 'single',
+ GRID: 'grid'
};
+const WORKSPACES_VIEW_KEY = 'overview/workspaces_view';
function GenericWorkspacesView(width, height, x, y, animate) {
this._init(width, height, x, y, animate);
@@ -950,24 +953,27 @@ function WorkspacesViewSwitch() {
}
WorkspacesViewSwitch.prototype = {
- VIEW_KEY: 'view',
-
_init: function() {
this._gconf = Shell.GConf.get_default();
this._mosaicViewButton = null;
this._singleViewButton = null;
- this._currentViewType = this._gconf.get_int(this.VIEW_KEY);
this._controlsBar = null;
+
+ let view = this._gconf.get_string(WORKSPACES_VIEW_KEY).toUpperCase();
+ if (view in WorkspacesViewType)
+ this._currentViewType = WorkspacesViewType[view];
+ else
+ this._currentViewType = WorkspacesViewType.SINGLE;
},
_setView: function(view) {
- this._mosaicViewButton.set_checked(WorkspacesViewType.MOSAIC == view);
+ this._mosaicViewButton.set_checked(WorkspacesViewType.GRID == view);
this._singleViewButton.set_checked(WorkspacesViewType.SINGLE == view);
if (this._currentViewType == view)
return;
this._currentViewType = view;
- this._gconf.set_int(this.VIEW_KEY, view);
+ this._gconf.set_string(WORKSPACES_VIEW_KEY, view);
this.emit('view-changed');
},
@@ -975,7 +981,7 @@ WorkspacesViewSwitch.prototype = {
switch (this._currentViewType) {
case WorkspacesViewType.SINGLE:
return new SingleView(width, height, x, y, animate);
- case WorkspacesViewType.MOSAIC:
+ case WorkspacesViewType.GRID:
return new MosaicView(width, height, x, y, animate);
default:
return new MosaicView(width, height, x, y, animate);
@@ -988,7 +994,7 @@ WorkspacesViewSwitch.prototype = {
this._mosaicViewButton = new St.Button({ style_class: "workspace-controls switch-mosaic" });
this._mosaicViewButton.set_toggle_mode(true);
this._mosaicViewButton.connect('clicked', Lang.bind(this, function() {
- this._setView(WorkspacesViewType.MOSAIC);
+ this._setView(WorkspacesViewType.GRID);
}));
actor.add(this._mosaicViewButton, {'y-fill' : false, 'y-align' : St.Align.START});
@@ -999,7 +1005,7 @@ WorkspacesViewSwitch.prototype = {
}));
actor.add(this._singleViewButton, {'y-fill' : false, 'y-align' : St.Align.START});
- if (this._currentViewType == WorkspacesViewType.MOSAIC)
+ if (this._currentViewType == WorkspacesViewType.GRID)
this._mosaicViewButton.set_checked(true);
else
this._singleViewButton.set_checked(true);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]