[the-board] [ui] Rename ToolBoxGroup to simply Toolbar
- From: Lucas Almeida Rocha <lucasr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [the-board] [ui] Rename ToolBoxGroup to simply Toolbar
- Date: Sun, 7 Nov 2010 23:21:35 +0000 (UTC)
commit 466e4bc5958227bf0a0a8a32e0eb6cb72a6ab542
Author: Lucas Rocha <lucasr gnome org>
Date: Sun Nov 7 22:36:59 2010 +0000
[ui] Rename ToolBoxGroup to simply Toolbar
Toolbar is a simpler name and better matches the semantics of the
widget.
data/style/style.css | 6 +-
src/Makefile-js.am | 2 +-
src/js/ui/mainWindow.js | 142 ++++++++++++++--------------
src/js/ui/thing.js | 6 +-
src/js/ui/things/photo.js | 11 +-
src/js/ui/things/video.js | 11 +-
src/js/ui/{toolBoxGroup.js => toolbar.js} | 22 ++--
7 files changed, 99 insertions(+), 101 deletions(-)
---
diff --git a/data/style/style.css b/data/style/style.css
index 479e678..2bdc229 100644
--- a/data/style/style.css
+++ b/data/style/style.css
@@ -127,15 +127,15 @@ TbBox#spinner-main-box {
background-color: #FFFFFFDD;
}
-/* ToolBoxGroup */
+/* Toolbar */
-TbBox#tool-box-group-main-box {
+TbBox#toolbar-main-box {
border-image: url("page-list-shadow.png") 1 8 8 8;
background-color: none;
padding: 0px 8px 8px 8px;
}
-TbBox#tool-box-group-content-box {
+TbBox#toolbar-content-box {
background-color: white;
spacing: 35px;
}
diff --git a/src/Makefile-js.am b/src/Makefile-js.am
index 5e66e84..27d453e 100644
--- a/src/Makefile-js.am
+++ b/src/Makefile-js.am
@@ -13,9 +13,9 @@ dist_jsui_DATA = \
js/ui/page.js \
js/ui/pageButton.js \
js/ui/thing.js \
+ js/ui/toolbar.js \
js/ui/toolBox.js \
js/ui/toolBoxBackgrounds.js \
- js/ui/toolBoxGroup.js \
js/ui/toolBoxPages.js \
js/ui/toolBoxThings.js
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index 95d85ad..d0abb8b 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -19,7 +19,7 @@ const PhotoThing = imports.ui.things.photo;
const Thing = imports.ui.thing;
const ToolBox = imports.ui.toolBox;
const ToolBoxBackgrounds = imports.ui.toolBoxBackgrounds;
-const ToolBoxGroup = imports.ui.toolBoxGroup;
+const Toolbar = imports.ui.toolbar;
const ToolBoxPages = imports.ui.toolBoxPages;
const ToolBoxThings = imports.ui.toolBoxThings;
@@ -51,9 +51,9 @@ MainWindow.prototype = {
this._keyFocusActor = null;
this._currentPage = null;
- this._activeToolBoxGroup = null;
- this._thingToolBoxGroup = null;
- this._toolBoxGroupsByThingId = {};
+ this._activeToolbar = null;
+ this._thingToolbar = null;
+ this._toolbarsByThingId = {};
this._createGtkWindow();
this._createClutterEmbed();
@@ -65,7 +65,7 @@ MainWindow.prototype = {
this._createContentBox();
this._createContext();
- this._createToolBoxGroup();
+ this._createToolbar();
this._createSpinner();
// show loading screen as soon as possible
@@ -190,23 +190,23 @@ MainWindow.prototype = {
this._onStartupBoxTimeout))
},
- _createToolBoxGroup : function() {
- this._mainToolBoxGroup = new ToolBoxGroup.ToolBoxGroup();
+ _createToolbar : function() {
+ this._mainToolbar = new Toolbar.Toolbar();
- this._mainToolBoxGroup.actor.depth = _LAYER_TOOLBOX;
+ this._mainToolbar.actor.depth = _LAYER_TOOLBOX;
this._createToolBoxPages();
this._createToolBoxThings();
this._createToolBoxBackgrounds();
- this._contentBox.append(this._mainToolBoxGroup.actor,
+ this._contentBox.append(this._mainToolbar.actor,
Tb.BoxPackFlags.FIXED);
- this._contentBox.set_fixed_child_align(this._mainToolBoxGroup.actor,
+ this._contentBox.set_fixed_child_align(this._mainToolbar.actor,
Tb.BoxAlignment.CENTER,
Tb.BoxAlignment.START);
- this._updateActiveToolBoxGroup();
+ this._updateActiveToolbar();
},
_createSpinner : function() {
@@ -236,21 +236,21 @@ MainWindow.prototype = {
this._toolBoxPages =
new ToolBoxPages.ToolBoxPages({ context: this._context });
- this._mainToolBoxGroup.addToolBox(this._toolBoxPages);
+ this._mainToolbar.addToolBox(this._toolBoxPages);
},
_createToolBoxThings : function() {
this._toolBoxThings =
new ToolBoxThings.ToolBoxThings({ mainWindow: this });
- this._mainToolBoxGroup.addToolBox(this._toolBoxThings);
+ this._mainToolbar.addToolBox(this._toolBoxThings);
},
_createToolBoxBackgrounds : function() {
this._toolBoxBackgrounds =
new ToolBoxBackgrounds.ToolBoxBackgrounds({ mainWindow: this });
- this._mainToolBoxGroup.addToolBox(this._toolBoxBackgrounds);
+ this._mainToolbar.addToolBox(this._toolBoxBackgrounds);
},
_createContext : function() {
@@ -316,65 +316,65 @@ MainWindow.prototype = {
onComplete: Lang.bind(this, onComplete) });
},
- _setActiveToolBoxGroup : function(activeToolBoxGroup) {
- if (this._activeToolBoxGroup == activeToolBoxGroup) {
+ _setActiveToolbar : function(activeToolbar) {
+ if (this._activeToolbar == activeToolbar) {
return;
}
- if (this._activeToolBoxGroup) {
- this._activeToolBoxGroup.disconnect(this._toolBoxGroupActiveChangedId);
- delete this._toolBoxGroupActiveChangedId;
+ if (this._activeToolbar) {
+ this._activeToolbar.disconnect(this._toolbarActiveChangedId);
+ delete this._toolbarActiveChangedId;
- this._activeToolBoxGroup.disconnect(this._toolBoxGroupActionId);
- delete this._toolBoxGroupActionId;
+ this._activeToolbar.disconnect(this._toolbarActionId);
+ delete this._toolbarActionId;
}
- this._activeToolBoxGroup = activeToolBoxGroup;
+ this._activeToolbar = activeToolbar;
- if (this._activeToolBoxGroup) {
- this._toolBoxGroupActiveChangedId =
- this._activeToolBoxGroup.connect("active-changed",
+ if (this._activeToolbar) {
+ this._toolbarActiveChangedId =
+ this._activeToolbar.connect("active-changed",
Lang.bind(this,
- this._onToolBoxGroupActiveChanged));
+ this._onToolbarActiveChanged));
- this._toolBoxGroupActionId =
- this._activeToolBoxGroup.connect("action",
+ this._toolbarActionId =
+ this._activeToolbar.connect("action",
Lang.bind(this,
- this._onToolBoxGroupAction));
+ this._onToolbarAction));
}
},
- _updateActiveToolBoxGroup : function() {
- let activeToolBoxGroup = null;
+ _updateActiveToolbar : function() {
+ let activeToolbar = null;
if (this._currentPage &&
this._currentPage.activeThing) {
- activeToolBoxGroup = this._thingToolBoxGroup;
+ activeToolbar = this._thingToolbar;
} else {
- activeToolBoxGroup = this._mainToolBoxGroup;
+ activeToolbar = this._mainToolbar;
}
- if (this._activeToolBoxGroup == activeToolBoxGroup) {
+ if (this._activeToolbar == activeToolbar) {
return;
}
- let oldActiveToolBoxGroup = this._activeToolBoxGroup;
- this._setActiveToolBoxGroup(activeToolBoxGroup);
+ let oldActiveToolbar = this._activeToolbar;
+ this._setActiveToolbar(activeToolbar);
let onSlideOut = function() {
- if (activeToolBoxGroup) {
- activeToolBoxGroup.slideIn();
+ if (activeToolbar) {
+ activeToolbar.slideIn();
}
};
- if (oldActiveToolBoxGroup) {
- oldActiveToolBoxGroup.slideOut(onSlideOut);
- } else if (activeToolBoxGroup) {
- activeToolBoxGroup.slideIn();
+ if (oldActiveToolbar) {
+ oldActiveToolbar.slideOut(onSlideOut);
+ } else if (activeToolbar) {
+ activeToolbar.slideIn();
}
},
- _createThingToolBoxGroup : function() {
+ _createThingToolbar : function() {
if (!this._currentPage ||
!this._currentPage.activeThing) {
return null;
@@ -382,40 +382,40 @@ MainWindow.prototype = {
let thingId = this._currentPage.activeThing.id;
- if (thingId in this._toolBoxGroupsByThingId) {
- return this._toolBoxGroupsByThingId[thingId];
+ if (thingId in this._toolbarsByThingId) {
+ return this._toolbarsByThingId[thingId];
}
- let thingToolBoxGroup =
- Thing.createToolBoxGroup(thingId,
+ let thingToolbar =
+ Thing.createToolbar(thingId,
{ mainWindow: this });
- if (thingToolBoxGroup) {
- thingToolBoxGroup.actor.depth = _LAYER_TOOLBOX;
+ if (thingToolbar) {
+ thingToolbar.actor.depth = _LAYER_TOOLBOX;
- this._toolBoxGroupsByThingId[thingId] = thingToolBoxGroup;
+ this._toolbarsByThingId[thingId] = thingToolbar;
- this._contentBox.append(thingToolBoxGroup.actor,
+ this._contentBox.append(thingToolbar.actor,
Tb.BoxPackFlags.FIXED);
- this._contentBox.set_fixed_child_align(thingToolBoxGroup.actor,
+ this._contentBox.set_fixed_child_align(thingToolbar.actor,
Tb.BoxAlignment.CENTER,
Tb.BoxAlignment.START);
}
- return thingToolBoxGroup;
+ return thingToolbar;
},
- _updateThingToolBoxGroup : function() {
- let newThingToolBoxGroup =
- this._createThingToolBoxGroup();
+ _updateThingToolbar : function() {
+ let newThingToolbar =
+ this._createThingToolbar();
- if (this._thingToolBoxGroup == newThingToolBoxGroup) {
+ if (this._thingToolbar == newThingToolbar) {
return;
}
- this._thingToolBoxGroup = newThingToolBoxGroup;
- this._updateActiveToolBoxGroup();
+ this._thingToolbar = newThingToolbar;
+ this._updateActiveToolbar();
},
_showSpinner : function() {
@@ -597,14 +597,14 @@ MainWindow.prototype = {
clipboard.request_text(onTextReceived, null);
},
- _onToolBoxGroupActiveChanged : function() {
- if (this._currentPage && this._activeToolBoxGroup.active) {
+ _onToolbarActiveChanged : function() {
+ if (this._currentPage && this._activeToolbar.active) {
this._currentPage.setActiveThing(null);
}
},
- _onToolBoxGroupAction : function(toolBoxGroup, actionName, actionArgs) {
- if (toolBoxGroup == this._mainToolBoxGroup) {
+ _onToolbarAction : function(toolbar, actionName, actionArgs) {
+ if (toolbar == this._mainToolbar) {
// FIXME: convert main toolbox group to use actions
// instead of internally hardcoded handlers
return;
@@ -704,15 +704,15 @@ MainWindow.prototype = {
_onPageActiveThingChanged : function() {
if (this._currentPage.activeThing === null) {
this._mainBox.grab_key_focus();
- } else if (this._activeToolBoxGroup) {
- this._activeToolBoxGroup.deactivate();
+ } else if (this._activeToolbar) {
+ this._activeToolbar.deactivate();
}
- this._updateThingToolBoxGroup();
+ this._updateThingToolbar();
},
_onPageButtonPressEvent : function() {
- this._activeToolBoxGroup.deactivate();
+ this._activeToolbar.deactivate();
this._mainBox.grab_key_focus();
},
@@ -789,9 +789,9 @@ MainWindow.prototype = {
},
destroy : function() {
- for (let thingId in this._mainToolBoxGroupsByThingId) {
- let toolBoxGroup = this._mainToolBoxGroupsByThingId[thingId];
- toolBoxGroup.destroy();
+ for (let thingId in this._toolbarsByThingId) {
+ let toolbar = this._toolbarsByThingId[thingId];
+ toolbar.destroy();
}
if (this._pageManagerStateChangedId) {
@@ -804,7 +804,7 @@ MainWindow.prototype = {
delete this._pageActiveThingChangedId;
}
- this._setActiveToolBoxGroup(null);
+ this._setActiveToolbar(null);
if (this._pageButtonPressEventId) {
this._currentPage.disconnect(this._pageButtonPressEventId);
diff --git a/src/js/ui/thing.js b/src/js/ui/thing.js
index 457fb77..5d88476 100644
--- a/src/js/ui/thing.js
+++ b/src/js/ui/thing.js
@@ -466,15 +466,15 @@ function createThingFromId(thingId, args) {
return constructorModule.create(args);
}
-function createToolBoxGroup(thingId, args) {
+function createToolbar(thingId, args) {
if (!thingId) {
throw new Error("Can't create tool box group without thing id");
}
let constructorModule = imports.ui.things[thingId];
- if ('createToolBoxGroup' in constructorModule) {
- return constructorModule.createToolBoxGroup(args);
+ if ('createToolbar' in constructorModule) {
+ return constructorModule.createToolbar(args);
}
return null;
diff --git a/src/js/ui/things/photo.js b/src/js/ui/things/photo.js
index 5b73108..b712a5f 100644
--- a/src/js/ui/things/photo.js
+++ b/src/js/ui/things/photo.js
@@ -15,7 +15,7 @@ const Pango = imports.gi.Pango;
// ui imports
const Thing = imports.ui.thing;
const ToolBox = imports.ui.toolBox;
-const ToolBoxGroup = imports.ui.toolBoxGroup;
+const Toolbar = imports.ui.toolbar;
// util imports
const Path = imports.util.path;
@@ -419,9 +419,8 @@ function create(args) {
return new PhotoThing(args);
}
-function createToolBoxGroup(args) {
- let toolBoxGroup =
- new ToolBoxGroup.ToolBoxGroup({ visible: false });
+function createToolbar(args) {
+ let toolbar = new Toolbar.Toolbar({ visible: false });
let toolBox =
new ToolBox.ToolBox({ title: Gettext.gettext("Load from"),
@@ -430,7 +429,7 @@ function createToolBoxGroup(args) {
toolBox.addButton({ label: Gettext.gettext("File"),
actionName: "chooseFile" });
- toolBoxGroup.addToolBox(toolBox);
+ toolbar.addToolBox(toolBox);
- return toolBoxGroup;
+ return toolbar;
}
diff --git a/src/js/ui/things/video.js b/src/js/ui/things/video.js
index fed9b11..5517ac7 100644
--- a/src/js/ui/things/video.js
+++ b/src/js/ui/things/video.js
@@ -16,7 +16,7 @@ const Pango = imports.gi.Pango;
// ui imports
const Thing = imports.ui.thing;
const ToolBox = imports.ui.toolBox;
-const ToolBoxGroup = imports.ui.toolBoxGroup;
+const Toolbar = imports.ui.toolbar;
// util imports
const Path = imports.util.path;
@@ -656,9 +656,8 @@ function create(args) {
return new VideoThing(args);
}
-function createToolBoxGroup(args) {
- let toolBoxGroup =
- new ToolBoxGroup.ToolBoxGroup({ visible: false });
+function createToolbar(args) {
+ let toolbar = new Toolbar.Toolbar({ visible: false });
let toolBox =
new ToolBox.ToolBox({ title: Gettext.gettext("Load from"),
@@ -667,7 +666,7 @@ function createToolBoxGroup(args) {
toolBox.addButton({ label: Gettext.gettext("File"),
actionName: "chooseFile" });
- toolBoxGroup.addToolBox(toolBox);
+ toolbar.addToolBox(toolBox);
- return toolBoxGroup;
+ return toolbar;
}
diff --git a/src/js/ui/toolBoxGroup.js b/src/js/ui/toolbar.js
similarity index 89%
rename from src/js/ui/toolBoxGroup.js
rename to src/js/ui/toolbar.js
index eaa1ee7..42fd898 100644
--- a/src/js/ui/toolBoxGroup.js
+++ b/src/js/ui/toolbar.js
@@ -23,11 +23,11 @@ const _TOOLBOX_ACTIVE_DEPTH = 0.2;
const _TOOLBOX_ANCHOR_Y = 100;
-function ToolBoxGroup(args) {
+function Toolbar(args) {
this._init(args);
}
-ToolBoxGroup.prototype = {
+Toolbar.prototype = {
_init : function(args) {
args = args || {};
@@ -50,7 +50,7 @@ ToolBoxGroup.prototype = {
xAlign: Tb.BoxAlignment.FILL,
yAlign: Tb.BoxAlignment.FILL,
anchorY: this._visible ? 0 : _TOOLBOX_ANCHOR_Y,
- name: "tool-box-group-main-box" });
+ name: "toolbar-main-box" });
},
_createContentBox : function() {
@@ -58,7 +58,7 @@ ToolBoxGroup.prototype = {
new Tb.Box({ orientation: Tb.BoxOrientation.HORIZONTAL,
xAlign: Tb.BoxAlignment.CENTER,
yAlign: Tb.BoxAlignment.START,
- name: "tool-box-group-content-box" });
+ name: "toolbar-content-box" });
this._mainBox.append(this._contentBox,
Tb.BoxPackFlags.EXPAND);
@@ -122,11 +122,11 @@ ToolBoxGroup.prototype = {
},
addToolBox : function(toolBox) {
- toolBox._ToolBoxGroup_activatedId =
+ toolBox._Toolbar_activatedId =
toolBox.connect("active-changed",
Lang.bind(this, this._onToolBoxActiveChanged));
- toolBox._ToolBoxGroup_actionId =
+ toolBox._Toolbar_actionId =
toolBox.connect("action",
Lang.bind(this, this._onToolBoxAction));
@@ -137,11 +137,11 @@ ToolBoxGroup.prototype = {
},
removeToolBox : function(toolBox) {
- toolBox.disconnect(toolBox._ToolBoxGroup_activatedId);
- delete toolBox._ToolBoxGroup_activatedId;
+ toolBox.disconnect(toolBox._Toolbar_activatedId);
+ delete toolBox._Toolbar_activatedId;
- toolBox.disconnect(toolBox._ToolBoxGroup_actionId);
- delete toolBox._ToolBoxGroup_actionId;
+ toolBox.disconnect(toolBox._Toolbar_actionId);
+ delete toolBox._Toolbar_actionId;
let indexToRemove = this._toolBoxes.indexOf(toolBox);
this._toolBoxes.splice(indexToRemove, 1);
@@ -189,4 +189,4 @@ ToolBoxGroup.prototype = {
}
}
-Signals.addSignalMethods(ToolBoxGroup.prototype);
+Signals.addSignalMethods(Toolbar.prototype);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]