cleanup: Use method syntax
Modern javascript has a short-hand for function properties, embrace it for better readability and to prepare for an eventual port to ES6 classes. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/23
This commit is contained in:
parent
cff0b81f32
commit
76f09b1e49
20
HACKING
20
HACKING
@ -136,13 +136,13 @@ GObjects, although this feature isn't used very often in the Shell itself.
|
|||||||
Name: 'IconLabelMenuItem',
|
Name: 'IconLabelMenuItem',
|
||||||
Extends: PopupMenu.PopupMenuBaseItem,
|
Extends: PopupMenu.PopupMenuBaseItem,
|
||||||
|
|
||||||
_init: function(icon, label) {
|
_init(icon, label) {
|
||||||
this.parent({ reactive: false });
|
this.parent({ reactive: false });
|
||||||
this.actor.add_child(icon);
|
this.actor.add_child(icon);
|
||||||
this.actor.add_child(label);
|
this.actor.add_child(label);
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function() {
|
open() {
|
||||||
log("menu opened!");
|
log("menu opened!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -173,15 +173,15 @@ you to inherit from a type to use it, you can do so:
|
|||||||
Name: 'MyClutterActor',
|
Name: 'MyClutterActor',
|
||||||
Extends: Clutter.Actor,
|
Extends: Clutter.Actor,
|
||||||
|
|
||||||
vfunc_get_preferred_width: function(actor, forHeight) {
|
vfunc_get_preferred_width(actor, forHeight) {
|
||||||
return [100, 100];
|
return [100, 100];
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_height: function(actor, forWidth) {
|
vfunc_get_preferred_height(actor, forWidth) {
|
||||||
return [100, 100];
|
return [100, 100];
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_paint: function(actor) {
|
vfunc_paint(actor) {
|
||||||
let alloc = this.get_allocation_box();
|
let alloc = this.get_allocation_box();
|
||||||
Cogl.set_source_color4ub(255, 0, 0, 255);
|
Cogl.set_source_color4ub(255, 0, 0, 255);
|
||||||
Cogl.rectangle(alloc.x1, alloc.y1,
|
Cogl.rectangle(alloc.x1, alloc.y1,
|
||||||
@ -218,14 +218,14 @@ the actor itself:
|
|||||||
var MyClass = new Lang.Class({
|
var MyClass = new Lang.Class({
|
||||||
Name: 'MyClass',
|
Name: 'MyClass',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.Button({ text: "This is a button" });
|
this.actor = new St.Button({ text: "This is a button" });
|
||||||
this.actor._delegate = this;
|
this.actor._delegate = this;
|
||||||
|
|
||||||
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onClicked: function(actor) {
|
_onClicked(actor) {
|
||||||
actor.set_label("You clicked the button!");
|
actor.set_label("You clicked the button!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -265,12 +265,12 @@ prototype:
|
|||||||
const FnorbLib = imports.fborbLib;
|
const FnorbLib = imports.fborbLib;
|
||||||
|
|
||||||
var MyClass = new Lang.Class({
|
var MyClass = new Lang.Class({
|
||||||
_init: function() {
|
_init() {
|
||||||
let fnorb = new FnorbLib.Fnorb();
|
let fnorb = new FnorbLib.Fnorb();
|
||||||
fnorb.connect('frobate', Lang.bind(this, this._onFnorbFrobate));
|
fnorb.connect('frobate', Lang.bind(this, this._onFnorbFrobate));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onFnorbFrobate: function(fnorb) {
|
_onFnorbFrobate(fnorb) {
|
||||||
this._updateFnorb();
|
this._updateFnorb();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -309,7 +309,7 @@ property.
|
|||||||
var MyClass = new Lang.Class({
|
var MyClass = new Lang.Class({
|
||||||
Name: 'MyClass',
|
Name: 'MyClass',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.BoxLayout();
|
this.actor = new St.BoxLayout();
|
||||||
this._position = 0;
|
this._position = 0;
|
||||||
},
|
},
|
||||||
|
@ -34,7 +34,7 @@ function stripPrefix(string, prefix) {
|
|||||||
|
|
||||||
var Application = new Lang.Class({
|
var Application = new Lang.Class({
|
||||||
Name: 'Application',
|
Name: 'Application',
|
||||||
_init: function() {
|
_init() {
|
||||||
GLib.set_prgname('gnome-shell-extension-prefs');
|
GLib.set_prgname('gnome-shell-extension-prefs');
|
||||||
this.application = new Gtk.Application({
|
this.application = new Gtk.Application({
|
||||||
application_id: 'org.gnome.shell.ExtensionPrefs',
|
application_id: 'org.gnome.shell.ExtensionPrefs',
|
||||||
@ -52,7 +52,7 @@ var Application = new Lang.Class({
|
|||||||
this._skipMainWindow = false;
|
this._skipMainWindow = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_extensionAvailable: function(uuid) {
|
_extensionAvailable(uuid) {
|
||||||
let extension = ExtensionUtils.extensions[uuid];
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
|
|
||||||
if (!extension)
|
if (!extension)
|
||||||
@ -64,7 +64,7 @@ var Application = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getExtensionPrefsModule: function(extension) {
|
_getExtensionPrefsModule(extension) {
|
||||||
let uuid = extension.metadata.uuid;
|
let uuid = extension.metadata.uuid;
|
||||||
|
|
||||||
if (this._extensionPrefsModules.hasOwnProperty(uuid))
|
if (this._extensionPrefsModules.hasOwnProperty(uuid))
|
||||||
@ -79,7 +79,7 @@ var Application = new Lang.Class({
|
|||||||
return prefsModule;
|
return prefsModule;
|
||||||
},
|
},
|
||||||
|
|
||||||
_selectExtension: function(uuid) {
|
_selectExtension(uuid) {
|
||||||
if (!this._extensionAvailable(uuid))
|
if (!this._extensionAvailable(uuid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ var Application = new Lang.Class({
|
|||||||
dialog.show();
|
dialog.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildErrorUI: function(extension, exc) {
|
_buildErrorUI(extension, exc) {
|
||||||
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
|
let box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL });
|
||||||
let label = new Gtk.Label({
|
let label = new Gtk.Label({
|
||||||
label: _("There was an error loading the preferences dialog for %s:").format(extension.metadata.name)
|
label: _("There was an error loading the preferences dialog for %s:").format(extension.metadata.name)
|
||||||
@ -142,7 +142,7 @@ var Application = new Lang.Class({
|
|||||||
return box;
|
return box;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildUI: function(app) {
|
_buildUI(app) {
|
||||||
this._window = new Gtk.ApplicationWindow({ application: app,
|
this._window = new Gtk.ApplicationWindow({ application: app,
|
||||||
window_position: Gtk.WindowPosition.CENTER });
|
window_position: Gtk.WindowPosition.CENTER });
|
||||||
|
|
||||||
@ -179,13 +179,13 @@ var Application = new Lang.Class({
|
|||||||
this._window.show_all();
|
this._window.show_all();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sortList: function(row1, row2) {
|
_sortList(row1, row2) {
|
||||||
let name1 = ExtensionUtils.extensions[row1.uuid].metadata.name;
|
let name1 = ExtensionUtils.extensions[row1.uuid].metadata.name;
|
||||||
let name2 = ExtensionUtils.extensions[row2.uuid].metadata.name;
|
let name2 = ExtensionUtils.extensions[row2.uuid].metadata.name;
|
||||||
return name1.localeCompare(name2);
|
return name1.localeCompare(name2);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateHeader: function(row, before) {
|
_updateHeader(row, before) {
|
||||||
if (!before || row.get_header())
|
if (!before || row.get_header())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -193,14 +193,14 @@ var Application = new Lang.Class({
|
|||||||
row.set_header(sep);
|
row.set_header(sep);
|
||||||
},
|
},
|
||||||
|
|
||||||
_scanExtensions: function() {
|
_scanExtensions() {
|
||||||
let finder = new ExtensionUtils.ExtensionFinder();
|
let finder = new ExtensionUtils.ExtensionFinder();
|
||||||
finder.connect('extension-found', Lang.bind(this, this._extensionFound));
|
finder.connect('extension-found', Lang.bind(this, this._extensionFound));
|
||||||
finder.scanExtensions();
|
finder.scanExtensions();
|
||||||
this._extensionsLoaded();
|
this._extensionsLoaded();
|
||||||
},
|
},
|
||||||
|
|
||||||
_extensionFound: function(finder, extension) {
|
_extensionFound(finder, extension) {
|
||||||
let row = new ExtensionRow(extension.uuid);
|
let row = new ExtensionRow(extension.uuid);
|
||||||
|
|
||||||
row.prefsButton.visible = this._extensionAvailable(row.uuid);
|
row.prefsButton.visible = this._extensionAvailable(row.uuid);
|
||||||
@ -213,7 +213,7 @@ var Application = new Lang.Class({
|
|||||||
this._extensionSelector.add(row);
|
this._extensionSelector.add(row);
|
||||||
},
|
},
|
||||||
|
|
||||||
_extensionsLoaded: function() {
|
_extensionsLoaded() {
|
||||||
if (this._startupUuid && this._extensionAvailable(this._startupUuid))
|
if (this._startupUuid && this._extensionAvailable(this._startupUuid))
|
||||||
this._selectExtension(this._startupUuid);
|
this._selectExtension(this._startupUuid);
|
||||||
this._startupUuid = null;
|
this._startupUuid = null;
|
||||||
@ -221,16 +221,16 @@ var Application = new Lang.Class({
|
|||||||
this._loaded = true;
|
this._loaded = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onActivate: function() {
|
_onActivate() {
|
||||||
this._window.present();
|
this._window.present();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onStartup: function(app) {
|
_onStartup(app) {
|
||||||
this._buildUI(app);
|
this._buildUI(app);
|
||||||
this._scanExtensions();
|
this._scanExtensions();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCommandLine: function(app, commandLine) {
|
_onCommandLine(app, commandLine) {
|
||||||
app.activate();
|
app.activate();
|
||||||
let args = commandLine.get_arguments();
|
let args = commandLine.get_arguments();
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ var DescriptionLabel = new Lang.Class({
|
|||||||
Name: 'DescriptionLabel',
|
Name: 'DescriptionLabel',
|
||||||
Extends: Gtk.Label,
|
Extends: Gtk.Label,
|
||||||
|
|
||||||
vfunc_get_preferred_height_for_width: function(width) {
|
vfunc_get_preferred_height_for_width(width) {
|
||||||
// Hack: Request the maximum height allowed by the line limit
|
// Hack: Request the maximum height allowed by the line limit
|
||||||
if (this.lines > 0)
|
if (this.lines > 0)
|
||||||
return this.parent(0);
|
return this.parent(0);
|
||||||
@ -269,7 +269,7 @@ var ExtensionRow = new Lang.Class({
|
|||||||
Name: 'ExtensionRow',
|
Name: 'ExtensionRow',
|
||||||
Extends: Gtk.ListBoxRow,
|
Extends: Gtk.ListBoxRow,
|
||||||
|
|
||||||
_init: function(uuid) {
|
_init(uuid) {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
@ -291,7 +291,7 @@ var ExtensionRow = new Lang.Class({
|
|||||||
this._buildUI();
|
this._buildUI();
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildUI: function() {
|
_buildUI() {
|
||||||
let extension = ExtensionUtils.extensions[this.uuid];
|
let extension = ExtensionUtils.extensions[this.uuid];
|
||||||
|
|
||||||
let hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
|
let hbox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
|
||||||
@ -339,7 +339,7 @@ var ExtensionRow = new Lang.Class({
|
|||||||
hbox.add(this._switch);
|
hbox.add(this._switch);
|
||||||
},
|
},
|
||||||
|
|
||||||
_canEnable: function() {
|
_canEnable() {
|
||||||
let extension = ExtensionUtils.extensions[this.uuid];
|
let extension = ExtensionUtils.extensions[this.uuid];
|
||||||
let checkVersion = !this._settings.get_boolean('disable-extension-version-validation');
|
let checkVersion = !this._settings.get_boolean('disable-extension-version-validation');
|
||||||
|
|
||||||
@ -347,12 +347,12 @@ var ExtensionRow = new Lang.Class({
|
|||||||
!(checkVersion && ExtensionUtils.isOutOfDate(extension));
|
!(checkVersion && ExtensionUtils.isOutOfDate(extension));
|
||||||
},
|
},
|
||||||
|
|
||||||
_isEnabled: function() {
|
_isEnabled() {
|
||||||
let extensions = this._settings.get_strv('enabled-extensions');
|
let extensions = this._settings.get_strv('enabled-extensions');
|
||||||
return extensions.indexOf(this.uuid) != -1;
|
return extensions.indexOf(this.uuid) != -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
_enable: function() {
|
_enable() {
|
||||||
let extensions = this._settings.get_strv('enabled-extensions');
|
let extensions = this._settings.get_strv('enabled-extensions');
|
||||||
if (extensions.indexOf(this.uuid) != -1)
|
if (extensions.indexOf(this.uuid) != -1)
|
||||||
return;
|
return;
|
||||||
@ -361,7 +361,7 @@ var ExtensionRow = new Lang.Class({
|
|||||||
this._settings.set_strv('enabled-extensions', extensions);
|
this._settings.set_strv('enabled-extensions', extensions);
|
||||||
},
|
},
|
||||||
|
|
||||||
_disable: function() {
|
_disable() {
|
||||||
let extensions = this._settings.get_strv('enabled-extensions');
|
let extensions = this._settings.get_strv('enabled-extensions');
|
||||||
let pos = extensions.indexOf(this.uuid);
|
let pos = extensions.indexOf(this.uuid);
|
||||||
if (pos == -1)
|
if (pos == -1)
|
||||||
@ -378,11 +378,11 @@ function initEnvironment() {
|
|||||||
// Monkey-patch in a "global" object that fakes some Shell utilities
|
// Monkey-patch in a "global" object that fakes some Shell utilities
|
||||||
// that ExtensionUtils depends on.
|
// that ExtensionUtils depends on.
|
||||||
window.global = {
|
window.global = {
|
||||||
log: function() {
|
log() {
|
||||||
print([].join.call(arguments, ', '));
|
print([].join.call(arguments, ', '));
|
||||||
},
|
},
|
||||||
|
|
||||||
logError: function(s) {
|
logError(s) {
|
||||||
log('ERROR: ' + s);
|
log('ERROR: ' + s);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ var BeginRequestType = {
|
|||||||
var AuthPrompt = new Lang.Class({
|
var AuthPrompt = new Lang.Class({
|
||||||
Name: 'AuthPrompt',
|
Name: 'AuthPrompt',
|
||||||
|
|
||||||
_init: function(gdmClient, mode) {
|
_init(gdmClient, mode) {
|
||||||
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
|
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
|
||||||
|
|
||||||
this._gdmClient = gdmClient;
|
this._gdmClient = gdmClient;
|
||||||
@ -136,12 +136,12 @@ var AuthPrompt = new Lang.Class({
|
|||||||
this._defaultButtonWell.add_child(this._spinner.actor);
|
this._defaultButtonWell.add_child(this._spinner.actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this._userVerifier.destroy();
|
this._userVerifier.destroy();
|
||||||
this._userVerifier = null;
|
this._userVerifier = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_initButtons: function() {
|
_initButtons() {
|
||||||
this.cancelButton = new St.Button({ style_class: 'modal-dialog-button button',
|
this.cancelButton = new St.Button({ style_class: 'modal-dialog-button button',
|
||||||
button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE,
|
button_mask: St.ButtonMask.ONE | St.ButtonMask.THREE,
|
||||||
reactive: true,
|
reactive: true,
|
||||||
@ -196,7 +196,7 @@ var AuthPrompt = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAskQuestion: function(verifier, serviceName, question, passwordChar) {
|
_onAskQuestion(verifier, serviceName, question, passwordChar) {
|
||||||
if (this._queryingService)
|
if (this._queryingService)
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
@ -222,12 +222,12 @@ var AuthPrompt = new Lang.Class({
|
|||||||
this.emit('prompted');
|
this.emit('prompted');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onOVirtUserAuthenticated: function() {
|
_onOVirtUserAuthenticated() {
|
||||||
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
||||||
this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSmartcardStatusChanged: function() {
|
_onSmartcardStatusChanged() {
|
||||||
this.smartcardDetected = this._userVerifier.smartcardDetected;
|
this.smartcardDetected = this._userVerifier.smartcardDetected;
|
||||||
|
|
||||||
// Most of the time we want to reset if the user inserts or removes
|
// Most of the time we want to reset if the user inserts or removes
|
||||||
@ -246,12 +246,12 @@ var AuthPrompt = new Lang.Class({
|
|||||||
this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onShowMessage: function(userVerifier, message, type) {
|
_onShowMessage(userVerifier, message, type) {
|
||||||
this.setMessage(message, type);
|
this.setMessage(message, type);
|
||||||
this.emit('prompted');
|
this.emit('prompted');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onVerificationFailed: function() {
|
_onVerificationFailed() {
|
||||||
this._queryingService = null;
|
this._queryingService = null;
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
@ -260,22 +260,22 @@ var AuthPrompt = new Lang.Class({
|
|||||||
this.verificationStatus = AuthPromptStatus.VERIFICATION_FAILED;
|
this.verificationStatus = AuthPromptStatus.VERIFICATION_FAILED;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onVerificationComplete: function() {
|
_onVerificationComplete() {
|
||||||
this.setActorInDefaultButtonWell(null);
|
this.setActorInDefaultButtonWell(null);
|
||||||
this.verificationStatus = AuthPromptStatus.VERIFICATION_SUCCEEDED;
|
this.verificationStatus = AuthPromptStatus.VERIFICATION_SUCCEEDED;
|
||||||
this.cancelButton.reactive = false;
|
this.cancelButton.reactive = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onReset: function() {
|
_onReset() {
|
||||||
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
|
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
|
||||||
this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
addActorToDefaultButtonWell: function(actor) {
|
addActorToDefaultButtonWell(actor) {
|
||||||
this._defaultButtonWell.add_child(actor);
|
this._defaultButtonWell.add_child(actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
setActorInDefaultButtonWell: function(actor, animate) {
|
setActorInDefaultButtonWell(actor, animate) {
|
||||||
if (!this._defaultButtonWellActor &&
|
if (!this._defaultButtonWellActor &&
|
||||||
!actor)
|
!actor)
|
||||||
return;
|
return;
|
||||||
@ -312,7 +312,7 @@ var AuthPrompt = new Lang.Class({
|
|||||||
delay: DEFAULT_BUTTON_WELL_ANIMATION_DELAY,
|
delay: DEFAULT_BUTTON_WELL_ANIMATION_DELAY,
|
||||||
transition: 'linear',
|
transition: 'linear',
|
||||||
onCompleteScope: this,
|
onCompleteScope: this,
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
if (wasSpinner) {
|
if (wasSpinner) {
|
||||||
if (this._spinner)
|
if (this._spinner)
|
||||||
this._spinner.stop();
|
this._spinner.stop();
|
||||||
@ -339,25 +339,25 @@ var AuthPrompt = new Lang.Class({
|
|||||||
this._defaultButtonWellActor = actor;
|
this._defaultButtonWellActor = actor;
|
||||||
},
|
},
|
||||||
|
|
||||||
startSpinning: function() {
|
startSpinning() {
|
||||||
this.setActorInDefaultButtonWell(this._spinner.actor, true);
|
this.setActorInDefaultButtonWell(this._spinner.actor, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
stopSpinning: function() {
|
stopSpinning() {
|
||||||
this.setActorInDefaultButtonWell(null, false);
|
this.setActorInDefaultButtonWell(null, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
clear: function() {
|
clear() {
|
||||||
this._entry.text = '';
|
this._entry.text = '';
|
||||||
this.stopSpinning();
|
this.stopSpinning();
|
||||||
},
|
},
|
||||||
|
|
||||||
setPasswordChar: function(passwordChar) {
|
setPasswordChar(passwordChar) {
|
||||||
this._entry.clutter_text.set_password_char(passwordChar);
|
this._entry.clutter_text.set_password_char(passwordChar);
|
||||||
this._entry.menu.isPassword = passwordChar != '';
|
this._entry.menu.isPassword = passwordChar != '';
|
||||||
},
|
},
|
||||||
|
|
||||||
setQuestion: function(question) {
|
setQuestion(question) {
|
||||||
this._label.set_text(question);
|
this._label.set_text(question);
|
||||||
|
|
||||||
this._label.show();
|
this._label.show();
|
||||||
@ -366,7 +366,7 @@ var AuthPrompt = new Lang.Class({
|
|||||||
this._entry.grab_key_focus();
|
this._entry.grab_key_focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
getAnswer: function() {
|
getAnswer() {
|
||||||
let text;
|
let text;
|
||||||
|
|
||||||
if (this._preemptiveAnswer) {
|
if (this._preemptiveAnswer) {
|
||||||
@ -379,7 +379,7 @@ var AuthPrompt = new Lang.Class({
|
|||||||
return text;
|
return text;
|
||||||
},
|
},
|
||||||
|
|
||||||
_fadeOutMessage: function() {
|
_fadeOutMessage() {
|
||||||
if (this._message.opacity == 0)
|
if (this._message.opacity == 0)
|
||||||
return;
|
return;
|
||||||
Tweener.removeTweens(this._message);
|
Tweener.removeTweens(this._message);
|
||||||
@ -390,7 +390,7 @@ var AuthPrompt = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
setMessage: function(message, type) {
|
setMessage(message, type) {
|
||||||
if (type == GdmUtil.MessageType.ERROR)
|
if (type == GdmUtil.MessageType.ERROR)
|
||||||
this._message.add_style_class_name('login-dialog-message-warning');
|
this._message.add_style_class_name('login-dialog-message-warning');
|
||||||
else
|
else
|
||||||
@ -410,18 +410,18 @@ var AuthPrompt = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateNextButtonSensitivity: function(sensitive) {
|
_updateNextButtonSensitivity(sensitive) {
|
||||||
this.nextButton.reactive = sensitive;
|
this.nextButton.reactive = sensitive;
|
||||||
this.nextButton.can_focus = sensitive;
|
this.nextButton.can_focus = sensitive;
|
||||||
},
|
},
|
||||||
|
|
||||||
updateSensitivity: function(sensitive) {
|
updateSensitivity(sensitive) {
|
||||||
this._updateNextButtonSensitivity(sensitive && (this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING));
|
this._updateNextButtonSensitivity(sensitive && (this._entry.text.length > 0 || this.verificationStatus == AuthPromptStatus.VERIFYING));
|
||||||
this._entry.reactive = sensitive;
|
this._entry.reactive = sensitive;
|
||||||
this._entry.clutter_text.editable = sensitive;
|
this._entry.clutter_text.editable = sensitive;
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide() {
|
||||||
this.setActorInDefaultButtonWell(null, true);
|
this.setActorInDefaultButtonWell(null, true);
|
||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
this._message.opacity = 0;
|
this._message.opacity = 0;
|
||||||
@ -432,7 +432,7 @@ var AuthPrompt = new Lang.Class({
|
|||||||
this._entry.set_text('');
|
this._entry.set_text('');
|
||||||
},
|
},
|
||||||
|
|
||||||
setUser: function(user) {
|
setUser(user) {
|
||||||
let oldChild = this._userWell.get_child();
|
let oldChild = this._userWell.get_child();
|
||||||
if (oldChild)
|
if (oldChild)
|
||||||
oldChild.destroy();
|
oldChild.destroy();
|
||||||
@ -443,7 +443,7 @@ var AuthPrompt = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset() {
|
||||||
let oldStatus = this.verificationStatus;
|
let oldStatus = this.verificationStatus;
|
||||||
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
|
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
|
||||||
this.cancelButton.reactive = true;
|
this.cancelButton.reactive = true;
|
||||||
@ -480,7 +480,7 @@ var AuthPrompt = new Lang.Class({
|
|||||||
this.emit('reset', beginRequestType);
|
this.emit('reset', beginRequestType);
|
||||||
},
|
},
|
||||||
|
|
||||||
addCharacter: function(unichar) {
|
addCharacter(unichar) {
|
||||||
if (!this._entry.visible)
|
if (!this._entry.visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ var AuthPrompt = new Lang.Class({
|
|||||||
this._entry.clutter_text.insert_unichar(unichar);
|
this._entry.clutter_text.insert_unichar(unichar);
|
||||||
},
|
},
|
||||||
|
|
||||||
begin: function(params) {
|
begin(params) {
|
||||||
params = Params.parse(params, { userName: null,
|
params = Params.parse(params, { userName: null,
|
||||||
hold: null });
|
hold: null });
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ var AuthPrompt = new Lang.Class({
|
|||||||
this.verificationStatus = AuthPromptStatus.VERIFYING;
|
this.verificationStatus = AuthPromptStatus.VERIFYING;
|
||||||
},
|
},
|
||||||
|
|
||||||
finish: function(onComplete) {
|
finish(onComplete) {
|
||||||
if (!this._userVerifier.hasPendingMessages) {
|
if (!this._userVerifier.hasPendingMessages) {
|
||||||
this._userVerifier.clear();
|
this._userVerifier.clear();
|
||||||
onComplete();
|
onComplete();
|
||||||
@ -517,7 +517,7 @@ var AuthPrompt = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function() {
|
cancel() {
|
||||||
if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED) {
|
if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ const Signals = imports.signals;
|
|||||||
var Task = new Lang.Class({
|
var Task = new Lang.Class({
|
||||||
Name: 'Task',
|
Name: 'Task',
|
||||||
|
|
||||||
_init: function(scope, handler) {
|
_init(scope, handler) {
|
||||||
if (scope)
|
if (scope)
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
else
|
else
|
||||||
@ -59,7 +59,7 @@ var Task = new Lang.Class({
|
|||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
},
|
},
|
||||||
|
|
||||||
run: function() {
|
run() {
|
||||||
if (this.handler)
|
if (this.handler)
|
||||||
return this.handler.call(this.scope);
|
return this.handler.call(this.scope);
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ var Hold = new Lang.Class({
|
|||||||
Name: 'Hold',
|
Name: 'Hold',
|
||||||
Extends: Task,
|
Extends: Task,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent(this, function () {
|
this.parent(this, function () {
|
||||||
return this;
|
return this;
|
||||||
});
|
});
|
||||||
@ -80,13 +80,13 @@ var Hold = new Lang.Class({
|
|||||||
this._acquisitions = 1;
|
this._acquisitions = 1;
|
||||||
},
|
},
|
||||||
|
|
||||||
acquire: function() {
|
acquire() {
|
||||||
if (this._acquisitions <= 0)
|
if (this._acquisitions <= 0)
|
||||||
throw new Error("Cannot acquire hold after it's been released");
|
throw new Error("Cannot acquire hold after it's been released");
|
||||||
this._acquisitions++;
|
this._acquisitions++;
|
||||||
},
|
},
|
||||||
|
|
||||||
acquireUntilAfter: function(hold) {
|
acquireUntilAfter(hold) {
|
||||||
if (!hold.isAcquired())
|
if (!hold.isAcquired())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -97,14 +97,14 @@ var Hold = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
release: function() {
|
release() {
|
||||||
this._acquisitions--;
|
this._acquisitions--;
|
||||||
|
|
||||||
if (this._acquisitions == 0)
|
if (this._acquisitions == 0)
|
||||||
this.emit('release');
|
this.emit('release');
|
||||||
},
|
},
|
||||||
|
|
||||||
isAcquired: function() {
|
isAcquired() {
|
||||||
return this._acquisitions > 0;
|
return this._acquisitions > 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -114,7 +114,7 @@ var Batch = new Lang.Class({
|
|||||||
Name: 'Batch',
|
Name: 'Batch',
|
||||||
Extends: Task,
|
Extends: Task,
|
||||||
|
|
||||||
_init: function(scope, tasks) {
|
_init(scope, tasks) {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this.tasks = [];
|
this.tasks = [];
|
||||||
@ -134,11 +134,11 @@ var Batch = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
process: function() {
|
process() {
|
||||||
throw new Error('Not implemented');
|
throw new Error('Not implemented');
|
||||||
},
|
},
|
||||||
|
|
||||||
runTask: function() {
|
runTask() {
|
||||||
if (!(this._currentTaskIndex in this.tasks)) {
|
if (!(this._currentTaskIndex in this.tasks)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -146,11 +146,11 @@ var Batch = new Lang.Class({
|
|||||||
return this.tasks[this._currentTaskIndex].run();
|
return this.tasks[this._currentTaskIndex].run();
|
||||||
},
|
},
|
||||||
|
|
||||||
_finish: function() {
|
_finish() {
|
||||||
this.hold.release();
|
this.hold.release();
|
||||||
},
|
},
|
||||||
|
|
||||||
nextTask: function() {
|
nextTask() {
|
||||||
this._currentTaskIndex++;
|
this._currentTaskIndex++;
|
||||||
|
|
||||||
// if the entire batch of tasks is finished, release
|
// if the entire batch of tasks is finished, release
|
||||||
@ -163,7 +163,7 @@ var Batch = new Lang.Class({
|
|||||||
this.process();
|
this.process();
|
||||||
},
|
},
|
||||||
|
|
||||||
_start: function() {
|
_start() {
|
||||||
// acquire a hold to get released when the entire
|
// acquire a hold to get released when the entire
|
||||||
// batch of tasks is finished
|
// batch of tasks is finished
|
||||||
this.hold = new Hold();
|
this.hold = new Hold();
|
||||||
@ -171,7 +171,7 @@ var Batch = new Lang.Class({
|
|||||||
this.process();
|
this.process();
|
||||||
},
|
},
|
||||||
|
|
||||||
run: function() {
|
run() {
|
||||||
this._start();
|
this._start();
|
||||||
|
|
||||||
// hold may be destroyed at this point
|
// hold may be destroyed at this point
|
||||||
@ -179,7 +179,7 @@ var Batch = new Lang.Class({
|
|||||||
return this.hold;
|
return this.hold;
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function() {
|
cancel() {
|
||||||
this.tasks = this.tasks.splice(0, this._currentTaskIndex + 1);
|
this.tasks = this.tasks.splice(0, this._currentTaskIndex + 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -189,7 +189,7 @@ var ConcurrentBatch = new Lang.Class({
|
|||||||
Name: 'ConcurrentBatch',
|
Name: 'ConcurrentBatch',
|
||||||
Extends: Batch,
|
Extends: Batch,
|
||||||
|
|
||||||
process: function() {
|
process() {
|
||||||
let hold = this.runTask();
|
let hold = this.runTask();
|
||||||
|
|
||||||
if (hold) {
|
if (hold) {
|
||||||
@ -208,7 +208,7 @@ var ConsecutiveBatch = new Lang.Class({
|
|||||||
Name: 'ConsecutiveBatch',
|
Name: 'ConsecutiveBatch',
|
||||||
Extends: Batch,
|
Extends: Batch,
|
||||||
|
|
||||||
process: function() {
|
process() {
|
||||||
let hold = this.runTask();
|
let hold = this.runTask();
|
||||||
|
|
||||||
if (hold && hold.isAcquired()) {
|
if (hold && hold.isAcquired()) {
|
||||||
|
@ -54,7 +54,7 @@ const _MAX_BOTTOM_MENU_ITEMS = 5;
|
|||||||
var UserListItem = new Lang.Class({
|
var UserListItem = new Lang.Class({
|
||||||
Name: 'UserListItem',
|
Name: 'UserListItem',
|
||||||
|
|
||||||
_init: function(user) {
|
_init(user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this._userChangedId = this.user.connect('changed',
|
this._userChangedId = this.user.connect('changed',
|
||||||
Lang.bind(this, this._onUserChanged));
|
Lang.bind(this, this._onUserChanged));
|
||||||
@ -94,26 +94,26 @@ var UserListItem = new Lang.Class({
|
|||||||
this._onUserChanged();
|
this._onUserChanged();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUserChanged: function() {
|
_onUserChanged() {
|
||||||
this._updateLoggedIn();
|
this._updateLoggedIn();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLoggedIn: function() {
|
_updateLoggedIn() {
|
||||||
if (this.user.is_logged_in())
|
if (this.user.is_logged_in())
|
||||||
this.actor.add_style_pseudo_class('logged-in');
|
this.actor.add_style_pseudo_class('logged-in');
|
||||||
else
|
else
|
||||||
this.actor.remove_style_pseudo_class('logged-in');
|
this.actor.remove_style_pseudo_class('logged-in');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this.user.disconnect(this._userChangedId);
|
this.user.disconnect(this._userChangedId);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onClicked: function() {
|
_onClicked() {
|
||||||
this.emit('activate');
|
this.emit('activate');
|
||||||
},
|
},
|
||||||
|
|
||||||
_setSelected: function(selected) {
|
_setSelected(selected) {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
this.actor.add_style_pseudo_class('selected');
|
this.actor.add_style_pseudo_class('selected');
|
||||||
this.actor.grab_key_focus();
|
this.actor.grab_key_focus();
|
||||||
@ -122,7 +122,7 @@ var UserListItem = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
showTimedLoginIndicator: function(time) {
|
showTimedLoginIndicator(time) {
|
||||||
let hold = new Batch.Hold();
|
let hold = new Batch.Hold();
|
||||||
|
|
||||||
this.hideTimedLoginIndicator();
|
this.hideTimedLoginIndicator();
|
||||||
@ -149,7 +149,7 @@ var UserListItem = new Lang.Class({
|
|||||||
return hold;
|
return hold;
|
||||||
},
|
},
|
||||||
|
|
||||||
hideTimedLoginIndicator: function() {
|
hideTimedLoginIndicator() {
|
||||||
if (this._timedLoginTimeoutId) {
|
if (this._timedLoginTimeoutId) {
|
||||||
GLib.source_remove(this._timedLoginTimeoutId);
|
GLib.source_remove(this._timedLoginTimeoutId);
|
||||||
this._timedLoginTimeoutId = 0;
|
this._timedLoginTimeoutId = 0;
|
||||||
@ -162,7 +162,7 @@ Signals.addSignalMethods(UserListItem.prototype);
|
|||||||
var UserList = new Lang.Class({
|
var UserList = new Lang.Class({
|
||||||
Name: 'UserList',
|
Name: 'UserList',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.ScrollView({ style_class: 'login-dialog-user-list-view'});
|
this.actor = new St.ScrollView({ style_class: 'login-dialog-user-list-view'});
|
||||||
this.actor.set_policy(Gtk.PolicyType.NEVER,
|
this.actor.set_policy(Gtk.PolicyType.NEVER,
|
||||||
Gtk.PolicyType.AUTOMATIC);
|
Gtk.PolicyType.AUTOMATIC);
|
||||||
@ -177,7 +177,7 @@ var UserList = new Lang.Class({
|
|||||||
this.actor.connect('key-focus-in', Lang.bind(this, this._moveFocusToItems));
|
this.actor.connect('key-focus-in', Lang.bind(this, this._moveFocusToItems));
|
||||||
},
|
},
|
||||||
|
|
||||||
_moveFocusToItems: function() {
|
_moveFocusToItems() {
|
||||||
let hasItems = Object.keys(this._items).length > 0;
|
let hasItems = Object.keys(this._items).length > 0;
|
||||||
|
|
||||||
if (!hasItems)
|
if (!hasItems)
|
||||||
@ -195,11 +195,11 @@ var UserList = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onItemActivated: function(activatedItem) {
|
_onItemActivated(activatedItem) {
|
||||||
this.emit('activate', activatedItem);
|
this.emit('activate', activatedItem);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateStyle: function(isExpanded) {
|
updateStyle(isExpanded) {
|
||||||
let tasks = [];
|
let tasks = [];
|
||||||
|
|
||||||
if (isExpanded)
|
if (isExpanded)
|
||||||
@ -213,7 +213,7 @@ var UserList = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollToItem: function(item) {
|
scrollToItem(item) {
|
||||||
let box = item.actor.get_allocation_box();
|
let box = item.actor.get_allocation_box();
|
||||||
|
|
||||||
let adjustment = this.actor.get_vscroll_bar().get_adjustment();
|
let adjustment = this.actor.get_vscroll_bar().get_adjustment();
|
||||||
@ -226,7 +226,7 @@ var UserList = new Lang.Class({
|
|||||||
transition: 'easeOutQuad' });
|
transition: 'easeOutQuad' });
|
||||||
},
|
},
|
||||||
|
|
||||||
jumpToItem: function(item) {
|
jumpToItem(item) {
|
||||||
let box = item.actor.get_allocation_box();
|
let box = item.actor.get_allocation_box();
|
||||||
|
|
||||||
let adjustment = this.actor.get_vscroll_bar().get_adjustment();
|
let adjustment = this.actor.get_vscroll_bar().get_adjustment();
|
||||||
@ -236,7 +236,7 @@ var UserList = new Lang.Class({
|
|||||||
adjustment.set_value(value);
|
adjustment.set_value(value);
|
||||||
},
|
},
|
||||||
|
|
||||||
getItemFromUserName: function(userName) {
|
getItemFromUserName(userName) {
|
||||||
let item = this._items[userName];
|
let item = this._items[userName];
|
||||||
|
|
||||||
if (!item)
|
if (!item)
|
||||||
@ -245,11 +245,11 @@ var UserList = new Lang.Class({
|
|||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|
||||||
containsUser: function(user) {
|
containsUser(user) {
|
||||||
return this._items[user.get_user_name()] != null;
|
return this._items[user.get_user_name()] != null;
|
||||||
},
|
},
|
||||||
|
|
||||||
addUser: function(user) {
|
addUser(user) {
|
||||||
if (!user.is_loaded)
|
if (!user.is_loaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ var UserList = new Lang.Class({
|
|||||||
this.emit('item-added', item);
|
this.emit('item-added', item);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeUser: function(user) {
|
removeUser(user) {
|
||||||
if (!user.is_loaded)
|
if (!user.is_loaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ var UserList = new Lang.Class({
|
|||||||
delete this._items[userName];
|
delete this._items[userName];
|
||||||
},
|
},
|
||||||
|
|
||||||
numItems: function() {
|
numItems() {
|
||||||
return Object.keys(this._items).length;
|
return Object.keys(this._items).length;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -313,7 +313,7 @@ Signals.addSignalMethods(UserList.prototype);
|
|||||||
var SessionMenuButton = new Lang.Class({
|
var SessionMenuButton = new Lang.Class({
|
||||||
Name: 'SessionMenuButton',
|
Name: 'SessionMenuButton',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
let gearIcon = new St.Icon({ icon_name: 'emblem-system-symbolic' });
|
let gearIcon = new St.Icon({ icon_name: 'emblem-system-symbolic' });
|
||||||
this._button = new St.Button({ style_class: 'login-dialog-session-list-button',
|
this._button = new St.Button({ style_class: 'login-dialog-session-list-button',
|
||||||
reactive: true,
|
reactive: true,
|
||||||
@ -358,13 +358,13 @@ var SessionMenuButton = new Lang.Class({
|
|||||||
this._populate();
|
this._populate();
|
||||||
},
|
},
|
||||||
|
|
||||||
updateSensitivity: function(sensitive) {
|
updateSensitivity(sensitive) {
|
||||||
this._button.reactive = sensitive;
|
this._button.reactive = sensitive;
|
||||||
this._button.can_focus = sensitive;
|
this._button.can_focus = sensitive;
|
||||||
this._menu.close(BoxPointer.PopupAnimation.NONE);
|
this._menu.close(BoxPointer.PopupAnimation.NONE);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateOrnament: function() {
|
_updateOrnament() {
|
||||||
let itemIds = Object.keys(this._items);
|
let itemIds = Object.keys(this._items);
|
||||||
for (let i = 0; i < itemIds.length; i++) {
|
for (let i = 0; i < itemIds.length; i++) {
|
||||||
if (itemIds[i] == this._activeSessionId)
|
if (itemIds[i] == this._activeSessionId)
|
||||||
@ -374,7 +374,7 @@ var SessionMenuButton = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setActiveSession: function(sessionId) {
|
setActiveSession(sessionId) {
|
||||||
if (sessionId == this._activeSessionId)
|
if (sessionId == this._activeSessionId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -382,11 +382,11 @@ var SessionMenuButton = new Lang.Class({
|
|||||||
this._updateOrnament();
|
this._updateOrnament();
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function() {
|
close() {
|
||||||
this._menu.close();
|
this._menu.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
_populate: function() {
|
_populate() {
|
||||||
let ids = Gdm.get_session_ids();
|
let ids = Gdm.get_session_ids();
|
||||||
ids.sort();
|
ids.sort();
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ Signals.addSignalMethods(SessionMenuButton.prototype);
|
|||||||
var LoginDialog = new Lang.Class({
|
var LoginDialog = new Lang.Class({
|
||||||
Name: 'LoginDialog',
|
Name: 'LoginDialog',
|
||||||
|
|
||||||
_init: function(parentActor) {
|
_init(parentActor) {
|
||||||
this.actor = new Shell.GenericContainer({ style_class: 'login-dialog',
|
this.actor = new Shell.GenericContainer({ style_class: 'login-dialog',
|
||||||
visible: false });
|
visible: false });
|
||||||
this.actor.get_accessible().set_role(Atk.Role.WINDOW);
|
this.actor.get_accessible().set_role(Atk.Role.WINDOW);
|
||||||
@ -537,7 +537,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
Lang.bind(this, this._updateDisableUserList));
|
Lang.bind(this, this._updateDisableUserList));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getBannerAllocation: function (dialogBox) {
|
_getBannerAllocation(dialogBox) {
|
||||||
let actorBox = new Clutter.ActorBox();
|
let actorBox = new Clutter.ActorBox();
|
||||||
|
|
||||||
let [minWidth, minHeight, natWidth, natHeight] = this._bannerView.get_preferred_size();
|
let [minWidth, minHeight, natWidth, natHeight] = this._bannerView.get_preferred_size();
|
||||||
@ -551,7 +551,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
return actorBox;
|
return actorBox;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getLogoBinAllocation: function (dialogBox) {
|
_getLogoBinAllocation(dialogBox) {
|
||||||
let actorBox = new Clutter.ActorBox();
|
let actorBox = new Clutter.ActorBox();
|
||||||
|
|
||||||
let [minWidth, minHeight, natWidth, natHeight] = this._logoBin.get_preferred_size();
|
let [minWidth, minHeight, natWidth, natHeight] = this._logoBin.get_preferred_size();
|
||||||
@ -565,7 +565,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
return actorBox;
|
return actorBox;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getCenterActorAllocation: function (dialogBox, actor) {
|
_getCenterActorAllocation(dialogBox, actor) {
|
||||||
let actorBox = new Clutter.ActorBox();
|
let actorBox = new Clutter.ActorBox();
|
||||||
|
|
||||||
let [minWidth, minHeight, natWidth, natHeight] = actor.get_preferred_size();
|
let [minWidth, minHeight, natWidth, natHeight] = actor.get_preferred_size();
|
||||||
@ -583,7 +583,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
return actorBox;
|
return actorBox;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAllocate: function (actor, dialogBox, flags) {
|
_onAllocate(actor, dialogBox, flags) {
|
||||||
let dialogWidth = dialogBox.x2 - dialogBox.x1;
|
let dialogWidth = dialogBox.x2 - dialogBox.x1;
|
||||||
let dialogHeight = dialogBox.y2 - dialogBox.y1;
|
let dialogHeight = dialogBox.y2 - dialogBox.y1;
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
this._logoBin.allocate(logoAllocation, flags);
|
this._logoBin.allocate(logoAllocation, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureUserListLoaded: function() {
|
_ensureUserListLoaded() {
|
||||||
if (!this._userManager.is_loaded) {
|
if (!this._userManager.is_loaded) {
|
||||||
this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
|
this._userManagerLoadedId = this._userManager.connect('notify::is-loaded',
|
||||||
Lang.bind(this, function() {
|
Lang.bind(this, function() {
|
||||||
@ -737,7 +737,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateDisableUserList: function() {
|
_updateDisableUserList() {
|
||||||
let disableUserList = this._settings.get_boolean(GdmUtil.DISABLE_USER_LIST_KEY);
|
let disableUserList = this._settings.get_boolean(GdmUtil.DISABLE_USER_LIST_KEY);
|
||||||
|
|
||||||
// Disable user list when there are no users.
|
// Disable user list when there are no users.
|
||||||
@ -752,7 +752,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCancelButton: function() {
|
_updateCancelButton() {
|
||||||
let cancelVisible;
|
let cancelVisible;
|
||||||
|
|
||||||
// Hide the cancel button if the user list is disabled and we're asking for
|
// Hide the cancel button if the user list is disabled and we're asking for
|
||||||
@ -765,7 +765,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
this._authPrompt.cancelButton.visible = cancelVisible;
|
this._authPrompt.cancelButton.visible = cancelVisible;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateBanner: function() {
|
_updateBanner() {
|
||||||
let enabled = this._settings.get_boolean(GdmUtil.BANNER_MESSAGE_KEY);
|
let enabled = this._settings.get_boolean(GdmUtil.BANNER_MESSAGE_KEY);
|
||||||
let text = this._settings.get_string(GdmUtil.BANNER_MESSAGE_TEXT_KEY);
|
let text = this._settings.get_string(GdmUtil.BANNER_MESSAGE_TEXT_KEY);
|
||||||
|
|
||||||
@ -777,7 +777,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_fadeInBannerView: function() {
|
_fadeInBannerView() {
|
||||||
this._bannerView.show();
|
this._bannerView.show();
|
||||||
Tweener.addTween(this._bannerView,
|
Tweener.addTween(this._bannerView,
|
||||||
{ opacity: 255,
|
{ opacity: 255,
|
||||||
@ -785,13 +785,13 @@ var LoginDialog = new Lang.Class({
|
|||||||
transition: 'easeOutQuad' });
|
transition: 'easeOutQuad' });
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideBannerView: function() {
|
_hideBannerView() {
|
||||||
Tweener.removeTweens(this._bannerView);
|
Tweener.removeTweens(this._bannerView);
|
||||||
this._bannerView.opacity = 0;
|
this._bannerView.opacity = 0;
|
||||||
this._bannerView.hide();
|
this._bannerView.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLogoTexture: function(cache, file) {
|
_updateLogoTexture(cache, file) {
|
||||||
if (this._logoFile && !this._logoFile.equal(file))
|
if (this._logoFile && !this._logoFile.equal(file))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -804,14 +804,14 @@ var LoginDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLogo: function() {
|
_updateLogo() {
|
||||||
let path = this._settings.get_string(GdmUtil.LOGO_KEY);
|
let path = this._settings.get_string(GdmUtil.LOGO_KEY);
|
||||||
|
|
||||||
this._logoFile = path ? Gio.file_new_for_path(path) : null;
|
this._logoFile = path ? Gio.file_new_for_path(path) : null;
|
||||||
this._updateLogoTexture(this._textureCache, this._logoFile);
|
this._updateLogoTexture(this._textureCache, this._logoFile);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPrompted: function() {
|
_onPrompted() {
|
||||||
if (this._shouldShowSessionMenuButton()) {
|
if (this._shouldShowSessionMenuButton()) {
|
||||||
this._sessionMenuButton.updateSensitivity(true);
|
this._sessionMenuButton.updateSensitivity(true);
|
||||||
this._authPrompt.setActorInDefaultButtonWell(this._sessionMenuButton.actor);
|
this._authPrompt.setActorInDefaultButtonWell(this._sessionMenuButton.actor);
|
||||||
@ -821,7 +821,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
this._showPrompt();
|
this._showPrompt();
|
||||||
},
|
},
|
||||||
|
|
||||||
_resetGreeterProxy: function() {
|
_resetGreeterProxy() {
|
||||||
if (GLib.getenv('GDM_GREETER_TEST') != '1') {
|
if (GLib.getenv('GDM_GREETER_TEST') != '1') {
|
||||||
if (this._greeter) {
|
if (this._greeter) {
|
||||||
this._greeter.run_dispose();
|
this._greeter.run_dispose();
|
||||||
@ -837,7 +837,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onReset: function(authPrompt, beginRequest) {
|
_onReset(authPrompt, beginRequest) {
|
||||||
this._resetGreeterProxy();
|
this._resetGreeterProxy();
|
||||||
this._sessionMenuButton.updateSensitivity(true);
|
this._sessionMenuButton.updateSensitivity(true);
|
||||||
|
|
||||||
@ -858,11 +858,11 @@ var LoginDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDefaultSessionChanged: function(client, sessionId) {
|
_onDefaultSessionChanged(client, sessionId) {
|
||||||
this._sessionMenuButton.setActiveSession(sessionId);
|
this._sessionMenuButton.setActiveSession(sessionId);
|
||||||
},
|
},
|
||||||
|
|
||||||
_shouldShowSessionMenuButton: function() {
|
_shouldShowSessionMenuButton() {
|
||||||
if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.VERIFYING &&
|
if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.VERIFYING &&
|
||||||
this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.VERIFICATION_FAILED)
|
this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.VERIFICATION_FAILED)
|
||||||
return false;
|
return false;
|
||||||
@ -873,7 +873,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_showPrompt: function() {
|
_showPrompt() {
|
||||||
if (this._authPrompt.actor.visible)
|
if (this._authPrompt.actor.visible)
|
||||||
return;
|
return;
|
||||||
this._authPrompt.actor.opacity = 0;
|
this._authPrompt.actor.opacity = 0;
|
||||||
@ -885,7 +885,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
this._fadeInBannerView();
|
this._fadeInBannerView();
|
||||||
},
|
},
|
||||||
|
|
||||||
_showRealmLoginHint: function(realmManager, hint) {
|
_showRealmLoginHint(realmManager, hint) {
|
||||||
if (!hint)
|
if (!hint)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -898,7 +898,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
this._authPrompt.setMessage(_("(e.g., user or %s)").format(hint), GdmUtil.MessageType.HINT);
|
this._authPrompt.setMessage(_("(e.g., user or %s)").format(hint), GdmUtil.MessageType.HINT);
|
||||||
},
|
},
|
||||||
|
|
||||||
_askForUsernameAndBeginVerification: function() {
|
_askForUsernameAndBeginVerification() {
|
||||||
this._authPrompt.setPasswordChar('');
|
this._authPrompt.setPasswordChar('');
|
||||||
this._authPrompt.setQuestion(_("Username: "));
|
this._authPrompt.setQuestion(_("Username: "));
|
||||||
|
|
||||||
@ -925,7 +925,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
this._showPrompt();
|
this._showPrompt();
|
||||||
},
|
},
|
||||||
|
|
||||||
_loginScreenSessionActivated: function() {
|
_loginScreenSessionActivated() {
|
||||||
if (this.actor.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
if (this.actor.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -933,7 +933,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
{ opacity: 255,
|
{ opacity: 255,
|
||||||
time: _FADE_ANIMATION_TIME,
|
time: _FADE_ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onUpdate: function() {
|
onUpdate() {
|
||||||
let children = Main.layoutManager.uiGroup.get_children();
|
let children = Main.layoutManager.uiGroup.get_children();
|
||||||
|
|
||||||
for (let i = 0; i < children.length; i++) {
|
for (let i = 0; i < children.length; i++) {
|
||||||
@ -942,14 +942,14 @@ var LoginDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUpdateScope: this,
|
onUpdateScope: this,
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
||||||
this._authPrompt.reset();
|
this._authPrompt.reset();
|
||||||
},
|
},
|
||||||
onCompleteScope: this });
|
onCompleteScope: this });
|
||||||
},
|
},
|
||||||
|
|
||||||
_gotGreeterSessionProxy: function(proxy) {
|
_gotGreeterSessionProxy(proxy) {
|
||||||
this._greeterSessionProxy = proxy;
|
this._greeterSessionProxy = proxy;
|
||||||
this._greeterSessionProxyChangedId =
|
this._greeterSessionProxyChangedId =
|
||||||
proxy.connect('g-properties-changed', Lang.bind(this, function() {
|
proxy.connect('g-properties-changed', Lang.bind(this, function() {
|
||||||
@ -958,12 +958,12 @@ var LoginDialog = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_startSession: function(serviceName) {
|
_startSession(serviceName) {
|
||||||
Tweener.addTween(this.actor,
|
Tweener.addTween(this.actor,
|
||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
time: _FADE_ANIMATION_TIME,
|
time: _FADE_ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onUpdate: function() {
|
onUpdate() {
|
||||||
let children = Main.layoutManager.uiGroup.get_children();
|
let children = Main.layoutManager.uiGroup.get_children();
|
||||||
|
|
||||||
for (let i = 0; i < children.length; i++) {
|
for (let i = 0; i < children.length; i++) {
|
||||||
@ -972,19 +972,19 @@ var LoginDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUpdateScope: this,
|
onUpdateScope: this,
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
this._greeter.call_start_session_when_ready_sync(serviceName, true, null);
|
this._greeter.call_start_session_when_ready_sync(serviceName, true, null);
|
||||||
},
|
},
|
||||||
onCompleteScope: this });
|
onCompleteScope: this });
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSessionOpened: function(client, serviceName) {
|
_onSessionOpened(client, serviceName) {
|
||||||
this._authPrompt.finish(Lang.bind(this, function() {
|
this._authPrompt.finish(Lang.bind(this, function() {
|
||||||
this._startSession(serviceName);
|
this._startSession(serviceName);
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_waitForItemForUser: function(userName) {
|
_waitForItemForUser(userName) {
|
||||||
let item = this._userList.getItemFromUserName(userName);
|
let item = this._userList.getItemFromUserName(userName);
|
||||||
|
|
||||||
if (item)
|
if (item)
|
||||||
@ -1006,12 +1006,12 @@ var LoginDialog = new Lang.Class({
|
|||||||
return hold;
|
return hold;
|
||||||
},
|
},
|
||||||
|
|
||||||
_showTimedLoginAnimation: function() {
|
_showTimedLoginAnimation() {
|
||||||
this._timedLoginItem.actor.grab_key_focus();
|
this._timedLoginItem.actor.grab_key_focus();
|
||||||
return this._timedLoginItem.showTimedLoginIndicator(this._timedLoginAnimationTime);
|
return this._timedLoginItem.showTimedLoginIndicator(this._timedLoginAnimationTime);
|
||||||
},
|
},
|
||||||
|
|
||||||
_blockTimedLoginUntilIdle: function() {
|
_blockTimedLoginUntilIdle() {
|
||||||
// This blocks timed login from starting until a few
|
// This blocks timed login from starting until a few
|
||||||
// seconds after the user stops interacting with the
|
// seconds after the user stops interacting with the
|
||||||
// login screen.
|
// login screen.
|
||||||
@ -1033,7 +1033,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
return hold;
|
return hold;
|
||||||
},
|
},
|
||||||
|
|
||||||
_startTimedLogin: function(userName, delay) {
|
_startTimedLogin(userName, delay) {
|
||||||
this._timedLoginItem = null;
|
this._timedLoginItem = null;
|
||||||
this._timedLoginDelay = delay;
|
this._timedLoginDelay = delay;
|
||||||
this._timedLoginAnimationTime = delay;
|
this._timedLoginAnimationTime = delay;
|
||||||
@ -1072,7 +1072,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
return this._timedLoginBatch.run();
|
return this._timedLoginBatch.run();
|
||||||
},
|
},
|
||||||
|
|
||||||
_resetTimedLogin: function() {
|
_resetTimedLogin() {
|
||||||
if (this._timedLoginBatch) {
|
if (this._timedLoginBatch) {
|
||||||
this._timedLoginBatch.cancel();
|
this._timedLoginBatch.cancel();
|
||||||
this._timedLoginBatch = null;
|
this._timedLoginBatch = null;
|
||||||
@ -1087,7 +1087,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
this._startTimedLogin(userName, this._timedLoginDelay);
|
this._startTimedLogin(userName, this._timedLoginDelay);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onTimedLoginRequested: function(client, userName, seconds) {
|
_onTimedLoginRequested(client, userName, seconds) {
|
||||||
this._startTimedLogin(userName, seconds);
|
this._startTimedLogin(userName, seconds);
|
||||||
|
|
||||||
global.stage.connect('captured-event',
|
global.stage.connect('captured-event',
|
||||||
@ -1110,28 +1110,28 @@ var LoginDialog = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_setUserListExpanded: function(expanded) {
|
_setUserListExpanded(expanded) {
|
||||||
this._userList.updateStyle(expanded);
|
this._userList.updateStyle(expanded);
|
||||||
this._userSelectionBox.visible = expanded;
|
this._userSelectionBox.visible = expanded;
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideUserList: function() {
|
_hideUserList() {
|
||||||
this._setUserListExpanded(false);
|
this._setUserListExpanded(false);
|
||||||
if (this._userSelectionBox.visible)
|
if (this._userSelectionBox.visible)
|
||||||
GdmUtil.cloneAndFadeOutActor(this._userSelectionBox);
|
GdmUtil.cloneAndFadeOutActor(this._userSelectionBox);
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideUserListAskForUsernameAndBeginVerification: function() {
|
_hideUserListAskForUsernameAndBeginVerification() {
|
||||||
this._hideUserList();
|
this._hideUserList();
|
||||||
this._askForUsernameAndBeginVerification();
|
this._askForUsernameAndBeginVerification();
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideUserListAndBeginVerification: function() {
|
_hideUserListAndBeginVerification() {
|
||||||
this._hideUserList();
|
this._hideUserList();
|
||||||
this._authPrompt.begin();
|
this._authPrompt.begin();
|
||||||
},
|
},
|
||||||
|
|
||||||
_showUserList: function() {
|
_showUserList() {
|
||||||
this._ensureUserListLoaded();
|
this._ensureUserListLoaded();
|
||||||
this._authPrompt.hide();
|
this._authPrompt.hide();
|
||||||
this._hideBannerView();
|
this._hideBannerView();
|
||||||
@ -1141,7 +1141,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
this._userList.actor.grab_key_focus();
|
this._userList.actor.grab_key_focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
_beginVerificationForItem: function(item) {
|
_beginVerificationForItem(item) {
|
||||||
this._authPrompt.setUser(item.user);
|
this._authPrompt.setUser(item.user);
|
||||||
|
|
||||||
let userName = item.user.get_user_name();
|
let userName = item.user.get_user_name();
|
||||||
@ -1152,7 +1152,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
return hold;
|
return hold;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUserListActivated: function(activatedItem) {
|
_onUserListActivated(activatedItem) {
|
||||||
this._user = activatedItem.user;
|
this._user = activatedItem.user;
|
||||||
|
|
||||||
this._updateCancelButton();
|
this._updateCancelButton();
|
||||||
@ -1162,7 +1162,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
batch.run();
|
batch.run();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
if (this._userManagerLoadedId) {
|
if (this._userManagerLoadedId) {
|
||||||
this._userManager.disconnect(this._userManagerLoadedId);
|
this._userManager.disconnect(this._userManagerLoadedId);
|
||||||
this._userManagerLoadedId = 0;
|
this._userManagerLoadedId = 0;
|
||||||
@ -1203,7 +1203,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadUserList: function() {
|
_loadUserList() {
|
||||||
if (this._userListLoaded)
|
if (this._userListLoaded)
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
|
|
||||||
@ -1241,7 +1241,7 @@ var LoginDialog = new Lang.Class({
|
|||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function() {
|
open() {
|
||||||
Main.ctrlAltTabManager.addGroup(this.actor,
|
Main.ctrlAltTabManager.addGroup(this.actor,
|
||||||
_("Login Window"),
|
_("Login Window"),
|
||||||
'dialog-password-symbolic',
|
'dialog-password-symbolic',
|
||||||
@ -1260,20 +1260,20 @@ var LoginDialog = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function() {
|
close() {
|
||||||
Main.popModal(this.actor);
|
Main.popModal(this.actor);
|
||||||
Main.ctrlAltTabManager.removeGroup(this.actor);
|
Main.ctrlAltTabManager.removeGroup(this.actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function() {
|
cancel() {
|
||||||
this._authPrompt.cancel();
|
this._authPrompt.cancel();
|
||||||
},
|
},
|
||||||
|
|
||||||
addCharacter: function(unichar) {
|
addCharacter(unichar) {
|
||||||
// Don't allow type ahead at the login screen
|
// Don't allow type ahead at the login screen
|
||||||
},
|
},
|
||||||
|
|
||||||
finish: function(onComplete) {
|
finish(onComplete) {
|
||||||
this._authPrompt.finish(onComplete);
|
this._authPrompt.finish(onComplete);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -29,7 +29,7 @@ function OVirtCredentials() {
|
|||||||
|
|
||||||
var OVirtCredentialsManager = new Lang.Class({
|
var OVirtCredentialsManager = new Lang.Class({
|
||||||
Name: 'OVirtCredentialsManager',
|
Name: 'OVirtCredentialsManager',
|
||||||
_init: function() {
|
_init() {
|
||||||
this._token = null;
|
this._token = null;
|
||||||
|
|
||||||
this._credentials = new OVirtCredentials();
|
this._credentials = new OVirtCredentials();
|
||||||
@ -37,20 +37,20 @@ var OVirtCredentialsManager = new Lang.Class({
|
|||||||
Lang.bind(this, this._onUserAuthenticated));
|
Lang.bind(this, this._onUserAuthenticated));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUserAuthenticated: function(proxy, sender, [token]) {
|
_onUserAuthenticated(proxy, sender, [token]) {
|
||||||
this._token = token;
|
this._token = token;
|
||||||
this.emit('user-authenticated', token);
|
this.emit('user-authenticated', token);
|
||||||
},
|
},
|
||||||
|
|
||||||
hasToken: function() {
|
hasToken() {
|
||||||
return this._token != null;
|
return this._token != null;
|
||||||
},
|
},
|
||||||
|
|
||||||
getToken: function() {
|
getToken() {
|
||||||
return this._token;
|
return this._token;
|
||||||
},
|
},
|
||||||
|
|
||||||
resetToken: function() {
|
resetToken() {
|
||||||
this._token = null;
|
this._token = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -62,7 +62,7 @@ const Realm = Gio.DBusProxy.makeProxyWrapper(RealmIface);
|
|||||||
var Manager = new Lang.Class({
|
var Manager = new Lang.Class({
|
||||||
Name: 'Manager',
|
Name: 'Manager',
|
||||||
|
|
||||||
_init: function(parentActor) {
|
_init(parentActor) {
|
||||||
this._aggregateProvider = Provider(Gio.DBus.system,
|
this._aggregateProvider = Provider(Gio.DBus.system,
|
||||||
'org.freedesktop.realmd',
|
'org.freedesktop.realmd',
|
||||||
'/org/freedesktop/realmd',
|
'/org/freedesktop/realmd',
|
||||||
@ -76,7 +76,7 @@ var Manager = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_reloadRealms: function() {
|
_reloadRealms() {
|
||||||
let realmPaths = this._aggregateProvider.Realms;
|
let realmPaths = this._aggregateProvider.Realms;
|
||||||
|
|
||||||
if (!realmPaths)
|
if (!realmPaths)
|
||||||
@ -90,7 +90,7 @@ var Manager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_reloadRealm: function(realm) {
|
_reloadRealm(realm) {
|
||||||
if (!realm.Configured) {
|
if (!realm.Configured) {
|
||||||
if (this._realms[realm.get_object_path()])
|
if (this._realms[realm.get_object_path()])
|
||||||
delete this._realms[realm.get_object_path()];
|
delete this._realms[realm.get_object_path()];
|
||||||
@ -103,7 +103,7 @@ var Manager = new Lang.Class({
|
|||||||
this._updateLoginFormat();
|
this._updateLoginFormat();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onRealmLoaded: function(realm, error) {
|
_onRealmLoaded(realm, error) {
|
||||||
if (error)
|
if (error)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ var Manager = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLoginFormat: function() {
|
_updateLoginFormat() {
|
||||||
let newLoginFormat;
|
let newLoginFormat;
|
||||||
|
|
||||||
for (let realmPath in this._realms) {
|
for (let realmPath in this._realms) {
|
||||||
@ -142,7 +142,7 @@ var Manager = new Lang.Class({
|
|||||||
return this._loginFormat;
|
return this._loginFormat;
|
||||||
},
|
},
|
||||||
|
|
||||||
release: function() {
|
release() {
|
||||||
Service(Gio.DBus.system,
|
Service(Gio.DBus.system,
|
||||||
'org.freedesktop.realmd',
|
'org.freedesktop.realmd',
|
||||||
'/org/freedesktop/realmd',
|
'/org/freedesktop/realmd',
|
||||||
|
@ -60,7 +60,7 @@ function fadeInActor(actor) {
|
|||||||
height: naturalHeight,
|
height: naturalHeight,
|
||||||
time: FADE_ANIMATION_TIME,
|
time: FADE_ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
this.set_height(-1);
|
this.set_height(-1);
|
||||||
hold.release();
|
hold.release();
|
||||||
},
|
},
|
||||||
@ -82,7 +82,7 @@ function fadeOutActor(actor) {
|
|||||||
height: 0,
|
height: 0,
|
||||||
time: FADE_ANIMATION_TIME,
|
time: FADE_ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
this.hide();
|
this.hide();
|
||||||
this.set_height(-1);
|
this.set_height(-1);
|
||||||
hold.release();
|
hold.release();
|
||||||
@ -111,7 +111,7 @@ function cloneAndFadeOutActor(actor) {
|
|||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
time: CLONE_FADE_ANIMATION_TIME,
|
time: CLONE_FADE_ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
clone.destroy();
|
clone.destroy();
|
||||||
hold.release();
|
hold.release();
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ function cloneAndFadeOutActor(actor) {
|
|||||||
var ShellUserVerifier = new Lang.Class({
|
var ShellUserVerifier = new Lang.Class({
|
||||||
Name: 'ShellUserVerifier',
|
Name: 'ShellUserVerifier',
|
||||||
|
|
||||||
_init: function(client, params) {
|
_init(client, params) {
|
||||||
params = Params.parse(params, { reauthenticationOnly: false });
|
params = Params.parse(params, { reauthenticationOnly: false });
|
||||||
this._reauthOnly = params.reauthenticationOnly;
|
this._reauthOnly = params.reauthenticationOnly;
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
Lang.bind(this, this._oVirtUserAuthenticated));
|
Lang.bind(this, this._oVirtUserAuthenticated));
|
||||||
},
|
},
|
||||||
|
|
||||||
begin: function(userName, hold) {
|
begin(userName, hold) {
|
||||||
this._cancellable = new Gio.Cancellable();
|
this._cancellable = new Gio.Cancellable();
|
||||||
this._hold = hold;
|
this._hold = hold;
|
||||||
this._userName = userName;
|
this._userName = userName;
|
||||||
@ -185,7 +185,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function() {
|
cancel() {
|
||||||
if (this._cancellable)
|
if (this._cancellable)
|
||||||
this._cancellable.cancel();
|
this._cancellable.cancel();
|
||||||
|
|
||||||
@ -195,14 +195,14 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearUserVerifier: function() {
|
_clearUserVerifier() {
|
||||||
if (this._userVerifier) {
|
if (this._userVerifier) {
|
||||||
this._userVerifier.run_dispose();
|
this._userVerifier.run_dispose();
|
||||||
this._userVerifier = null;
|
this._userVerifier = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
clear: function() {
|
clear() {
|
||||||
if (this._cancellable) {
|
if (this._cancellable) {
|
||||||
this._cancellable.cancel();
|
this._cancellable.cancel();
|
||||||
this._cancellable = null;
|
this._cancellable = null;
|
||||||
@ -212,7 +212,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
this._clearMessageQueue();
|
this._clearMessageQueue();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
this._settings.run_dispose();
|
this._settings.run_dispose();
|
||||||
@ -226,7 +226,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
this._oVirtCredentialsManager = null;
|
this._oVirtCredentialsManager = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
answerQuery: function(serviceName, answer) {
|
answerQuery(serviceName, answer) {
|
||||||
if (!this.hasPendingMessages) {
|
if (!this.hasPendingMessages) {
|
||||||
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
|
this._userVerifier.call_answer_query(serviceName, answer, this._cancellable, null);
|
||||||
} else {
|
} else {
|
||||||
@ -238,12 +238,12 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getIntervalForMessage: function(message) {
|
_getIntervalForMessage(message) {
|
||||||
// We probably could be smarter here
|
// We probably could be smarter here
|
||||||
return message.length * USER_READ_TIME;
|
return message.length * USER_READ_TIME;
|
||||||
},
|
},
|
||||||
|
|
||||||
finishMessageQueue: function() {
|
finishMessageQueue() {
|
||||||
if (!this.hasPendingMessages)
|
if (!this.hasPendingMessages)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
this.emit('no-more-messages');
|
this.emit('no-more-messages');
|
||||||
},
|
},
|
||||||
|
|
||||||
_queueMessageTimeout: function() {
|
_queueMessageTimeout() {
|
||||||
if (this._messageQueue.length == 0) {
|
if (this._messageQueue.length == 0) {
|
||||||
this.finishMessageQueue();
|
this.finishMessageQueue();
|
||||||
return;
|
return;
|
||||||
@ -276,7 +276,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._messageQueueTimeoutId, '[gnome-shell] this._queueMessageTimeout');
|
GLib.Source.set_name_by_id(this._messageQueueTimeoutId, '[gnome-shell] this._queueMessageTimeout');
|
||||||
},
|
},
|
||||||
|
|
||||||
_queueMessage: function(message, messageType) {
|
_queueMessage(message, messageType) {
|
||||||
let interval = this._getIntervalForMessage(message);
|
let interval = this._getIntervalForMessage(message);
|
||||||
|
|
||||||
this.hasPendingMessages = true;
|
this.hasPendingMessages = true;
|
||||||
@ -284,7 +284,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
this._queueMessageTimeout();
|
this._queueMessageTimeout();
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearMessageQueue: function() {
|
_clearMessageQueue() {
|
||||||
this.finishMessageQueue();
|
this.finishMessageQueue();
|
||||||
|
|
||||||
if (this._messageQueueTimeoutId != 0) {
|
if (this._messageQueueTimeoutId != 0) {
|
||||||
@ -294,7 +294,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
this.emit('show-message', null, MessageType.NONE);
|
this.emit('show-message', null, MessageType.NONE);
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkForFingerprintReader: function() {
|
_checkForFingerprintReader() {
|
||||||
this._haveFingerprintReader = false;
|
this._haveFingerprintReader = false;
|
||||||
|
|
||||||
if (!this._settings.get_boolean(FINGERPRINT_AUTHENTICATION_KEY) ||
|
if (!this._settings.get_boolean(FINGERPRINT_AUTHENTICATION_KEY) ||
|
||||||
@ -312,12 +312,12 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_oVirtUserAuthenticated: function(token) {
|
_oVirtUserAuthenticated(token) {
|
||||||
this._preemptingService = OVIRT_SERVICE_NAME;
|
this._preemptingService = OVIRT_SERVICE_NAME;
|
||||||
this.emit('ovirt-user-authenticated');
|
this.emit('ovirt-user-authenticated');
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkForSmartcard: function() {
|
_checkForSmartcard() {
|
||||||
let smartcardDetected;
|
let smartcardDetected;
|
||||||
|
|
||||||
if (!this._settings.get_boolean(SMARTCARD_AUTHENTICATION_KEY))
|
if (!this._settings.get_boolean(SMARTCARD_AUTHENTICATION_KEY))
|
||||||
@ -339,7 +339,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_reportInitError: function(where, error) {
|
_reportInitError(where, error) {
|
||||||
logError(error, where);
|
logError(error, where);
|
||||||
this._hold.release();
|
this._hold.release();
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
this._verificationFailed(false);
|
this._verificationFailed(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_reauthenticationChannelOpened: function(client, result) {
|
_reauthenticationChannelOpened(client, result) {
|
||||||
try {
|
try {
|
||||||
this._clearUserVerifier();
|
this._clearUserVerifier();
|
||||||
this._userVerifier = client.open_reauthentication_channel_finish(result);
|
this._userVerifier = client.open_reauthentication_channel_finish(result);
|
||||||
@ -371,7 +371,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
this._hold.release();
|
this._hold.release();
|
||||||
},
|
},
|
||||||
|
|
||||||
_userVerifierGot: function(client, result) {
|
_userVerifierGot(client, result) {
|
||||||
try {
|
try {
|
||||||
this._clearUserVerifier();
|
this._clearUserVerifier();
|
||||||
this._userVerifier = client.get_user_verifier_finish(result);
|
this._userVerifier = client.get_user_verifier_finish(result);
|
||||||
@ -387,7 +387,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
this._hold.release();
|
this._hold.release();
|
||||||
},
|
},
|
||||||
|
|
||||||
_connectSignals: function() {
|
_connectSignals() {
|
||||||
this._userVerifier.connect('info', Lang.bind(this, this._onInfo));
|
this._userVerifier.connect('info', Lang.bind(this, this._onInfo));
|
||||||
this._userVerifier.connect('problem', Lang.bind(this, this._onProblem));
|
this._userVerifier.connect('problem', Lang.bind(this, this._onProblem));
|
||||||
this._userVerifier.connect('info-query', Lang.bind(this, this._onInfoQuery));
|
this._userVerifier.connect('info-query', Lang.bind(this, this._onInfoQuery));
|
||||||
@ -397,22 +397,22 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
this._userVerifier.connect('verification-complete', Lang.bind(this, this._onVerificationComplete));
|
this._userVerifier.connect('verification-complete', Lang.bind(this, this._onVerificationComplete));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getForegroundService: function() {
|
_getForegroundService() {
|
||||||
if (this._preemptingService)
|
if (this._preemptingService)
|
||||||
return this._preemptingService;
|
return this._preemptingService;
|
||||||
|
|
||||||
return this._defaultService;
|
return this._defaultService;
|
||||||
},
|
},
|
||||||
|
|
||||||
serviceIsForeground: function(serviceName) {
|
serviceIsForeground(serviceName) {
|
||||||
return serviceName == this._getForegroundService();
|
return serviceName == this._getForegroundService();
|
||||||
},
|
},
|
||||||
|
|
||||||
serviceIsDefault: function(serviceName) {
|
serviceIsDefault(serviceName) {
|
||||||
return serviceName == this._defaultService;
|
return serviceName == this._defaultService;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateDefaultService: function() {
|
_updateDefaultService() {
|
||||||
if (this._settings.get_boolean(PASSWORD_AUTHENTICATION_KEY))
|
if (this._settings.get_boolean(PASSWORD_AUTHENTICATION_KEY))
|
||||||
this._defaultService = PASSWORD_SERVICE_NAME;
|
this._defaultService = PASSWORD_SERVICE_NAME;
|
||||||
else if (this._settings.get_boolean(SMARTCARD_AUTHENTICATION_KEY))
|
else if (this._settings.get_boolean(SMARTCARD_AUTHENTICATION_KEY))
|
||||||
@ -426,7 +426,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_startService: function(serviceName) {
|
_startService(serviceName) {
|
||||||
this._hold.acquire();
|
this._hold.acquire();
|
||||||
if (this._userName) {
|
if (this._userName) {
|
||||||
this._userVerifier.call_begin_verification_for_user(serviceName,
|
this._userVerifier.call_begin_verification_for_user(serviceName,
|
||||||
@ -462,14 +462,14 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_beginVerification: function() {
|
_beginVerification() {
|
||||||
this._startService(this._getForegroundService());
|
this._startService(this._getForegroundService());
|
||||||
|
|
||||||
if (this._userName && this._haveFingerprintReader && !this.serviceIsForeground(FINGERPRINT_SERVICE_NAME))
|
if (this._userName && this._haveFingerprintReader && !this.serviceIsForeground(FINGERPRINT_SERVICE_NAME))
|
||||||
this._startService(FINGERPRINT_SERVICE_NAME);
|
this._startService(FINGERPRINT_SERVICE_NAME);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onInfo: function(client, serviceName, info) {
|
_onInfo(client, serviceName, info) {
|
||||||
if (this.serviceIsForeground(serviceName)) {
|
if (this.serviceIsForeground(serviceName)) {
|
||||||
this._queueMessage(info, MessageType.INFO);
|
this._queueMessage(info, MessageType.INFO);
|
||||||
} else if (serviceName == FINGERPRINT_SERVICE_NAME &&
|
} else if (serviceName == FINGERPRINT_SERVICE_NAME &&
|
||||||
@ -484,21 +484,21 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onProblem: function(client, serviceName, problem) {
|
_onProblem(client, serviceName, problem) {
|
||||||
if (!this.serviceIsForeground(serviceName))
|
if (!this.serviceIsForeground(serviceName))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._queueMessage(problem, MessageType.ERROR);
|
this._queueMessage(problem, MessageType.ERROR);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onInfoQuery: function(client, serviceName, question) {
|
_onInfoQuery(client, serviceName, question) {
|
||||||
if (!this.serviceIsForeground(serviceName))
|
if (!this.serviceIsForeground(serviceName))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.emit('ask-question', serviceName, question, '');
|
this.emit('ask-question', serviceName, question, '');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSecretInfoQuery: function(client, serviceName, secretQuestion) {
|
_onSecretInfoQuery(client, serviceName, secretQuestion) {
|
||||||
if (!this.serviceIsForeground(serviceName))
|
if (!this.serviceIsForeground(serviceName))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
this.emit('ask-question', serviceName, secretQuestion, '\u25cf');
|
this.emit('ask-question', serviceName, secretQuestion, '\u25cf');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onReset: function() {
|
_onReset() {
|
||||||
// Clear previous attempts to authenticate
|
// Clear previous attempts to authenticate
|
||||||
this._failCounter = 0;
|
this._failCounter = 0;
|
||||||
this._updateDefaultService();
|
this._updateDefaultService();
|
||||||
@ -519,20 +519,20 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
this.emit('reset');
|
this.emit('reset');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onVerificationComplete: function() {
|
_onVerificationComplete() {
|
||||||
this.emit('verification-complete');
|
this.emit('verification-complete');
|
||||||
},
|
},
|
||||||
|
|
||||||
_cancelAndReset: function() {
|
_cancelAndReset() {
|
||||||
this.cancel();
|
this.cancel();
|
||||||
this._onReset();
|
this._onReset();
|
||||||
},
|
},
|
||||||
|
|
||||||
_retry: function() {
|
_retry() {
|
||||||
this.begin(this._userName, new Batch.Hold());
|
this.begin(this._userName, new Batch.Hold());
|
||||||
},
|
},
|
||||||
|
|
||||||
_verificationFailed: function(retry) {
|
_verificationFailed(retry) {
|
||||||
// For Not Listed / enterprise logins, immediately reset
|
// For Not Listed / enterprise logins, immediately reset
|
||||||
// the dialog
|
// the dialog
|
||||||
// Otherwise, we allow ALLOWED_FAILURES attempts. After that, we
|
// Otherwise, we allow ALLOWED_FAILURES attempts. After that, we
|
||||||
@ -568,7 +568,7 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
this.emit('verification-failed');
|
this.emit('verification-failed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onConversationStopped: function(client, serviceName) {
|
_onConversationStopped(client, serviceName) {
|
||||||
// If the login failed with the preauthenticated oVirt credentials
|
// If the login failed with the preauthenticated oVirt credentials
|
||||||
// then discard the credentials and revert to default authentication
|
// then discard the credentials and revert to default authentication
|
||||||
// mechanism.
|
// mechanism.
|
||||||
|
@ -161,7 +161,7 @@ function installImporter(extension) {
|
|||||||
var ExtensionFinder = new Lang.Class({
|
var ExtensionFinder = new Lang.Class({
|
||||||
Name: 'ExtensionFinder',
|
Name: 'ExtensionFinder',
|
||||||
|
|
||||||
_loadExtension: function(extensionDir, info, perUserDir) {
|
_loadExtension(extensionDir, info, perUserDir) {
|
||||||
let fileType = info.get_file_type();
|
let fileType = info.get_file_type();
|
||||||
if (fileType != Gio.FileType.DIRECTORY)
|
if (fileType != Gio.FileType.DIRECTORY)
|
||||||
return;
|
return;
|
||||||
@ -184,7 +184,7 @@ var ExtensionFinder = new Lang.Class({
|
|||||||
this.emit('extension-found', extension);
|
this.emit('extension-found', extension);
|
||||||
},
|
},
|
||||||
|
|
||||||
scanExtensions: function() {
|
scanExtensions() {
|
||||||
let perUserDir = Gio.File.new_for_path(global.userdatadir);
|
let perUserDir = Gio.File.new_for_path(global.userdatadir);
|
||||||
FileUtils.collectFromDatadirs('extensions', true, Lang.bind(this, this._loadExtension, perUserDir));
|
FileUtils.collectFromDatadirs('extensions', true, Lang.bind(this, this._loadExtension, perUserDir));
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ var DEFAULT_LIMIT = 512;
|
|||||||
var HistoryManager = new Lang.Class({
|
var HistoryManager = new Lang.Class({
|
||||||
Name: 'HistoryManager',
|
Name: 'HistoryManager',
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
params = Params.parse(params, { gsettingsKey: null,
|
params = Params.parse(params, { gsettingsKey: null,
|
||||||
limit: DEFAULT_LIMIT,
|
limit: DEFAULT_LIMIT,
|
||||||
entry: null });
|
entry: null });
|
||||||
@ -36,12 +36,12 @@ var HistoryManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_historyChanged: function() {
|
_historyChanged() {
|
||||||
this._history = global.settings.get_strv(this._key);
|
this._history = global.settings.get_strv(this._key);
|
||||||
this._historyIndex = this._history.length;
|
this._historyIndex = this._history.length;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setPrevItem: function(text) {
|
_setPrevItem(text) {
|
||||||
if (this._historyIndex <= 0)
|
if (this._historyIndex <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ var HistoryManager = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setNextItem: function(text) {
|
_setNextItem(text) {
|
||||||
if (this._historyIndex >= this._history.length)
|
if (this._historyIndex >= this._history.length)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ var HistoryManager = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
lastItem: function() {
|
lastItem() {
|
||||||
if (this._historyIndex != this._history.length) {
|
if (this._historyIndex != this._history.length) {
|
||||||
this._historyIndex = this._history.length;
|
this._historyIndex = this._history.length;
|
||||||
this._indexChanged();
|
this._indexChanged();
|
||||||
@ -72,7 +72,7 @@ var HistoryManager = new Lang.Class({
|
|||||||
return this._historyIndex ? this._history[this._historyIndex -1] : null;
|
return this._historyIndex ? this._history[this._historyIndex -1] : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
addItem: function(input) {
|
addItem(input) {
|
||||||
if (this._history.length == 0 ||
|
if (this._history.length == 0 ||
|
||||||
this._history[this._history.length - 1] != input) {
|
this._history[this._history.length - 1] != input) {
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ var HistoryManager = new Lang.Class({
|
|||||||
this._historyIndex = this._history.length;
|
this._historyIndex = this._history.length;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEntryKeyPress: function(entry, event) {
|
_onEntryKeyPress(entry, event) {
|
||||||
let symbol = event.get_key_symbol();
|
let symbol = event.get_key_symbol();
|
||||||
if (symbol == Clutter.KEY_Up) {
|
if (symbol == Clutter.KEY_Up) {
|
||||||
return this._setPrevItem(entry.get_text());
|
return this._setPrevItem(entry.get_text());
|
||||||
@ -92,7 +92,7 @@ var HistoryManager = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_indexChanged: function() {
|
_indexChanged() {
|
||||||
let current = this._history[this._historyIndex] || '';
|
let current = this._history[this._historyIndex] || '';
|
||||||
this.emit('changed', current);
|
this.emit('changed', current);
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ var HistoryManager = new Lang.Class({
|
|||||||
this._entry.set_text(current);
|
this._entry.set_text(current);
|
||||||
},
|
},
|
||||||
|
|
||||||
_save: function() {
|
_save() {
|
||||||
if (this._history.length > this._limit)
|
if (this._history.length > this._limit)
|
||||||
this._history.splice(0, this._history.length - this._limit);
|
this._history.splice(0, this._history.length - this._limit);
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ var IBusManager = new Lang.Class({
|
|||||||
_MAX_INPUT_SOURCE_ACTIVATION_TIME: 4000, // ms
|
_MAX_INPUT_SOURCE_ACTIVATION_TIME: 4000, // ms
|
||||||
_PRELOAD_ENGINES_DELAY_TIME: 30, // sec
|
_PRELOAD_ENGINES_DELAY_TIME: 30, // sec
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
IBus.init();
|
IBus.init();
|
||||||
|
|
||||||
this._candidatePopup = new IBusCandidatePopup.CandidatePopup();
|
this._candidatePopup = new IBusCandidatePopup.CandidatePopup();
|
||||||
@ -62,7 +62,7 @@ var IBusManager = new Lang.Class({
|
|||||||
this._spawn();
|
this._spawn();
|
||||||
},
|
},
|
||||||
|
|
||||||
_spawn: function() {
|
_spawn() {
|
||||||
try {
|
try {
|
||||||
Gio.Subprocess.new(['ibus-daemon', '--xim', '--panel', 'disable'],
|
Gio.Subprocess.new(['ibus-daemon', '--xim', '--panel', 'disable'],
|
||||||
Gio.SubprocessFlags.NONE);
|
Gio.SubprocessFlags.NONE);
|
||||||
@ -71,7 +71,7 @@ var IBusManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_clear: function() {
|
_clear() {
|
||||||
if (this._panelService)
|
if (this._panelService)
|
||||||
this._panelService.destroy();
|
this._panelService.destroy();
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ var IBusManager = new Lang.Class({
|
|||||||
this._spawn();
|
this._spawn();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onConnected: function() {
|
_onConnected() {
|
||||||
this._ibus.list_engines_async(-1, null, Lang.bind(this, this._initEngines));
|
this._ibus.list_engines_async(-1, null, Lang.bind(this, this._initEngines));
|
||||||
this._ibus.request_name_async(IBus.SERVICE_PANEL,
|
this._ibus.request_name_async(IBus.SERVICE_PANEL,
|
||||||
IBus.BusNameFlag.REPLACE_EXISTING,
|
IBus.BusNameFlag.REPLACE_EXISTING,
|
||||||
@ -95,7 +95,7 @@ var IBusManager = new Lang.Class({
|
|||||||
Lang.bind(this, this._initPanelService));
|
Lang.bind(this, this._initPanelService));
|
||||||
},
|
},
|
||||||
|
|
||||||
_initEngines: function(ibus, result) {
|
_initEngines(ibus, result) {
|
||||||
let enginesList = this._ibus.list_engines_async_finish(result);
|
let enginesList = this._ibus.list_engines_async_finish(result);
|
||||||
if (enginesList) {
|
if (enginesList) {
|
||||||
for (let i = 0; i < enginesList.length; ++i) {
|
for (let i = 0; i < enginesList.length; ++i) {
|
||||||
@ -108,7 +108,7 @@ var IBusManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_initPanelService: function(ibus, result) {
|
_initPanelService(ibus, result) {
|
||||||
let success = this._ibus.request_name_async_finish(result);
|
let success = this._ibus.request_name_async_finish(result);
|
||||||
if (success) {
|
if (success) {
|
||||||
this._panelService = new IBus.PanelService({ connection: this._ibus.get_connection(),
|
this._panelService = new IBus.PanelService({ connection: this._ibus.get_connection(),
|
||||||
@ -143,13 +143,13 @@ var IBusManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateReadiness: function() {
|
_updateReadiness() {
|
||||||
this._ready = (Object.keys(this._engines).length > 0 &&
|
this._ready = (Object.keys(this._engines).length > 0 &&
|
||||||
this._panelService != null);
|
this._panelService != null);
|
||||||
this.emit('ready', this._ready);
|
this.emit('ready', this._ready);
|
||||||
},
|
},
|
||||||
|
|
||||||
_engineChanged: function(bus, engineName) {
|
_engineChanged(bus, engineName) {
|
||||||
if (!this._ready)
|
if (!this._ready)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -170,26 +170,26 @@ var IBusManager = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateProperty: function(panel, prop) {
|
_updateProperty(panel, prop) {
|
||||||
this.emit('property-updated', this._currentEngineName, prop);
|
this.emit('property-updated', this._currentEngineName, prop);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setContentType: function(panel, purpose, hints) {
|
_setContentType(panel, purpose, hints) {
|
||||||
this.emit('set-content-type', purpose, hints);
|
this.emit('set-content-type', purpose, hints);
|
||||||
},
|
},
|
||||||
|
|
||||||
activateProperty: function(key, state) {
|
activateProperty(key, state) {
|
||||||
this._panelService.property_activate(key, state);
|
this._panelService.property_activate(key, state);
|
||||||
},
|
},
|
||||||
|
|
||||||
getEngineDesc: function(id) {
|
getEngineDesc(id) {
|
||||||
if (!this._ready || !this._engines.hasOwnProperty(id))
|
if (!this._ready || !this._engines.hasOwnProperty(id))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return this._engines[id];
|
return this._engines[id];
|
||||||
},
|
},
|
||||||
|
|
||||||
setEngine: function(id, callback) {
|
setEngine(id, callback) {
|
||||||
// Send id even if id == this._currentEngineName
|
// Send id even if id == this._currentEngineName
|
||||||
// because 'properties-registered' signal can be emitted
|
// because 'properties-registered' signal can be emitted
|
||||||
// while this._ibusSources == null on a lock screen.
|
// while this._ibusSources == null on a lock screen.
|
||||||
@ -203,7 +203,7 @@ var IBusManager = new Lang.Class({
|
|||||||
null, callback);
|
null, callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
preloadEngines: function(ids) {
|
preloadEngines(ids) {
|
||||||
if (!this._ibus || ids.length == 0)
|
if (!this._ibus || ids.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ var InputMethod = new Lang.Class({
|
|||||||
Name: 'InputMethod',
|
Name: 'InputMethod',
|
||||||
Extends: Clutter.InputMethod,
|
Extends: Clutter.InputMethod,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
this._hints = 0;
|
this._hints = 0;
|
||||||
this._purpose = 0;
|
this._purpose = 0;
|
||||||
@ -33,7 +33,7 @@ var InputMethod = new Lang.Class({
|
|||||||
return this._currentFocus;
|
return this._currentFocus;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCapabilities: function() {
|
_updateCapabilities() {
|
||||||
let caps = 0;
|
let caps = 0;
|
||||||
|
|
||||||
if (this.can_show_preedit)
|
if (this.can_show_preedit)
|
||||||
@ -48,16 +48,16 @@ var InputMethod = new Lang.Class({
|
|||||||
this._context.set_capabilities(caps);
|
this._context.set_capabilities(caps);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSourceChanged: function() {
|
_onSourceChanged() {
|
||||||
this._currentSource = this._inputSourceManager.currentSource;
|
this._currentSource = this._inputSourceManager.currentSource;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onConnected: function() {
|
_onConnected() {
|
||||||
this._ibus.create_input_context_async ('gnome-shell', -1, null,
|
this._ibus.create_input_context_async ('gnome-shell', -1, null,
|
||||||
Lang.bind(this, this._setContext));
|
Lang.bind(this, this._setContext));
|
||||||
},
|
},
|
||||||
|
|
||||||
_setContext: function(bus, res) {
|
_setContext(bus, res) {
|
||||||
this._context = this._ibus.create_input_context_async_finish(res);
|
this._context = this._ibus.create_input_context_async_finish(res);
|
||||||
this._context.connect('enabled', Lang.bind(this, function () { this._enabled = true }));
|
this._context.connect('enabled', Lang.bind(this, function () { this._enabled = true }));
|
||||||
this._context.connect('disabled', Lang.bind(this, function () { this._enabled = false }));
|
this._context.connect('disabled', Lang.bind(this, function () { this._enabled = false }));
|
||||||
@ -68,27 +68,27 @@ var InputMethod = new Lang.Class({
|
|||||||
this._updateCapabilities();
|
this._updateCapabilities();
|
||||||
},
|
},
|
||||||
|
|
||||||
_clear: function() {
|
_clear() {
|
||||||
this._context = null;
|
this._context = null;
|
||||||
this._hints = 0;
|
this._hints = 0;
|
||||||
this._purpose = 0;
|
this._purpose = 0;
|
||||||
this._enabled = false;
|
this._enabled = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_emitRequestSurrounding: function() {
|
_emitRequestSurrounding() {
|
||||||
if (this._context.needs_surrounding_text())
|
if (this._context.needs_surrounding_text())
|
||||||
this.emit('request-surrounding');
|
this.emit('request-surrounding');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCommitText: function(context, text) {
|
_onCommitText(context, text) {
|
||||||
this.commit(text.get_text());
|
this.commit(text.get_text());
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDeleteSurroundingText: function (context) {
|
_onDeleteSurroundingText(context) {
|
||||||
this.delete_surrounding();
|
this.delete_surrounding();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUpdatePreeditText: function (context, text, pos, visible) {
|
_onUpdatePreeditText(context, text, pos, visible) {
|
||||||
let str = null;
|
let str = null;
|
||||||
if (visible && text != null)
|
if (visible && text != null)
|
||||||
str = text.get_text();
|
str = text.get_text();
|
||||||
@ -96,7 +96,7 @@ var InputMethod = new Lang.Class({
|
|||||||
this.set_preedit_text(str, pos);
|
this.set_preedit_text(str, pos);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_focus_in: function(focus) {
|
vfunc_focus_in(focus) {
|
||||||
this._currentFocus = focus;
|
this._currentFocus = focus;
|
||||||
if (this._context) {
|
if (this._context) {
|
||||||
this._context.focus_in();
|
this._context.focus_in();
|
||||||
@ -105,7 +105,7 @@ var InputMethod = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_focus_out: function() {
|
vfunc_focus_out() {
|
||||||
this._currentFocus = null;
|
this._currentFocus = null;
|
||||||
if (this._context) {
|
if (this._context) {
|
||||||
this._context.focus_out();
|
this._context.focus_out();
|
||||||
@ -116,7 +116,7 @@ var InputMethod = new Lang.Class({
|
|||||||
this.set_preedit_text(null, 0);
|
this.set_preedit_text(null, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_reset: function() {
|
vfunc_reset() {
|
||||||
if (this._context) {
|
if (this._context) {
|
||||||
this._context.reset();
|
this._context.reset();
|
||||||
this._emitRequestSurrounding();
|
this._emitRequestSurrounding();
|
||||||
@ -126,7 +126,7 @@ var InputMethod = new Lang.Class({
|
|||||||
this.set_preedit_text(null, 0);
|
this.set_preedit_text(null, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_set_cursor_location: function(rect) {
|
vfunc_set_cursor_location(rect) {
|
||||||
if (this._context) {
|
if (this._context) {
|
||||||
this._context.set_cursor_location(rect.get_x(), rect.get_y(),
|
this._context.set_cursor_location(rect.get_x(), rect.get_y(),
|
||||||
rect.get_width(), rect.get_height());
|
rect.get_width(), rect.get_height());
|
||||||
@ -134,12 +134,12 @@ var InputMethod = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_set_surrounding: function(text, cursor, anchor) {
|
vfunc_set_surrounding(text, cursor, anchor) {
|
||||||
if (this._context)
|
if (this._context)
|
||||||
this._context.set_surrounding_text(text, cursor, anchor);
|
this._context.set_surrounding_text(text, cursor, anchor);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_update_content_hints: function(hints) {
|
vfunc_update_content_hints(hints) {
|
||||||
let ibusHints = 0;
|
let ibusHints = 0;
|
||||||
if (hints & Clutter.InputContentHintFlags.COMPLETION)
|
if (hints & Clutter.InputContentHintFlags.COMPLETION)
|
||||||
ibusHints |= IBus.InputHints.WORD_COMPLETION;
|
ibusHints |= IBus.InputHints.WORD_COMPLETION;
|
||||||
@ -159,7 +159,7 @@ var InputMethod = new Lang.Class({
|
|||||||
this._context.set_content_type(this._purpose, this._hints);
|
this._context.set_content_type(this._purpose, this._hints);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_update_content_purpose: function(purpose) {
|
vfunc_update_content_purpose(purpose) {
|
||||||
let ibusPurpose = 0;
|
let ibusPurpose = 0;
|
||||||
if (purpose == Clutter.InputContentPurpose.NORMAL)
|
if (purpose == Clutter.InputContentPurpose.NORMAL)
|
||||||
ibusPurpose = IBus.InputPurpose.FREE_FORM;
|
ibusPurpose = IBus.InputPurpose.FREE_FORM;
|
||||||
@ -185,7 +185,7 @@ var InputMethod = new Lang.Class({
|
|||||||
this._context.set_content_type(this._purpose, this._hints);
|
this._context.set_content_type(this._purpose, this._hints);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_filter_key_event: function(event) {
|
vfunc_filter_key_event(event) {
|
||||||
if (!this._context || !this._enabled)
|
if (!this._context || !this._enabled)
|
||||||
return false;
|
return false;
|
||||||
if (!this._currentSource ||
|
if (!this._currentSource ||
|
||||||
|
@ -47,24 +47,24 @@ var KeyboardManager = new Lang.Class({
|
|||||||
// even as a Wayland compositor, we can't bump this.
|
// even as a Wayland compositor, we can't bump this.
|
||||||
MAX_LAYOUTS_PER_GROUP: 4,
|
MAX_LAYOUTS_PER_GROUP: 4,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._xkbInfo = getXkbInfo();
|
this._xkbInfo = getXkbInfo();
|
||||||
this._current = null;
|
this._current = null;
|
||||||
this._localeLayoutInfo = this._getLocaleLayout();
|
this._localeLayoutInfo = this._getLocaleLayout();
|
||||||
this._layoutInfos = {};
|
this._layoutInfos = {};
|
||||||
},
|
},
|
||||||
|
|
||||||
_applyLayoutGroup: function(group) {
|
_applyLayoutGroup(group) {
|
||||||
let options = this._buildOptionsString();
|
let options = this._buildOptionsString();
|
||||||
let [layouts, variants] = this._buildGroupStrings(group);
|
let [layouts, variants] = this._buildGroupStrings(group);
|
||||||
Meta.get_backend().set_keymap(layouts, variants, options);
|
Meta.get_backend().set_keymap(layouts, variants, options);
|
||||||
},
|
},
|
||||||
|
|
||||||
_applyLayoutGroupIndex: function(idx) {
|
_applyLayoutGroupIndex(idx) {
|
||||||
Meta.get_backend().lock_layout_group(idx);
|
Meta.get_backend().lock_layout_group(idx);
|
||||||
},
|
},
|
||||||
|
|
||||||
apply: function(id) {
|
apply(id) {
|
||||||
let info = this._layoutInfos[id];
|
let info = this._layoutInfos[id];
|
||||||
if (!info)
|
if (!info)
|
||||||
return;
|
return;
|
||||||
@ -80,7 +80,7 @@ var KeyboardManager = new Lang.Class({
|
|||||||
this._current = info;
|
this._current = info;
|
||||||
},
|
},
|
||||||
|
|
||||||
reapply: function() {
|
reapply() {
|
||||||
if (!this._current)
|
if (!this._current)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ var KeyboardManager = new Lang.Class({
|
|||||||
this._applyLayoutGroupIndex(this._current.groupIndex);
|
this._applyLayoutGroupIndex(this._current.groupIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
setUserLayouts: function(ids) {
|
setUserLayouts(ids) {
|
||||||
this._current = null;
|
this._current = null;
|
||||||
this._layoutInfos = {};
|
this._layoutInfos = {};
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ var KeyboardManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getLocaleLayout: function() {
|
_getLocaleLayout() {
|
||||||
let locale = GLib.get_language_names()[0];
|
let locale = GLib.get_language_names()[0];
|
||||||
if (locale.indexOf('_') == -1)
|
if (locale.indexOf('_') == -1)
|
||||||
locale = DEFAULT_LOCALE;
|
locale = DEFAULT_LOCALE;
|
||||||
@ -136,18 +136,18 @@ var KeyboardManager = new Lang.Class({
|
|||||||
return { layout: DEFAULT_LAYOUT, variant: DEFAULT_VARIANT };
|
return { layout: DEFAULT_LAYOUT, variant: DEFAULT_VARIANT };
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildGroupStrings: function(_group) {
|
_buildGroupStrings(_group) {
|
||||||
let group = _group.concat(this._localeLayoutInfo);
|
let group = _group.concat(this._localeLayoutInfo);
|
||||||
let layouts = group.map(function(g) { return g.layout; }).join(',');
|
let layouts = group.map(function(g) { return g.layout; }).join(',');
|
||||||
let variants = group.map(function(g) { return g.variant; }).join(',');
|
let variants = group.map(function(g) { return g.variant; }).join(',');
|
||||||
return [layouts, variants];
|
return [layouts, variants];
|
||||||
},
|
},
|
||||||
|
|
||||||
setKeyboardOptions: function(options) {
|
setKeyboardOptions(options) {
|
||||||
this._xkbOptions = options;
|
this._xkbOptions = options;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildOptionsString: function() {
|
_buildOptionsString() {
|
||||||
let options = this._xkbOptions.join(',');
|
let options = this._xkbOptions.join(',');
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ function getLoginManager() {
|
|||||||
var LoginManagerSystemd = new Lang.Class({
|
var LoginManagerSystemd = new Lang.Class({
|
||||||
Name: 'LoginManagerSystemd',
|
Name: 'LoginManagerSystemd',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._proxy = new SystemdLoginManager(Gio.DBus.system,
|
this._proxy = new SystemdLoginManager(Gio.DBus.system,
|
||||||
'org.freedesktop.login1',
|
'org.freedesktop.login1',
|
||||||
'/org/freedesktop/login1');
|
'/org/freedesktop/login1');
|
||||||
@ -113,7 +113,7 @@ var LoginManagerSystemd = new Lang.Class({
|
|||||||
Lang.bind(this, this._prepareForSleep));
|
Lang.bind(this, this._prepareForSleep));
|
||||||
},
|
},
|
||||||
|
|
||||||
getCurrentSessionProxy: function(callback) {
|
getCurrentSessionProxy(callback) {
|
||||||
if (this._currentSession) {
|
if (this._currentSession) {
|
||||||
callback (this._currentSession);
|
callback (this._currentSession);
|
||||||
return;
|
return;
|
||||||
@ -138,7 +138,7 @@ var LoginManagerSystemd = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
canSuspend: function(asyncCallback) {
|
canSuspend(asyncCallback) {
|
||||||
this._proxy.CanSuspendRemote(function(result, error) {
|
this._proxy.CanSuspendRemote(function(result, error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
asyncCallback(false, false);
|
asyncCallback(false, false);
|
||||||
@ -150,7 +150,7 @@ var LoginManagerSystemd = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
listSessions: function(asyncCallback) {
|
listSessions(asyncCallback) {
|
||||||
this._proxy.ListSessionsRemote(function(result, error) {
|
this._proxy.ListSessionsRemote(function(result, error) {
|
||||||
if (error)
|
if (error)
|
||||||
asyncCallback([]);
|
asyncCallback([]);
|
||||||
@ -159,11 +159,11 @@ var LoginManagerSystemd = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
suspend: function() {
|
suspend() {
|
||||||
this._proxy.SuspendRemote(true);
|
this._proxy.SuspendRemote(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
inhibit: function(reason, callback) {
|
inhibit(reason, callback) {
|
||||||
let inVariant = GLib.Variant.new('(ssss)',
|
let inVariant = GLib.Variant.new('(ssss)',
|
||||||
['sleep',
|
['sleep',
|
||||||
'GNOME Shell',
|
'GNOME Shell',
|
||||||
@ -183,7 +183,7 @@ var LoginManagerSystemd = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_prepareForSleep: function(proxy, sender, [aboutToSuspend]) {
|
_prepareForSleep(proxy, sender, [aboutToSuspend]) {
|
||||||
this.emit('prepare-for-sleep', aboutToSuspend);
|
this.emit('prepare-for-sleep', aboutToSuspend);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -192,26 +192,26 @@ Signals.addSignalMethods(LoginManagerSystemd.prototype);
|
|||||||
var LoginManagerDummy = new Lang.Class({
|
var LoginManagerDummy = new Lang.Class({
|
||||||
Name: 'LoginManagerDummy',
|
Name: 'LoginManagerDummy',
|
||||||
|
|
||||||
getCurrentSessionProxy: function(callback) {
|
getCurrentSessionProxy(callback) {
|
||||||
// we could return a DummySession object that fakes whatever callers
|
// we could return a DummySession object that fakes whatever callers
|
||||||
// expect (at the time of writing: connect() and connectSignal()
|
// expect (at the time of writing: connect() and connectSignal()
|
||||||
// methods), but just never calling the callback should be safer
|
// methods), but just never calling the callback should be safer
|
||||||
},
|
},
|
||||||
|
|
||||||
canSuspend: function(asyncCallback) {
|
canSuspend(asyncCallback) {
|
||||||
asyncCallback(false, false);
|
asyncCallback(false, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
listSessions: function(asyncCallback) {
|
listSessions(asyncCallback) {
|
||||||
asyncCallback([]);
|
asyncCallback([]);
|
||||||
},
|
},
|
||||||
|
|
||||||
suspend: function() {
|
suspend() {
|
||||||
this.emit('prepare-for-sleep', true);
|
this.emit('prepare-for-sleep', true);
|
||||||
this.emit('prepare-for-sleep', false);
|
this.emit('prepare-for-sleep', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
inhibit: function(reason, callback) {
|
inhibit(reason, callback) {
|
||||||
callback(null);
|
callback(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -133,7 +133,7 @@ const ModemCdmaProxy = Gio.DBusProxy.makeProxyWrapper(ModemCdmaInterface);
|
|||||||
var ModemGsm = new Lang.Class({
|
var ModemGsm = new Lang.Class({
|
||||||
Name: 'ModemGsm',
|
Name: 'ModemGsm',
|
||||||
|
|
||||||
_init: function(path) {
|
_init(path) {
|
||||||
this._proxy = new ModemGsmNetworkProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
|
this._proxy = new ModemGsmNetworkProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
|
||||||
|
|
||||||
this.signal_quality = 0;
|
this.signal_quality = 0;
|
||||||
@ -175,7 +175,7 @@ Signals.addSignalMethods(ModemGsm.prototype);
|
|||||||
var ModemCdma = new Lang.Class({
|
var ModemCdma = new Lang.Class({
|
||||||
Name: 'ModemCdma',
|
Name: 'ModemCdma',
|
||||||
|
|
||||||
_init: function(path) {
|
_init(path) {
|
||||||
this._proxy = new ModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
|
this._proxy = new ModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
|
||||||
|
|
||||||
this.signal_quality = 0;
|
this.signal_quality = 0;
|
||||||
@ -201,7 +201,7 @@ var ModemCdma = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_refreshServingSystem: function() {
|
_refreshServingSystem() {
|
||||||
this._proxy.GetServingSystemRemote(Lang.bind(this, function([result], err) {
|
this._proxy.GetServingSystemRemote(Lang.bind(this, function([result], err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
// it will return an error if the device is not connected
|
// it will return an error if the device is not connected
|
||||||
@ -247,7 +247,7 @@ const BroadbandModemCdmaProxy = Gio.DBusProxy.makeProxyWrapper(BroadbandModemCdm
|
|||||||
var BroadbandModem = new Lang.Class({
|
var BroadbandModem = new Lang.Class({
|
||||||
Name: 'BroadbandModem',
|
Name: 'BroadbandModem',
|
||||||
|
|
||||||
_init: function(path, capabilities) {
|
_init(path, capabilities) {
|
||||||
this._proxy = new BroadbandModemProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
|
this._proxy = new BroadbandModemProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
|
||||||
this._proxy_3gpp = new BroadbandModem3gppProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
|
this._proxy_3gpp = new BroadbandModem3gppProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
|
||||||
this._proxy_cdma = new BroadbandModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
|
this._proxy_cdma = new BroadbandModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager1', path);
|
||||||
@ -274,13 +274,13 @@ var BroadbandModem = new Lang.Class({
|
|||||||
this._reloadCdmaOperatorName();
|
this._reloadCdmaOperatorName();
|
||||||
},
|
},
|
||||||
|
|
||||||
_reloadSignalQuality: function() {
|
_reloadSignalQuality() {
|
||||||
let [quality, recent] = this._proxy.SignalQuality;
|
let [quality, recent] = this._proxy.SignalQuality;
|
||||||
this.signal_quality = quality;
|
this.signal_quality = quality;
|
||||||
this.emit('notify::signal-quality');
|
this.emit('notify::signal-quality');
|
||||||
},
|
},
|
||||||
|
|
||||||
_reloadOperatorName: function() {
|
_reloadOperatorName() {
|
||||||
let new_name = "";
|
let new_name = "";
|
||||||
if (this.operator_name_3gpp && this.operator_name_3gpp.length > 0)
|
if (this.operator_name_3gpp && this.operator_name_3gpp.length > 0)
|
||||||
new_name += this.operator_name_3gpp;
|
new_name += this.operator_name_3gpp;
|
||||||
@ -295,14 +295,14 @@ var BroadbandModem = new Lang.Class({
|
|||||||
this.emit('notify::operator-name');
|
this.emit('notify::operator-name');
|
||||||
},
|
},
|
||||||
|
|
||||||
_reload3gppOperatorName: function() {
|
_reload3gppOperatorName() {
|
||||||
let name = this._proxy_3gpp.OperatorName;
|
let name = this._proxy_3gpp.OperatorName;
|
||||||
let code = this._proxy_3gpp.OperatorCode;
|
let code = this._proxy_3gpp.OperatorCode;
|
||||||
this.operator_name_3gpp = _findProviderForMccMnc(name, code);
|
this.operator_name_3gpp = _findProviderForMccMnc(name, code);
|
||||||
this._reloadOperatorName();
|
this._reloadOperatorName();
|
||||||
},
|
},
|
||||||
|
|
||||||
_reloadCdmaOperatorName: function() {
|
_reloadCdmaOperatorName() {
|
||||||
let sid = this._proxy_cdma.Sid;
|
let sid = this._proxy_cdma.Sid;
|
||||||
this.operator_name_cdma = _findProviderForSid(sid);
|
this.operator_name_cdma = _findProviderForSid(sid);
|
||||||
this._reloadOperatorName();
|
this._reloadOperatorName();
|
||||||
|
@ -28,7 +28,7 @@ const ObjectManagerInfo = Gio.DBusInterfaceInfo.new_for_xml(ObjectManagerIface);
|
|||||||
|
|
||||||
var ObjectManager = new Lang.Class({
|
var ObjectManager = new Lang.Class({
|
||||||
Name: 'ObjectManager',
|
Name: 'ObjectManager',
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
params = Params.parse(params, { connection: null,
|
params = Params.parse(params, { connection: null,
|
||||||
name: null,
|
name: null,
|
||||||
objectPath: null,
|
objectPath: null,
|
||||||
@ -64,7 +64,7 @@ var ObjectManager = new Lang.Class({
|
|||||||
Lang.bind(this, this._onManagerProxyLoaded));
|
Lang.bind(this, this._onManagerProxyLoaded));
|
||||||
},
|
},
|
||||||
|
|
||||||
_tryToCompleteLoad: function() {
|
_tryToCompleteLoad() {
|
||||||
if (this._numLoadInhibitors == 0)
|
if (this._numLoadInhibitors == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ var ObjectManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_addInterface: function(objectPath, interfaceName, onFinished) {
|
_addInterface(objectPath, interfaceName, onFinished) {
|
||||||
let info = this._interfaceInfos[interfaceName];
|
let info = this._interfaceInfos[interfaceName];
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
@ -130,7 +130,7 @@ var ObjectManager = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeInterface: function(objectPath, interfaceName) {
|
_removeInterface(objectPath, interfaceName) {
|
||||||
if (!this._objects[objectPath])
|
if (!this._objects[objectPath])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ var ObjectManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onManagerProxyLoaded: function(initable, result) {
|
_onManagerProxyLoaded(initable, result) {
|
||||||
let error = null;
|
let error = null;
|
||||||
try {
|
try {
|
||||||
initable.init_finish(result);
|
initable.init_finish(result);
|
||||||
@ -195,7 +195,7 @@ var ObjectManager = new Lang.Class({
|
|||||||
this._onNameAppeared();
|
this._onNameAppeared();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNameAppeared: function() {
|
_onNameAppeared() {
|
||||||
this._managerProxy.GetManagedObjectsRemote(Lang.bind(this, function(result, error) {
|
this._managerProxy.GetManagedObjectsRemote(Lang.bind(this, function(result, error) {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -233,7 +233,7 @@ var ObjectManager = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNameVanished: function() {
|
_onNameVanished() {
|
||||||
let objectPaths = Object.keys(this._objects);
|
let objectPaths = Object.keys(this._objects);
|
||||||
for (let i = 0; i < objectPaths.length; i++) {
|
for (let i = 0; i < objectPaths.length; i++) {
|
||||||
let object = this._objects[objectPaths];
|
let object = this._objects[objectPaths];
|
||||||
@ -248,14 +248,14 @@ var ObjectManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_registerInterfaces: function(interfaces) {
|
_registerInterfaces(interfaces) {
|
||||||
for (let i = 0; i < interfaces.length; i++) {
|
for (let i = 0; i < interfaces.length; i++) {
|
||||||
let info = Gio.DBusInterfaceInfo.new_for_xml(interfaces[i]);
|
let info = Gio.DBusInterfaceInfo.new_for_xml(interfaces[i]);
|
||||||
this._interfaceInfos[info.name] = info;
|
this._interfaceInfos[info.name] = info;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getProxy: function(objectPath, interfaceName) {
|
getProxy(objectPath, interfaceName) {
|
||||||
let object = this._objects[objectPath];
|
let object = this._objects[objectPath];
|
||||||
|
|
||||||
if (!object)
|
if (!object)
|
||||||
@ -264,7 +264,7 @@ var ObjectManager = new Lang.Class({
|
|||||||
return object[interfaceName];
|
return object[interfaceName];
|
||||||
},
|
},
|
||||||
|
|
||||||
getProxiesForInterface: function(interfaceName) {
|
getProxiesForInterface(interfaceName) {
|
||||||
let proxyList = this._interfaces[interfaceName];
|
let proxyList = this._interfaces[interfaceName];
|
||||||
|
|
||||||
if (!proxyList)
|
if (!proxyList)
|
||||||
@ -273,7 +273,7 @@ var ObjectManager = new Lang.Class({
|
|||||||
return proxyList;
|
return proxyList;
|
||||||
},
|
},
|
||||||
|
|
||||||
getAllProxies: function() {
|
getAllProxies() {
|
||||||
let proxies = [];
|
let proxies = [];
|
||||||
|
|
||||||
let objectPaths = Object.keys(this._objects);
|
let objectPaths = Object.keys(this._objects);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// parse:
|
// parse:
|
||||||
// @params: caller-provided parameter object, or %null
|
// @params: caller-provided parameter object, or %null
|
||||||
// @defaults: function-provided defaults object
|
// @defaults-provided defaults object
|
||||||
// @allowExtras: whether or not to allow properties not in @default
|
// @allowExtras: whether or not to allow properties not in @default
|
||||||
//
|
//
|
||||||
// Examines @params and fills in default values from @defaults for
|
// Examines @params and fills in default values from @defaults for
|
||||||
|
@ -27,7 +27,7 @@ function getSmartcardManager() {
|
|||||||
|
|
||||||
var SmartcardManager = new Lang.Class({
|
var SmartcardManager = new Lang.Class({
|
||||||
Name: 'SmartcardManager',
|
Name: 'SmartcardManager',
|
||||||
_init: function() {
|
_init() {
|
||||||
this._objectManager = new ObjectManager.ObjectManager({ connection: Gio.DBus.session,
|
this._objectManager = new ObjectManager.ObjectManager({ connection: Gio.DBus.session,
|
||||||
name: "org.gnome.SettingsDaemon.Smartcard",
|
name: "org.gnome.SettingsDaemon.Smartcard",
|
||||||
objectPath: '/org/gnome/SettingsDaemon/Smartcard',
|
objectPath: '/org/gnome/SettingsDaemon/Smartcard',
|
||||||
@ -37,7 +37,7 @@ var SmartcardManager = new Lang.Class({
|
|||||||
this._loginToken = null;
|
this._loginToken = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLoaded: function() {
|
_onLoaded() {
|
||||||
let tokens = this._objectManager.getProxiesForInterface('org.gnome.SettingsDaemon.Smartcard.Token');
|
let tokens = this._objectManager.getProxiesForInterface('org.gnome.SettingsDaemon.Smartcard.Token');
|
||||||
|
|
||||||
for (let i = 0; i < tokens.length; i++)
|
for (let i = 0; i < tokens.length; i++)
|
||||||
@ -54,7 +54,7 @@ var SmartcardManager = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateToken: function(token) {
|
_updateToken(token) {
|
||||||
let objectPath = token.get_object_path();
|
let objectPath = token.get_object_path();
|
||||||
|
|
||||||
delete this._insertedTokens[objectPath];
|
delete this._insertedTokens[objectPath];
|
||||||
@ -66,7 +66,7 @@ var SmartcardManager = new Lang.Class({
|
|||||||
this._loginToken = token;
|
this._loginToken = token;
|
||||||
},
|
},
|
||||||
|
|
||||||
_addToken: function(token) {
|
_addToken(token) {
|
||||||
this._updateToken(token);
|
this._updateToken(token);
|
||||||
|
|
||||||
token.connect('g-properties-changed',
|
token.connect('g-properties-changed',
|
||||||
@ -87,7 +87,7 @@ var SmartcardManager = new Lang.Class({
|
|||||||
this.emit('smartcard-inserted', token);
|
this.emit('smartcard-inserted', token);
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeToken: function(token) {
|
_removeToken(token) {
|
||||||
let objectPath = token.get_object_path();
|
let objectPath = token.get_object_path();
|
||||||
|
|
||||||
if (this._insertedTokens[objectPath] == token) {
|
if (this._insertedTokens[objectPath] == token) {
|
||||||
@ -101,11 +101,11 @@ var SmartcardManager = new Lang.Class({
|
|||||||
token.disconnectAll();
|
token.disconnectAll();
|
||||||
},
|
},
|
||||||
|
|
||||||
hasInsertedTokens: function() {
|
hasInsertedTokens() {
|
||||||
return Object.keys(this._insertedTokens).length > 0;
|
return Object.keys(this._insertedTokens).length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
hasInsertedLoginToken: function() {
|
hasInsertedLoginToken() {
|
||||||
if (!this._loginToken)
|
if (!this._loginToken)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ const SystemActions = new Lang.Class({
|
|||||||
null)
|
null)
|
||||||
},
|
},
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._canHavePowerOff = true;
|
this._canHavePowerOff = true;
|
||||||
@ -218,7 +218,7 @@ const SystemActions = new Lang.Class({
|
|||||||
return this._actions.get(LOCK_ORIENTATION_ACTION_ID).iconName;
|
return this._actions.get(LOCK_ORIENTATION_ACTION_ID).iconName;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sensorProxyAppeared: function() {
|
_sensorProxyAppeared() {
|
||||||
this._sensorProxy = new SensorProxy(Gio.DBus.system, SENSOR_BUS_NAME, SENSOR_OBJECT_PATH,
|
this._sensorProxy = new SensorProxy(Gio.DBus.system, SENSOR_BUS_NAME, SENSOR_OBJECT_PATH,
|
||||||
(proxy, error) => {
|
(proxy, error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -231,7 +231,7 @@ const SystemActions = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateOrientationLock: function() {
|
_updateOrientationLock() {
|
||||||
let available = false;
|
let available = false;
|
||||||
if (this._sensorProxy)
|
if (this._sensorProxy)
|
||||||
available = this._sensorProxy.HasAccelerometer &&
|
available = this._sensorProxy.HasAccelerometer &&
|
||||||
@ -242,7 +242,7 @@ const SystemActions = new Lang.Class({
|
|||||||
this.notify('can-lock-orientation');
|
this.notify('can-lock-orientation');
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateOrientationLockIcon: function() {
|
_updateOrientationLockIcon() {
|
||||||
let locked = this._orientationSettings.get_boolean('orientation-lock');
|
let locked = this._orientationSettings.get_boolean('orientation-lock');
|
||||||
let iconName = locked ? 'rotation-locked-symbolic'
|
let iconName = locked ? 'rotation-locked-symbolic'
|
||||||
: 'rotation-allowed-symbolic';
|
: 'rotation-allowed-symbolic';
|
||||||
@ -251,14 +251,14 @@ const SystemActions = new Lang.Class({
|
|||||||
this.notify('orientation-lock-icon');
|
this.notify('orientation-lock-icon');
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
this._updateLockScreen();
|
this._updateLockScreen();
|
||||||
this._updatePowerOff();
|
this._updatePowerOff();
|
||||||
this._updateSuspend();
|
this._updateSuspend();
|
||||||
this._updateMultiUser();
|
this._updateMultiUser();
|
||||||
},
|
},
|
||||||
|
|
||||||
forceUpdate: function() {
|
forceUpdate() {
|
||||||
// Whether those actions are available or not depends on both lockdown
|
// Whether those actions are available or not depends on both lockdown
|
||||||
// settings and Polkit policy - we don't get change notifications for the
|
// settings and Polkit policy - we don't get change notifications for the
|
||||||
// latter, so their value may be outdated; force an update now
|
// latter, so their value may be outdated; force an update now
|
||||||
@ -266,7 +266,7 @@ const SystemActions = new Lang.Class({
|
|||||||
this._updateHaveSuspend();
|
this._updateHaveSuspend();
|
||||||
},
|
},
|
||||||
|
|
||||||
getMatchingActions: function(terms) {
|
getMatchingActions(terms) {
|
||||||
// terms is a list of strings
|
// terms is a list of strings
|
||||||
terms = terms.map((term) => { return term.toLowerCase(); });
|
terms = terms.map((term) => { return term.toLowerCase(); });
|
||||||
|
|
||||||
@ -279,15 +279,15 @@ const SystemActions = new Lang.Class({
|
|||||||
return results;
|
return results;
|
||||||
},
|
},
|
||||||
|
|
||||||
getName: function(id) {
|
getName(id) {
|
||||||
return this._actions.get(id).name;
|
return this._actions.get(id).name;
|
||||||
},
|
},
|
||||||
|
|
||||||
getIconName: function(id) {
|
getIconName(id) {
|
||||||
return this._actions.get(id).iconName;
|
return this._actions.get(id).iconName;
|
||||||
},
|
},
|
||||||
|
|
||||||
activateAction: function(id) {
|
activateAction(id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case POWER_OFF_ACTION_ID:
|
case POWER_OFF_ACTION_ID:
|
||||||
this.activatePowerOff();
|
this.activatePowerOff();
|
||||||
@ -317,7 +317,7 @@ const SystemActions = new Lang.Class({
|
|||||||
this.notify('can-lock-screen');
|
this.notify('can-lock-screen');
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateHaveShutdown: function() {
|
_updateHaveShutdown() {
|
||||||
this._session.CanShutdownRemote((result, error) => {
|
this._session.CanShutdownRemote((result, error) => {
|
||||||
if (error)
|
if (error)
|
||||||
return;
|
return;
|
||||||
@ -327,7 +327,7 @@ const SystemActions = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePowerOff: function() {
|
_updatePowerOff() {
|
||||||
let disabled = Main.sessionMode.isLocked ||
|
let disabled = Main.sessionMode.isLocked ||
|
||||||
(Main.sessionMode.isGreeter &&
|
(Main.sessionMode.isGreeter &&
|
||||||
this._loginScreenSettings.get_boolean(DISABLE_RESTART_KEY));
|
this._loginScreenSettings.get_boolean(DISABLE_RESTART_KEY));
|
||||||
@ -335,7 +335,7 @@ const SystemActions = new Lang.Class({
|
|||||||
this.notify('can-power-off');
|
this.notify('can-power-off');
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateHaveSuspend: function() {
|
_updateHaveSuspend() {
|
||||||
this._loginManager.canSuspend(
|
this._loginManager.canSuspend(
|
||||||
(canSuspend, needsAuth) => {
|
(canSuspend, needsAuth) => {
|
||||||
this._canHaveSuspend = canSuspend;
|
this._canHaveSuspend = canSuspend;
|
||||||
@ -344,7 +344,7 @@ const SystemActions = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSuspend: function() {
|
_updateSuspend() {
|
||||||
let disabled = (Main.sessionMode.isLocked &&
|
let disabled = (Main.sessionMode.isLocked &&
|
||||||
this._suspendNeedsAuth) ||
|
this._suspendNeedsAuth) ||
|
||||||
(Main.sessionMode.isGreeter &&
|
(Main.sessionMode.isGreeter &&
|
||||||
@ -353,12 +353,12 @@ const SystemActions = new Lang.Class({
|
|||||||
this.notify('can-suspend');
|
this.notify('can-suspend');
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateMultiUser: function() {
|
_updateMultiUser() {
|
||||||
this._updateLogout();
|
this._updateLogout();
|
||||||
this._updateSwitchUser();
|
this._updateSwitchUser();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSwitchUser: function() {
|
_updateSwitchUser() {
|
||||||
let allowSwitch = !this._lockdownSettings.get_boolean(DISABLE_USER_SWITCH_KEY);
|
let allowSwitch = !this._lockdownSettings.get_boolean(DISABLE_USER_SWITCH_KEY);
|
||||||
let multiUser = this._userManager.can_switch() && this._userManager.has_multiple_users;
|
let multiUser = this._userManager.can_switch() && this._userManager.has_multiple_users;
|
||||||
let shouldShowInMode = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
let shouldShowInMode = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
||||||
@ -370,7 +370,7 @@ const SystemActions = new Lang.Class({
|
|||||||
return visible;
|
return visible;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLogout: function() {
|
_updateLogout() {
|
||||||
let user = this._userManager.get_user(GLib.get_user_name());
|
let user = this._userManager.get_user(GLib.get_user_name());
|
||||||
|
|
||||||
let allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY);
|
let allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY);
|
||||||
@ -388,7 +388,7 @@ const SystemActions = new Lang.Class({
|
|||||||
return visible;
|
return visible;
|
||||||
},
|
},
|
||||||
|
|
||||||
activateLockOrientation: function() {
|
activateLockOrientation() {
|
||||||
if (!this._actions.get(LOCK_ORIENTATION_ACTION_ID).available)
|
if (!this._actions.get(LOCK_ORIENTATION_ACTION_ID).available)
|
||||||
throw new Error('The lock-orientation action is not available!');
|
throw new Error('The lock-orientation action is not available!');
|
||||||
|
|
||||||
@ -396,14 +396,14 @@ const SystemActions = new Lang.Class({
|
|||||||
this._orientationSettings.set_boolean('orientation-lock', !locked);
|
this._orientationSettings.set_boolean('orientation-lock', !locked);
|
||||||
},
|
},
|
||||||
|
|
||||||
activateLockScreen: function() {
|
activateLockScreen() {
|
||||||
if (!this._actions.get(LOCK_SCREEN_ACTION_ID).available)
|
if (!this._actions.get(LOCK_SCREEN_ACTION_ID).available)
|
||||||
throw new Error('The lock-screen action is not available!');
|
throw new Error('The lock-screen action is not available!');
|
||||||
|
|
||||||
Main.screenShield.lock(true);
|
Main.screenShield.lock(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
activateSwitchUser: function() {
|
activateSwitchUser() {
|
||||||
if (!this._actions.get(SWITCH_USER_ACTION_ID).available)
|
if (!this._actions.get(SWITCH_USER_ACTION_ID).available)
|
||||||
throw new Error('The switch-user action is not available!');
|
throw new Error('The switch-user action is not available!');
|
||||||
|
|
||||||
@ -416,7 +416,7 @@ const SystemActions = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
activateLogout: function() {
|
activateLogout() {
|
||||||
if (!this._actions.get(LOGOUT_ACTION_ID).available)
|
if (!this._actions.get(LOGOUT_ACTION_ID).available)
|
||||||
throw new Error('The logout action is not available!');
|
throw new Error('The logout action is not available!');
|
||||||
|
|
||||||
@ -424,14 +424,14 @@ const SystemActions = new Lang.Class({
|
|||||||
this._session.LogoutRemote(0);
|
this._session.LogoutRemote(0);
|
||||||
},
|
},
|
||||||
|
|
||||||
activatePowerOff: function() {
|
activatePowerOff() {
|
||||||
if (!this._actions.get(POWER_OFF_ACTION_ID).available)
|
if (!this._actions.get(POWER_OFF_ACTION_ID).available)
|
||||||
throw new Error('The power-off action is not available!');
|
throw new Error('The power-off action is not available!');
|
||||||
|
|
||||||
this._session.ShutdownRemote(0);
|
this._session.ShutdownRemote(0);
|
||||||
},
|
},
|
||||||
|
|
||||||
activateSuspend: function() {
|
activateSuspend() {
|
||||||
if (!this._actions.get(SUSPEND_ACTION_ID).available)
|
if (!this._actions.get(SUSPEND_ACTION_ID).available)
|
||||||
throw new Error('The suspend action is not available!');
|
throw new Error('The suspend action is not available!');
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ var CloseButton = new Lang.Class({
|
|||||||
Name: 'CloseButton',
|
Name: 'CloseButton',
|
||||||
Extends: St.Button,
|
Extends: St.Button,
|
||||||
|
|
||||||
_init: function(boxpointer) {
|
_init(boxpointer) {
|
||||||
this.parent({ style_class: 'notification-close'});
|
this.parent({ style_class: 'notification-close'});
|
||||||
|
|
||||||
// This is a bit tricky. St.Bin has its own x-align/y-align properties
|
// This is a bit tricky. St.Bin has its own x-align/y-align properties
|
||||||
@ -374,7 +374,7 @@ var CloseButton = new Lang.Class({
|
|||||||
this._boxPointer.connect('arrow-side-changed', Lang.bind(this, this._sync));
|
this._boxPointer.connect('arrow-side-changed', Lang.bind(this, this._sync));
|
||||||
},
|
},
|
||||||
|
|
||||||
_computeBoxPointerOffset: function() {
|
_computeBoxPointerOffset() {
|
||||||
if (!this._boxPointer || !this._boxPointer.actor.get_stage())
|
if (!this._boxPointer || !this._boxPointer.actor.get_stage())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ var CloseButton = new Lang.Class({
|
|||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let themeNode = this.get_theme_node();
|
let themeNode = this.get_theme_node();
|
||||||
|
|
||||||
let offY = this._computeBoxPointerOffset();
|
let offY = this._computeBoxPointerOffset();
|
||||||
@ -393,7 +393,7 @@ var CloseButton = new Lang.Class({
|
|||||||
this.translation_y = themeNode.get_length('-shell-close-overlap-y') + offY;
|
this.translation_y = themeNode.get_length('-shell-close-overlap-y') + offY;
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_style_changed: function() {
|
vfunc_style_changed() {
|
||||||
this._sync();
|
this._sync();
|
||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
@ -442,7 +442,7 @@ function ensureActorVisibleInScrollView(scrollView, actor) {
|
|||||||
var AppSettingsMonitor = new Lang.Class({
|
var AppSettingsMonitor = new Lang.Class({
|
||||||
Name: 'AppSettingsMonitor',
|
Name: 'AppSettingsMonitor',
|
||||||
|
|
||||||
_init: function(appId, schemaId) {
|
_init(appId, schemaId) {
|
||||||
this._appId = appId;
|
this._appId = appId;
|
||||||
this._schemaId = schemaId;
|
this._schemaId = schemaId;
|
||||||
|
|
||||||
@ -462,19 +462,19 @@ var AppSettingsMonitor = new Lang.Class({
|
|||||||
return this._app != null && this._settings != null;
|
return this._app != null && this._settings != null;
|
||||||
},
|
},
|
||||||
|
|
||||||
activateApp: function() {
|
activateApp() {
|
||||||
if (this._app)
|
if (this._app)
|
||||||
this._app.activate();
|
this._app.activate();
|
||||||
},
|
},
|
||||||
|
|
||||||
watchSetting: function(key, callback) {
|
watchSetting(key, callback) {
|
||||||
let handler = { id: 0, key: key, callback: callback };
|
let handler = { id: 0, key: key, callback: callback };
|
||||||
this._handlers.push(handler);
|
this._handlers.push(handler);
|
||||||
|
|
||||||
this._connectHandler(handler);
|
this._connectHandler(handler);
|
||||||
},
|
},
|
||||||
|
|
||||||
_connectHandler: function(handler) {
|
_connectHandler(handler) {
|
||||||
if (!this._settings || handler.id > 0)
|
if (!this._settings || handler.id > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -483,13 +483,13 @@ var AppSettingsMonitor = new Lang.Class({
|
|||||||
handler.callback(this._settings, handler.key);
|
handler.callback(this._settings, handler.key);
|
||||||
},
|
},
|
||||||
|
|
||||||
_disconnectHandler: function(handler) {
|
_disconnectHandler(handler) {
|
||||||
if (this._settings && handler.id > 0)
|
if (this._settings && handler.id > 0)
|
||||||
this._settings.disconnect(handler.id);
|
this._settings.disconnect(handler.id);
|
||||||
handler.id = 0;
|
handler.id = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onInstalledChanged: function() {
|
_onInstalledChanged() {
|
||||||
let hadApp = (this._app != null);
|
let hadApp = (this._app != null);
|
||||||
this._app = this._appSystem.lookup_app(this._appId);
|
this._app = this._appSystem.lookup_app(this._appId);
|
||||||
let haveApp = (this._app != null);
|
let haveApp = (this._app != null);
|
||||||
@ -503,7 +503,7 @@ var AppSettingsMonitor = new Lang.Class({
|
|||||||
this._setSettings(null);
|
this._setSettings(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setSettings: function(settings) {
|
_setSettings(settings) {
|
||||||
this._handlers.forEach((handler) => { this._disconnectHandler(handler); });
|
this._handlers.forEach((handler) => { this._disconnectHandler(handler); });
|
||||||
|
|
||||||
let hadSettings = (this._settings != null);
|
let hadSettings = (this._settings != null);
|
||||||
@ -516,7 +516,7 @@ var AppSettingsMonitor = new Lang.Class({
|
|||||||
this.emit('available-changed');
|
this.emit('available-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkSettings: function() {
|
_checkSettings() {
|
||||||
let schema = this._schemaSource.lookup(this._schemaId, true);
|
let schema = this._schemaSource.lookup(this._schemaId, true);
|
||||||
if (schema) {
|
if (schema) {
|
||||||
this._setSettings(new Gio.Settings({ settings_schema: schema }));
|
this._setSettings(new Gio.Settings({ settings_schema: schema }));
|
||||||
|
@ -16,7 +16,7 @@ var UPDATE_THRESHOLD = 10 * GLib.TIME_SPAN_MINUTE;
|
|||||||
var WeatherClient = new Lang.Class({
|
var WeatherClient = new Lang.Class({
|
||||||
Name: 'WeatherClient',
|
Name: 'WeatherClient',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._loading = false;
|
this._loading = false;
|
||||||
this._locationValid = false;
|
this._locationValid = false;
|
||||||
this._lastUpdate = GLib.DateTime.new_from_unix_local(0);
|
this._lastUpdate = GLib.DateTime.new_from_unix_local(0);
|
||||||
@ -89,11 +89,11 @@ var WeatherClient = new Lang.Class({
|
|||||||
return this._weatherInfo;
|
return this._weatherInfo;
|
||||||
},
|
},
|
||||||
|
|
||||||
activateApp: function() {
|
activateApp() {
|
||||||
this._weatherAppMon.activateApp();
|
this._weatherAppMon.activateApp();
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function() {
|
update() {
|
||||||
if (!this._locationValid)
|
if (!this._locationValid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ var WeatherClient = new Lang.Class({
|
|||||||
this._weatherAuthorized;
|
this._weatherAuthorized;
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadInfo: function() {
|
_loadInfo() {
|
||||||
let id = this._weatherInfo.connect('updated', () => {
|
let id = this._weatherInfo.connect('updated', () => {
|
||||||
this._weatherInfo.disconnect(id);
|
this._weatherInfo.disconnect(id);
|
||||||
this._loading = false;
|
this._loading = false;
|
||||||
@ -124,7 +124,7 @@ var WeatherClient = new Lang.Class({
|
|||||||
this._weatherInfo.update();
|
this._weatherInfo.update();
|
||||||
},
|
},
|
||||||
|
|
||||||
_locationsEqual: function(loc1, loc2) {
|
_locationsEqual(loc1, loc2) {
|
||||||
if (loc1 == loc2)
|
if (loc1 == loc2)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ var WeatherClient = new Lang.Class({
|
|||||||
return loc1.equal(loc2);
|
return loc1.equal(loc2);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setLocation: function(location) {
|
_setLocation(location) {
|
||||||
if (this._locationsEqual(this._weatherInfo.location, location))
|
if (this._locationsEqual(this._weatherInfo.location, location))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ var WeatherClient = new Lang.Class({
|
|||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLocationMonitoring: function() {
|
_updateLocationMonitoring() {
|
||||||
if (this._useAutoLocation) {
|
if (this._useAutoLocation) {
|
||||||
if (this._gclueLocationChangedId != 0 || this._gclueService == null)
|
if (this._gclueLocationChangedId != 0 || this._gclueService == null)
|
||||||
return;
|
return;
|
||||||
@ -166,7 +166,7 @@ var WeatherClient = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_startGClueService: function() {
|
_startGClueService() {
|
||||||
if (this._gclueStarting)
|
if (this._gclueStarting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ var WeatherClient = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_onGClueLocationChanged: function() {
|
_onGClueLocationChanged() {
|
||||||
let geoLocation = this._gclueService.location;
|
let geoLocation = this._gclueService.location;
|
||||||
let location = GWeather.Location.new_detached(geoLocation.description,
|
let location = GWeather.Location.new_detached(geoLocation.description,
|
||||||
null,
|
null,
|
||||||
@ -196,7 +196,7 @@ var WeatherClient = new Lang.Class({
|
|||||||
this._setLocation(location);
|
this._setLocation(location);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAutomaticLocationChanged: function(settings, key) {
|
_onAutomaticLocationChanged(settings, key) {
|
||||||
let useAutoLocation = settings.get_boolean(key);
|
let useAutoLocation = settings.get_boolean(key);
|
||||||
if (this._autoLocationRequested == useAutoLocation)
|
if (this._autoLocationRequested == useAutoLocation)
|
||||||
return;
|
return;
|
||||||
@ -206,7 +206,7 @@ var WeatherClient = new Lang.Class({
|
|||||||
this._updateAutoLocation();
|
this._updateAutoLocation();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateAutoLocation: function() {
|
_updateAutoLocation() {
|
||||||
this._updateLocationMonitoring();
|
this._updateLocationMonitoring();
|
||||||
|
|
||||||
if (this._useAutoLocation)
|
if (this._useAutoLocation)
|
||||||
@ -215,7 +215,7 @@ var WeatherClient = new Lang.Class({
|
|||||||
this._setLocation(this._mostRecentLocation);
|
this._setLocation(this._mostRecentLocation);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLocationsChanged: function(settings, key) {
|
_onLocationsChanged(settings, key) {
|
||||||
let serialized = settings.get_value(key).deep_unpack().shift();
|
let serialized = settings.get_value(key).deep_unpack().shift();
|
||||||
let mostRecentLocation = null;
|
let mostRecentLocation = null;
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ var WeatherClient = new Lang.Class({
|
|||||||
this._setLocation(this._mostRecentLocation);
|
this._setLocation(this._mostRecentLocation);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPermStoreChanged: function(proxy, sender, params) {
|
_onPermStoreChanged(proxy, sender, params) {
|
||||||
let [table, id, deleted, data, perms] = params;
|
let [table, id, deleted, data, perms] = params;
|
||||||
|
|
||||||
if (table != 'gnome' || id != 'geolocation')
|
if (table != 'gnome' || id != 'geolocation')
|
||||||
|
@ -54,7 +54,7 @@ var PortalHeaderBar = new Lang.Class({
|
|||||||
Name: 'PortalHeaderBar',
|
Name: 'PortalHeaderBar',
|
||||||
Extends: Gtk.HeaderBar,
|
Extends: Gtk.HeaderBar,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent({ show_close_button: true });
|
this.parent({ show_close_button: true });
|
||||||
|
|
||||||
// See ephy-title-box.c in epiphany for the layout
|
// See ephy-title-box.c in epiphany for the layout
|
||||||
@ -92,11 +92,11 @@ var PortalHeaderBar = new Lang.Class({
|
|||||||
vbox.show_all();
|
vbox.show_all();
|
||||||
},
|
},
|
||||||
|
|
||||||
setSubtitle: function(label) {
|
setSubtitle(label) {
|
||||||
this.subtitleLabel.set_text(label);
|
this.subtitleLabel.set_text(label);
|
||||||
},
|
},
|
||||||
|
|
||||||
setSecurityIcon: function(securityLevel) {
|
setSecurityIcon(securityLevel) {
|
||||||
switch (securityLevel) {
|
switch (securityLevel) {
|
||||||
case PortalHelperSecurityLevel.NOT_YET_DETERMINED:
|
case PortalHelperSecurityLevel.NOT_YET_DETERMINED:
|
||||||
this._lockImage.hide();
|
this._lockImage.hide();
|
||||||
@ -119,7 +119,7 @@ var PortalWindow = new Lang.Class({
|
|||||||
Name: 'PortalWindow',
|
Name: 'PortalWindow',
|
||||||
Extends: Gtk.ApplicationWindow,
|
Extends: Gtk.ApplicationWindow,
|
||||||
|
|
||||||
_init: function(application, url, timestamp, doneCallback) {
|
_init(application, url, timestamp, doneCallback) {
|
||||||
this.parent({ application: application });
|
this.parent({ application: application });
|
||||||
|
|
||||||
this.connect('delete-event', Lang.bind(this, this.destroyWindow));
|
this.connect('delete-event', Lang.bind(this, this.destroyWindow));
|
||||||
@ -163,11 +163,11 @@ var PortalWindow = new Lang.Class({
|
|||||||
this.application.set_accels_for_action('app.quit', ['<Primary>q', '<Primary>w']);
|
this.application.set_accels_for_action('app.quit', ['<Primary>q', '<Primary>w']);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyWindow: function() {
|
destroyWindow() {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncUri: function() {
|
_syncUri() {
|
||||||
let uri = this._webView.uri;
|
let uri = this._webView.uri;
|
||||||
if (uri)
|
if (uri)
|
||||||
this._headerBar.setSubtitle(GLib.uri_unescape_string(uri, null));
|
this._headerBar.setSubtitle(GLib.uri_unescape_string(uri, null));
|
||||||
@ -175,12 +175,12 @@ var PortalWindow = new Lang.Class({
|
|||||||
this._headerBar.setSubtitle('');
|
this._headerBar.setSubtitle('');
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function() {
|
refresh() {
|
||||||
this._everSeenRedirect = false;
|
this._everSeenRedirect = false;
|
||||||
this._webView.load_uri(this._originalUrl);
|
this._webView.load_uri(this._originalUrl);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_delete_event: function(event) {
|
vfunc_delete_event(event) {
|
||||||
if (this._recheckAtExit)
|
if (this._recheckAtExit)
|
||||||
this._doneCallback(PortalHelperResult.RECHECK);
|
this._doneCallback(PortalHelperResult.RECHECK);
|
||||||
else
|
else
|
||||||
@ -188,7 +188,7 @@ var PortalWindow = new Lang.Class({
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLoadChanged: function(view, loadEvent) {
|
_onLoadChanged(view, loadEvent) {
|
||||||
if (loadEvent == WebKit.LoadEvent.STARTED) {
|
if (loadEvent == WebKit.LoadEvent.STARTED) {
|
||||||
this._headerBar.setSecurityIcon(PortalHelperSecurityLevel.NOT_YET_DETERMINED);
|
this._headerBar.setSecurityIcon(PortalHelperSecurityLevel.NOT_YET_DETERMINED);
|
||||||
} else if (loadEvent == WebKit.LoadEvent.COMMITTED) {
|
} else if (loadEvent == WebKit.LoadEvent.COMMITTED) {
|
||||||
@ -202,11 +202,11 @@ var PortalWindow = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onInsecureContentDetected: function () {
|
_onInsecureContentDetected() {
|
||||||
this._headerBar.setSecurityIcon(PortalHelperSecurityLevel.INSECURE);
|
this._headerBar.setSecurityIcon(PortalHelperSecurityLevel.INSECURE);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLoadFailedWithTlsErrors: function (view, failingURI, certificate, errors) {
|
_onLoadFailedWithTlsErrors(view, failingURI, certificate, errors) {
|
||||||
this._headerBar.setSecurityIcon(PortalHelperSecurityLevel.INSECURE);
|
this._headerBar.setSecurityIcon(PortalHelperSecurityLevel.INSECURE);
|
||||||
let uri = new Soup.URI(failingURI);
|
let uri = new Soup.URI(failingURI);
|
||||||
this._webContext.allow_tls_certificate_for_host(certificate, uri.get_host());
|
this._webContext.allow_tls_certificate_for_host(certificate, uri.get_host());
|
||||||
@ -214,7 +214,7 @@ var PortalWindow = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDecidePolicy: function(view, decision, type) {
|
_onDecidePolicy(view, decision, type) {
|
||||||
if (type == WebKit.PolicyDecisionType.NEW_WINDOW_ACTION) {
|
if (type == WebKit.PolicyDecisionType.NEW_WINDOW_ACTION) {
|
||||||
let navigationAction = decision.get_navigation_action();
|
let navigationAction = decision.get_navigation_action();
|
||||||
if (navigationAction.is_user_gesture()) {
|
if (navigationAction.is_user_gesture()) {
|
||||||
@ -286,7 +286,7 @@ var WebPortalHelper = new Lang.Class({
|
|||||||
Name: 'WebPortalHelper',
|
Name: 'WebPortalHelper',
|
||||||
Extends: Gtk.Application,
|
Extends: Gtk.Application,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent({ application_id: 'org.gnome.Shell.PortalHelper',
|
this.parent({ application_id: 'org.gnome.Shell.PortalHelper',
|
||||||
flags: Gio.ApplicationFlags.IS_SERVICE,
|
flags: Gio.ApplicationFlags.IS_SERVICE,
|
||||||
inactivity_timeout: 30000 });
|
inactivity_timeout: 30000 });
|
||||||
@ -299,30 +299,30 @@ var WebPortalHelper = new Lang.Class({
|
|||||||
this.add_action(action);
|
this.add_action(action);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_dbus_register: function(connection, path) {
|
vfunc_dbus_register(connection, path) {
|
||||||
this._dbusImpl.export(connection, path);
|
this._dbusImpl.export(connection, path);
|
||||||
this.parent(connection, path);
|
this.parent(connection, path);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_dbus_unregister: function(connection, path) {
|
vfunc_dbus_unregister(connection, path) {
|
||||||
this._dbusImpl.unexport_from_connection(connection);
|
this._dbusImpl.unexport_from_connection(connection);
|
||||||
this.parent(connection, path);
|
this.parent(connection, path);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_activate: function() {
|
vfunc_activate() {
|
||||||
// If launched manually (for example for testing), force a dummy authentication
|
// If launched manually (for example for testing), force a dummy authentication
|
||||||
// session with the default url
|
// session with the default url
|
||||||
this.Authenticate('/org/gnome/dummy', '', 0);
|
this.Authenticate('/org/gnome/dummy', '', 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
Authenticate: function(connection, url, timestamp) {
|
Authenticate(connection, url, timestamp) {
|
||||||
this._queue.push({ connection: connection, url: url, timestamp: timestamp });
|
this._queue.push({ connection: connection, url: url, timestamp: timestamp });
|
||||||
|
|
||||||
this._processQueue();
|
this._processQueue();
|
||||||
},
|
},
|
||||||
|
|
||||||
Close: function(connection) {
|
Close(connection) {
|
||||||
for (let i = 0; i < this._queue.length; i++) {
|
for (let i = 0; i < this._queue.length; i++) {
|
||||||
let obj = this._queue[i];
|
let obj = this._queue[i];
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ var WebPortalHelper = new Lang.Class({
|
|||||||
this._processQueue();
|
this._processQueue();
|
||||||
},
|
},
|
||||||
|
|
||||||
Refresh: function(connection) {
|
Refresh(connection) {
|
||||||
for (let i = 0; i < this._queue.length; i++) {
|
for (let i = 0; i < this._queue.length; i++) {
|
||||||
let obj = this._queue[i];
|
let obj = this._queue[i];
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ var WebPortalHelper = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_processQueue: function() {
|
_processQueue() {
|
||||||
if (this._queue.length == 0)
|
if (this._queue.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ var AccessDialog = new Lang.Class({
|
|||||||
Name: 'AccessDialog',
|
Name: 'AccessDialog',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function(invocation, handle, title, subtitle, body, options) {
|
_init(invocation, handle, title, subtitle, body, options) {
|
||||||
this.parent({ styleClass: 'access-dialog' });
|
this.parent({ styleClass: 'access-dialog' });
|
||||||
|
|
||||||
this._invocation = invocation;
|
this._invocation = invocation;
|
||||||
@ -57,7 +57,7 @@ var AccessDialog = new Lang.Class({
|
|||||||
this._buildLayout(title, subtitle, body, options);
|
this._buildLayout(title, subtitle, body, options);
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildLayout: function(title, subtitle, body, options) {
|
_buildLayout(title, subtitle, body, options) {
|
||||||
// No support for non-modal system dialogs, so ignore the option
|
// No support for non-modal system dialogs, so ignore the option
|
||||||
//let modal = options['modal'] || true;
|
//let modal = options['modal'] || true;
|
||||||
let denyLabel = options['deny_label'] || _("Deny Access");
|
let denyLabel = options['deny_label'] || _("Deny Access");
|
||||||
@ -97,14 +97,14 @@ var AccessDialog = new Lang.Class({
|
|||||||
}});
|
}});
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function() {
|
open() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
let connection = this._invocation.get_connection();
|
let connection = this._invocation.get_connection();
|
||||||
this._requestExported = this._request.export(connection, this._handle);
|
this._requestExported = this._request.export(connection, this._handle);
|
||||||
},
|
},
|
||||||
|
|
||||||
CloseAsync: function(invocation, params) {
|
CloseAsync(invocation, params) {
|
||||||
if (this._invocation.get_sender() != invocation.get_sender()) {
|
if (this._invocation.get_sender() != invocation.get_sender()) {
|
||||||
invocation.return_error_literal(Gio.DBusError,
|
invocation.return_error_literal(Gio.DBusError,
|
||||||
Gio.DBusError.ACCESS_DENIED,
|
Gio.DBusError.ACCESS_DENIED,
|
||||||
@ -115,7 +115,7 @@ var AccessDialog = new Lang.Class({
|
|||||||
this._sendResponse(DialogResponse.CLOSED);
|
this._sendResponse(DialogResponse.CLOSED);
|
||||||
},
|
},
|
||||||
|
|
||||||
_sendResponse: function(response) {
|
_sendResponse(response) {
|
||||||
if (this._requestExported)
|
if (this._requestExported)
|
||||||
this._request.unexport();
|
this._request.unexport();
|
||||||
this._requestExported = false;
|
this._requestExported = false;
|
||||||
@ -140,7 +140,7 @@ var AccessDialog = new Lang.Class({
|
|||||||
var AccessDialogDBus = new Lang.Class({
|
var AccessDialogDBus = new Lang.Class({
|
||||||
Name: 'AccessDialogDBus',
|
Name: 'AccessDialogDBus',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._accessDialog = null;
|
this._accessDialog = null;
|
||||||
|
|
||||||
this._windowTracker = Shell.WindowTracker.get_default();
|
this._windowTracker = Shell.WindowTracker.get_default();
|
||||||
@ -151,7 +151,7 @@ var AccessDialogDBus = new Lang.Class({
|
|||||||
Gio.DBus.session.own_name('org.freedesktop.impl.portal.desktop.gnome', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
Gio.DBus.session.own_name('org.freedesktop.impl.portal.desktop.gnome', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
AccessDialogAsync: function(params, invocation) {
|
AccessDialogAsync(params, invocation) {
|
||||||
if (this._accessDialog) {
|
if (this._accessDialog) {
|
||||||
invocation.return_error_literal(Gio.DBusError,
|
invocation.return_error_literal(Gio.DBusError,
|
||||||
Gio.DBusError.LIMITS_EXCEEDED,
|
Gio.DBusError.LIMITS_EXCEEDED,
|
||||||
|
124
js/ui/altTab.js
124
js/ui/altTab.js
@ -62,7 +62,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
Name: 'AppSwitcherPopup',
|
Name: 'AppSwitcherPopup',
|
||||||
Extends: SwitcherPopup.SwitcherPopup,
|
Extends: SwitcherPopup.SwitcherPopup,
|
||||||
|
|
||||||
_init : function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._thumbnails = null;
|
this._thumbnails = null;
|
||||||
@ -80,7 +80,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
this._items = this._switcherList.icons;
|
this._items = this._switcherList.icons;
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocate: function (actor, box, flags) {
|
_allocate(actor, box, flags) {
|
||||||
this.parent(actor, box, flags);
|
this.parent(actor, box, flags);
|
||||||
|
|
||||||
// Allocate the thumbnails
|
// Allocate the thumbnails
|
||||||
@ -118,7 +118,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_initialSelection: function(backward, binding) {
|
_initialSelection(backward, binding) {
|
||||||
if (binding == 'switch-group') {
|
if (binding == 'switch-group') {
|
||||||
if (backward) {
|
if (backward) {
|
||||||
this._select(0, this._items[0].cachedWindows.length - 1);
|
this._select(0, this._items[0].cachedWindows.length - 1);
|
||||||
@ -141,14 +141,14 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_nextWindow : function() {
|
_nextWindow() {
|
||||||
// We actually want the second window if we're in the unset state
|
// We actually want the second window if we're in the unset state
|
||||||
if (this._currentWindow == -1)
|
if (this._currentWindow == -1)
|
||||||
this._currentWindow = 0;
|
this._currentWindow = 0;
|
||||||
return SwitcherPopup.mod(this._currentWindow + 1,
|
return SwitcherPopup.mod(this._currentWindow + 1,
|
||||||
this._items[this._selectedIndex].cachedWindows.length);
|
this._items[this._selectedIndex].cachedWindows.length);
|
||||||
},
|
},
|
||||||
_previousWindow : function() {
|
_previousWindow() {
|
||||||
// Also assume second window here
|
// Also assume second window here
|
||||||
if (this._currentWindow == -1)
|
if (this._currentWindow == -1)
|
||||||
this._currentWindow = 1;
|
this._currentWindow = 1;
|
||||||
@ -156,7 +156,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
this._items[this._selectedIndex].cachedWindows.length);
|
this._items[this._selectedIndex].cachedWindows.length);
|
||||||
},
|
},
|
||||||
|
|
||||||
_closeAppWindow: function(appIndex, windowIndex) {
|
_closeAppWindow(appIndex, windowIndex) {
|
||||||
let appIcon = this._items[appIndex];
|
let appIcon = this._items[appIndex];
|
||||||
if (!appIcon)
|
if (!appIcon)
|
||||||
return;
|
return;
|
||||||
@ -168,7 +168,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
window.delete(global.get_current_time());
|
window.delete(global.get_current_time());
|
||||||
},
|
},
|
||||||
|
|
||||||
_quitApplication: function(appIndex) {
|
_quitApplication(appIndex) {
|
||||||
let appIcon = this._items[appIndex];
|
let appIcon = this._items[appIndex];
|
||||||
if (!appIcon)
|
if (!appIcon)
|
||||||
return;
|
return;
|
||||||
@ -176,7 +176,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
appIcon.app.request_quit();
|
appIcon.app.request_quit();
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyPressHandler: function(keysym, action) {
|
_keyPressHandler(keysym, action) {
|
||||||
if (action == Meta.KeyBindingAction.SWITCH_GROUP) {
|
if (action == Meta.KeyBindingAction.SWITCH_GROUP) {
|
||||||
if (!this._thumbnailsFocused)
|
if (!this._thumbnailsFocused)
|
||||||
this._select(this._selectedIndex, 0);
|
this._select(this._selectedIndex, 0);
|
||||||
@ -215,7 +215,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_scrollHandler: function(direction) {
|
_scrollHandler(direction) {
|
||||||
if (direction == Clutter.ScrollDirection.UP) {
|
if (direction == Clutter.ScrollDirection.UP) {
|
||||||
if (this._thumbnailsFocused) {
|
if (this._thumbnailsFocused) {
|
||||||
if (this._currentWindow == 0 || this._currentWindow == -1)
|
if (this._currentWindow == 0 || this._currentWindow == -1)
|
||||||
@ -245,7 +245,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_itemActivatedHandler: function(n) {
|
_itemActivatedHandler(n) {
|
||||||
// If the user clicks on the selected app, activate the
|
// If the user clicks on the selected app, activate the
|
||||||
// selected window; otherwise (eg, they click on an app while
|
// selected window; otherwise (eg, they click on an app while
|
||||||
// !mouseActive) activate the clicked-on app.
|
// !mouseActive) activate the clicked-on app.
|
||||||
@ -255,24 +255,24 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
this._select(n);
|
this._select(n);
|
||||||
},
|
},
|
||||||
|
|
||||||
_itemEnteredHandler: function(n) {
|
_itemEnteredHandler(n) {
|
||||||
this._select(n);
|
this._select(n);
|
||||||
},
|
},
|
||||||
|
|
||||||
_windowActivated : function(thumbnailList, n) {
|
_windowActivated(thumbnailList, n) {
|
||||||
let appIcon = this._items[this._selectedIndex];
|
let appIcon = this._items[this._selectedIndex];
|
||||||
Main.activateWindow(appIcon.cachedWindows[n]);
|
Main.activateWindow(appIcon.cachedWindows[n]);
|
||||||
this.destroy();
|
this.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
_windowEntered : function(thumbnailList, n) {
|
_windowEntered(thumbnailList, n) {
|
||||||
if (!this.mouseActive)
|
if (!this.mouseActive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._select(this._selectedIndex, n);
|
this._select(this._selectedIndex, n);
|
||||||
},
|
},
|
||||||
|
|
||||||
_windowRemoved : function(thumbnailList, n) {
|
_windowRemoved(thumbnailList, n) {
|
||||||
let appIcon = this._items[this._selectedIndex];
|
let appIcon = this._items[this._selectedIndex];
|
||||||
if (!appIcon)
|
if (!appIcon)
|
||||||
return;
|
return;
|
||||||
@ -283,7 +283,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_finish : function(timestamp) {
|
_finish(timestamp) {
|
||||||
let appIcon = this._items[this._selectedIndex];
|
let appIcon = this._items[this._selectedIndex];
|
||||||
if (this._currentWindow < 0)
|
if (this._currentWindow < 0)
|
||||||
appIcon.app.activate_window(appIcon.cachedWindows[0], timestamp);
|
appIcon.app.activate_window(appIcon.cachedWindows[0], timestamp);
|
||||||
@ -293,7 +293,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy : function() {
|
_onDestroy() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
if (this._thumbnails)
|
if (this._thumbnails)
|
||||||
@ -327,7 +327,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
* then @app will be highlighted, and @window outlined, and the
|
* then @app will be highlighted, and @window outlined, and the
|
||||||
* app list will have the keyboard focus.
|
* app list will have the keyboard focus.
|
||||||
*/
|
*/
|
||||||
_select : function(app, window, forceAppFocus) {
|
_select(app, window, forceAppFocus) {
|
||||||
if (app != this._selectedIndex || window == null) {
|
if (app != this._selectedIndex || window == null) {
|
||||||
if (this._thumbnails)
|
if (this._thumbnails)
|
||||||
this._destroyThumbnails();
|
this._destroyThumbnails();
|
||||||
@ -358,7 +358,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_timeoutPopupThumbnails: function() {
|
_timeoutPopupThumbnails() {
|
||||||
if (!this._thumbnails)
|
if (!this._thumbnails)
|
||||||
this._createThumbnails();
|
this._createThumbnails();
|
||||||
this._thumbnailTimeoutId = 0;
|
this._thumbnailTimeoutId = 0;
|
||||||
@ -366,7 +366,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_destroyThumbnails : function() {
|
_destroyThumbnails() {
|
||||||
let thumbnailsActor = this._thumbnails.actor;
|
let thumbnailsActor = this._thumbnails.actor;
|
||||||
Tweener.addTween(thumbnailsActor,
|
Tweener.addTween(thumbnailsActor,
|
||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
@ -382,7 +382,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
this._switcherList._items[this._selectedIndex].remove_accessible_state (Atk.StateType.EXPANDED);
|
this._switcherList._items[this._selectedIndex].remove_accessible_state (Atk.StateType.EXPANDED);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createThumbnails : function() {
|
_createThumbnails() {
|
||||||
this._thumbnails = new ThumbnailList (this._items[this._selectedIndex].cachedWindows);
|
this._thumbnails = new ThumbnailList (this._items[this._selectedIndex].cachedWindows);
|
||||||
this._thumbnails.connect('item-activated', Lang.bind(this, this._windowActivated));
|
this._thumbnails.connect('item-activated', Lang.bind(this, this._windowActivated));
|
||||||
this._thumbnails.connect('item-entered', Lang.bind(this, this._windowEntered));
|
this._thumbnails.connect('item-entered', Lang.bind(this, this._windowEntered));
|
||||||
@ -413,7 +413,7 @@ var AppSwitcherPopup = new Lang.Class({
|
|||||||
var CyclerHighlight = new Lang.Class({
|
var CyclerHighlight = new Lang.Class({
|
||||||
Name: 'CyclerHighlight',
|
Name: 'CyclerHighlight',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._window = null;
|
this._window = null;
|
||||||
|
|
||||||
this.actor = new St.Widget({ layout_manager: new Clutter.BinLayout() });
|
this.actor = new St.Widget({ layout_manager: new Clutter.BinLayout() });
|
||||||
@ -453,7 +453,7 @@ var CyclerHighlight = new Lang.Class({
|
|||||||
this._clone.source = windowActor;
|
this._clone.source = windowActor;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAllocationChanged: function() {
|
_onAllocationChanged() {
|
||||||
if (!this._window) {
|
if (!this._window) {
|
||||||
this._highlight.set_size(0, 0);
|
this._highlight.set_size(0, 0);
|
||||||
this._highlight.hide();
|
this._highlight.hide();
|
||||||
@ -466,7 +466,7 @@ var CyclerHighlight = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this.window = null;
|
this.window = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -476,7 +476,7 @@ var CyclerPopup = new Lang.Class({
|
|||||||
Extends: SwitcherPopup.SwitcherPopup,
|
Extends: SwitcherPopup.SwitcherPopup,
|
||||||
Abstract: true,
|
Abstract: true,
|
||||||
|
|
||||||
_init : function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._items = this._getWindows();
|
this._items = this._getWindows();
|
||||||
@ -491,15 +491,15 @@ var CyclerPopup = new Lang.Class({
|
|||||||
// expects instead of inheriting from SwitcherList
|
// expects instead of inheriting from SwitcherList
|
||||||
this._switcherList = { actor: new St.Widget(),
|
this._switcherList = { actor: new St.Widget(),
|
||||||
highlight: Lang.bind(this, this._highlightItem),
|
highlight: Lang.bind(this, this._highlightItem),
|
||||||
connect: function() {} };
|
connect() {} };
|
||||||
},
|
},
|
||||||
|
|
||||||
_highlightItem: function(index, justOutline) {
|
_highlightItem(index, justOutline) {
|
||||||
this._highlight.window = this._items[index];
|
this._highlight.window = this._items[index];
|
||||||
global.window_group.set_child_above_sibling(this._highlight.actor, null);
|
global.window_group.set_child_above_sibling(this._highlight.actor, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_finish: function() {
|
_finish() {
|
||||||
let window = this._items[this._selectedIndex];
|
let window = this._items[this._selectedIndex];
|
||||||
let ws = window.get_workspace();
|
let ws = window.get_workspace();
|
||||||
let activeWs = global.screen.get_active_workspace();
|
let activeWs = global.screen.get_active_workspace();
|
||||||
@ -524,7 +524,7 @@ var CyclerPopup = new Lang.Class({
|
|||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this._highlight.actor.destroy();
|
this._highlight.actor.destroy();
|
||||||
|
|
||||||
this.parent();
|
this.parent();
|
||||||
@ -536,12 +536,12 @@ var GroupCyclerPopup = new Lang.Class({
|
|||||||
Name: 'GroupCyclerPopup',
|
Name: 'GroupCyclerPopup',
|
||||||
Extends: CyclerPopup,
|
Extends: CyclerPopup,
|
||||||
|
|
||||||
_getWindows: function() {
|
_getWindows() {
|
||||||
let app = Shell.WindowTracker.get_default().focus_app;
|
let app = Shell.WindowTracker.get_default().focus_app;
|
||||||
return app ? app.get_windows() : [];
|
return app ? app.get_windows() : [];
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyPressHandler: function(keysym, action) {
|
_keyPressHandler(keysym, action) {
|
||||||
if (action == Meta.KeyBindingAction.CYCLE_GROUP)
|
if (action == Meta.KeyBindingAction.CYCLE_GROUP)
|
||||||
this._select(this._next());
|
this._select(this._next());
|
||||||
else if (action == Meta.KeyBindingAction.CYCLE_GROUP_BACKWARD)
|
else if (action == Meta.KeyBindingAction.CYCLE_GROUP_BACKWARD)
|
||||||
@ -557,7 +557,7 @@ var WindowSwitcherPopup = new Lang.Class({
|
|||||||
Name: 'WindowSwitcherPopup',
|
Name: 'WindowSwitcherPopup',
|
||||||
Extends: SwitcherPopup.SwitcherPopup,
|
Extends: SwitcherPopup.SwitcherPopup,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell.window-switcher' });
|
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell.window-switcher' });
|
||||||
|
|
||||||
@ -571,12 +571,12 @@ var WindowSwitcherPopup = new Lang.Class({
|
|||||||
this._items = this._switcherList.icons;
|
this._items = this._switcherList.icons;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getWindowList: function() {
|
_getWindowList() {
|
||||||
let workspace = this._settings.get_boolean('current-workspace-only') ? global.screen.get_active_workspace() : null;
|
let workspace = this._settings.get_boolean('current-workspace-only') ? global.screen.get_active_workspace() : null;
|
||||||
return getWindows(workspace);
|
return getWindows(workspace);
|
||||||
},
|
},
|
||||||
|
|
||||||
_closeWindow: function(windowIndex) {
|
_closeWindow(windowIndex) {
|
||||||
let windowIcon = this._items[windowIndex];
|
let windowIcon = this._items[windowIndex];
|
||||||
if (!windowIcon)
|
if (!windowIcon)
|
||||||
return;
|
return;
|
||||||
@ -584,7 +584,7 @@ var WindowSwitcherPopup = new Lang.Class({
|
|||||||
windowIcon.window.delete(global.get_current_time());
|
windowIcon.window.delete(global.get_current_time());
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyPressHandler: function(keysym, action) {
|
_keyPressHandler(keysym, action) {
|
||||||
if (action == Meta.KeyBindingAction.SWITCH_WINDOWS) {
|
if (action == Meta.KeyBindingAction.SWITCH_WINDOWS) {
|
||||||
this._select(this._next());
|
this._select(this._next());
|
||||||
} else if (action == Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD) {
|
} else if (action == Meta.KeyBindingAction.SWITCH_WINDOWS_BACKWARD) {
|
||||||
@ -603,7 +603,7 @@ var WindowSwitcherPopup = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_finish: function() {
|
_finish() {
|
||||||
Main.activateWindow(this._items[this._selectedIndex].window);
|
Main.activateWindow(this._items[this._selectedIndex].window);
|
||||||
|
|
||||||
this.parent();
|
this.parent();
|
||||||
@ -614,17 +614,17 @@ var WindowCyclerPopup = new Lang.Class({
|
|||||||
Name: 'WindowCyclerPopup',
|
Name: 'WindowCyclerPopup',
|
||||||
Extends: CyclerPopup,
|
Extends: CyclerPopup,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell.window-switcher' });
|
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell.window-switcher' });
|
||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getWindows: function() {
|
_getWindows() {
|
||||||
let workspace = this._settings.get_boolean('current-workspace-only') ? global.screen.get_active_workspace() : null;
|
let workspace = this._settings.get_boolean('current-workspace-only') ? global.screen.get_active_workspace() : null;
|
||||||
return getWindows(workspace);
|
return getWindows(workspace);
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyPressHandler: function(keysym, action) {
|
_keyPressHandler(keysym, action) {
|
||||||
if (action == Meta.KeyBindingAction.CYCLE_WINDOWS)
|
if (action == Meta.KeyBindingAction.CYCLE_WINDOWS)
|
||||||
this._select(this._next());
|
this._select(this._next());
|
||||||
else if (action == Meta.KeyBindingAction.CYCLE_WINDOWS_BACKWARD)
|
else if (action == Meta.KeyBindingAction.CYCLE_WINDOWS_BACKWARD)
|
||||||
@ -639,7 +639,7 @@ var WindowCyclerPopup = new Lang.Class({
|
|||||||
var AppIcon = new Lang.Class({
|
var AppIcon = new Lang.Class({
|
||||||
Name: 'AppIcon',
|
Name: 'AppIcon',
|
||||||
|
|
||||||
_init: function(app) {
|
_init(app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
|
this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
@ -651,7 +651,7 @@ var AppIcon = new Lang.Class({
|
|||||||
this.actor.add(this.label, { x_fill: false });
|
this.actor.add(this.label, { x_fill: false });
|
||||||
},
|
},
|
||||||
|
|
||||||
set_size: function(size) {
|
set_size(size) {
|
||||||
this.icon = this.app.create_icon_texture(size);
|
this.icon = this.app.create_icon_texture(size);
|
||||||
this._iconBin.child = this.icon;
|
this._iconBin.child = this.icon;
|
||||||
}
|
}
|
||||||
@ -661,7 +661,7 @@ var AppSwitcher = new Lang.Class({
|
|||||||
Name: 'AppSwitcher',
|
Name: 'AppSwitcher',
|
||||||
Extends: SwitcherPopup.SwitcherList,
|
Extends: SwitcherPopup.SwitcherList,
|
||||||
|
|
||||||
_init : function(apps, altTabPopup) {
|
_init(apps, altTabPopup) {
|
||||||
this.parent(true);
|
this.parent(true);
|
||||||
|
|
||||||
this.icons = [];
|
this.icons = [];
|
||||||
@ -693,7 +693,7 @@ var AppSwitcher = new Lang.Class({
|
|||||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
if (this._mouseTimeOutId != 0)
|
if (this._mouseTimeOutId != 0)
|
||||||
Mainloop.source_remove(this._mouseTimeOutId);
|
Mainloop.source_remove(this._mouseTimeOutId);
|
||||||
|
|
||||||
@ -702,7 +702,7 @@ var AppSwitcher = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_setIconSize: function() {
|
_setIconSize() {
|
||||||
let j = 0;
|
let j = 0;
|
||||||
while(this._items.length > 1 && this._items[j].style_class != 'item-box') {
|
while(this._items.length > 1 && this._items[j].style_class != 'item-box') {
|
||||||
j++;
|
j++;
|
||||||
@ -744,12 +744,12 @@ var AppSwitcher = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredHeight: function (actor, forWidth, alloc) {
|
_getPreferredHeight(actor, forWidth, alloc) {
|
||||||
this._setIconSize();
|
this._setIconSize();
|
||||||
this.parent(actor, forWidth, alloc);
|
this.parent(actor, forWidth, alloc);
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocate: function (actor, box, flags) {
|
_allocate(actor, box, flags) {
|
||||||
// Allocate the main list items
|
// Allocate the main list items
|
||||||
this.parent(actor, box, flags);
|
this.parent(actor, box, flags);
|
||||||
|
|
||||||
@ -770,7 +770,7 @@ var AppSwitcher = new Lang.Class({
|
|||||||
|
|
||||||
// We override SwitcherList's _onItemEnter method to delay
|
// We override SwitcherList's _onItemEnter method to delay
|
||||||
// activation when the thumbnail list is open
|
// activation when the thumbnail list is open
|
||||||
_onItemEnter: function (index) {
|
_onItemEnter(index) {
|
||||||
if (this._mouseTimeOutId != 0)
|
if (this._mouseTimeOutId != 0)
|
||||||
Mainloop.source_remove(this._mouseTimeOutId);
|
Mainloop.source_remove(this._mouseTimeOutId);
|
||||||
if (this._altTabPopup.thumbnailsVisible) {
|
if (this._altTabPopup.thumbnailsVisible) {
|
||||||
@ -785,7 +785,7 @@ var AppSwitcher = new Lang.Class({
|
|||||||
this._itemEntered(index);
|
this._itemEntered(index);
|
||||||
},
|
},
|
||||||
|
|
||||||
_enterItem: function(index) {
|
_enterItem(index) {
|
||||||
let [x, y, mask] = global.get_pointer();
|
let [x, y, mask] = global.get_pointer();
|
||||||
let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
|
let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
|
||||||
if (this._items[index].contains(pickedActor))
|
if (this._items[index].contains(pickedActor))
|
||||||
@ -799,7 +799,7 @@ var AppSwitcher = new Lang.Class({
|
|||||||
// in justOutline mode). Apps with multiple windows will normally
|
// in justOutline mode). Apps with multiple windows will normally
|
||||||
// show a dim arrow, but show a bright arrow when they are
|
// show a dim arrow, but show a bright arrow when they are
|
||||||
// highlighted.
|
// highlighted.
|
||||||
highlight : function(n, justOutline) {
|
highlight(n, justOutline) {
|
||||||
if (this.icons[this._curApp]) {
|
if (this.icons[this._curApp]) {
|
||||||
if (this.icons[this._curApp].cachedWindows.length == 1)
|
if (this.icons[this._curApp].cachedWindows.length == 1)
|
||||||
this._arrows[this._curApp].hide();
|
this._arrows[this._curApp].hide();
|
||||||
@ -818,7 +818,7 @@ var AppSwitcher = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_addIcon : function(appIcon) {
|
_addIcon(appIcon) {
|
||||||
this.icons.push(appIcon);
|
this.icons.push(appIcon);
|
||||||
let item = this.addItem(appIcon.actor, appIcon.label);
|
let item = this.addItem(appIcon.actor, appIcon.label);
|
||||||
|
|
||||||
@ -839,7 +839,7 @@ var AppSwitcher = new Lang.Class({
|
|||||||
item.add_accessible_state (Atk.StateType.EXPANDABLE);
|
item.add_accessible_state (Atk.StateType.EXPANDABLE);
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeIcon: function(app) {
|
_removeIcon(app) {
|
||||||
let index = this.icons.findIndex(icon => {
|
let index = this.icons.findIndex(icon => {
|
||||||
return icon.app == app;
|
return icon.app == app;
|
||||||
});
|
});
|
||||||
@ -855,7 +855,7 @@ var ThumbnailList = new Lang.Class({
|
|||||||
Name: 'ThumbnailList',
|
Name: 'ThumbnailList',
|
||||||
Extends: SwitcherPopup.SwitcherList,
|
Extends: SwitcherPopup.SwitcherList,
|
||||||
|
|
||||||
_init : function(windows) {
|
_init(windows) {
|
||||||
this.parent(false);
|
this.parent(false);
|
||||||
|
|
||||||
this._labels = new Array();
|
this._labels = new Array();
|
||||||
@ -891,7 +891,7 @@ var ThumbnailList = new Lang.Class({
|
|||||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
addClones : function (availHeight) {
|
addClones(availHeight) {
|
||||||
if (!this._thumbnailBins.length)
|
if (!this._thumbnailBins.length)
|
||||||
return;
|
return;
|
||||||
let totalPadding = this._items[0].get_theme_node().get_horizontal_padding() + this._items[0].get_theme_node().get_vertical_padding();
|
let totalPadding = this._items[0].get_theme_node().get_horizontal_padding() + this._items[0].get_theme_node().get_vertical_padding();
|
||||||
@ -922,7 +922,7 @@ var ThumbnailList = new Lang.Class({
|
|||||||
this._thumbnailBins = new Array();
|
this._thumbnailBins = new Array();
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeThumbnail: function(source, clone) {
|
_removeThumbnail(source, clone) {
|
||||||
let index = this._clones.indexOf(clone);
|
let index = this._clones.indexOf(clone);
|
||||||
if (index === -1)
|
if (index === -1)
|
||||||
return;
|
return;
|
||||||
@ -938,7 +938,7 @@ var ThumbnailList = new Lang.Class({
|
|||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this._clones.forEach(clone => {
|
this._clones.forEach(clone => {
|
||||||
if (clone.source)
|
if (clone.source)
|
||||||
clone.source.disconnect(clone._destroyId);
|
clone.source.disconnect(clone._destroyId);
|
||||||
@ -950,7 +950,7 @@ var ThumbnailList = new Lang.Class({
|
|||||||
var WindowIcon = new Lang.Class({
|
var WindowIcon = new Lang.Class({
|
||||||
Name: 'WindowIcon',
|
Name: 'WindowIcon',
|
||||||
|
|
||||||
_init: function(window, mode) {
|
_init(window, mode) {
|
||||||
this.window = window;
|
this.window = window;
|
||||||
|
|
||||||
this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
|
this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
|
||||||
@ -993,7 +993,7 @@ var WindowIcon = new Lang.Class({
|
|||||||
this._icon.set_size(size * scaleFactor, size * scaleFactor);
|
this._icon.set_size(size * scaleFactor, size * scaleFactor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createAppIcon: function(app, size) {
|
_createAppIcon(app, size) {
|
||||||
let appIcon = app ? app.create_icon_texture(size)
|
let appIcon = app ? app.create_icon_texture(size)
|
||||||
: new St.Icon({ icon_name: 'icon-missing',
|
: new St.Icon({ icon_name: 'icon-missing',
|
||||||
icon_size: size });
|
icon_size: size });
|
||||||
@ -1008,7 +1008,7 @@ var WindowList = new Lang.Class({
|
|||||||
Name: 'WindowList',
|
Name: 'WindowList',
|
||||||
Extends: SwitcherPopup.SwitcherList,
|
Extends: SwitcherPopup.SwitcherList,
|
||||||
|
|
||||||
_init : function(windows, mode) {
|
_init(windows, mode) {
|
||||||
this.parent(true);
|
this.parent(true);
|
||||||
|
|
||||||
this._label = new St.Label({ x_align: Clutter.ActorAlign.CENTER,
|
this._label = new St.Label({ x_align: Clutter.ActorAlign.CENTER,
|
||||||
@ -1033,13 +1033,13 @@ var WindowList = new Lang.Class({
|
|||||||
this.actor.connect('destroy', () => { this._onDestroy(); });
|
this.actor.connect('destroy', () => { this._onDestroy(); });
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this.icons.forEach(icon => {
|
this.icons.forEach(icon => {
|
||||||
icon.window.disconnect(icon._unmanagedSignalId);
|
icon.window.disconnect(icon._unmanagedSignalId);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredHeight: function(actor, forWidth, alloc) {
|
_getPreferredHeight(actor, forWidth, alloc) {
|
||||||
this.parent(actor, forWidth, alloc);
|
this.parent(actor, forWidth, alloc);
|
||||||
|
|
||||||
let spacing = this.actor.get_theme_node().get_padding(St.Side.BOTTOM);
|
let spacing = this.actor.get_theme_node().get_padding(St.Side.BOTTOM);
|
||||||
@ -1048,7 +1048,7 @@ var WindowList = new Lang.Class({
|
|||||||
alloc.natural_size += labelNat + spacing;
|
alloc.natural_size += labelNat + spacing;
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocateTop: function(actor, box, flags) {
|
_allocateTop(actor, box, flags) {
|
||||||
let childBox = new Clutter.ActorBox();
|
let childBox = new Clutter.ActorBox();
|
||||||
childBox.x1 = box.x1;
|
childBox.x1 = box.x1;
|
||||||
childBox.x2 = box.x2;
|
childBox.x2 = box.x2;
|
||||||
@ -1061,13 +1061,13 @@ var WindowList = new Lang.Class({
|
|||||||
this.parent(actor, box, flags);
|
this.parent(actor, box, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
highlight: function(index, justOutline) {
|
highlight(index, justOutline) {
|
||||||
this.parent(index, justOutline);
|
this.parent(index, justOutline);
|
||||||
|
|
||||||
this._label.set_text(index == -1 ? '' : this.icons[index].label.text);
|
this._label.set_text(index == -1 ? '' : this.icons[index].label.text);
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeWindow: function(window) {
|
_removeWindow(window) {
|
||||||
let index = this.icons.findIndex(icon => {
|
let index = this.icons.findIndex(icon => {
|
||||||
return icon.window == window;
|
return icon.window == window;
|
||||||
});
|
});
|
||||||
|
@ -12,7 +12,7 @@ var ANIMATED_ICON_UPDATE_TIMEOUT = 16;
|
|||||||
var Animation = new Lang.Class({
|
var Animation = new Lang.Class({
|
||||||
Name: 'Animation',
|
Name: 'Animation',
|
||||||
|
|
||||||
_init: function(file, width, height, speed) {
|
_init(file, width, height, speed) {
|
||||||
this.actor = new St.Bin();
|
this.actor = new St.Bin();
|
||||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
this._speed = speed;
|
this._speed = speed;
|
||||||
@ -28,7 +28,7 @@ var Animation = new Lang.Class({
|
|||||||
this.actor.set_child(this._animations);
|
this.actor.set_child(this._animations);
|
||||||
},
|
},
|
||||||
|
|
||||||
play: function() {
|
play() {
|
||||||
if (this._isLoaded && this._timeoutId == 0) {
|
if (this._isLoaded && this._timeoutId == 0) {
|
||||||
if (this._frame == 0)
|
if (this._frame == 0)
|
||||||
this._showFrame(0);
|
this._showFrame(0);
|
||||||
@ -40,7 +40,7 @@ var Animation = new Lang.Class({
|
|||||||
this._isPlaying = true;
|
this._isPlaying = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
stop: function() {
|
stop() {
|
||||||
if (this._timeoutId > 0) {
|
if (this._timeoutId > 0) {
|
||||||
Mainloop.source_remove(this._timeoutId);
|
Mainloop.source_remove(this._timeoutId);
|
||||||
this._timeoutId = 0;
|
this._timeoutId = 0;
|
||||||
@ -49,7 +49,7 @@ var Animation = new Lang.Class({
|
|||||||
this._isPlaying = false;
|
this._isPlaying = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_showFrame: function(frame) {
|
_showFrame(frame) {
|
||||||
let oldFrameActor = this._animations.get_child_at_index(this._frame);
|
let oldFrameActor = this._animations.get_child_at_index(this._frame);
|
||||||
if (oldFrameActor)
|
if (oldFrameActor)
|
||||||
oldFrameActor.hide();
|
oldFrameActor.hide();
|
||||||
@ -61,19 +61,19 @@ var Animation = new Lang.Class({
|
|||||||
newFrameActor.show();
|
newFrameActor.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
_update: function() {
|
_update() {
|
||||||
this._showFrame(this._frame + 1);
|
this._showFrame(this._frame + 1);
|
||||||
return GLib.SOURCE_CONTINUE;
|
return GLib.SOURCE_CONTINUE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_animationsLoaded: function() {
|
_animationsLoaded() {
|
||||||
this._isLoaded = this._animations.get_n_children() > 0;
|
this._isLoaded = this._animations.get_n_children() > 0;
|
||||||
|
|
||||||
if (this._isPlaying)
|
if (this._isPlaying)
|
||||||
this.play();
|
this.play();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this.stop();
|
this.stop();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -82,7 +82,7 @@ var AnimatedIcon = new Lang.Class({
|
|||||||
Name: 'AnimatedIcon',
|
Name: 'AnimatedIcon',
|
||||||
Extends: Animation,
|
Extends: Animation,
|
||||||
|
|
||||||
_init: function(file, size) {
|
_init(file, size) {
|
||||||
this.parent(file, size, size, ANIMATED_ICON_UPDATE_TIMEOUT);
|
this.parent(file, size, size, ANIMATED_ICON_UPDATE_TIMEOUT);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -115,7 +115,7 @@ var BaseAppView = new Lang.Class({
|
|||||||
Name: 'BaseAppView',
|
Name: 'BaseAppView',
|
||||||
Abstract: true,
|
Abstract: true,
|
||||||
|
|
||||||
_init: function(params, gridParams) {
|
_init(params, gridParams) {
|
||||||
gridParams = Params.parse(gridParams, { xAlign: St.Align.MIDDLE,
|
gridParams = Params.parse(gridParams, { xAlign: St.Align.MIDDLE,
|
||||||
columnLimit: MAX_COLUMNS,
|
columnLimit: MAX_COLUMNS,
|
||||||
minRows: MIN_ROWS,
|
minRows: MIN_ROWS,
|
||||||
@ -139,26 +139,26 @@ var BaseAppView = new Lang.Class({
|
|||||||
this._allItems = [];
|
this._allItems = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyFocusIn: function(actor) {
|
_keyFocusIn(actor) {
|
||||||
// Nothing by default
|
// Nothing by default
|
||||||
},
|
},
|
||||||
|
|
||||||
removeAll: function() {
|
removeAll() {
|
||||||
this._grid.destroyAll();
|
this._grid.destroyAll();
|
||||||
this._items = {};
|
this._items = {};
|
||||||
this._allItems = [];
|
this._allItems = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
_redisplay: function() {
|
_redisplay() {
|
||||||
this.removeAll();
|
this.removeAll();
|
||||||
this._loadApps();
|
this._loadApps();
|
||||||
},
|
},
|
||||||
|
|
||||||
getAllItems: function() {
|
getAllItems() {
|
||||||
return this._allItems;
|
return this._allItems;
|
||||||
},
|
},
|
||||||
|
|
||||||
addItem: function(icon) {
|
addItem(icon) {
|
||||||
let id = icon.id;
|
let id = icon.id;
|
||||||
if (this._items[id] !== undefined)
|
if (this._items[id] !== undefined)
|
||||||
return;
|
return;
|
||||||
@ -167,11 +167,11 @@ var BaseAppView = new Lang.Class({
|
|||||||
this._items[id] = icon;
|
this._items[id] = icon;
|
||||||
},
|
},
|
||||||
|
|
||||||
_compareItems: function(a, b) {
|
_compareItems(a, b) {
|
||||||
return a.name.localeCompare(b.name);
|
return a.name.localeCompare(b.name);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadGrid: function() {
|
loadGrid() {
|
||||||
this._allItems.sort(this._compareItems);
|
this._allItems.sort(this._compareItems);
|
||||||
this._allItems.forEach(Lang.bind(this, function(item) {
|
this._allItems.forEach(Lang.bind(this, function(item) {
|
||||||
this._grid.addItem(item);
|
this._grid.addItem(item);
|
||||||
@ -179,14 +179,14 @@ var BaseAppView = new Lang.Class({
|
|||||||
this.emit('view-loaded');
|
this.emit('view-loaded');
|
||||||
},
|
},
|
||||||
|
|
||||||
_selectAppInternal: function(id) {
|
_selectAppInternal(id) {
|
||||||
if (this._items[id])
|
if (this._items[id])
|
||||||
this._items[id].actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
this._items[id].actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||||
else
|
else
|
||||||
log('No such application ' + id);
|
log('No such application ' + id);
|
||||||
},
|
},
|
||||||
|
|
||||||
selectApp: function(id) {
|
selectApp(id) {
|
||||||
if (this._items[id] && this._items[id].actor.mapped) {
|
if (this._items[id] && this._items[id].actor.mapped) {
|
||||||
this._selectAppInternal(id);
|
this._selectAppInternal(id);
|
||||||
} else if (this._items[id]) {
|
} else if (this._items[id]) {
|
||||||
@ -206,13 +206,13 @@ var BaseAppView = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_doSpringAnimation: function(animationDirection) {
|
_doSpringAnimation(animationDirection) {
|
||||||
this._grid.actor.opacity = 255;
|
this._grid.actor.opacity = 255;
|
||||||
this._grid.animateSpring(animationDirection,
|
this._grid.animateSpring(animationDirection,
|
||||||
Main.overview.getShowAppsButton());
|
Main.overview.getShowAppsButton());
|
||||||
},
|
},
|
||||||
|
|
||||||
animate: function(animationDirection, onComplete) {
|
animate(animationDirection, onComplete) {
|
||||||
if (onComplete) {
|
if (onComplete) {
|
||||||
let animationDoneId = this._grid.connect('animation-done', Lang.bind(this,
|
let animationDoneId = this._grid.connect('animation-done', Lang.bind(this,
|
||||||
function () {
|
function () {
|
||||||
@ -231,7 +231,7 @@ var BaseAppView = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
animateSwitch: function(animationDirection) {
|
animateSwitch(animationDirection) {
|
||||||
Tweener.removeTweens(this.actor);
|
Tweener.removeTweens(this.actor);
|
||||||
Tweener.removeTweens(this._grid.actor);
|
Tweener.removeTweens(this._grid.actor);
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ var PageIndicatorsActor = new Lang.Class({
|
|||||||
Name:'PageIndicatorsActor',
|
Name:'PageIndicatorsActor',
|
||||||
Extends: St.BoxLayout,
|
Extends: St.BoxLayout,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent({ style_class: 'page-indicators',
|
this.parent({ style_class: 'page-indicators',
|
||||||
vertical: true,
|
vertical: true,
|
||||||
x_expand: true, y_expand: true,
|
x_expand: true, y_expand: true,
|
||||||
@ -266,7 +266,7 @@ var PageIndicatorsActor = new Lang.Class({
|
|||||||
clip_to_allocation: true });
|
clip_to_allocation: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_height: function(forWidth) {
|
vfunc_get_preferred_height(forWidth) {
|
||||||
// We want to request the natural height of all our children as our
|
// We want to request the natural height of all our children as our
|
||||||
// natural height, so we chain up to St.BoxLayout, but we only request 0
|
// natural height, so we chain up to St.BoxLayout, but we only request 0
|
||||||
// as minimum height, since it's not that important if some indicators
|
// as minimum height, since it's not that important if some indicators
|
||||||
@ -279,7 +279,7 @@ var PageIndicatorsActor = new Lang.Class({
|
|||||||
var PageIndicators = new Lang.Class({
|
var PageIndicators = new Lang.Class({
|
||||||
Name:'PageIndicators',
|
Name:'PageIndicators',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new PageIndicatorsActor();
|
this.actor = new PageIndicatorsActor();
|
||||||
this._nPages = 0;
|
this._nPages = 0;
|
||||||
this._currentPage = undefined;
|
this._currentPage = undefined;
|
||||||
@ -291,7 +291,7 @@ var PageIndicators = new Lang.Class({
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
setNPages: function(nPages) {
|
setNPages(nPages) {
|
||||||
if (this._nPages == nPages)
|
if (this._nPages == nPages)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ var PageIndicators = new Lang.Class({
|
|||||||
this.actor.visible = (this._nPages > 1);
|
this.actor.visible = (this._nPages > 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
setCurrentPage: function(currentPage) {
|
setCurrentPage(currentPage) {
|
||||||
this._currentPage = currentPage;
|
this._currentPage = currentPage;
|
||||||
|
|
||||||
let children = this.actor.get_children();
|
let children = this.actor.get_children();
|
||||||
@ -329,7 +329,7 @@ var PageIndicators = new Lang.Class({
|
|||||||
children[i].set_checked(i == this._currentPage);
|
children[i].set_checked(i == this._currentPage);
|
||||||
},
|
},
|
||||||
|
|
||||||
animateIndicators: function(animationDirection) {
|
animateIndicators(animationDirection) {
|
||||||
if (!this.actor.mapped)
|
if (!this.actor.mapped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ var AllView = new Lang.Class({
|
|||||||
Name: 'AllView',
|
Name: 'AllView',
|
||||||
Extends: BaseAppView,
|
Extends: BaseAppView,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent({ usePagination: true }, null);
|
this.parent({ usePagination: true }, null);
|
||||||
this._scrollView = new St.ScrollView({ style_class: 'all-apps',
|
this._scrollView = new St.ScrollView({ style_class: 'all-apps',
|
||||||
x_expand: true,
|
x_expand: true,
|
||||||
@ -478,12 +478,12 @@ var AllView = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
removeAll: function() {
|
removeAll() {
|
||||||
this.folderIcons = [];
|
this.folderIcons = [];
|
||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_itemNameChanged: function(item) {
|
_itemNameChanged(item) {
|
||||||
// If an item's name changed, we can pluck it out of where it's
|
// If an item's name changed, we can pluck it out of where it's
|
||||||
// supposed to be and reinsert it where it's sorted.
|
// supposed to be and reinsert it where it's sorted.
|
||||||
let oldIdx = this._allItems.indexOf(item);
|
let oldIdx = this._allItems.indexOf(item);
|
||||||
@ -494,7 +494,7 @@ var AllView = new Lang.Class({
|
|||||||
this._grid.addItem(item, newIdx);
|
this._grid.addItem(item, newIdx);
|
||||||
},
|
},
|
||||||
|
|
||||||
_refilterApps: function() {
|
_refilterApps() {
|
||||||
this._allItems.forEach(function(icon) {
|
this._allItems.forEach(function(icon) {
|
||||||
if (icon instanceof AppIcon)
|
if (icon instanceof AppIcon)
|
||||||
icon.actor.visible = true;
|
icon.actor.visible = true;
|
||||||
@ -509,7 +509,7 @@ var AllView = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadApps: function() {
|
_loadApps() {
|
||||||
let apps = Gio.AppInfo.get_all().filter(function(appInfo) {
|
let apps = Gio.AppInfo.get_all().filter(function(appInfo) {
|
||||||
try {
|
try {
|
||||||
let id = appInfo.get_id(); // catch invalid file encodings
|
let id = appInfo.get_id(); // catch invalid file encodings
|
||||||
@ -554,7 +554,7 @@ var AllView = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Overriden from BaseAppView
|
// Overriden from BaseAppView
|
||||||
animate: function (animationDirection, onComplete) {
|
animate(animationDirection, onComplete) {
|
||||||
this._scrollView.reactive = false;
|
this._scrollView.reactive = false;
|
||||||
let completionFunc = Lang.bind(this, function() {
|
let completionFunc = Lang.bind(this, function() {
|
||||||
this._scrollView.reactive = true;
|
this._scrollView.reactive = true;
|
||||||
@ -581,7 +581,7 @@ var AllView = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
animateSwitch: function(animationDirection) {
|
animateSwitch(animationDirection) {
|
||||||
this.parent(animationDirection);
|
this.parent(animationDirection);
|
||||||
|
|
||||||
if (this._currentPopup && this._displayingPopup &&
|
if (this._currentPopup && this._displayingPopup &&
|
||||||
@ -590,7 +590,7 @@ var AllView = new Lang.Class({
|
|||||||
{ time: VIEWS_SWITCH_TIME,
|
{ time: VIEWS_SWITCH_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
this.opacity = 255;
|
this.opacity = 255;
|
||||||
} });
|
} });
|
||||||
|
|
||||||
@ -598,11 +598,11 @@ var AllView = new Lang.Class({
|
|||||||
this._pageIndicators.animateIndicators(animationDirection);
|
this._pageIndicators.animateIndicators(animationDirection);
|
||||||
},
|
},
|
||||||
|
|
||||||
getCurrentPageY: function() {
|
getCurrentPageY() {
|
||||||
return this._grid.getPageY(this._grid.currentPage);
|
return this._grid.getPageY(this._grid.currentPage);
|
||||||
},
|
},
|
||||||
|
|
||||||
goToPage: function(pageNumber) {
|
goToPage(pageNumber) {
|
||||||
pageNumber = clamp(pageNumber, 0, this._grid.nPages() - 1);
|
pageNumber = clamp(pageNumber, 0, this._grid.nPages() - 1);
|
||||||
|
|
||||||
if (this._grid.currentPage == pageNumber && this._displayingPopup && this._currentPopup)
|
if (this._grid.currentPage == pageNumber && this._displayingPopup && this._currentPopup)
|
||||||
@ -644,18 +644,18 @@ var AllView = new Lang.Class({
|
|||||||
this._pageIndicators.setCurrentPage(pageNumber);
|
this._pageIndicators.setCurrentPage(pageNumber);
|
||||||
},
|
},
|
||||||
|
|
||||||
_diffToPage: function (pageNumber) {
|
_diffToPage(pageNumber) {
|
||||||
let currentScrollPosition = this._adjustment.value;
|
let currentScrollPosition = this._adjustment.value;
|
||||||
return Math.abs(currentScrollPosition - this._grid.getPageY(pageNumber));
|
return Math.abs(currentScrollPosition - this._grid.getPageY(pageNumber));
|
||||||
},
|
},
|
||||||
|
|
||||||
openSpaceForPopup: function(item, side, nRows) {
|
openSpaceForPopup(item, side, nRows) {
|
||||||
this._updateIconOpacities(true);
|
this._updateIconOpacities(true);
|
||||||
this._displayingPopup = true;
|
this._displayingPopup = true;
|
||||||
this._grid.openExtraSpace(item, side, nRows);
|
this._grid.openExtraSpace(item, side, nRows);
|
||||||
},
|
},
|
||||||
|
|
||||||
_closeSpaceForPopup: function() {
|
_closeSpaceForPopup() {
|
||||||
this._updateIconOpacities(false);
|
this._updateIconOpacities(false);
|
||||||
|
|
||||||
let fadeEffect = this._scrollView.get_effect('fade');
|
let fadeEffect = this._scrollView.get_effect('fade');
|
||||||
@ -665,7 +665,7 @@ var AllView = new Lang.Class({
|
|||||||
this._grid.closeExtraSpace();
|
this._grid.closeExtraSpace();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onScroll: function(actor, event) {
|
_onScroll(actor, event) {
|
||||||
if (this._displayingPopup || !this._scrollView.reactive)
|
if (this._displayingPopup || !this._scrollView.reactive)
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
|
|
||||||
@ -678,7 +678,7 @@ var AllView = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPan: function(action) {
|
_onPan(action) {
|
||||||
if (this._displayingPopup)
|
if (this._displayingPopup)
|
||||||
return false;
|
return false;
|
||||||
this._panning = true;
|
this._panning = true;
|
||||||
@ -689,7 +689,7 @@ var AllView = new Lang.Class({
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPanEnd: function(action) {
|
_onPanEnd(action) {
|
||||||
if (this._displayingPopup)
|
if (this._displayingPopup)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -708,7 +708,7 @@ var AllView = new Lang.Class({
|
|||||||
this._panning = false;
|
this._panning = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyPressEvent: function(actor, event) {
|
_onKeyPressEvent(actor, event) {
|
||||||
if (this._displayingPopup)
|
if (this._displayingPopup)
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
|
|
||||||
@ -723,7 +723,7 @@ var AllView = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
addFolderPopup: function(popup) {
|
addFolderPopup(popup) {
|
||||||
this._stack.add_actor(popup.actor);
|
this._stack.add_actor(popup.actor);
|
||||||
popup.connect('open-state-changed', Lang.bind(this,
|
popup.connect('open-state-changed', Lang.bind(this,
|
||||||
function(popup, isOpen) {
|
function(popup, isOpen) {
|
||||||
@ -735,12 +735,12 @@ var AllView = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyFocusIn: function(icon) {
|
_keyFocusIn(icon) {
|
||||||
let itemPage = this._grid.getItemPage(icon);
|
let itemPage = this._grid.getItemPage(icon);
|
||||||
this.goToPage(itemPage);
|
this.goToPage(itemPage);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateIconOpacities: function(folderOpen) {
|
_updateIconOpacities(folderOpen) {
|
||||||
for (let id in this._items) {
|
for (let id in this._items) {
|
||||||
let params, opacity;
|
let params, opacity;
|
||||||
if (folderOpen && !this._items[id].actor.checked)
|
if (folderOpen && !this._items[id].actor.checked)
|
||||||
@ -755,7 +755,7 @@ var AllView = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Called before allocation to calculate dynamic spacing
|
// Called before allocation to calculate dynamic spacing
|
||||||
adaptToSize: function(width, height) {
|
adaptToSize(width, height) {
|
||||||
let box = new Clutter.ActorBox();
|
let box = new Clutter.ActorBox();
|
||||||
box.x1 = 0;
|
box.x1 = 0;
|
||||||
box.x2 = width;
|
box.x2 = width;
|
||||||
@ -799,7 +799,7 @@ var FrequentView = new Lang.Class({
|
|||||||
Name: 'FrequentView',
|
Name: 'FrequentView',
|
||||||
Extends: BaseAppView,
|
Extends: BaseAppView,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent(null, { fillParent: true });
|
this.parent(null, { fillParent: true });
|
||||||
|
|
||||||
this.actor = new St.Widget({ style_class: 'frequent-apps',
|
this.actor = new St.Widget({ style_class: 'frequent-apps',
|
||||||
@ -827,11 +827,11 @@ var FrequentView = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
hasUsefulData: function() {
|
hasUsefulData() {
|
||||||
return this._usage.get_most_used("").length >= MIN_FREQUENT_APPS_COUNT;
|
return this._usage.get_most_used("").length >= MIN_FREQUENT_APPS_COUNT;
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadApps: function() {
|
_loadApps() {
|
||||||
let mostUsed = this._usage.get_most_used ("");
|
let mostUsed = this._usage.get_most_used ("");
|
||||||
let hasUsefulData = this.hasUsefulData();
|
let hasUsefulData = this.hasUsefulData();
|
||||||
this._noFrequentAppsLabel.visible = !hasUsefulData;
|
this._noFrequentAppsLabel.visible = !hasUsefulData;
|
||||||
@ -856,7 +856,7 @@ var FrequentView = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Called before allocation to calculate dynamic spacing
|
// Called before allocation to calculate dynamic spacing
|
||||||
adaptToSize: function(width, height) {
|
adaptToSize(width, height) {
|
||||||
let box = new Clutter.ActorBox();
|
let box = new Clutter.ActorBox();
|
||||||
box.x1 = box.y1 = 0;
|
box.x1 = box.y1 = 0;
|
||||||
box.x2 = width;
|
box.x2 = width;
|
||||||
@ -882,7 +882,7 @@ var ControlsBoxLayout = Lang.Class({
|
|||||||
* Override the BoxLayout behavior to use the maximum preferred width of all
|
* Override the BoxLayout behavior to use the maximum preferred width of all
|
||||||
* buttons for each child
|
* buttons for each child
|
||||||
*/
|
*/
|
||||||
vfunc_get_preferred_width: function(container, forHeight) {
|
vfunc_get_preferred_width(container, forHeight) {
|
||||||
let maxMinWidth = 0;
|
let maxMinWidth = 0;
|
||||||
let maxNaturalWidth = 0;
|
let maxNaturalWidth = 0;
|
||||||
for (let child = container.get_first_child();
|
for (let child = container.get_first_child();
|
||||||
@ -905,7 +905,7 @@ var ViewStackLayout = new Lang.Class({
|
|||||||
Signals: { 'allocated-size-changed': { param_types: [GObject.TYPE_INT,
|
Signals: { 'allocated-size-changed': { param_types: [GObject.TYPE_INT,
|
||||||
GObject.TYPE_INT] } },
|
GObject.TYPE_INT] } },
|
||||||
|
|
||||||
vfunc_allocate: function (actor, box, flags) {
|
vfunc_allocate(actor, box, flags) {
|
||||||
let availWidth = box.x2 - box.x1;
|
let availWidth = box.x2 - box.x1;
|
||||||
let availHeight = box.y2 - box.y1;
|
let availHeight = box.y2 - box.y1;
|
||||||
// Prepare children of all views for the upcoming allocation, calculate all
|
// Prepare children of all views for the upcoming allocation, calculate all
|
||||||
@ -918,7 +918,7 @@ var ViewStackLayout = new Lang.Class({
|
|||||||
var AppDisplay = new Lang.Class({
|
var AppDisplay = new Lang.Class({
|
||||||
Name: 'AppDisplay',
|
Name: 'AppDisplay',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._privacySettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.privacy' });
|
this._privacySettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.privacy' });
|
||||||
this._privacySettings.connect('changed::remember-app-usage',
|
this._privacySettings.connect('changed::remember-app-usage',
|
||||||
Lang.bind(this, this._updateFrequentVisibility));
|
Lang.bind(this, this._updateFrequentVisibility));
|
||||||
@ -995,14 +995,14 @@ var AppDisplay = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateDiscreteGpuAvailable: function() {
|
_updateDiscreteGpuAvailable() {
|
||||||
if (!this._switcherooProxy)
|
if (!this._switcherooProxy)
|
||||||
discreteGpuAvailable = false;
|
discreteGpuAvailable = false;
|
||||||
else
|
else
|
||||||
discreteGpuAvailable = this._switcherooProxy.HasDualGpu;
|
discreteGpuAvailable = this._switcherooProxy.HasDualGpu;
|
||||||
},
|
},
|
||||||
|
|
||||||
_switcherooProxyAppeared: function() {
|
_switcherooProxyAppeared() {
|
||||||
this._switcherooProxy = new SwitcherooProxy(Gio.DBus.system, SWITCHEROO_BUS_NAME, SWITCHEROO_OBJECT_PATH,
|
this._switcherooProxy = new SwitcherooProxy(Gio.DBus.system, SWITCHEROO_BUS_NAME, SWITCHEROO_OBJECT_PATH,
|
||||||
Lang.bind(this, function(proxy, error) {
|
Lang.bind(this, function(proxy, error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -1013,7 +1013,7 @@ var AppDisplay = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
animate: function(animationDirection, onComplete) {
|
animate(animationDirection, onComplete) {
|
||||||
let currentView = this._views.filter(v => v.control.has_style_pseudo_class('checked')).pop().view;
|
let currentView = this._views.filter(v => v.control.has_style_pseudo_class('checked')).pop().view;
|
||||||
|
|
||||||
// Animate controls opacity using iconGrid animation time, since
|
// Animate controls opacity using iconGrid animation time, since
|
||||||
@ -1036,7 +1036,7 @@ var AppDisplay = new Lang.Class({
|
|||||||
currentView.animate(animationDirection, onComplete);
|
currentView.animate(animationDirection, onComplete);
|
||||||
},
|
},
|
||||||
|
|
||||||
_showView: function(activeIndex) {
|
_showView(activeIndex) {
|
||||||
for (let i = 0; i < this._views.length; i++) {
|
for (let i = 0; i < this._views.length; i++) {
|
||||||
if (i == activeIndex)
|
if (i == activeIndex)
|
||||||
this._views[i].control.add_style_pseudo_class('checked');
|
this._views[i].control.add_style_pseudo_class('checked');
|
||||||
@ -1049,7 +1049,7 @@ var AppDisplay = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateFrequentVisibility: function() {
|
_updateFrequentVisibility() {
|
||||||
let enabled = this._privacySettings.get_boolean('remember-app-usage');
|
let enabled = this._privacySettings.get_boolean('remember-app-usage');
|
||||||
this._views[Views.FREQUENT].control.visible = enabled;
|
this._views[Views.FREQUENT].control.visible = enabled;
|
||||||
|
|
||||||
@ -1062,12 +1062,12 @@ var AppDisplay = new Lang.Class({
|
|||||||
this._showView(Views.ALL);
|
this._showView(Views.ALL);
|
||||||
},
|
},
|
||||||
|
|
||||||
selectApp: function(id) {
|
selectApp(id) {
|
||||||
this._showView(Views.ALL);
|
this._showView(Views.ALL);
|
||||||
this._views[Views.ALL].view.selectApp(id);
|
this._views[Views.ALL].view.selectApp(id);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAllocatedSizeChanged: function(actor, width, height) {
|
_onAllocatedSizeChanged(actor, width, height) {
|
||||||
let box = new Clutter.ActorBox();
|
let box = new Clutter.ActorBox();
|
||||||
box.x1 = box.y1 =0;
|
box.x1 = box.y1 =0;
|
||||||
box.x2 = width;
|
box.x2 = width;
|
||||||
@ -1083,7 +1083,7 @@ var AppDisplay = new Lang.Class({
|
|||||||
var AppSearchProvider = new Lang.Class({
|
var AppSearchProvider = new Lang.Class({
|
||||||
Name: 'AppSearchProvider',
|
Name: 'AppSearchProvider',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._appSys = Shell.AppSystem.get_default();
|
this._appSys = Shell.AppSystem.get_default();
|
||||||
this.id = 'applications';
|
this.id = 'applications';
|
||||||
this.isRemoteProvider = false;
|
this.isRemoteProvider = false;
|
||||||
@ -1092,7 +1092,7 @@ var AppSearchProvider = new Lang.Class({
|
|||||||
this._systemActions = new SystemActions.getDefault();
|
this._systemActions = new SystemActions.getDefault();
|
||||||
},
|
},
|
||||||
|
|
||||||
getResultMetas: function(apps, callback) {
|
getResultMetas(apps, callback) {
|
||||||
let metas = [];
|
let metas = [];
|
||||||
for (let id of apps) {
|
for (let id of apps) {
|
||||||
if (id.endsWith('.desktop')) {
|
if (id.endsWith('.desktop')) {
|
||||||
@ -1100,7 +1100,7 @@ var AppSearchProvider = new Lang.Class({
|
|||||||
|
|
||||||
metas.push({ 'id': app.get_id(),
|
metas.push({ 'id': app.get_id(),
|
||||||
'name': app.get_name(),
|
'name': app.get_name(),
|
||||||
'createIcon': function(size) {
|
'createIcon'(size) {
|
||||||
return app.create_icon_texture(size);
|
return app.create_icon_texture(size);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1120,11 +1120,11 @@ var AppSearchProvider = new Lang.Class({
|
|||||||
callback(metas);
|
callback(metas);
|
||||||
},
|
},
|
||||||
|
|
||||||
filterResults: function(results, maxNumber) {
|
filterResults(results, maxNumber) {
|
||||||
return results.slice(0, maxNumber);
|
return results.slice(0, maxNumber);
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialResultSet: function(terms, callback, cancellable) {
|
getInitialResultSet(terms, callback, cancellable) {
|
||||||
let query = terms.join(' ');
|
let query = terms.join(' ');
|
||||||
let groups = Shell.AppSystem.search(query);
|
let groups = Shell.AppSystem.search(query);
|
||||||
let usage = Shell.AppUsage.get_default();
|
let usage = Shell.AppUsage.get_default();
|
||||||
@ -1144,11 +1144,11 @@ var AppSearchProvider = new Lang.Class({
|
|||||||
callback(results);
|
callback(results);
|
||||||
},
|
},
|
||||||
|
|
||||||
getSubsearchResultSet: function(previousResults, terms, callback, cancellable) {
|
getSubsearchResultSet(previousResults, terms, callback, cancellable) {
|
||||||
this.getInitialResultSet(terms, callback, cancellable);
|
this.getInitialResultSet(terms, callback, cancellable);
|
||||||
},
|
},
|
||||||
|
|
||||||
createResultObject: function (resultMeta) {
|
createResultObject(resultMeta) {
|
||||||
if (resultMeta.id.endsWith('.desktop'))
|
if (resultMeta.id.endsWith('.desktop'))
|
||||||
return new AppIcon(this._appSys.lookup_app(resultMeta['id']));
|
return new AppIcon(this._appSys.lookup_app(resultMeta['id']));
|
||||||
else
|
else
|
||||||
@ -1160,7 +1160,7 @@ var FolderView = new Lang.Class({
|
|||||||
Name: 'FolderView',
|
Name: 'FolderView',
|
||||||
Extends: BaseAppView,
|
Extends: BaseAppView,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent(null, null);
|
this.parent(null, null);
|
||||||
// If it not expand, the parent doesn't take into account its preferred_width when allocating
|
// If it not expand, the parent doesn't take into account its preferred_width when allocating
|
||||||
// the second time it allocates, so we apply the "Standard hack for ClutterBinLayout"
|
// the second time it allocates, so we apply the "Standard hack for ClutterBinLayout"
|
||||||
@ -1177,16 +1177,16 @@ var FolderView = new Lang.Class({
|
|||||||
this.actor.add_action(action);
|
this.actor.add_action(action);
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyFocusIn: function(actor) {
|
_keyFocusIn(actor) {
|
||||||
Util.ensureActorVisibleInScrollView(this.actor, actor);
|
Util.ensureActorVisibleInScrollView(this.actor, actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Overriden from BaseAppView
|
// Overriden from BaseAppView
|
||||||
animate: function(animationDirection) {
|
animate(animationDirection) {
|
||||||
this._grid.animatePulse(animationDirection);
|
this._grid.animatePulse(animationDirection);
|
||||||
},
|
},
|
||||||
|
|
||||||
createFolderIcon: function(size) {
|
createFolderIcon(size) {
|
||||||
let layout = new Clutter.GridLayout();
|
let layout = new Clutter.GridLayout();
|
||||||
let icon = new St.Widget({ layout_manager: layout,
|
let icon = new St.Widget({ layout_manager: layout,
|
||||||
style_class: 'app-folder-icon' });
|
style_class: 'app-folder-icon' });
|
||||||
@ -1206,14 +1206,14 @@ var FolderView = new Lang.Class({
|
|||||||
return icon;
|
return icon;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPan: function(action) {
|
_onPan(action) {
|
||||||
let [dist, dx, dy] = action.get_motion_delta(0);
|
let [dist, dx, dy] = action.get_motion_delta(0);
|
||||||
let adjustment = this.actor.vscroll.adjustment;
|
let adjustment = this.actor.vscroll.adjustment;
|
||||||
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
|
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
adaptToSize: function(width, height) {
|
adaptToSize(width, height) {
|
||||||
this._parentAvailableWidth = width;
|
this._parentAvailableWidth = width;
|
||||||
this._parentAvailableHeight = height;
|
this._parentAvailableHeight = height;
|
||||||
|
|
||||||
@ -1237,7 +1237,7 @@ var FolderView = new Lang.Class({
|
|||||||
this.actor.set_height(this.usedHeight());
|
this.actor.set_height(this.usedHeight());
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPageAvailableSize: function() {
|
_getPageAvailableSize() {
|
||||||
let pageBox = new Clutter.ActorBox();
|
let pageBox = new Clutter.ActorBox();
|
||||||
pageBox.x1 = pageBox.y1 = 0;
|
pageBox.x1 = pageBox.y1 = 0;
|
||||||
pageBox.x2 = this._parentAvailableWidth;
|
pageBox.x2 = this._parentAvailableWidth;
|
||||||
@ -1249,22 +1249,22 @@ var FolderView = new Lang.Class({
|
|||||||
return [(contentBox.x2 - contentBox.x1) - 2 * this._offsetForEachSide, (contentBox.y2 - contentBox.y1) - 2 * this._offsetForEachSide];
|
return [(contentBox.x2 - contentBox.x1) - 2 * this._offsetForEachSide, (contentBox.y2 - contentBox.y1) - 2 * this._offsetForEachSide];
|
||||||
},
|
},
|
||||||
|
|
||||||
usedWidth: function() {
|
usedWidth() {
|
||||||
let [availWidthPerPage, availHeightPerPage] = this._getPageAvailableSize();
|
let [availWidthPerPage, availHeightPerPage] = this._getPageAvailableSize();
|
||||||
return this._grid.usedWidth(availWidthPerPage);
|
return this._grid.usedWidth(availWidthPerPage);
|
||||||
},
|
},
|
||||||
|
|
||||||
usedHeight: function() {
|
usedHeight() {
|
||||||
return this._grid.usedHeightForNRows(this.nRowsDisplayedAtOnce());
|
return this._grid.usedHeightForNRows(this.nRowsDisplayedAtOnce());
|
||||||
},
|
},
|
||||||
|
|
||||||
nRowsDisplayedAtOnce: function() {
|
nRowsDisplayedAtOnce() {
|
||||||
let [availWidthPerPage, availHeightPerPage] = this._getPageAvailableSize();
|
let [availWidthPerPage, availHeightPerPage] = this._getPageAvailableSize();
|
||||||
let maxRows = this._grid.rowsForHeight(availHeightPerPage) - 1;
|
let maxRows = this._grid.rowsForHeight(availHeightPerPage) - 1;
|
||||||
return Math.min(this._grid.nRows(availWidthPerPage), maxRows);
|
return Math.min(this._grid.nRows(availWidthPerPage), maxRows);
|
||||||
},
|
},
|
||||||
|
|
||||||
setPaddingOffsets: function(offset) {
|
setPaddingOffsets(offset) {
|
||||||
this._offsetForEachSide = offset;
|
this._offsetForEachSide = offset;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1272,7 +1272,7 @@ var FolderView = new Lang.Class({
|
|||||||
var FolderIcon = new Lang.Class({
|
var FolderIcon = new Lang.Class({
|
||||||
Name: 'FolderIcon',
|
Name: 'FolderIcon',
|
||||||
|
|
||||||
_init: function(id, path, parentView) {
|
_init(id, path, parentView) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = '';
|
this.name = '';
|
||||||
this._parentView = parentView;
|
this._parentView = parentView;
|
||||||
@ -1311,13 +1311,13 @@ var FolderIcon = new Lang.Class({
|
|||||||
this._redisplay();
|
this._redisplay();
|
||||||
},
|
},
|
||||||
|
|
||||||
getAppIds: function() {
|
getAppIds() {
|
||||||
return this.view.getAllItems().map(function(item) {
|
return this.view.getAllItems().map(function(item) {
|
||||||
return item.id;
|
return item.id;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateName: function() {
|
_updateName() {
|
||||||
let name = _getFolderName(this._folder);
|
let name = _getFolderName(this._folder);
|
||||||
if (this.name == name)
|
if (this.name == name)
|
||||||
return;
|
return;
|
||||||
@ -1327,7 +1327,7 @@ var FolderIcon = new Lang.Class({
|
|||||||
this.emit('name-changed');
|
this.emit('name-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_redisplay: function() {
|
_redisplay() {
|
||||||
this._updateName();
|
this._updateName();
|
||||||
|
|
||||||
this.view.removeAll();
|
this.view.removeAll();
|
||||||
@ -1369,16 +1369,16 @@ var FolderIcon = new Lang.Class({
|
|||||||
this.emit('apps-changed');
|
this.emit('apps-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_createIcon: function(iconSize) {
|
_createIcon(iconSize) {
|
||||||
return this.view.createFolderIcon(iconSize, this);
|
return this.view.createFolderIcon(iconSize, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_popupHeight: function() {
|
_popupHeight() {
|
||||||
let usedHeight = this.view.usedHeight() + this._popup.getOffset(St.Side.TOP) + this._popup.getOffset(St.Side.BOTTOM);
|
let usedHeight = this.view.usedHeight() + this._popup.getOffset(St.Side.TOP) + this._popup.getOffset(St.Side.BOTTOM);
|
||||||
return usedHeight;
|
return usedHeight;
|
||||||
},
|
},
|
||||||
|
|
||||||
_openSpaceForPopup: function() {
|
_openSpaceForPopup() {
|
||||||
let id = this._parentView.connect('space-ready', Lang.bind(this,
|
let id = this._parentView.connect('space-ready', Lang.bind(this,
|
||||||
function() {
|
function() {
|
||||||
this._parentView.disconnect(id);
|
this._parentView.disconnect(id);
|
||||||
@ -1388,14 +1388,14 @@ var FolderIcon = new Lang.Class({
|
|||||||
this._parentView.openSpaceForPopup(this, this._boxPointerArrowside, this.view.nRowsDisplayedAtOnce());
|
this._parentView.openSpaceForPopup(this, this._boxPointerArrowside, this.view.nRowsDisplayedAtOnce());
|
||||||
},
|
},
|
||||||
|
|
||||||
_calculateBoxPointerArrowSide: function() {
|
_calculateBoxPointerArrowSide() {
|
||||||
let spaceTop = this.actor.y - this._parentView.getCurrentPageY();
|
let spaceTop = this.actor.y - this._parentView.getCurrentPageY();
|
||||||
let spaceBottom = this._parentView.actor.height - (spaceTop + this.actor.height);
|
let spaceBottom = this._parentView.actor.height - (spaceTop + this.actor.height);
|
||||||
|
|
||||||
return spaceTop > spaceBottom ? St.Side.BOTTOM : St.Side.TOP;
|
return spaceTop > spaceBottom ? St.Side.BOTTOM : St.Side.TOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePopupSize: function() {
|
_updatePopupSize() {
|
||||||
// StWidget delays style calculation until needed, make sure we use the correct values
|
// StWidget delays style calculation until needed, make sure we use the correct values
|
||||||
this.view._grid.actor.ensure_style();
|
this.view._grid.actor.ensure_style();
|
||||||
|
|
||||||
@ -1407,7 +1407,7 @@ var FolderIcon = new Lang.Class({
|
|||||||
this.view.adaptToSize(this._parentAvailableWidth, this._parentAvailableHeight);
|
this.view.adaptToSize(this._parentAvailableWidth, this._parentAvailableHeight);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePopupPosition: function() {
|
_updatePopupPosition() {
|
||||||
if (!this._popup)
|
if (!this._popup)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1417,7 +1417,7 @@ var FolderIcon = new Lang.Class({
|
|||||||
this._popup.actor.y = this.actor.allocation.y1 + this.actor.translation_y + this.actor.height;
|
this._popup.actor.y = this.actor.allocation.y1 + this.actor.translation_y + this.actor.height;
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensurePopup: function() {
|
_ensurePopup() {
|
||||||
if (this._popup && !this._popupInvalidated)
|
if (this._popup && !this._popupInvalidated)
|
||||||
return;
|
return;
|
||||||
this._boxPointerArrowside = this._calculateBoxPointerArrowSide();
|
this._boxPointerArrowside = this._calculateBoxPointerArrowSide();
|
||||||
@ -1437,7 +1437,7 @@ var FolderIcon = new Lang.Class({
|
|||||||
this._popupInvalidated = false;
|
this._popupInvalidated = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
adaptToSize: function(width, height) {
|
adaptToSize(width, height) {
|
||||||
this._parentAvailableWidth = width;
|
this._parentAvailableWidth = width;
|
||||||
this._parentAvailableHeight = height;
|
this._parentAvailableHeight = height;
|
||||||
if(this._popup)
|
if(this._popup)
|
||||||
@ -1450,7 +1450,7 @@ Signals.addSignalMethods(FolderIcon.prototype);
|
|||||||
var AppFolderPopup = new Lang.Class({
|
var AppFolderPopup = new Lang.Class({
|
||||||
Name: 'AppFolderPopup',
|
Name: 'AppFolderPopup',
|
||||||
|
|
||||||
_init: function(source, side) {
|
_init(source, side) {
|
||||||
this._source = source;
|
this._source = source;
|
||||||
this._view = source.view;
|
this._view = source.view;
|
||||||
this._arrowSide = side;
|
this._arrowSide = side;
|
||||||
@ -1499,7 +1499,7 @@ var AppFolderPopup = new Lang.Class({
|
|||||||
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress));
|
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyPress: function(actor, event) {
|
_onKeyPress(actor, event) {
|
||||||
if (global.stage.get_key_focus() != actor)
|
if (global.stage.get_key_focus() != actor)
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
|
||||||
@ -1543,14 +1543,14 @@ var AppFolderPopup = new Lang.Class({
|
|||||||
return actor.navigate_focus(null, direction, false);
|
return actor.navigate_focus(null, direction, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle: function() {
|
toggle() {
|
||||||
if (this._isOpen)
|
if (this._isOpen)
|
||||||
this.popdown();
|
this.popdown();
|
||||||
else
|
else
|
||||||
this.popup();
|
this.popup();
|
||||||
},
|
},
|
||||||
|
|
||||||
popup: function() {
|
popup() {
|
||||||
if (this._isOpen)
|
if (this._isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1578,7 +1578,7 @@ var AppFolderPopup = new Lang.Class({
|
|||||||
this.emit('open-state-changed', true);
|
this.emit('open-state-changed', true);
|
||||||
},
|
},
|
||||||
|
|
||||||
popdown: function() {
|
popdown() {
|
||||||
if (!this._isOpen)
|
if (!this._isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1590,18 +1590,18 @@ var AppFolderPopup = new Lang.Class({
|
|||||||
this.emit('open-state-changed', false);
|
this.emit('open-state-changed', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
getCloseButtonOverlap: function() {
|
getCloseButtonOverlap() {
|
||||||
return this.closeButton.get_theme_node().get_length('-shell-close-overlap-y');
|
return this.closeButton.get_theme_node().get_length('-shell-close-overlap-y');
|
||||||
},
|
},
|
||||||
|
|
||||||
getOffset: function (side) {
|
getOffset(side) {
|
||||||
let offset = this._boxPointer.getPadding(side);
|
let offset = this._boxPointer.getPadding(side);
|
||||||
if (this._arrowSide == side)
|
if (this._arrowSide == side)
|
||||||
offset += this._boxPointer.getArrowHeight();
|
offset += this._boxPointer.getArrowHeight();
|
||||||
return offset;
|
return offset;
|
||||||
},
|
},
|
||||||
|
|
||||||
updateArrowSide: function (side) {
|
updateArrowSide(side) {
|
||||||
this._arrowSide = side;
|
this._arrowSide = side;
|
||||||
this._boxPointer.updateArrowSide(side);
|
this._boxPointer.updateArrowSide(side);
|
||||||
}
|
}
|
||||||
@ -1611,7 +1611,7 @@ Signals.addSignalMethods(AppFolderPopup.prototype);
|
|||||||
var AppIcon = new Lang.Class({
|
var AppIcon = new Lang.Class({
|
||||||
Name: 'AppIcon',
|
Name: 'AppIcon',
|
||||||
|
|
||||||
_init : function(app, iconParams) {
|
_init(app, iconParams) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.id = app.get_id();
|
this.id = app.get_id();
|
||||||
this.name = app.get_name();
|
this.name = app.get_name();
|
||||||
@ -1688,32 +1688,32 @@ var AppIcon = new Lang.Class({
|
|||||||
this._updateRunningStyle();
|
this._updateRunningStyle();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
if (this._stateChangedId > 0)
|
if (this._stateChangedId > 0)
|
||||||
this.app.disconnect(this._stateChangedId);
|
this.app.disconnect(this._stateChangedId);
|
||||||
this._stateChangedId = 0;
|
this._stateChangedId = 0;
|
||||||
this._removeMenuTimeout();
|
this._removeMenuTimeout();
|
||||||
},
|
},
|
||||||
|
|
||||||
_createIcon: function(iconSize) {
|
_createIcon(iconSize) {
|
||||||
return this.app.create_icon_texture(iconSize);
|
return this.app.create_icon_texture(iconSize);
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeMenuTimeout: function() {
|
_removeMenuTimeout() {
|
||||||
if (this._menuTimeoutId > 0) {
|
if (this._menuTimeoutId > 0) {
|
||||||
Mainloop.source_remove(this._menuTimeoutId);
|
Mainloop.source_remove(this._menuTimeoutId);
|
||||||
this._menuTimeoutId = 0;
|
this._menuTimeoutId = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateRunningStyle: function() {
|
_updateRunningStyle() {
|
||||||
if (this.app.state != Shell.AppState.STOPPED)
|
if (this.app.state != Shell.AppState.STOPPED)
|
||||||
this._dot.show();
|
this._dot.show();
|
||||||
else
|
else
|
||||||
this._dot.hide();
|
this._dot.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_setPopupTimeout: function() {
|
_setPopupTimeout() {
|
||||||
this._removeMenuTimeout();
|
this._removeMenuTimeout();
|
||||||
this._menuTimeoutId = Mainloop.timeout_add(MENU_POPUP_TIMEOUT,
|
this._menuTimeoutId = Mainloop.timeout_add(MENU_POPUP_TIMEOUT,
|
||||||
Lang.bind(this, function() {
|
Lang.bind(this, function() {
|
||||||
@ -1724,12 +1724,12 @@ var AppIcon = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._menuTimeoutId, '[gnome-shell] this.popupMenu');
|
GLib.Source.set_name_by_id(this._menuTimeoutId, '[gnome-shell] this.popupMenu');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLeaveEvent: function(actor, event) {
|
_onLeaveEvent(actor, event) {
|
||||||
this.actor.fake_release();
|
this.actor.fake_release();
|
||||||
this._removeMenuTimeout();
|
this._removeMenuTimeout();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonPress: function(actor, event) {
|
_onButtonPress(actor, event) {
|
||||||
let button = event.get_button();
|
let button = event.get_button();
|
||||||
if (button == 1) {
|
if (button == 1) {
|
||||||
this._setPopupTimeout();
|
this._setPopupTimeout();
|
||||||
@ -1740,28 +1740,28 @@ var AppIcon = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onTouchEvent: function (actor, event) {
|
_onTouchEvent(actor, event) {
|
||||||
if (event.type() == Clutter.EventType.TOUCH_BEGIN)
|
if (event.type() == Clutter.EventType.TOUCH_BEGIN)
|
||||||
this._setPopupTimeout();
|
this._setPopupTimeout();
|
||||||
|
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onClicked: function(actor, button) {
|
_onClicked(actor, button) {
|
||||||
this._removeMenuTimeout();
|
this._removeMenuTimeout();
|
||||||
this.activate(button);
|
this.activate(button);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyboardPopupMenu: function() {
|
_onKeyboardPopupMenu() {
|
||||||
this.popupMenu();
|
this.popupMenu();
|
||||||
this._menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
this._menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
getId: function() {
|
getId() {
|
||||||
return this.app.get_id();
|
return this.app.get_id();
|
||||||
},
|
},
|
||||||
|
|
||||||
popupMenu: function() {
|
popupMenu() {
|
||||||
this._removeMenuTimeout();
|
this._removeMenuTimeout();
|
||||||
this.actor.fake_release();
|
this.actor.fake_release();
|
||||||
|
|
||||||
@ -1795,7 +1795,7 @@ var AppIcon = new Lang.Class({
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
activateWindow: function(metaWindow) {
|
activateWindow(metaWindow) {
|
||||||
if (metaWindow) {
|
if (metaWindow) {
|
||||||
Main.activateWindow(metaWindow);
|
Main.activateWindow(metaWindow);
|
||||||
} else {
|
} else {
|
||||||
@ -1803,12 +1803,12 @@ var AppIcon = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMenuPoppedDown: function() {
|
_onMenuPoppedDown() {
|
||||||
this.actor.sync_hover();
|
this.actor.sync_hover();
|
||||||
this.emit('menu-state-changed', false);
|
this.emit('menu-state-changed', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function (button) {
|
activate(button) {
|
||||||
let event = Clutter.get_current_event();
|
let event = Clutter.get_current_event();
|
||||||
let modifiers = event ? event.get_state() : 0;
|
let modifiers = event ? event.get_state() : 0;
|
||||||
let openNewWindow = this.app.can_open_new_window () &&
|
let openNewWindow = this.app.can_open_new_window () &&
|
||||||
@ -1827,28 +1827,28 @@ var AppIcon = new Lang.Class({
|
|||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
animateLaunch: function() {
|
animateLaunch() {
|
||||||
this.icon.animateZoomOut();
|
this.icon.animateZoomOut();
|
||||||
},
|
},
|
||||||
|
|
||||||
shellWorkspaceLaunch : function(params) {
|
shellWorkspaceLaunch(params) {
|
||||||
params = Params.parse(params, { workspace: -1,
|
params = Params.parse(params, { workspace: -1,
|
||||||
timestamp: 0 });
|
timestamp: 0 });
|
||||||
|
|
||||||
this.app.open_new_window(params.workspace);
|
this.app.open_new_window(params.workspace);
|
||||||
},
|
},
|
||||||
|
|
||||||
getDragActor: function() {
|
getDragActor() {
|
||||||
return this.app.create_icon_texture(Main.overview.dashIconSize);
|
return this.app.create_icon_texture(Main.overview.dashIconSize);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns the original actor that should align with the actor
|
// Returns the original actor that should align with the actor
|
||||||
// we show as the item is being dragged.
|
// we show as the item is being dragged.
|
||||||
getDragActorSource: function() {
|
getDragActorSource() {
|
||||||
return this.icon.icon;
|
return this.icon.icon;
|
||||||
},
|
},
|
||||||
|
|
||||||
shouldShowTooltip: function() {
|
shouldShowTooltip() {
|
||||||
return this.actor.hover && (!this._menu || !this._menu.isOpen);
|
return this.actor.hover && (!this._menu || !this._menu.isOpen);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -1858,7 +1858,7 @@ var AppIconMenu = new Lang.Class({
|
|||||||
Name: 'AppIconMenu',
|
Name: 'AppIconMenu',
|
||||||
Extends: PopupMenu.PopupMenu,
|
Extends: PopupMenu.PopupMenu,
|
||||||
|
|
||||||
_init: function(source) {
|
_init(source) {
|
||||||
let side = St.Side.LEFT;
|
let side = St.Side.LEFT;
|
||||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||||
side = St.Side.RIGHT;
|
side = St.Side.RIGHT;
|
||||||
@ -1885,7 +1885,7 @@ var AppIconMenu = new Lang.Class({
|
|||||||
Main.uiGroup.add_actor(this.actor);
|
Main.uiGroup.add_actor(this.actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_redisplay: function() {
|
_redisplay() {
|
||||||
this.removeAll();
|
this.removeAll();
|
||||||
|
|
||||||
let windows = this._source.app.get_windows().filter(function(w) {
|
let windows = this._source.app.get_windows().filter(function(w) {
|
||||||
@ -1993,19 +1993,19 @@ var AppIconMenu = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_appendSeparator: function () {
|
_appendSeparator() {
|
||||||
let separator = new PopupMenu.PopupSeparatorMenuItem();
|
let separator = new PopupMenu.PopupSeparatorMenuItem();
|
||||||
this.addMenuItem(separator);
|
this.addMenuItem(separator);
|
||||||
},
|
},
|
||||||
|
|
||||||
_appendMenuItem: function(labelText) {
|
_appendMenuItem(labelText) {
|
||||||
// FIXME: app-well-menu-item style
|
// FIXME: app-well-menu-item style
|
||||||
let item = new PopupMenu.PopupMenuItem(labelText);
|
let item = new PopupMenu.PopupMenuItem(labelText);
|
||||||
this.addMenuItem(item);
|
this.addMenuItem(item);
|
||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|
||||||
popup: function(activatingButton) {
|
popup(activatingButton) {
|
||||||
this._redisplay();
|
this._redisplay();
|
||||||
this.open();
|
this.open();
|
||||||
}
|
}
|
||||||
@ -2016,7 +2016,7 @@ var SystemActionIcon = new Lang.Class({
|
|||||||
Name: 'SystemActionIcon',
|
Name: 'SystemActionIcon',
|
||||||
Extends: Search.GridSearchResult,
|
Extends: Search.GridSearchResult,
|
||||||
|
|
||||||
activate: function() {
|
activate() {
|
||||||
SystemActions.getDefault().activateAction(this.metaInfo['id']);
|
SystemActions.getDefault().activateAction(this.metaInfo['id']);
|
||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
}
|
}
|
||||||
|
@ -49,18 +49,18 @@ var AppFavorites = new Lang.Class({
|
|||||||
|
|
||||||
FAVORITE_APPS_KEY: 'favorite-apps',
|
FAVORITE_APPS_KEY: 'favorite-apps',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._favorites = {};
|
this._favorites = {};
|
||||||
global.settings.connect('changed::' + this.FAVORITE_APPS_KEY, Lang.bind(this, this._onFavsChanged));
|
global.settings.connect('changed::' + this.FAVORITE_APPS_KEY, Lang.bind(this, this._onFavsChanged));
|
||||||
this.reload();
|
this.reload();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onFavsChanged: function() {
|
_onFavsChanged() {
|
||||||
this.reload();
|
this.reload();
|
||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
reload: function() {
|
reload() {
|
||||||
let ids = global.settings.get_strv(this.FAVORITE_APPS_KEY);
|
let ids = global.settings.get_strv(this.FAVORITE_APPS_KEY);
|
||||||
let appSys = Shell.AppSystem.get_default();
|
let appSys = Shell.AppSystem.get_default();
|
||||||
|
|
||||||
@ -91,29 +91,29 @@ var AppFavorites = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getIds: function() {
|
_getIds() {
|
||||||
let ret = [];
|
let ret = [];
|
||||||
for (let id in this._favorites)
|
for (let id in this._favorites)
|
||||||
ret.push(id);
|
ret.push(id);
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
getFavoriteMap: function() {
|
getFavoriteMap() {
|
||||||
return this._favorites;
|
return this._favorites;
|
||||||
},
|
},
|
||||||
|
|
||||||
getFavorites: function() {
|
getFavorites() {
|
||||||
let ret = [];
|
let ret = [];
|
||||||
for (let id in this._favorites)
|
for (let id in this._favorites)
|
||||||
ret.push(this._favorites[id]);
|
ret.push(this._favorites[id]);
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
isFavorite: function(appId) {
|
isFavorite(appId) {
|
||||||
return appId in this._favorites;
|
return appId in this._favorites;
|
||||||
},
|
},
|
||||||
|
|
||||||
_addFavorite: function(appId, pos) {
|
_addFavorite(appId, pos) {
|
||||||
if (appId in this._favorites)
|
if (appId in this._favorites)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ var AppFavorites = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
addFavoriteAtPos: function(appId, pos) {
|
addFavoriteAtPos(appId, pos) {
|
||||||
if (!this._addFavorite(appId, pos))
|
if (!this._addFavorite(appId, pos))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -146,16 +146,16 @@ var AppFavorites = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
addFavorite: function(appId) {
|
addFavorite(appId) {
|
||||||
this.addFavoriteAtPos(appId, -1);
|
this.addFavoriteAtPos(appId, -1);
|
||||||
},
|
},
|
||||||
|
|
||||||
moveFavoriteToPos: function(appId, pos) {
|
moveFavoriteToPos(appId, pos) {
|
||||||
this._removeFavorite(appId);
|
this._removeFavorite(appId);
|
||||||
this._addFavorite(appId, pos);
|
this._addFavorite(appId, pos);
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeFavorite: function(appId) {
|
_removeFavorite(appId) {
|
||||||
if (!appId in this._favorites)
|
if (!appId in this._favorites)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ var AppFavorites = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeFavorite: function(appId) {
|
removeFavorite(appId) {
|
||||||
let ids = this._getIds();
|
let ids = this._getIds();
|
||||||
let pos = ids.indexOf(appId);
|
let pos = ids.indexOf(appId);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
|||||||
Name: 'AudioDeviceSelectionDialog',
|
Name: 'AudioDeviceSelectionDialog',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function(devices) {
|
_init(devices) {
|
||||||
this.parent({ styleClass: 'audio-device-selection-dialog' });
|
this.parent({ styleClass: 'audio-device-selection-dialog' });
|
||||||
|
|
||||||
this._deviceItems = {};
|
this._deviceItems = {};
|
||||||
@ -50,11 +50,11 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
|||||||
throw new Error('Too few devices for a selection');
|
throw new Error('Too few devices for a selection');
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildLayout: function(devices) {
|
_buildLayout(devices) {
|
||||||
let title = new St.Label({ style_class: 'audio-selection-title',
|
let title = new St.Label({ style_class: 'audio-selection-title',
|
||||||
text: _("Select Audio Device"),
|
text: _("Select Audio Device"),
|
||||||
x_align: Clutter.ActorAlign.CENTER });
|
x_align: Clutter.ActorAlign.CENTER });
|
||||||
@ -72,7 +72,7 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
|||||||
key: Clutter.Escape });
|
key: Clutter.Escape });
|
||||||
},
|
},
|
||||||
|
|
||||||
_getDeviceLabel: function(device) {
|
_getDeviceLabel(device) {
|
||||||
switch(device) {
|
switch(device) {
|
||||||
case AudioDevice.HEADPHONES:
|
case AudioDevice.HEADPHONES:
|
||||||
return _("Headphones");
|
return _("Headphones");
|
||||||
@ -85,7 +85,7 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getDeviceIcon: function(device) {
|
_getDeviceIcon(device) {
|
||||||
switch(device) {
|
switch(device) {
|
||||||
case AudioDevice.HEADPHONES:
|
case AudioDevice.HEADPHONES:
|
||||||
return 'audio-headphones-symbolic';
|
return 'audio-headphones-symbolic';
|
||||||
@ -98,7 +98,7 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_addDevice: function(device) {
|
_addDevice(device) {
|
||||||
let box = new St.BoxLayout({ style_class: 'audio-selection-device-box',
|
let box = new St.BoxLayout({ style_class: 'audio-selection-device-box',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
box.connect('notify::height',
|
box.connect('notify::height',
|
||||||
@ -131,7 +131,7 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_openSettings: function() {
|
_openSettings() {
|
||||||
let desktopFile = 'gnome-sound-panel.desktop'
|
let desktopFile = 'gnome-sound-panel.desktop'
|
||||||
let app = Shell.AppSystem.get_default().lookup_app(desktopFile);
|
let app = Shell.AppSystem.get_default().lookup_app(desktopFile);
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ var AudioDeviceSelectionDialog = new Lang.Class({
|
|||||||
var AudioDeviceSelectionDBus = new Lang.Class({
|
var AudioDeviceSelectionDBus = new Lang.Class({
|
||||||
Name: 'AudioDeviceSelectionDBus',
|
Name: 'AudioDeviceSelectionDBus',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._audioSelectionDialog = null;
|
this._audioSelectionDialog = null;
|
||||||
|
|
||||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(AudioDeviceSelectionIface, this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(AudioDeviceSelectionIface, this);
|
||||||
@ -158,11 +158,11 @@ var AudioDeviceSelectionDBus = new Lang.Class({
|
|||||||
Gio.DBus.session.own_name('org.gnome.Shell.AudioDeviceSelection', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
Gio.DBus.session.own_name('org.gnome.Shell.AudioDeviceSelection', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDialogClosed: function() {
|
_onDialogClosed() {
|
||||||
this._audioSelectionDialog = null;
|
this._audioSelectionDialog = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDeviceSelected: function(dialog, device) {
|
_onDeviceSelected(dialog, device) {
|
||||||
let connection = this._dbusImpl.get_connection();
|
let connection = this._dbusImpl.get_connection();
|
||||||
let info = this._dbusImpl.get_info();
|
let info = this._dbusImpl.get_info();
|
||||||
let deviceName = Object.keys(AudioDevice).filter(
|
let deviceName = Object.keys(AudioDevice).filter(
|
||||||
@ -176,7 +176,7 @@ var AudioDeviceSelectionDBus = new Lang.Class({
|
|||||||
GLib.Variant.new('(s)', [deviceName]));
|
GLib.Variant.new('(s)', [deviceName]));
|
||||||
},
|
},
|
||||||
|
|
||||||
OpenAsync: function(params, invocation) {
|
OpenAsync(params, invocation) {
|
||||||
if (this._audioSelectionDialog) {
|
if (this._audioSelectionDialog) {
|
||||||
invocation.return_value(null);
|
invocation.return_value(null);
|
||||||
return;
|
return;
|
||||||
@ -206,7 +206,7 @@ var AudioDeviceSelectionDBus = new Lang.Class({
|
|||||||
invocation.return_value(null);
|
invocation.return_value(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
CloseAsync: function(params, invocation) {
|
CloseAsync(params, invocation) {
|
||||||
if (this._audioSelectionDialog &&
|
if (this._audioSelectionDialog &&
|
||||||
this._audioSelectionDialog._sender == invocation.get_sender())
|
this._audioSelectionDialog._sender == invocation.get_sender())
|
||||||
this._audioSelectionDialog.close();
|
this._audioSelectionDialog.close();
|
||||||
|
@ -141,13 +141,13 @@ function _fileEqual0(file1, file2) {
|
|||||||
var BackgroundCache = new Lang.Class({
|
var BackgroundCache = new Lang.Class({
|
||||||
Name: 'BackgroundCache',
|
Name: 'BackgroundCache',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._fileMonitors = {};
|
this._fileMonitors = {};
|
||||||
this._backgroundSources = {};
|
this._backgroundSources = {};
|
||||||
this._animations = {};
|
this._animations = {};
|
||||||
},
|
},
|
||||||
|
|
||||||
monitorFile: function(file) {
|
monitorFile(file) {
|
||||||
let key = file.hash();
|
let key = file.hash();
|
||||||
if (this._fileMonitors[key])
|
if (this._fileMonitors[key])
|
||||||
return;
|
return;
|
||||||
@ -165,7 +165,7 @@ var BackgroundCache = new Lang.Class({
|
|||||||
this._fileMonitors[key] = monitor;
|
this._fileMonitors[key] = monitor;
|
||||||
},
|
},
|
||||||
|
|
||||||
getAnimation: function(params) {
|
getAnimation(params) {
|
||||||
params = Params.parse(params, { file: null,
|
params = Params.parse(params, { file: null,
|
||||||
settingsSchema: null,
|
settingsSchema: null,
|
||||||
onLoaded: null });
|
onLoaded: null });
|
||||||
@ -197,7 +197,7 @@ var BackgroundCache = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
getBackgroundSource: function(layoutManager, settingsSchema) {
|
getBackgroundSource(layoutManager, settingsSchema) {
|
||||||
// The layoutManager is always the same one; we pass in it since
|
// The layoutManager is always the same one; we pass in it since
|
||||||
// Main.layoutManager may not be set yet
|
// Main.layoutManager may not be set yet
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ var BackgroundCache = new Lang.Class({
|
|||||||
return this._backgroundSources[settingsSchema];
|
return this._backgroundSources[settingsSchema];
|
||||||
},
|
},
|
||||||
|
|
||||||
releaseBackgroundSource: function(settingsSchema) {
|
releaseBackgroundSource(settingsSchema) {
|
||||||
if (settingsSchema in this._backgroundSources) {
|
if (settingsSchema in this._backgroundSources) {
|
||||||
let source = this._backgroundSources[settingsSchema];
|
let source = this._backgroundSources[settingsSchema];
|
||||||
source._useCount--;
|
source._useCount--;
|
||||||
@ -233,7 +233,7 @@ function getBackgroundCache() {
|
|||||||
var Background = new Lang.Class({
|
var Background = new Lang.Class({
|
||||||
Name: 'Background',
|
Name: 'Background',
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
params = Params.parse(params, { monitorIndex: 0,
|
params = Params.parse(params, { monitorIndex: 0,
|
||||||
layoutManager: Main.layoutManager,
|
layoutManager: Main.layoutManager,
|
||||||
settings: null,
|
settings: null,
|
||||||
@ -274,7 +274,7 @@ var Background = new Lang.Class({
|
|||||||
this._load();
|
this._load();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this._cancellable.cancel();
|
this._cancellable.cancel();
|
||||||
this._removeAnimationTimeout();
|
this._removeAnimationTimeout();
|
||||||
|
|
||||||
@ -300,12 +300,12 @@ var Background = new Lang.Class({
|
|||||||
this._settingsChangedSignalId = 0;
|
this._settingsChangedSignalId = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
updateResolution: function() {
|
updateResolution() {
|
||||||
if (this._animation)
|
if (this._animation)
|
||||||
this._refreshAnimation();
|
this._refreshAnimation();
|
||||||
},
|
},
|
||||||
|
|
||||||
_refreshAnimation: function() {
|
_refreshAnimation() {
|
||||||
if (!this._animation)
|
if (!this._animation)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ var Background = new Lang.Class({
|
|||||||
this._updateAnimation();
|
this._updateAnimation();
|
||||||
},
|
},
|
||||||
|
|
||||||
_setLoaded: function() {
|
_setLoaded() {
|
||||||
if (this.isLoaded)
|
if (this.isLoaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ var Background = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(id, '[gnome-shell] this.emit');
|
GLib.Source.set_name_by_id(id, '[gnome-shell] this.emit');
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadPattern: function() {
|
_loadPattern() {
|
||||||
let colorString, res, color, secondColor;
|
let colorString, res, color, secondColor;
|
||||||
|
|
||||||
colorString = this._settings.get_string(PRIMARY_COLOR_KEY);
|
colorString = this._settings.get_string(PRIMARY_COLOR_KEY);
|
||||||
@ -342,7 +342,7 @@ var Background = new Lang.Class({
|
|||||||
this.background.set_gradient(shadingType, color, secondColor);
|
this.background.set_gradient(shadingType, color, secondColor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_watchFile: function(file) {
|
_watchFile(file) {
|
||||||
let key = file.hash();
|
let key = file.hash();
|
||||||
if (this._fileWatches[key])
|
if (this._fileWatches[key])
|
||||||
return;
|
return;
|
||||||
@ -359,14 +359,14 @@ var Background = new Lang.Class({
|
|||||||
this._fileWatches[key] = signalId;
|
this._fileWatches[key] = signalId;
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeAnimationTimeout: function() {
|
_removeAnimationTimeout() {
|
||||||
if (this._updateAnimationTimeoutId) {
|
if (this._updateAnimationTimeoutId) {
|
||||||
GLib.source_remove(this._updateAnimationTimeoutId);
|
GLib.source_remove(this._updateAnimationTimeoutId);
|
||||||
this._updateAnimationTimeoutId = 0;
|
this._updateAnimationTimeoutId = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateAnimation: function() {
|
_updateAnimation() {
|
||||||
this._updateAnimationTimeoutId = 0;
|
this._updateAnimationTimeoutId = 0;
|
||||||
|
|
||||||
this._animation.update(this._layoutManager.monitors[this._monitorIndex]);
|
this._animation.update(this._layoutManager.monitors[this._monitorIndex]);
|
||||||
@ -407,7 +407,7 @@ var Background = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_queueUpdateAnimation: function() {
|
_queueUpdateAnimation() {
|
||||||
if (this._updateAnimationTimeoutId != 0)
|
if (this._updateAnimationTimeoutId != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -436,7 +436,7 @@ var Background = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._updateAnimationTimeoutId, '[gnome-shell] this._updateAnimation');
|
GLib.Source.set_name_by_id(this._updateAnimationTimeoutId, '[gnome-shell] this._updateAnimation');
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadAnimation: function(file) {
|
_loadAnimation(file) {
|
||||||
this._cache.getAnimation({ file: file,
|
this._cache.getAnimation({ file: file,
|
||||||
settingsSchema: this._settings.schema_id,
|
settingsSchema: this._settings.schema_id,
|
||||||
onLoaded: Lang.bind(this, function(animation) {
|
onLoaded: Lang.bind(this, function(animation) {
|
||||||
@ -453,7 +453,7 @@ var Background = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadImage: function(file) {
|
_loadImage(file) {
|
||||||
this.background.set_file(file, this._style);
|
this.background.set_file(file, this._style);
|
||||||
this._watchFile(file);
|
this._watchFile(file);
|
||||||
|
|
||||||
@ -470,14 +470,14 @@ var Background = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadFile: function(file) {
|
_loadFile(file) {
|
||||||
if (file.get_basename().endsWith('.xml'))
|
if (file.get_basename().endsWith('.xml'))
|
||||||
this._loadAnimation(file);
|
this._loadAnimation(file);
|
||||||
else
|
else
|
||||||
this._loadImage(file);
|
this._loadImage(file);
|
||||||
},
|
},
|
||||||
|
|
||||||
_load: function () {
|
_load() {
|
||||||
this._cache = getBackgroundCache();
|
this._cache = getBackgroundCache();
|
||||||
|
|
||||||
this._loadPattern();
|
this._loadPattern();
|
||||||
@ -497,7 +497,7 @@ let _systemBackground;
|
|||||||
var SystemBackground = new Lang.Class({
|
var SystemBackground = new Lang.Class({
|
||||||
Name: 'SystemBackground',
|
Name: 'SystemBackground',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/noise-texture.png');
|
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/noise-texture.png');
|
||||||
|
|
||||||
if (_systemBackground == null) {
|
if (_systemBackground == null) {
|
||||||
@ -534,7 +534,7 @@ Signals.addSignalMethods(SystemBackground.prototype);
|
|||||||
var BackgroundSource = new Lang.Class({
|
var BackgroundSource = new Lang.Class({
|
||||||
Name: 'BackgroundSource',
|
Name: 'BackgroundSource',
|
||||||
|
|
||||||
_init: function(layoutManager, settingsSchema) {
|
_init(layoutManager, settingsSchema) {
|
||||||
// Allow override the background image setting for performance testing
|
// Allow override the background image setting for performance testing
|
||||||
this._layoutManager = layoutManager;
|
this._layoutManager = layoutManager;
|
||||||
this._overrideImage = GLib.getenv('SHELL_BACKGROUND_IMAGE');
|
this._overrideImage = GLib.getenv('SHELL_BACKGROUND_IMAGE');
|
||||||
@ -545,7 +545,7 @@ var BackgroundSource = new Lang.Class({
|
|||||||
Lang.bind(this, this._onMonitorsChanged));
|
Lang.bind(this, this._onMonitorsChanged));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMonitorsChanged: function() {
|
_onMonitorsChanged() {
|
||||||
for (let monitorIndex in this._backgrounds) {
|
for (let monitorIndex in this._backgrounds) {
|
||||||
let background = this._backgrounds[monitorIndex];
|
let background = this._backgrounds[monitorIndex];
|
||||||
|
|
||||||
@ -559,7 +559,7 @@ var BackgroundSource = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getBackground: function(monitorIndex) {
|
getBackground(monitorIndex) {
|
||||||
let file = null;
|
let file = null;
|
||||||
let style;
|
let style;
|
||||||
|
|
||||||
@ -606,7 +606,7 @@ var BackgroundSource = new Lang.Class({
|
|||||||
return this._backgrounds[monitorIndex];
|
return this._backgrounds[monitorIndex];
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
global.screen.disconnect(this._monitorsChangedId);
|
global.screen.disconnect(this._monitorsChangedId);
|
||||||
|
|
||||||
for (let monitorIndex in this._backgrounds) {
|
for (let monitorIndex in this._backgrounds) {
|
||||||
@ -622,7 +622,7 @@ var BackgroundSource = new Lang.Class({
|
|||||||
var Animation = new Lang.Class({
|
var Animation = new Lang.Class({
|
||||||
Name: 'Animation',
|
Name: 'Animation',
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
params = Params.parse(params, { file: null });
|
params = Params.parse(params, { file: null });
|
||||||
|
|
||||||
this.file = params.file;
|
this.file = params.file;
|
||||||
@ -632,7 +632,7 @@ var Animation = new Lang.Class({
|
|||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
load: function(callback) {
|
load(callback) {
|
||||||
this._show = new GnomeDesktop.BGSlideShow({ filename: this.file.get_path() });
|
this._show = new GnomeDesktop.BGSlideShow({ filename: this.file.get_path() });
|
||||||
|
|
||||||
this._show.load_async(null,
|
this._show.load_async(null,
|
||||||
@ -644,7 +644,7 @@ var Animation = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function(monitor) {
|
update(monitor) {
|
||||||
this.keyFrameFiles = [];
|
this.keyFrameFiles = [];
|
||||||
|
|
||||||
if (!this._show)
|
if (!this._show)
|
||||||
@ -670,7 +670,7 @@ Signals.addSignalMethods(Animation.prototype);
|
|||||||
var BackgroundManager = new Lang.Class({
|
var BackgroundManager = new Lang.Class({
|
||||||
Name: 'BackgroundManager',
|
Name: 'BackgroundManager',
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
params = Params.parse(params, { container: null,
|
params = Params.parse(params, { container: null,
|
||||||
layoutManager: Main.layoutManager,
|
layoutManager: Main.layoutManager,
|
||||||
monitorIndex: null,
|
monitorIndex: null,
|
||||||
@ -692,7 +692,7 @@ var BackgroundManager = new Lang.Class({
|
|||||||
this._newBackgroundActor = null;
|
this._newBackgroundActor = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
let cache = getBackgroundCache();
|
let cache = getBackgroundCache();
|
||||||
cache.releaseBackgroundSource(this._settingsSchema);
|
cache.releaseBackgroundSource(this._settingsSchema);
|
||||||
this._backgroundSource = null;
|
this._backgroundSource = null;
|
||||||
@ -708,7 +708,7 @@ var BackgroundManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_swapBackgroundActor: function() {
|
_swapBackgroundActor() {
|
||||||
let oldBackgroundActor = this.backgroundActor;
|
let oldBackgroundActor = this.backgroundActor;
|
||||||
this.backgroundActor = this._newBackgroundActor;
|
this.backgroundActor = this._newBackgroundActor;
|
||||||
this._newBackgroundActor = null;
|
this._newBackgroundActor = null;
|
||||||
@ -718,14 +718,14 @@ var BackgroundManager = new Lang.Class({
|
|||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
time: FADE_ANIMATION_TIME,
|
time: FADE_ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
oldBackgroundActor.background.run_dispose();
|
oldBackgroundActor.background.run_dispose();
|
||||||
oldBackgroundActor.destroy();
|
oldBackgroundActor.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateBackgroundActor: function() {
|
_updateBackgroundActor() {
|
||||||
if (this._newBackgroundActor) {
|
if (this._newBackgroundActor) {
|
||||||
/* Skip displaying existing background queued for load */
|
/* Skip displaying existing background queued for load */
|
||||||
this._newBackgroundActor.destroy();
|
this._newBackgroundActor.destroy();
|
||||||
@ -755,7 +755,7 @@ var BackgroundManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_createBackgroundActor: function() {
|
_createBackgroundActor() {
|
||||||
let background = this._backgroundSource.getBackground(this._monitorIndex);
|
let background = this._backgroundSource.getBackground(this._monitorIndex);
|
||||||
let backgroundActor = new Meta.BackgroundActor({ meta_screen: global.screen,
|
let backgroundActor = new Meta.BackgroundActor({ meta_screen: global.screen,
|
||||||
monitor: this._monitorIndex,
|
monitor: this._monitorIndex,
|
||||||
|
@ -13,7 +13,7 @@ var BackgroundMenu = new Lang.Class({
|
|||||||
Name: 'BackgroundMenu',
|
Name: 'BackgroundMenu',
|
||||||
Extends: PopupMenu.PopupMenu,
|
Extends: PopupMenu.PopupMenu,
|
||||||
|
|
||||||
_init: function(layoutManager) {
|
_init(layoutManager) {
|
||||||
this.parent(layoutManager.dummyCursor, 0, St.Side.TOP);
|
this.parent(layoutManager.dummyCursor, 0, St.Side.TOP);
|
||||||
|
|
||||||
this.addSettingsAction(_("Change Background…"), 'gnome-background-panel.desktop');
|
this.addSettingsAction(_("Change Background…"), 'gnome-background-panel.desktop');
|
||||||
|
@ -35,7 +35,7 @@ var POPUP_ANIMATION_TIME = 0.15;
|
|||||||
var BoxPointer = new Lang.Class({
|
var BoxPointer = new Lang.Class({
|
||||||
Name: 'BoxPointer',
|
Name: 'BoxPointer',
|
||||||
|
|
||||||
_init: function(arrowSide, binProperties) {
|
_init(arrowSide, binProperties) {
|
||||||
this._arrowSide = arrowSide;
|
this._arrowSide = arrowSide;
|
||||||
this._userArrowSide = arrowSide;
|
this._userArrowSide = arrowSide;
|
||||||
this._arrowOrigin = 0;
|
this._arrowOrigin = 0;
|
||||||
@ -66,20 +66,20 @@ var BoxPointer = new Lang.Class({
|
|||||||
return this._arrowSide;
|
return this._arrowSide;
|
||||||
},
|
},
|
||||||
|
|
||||||
_muteInput: function() {
|
_muteInput() {
|
||||||
if (this._capturedEventId == 0)
|
if (this._capturedEventId == 0)
|
||||||
this._capturedEventId = this.actor.connect('captured-event',
|
this._capturedEventId = this.actor.connect('captured-event',
|
||||||
function() { return Clutter.EVENT_STOP; });
|
function() { return Clutter.EVENT_STOP; });
|
||||||
},
|
},
|
||||||
|
|
||||||
_unmuteInput: function() {
|
_unmuteInput() {
|
||||||
if (this._capturedEventId != 0) {
|
if (this._capturedEventId != 0) {
|
||||||
this.actor.disconnect(this._capturedEventId);
|
this.actor.disconnect(this._capturedEventId);
|
||||||
this._capturedEventId = 0;
|
this._capturedEventId = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function(animate, onComplete) {
|
show(animate, onComplete) {
|
||||||
let themeNode = this.actor.get_theme_node();
|
let themeNode = this.actor.get_theme_node();
|
||||||
let rise = themeNode.get_length('-arrow-rise');
|
let rise = themeNode.get_length('-arrow-rise');
|
||||||
let animationTime = (animate & PopupAnimation.FULL) ? POPUP_ANIMATION_TIME : 0;
|
let animationTime = (animate & PopupAnimation.FULL) ? POPUP_ANIMATION_TIME : 0;
|
||||||
@ -120,7 +120,7 @@ var BoxPointer = new Lang.Class({
|
|||||||
time: animationTime });
|
time: animationTime });
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function(animate, onComplete) {
|
hide(animate, onComplete) {
|
||||||
if (!this.actor.visible)
|
if (!this.actor.visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ var BoxPointer = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_adjustAllocationForArrow: function(isWidth, alloc) {
|
_adjustAllocationForArrow(isWidth, alloc) {
|
||||||
let themeNode = this.actor.get_theme_node();
|
let themeNode = this.actor.get_theme_node();
|
||||||
let borderWidth = themeNode.get_length('-arrow-border-width');
|
let borderWidth = themeNode.get_length('-arrow-border-width');
|
||||||
alloc.min_size += borderWidth * 2;
|
alloc.min_size += borderWidth * 2;
|
||||||
@ -180,14 +180,14 @@ var BoxPointer = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredWidth: function(actor, forHeight, alloc) {
|
_getPreferredWidth(actor, forHeight, alloc) {
|
||||||
let [minInternalSize, natInternalSize] = this.bin.get_preferred_width(forHeight);
|
let [minInternalSize, natInternalSize] = this.bin.get_preferred_width(forHeight);
|
||||||
alloc.min_size = minInternalSize;
|
alloc.min_size = minInternalSize;
|
||||||
alloc.natural_size = natInternalSize;
|
alloc.natural_size = natInternalSize;
|
||||||
this._adjustAllocationForArrow(true, alloc);
|
this._adjustAllocationForArrow(true, alloc);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredHeight: function(actor, forWidth, alloc) {
|
_getPreferredHeight(actor, forWidth, alloc) {
|
||||||
let themeNode = this.actor.get_theme_node();
|
let themeNode = this.actor.get_theme_node();
|
||||||
let borderWidth = themeNode.get_length('-arrow-border-width');
|
let borderWidth = themeNode.get_length('-arrow-border-width');
|
||||||
let [minSize, naturalSize] = this.bin.get_preferred_height(forWidth - 2 * borderWidth);
|
let [minSize, naturalSize] = this.bin.get_preferred_height(forWidth - 2 * borderWidth);
|
||||||
@ -196,7 +196,7 @@ var BoxPointer = new Lang.Class({
|
|||||||
this._adjustAllocationForArrow(false, alloc);
|
this._adjustAllocationForArrow(false, alloc);
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocate: function(actor, box, flags) {
|
_allocate(actor, box, flags) {
|
||||||
let themeNode = this.actor.get_theme_node();
|
let themeNode = this.actor.get_theme_node();
|
||||||
let borderWidth = themeNode.get_length('-arrow-border-width');
|
let borderWidth = themeNode.get_length('-arrow-border-width');
|
||||||
let rise = themeNode.get_length('-arrow-rise');
|
let rise = themeNode.get_length('-arrow-rise');
|
||||||
@ -236,7 +236,7 @@ var BoxPointer = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_drawBorder: function(area) {
|
_drawBorder(area) {
|
||||||
let themeNode = this.actor.get_theme_node();
|
let themeNode = this.actor.get_theme_node();
|
||||||
|
|
||||||
if (this._arrowActor) {
|
if (this._arrowActor) {
|
||||||
@ -418,7 +418,7 @@ var BoxPointer = new Lang.Class({
|
|||||||
cr.$dispose();
|
cr.$dispose();
|
||||||
},
|
},
|
||||||
|
|
||||||
setPosition: function(sourceActor, alignment) {
|
setPosition(sourceActor, alignment) {
|
||||||
// We need to show it now to force an allocation,
|
// We need to show it now to force an allocation,
|
||||||
// so that we can query the correct size.
|
// so that we can query the correct size.
|
||||||
this.actor.show();
|
this.actor.show();
|
||||||
@ -430,7 +430,7 @@ var BoxPointer = new Lang.Class({
|
|||||||
this._updateFlip();
|
this._updateFlip();
|
||||||
},
|
},
|
||||||
|
|
||||||
setSourceAlignment: function(alignment) {
|
setSourceAlignment(alignment) {
|
||||||
this._sourceAlignment = alignment;
|
this._sourceAlignment = alignment;
|
||||||
|
|
||||||
if (!this._sourceActor)
|
if (!this._sourceActor)
|
||||||
@ -439,7 +439,7 @@ var BoxPointer = new Lang.Class({
|
|||||||
this.setPosition(this._sourceActor, this._arrowAlignment);
|
this.setPosition(this._sourceActor, this._arrowAlignment);
|
||||||
},
|
},
|
||||||
|
|
||||||
_reposition: function() {
|
_reposition() {
|
||||||
let sourceActor = this._sourceActor;
|
let sourceActor = this._sourceActor;
|
||||||
let alignment = this._arrowAlignment;
|
let alignment = this._arrowAlignment;
|
||||||
|
|
||||||
@ -556,7 +556,7 @@ var BoxPointer = new Lang.Class({
|
|||||||
// @origin: Coordinate specifying middle of the arrow, along
|
// @origin: Coordinate specifying middle of the arrow, along
|
||||||
// the Y axis for St.Side.LEFT, St.Side.RIGHT from the top and X axis from
|
// the Y axis for St.Side.LEFT, St.Side.RIGHT from the top and X axis from
|
||||||
// the left for St.Side.TOP and St.Side.BOTTOM.
|
// the left for St.Side.TOP and St.Side.BOTTOM.
|
||||||
setArrowOrigin: function(origin) {
|
setArrowOrigin(origin) {
|
||||||
if (this._arrowOrigin != origin) {
|
if (this._arrowOrigin != origin) {
|
||||||
this._arrowOrigin = origin;
|
this._arrowOrigin = origin;
|
||||||
this._border.queue_repaint();
|
this._border.queue_repaint();
|
||||||
@ -566,14 +566,14 @@ var BoxPointer = new Lang.Class({
|
|||||||
// @actor: an actor relative to which the arrow is positioned.
|
// @actor: an actor relative to which the arrow is positioned.
|
||||||
// Differently from setPosition, this will not move the boxpointer itself,
|
// Differently from setPosition, this will not move the boxpointer itself,
|
||||||
// on the arrow
|
// on the arrow
|
||||||
setArrowActor: function(actor) {
|
setArrowActor(actor) {
|
||||||
if (this._arrowActor != actor) {
|
if (this._arrowActor != actor) {
|
||||||
this._arrowActor = actor;
|
this._arrowActor = actor;
|
||||||
this._border.queue_repaint();
|
this._border.queue_repaint();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_shiftActor : function() {
|
_shiftActor() {
|
||||||
// Since the position of the BoxPointer depends on the allocated size
|
// Since the position of the BoxPointer depends on the allocated size
|
||||||
// of the BoxPointer and the position of the source actor, trying
|
// of the BoxPointer and the position of the source actor, trying
|
||||||
// to position the BoxPointer via the x/y properties will result in
|
// to position the BoxPointer via the x/y properties will result in
|
||||||
@ -584,7 +584,7 @@ var BoxPointer = new Lang.Class({
|
|||||||
-(this._yPosition + this._yOffset));
|
-(this._yPosition + this._yOffset));
|
||||||
},
|
},
|
||||||
|
|
||||||
_calculateArrowSide: function(arrowSide) {
|
_calculateArrowSide(arrowSide) {
|
||||||
let sourceAllocation = Shell.util_get_transformed_allocation(this._sourceActor);
|
let sourceAllocation = Shell.util_get_transformed_allocation(this._sourceActor);
|
||||||
let [minWidth, minHeight, boxWidth, boxHeight] = this._container.get_preferred_size();
|
let [minWidth, minHeight, boxWidth, boxHeight] = this._container.get_preferred_size();
|
||||||
let monitorActor = this.sourceActor;
|
let monitorActor = this.sourceActor;
|
||||||
@ -618,7 +618,7 @@ var BoxPointer = new Lang.Class({
|
|||||||
return arrowSide;
|
return arrowSide;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateFlip: function() {
|
_updateFlip() {
|
||||||
let arrowSide = this._calculateArrowSide(this._userArrowSide);
|
let arrowSide = this._calculateArrowSide(this._userArrowSide);
|
||||||
if (this._arrowSide != arrowSide) {
|
if (this._arrowSide != arrowSide) {
|
||||||
this._arrowSide = arrowSide;
|
this._arrowSide = arrowSide;
|
||||||
@ -658,18 +658,18 @@ var BoxPointer = new Lang.Class({
|
|||||||
return this.actor.opacity;
|
return this.actor.opacity;
|
||||||
},
|
},
|
||||||
|
|
||||||
updateArrowSide: function(side) {
|
updateArrowSide(side) {
|
||||||
this._arrowSide = side;
|
this._arrowSide = side;
|
||||||
this._border.queue_repaint();
|
this._border.queue_repaint();
|
||||||
|
|
||||||
this.emit('arrow-side-changed');
|
this.emit('arrow-side-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
getPadding: function(side) {
|
getPadding(side) {
|
||||||
return this.bin.get_theme_node().get_padding(side);
|
return this.bin.get_theme_node().get_padding(side);
|
||||||
},
|
},
|
||||||
|
|
||||||
getArrowHeight: function() {
|
getArrowHeight() {
|
||||||
return this.actor.get_theme_node().get_length('-arrow-rise');
|
return this.actor.get_theme_node().get_length('-arrow-rise');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -92,7 +92,7 @@ function _getCalendarDayAbbreviation(dayNumber) {
|
|||||||
var CalendarEvent = new Lang.Class({
|
var CalendarEvent = new Lang.Class({
|
||||||
Name: 'CalendarEvent',
|
Name: 'CalendarEvent',
|
||||||
|
|
||||||
_init: function(id, date, end, summary, allDay) {
|
_init(id, date, end, summary, allDay) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.date = date;
|
this.date = date;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
@ -108,27 +108,27 @@ var CalendarEvent = new Lang.Class({
|
|||||||
var EmptyEventSource = new Lang.Class({
|
var EmptyEventSource = new Lang.Class({
|
||||||
Name: 'EmptyEventSource',
|
Name: 'EmptyEventSource',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.isDummy = true;
|
this.isDummy = true;
|
||||||
this.hasCalendars = false;
|
this.hasCalendars = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
},
|
},
|
||||||
|
|
||||||
ignoreEvent: function(event) {
|
ignoreEvent(event) {
|
||||||
},
|
},
|
||||||
|
|
||||||
requestRange: function(begin, end) {
|
requestRange(begin, end) {
|
||||||
},
|
},
|
||||||
|
|
||||||
getEvents: function(begin, end) {
|
getEvents(begin, end) {
|
||||||
let result = [];
|
let result = [];
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
hasEvents: function(day) {
|
hasEvents(day) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -179,7 +179,7 @@ function _dateIntervalsOverlap(a0, a1, b0, b1)
|
|||||||
var DBusEventSource = new Lang.Class({
|
var DBusEventSource = new Lang.Class({
|
||||||
Name: 'DBusEventSource',
|
Name: 'DBusEventSource',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._resetCache();
|
this._resetCache();
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.isDummy = false;
|
this.isDummy = false;
|
||||||
@ -237,7 +237,7 @@ var DBusEventSource = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this._dbusProxy.run_dispose();
|
this._dbusProxy.run_dispose();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -248,28 +248,28 @@ var DBusEventSource = new Lang.Class({
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_resetCache: function() {
|
_resetCache() {
|
||||||
this._events = [];
|
this._events = [];
|
||||||
this._lastRequestBegin = null;
|
this._lastRequestBegin = null;
|
||||||
this._lastRequestEnd = null;
|
this._lastRequestEnd = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNameAppeared: function(owner) {
|
_onNameAppeared(owner) {
|
||||||
this._initialized = true;
|
this._initialized = true;
|
||||||
this._resetCache();
|
this._resetCache();
|
||||||
this._loadEvents(true);
|
this._loadEvents(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNameVanished: function(oldOwner) {
|
_onNameVanished(oldOwner) {
|
||||||
this._resetCache();
|
this._resetCache();
|
||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onChanged: function() {
|
_onChanged() {
|
||||||
this._loadEvents(false);
|
this._loadEvents(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEventsReceived: function(results, error) {
|
_onEventsReceived(results, error) {
|
||||||
let newEvents = [];
|
let newEvents = [];
|
||||||
let appointments = results ? results[0] : null;
|
let appointments = results ? results[0] : null;
|
||||||
if (appointments != null) {
|
if (appointments != null) {
|
||||||
@ -293,7 +293,7 @@ var DBusEventSource = new Lang.Class({
|
|||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadEvents: function(forceReload) {
|
_loadEvents(forceReload) {
|
||||||
// Ignore while loading
|
// Ignore while loading
|
||||||
if (!this._initialized)
|
if (!this._initialized)
|
||||||
return;
|
return;
|
||||||
@ -307,7 +307,7 @@ var DBusEventSource = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
ignoreEvent: function(event) {
|
ignoreEvent(event) {
|
||||||
if (this._ignoredEvents.get(event.id))
|
if (this._ignoredEvents.get(event.id))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ var DBusEventSource = new Lang.Class({
|
|||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
requestRange: function(begin, end) {
|
requestRange(begin, end) {
|
||||||
if (!(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, this._lastRequestEnd))) {
|
if (!(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, this._lastRequestEnd))) {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this._lastRequestBegin = begin;
|
this._lastRequestBegin = begin;
|
||||||
@ -328,7 +328,7 @@ var DBusEventSource = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getEvents: function(begin, end) {
|
getEvents(begin, end) {
|
||||||
let result = [];
|
let result = [];
|
||||||
for(let n = 0; n < this._events.length; n++) {
|
for(let n = 0; n < this._events.length; n++) {
|
||||||
let event = this._events[n];
|
let event = this._events[n];
|
||||||
@ -349,7 +349,7 @@ var DBusEventSource = new Lang.Class({
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
hasEvents: function(day) {
|
hasEvents(day) {
|
||||||
let dayBegin = _getBeginningOfDay(day);
|
let dayBegin = _getBeginningOfDay(day);
|
||||||
let dayEnd = _getEndOfDay(day);
|
let dayEnd = _getEndOfDay(day);
|
||||||
|
|
||||||
@ -366,7 +366,7 @@ Signals.addSignalMethods(DBusEventSource.prototype);
|
|||||||
var Calendar = new Lang.Class({
|
var Calendar = new Lang.Class({
|
||||||
Name: 'Calendar',
|
Name: 'Calendar',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._weekStart = Shell.util_get_week_start();
|
this._weekStart = Shell.util_get_week_start();
|
||||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.calendar' });
|
this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.calendar' });
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ var Calendar = new Lang.Class({
|
|||||||
|
|
||||||
// @eventSource: is an object implementing the EventSource API, e.g. the
|
// @eventSource: is an object implementing the EventSource API, e.g. the
|
||||||
// requestRange(), getEvents(), hasEvents() methods and the ::changed signal.
|
// requestRange(), getEvents(), hasEvents() methods and the ::changed signal.
|
||||||
setEventSource: function(eventSource) {
|
setEventSource(eventSource) {
|
||||||
this._eventSource = eventSource;
|
this._eventSource = eventSource;
|
||||||
this._eventSource.connect('changed', Lang.bind(this, function() {
|
this._eventSource.connect('changed', Lang.bind(this, function() {
|
||||||
this._rebuildCalendar();
|
this._rebuildCalendar();
|
||||||
@ -419,7 +419,7 @@ var Calendar = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Sets the calendar to show a specific date
|
// Sets the calendar to show a specific date
|
||||||
setDate: function(date) {
|
setDate(date) {
|
||||||
if (sameDay(date, this._selectedDate))
|
if (sameDay(date, this._selectedDate))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -428,14 +428,14 @@ var Calendar = new Lang.Class({
|
|||||||
this.emit('selected-date-changed', new Date(this._selectedDate));
|
this.emit('selected-date-changed', new Date(this._selectedDate));
|
||||||
},
|
},
|
||||||
|
|
||||||
updateTimeZone: function() {
|
updateTimeZone() {
|
||||||
// The calendar need to be rebuilt after a time zone update because
|
// The calendar need to be rebuilt after a time zone update because
|
||||||
// the date might have changed.
|
// the date might have changed.
|
||||||
this._rebuildCalendar();
|
this._rebuildCalendar();
|
||||||
this._update();
|
this._update();
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildHeader: function() {
|
_buildHeader() {
|
||||||
let layout = this.actor.layout_manager;
|
let layout = this.actor.layout_manager;
|
||||||
let offsetCols = this._useWeekdate ? 1 : 0;
|
let offsetCols = this._useWeekdate ? 1 : 0;
|
||||||
this.actor.destroy_all_children();
|
this.actor.destroy_all_children();
|
||||||
@ -490,7 +490,7 @@ var Calendar = new Lang.Class({
|
|||||||
this._firstDayIndex = this.actor.get_n_children();
|
this._firstDayIndex = this.actor.get_n_children();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onScroll : function(actor, event) {
|
_onScroll(actor, event) {
|
||||||
switch (event.get_scroll_direction()) {
|
switch (event.get_scroll_direction()) {
|
||||||
case Clutter.ScrollDirection.UP:
|
case Clutter.ScrollDirection.UP:
|
||||||
case Clutter.ScrollDirection.LEFT:
|
case Clutter.ScrollDirection.LEFT:
|
||||||
@ -504,7 +504,7 @@ var Calendar = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPrevMonthButtonClicked: function() {
|
_onPrevMonthButtonClicked() {
|
||||||
let newDate = new Date(this._selectedDate);
|
let newDate = new Date(this._selectedDate);
|
||||||
let oldMonth = newDate.getMonth();
|
let oldMonth = newDate.getMonth();
|
||||||
if (oldMonth == 0) {
|
if (oldMonth == 0) {
|
||||||
@ -528,7 +528,7 @@ var Calendar = new Lang.Class({
|
|||||||
this.setDate(newDate);
|
this.setDate(newDate);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNextMonthButtonClicked: function() {
|
_onNextMonthButtonClicked() {
|
||||||
let newDate = new Date(this._selectedDate);
|
let newDate = new Date(this._selectedDate);
|
||||||
let oldMonth = newDate.getMonth();
|
let oldMonth = newDate.getMonth();
|
||||||
if (oldMonth == 11) {
|
if (oldMonth == 11) {
|
||||||
@ -552,14 +552,14 @@ var Calendar = new Lang.Class({
|
|||||||
this.setDate(newDate);
|
this.setDate(newDate);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSettingsChange: function() {
|
_onSettingsChange() {
|
||||||
this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY);
|
this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY);
|
||||||
this._buildHeader();
|
this._buildHeader();
|
||||||
this._rebuildCalendar();
|
this._rebuildCalendar();
|
||||||
this._update();
|
this._update();
|
||||||
},
|
},
|
||||||
|
|
||||||
_rebuildCalendar: function() {
|
_rebuildCalendar() {
|
||||||
let now = new Date();
|
let now = new Date();
|
||||||
|
|
||||||
// Remove everything but the topBox and the weekday labels
|
// Remove everything but the topBox and the weekday labels
|
||||||
@ -680,7 +680,7 @@ var Calendar = new Lang.Class({
|
|||||||
this._eventSource.requestRange(beginDate, iter);
|
this._eventSource.requestRange(beginDate, iter);
|
||||||
},
|
},
|
||||||
|
|
||||||
_update: function() {
|
_update() {
|
||||||
let now = new Date();
|
let now = new Date();
|
||||||
|
|
||||||
if (sameYear(this._selectedDate, now))
|
if (sameYear(this._selectedDate, now))
|
||||||
@ -708,7 +708,7 @@ var EventMessage = new Lang.Class({
|
|||||||
Name: 'EventMessage',
|
Name: 'EventMessage',
|
||||||
Extends: MessageList.Message,
|
Extends: MessageList.Message,
|
||||||
|
|
||||||
_init: function(event, date) {
|
_init(event, date) {
|
||||||
this._event = event;
|
this._event = event;
|
||||||
this._date = date;
|
this._date = date;
|
||||||
|
|
||||||
@ -723,7 +723,7 @@ var EventMessage = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_formatEventTime: function() {
|
_formatEventTime() {
|
||||||
let periodBegin = _getBeginningOfDay(this._date);
|
let periodBegin = _getBeginningOfDay(this._date);
|
||||||
let periodEnd = _getEndOfDay(this._date);
|
let periodEnd = _getEndOfDay(this._date);
|
||||||
let allDay = (this._event.allDay || (this._event.date <= periodBegin &&
|
let allDay = (this._event.allDay || (this._event.date <= periodBegin &&
|
||||||
@ -756,7 +756,7 @@ var EventMessage = new Lang.Class({
|
|||||||
return title;
|
return title;
|
||||||
},
|
},
|
||||||
|
|
||||||
canClose: function() {
|
canClose() {
|
||||||
return isToday(this._date);
|
return isToday(this._date);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -765,7 +765,7 @@ var NotificationMessage = new Lang.Class({
|
|||||||
Name: 'NotificationMessage',
|
Name: 'NotificationMessage',
|
||||||
Extends: MessageList.Message,
|
Extends: MessageList.Message,
|
||||||
|
|
||||||
_init: function(notification) {
|
_init(notification) {
|
||||||
this.notification = notification;
|
this.notification = notification;
|
||||||
|
|
||||||
this.parent(notification.title, notification.bannerBodyText);
|
this.parent(notification.title, notification.bannerBodyText);
|
||||||
@ -787,7 +787,7 @@ var NotificationMessage = new Lang.Class({
|
|||||||
Lang.bind(this, this._onUpdated));
|
Lang.bind(this, this._onUpdated));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getIcon: function() {
|
_getIcon() {
|
||||||
if (this.notification.gicon)
|
if (this.notification.gicon)
|
||||||
return new St.Icon({ gicon: this.notification.gicon,
|
return new St.Icon({ gicon: this.notification.gicon,
|
||||||
icon_size: MESSAGE_ICON_SIZE });
|
icon_size: MESSAGE_ICON_SIZE });
|
||||||
@ -795,18 +795,18 @@ var NotificationMessage = new Lang.Class({
|
|||||||
return this.notification.source.createIcon(MESSAGE_ICON_SIZE);
|
return this.notification.source.createIcon(MESSAGE_ICON_SIZE);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUpdated: function(n, clear) {
|
_onUpdated(n, clear) {
|
||||||
this.setIcon(this._getIcon());
|
this.setIcon(this._getIcon());
|
||||||
this.setTitle(n.title);
|
this.setTitle(n.title);
|
||||||
this.setBody(n.bannerBodyText);
|
this.setBody(n.bannerBodyText);
|
||||||
this.setUseBodyMarkup(n.bannerBodyMarkup);
|
this.setUseBodyMarkup(n.bannerBodyMarkup);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onClicked: function() {
|
_onClicked() {
|
||||||
this.notification.activate();
|
this.notification.activate();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
if (this._updatedId)
|
if (this._updatedId)
|
||||||
this.notification.disconnect(this._updatedId);
|
this.notification.disconnect(this._updatedId);
|
||||||
this._updatedId = 0;
|
this._updatedId = 0;
|
||||||
@ -821,7 +821,7 @@ var EventsSection = new Lang.Class({
|
|||||||
Name: 'EventsSection',
|
Name: 'EventsSection',
|
||||||
Extends: MessageList.MessageListSection,
|
Extends: MessageList.MessageListSection,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
|
this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
|
||||||
this._desktopSettings.connect('changed', Lang.bind(this, this._reloadEvents));
|
this._desktopSettings.connect('changed', Lang.bind(this, this._reloadEvents));
|
||||||
this._eventSource = new EmptyEventSource();
|
this._eventSource = new EmptyEventSource();
|
||||||
@ -842,11 +842,11 @@ var EventsSection = new Lang.Class({
|
|||||||
this._appInstalledChanged();
|
this._appInstalledChanged();
|
||||||
},
|
},
|
||||||
|
|
||||||
_ignoreEvent: function(event) {
|
_ignoreEvent(event) {
|
||||||
this._eventSource.ignoreEvent(event);
|
this._eventSource.ignoreEvent(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
setEventSource: function(eventSource) {
|
setEventSource(eventSource) {
|
||||||
this._eventSource = eventSource;
|
this._eventSource = eventSource;
|
||||||
this._eventSource.connect('changed', Lang.bind(this, this._reloadEvents));
|
this._eventSource.connect('changed', Lang.bind(this, this._reloadEvents));
|
||||||
},
|
},
|
||||||
@ -855,7 +855,7 @@ var EventsSection = new Lang.Class({
|
|||||||
return Main.sessionMode.showCalendarEvents;
|
return Main.sessionMode.showCalendarEvents;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateTitle: function() {
|
_updateTitle() {
|
||||||
this._title.visible = !isToday(this._date);
|
this._title.visible = !isToday(this._date);
|
||||||
|
|
||||||
if (!this._title.visible)
|
if (!this._title.visible)
|
||||||
@ -874,7 +874,7 @@ var EventsSection = new Lang.Class({
|
|||||||
this._title.label = this._date.toLocaleFormat(dayFormat);
|
this._title.label = this._date.toLocaleFormat(dayFormat);
|
||||||
},
|
},
|
||||||
|
|
||||||
_reloadEvents: function() {
|
_reloadEvents() {
|
||||||
if (this._eventSource.isLoading)
|
if (this._eventSource.isLoading)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -900,12 +900,12 @@ var EventsSection = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_appInstalledChanged: function() {
|
_appInstalledChanged() {
|
||||||
this._calendarApp = undefined;
|
this._calendarApp = undefined;
|
||||||
this._title.reactive = (this._getCalendarApp() != null);
|
this._title.reactive = (this._getCalendarApp() != null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getCalendarApp: function() {
|
_getCalendarApp() {
|
||||||
if (this._calendarApp !== undefined)
|
if (this._calendarApp !== undefined)
|
||||||
return this._calendarApp;
|
return this._calendarApp;
|
||||||
|
|
||||||
@ -920,7 +920,7 @@ var EventsSection = new Lang.Class({
|
|||||||
return this._calendarApp;
|
return this._calendarApp;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onTitleClicked: function() {
|
_onTitleClicked() {
|
||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
Main.panel.closeCalendar();
|
Main.panel.closeCalendar();
|
||||||
|
|
||||||
@ -930,17 +930,17 @@ var EventsSection = new Lang.Class({
|
|||||||
app.launch([], global.create_app_launch_context(0, -1));
|
app.launch([], global.create_app_launch_context(0, -1));
|
||||||
},
|
},
|
||||||
|
|
||||||
setDate: function(date) {
|
setDate(date) {
|
||||||
this.parent(date);
|
this.parent(date);
|
||||||
this._updateTitle();
|
this._updateTitle();
|
||||||
this._reloadEvents();
|
this._reloadEvents();
|
||||||
},
|
},
|
||||||
|
|
||||||
_shouldShow: function() {
|
_shouldShow() {
|
||||||
return !this.empty || !isToday(this._date);
|
return !this.empty || !isToday(this._date);
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
if (this._reloading)
|
if (this._reloading)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -952,7 +952,7 @@ var NotificationSection = new Lang.Class({
|
|||||||
Name: 'NotificationSection',
|
Name: 'NotificationSection',
|
||||||
Extends: MessageList.MessageListSection,
|
Extends: MessageList.MessageListSection,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._sources = new Map();
|
this._sources = new Map();
|
||||||
@ -971,7 +971,7 @@ var NotificationSection = new Lang.Class({
|
|||||||
!Main.sessionMode.isGreeter;
|
!Main.sessionMode.isGreeter;
|
||||||
},
|
},
|
||||||
|
|
||||||
_createTimeLabel: function(datetime) {
|
_createTimeLabel(datetime) {
|
||||||
let label = new St.Label({ style_class: 'event-time',
|
let label = new St.Label({ style_class: 'event-time',
|
||||||
x_align: Clutter.ActorAlign.START,
|
x_align: Clutter.ActorAlign.START,
|
||||||
y_align: Clutter.ActorAlign.END });
|
y_align: Clutter.ActorAlign.END });
|
||||||
@ -982,7 +982,7 @@ var NotificationSection = new Lang.Class({
|
|||||||
return label;
|
return label;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sourceAdded: function(tray, source) {
|
_sourceAdded(tray, source) {
|
||||||
let obj = {
|
let obj = {
|
||||||
destroyId: 0,
|
destroyId: 0,
|
||||||
notificationAddedId: 0,
|
notificationAddedId: 0,
|
||||||
@ -997,7 +997,7 @@ var NotificationSection = new Lang.Class({
|
|||||||
this._sources.set(source, obj);
|
this._sources.set(source, obj);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNotificationAdded: function(source, notification) {
|
_onNotificationAdded(source, notification) {
|
||||||
let message = new NotificationMessage(notification);
|
let message = new NotificationMessage(notification);
|
||||||
message.setSecondaryActor(this._createTimeLabel(notification.datetime));
|
message.setSecondaryActor(this._createTimeLabel(notification.datetime));
|
||||||
|
|
||||||
@ -1030,14 +1030,14 @@ var NotificationSection = new Lang.Class({
|
|||||||
this.addMessageAtIndex(message, index, this.actor.mapped);
|
this.addMessageAtIndex(message, index, this.actor.mapped);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSourceDestroy: function(source, obj) {
|
_onSourceDestroy(source, obj) {
|
||||||
source.disconnect(obj.destroyId);
|
source.disconnect(obj.destroyId);
|
||||||
source.disconnect(obj.notificationAddedId);
|
source.disconnect(obj.notificationAddedId);
|
||||||
|
|
||||||
this._sources.delete(source);
|
this._sources.delete(source);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMapped: function() {
|
_onMapped() {
|
||||||
if (!this.actor.mapped)
|
if (!this.actor.mapped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1046,7 +1046,7 @@ var NotificationSection = new Lang.Class({
|
|||||||
message.notification.acknowledged = true;
|
message.notification.acknowledged = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_shouldShow: function() {
|
_shouldShow() {
|
||||||
return !this.empty && isToday(this._date);
|
return !this.empty && isToday(this._date);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1054,7 +1054,7 @@ var NotificationSection = new Lang.Class({
|
|||||||
var Placeholder = new Lang.Class({
|
var Placeholder = new Lang.Class({
|
||||||
Name: 'Placeholder',
|
Name: 'Placeholder',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.BoxLayout({ style_class: 'message-list-placeholder',
|
this.actor = new St.BoxLayout({ style_class: 'message-list-placeholder',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
|
|
||||||
@ -1074,14 +1074,14 @@ var Placeholder = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
setDate: function(date) {
|
setDate(date) {
|
||||||
if (sameDay(this._date, date))
|
if (sameDay(this._date, date))
|
||||||
return;
|
return;
|
||||||
this._date = date;
|
this._date = date;
|
||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let today = isToday(this._date);
|
let today = isToday(this._date);
|
||||||
if (today && this._icon.gicon == this._todayIcon)
|
if (today && this._icon.gicon == this._todayIcon)
|
||||||
return;
|
return;
|
||||||
@ -1101,7 +1101,7 @@ var Placeholder = new Lang.Class({
|
|||||||
var CalendarMessageList = new Lang.Class({
|
var CalendarMessageList = new Lang.Class({
|
||||||
Name: 'CalendarMessageList',
|
Name: 'CalendarMessageList',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.Widget({ style_class: 'message-list',
|
this.actor = new St.Widget({ style_class: 'message-list',
|
||||||
layout_manager: new Clutter.BinLayout(),
|
layout_manager: new Clutter.BinLayout(),
|
||||||
x_expand: true, y_expand: true });
|
x_expand: true, y_expand: true });
|
||||||
@ -1149,7 +1149,7 @@ var CalendarMessageList = new Lang.Class({
|
|||||||
Main.sessionMode.connect('updated', Lang.bind(this, this._sync));
|
Main.sessionMode.connect('updated', Lang.bind(this, this._sync));
|
||||||
},
|
},
|
||||||
|
|
||||||
_addSection: function(section) {
|
_addSection(section) {
|
||||||
let obj = {
|
let obj = {
|
||||||
destroyId: 0,
|
destroyId: 0,
|
||||||
visibleId: 0,
|
visibleId: 0,
|
||||||
@ -1175,7 +1175,7 @@ var CalendarMessageList = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeSection: function(section) {
|
_removeSection(section) {
|
||||||
let obj = this._sections.get(section);
|
let obj = this._sections.get(section);
|
||||||
section.actor.disconnect(obj.destroyId);
|
section.actor.disconnect(obj.destroyId);
|
||||||
section.actor.disconnect(obj.visibleId);
|
section.actor.disconnect(obj.visibleId);
|
||||||
@ -1188,11 +1188,11 @@ var CalendarMessageList = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyFocusIn: function(section, actor) {
|
_onKeyFocusIn(section, actor) {
|
||||||
Util.ensureActorVisibleInScrollView(this._scrollView, actor);
|
Util.ensureActorVisibleInScrollView(this._scrollView, actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let sections = [...this._sections.keys()];
|
let sections = [...this._sections.keys()];
|
||||||
let visible = sections.some(function(s) {
|
let visible = sections.some(function(s) {
|
||||||
return s.allowed;
|
return s.allowed;
|
||||||
@ -1213,11 +1213,11 @@ var CalendarMessageList = new Lang.Class({
|
|||||||
this._clearButton.reactive = canClear;
|
this._clearButton.reactive = canClear;
|
||||||
},
|
},
|
||||||
|
|
||||||
setEventSource: function(eventSource) {
|
setEventSource(eventSource) {
|
||||||
this._eventsSection.setEventSource(eventSource);
|
this._eventsSection.setEventSource(eventSource);
|
||||||
},
|
},
|
||||||
|
|
||||||
setDate: function(date) {
|
setDate(date) {
|
||||||
for (let section of this._sections.keys())
|
for (let section of this._sections.keys())
|
||||||
section.setDate(date);
|
section.setDate(date);
|
||||||
this._placeholder.setDate(date);
|
this._placeholder.setDate(date);
|
||||||
|
@ -7,7 +7,7 @@ const Lang = imports.lang;
|
|||||||
var CheckBox = new Lang.Class({
|
var CheckBox = new Lang.Class({
|
||||||
Name: 'CheckBox',
|
Name: 'CheckBox',
|
||||||
|
|
||||||
_init: function(label) {
|
_init(label) {
|
||||||
let container = new St.BoxLayout();
|
let container = new St.BoxLayout();
|
||||||
this.actor = new St.Button({ style_class: 'check-box',
|
this.actor = new St.Button({ style_class: 'check-box',
|
||||||
child: container,
|
child: container,
|
||||||
@ -30,11 +30,11 @@ var CheckBox = new Lang.Class({
|
|||||||
this.setLabel(label);
|
this.setLabel(label);
|
||||||
},
|
},
|
||||||
|
|
||||||
setLabel: function(label) {
|
setLabel(label) {
|
||||||
this._label.set_text(label);
|
this._label.set_text(label);
|
||||||
},
|
},
|
||||||
|
|
||||||
getLabelActor: function() {
|
getLabelActor() {
|
||||||
return this._label;
|
return this._label;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -22,7 +22,7 @@ var CloseDialog = new Lang.Class({
|
|||||||
'window': GObject.ParamSpec.override('window', Meta.CloseDialog)
|
'window': GObject.ParamSpec.override('window', Meta.CloseDialog)
|
||||||
},
|
},
|
||||||
|
|
||||||
_init: function (window) {
|
_init(window) {
|
||||||
this.parent();
|
this.parent();
|
||||||
this._window = window;
|
this._window = window;
|
||||||
this._dialog = null;
|
this._dialog = null;
|
||||||
@ -36,7 +36,7 @@ var CloseDialog = new Lang.Class({
|
|||||||
this._window = window;
|
this._window = window;
|
||||||
},
|
},
|
||||||
|
|
||||||
_createDialogContent: function () {
|
_createDialogContent() {
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
let windowApp = tracker.get_window_app(this._window);
|
let windowApp = tracker.get_window_app(this._window);
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ var CloseDialog = new Lang.Class({
|
|||||||
return new Dialog.MessageDialogContent({ icon, title, subtitle });
|
return new Dialog.MessageDialogContent({ icon, title, subtitle });
|
||||||
},
|
},
|
||||||
|
|
||||||
_initDialog: function () {
|
_initDialog() {
|
||||||
if (this._dialog)
|
if (this._dialog)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ var CloseDialog = new Lang.Class({
|
|||||||
global.focus_manager.add_group(this._dialog);
|
global.focus_manager.add_group(this._dialog);
|
||||||
},
|
},
|
||||||
|
|
||||||
_addWindowEffect: function () {
|
_addWindowEffect() {
|
||||||
// We set the effect on the surface actor, so the dialog itself
|
// We set the effect on the surface actor, so the dialog itself
|
||||||
// (which is a child of the MetaWindowActor) does not get the
|
// (which is a child of the MetaWindowActor) does not get the
|
||||||
// effect applied itself.
|
// effect applied itself.
|
||||||
@ -79,21 +79,21 @@ var CloseDialog = new Lang.Class({
|
|||||||
surfaceActor.add_effect_with_name("gnome-shell-frozen-window", effect);
|
surfaceActor.add_effect_with_name("gnome-shell-frozen-window", effect);
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeWindowEffect: function () {
|
_removeWindowEffect() {
|
||||||
let windowActor = this._window.get_compositor_private();
|
let windowActor = this._window.get_compositor_private();
|
||||||
let surfaceActor = windowActor.get_first_child();
|
let surfaceActor = windowActor.get_first_child();
|
||||||
surfaceActor.remove_effect_by_name("gnome-shell-frozen-window");
|
surfaceActor.remove_effect_by_name("gnome-shell-frozen-window");
|
||||||
},
|
},
|
||||||
|
|
||||||
_onWait: function () {
|
_onWait() {
|
||||||
this.response(Meta.CloseDialogResponse.WAIT);
|
this.response(Meta.CloseDialogResponse.WAIT);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onClose: function () {
|
_onClose() {
|
||||||
this.response(Meta.CloseDialogResponse.FORCE_CLOSE);
|
this.response(Meta.CloseDialogResponse.FORCE_CLOSE);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_show: function () {
|
vfunc_show() {
|
||||||
if (this._dialog != null)
|
if (this._dialog != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ var CloseDialog = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_hide: function () {
|
vfunc_hide() {
|
||||||
if (this._dialog == null)
|
if (this._dialog == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ var CloseDialog = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_focus: function () {
|
vfunc_focus() {
|
||||||
if (this._dialog)
|
if (this._dialog)
|
||||||
this._dialog.grab_key_focus();
|
this._dialog.grab_key_focus();
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ const Main = imports.ui.main;
|
|||||||
var ComponentManager = new Lang.Class({
|
var ComponentManager = new Lang.Class({
|
||||||
Name: 'ComponentManager',
|
Name: 'ComponentManager',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._allComponents = {};
|
this._allComponents = {};
|
||||||
this._enabledComponents = [];
|
this._enabledComponents = [];
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ var ComponentManager = new Lang.Class({
|
|||||||
this._sessionUpdated();
|
this._sessionUpdated();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
let newEnabledComponents = Main.sessionMode.components;
|
let newEnabledComponents = Main.sessionMode.components;
|
||||||
|
|
||||||
newEnabledComponents.filter(Lang.bind(this, function(name) {
|
newEnabledComponents.filter(Lang.bind(this, function(name) {
|
||||||
@ -31,12 +31,12 @@ var ComponentManager = new Lang.Class({
|
|||||||
this._enabledComponents = newEnabledComponents;
|
this._enabledComponents = newEnabledComponents;
|
||||||
},
|
},
|
||||||
|
|
||||||
_importComponent: function(name) {
|
_importComponent(name) {
|
||||||
let module = imports.ui.components[name];
|
let module = imports.ui.components[name];
|
||||||
return module.Component;
|
return module.Component;
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureComponent: function(name) {
|
_ensureComponent(name) {
|
||||||
let component = this._allComponents[name];
|
let component = this._allComponents[name];
|
||||||
if (component)
|
if (component)
|
||||||
return component;
|
return component;
|
||||||
@ -50,13 +50,13 @@ var ComponentManager = new Lang.Class({
|
|||||||
return component;
|
return component;
|
||||||
},
|
},
|
||||||
|
|
||||||
_enableComponent: function(name) {
|
_enableComponent(name) {
|
||||||
let component = this._ensureComponent(name);
|
let component = this._ensureComponent(name);
|
||||||
if (component)
|
if (component)
|
||||||
component.enable();
|
component.enable();
|
||||||
},
|
},
|
||||||
|
|
||||||
_disableComponent: function(name) {
|
_disableComponent(name) {
|
||||||
let component = this._allComponents[name];
|
let component = this._allComponents[name];
|
||||||
if (component == null)
|
if (component == null)
|
||||||
return;
|
return;
|
||||||
|
@ -22,7 +22,7 @@ var AUTORUN_EXPIRE_TIMEOUT_SECS = 10;
|
|||||||
var AutomountManager = new Lang.Class({
|
var AutomountManager = new Lang.Class({
|
||||||
Name: 'AutomountManager',
|
Name: 'AutomountManager',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._settings = new Gio.Settings({ schema_id: SETTINGS_SCHEMA });
|
this._settings = new Gio.Settings({ schema_id: SETTINGS_SCHEMA });
|
||||||
this._volumeQueue = [];
|
this._volumeQueue = [];
|
||||||
this._session = new GnomeSession.SessionManager();
|
this._session = new GnomeSession.SessionManager();
|
||||||
@ -35,7 +35,7 @@ var AutomountManager = new Lang.Class({
|
|||||||
this._volumeMonitor = Gio.VolumeMonitor.get();
|
this._volumeMonitor = Gio.VolumeMonitor.get();
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function() {
|
enable() {
|
||||||
this._volumeAddedId = this._volumeMonitor.connect('volume-added', Lang.bind(this, this._onVolumeAdded));
|
this._volumeAddedId = this._volumeMonitor.connect('volume-added', Lang.bind(this, this._onVolumeAdded));
|
||||||
this._volumeRemovedId = this._volumeMonitor.connect('volume-removed', Lang.bind(this, this._onVolumeRemoved));
|
this._volumeRemovedId = this._volumeMonitor.connect('volume-removed', Lang.bind(this, this._onVolumeRemoved));
|
||||||
this._driveConnectedId = this._volumeMonitor.connect('drive-connected', Lang.bind(this, this._onDriveConnected));
|
this._driveConnectedId = this._volumeMonitor.connect('drive-connected', Lang.bind(this, this._onDriveConnected));
|
||||||
@ -46,7 +46,7 @@ var AutomountManager = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._mountAllId, '[gnome-shell] this._startupMountAll');
|
GLib.Source.set_name_by_id(this._mountAllId, '[gnome-shell] this._startupMountAll');
|
||||||
},
|
},
|
||||||
|
|
||||||
disable: function() {
|
disable() {
|
||||||
this._volumeMonitor.disconnect(this._volumeAddedId);
|
this._volumeMonitor.disconnect(this._volumeAddedId);
|
||||||
this._volumeMonitor.disconnect(this._volumeRemovedId);
|
this._volumeMonitor.disconnect(this._volumeRemovedId);
|
||||||
this._volumeMonitor.disconnect(this._driveConnectedId);
|
this._volumeMonitor.disconnect(this._driveConnectedId);
|
||||||
@ -59,7 +59,7 @@ var AutomountManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_InhibitorsChanged: function(object, senderName, [inhibtor]) {
|
_InhibitorsChanged(object, senderName, [inhibtor]) {
|
||||||
this._session.IsInhibitedRemote(GNOME_SESSION_AUTOMOUNT_INHIBIT,
|
this._session.IsInhibitedRemote(GNOME_SESSION_AUTOMOUNT_INHIBIT,
|
||||||
Lang.bind(this,
|
Lang.bind(this,
|
||||||
function(result, error) {
|
function(result, error) {
|
||||||
@ -69,7 +69,7 @@ var AutomountManager = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_startupMountAll: function() {
|
_startupMountAll() {
|
||||||
let volumes = this._volumeMonitor.get_volumes();
|
let volumes = this._volumeMonitor.get_volumes();
|
||||||
volumes.forEach(Lang.bind(this, function(volume) {
|
volumes.forEach(Lang.bind(this, function(volume) {
|
||||||
this._checkAndMountVolume(volume, { checkSession: false,
|
this._checkAndMountVolume(volume, { checkSession: false,
|
||||||
@ -81,7 +81,7 @@ var AutomountManager = new Lang.Class({
|
|||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDriveConnected: function() {
|
_onDriveConnected() {
|
||||||
// if we're not in the current ConsoleKit session,
|
// if we're not in the current ConsoleKit session,
|
||||||
// or screensaver is active, don't play sounds
|
// or screensaver is active, don't play sounds
|
||||||
if (!this._session.SessionIsActive)
|
if (!this._session.SessionIsActive)
|
||||||
@ -92,7 +92,7 @@ var AutomountManager = new Lang.Class({
|
|||||||
null);
|
null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDriveDisconnected: function() {
|
_onDriveDisconnected() {
|
||||||
// if we're not in the current ConsoleKit session,
|
// if we're not in the current ConsoleKit session,
|
||||||
// or screensaver is active, don't play sounds
|
// or screensaver is active, don't play sounds
|
||||||
if (!this._session.SessionIsActive)
|
if (!this._session.SessionIsActive)
|
||||||
@ -103,7 +103,7 @@ var AutomountManager = new Lang.Class({
|
|||||||
null);
|
null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDriveEjectButton: function(monitor, drive) {
|
_onDriveEjectButton(monitor, drive) {
|
||||||
// TODO: this code path is not tested, as the GVfs volume monitor
|
// TODO: this code path is not tested, as the GVfs volume monitor
|
||||||
// doesn't emit this signal just yet.
|
// doesn't emit this signal just yet.
|
||||||
if (!this._session.SessionIsActive)
|
if (!this._session.SessionIsActive)
|
||||||
@ -134,11 +134,11 @@ var AutomountManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onVolumeAdded: function(monitor, volume) {
|
_onVolumeAdded(monitor, volume) {
|
||||||
this._checkAndMountVolume(volume);
|
this._checkAndMountVolume(volume);
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkAndMountVolume: function(volume, params) {
|
_checkAndMountVolume(volume, params) {
|
||||||
params = Params.parse(params, { checkSession: true,
|
params = Params.parse(params, { checkSession: true,
|
||||||
useMountOp: true,
|
useMountOp: true,
|
||||||
allowAutorun: true });
|
allowAutorun: true });
|
||||||
@ -178,7 +178,7 @@ var AutomountManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_mountVolume: function(volume, operation, allowAutorun) {
|
_mountVolume(volume, operation, allowAutorun) {
|
||||||
if (allowAutorun)
|
if (allowAutorun)
|
||||||
this._allowAutorun(volume);
|
this._allowAutorun(volume);
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ var AutomountManager = new Lang.Class({
|
|||||||
Lang.bind(this, this._onVolumeMounted));
|
Lang.bind(this, this._onVolumeMounted));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onVolumeMounted: function(volume, res) {
|
_onVolumeMounted(volume, res) {
|
||||||
this._allowAutorunExpire(volume);
|
this._allowAutorunExpire(volume);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -210,14 +210,14 @@ var AutomountManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onVolumeRemoved: function(monitor, volume) {
|
_onVolumeRemoved(monitor, volume) {
|
||||||
this._volumeQueue =
|
this._volumeQueue =
|
||||||
this._volumeQueue.filter(function(element) {
|
this._volumeQueue.filter(function(element) {
|
||||||
return (element != volume);
|
return (element != volume);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_reaskPassword: function(volume) {
|
_reaskPassword(volume) {
|
||||||
let existingDialog = volume._operation ? volume._operation.borrowDialog() : null;
|
let existingDialog = volume._operation ? volume._operation.borrowDialog() : null;
|
||||||
let operation =
|
let operation =
|
||||||
new ShellMountOperation.ShellMountOperation(volume,
|
new ShellMountOperation.ShellMountOperation(volume,
|
||||||
@ -225,16 +225,16 @@ var AutomountManager = new Lang.Class({
|
|||||||
this._mountVolume(volume, operation);
|
this._mountVolume(volume, operation);
|
||||||
},
|
},
|
||||||
|
|
||||||
_closeOperation: function(volume) {
|
_closeOperation(volume) {
|
||||||
if (volume._operation)
|
if (volume._operation)
|
||||||
volume._operation.close();
|
volume._operation.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
_allowAutorun: function(volume) {
|
_allowAutorun(volume) {
|
||||||
volume.allowAutorun = true;
|
volume.allowAutorun = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_allowAutorunExpire: function(volume) {
|
_allowAutorunExpire(volume) {
|
||||||
let id = Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, function() {
|
let id = Mainloop.timeout_add_seconds(AUTORUN_EXPIRE_TIMEOUT_SECS, function() {
|
||||||
volume.allowAutorun = false;
|
volume.allowAutorun = false;
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
|
@ -93,12 +93,12 @@ function HotplugSniffer() {
|
|||||||
var ContentTypeDiscoverer = new Lang.Class({
|
var ContentTypeDiscoverer = new Lang.Class({
|
||||||
Name: 'ContentTypeDiscoverer',
|
Name: 'ContentTypeDiscoverer',
|
||||||
|
|
||||||
_init: function(callback) {
|
_init(callback) {
|
||||||
this._callback = callback;
|
this._callback = callback;
|
||||||
this._settings = new Gio.Settings({ schema_id: SETTINGS_SCHEMA });
|
this._settings = new Gio.Settings({ schema_id: SETTINGS_SCHEMA });
|
||||||
},
|
},
|
||||||
|
|
||||||
guessContentTypes: function(mount) {
|
guessContentTypes(mount) {
|
||||||
let autorunEnabled = !this._settings.get_boolean(SETTING_DISABLE_AUTORUN);
|
let autorunEnabled = !this._settings.get_boolean(SETTING_DISABLE_AUTORUN);
|
||||||
let shouldScan = autorunEnabled && !isMountNonLocal(mount);
|
let shouldScan = autorunEnabled && !isMountNonLocal(mount);
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ var ContentTypeDiscoverer = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onContentTypeGuessed: function(mount, res) {
|
_onContentTypeGuessed(mount, res) {
|
||||||
let contentTypes = [];
|
let contentTypes = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -135,7 +135,7 @@ var ContentTypeDiscoverer = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_emitCallback: function(mount, contentTypes) {
|
_emitCallback(mount, contentTypes) {
|
||||||
if (!contentTypes)
|
if (!contentTypes)
|
||||||
contentTypes = [];
|
contentTypes = [];
|
||||||
|
|
||||||
@ -162,24 +162,24 @@ var ContentTypeDiscoverer = new Lang.Class({
|
|||||||
var AutorunManager = new Lang.Class({
|
var AutorunManager = new Lang.Class({
|
||||||
Name: 'AutorunManager',
|
Name: 'AutorunManager',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._session = new GnomeSession.SessionManager();
|
this._session = new GnomeSession.SessionManager();
|
||||||
this._volumeMonitor = Gio.VolumeMonitor.get();
|
this._volumeMonitor = Gio.VolumeMonitor.get();
|
||||||
|
|
||||||
this._dispatcher = new AutorunDispatcher(this);
|
this._dispatcher = new AutorunDispatcher(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function() {
|
enable() {
|
||||||
this._mountAddedId = this._volumeMonitor.connect('mount-added', Lang.bind(this, this._onMountAdded));
|
this._mountAddedId = this._volumeMonitor.connect('mount-added', Lang.bind(this, this._onMountAdded));
|
||||||
this._mountRemovedId = this._volumeMonitor.connect('mount-removed', Lang.bind(this, this._onMountRemoved));
|
this._mountRemovedId = this._volumeMonitor.connect('mount-removed', Lang.bind(this, this._onMountRemoved));
|
||||||
},
|
},
|
||||||
|
|
||||||
disable: function() {
|
disable() {
|
||||||
this._volumeMonitor.disconnect(this._mountAddedId);
|
this._volumeMonitor.disconnect(this._mountAddedId);
|
||||||
this._volumeMonitor.disconnect(this._mountRemovedId);
|
this._volumeMonitor.disconnect(this._mountRemovedId);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMountAdded: function(monitor, mount) {
|
_onMountAdded(monitor, mount) {
|
||||||
// don't do anything if our session is not the currently
|
// don't do anything if our session is not the currently
|
||||||
// active one
|
// active one
|
||||||
if (!this._session.SessionIsActive)
|
if (!this._session.SessionIsActive)
|
||||||
@ -191,7 +191,7 @@ var AutorunManager = new Lang.Class({
|
|||||||
discoverer.guessContentTypes(mount);
|
discoverer.guessContentTypes(mount);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMountRemoved: function(monitor, mount) {
|
_onMountRemoved(monitor, mount) {
|
||||||
this._dispatcher.removeMount(mount);
|
this._dispatcher.removeMount(mount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -199,13 +199,13 @@ var AutorunManager = new Lang.Class({
|
|||||||
var AutorunDispatcher = new Lang.Class({
|
var AutorunDispatcher = new Lang.Class({
|
||||||
Name: 'AutorunDispatcher',
|
Name: 'AutorunDispatcher',
|
||||||
|
|
||||||
_init: function(manager) {
|
_init(manager) {
|
||||||
this._manager = manager;
|
this._manager = manager;
|
||||||
this._sources = [];
|
this._sources = [];
|
||||||
this._settings = new Gio.Settings({ schema_id: SETTINGS_SCHEMA });
|
this._settings = new Gio.Settings({ schema_id: SETTINGS_SCHEMA });
|
||||||
},
|
},
|
||||||
|
|
||||||
_getAutorunSettingForType: function(contentType) {
|
_getAutorunSettingForType(contentType) {
|
||||||
let runApp = this._settings.get_strv(SETTING_START_APP);
|
let runApp = this._settings.get_strv(SETTING_START_APP);
|
||||||
if (runApp.indexOf(contentType) != -1)
|
if (runApp.indexOf(contentType) != -1)
|
||||||
return AutorunSetting.RUN;
|
return AutorunSetting.RUN;
|
||||||
@ -221,7 +221,7 @@ var AutorunDispatcher = new Lang.Class({
|
|||||||
return AutorunSetting.ASK;
|
return AutorunSetting.ASK;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSourceForMount: function(mount) {
|
_getSourceForMount(mount) {
|
||||||
let filtered =
|
let filtered =
|
||||||
this._sources.filter(function (source) {
|
this._sources.filter(function (source) {
|
||||||
return (source.mount == mount);
|
return (source.mount == mount);
|
||||||
@ -236,7 +236,7 @@ var AutorunDispatcher = new Lang.Class({
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_addSource: function(mount, apps) {
|
_addSource(mount, apps) {
|
||||||
// if we already have a source showing for this
|
// if we already have a source showing for this
|
||||||
// mount, return
|
// mount, return
|
||||||
if (this._getSourceForMount(mount))
|
if (this._getSourceForMount(mount))
|
||||||
@ -246,7 +246,7 @@ var AutorunDispatcher = new Lang.Class({
|
|||||||
this._sources.push(new AutorunSource(this._manager, mount, apps));
|
this._sources.push(new AutorunSource(this._manager, mount, apps));
|
||||||
},
|
},
|
||||||
|
|
||||||
addMount: function(mount, apps, contentTypes) {
|
addMount(mount, apps, contentTypes) {
|
||||||
// if autorun is disabled globally, return
|
// if autorun is disabled globally, return
|
||||||
if (this._settings.get_boolean(SETTING_DISABLE_AUTORUN))
|
if (this._settings.get_boolean(SETTING_DISABLE_AUTORUN))
|
||||||
return;
|
return;
|
||||||
@ -284,7 +284,7 @@ var AutorunDispatcher = new Lang.Class({
|
|||||||
this._addSource(mount, apps);
|
this._addSource(mount, apps);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeMount: function(mount) {
|
removeMount(mount) {
|
||||||
let source = this._getSourceForMount(mount);
|
let source = this._getSourceForMount(mount);
|
||||||
|
|
||||||
// if we aren't tracking this mount, don't do anything
|
// if we aren't tracking this mount, don't do anything
|
||||||
@ -300,7 +300,7 @@ var AutorunSource = new Lang.Class({
|
|||||||
Name: 'AutorunSource',
|
Name: 'AutorunSource',
|
||||||
Extends: MessageTray.Source,
|
Extends: MessageTray.Source,
|
||||||
|
|
||||||
_init: function(manager, mount, apps) {
|
_init(manager, mount, apps) {
|
||||||
this._manager = manager;
|
this._manager = manager;
|
||||||
this.mount = mount;
|
this.mount = mount;
|
||||||
this.apps = apps;
|
this.apps = apps;
|
||||||
@ -314,11 +314,11 @@ var AutorunSource = new Lang.Class({
|
|||||||
this.notify(this._notification);
|
this.notify(this._notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
getIcon: function() {
|
getIcon() {
|
||||||
return this.mount.get_icon();
|
return this.mount.get_icon();
|
||||||
},
|
},
|
||||||
|
|
||||||
_createPolicy: function() {
|
_createPolicy() {
|
||||||
return new MessageTray.NotificationApplicationPolicy('org.gnome.Nautilus');
|
return new MessageTray.NotificationApplicationPolicy('org.gnome.Nautilus');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -327,14 +327,14 @@ var AutorunNotification = new Lang.Class({
|
|||||||
Name: 'AutorunNotification',
|
Name: 'AutorunNotification',
|
||||||
Extends: MessageTray.Notification,
|
Extends: MessageTray.Notification,
|
||||||
|
|
||||||
_init: function(manager, source) {
|
_init(manager, source) {
|
||||||
this.parent(source, source.title);
|
this.parent(source, source.title);
|
||||||
|
|
||||||
this._manager = manager;
|
this._manager = manager;
|
||||||
this._mount = source.mount;
|
this._mount = source.mount;
|
||||||
},
|
},
|
||||||
|
|
||||||
createBanner: function() {
|
createBanner() {
|
||||||
let banner = new MessageTray.NotificationBanner(this);
|
let banner = new MessageTray.NotificationBanner(this);
|
||||||
|
|
||||||
this.source.apps.forEach(Lang.bind(this, function (app) {
|
this.source.apps.forEach(Lang.bind(this, function (app) {
|
||||||
@ -347,7 +347,7 @@ var AutorunNotification = new Lang.Class({
|
|||||||
return banner;
|
return banner;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buttonForApp: function(app) {
|
_buttonForApp(app) {
|
||||||
let box = new St.BoxLayout();
|
let box = new St.BoxLayout();
|
||||||
let icon = new St.Icon({ gicon: app.get_icon(),
|
let icon = new St.Icon({ gicon: app.get_icon(),
|
||||||
style_class: 'hotplug-notification-item-icon' });
|
style_class: 'hotplug-notification-item-icon' });
|
||||||
@ -374,7 +374,7 @@ var AutorunNotification = new Lang.Class({
|
|||||||
return button;
|
return button;
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function() {
|
activate() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
let app = Gio.app_info_get_default_for_type('inode/directory', false);
|
let app = Gio.app_info_get_default_for_type('inode/directory', false);
|
||||||
|
@ -24,7 +24,7 @@ var KeyringDialog = new Lang.Class({
|
|||||||
Name: 'KeyringDialog',
|
Name: 'KeyringDialog',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent({ styleClass: 'prompt-dialog' });
|
this.parent({ styleClass: 'prompt-dialog' });
|
||||||
|
|
||||||
this.prompt = new Shell.KeyringPrompt();
|
this.prompt = new Shell.KeyringPrompt();
|
||||||
@ -65,7 +65,7 @@ var KeyringDialog = new Lang.Class({
|
|||||||
this.prompt.bind_property('continue-label', this._continueButton, 'label', GObject.BindingFlags.SYNC_CREATE);
|
this.prompt.bind_property('continue-label', this._continueButton, 'label', GObject.BindingFlags.SYNC_CREATE);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setWorking: function(working) {
|
_setWorking(working) {
|
||||||
if (!this._workSpinner)
|
if (!this._workSpinner)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ var KeyringDialog = new Lang.Class({
|
|||||||
time: WORK_SPINNER_ANIMATION_TIME,
|
time: WORK_SPINNER_ANIMATION_TIME,
|
||||||
transition: 'linear',
|
transition: 'linear',
|
||||||
onCompleteScope: this,
|
onCompleteScope: this,
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
if (this._workSpinner)
|
if (this._workSpinner)
|
||||||
this._workSpinner.stop();
|
this._workSpinner.stop();
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ var KeyringDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildControlTable: function() {
|
_buildControlTable() {
|
||||||
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
|
let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
|
||||||
let table = new St.Widget({ style_class: 'keyring-dialog-control-table',
|
let table = new St.Widget({ style_class: 'keyring-dialog-control-table',
|
||||||
layout_manager: layout });
|
layout_manager: layout });
|
||||||
@ -185,7 +185,7 @@ var KeyringDialog = new Lang.Class({
|
|||||||
this._content.messageBox.add(table, { x_fill: true, y_fill: true });
|
this._content.messageBox.add(table, { x_fill: true, y_fill: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSensitivity: function(sensitive) {
|
_updateSensitivity(sensitive) {
|
||||||
if (this._passwordEntry) {
|
if (this._passwordEntry) {
|
||||||
this._passwordEntry.reactive = sensitive;
|
this._passwordEntry.reactive = sensitive;
|
||||||
this._passwordEntry.clutter_text.editable = sensitive;
|
this._passwordEntry.clutter_text.editable = sensitive;
|
||||||
@ -201,7 +201,7 @@ var KeyringDialog = new Lang.Class({
|
|||||||
this._setWorking(!sensitive);
|
this._setWorking(!sensitive);
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureOpen: function() {
|
_ensureOpen() {
|
||||||
// NOTE: ModalDialog.open() is safe to call if the dialog is
|
// NOTE: ModalDialog.open() is safe to call if the dialog is
|
||||||
// already open - it just returns true without side-effects
|
// already open - it just returns true without side-effects
|
||||||
if (this.open())
|
if (this.open())
|
||||||
@ -219,41 +219,41 @@ var KeyringDialog = new Lang.Class({
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onShowPassword: function(prompt) {
|
_onShowPassword(prompt) {
|
||||||
this._buildControlTable();
|
this._buildControlTable();
|
||||||
this._ensureOpen();
|
this._ensureOpen();
|
||||||
this._updateSensitivity(true);
|
this._updateSensitivity(true);
|
||||||
this._passwordEntry.grab_key_focus();
|
this._passwordEntry.grab_key_focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onShowConfirm: function(prompt) {
|
_onShowConfirm(prompt) {
|
||||||
this._buildControlTable();
|
this._buildControlTable();
|
||||||
this._ensureOpen();
|
this._ensureOpen();
|
||||||
this._updateSensitivity(true);
|
this._updateSensitivity(true);
|
||||||
this._continueButton.grab_key_focus();
|
this._continueButton.grab_key_focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onHidePrompt: function(prompt) {
|
_onHidePrompt(prompt) {
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPasswordActivate: function() {
|
_onPasswordActivate() {
|
||||||
if (this.prompt.confirm_visible)
|
if (this.prompt.confirm_visible)
|
||||||
this._confirmEntry.grab_key_focus();
|
this._confirmEntry.grab_key_focus();
|
||||||
else
|
else
|
||||||
this._onContinueButton();
|
this._onContinueButton();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onConfirmActivate: function() {
|
_onConfirmActivate() {
|
||||||
this._onContinueButton();
|
this._onContinueButton();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onContinueButton: function() {
|
_onContinueButton() {
|
||||||
this._updateSensitivity(false);
|
this._updateSensitivity(false);
|
||||||
this.prompt.complete();
|
this.prompt.complete();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCancelButton: function() {
|
_onCancelButton() {
|
||||||
this.prompt.cancel();
|
this.prompt.cancel();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -261,7 +261,7 @@ var KeyringDialog = new Lang.Class({
|
|||||||
var KeyringDummyDialog = new Lang.Class({
|
var KeyringDummyDialog = new Lang.Class({
|
||||||
Name: 'KeyringDummyDialog',
|
Name: 'KeyringDummyDialog',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.prompt = new Shell.KeyringPrompt();
|
this.prompt = new Shell.KeyringPrompt();
|
||||||
this.prompt.connect('show-password',
|
this.prompt.connect('show-password',
|
||||||
Lang.bind(this, this._cancelPrompt));
|
Lang.bind(this, this._cancelPrompt));
|
||||||
@ -269,7 +269,7 @@ var KeyringDummyDialog = new Lang.Class({
|
|||||||
this._cancelPrompt));
|
this._cancelPrompt));
|
||||||
},
|
},
|
||||||
|
|
||||||
_cancelPrompt: function() {
|
_cancelPrompt() {
|
||||||
this.prompt.cancel();
|
this.prompt.cancel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -277,7 +277,7 @@ var KeyringDummyDialog = new Lang.Class({
|
|||||||
var KeyringPrompter = new Lang.Class({
|
var KeyringPrompter = new Lang.Class({
|
||||||
Name: 'KeyringPrompter',
|
Name: 'KeyringPrompter',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._prompter = new Gcr.SystemPrompter();
|
this._prompter = new Gcr.SystemPrompter();
|
||||||
this._prompter.connect('new-prompt', Lang.bind(this,
|
this._prompter.connect('new-prompt', Lang.bind(this,
|
||||||
function() {
|
function() {
|
||||||
@ -292,7 +292,7 @@ var KeyringPrompter = new Lang.Class({
|
|||||||
this._currentPrompt = null;
|
this._currentPrompt = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function() {
|
enable() {
|
||||||
if (!this._registered) {
|
if (!this._registered) {
|
||||||
this._prompter.register(Gio.DBus.session);
|
this._prompter.register(Gio.DBus.session);
|
||||||
this._dbusId = Gio.DBus.session.own_name('org.gnome.keyring.SystemPrompter',
|
this._dbusId = Gio.DBus.session.own_name('org.gnome.keyring.SystemPrompter',
|
||||||
@ -302,7 +302,7 @@ var KeyringPrompter = new Lang.Class({
|
|||||||
this._enabled = true;
|
this._enabled = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
disable: function() {
|
disable() {
|
||||||
this._enabled = false;
|
this._enabled = false;
|
||||||
|
|
||||||
if (this._prompter.prompting)
|
if (this._prompter.prompting)
|
||||||
|
@ -25,7 +25,7 @@ var NetworkSecretDialog = new Lang.Class({
|
|||||||
Name: 'NetworkSecretDialog',
|
Name: 'NetworkSecretDialog',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function(agent, requestId, connection, settingName, hints, contentOverride) {
|
_init(agent, requestId, connection, settingName, hints, contentOverride) {
|
||||||
this.parent({ styleClass: 'prompt-dialog' });
|
this.parent({ styleClass: 'prompt-dialog' });
|
||||||
|
|
||||||
this._agent = agent;
|
this._agent = agent;
|
||||||
@ -123,7 +123,7 @@ var NetworkSecretDialog = new Lang.Class({
|
|||||||
this._updateOkButton();
|
this._updateOkButton();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateOkButton: function() {
|
_updateOkButton() {
|
||||||
let valid = true;
|
let valid = true;
|
||||||
for (let i = 0; i < this._content.secrets.length; i++) {
|
for (let i = 0; i < this._content.secrets.length; i++) {
|
||||||
let secret = this._content.secrets[i];
|
let secret = this._content.secrets[i];
|
||||||
@ -134,7 +134,7 @@ var NetworkSecretDialog = new Lang.Class({
|
|||||||
this._okButton.button.can_focus = valid;
|
this._okButton.button.can_focus = valid;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onOk: function() {
|
_onOk() {
|
||||||
let valid = true;
|
let valid = true;
|
||||||
for (let i = 0; i < this._content.secrets.length; i++) {
|
for (let i = 0; i < this._content.secrets.length; i++) {
|
||||||
let secret = this._content.secrets[i];
|
let secret = this._content.secrets[i];
|
||||||
@ -150,12 +150,12 @@ var NetworkSecretDialog = new Lang.Class({
|
|||||||
// do nothing if not valid
|
// do nothing if not valid
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function() {
|
cancel() {
|
||||||
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED);
|
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED);
|
||||||
this.close(global.get_current_time());
|
this.close(global.get_current_time());
|
||||||
},
|
},
|
||||||
|
|
||||||
_validateWpaPsk: function(secret) {
|
_validateWpaPsk(secret) {
|
||||||
let value = secret.value;
|
let value = secret.value;
|
||||||
if (value.length == 64) {
|
if (value.length == 64) {
|
||||||
// must be composed of hexadecimal digits only
|
// must be composed of hexadecimal digits only
|
||||||
@ -171,7 +171,7 @@ var NetworkSecretDialog = new Lang.Class({
|
|||||||
return (value.length >= 8 && value.length <= 63);
|
return (value.length >= 8 && value.length <= 63);
|
||||||
},
|
},
|
||||||
|
|
||||||
_validateStaticWep: function(secret) {
|
_validateStaticWep(secret) {
|
||||||
let value = secret.value;
|
let value = secret.value;
|
||||||
if (secret.wep_key_type == NM.WepKeyType.KEY) {
|
if (secret.wep_key_type == NM.WepKeyType.KEY) {
|
||||||
if (value.length == 10 || value.length == 26) {
|
if (value.length == 10 || value.length == 26) {
|
||||||
@ -196,7 +196,7 @@ var NetworkSecretDialog = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getWirelessSecrets: function(secrets, wirelessSetting) {
|
_getWirelessSecrets(secrets, wirelessSetting) {
|
||||||
let wirelessSecuritySetting = this._connection.get_setting_wireless_security();
|
let wirelessSecuritySetting = this._connection.get_setting_wireless_security();
|
||||||
switch (wirelessSecuritySetting.key_mgmt) {
|
switch (wirelessSecuritySetting.key_mgmt) {
|
||||||
// First the easy ones
|
// First the easy ones
|
||||||
@ -227,7 +227,7 @@ var NetworkSecretDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_get8021xSecrets: function(secrets) {
|
_get8021xSecrets(secrets) {
|
||||||
let ieee8021xSetting = this._connection.get_setting_802_1x();
|
let ieee8021xSetting = this._connection.get_setting_802_1x();
|
||||||
let phase2method;
|
let phase2method;
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ var NetworkSecretDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPPPoESecrets: function(secrets) {
|
_getPPPoESecrets(secrets) {
|
||||||
let pppoeSetting = this._connection.get_setting_pppoe();
|
let pppoeSetting = this._connection.get_setting_pppoe();
|
||||||
secrets.push({ label: _("Username: "), key: 'username',
|
secrets.push({ label: _("Username: "), key: 'username',
|
||||||
value: pppoeSetting.username || '', password: false });
|
value: pppoeSetting.username || '', password: false });
|
||||||
@ -266,7 +266,7 @@ var NetworkSecretDialog = new Lang.Class({
|
|||||||
value: pppoeSetting.password || '', password: true });
|
value: pppoeSetting.password || '', password: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMobileSecrets: function(secrets, connectionType) {
|
_getMobileSecrets(secrets, connectionType) {
|
||||||
let setting;
|
let setting;
|
||||||
if (connectionType == 'bluetooth')
|
if (connectionType == 'bluetooth')
|
||||||
setting = this._connection.get_setting_cdma() || this._connection.get_setting_gsm();
|
setting = this._connection.get_setting_cdma() || this._connection.get_setting_gsm();
|
||||||
@ -276,7 +276,7 @@ var NetworkSecretDialog = new Lang.Class({
|
|||||||
value: setting.value || '', password: true });
|
value: setting.value || '', password: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
_getContent: function() {
|
_getContent() {
|
||||||
let connectionSetting = this._connection.get_setting_connection();
|
let connectionSetting = this._connection.get_setting_connection();
|
||||||
let connectionType = connectionSetting.get_connection_type();
|
let connectionType = connectionSetting.get_connection_type();
|
||||||
let wirelessSetting;
|
let wirelessSetting;
|
||||||
@ -332,7 +332,7 @@ var NetworkSecretDialog = new Lang.Class({
|
|||||||
var VPNRequestHandler = new Lang.Class({
|
var VPNRequestHandler = new Lang.Class({
|
||||||
Name: 'VPNRequestHandler',
|
Name: 'VPNRequestHandler',
|
||||||
|
|
||||||
_init: function(agent, requestId, authHelper, serviceType, connection, hints, flags) {
|
_init(agent, requestId, authHelper, serviceType, connection, hints, flags) {
|
||||||
this._agent = agent;
|
this._agent = agent;
|
||||||
this._requestId = requestId;
|
this._requestId = requestId;
|
||||||
this._connection = connection;
|
this._connection = connection;
|
||||||
@ -394,7 +394,7 @@ var VPNRequestHandler = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function(respond) {
|
cancel(respond) {
|
||||||
if (respond)
|
if (respond)
|
||||||
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED);
|
this._agent.respond(this._requestId, Shell.NetworkAgentResponse.USER_CANCELED);
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ var VPNRequestHandler = new Lang.Class({
|
|||||||
this.destroy();
|
this.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
if (this._destroyed)
|
if (this._destroyed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ var VPNRequestHandler = new Lang.Class({
|
|||||||
this._destroyed = true;
|
this._destroyed = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_vpnChildFinished: function(pid, status, requestObj) {
|
_vpnChildFinished(pid, status, requestObj) {
|
||||||
this._childWatch = 0;
|
this._childWatch = 0;
|
||||||
if (this._newStylePlugin) {
|
if (this._newStylePlugin) {
|
||||||
// For new style plugin, all work is done in the async reading functions
|
// For new style plugin, all work is done in the async reading functions
|
||||||
@ -445,7 +445,7 @@ var VPNRequestHandler = new Lang.Class({
|
|||||||
this.destroy();
|
this.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
_vpnChildProcessLineOldStyle: function(line) {
|
_vpnChildProcessLineOldStyle(line) {
|
||||||
if (this._previousLine != undefined) {
|
if (this._previousLine != undefined) {
|
||||||
// Two consecutive newlines mean that the child should be closed
|
// Two consecutive newlines mean that the child should be closed
|
||||||
// (the actual newlines are eaten by Gio.DataInputStream)
|
// (the actual newlines are eaten by Gio.DataInputStream)
|
||||||
@ -463,7 +463,7 @@ var VPNRequestHandler = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_readStdoutOldStyle: function() {
|
_readStdoutOldStyle() {
|
||||||
this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(stream, result) {
|
this._dataStdout.read_line_async(GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(stream, result) {
|
||||||
let [line, len] = this._dataStdout.read_line_finish_utf8(result);
|
let [line, len] = this._dataStdout.read_line_finish_utf8(result);
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ var VPNRequestHandler = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_readStdoutNewStyle: function() {
|
_readStdoutNewStyle() {
|
||||||
this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(stream, result) {
|
this._dataStdout.fill_async(-1, GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(stream, result) {
|
||||||
let cnt = this._dataStdout.fill_finish(result);
|
let cnt = this._dataStdout.fill_finish(result);
|
||||||
|
|
||||||
@ -498,7 +498,7 @@ var VPNRequestHandler = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_showNewStyleDialog: function() {
|
_showNewStyleDialog() {
|
||||||
let keyfile = new GLib.KeyFile();
|
let keyfile = new GLib.KeyFile();
|
||||||
let data;
|
let data;
|
||||||
let contentOverride;
|
let contentOverride;
|
||||||
@ -558,7 +558,7 @@ var VPNRequestHandler = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_writeConnection: function() {
|
_writeConnection() {
|
||||||
let vpnSetting = this._connection.get_setting_vpn();
|
let vpnSetting = this._connection.get_setting_vpn();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -584,7 +584,7 @@ Signals.addSignalMethods(VPNRequestHandler.prototype);
|
|||||||
var NetworkAgent = new Lang.Class({
|
var NetworkAgent = new Lang.Class({
|
||||||
Name: 'NetworkAgent',
|
Name: 'NetworkAgent',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._native = new Shell.NetworkAgent({ identifier: 'org.gnome.Shell.NetworkAgent',
|
this._native = new Shell.NetworkAgent({ identifier: 'org.gnome.Shell.NetworkAgent',
|
||||||
capabilities: NM.SecretAgentCapabilities.VPN_HINTS,
|
capabilities: NM.SecretAgentCapabilities.VPN_HINTS,
|
||||||
auto_register: false
|
auto_register: false
|
||||||
@ -612,7 +612,7 @@ var NetworkAgent = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function() {
|
enable() {
|
||||||
if (!this._native)
|
if (!this._native)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -621,7 +621,7 @@ var NetworkAgent = new Lang.Class({
|
|||||||
this._native.register_async(null, null);
|
this._native.register_async(null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
disable: function() {
|
disable() {
|
||||||
let requestId;
|
let requestId;
|
||||||
|
|
||||||
for (requestId in this._dialogs)
|
for (requestId in this._dialogs)
|
||||||
@ -644,7 +644,7 @@ var NetworkAgent = new Lang.Class({
|
|||||||
this._native.unregister_async(null, null);
|
this._native.unregister_async(null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_showNotification: function(requestId, connection, settingName, hints, flags) {
|
_showNotification(requestId, connection, settingName, hints, flags) {
|
||||||
let source = new MessageTray.Source(_("Network Manager"), 'network-transmit-receive');
|
let source = new MessageTray.Source(_("Network Manager"), 'network-transmit-receive');
|
||||||
source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel');
|
source.policy = new MessageTray.NotificationApplicationPolicy('gnome-network-panel');
|
||||||
|
|
||||||
@ -704,14 +704,14 @@ var NetworkAgent = new Lang.Class({
|
|||||||
source.notify(notification);
|
source.notify(notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
_newRequest: function(agent, requestId, connection, settingName, hints, flags) {
|
_newRequest(agent, requestId, connection, settingName, hints, flags) {
|
||||||
if (!(flags & NM.SecretAgentGetSecretsFlags.USER_REQUESTED))
|
if (!(flags & NM.SecretAgentGetSecretsFlags.USER_REQUESTED))
|
||||||
this._showNotification(requestId, connection, settingName, hints, flags);
|
this._showNotification(requestId, connection, settingName, hints, flags);
|
||||||
else
|
else
|
||||||
this._handleRequest(requestId, connection, settingName, hints, flags);
|
this._handleRequest(requestId, connection, settingName, hints, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleRequest: function(requestId, connection, settingName, hints, flags) {
|
_handleRequest(requestId, connection, settingName, hints, flags) {
|
||||||
if (settingName == 'vpn') {
|
if (settingName == 'vpn') {
|
||||||
this._vpnRequest(requestId, connection, hints, flags);
|
this._vpnRequest(requestId, connection, hints, flags);
|
||||||
return;
|
return;
|
||||||
@ -725,7 +725,7 @@ var NetworkAgent = new Lang.Class({
|
|||||||
dialog.open(global.get_current_time());
|
dialog.open(global.get_current_time());
|
||||||
},
|
},
|
||||||
|
|
||||||
_cancelRequest: function(agent, requestId) {
|
_cancelRequest(agent, requestId) {
|
||||||
if (this._dialogs[requestId]) {
|
if (this._dialogs[requestId]) {
|
||||||
this._dialogs[requestId].close(global.get_current_time());
|
this._dialogs[requestId].close(global.get_current_time());
|
||||||
this._dialogs[requestId].destroy();
|
this._dialogs[requestId].destroy();
|
||||||
@ -736,7 +736,7 @@ var NetworkAgent = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_vpnRequest: function(requestId, connection, hints, flags) {
|
_vpnRequest(requestId, connection, hints, flags) {
|
||||||
let vpnSetting = connection.get_setting_vpn();
|
let vpnSetting = connection.get_setting_vpn();
|
||||||
let serviceType = vpnSetting.service_type;
|
let serviceType = vpnSetting.service_type;
|
||||||
|
|
||||||
@ -758,7 +758,7 @@ var NetworkAgent = new Lang.Class({
|
|||||||
this._vpnRequests[requestId] = vpnRequest;
|
this._vpnRequests[requestId] = vpnRequest;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildVPNServiceCache: function() {
|
_buildVPNServiceCache() {
|
||||||
if (this._vpnCacheBuilt)
|
if (this._vpnCacheBuilt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
Name: 'AuthenticationDialog',
|
Name: 'AuthenticationDialog',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function(actionId, body, cookie, userNames) {
|
_init(actionId, body, cookie, userNames) {
|
||||||
this.parent({ styleClass: 'prompt-dialog' });
|
this.parent({ styleClass: 'prompt-dialog' });
|
||||||
|
|
||||||
this.actionId = actionId;
|
this.actionId = actionId;
|
||||||
@ -158,7 +158,7 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
this._cookie = cookie;
|
this._cookie = cookie;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setWorking: function(working) {
|
_setWorking(working) {
|
||||||
Tweener.removeTweens(this._workSpinner.actor);
|
Tweener.removeTweens(this._workSpinner.actor);
|
||||||
if (working) {
|
if (working) {
|
||||||
this._workSpinner.play();
|
this._workSpinner.play();
|
||||||
@ -174,7 +174,7 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
time: WORK_SPINNER_ANIMATION_TIME,
|
time: WORK_SPINNER_ANIMATION_TIME,
|
||||||
transition: 'linear',
|
transition: 'linear',
|
||||||
onCompleteScope: this,
|
onCompleteScope: this,
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
if (this._workSpinner)
|
if (this._workSpinner)
|
||||||
this._workSpinner.stop();
|
this._workSpinner.stop();
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
performAuthentication: function() {
|
performAuthentication() {
|
||||||
this.destroySession();
|
this.destroySession();
|
||||||
this._session = new PolkitAgent.Session({ identity: this._identityToAuth,
|
this._session = new PolkitAgent.Session({ identity: this._identityToAuth,
|
||||||
cookie: this._cookie });
|
cookie: this._cookie });
|
||||||
@ -193,7 +193,7 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
this._session.initiate();
|
this._session.initiate();
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureOpen: function() {
|
_ensureOpen() {
|
||||||
// NOTE: ModalDialog.open() is safe to call if the dialog is
|
// NOTE: ModalDialog.open() is safe to call if the dialog is
|
||||||
// already open - it just returns true without side-effects
|
// already open - it just returns true without side-effects
|
||||||
if (!this.open(global.get_current_time())) {
|
if (!this.open(global.get_current_time())) {
|
||||||
@ -215,14 +215,14 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_emitDone: function(dismissed) {
|
_emitDone(dismissed) {
|
||||||
if (!this._doneEmitted) {
|
if (!this._doneEmitted) {
|
||||||
this._doneEmitted = true;
|
this._doneEmitted = true;
|
||||||
this.emit('done', dismissed);
|
this.emit('done', dismissed);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSensitivity: function(sensitive) {
|
_updateSensitivity(sensitive) {
|
||||||
this._passwordEntry.reactive = sensitive;
|
this._passwordEntry.reactive = sensitive;
|
||||||
this._passwordEntry.clutter_text.editable = sensitive;
|
this._passwordEntry.clutter_text.editable = sensitive;
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
this._setWorking(!sensitive);
|
this._setWorking(!sensitive);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEntryActivate: function() {
|
_onEntryActivate() {
|
||||||
let response = this._passwordEntry.get_text();
|
let response = this._passwordEntry.get_text();
|
||||||
this._updateSensitivity(false);
|
this._updateSensitivity(false);
|
||||||
this._session.response(response);
|
this._session.response(response);
|
||||||
@ -242,11 +242,11 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
this._nullMessageLabel.show();
|
this._nullMessageLabel.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAuthenticateButtonPressed: function() {
|
_onAuthenticateButtonPressed() {
|
||||||
this._onEntryActivate();
|
this._onEntryActivate();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSessionCompleted: function(session, gainedAuthorization) {
|
_onSessionCompleted(session, gainedAuthorization) {
|
||||||
if (this._completed || this._doneEmitted)
|
if (this._completed || this._doneEmitted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSessionRequest: function(session, request, echo_on) {
|
_onSessionRequest(session, request, echo_on) {
|
||||||
// Cheap localization trick
|
// Cheap localization trick
|
||||||
if (request == 'Password:' || request == 'Password: ')
|
if (request == 'Password:' || request == 'Password: ')
|
||||||
this._passwordLabel.set_text(_("Password:"));
|
this._passwordLabel.set_text(_("Password:"));
|
||||||
@ -297,7 +297,7 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
this._ensureOpen();
|
this._ensureOpen();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSessionShowError: function(session, text) {
|
_onSessionShowError(session, text) {
|
||||||
this._passwordEntry.set_text('');
|
this._passwordEntry.set_text('');
|
||||||
this._errorMessageLabel.set_text(text);
|
this._errorMessageLabel.set_text(text);
|
||||||
this._errorMessageLabel.show();
|
this._errorMessageLabel.show();
|
||||||
@ -306,7 +306,7 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
this._ensureOpen();
|
this._ensureOpen();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSessionShowInfo: function(session, text) {
|
_onSessionShowInfo(session, text) {
|
||||||
this._passwordEntry.set_text('');
|
this._passwordEntry.set_text('');
|
||||||
this._infoMessageLabel.set_text(text);
|
this._infoMessageLabel.set_text(text);
|
||||||
this._infoMessageLabel.show();
|
this._infoMessageLabel.show();
|
||||||
@ -315,7 +315,7 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
this._ensureOpen();
|
this._ensureOpen();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroySession: function() {
|
destroySession() {
|
||||||
if (this._session) {
|
if (this._session) {
|
||||||
if (!this._completed)
|
if (!this._completed)
|
||||||
this._session.cancel();
|
this._session.cancel();
|
||||||
@ -324,14 +324,14 @@ var AuthenticationDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUserChanged: function() {
|
_onUserChanged() {
|
||||||
if (this._user.is_loaded && this._userAvatar) {
|
if (this._user.is_loaded && this._userAvatar) {
|
||||||
this._userAvatar.update();
|
this._userAvatar.update();
|
||||||
this._userAvatar.actor.show();
|
this._userAvatar.actor.show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function() {
|
cancel() {
|
||||||
this._wasDismissed = true;
|
this._wasDismissed = true;
|
||||||
this.close(global.get_current_time());
|
this.close(global.get_current_time());
|
||||||
this._emitDone(true);
|
this._emitDone(true);
|
||||||
@ -342,7 +342,7 @@ Signals.addSignalMethods(AuthenticationDialog.prototype);
|
|||||||
var AuthenticationAgent = new Lang.Class({
|
var AuthenticationAgent = new Lang.Class({
|
||||||
Name: 'AuthenticationAgent',
|
Name: 'AuthenticationAgent',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._currentDialog = null;
|
this._currentDialog = null;
|
||||||
this._handle = null;
|
this._handle = null;
|
||||||
this._native = new Shell.PolkitAuthenticationAgent();
|
this._native = new Shell.PolkitAuthenticationAgent();
|
||||||
@ -350,7 +350,7 @@ var AuthenticationAgent = new Lang.Class({
|
|||||||
this._native.connect('cancel', Lang.bind(this, this._onCancel));
|
this._native.connect('cancel', Lang.bind(this, this._onCancel));
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function() {
|
enable() {
|
||||||
try {
|
try {
|
||||||
this._native.register();
|
this._native.register();
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
@ -358,7 +358,7 @@ var AuthenticationAgent = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
disable: function() {
|
disable() {
|
||||||
try {
|
try {
|
||||||
this._native.unregister();
|
this._native.unregister();
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
@ -366,7 +366,7 @@ var AuthenticationAgent = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onInitiate: function(nativeAgent, actionId, message, iconName, cookie, userNames) {
|
_onInitiate(nativeAgent, actionId, message, iconName, cookie, userNames) {
|
||||||
this._currentDialog = new AuthenticationDialog(actionId, message, cookie, userNames);
|
this._currentDialog = new AuthenticationDialog(actionId, message, cookie, userNames);
|
||||||
|
|
||||||
// We actually don't want to open the dialog until we know for
|
// We actually don't want to open the dialog until we know for
|
||||||
@ -383,15 +383,15 @@ var AuthenticationAgent = new Lang.Class({
|
|||||||
this._currentDialog.performAuthentication();
|
this._currentDialog.performAuthentication();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCancel: function(nativeAgent) {
|
_onCancel(nativeAgent) {
|
||||||
this._completeRequest(false);
|
this._completeRequest(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDialogDone: function(dialog, dismissed) {
|
_onDialogDone(dialog, dismissed) {
|
||||||
this._completeRequest(dismissed);
|
this._completeRequest(dismissed);
|
||||||
},
|
},
|
||||||
|
|
||||||
_completeRequest: function(dismissed) {
|
_completeRequest(dismissed) {
|
||||||
this._currentDialog.close();
|
this._currentDialog.close();
|
||||||
this._currentDialog.destroySession();
|
this._currentDialog.destroySession();
|
||||||
this._currentDialog = null;
|
this._currentDialog = null;
|
||||||
|
@ -82,7 +82,7 @@ function makeMessageFromTplEvent(event) {
|
|||||||
var TelepathyComponent = new Lang.Class({
|
var TelepathyComponent = new Lang.Class({
|
||||||
Name: 'TelepathyComponent',
|
Name: 'TelepathyComponent',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._client = null;
|
this._client = null;
|
||||||
|
|
||||||
if (!HAVE_TP)
|
if (!HAVE_TP)
|
||||||
@ -91,7 +91,7 @@ var TelepathyComponent = new Lang.Class({
|
|||||||
this._client = new TelepathyClient();
|
this._client = new TelepathyClient();
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function() {
|
enable() {
|
||||||
if (!this._client)
|
if (!this._client)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ var TelepathyComponent = new Lang.Class({
|
|||||||
this._client.account_manager.prepare_async(null, null);
|
this._client.account_manager.prepare_async(null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
disable: function() {
|
disable() {
|
||||||
if (!this._client)
|
if (!this._client)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
|||||||
Name: 'TelepathyClient',
|
Name: 'TelepathyClient',
|
||||||
Extends: Tp.BaseClient,
|
Extends: Tp.BaseClient,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
// channel path -> ChatSource
|
// channel path -> ChatSource
|
||||||
this._chatSources = {};
|
this._chatSources = {};
|
||||||
this._chatState = Tp.ChannelChatState.ACTIVE;
|
this._chatState = Tp.ChannelChatState.ACTIVE;
|
||||||
@ -160,7 +160,7 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
|||||||
Lang.bind(this, this._delegatedChannelsCb));
|
Lang.bind(this, this._delegatedChannelsCb));
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_observe_channels: function(account, conn, channels,
|
vfunc_observe_channels(account, conn, channels,
|
||||||
dispatchOp, requests, context) {
|
dispatchOp, requests, context) {
|
||||||
let len = channels.length;
|
let len = channels.length;
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
@ -181,7 +181,7 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
|||||||
context.accept();
|
context.accept();
|
||||||
},
|
},
|
||||||
|
|
||||||
_createChatSource: function(account, conn, channel, contact) {
|
_createChatSource(account, conn, channel, contact) {
|
||||||
if (this._chatSources[channel.get_object_path()])
|
if (this._chatSources[channel.get_object_path()])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -194,13 +194,13 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_handle_channels: function(account, conn, channels, requests,
|
vfunc_handle_channels(account, conn, channels, requests,
|
||||||
user_action_time, context) {
|
user_action_time, context) {
|
||||||
this._handlingChannels(account, conn, channels, true);
|
this._handlingChannels(account, conn, channels, true);
|
||||||
context.accept();
|
context.accept();
|
||||||
},
|
},
|
||||||
|
|
||||||
_handlingChannels: function(account, conn, channels, notify) {
|
_handlingChannels(account, conn, channels, notify) {
|
||||||
let len = channels.length;
|
let len = channels.length;
|
||||||
for (let i = 0; i < len; i++) {
|
for (let i = 0; i < len; i++) {
|
||||||
let channel = channels[i];
|
let channel = channels[i];
|
||||||
@ -234,7 +234,7 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_add_dispatch_operation: function(account, conn, channels,
|
vfunc_add_dispatch_operation(account, conn, channels,
|
||||||
dispatchOp, context) {
|
dispatchOp, context) {
|
||||||
let channel = channels[0];
|
let channel = channels[0];
|
||||||
let chanType = channel.get_channel_type();
|
let chanType = channel.get_channel_type();
|
||||||
@ -252,7 +252,7 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
|||||||
message: 'Unsupported channel type' }));
|
message: 'Unsupported channel type' }));
|
||||||
},
|
},
|
||||||
|
|
||||||
_approveTextChannel: function(account, conn, channel, dispatchOp, context) {
|
_approveTextChannel(account, conn, channel, dispatchOp, context) {
|
||||||
let [targetHandle, targetHandleType] = channel.get_handle();
|
let [targetHandle, targetHandleType] = channel.get_handle();
|
||||||
|
|
||||||
if (targetHandleType != Tp.HandleType.CONTACT) {
|
if (targetHandleType != Tp.HandleType.CONTACT) {
|
||||||
@ -274,7 +274,7 @@ var TelepathyClient = HAVE_TP ? new Lang.Class({
|
|||||||
context.accept();
|
context.accept();
|
||||||
},
|
},
|
||||||
|
|
||||||
_delegatedChannelsCb: function(client, channels) {
|
_delegatedChannelsCb(client, channels) {
|
||||||
// Nothing to do as we don't make a distinction between observed and
|
// Nothing to do as we don't make a distinction between observed and
|
||||||
// handled channels.
|
// handled channels.
|
||||||
},
|
},
|
||||||
@ -284,7 +284,7 @@ var ChatSource = new Lang.Class({
|
|||||||
Name: 'ChatSource',
|
Name: 'ChatSource',
|
||||||
Extends: MessageTray.Source,
|
Extends: MessageTray.Source,
|
||||||
|
|
||||||
_init: function(account, conn, channel, contact, client) {
|
_init(account, conn, channel, contact, client) {
|
||||||
this._account = account;
|
this._account = account;
|
||||||
this._contact = contact;
|
this._contact = contact;
|
||||||
this._client = client;
|
this._client = client;
|
||||||
@ -316,7 +316,7 @@ var ChatSource = new Lang.Class({
|
|||||||
this._getLogMessages();
|
this._getLogMessages();
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureNotification: function() {
|
_ensureNotification() {
|
||||||
if (this._notification)
|
if (this._notification)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -334,13 +334,13 @@ var ChatSource = new Lang.Class({
|
|||||||
this.pushNotification(this._notification);
|
this.pushNotification(this._notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createPolicy: function() {
|
_createPolicy() {
|
||||||
if (this._account.protocol_name == 'irc')
|
if (this._account.protocol_name == 'irc')
|
||||||
return new MessageTray.NotificationApplicationPolicy('org.gnome.Polari');
|
return new MessageTray.NotificationApplicationPolicy('org.gnome.Polari');
|
||||||
return new MessageTray.NotificationApplicationPolicy('empathy');
|
return new MessageTray.NotificationApplicationPolicy('empathy');
|
||||||
},
|
},
|
||||||
|
|
||||||
createBanner: function() {
|
createBanner() {
|
||||||
this._banner = new ChatNotificationBanner(this._notification);
|
this._banner = new ChatNotificationBanner(this._notification);
|
||||||
|
|
||||||
// We ack messages when the user expands the new notification
|
// We ack messages when the user expands the new notification
|
||||||
@ -354,7 +354,7 @@ var ChatSource = new Lang.Class({
|
|||||||
return this._banner;
|
return this._banner;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateAlias: function() {
|
_updateAlias() {
|
||||||
let oldAlias = this.title;
|
let oldAlias = this.title;
|
||||||
let newAlias = this._contact.get_alias();
|
let newAlias = this._contact.get_alias();
|
||||||
|
|
||||||
@ -366,7 +366,7 @@ var ChatSource = new Lang.Class({
|
|||||||
this._notification.appendAliasChange(oldAlias, newAlias);
|
this._notification.appendAliasChange(oldAlias, newAlias);
|
||||||
},
|
},
|
||||||
|
|
||||||
getIcon: function() {
|
getIcon() {
|
||||||
let file = this._contact.get_avatar_file();
|
let file = this._contact.get_avatar_file();
|
||||||
if (file) {
|
if (file) {
|
||||||
return new Gio.FileIcon({ file: file });
|
return new Gio.FileIcon({ file: file });
|
||||||
@ -375,7 +375,7 @@ var ChatSource = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getSecondaryIcon: function() {
|
getSecondaryIcon() {
|
||||||
let iconName;
|
let iconName;
|
||||||
let presenceType = this._contact.get_presence_type();
|
let presenceType = this._contact.get_presence_type();
|
||||||
|
|
||||||
@ -404,7 +404,7 @@ var ChatSource = new Lang.Class({
|
|||||||
return new Gio.ThemedIcon({ name: iconName });
|
return new Gio.ThemedIcon({ name: iconName });
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateAvatarIcon: function() {
|
_updateAvatarIcon() {
|
||||||
this.iconUpdated();
|
this.iconUpdated();
|
||||||
if (this._notifiction)
|
if (this._notifiction)
|
||||||
this._notification.update(this._notification.title,
|
this._notification.update(this._notification.title,
|
||||||
@ -412,7 +412,7 @@ var ChatSource = new Lang.Class({
|
|||||||
{ gicon: this.getIcon() });
|
{ gicon: this.getIcon() });
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function() {
|
open() {
|
||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
Main.panel.closeCalendar();
|
Main.panel.closeCalendar();
|
||||||
|
|
||||||
@ -437,7 +437,7 @@ var ChatSource = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getLogMessages: function() {
|
_getLogMessages() {
|
||||||
let logManager = Tpl.LogManager.dup_singleton();
|
let logManager = Tpl.LogManager.dup_singleton();
|
||||||
let entity = Tpl.Entity.new_from_tp_contact(this._contact, Tpl.EntityType.CONTACT);
|
let entity = Tpl.Entity.new_from_tp_contact(this._contact, Tpl.EntityType.CONTACT);
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ var ChatSource = new Lang.Class({
|
|||||||
null, Lang.bind(this, this._displayPendingMessages));
|
null, Lang.bind(this, this._displayPendingMessages));
|
||||||
},
|
},
|
||||||
|
|
||||||
_displayPendingMessages: function(logManager, result) {
|
_displayPendingMessages(logManager, result) {
|
||||||
let [success, events] = logManager.get_filtered_events_finish(result);
|
let [success, events] = logManager.get_filtered_events_finish(result);
|
||||||
|
|
||||||
let logMessages = events.map(makeMessageFromTplEvent);
|
let logMessages = events.map(makeMessageFromTplEvent);
|
||||||
@ -499,7 +499,7 @@ var ChatSource = new Lang.Class({
|
|||||||
this.notify();
|
this.notify();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function(reason) {
|
destroy(reason) {
|
||||||
if (this._client.is_handling_channel(this._channel)) {
|
if (this._client.is_handling_channel(this._channel)) {
|
||||||
this._ackMessages();
|
this._ackMessages();
|
||||||
// The chat box has been destroyed so it can't
|
// The chat box has been destroyed so it can't
|
||||||
@ -534,7 +534,7 @@ var ChatSource = new Lang.Class({
|
|||||||
this.parent(reason);
|
this.parent(reason);
|
||||||
},
|
},
|
||||||
|
|
||||||
_channelClosed: function() {
|
_channelClosed() {
|
||||||
this.destroy(MessageTray.NotificationDestroyedReason.SOURCE_CLOSED);
|
this.destroy(MessageTray.NotificationDestroyedReason.SOURCE_CLOSED);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -551,7 +551,7 @@ var ChatSource = new Lang.Class({
|
|||||||
return this.count > 0;
|
return this.count > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_messageReceived: function(channel, message) {
|
_messageReceived(channel, message) {
|
||||||
if (message.get_message_type() == Tp.ChannelTextMessageType.DELIVERY_REPORT)
|
if (message.get_message_type() == Tp.ChannelTextMessageType.DELIVERY_REPORT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -571,7 +571,7 @@ var ChatSource = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._notifyTimeoutId, '[gnome-shell] this._notifyTimeout');
|
GLib.Source.set_name_by_id(this._notifyTimeoutId, '[gnome-shell] this._notifyTimeout');
|
||||||
},
|
},
|
||||||
|
|
||||||
_notifyTimeout: function() {
|
_notifyTimeout() {
|
||||||
if (this._pendingMessages.length != 0)
|
if (this._pendingMessages.length != 0)
|
||||||
this.notify();
|
this.notify();
|
||||||
|
|
||||||
@ -582,17 +582,17 @@ var ChatSource = new Lang.Class({
|
|||||||
|
|
||||||
// This is called for both messages we send from
|
// This is called for both messages we send from
|
||||||
// our client and other clients as well.
|
// our client and other clients as well.
|
||||||
_messageSent: function(channel, message, flags, token) {
|
_messageSent(channel, message, flags, token) {
|
||||||
this._ensureNotification();
|
this._ensureNotification();
|
||||||
message = makeMessageFromTpMessage(message, NotificationDirection.SENT);
|
message = makeMessageFromTpMessage(message, NotificationDirection.SENT);
|
||||||
this._notification.appendMessage(message);
|
this._notification.appendMessage(message);
|
||||||
},
|
},
|
||||||
|
|
||||||
notify: function() {
|
notify() {
|
||||||
this.parent(this._notification);
|
this.parent(this._notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
respond: function(text) {
|
respond(text) {
|
||||||
let type;
|
let type;
|
||||||
if (text.slice(0, 4) == '/me ') {
|
if (text.slice(0, 4) == '/me ') {
|
||||||
type = Tp.ChannelTextMessageType.ACTION;
|
type = Tp.ChannelTextMessageType.ACTION;
|
||||||
@ -607,7 +607,7 @@ var ChatSource = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
setChatState: function(state) {
|
setChatState(state) {
|
||||||
// We don't want to send COMPOSING every time a letter is typed into
|
// We don't want to send COMPOSING every time a letter is typed into
|
||||||
// the entry. We send the state only when it changes. Telepathy/Empathy
|
// the entry. We send the state only when it changes. Telepathy/Empathy
|
||||||
// might change it behind our back if the user is using both
|
// might change it behind our back if the user is using both
|
||||||
@ -620,14 +620,14 @@ var ChatSource = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_presenceChanged: function (contact, presence, status, message) {
|
_presenceChanged(contact, presence, status, message) {
|
||||||
if (this._notification)
|
if (this._notification)
|
||||||
this._notification.update(this._notification.title,
|
this._notification.update(this._notification.title,
|
||||||
this._notification.bannerBodyText,
|
this._notification.bannerBodyText,
|
||||||
{ secondaryGIcon: this.getSecondaryIcon() });
|
{ secondaryGIcon: this.getSecondaryIcon() });
|
||||||
},
|
},
|
||||||
|
|
||||||
_pendingRemoved: function(channel, message) {
|
_pendingRemoved(channel, message) {
|
||||||
let idx = this._pendingMessages.indexOf(message);
|
let idx = this._pendingMessages.indexOf(message);
|
||||||
|
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
@ -640,7 +640,7 @@ var ChatSource = new Lang.Class({
|
|||||||
this._banner.hide();
|
this._banner.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_ackMessages: function() {
|
_ackMessages() {
|
||||||
// Don't clear our messages here, tp-glib will send a
|
// Don't clear our messages here, tp-glib will send a
|
||||||
// 'pending-message-removed' for each one.
|
// 'pending-message-removed' for each one.
|
||||||
this._channel.ack_all_pending_messages_async(null);
|
this._channel.ack_all_pending_messages_async(null);
|
||||||
@ -651,7 +651,7 @@ var ChatNotification = new Lang.Class({
|
|||||||
Name: 'ChatNotification',
|
Name: 'ChatNotification',
|
||||||
Extends: MessageTray.Notification,
|
Extends: MessageTray.Notification,
|
||||||
|
|
||||||
_init: function(source) {
|
_init(source) {
|
||||||
this.parent(source, source.title, null,
|
this.parent(source, source.title, null,
|
||||||
{ secondaryGIcon: source.getSecondaryIcon() });
|
{ secondaryGIcon: source.getSecondaryIcon() });
|
||||||
this.setUrgency(MessageTray.Urgency.HIGH);
|
this.setUrgency(MessageTray.Urgency.HIGH);
|
||||||
@ -661,7 +661,7 @@ var ChatNotification = new Lang.Class({
|
|||||||
this._timestampTimeoutId = 0;
|
this._timestampTimeoutId = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function(reason) {
|
destroy(reason) {
|
||||||
if (this._timestampTimeoutId)
|
if (this._timestampTimeoutId)
|
||||||
Mainloop.source_remove(this._timestampTimeoutId);
|
Mainloop.source_remove(this._timestampTimeoutId);
|
||||||
this._timestampTimeoutId = 0;
|
this._timestampTimeoutId = 0;
|
||||||
@ -681,7 +681,7 @@ var ChatNotification = new Lang.Class({
|
|||||||
* will be added, regardless of the difference since the
|
* will be added, regardless of the difference since the
|
||||||
* last timestamp
|
* last timestamp
|
||||||
*/
|
*/
|
||||||
appendMessage: function(message, noTimestamp) {
|
appendMessage(message, noTimestamp) {
|
||||||
let messageBody = GLib.markup_escape_text(message.text, -1);
|
let messageBody = GLib.markup_escape_text(message.text, -1);
|
||||||
let styles = [message.direction];
|
let styles = [message.direction];
|
||||||
|
|
||||||
@ -706,7 +706,7 @@ var ChatNotification = new Lang.Class({
|
|||||||
noTimestamp: noTimestamp });
|
noTimestamp: noTimestamp });
|
||||||
},
|
},
|
||||||
|
|
||||||
_filterMessages: function() {
|
_filterMessages() {
|
||||||
if (this.messages.length < 1)
|
if (this.messages.length < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -741,7 +741,7 @@ var ChatNotification = new Lang.Class({
|
|||||||
* timestamp: The timestamp of the message.
|
* timestamp: The timestamp of the message.
|
||||||
* noTimestamp: suppress timestamp signal?
|
* noTimestamp: suppress timestamp signal?
|
||||||
*/
|
*/
|
||||||
_append: function(props) {
|
_append(props) {
|
||||||
let currentTime = (Date.now() / 1000);
|
let currentTime = (Date.now() / 1000);
|
||||||
props = Params.parse(props, { body: null,
|
props = Params.parse(props, { body: null,
|
||||||
group: null,
|
group: null,
|
||||||
@ -779,7 +779,7 @@ var ChatNotification = new Lang.Class({
|
|||||||
this._filterMessages();
|
this._filterMessages();
|
||||||
},
|
},
|
||||||
|
|
||||||
appendTimestamp: function() {
|
appendTimestamp() {
|
||||||
this._timestampTimeoutId = 0;
|
this._timestampTimeoutId = 0;
|
||||||
|
|
||||||
this.messages[0].showTimestamp = true;
|
this.messages[0].showTimestamp = true;
|
||||||
@ -790,7 +790,7 @@ var ChatNotification = new Lang.Class({
|
|||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
|
||||||
appendAliasChange: function(oldAlias, newAlias) {
|
appendAliasChange(oldAlias, newAlias) {
|
||||||
oldAlias = GLib.markup_escape_text(oldAlias, -1);
|
oldAlias = GLib.markup_escape_text(oldAlias, -1);
|
||||||
newAlias = GLib.markup_escape_text(newAlias, -1);
|
newAlias = GLib.markup_escape_text(newAlias, -1);
|
||||||
|
|
||||||
@ -810,7 +810,7 @@ var ChatLineBox = new Lang.Class({
|
|||||||
Name: 'ChatLineBox',
|
Name: 'ChatLineBox',
|
||||||
Extends: St.BoxLayout,
|
Extends: St.BoxLayout,
|
||||||
|
|
||||||
vfunc_get_preferred_height: function(forWidth) {
|
vfunc_get_preferred_height(forWidth) {
|
||||||
let [, natHeight] = this.parent(forWidth);
|
let [, natHeight] = this.parent(forWidth);
|
||||||
return [natHeight, natHeight];
|
return [natHeight, natHeight];
|
||||||
}
|
}
|
||||||
@ -820,7 +820,7 @@ var ChatNotificationBanner = new Lang.Class({
|
|||||||
Name: 'ChatNotificationBanner',
|
Name: 'ChatNotificationBanner',
|
||||||
Extends: MessageTray.NotificationBanner,
|
Extends: MessageTray.NotificationBanner,
|
||||||
|
|
||||||
_init: function(notification) {
|
_init(notification) {
|
||||||
this.parent(notification);
|
this.parent(notification);
|
||||||
|
|
||||||
this._responseEntry = new St.Entry({ style_class: 'chat-response',
|
this._responseEntry = new St.Entry({ style_class: 'chat-response',
|
||||||
@ -886,14 +886,14 @@ var ChatNotificationBanner = new Lang.Class({
|
|||||||
this._addMessage(this.notification.messages[i]);
|
this._addMessage(this.notification.messages[i]);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this.parent();
|
this.parent();
|
||||||
this.notification.disconnect(this._messageAddedId);
|
this.notification.disconnect(this._messageAddedId);
|
||||||
this.notification.disconnect(this._messageRemovedId);
|
this.notification.disconnect(this._messageRemovedId);
|
||||||
this.notification.disconnect(this._timestampChangedId);
|
this.notification.disconnect(this._timestampChangedId);
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollTo: function(side) {
|
scrollTo(side) {
|
||||||
let adjustment = this._scrollArea.vscroll.adjustment;
|
let adjustment = this._scrollArea.vscroll.adjustment;
|
||||||
if (side == St.Side.TOP)
|
if (side == St.Side.TOP)
|
||||||
adjustment.value = adjustment.lower;
|
adjustment.value = adjustment.lower;
|
||||||
@ -901,11 +901,11 @@ var ChatNotificationBanner = new Lang.Class({
|
|||||||
adjustment.value = adjustment.upper;
|
adjustment.value = adjustment.upper;
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide() {
|
||||||
this.emit('done-displaying');
|
this.emit('done-displaying');
|
||||||
},
|
},
|
||||||
|
|
||||||
_addMessage: function(message) {
|
_addMessage(message) {
|
||||||
let highlighter = new MessageList.URLHighlighter(message.body, true, true);
|
let highlighter = new MessageList.URLHighlighter(message.body, true, true);
|
||||||
let body = highlighter.actor;
|
let body = highlighter.actor;
|
||||||
|
|
||||||
@ -927,7 +927,7 @@ var ChatNotificationBanner = new Lang.Class({
|
|||||||
this._updateTimestamp(message);
|
this._updateTimestamp(message);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateTimestamp: function(message) {
|
_updateTimestamp(message) {
|
||||||
let actor = this._messageActors.get(message);
|
let actor = this._messageActors.get(message);
|
||||||
if (!actor)
|
if (!actor)
|
||||||
return;
|
return;
|
||||||
@ -948,7 +948,7 @@ var ChatNotificationBanner = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEntryActivated: function() {
|
_onEntryActivated() {
|
||||||
let text = this._responseEntry.get_text();
|
let text = this._responseEntry.get_text();
|
||||||
if (text == '')
|
if (text == '')
|
||||||
return;
|
return;
|
||||||
@ -961,7 +961,7 @@ var ChatNotificationBanner = new Lang.Class({
|
|||||||
this.notification.source.respond(text);
|
this.notification.source.respond(text);
|
||||||
},
|
},
|
||||||
|
|
||||||
_composingStopTimeout: function() {
|
_composingStopTimeout() {
|
||||||
this._composingTimeoutId = 0;
|
this._composingTimeoutId = 0;
|
||||||
|
|
||||||
this.notification.source.setChatState(Tp.ChannelChatState.PAUSED);
|
this.notification.source.setChatState(Tp.ChannelChatState.PAUSED);
|
||||||
@ -969,7 +969,7 @@ var ChatNotificationBanner = new Lang.Class({
|
|||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEntryChanged: function() {
|
_onEntryChanged() {
|
||||||
let text = this._responseEntry.get_text();
|
let text = this._responseEntry.get_text();
|
||||||
|
|
||||||
// If we're typing, we want to send COMPOSING.
|
// If we're typing, we want to send COMPOSING.
|
||||||
|
@ -24,14 +24,14 @@ var SortGroup = {
|
|||||||
var CtrlAltTabManager = new Lang.Class({
|
var CtrlAltTabManager = new Lang.Class({
|
||||||
Name: 'CtrlAltTabManager',
|
Name: 'CtrlAltTabManager',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._items = [];
|
this._items = [];
|
||||||
this.addGroup(global.window_group, _("Windows"),
|
this.addGroup(global.window_group, _("Windows"),
|
||||||
'focus-windows-symbolic', { sortGroup: SortGroup.TOP,
|
'focus-windows-symbolic', { sortGroup: SortGroup.TOP,
|
||||||
focusCallback: Lang.bind(this, this._focusWindows) });
|
focusCallback: Lang.bind(this, this._focusWindows) });
|
||||||
},
|
},
|
||||||
|
|
||||||
addGroup: function(root, name, icon, params) {
|
addGroup(root, name, icon, params) {
|
||||||
let item = Params.parse(params, { sortGroup: SortGroup.MIDDLE,
|
let item = Params.parse(params, { sortGroup: SortGroup.MIDDLE,
|
||||||
proxy: root,
|
proxy: root,
|
||||||
focusCallback: null });
|
focusCallback: null });
|
||||||
@ -46,7 +46,7 @@ var CtrlAltTabManager = new Lang.Class({
|
|||||||
global.focus_manager.add_group(root);
|
global.focus_manager.add_group(root);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeGroup: function(root) {
|
removeGroup(root) {
|
||||||
if (root instanceof St.Widget)
|
if (root instanceof St.Widget)
|
||||||
global.focus_manager.remove_group(root);
|
global.focus_manager.remove_group(root);
|
||||||
for (let i = 0; i < this._items.length; i++) {
|
for (let i = 0; i < this._items.length; i++) {
|
||||||
@ -57,7 +57,7 @@ var CtrlAltTabManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
focusGroup: function(item, timestamp) {
|
focusGroup(item, timestamp) {
|
||||||
if (item.focusCallback)
|
if (item.focusCallback)
|
||||||
item.focusCallback(timestamp);
|
item.focusCallback(timestamp);
|
||||||
else
|
else
|
||||||
@ -68,7 +68,7 @@ var CtrlAltTabManager = new Lang.Class({
|
|||||||
// and everything else in between, sorted by X coordinate, so that
|
// and everything else in between, sorted by X coordinate, so that
|
||||||
// they will have the same left-to-right ordering in the
|
// they will have the same left-to-right ordering in the
|
||||||
// Ctrl-Alt-Tab dialog as they do onscreen.
|
// Ctrl-Alt-Tab dialog as they do onscreen.
|
||||||
_sortItems: function(a, b) {
|
_sortItems(a, b) {
|
||||||
if (a.sortGroup != b.sortGroup)
|
if (a.sortGroup != b.sortGroup)
|
||||||
return a.sortGroup - b.sortGroup;
|
return a.sortGroup - b.sortGroup;
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ var CtrlAltTabManager = new Lang.Class({
|
|||||||
return ax - bx;
|
return ax - bx;
|
||||||
},
|
},
|
||||||
|
|
||||||
popup: function(backward, binding, mask) {
|
popup(backward, binding, mask) {
|
||||||
// Start with the set of focus groups that are currently mapped
|
// Start with the set of focus groups that are currently mapped
|
||||||
let items = this._items.filter(function (item) { return item.proxy.mapped; });
|
let items = this._items.filter(function (item) { return item.proxy.mapped; });
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ var CtrlAltTabManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_focusWindows: function(timestamp) {
|
_focusWindows(timestamp) {
|
||||||
global.screen.focus_default_window(timestamp);
|
global.screen.focus_default_window(timestamp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -140,13 +140,13 @@ var CtrlAltTabPopup = new Lang.Class({
|
|||||||
Name: 'CtrlAltTabPopup',
|
Name: 'CtrlAltTabPopup',
|
||||||
Extends: SwitcherPopup.SwitcherPopup,
|
Extends: SwitcherPopup.SwitcherPopup,
|
||||||
|
|
||||||
_init: function(items) {
|
_init(items) {
|
||||||
this.parent(items);
|
this.parent(items);
|
||||||
|
|
||||||
this._switcherList = new CtrlAltTabSwitcher(this._items);
|
this._switcherList = new CtrlAltTabSwitcher(this._items);
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyPressHandler: function(keysym, action) {
|
_keyPressHandler(keysym, action) {
|
||||||
if (action == Meta.KeyBindingAction.SWITCH_PANELS)
|
if (action == Meta.KeyBindingAction.SWITCH_PANELS)
|
||||||
this._select(this._next());
|
this._select(this._next());
|
||||||
else if (action == Meta.KeyBindingAction.SWITCH_PANELS_BACKWARD)
|
else if (action == Meta.KeyBindingAction.SWITCH_PANELS_BACKWARD)
|
||||||
@ -161,7 +161,7 @@ var CtrlAltTabPopup = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_finish : function(time) {
|
_finish(time) {
|
||||||
this.parent(time);
|
this.parent(time);
|
||||||
Main.ctrlAltTabManager.focusGroup(this._items[this._selectedIndex], time);
|
Main.ctrlAltTabManager.focusGroup(this._items[this._selectedIndex], time);
|
||||||
},
|
},
|
||||||
@ -171,14 +171,14 @@ var CtrlAltTabSwitcher = new Lang.Class({
|
|||||||
Name: 'CtrlAltTabSwitcher',
|
Name: 'CtrlAltTabSwitcher',
|
||||||
Extends: SwitcherPopup.SwitcherList,
|
Extends: SwitcherPopup.SwitcherList,
|
||||||
|
|
||||||
_init : function(items) {
|
_init(items) {
|
||||||
this.parent(true);
|
this.parent(true);
|
||||||
|
|
||||||
for (let i = 0; i < items.length; i++)
|
for (let i = 0; i < items.length; i++)
|
||||||
this._addIcon(items[i]);
|
this._addIcon(items[i]);
|
||||||
},
|
},
|
||||||
|
|
||||||
_addIcon : function(item) {
|
_addIcon(item) {
|
||||||
let box = new St.BoxLayout({ style_class: 'alt-tab-app',
|
let box = new St.BoxLayout({ style_class: 'alt-tab-app',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ var DashItemContainer = new Lang.Class({
|
|||||||
Name: 'DashItemContainer',
|
Name: 'DashItemContainer',
|
||||||
Extends: St.Widget,
|
Extends: St.Widget,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent({ style_class: 'dash-item-container' });
|
this.parent({ style_class: 'dash-item-container' });
|
||||||
|
|
||||||
this._labelText = "";
|
this._labelText = "";
|
||||||
@ -56,7 +56,7 @@ var DashItemContainer = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_allocate: function(box, flags) {
|
vfunc_allocate(box, flags) {
|
||||||
this.set_allocation(box, flags);
|
this.set_allocation(box, flags);
|
||||||
|
|
||||||
if (this.child == null)
|
if (this.child == null)
|
||||||
@ -80,7 +80,7 @@ var DashItemContainer = new Lang.Class({
|
|||||||
this.child.allocate(childBox, flags);
|
this.child.allocate(childBox, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_height: function(forWidth) {
|
vfunc_get_preferred_height(forWidth) {
|
||||||
let themeNode = this.get_theme_node();
|
let themeNode = this.get_theme_node();
|
||||||
|
|
||||||
if (this.child == null)
|
if (this.child == null)
|
||||||
@ -92,7 +92,7 @@ var DashItemContainer = new Lang.Class({
|
|||||||
natHeight * this.child.scale_y);
|
natHeight * this.child.scale_y);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_width: function(forHeight) {
|
vfunc_get_preferred_width(forHeight) {
|
||||||
let themeNode = this.get_theme_node();
|
let themeNode = this.get_theme_node();
|
||||||
|
|
||||||
if (this.child == null)
|
if (this.child == null)
|
||||||
@ -104,7 +104,7 @@ var DashItemContainer = new Lang.Class({
|
|||||||
natWidth * this.child.scale_y);
|
natWidth * this.child.scale_y);
|
||||||
},
|
},
|
||||||
|
|
||||||
showLabel: function() {
|
showLabel() {
|
||||||
if (!this._labelText)
|
if (!this._labelText)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -138,12 +138,12 @@ var DashItemContainer = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
setLabelText: function(text) {
|
setLabelText(text) {
|
||||||
this._labelText = text;
|
this._labelText = text;
|
||||||
this.child.accessible_name = text;
|
this.child.accessible_name = text;
|
||||||
},
|
},
|
||||||
|
|
||||||
hideLabel: function () {
|
hideLabel() {
|
||||||
Tweener.addTween(this.label,
|
Tweener.addTween(this.label,
|
||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
time: DASH_ITEM_LABEL_HIDE_TIME,
|
time: DASH_ITEM_LABEL_HIDE_TIME,
|
||||||
@ -154,7 +154,7 @@ var DashItemContainer = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
setChild: function(actor) {
|
setChild(actor) {
|
||||||
if (this.child == actor)
|
if (this.child == actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ var DashItemContainer = new Lang.Class({
|
|||||||
this.child.set_opacity(this._childOpacity);
|
this.child.set_opacity(this._childOpacity);
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function(animate) {
|
show(animate) {
|
||||||
if (this.child == null)
|
if (this.child == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ var DashItemContainer = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
animateOutAndDestroy: function() {
|
animateOutAndDestroy() {
|
||||||
this.label.hide();
|
this.label.hide();
|
||||||
|
|
||||||
if (this.child == null) {
|
if (this.child == null) {
|
||||||
@ -235,7 +235,7 @@ var ShowAppsIcon = new Lang.Class({
|
|||||||
Name: 'ShowAppsIcon',
|
Name: 'ShowAppsIcon',
|
||||||
Extends: DashItemContainer,
|
Extends: DashItemContainer,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this.toggleButton = new St.Button({ style_class: 'show-apps',
|
this.toggleButton = new St.Button({ style_class: 'show-apps',
|
||||||
@ -254,7 +254,7 @@ var ShowAppsIcon = new Lang.Class({
|
|||||||
this.setDragApp(null);
|
this.setDragApp(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createIcon: function(size) {
|
_createIcon(size) {
|
||||||
this._iconActor = new St.Icon({ icon_name: 'view-app-grid-symbolic',
|
this._iconActor = new St.Icon({ icon_name: 'view-app-grid-symbolic',
|
||||||
icon_size: size,
|
icon_size: size,
|
||||||
style_class: 'show-apps-icon',
|
style_class: 'show-apps-icon',
|
||||||
@ -262,7 +262,7 @@ var ShowAppsIcon = new Lang.Class({
|
|||||||
return this._iconActor;
|
return this._iconActor;
|
||||||
},
|
},
|
||||||
|
|
||||||
_canRemoveApp: function(app) {
|
_canRemoveApp(app) {
|
||||||
if (app == null)
|
if (app == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ var ShowAppsIcon = new Lang.Class({
|
|||||||
return isFavorite;
|
return isFavorite;
|
||||||
},
|
},
|
||||||
|
|
||||||
setDragApp: function(app) {
|
setDragApp(app) {
|
||||||
let canRemove = this._canRemoveApp(app);
|
let canRemove = this._canRemoveApp(app);
|
||||||
|
|
||||||
this.toggleButton.set_hover(canRemove);
|
this.toggleButton.set_hover(canRemove);
|
||||||
@ -287,14 +287,14 @@ var ShowAppsIcon = new Lang.Class({
|
|||||||
this.setLabelText(_("Show Applications"));
|
this.setLabelText(_("Show Applications"));
|
||||||
},
|
},
|
||||||
|
|
||||||
handleDragOver: function(source, actor, x, y, time) {
|
handleDragOver(source, actor, x, y, time) {
|
||||||
if (!this._canRemoveApp(getAppFromSource(source)))
|
if (!this._canRemoveApp(getAppFromSource(source)))
|
||||||
return DND.DragMotionResult.NO_DROP;
|
return DND.DragMotionResult.NO_DROP;
|
||||||
|
|
||||||
return DND.DragMotionResult.MOVE_DROP;
|
return DND.DragMotionResult.MOVE_DROP;
|
||||||
},
|
},
|
||||||
|
|
||||||
acceptDrop: function(source, actor, x, y, time) {
|
acceptDrop(source, actor, x, y, time) {
|
||||||
let app = getAppFromSource(source);
|
let app = getAppFromSource(source);
|
||||||
if (!this._canRemoveApp(app))
|
if (!this._canRemoveApp(app))
|
||||||
return false;
|
return false;
|
||||||
@ -315,7 +315,7 @@ var DragPlaceholderItem = new Lang.Class({
|
|||||||
Name: 'DragPlaceholderItem',
|
Name: 'DragPlaceholderItem',
|
||||||
Extends: DashItemContainer,
|
Extends: DashItemContainer,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
this.setChild(new St.Bin({ style_class: 'placeholder' }));
|
this.setChild(new St.Bin({ style_class: 'placeholder' }));
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ var EmptyDropTargetItem = new Lang.Class({
|
|||||||
Name: 'EmptyDropTargetItem',
|
Name: 'EmptyDropTargetItem',
|
||||||
Extends: DashItemContainer,
|
Extends: DashItemContainer,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
this.setChild(new St.Bin({ style_class: 'empty-dash-drop-target' }));
|
this.setChild(new St.Bin({ style_class: 'empty-dash-drop-target' }));
|
||||||
}
|
}
|
||||||
@ -335,14 +335,14 @@ var DashActor = new Lang.Class({
|
|||||||
Name: 'DashActor',
|
Name: 'DashActor',
|
||||||
Extends: St.Widget,
|
Extends: St.Widget,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
let layout = new Clutter.BoxLayout({ orientation: Clutter.Orientation.VERTICAL });
|
let layout = new Clutter.BoxLayout({ orientation: Clutter.Orientation.VERTICAL });
|
||||||
this.parent({ name: 'dash',
|
this.parent({ name: 'dash',
|
||||||
layout_manager: layout,
|
layout_manager: layout,
|
||||||
clip_to_allocation: true });
|
clip_to_allocation: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_allocate: function(box, flags) {
|
vfunc_allocate(box, flags) {
|
||||||
let contentBox = this.get_theme_node().get_content_box(box);
|
let contentBox = this.get_theme_node().get_content_box(box);
|
||||||
let availWidth = contentBox.x2 - contentBox.x1;
|
let availWidth = contentBox.x2 - contentBox.x1;
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ var DashActor = new Lang.Class({
|
|||||||
showAppsButton.allocate(childBox, flags);
|
showAppsButton.allocate(childBox, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_height: function(forWidth) {
|
vfunc_get_preferred_height(forWidth) {
|
||||||
// We want to request the natural height of all our children
|
// We want to request the natural height of all our children
|
||||||
// as our natural height, so we chain up to StWidget (which
|
// as our natural height, so we chain up to StWidget (which
|
||||||
// then calls BoxLayout), but we only request the showApps
|
// then calls BoxLayout), but we only request the showApps
|
||||||
@ -386,7 +386,7 @@ const baseIconSizes = [ 16, 22, 24, 32, 48, 64 ];
|
|||||||
var Dash = new Lang.Class({
|
var Dash = new Lang.Class({
|
||||||
Name: 'Dash',
|
Name: 'Dash',
|
||||||
|
|
||||||
_init : function() {
|
_init() {
|
||||||
this._maxHeight = -1;
|
this._maxHeight = -1;
|
||||||
this.iconSize = 64;
|
this.iconSize = 64;
|
||||||
this._shownInitially = false;
|
this._shownInitially = false;
|
||||||
@ -445,7 +445,7 @@ var Dash = new Lang.Class({
|
|||||||
Main.ctrlAltTabManager.addGroup(this.actor, _("Dash"), 'user-bookmarks-symbolic');
|
Main.ctrlAltTabManager.addGroup(this.actor, _("Dash"), 'user-bookmarks-symbolic');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragBegin: function() {
|
_onDragBegin() {
|
||||||
this._dragCancelled = false;
|
this._dragCancelled = false;
|
||||||
this._dragMonitor = {
|
this._dragMonitor = {
|
||||||
dragMotion: Lang.bind(this, this._onDragMotion)
|
dragMotion: Lang.bind(this, this._onDragMotion)
|
||||||
@ -459,26 +459,26 @@ var Dash = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragCancelled: function() {
|
_onDragCancelled() {
|
||||||
this._dragCancelled = true;
|
this._dragCancelled = true;
|
||||||
this._endDrag();
|
this._endDrag();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragEnd: function() {
|
_onDragEnd() {
|
||||||
if (this._dragCancelled)
|
if (this._dragCancelled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._endDrag();
|
this._endDrag();
|
||||||
},
|
},
|
||||||
|
|
||||||
_endDrag: function() {
|
_endDrag() {
|
||||||
this._clearDragPlaceholder();
|
this._clearDragPlaceholder();
|
||||||
this._clearEmptyDropTarget();
|
this._clearEmptyDropTarget();
|
||||||
this._showAppsIcon.setDragApp(null);
|
this._showAppsIcon.setDragApp(null);
|
||||||
DND.removeDragMonitor(this._dragMonitor);
|
DND.removeDragMonitor(this._dragMonitor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragMotion: function(dragEvent) {
|
_onDragMotion(dragEvent) {
|
||||||
let app = getAppFromSource(dragEvent.source);
|
let app = getAppFromSource(dragEvent.source);
|
||||||
if (app == null)
|
if (app == null)
|
||||||
return DND.DragMotionResult.CONTINUE;
|
return DND.DragMotionResult.CONTINUE;
|
||||||
@ -497,18 +497,18 @@ var Dash = new Lang.Class({
|
|||||||
return DND.DragMotionResult.CONTINUE;
|
return DND.DragMotionResult.CONTINUE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_appIdListToHash: function(apps) {
|
_appIdListToHash(apps) {
|
||||||
let ids = {};
|
let ids = {};
|
||||||
for (let i = 0; i < apps.length; i++)
|
for (let i = 0; i < apps.length; i++)
|
||||||
ids[apps[i].get_id()] = apps[i];
|
ids[apps[i].get_id()] = apps[i];
|
||||||
return ids;
|
return ids;
|
||||||
},
|
},
|
||||||
|
|
||||||
_queueRedisplay: function () {
|
_queueRedisplay() {
|
||||||
Main.queueDeferredWork(this._workId);
|
Main.queueDeferredWork(this._workId);
|
||||||
},
|
},
|
||||||
|
|
||||||
_hookUpLabel: function(item, appIcon) {
|
_hookUpLabel(item, appIcon) {
|
||||||
item.child.connect('notify::hover', Lang.bind(this, function() {
|
item.child.connect('notify::hover', Lang.bind(this, function() {
|
||||||
this._syncLabel(item, appIcon);
|
this._syncLabel(item, appIcon);
|
||||||
}));
|
}));
|
||||||
@ -528,7 +528,7 @@ var Dash = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_createAppItem: function(app) {
|
_createAppItem(app) {
|
||||||
let appIcon = new AppDisplay.AppIcon(app,
|
let appIcon = new AppDisplay.AppIcon(app,
|
||||||
{ setSizeManually: true,
|
{ setSizeManually: true,
|
||||||
showLabel: false });
|
showLabel: false });
|
||||||
@ -562,7 +562,7 @@ var Dash = new Lang.Class({
|
|||||||
return item;
|
return item;
|
||||||
},
|
},
|
||||||
|
|
||||||
_itemMenuStateChanged: function(item, opened) {
|
_itemMenuStateChanged(item, opened) {
|
||||||
// When the menu closes, it calls sync_hover, which means
|
// When the menu closes, it calls sync_hover, which means
|
||||||
// that the notify::hover handler does everything we need to.
|
// that the notify::hover handler does everything we need to.
|
||||||
if (opened) {
|
if (opened) {
|
||||||
@ -575,7 +575,7 @@ var Dash = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncLabel: function (item, appIcon) {
|
_syncLabel(item, appIcon) {
|
||||||
let shouldShow = appIcon ? appIcon.shouldShowTooltip() : item.child.get_hover();
|
let shouldShow = appIcon ? appIcon.shouldShowTooltip() : item.child.get_hover();
|
||||||
|
|
||||||
if (shouldShow) {
|
if (shouldShow) {
|
||||||
@ -611,7 +611,7 @@ var Dash = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_adjustIconSize: function() {
|
_adjustIconSize() {
|
||||||
// For the icon size, we only consider children which are "proper"
|
// For the icon size, we only consider children which are "proper"
|
||||||
// icons (i.e. ignoring drag placeholders) and which are not
|
// icons (i.e. ignoring drag placeholders) and which are not
|
||||||
// animating out (which means they will be destroyed at the end of
|
// animating out (which means they will be destroyed at the end of
|
||||||
@ -703,7 +703,7 @@ var Dash = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_redisplay: function () {
|
_redisplay() {
|
||||||
let favorites = AppFavorites.getAppFavorites().getFavoriteMap();
|
let favorites = AppFavorites.getAppFavorites().getFavoriteMap();
|
||||||
|
|
||||||
let running = this._appSystem.get_running();
|
let running = this._appSystem.get_running();
|
||||||
@ -834,7 +834,7 @@ var Dash = new Lang.Class({
|
|||||||
this._box.queue_relayout();
|
this._box.queue_relayout();
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearDragPlaceholder: function() {
|
_clearDragPlaceholder() {
|
||||||
if (this._dragPlaceholder) {
|
if (this._dragPlaceholder) {
|
||||||
this._animatingPlaceholdersCount++;
|
this._animatingPlaceholdersCount++;
|
||||||
this._dragPlaceholder.animateOutAndDestroy();
|
this._dragPlaceholder.animateOutAndDestroy();
|
||||||
@ -847,14 +847,14 @@ var Dash = new Lang.Class({
|
|||||||
this._dragPlaceholderPos = -1;
|
this._dragPlaceholderPos = -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearEmptyDropTarget: function() {
|
_clearEmptyDropTarget() {
|
||||||
if (this._emptyDropTarget) {
|
if (this._emptyDropTarget) {
|
||||||
this._emptyDropTarget.animateOutAndDestroy();
|
this._emptyDropTarget.animateOutAndDestroy();
|
||||||
this._emptyDropTarget = null;
|
this._emptyDropTarget = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleDragOver : function(source, actor, x, y, time) {
|
handleDragOver(source, actor, x, y, time) {
|
||||||
let app = getAppFromSource(source);
|
let app = getAppFromSource(source);
|
||||||
|
|
||||||
// Don't allow favoriting of transient apps
|
// Don't allow favoriting of transient apps
|
||||||
@ -932,7 +932,7 @@ var Dash = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Draggable target interface
|
// Draggable target interface
|
||||||
acceptDrop : function(source, actor, x, y, time) {
|
acceptDrop(source, actor, x, y, time) {
|
||||||
let app = getAppFromSource(source);
|
let app = getAppFromSource(source);
|
||||||
|
|
||||||
// Don't allow favoriting of transient apps
|
// Don't allow favoriting of transient apps
|
||||||
|
@ -34,7 +34,7 @@ function _isToday(date) {
|
|||||||
var TodayButton = new Lang.Class({
|
var TodayButton = new Lang.Class({
|
||||||
Name: 'TodayButton',
|
Name: 'TodayButton',
|
||||||
|
|
||||||
_init: function(calendar) {
|
_init(calendar) {
|
||||||
// Having the ability to go to the current date if the user is already
|
// Having the ability to go to the current date if the user is already
|
||||||
// on the current date can be confusing. So don't make the button reactive
|
// on the current date can be confusing. So don't make the button reactive
|
||||||
// until the selected date changes.
|
// until the selected date changes.
|
||||||
@ -67,7 +67,7 @@ var TodayButton = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
setDate: function(date) {
|
setDate(date) {
|
||||||
this._dayLabel.set_text(date.toLocaleFormat('%A'));
|
this._dayLabel.set_text(date.toLocaleFormat('%A'));
|
||||||
|
|
||||||
/* Translators: This is the date format to use when the calendar popup is
|
/* Translators: This is the date format to use when the calendar popup is
|
||||||
@ -88,7 +88,7 @@ var TodayButton = new Lang.Class({
|
|||||||
var WorldClocksSection = new Lang.Class({
|
var WorldClocksSection = new Lang.Class({
|
||||||
Name: 'WorldClocksSection',
|
Name: 'WorldClocksSection',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._clock = new GnomeDesktop.WallClock();
|
this._clock = new GnomeDesktop.WallClock();
|
||||||
this._clockNotifyId = 0;
|
this._clockNotifyId = 0;
|
||||||
|
|
||||||
@ -121,11 +121,11 @@ var WorldClocksSection = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
this.actor.visible = this._clockAppMon.available;
|
this.actor.visible = this._clockAppMon.available;
|
||||||
},
|
},
|
||||||
|
|
||||||
_clocksChanged: function(settings) {
|
_clocksChanged(settings) {
|
||||||
this._grid.destroy_all_children();
|
this._grid.destroy_all_children();
|
||||||
this._locations = [];
|
this._locations = [];
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ var WorldClocksSection = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLabels: function() {
|
_updateLabels() {
|
||||||
for (let i = 0; i < this._locations.length; i++) {
|
for (let i = 0; i < this._locations.length; i++) {
|
||||||
let l = this._locations[i];
|
let l = this._locations[i];
|
||||||
let tz = GLib.TimeZone.new(l.location.get_timezone().get_tzid());
|
let tz = GLib.TimeZone.new(l.location.get_timezone().get_tzid());
|
||||||
@ -201,7 +201,7 @@ var WorldClocksSection = new Lang.Class({
|
|||||||
var WeatherSection = new Lang.Class({
|
var WeatherSection = new Lang.Class({
|
||||||
Name: 'WeatherSection',
|
Name: 'WeatherSection',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._weatherClient = new Weather.WeatherClient();
|
this._weatherClient = new Weather.WeatherClient();
|
||||||
|
|
||||||
this.actor = new St.Button({ style_class: 'weather-button',
|
this.actor = new St.Button({ style_class: 'weather-button',
|
||||||
@ -237,7 +237,7 @@ var WeatherSection = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSummary: function(info, capitalize=false) {
|
_getSummary(info, capitalize=false) {
|
||||||
let options = capitalize ? GWeather.FormatOptions.SENTENCE_CAPITALIZATION
|
let options = capitalize ? GWeather.FormatOptions.SENTENCE_CAPITALIZATION
|
||||||
: GWeather.FormatOptions.NO_CAPITALIZATION;
|
: GWeather.FormatOptions.NO_CAPITALIZATION;
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ var WeatherSection = new Lang.Class({
|
|||||||
return GWeather.Sky.to_string_full(sky, options);
|
return GWeather.Sky.to_string_full(sky, options);
|
||||||
},
|
},
|
||||||
|
|
||||||
_sameSummary: function(info1, info2) {
|
_sameSummary(info1, info2) {
|
||||||
let [ok1, phenom1, qualifier1] = info1.get_value_conditions();
|
let [ok1, phenom1, qualifier1] = info1.get_value_conditions();
|
||||||
let [ok2, phenom2, qualifier2] = info2.get_value_conditions();
|
let [ok2, phenom2, qualifier2] = info2.get_value_conditions();
|
||||||
if (ok1 || ok2)
|
if (ok1 || ok2)
|
||||||
@ -262,7 +262,7 @@ var WeatherSection = new Lang.Class({
|
|||||||
return sky1 == sky2;
|
return sky1 == sky2;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSummaryText: function() {
|
_getSummaryText() {
|
||||||
let info = this._weatherClient.info;
|
let info = this._weatherClient.info;
|
||||||
let forecasts = info.get_forecast_list();
|
let forecasts = info.get_forecast_list();
|
||||||
if (forecasts.length == 0) // No forecasts, just current conditions
|
if (forecasts.length == 0) // No forecasts, just current conditions
|
||||||
@ -310,7 +310,7 @@ var WeatherSection = new Lang.Class({
|
|||||||
return String.prototype.format.apply(fmt, summaries);
|
return String.prototype.format.apply(fmt, summaries);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getLabelText: function() {
|
_getLabelText() {
|
||||||
if (!this._weatherClient.hasLocation)
|
if (!this._weatherClient.hasLocation)
|
||||||
return _("Select a location…");
|
return _("Select a location…");
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ var WeatherSection = new Lang.Class({
|
|||||||
return _("Weather information is currently unavailable");
|
return _("Weather information is currently unavailable");
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
this.actor.visible = this._weatherClient.available;
|
this.actor.visible = this._weatherClient.available;
|
||||||
|
|
||||||
if (!this.actor.visible)
|
if (!this.actor.visible)
|
||||||
@ -342,7 +342,7 @@ var WeatherSection = new Lang.Class({
|
|||||||
var MessagesIndicator = new Lang.Class({
|
var MessagesIndicator = new Lang.Class({
|
||||||
Name: 'MessagesIndicator',
|
Name: 'MessagesIndicator',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.Icon({ icon_name: 'message-indicator-symbolic',
|
this.actor = new St.Icon({ icon_name: 'message-indicator-symbolic',
|
||||||
icon_size: 16,
|
icon_size: 16,
|
||||||
visible: false, y_expand: true,
|
visible: false, y_expand: true,
|
||||||
@ -358,18 +358,18 @@ var MessagesIndicator = new Lang.Class({
|
|||||||
sources.forEach(Lang.bind(this, function(source) { this._onSourceAdded(null, source); }));
|
sources.forEach(Lang.bind(this, function(source) { this._onSourceAdded(null, source); }));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSourceAdded: function(tray, source) {
|
_onSourceAdded(tray, source) {
|
||||||
source.connect('count-updated', Lang.bind(this, this._updateCount));
|
source.connect('count-updated', Lang.bind(this, this._updateCount));
|
||||||
this._sources.push(source);
|
this._sources.push(source);
|
||||||
this._updateCount();
|
this._updateCount();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSourceRemoved: function(tray, source) {
|
_onSourceRemoved(tray, source) {
|
||||||
this._sources.splice(this._sources.indexOf(source), 1);
|
this._sources.splice(this._sources.indexOf(source), 1);
|
||||||
this._updateCount();
|
this._updateCount();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCount: function() {
|
_updateCount() {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
this._sources.forEach(Lang.bind(this,
|
this._sources.forEach(Lang.bind(this,
|
||||||
function(source) {
|
function(source) {
|
||||||
@ -385,19 +385,19 @@ var IndicatorPad = new Lang.Class({
|
|||||||
Name: 'IndicatorPad',
|
Name: 'IndicatorPad',
|
||||||
Extends: St.Widget,
|
Extends: St.Widget,
|
||||||
|
|
||||||
_init: function(actor) {
|
_init(actor) {
|
||||||
this._source = actor;
|
this._source = actor;
|
||||||
this._source.connect('notify::visible', () => { this.queue_relayout(); });
|
this._source.connect('notify::visible', () => { this.queue_relayout(); });
|
||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_width: function(container, forHeight) {
|
vfunc_get_preferred_width(container, forHeight) {
|
||||||
if (this._source.visible)
|
if (this._source.visible)
|
||||||
return this._source.get_preferred_width(forHeight);
|
return this._source.get_preferred_width(forHeight);
|
||||||
return [0, 0];
|
return [0, 0];
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_height: function(container, forWidth) {
|
vfunc_get_preferred_height(container, forWidth) {
|
||||||
if (this._source.visible)
|
if (this._source.visible)
|
||||||
return this._source.get_preferred_height(forWidth);
|
return this._source.get_preferred_height(forWidth);
|
||||||
return [0, 0];
|
return [0, 0];
|
||||||
@ -408,7 +408,7 @@ var FreezableBinLayout = new Lang.Class({
|
|||||||
Name: 'FreezableBinLayout',
|
Name: 'FreezableBinLayout',
|
||||||
Extends: Clutter.BinLayout,
|
Extends: Clutter.BinLayout,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._frozen = false;
|
this._frozen = false;
|
||||||
@ -425,19 +425,19 @@ var FreezableBinLayout = new Lang.Class({
|
|||||||
this.layout_changed();
|
this.layout_changed();
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_width: function(container, forHeight) {
|
vfunc_get_preferred_width(container, forHeight) {
|
||||||
if (!this._frozen || this._savedWidth.some(isNaN))
|
if (!this._frozen || this._savedWidth.some(isNaN))
|
||||||
return this.parent(container, forHeight);
|
return this.parent(container, forHeight);
|
||||||
return this._savedWidth;
|
return this._savedWidth;
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_height: function(container, forWidth) {
|
vfunc_get_preferred_height(container, forWidth) {
|
||||||
if (!this._frozen || this._savedHeight.some(isNaN))
|
if (!this._frozen || this._savedHeight.some(isNaN))
|
||||||
return this.parent(container, forWidth);
|
return this.parent(container, forWidth);
|
||||||
return this._savedHeight;
|
return this._savedHeight;
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_allocate: function(container, allocation, flags) {
|
vfunc_allocate(container, allocation, flags) {
|
||||||
this.parent(container, allocation, flags);
|
this.parent(container, allocation, flags);
|
||||||
|
|
||||||
let [width, height] = allocation.get_size();
|
let [width, height] = allocation.get_size();
|
||||||
@ -450,12 +450,12 @@ var CalendarColumnLayout = new Lang.Class({
|
|||||||
Name: 'CalendarColumnLayout',
|
Name: 'CalendarColumnLayout',
|
||||||
Extends: Clutter.BoxLayout,
|
Extends: Clutter.BoxLayout,
|
||||||
|
|
||||||
_init: function(actor) {
|
_init(actor) {
|
||||||
this.parent({ orientation: Clutter.Orientation.VERTICAL });
|
this.parent({ orientation: Clutter.Orientation.VERTICAL });
|
||||||
this._calActor = actor;
|
this._calActor = actor;
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_width: function(container, forHeight) {
|
vfunc_get_preferred_width(container, forHeight) {
|
||||||
if (!this._calActor || this._calActor.get_parent() != container)
|
if (!this._calActor || this._calActor.get_parent() != container)
|
||||||
return this.parent(container, forHeight);
|
return this.parent(container, forHeight);
|
||||||
return this._calActor.get_preferred_width(forHeight);
|
return this._calActor.get_preferred_width(forHeight);
|
||||||
@ -466,7 +466,7 @@ var DateMenuButton = new Lang.Class({
|
|||||||
Name: 'DateMenuButton',
|
Name: 'DateMenuButton',
|
||||||
Extends: PanelMenu.Button,
|
Extends: PanelMenu.Button,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
let item;
|
let item;
|
||||||
let hbox;
|
let hbox;
|
||||||
let vbox;
|
let vbox;
|
||||||
@ -557,11 +557,11 @@ var DateMenuButton = new Lang.Class({
|
|||||||
this._sessionUpdated();
|
this._sessionUpdated();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getEventSource: function() {
|
_getEventSource() {
|
||||||
return new Calendar.DBusEventSource();
|
return new Calendar.DBusEventSource();
|
||||||
},
|
},
|
||||||
|
|
||||||
_setEventSource: function(eventSource) {
|
_setEventSource(eventSource) {
|
||||||
if (this._eventSource)
|
if (this._eventSource)
|
||||||
this._eventSource.destroy();
|
this._eventSource.destroy();
|
||||||
|
|
||||||
@ -571,7 +571,7 @@ var DateMenuButton = new Lang.Class({
|
|||||||
this._eventSource = eventSource;
|
this._eventSource = eventSource;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateTimeZone: function() {
|
_updateTimeZone() {
|
||||||
// SpiderMonkey caches the time zone so we must explicitly clear it
|
// SpiderMonkey caches the time zone so we must explicitly clear it
|
||||||
// before we can update the calendar, see
|
// before we can update the calendar, see
|
||||||
// https://bugzilla.gnome.org/show_bug.cgi?id=678507
|
// https://bugzilla.gnome.org/show_bug.cgi?id=678507
|
||||||
@ -580,7 +580,7 @@ var DateMenuButton = new Lang.Class({
|
|||||||
this._calendar.updateTimeZone();
|
this._calendar.updateTimeZone();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
let eventSource;
|
let eventSource;
|
||||||
let showEvents = Main.sessionMode.showCalendarEvents;
|
let showEvents = Main.sessionMode.showCalendarEvents;
|
||||||
if (showEvents) {
|
if (showEvents) {
|
||||||
|
@ -11,7 +11,7 @@ var Dialog = new Lang.Class({
|
|||||||
Name: 'Dialog',
|
Name: 'Dialog',
|
||||||
Extends: St.Widget,
|
Extends: St.Widget,
|
||||||
|
|
||||||
_init: function (parentActor, styleClass) {
|
_init(parentActor, styleClass) {
|
||||||
this.parent({ layout_manager: new Clutter.BinLayout() });
|
this.parent({ layout_manager: new Clutter.BinLayout() });
|
||||||
this.connect('destroy', Lang.bind(this, this._onDestroy));
|
this.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ var Dialog = new Lang.Class({
|
|||||||
this._parentActor.add_child(this);
|
this._parentActor.add_child(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createDialog: function () {
|
_createDialog() {
|
||||||
this._dialog = new St.BoxLayout({ style_class: 'modal-dialog',
|
this._dialog = new St.BoxLayout({ style_class: 'modal-dialog',
|
||||||
x_align: Clutter.ActorAlign.CENTER,
|
x_align: Clutter.ActorAlign.CENTER,
|
||||||
y_align: Clutter.ActorAlign.CENTER,
|
y_align: Clutter.ActorAlign.CENTER,
|
||||||
@ -56,13 +56,13 @@ var Dialog = new Lang.Class({
|
|||||||
y_align: St.Align.START });
|
y_align: St.Align.START });
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function () {
|
_onDestroy() {
|
||||||
if (this._eventId != 0)
|
if (this._eventId != 0)
|
||||||
this._parentActor.disconnect(this._eventId);
|
this._parentActor.disconnect(this._eventId);
|
||||||
this._eventId = 0;
|
this._eventId = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_modalEventHandler: function (actor, event) {
|
_modalEventHandler(actor, event) {
|
||||||
if (event.type() == Clutter.EventType.KEY_PRESS) {
|
if (event.type() == Clutter.EventType.KEY_PRESS) {
|
||||||
this._pressedKey = event.get_key_symbol();
|
this._pressedKey = event.get_key_symbol();
|
||||||
} else if (event.type() == Clutter.EventType.KEY_RELEASE) {
|
} else if (event.type() == Clutter.EventType.KEY_RELEASE) {
|
||||||
@ -88,7 +88,7 @@ var Dialog = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setInitialKeyFocus: function(actor) {
|
_setInitialKeyFocus(actor) {
|
||||||
if (this._initialKeyFocus)
|
if (this._initialKeyFocus)
|
||||||
this._initialKeyFocus.disconnect(this._initialKeyFocusDestroyId);
|
this._initialKeyFocus.disconnect(this._initialKeyFocusDestroyId);
|
||||||
|
|
||||||
@ -104,11 +104,11 @@ var Dialog = new Lang.Class({
|
|||||||
return this._initialKeyFocus || this;
|
return this._initialKeyFocus || this;
|
||||||
},
|
},
|
||||||
|
|
||||||
addContent: function (actor) {
|
addContent(actor) {
|
||||||
this.contentLayout.add (actor, { expand: true });
|
this.contentLayout.add (actor, { expand: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
addButton: function (buttonInfo) {
|
addButton(buttonInfo) {
|
||||||
let { label, action, key } = buttonInfo;
|
let { label, action, key } = buttonInfo;
|
||||||
let isDefault = buttonInfo['default'];
|
let isDefault = buttonInfo['default'];
|
||||||
let keys;
|
let keys;
|
||||||
@ -145,7 +145,7 @@ var Dialog = new Lang.Class({
|
|||||||
return button;
|
return button;
|
||||||
},
|
},
|
||||||
|
|
||||||
clearButtons: function () {
|
clearButtons() {
|
||||||
this.buttonLayout.destroy_all_children();
|
this.buttonLayout.destroy_all_children();
|
||||||
this._buttonKeys = {};
|
this._buttonKeys = {};
|
||||||
},
|
},
|
||||||
@ -173,7 +173,7 @@ var MessageDialogContent = new Lang.Class({
|
|||||||
null)
|
null)
|
||||||
},
|
},
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
this._icon = new St.Icon({ y_align: Clutter.ActorAlign.START });
|
this._icon = new St.Icon({ y_align: Clutter.ActorAlign.START });
|
||||||
this._title = new St.Label({ style_class: 'headline' });
|
this._title = new St.Label({ style_class: 'headline' });
|
||||||
this._subtitle = new St.Label();
|
this._subtitle = new St.Label();
|
||||||
@ -243,7 +243,7 @@ var MessageDialogContent = new Lang.Class({
|
|||||||
this.notify(prop);
|
this.notify(prop);
|
||||||
},
|
},
|
||||||
|
|
||||||
insertBeforeBody: function(actor) {
|
insertBeforeBody(actor) {
|
||||||
this.messageBox.insert_child_below(actor, this._body);
|
this.messageBox.insert_child_below(actor, this._body);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
50
js/ui/dnd.js
50
js/ui/dnd.js
@ -72,7 +72,7 @@ function removeDragMonitor(monitor) {
|
|||||||
var _Draggable = new Lang.Class({
|
var _Draggable = new Lang.Class({
|
||||||
Name: 'Draggable',
|
Name: 'Draggable',
|
||||||
|
|
||||||
_init : function(actor, params) {
|
_init(actor, params) {
|
||||||
params = Params.parse(params, { manualMode: false,
|
params = Params.parse(params, { manualMode: false,
|
||||||
restoreOnSuccess: false,
|
restoreOnSuccess: false,
|
||||||
dragActorMaxSize: undefined,
|
dragActorMaxSize: undefined,
|
||||||
@ -108,7 +108,7 @@ var _Draggable = new Lang.Class({
|
|||||||
this._eventsGrabbed = false;
|
this._eventsGrabbed = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonPress : function (actor, event) {
|
_onButtonPress(actor, event) {
|
||||||
if (event.get_button() != 1)
|
if (event.get_button() != 1)
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ var _Draggable = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onTouchEvent: function (actor, event) {
|
_onTouchEvent(actor, event) {
|
||||||
if (event.type() != Clutter.EventType.TOUCH_BEGIN ||
|
if (event.type() != Clutter.EventType.TOUCH_BEGIN ||
|
||||||
!global.display.is_pointer_emulating_sequence(event.get_event_sequence()))
|
!global.display.is_pointer_emulating_sequence(event.get_event_sequence()))
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
@ -145,7 +145,7 @@ var _Draggable = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_grabDevice: function(actor) {
|
_grabDevice(actor) {
|
||||||
let manager = Clutter.DeviceManager.get_default();
|
let manager = Clutter.DeviceManager.get_default();
|
||||||
let pointer = manager.get_core_device(Clutter.InputDeviceType.POINTER_DEVICE);
|
let pointer = manager.get_core_device(Clutter.InputDeviceType.POINTER_DEVICE);
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ var _Draggable = new Lang.Class({
|
|||||||
this._grabbedDevice = pointer;
|
this._grabbedDevice = pointer;
|
||||||
},
|
},
|
||||||
|
|
||||||
_ungrabDevice: function() {
|
_ungrabDevice() {
|
||||||
if (this._touchSequence)
|
if (this._touchSequence)
|
||||||
this._grabbedDevice.sequence_ungrab (this._touchSequence);
|
this._grabbedDevice.sequence_ungrab (this._touchSequence);
|
||||||
else
|
else
|
||||||
@ -167,13 +167,13 @@ var _Draggable = new Lang.Class({
|
|||||||
this._grabbedDevice = null;
|
this._grabbedDevice = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_grabActor: function() {
|
_grabActor() {
|
||||||
this._grabDevice(this.actor);
|
this._grabDevice(this.actor);
|
||||||
this._onEventId = this.actor.connect('event',
|
this._onEventId = this.actor.connect('event',
|
||||||
Lang.bind(this, this._onEvent));
|
Lang.bind(this, this._onEvent));
|
||||||
},
|
},
|
||||||
|
|
||||||
_ungrabActor: function() {
|
_ungrabActor() {
|
||||||
if (!this._onEventId)
|
if (!this._onEventId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ var _Draggable = new Lang.Class({
|
|||||||
this._onEventId = null;
|
this._onEventId = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_grabEvents: function() {
|
_grabEvents() {
|
||||||
if (!this._eventsGrabbed) {
|
if (!this._eventsGrabbed) {
|
||||||
this._eventsGrabbed = Main.pushModal(_getEventHandlerActor());
|
this._eventsGrabbed = Main.pushModal(_getEventHandlerActor());
|
||||||
if (this._eventsGrabbed)
|
if (this._eventsGrabbed)
|
||||||
@ -190,7 +190,7 @@ var _Draggable = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_ungrabEvents: function() {
|
_ungrabEvents() {
|
||||||
if (this._eventsGrabbed) {
|
if (this._eventsGrabbed) {
|
||||||
this._ungrabDevice();
|
this._ungrabDevice();
|
||||||
Main.popModal(_getEventHandlerActor());
|
Main.popModal(_getEventHandlerActor());
|
||||||
@ -198,7 +198,7 @@ var _Draggable = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEvent: function(actor, event) {
|
_onEvent(actor, event) {
|
||||||
// We intercept BUTTON_RELEASE event to know that the button was released in case we
|
// We intercept BUTTON_RELEASE event to know that the button was released in case we
|
||||||
// didn't start the drag, to drop the draggable in case the drag was in progress, and
|
// didn't start the drag, to drop the draggable in case the drag was in progress, and
|
||||||
// to complete the drag and ensure that whatever happens to be under the pointer does
|
// to complete the drag and ensure that whatever happens to be under the pointer does
|
||||||
@ -249,7 +249,7 @@ var _Draggable = new Lang.Class({
|
|||||||
* actors for other purposes (for example if you're using
|
* actors for other purposes (for example if you're using
|
||||||
* PopupMenu.ignoreRelease())
|
* PopupMenu.ignoreRelease())
|
||||||
*/
|
*/
|
||||||
fakeRelease: function() {
|
fakeRelease() {
|
||||||
this._buttonDown = false;
|
this._buttonDown = false;
|
||||||
this._ungrabActor();
|
this._ungrabActor();
|
||||||
},
|
},
|
||||||
@ -264,7 +264,7 @@ var _Draggable = new Lang.Class({
|
|||||||
* This function is useful to call if you've specified manualMode
|
* This function is useful to call if you've specified manualMode
|
||||||
* for the draggable.
|
* for the draggable.
|
||||||
*/
|
*/
|
||||||
startDrag: function (stageX, stageY, time, sequence) {
|
startDrag(stageX, stageY, time, sequence) {
|
||||||
currentDraggable = this;
|
currentDraggable = this;
|
||||||
this._dragInProgress = true;
|
this._dragInProgress = true;
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ var _Draggable = new Lang.Class({
|
|||||||
scale_y: scale * origScale,
|
scale_y: scale * origScale,
|
||||||
time: SCALE_ANIMATION_TIME,
|
time: SCALE_ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onUpdate: function() {
|
onUpdate() {
|
||||||
let currentScale = this._dragActor.scale_x / origScale;
|
let currentScale = this._dragActor.scale_x / origScale;
|
||||||
this._dragOffsetX = currentScale * origDragOffsetX;
|
this._dragOffsetX = currentScale * origDragOffsetX;
|
||||||
this._dragOffsetY = currentScale * origDragOffsetY;
|
this._dragOffsetY = currentScale * origDragOffsetY;
|
||||||
@ -383,7 +383,7 @@ var _Draggable = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_maybeStartDrag: function(event) {
|
_maybeStartDrag(event) {
|
||||||
let [stageX, stageY] = event.get_coords();
|
let [stageX, stageY] = event.get_coords();
|
||||||
|
|
||||||
// See if the user has moved the mouse enough to trigger a drag
|
// See if the user has moved the mouse enough to trigger a drag
|
||||||
@ -397,7 +397,7 @@ var _Draggable = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateDragHover : function () {
|
_updateDragHover() {
|
||||||
this._updateHoverId = 0;
|
this._updateHoverId = 0;
|
||||||
let target = this._dragActor.get_stage().get_actor_at_pos(Clutter.PickMode.ALL,
|
let target = this._dragActor.get_stage().get_actor_at_pos(Clutter.PickMode.ALL,
|
||||||
this._dragX, this._dragY);
|
this._dragX, this._dragY);
|
||||||
@ -441,7 +441,7 @@ var _Draggable = new Lang.Class({
|
|||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_queueUpdateDragHover: function() {
|
_queueUpdateDragHover() {
|
||||||
if (this._updateHoverId)
|
if (this._updateHoverId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -450,7 +450,7 @@ var _Draggable = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._updateHoverId, '[gnome-shell] this._updateDragHover');
|
GLib.Source.set_name_by_id(this._updateHoverId, '[gnome-shell] this._updateDragHover');
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateDragPosition : function (event) {
|
_updateDragPosition(event) {
|
||||||
let [stageX, stageY] = event.get_coords();
|
let [stageX, stageY] = event.get_coords();
|
||||||
this._dragX = stageX;
|
this._dragX = stageX;
|
||||||
this._dragY = stageY;
|
this._dragY = stageY;
|
||||||
@ -461,7 +461,7 @@ var _Draggable = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_dragActorDropped: function(event) {
|
_dragActorDropped(event) {
|
||||||
let [dropX, dropY] = event.get_coords();
|
let [dropX, dropY] = event.get_coords();
|
||||||
let target = this._dragActor.get_stage().get_actor_at_pos(Clutter.PickMode.ALL,
|
let target = this._dragActor.get_stage().get_actor_at_pos(Clutter.PickMode.ALL,
|
||||||
dropX, dropY);
|
dropX, dropY);
|
||||||
@ -524,7 +524,7 @@ var _Draggable = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getRestoreLocation: function() {
|
_getRestoreLocation() {
|
||||||
let x, y, scale;
|
let x, y, scale;
|
||||||
|
|
||||||
if (this._dragActorSource && this._dragActorSource.visible) {
|
if (this._dragActorSource && this._dragActorSource.visible) {
|
||||||
@ -556,7 +556,7 @@ var _Draggable = new Lang.Class({
|
|||||||
return [x, y, scale];
|
return [x, y, scale];
|
||||||
},
|
},
|
||||||
|
|
||||||
_cancelDrag: function(eventTime) {
|
_cancelDrag(eventTime) {
|
||||||
this.emit('drag-cancelled', eventTime);
|
this.emit('drag-cancelled', eventTime);
|
||||||
this._dragInProgress = false;
|
this._dragInProgress = false;
|
||||||
let [snapBackX, snapBackY, snapBackScale] = this._getRestoreLocation();
|
let [snapBackX, snapBackY, snapBackScale] = this._getRestoreLocation();
|
||||||
@ -581,7 +581,7 @@ var _Draggable = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_restoreDragActor: function(eventTime) {
|
_restoreDragActor(eventTime) {
|
||||||
this._dragInProgress = false;
|
this._dragInProgress = false;
|
||||||
let [restoreX, restoreY, restoreScale] = this._getRestoreLocation();
|
let [restoreX, restoreY, restoreScale] = this._getRestoreLocation();
|
||||||
|
|
||||||
@ -594,7 +594,7 @@ var _Draggable = new Lang.Class({
|
|||||||
{ time: REVERT_ANIMATION_TIME });
|
{ time: REVERT_ANIMATION_TIME });
|
||||||
},
|
},
|
||||||
|
|
||||||
_animateDragEnd: function (eventTime, params) {
|
_animateDragEnd(eventTime, params) {
|
||||||
this._animationInProgress = true;
|
this._animationInProgress = true;
|
||||||
|
|
||||||
// finish animation if the actor gets destroyed
|
// finish animation if the actor gets destroyed
|
||||||
@ -613,7 +613,7 @@ var _Draggable = new Lang.Class({
|
|||||||
Tweener.addTween(this._dragActor, params)
|
Tweener.addTween(this._dragActor, params)
|
||||||
},
|
},
|
||||||
|
|
||||||
_finishAnimation : function () {
|
_finishAnimation() {
|
||||||
if (!this._animationInProgress)
|
if (!this._animationInProgress)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -624,7 +624,7 @@ var _Draggable = new Lang.Class({
|
|||||||
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAnimationComplete : function (dragActor, eventTime) {
|
_onAnimationComplete(dragActor, eventTime) {
|
||||||
dragActor.disconnect(this._dragActorDestroyId);
|
dragActor.disconnect(this._dragActorDestroyId);
|
||||||
this._dragActorDestroyId = 0;
|
this._dragActorDestroyId = 0;
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ var _Draggable = new Lang.Class({
|
|||||||
this._finishAnimation();
|
this._finishAnimation();
|
||||||
},
|
},
|
||||||
|
|
||||||
_dragComplete: function() {
|
_dragComplete() {
|
||||||
if (!this._actorDestroyed)
|
if (!this._actorDestroyed)
|
||||||
Shell.util_set_hidden_from_pick(this._dragActor, false);
|
Shell.util_set_hidden_from_pick(this._dragActor, false);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ var EdgeDragAction = new Lang.Class({
|
|||||||
Extends: Clutter.GestureAction,
|
Extends: Clutter.GestureAction,
|
||||||
Signals: { 'activated': {} },
|
Signals: { 'activated': {} },
|
||||||
|
|
||||||
_init : function(side, allowedModes) {
|
_init(side, allowedModes) {
|
||||||
this.parent();
|
this.parent();
|
||||||
this._side = side;
|
this._side = side;
|
||||||
this._allowedModes = allowedModes;
|
this._allowedModes = allowedModes;
|
||||||
@ -27,14 +27,14 @@ var EdgeDragAction = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMonitorRect : function (x, y) {
|
_getMonitorRect(x, y) {
|
||||||
let rect = new Meta.Rectangle({ x: x - 1, y: y - 1, width: 1, height: 1 });
|
let rect = new Meta.Rectangle({ x: x - 1, y: y - 1, width: 1, height: 1 });
|
||||||
let monitorIndex = global.screen.get_monitor_index_for_rect(rect);
|
let monitorIndex = global.screen.get_monitor_index_for_rect(rect);
|
||||||
|
|
||||||
return global.screen.get_monitor_geometry(monitorIndex);
|
return global.screen.get_monitor_geometry(monitorIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_gesture_prepare : function(action, actor) {
|
vfunc_gesture_prepare(action, actor) {
|
||||||
if (this.get_n_current_points() == 0)
|
if (this.get_n_current_points() == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ var EdgeDragAction = new Lang.Class({
|
|||||||
(this._side == St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD));
|
(this._side == St.Side.BOTTOM && y > monitorRect.y + monitorRect.height - EDGE_THRESHOLD));
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_gesture_progress : function (action, actor) {
|
vfunc_gesture_progress(action, actor) {
|
||||||
let [startX, startY] = this.get_press_coords(0);
|
let [startX, startY] = this.get_press_coords(0);
|
||||||
let [x, y] = this.get_motion_coords(0);
|
let [x, y] = this.get_motion_coords(0);
|
||||||
let offsetX = Math.abs (x - startX);
|
let offsetX = Math.abs (x - startX);
|
||||||
@ -70,7 +70,7 @@ var EdgeDragAction = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_gesture_end : function (action, actor) {
|
vfunc_gesture_end(action, actor) {
|
||||||
let [startX, startY] = this.get_press_coords(0);
|
let [startX, startY] = this.get_press_coords(0);
|
||||||
let [x, y] = this.get_motion_coords(0);
|
let [x, y] = this.get_motion_coords(0);
|
||||||
let monitorRect = this._getMonitorRect(startX, startY);
|
let monitorRect = this._getMonitorRect(startX, startY);
|
||||||
|
@ -63,12 +63,12 @@ const EndSessionDialogIface = '<node> \
|
|||||||
const logoutDialogContent = {
|
const logoutDialogContent = {
|
||||||
subjectWithUser: C_("title", "Log Out %s"),
|
subjectWithUser: C_("title", "Log Out %s"),
|
||||||
subject: C_("title", "Log Out"),
|
subject: C_("title", "Log Out"),
|
||||||
descriptionWithUser: function(user, seconds) {
|
descriptionWithUser(user, seconds) {
|
||||||
return ngettext("%s will be logged out automatically in %d second.",
|
return ngettext("%s will be logged out automatically in %d second.",
|
||||||
"%s will be logged out automatically in %d seconds.",
|
"%s will be logged out automatically in %d seconds.",
|
||||||
seconds).format(user, seconds);
|
seconds).format(user, seconds);
|
||||||
},
|
},
|
||||||
description: function(seconds) {
|
description(seconds) {
|
||||||
return ngettext("You will be logged out automatically in %d second.",
|
return ngettext("You will be logged out automatically in %d second.",
|
||||||
"You will be logged out automatically in %d seconds.",
|
"You will be logged out automatically in %d seconds.",
|
||||||
seconds).format(seconds);
|
seconds).format(seconds);
|
||||||
@ -83,7 +83,7 @@ const logoutDialogContent = {
|
|||||||
const shutdownDialogContent = {
|
const shutdownDialogContent = {
|
||||||
subject: C_("title", "Power Off"),
|
subject: C_("title", "Power Off"),
|
||||||
subjectWithUpdates: C_("title", "Install Updates & Power Off"),
|
subjectWithUpdates: C_("title", "Install Updates & Power Off"),
|
||||||
description: function(seconds) {
|
description(seconds) {
|
||||||
return ngettext("The system will power off automatically in %d second.",
|
return ngettext("The system will power off automatically in %d second.",
|
||||||
"The system will power off automatically in %d seconds.",
|
"The system will power off automatically in %d seconds.",
|
||||||
seconds).format(seconds);
|
seconds).format(seconds);
|
||||||
@ -101,7 +101,7 @@ const shutdownDialogContent = {
|
|||||||
|
|
||||||
const restartDialogContent = {
|
const restartDialogContent = {
|
||||||
subject: C_("title", "Restart"),
|
subject: C_("title", "Restart"),
|
||||||
description: function(seconds) {
|
description(seconds) {
|
||||||
return ngettext("The system will restart automatically in %d second.",
|
return ngettext("The system will restart automatically in %d second.",
|
||||||
"The system will restart automatically in %d seconds.",
|
"The system will restart automatically in %d seconds.",
|
||||||
seconds).format(seconds);
|
seconds).format(seconds);
|
||||||
@ -117,7 +117,7 @@ const restartDialogContent = {
|
|||||||
const restartUpdateDialogContent = {
|
const restartUpdateDialogContent = {
|
||||||
|
|
||||||
subject: C_("title", "Restart & Install Updates"),
|
subject: C_("title", "Restart & Install Updates"),
|
||||||
description: function(seconds) {
|
description(seconds) {
|
||||||
return ngettext("The system will automatically restart and install updates in %d second.",
|
return ngettext("The system will automatically restart and install updates in %d second.",
|
||||||
"The system will automatically restart and install updates in %d seconds.",
|
"The system will automatically restart and install updates in %d seconds.",
|
||||||
seconds).format(seconds);
|
seconds).format(seconds);
|
||||||
@ -135,7 +135,7 @@ const restartUpdateDialogContent = {
|
|||||||
const restartUpgradeDialogContent = {
|
const restartUpgradeDialogContent = {
|
||||||
|
|
||||||
subject: C_("title", "Restart & Install Upgrade"),
|
subject: C_("title", "Restart & Install Upgrade"),
|
||||||
upgradeDescription: function(distroName, distroVersion) {
|
upgradeDescription(distroName, distroVersion) {
|
||||||
/* Translators: This is the text displayed for system upgrades in the
|
/* Translators: This is the text displayed for system upgrades in the
|
||||||
shut down dialog. First %s gets replaced with the distro name and
|
shut down dialog. First %s gets replaced with the distro name and
|
||||||
second %s with the distro version to upgrade to */
|
second %s with the distro version to upgrade to */
|
||||||
@ -279,7 +279,7 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
Name: 'EndSessionDialog',
|
Name: 'EndSessionDialog',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent({ styleClass: 'end-session-dialog',
|
this.parent({ styleClass: 'end-session-dialog',
|
||||||
destroyOnClose: false });
|
destroyOnClose: false });
|
||||||
|
|
||||||
@ -398,12 +398,12 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/SessionManager/EndSessionDialog');
|
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/SessionManager/EndSessionDialog');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this._user.disconnect(this._userLoadedId);
|
this._user.disconnect(this._userLoadedId);
|
||||||
this._user.disconnect(this._userChangedId);
|
this._user.disconnect(this._userChangedId);
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let open = (this.state == ModalDialog.State.OPENING || this.state == ModalDialog.State.OPENED);
|
let open = (this.state == ModalDialog.State.OPENING || this.state == ModalDialog.State.OPENED);
|
||||||
if (!open)
|
if (!open)
|
||||||
return;
|
return;
|
||||||
@ -476,7 +476,7 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
this._sessionHeader.visible = hasSessions;
|
this._sessionHeader.visible = hasSessions;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateButtons: function() {
|
_updateButtons() {
|
||||||
let dialogContent = DialogContent[this._type];
|
let dialogContent = DialogContent[this._type];
|
||||||
let buttons = [{ action: Lang.bind(this, this.cancel),
|
let buttons = [{ action: Lang.bind(this, this.cancel),
|
||||||
label: _("Cancel"),
|
label: _("Cancel"),
|
||||||
@ -499,20 +499,20 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
this.setButtons(buttons);
|
this.setButtons(buttons);
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function(skipSignal) {
|
close(skipSignal) {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
if (!skipSignal)
|
if (!skipSignal)
|
||||||
this._dbusImpl.emit_signal('Closed', null);
|
this._dbusImpl.emit_signal('Closed', null);
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function() {
|
cancel() {
|
||||||
this._stopTimer();
|
this._stopTimer();
|
||||||
this._dbusImpl.emit_signal('Canceled', null);
|
this._dbusImpl.emit_signal('Canceled', null);
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
_confirm: function(signal) {
|
_confirm(signal) {
|
||||||
let callback = Lang.bind(this, function() {
|
let callback = Lang.bind(this, function() {
|
||||||
this._fadeOutDialog();
|
this._fadeOutDialog();
|
||||||
this._stopTimer();
|
this._stopTimer();
|
||||||
@ -547,11 +547,11 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onOpened: function() {
|
_onOpened() {
|
||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_triggerOfflineUpdateReboot: function(callback) {
|
_triggerOfflineUpdateReboot(callback) {
|
||||||
this._pkOfflineProxy.TriggerRemote('reboot',
|
this._pkOfflineProxy.TriggerRemote('reboot',
|
||||||
function (result, error) {
|
function (result, error) {
|
||||||
if (error)
|
if (error)
|
||||||
@ -561,7 +561,7 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_triggerOfflineUpdateShutdown: function(callback) {
|
_triggerOfflineUpdateShutdown(callback) {
|
||||||
this._pkOfflineProxy.TriggerRemote('power-off',
|
this._pkOfflineProxy.TriggerRemote('power-off',
|
||||||
function (result, error) {
|
function (result, error) {
|
||||||
if (error)
|
if (error)
|
||||||
@ -571,7 +571,7 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_triggerOfflineUpdateCancel: function(callback) {
|
_triggerOfflineUpdateCancel(callback) {
|
||||||
this._pkOfflineProxy.CancelRemote(function (result, error) {
|
this._pkOfflineProxy.CancelRemote(function (result, error) {
|
||||||
if (error)
|
if (error)
|
||||||
log(error.message);
|
log(error.message);
|
||||||
@ -580,7 +580,7 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_startTimer: function() {
|
_startTimer() {
|
||||||
let startTime = GLib.get_monotonic_time();
|
let startTime = GLib.get_monotonic_time();
|
||||||
this._secondsLeft = this._totalSecondsToStayOpen;
|
this._secondsLeft = this._totalSecondsToStayOpen;
|
||||||
|
|
||||||
@ -605,7 +605,7 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._timerId, '[gnome-shell] this._confirm');
|
GLib.Source.set_name_by_id(this._timerId, '[gnome-shell] this._confirm');
|
||||||
},
|
},
|
||||||
|
|
||||||
_stopTimer: function() {
|
_stopTimer() {
|
||||||
if (this._timerId > 0) {
|
if (this._timerId > 0) {
|
||||||
Mainloop.source_remove(this._timerId);
|
Mainloop.source_remove(this._timerId);
|
||||||
this._timerId = 0;
|
this._timerId = 0;
|
||||||
@ -614,7 +614,7 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
this._secondsLeft = 0;
|
this._secondsLeft = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_constructListItemForApp: function(inhibitor, app) {
|
_constructListItemForApp(inhibitor, app) {
|
||||||
let actor = new St.BoxLayout({ style_class: 'end-session-dialog-app-list-item',
|
let actor = new St.BoxLayout({ style_class: 'end-session-dialog-app-list-item',
|
||||||
can_focus: true });
|
can_focus: true });
|
||||||
actor.add(app.create_icon_texture(_ITEM_ICON_SIZE));
|
actor.add(app.create_icon_texture(_ITEM_ICON_SIZE));
|
||||||
@ -639,7 +639,7 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
return actor;
|
return actor;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onInhibitorLoaded: function(inhibitor) {
|
_onInhibitorLoaded(inhibitor) {
|
||||||
if (this._applications.indexOf(inhibitor) < 0) {
|
if (this._applications.indexOf(inhibitor) < 0) {
|
||||||
// Stale inhibitor
|
// Stale inhibitor
|
||||||
return;
|
return;
|
||||||
@ -658,7 +658,7 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_constructListItemForSession: function(session) {
|
_constructListItemForSession(session) {
|
||||||
let avatar = new UserWidget.Avatar(session.user, { iconSize: _ITEM_ICON_SIZE });
|
let avatar = new UserWidget.Avatar(session.user, { iconSize: _ITEM_ICON_SIZE });
|
||||||
avatar.update();
|
avatar.update();
|
||||||
|
|
||||||
@ -688,7 +688,7 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
return actor;
|
return actor;
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadSessions: function() {
|
_loadSessions() {
|
||||||
this._loginManager.listSessions(Lang.bind(this, function(result) {
|
this._loginManager.listSessions(Lang.bind(this, function(result) {
|
||||||
let n = 0;
|
let n = 0;
|
||||||
for (let i = 0; i < result.length; i++) {
|
for (let i = 0; i < result.length; i++) {
|
||||||
@ -723,7 +723,7 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
OpenAsync: function(parameters, invocation) {
|
OpenAsync(parameters, invocation) {
|
||||||
let [type, timestamp, totalSecondsToStayOpen, inhibitorObjectPaths] = parameters;
|
let [type, timestamp, totalSecondsToStayOpen, inhibitorObjectPaths] = parameters;
|
||||||
this._totalSecondsToStayOpen = totalSecondsToStayOpen;
|
this._totalSecondsToStayOpen = totalSecondsToStayOpen;
|
||||||
this._type = type;
|
this._type = type;
|
||||||
@ -794,7 +794,7 @@ var EndSessionDialog = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
Close: function(parameters, invocation) {
|
Close(parameters, invocation) {
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -187,7 +187,7 @@ var InstallExtensionDialog = new Lang.Class({
|
|||||||
Name: 'InstallExtensionDialog',
|
Name: 'InstallExtensionDialog',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function(uuid, info, invocation) {
|
_init(uuid, info, invocation) {
|
||||||
this.parent({ styleClass: 'extension-dialog' });
|
this.parent({ styleClass: 'extension-dialog' });
|
||||||
|
|
||||||
this._uuid = uuid;
|
this._uuid = uuid;
|
||||||
@ -218,12 +218,12 @@ var InstallExtensionDialog = new Lang.Class({
|
|||||||
box.add(label);
|
box.add(label);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCancelButtonPressed: function(button, event) {
|
_onCancelButtonPressed(button, event) {
|
||||||
this.close();
|
this.close();
|
||||||
this._invocation.return_value(GLib.Variant.new('(s)', ['cancelled']));
|
this._invocation.return_value(GLib.Variant.new('(s)', ['cancelled']));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onInstallButtonPressed: function(button, event) {
|
_onInstallButtonPressed(button, event) {
|
||||||
let params = { shell_version: Config.PACKAGE_VERSION };
|
let params = { shell_version: Config.PACKAGE_VERSION };
|
||||||
|
|
||||||
let url = REPOSITORY_URL_DOWNLOAD.format(this._uuid);
|
let url = REPOSITORY_URL_DOWNLOAD.format(this._uuid);
|
||||||
|
@ -31,7 +31,7 @@ const STATECHANGED = 'object:state-changed';
|
|||||||
var FocusCaretTracker = new Lang.Class({
|
var FocusCaretTracker = new Lang.Class({
|
||||||
Name: 'FocusCaretTracker',
|
Name: 'FocusCaretTracker',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._atspiListener = Atspi.EventListener.new(Lang.bind(this, this._onChanged));
|
this._atspiListener = Atspi.EventListener.new(Lang.bind(this, this._onChanged));
|
||||||
|
|
||||||
this._atspiInited = false;
|
this._atspiInited = false;
|
||||||
@ -39,14 +39,14 @@ var FocusCaretTracker = new Lang.Class({
|
|||||||
this._caretListenerRegistered = false;
|
this._caretListenerRegistered = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onChanged: function(event) {
|
_onChanged(event) {
|
||||||
if (event.type.indexOf(STATECHANGED) == 0)
|
if (event.type.indexOf(STATECHANGED) == 0)
|
||||||
this.emit('focus-changed', event);
|
this.emit('focus-changed', event);
|
||||||
else if (event.type == CARETMOVED)
|
else if (event.type == CARETMOVED)
|
||||||
this.emit('caret-moved', event);
|
this.emit('caret-moved', event);
|
||||||
},
|
},
|
||||||
|
|
||||||
_initAtspi: function() {
|
_initAtspi() {
|
||||||
if (!this._atspiInited && Atspi.init() == 0) {
|
if (!this._atspiInited && Atspi.init() == 0) {
|
||||||
Atspi.set_timeout(250, 250);
|
Atspi.set_timeout(250, 250);
|
||||||
this._atspiInited = true;
|
this._atspiInited = true;
|
||||||
@ -55,7 +55,7 @@ var FocusCaretTracker = new Lang.Class({
|
|||||||
return this._atspiInited;
|
return this._atspiInited;
|
||||||
},
|
},
|
||||||
|
|
||||||
registerFocusListener: function() {
|
registerFocusListener() {
|
||||||
if (!this._initAtspi() || this._focusListenerRegistered)
|
if (!this._initAtspi() || this._focusListenerRegistered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ var FocusCaretTracker = new Lang.Class({
|
|||||||
this._focusListenerRegistered = true;
|
this._focusListenerRegistered = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
registerCaretListener: function() {
|
registerCaretListener() {
|
||||||
if (!this._initAtspi() || this._caretListenerRegistered)
|
if (!this._initAtspi() || this._caretListenerRegistered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ var FocusCaretTracker = new Lang.Class({
|
|||||||
this._caretListenerRegistered = true;
|
this._caretListenerRegistered = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
deregisterFocusListener: function() {
|
deregisterFocusListener() {
|
||||||
if (!this._focusListenerRegistered)
|
if (!this._focusListenerRegistered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ var FocusCaretTracker = new Lang.Class({
|
|||||||
this._focusListenerRegistered = false;
|
this._focusListenerRegistered = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
deregisterCaretListener: function() {
|
deregisterCaretListener() {
|
||||||
if (!this._caretListenerRegistered)
|
if (!this._caretListenerRegistered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ function _popGrabHelper(grabHelper) {
|
|||||||
var GrabHelper = new Lang.Class({
|
var GrabHelper = new Lang.Class({
|
||||||
Name: 'GrabHelper',
|
Name: 'GrabHelper',
|
||||||
|
|
||||||
_init: function(owner, params) {
|
_init(owner, params) {
|
||||||
this._owner = owner;
|
this._owner = owner;
|
||||||
this._modalParams = params;
|
this._modalParams = params;
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ var GrabHelper = new Lang.Class({
|
|||||||
//
|
//
|
||||||
// Adds @actor to the set of actors that are allowed to process events
|
// Adds @actor to the set of actors that are allowed to process events
|
||||||
// during a grab.
|
// during a grab.
|
||||||
addActor: function(actor) {
|
addActor(actor) {
|
||||||
actor.__grabHelperDestroyId = actor.connect('destroy', Lang.bind(this, function() { this.removeActor(actor); }));
|
actor.__grabHelperDestroyId = actor.connect('destroy', Lang.bind(this, function() { this.removeActor(actor); }));
|
||||||
this._actors.push(actor);
|
this._actors.push(actor);
|
||||||
},
|
},
|
||||||
@ -76,7 +76,7 @@ var GrabHelper = new Lang.Class({
|
|||||||
//
|
//
|
||||||
// Removes @actor from the set of actors that are allowed to
|
// Removes @actor from the set of actors that are allowed to
|
||||||
// process events during a grab.
|
// process events during a grab.
|
||||||
removeActor: function(actor) {
|
removeActor(actor) {
|
||||||
let index = this._actors.indexOf(actor);
|
let index = this._actors.indexOf(actor);
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
this._actors.splice(index, 1);
|
this._actors.splice(index, 1);
|
||||||
@ -86,7 +86,7 @@ var GrabHelper = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_isWithinGrabbedActor: function(actor) {
|
_isWithinGrabbedActor(actor) {
|
||||||
let currentActor = this.currentGrab.actor;
|
let currentActor = this.currentGrab.actor;
|
||||||
while (actor) {
|
while (actor) {
|
||||||
if (this._actors.indexOf(actor) != -1)
|
if (this._actors.indexOf(actor) != -1)
|
||||||
@ -110,7 +110,7 @@ var GrabHelper = new Lang.Class({
|
|||||||
return this._grabStack;
|
return this._grabStack;
|
||||||
},
|
},
|
||||||
|
|
||||||
_findStackIndex: function(actor) {
|
_findStackIndex(actor) {
|
||||||
if (!actor)
|
if (!actor)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ var GrabHelper = new Lang.Class({
|
|||||||
return -1;
|
return -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
_actorInGrabStack: function(actor) {
|
_actorInGrabStack(actor) {
|
||||||
while (actor) {
|
while (actor) {
|
||||||
let idx = this._findStackIndex(actor);
|
let idx = this._findStackIndex(actor);
|
||||||
if (idx >= 0)
|
if (idx >= 0)
|
||||||
@ -131,7 +131,7 @@ var GrabHelper = new Lang.Class({
|
|||||||
return -1;
|
return -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
isActorGrabbed: function(actor) {
|
isActorGrabbed(actor) {
|
||||||
return this._findStackIndex(actor) >= 0;
|
return this._findStackIndex(actor) >= 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ var GrabHelper = new Lang.Class({
|
|||||||
// to that actor instead of navigating in @params.actor. This is for
|
// to that actor instead of navigating in @params.actor. This is for
|
||||||
// use cases like menus, where we want to grab the menu actor, but keep
|
// use cases like menus, where we want to grab the menu actor, but keep
|
||||||
// focus on the clicked on menu item.
|
// focus on the clicked on menu item.
|
||||||
grab: function(params) {
|
grab(params) {
|
||||||
params = Params.parse(params, { actor: null,
|
params = Params.parse(params, { actor: null,
|
||||||
focus: null,
|
focus: null,
|
||||||
onUngrab: null });
|
onUngrab: null });
|
||||||
@ -195,7 +195,7 @@ var GrabHelper = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_takeModalGrab: function() {
|
_takeModalGrab() {
|
||||||
let firstGrab = (this._modalCount == 0);
|
let firstGrab = (this._modalCount == 0);
|
||||||
if (firstGrab) {
|
if (firstGrab) {
|
||||||
if (!Main.pushModal(this._owner, this._modalParams))
|
if (!Main.pushModal(this._owner, this._modalParams))
|
||||||
@ -208,7 +208,7 @@ var GrabHelper = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_releaseModalGrab: function() {
|
_releaseModalGrab() {
|
||||||
this._modalCount--;
|
this._modalCount--;
|
||||||
if (this._modalCount > 0)
|
if (this._modalCount > 0)
|
||||||
return;
|
return;
|
||||||
@ -227,7 +227,7 @@ var GrabHelper = new Lang.Class({
|
|||||||
// capture event handler returns false. This is designed for things
|
// capture event handler returns false. This is designed for things
|
||||||
// like the ComboBoxMenu that go away on press, but need to eat
|
// like the ComboBoxMenu that go away on press, but need to eat
|
||||||
// the next release event.
|
// the next release event.
|
||||||
ignoreRelease: function() {
|
ignoreRelease() {
|
||||||
this._ignoreUntilRelease = true;
|
this._ignoreUntilRelease = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ var GrabHelper = new Lang.Class({
|
|||||||
// popped until the grabbed actor is at the top of the grab stack.
|
// popped until the grabbed actor is at the top of the grab stack.
|
||||||
// The onUngrab callback for every grab is called for every popped
|
// The onUngrab callback for every grab is called for every popped
|
||||||
// grab with the parameter %false.
|
// grab with the parameter %false.
|
||||||
ungrab: function(params) {
|
ungrab(params) {
|
||||||
params = Params.parse(params, { actor: this.currentGrab.actor,
|
params = Params.parse(params, { actor: this.currentGrab.actor,
|
||||||
isUser: false });
|
isUser: false });
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ var GrabHelper = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onCapturedEvent: function(event) {
|
onCapturedEvent(event) {
|
||||||
let type = event.type();
|
let type = event.type();
|
||||||
|
|
||||||
if (type == Clutter.EventType.KEY_PRESS &&
|
if (type == Clutter.EventType.KEY_PRESS &&
|
||||||
|
@ -17,7 +17,7 @@ var DEFAULT_INDEX_LABELS = [ '1', '2', '3', '4', '5', '6', '7', '8',
|
|||||||
var CandidateArea = new Lang.Class({
|
var CandidateArea = new Lang.Class({
|
||||||
Name: 'CandidateArea',
|
Name: 'CandidateArea',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.BoxLayout({ vertical: true,
|
this.actor = new St.BoxLayout({ vertical: true,
|
||||||
reactive: true,
|
reactive: true,
|
||||||
visible: false });
|
visible: false });
|
||||||
@ -76,7 +76,7 @@ var CandidateArea = new Lang.Class({
|
|||||||
this._cursorPosition = 0;
|
this._cursorPosition = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
setOrientation: function(orientation) {
|
setOrientation(orientation) {
|
||||||
if (this._orientation == orientation)
|
if (this._orientation == orientation)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ var CandidateArea = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setCandidates: function(indexes, candidates, cursorPosition, cursorVisible) {
|
setCandidates(indexes, candidates, cursorPosition, cursorVisible) {
|
||||||
for (let i = 0; i < MAX_CANDIDATES_PER_PAGE; ++i) {
|
for (let i = 0; i < MAX_CANDIDATES_PER_PAGE; ++i) {
|
||||||
let visible = i < candidates.length;
|
let visible = i < candidates.length;
|
||||||
let box = this._candidateBoxes[i];
|
let box = this._candidateBoxes[i];
|
||||||
@ -116,7 +116,7 @@ var CandidateArea = new Lang.Class({
|
|||||||
this._candidateBoxes[cursorPosition].add_style_pseudo_class('selected');
|
this._candidateBoxes[cursorPosition].add_style_pseudo_class('selected');
|
||||||
},
|
},
|
||||||
|
|
||||||
updateButtons: function(wrapsAround, page, nPages) {
|
updateButtons(wrapsAround, page, nPages) {
|
||||||
if (nPages < 2) {
|
if (nPages < 2) {
|
||||||
this._buttonBox.hide();
|
this._buttonBox.hide();
|
||||||
return;
|
return;
|
||||||
@ -131,7 +131,7 @@ Signals.addSignalMethods(CandidateArea.prototype);
|
|||||||
var CandidatePopup = new Lang.Class({
|
var CandidatePopup = new Lang.Class({
|
||||||
Name: 'CandidatePopup',
|
Name: 'CandidatePopup',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._boxPointer = new BoxPointer.BoxPointer(St.Side.TOP);
|
this._boxPointer = new BoxPointer.BoxPointer(St.Side.TOP);
|
||||||
this._boxPointer.actor.visible = false;
|
this._boxPointer.actor.visible = false;
|
||||||
this._boxPointer.actor.style_class = 'candidate-popup-boxpointer';
|
this._boxPointer.actor.style_class = 'candidate-popup-boxpointer';
|
||||||
@ -173,7 +173,7 @@ var CandidatePopup = new Lang.Class({
|
|||||||
this._panelService = null;
|
this._panelService = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
setPanelService: function(panelService) {
|
setPanelService(panelService) {
|
||||||
this._panelService = panelService;
|
this._panelService = panelService;
|
||||||
if (!panelService)
|
if (!panelService)
|
||||||
return;
|
return;
|
||||||
@ -289,13 +289,13 @@ var CandidatePopup = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_setDummyCursorGeometry: function(x, y, w, h) {
|
_setDummyCursorGeometry(x, y, w, h) {
|
||||||
Main.layoutManager.setDummyCursorGeometry(x, y, w, h);
|
Main.layoutManager.setDummyCursorGeometry(x, y, w, h);
|
||||||
if (this._boxPointer.actor.visible)
|
if (this._boxPointer.actor.visible)
|
||||||
this._boxPointer.setPosition(Main.layoutManager.dummyCursor, 0);
|
this._boxPointer.setPosition(Main.layoutManager.dummyCursor, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateVisibility: function() {
|
_updateVisibility() {
|
||||||
let isVisible = (!Main.keyboard.visible &&
|
let isVisible = (!Main.keyboard.visible &&
|
||||||
(this._preeditText.visible ||
|
(this._preeditText.visible ||
|
||||||
this._auxText.visible ||
|
this._auxText.visible ||
|
||||||
@ -310,7 +310,7 @@ var CandidatePopup = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_setTextAttributes: function(clutterText, ibusAttrList) {
|
_setTextAttributes(clutterText, ibusAttrList) {
|
||||||
let attr;
|
let attr;
|
||||||
for (let i = 0; attr = ibusAttrList.get(i); ++i)
|
for (let i = 0; attr = ibusAttrList.get(i); ++i)
|
||||||
if (attr.get_attr_type() == IBus.AttrType.BACKGROUND)
|
if (attr.get_attr_type() == IBus.AttrType.BACKGROUND)
|
||||||
|
@ -37,7 +37,7 @@ var APPICON_ANIMATION_OUT_TIME = 0.25;
|
|||||||
var BaseIcon = new Lang.Class({
|
var BaseIcon = new Lang.Class({
|
||||||
Name: 'BaseIcon',
|
Name: 'BaseIcon',
|
||||||
|
|
||||||
_init : function(label, params) {
|
_init(label, params) {
|
||||||
params = Params.parse(params, { createIcon: null,
|
params = Params.parse(params, { createIcon: null,
|
||||||
setSizeManually: false,
|
setSizeManually: false,
|
||||||
showLabel: true });
|
showLabel: true });
|
||||||
@ -88,7 +88,7 @@ var BaseIcon = new Lang.Class({
|
|||||||
this._iconThemeChangedId = cache.connect('icon-theme-changed', Lang.bind(this, this._onIconThemeChanged));
|
this._iconThemeChangedId = cache.connect('icon-theme-changed', Lang.bind(this, this._onIconThemeChanged));
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocate: function(actor, box, flags) {
|
_allocate(actor, box, flags) {
|
||||||
let availWidth = box.x2 - box.x1;
|
let availWidth = box.x2 - box.x1;
|
||||||
let availHeight = box.y2 - box.y1;
|
let availHeight = box.y2 - box.y1;
|
||||||
|
|
||||||
@ -122,11 +122,11 @@ var BaseIcon = new Lang.Class({
|
|||||||
this._iconBin.allocate(childBox, flags);
|
this._iconBin.allocate(childBox, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredWidth: function(actor, forHeight, alloc) {
|
_getPreferredWidth(actor, forHeight, alloc) {
|
||||||
this._getPreferredHeight(actor, -1, alloc);
|
this._getPreferredHeight(actor, -1, alloc);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredHeight: function(actor, forWidth, alloc) {
|
_getPreferredHeight(actor, forWidth, alloc) {
|
||||||
let [iconMinHeight, iconNatHeight] = this._iconBin.get_preferred_height(forWidth);
|
let [iconMinHeight, iconNatHeight] = this._iconBin.get_preferred_height(forWidth);
|
||||||
alloc.min_size = iconMinHeight;
|
alloc.min_size = iconMinHeight;
|
||||||
alloc.natural_size = iconNatHeight;
|
alloc.natural_size = iconNatHeight;
|
||||||
@ -140,11 +140,11 @@ var BaseIcon = new Lang.Class({
|
|||||||
|
|
||||||
// This can be overridden by a subclass, or by the createIcon
|
// This can be overridden by a subclass, or by the createIcon
|
||||||
// parameter to _init()
|
// parameter to _init()
|
||||||
createIcon: function(size) {
|
createIcon(size) {
|
||||||
throw new Error('no implementation of createIcon in ' + this);
|
throw new Error('no implementation of createIcon in ' + this);
|
||||||
},
|
},
|
||||||
|
|
||||||
setIconSize: function(size) {
|
setIconSize(size) {
|
||||||
if (!this._setSizeManually)
|
if (!this._setSizeManually)
|
||||||
throw new Error('setSizeManually has to be set to use setIconsize');
|
throw new Error('setSizeManually has to be set to use setIconsize');
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ var BaseIcon = new Lang.Class({
|
|||||||
this._createIconTexture(size);
|
this._createIconTexture(size);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createIconTexture: function(size) {
|
_createIconTexture(size) {
|
||||||
if (this.icon)
|
if (this.icon)
|
||||||
this.icon.destroy();
|
this.icon.destroy();
|
||||||
this.iconSize = size;
|
this.iconSize = size;
|
||||||
@ -163,7 +163,7 @@ var BaseIcon = new Lang.Class({
|
|||||||
this._iconBin.child = this.icon;
|
this._iconBin.child = this.icon;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onStyleChanged: function() {
|
_onStyleChanged() {
|
||||||
let node = this.actor.get_theme_node();
|
let node = this.actor.get_theme_node();
|
||||||
this._spacing = node.get_length('spacing');
|
this._spacing = node.get_length('spacing');
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ var BaseIcon = new Lang.Class({
|
|||||||
this._createIconTexture(size);
|
this._createIconTexture(size);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
if (this._iconThemeChangedId > 0) {
|
if (this._iconThemeChangedId > 0) {
|
||||||
let cache = St.TextureCache.get_default();
|
let cache = St.TextureCache.get_default();
|
||||||
cache.disconnect(this._iconThemeChangedId);
|
cache.disconnect(this._iconThemeChangedId);
|
||||||
@ -189,11 +189,11 @@ var BaseIcon = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onIconThemeChanged: function() {
|
_onIconThemeChanged() {
|
||||||
this._createIconTexture(this.iconSize);
|
this._createIconTexture(this.iconSize);
|
||||||
},
|
},
|
||||||
|
|
||||||
animateZoomOut: function() {
|
animateZoomOut() {
|
||||||
// Animate only the child instead of the entire actor, so the
|
// Animate only the child instead of the entire actor, so the
|
||||||
// styles like hover and running are not applied while
|
// styles like hover and running are not applied while
|
||||||
// animating.
|
// animating.
|
||||||
@ -234,7 +234,7 @@ function zoomOutActor(actor) {
|
|||||||
translation_y: containedY - scaledY,
|
translation_y: containedY - scaledY,
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
actorClone.destroy();
|
actorClone.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -243,7 +243,7 @@ function zoomOutActor(actor) {
|
|||||||
var IconGrid = new Lang.Class({
|
var IconGrid = new Lang.Class({
|
||||||
Name: 'IconGrid',
|
Name: 'IconGrid',
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
params = Params.parse(params, { rowLimit: null,
|
params = Params.parse(params, { rowLimit: null,
|
||||||
columnLimit: null,
|
columnLimit: null,
|
||||||
minRows: 1,
|
minRows: 1,
|
||||||
@ -290,19 +290,19 @@ var IconGrid = new Lang.Class({
|
|||||||
this._grid.connect('actor-removed', Lang.bind(this, this._childRemoved));
|
this._grid.connect('actor-removed', Lang.bind(this, this._childRemoved));
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyFocusIn: function(actor) {
|
_keyFocusIn(actor) {
|
||||||
this.emit('key-focus-in', actor);
|
this.emit('key-focus-in', actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_childAdded: function(grid, child) {
|
_childAdded(grid, child) {
|
||||||
child._iconGridKeyFocusInId = child.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
|
child._iconGridKeyFocusInId = child.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
|
||||||
},
|
},
|
||||||
|
|
||||||
_childRemoved: function(grid, child) {
|
_childRemoved(grid, child) {
|
||||||
child.disconnect(child._iconGridKeyFocusInId);
|
child.disconnect(child._iconGridKeyFocusInId);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredWidth: function (grid, forHeight, alloc) {
|
_getPreferredWidth(grid, forHeight, alloc) {
|
||||||
if (this._fillParent)
|
if (this._fillParent)
|
||||||
// Ignore all size requests of children and request a size of 0;
|
// Ignore all size requests of children and request a size of 0;
|
||||||
// later we'll allocate as many children as fit the parent
|
// later we'll allocate as many children as fit the parent
|
||||||
@ -320,7 +320,7 @@ var IconGrid = new Lang.Class({
|
|||||||
alloc.natural_size = nColumns * this._getHItemSize() + totalSpacing + this.leftPadding + this.rightPadding;
|
alloc.natural_size = nColumns * this._getHItemSize() + totalSpacing + this.leftPadding + this.rightPadding;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getVisibleChildren: function() {
|
_getVisibleChildren() {
|
||||||
let children = this._grid.get_children();
|
let children = this._grid.get_children();
|
||||||
children = children.filter(function(actor) {
|
children = children.filter(function(actor) {
|
||||||
return actor.visible;
|
return actor.visible;
|
||||||
@ -328,7 +328,7 @@ var IconGrid = new Lang.Class({
|
|||||||
return children;
|
return children;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredHeight: function (grid, forWidth, alloc) {
|
_getPreferredHeight(grid, forWidth, alloc) {
|
||||||
if (this._fillParent)
|
if (this._fillParent)
|
||||||
// Ignore all size requests of children and request a size of 0;
|
// Ignore all size requests of children and request a size of 0;
|
||||||
// later we'll allocate as many children as fit the parent
|
// later we'll allocate as many children as fit the parent
|
||||||
@ -354,7 +354,7 @@ var IconGrid = new Lang.Class({
|
|||||||
alloc.natural_size = height;
|
alloc.natural_size = height;
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocate: function (grid, box, flags) {
|
_allocate(grid, box, flags) {
|
||||||
if (this._fillParent) {
|
if (this._fillParent) {
|
||||||
// Reset the passed in box to fill the parent
|
// Reset the passed in box to fill the parent
|
||||||
let parentBox = this.actor.get_parent().allocation;
|
let parentBox = this.actor.get_parent().allocation;
|
||||||
@ -414,21 +414,21 @@ var IconGrid = new Lang.Class({
|
|||||||
* Intended to be override by subclasses if they need a different
|
* Intended to be override by subclasses if they need a different
|
||||||
* set of items to be animated.
|
* set of items to be animated.
|
||||||
*/
|
*/
|
||||||
_getChildrenToAnimate: function() {
|
_getChildrenToAnimate() {
|
||||||
return this._getVisibleChildren();
|
return this._getVisibleChildren();
|
||||||
},
|
},
|
||||||
|
|
||||||
_cancelAnimation: function() {
|
_cancelAnimation() {
|
||||||
this._clonesAnimating.forEach(clone => { clone.destroy(); });
|
this._clonesAnimating.forEach(clone => { clone.destroy(); });
|
||||||
this._clonesAnimating = [];
|
this._clonesAnimating = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
_animationDone: function() {
|
_animationDone() {
|
||||||
this._clonesAnimating = [];
|
this._clonesAnimating = [];
|
||||||
this.emit('animation-done');
|
this.emit('animation-done');
|
||||||
},
|
},
|
||||||
|
|
||||||
animatePulse: function(animationDirection) {
|
animatePulse(animationDirection) {
|
||||||
if (animationDirection != AnimationDirection.IN)
|
if (animationDirection != AnimationDirection.IN)
|
||||||
throw new Error("Pulse animation only implements 'in' animation direction");
|
throw new Error("Pulse animation only implements 'in' animation direction");
|
||||||
|
|
||||||
@ -479,7 +479,7 @@ var IconGrid = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
animateSpring: function(animationDirection, sourceActor) {
|
animateSpring(animationDirection, sourceActor) {
|
||||||
this._cancelAnimation();
|
this._cancelAnimation();
|
||||||
|
|
||||||
let actors = this._getChildrenToAnimate();
|
let actors = this._getChildrenToAnimate();
|
||||||
@ -587,13 +587,13 @@ var IconGrid = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_restoreItemsOpacity: function() {
|
_restoreItemsOpacity() {
|
||||||
for (let index = 0; index < this._items.length; index++) {
|
for (let index = 0; index < this._items.length; index++) {
|
||||||
this._items[index].actor.opacity = 255;
|
this._items[index].actor.opacity = 255;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getAllocatedChildSizeAndSpacing: function(child) {
|
_getAllocatedChildSizeAndSpacing(child) {
|
||||||
let [,, natWidth, natHeight] = child.get_preferred_size();
|
let [,, natWidth, natHeight] = child.get_preferred_size();
|
||||||
let width = Math.min(this._getHItemSize(), natWidth);
|
let width = Math.min(this._getHItemSize(), natWidth);
|
||||||
let xSpacing = Math.max(0, width - natWidth) / 2;
|
let xSpacing = Math.max(0, width - natWidth) / 2;
|
||||||
@ -602,7 +602,7 @@ var IconGrid = new Lang.Class({
|
|||||||
return [width, height, xSpacing, ySpacing];
|
return [width, height, xSpacing, ySpacing];
|
||||||
},
|
},
|
||||||
|
|
||||||
_calculateChildBox: function(child, x, y, box) {
|
_calculateChildBox(child, x, y, box) {
|
||||||
/* Center the item in its allocation horizontally */
|
/* Center the item in its allocation horizontally */
|
||||||
let [width, height, childXSpacing, childYSpacing] =
|
let [width, height, childXSpacing, childYSpacing] =
|
||||||
this._getAllocatedChildSizeAndSpacing(child);
|
this._getAllocatedChildSizeAndSpacing(child);
|
||||||
@ -620,15 +620,15 @@ var IconGrid = new Lang.Class({
|
|||||||
return childBox;
|
return childBox;
|
||||||
},
|
},
|
||||||
|
|
||||||
columnsForWidth: function(rowWidth) {
|
columnsForWidth(rowWidth) {
|
||||||
return this._computeLayout(rowWidth)[0];
|
return this._computeLayout(rowWidth)[0];
|
||||||
},
|
},
|
||||||
|
|
||||||
getRowLimit: function() {
|
getRowLimit() {
|
||||||
return this._rowLimit;
|
return this._rowLimit;
|
||||||
},
|
},
|
||||||
|
|
||||||
_computeLayout: function (forWidth) {
|
_computeLayout(forWidth) {
|
||||||
let nColumns = 0;
|
let nColumns = 0;
|
||||||
let usedWidth = this.leftPadding + this.rightPadding;
|
let usedWidth = this.leftPadding + this.rightPadding;
|
||||||
let spacing = this._getSpacing();
|
let spacing = this._getSpacing();
|
||||||
@ -645,7 +645,7 @@ var IconGrid = new Lang.Class({
|
|||||||
return [nColumns, usedWidth];
|
return [nColumns, usedWidth];
|
||||||
},
|
},
|
||||||
|
|
||||||
_onStyleChanged: function() {
|
_onStyleChanged() {
|
||||||
let themeNode = this.actor.get_theme_node();
|
let themeNode = this.actor.get_theme_node();
|
||||||
this._spacing = themeNode.get_length('spacing');
|
this._spacing = themeNode.get_length('spacing');
|
||||||
this._hItemSize = themeNode.get_length('-shell-grid-horizontal-item-size') || ICON_SIZE;
|
this._hItemSize = themeNode.get_length('-shell-grid-horizontal-item-size') || ICON_SIZE;
|
||||||
@ -653,7 +653,7 @@ var IconGrid = new Lang.Class({
|
|||||||
this._grid.queue_relayout();
|
this._grid.queue_relayout();
|
||||||
},
|
},
|
||||||
|
|
||||||
nRows: function(forWidth) {
|
nRows(forWidth) {
|
||||||
let children = this._getVisibleChildren();
|
let children = this._getVisibleChildren();
|
||||||
let nColumns = (forWidth < 0) ? children.length : this._computeLayout(forWidth)[0];
|
let nColumns = (forWidth < 0) ? children.length : this._computeLayout(forWidth)[0];
|
||||||
let nRows = (nColumns > 0) ? Math.ceil(children.length / nColumns) : 0;
|
let nRows = (nColumns > 0) ? Math.ceil(children.length / nColumns) : 0;
|
||||||
@ -662,35 +662,35 @@ var IconGrid = new Lang.Class({
|
|||||||
return nRows;
|
return nRows;
|
||||||
},
|
},
|
||||||
|
|
||||||
rowsForHeight: function(forHeight) {
|
rowsForHeight(forHeight) {
|
||||||
return Math.floor((forHeight - (this.topPadding + this.bottomPadding) + this._getSpacing()) / (this._getVItemSize() + this._getSpacing()));
|
return Math.floor((forHeight - (this.topPadding + this.bottomPadding) + this._getSpacing()) / (this._getVItemSize() + this._getSpacing()));
|
||||||
},
|
},
|
||||||
|
|
||||||
usedHeightForNRows: function(nRows) {
|
usedHeightForNRows(nRows) {
|
||||||
return (this._getVItemSize() + this._getSpacing()) * nRows - this._getSpacing() + this.topPadding + this.bottomPadding;
|
return (this._getVItemSize() + this._getSpacing()) * nRows - this._getSpacing() + this.topPadding + this.bottomPadding;
|
||||||
},
|
},
|
||||||
|
|
||||||
usedWidth: function(forWidth) {
|
usedWidth(forWidth) {
|
||||||
return this.usedWidthForNColumns(this.columnsForWidth(forWidth));
|
return this.usedWidthForNColumns(this.columnsForWidth(forWidth));
|
||||||
},
|
},
|
||||||
|
|
||||||
usedWidthForNColumns: function(columns) {
|
usedWidthForNColumns(columns) {
|
||||||
let usedWidth = columns * (this._getHItemSize() + this._getSpacing());
|
let usedWidth = columns * (this._getHItemSize() + this._getSpacing());
|
||||||
usedWidth -= this._getSpacing();
|
usedWidth -= this._getSpacing();
|
||||||
return usedWidth + this.leftPadding + this.rightPadding;
|
return usedWidth + this.leftPadding + this.rightPadding;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeAll: function() {
|
removeAll() {
|
||||||
this._items = [];
|
this._items = [];
|
||||||
this._grid.remove_all_children();
|
this._grid.remove_all_children();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyAll: function() {
|
destroyAll() {
|
||||||
this._items = [];
|
this._items = [];
|
||||||
this._grid.destroy_all_children();
|
this._grid.destroy_all_children();
|
||||||
},
|
},
|
||||||
|
|
||||||
addItem: function(item, index) {
|
addItem(item, index) {
|
||||||
if (!item.icon instanceof BaseIcon)
|
if (!item.icon instanceof BaseIcon)
|
||||||
throw new Error('Only items with a BaseIcon icon property can be added to IconGrid');
|
throw new Error('Only items with a BaseIcon icon property can be added to IconGrid');
|
||||||
|
|
||||||
@ -701,35 +701,35 @@ var IconGrid = new Lang.Class({
|
|||||||
this._grid.add_actor(item.actor);
|
this._grid.add_actor(item.actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeItem: function(item) {
|
removeItem(item) {
|
||||||
this._grid.remove_child(item.actor);
|
this._grid.remove_child(item.actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
getItemAtIndex: function(index) {
|
getItemAtIndex(index) {
|
||||||
return this._grid.get_child_at_index(index);
|
return this._grid.get_child_at_index(index);
|
||||||
},
|
},
|
||||||
|
|
||||||
visibleItemsCount: function() {
|
visibleItemsCount() {
|
||||||
return this._grid.get_n_children() - this._grid.get_n_skip_paint();
|
return this._grid.get_n_children() - this._grid.get_n_skip_paint();
|
||||||
},
|
},
|
||||||
|
|
||||||
setSpacing: function(spacing) {
|
setSpacing(spacing) {
|
||||||
this._fixedSpacing = spacing;
|
this._fixedSpacing = spacing;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSpacing: function() {
|
_getSpacing() {
|
||||||
return this._fixedSpacing ? this._fixedSpacing : this._spacing;
|
return this._fixedSpacing ? this._fixedSpacing : this._spacing;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getHItemSize: function() {
|
_getHItemSize() {
|
||||||
return this._fixedHItemSize ? this._fixedHItemSize : this._hItemSize;
|
return this._fixedHItemSize ? this._fixedHItemSize : this._hItemSize;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getVItemSize: function() {
|
_getVItemSize() {
|
||||||
return this._fixedVItemSize ? this._fixedVItemSize : this._vItemSize;
|
return this._fixedVItemSize ? this._fixedVItemSize : this._vItemSize;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSpacingForSize: function(availWidth, availHeight) {
|
_updateSpacingForSize(availWidth, availHeight) {
|
||||||
let maxEmptyVArea = availHeight - this._minRows * this._getVItemSize();
|
let maxEmptyVArea = availHeight - this._minRows * this._getVItemSize();
|
||||||
let maxEmptyHArea = availWidth - this._minColumns * this._getHItemSize();
|
let maxEmptyHArea = availWidth - this._minColumns * this._getHItemSize();
|
||||||
let maxHSpacing, maxVSpacing;
|
let maxHSpacing, maxVSpacing;
|
||||||
@ -766,7 +766,7 @@ var IconGrid = new Lang.Class({
|
|||||||
* This function must to be called before iconGrid allocation,
|
* This function must to be called before iconGrid allocation,
|
||||||
* to know how much spacing can the grid has
|
* to know how much spacing can the grid has
|
||||||
*/
|
*/
|
||||||
adaptToSize: function(availWidth, availHeight) {
|
adaptToSize(availWidth, availHeight) {
|
||||||
this._fixedHItemSize = this._hItemSize;
|
this._fixedHItemSize = this._hItemSize;
|
||||||
this._fixedVItemSize = this._vItemSize;
|
this._fixedVItemSize = this._vItemSize;
|
||||||
this._updateSpacingForSize(availWidth, availHeight);
|
this._updateSpacingForSize(availWidth, availHeight);
|
||||||
@ -788,7 +788,7 @@ var IconGrid = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up
|
// Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up
|
||||||
_updateIconSizes: function() {
|
_updateIconSizes() {
|
||||||
let scale = Math.min(this._fixedHItemSize, this._fixedVItemSize) / Math.max(this._hItemSize, this._vItemSize);
|
let scale = Math.min(this._fixedHItemSize, this._fixedVItemSize) / Math.max(this._hItemSize, this._vItemSize);
|
||||||
let newIconSize = Math.floor(ICON_SIZE * scale);
|
let newIconSize = Math.floor(ICON_SIZE * scale);
|
||||||
for (let i in this._items) {
|
for (let i in this._items) {
|
||||||
@ -802,7 +802,7 @@ var PaginatedIconGrid = new Lang.Class({
|
|||||||
Name: 'PaginatedIconGrid',
|
Name: 'PaginatedIconGrid',
|
||||||
Extends: IconGrid,
|
Extends: IconGrid,
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
this.parent(params);
|
this.parent(params);
|
||||||
this._nPages = 0;
|
this._nPages = 0;
|
||||||
this.currentPage = 0;
|
this.currentPage = 0;
|
||||||
@ -811,12 +811,12 @@ var PaginatedIconGrid = new Lang.Class({
|
|||||||
this._childrenPerPage = 0;
|
this._childrenPerPage = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredHeight: function (grid, forWidth, alloc) {
|
_getPreferredHeight(grid, forWidth, alloc) {
|
||||||
alloc.min_size = (this._availableHeightPerPageForItems() + this.bottomPadding + this.topPadding) * this._nPages + this._spaceBetweenPages * this._nPages;
|
alloc.min_size = (this._availableHeightPerPageForItems() + this.bottomPadding + this.topPadding) * this._nPages + this._spaceBetweenPages * this._nPages;
|
||||||
alloc.natural_size = (this._availableHeightPerPageForItems() + this.bottomPadding + this.topPadding) * this._nPages + this._spaceBetweenPages * this._nPages;
|
alloc.natural_size = (this._availableHeightPerPageForItems() + this.bottomPadding + this.topPadding) * this._nPages + this._spaceBetweenPages * this._nPages;
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocate: function (grid, box, flags) {
|
_allocate(grid, box, flags) {
|
||||||
if (this._childrenPerPage == 0)
|
if (this._childrenPerPage == 0)
|
||||||
log('computePages() must be called before allocate(); pagination will not work.');
|
log('computePages() must be called before allocate(); pagination will not work.');
|
||||||
|
|
||||||
@ -870,7 +870,7 @@ var PaginatedIconGrid = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Overriden from IconGrid
|
// Overriden from IconGrid
|
||||||
_getChildrenToAnimate: function() {
|
_getChildrenToAnimate() {
|
||||||
let children = this._getVisibleChildren();
|
let children = this._getVisibleChildren();
|
||||||
let firstIndex = this._childrenPerPage * this.currentPage;
|
let firstIndex = this._childrenPerPage * this.currentPage;
|
||||||
let lastIndex = firstIndex + this._childrenPerPage;
|
let lastIndex = firstIndex + this._childrenPerPage;
|
||||||
@ -878,7 +878,7 @@ var PaginatedIconGrid = new Lang.Class({
|
|||||||
return children.slice(firstIndex, lastIndex);
|
return children.slice(firstIndex, lastIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
_computePages: function (availWidthPerPage, availHeightPerPage) {
|
_computePages(availWidthPerPage, availHeightPerPage) {
|
||||||
let [nColumns, usedWidth] = this._computeLayout(availWidthPerPage);
|
let [nColumns, usedWidth] = this._computeLayout(availWidthPerPage);
|
||||||
let nRows;
|
let nRows;
|
||||||
let children = this._getVisibleChildren();
|
let children = this._getVisibleChildren();
|
||||||
@ -897,24 +897,24 @@ var PaginatedIconGrid = new Lang.Class({
|
|||||||
this._childrenPerPage = nColumns * this._rowsPerPage;
|
this._childrenPerPage = nColumns * this._rowsPerPage;
|
||||||
},
|
},
|
||||||
|
|
||||||
adaptToSize: function(availWidth, availHeight) {
|
adaptToSize(availWidth, availHeight) {
|
||||||
this.parent(availWidth, availHeight);
|
this.parent(availWidth, availHeight);
|
||||||
this._computePages(availWidth, availHeight);
|
this._computePages(availWidth, availHeight);
|
||||||
},
|
},
|
||||||
|
|
||||||
_availableHeightPerPageForItems: function() {
|
_availableHeightPerPageForItems() {
|
||||||
return this.usedHeightForNRows(this._rowsPerPage) - (this.topPadding + this.bottomPadding);
|
return this.usedHeightForNRows(this._rowsPerPage) - (this.topPadding + this.bottomPadding);
|
||||||
},
|
},
|
||||||
|
|
||||||
nPages: function() {
|
nPages() {
|
||||||
return this._nPages;
|
return this._nPages;
|
||||||
},
|
},
|
||||||
|
|
||||||
getPageHeight: function() {
|
getPageHeight() {
|
||||||
return this._availableHeightPerPageForItems();
|
return this._availableHeightPerPageForItems();
|
||||||
},
|
},
|
||||||
|
|
||||||
getPageY: function(pageNumber) {
|
getPageY(pageNumber) {
|
||||||
if (!this._nPages)
|
if (!this._nPages)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -923,7 +923,7 @@ var PaginatedIconGrid = new Lang.Class({
|
|||||||
return childBox.y1 - this.topPadding;
|
return childBox.y1 - this.topPadding;
|
||||||
},
|
},
|
||||||
|
|
||||||
getItemPage: function(item) {
|
getItemPage(item) {
|
||||||
let children = this._getVisibleChildren();
|
let children = this._getVisibleChildren();
|
||||||
let index = children.indexOf(item);
|
let index = children.indexOf(item);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
@ -941,7 +941,7 @@ var PaginatedIconGrid = new Lang.Class({
|
|||||||
*
|
*
|
||||||
* Pan view to create extra space for @nRows above or below @sourceItem.
|
* Pan view to create extra space for @nRows above or below @sourceItem.
|
||||||
*/
|
*/
|
||||||
openExtraSpace: function(sourceItem, side, nRows) {
|
openExtraSpace(sourceItem, side, nRows) {
|
||||||
let children = this._getVisibleChildren();
|
let children = this._getVisibleChildren();
|
||||||
let index = children.indexOf(sourceItem.actor);
|
let index = children.indexOf(sourceItem.actor);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
@ -985,7 +985,7 @@ var PaginatedIconGrid = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_translateChildren: function(children, direction, nRows) {
|
_translateChildren(children, direction, nRows) {
|
||||||
let translationY = nRows * (this._getVItemSize() + this._getSpacing());
|
let translationY = nRows * (this._getVItemSize() + this._getSpacing());
|
||||||
if (translationY == 0)
|
if (translationY == 0)
|
||||||
return;
|
return;
|
||||||
@ -1008,7 +1008,7 @@ var PaginatedIconGrid = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
closeExtraSpace: function() {
|
closeExtraSpace() {
|
||||||
if (!this._translatedChildren || !this._translatedChildren.length) {
|
if (!this._translatedChildren || !this._translatedChildren.length) {
|
||||||
this.emit('space-closed');
|
this.emit('space-closed');
|
||||||
return;
|
return;
|
||||||
|
@ -24,7 +24,7 @@ var InhibitShortcutsDialog = new Lang.Class({
|
|||||||
'window': GObject.ParamSpec.override('window', Meta.InhibitShortcutsDialog)
|
'window': GObject.ParamSpec.override('window', Meta.InhibitShortcutsDialog)
|
||||||
},
|
},
|
||||||
|
|
||||||
_init: function(window) {
|
_init(window) {
|
||||||
this.parent();
|
this.parent();
|
||||||
this._window = window;
|
this._window = window;
|
||||||
|
|
||||||
@ -45,14 +45,14 @@ var InhibitShortcutsDialog = new Lang.Class({
|
|||||||
return windowTracker.get_window_app(this._window);
|
return windowTracker.get_window_app(this._window);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getRestoreAccel: function() {
|
_getRestoreAccel() {
|
||||||
let settings = new Gio.Settings({ schema_id: WAYLAND_KEYBINDINGS_SCHEMA });
|
let settings = new Gio.Settings({ schema_id: WAYLAND_KEYBINDINGS_SCHEMA });
|
||||||
let accel = settings.get_strv('restore-shortcuts')[0] || '';
|
let accel = settings.get_strv('restore-shortcuts')[0] || '';
|
||||||
return Gtk.accelerator_get_label.apply(null,
|
return Gtk.accelerator_get_label.apply(null,
|
||||||
Gtk.accelerator_parse(accel));
|
Gtk.accelerator_parse(accel));
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildLayout: function() {
|
_buildLayout() {
|
||||||
let name = this._app ? this._app.get_name() : this._window.title;
|
let name = this._app ? this._app.get_name() : this._window.title;
|
||||||
|
|
||||||
/* Translators: %s is an application name like "Settings" */
|
/* Translators: %s is an application name like "Settings" */
|
||||||
@ -84,19 +84,19 @@ var InhibitShortcutsDialog = new Lang.Class({
|
|||||||
default: true });
|
default: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
_emitResponse: function(response) {
|
_emitResponse(response) {
|
||||||
this.emit('response', response);
|
this.emit('response', response);
|
||||||
this._dialog.close();
|
this._dialog.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_show: function() {
|
vfunc_show() {
|
||||||
if (this._app && APP_WHITELIST.indexOf(this._app.get_id()) != -1)
|
if (this._app && APP_WHITELIST.indexOf(this._app.get_id()) != -1)
|
||||||
this._emitResponse(DialogResponse.ALLOW);
|
this._emitResponse(DialogResponse.ALLOW);
|
||||||
else
|
else
|
||||||
this._dialog.open();
|
this._dialog.open();
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_hide: function() {
|
vfunc_hide() {
|
||||||
this._dialog.close();
|
this._dialog.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -13,7 +13,7 @@ var KbdA11yDialog = new Lang.Class({
|
|||||||
Name: 'KbdA11yDialog',
|
Name: 'KbdA11yDialog',
|
||||||
Extends: GObject.Object,
|
Extends: GObject.Object,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._a11ySettings = new Gio.Settings({ schema_id: KEYBOARD_A11Y_SCHEMA });
|
this._a11ySettings = new Gio.Settings({ schema_id: KEYBOARD_A11Y_SCHEMA });
|
||||||
|
|
||||||
let deviceManager = Clutter.DeviceManager.get_default();
|
let deviceManager = Clutter.DeviceManager.get_default();
|
||||||
@ -21,7 +21,7 @@ var KbdA11yDialog = new Lang.Class({
|
|||||||
Lang.bind(this, this._showKbdA11yDialog));
|
Lang.bind(this, this._showKbdA11yDialog));
|
||||||
},
|
},
|
||||||
|
|
||||||
_showKbdA11yDialog: function(deviceManager, newFlags, whatChanged) {
|
_showKbdA11yDialog(deviceManager, newFlags, whatChanged) {
|
||||||
let dialog = new ModalDialog.ModalDialog();
|
let dialog = new ModalDialog.ModalDialog();
|
||||||
let title, body;
|
let title, body;
|
||||||
let key, enabled;
|
let key, enabled;
|
||||||
|
@ -59,7 +59,7 @@ var KeyContainer = new Lang.Class({
|
|||||||
Name: 'KeyContainer',
|
Name: 'KeyContainer',
|
||||||
Extends: St.Widget,
|
Extends: St.Widget,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
let gridLayout = new Clutter.GridLayout({ orientation: Clutter.Orientation.HORIZONTAL,
|
let gridLayout = new Clutter.GridLayout({ orientation: Clutter.Orientation.HORIZONTAL,
|
||||||
column_homogeneous: true,
|
column_homogeneous: true,
|
||||||
row_homogeneous: true });
|
row_homogeneous: true });
|
||||||
@ -73,7 +73,7 @@ var KeyContainer = new Lang.Class({
|
|||||||
this._rows = [];
|
this._rows = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
appendRow: function(length) {
|
appendRow(length) {
|
||||||
this._currentRow++;
|
this._currentRow++;
|
||||||
this._currentCol = 0;
|
this._currentCol = 0;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ var KeyContainer = new Lang.Class({
|
|||||||
this._rows.push(row);
|
this._rows.push(row);
|
||||||
},
|
},
|
||||||
|
|
||||||
appendKey: function(key, width = 1, height = 1) {
|
appendKey(key, width = 1, height = 1) {
|
||||||
let keyInfo = {
|
let keyInfo = {
|
||||||
key,
|
key,
|
||||||
left: this._currentCol,
|
left: this._currentCol,
|
||||||
@ -100,7 +100,7 @@ var KeyContainer = new Lang.Class({
|
|||||||
this._maxCols = Math.max(this._currentCol, this._maxCols);
|
this._maxCols = Math.max(this._currentCol, this._maxCols);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_allocate: function(box, flags) {
|
vfunc_allocate(box, flags) {
|
||||||
if (box.get_width() > 0 && box.get_height() > 0 && this._maxCols > 0) {
|
if (box.get_width() > 0 && box.get_height() > 0 && this._maxCols > 0) {
|
||||||
let keyboardRatio = this._maxCols / this._rows.length;
|
let keyboardRatio = this._maxCols / this._rows.length;
|
||||||
let sizeRatio = box.get_width() / box.get_height();
|
let sizeRatio = box.get_width() / box.get_height();
|
||||||
@ -125,7 +125,7 @@ var KeyContainer = new Lang.Class({
|
|||||||
this.parent (box, flags);
|
this.parent (box, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
layoutButtons: function() {
|
layoutButtons() {
|
||||||
let nCol = 0, nRow = 0;
|
let nCol = 0, nRow = 0;
|
||||||
|
|
||||||
for (let i = 0; i < this._rows.length; i++) {
|
for (let i = 0; i < this._rows.length; i++) {
|
||||||
@ -158,19 +158,19 @@ var KeyContainer = new Lang.Class({
|
|||||||
var Suggestions = new Lang.Class({
|
var Suggestions = new Lang.Class({
|
||||||
Name: 'Suggestions',
|
Name: 'Suggestions',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.BoxLayout({ style_class: 'word-suggestions',
|
this.actor = new St.BoxLayout({ style_class: 'word-suggestions',
|
||||||
vertical: false });
|
vertical: false });
|
||||||
this.actor.show();
|
this.actor.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
add: function(word, callback) {
|
add(word, callback) {
|
||||||
let button = new St.Button({ label: word });
|
let button = new St.Button({ label: word });
|
||||||
button.connect('clicked', callback);
|
button.connect('clicked', callback);
|
||||||
this.actor.add(button);
|
this.actor.add(button);
|
||||||
},
|
},
|
||||||
|
|
||||||
clear: function() {
|
clear() {
|
||||||
this.actor.remove_all_children();
|
this.actor.remove_all_children();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -180,7 +180,7 @@ var LanguageSelectionPopup = new Lang.Class({
|
|||||||
Name: 'LanguageSelectionPopup',
|
Name: 'LanguageSelectionPopup',
|
||||||
Extends: PopupMenu.PopupMenu,
|
Extends: PopupMenu.PopupMenu,
|
||||||
|
|
||||||
_init: function(actor) {
|
_init(actor) {
|
||||||
this.parent(actor, 0.5, St.Side.BOTTOM);
|
this.parent(actor, 0.5, St.Side.BOTTOM);
|
||||||
|
|
||||||
let inputSourceManager = InputSourceManager.getInputSourceManager();
|
let inputSourceManager = InputSourceManager.getInputSourceManager();
|
||||||
@ -204,12 +204,12 @@ var LanguageSelectionPopup = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_launchSettings: function() {
|
_launchSettings() {
|
||||||
Util.spawn(['gnome-control-center', 'region']);
|
Util.spawn(['gnome-control-center', 'region']);
|
||||||
this.close(true);
|
this.close(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCapturedEvent: function(actor, event) {
|
_onCapturedEvent(actor, event) {
|
||||||
if (event.get_source() == this.actor ||
|
if (event.get_source() == this.actor ||
|
||||||
this.actor.contains(event.get_source()))
|
this.actor.contains(event.get_source()))
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
@ -220,13 +220,13 @@ var LanguageSelectionPopup = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function(animate) {
|
open(animate) {
|
||||||
this.parent(animate);
|
this.parent(animate);
|
||||||
this._capturedEventId = global.stage.connect('captured-event',
|
this._capturedEventId = global.stage.connect('captured-event',
|
||||||
Lang.bind(this, this._onCapturedEvent));
|
Lang.bind(this, this._onCapturedEvent));
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function(animate) {
|
close(animate) {
|
||||||
this.parent(animate);
|
this.parent(animate);
|
||||||
if (this._capturedEventId != 0) {
|
if (this._capturedEventId != 0) {
|
||||||
global.stage.disconnect(this._capturedEventId);
|
global.stage.disconnect(this._capturedEventId);
|
||||||
@ -234,7 +234,7 @@ var LanguageSelectionPopup = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
if (this._capturedEventId != 0)
|
if (this._capturedEventId != 0)
|
||||||
global.stage.disconnect(this._capturedEventId);
|
global.stage.disconnect(this._capturedEventId);
|
||||||
if (this._unmapId != 0)
|
if (this._unmapId != 0)
|
||||||
@ -246,7 +246,7 @@ var LanguageSelectionPopup = new Lang.Class({
|
|||||||
var Key = new Lang.Class({
|
var Key = new Lang.Class({
|
||||||
Name: 'Key',
|
Name: 'Key',
|
||||||
|
|
||||||
_init : function(key, extendedKeys) {
|
_init(key, extendedKeys) {
|
||||||
this.key = key || "";
|
this.key = key || "";
|
||||||
this.keyButton = this._makeKey(this.key);
|
this.keyButton = this._makeKey(this.key);
|
||||||
|
|
||||||
@ -266,14 +266,14 @@ var Key = new Lang.Class({
|
|||||||
this._longPress = false;
|
this._longPress = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
if (this._boxPointer) {
|
if (this._boxPointer) {
|
||||||
this._boxPointer.actor.destroy();
|
this._boxPointer.actor.destroy();
|
||||||
this._boxPointer = null;
|
this._boxPointer = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureExtendedKeysPopup: function() {
|
_ensureExtendedKeysPopup() {
|
||||||
if (this._extended_keys.length == 0)
|
if (this._extended_keys.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -291,12 +291,12 @@ var Key = new Lang.Class({
|
|||||||
this.keyButton._extended_keys = this._extended_keyboard;
|
this.keyButton._extended_keys = this._extended_keyboard;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getKeyval: function(key) {
|
_getKeyval(key) {
|
||||||
let unicode = String.charCodeAt(key, 0);
|
let unicode = String.charCodeAt(key, 0);
|
||||||
return Gdk.unicode_to_keyval(unicode);
|
return Gdk.unicode_to_keyval(unicode);
|
||||||
},
|
},
|
||||||
|
|
||||||
_press: function(key) {
|
_press(key) {
|
||||||
if (key != this.key || this._extended_keys.length == 0) {
|
if (key != this.key || this._extended_keys.length == 0) {
|
||||||
this.emit('pressed', this._getKeyval(key), key);
|
this.emit('pressed', this._getKeyval(key), key);
|
||||||
}
|
}
|
||||||
@ -323,7 +323,7 @@ var Key = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_release: function(key) {
|
_release(key) {
|
||||||
if (this._pressTimeoutId != 0) {
|
if (this._pressTimeoutId != 0) {
|
||||||
GLib.source_remove(this._pressTimeoutId);
|
GLib.source_remove(this._pressTimeoutId);
|
||||||
this._pressTimeoutId = 0;
|
this._pressTimeoutId = 0;
|
||||||
@ -337,7 +337,7 @@ var Key = new Lang.Class({
|
|||||||
this._longPress = false;
|
this._longPress = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCapturedEvent: function(actor, event) {
|
_onCapturedEvent(actor, event) {
|
||||||
let type = event.type();
|
let type = event.type();
|
||||||
let press = (type == Clutter.EventType.BUTTON_PRESS || type == Clutter.EventType.TOUCH_BEGIN);
|
let press = (type == Clutter.EventType.BUTTON_PRESS || type == Clutter.EventType.TOUCH_BEGIN);
|
||||||
let release = (type == Clutter.EventType.BUTTON_RELEASE || type == Clutter.EventType.TOUCH_END);
|
let release = (type == Clutter.EventType.BUTTON_RELEASE || type == Clutter.EventType.TOUCH_END);
|
||||||
@ -354,7 +354,7 @@ var Key = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_showSubkeys: function() {
|
_showSubkeys() {
|
||||||
this._boxPointer.show(BoxPointer.PopupAnimation.FULL);
|
this._boxPointer.show(BoxPointer.PopupAnimation.FULL);
|
||||||
this._capturedEventId = global.stage.connect('captured-event',
|
this._capturedEventId = global.stage.connect('captured-event',
|
||||||
Lang.bind(this, this._onCapturedEvent));
|
Lang.bind(this, this._onCapturedEvent));
|
||||||
@ -364,7 +364,7 @@ var Key = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideSubkeys: function() {
|
_hideSubkeys() {
|
||||||
if (this._boxPointer)
|
if (this._boxPointer)
|
||||||
this._boxPointer.hide(BoxPointer.PopupAnimation.FULL);
|
this._boxPointer.hide(BoxPointer.PopupAnimation.FULL);
|
||||||
if (this._capturedEventId) {
|
if (this._capturedEventId) {
|
||||||
@ -378,7 +378,7 @@ var Key = new Lang.Class({
|
|||||||
this._capturedPress = false;
|
this._capturedPress = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_makeKey: function (key) {
|
_makeKey(key) {
|
||||||
let label = GLib.markup_escape_text(key, -1);
|
let label = GLib.markup_escape_text(key, -1);
|
||||||
let button = new St.Button ({ label: label,
|
let button = new St.Button ({ label: label,
|
||||||
style_class: 'keyboard-key' });
|
style_class: 'keyboard-key' });
|
||||||
@ -427,7 +427,7 @@ var Key = new Lang.Class({
|
|||||||
return button;
|
return button;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getExtendedKeys: function () {
|
_getExtendedKeys() {
|
||||||
this._extended_keyboard = new St.BoxLayout({ style_class: 'key-container',
|
this._extended_keyboard = new St.BoxLayout({ style_class: 'key-container',
|
||||||
vertical: false });
|
vertical: false });
|
||||||
for (let i = 0; i < this._extended_keys.length; ++i) {
|
for (let i = 0; i < this._extended_keys.length; ++i) {
|
||||||
@ -447,11 +447,11 @@ var Key = new Lang.Class({
|
|||||||
return this._boxPointer;
|
return this._boxPointer;
|
||||||
},
|
},
|
||||||
|
|
||||||
setWidth: function (width) {
|
setWidth(width) {
|
||||||
this.keyButton.keyWidth = width;
|
this.keyButton.keyWidth = width;
|
||||||
},
|
},
|
||||||
|
|
||||||
setLatched: function (latched) {
|
setLatched(latched) {
|
||||||
if (latched)
|
if (latched)
|
||||||
this.keyButton.add_style_pseudo_class('latched');
|
this.keyButton.add_style_pseudo_class('latched');
|
||||||
else
|
else
|
||||||
@ -463,7 +463,7 @@ Signals.addSignalMethods(Key.prototype);
|
|||||||
var KeyboardModel = new Lang.Class({
|
var KeyboardModel = new Lang.Class({
|
||||||
Name: 'KeyboardModel',
|
Name: 'KeyboardModel',
|
||||||
|
|
||||||
_init: function (groupName) {
|
_init(groupName) {
|
||||||
try {
|
try {
|
||||||
this._model = this._loadModel(groupName);
|
this._model = this._loadModel(groupName);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -471,18 +471,18 @@ var KeyboardModel = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadModel: function(groupName) {
|
_loadModel(groupName) {
|
||||||
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/osk-layouts/%s.json'.format(groupName));
|
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/osk-layouts/%s.json'.format(groupName));
|
||||||
let [success, contents] = file.load_contents(null);
|
let [success, contents] = file.load_contents(null);
|
||||||
|
|
||||||
return JSON.parse(contents);
|
return JSON.parse(contents);
|
||||||
},
|
},
|
||||||
|
|
||||||
getLevels: function() {
|
getLevels() {
|
||||||
return this._model.levels;
|
return this._model.levels;
|
||||||
},
|
},
|
||||||
|
|
||||||
getKeysForLevel: function(levelName) {
|
getKeysForLevel(levelName) {
|
||||||
return this._model.levels.find(level => level == levelName);
|
return this._model.levels.find(level => level == levelName);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -490,7 +490,7 @@ var KeyboardModel = new Lang.Class({
|
|||||||
var Keyboard = new Lang.Class({
|
var Keyboard = new Lang.Class({
|
||||||
Name: 'Keyboard',
|
Name: 'Keyboard',
|
||||||
|
|
||||||
_init: function () {
|
_init() {
|
||||||
this.actor = null;
|
this.actor = null;
|
||||||
this._focusInExtendedKeys = false;
|
this._focusInExtendedKeys = false;
|
||||||
|
|
||||||
@ -548,7 +548,7 @@ var Keyboard = new Lang.Class({
|
|||||||
return this._keyboardVisible;
|
return this._keyboardVisible;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setCaretTrackerEnabled: function (enabled) {
|
_setCaretTrackerEnabled(enabled) {
|
||||||
if (this._caretTrackingEnabled == enabled)
|
if (this._caretTrackingEnabled == enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -563,7 +563,7 @@ var Keyboard = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCaretPosition: function (accessible) {
|
_updateCaretPosition(accessible) {
|
||||||
if (this._updateCaretPositionId)
|
if (this._updateCaretPositionId)
|
||||||
GLib.source_remove(this._updateCaretPositionId);
|
GLib.source_remove(this._updateCaretPositionId);
|
||||||
if (!this._keyboardRequested)
|
if (!this._keyboardRequested)
|
||||||
@ -600,7 +600,7 @@ var Keyboard = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._updateCaretPositionId, '[gnome-shell] this._updateCaretPosition');
|
GLib.Source.set_name_by_id(this._updateCaretPositionId, '[gnome-shell] this._updateCaretPosition');
|
||||||
},
|
},
|
||||||
|
|
||||||
_focusIsTextEntry: function (accessible) {
|
_focusIsTextEntry(accessible) {
|
||||||
try {
|
try {
|
||||||
let role = accessible.get_role();
|
let role = accessible.get_role();
|
||||||
let stateSet = accessible.get_state_set();
|
let stateSet = accessible.get_state_set();
|
||||||
@ -611,7 +611,7 @@ var Keyboard = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onFocusChanged: function (caretTracker, event) {
|
_onFocusChanged(caretTracker, event) {
|
||||||
let accessible = event.source;
|
let accessible = event.source;
|
||||||
if (!this._focusIsTextEntry(accessible))
|
if (!this._focusIsTextEntry(accessible))
|
||||||
return;
|
return;
|
||||||
@ -627,13 +627,13 @@ var Keyboard = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCaretMoved: function (caretTracker, event) {
|
_onCaretMoved(caretTracker, event) {
|
||||||
let accessible = event.source;
|
let accessible = event.source;
|
||||||
if (this._currentAccessible == accessible)
|
if (this._currentAccessible == accessible)
|
||||||
this._updateCaretPosition(accessible);
|
this._updateCaretPosition(accessible);
|
||||||
},
|
},
|
||||||
|
|
||||||
_lastDeviceIsTouchscreen: function () {
|
_lastDeviceIsTouchscreen() {
|
||||||
if (!this._lastDeviceId)
|
if (!this._lastDeviceId)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -646,7 +646,7 @@ var Keyboard = new Lang.Class({
|
|||||||
return device.get_device_type() == Clutter.InputDeviceType.TOUCHSCREEN_DEVICE;
|
return device.get_device_type() == Clutter.InputDeviceType.TOUCHSCREEN_DEVICE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncEnabled: function () {
|
_syncEnabled() {
|
||||||
let wasEnabled = this._enabled;
|
let wasEnabled = this._enabled;
|
||||||
this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD);
|
this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD);
|
||||||
this._enabled = this._enableKeyboard || this._lastDeviceIsTouchscreen();
|
this._enabled = this._enableKeyboard || this._lastDeviceIsTouchscreen();
|
||||||
@ -664,7 +664,7 @@ var Keyboard = new Lang.Class({
|
|||||||
Main.layoutManager.hideKeyboard(true);
|
Main.layoutManager.hideKeyboard(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_destroyKeyboard: function() {
|
_destroyKeyboard() {
|
||||||
if (this._keyboardNotifyId)
|
if (this._keyboardNotifyId)
|
||||||
this._keyboardController.disconnect(this._keyboardNotifyId);
|
this._keyboardController.disconnect(this._keyboardNotifyId);
|
||||||
if (this._keyboardGroupsChangedId)
|
if (this._keyboardGroupsChangedId)
|
||||||
@ -683,7 +683,7 @@ var Keyboard = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_setupKeyboard: function() {
|
_setupKeyboard() {
|
||||||
this.actor = new St.BoxLayout({ name: 'keyboard', vertical: true, reactive: true });
|
this.actor = new St.BoxLayout({ name: 'keyboard', vertical: true, reactive: true });
|
||||||
Main.layoutManager.keyboardBox.add_actor(this.actor);
|
Main.layoutManager.keyboardBox.add_actor(this.actor);
|
||||||
Main.layoutManager.trackChrome(this.actor);
|
Main.layoutManager.trackChrome(this.actor);
|
||||||
@ -717,7 +717,7 @@ var Keyboard = new Lang.Class({
|
|||||||
this._relayout();
|
this._relayout();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyFocusChanged: function () {
|
_onKeyFocusChanged() {
|
||||||
let focus = global.stage.key_focus;
|
let focus = global.stage.key_focus;
|
||||||
|
|
||||||
// Showing an extended key popup and clicking a key from the extended keys
|
// Showing an extended key popup and clicking a key from the extended keys
|
||||||
@ -743,7 +743,7 @@ var Keyboard = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_createLayersForGroup: function (groupName) {
|
_createLayersForGroup(groupName) {
|
||||||
let keyboardModel = new KeyboardModel(groupName);
|
let keyboardModel = new KeyboardModel(groupName);
|
||||||
let layers = {};
|
let layers = {};
|
||||||
let levels = keyboardModel.getLevels();
|
let levels = keyboardModel.getLevels();
|
||||||
@ -768,12 +768,12 @@ var Keyboard = new Lang.Class({
|
|||||||
return layers;
|
return layers;
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureKeysForGroup: function(group) {
|
_ensureKeysForGroup(group) {
|
||||||
if (!this._groups[group])
|
if (!this._groups[group])
|
||||||
this._groups[group] = this._createLayersForGroup(group);
|
this._groups[group] = this._createLayersForGroup(group);
|
||||||
},
|
},
|
||||||
|
|
||||||
_addRowKeys : function (keys, layout) {
|
_addRowKeys(keys, layout) {
|
||||||
for (let i = 0; i < keys.length; ++i) {
|
for (let i = 0; i < keys.length; ++i) {
|
||||||
let key = keys[i];
|
let key = keys[i];
|
||||||
let button = new Key(key.shift(), key);
|
let button = new Key(key.shift(), key);
|
||||||
@ -806,7 +806,7 @@ var Keyboard = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_popupLanguageMenu: function(keyActor) {
|
_popupLanguageMenu(keyActor) {
|
||||||
if (this._languagePopup)
|
if (this._languagePopup)
|
||||||
this._languagePopup.destroy();
|
this._languagePopup.destroy();
|
||||||
|
|
||||||
@ -815,7 +815,7 @@ var Keyboard = new Lang.Class({
|
|||||||
this._languagePopup.open(true);
|
this._languagePopup.open(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadDefaultKeys: function(keys, layout, numLevels, numKeys) {
|
_loadDefaultKeys(keys, layout, numLevels, numKeys) {
|
||||||
let extraButton;
|
let extraButton;
|
||||||
for (let i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
let key = keys[i];
|
let key = keys[i];
|
||||||
@ -880,14 +880,14 @@ var Keyboard = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_setCurrentLevelLatched: function(layout, latched) {
|
_setCurrentLevelLatched(layout, latched) {
|
||||||
for (let i = 0; layout.shiftKeys[i]; i++) {
|
for (let i = 0; layout.shiftKeys[i]; i++) {
|
||||||
let key = layout.shiftKeys[i];
|
let key = layout.shiftKeys[i];
|
||||||
key.setLatched(latched);
|
key.setLatched(latched);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getDefaultKeysForRow: function(row, numRows, level) {
|
_getDefaultKeysForRow(row, numRows, level) {
|
||||||
let pre, post;
|
let pre, post;
|
||||||
|
|
||||||
/* The first 2 rows in defaultKeysPre/Post belong together with
|
/* The first 2 rows in defaultKeysPre/Post belong together with
|
||||||
@ -905,7 +905,7 @@ var Keyboard = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_mergeRowKeys: function (layout, pre, row, post, numLevels) {
|
_mergeRowKeys(layout, pre, row, post, numLevels) {
|
||||||
if (pre != null)
|
if (pre != null)
|
||||||
this._loadDefaultKeys(pre, layout, numLevels, row.length);
|
this._loadDefaultKeys(pre, layout, numLevels, row.length);
|
||||||
|
|
||||||
@ -915,7 +915,7 @@ var Keyboard = new Lang.Class({
|
|||||||
this._loadDefaultKeys(post, layout, numLevels, row.length);
|
this._loadDefaultKeys(post, layout, numLevels, row.length);
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadRows : function (model, level, numLevels, layout) {
|
_loadRows(model, level, numLevels, layout) {
|
||||||
let rows = model.rows;
|
let rows = model.rows;
|
||||||
for (let i = 0; i < rows.length; ++i) {
|
for (let i = 0; i < rows.length; ++i) {
|
||||||
layout.appendRow();
|
layout.appendRow();
|
||||||
@ -924,7 +924,7 @@ var Keyboard = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_getGridSlots: function() {
|
_getGridSlots() {
|
||||||
let numOfHorizSlots = 0, numOfVertSlots;
|
let numOfHorizSlots = 0, numOfVertSlots;
|
||||||
let rows = this._current_page.get_children();
|
let rows = this._current_page.get_children();
|
||||||
numOfVertSlots = rows.length;
|
numOfVertSlots = rows.length;
|
||||||
@ -939,7 +939,7 @@ var Keyboard = new Lang.Class({
|
|||||||
return [numOfHorizSlots, numOfVertSlots];
|
return [numOfHorizSlots, numOfVertSlots];
|
||||||
},
|
},
|
||||||
|
|
||||||
_relayout: function () {
|
_relayout() {
|
||||||
if (this.actor == null)
|
if (this.actor == null)
|
||||||
return;
|
return;
|
||||||
let monitor = Main.layoutManager.keyboardMonitor;
|
let monitor = Main.layoutManager.keyboardMonitor;
|
||||||
@ -948,17 +948,17 @@ var Keyboard = new Lang.Class({
|
|||||||
this.actor.height = maxHeight;
|
this.actor.height = maxHeight;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onGroupChanged: function () {
|
_onGroupChanged() {
|
||||||
this._ensureKeysForGroup(this._keyboardController.getCurrentGroup());
|
this._ensureKeysForGroup(this._keyboardController.getCurrentGroup());
|
||||||
this._setActiveLayer(0);
|
this._setActiveLayer(0);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyboardGroupsChanged: function(keyboard) {
|
_onKeyboardGroupsChanged(keyboard) {
|
||||||
this._groups = [];
|
this._groups = [];
|
||||||
this._onGroupChanged();
|
this._onGroupChanged();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyboardStateChanged: function(controller, state) {
|
_onKeyboardStateChanged(controller, state) {
|
||||||
let enabled;
|
let enabled;
|
||||||
if (state == Clutter.InputPanelState.OFF)
|
if (state == Clutter.InputPanelState.OFF)
|
||||||
enabled = false;
|
enabled = false;
|
||||||
@ -975,7 +975,7 @@ var Keyboard = new Lang.Class({
|
|||||||
this.hide();
|
this.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_setActiveLayer: function (activeLevel) {
|
_setActiveLayer(activeLevel) {
|
||||||
let activeGroupName = this._keyboardController.getCurrentGroup();
|
let activeGroupName = this._keyboardController.getCurrentGroup();
|
||||||
let layers = this._groups[activeGroupName];
|
let layers = this._groups[activeGroupName];
|
||||||
|
|
||||||
@ -988,20 +988,20 @@ var Keyboard = new Lang.Class({
|
|||||||
this._current_page.show();
|
this._current_page.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
shouldTakeEvent: function(event) {
|
shouldTakeEvent(event) {
|
||||||
let actor = event.get_source();
|
let actor = event.get_source();
|
||||||
return Main.layoutManager.keyboardBox.contains(actor) ||
|
return Main.layoutManager.keyboardBox.contains(actor) ||
|
||||||
!!actor._extended_keys || !!actor.extended_key;
|
!!actor._extended_keys || !!actor.extended_key;
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearKeyboardRestTimer: function() {
|
_clearKeyboardRestTimer() {
|
||||||
if (!this._keyboardRestingId)
|
if (!this._keyboardRestingId)
|
||||||
return;
|
return;
|
||||||
GLib.source_remove(this._keyboardRestingId);
|
GLib.source_remove(this._keyboardRestingId);
|
||||||
this._keyboardRestingId = 0;
|
this._keyboardRestingId = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function (monitor) {
|
show(monitor) {
|
||||||
if (!this._enabled)
|
if (!this._enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1027,7 +1027,7 @@ var Keyboard = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
|
GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
|
||||||
},
|
},
|
||||||
|
|
||||||
_show: function(monitor) {
|
_show(monitor) {
|
||||||
if (!this._keyboardRequested)
|
if (!this._keyboardRequested)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1038,7 +1038,7 @@ var Keyboard = new Lang.Class({
|
|||||||
Main.layoutManager.showKeyboard();
|
Main.layoutManager.showKeyboard();
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function () {
|
hide() {
|
||||||
if (!this._enabled)
|
if (!this._enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1059,7 +1059,7 @@ var Keyboard = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
|
GLib.Source.set_name_by_id(this._keyboardRestingId, '[gnome-shell] this._clearKeyboardRestTimer');
|
||||||
},
|
},
|
||||||
|
|
||||||
_hide: function() {
|
_hide() {
|
||||||
if (this._keyboardRequested)
|
if (this._keyboardRequested)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1067,7 +1067,7 @@ var Keyboard = new Lang.Class({
|
|||||||
this.setCursorLocation(null);
|
this.setCursorLocation(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideSubkeys: function() {
|
_hideSubkeys() {
|
||||||
if (this._subkeysBoxPointer) {
|
if (this._subkeysBoxPointer) {
|
||||||
this._subkeysBoxPointer.hide(BoxPointer.PopupAnimation.FULL);
|
this._subkeysBoxPointer.hide(BoxPointer.PopupAnimation.FULL);
|
||||||
this._subkeysBoxPointer = null;
|
this._subkeysBoxPointer = null;
|
||||||
@ -1079,26 +1079,26 @@ var Keyboard = new Lang.Class({
|
|||||||
this._capturedPress = false;
|
this._capturedPress = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
resetSuggestions: function() {
|
resetSuggestions() {
|
||||||
if (this._suggestions)
|
if (this._suggestions)
|
||||||
this._suggestions.clear();
|
this._suggestions.clear();
|
||||||
},
|
},
|
||||||
|
|
||||||
addSuggestion: function(text, callback) {
|
addSuggestion(text, callback) {
|
||||||
if (!this._suggestions)
|
if (!this._suggestions)
|
||||||
return;
|
return;
|
||||||
this._suggestions.add(text, callback);
|
this._suggestions.add(text, callback);
|
||||||
this._suggestions.actor.show();
|
this._suggestions.actor.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearShowIdle: function() {
|
_clearShowIdle() {
|
||||||
if (!this._showIdleId)
|
if (!this._showIdleId)
|
||||||
return;
|
return;
|
||||||
GLib.source_remove(this._showIdleId);
|
GLib.source_remove(this._showIdleId);
|
||||||
this._showIdleId = 0;
|
this._showIdleId = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_windowSlideAnimationComplete: function(window, delta) {
|
_windowSlideAnimationComplete(window, delta) {
|
||||||
// Synchronize window and actor positions again.
|
// Synchronize window and actor positions again.
|
||||||
let windowActor = window.get_compositor_private();
|
let windowActor = window.get_compositor_private();
|
||||||
let frameRect = window.get_frame_rect();
|
let frameRect = window.get_frame_rect();
|
||||||
@ -1106,7 +1106,7 @@ var Keyboard = new Lang.Class({
|
|||||||
window.move_frame(true, frameRect.x, frameRect.y);
|
window.move_frame(true, frameRect.x, frameRect.y);
|
||||||
},
|
},
|
||||||
|
|
||||||
_animateWindow: function(window, show, deltaY) {
|
_animateWindow(window, show, deltaY) {
|
||||||
let windowActor = window.get_compositor_private();
|
let windowActor = window.get_compositor_private();
|
||||||
if (!windowActor)
|
if (!windowActor)
|
||||||
return;
|
return;
|
||||||
@ -1128,7 +1128,7 @@ var Keyboard = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setCursorLocation: function(window, x, y , w, h) {
|
setCursorLocation(window, x, y , w, h) {
|
||||||
if (window == this._oskFocusWindow)
|
if (window == this._oskFocusWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1163,7 +1163,7 @@ var Keyboard = new Lang.Class({
|
|||||||
var KeyboardController = new Lang.Class({
|
var KeyboardController = new Lang.Class({
|
||||||
Name: 'KeyboardController',
|
Name: 'KeyboardController',
|
||||||
|
|
||||||
_init: function () {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
let deviceManager = Clutter.DeviceManager.get_default();
|
let deviceManager = Clutter.DeviceManager.get_default();
|
||||||
this._virtualDevice = deviceManager.create_virtual_device(Clutter.InputDeviceType.KEYBOARD_DEVICE);
|
this._virtualDevice = deviceManager.create_virtual_device(Clutter.InputDeviceType.KEYBOARD_DEVICE);
|
||||||
@ -1180,24 +1180,24 @@ var KeyboardController = new Lang.Class({
|
|||||||
Main.inputMethod.connect('input-panel-state', Lang.bind(this, function(o, state) { this.emit('panel-state', state); }));
|
Main.inputMethod.connect('input-panel-state', Lang.bind(this, function(o, state) { this.emit('panel-state', state); }));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSourcesModified: function () {
|
_onSourcesModified() {
|
||||||
this.emit('groups-changed');
|
this.emit('groups-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSourceChanged: function (inputSourceManager, oldSource) {
|
_onSourceChanged(inputSourceManager, oldSource) {
|
||||||
let source = inputSourceManager.currentSource;
|
let source = inputSourceManager.currentSource;
|
||||||
this._currentSource = source;
|
this._currentSource = source;
|
||||||
this.emit('active-group', source.id);
|
this.emit('active-group', source.id);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onContentPurposeHintsChanged: function(method) {
|
_onContentPurposeHintsChanged(method) {
|
||||||
let hints = method.content_hints;
|
let hints = method.content_hints;
|
||||||
let purpose = method.content_purpose;
|
let purpose = method.content_purpose;
|
||||||
|
|
||||||
// XXX: hook numeric/emoji/etc special keyboards
|
// XXX: hook numeric/emoji/etc special keyboards
|
||||||
},
|
},
|
||||||
|
|
||||||
getGroups: function () {
|
getGroups() {
|
||||||
let inputSources = this._inputSourceManager.inputSources;
|
let inputSources = this._inputSourceManager.inputSources;
|
||||||
let groups = []
|
let groups = []
|
||||||
|
|
||||||
@ -1209,11 +1209,11 @@ var KeyboardController = new Lang.Class({
|
|||||||
return groups;
|
return groups;
|
||||||
},
|
},
|
||||||
|
|
||||||
getCurrentGroup: function () {
|
getCurrentGroup() {
|
||||||
return this._currentSource.xkbId;
|
return this._currentSource.xkbId;
|
||||||
},
|
},
|
||||||
|
|
||||||
commitString: function(string, fromKey) {
|
commitString(string, fromKey) {
|
||||||
if (string == null)
|
if (string == null)
|
||||||
return false;
|
return false;
|
||||||
/* Let ibus methods fall through keyval emission */
|
/* Let ibus methods fall through keyval emission */
|
||||||
@ -1224,12 +1224,12 @@ var KeyboardController = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
keyvalPress: function(keyval) {
|
keyvalPress(keyval) {
|
||||||
this._virtualDevice.notify_keyval(Clutter.get_current_event_time(),
|
this._virtualDevice.notify_keyval(Clutter.get_current_event_time(),
|
||||||
keyval, Clutter.KeyState.PRESSED);
|
keyval, Clutter.KeyState.PRESSED);
|
||||||
},
|
},
|
||||||
|
|
||||||
keyvalRelease: function(keyval) {
|
keyvalRelease(keyval) {
|
||||||
this._virtualDevice.notify_keyval(Clutter.get_current_event_time(),
|
this._virtualDevice.notify_keyval(Clutter.get_current_event_time(),
|
||||||
keyval, Clutter.KeyState.RELEASED);
|
keyval, Clutter.KeyState.RELEASED);
|
||||||
},
|
},
|
||||||
|
154
js/ui/layout.js
154
js/ui/layout.js
@ -52,7 +52,7 @@ var MonitorConstraint = new Lang.Class({
|
|||||||
GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE,
|
GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE,
|
||||||
false)},
|
false)},
|
||||||
|
|
||||||
_init: function(props) {
|
_init(props) {
|
||||||
this._primary = false;
|
this._primary = false;
|
||||||
this._index = -1;
|
this._index = -1;
|
||||||
this._workArea = false;
|
this._workArea = false;
|
||||||
@ -98,7 +98,7 @@ var MonitorConstraint = new Lang.Class({
|
|||||||
this.notify('work-area');
|
this.notify('work-area');
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_set_actor: function(actor) {
|
vfunc_set_actor(actor) {
|
||||||
if (actor) {
|
if (actor) {
|
||||||
if (!this._monitorsChangedId) {
|
if (!this._monitorsChangedId) {
|
||||||
this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', Lang.bind(this, function() {
|
this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', Lang.bind(this, function() {
|
||||||
@ -125,7 +125,7 @@ var MonitorConstraint = new Lang.Class({
|
|||||||
this.parent(actor);
|
this.parent(actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_update_allocation: function(actor, actorBox) {
|
vfunc_update_allocation(actor, actorBox) {
|
||||||
if (!this._primary && this._index < 0)
|
if (!this._primary && this._index < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ var MonitorConstraint = new Lang.Class({
|
|||||||
var Monitor = new Lang.Class({
|
var Monitor = new Lang.Class({
|
||||||
Name: 'Monitor',
|
Name: 'Monitor',
|
||||||
|
|
||||||
_init: function(index, geometry) {
|
_init(index, geometry) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.x = geometry.x;
|
this.x = geometry.x;
|
||||||
this.y = geometry.y;
|
this.y = geometry.y;
|
||||||
@ -175,7 +175,7 @@ const defaultParams = {
|
|||||||
var LayoutManager = new Lang.Class({
|
var LayoutManager = new Lang.Class({
|
||||||
Name: 'LayoutManager',
|
Name: 'LayoutManager',
|
||||||
|
|
||||||
_init: function () {
|
_init() {
|
||||||
this._rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
|
this._rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
|
||||||
this.monitors = [];
|
this.monitors = [];
|
||||||
this.primaryMonitor = null;
|
this.primaryMonitor = null;
|
||||||
@ -294,32 +294,32 @@ var LayoutManager = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// This is called by Main after everything else is constructed
|
// This is called by Main after everything else is constructed
|
||||||
init: function() {
|
init() {
|
||||||
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
||||||
|
|
||||||
this._loadBackground();
|
this._loadBackground();
|
||||||
},
|
},
|
||||||
|
|
||||||
showOverview: function() {
|
showOverview() {
|
||||||
this.overviewGroup.show();
|
this.overviewGroup.show();
|
||||||
|
|
||||||
this._inOverview = true;
|
this._inOverview = true;
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
},
|
},
|
||||||
|
|
||||||
hideOverview: function() {
|
hideOverview() {
|
||||||
this.overviewGroup.hide();
|
this.overviewGroup.hide();
|
||||||
|
|
||||||
this._inOverview = false;
|
this._inOverview = false;
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
this._queueUpdateRegions();
|
this._queueUpdateRegions();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateMonitors: function() {
|
_updateMonitors() {
|
||||||
let screen = global.screen;
|
let screen = global.screen;
|
||||||
|
|
||||||
this.monitors = [];
|
this.monitors = [];
|
||||||
@ -357,7 +357,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateHotCorners: function() {
|
_updateHotCorners() {
|
||||||
// destroy old hot corners
|
// destroy old hot corners
|
||||||
this.hotCorners.forEach(function(corner) {
|
this.hotCorners.forEach(function(corner) {
|
||||||
if (corner)
|
if (corner)
|
||||||
@ -416,11 +416,11 @@ var LayoutManager = new Lang.Class({
|
|||||||
this.emit('hot-corners-changed');
|
this.emit('hot-corners-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_addBackgroundMenu: function(bgManager) {
|
_addBackgroundMenu(bgManager) {
|
||||||
BackgroundMenu.addBackgroundMenu(bgManager.backgroundActor, this);
|
BackgroundMenu.addBackgroundMenu(bgManager.backgroundActor, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createBackgroundManager: function(monitorIndex) {
|
_createBackgroundManager(monitorIndex) {
|
||||||
let bgManager = new Background.BackgroundManager({ container: this._backgroundGroup,
|
let bgManager = new Background.BackgroundManager({ container: this._backgroundGroup,
|
||||||
layoutManager: this,
|
layoutManager: this,
|
||||||
monitorIndex: monitorIndex });
|
monitorIndex: monitorIndex });
|
||||||
@ -431,7 +431,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
return bgManager;
|
return bgManager;
|
||||||
},
|
},
|
||||||
|
|
||||||
_showSecondaryBackgrounds: function() {
|
_showSecondaryBackgrounds() {
|
||||||
for (let i = 0; i < this.monitors.length; i++) {
|
for (let i = 0; i < this.monitors.length; i++) {
|
||||||
if (i != this.primaryIndex) {
|
if (i != this.primaryIndex) {
|
||||||
let backgroundActor = this._bgManagers[i].backgroundActor;
|
let backgroundActor = this._bgManagers[i].backgroundActor;
|
||||||
@ -445,7 +445,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateBackgrounds: function() {
|
_updateBackgrounds() {
|
||||||
let i;
|
let i;
|
||||||
for (i = 0; i < this._bgManagers.length; i++)
|
for (i = 0; i < this._bgManagers.length; i++)
|
||||||
this._bgManagers[i].destroy();
|
this._bgManagers[i].destroy();
|
||||||
@ -464,13 +464,13 @@ var LayoutManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateKeyboardBox: function() {
|
_updateKeyboardBox() {
|
||||||
this.keyboardBox.set_position(this.keyboardMonitor.x,
|
this.keyboardBox.set_position(this.keyboardMonitor.x,
|
||||||
this.keyboardMonitor.y + this.keyboardMonitor.height);
|
this.keyboardMonitor.y + this.keyboardMonitor.height);
|
||||||
this.keyboardBox.set_size(this.keyboardMonitor.width, -1);
|
this.keyboardBox.set_size(this.keyboardMonitor.width, -1);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateBoxes: function() {
|
_updateBoxes() {
|
||||||
this.screenShieldGroup.set_position(0, 0);
|
this.screenShieldGroup.set_position(0, 0);
|
||||||
this.screenShieldGroup.set_size(global.screen_width, global.screen_height);
|
this.screenShieldGroup.set_size(global.screen_width, global.screen_height);
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
this.keyboardIndex = this.primaryIndex;
|
this.keyboardIndex = this.primaryIndex;
|
||||||
},
|
},
|
||||||
|
|
||||||
_panelBoxChanged: function() {
|
_panelBoxChanged() {
|
||||||
this._updatePanelBarrier();
|
this._updatePanelBarrier();
|
||||||
|
|
||||||
let size = this.panelBox.height;
|
let size = this.panelBox.height;
|
||||||
@ -493,7 +493,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePanelBarrier: function() {
|
_updatePanelBarrier() {
|
||||||
if (this._rightPanelBarrier) {
|
if (this._rightPanelBarrier) {
|
||||||
this._rightPanelBarrier.destroy();
|
this._rightPanelBarrier.destroy();
|
||||||
this._rightPanelBarrier = null;
|
this._rightPanelBarrier = null;
|
||||||
@ -512,7 +512,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_monitorsChanged: function() {
|
_monitorsChanged() {
|
||||||
this._updateMonitors();
|
this._updateMonitors();
|
||||||
this._updateBoxes();
|
this._updateBoxes();
|
||||||
this._updateHotCorners();
|
this._updateHotCorners();
|
||||||
@ -524,7 +524,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
this.emit('monitors-changed');
|
this.emit('monitors-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_isAboveOrBelowPrimary: function(monitor) {
|
_isAboveOrBelowPrimary(monitor) {
|
||||||
let primary = this.monitors[this.primaryIndex];
|
let primary = this.monitors[this.primaryIndex];
|
||||||
let monitorLeft = monitor.x, monitorRight = monitor.x + monitor.width;
|
let monitorLeft = monitor.x, monitorRight = monitor.x + monitor.width;
|
||||||
let primaryLeft = primary.x, primaryRight = primary.x + primary.width;
|
let primaryLeft = primary.x, primaryRight = primary.x + primary.width;
|
||||||
@ -570,7 +570,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
return this._keyboardIndex;
|
return this._keyboardIndex;
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadBackground: function() {
|
_loadBackground() {
|
||||||
if (!this.primaryMonitor) {
|
if (!this.primaryMonitor) {
|
||||||
this._pendingLoadBackground = true;
|
this._pendingLoadBackground = true;
|
||||||
return;
|
return;
|
||||||
@ -608,7 +608,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
// When starting a normal user session, we want to grow it out of the middle
|
// When starting a normal user session, we want to grow it out of the middle
|
||||||
// of the screen.
|
// of the screen.
|
||||||
|
|
||||||
_prepareStartupAnimation: function() {
|
_prepareStartupAnimation() {
|
||||||
// During the initial transition, add a simple actor to block all events,
|
// During the initial transition, add a simple actor to block all events,
|
||||||
// so they don't get delivered to X11 windows that have been transformed.
|
// so they don't get delivered to X11 windows that have been transformed.
|
||||||
this._coverPane = new Clutter.Actor({ opacity: 0,
|
this._coverPane = new Clutter.Actor({ opacity: 0,
|
||||||
@ -659,7 +659,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(id, '[gnome-shell] this._startupAnimation');
|
GLib.Source.set_name_by_id(id, '[gnome-shell] this._startupAnimation');
|
||||||
},
|
},
|
||||||
|
|
||||||
_startupAnimation: function() {
|
_startupAnimation() {
|
||||||
if (Meta.is_restart())
|
if (Meta.is_restart())
|
||||||
this._startupAnimationComplete();
|
this._startupAnimationComplete();
|
||||||
else if (Main.sessionMode.isGreeter)
|
else if (Main.sessionMode.isGreeter)
|
||||||
@ -668,7 +668,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
this._startupAnimationSession();
|
this._startupAnimationSession();
|
||||||
},
|
},
|
||||||
|
|
||||||
_startupAnimationGreeter: function() {
|
_startupAnimationGreeter() {
|
||||||
Tweener.addTween(this.panelBox,
|
Tweener.addTween(this.panelBox,
|
||||||
{ translation_y: 0,
|
{ translation_y: 0,
|
||||||
time: STARTUP_ANIMATION_TIME,
|
time: STARTUP_ANIMATION_TIME,
|
||||||
@ -677,7 +677,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
onCompleteScope: this });
|
onCompleteScope: this });
|
||||||
},
|
},
|
||||||
|
|
||||||
_startupAnimationSession: function() {
|
_startupAnimationSession() {
|
||||||
Tweener.addTween(this.uiGroup,
|
Tweener.addTween(this.uiGroup,
|
||||||
{ scale_x: 1,
|
{ scale_x: 1,
|
||||||
scale_y: 1,
|
scale_y: 1,
|
||||||
@ -688,7 +688,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
onCompleteScope: this });
|
onCompleteScope: this });
|
||||||
},
|
},
|
||||||
|
|
||||||
_startupAnimationComplete: function() {
|
_startupAnimationComplete() {
|
||||||
this._coverPane.destroy();
|
this._coverPane.destroy();
|
||||||
this._coverPane = null;
|
this._coverPane = null;
|
||||||
|
|
||||||
@ -709,7 +709,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
this.emit('startup-complete');
|
this.emit('startup-complete');
|
||||||
},
|
},
|
||||||
|
|
||||||
showKeyboard: function () {
|
showKeyboard() {
|
||||||
this.keyboardBox.show();
|
this.keyboardBox.show();
|
||||||
Tweener.addTween(this.keyboardBox,
|
Tweener.addTween(this.keyboardBox,
|
||||||
{ anchor_y: this.keyboardBox.height,
|
{ anchor_y: this.keyboardBox.height,
|
||||||
@ -722,7 +722,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
this.emit('keyboard-visible-changed', true);
|
this.emit('keyboard-visible-changed', true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_showKeyboardComplete: function() {
|
_showKeyboardComplete() {
|
||||||
// Poke Chrome to update the input shape; it doesn't notice
|
// Poke Chrome to update the input shape; it doesn't notice
|
||||||
// anchor point changes
|
// anchor point changes
|
||||||
this._updateRegions();
|
this._updateRegions();
|
||||||
@ -732,7 +732,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
hideKeyboard: function (immediate) {
|
hideKeyboard(immediate) {
|
||||||
if (this._keyboardHeightNotifyId) {
|
if (this._keyboardHeightNotifyId) {
|
||||||
this.keyboardBox.disconnect(this._keyboardHeightNotifyId);
|
this.keyboardBox.disconnect(this._keyboardHeightNotifyId);
|
||||||
this._keyboardHeightNotifyId = 0;
|
this._keyboardHeightNotifyId = 0;
|
||||||
@ -749,7 +749,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
this.emit('keyboard-visible-changed', false);
|
this.emit('keyboard-visible-changed', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideKeyboardComplete: function() {
|
_hideKeyboardComplete() {
|
||||||
this.keyboardBox.hide();
|
this.keyboardBox.hide();
|
||||||
this._updateRegions();
|
this._updateRegions();
|
||||||
},
|
},
|
||||||
@ -764,7 +764,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
// the actual mouse pointer as it moves, you need to call this
|
// the actual mouse pointer as it moves, you need to call this
|
||||||
// function before you show the menu to ensure it is at the right
|
// function before you show the menu to ensure it is at the right
|
||||||
// position and has the right size.
|
// position and has the right size.
|
||||||
setDummyCursorGeometry: function(x, y, w, h) {
|
setDummyCursorGeometry(x, y, w, h) {
|
||||||
this.dummyCursor.set_position(Math.round(x), Math.round(y));
|
this.dummyCursor.set_position(Math.round(x), Math.round(y));
|
||||||
this.dummyCursor.set_size(Math.round(w), Math.round(h));
|
this.dummyCursor.set_size(Math.round(w), Math.round(h));
|
||||||
},
|
},
|
||||||
@ -788,7 +788,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
// will be bound to the presence of fullscreen windows on the same
|
// will be bound to the presence of fullscreen windows on the same
|
||||||
// monitor (it will be hidden whenever a fullscreen window is visible,
|
// monitor (it will be hidden whenever a fullscreen window is visible,
|
||||||
// and shown otherwise)
|
// and shown otherwise)
|
||||||
addChrome: function(actor, params) {
|
addChrome(actor, params) {
|
||||||
this.uiGroup.add_actor(actor);
|
this.uiGroup.add_actor(actor);
|
||||||
if (this.uiGroup.contains(global.top_window_group))
|
if (this.uiGroup.contains(global.top_window_group))
|
||||||
this.uiGroup.set_child_below_sibling(actor, global.top_window_group);
|
this.uiGroup.set_child_below_sibling(actor, global.top_window_group);
|
||||||
@ -805,7 +805,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
// @params can have any of the same values as in addChrome(),
|
// @params can have any of the same values as in addChrome(),
|
||||||
// though some possibilities don't make sense. By default, @actor has
|
// though some possibilities don't make sense. By default, @actor has
|
||||||
// the same params as its chrome ancestor.
|
// the same params as its chrome ancestor.
|
||||||
trackChrome: function(actor, params) {
|
trackChrome(actor, params) {
|
||||||
let ancestor = actor.get_parent();
|
let ancestor = actor.get_parent();
|
||||||
let index = this._findActor(ancestor);
|
let index = this._findActor(ancestor);
|
||||||
while (ancestor && index == -1) {
|
while (ancestor && index == -1) {
|
||||||
@ -831,7 +831,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
// @actor: an actor previously tracked via trackChrome()
|
// @actor: an actor previously tracked via trackChrome()
|
||||||
//
|
//
|
||||||
// Undoes the effect of trackChrome()
|
// Undoes the effect of trackChrome()
|
||||||
untrackChrome: function(actor) {
|
untrackChrome(actor) {
|
||||||
this._untrackActor(actor);
|
this._untrackActor(actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -839,12 +839,12 @@ var LayoutManager = new Lang.Class({
|
|||||||
// @actor: a chrome actor
|
// @actor: a chrome actor
|
||||||
//
|
//
|
||||||
// Removes @actor from the chrome
|
// Removes @actor from the chrome
|
||||||
removeChrome: function(actor) {
|
removeChrome(actor) {
|
||||||
this.uiGroup.remove_actor(actor);
|
this.uiGroup.remove_actor(actor);
|
||||||
this._untrackActor(actor);
|
this._untrackActor(actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_findActor: function(actor) {
|
_findActor(actor) {
|
||||||
for (let i = 0; i < this._trackedActors.length; i++) {
|
for (let i = 0; i < this._trackedActors.length; i++) {
|
||||||
let actorData = this._trackedActors[i];
|
let actorData = this._trackedActors[i];
|
||||||
if (actorData.actor == actor)
|
if (actorData.actor == actor)
|
||||||
@ -853,7 +853,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
return -1;
|
return -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
_trackActor: function(actor, params) {
|
_trackActor(actor, params) {
|
||||||
if (this._findActor(actor) != -1)
|
if (this._findActor(actor) != -1)
|
||||||
throw new Error('trying to re-track existing chrome actor');
|
throw new Error('trying to re-track existing chrome actor');
|
||||||
|
|
||||||
@ -873,7 +873,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
this._queueUpdateRegions();
|
this._queueUpdateRegions();
|
||||||
},
|
},
|
||||||
|
|
||||||
_untrackActor: function(actor) {
|
_untrackActor(actor) {
|
||||||
let i = this._findActor(actor);
|
let i = this._findActor(actor);
|
||||||
|
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
@ -888,7 +888,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
this._queueUpdateRegions();
|
this._queueUpdateRegions();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateActorVisibility: function(actorData) {
|
_updateActorVisibility(actorData) {
|
||||||
if (!actorData.trackFullscreen)
|
if (!actorData.trackFullscreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -898,7 +898,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
monitor.inFullscreen);
|
monitor.inFullscreen);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateVisibility: function() {
|
_updateVisibility() {
|
||||||
let windowsVisible = Main.sessionMode.hasWindows && !this._inOverview;
|
let windowsVisible = Main.sessionMode.hasWindows && !this._inOverview;
|
||||||
|
|
||||||
global.window_group.visible = windowsVisible;
|
global.window_group.visible = windowsVisible;
|
||||||
@ -907,7 +907,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
this._trackedActors.forEach(Lang.bind(this, this._updateActorVisibility));
|
this._trackedActors.forEach(Lang.bind(this, this._updateActorVisibility));
|
||||||
},
|
},
|
||||||
|
|
||||||
getWorkAreaForMonitor: function(monitorIndex) {
|
getWorkAreaForMonitor(monitorIndex) {
|
||||||
// Assume that all workspaces will have the same
|
// Assume that all workspaces will have the same
|
||||||
// struts and pick the first one.
|
// struts and pick the first one.
|
||||||
let ws = global.screen.get_workspace_by_index(0);
|
let ws = global.screen.get_workspace_by_index(0);
|
||||||
@ -916,21 +916,21 @@ var LayoutManager = new Lang.Class({
|
|||||||
|
|
||||||
// This call guarantees that we return some monitor to simplify usage of it
|
// This call guarantees that we return some monitor to simplify usage of it
|
||||||
// In practice all tracked actors should be visible on some monitor anyway
|
// In practice all tracked actors should be visible on some monitor anyway
|
||||||
findIndexForActor: function(actor) {
|
findIndexForActor(actor) {
|
||||||
let [x, y] = actor.get_transformed_position();
|
let [x, y] = actor.get_transformed_position();
|
||||||
let [w, h] = actor.get_transformed_size();
|
let [w, h] = actor.get_transformed_size();
|
||||||
let rect = new Meta.Rectangle({ x: x, y: y, width: w, height: h });
|
let rect = new Meta.Rectangle({ x: x, y: y, width: w, height: h });
|
||||||
return global.screen.get_monitor_index_for_rect(rect);
|
return global.screen.get_monitor_index_for_rect(rect);
|
||||||
},
|
},
|
||||||
|
|
||||||
findMonitorForActor: function(actor) {
|
findMonitorForActor(actor) {
|
||||||
let index = this.findIndexForActor(actor);
|
let index = this.findIndexForActor(actor);
|
||||||
if (index >= 0 && index < this.monitors.length)
|
if (index >= 0 && index < this.monitors.length)
|
||||||
return this.monitors[index];
|
return this.monitors[index];
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_queueUpdateRegions: function() {
|
_queueUpdateRegions() {
|
||||||
if (this._startingUp)
|
if (this._startingUp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -939,19 +939,19 @@ var LayoutManager = new Lang.Class({
|
|||||||
Lang.bind(this, this._updateRegions));
|
Lang.bind(this, this._updateRegions));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getWindowActorsForWorkspace: function(workspace) {
|
_getWindowActorsForWorkspace(workspace) {
|
||||||
return global.get_window_actors().filter(function (actor) {
|
return global.get_window_actors().filter(function (actor) {
|
||||||
let win = actor.meta_window;
|
let win = actor.meta_window;
|
||||||
return win.located_on_workspace(workspace);
|
return win.located_on_workspace(workspace);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateFullscreen: function() {
|
_updateFullscreen() {
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
this._queueUpdateRegions();
|
this._queueUpdateRegions();
|
||||||
},
|
},
|
||||||
|
|
||||||
_windowsRestacked: function() {
|
_windowsRestacked() {
|
||||||
let changed = false;
|
let changed = false;
|
||||||
|
|
||||||
if (this._isPopupWindowVisible != global.top_window_group.get_children().some(isPopupMetaWindow))
|
if (this._isPopupWindowVisible != global.top_window_group.get_children().some(isPopupMetaWindow))
|
||||||
@ -963,7 +963,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateRegions: function() {
|
_updateRegions() {
|
||||||
if (this._updateRegionIdle) {
|
if (this._updateRegionIdle) {
|
||||||
Meta.later_remove(this._updateRegionIdle);
|
Meta.later_remove(this._updateRegionIdle);
|
||||||
delete this._updateRegionIdle;
|
delete this._updateRegionIdle;
|
||||||
@ -1062,7 +1062,7 @@ var LayoutManager = new Lang.Class({
|
|||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
|
||||||
modalEnded: function() {
|
modalEnded() {
|
||||||
// We don't update the stage input region while in a modal,
|
// We don't update the stage input region while in a modal,
|
||||||
// so queue an update now.
|
// so queue an update now.
|
||||||
this._queueUpdateRegions();
|
this._queueUpdateRegions();
|
||||||
@ -1078,7 +1078,7 @@ Signals.addSignalMethods(LayoutManager.prototype);
|
|||||||
var HotCorner = new Lang.Class({
|
var HotCorner = new Lang.Class({
|
||||||
Name: 'HotCorner',
|
Name: 'HotCorner',
|
||||||
|
|
||||||
_init : function(layoutManager, monitor, x, y) {
|
_init(layoutManager, monitor, x, y) {
|
||||||
// We use this flag to mark the case where the user has entered the
|
// We use this flag to mark the case where the user has entered the
|
||||||
// hot corner and has not left both the hot corner and a surrounding
|
// hot corner and has not left both the hot corner and a surrounding
|
||||||
// guard area (the "environs"). This avoids triggering the hot corner
|
// guard area (the "environs"). This avoids triggering the hot corner
|
||||||
@ -1108,7 +1108,7 @@ var HotCorner = new Lang.Class({
|
|||||||
layoutManager.uiGroup.add_actor(this._ripple3);
|
layoutManager.uiGroup.add_actor(this._ripple3);
|
||||||
},
|
},
|
||||||
|
|
||||||
setBarrierSize: function(size) {
|
setBarrierSize(size) {
|
||||||
if (this._verticalBarrier) {
|
if (this._verticalBarrier) {
|
||||||
this._pressureBarrier.removeBarrier(this._verticalBarrier);
|
this._pressureBarrier.removeBarrier(this._verticalBarrier);
|
||||||
this._verticalBarrier.destroy();
|
this._verticalBarrier.destroy();
|
||||||
@ -1143,7 +1143,7 @@ var HotCorner = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_setupFallbackCornerIfNeeded: function(layoutManager) {
|
_setupFallbackCornerIfNeeded(layoutManager) {
|
||||||
if (!global.display.supports_extended_barriers()) {
|
if (!global.display.supports_extended_barriers()) {
|
||||||
this.actor = new Clutter.Actor({ name: 'hot-corner-environs',
|
this.actor = new Clutter.Actor({ name: 'hot-corner-environs',
|
||||||
x: this._x, y: this._y,
|
x: this._x, y: this._y,
|
||||||
@ -1178,7 +1178,7 @@ var HotCorner = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this.setBarrierSize(0);
|
this.setBarrierSize(0);
|
||||||
this._pressureBarrier.destroy();
|
this._pressureBarrier.destroy();
|
||||||
this._pressureBarrier = null;
|
this._pressureBarrier = null;
|
||||||
@ -1187,7 +1187,7 @@ var HotCorner = new Lang.Class({
|
|||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
_animRipple : function(ripple, delay, time, startScale, startOpacity, finalScale) {
|
_animRipple(ripple, delay, time, startScale, startOpacity, finalScale) {
|
||||||
// We draw a ripple by using a source image and animating it scaling
|
// We draw a ripple by using a source image and animating it scaling
|
||||||
// outwards and fading away. We want the ripples to move linearly
|
// outwards and fading away. We want the ripples to move linearly
|
||||||
// or it looks unrealistic, but if the opacity of the ripple goes
|
// or it looks unrealistic, but if the opacity of the ripple goes
|
||||||
@ -1213,11 +1213,11 @@ var HotCorner = new Lang.Class({
|
|||||||
delay: delay,
|
delay: delay,
|
||||||
time: time,
|
time: time,
|
||||||
transition: 'linear',
|
transition: 'linear',
|
||||||
onUpdate: function() { ripple.opacity = 255 * Math.sqrt(ripple._opacity); },
|
onUpdate() { ripple.opacity = 255 * Math.sqrt(ripple._opacity); },
|
||||||
onComplete: function() { ripple.visible = false; } });
|
onComplete() { ripple.visible = false; } });
|
||||||
},
|
},
|
||||||
|
|
||||||
_rippleAnimation: function() {
|
_rippleAnimation() {
|
||||||
// Show three concentric ripples expanding outwards; the exact
|
// Show three concentric ripples expanding outwards; the exact
|
||||||
// parameters were found by trial and error, so don't look
|
// parameters were found by trial and error, so don't look
|
||||||
// for them to make perfect sense mathematically
|
// for them to make perfect sense mathematically
|
||||||
@ -1228,7 +1228,7 @@ var HotCorner = new Lang.Class({
|
|||||||
this._animRipple(this._ripple3, 0.35, 1.0, 0.0, 0.3, 1);
|
this._animRipple(this._ripple3, 0.35, 1.0, 0.0, 0.3, 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
_toggleOverview: function() {
|
_toggleOverview() {
|
||||||
if (this._monitor.inFullscreen)
|
if (this._monitor.inFullscreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1238,7 +1238,7 @@ var HotCorner = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleDragOver: function(source, actor, x, y, time) {
|
handleDragOver(source, actor, x, y, time) {
|
||||||
if (source != Main.xdndHandler)
|
if (source != Main.xdndHandler)
|
||||||
return DND.DragMotionResult.CONTINUE;
|
return DND.DragMotionResult.CONTINUE;
|
||||||
|
|
||||||
@ -1247,7 +1247,7 @@ var HotCorner = new Lang.Class({
|
|||||||
return DND.DragMotionResult.CONTINUE;
|
return DND.DragMotionResult.CONTINUE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCornerEntered : function() {
|
_onCornerEntered() {
|
||||||
if (!this._entered) {
|
if (!this._entered) {
|
||||||
this._entered = true;
|
this._entered = true;
|
||||||
this._toggleOverview();
|
this._toggleOverview();
|
||||||
@ -1255,14 +1255,14 @@ var HotCorner = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCornerLeft : function(actor, event) {
|
_onCornerLeft(actor, event) {
|
||||||
if (event.get_related() != this.actor)
|
if (event.get_related() != this.actor)
|
||||||
this._entered = false;
|
this._entered = false;
|
||||||
// Consume event, otherwise this will confuse onEnvironsLeft
|
// Consume event, otherwise this will confuse onEnvironsLeft
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEnvironsLeft : function(actor, event) {
|
_onEnvironsLeft(actor, event) {
|
||||||
if (event.get_related() != this._corner)
|
if (event.get_related() != this._corner)
|
||||||
this._entered = false;
|
this._entered = false;
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
@ -1272,7 +1272,7 @@ var HotCorner = new Lang.Class({
|
|||||||
var PressureBarrier = new Lang.Class({
|
var PressureBarrier = new Lang.Class({
|
||||||
Name: 'PressureBarrier',
|
Name: 'PressureBarrier',
|
||||||
|
|
||||||
_init: function(threshold, timeout, actionMode) {
|
_init(threshold, timeout, actionMode) {
|
||||||
this._threshold = threshold;
|
this._threshold = threshold;
|
||||||
this._timeout = timeout;
|
this._timeout = timeout;
|
||||||
this._actionMode = actionMode;
|
this._actionMode = actionMode;
|
||||||
@ -1283,57 +1283,57 @@ var PressureBarrier = new Lang.Class({
|
|||||||
this._reset();
|
this._reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
addBarrier: function(barrier) {
|
addBarrier(barrier) {
|
||||||
barrier._pressureHitId = barrier.connect('hit', Lang.bind(this, this._onBarrierHit));
|
barrier._pressureHitId = barrier.connect('hit', Lang.bind(this, this._onBarrierHit));
|
||||||
barrier._pressureLeftId = barrier.connect('left', Lang.bind(this, this._onBarrierLeft));
|
barrier._pressureLeftId = barrier.connect('left', Lang.bind(this, this._onBarrierLeft));
|
||||||
|
|
||||||
this._barriers.push(barrier);
|
this._barriers.push(barrier);
|
||||||
},
|
},
|
||||||
|
|
||||||
_disconnectBarrier: function(barrier) {
|
_disconnectBarrier(barrier) {
|
||||||
barrier.disconnect(barrier._pressureHitId);
|
barrier.disconnect(barrier._pressureHitId);
|
||||||
barrier.disconnect(barrier._pressureLeftId);
|
barrier.disconnect(barrier._pressureLeftId);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeBarrier: function(barrier) {
|
removeBarrier(barrier) {
|
||||||
this._disconnectBarrier(barrier);
|
this._disconnectBarrier(barrier);
|
||||||
this._barriers.splice(this._barriers.indexOf(barrier), 1);
|
this._barriers.splice(this._barriers.indexOf(barrier), 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this._barriers.forEach(Lang.bind(this, this._disconnectBarrier));
|
this._barriers.forEach(Lang.bind(this, this._disconnectBarrier));
|
||||||
this._barriers = [];
|
this._barriers = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
setEventFilter: function(filter) {
|
setEventFilter(filter) {
|
||||||
this._eventFilter = filter;
|
this._eventFilter = filter;
|
||||||
},
|
},
|
||||||
|
|
||||||
_reset: function() {
|
_reset() {
|
||||||
this._barrierEvents = [];
|
this._barrierEvents = [];
|
||||||
this._currentPressure = 0;
|
this._currentPressure = 0;
|
||||||
this._lastTime = 0;
|
this._lastTime = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_isHorizontal: function(barrier) {
|
_isHorizontal(barrier) {
|
||||||
return barrier.y1 == barrier.y2;
|
return barrier.y1 == barrier.y2;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getDistanceAcrossBarrier: function(barrier, event) {
|
_getDistanceAcrossBarrier(barrier, event) {
|
||||||
if (this._isHorizontal(barrier))
|
if (this._isHorizontal(barrier))
|
||||||
return Math.abs(event.dy);
|
return Math.abs(event.dy);
|
||||||
else
|
else
|
||||||
return Math.abs(event.dx);
|
return Math.abs(event.dx);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getDistanceAlongBarrier: function(barrier, event) {
|
_getDistanceAlongBarrier(barrier, event) {
|
||||||
if (this._isHorizontal(barrier))
|
if (this._isHorizontal(barrier))
|
||||||
return Math.abs(event.dx);
|
return Math.abs(event.dx);
|
||||||
else
|
else
|
||||||
return Math.abs(event.dy);
|
return Math.abs(event.dy);
|
||||||
},
|
},
|
||||||
|
|
||||||
_trimBarrierEvents: function() {
|
_trimBarrierEvents() {
|
||||||
// Events are guaranteed to be sorted in time order from
|
// Events are guaranteed to be sorted in time order from
|
||||||
// oldest to newest, so just look for the first old event,
|
// oldest to newest, so just look for the first old event,
|
||||||
// and then chop events after that off.
|
// and then chop events after that off.
|
||||||
@ -1357,7 +1357,7 @@ var PressureBarrier = new Lang.Class({
|
|||||||
this._barrierEvents = this._barrierEvents.slice(firstNewEvent);
|
this._barrierEvents = this._barrierEvents.slice(firstNewEvent);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onBarrierLeft: function(barrier, event) {
|
_onBarrierLeft(barrier, event) {
|
||||||
barrier._isHit = false;
|
barrier._isHit = false;
|
||||||
if (this._barriers.every(function(b) { return !b._isHit; })) {
|
if (this._barriers.every(function(b) { return !b._isHit; })) {
|
||||||
this._reset();
|
this._reset();
|
||||||
@ -1365,13 +1365,13 @@ var PressureBarrier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_trigger: function() {
|
_trigger() {
|
||||||
this._isTriggered = true;
|
this._isTriggered = true;
|
||||||
this.emit('trigger');
|
this.emit('trigger');
|
||||||
this._reset();
|
this._reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onBarrierHit: function(barrier, event) {
|
_onBarrierHit(barrier, event) {
|
||||||
barrier._isHit = true;
|
barrier._isHit = true;
|
||||||
|
|
||||||
// If we've triggered the barrier, wait until the pointer has the
|
// If we've triggered the barrier, wait until the pointer has the
|
||||||
|
@ -31,7 +31,7 @@ var RadialShaderQuad = new Lang.Class({
|
|||||||
Name: 'RadialShaderQuad',
|
Name: 'RadialShaderQuad',
|
||||||
Extends: Shell.GLSLQuad,
|
Extends: Shell.GLSLQuad,
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
this.parent(params);
|
this.parent(params);
|
||||||
|
|
||||||
this._brightnessLocation = this.get_uniform_location('brightness');
|
this._brightnessLocation = this.get_uniform_location('brightness');
|
||||||
@ -41,7 +41,7 @@ var RadialShaderQuad = new Lang.Class({
|
|||||||
this.vignetteSharpness = 0.0;
|
this.vignetteSharpness = 0.0;
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_build_pipeline: function() {
|
vfunc_build_pipeline() {
|
||||||
this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT,
|
this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT,
|
||||||
VIGNETTE_DECLARATIONS, VIGNETTE_CODE, true);
|
VIGNETTE_DECLARATIONS, VIGNETTE_CODE, true);
|
||||||
},
|
},
|
||||||
@ -94,7 +94,7 @@ var RadialShaderQuad = new Lang.Class({
|
|||||||
var Lightbox = new Lang.Class({
|
var Lightbox = new Lang.Class({
|
||||||
Name: 'Lightbox',
|
Name: 'Lightbox',
|
||||||
|
|
||||||
_init : function(container, params) {
|
_init(container, params) {
|
||||||
params = Params.parse(params, { inhibitEvents: false,
|
params = Params.parse(params, { inhibitEvents: false,
|
||||||
width: null,
|
width: null,
|
||||||
height: null,
|
height: null,
|
||||||
@ -139,7 +139,7 @@ var Lightbox = new Lang.Class({
|
|||||||
this._highlighted = null;
|
this._highlighted = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_actorAdded : function(container, newChild) {
|
_actorAdded(container, newChild) {
|
||||||
let children = this._container.get_children();
|
let children = this._container.get_children();
|
||||||
let myIndex = children.indexOf(this.actor);
|
let myIndex = children.indexOf(this.actor);
|
||||||
let newChildIndex = children.indexOf(newChild);
|
let newChildIndex = children.indexOf(newChild);
|
||||||
@ -161,7 +161,7 @@ var Lightbox = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function(fadeInTime) {
|
show(fadeInTime) {
|
||||||
fadeInTime = fadeInTime || 0;
|
fadeInTime = fadeInTime || 0;
|
||||||
|
|
||||||
Tweener.removeTweens(this.actor);
|
Tweener.removeTweens(this.actor);
|
||||||
@ -191,7 +191,7 @@ var Lightbox = new Lang.Class({
|
|||||||
this.actor.show();
|
this.actor.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function(fadeOutTime) {
|
hide(fadeOutTime) {
|
||||||
fadeOutTime = fadeOutTime || 0;
|
fadeOutTime = fadeOutTime || 0;
|
||||||
|
|
||||||
this.shown = false;
|
this.shown = false;
|
||||||
@ -219,7 +219,7 @@ var Lightbox = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_actorRemoved : function(container, child) {
|
_actorRemoved(container, child) {
|
||||||
let index = this._children.indexOf(child);
|
let index = this._children.indexOf(child);
|
||||||
if (index != -1) // paranoia
|
if (index != -1) // paranoia
|
||||||
this._children.splice(index, 1);
|
this._children.splice(index, 1);
|
||||||
@ -236,7 +236,7 @@ var Lightbox = new Lang.Class({
|
|||||||
* currently-highlighted actor. With no arguments or a false/null
|
* currently-highlighted actor. With no arguments or a false/null
|
||||||
* argument, all actors will be unhighlighted.
|
* argument, all actors will be unhighlighted.
|
||||||
*/
|
*/
|
||||||
highlight : function(window) {
|
highlight(window) {
|
||||||
if (this._highlighted == window)
|
if (this._highlighted == window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ var Lightbox = new Lang.Class({
|
|||||||
*
|
*
|
||||||
* Destroys the lightbox.
|
* Destroys the lightbox.
|
||||||
*/
|
*/
|
||||||
destroy : function() {
|
destroy() {
|
||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ var Lightbox = new Lang.Class({
|
|||||||
* This is called when the lightbox' actor is destroyed, either
|
* This is called when the lightbox' actor is destroyed, either
|
||||||
* by destroying its container or by explicitly calling this.destroy().
|
* by destroying its container or by explicitly calling this.destroy().
|
||||||
*/
|
*/
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this._container.disconnect(this._actorAddedSignalId);
|
this._container.disconnect(this._actorAddedSignalId);
|
||||||
this._container.disconnect(this._actorRemovedSignalId);
|
this._container.disconnect(this._actorRemovedSignalId);
|
||||||
|
|
||||||
|
@ -62,13 +62,13 @@ function _getAutoCompleteGlobalKeywords() {
|
|||||||
var AutoComplete = new Lang.Class({
|
var AutoComplete = new Lang.Class({
|
||||||
Name: 'AutoComplete',
|
Name: 'AutoComplete',
|
||||||
|
|
||||||
_init: function(entry) {
|
_init(entry) {
|
||||||
this._entry = entry;
|
this._entry = entry;
|
||||||
this._entry.connect('key-press-event', Lang.bind(this, this._entryKeyPressEvent));
|
this._entry.connect('key-press-event', Lang.bind(this, this._entryKeyPressEvent));
|
||||||
this._lastTabTime = global.get_current_time();
|
this._lastTabTime = global.get_current_time();
|
||||||
},
|
},
|
||||||
|
|
||||||
_processCompletionRequest: function(event) {
|
_processCompletionRequest(event) {
|
||||||
if (event.completions.length == 0) {
|
if (event.completions.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ var AutoComplete = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_entryKeyPressEvent: function(actor, event) {
|
_entryKeyPressEvent(actor, event) {
|
||||||
let cursorPos = this._entry.clutter_text.get_cursor_position();
|
let cursorPos = this._entry.clutter_text.get_cursor_position();
|
||||||
let text = this._entry.get_text();
|
let text = this._entry.get_text();
|
||||||
if (cursorPos != -1) {
|
if (cursorPos != -1) {
|
||||||
@ -115,7 +115,7 @@ var AutoComplete = new Lang.Class({
|
|||||||
|
|
||||||
// Insert characters of text not already included in head at cursor position. i.e., if text="abc" and head="a",
|
// Insert characters of text not already included in head at cursor position. i.e., if text="abc" and head="a",
|
||||||
// the string "bc" will be appended to this._entry
|
// the string "bc" will be appended to this._entry
|
||||||
additionalCompletionText: function(text, head) {
|
additionalCompletionText(text, head) {
|
||||||
let additionalCompletionText = text.slice(head.length);
|
let additionalCompletionText = text.slice(head.length);
|
||||||
let cursorPos = this._entry.clutter_text.get_cursor_position();
|
let cursorPos = this._entry.clutter_text.get_cursor_position();
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ Signals.addSignalMethods(AutoComplete.prototype);
|
|||||||
var Notebook = new Lang.Class({
|
var Notebook = new Lang.Class({
|
||||||
Name: 'Notebook',
|
Name: 'Notebook',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.BoxLayout({ vertical: true });
|
this.actor = new St.BoxLayout({ vertical: true });
|
||||||
|
|
||||||
this.tabControls = new St.BoxLayout({ style_class: 'labels' });
|
this.tabControls = new St.BoxLayout({ style_class: 'labels' });
|
||||||
@ -137,7 +137,7 @@ var Notebook = new Lang.Class({
|
|||||||
this._tabs = [];
|
this._tabs = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
appendPage: function(name, child) {
|
appendPage(name, child) {
|
||||||
let labelBox = new St.BoxLayout({ style_class: 'notebook-tab',
|
let labelBox = new St.BoxLayout({ style_class: 'notebook-tab',
|
||||||
reactive: true,
|
reactive: true,
|
||||||
track_hover: true });
|
track_hover: true });
|
||||||
@ -170,7 +170,7 @@ var Notebook = new Lang.Class({
|
|||||||
this.selectIndex(0);
|
this.selectIndex(0);
|
||||||
},
|
},
|
||||||
|
|
||||||
_unselect: function() {
|
_unselect() {
|
||||||
if (this._selectedIndex < 0)
|
if (this._selectedIndex < 0)
|
||||||
return;
|
return;
|
||||||
let tabData = this._tabs[this._selectedIndex];
|
let tabData = this._tabs[this._selectedIndex];
|
||||||
@ -179,7 +179,7 @@ var Notebook = new Lang.Class({
|
|||||||
this._selectedIndex = -1;
|
this._selectedIndex = -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
selectIndex: function(index) {
|
selectIndex(index) {
|
||||||
if (index == this._selectedIndex)
|
if (index == this._selectedIndex)
|
||||||
return;
|
return;
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
@ -201,7 +201,7 @@ var Notebook = new Lang.Class({
|
|||||||
this.emit('selection', tabData.child);
|
this.emit('selection', tabData.child);
|
||||||
},
|
},
|
||||||
|
|
||||||
selectChild: function(child) {
|
selectChild(child) {
|
||||||
if (child == null)
|
if (child == null)
|
||||||
this.selectIndex(-1);
|
this.selectIndex(-1);
|
||||||
else {
|
else {
|
||||||
@ -215,26 +215,26 @@ var Notebook = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollToBottom: function(index) {
|
scrollToBottom(index) {
|
||||||
let tabData = this._tabs[index];
|
let tabData = this._tabs[index];
|
||||||
tabData._scrollToBottom = true;
|
tabData._scrollToBottom = true;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAdjustValueChanged: function (tabData) {
|
_onAdjustValueChanged(tabData) {
|
||||||
let vAdjust = tabData.scrollView.vscroll.adjustment;
|
let vAdjust = tabData.scrollView.vscroll.adjustment;
|
||||||
if (vAdjust.value < (vAdjust.upper - vAdjust.lower - 0.5))
|
if (vAdjust.value < (vAdjust.upper - vAdjust.lower - 0.5))
|
||||||
tabData._scrolltoBottom = false;
|
tabData._scrolltoBottom = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAdjustScopeChanged: function (tabData) {
|
_onAdjustScopeChanged(tabData) {
|
||||||
if (!tabData._scrollToBottom)
|
if (!tabData._scrollToBottom)
|
||||||
return;
|
return;
|
||||||
let vAdjust = tabData.scrollView.vscroll.adjustment;
|
let vAdjust = tabData.scrollView.vscroll.adjustment;
|
||||||
vAdjust.value = vAdjust.upper - vAdjust.page_size;
|
vAdjust.value = vAdjust.upper - vAdjust.page_size;
|
||||||
},
|
},
|
||||||
|
|
||||||
nextTab: function() {
|
nextTab() {
|
||||||
let nextIndex = this._selectedIndex;
|
let nextIndex = this._selectedIndex;
|
||||||
if (nextIndex < this._tabs.length - 1) {
|
if (nextIndex < this._tabs.length - 1) {
|
||||||
++nextIndex;
|
++nextIndex;
|
||||||
@ -243,7 +243,7 @@ var Notebook = new Lang.Class({
|
|||||||
this.selectIndex(nextIndex);
|
this.selectIndex(nextIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
prevTab: function() {
|
prevTab() {
|
||||||
let prevIndex = this._selectedIndex;
|
let prevIndex = this._selectedIndex;
|
||||||
if (prevIndex > 0) {
|
if (prevIndex > 0) {
|
||||||
--prevIndex;
|
--prevIndex;
|
||||||
@ -266,7 +266,7 @@ function objectToString(o) {
|
|||||||
var ObjLink = new Lang.Class({
|
var ObjLink = new Lang.Class({
|
||||||
Name: 'ObjLink',
|
Name: 'ObjLink',
|
||||||
|
|
||||||
_init: function(lookingGlass, o, title) {
|
_init(lookingGlass, o, title) {
|
||||||
let text;
|
let text;
|
||||||
if (title)
|
if (title)
|
||||||
text = title;
|
text = title;
|
||||||
@ -285,7 +285,7 @@ var ObjLink = new Lang.Class({
|
|||||||
this._lookingGlass = lookingGlass;
|
this._lookingGlass = lookingGlass;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onClicked: function (link) {
|
_onClicked(link) {
|
||||||
this._lookingGlass.inspectObject(this._obj, this.actor);
|
this._lookingGlass.inspectObject(this._obj, this.actor);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -293,7 +293,7 @@ var ObjLink = new Lang.Class({
|
|||||||
var Result = new Lang.Class({
|
var Result = new Lang.Class({
|
||||||
Name: 'Result',
|
Name: 'Result',
|
||||||
|
|
||||||
_init: function(lookingGlass, command, o, index) {
|
_init(lookingGlass, command, o, index) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.o = o;
|
this.o = o;
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ var Result = new Lang.Class({
|
|||||||
var WindowList = new Lang.Class({
|
var WindowList = new Lang.Class({
|
||||||
Name: 'WindowList',
|
Name: 'WindowList',
|
||||||
|
|
||||||
_init: function(lookingGlass) {
|
_init(lookingGlass) {
|
||||||
this.actor = new St.BoxLayout({ name: 'Windows', vertical: true, style: 'spacing: 8px' });
|
this.actor = new St.BoxLayout({ name: 'Windows', vertical: true, style: 'spacing: 8px' });
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
this._updateId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._updateWindowList));
|
this._updateId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._updateWindowList));
|
||||||
@ -326,7 +326,7 @@ var WindowList = new Lang.Class({
|
|||||||
this._lookingGlass = lookingGlass;
|
this._lookingGlass = lookingGlass;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateWindowList: function() {
|
_updateWindowList() {
|
||||||
this.actor.destroy_all_children();
|
this.actor.destroy_all_children();
|
||||||
let windows = global.get_window_actors();
|
let windows = global.get_window_actors();
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
@ -364,7 +364,7 @@ Signals.addSignalMethods(WindowList.prototype);
|
|||||||
var ObjInspector = new Lang.Class({
|
var ObjInspector = new Lang.Class({
|
||||||
Name: 'ObjInspector',
|
Name: 'ObjInspector',
|
||||||
|
|
||||||
_init: function(lookingGlass) {
|
_init(lookingGlass) {
|
||||||
this._obj = null;
|
this._obj = null;
|
||||||
this._previousObj = null;
|
this._previousObj = null;
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ var ObjInspector = new Lang.Class({
|
|||||||
this._lookingGlass = lookingGlass;
|
this._lookingGlass = lookingGlass;
|
||||||
},
|
},
|
||||||
|
|
||||||
selectObject: function(obj, skipPrevious) {
|
selectObject(obj, skipPrevious) {
|
||||||
if (!skipPrevious)
|
if (!skipPrevious)
|
||||||
this._previousObj = this._obj;
|
this._previousObj = this._obj;
|
||||||
else
|
else
|
||||||
@ -435,7 +435,7 @@ var ObjInspector = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function(sourceActor) {
|
open(sourceActor) {
|
||||||
if (this._open)
|
if (this._open)
|
||||||
return;
|
return;
|
||||||
this._previousObj = null;
|
this._previousObj = null;
|
||||||
@ -451,7 +451,7 @@ var ObjInspector = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function() {
|
close() {
|
||||||
if (!this._open)
|
if (!this._open)
|
||||||
return;
|
return;
|
||||||
this._open = false;
|
this._open = false;
|
||||||
@ -460,13 +460,13 @@ var ObjInspector = new Lang.Class({
|
|||||||
this._obj = null;
|
this._obj = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onInsert: function() {
|
_onInsert() {
|
||||||
let obj = this._obj;
|
let obj = this._obj;
|
||||||
this.close();
|
this.close();
|
||||||
this._lookingGlass.insertObject(obj);
|
this._lookingGlass.insertObject(obj);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onBack: function() {
|
_onBack() {
|
||||||
this.selectObject(this._previousObj, true);
|
this.selectObject(this._previousObj, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -475,7 +475,7 @@ var RedBorderEffect = new Lang.Class({
|
|||||||
Name: 'RedBorderEffect',
|
Name: 'RedBorderEffect',
|
||||||
Extends: Clutter.Effect,
|
Extends: Clutter.Effect,
|
||||||
|
|
||||||
vfunc_paint: function() {
|
vfunc_paint() {
|
||||||
let actor = this.get_actor();
|
let actor = this.get_actor();
|
||||||
actor.continue_paint();
|
actor.continue_paint();
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ var RedBorderEffect = new Lang.Class({
|
|||||||
var Inspector = new Lang.Class({
|
var Inspector = new Lang.Class({
|
||||||
Name: 'Inspector',
|
Name: 'Inspector',
|
||||||
|
|
||||||
_init: function(lookingGlass) {
|
_init(lookingGlass) {
|
||||||
let container = new Shell.GenericContainer({ width: 0,
|
let container = new Shell.GenericContainer({ width: 0,
|
||||||
height: 0 });
|
height: 0 });
|
||||||
container.connect('allocate', Lang.bind(this, this._allocate));
|
container.connect('allocate', Lang.bind(this, this._allocate));
|
||||||
@ -532,7 +532,7 @@ var Inspector = new Lang.Class({
|
|||||||
this._lookingGlass = lookingGlass;
|
this._lookingGlass = lookingGlass;
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocate: function(actor, box, flags) {
|
_allocate(actor, box, flags) {
|
||||||
if (!this._eventHandler)
|
if (!this._eventHandler)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -549,7 +549,7 @@ var Inspector = new Lang.Class({
|
|||||||
this._eventHandler.allocate(childBox, flags);
|
this._eventHandler.allocate(childBox, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
_close: function() {
|
_close() {
|
||||||
Clutter.ungrab_pointer();
|
Clutter.ungrab_pointer();
|
||||||
Clutter.ungrab_keyboard();
|
Clutter.ungrab_keyboard();
|
||||||
this._eventHandler.destroy();
|
this._eventHandler.destroy();
|
||||||
@ -557,13 +557,13 @@ var Inspector = new Lang.Class({
|
|||||||
this.emit('closed');
|
this.emit('closed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyPressEvent: function (actor, event) {
|
_onKeyPressEvent(actor, event) {
|
||||||
if (event.get_key_symbol() == Clutter.Escape)
|
if (event.get_key_symbol() == Clutter.Escape)
|
||||||
this._close();
|
this._close();
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonPressEvent: function (actor, event) {
|
_onButtonPressEvent(actor, event) {
|
||||||
if (this._target) {
|
if (this._target) {
|
||||||
let [stageX, stageY] = event.get_coords();
|
let [stageX, stageY] = event.get_coords();
|
||||||
this.emit('target', this._target, stageX, stageY);
|
this.emit('target', this._target, stageX, stageY);
|
||||||
@ -572,7 +572,7 @@ var Inspector = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onScrollEvent: function (actor, event) {
|
_onScrollEvent(actor, event) {
|
||||||
switch (event.get_scroll_direction()) {
|
switch (event.get_scroll_direction()) {
|
||||||
case Clutter.ScrollDirection.UP:
|
case Clutter.ScrollDirection.UP:
|
||||||
// select parent
|
// select parent
|
||||||
@ -606,12 +606,12 @@ var Inspector = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMotionEvent: function (actor, event) {
|
_onMotionEvent(actor, event) {
|
||||||
this._update(event);
|
this._update(event);
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_update: function(event) {
|
_update(event) {
|
||||||
let [stageX, stageY] = event.get_coords();
|
let [stageX, stageY] = event.get_coords();
|
||||||
let target = global.stage.get_actor_at_pos(Clutter.PickMode.ALL,
|
let target = global.stage.get_actor_at_pos(Clutter.PickMode.ALL,
|
||||||
stageX,
|
stageX,
|
||||||
@ -634,7 +634,7 @@ Signals.addSignalMethods(Inspector.prototype);
|
|||||||
var Extensions = new Lang.Class({
|
var Extensions = new Lang.Class({
|
||||||
Name: 'Extensions',
|
Name: 'Extensions',
|
||||||
|
|
||||||
_init: function(lookingGlass) {
|
_init(lookingGlass) {
|
||||||
this._lookingGlass = lookingGlass;
|
this._lookingGlass = lookingGlass;
|
||||||
this.actor = new St.BoxLayout({ vertical: true,
|
this.actor = new St.BoxLayout({ vertical: true,
|
||||||
name: 'lookingGlassExtensions' });
|
name: 'lookingGlassExtensions' });
|
||||||
@ -653,7 +653,7 @@ var Extensions = new Lang.Class({
|
|||||||
Lang.bind(this, this._loadExtension));
|
Lang.bind(this, this._loadExtension));
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadExtension: function(o, uuid) {
|
_loadExtension(o, uuid) {
|
||||||
let extension = ExtensionUtils.extensions[uuid];
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
// There can be cases where we create dummy extension metadata
|
// There can be cases where we create dummy extension metadata
|
||||||
// that's not really a proper extension. Don't bother with these.
|
// that's not really a proper extension. Don't bother with these.
|
||||||
@ -668,20 +668,20 @@ var Extensions = new Lang.Class({
|
|||||||
this._extensionsList.add(extensionDisplay);
|
this._extensionsList.add(extensionDisplay);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onViewSource: function (actor) {
|
_onViewSource(actor) {
|
||||||
let extension = actor._extension;
|
let extension = actor._extension;
|
||||||
let uri = extension.dir.get_uri();
|
let uri = extension.dir.get_uri();
|
||||||
Gio.app_info_launch_default_for_uri(uri, global.create_app_launch_context(0, -1));
|
Gio.app_info_launch_default_for_uri(uri, global.create_app_launch_context(0, -1));
|
||||||
this._lookingGlass.close();
|
this._lookingGlass.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onWebPage: function (actor) {
|
_onWebPage(actor) {
|
||||||
let extension = actor._extension;
|
let extension = actor._extension;
|
||||||
Gio.app_info_launch_default_for_uri(extension.metadata.url, global.create_app_launch_context(0, -1));
|
Gio.app_info_launch_default_for_uri(extension.metadata.url, global.create_app_launch_context(0, -1));
|
||||||
this._lookingGlass.close();
|
this._lookingGlass.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onViewErrors: function (actor) {
|
_onViewErrors(actor) {
|
||||||
let extension = actor._extension;
|
let extension = actor._extension;
|
||||||
let shouldShow = !actor._isShowing;
|
let shouldShow = !actor._isShowing;
|
||||||
|
|
||||||
@ -709,7 +709,7 @@ var Extensions = new Lang.Class({
|
|||||||
actor._isShowing = shouldShow;
|
actor._isShowing = shouldShow;
|
||||||
},
|
},
|
||||||
|
|
||||||
_stateToString: function(extensionState) {
|
_stateToString(extensionState) {
|
||||||
switch (extensionState) {
|
switch (extensionState) {
|
||||||
case ExtensionSystem.ExtensionState.ENABLED:
|
case ExtensionSystem.ExtensionState.ENABLED:
|
||||||
return _("Enabled");
|
return _("Enabled");
|
||||||
@ -726,7 +726,7 @@ var Extensions = new Lang.Class({
|
|||||||
return 'Unknown'; // Not translated, shouldn't appear
|
return 'Unknown'; // Not translated, shouldn't appear
|
||||||
},
|
},
|
||||||
|
|
||||||
_createExtensionDisplay: function(extension) {
|
_createExtensionDisplay(extension) {
|
||||||
let box = new St.BoxLayout({ style_class: 'lg-extension', vertical: true });
|
let box = new St.BoxLayout({ style_class: 'lg-extension', vertical: true });
|
||||||
let name = new St.Label({ style_class: 'lg-extension-name',
|
let name = new St.Label({ style_class: 'lg-extension-name',
|
||||||
text: extension.metadata.name });
|
text: extension.metadata.name });
|
||||||
@ -777,7 +777,7 @@ var Extensions = new Lang.Class({
|
|||||||
var LookingGlass = new Lang.Class({
|
var LookingGlass = new Lang.Class({
|
||||||
Name: 'LookingGlass',
|
Name: 'LookingGlass',
|
||||||
|
|
||||||
_init : function() {
|
_init() {
|
||||||
this._borderPaintTarget = null;
|
this._borderPaintTarget = null;
|
||||||
this._redBorderEffect = new RedBorderEffect();
|
this._redBorderEffect = new RedBorderEffect();
|
||||||
|
|
||||||
@ -913,7 +913,7 @@ var LookingGlass = new Lang.Class({
|
|||||||
this._resize();
|
this._resize();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateFont: function() {
|
_updateFont() {
|
||||||
let fontName = this._interfaceSettings.get_string('monospace-font-name');
|
let fontName = this._interfaceSettings.get_string('monospace-font-name');
|
||||||
let fontDesc = Pango.FontDescription.from_string(fontName);
|
let fontDesc = Pango.FontDescription.from_string(fontName);
|
||||||
// We ignore everything but size and style; you'd be crazy to set your system-wide
|
// We ignore everything but size and style; you'd be crazy to set your system-wide
|
||||||
@ -923,7 +923,7 @@ var LookingGlass = new Lang.Class({
|
|||||||
+ 'font-family: "' + fontDesc.get_family() + '";';
|
+ 'font-family: "' + fontDesc.get_family() + '";';
|
||||||
},
|
},
|
||||||
|
|
||||||
setBorderPaintTarget: function(obj) {
|
setBorderPaintTarget(obj) {
|
||||||
if (this._borderPaintTarget != null)
|
if (this._borderPaintTarget != null)
|
||||||
this._borderPaintTarget.remove_effect(this._redBorderEffect);
|
this._borderPaintTarget.remove_effect(this._redBorderEffect);
|
||||||
this._borderPaintTarget = obj;
|
this._borderPaintTarget = obj;
|
||||||
@ -931,7 +931,7 @@ var LookingGlass = new Lang.Class({
|
|||||||
this._borderPaintTarget.add_effect(this._redBorderEffect);
|
this._borderPaintTarget.add_effect(this._redBorderEffect);
|
||||||
},
|
},
|
||||||
|
|
||||||
_pushResult: function(command, obj) {
|
_pushResult(command, obj) {
|
||||||
let index = this._results.length + this._offset;
|
let index = this._results.length + this._offset;
|
||||||
let result = new Result(this, CHEVRON + command, obj, index);
|
let result = new Result(this, CHEVRON + command, obj, index);
|
||||||
this._results.push(result);
|
this._results.push(result);
|
||||||
@ -951,7 +951,7 @@ var LookingGlass = new Lang.Class({
|
|||||||
this._notebook.scrollToBottom(0);
|
this._notebook.scrollToBottom(0);
|
||||||
},
|
},
|
||||||
|
|
||||||
_showCompletions: function(completions) {
|
_showCompletions(completions) {
|
||||||
if (!this._completionActor) {
|
if (!this._completionActor) {
|
||||||
this._completionActor = new St.Label({ name: 'LookingGlassAutoCompletionText', style_class: 'lg-completions-text' });
|
this._completionActor = new St.Label({ name: 'LookingGlassAutoCompletionText', style_class: 'lg-completions-text' });
|
||||||
this._completionActor.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
this._completionActor.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
||||||
@ -980,7 +980,7 @@ var LookingGlass = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideCompletions: function() {
|
_hideCompletions() {
|
||||||
if (this._completionActor) {
|
if (this._completionActor) {
|
||||||
Tweener.removeTweens(this._completionActor);
|
Tweener.removeTweens(this._completionActor);
|
||||||
Tweener.addTween(this._completionActor, { time: AUTO_COMPLETE_SHOW_COMPLETION_ANIMATION_DURATION / St.get_slow_down_factor(),
|
Tweener.addTween(this._completionActor, { time: AUTO_COMPLETE_SHOW_COMPLETION_ANIMATION_DURATION / St.get_slow_down_factor(),
|
||||||
@ -994,7 +994,7 @@ var LookingGlass = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_evaluate : function(command) {
|
_evaluate(command) {
|
||||||
this._history.addItem(command);
|
this._history.addItem(command);
|
||||||
|
|
||||||
let fullCmd = commandHeader + command;
|
let fullCmd = commandHeader + command;
|
||||||
@ -1010,31 +1010,31 @@ var LookingGlass = new Lang.Class({
|
|||||||
this._entry.text = '';
|
this._entry.text = '';
|
||||||
},
|
},
|
||||||
|
|
||||||
inspect: function(x, y) {
|
inspect(x, y) {
|
||||||
return global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
|
return global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
|
||||||
},
|
},
|
||||||
|
|
||||||
getIt: function () {
|
getIt() {
|
||||||
return this._it;
|
return this._it;
|
||||||
},
|
},
|
||||||
|
|
||||||
getResult: function(idx) {
|
getResult(idx) {
|
||||||
return this._results[idx - this._offset].o;
|
return this._results[idx - this._offset].o;
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle: function() {
|
toggle() {
|
||||||
if (this._open)
|
if (this._open)
|
||||||
this.close();
|
this.close();
|
||||||
else
|
else
|
||||||
this.open();
|
this.open();
|
||||||
},
|
},
|
||||||
|
|
||||||
_queueResize: function() {
|
_queueResize() {
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
||||||
Lang.bind(this, function () { this._resize(); }));
|
Lang.bind(this, function () { this._resize(); }));
|
||||||
},
|
},
|
||||||
|
|
||||||
_resize: function() {
|
_resize() {
|
||||||
let primary = Main.layoutManager.primaryMonitor;
|
let primary = Main.layoutManager.primaryMonitor;
|
||||||
let myWidth = primary.width * 0.7;
|
let myWidth = primary.width * 0.7;
|
||||||
let availableHeight = primary.height - Main.layoutManager.keyboardBox.height;
|
let availableHeight = primary.height - Main.layoutManager.keyboardBox.height;
|
||||||
@ -1050,17 +1050,17 @@ var LookingGlass = new Lang.Class({
|
|||||||
this._targetY + Math.floor(myHeight * 0.1));
|
this._targetY + Math.floor(myHeight * 0.1));
|
||||||
},
|
},
|
||||||
|
|
||||||
insertObject: function(obj) {
|
insertObject(obj) {
|
||||||
this._pushResult('<insert>', obj);
|
this._pushResult('<insert>', obj);
|
||||||
},
|
},
|
||||||
|
|
||||||
inspectObject: function(obj, sourceActor) {
|
inspectObject(obj, sourceActor) {
|
||||||
this._objInspector.open(sourceActor);
|
this._objInspector.open(sourceActor);
|
||||||
this._objInspector.selectObject(obj);
|
this._objInspector.selectObject(obj);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Handle key events which are relevant for all tabs of the LookingGlass
|
// Handle key events which are relevant for all tabs of the LookingGlass
|
||||||
_globalKeyPressEvent : function(actor, event) {
|
_globalKeyPressEvent(actor, event) {
|
||||||
let symbol = event.get_key_symbol();
|
let symbol = event.get_key_symbol();
|
||||||
let modifierState = event.get_state();
|
let modifierState = event.get_state();
|
||||||
if (symbol == Clutter.Escape) {
|
if (symbol == Clutter.Escape) {
|
||||||
@ -1082,7 +1082,7 @@ var LookingGlass = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
open : function() {
|
open() {
|
||||||
if (this._open)
|
if (this._open)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1104,7 +1104,7 @@ var LookingGlass = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
close : function() {
|
close() {
|
||||||
if (!this._open)
|
if (!this._open)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ let magDBusService = null;
|
|||||||
var Magnifier = new Lang.Class({
|
var Magnifier = new Lang.Class({
|
||||||
Name: 'Magnifier',
|
Name: 'Magnifier',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
// Magnifier is a manager of ZoomRegions.
|
// Magnifier is a manager of ZoomRegions.
|
||||||
this._zoomRegions = [];
|
this._zoomRegions = [];
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* showSystemCursor:
|
* showSystemCursor:
|
||||||
* Show the system mouse pointer.
|
* Show the system mouse pointer.
|
||||||
*/
|
*/
|
||||||
showSystemCursor: function() {
|
showSystemCursor() {
|
||||||
this._cursorTracker.set_pointer_visible(true);
|
this._cursorTracker.set_pointer_visible(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* hideSystemCursor:
|
* hideSystemCursor:
|
||||||
* Hide the system mouse pointer.
|
* Hide the system mouse pointer.
|
||||||
*/
|
*/
|
||||||
hideSystemCursor: function() {
|
hideSystemCursor() {
|
||||||
this._cursorTracker.set_pointer_visible(false);
|
this._cursorTracker.set_pointer_visible(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* Show/hide all the zoom regions.
|
* Show/hide all the zoom regions.
|
||||||
* @activate: Boolean to activate or de-activate the magnifier.
|
* @activate: Boolean to activate or de-activate the magnifier.
|
||||||
*/
|
*/
|
||||||
setActive: function(activate) {
|
setActive(activate) {
|
||||||
let isActive = this.isActive();
|
let isActive = this.isActive();
|
||||||
|
|
||||||
this._zoomRegions.forEach (function(zoomRegion, index, array) {
|
this._zoomRegions.forEach (function(zoomRegion, index, array) {
|
||||||
@ -138,7 +138,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* isActive:
|
* isActive:
|
||||||
* @return Whether the magnifier is active (boolean).
|
* @return Whether the magnifier is active (boolean).
|
||||||
*/
|
*/
|
||||||
isActive: function() {
|
isActive() {
|
||||||
// Sufficient to check one ZoomRegion since Magnifier's active
|
// Sufficient to check one ZoomRegion since Magnifier's active
|
||||||
// state applies to all of them.
|
// state applies to all of them.
|
||||||
if (this._zoomRegions.length == 0)
|
if (this._zoomRegions.length == 0)
|
||||||
@ -151,7 +151,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* startTrackingMouse:
|
* startTrackingMouse:
|
||||||
* Turn on mouse tracking, if not already doing so.
|
* Turn on mouse tracking, if not already doing so.
|
||||||
*/
|
*/
|
||||||
startTrackingMouse: function() {
|
startTrackingMouse() {
|
||||||
if (!this._pointerWatch)
|
if (!this._pointerWatch)
|
||||||
this._pointerWatch = PointerWatcher.getPointerWatcher().addWatch(MOUSE_POLL_FREQUENCY, Lang.bind(this, this.scrollToMousePos));
|
this._pointerWatch = PointerWatcher.getPointerWatcher().addWatch(MOUSE_POLL_FREQUENCY, Lang.bind(this, this.scrollToMousePos));
|
||||||
},
|
},
|
||||||
@ -160,7 +160,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* stopTrackingMouse:
|
* stopTrackingMouse:
|
||||||
* Turn off mouse tracking, if not already doing so.
|
* Turn off mouse tracking, if not already doing so.
|
||||||
*/
|
*/
|
||||||
stopTrackingMouse: function() {
|
stopTrackingMouse() {
|
||||||
if (this._pointerWatch)
|
if (this._pointerWatch)
|
||||||
this._pointerWatch.remove();
|
this._pointerWatch.remove();
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* isTrackingMouse:
|
* isTrackingMouse:
|
||||||
* Is the magnifier tracking the mouse currently?
|
* Is the magnifier tracking the mouse currently?
|
||||||
*/
|
*/
|
||||||
isTrackingMouse: function() {
|
isTrackingMouse() {
|
||||||
return !!this._mouseTrackingId;
|
return !!this._mouseTrackingId;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* system pointer.
|
* system pointer.
|
||||||
* @return true.
|
* @return true.
|
||||||
*/
|
*/
|
||||||
scrollToMousePos: function() {
|
scrollToMousePos() {
|
||||||
let [xMouse, yMouse, mask] = global.get_pointer();
|
let [xMouse, yMouse, mask] = global.get_pointer();
|
||||||
|
|
||||||
if (xMouse != this.xMouse || yMouse != this.yMouse) {
|
if (xMouse != this.xMouse || yMouse != this.yMouse) {
|
||||||
@ -216,7 +216,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* the position of the ZoomRegion on screen.
|
* the position of the ZoomRegion on screen.
|
||||||
* @return The newly created ZoomRegion.
|
* @return The newly created ZoomRegion.
|
||||||
*/
|
*/
|
||||||
createZoomRegion: function(xMagFactor, yMagFactor, roi, viewPort) {
|
createZoomRegion(xMagFactor, yMagFactor, roi, viewPort) {
|
||||||
let zoomRegion = new ZoomRegion(this, this._cursorRoot);
|
let zoomRegion = new ZoomRegion(this, this._cursorRoot);
|
||||||
zoomRegion.setViewPort(viewPort);
|
zoomRegion.setViewPort(viewPort);
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* for this Magnifier instance.
|
* for this Magnifier instance.
|
||||||
* @zoomRegion: The zoomRegion to add.
|
* @zoomRegion: The zoomRegion to add.
|
||||||
*/
|
*/
|
||||||
addZoomRegion: function(zoomRegion) {
|
addZoomRegion(zoomRegion) {
|
||||||
if(zoomRegion) {
|
if(zoomRegion) {
|
||||||
this._zoomRegions.push(zoomRegion);
|
this._zoomRegions.push(zoomRegion);
|
||||||
if (!this.isTrackingMouse())
|
if (!this.isTrackingMouse())
|
||||||
@ -249,7 +249,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* Return a list of ZoomRegion's for this Magnifier.
|
* Return a list of ZoomRegion's for this Magnifier.
|
||||||
* @return: The Magnifier's zoom region list (array).
|
* @return: The Magnifier's zoom region list (array).
|
||||||
*/
|
*/
|
||||||
getZoomRegions: function() {
|
getZoomRegions() {
|
||||||
return this._zoomRegions;
|
return this._zoomRegions;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* clearAllZoomRegions:
|
* clearAllZoomRegions:
|
||||||
* Remove all the zoom regions from this Magnfier's ZoomRegion list.
|
* Remove all the zoom regions from this Magnfier's ZoomRegion list.
|
||||||
*/
|
*/
|
||||||
clearAllZoomRegions: function() {
|
clearAllZoomRegions() {
|
||||||
for (let i = 0; i < this._zoomRegions.length; i++)
|
for (let i = 0; i < this._zoomRegions.length; i++)
|
||||||
this._zoomRegions[i].setActive(false);
|
this._zoomRegions[i].setActive(false);
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* addCrosshairs:
|
* addCrosshairs:
|
||||||
* Add and show a cross hair centered on the magnified mouse.
|
* Add and show a cross hair centered on the magnified mouse.
|
||||||
*/
|
*/
|
||||||
addCrosshairs: function() {
|
addCrosshairs() {
|
||||||
if (!this._crossHairs)
|
if (!this._crossHairs)
|
||||||
this._crossHairs = new Crosshairs();
|
this._crossHairs = new Crosshairs();
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* Show or hide the cross hair.
|
* Show or hide the cross hair.
|
||||||
* @visible Flag that indicates show (true) or hide (false).
|
* @visible Flag that indicates show (true) or hide (false).
|
||||||
*/
|
*/
|
||||||
setCrosshairsVisible: function(visible) {
|
setCrosshairsVisible(visible) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
if (!this._crossHairs)
|
if (!this._crossHairs)
|
||||||
this.addCrosshairs();
|
this.addCrosshairs();
|
||||||
@ -314,7 +314,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* Set the color of the crosshairs for all ZoomRegions.
|
* Set the color of the crosshairs for all ZoomRegions.
|
||||||
* @color: The color as a string, e.g. '#ff0000ff' or 'red'.
|
* @color: The color as a string, e.g. '#ff0000ff' or 'red'.
|
||||||
*/
|
*/
|
||||||
setCrosshairsColor: function(color) {
|
setCrosshairsColor(color) {
|
||||||
if (this._crossHairs) {
|
if (this._crossHairs) {
|
||||||
let [res, clutterColor] = Clutter.Color.from_string(color);
|
let [res, clutterColor] = Clutter.Color.from_string(color);
|
||||||
this._crossHairs.setColor(clutterColor);
|
this._crossHairs.setColor(clutterColor);
|
||||||
@ -326,7 +326,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* Get the color of the crosshairs.
|
* Get the color of the crosshairs.
|
||||||
* @return: The color as a string, e.g. '#0000ffff' or 'blue'.
|
* @return: The color as a string, e.g. '#0000ffff' or 'blue'.
|
||||||
*/
|
*/
|
||||||
getCrosshairsColor: function() {
|
getCrosshairsColor() {
|
||||||
if (this._crossHairs) {
|
if (this._crossHairs) {
|
||||||
let clutterColor = this._crossHairs.getColor();
|
let clutterColor = this._crossHairs.getColor();
|
||||||
return clutterColor.to_string();
|
return clutterColor.to_string();
|
||||||
@ -341,7 +341,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* @thickness: The width of the vertical and horizontal lines of the
|
* @thickness: The width of the vertical and horizontal lines of the
|
||||||
* crosshairs.
|
* crosshairs.
|
||||||
*/
|
*/
|
||||||
setCrosshairsThickness: function(thickness) {
|
setCrosshairsThickness(thickness) {
|
||||||
if (this._crossHairs)
|
if (this._crossHairs)
|
||||||
this._crossHairs.setThickness(thickness);
|
this._crossHairs.setThickness(thickness);
|
||||||
},
|
},
|
||||||
@ -352,7 +352,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* @return: The width of the vertical and horizontal lines of the
|
* @return: The width of the vertical and horizontal lines of the
|
||||||
* crosshairs.
|
* crosshairs.
|
||||||
*/
|
*/
|
||||||
getCrosshairsThickness: function() {
|
getCrosshairsThickness() {
|
||||||
if (this._crossHairs)
|
if (this._crossHairs)
|
||||||
return this._crossHairs.getThickness();
|
return this._crossHairs.getThickness();
|
||||||
else
|
else
|
||||||
@ -363,7 +363,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* setCrosshairsOpacity:
|
* setCrosshairsOpacity:
|
||||||
* @opacity: Value between 0.0 (transparent) and 1.0 (fully opaque).
|
* @opacity: Value between 0.0 (transparent) and 1.0 (fully opaque).
|
||||||
*/
|
*/
|
||||||
setCrosshairsOpacity: function(opacity) {
|
setCrosshairsOpacity(opacity) {
|
||||||
if (this._crossHairs)
|
if (this._crossHairs)
|
||||||
this._crossHairs.setOpacity(opacity * 255);
|
this._crossHairs.setOpacity(opacity * 255);
|
||||||
},
|
},
|
||||||
@ -372,7 +372,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* getCrosshairsOpacity:
|
* getCrosshairsOpacity:
|
||||||
* @return: Value between 0.0 (transparent) and 1.0 (fully opaque).
|
* @return: Value between 0.0 (transparent) and 1.0 (fully opaque).
|
||||||
*/
|
*/
|
||||||
getCrosshairsOpacity: function() {
|
getCrosshairsOpacity() {
|
||||||
if (this._crossHairs)
|
if (this._crossHairs)
|
||||||
return this._crossHairs.getOpacity() / 255.0;
|
return this._crossHairs.getOpacity() / 255.0;
|
||||||
else
|
else
|
||||||
@ -385,7 +385,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* @length: The length of the vertical and horizontal lines making up the
|
* @length: The length of the vertical and horizontal lines making up the
|
||||||
* crosshairs.
|
* crosshairs.
|
||||||
*/
|
*/
|
||||||
setCrosshairsLength: function(length) {
|
setCrosshairsLength(length) {
|
||||||
if (this._crossHairs)
|
if (this._crossHairs)
|
||||||
this._crossHairs.setLength(length);
|
this._crossHairs.setLength(length);
|
||||||
},
|
},
|
||||||
@ -396,7 +396,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* @return: The length of the vertical and horizontal lines making up the
|
* @return: The length of the vertical and horizontal lines making up the
|
||||||
* crosshairs.
|
* crosshairs.
|
||||||
*/
|
*/
|
||||||
getCrosshairsLength: function() {
|
getCrosshairsLength() {
|
||||||
if (this._crossHairs)
|
if (this._crossHairs)
|
||||||
return this._crossHairs.getLength();
|
return this._crossHairs.getLength();
|
||||||
else
|
else
|
||||||
@ -408,7 +408,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* Set whether the crosshairs are clipped at their intersection.
|
* Set whether the crosshairs are clipped at their intersection.
|
||||||
* @clip: Flag to indicate whether to clip the crosshairs.
|
* @clip: Flag to indicate whether to clip the crosshairs.
|
||||||
*/
|
*/
|
||||||
setCrosshairsClip: function(clip) {
|
setCrosshairsClip(clip) {
|
||||||
if (clip) {
|
if (clip) {
|
||||||
if (this._crossHairs)
|
if (this._crossHairs)
|
||||||
this._crossHairs.setClip(CROSSHAIRS_CLIP_SIZE);
|
this._crossHairs.setClip(CROSSHAIRS_CLIP_SIZE);
|
||||||
@ -426,7 +426,7 @@ var Magnifier = new Lang.Class({
|
|||||||
* Get whether the crosshairs are clipped by the mouse image.
|
* Get whether the crosshairs are clipped by the mouse image.
|
||||||
* @return: Whether the crosshairs are clipped.
|
* @return: Whether the crosshairs are clipped.
|
||||||
*/
|
*/
|
||||||
getCrosshairsClip: function() {
|
getCrosshairsClip() {
|
||||||
if (this._crossHairs) {
|
if (this._crossHairs) {
|
||||||
let [clipWidth, clipHeight] = this._crossHairs.getClip();
|
let [clipWidth, clipHeight] = this._crossHairs.getClip();
|
||||||
return (clipWidth > 0 && clipHeight > 0);
|
return (clipWidth > 0 && clipHeight > 0);
|
||||||
@ -437,13 +437,13 @@ var Magnifier = new Lang.Class({
|
|||||||
|
|
||||||
//// Private methods ////
|
//// Private methods ////
|
||||||
|
|
||||||
_updateMouseSprite: function() {
|
_updateMouseSprite() {
|
||||||
Shell.util_cursor_tracker_to_clutter(this._cursorTracker, this._mouseSprite);
|
Shell.util_cursor_tracker_to_clutter(this._cursorTracker, this._mouseSprite);
|
||||||
let [xHot, yHot] = this._cursorTracker.get_hot();
|
let [xHot, yHot] = this._cursorTracker.get_hot();
|
||||||
this._mouseSprite.set_anchor_point(xHot, yHot);
|
this._mouseSprite.set_anchor_point(xHot, yHot);
|
||||||
},
|
},
|
||||||
|
|
||||||
_settingsInit: function(zoomRegion) {
|
_settingsInit(zoomRegion) {
|
||||||
this._appSettings = new Gio.Settings({ schema_id: APPLICATIONS_SCHEMA });
|
this._appSettings = new Gio.Settings({ schema_id: APPLICATIONS_SCHEMA });
|
||||||
this._settings = new Gio.Settings({ schema_id: MAGNIFIER_SCHEMA });
|
this._settings = new Gio.Settings({ schema_id: MAGNIFIER_SCHEMA });
|
||||||
|
|
||||||
@ -568,7 +568,7 @@ var Magnifier = new Lang.Class({
|
|||||||
return this._appSettings.get_boolean(SHOW_KEY);
|
return this._appSettings.get_boolean(SHOW_KEY);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateScreenPosition: function() {
|
_updateScreenPosition() {
|
||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
let position = this._settings.get_enum(SCREEN_POSITION_KEY);
|
let position = this._settings.get_enum(SCREEN_POSITION_KEY);
|
||||||
@ -578,7 +578,7 @@ var Magnifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateMagFactor: function() {
|
_updateMagFactor() {
|
||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
// Mag factor is accurate to two decimal places.
|
// Mag factor is accurate to two decimal places.
|
||||||
@ -587,14 +587,14 @@ var Magnifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLensMode: function() {
|
_updateLensMode() {
|
||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setLensMode(this._settings.get_boolean(LENS_MODE_KEY));
|
this._zoomRegions[0].setLensMode(this._settings.get_boolean(LENS_MODE_KEY));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateClampMode: function() {
|
_updateClampMode() {
|
||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setClampScrollingAtEdges(
|
this._zoomRegions[0].setClampScrollingAtEdges(
|
||||||
@ -603,7 +603,7 @@ var Magnifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateMouseTrackingMode: function() {
|
_updateMouseTrackingMode() {
|
||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setMouseTrackingMode(
|
this._zoomRegions[0].setMouseTrackingMode(
|
||||||
@ -612,7 +612,7 @@ var Magnifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateFocusTrackingMode: function() {
|
_updateFocusTrackingMode() {
|
||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setFocusTrackingMode(
|
this._zoomRegions[0].setFocusTrackingMode(
|
||||||
@ -621,7 +621,7 @@ var Magnifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCaretTrackingMode: function() {
|
_updateCaretTrackingMode() {
|
||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setCaretTrackingMode(
|
this._zoomRegions[0].setCaretTrackingMode(
|
||||||
@ -630,7 +630,7 @@ var Magnifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateInvertLightness: function() {
|
_updateInvertLightness() {
|
||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setInvertLightness(
|
this._zoomRegions[0].setInvertLightness(
|
||||||
@ -639,7 +639,7 @@ var Magnifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateColorSaturation: function() {
|
_updateColorSaturation() {
|
||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
this._zoomRegions[0].setColorSaturation(
|
this._zoomRegions[0].setColorSaturation(
|
||||||
@ -648,7 +648,7 @@ var Magnifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateBrightness: function() {
|
_updateBrightness() {
|
||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
let brightness = {};
|
let brightness = {};
|
||||||
@ -659,7 +659,7 @@ var Magnifier = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateContrast: function() {
|
_updateContrast() {
|
||||||
// Applies only to the first zoom region.
|
// Applies only to the first zoom region.
|
||||||
if (this._zoomRegions.length) {
|
if (this._zoomRegions.length) {
|
||||||
let contrast = {};
|
let contrast = {};
|
||||||
@ -675,7 +675,7 @@ Signals.addSignalMethods(Magnifier.prototype);
|
|||||||
var ZoomRegion = new Lang.Class({
|
var ZoomRegion = new Lang.Class({
|
||||||
Name: 'ZoomRegion',
|
Name: 'ZoomRegion',
|
||||||
|
|
||||||
_init: function(magnifier, mouseSourceActor) {
|
_init(magnifier, mouseSourceActor) {
|
||||||
this._magnifier = magnifier;
|
this._magnifier = magnifier;
|
||||||
this._focusCaretTracker = new FocusCaretTracker.FocusCaretTracker();
|
this._focusCaretTracker = new FocusCaretTracker.FocusCaretTracker();
|
||||||
|
|
||||||
@ -723,7 +723,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
Lang.bind(this, this._updateFocus));
|
Lang.bind(this, this._updateFocus));
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateFocus: function(caller, event) {
|
_updateFocus(caller, event) {
|
||||||
let component = event.source.get_component_iface();
|
let component = event.source.get_component_iface();
|
||||||
if (!component || event.detail1 != 1)
|
if (!component || event.detail1 != 1)
|
||||||
return;
|
return;
|
||||||
@ -740,7 +740,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
this._centerFromFocusPosition();
|
this._centerFromFocusPosition();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCaret: function(caller, event) {
|
_updateCaret(caller, event) {
|
||||||
let text = event.source.get_text_iface();
|
let text = event.source.get_text_iface();
|
||||||
if (!text)
|
if (!text)
|
||||||
return;
|
return;
|
||||||
@ -760,7 +760,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* setActive:
|
* setActive:
|
||||||
* @activate: Boolean to show/hide the ZoomRegion.
|
* @activate: Boolean to show/hide the ZoomRegion.
|
||||||
*/
|
*/
|
||||||
setActive: function(activate) {
|
setActive(activate) {
|
||||||
if (activate == this.isActive())
|
if (activate == this.isActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -783,7 +783,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* isActive:
|
* isActive:
|
||||||
* @return Whether this ZoomRegion is active (boolean).
|
* @return Whether this ZoomRegion is active (boolean).
|
||||||
*/
|
*/
|
||||||
isActive: function() {
|
isActive() {
|
||||||
return this._magView != null;
|
return this._magView != null;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -795,7 +795,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* @yMagFactor: The power to set the vertical magnification factor to
|
* @yMagFactor: The power to set the vertical magnification factor to
|
||||||
* of the magnified view.
|
* of the magnified view.
|
||||||
*/
|
*/
|
||||||
setMagFactor: function(xMagFactor, yMagFactor) {
|
setMagFactor(xMagFactor, yMagFactor) {
|
||||||
this._changeROI({ xMagFactor: xMagFactor,
|
this._changeROI({ xMagFactor: xMagFactor,
|
||||||
yMagFactor: yMagFactor,
|
yMagFactor: yMagFactor,
|
||||||
redoCursorTracking: this._followingCursor });
|
redoCursorTracking: this._followingCursor });
|
||||||
@ -808,7 +808,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* magnification. A value of 2.0 means the contents are doubled
|
* magnification. A value of 2.0 means the contents are doubled
|
||||||
* in size, and so on.
|
* in size, and so on.
|
||||||
*/
|
*/
|
||||||
getMagFactor: function() {
|
getMagFactor() {
|
||||||
return [this._xMagFactor, this._yMagFactor];
|
return [this._xMagFactor, this._yMagFactor];
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -816,7 +816,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* setMouseTrackingMode
|
* setMouseTrackingMode
|
||||||
* @mode: One of the enum MouseTrackingMode values.
|
* @mode: One of the enum MouseTrackingMode values.
|
||||||
*/
|
*/
|
||||||
setMouseTrackingMode: function(mode) {
|
setMouseTrackingMode(mode) {
|
||||||
if (mode >= GDesktopEnums.MagnifierMouseTrackingMode.NONE &&
|
if (mode >= GDesktopEnums.MagnifierMouseTrackingMode.NONE &&
|
||||||
mode <= GDesktopEnums.MagnifierMouseTrackingMode.PUSH)
|
mode <= GDesktopEnums.MagnifierMouseTrackingMode.PUSH)
|
||||||
this._mouseTrackingMode = mode;
|
this._mouseTrackingMode = mode;
|
||||||
@ -826,7 +826,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* getMouseTrackingMode
|
* getMouseTrackingMode
|
||||||
* @return: One of the enum MouseTrackingMode values.
|
* @return: One of the enum MouseTrackingMode values.
|
||||||
*/
|
*/
|
||||||
getMouseTrackingMode: function() {
|
getMouseTrackingMode() {
|
||||||
return this._mouseTrackingMode;
|
return this._mouseTrackingMode;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -834,7 +834,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* setFocusTrackingMode
|
* setFocusTrackingMode
|
||||||
* @mode: One of the enum FocusTrackingMode values.
|
* @mode: One of the enum FocusTrackingMode values.
|
||||||
*/
|
*/
|
||||||
setFocusTrackingMode: function(mode) {
|
setFocusTrackingMode(mode) {
|
||||||
this._focusTrackingMode = mode;
|
this._focusTrackingMode = mode;
|
||||||
this._syncFocusTracking();
|
this._syncFocusTracking();
|
||||||
},
|
},
|
||||||
@ -843,12 +843,12 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* setCaretTrackingMode
|
* setCaretTrackingMode
|
||||||
* @mode: One of the enum CaretTrackingMode values.
|
* @mode: One of the enum CaretTrackingMode values.
|
||||||
*/
|
*/
|
||||||
setCaretTrackingMode: function(mode) {
|
setCaretTrackingMode(mode) {
|
||||||
this._caretTrackingMode = mode;
|
this._caretTrackingMode = mode;
|
||||||
this._syncCaretTracking();
|
this._syncCaretTracking();
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncFocusTracking: function() {
|
_syncFocusTracking() {
|
||||||
let enabled = this._focusTrackingMode != GDesktopEnums.MagnifierFocusTrackingMode.NONE &&
|
let enabled = this._focusTrackingMode != GDesktopEnums.MagnifierFocusTrackingMode.NONE &&
|
||||||
this.isActive();
|
this.isActive();
|
||||||
|
|
||||||
@ -858,7 +858,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
this._focusCaretTracker.deregisterFocusListener();
|
this._focusCaretTracker.deregisterFocusListener();
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncCaretTracking: function() {
|
_syncCaretTracking() {
|
||||||
let enabled = this._caretTrackingMode != GDesktopEnums.MagnifierCaretTrackingMode.NONE &&
|
let enabled = this._caretTrackingMode != GDesktopEnums.MagnifierCaretTrackingMode.NONE &&
|
||||||
this.isActive();
|
this.isActive();
|
||||||
|
|
||||||
@ -875,7 +875,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* It has members x, y, width, height. The values are in
|
* It has members x, y, width, height. The values are in
|
||||||
* stage coordinate space.
|
* stage coordinate space.
|
||||||
*/
|
*/
|
||||||
setViewPort: function(viewPort) {
|
setViewPort(viewPort) {
|
||||||
this._setViewPort(viewPort);
|
this._setViewPort(viewPort);
|
||||||
this._screenPosition = GDesktopEnums.MagnifierScreenPosition.NONE;
|
this._screenPosition = GDesktopEnums.MagnifierScreenPosition.NONE;
|
||||||
},
|
},
|
||||||
@ -887,7 +887,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* has members x, y, width, height. The values are in
|
* has members x, y, width, height. The values are in
|
||||||
* screen (unmagnified) coordinate space.
|
* screen (unmagnified) coordinate space.
|
||||||
*/
|
*/
|
||||||
setROI: function(roi) {
|
setROI(roi) {
|
||||||
if (roi.width <= 0 || roi.height <= 0)
|
if (roi.width <= 0 || roi.height <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -906,7 +906,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* @return an array, [x, y, width, height], representing the bounding
|
* @return an array, [x, y, width, height], representing the bounding
|
||||||
* rectangle of what is shown in the magnified view.
|
* rectangle of what is shown in the magnified view.
|
||||||
*/
|
*/
|
||||||
getROI: function() {
|
getROI() {
|
||||||
let roiWidth = this._viewPortWidth / this._xMagFactor;
|
let roiWidth = this._viewPortWidth / this._xMagFactor;
|
||||||
let roiHeight = this._viewPortHeight / this._yMagFactor;
|
let roiHeight = this._viewPortHeight / this._yMagFactor;
|
||||||
|
|
||||||
@ -921,7 +921,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* a lens the size of the screen is pointless.
|
* a lens the size of the screen is pointless.
|
||||||
* @lensMode: A boolean to set the sense of lens mode.
|
* @lensMode: A boolean to set the sense of lens mode.
|
||||||
*/
|
*/
|
||||||
setLensMode: function(lensMode) {
|
setLensMode(lensMode) {
|
||||||
this._lensMode = lensMode;
|
this._lensMode = lensMode;
|
||||||
if (!this._lensMode)
|
if (!this._lensMode)
|
||||||
this.setScreenPosition (this._screenPosition);
|
this.setScreenPosition (this._screenPosition);
|
||||||
@ -932,7 +932,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* Is lens mode on or off?
|
* Is lens mode on or off?
|
||||||
* @return The lens mode state as a boolean.
|
* @return The lens mode state as a boolean.
|
||||||
*/
|
*/
|
||||||
isLensMode: function() {
|
isLensMode() {
|
||||||
return this._lensMode;
|
return this._lensMode;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -942,7 +942,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* the edges of the screen.
|
* the edges of the screen.
|
||||||
* @clamp: Boolean to turn on/off clamping.
|
* @clamp: Boolean to turn on/off clamping.
|
||||||
*/
|
*/
|
||||||
setClampScrollingAtEdges: function(clamp) {
|
setClampScrollingAtEdges(clamp) {
|
||||||
this._clampScrollingAtEdges = clamp;
|
this._clampScrollingAtEdges = clamp;
|
||||||
if (clamp)
|
if (clamp)
|
||||||
this._changeROI();
|
this._changeROI();
|
||||||
@ -952,7 +952,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* setTopHalf:
|
* setTopHalf:
|
||||||
* Magnifier view occupies the top half of the screen.
|
* Magnifier view occupies the top half of the screen.
|
||||||
*/
|
*/
|
||||||
setTopHalf: function() {
|
setTopHalf() {
|
||||||
let viewPort = {};
|
let viewPort = {};
|
||||||
viewPort.x = 0;
|
viewPort.x = 0;
|
||||||
viewPort.y = 0;
|
viewPort.y = 0;
|
||||||
@ -966,7 +966,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* setBottomHalf:
|
* setBottomHalf:
|
||||||
* Magnifier view occupies the bottom half of the screen.
|
* Magnifier view occupies the bottom half of the screen.
|
||||||
*/
|
*/
|
||||||
setBottomHalf: function() {
|
setBottomHalf() {
|
||||||
let viewPort = {};
|
let viewPort = {};
|
||||||
viewPort.x = 0;
|
viewPort.x = 0;
|
||||||
viewPort.y = global.screen_height/2;
|
viewPort.y = global.screen_height/2;
|
||||||
@ -980,7 +980,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* setLeftHalf:
|
* setLeftHalf:
|
||||||
* Magnifier view occupies the left half of the screen.
|
* Magnifier view occupies the left half of the screen.
|
||||||
*/
|
*/
|
||||||
setLeftHalf: function() {
|
setLeftHalf() {
|
||||||
let viewPort = {};
|
let viewPort = {};
|
||||||
viewPort.x = 0;
|
viewPort.x = 0;
|
||||||
viewPort.y = 0;
|
viewPort.y = 0;
|
||||||
@ -994,7 +994,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* setRightHalf:
|
* setRightHalf:
|
||||||
* Magnifier view occupies the right half of the screen.
|
* Magnifier view occupies the right half of the screen.
|
||||||
*/
|
*/
|
||||||
setRightHalf: function() {
|
setRightHalf() {
|
||||||
let viewPort = {};
|
let viewPort = {};
|
||||||
viewPort.x = global.screen_width/2;
|
viewPort.x = global.screen_width/2;
|
||||||
viewPort.y = 0;
|
viewPort.y = 0;
|
||||||
@ -1009,7 +1009,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* Set the ZoomRegion to full-screen mode.
|
* Set the ZoomRegion to full-screen mode.
|
||||||
* Note: disallows lens mode.
|
* Note: disallows lens mode.
|
||||||
*/
|
*/
|
||||||
setFullScreenMode: function() {
|
setFullScreenMode() {
|
||||||
let viewPort = {};
|
let viewPort = {};
|
||||||
viewPort.x = 0;
|
viewPort.x = 0;
|
||||||
viewPort.y = 0;
|
viewPort.y = 0;
|
||||||
@ -1028,7 +1028,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* Magnifier.BOTTOM_HALF,Magnifier.LEFT_HALF, or
|
* Magnifier.BOTTOM_HALF,Magnifier.LEFT_HALF, or
|
||||||
* Magnifier.RIGHT_HALF.
|
* Magnifier.RIGHT_HALF.
|
||||||
*/
|
*/
|
||||||
setScreenPosition: function(inPosition) {
|
setScreenPosition(inPosition) {
|
||||||
switch (inPosition) {
|
switch (inPosition) {
|
||||||
case GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN:
|
case GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN:
|
||||||
this.setFullScreenMode();
|
this.setFullScreenMode();
|
||||||
@ -1054,7 +1054,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* top half, bottom half, etc.
|
* top half, bottom half, etc.
|
||||||
* @return: the current mode.
|
* @return: the current mode.
|
||||||
*/
|
*/
|
||||||
getScreenPosition: function() {
|
getScreenPosition() {
|
||||||
return this._screenPosition;
|
return this._screenPosition;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1063,7 +1063,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* Set the region of interest based on the position of the system pointer.
|
* Set the region of interest based on the position of the system pointer.
|
||||||
* @return: Whether the system mouse pointer is over the magnified view.
|
* @return: Whether the system mouse pointer is over the magnified view.
|
||||||
*/
|
*/
|
||||||
scrollToMousePos: function() {
|
scrollToMousePos() {
|
||||||
this._followingCursor = true;
|
this._followingCursor = true;
|
||||||
if (this._mouseTrackingMode != GDesktopEnums.MagnifierMouseTrackingMode.NONE)
|
if (this._mouseTrackingMode != GDesktopEnums.MagnifierMouseTrackingMode.NONE)
|
||||||
this._changeROI({ redoCursorTracking: true });
|
this._changeROI({ redoCursorTracking: true });
|
||||||
@ -1074,14 +1074,14 @@ var ZoomRegion = new Lang.Class({
|
|||||||
return this._isMouseOverRegion();
|
return this._isMouseOverRegion();
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearScrollContentsTimer: function() {
|
_clearScrollContentsTimer() {
|
||||||
if (this._scrollContentsTimerId != 0) {
|
if (this._scrollContentsTimerId != 0) {
|
||||||
Mainloop.source_remove(this._scrollContentsTimerId);
|
Mainloop.source_remove(this._scrollContentsTimerId);
|
||||||
this._scrollContentsTimerId = 0;
|
this._scrollContentsTimerId = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_scrollContentsToDelayed: function(x, y) {
|
_scrollContentsToDelayed(x, y) {
|
||||||
if (this._pointerIdleMonitor.get_idletime() >= POINTER_REST_TIME) {
|
if (this._pointerIdleMonitor.get_idletime() >= POINTER_REST_TIME) {
|
||||||
this.scrollContentsTo(x, y);
|
this.scrollContentsTo(x, y);
|
||||||
return;
|
return;
|
||||||
@ -1101,7 +1101,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* @x: The x-coord of the point to center on.
|
* @x: The x-coord of the point to center on.
|
||||||
* @y: The y-coord of the point to center on.
|
* @y: The y-coord of the point to center on.
|
||||||
*/
|
*/
|
||||||
scrollContentsTo: function(x, y) {
|
scrollContentsTo(x, y) {
|
||||||
this._clearScrollContentsTimer();
|
this._clearScrollContentsTimer();
|
||||||
|
|
||||||
this._followingCursor = false;
|
this._followingCursor = false;
|
||||||
@ -1114,7 +1114,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* Add crosshairs centered on the magnified mouse.
|
* Add crosshairs centered on the magnified mouse.
|
||||||
* @crossHairs: Crosshairs instance
|
* @crossHairs: Crosshairs instance
|
||||||
*/
|
*/
|
||||||
addCrosshairs: function(crossHairs) {
|
addCrosshairs(crossHairs) {
|
||||||
this._crossHairs = crossHairs;
|
this._crossHairs = crossHairs;
|
||||||
|
|
||||||
// If the crossHairs is not already within a larger container, add it
|
// If the crossHairs is not already within a larger container, add it
|
||||||
@ -1129,7 +1129,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* Set whether to invert the lightness of the magnified view.
|
* Set whether to invert the lightness of the magnified view.
|
||||||
* @flag Boolean to either invert brightness (true), or not (false).
|
* @flag Boolean to either invert brightness (true), or not (false).
|
||||||
*/
|
*/
|
||||||
setInvertLightness: function(flag) {
|
setInvertLightness(flag) {
|
||||||
this._invertLightness = flag;
|
this._invertLightness = flag;
|
||||||
if (this._magShaderEffects)
|
if (this._magShaderEffects)
|
||||||
this._magShaderEffects.setInvertLightness(this._invertLightness);
|
this._magShaderEffects.setInvertLightness(this._invertLightness);
|
||||||
@ -1140,7 +1140,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* Retrieve whether the lightness is inverted.
|
* Retrieve whether the lightness is inverted.
|
||||||
* @return Boolean indicating inversion (true), or not (false).
|
* @return Boolean indicating inversion (true), or not (false).
|
||||||
*/
|
*/
|
||||||
getInvertLightness: function() {
|
getInvertLightness() {
|
||||||
return this._invertLightness;
|
return this._invertLightness;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1151,7 +1151,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* saturation, with 0.0 defining no color (grayscale),
|
* saturation, with 0.0 defining no color (grayscale),
|
||||||
* and 1.0 defining full color.
|
* and 1.0 defining full color.
|
||||||
*/
|
*/
|
||||||
setColorSaturation: function(saturation) {
|
setColorSaturation(saturation) {
|
||||||
this._colorSaturation = saturation;
|
this._colorSaturation = saturation;
|
||||||
if (this._magShaderEffects)
|
if (this._magShaderEffects)
|
||||||
this._magShaderEffects.setColorSaturation(this._colorSaturation);
|
this._magShaderEffects.setColorSaturation(this._colorSaturation);
|
||||||
@ -1161,7 +1161,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* getColorSaturation:
|
* getColorSaturation:
|
||||||
* Retrieve the color saturation of the magnified view.
|
* Retrieve the color saturation of the magnified view.
|
||||||
*/
|
*/
|
||||||
getColorSaturation: function() {
|
getColorSaturation() {
|
||||||
return this._colorSaturation;
|
return this._colorSaturation;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1173,7 +1173,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* brightness (no change), whereas values less or greater than
|
* brightness (no change), whereas values less or greater than
|
||||||
* 0.0 indicate decreased or incresaed brightness, respectively.
|
* 0.0 indicate decreased or incresaed brightness, respectively.
|
||||||
*/
|
*/
|
||||||
setBrightness: function(brightness) {
|
setBrightness(brightness) {
|
||||||
this._brightness.r = brightness.r;
|
this._brightness.r = brightness.r;
|
||||||
this._brightness.g = brightness.g;
|
this._brightness.g = brightness.g;
|
||||||
this._brightness.b = brightness.b;
|
this._brightness.b = brightness.b;
|
||||||
@ -1189,7 +1189,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* contrast (no change), whereas values less or greater than
|
* contrast (no change), whereas values less or greater than
|
||||||
* 0.0 indicate decreased or incresaed contrast, respectively.
|
* 0.0 indicate decreased or incresaed contrast, respectively.
|
||||||
*/
|
*/
|
||||||
setContrast: function(contrast) {
|
setContrast(contrast) {
|
||||||
this._contrast.r = contrast.r;
|
this._contrast.r = contrast.r;
|
||||||
this._contrast.g = contrast.g;
|
this._contrast.g = contrast.g;
|
||||||
this._contrast.b = contrast.b;
|
this._contrast.b = contrast.b;
|
||||||
@ -1203,7 +1203,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
* @return Object containing the contrast for the red, green,
|
* @return Object containing the contrast for the red, green,
|
||||||
* and blue channels.
|
* and blue channels.
|
||||||
*/
|
*/
|
||||||
getContrast: function() {
|
getContrast() {
|
||||||
let contrast = {};
|
let contrast = {};
|
||||||
contrast.r = this._contrast.r;
|
contrast.r = this._contrast.r;
|
||||||
contrast.g = this._contrast.g;
|
contrast.g = this._contrast.g;
|
||||||
@ -1213,7 +1213,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
|
|
||||||
//// Private methods ////
|
//// Private methods ////
|
||||||
|
|
||||||
_createActors: function() {
|
_createActors() {
|
||||||
// The root actor for the zoom region
|
// The root actor for the zoom region
|
||||||
this._magView = new St.Bin({ style_class: 'magnifier-zoom-region', x_fill: true, y_fill: true });
|
this._magView = new St.Bin({ style_class: 'magnifier-zoom-region', x_fill: true, y_fill: true });
|
||||||
global.stage.add_actor(this._magView);
|
global.stage.add_actor(this._magView);
|
||||||
@ -1257,7 +1257,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
this._magShaderEffects.setContrast(this._contrast);
|
this._magShaderEffects.setContrast(this._contrast);
|
||||||
},
|
},
|
||||||
|
|
||||||
_destroyActors: function() {
|
_destroyActors() {
|
||||||
if (this._mouseActor == this._mouseSourceActor)
|
if (this._mouseActor == this._mouseSourceActor)
|
||||||
this._mouseActor.get_parent().remove_actor (this._mouseActor);
|
this._mouseActor.get_parent().remove_actor (this._mouseActor);
|
||||||
if (this._crossHairs)
|
if (this._crossHairs)
|
||||||
@ -1273,7 +1273,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
this._crossHairsActor = null;
|
this._crossHairsActor = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setViewPort: function(viewPort, fromROIUpdate) {
|
_setViewPort(viewPort, fromROIUpdate) {
|
||||||
// Sets the position of the zoom region on the screen
|
// Sets the position of the zoom region on the screen
|
||||||
|
|
||||||
let width = Math.round(Math.min(viewPort.width, global.screen_width));
|
let width = Math.round(Math.min(viewPort.width, global.screen_width));
|
||||||
@ -1298,7 +1298,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
this._magnifier.hideSystemCursor();
|
this._magnifier.hideSystemCursor();
|
||||||
},
|
},
|
||||||
|
|
||||||
_changeROI: function(params) {
|
_changeROI(params) {
|
||||||
// Updates the area we are viewing; the magnification factors
|
// Updates the area we are viewing; the magnification factors
|
||||||
// and center can be set explicitly, or we can recompute
|
// and center can be set explicitly, or we can recompute
|
||||||
// the position based on the mouse cursor position
|
// the position based on the mouse cursor position
|
||||||
@ -1349,7 +1349,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
this._updateMousePosition();
|
this._updateMousePosition();
|
||||||
},
|
},
|
||||||
|
|
||||||
_isMouseOverRegion: function() {
|
_isMouseOverRegion() {
|
||||||
// Return whether the system mouse sprite is over this ZoomRegion. If the
|
// Return whether the system mouse sprite is over this ZoomRegion. If the
|
||||||
// mouse's position is not given, then it is fetched.
|
// mouse's position is not given, then it is fetched.
|
||||||
let mouseIsOver = false;
|
let mouseIsOver = false;
|
||||||
@ -1365,7 +1365,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
return mouseIsOver;
|
return mouseIsOver;
|
||||||
},
|
},
|
||||||
|
|
||||||
_isFullScreen: function() {
|
_isFullScreen() {
|
||||||
// Does the magnified view occupy the whole screen? Note that this
|
// Does the magnified view occupy the whole screen? Note that this
|
||||||
// doesn't necessarily imply
|
// doesn't necessarily imply
|
||||||
// this._screenPosition = GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN;
|
// this._screenPosition = GDesktopEnums.MagnifierScreenPosition.FULL_SCREEN;
|
||||||
@ -1378,7 +1378,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_centerFromMousePosition: function() {
|
_centerFromMousePosition() {
|
||||||
// Determines where the center should be given the current cursor
|
// Determines where the center should be given the current cursor
|
||||||
// position and mouse tracking mode
|
// position and mouse tracking mode
|
||||||
|
|
||||||
@ -1398,7 +1398,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
return null; // Should never be hit
|
return null; // Should never be hit
|
||||||
},
|
},
|
||||||
|
|
||||||
_centerFromCaretPosition: function() {
|
_centerFromCaretPosition() {
|
||||||
let xCaret = this._xCaret;
|
let xCaret = this._xCaret;
|
||||||
let yCaret = this._yCaret;
|
let yCaret = this._yCaret;
|
||||||
|
|
||||||
@ -1412,7 +1412,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
this._scrollContentsToDelayed(xCaret, yCaret);
|
this._scrollContentsToDelayed(xCaret, yCaret);
|
||||||
},
|
},
|
||||||
|
|
||||||
_centerFromFocusPosition: function() {
|
_centerFromFocusPosition() {
|
||||||
let xFocus = this._xFocus;
|
let xFocus = this._xFocus;
|
||||||
let yFocus = this._yFocus;
|
let yFocus = this._yFocus;
|
||||||
|
|
||||||
@ -1426,7 +1426,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
this._scrollContentsToDelayed(xFocus, yFocus);
|
this._scrollContentsToDelayed(xFocus, yFocus);
|
||||||
},
|
},
|
||||||
|
|
||||||
_centerFromPointPush: function(xPoint, yPoint) {
|
_centerFromPointPush(xPoint, yPoint) {
|
||||||
let [xRoi, yRoi, widthRoi, heightRoi] = this.getROI();
|
let [xRoi, yRoi, widthRoi, heightRoi] = this.getROI();
|
||||||
let [cursorWidth, cursorHeight] = this._mouseSourceActor.get_size();
|
let [cursorWidth, cursorHeight] = this._mouseSourceActor.get_size();
|
||||||
let xPos = xRoi + widthRoi / 2;
|
let xPos = xRoi + widthRoi / 2;
|
||||||
@ -1447,7 +1447,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
return [xPos, yPos];
|
return [xPos, yPos];
|
||||||
},
|
},
|
||||||
|
|
||||||
_centerFromPointProportional: function(xPoint, yPoint) {
|
_centerFromPointProportional(xPoint, yPoint) {
|
||||||
let [xRoi, yRoi, widthRoi, heightRoi] = this.getROI();
|
let [xRoi, yRoi, widthRoi, heightRoi] = this.getROI();
|
||||||
let halfScreenWidth = global.screen_width / 2;
|
let halfScreenWidth = global.screen_width / 2;
|
||||||
let halfScreenHeight = global.screen_height / 2;
|
let halfScreenHeight = global.screen_height / 2;
|
||||||
@ -1464,18 +1464,18 @@ var ZoomRegion = new Lang.Class({
|
|||||||
return [xPos, yPos];
|
return [xPos, yPos];
|
||||||
},
|
},
|
||||||
|
|
||||||
_centerFromPointCentered: function(xPoint, yPoint) {
|
_centerFromPointCentered(xPoint, yPoint) {
|
||||||
return [xPoint, yPoint];
|
return [xPoint, yPoint];
|
||||||
},
|
},
|
||||||
|
|
||||||
_screenToViewPort: function(screenX, screenY) {
|
_screenToViewPort(screenX, screenY) {
|
||||||
// Converts coordinates relative to the (unmagnified) screen to coordinates
|
// Converts coordinates relative to the (unmagnified) screen to coordinates
|
||||||
// relative to the origin of this._magView
|
// relative to the origin of this._magView
|
||||||
return [this._viewPortWidth / 2 + (screenX - this._xCenter) * this._xMagFactor,
|
return [this._viewPortWidth / 2 + (screenX - this._xCenter) * this._xMagFactor,
|
||||||
this._viewPortHeight / 2 + (screenY - this._yCenter) * this._yMagFactor];
|
this._viewPortHeight / 2 + (screenY - this._yCenter) * this._yMagFactor];
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateMagViewGeometry: function() {
|
_updateMagViewGeometry() {
|
||||||
if (!this.isActive())
|
if (!this.isActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1488,7 +1488,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
this._magView.set_position(this._viewPortX, this._viewPortY);
|
this._magView.set_position(this._viewPortX, this._viewPortY);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCloneGeometry: function() {
|
_updateCloneGeometry() {
|
||||||
if (!this.isActive())
|
if (!this.isActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1501,7 +1501,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
this._updateMousePosition();
|
this._updateMousePosition();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateMousePosition: function() {
|
_updateMousePosition() {
|
||||||
if (!this.isActive())
|
if (!this.isActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1520,7 +1520,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_monitorsChanged: function() {
|
_monitorsChanged() {
|
||||||
if (!this.isActive())
|
if (!this.isActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1539,7 +1539,7 @@ var ZoomRegion = new Lang.Class({
|
|||||||
var Crosshairs = new Lang.Class({
|
var Crosshairs = new Lang.Class({
|
||||||
Name: 'Crosshairs',
|
Name: 'Crosshairs',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
|
|
||||||
// Set the group containing the crosshairs to three times the desktop
|
// Set the group containing the crosshairs to three times the desktop
|
||||||
// size in case the crosshairs need to appear to be infinite in
|
// size in case the crosshairs need to appear to be infinite in
|
||||||
@ -1568,7 +1568,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
Lang.bind(this, this._monitorsChanged));
|
Lang.bind(this, this._monitorsChanged));
|
||||||
},
|
},
|
||||||
|
|
||||||
_monitorsChanged: function() {
|
_monitorsChanged() {
|
||||||
this._actor.set_size(global.screen_width * 3, global.screen_height * 3);
|
this._actor.set_size(global.screen_width * 3, global.screen_height * 3);
|
||||||
this.reCenter();
|
this.reCenter();
|
||||||
},
|
},
|
||||||
@ -1585,7 +1585,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* the mouse.
|
* the mouse.
|
||||||
* @return The crosshairs actor, or its clone.
|
* @return The crosshairs actor, or its clone.
|
||||||
*/
|
*/
|
||||||
addToZoomRegion: function(zoomRegion, magnifiedMouse) {
|
addToZoomRegion(zoomRegion, magnifiedMouse) {
|
||||||
let crosshairsActor = null;
|
let crosshairsActor = null;
|
||||||
if (zoomRegion && magnifiedMouse) {
|
if (zoomRegion && magnifiedMouse) {
|
||||||
let container = magnifiedMouse.get_parent();
|
let container = magnifiedMouse.get_parent();
|
||||||
@ -1613,7 +1613,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* Remove the crosshairs actor from its parent container, or destroy the
|
* Remove the crosshairs actor from its parent container, or destroy the
|
||||||
* child actor if it was just a clone of the crosshairs actor.
|
* child actor if it was just a clone of the crosshairs actor.
|
||||||
*/
|
*/
|
||||||
removeFromParent: function(childActor) {
|
removeFromParent(childActor) {
|
||||||
if (childActor == this._actor)
|
if (childActor == this._actor)
|
||||||
childActor.get_parent().remove_actor(childActor);
|
childActor.get_parent().remove_actor(childActor);
|
||||||
else
|
else
|
||||||
@ -1625,7 +1625,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* Set the color of the crosshairs.
|
* Set the color of the crosshairs.
|
||||||
* @clutterColor: The color as a Clutter.Color.
|
* @clutterColor: The color as a Clutter.Color.
|
||||||
*/
|
*/
|
||||||
setColor: function(clutterColor) {
|
setColor(clutterColor) {
|
||||||
this._horizLeftHair.background_color = clutterColor;
|
this._horizLeftHair.background_color = clutterColor;
|
||||||
this._horizRightHair.background_color = clutterColor;
|
this._horizRightHair.background_color = clutterColor;
|
||||||
this._vertTopHair.background_color = clutterColor;
|
this._vertTopHair.background_color = clutterColor;
|
||||||
@ -1637,7 +1637,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* Get the color of the crosshairs.
|
* Get the color of the crosshairs.
|
||||||
* @color: The color as a Clutter.Color.
|
* @color: The color as a Clutter.Color.
|
||||||
*/
|
*/
|
||||||
getColor: function() {
|
getColor() {
|
||||||
return this._horizLeftHair.get_color();
|
return this._horizLeftHair.get_color();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1646,7 +1646,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* Set the width of the vertical and horizontal lines of the crosshairs.
|
* Set the width of the vertical and horizontal lines of the crosshairs.
|
||||||
* @thickness
|
* @thickness
|
||||||
*/
|
*/
|
||||||
setThickness: function(thickness) {
|
setThickness(thickness) {
|
||||||
this._horizLeftHair.set_height(thickness);
|
this._horizLeftHair.set_height(thickness);
|
||||||
this._horizRightHair.set_height(thickness);
|
this._horizRightHair.set_height(thickness);
|
||||||
this._vertTopHair.set_width(thickness);
|
this._vertTopHair.set_width(thickness);
|
||||||
@ -1659,7 +1659,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* Get the width of the vertical and horizontal lines of the crosshairs.
|
* Get the width of the vertical and horizontal lines of the crosshairs.
|
||||||
* @return: The thickness of the crosshairs.
|
* @return: The thickness of the crosshairs.
|
||||||
*/
|
*/
|
||||||
getThickness: function() {
|
getThickness() {
|
||||||
return this._horizLeftHair.get_height();
|
return this._horizLeftHair.get_height();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1668,7 +1668,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* Set how opaque the crosshairs are.
|
* Set how opaque the crosshairs are.
|
||||||
* @opacity: Value between 0 (fully transparent) and 255 (full opaque).
|
* @opacity: Value between 0 (fully transparent) and 255 (full opaque).
|
||||||
*/
|
*/
|
||||||
setOpacity: function(opacity) {
|
setOpacity(opacity) {
|
||||||
// set_opacity() throws an exception for values outside the range
|
// set_opacity() throws an exception for values outside the range
|
||||||
// [0, 255].
|
// [0, 255].
|
||||||
if (opacity < 0)
|
if (opacity < 0)
|
||||||
@ -1687,7 +1687,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* Set the length of the vertical and horizontal lines in the crosshairs.
|
* Set the length of the vertical and horizontal lines in the crosshairs.
|
||||||
* @length: The length of the crosshairs.
|
* @length: The length of the crosshairs.
|
||||||
*/
|
*/
|
||||||
setLength: function(length) {
|
setLength(length) {
|
||||||
this._horizLeftHair.set_width(length);
|
this._horizLeftHair.set_width(length);
|
||||||
this._horizRightHair.set_width(length);
|
this._horizRightHair.set_width(length);
|
||||||
this._vertTopHair.set_height(length);
|
this._vertTopHair.set_height(length);
|
||||||
@ -1700,7 +1700,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* Get the length of the vertical and horizontal lines in the crosshairs.
|
* Get the length of the vertical and horizontal lines in the crosshairs.
|
||||||
* @return: The length of the crosshairs.
|
* @return: The length of the crosshairs.
|
||||||
*/
|
*/
|
||||||
getLength: function() {
|
getLength() {
|
||||||
return this._horizLeftHair.get_width();
|
return this._horizLeftHair.get_width();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1711,7 +1711,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* @size: Array of [width, height] defining the size of the clip
|
* @size: Array of [width, height] defining the size of the clip
|
||||||
* rectangle.
|
* rectangle.
|
||||||
*/
|
*/
|
||||||
setClip: function(size) {
|
setClip(size) {
|
||||||
if (size) {
|
if (size) {
|
||||||
// Take a chunk out of the crosshairs where it intersects the
|
// Take a chunk out of the crosshairs where it intersects the
|
||||||
// mouse.
|
// mouse.
|
||||||
@ -1729,7 +1729,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* show:
|
* show:
|
||||||
* Show the crosshairs.
|
* Show the crosshairs.
|
||||||
*/
|
*/
|
||||||
show: function() {
|
show() {
|
||||||
this._actor.show();
|
this._actor.show();
|
||||||
// Clones don't share visibility.
|
// Clones don't share visibility.
|
||||||
for (let i = 0; i < this._clones.length; i++)
|
for (let i = 0; i < this._clones.length; i++)
|
||||||
@ -1740,7 +1740,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* hide:
|
* hide:
|
||||||
* Hide the crosshairs.
|
* Hide the crosshairs.
|
||||||
*/
|
*/
|
||||||
hide: function() {
|
hide() {
|
||||||
this._actor.hide();
|
this._actor.hide();
|
||||||
// Clones don't share visibility.
|
// Clones don't share visibility.
|
||||||
for (let i = 0; i < this._clones.length; i++)
|
for (let i = 0; i < this._clones.length; i++)
|
||||||
@ -1754,7 +1754,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
* the clip rectangle, these are used to update the size of the clip.
|
* the clip rectangle, these are used to update the size of the clip.
|
||||||
* @clipSize: Optional. If present, an array of the form [width, height].
|
* @clipSize: Optional. If present, an array of the form [width, height].
|
||||||
*/
|
*/
|
||||||
reCenter: function(clipSize) {
|
reCenter(clipSize) {
|
||||||
let [groupWidth, groupHeight] = this._actor.get_size();
|
let [groupWidth, groupHeight] = this._actor.get_size();
|
||||||
let leftLength = this._horizLeftHair.get_width();
|
let leftLength = this._horizLeftHair.get_width();
|
||||||
let rightLength = this._horizRightHair.get_width();
|
let rightLength = this._horizRightHair.get_width();
|
||||||
@ -1784,7 +1784,7 @@ var Crosshairs = new Lang.Class({
|
|||||||
var MagShaderEffects = new Lang.Class({
|
var MagShaderEffects = new Lang.Class({
|
||||||
Name: 'MagShaderEffects',
|
Name: 'MagShaderEffects',
|
||||||
|
|
||||||
_init: function(uiGroupClone) {
|
_init(uiGroupClone) {
|
||||||
this._inverse = new Shell.InvertLightnessEffect();
|
this._inverse = new Shell.InvertLightnessEffect();
|
||||||
this._brightnessContrast = new Clutter.BrightnessContrastEffect();
|
this._brightnessContrast = new Clutter.BrightnessContrastEffect();
|
||||||
this._colorDesaturation = new Clutter.DesaturateEffect();
|
this._colorDesaturation = new Clutter.DesaturateEffect();
|
||||||
@ -1803,7 +1803,7 @@ var MagShaderEffects = new Lang.Class({
|
|||||||
* lose the reference to the actor they were applied to. Don't use this
|
* lose the reference to the actor they were applied to. Don't use this
|
||||||
* object after calling this.
|
* object after calling this.
|
||||||
*/
|
*/
|
||||||
destroyEffects: function() {
|
destroyEffects() {
|
||||||
this._magView.clear_effects();
|
this._magView.clear_effects();
|
||||||
this._colorDesaturation = null;
|
this._colorDesaturation = null;
|
||||||
this._brightnessContrast = null;
|
this._brightnessContrast = null;
|
||||||
@ -1816,11 +1816,11 @@ var MagShaderEffects = new Lang.Class({
|
|||||||
* Enable/disable invert lightness effect.
|
* Enable/disable invert lightness effect.
|
||||||
* @invertFlag: Enabled flag.
|
* @invertFlag: Enabled flag.
|
||||||
*/
|
*/
|
||||||
setInvertLightness: function(invertFlag) {
|
setInvertLightness(invertFlag) {
|
||||||
this._inverse.set_enabled(invertFlag);
|
this._inverse.set_enabled(invertFlag);
|
||||||
},
|
},
|
||||||
|
|
||||||
setColorSaturation: function(factor) {
|
setColorSaturation(factor) {
|
||||||
this._colorDesaturation.set_factor(1.0 - factor);
|
this._colorDesaturation.set_factor(1.0 - factor);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -1833,7 +1833,7 @@ var MagShaderEffects = new Lang.Class({
|
|||||||
* 0.0 indicate decreased or incresaed brightness,
|
* 0.0 indicate decreased or incresaed brightness,
|
||||||
* respectively.
|
* respectively.
|
||||||
*/
|
*/
|
||||||
setBrightness: function(brightness) {
|
setBrightness(brightness) {
|
||||||
let bRed = brightness.r;
|
let bRed = brightness.r;
|
||||||
let bGreen = brightness.g;
|
let bGreen = brightness.g;
|
||||||
let bBlue = brightness.b;
|
let bBlue = brightness.b;
|
||||||
@ -1855,7 +1855,7 @@ var MagShaderEffects = new Lang.Class({
|
|||||||
* contrast (no change), whereas values less or greater than
|
* contrast (no change), whereas values less or greater than
|
||||||
* 0.0 indicate decreased or incresaed contrast, respectively.
|
* 0.0 indicate decreased or incresaed contrast, respectively.
|
||||||
*/
|
*/
|
||||||
setContrast: function(contrast) {
|
setContrast(contrast) {
|
||||||
let cRed = contrast.r;
|
let cRed = contrast.r;
|
||||||
let cGreen = contrast.g;
|
let cGreen = contrast.g;
|
||||||
let cBlue = contrast.b;
|
let cBlue = contrast.b;
|
||||||
|
@ -101,7 +101,7 @@ let _zoomRegionInstanceCount = 0;
|
|||||||
var ShellMagnifier = new Lang.Class({
|
var ShellMagnifier = new Lang.Class({
|
||||||
Name: 'ShellMagnifier',
|
Name: 'ShellMagnifier',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._zoomers = {};
|
this._zoomers = {};
|
||||||
|
|
||||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(MagnifierIface, this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(MagnifierIface, this);
|
||||||
@ -112,7 +112,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* setActive:
|
* setActive:
|
||||||
* @activate: Boolean to activate or de-activate the magnifier.
|
* @activate: Boolean to activate or de-activate the magnifier.
|
||||||
*/
|
*/
|
||||||
setActive: function(activate) {
|
setActive(activate) {
|
||||||
Main.magnifier.setActive(activate);
|
Main.magnifier.setActive(activate);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* isActive:
|
* isActive:
|
||||||
* @return Whether the magnifier is active (boolean).
|
* @return Whether the magnifier is active (boolean).
|
||||||
*/
|
*/
|
||||||
isActive: function() {
|
isActive() {
|
||||||
return Main.magnifier.isActive();
|
return Main.magnifier.isActive();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* showCursor:
|
* showCursor:
|
||||||
* Show the system mouse pointer.
|
* Show the system mouse pointer.
|
||||||
*/
|
*/
|
||||||
showCursor: function() {
|
showCursor() {
|
||||||
Main.magnifier.showSystemCursor();
|
Main.magnifier.showSystemCursor();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* hideCursor:
|
* hideCursor:
|
||||||
* Hide the system mouse pointer.
|
* Hide the system mouse pointer.
|
||||||
*/
|
*/
|
||||||
hideCursor: function() {
|
hideCursor() {
|
||||||
Main.magnifier.hideSystemCursor();
|
Main.magnifier.hideSystemCursor();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
*
|
*
|
||||||
* @return The newly created ZoomRegion.
|
* @return The newly created ZoomRegion.
|
||||||
*/
|
*/
|
||||||
createZoomRegion: function(xMagFactor, yMagFactor, roi, viewPort) {
|
createZoomRegion(xMagFactor, yMagFactor, roi, viewPort) {
|
||||||
let ROI = { x: roi[0], y: roi[1], width: roi[2] - roi[0], height: roi[3] - roi[1] };
|
let ROI = { x: roi[0], y: roi[1], width: roi[2] - roi[0], height: roi[3] - roi[1] };
|
||||||
let viewBox = { x: viewPort[0], y: viewPort[1], width: viewPort[2] - viewPort[0], height: viewPort[3] - viewPort[1] };
|
let viewBox = { x: viewPort[0], y: viewPort[1], width: viewPort[2] - viewPort[0], height: viewPort[3] - viewPort[1] };
|
||||||
let realZoomRegion = Main.magnifier.createZoomRegion(xMagFactor, yMagFactor, ROI, viewBox);
|
let realZoomRegion = Main.magnifier.createZoomRegion(xMagFactor, yMagFactor, ROI, viewBox);
|
||||||
@ -180,7 +180,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* Append the given ZoomRegion to the magnifier's list of ZoomRegions.
|
* Append the given ZoomRegion to the magnifier's list of ZoomRegions.
|
||||||
* @zoomerObjectPath: The object path for the zoom region proxy.
|
* @zoomerObjectPath: The object path for the zoom region proxy.
|
||||||
*/
|
*/
|
||||||
addZoomRegion: function(zoomerObjectPath) {
|
addZoomRegion(zoomerObjectPath) {
|
||||||
let proxyAndZoomRegion = this._zoomers[zoomerObjectPath];
|
let proxyAndZoomRegion = this._zoomers[zoomerObjectPath];
|
||||||
if (proxyAndZoomRegion && proxyAndZoomRegion.zoomRegion) {
|
if (proxyAndZoomRegion && proxyAndZoomRegion.zoomRegion) {
|
||||||
Main.magnifier.addZoomRegion(proxyAndZoomRegion.zoomRegion);
|
Main.magnifier.addZoomRegion(proxyAndZoomRegion.zoomRegion);
|
||||||
@ -196,7 +196,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* @return: The Magnifier's zoom region list as an array of DBus object
|
* @return: The Magnifier's zoom region list as an array of DBus object
|
||||||
* paths.
|
* paths.
|
||||||
*/
|
*/
|
||||||
getZoomRegions: function() {
|
getZoomRegions() {
|
||||||
// There may be more ZoomRegions in the magnifier itself than have
|
// There may be more ZoomRegions in the magnifier itself than have
|
||||||
// been added through dbus. Make sure all of them are associated with
|
// been added through dbus. Make sure all of them are associated with
|
||||||
// an object path and proxy.
|
// an object path and proxy.
|
||||||
@ -232,7 +232,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* clearAllZoomRegions:
|
* clearAllZoomRegions:
|
||||||
* Remove all the zoom regions from this Magnfier's ZoomRegion list.
|
* Remove all the zoom regions from this Magnfier's ZoomRegion list.
|
||||||
*/
|
*/
|
||||||
clearAllZoomRegions: function() {
|
clearAllZoomRegions() {
|
||||||
Main.magnifier.clearAllZoomRegions();
|
Main.magnifier.clearAllZoomRegions();
|
||||||
for (let objectPath in this._zoomers) {
|
for (let objectPath in this._zoomers) {
|
||||||
let proxyAndZoomer = this._zoomers[objectPath];
|
let proxyAndZoomer = this._zoomers[objectPath];
|
||||||
@ -249,7 +249,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* Consult if the Magnifier can magnify in full-screen mode.
|
* Consult if the Magnifier can magnify in full-screen mode.
|
||||||
* @return Always return true.
|
* @return Always return true.
|
||||||
*/
|
*/
|
||||||
fullScreenCapable: function() {
|
fullScreenCapable() {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* Set the crosswire size of all ZoomRegions.
|
* Set the crosswire size of all ZoomRegions.
|
||||||
* @size: The thickness of each line in the cross wire.
|
* @size: The thickness of each line in the cross wire.
|
||||||
*/
|
*/
|
||||||
setCrosswireSize: function(size) {
|
setCrosswireSize(size) {
|
||||||
Main.magnifier.setCrosshairsThickness(size);
|
Main.magnifier.setCrosshairsThickness(size);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* Get the crosswire size of all ZoomRegions.
|
* Get the crosswire size of all ZoomRegions.
|
||||||
* @return: The thickness of each line in the cross wire.
|
* @return: The thickness of each line in the cross wire.
|
||||||
*/
|
*/
|
||||||
getCrosswireSize: function() {
|
getCrosswireSize() {
|
||||||
return Main.magnifier.getCrosshairsThickness();
|
return Main.magnifier.getCrosshairsThickness();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* Set the crosswire length of all zoom-regions..
|
* Set the crosswire length of all zoom-regions..
|
||||||
* @size: The length of each line in the cross wire.
|
* @size: The length of each line in the cross wire.
|
||||||
*/
|
*/
|
||||||
setCrosswireLength: function(length) {
|
setCrosswireLength(length) {
|
||||||
Main.magnifier.setCrosshairsLength(length);
|
Main.magnifier.setCrosshairsLength(length);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* Set the crosswire size of all zoom-regions.
|
* Set the crosswire size of all zoom-regions.
|
||||||
* @size: The thickness of each line in the cross wire.
|
* @size: The thickness of each line in the cross wire.
|
||||||
*/
|
*/
|
||||||
getCrosswireLength: function() {
|
getCrosswireLength() {
|
||||||
return Main.magnifier.getCrosshairsLength();
|
return Main.magnifier.getCrosshairsLength();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* Set if the crosswire will be clipped by the cursor image..
|
* Set if the crosswire will be clipped by the cursor image..
|
||||||
* @clip: Flag to indicate whether to clip the crosswire.
|
* @clip: Flag to indicate whether to clip the crosswire.
|
||||||
*/
|
*/
|
||||||
setCrosswireClip: function(clip) {
|
setCrosswireClip(clip) {
|
||||||
Main.magnifier.setCrosshairsClip(clip);
|
Main.magnifier.setCrosshairsClip(clip);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* Get the crosswire clip value.
|
* Get the crosswire clip value.
|
||||||
* @return: Whether the crosswire is clipped by the cursor image.
|
* @return: Whether the crosswire is clipped by the cursor image.
|
||||||
*/
|
*/
|
||||||
getCrosswireClip: function() {
|
getCrosswireClip() {
|
||||||
return Main.magnifier.getCrosshairsClip();
|
return Main.magnifier.getCrosshairsClip();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* Set the crosswire color of all ZoomRegions.
|
* Set the crosswire color of all ZoomRegions.
|
||||||
* @color: Unsigned int of the form rrggbbaa.
|
* @color: Unsigned int of the form rrggbbaa.
|
||||||
*/
|
*/
|
||||||
setCrosswireColor: function(color) {
|
setCrosswireColor(color) {
|
||||||
Main.magnifier.setCrosshairsColor('#%08x'.format(color));
|
Main.magnifier.setCrosshairsColor('#%08x'.format(color));
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
* Get the crosswire color of all ZoomRegions.
|
* Get the crosswire color of all ZoomRegions.
|
||||||
* @return: The crosswire color as an unsigned int in the form rrggbbaa.
|
* @return: The crosswire color as an unsigned int in the form rrggbbaa.
|
||||||
*/
|
*/
|
||||||
getCrosswireColor: function() {
|
getCrosswireColor() {
|
||||||
let colorString = Main.magnifier.getCrosshairsColor();
|
let colorString = Main.magnifier.getCrosshairsColor();
|
||||||
// Drop the leading '#'.
|
// Drop the leading '#'.
|
||||||
return parseInt(colorString.slice(1), 16);
|
return parseInt(colorString.slice(1), 16);
|
||||||
@ -337,7 +337,7 @@ var ShellMagnifier = new Lang.Class({
|
|||||||
var ShellMagnifierZoomRegion = new Lang.Class({
|
var ShellMagnifierZoomRegion = new Lang.Class({
|
||||||
Name: 'ShellMagnifierZoomRegion',
|
Name: 'ShellMagnifierZoomRegion',
|
||||||
|
|
||||||
_init: function(zoomerObjectPath, zoomRegion) {
|
_init(zoomerObjectPath, zoomRegion) {
|
||||||
this._zoomRegion = zoomRegion;
|
this._zoomRegion = zoomRegion;
|
||||||
|
|
||||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ZoomRegionIface, this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ZoomRegionIface, this);
|
||||||
@ -352,7 +352,7 @@ var ShellMagnifierZoomRegion = new Lang.Class({
|
|||||||
* @yMagFactor: The power to set the vertical magnification factor to
|
* @yMagFactor: The power to set the vertical magnification factor to
|
||||||
* of the magnified view.
|
* of the magnified view.
|
||||||
*/
|
*/
|
||||||
setMagFactor: function(xMagFactor, yMagFactor) {
|
setMagFactor(xMagFactor, yMagFactor) {
|
||||||
this._zoomRegion.setMagFactor(xMagFactor, yMagFactor);
|
this._zoomRegion.setMagFactor(xMagFactor, yMagFactor);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ var ShellMagnifierZoomRegion = new Lang.Class({
|
|||||||
* magnification. A value of 2.0 means the contents are doubled
|
* magnification. A value of 2.0 means the contents are doubled
|
||||||
* in size, and so on.
|
* in size, and so on.
|
||||||
*/
|
*/
|
||||||
getMagFactor: function() {
|
getMagFactor() {
|
||||||
return this._zoomRegion.getMagFactor();
|
return this._zoomRegion.getMagFactor();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ var ShellMagnifierZoomRegion = new Lang.Class({
|
|||||||
* screen to magnify. The values are in screen (unmagnified)
|
* screen to magnify. The values are in screen (unmagnified)
|
||||||
* coordinate space.
|
* coordinate space.
|
||||||
*/
|
*/
|
||||||
setRoi: function(roi) {
|
setRoi(roi) {
|
||||||
let roiObject = { x: roi[0], y: roi[1], width: roi[2] - roi[0], height: roi[3] - roi[1] };
|
let roiObject = { x: roi[0], y: roi[1], width: roi[2] - roi[0], height: roi[3] - roi[1] };
|
||||||
this._zoomRegion.setROI(roiObject);
|
this._zoomRegion.setROI(roiObject);
|
||||||
},
|
},
|
||||||
@ -387,7 +387,7 @@ var ShellMagnifierZoomRegion = new Lang.Class({
|
|||||||
* @return an array, [left, top, right, bottom], representing the bounding
|
* @return an array, [left, top, right, bottom], representing the bounding
|
||||||
* rectangle of what is shown in the magnified view.
|
* rectangle of what is shown in the magnified view.
|
||||||
*/
|
*/
|
||||||
getRoi: function() {
|
getRoi() {
|
||||||
let roi = this._zoomRegion.getROI();
|
let roi = this._zoomRegion.getROI();
|
||||||
roi[2] += roi[0];
|
roi[2] += roi[0];
|
||||||
roi[3] += roi[1];
|
roi[3] += roi[1];
|
||||||
@ -402,7 +402,7 @@ var ShellMagnifierZoomRegion = new Lang.Class({
|
|||||||
* @return Whether the shift was successful (for GS-mag, this is always
|
* @return Whether the shift was successful (for GS-mag, this is always
|
||||||
* true).
|
* true).
|
||||||
*/
|
*/
|
||||||
shiftContentsTo: function(x, y) {
|
shiftContentsTo(x, y) {
|
||||||
this._zoomRegion.scrollContentsTo(x, y);
|
this._zoomRegion.scrollContentsTo(x, y);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@ -413,12 +413,12 @@ var ShellMagnifierZoomRegion = new Lang.Class({
|
|||||||
* @viewPort Array, [left, top, right, bottom], defining the position and
|
* @viewPort Array, [left, top, right, bottom], defining the position and
|
||||||
* size on screen to place the zoom region.
|
* size on screen to place the zoom region.
|
||||||
*/
|
*/
|
||||||
moveResize: function(viewPort) {
|
moveResize(viewPort) {
|
||||||
let viewRect = { x: viewPort[0], y: viewPort[1], width: viewPort[2] - viewPort[0], height: viewPort[3] - viewPort[1] };
|
let viewRect = { x: viewPort[0], y: viewPort[1], width: viewPort[2] - viewPort[0], height: viewPort[3] - viewPort[1] };
|
||||||
this._zoomRegion.setViewPort(viewRect);
|
this._zoomRegion.setViewPort(viewRect);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this._dbusImpl.unexport();
|
this._dbusImpl.unexport();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -686,7 +686,7 @@ var RestartMessage = new Lang.Class({
|
|||||||
Name: 'RestartMessage',
|
Name: 'RestartMessage',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init : function(message) {
|
_init(message) {
|
||||||
this.parent({ shellReactive: true,
|
this.parent({ shellReactive: true,
|
||||||
styleClass: 'restart-message headline',
|
styleClass: 'restart-message headline',
|
||||||
shouldFadeIn: false,
|
shouldFadeIn: false,
|
||||||
|
@ -42,7 +42,7 @@ function _fixMarkup(text, allowMarkup) {
|
|||||||
var URLHighlighter = new Lang.Class({
|
var URLHighlighter = new Lang.Class({
|
||||||
Name: 'URLHighlighter',
|
Name: 'URLHighlighter',
|
||||||
|
|
||||||
_init: function(text, lineWrap, allowMarkup) {
|
_init(text, lineWrap, allowMarkup) {
|
||||||
if (!text)
|
if (!text)
|
||||||
text = '';
|
text = '';
|
||||||
this.actor = new St.Label({ reactive: true, style_class: 'url-highlighter',
|
this.actor = new St.Label({ reactive: true, style_class: 'url-highlighter',
|
||||||
@ -115,7 +115,7 @@ var URLHighlighter = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
setMarkup: function(text, allowMarkup) {
|
setMarkup(text, allowMarkup) {
|
||||||
text = text ? _fixMarkup(text, allowMarkup) : '';
|
text = text ? _fixMarkup(text, allowMarkup) : '';
|
||||||
this._text = text;
|
this._text = text;
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ var URLHighlighter = new Lang.Class({
|
|||||||
this._highlightUrls();
|
this._highlightUrls();
|
||||||
},
|
},
|
||||||
|
|
||||||
_highlightUrls: function() {
|
_highlightUrls() {
|
||||||
// text here contain markup
|
// text here contain markup
|
||||||
let urls = Util.findUrls(this._text);
|
let urls = Util.findUrls(this._text);
|
||||||
let markup = '';
|
let markup = '';
|
||||||
@ -140,7 +140,7 @@ var URLHighlighter = new Lang.Class({
|
|||||||
this.actor.clutter_text.set_markup(markup);
|
this.actor.clutter_text.set_markup(markup);
|
||||||
},
|
},
|
||||||
|
|
||||||
_findUrlAtPos: function(event) {
|
_findUrlAtPos(event) {
|
||||||
let success;
|
let success;
|
||||||
let [x, y] = event.get_coords();
|
let [x, y] = event.get_coords();
|
||||||
[success, x, y] = this.actor.transform_stage_point(x, y);
|
[success, x, y] = this.actor.transform_stage_point(x, y);
|
||||||
@ -165,12 +165,12 @@ var ScaleLayout = new Lang.Class({
|
|||||||
Name: 'ScaleLayout',
|
Name: 'ScaleLayout',
|
||||||
Extends: Clutter.BinLayout,
|
Extends: Clutter.BinLayout,
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
this._container = null;
|
this._container = null;
|
||||||
this.parent(params);
|
this.parent(params);
|
||||||
},
|
},
|
||||||
|
|
||||||
_connectContainer: function(container) {
|
_connectContainer(container) {
|
||||||
if (this._container == container)
|
if (this._container == container)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ var ScaleLayout = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_width: function(container, forHeight) {
|
vfunc_get_preferred_width(container, forHeight) {
|
||||||
this._connectContainer(container);
|
this._connectContainer(container);
|
||||||
|
|
||||||
let [min, nat] = this.parent(container, forHeight);
|
let [min, nat] = this.parent(container, forHeight);
|
||||||
@ -199,7 +199,7 @@ var ScaleLayout = new Lang.Class({
|
|||||||
Math.floor(nat * container.scale_x)];
|
Math.floor(nat * container.scale_x)];
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_height: function(container, forWidth) {
|
vfunc_get_preferred_height(container, forWidth) {
|
||||||
this._connectContainer(container);
|
this._connectContainer(container);
|
||||||
|
|
||||||
let [min, nat] = this.parent(container, forWidth);
|
let [min, nat] = this.parent(container, forWidth);
|
||||||
@ -218,7 +218,7 @@ var LabelExpanderLayout = new Lang.Class({
|
|||||||
GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE,
|
GObject.ParamFlags.READABLE | GObject.ParamFlags.WRITABLE,
|
||||||
0, 1, 0)},
|
0, 1, 0)},
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
this._expansion = 0;
|
this._expansion = 0;
|
||||||
this._expandLines = DEFAULT_EXPAND_LINES;
|
this._expandLines = DEFAULT_EXPAND_LINES;
|
||||||
|
|
||||||
@ -250,11 +250,11 @@ var LabelExpanderLayout = new Lang.Class({
|
|||||||
this.layout_changed();
|
this.layout_changed();
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_set_container: function(container) {
|
vfunc_set_container(container) {
|
||||||
this._container = container;
|
this._container = container;
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_width: function(container, forHeight) {
|
vfunc_get_preferred_width(container, forHeight) {
|
||||||
let [min, nat] = [0, 0];
|
let [min, nat] = [0, 0];
|
||||||
|
|
||||||
for (let i = 0; i < container.get_n_children(); i++) {
|
for (let i = 0; i < container.get_n_children(); i++) {
|
||||||
@ -269,7 +269,7 @@ var LabelExpanderLayout = new Lang.Class({
|
|||||||
return [min, nat];
|
return [min, nat];
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_height: function(container, forWidth) {
|
vfunc_get_preferred_height(container, forWidth) {
|
||||||
let [min, nat] = [0, 0];
|
let [min, nat] = [0, 0];
|
||||||
|
|
||||||
let children = container.get_children();
|
let children = container.get_children();
|
||||||
@ -287,7 +287,7 @@ var LabelExpanderLayout = new Lang.Class({
|
|||||||
return [min, nat];
|
return [min, nat];
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_allocate: function(container, box, flags) {
|
vfunc_allocate(container, box, flags) {
|
||||||
for (let i = 0; i < container.get_n_children(); i++) {
|
for (let i = 0; i < container.get_n_children(); i++) {
|
||||||
let child = container.get_child_at_index(i);
|
let child = container.get_child_at_index(i);
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ var LabelExpanderLayout = new Lang.Class({
|
|||||||
var Message = new Lang.Class({
|
var Message = new Lang.Class({
|
||||||
Name: 'Message',
|
Name: 'Message',
|
||||||
|
|
||||||
_init: function(title, body) {
|
_init(title, body) {
|
||||||
this.expanded = false;
|
this.expanded = false;
|
||||||
|
|
||||||
this._useBodyMarkup = false;
|
this._useBodyMarkup = false;
|
||||||
@ -369,25 +369,25 @@ var Message = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function() {
|
close() {
|
||||||
this.emit('close');
|
this.emit('close');
|
||||||
},
|
},
|
||||||
|
|
||||||
setIcon: function(actor) {
|
setIcon(actor) {
|
||||||
this._iconBin.child = actor;
|
this._iconBin.child = actor;
|
||||||
this._iconBin.visible = (actor != null);
|
this._iconBin.visible = (actor != null);
|
||||||
},
|
},
|
||||||
|
|
||||||
setSecondaryActor: function(actor) {
|
setSecondaryActor(actor) {
|
||||||
this._secondaryBin.child = actor;
|
this._secondaryBin.child = actor;
|
||||||
},
|
},
|
||||||
|
|
||||||
setTitle: function(text) {
|
setTitle(text) {
|
||||||
let title = text ? _fixMarkup(text.replace(/\n/g, ' '), false) : '';
|
let title = text ? _fixMarkup(text.replace(/\n/g, ' '), false) : '';
|
||||||
this.titleLabel.clutter_text.set_markup(title);
|
this.titleLabel.clutter_text.set_markup(title);
|
||||||
},
|
},
|
||||||
|
|
||||||
setBody: function(text) {
|
setBody(text) {
|
||||||
this._bodyText = text;
|
this._bodyText = text;
|
||||||
this.bodyLabel.setMarkup(text ? text.replace(/\n/g, ' ') : '',
|
this.bodyLabel.setMarkup(text ? text.replace(/\n/g, ' ') : '',
|
||||||
this._useBodyMarkup);
|
this._useBodyMarkup);
|
||||||
@ -395,7 +395,7 @@ var Message = new Lang.Class({
|
|||||||
this._expandedLabel.setMarkup(text, this._useBodyMarkup);
|
this._expandedLabel.setMarkup(text, this._useBodyMarkup);
|
||||||
},
|
},
|
||||||
|
|
||||||
setUseBodyMarkup: function(enable) {
|
setUseBodyMarkup(enable) {
|
||||||
if (this._useBodyMarkup === enable)
|
if (this._useBodyMarkup === enable)
|
||||||
return;
|
return;
|
||||||
this._useBodyMarkup = enable;
|
this._useBodyMarkup = enable;
|
||||||
@ -403,7 +403,7 @@ var Message = new Lang.Class({
|
|||||||
this.setBody(this._bodyText);
|
this.setBody(this._bodyText);
|
||||||
},
|
},
|
||||||
|
|
||||||
setActionArea: function(actor) {
|
setActionArea(actor) {
|
||||||
if (actor == null) {
|
if (actor == null) {
|
||||||
if (this._actionBin.get_n_children() > 0)
|
if (this._actionBin.get_n_children() > 0)
|
||||||
this._actionBin.get_child_at_index(0).destroy();
|
this._actionBin.get_child_at_index(0).destroy();
|
||||||
@ -417,7 +417,7 @@ var Message = new Lang.Class({
|
|||||||
this._actionBin.visible = this.expanded;
|
this._actionBin.visible = this.expanded;
|
||||||
},
|
},
|
||||||
|
|
||||||
addMediaControl: function(iconName, callback) {
|
addMediaControl(iconName, callback) {
|
||||||
let icon = new St.Icon({ icon_name: iconName, icon_size: 16 });
|
let icon = new St.Icon({ icon_name: iconName, icon_size: 16 });
|
||||||
let button = new St.Button({ style_class: 'message-media-control',
|
let button = new St.Button({ style_class: 'message-media-control',
|
||||||
child: icon });
|
child: icon });
|
||||||
@ -426,7 +426,7 @@ var Message = new Lang.Class({
|
|||||||
return button;
|
return button;
|
||||||
},
|
},
|
||||||
|
|
||||||
setExpandedBody: function(actor) {
|
setExpandedBody(actor) {
|
||||||
if (actor == null) {
|
if (actor == null) {
|
||||||
if (this._bodyStack.get_n_children() > 1)
|
if (this._bodyStack.get_n_children() > 1)
|
||||||
this._bodyStack.get_child_at_index(1).destroy();
|
this._bodyStack.get_child_at_index(1).destroy();
|
||||||
@ -439,11 +439,11 @@ var Message = new Lang.Class({
|
|||||||
this._bodyStack.insert_child_at_index(actor, 1);
|
this._bodyStack.insert_child_at_index(actor, 1);
|
||||||
},
|
},
|
||||||
|
|
||||||
setExpandedLines: function(nLines) {
|
setExpandedLines(nLines) {
|
||||||
this._bodyStack.layout_manager.expandLines = nLines;
|
this._bodyStack.layout_manager.expandLines = nLines;
|
||||||
},
|
},
|
||||||
|
|
||||||
expand: function(animate) {
|
expand(animate) {
|
||||||
this.expanded = true;
|
this.expanded = true;
|
||||||
|
|
||||||
this._actionBin.visible = (this._actionBin.get_n_children() > 0);
|
this._actionBin.visible = (this._actionBin.get_n_children() > 0);
|
||||||
@ -472,7 +472,7 @@ var Message = new Lang.Class({
|
|||||||
this.emit('expanded');
|
this.emit('expanded');
|
||||||
},
|
},
|
||||||
|
|
||||||
unexpand: function(animate) {
|
unexpand(animate) {
|
||||||
if (animate) {
|
if (animate) {
|
||||||
Tweener.addTween(this._bodyStack.layout_manager,
|
Tweener.addTween(this._bodyStack.layout_manager,
|
||||||
{ expansion: 0,
|
{ expansion: 0,
|
||||||
@ -483,7 +483,7 @@ var Message = new Lang.Class({
|
|||||||
time: MessageTray.ANIMATION_TIME,
|
time: MessageTray.ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onCompleteScope: this,
|
onCompleteScope: this,
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
this._actionBin.hide();
|
this._actionBin.hide();
|
||||||
this.expanded = false;
|
this.expanded = false;
|
||||||
}});
|
}});
|
||||||
@ -496,22 +496,22 @@ var Message = new Lang.Class({
|
|||||||
this.emit('unexpanded');
|
this.emit('unexpanded');
|
||||||
},
|
},
|
||||||
|
|
||||||
canClose: function() {
|
canClose() {
|
||||||
return this._mediaControls.get_n_children() == 0;
|
return this._mediaControls.get_n_children() == 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let visible = this.actor.hover && this.canClose();
|
let visible = this.actor.hover && this.canClose();
|
||||||
this._closeButton.opacity = visible ? 255 : 0;
|
this._closeButton.opacity = visible ? 255 : 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onClicked: function() {
|
_onClicked() {
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyPressed: function(a, event) {
|
_onKeyPressed(a, event) {
|
||||||
let keysym = event.get_key_symbol();
|
let keysym = event.get_key_symbol();
|
||||||
|
|
||||||
if (keysym == Clutter.KEY_Delete ||
|
if (keysym == Clutter.KEY_Delete ||
|
||||||
@ -527,7 +527,7 @@ Signals.addSignalMethods(Message.prototype);
|
|||||||
var MessageListSection = new Lang.Class({
|
var MessageListSection = new Lang.Class({
|
||||||
Name: 'MessageListSection',
|
Name: 'MessageListSection',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.BoxLayout({ style_class: 'message-list-section',
|
this.actor = new St.BoxLayout({ style_class: 'message-list-section',
|
||||||
clip_to_allocation: true,
|
clip_to_allocation: true,
|
||||||
x_expand: true, vertical: true });
|
x_expand: true, vertical: true });
|
||||||
@ -552,7 +552,7 @@ var MessageListSection = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyFocusIn: function(actor) {
|
_onKeyFocusIn(actor) {
|
||||||
this.emit('key-focus-in', actor);
|
this.emit('key-focus-in', actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -560,18 +560,18 @@ var MessageListSection = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
setDate: function(date) {
|
setDate(date) {
|
||||||
if (Calendar.sameDay(date, this._date))
|
if (Calendar.sameDay(date, this._date))
|
||||||
return;
|
return;
|
||||||
this._date = date;
|
this._date = date;
|
||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
addMessage: function(message, animate) {
|
addMessage(message, animate) {
|
||||||
this.addMessageAtIndex(message, -1, animate);
|
this.addMessageAtIndex(message, -1, animate);
|
||||||
},
|
},
|
||||||
|
|
||||||
addMessageAtIndex: function(message, index, animate) {
|
addMessageAtIndex(message, index, animate) {
|
||||||
let obj = {
|
let obj = {
|
||||||
container: null,
|
container: null,
|
||||||
destroyId: 0,
|
destroyId: 0,
|
||||||
@ -606,7 +606,7 @@ var MessageListSection = new Lang.Class({
|
|||||||
transition: 'easeOutQuad' });
|
transition: 'easeOutQuad' });
|
||||||
},
|
},
|
||||||
|
|
||||||
moveMessage: function(message, index, animate) {
|
moveMessage(message, index, animate) {
|
||||||
let obj = this._messages.get(message);
|
let obj = this._messages.get(message);
|
||||||
|
|
||||||
if (!animate) {
|
if (!animate) {
|
||||||
@ -628,7 +628,7 @@ var MessageListSection = new Lang.Class({
|
|||||||
onComplete: onComplete });
|
onComplete: onComplete });
|
||||||
},
|
},
|
||||||
|
|
||||||
removeMessage: function(message, animate) {
|
removeMessage(message, animate) {
|
||||||
let obj = this._messages.get(message);
|
let obj = this._messages.get(message);
|
||||||
|
|
||||||
message.actor.disconnect(obj.destroyId);
|
message.actor.disconnect(obj.destroyId);
|
||||||
@ -641,7 +641,7 @@ var MessageListSection = new Lang.Class({
|
|||||||
Tweener.addTween(obj.container, { scale_x: 0, scale_y: 0,
|
Tweener.addTween(obj.container, { scale_x: 0, scale_y: 0,
|
||||||
time: MESSAGE_ANIMATION_TIME,
|
time: MESSAGE_ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
obj.container.destroy();
|
obj.container.destroy();
|
||||||
global.sync_pointer();
|
global.sync_pointer();
|
||||||
}});
|
}});
|
||||||
@ -651,7 +651,7 @@ var MessageListSection = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
clear: function() {
|
clear() {
|
||||||
let messages = [...this._messages.keys()].filter(function(message) {
|
let messages = [...this._messages.keys()].filter(function(message) {
|
||||||
return message.canClose();
|
return message.canClose();
|
||||||
});
|
});
|
||||||
@ -674,25 +674,25 @@ var MessageListSection = new Lang.Class({
|
|||||||
time: MESSAGE_ANIMATION_TIME,
|
time: MESSAGE_ANIMATION_TIME,
|
||||||
delay: i * delay,
|
delay: i * delay,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
message.close();
|
message.close();
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_canClear: function() {
|
_canClear() {
|
||||||
for (let message of this._messages.keys())
|
for (let message of this._messages.keys())
|
||||||
if (message.canClose())
|
if (message.canClose())
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_shouldShow: function() {
|
_shouldShow() {
|
||||||
return !this.empty;
|
return !this.empty;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let empty = this._list.get_n_children() == 0;
|
let empty = this._list.get_n_children() == 0;
|
||||||
let changed = this.empty !== empty;
|
let changed = this.empty !== empty;
|
||||||
this.empty = empty;
|
this.empty = empty;
|
||||||
|
@ -72,14 +72,14 @@ var Urgency = {
|
|||||||
var FocusGrabber = new Lang.Class({
|
var FocusGrabber = new Lang.Class({
|
||||||
Name: 'FocusGrabber',
|
Name: 'FocusGrabber',
|
||||||
|
|
||||||
_init: function(actor) {
|
_init(actor) {
|
||||||
this._actor = actor;
|
this._actor = actor;
|
||||||
this._prevKeyFocusActor = null;
|
this._prevKeyFocusActor = null;
|
||||||
this._focusActorChangedId = 0;
|
this._focusActorChangedId = 0;
|
||||||
this._focused = false;
|
this._focused = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
grabFocus: function() {
|
grabFocus() {
|
||||||
if (this._focused)
|
if (this._focused)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ var FocusGrabber = new Lang.Class({
|
|||||||
this._focused = true;
|
this._focused = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_focusUngrabbed: function() {
|
_focusUngrabbed() {
|
||||||
if (!this._focused)
|
if (!this._focused)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -106,13 +106,13 @@ var FocusGrabber = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_focusActorChanged: function() {
|
_focusActorChanged() {
|
||||||
let focusedActor = global.stage.get_key_focus();
|
let focusedActor = global.stage.get_key_focus();
|
||||||
if (!focusedActor || !this._actor.contains(focusedActor))
|
if (!focusedActor || !this._actor.contains(focusedActor))
|
||||||
this._focusUngrabbed();
|
this._focusUngrabbed();
|
||||||
},
|
},
|
||||||
|
|
||||||
ungrabFocus: function() {
|
ungrabFocus() {
|
||||||
if (!this._focusUngrabbed())
|
if (!this._focusUngrabbed())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ var FocusGrabber = new Lang.Class({
|
|||||||
var NotificationPolicy = new Lang.Class({
|
var NotificationPolicy = new Lang.Class({
|
||||||
Name: 'NotificationPolicy',
|
Name: 'NotificationPolicy',
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
params = Params.parse(params, { enable: true,
|
params = Params.parse(params, { enable: true,
|
||||||
enableSound: true,
|
enableSound: true,
|
||||||
showBanners: true,
|
showBanners: true,
|
||||||
@ -148,8 +148,8 @@ var NotificationPolicy = new Lang.Class({
|
|||||||
|
|
||||||
// Do nothing for the default policy. These methods are only useful for the
|
// Do nothing for the default policy. These methods are only useful for the
|
||||||
// GSettings policy.
|
// GSettings policy.
|
||||||
store: function() { },
|
store() { },
|
||||||
destroy: function() { }
|
destroy() { }
|
||||||
});
|
});
|
||||||
Signals.addSignalMethods(NotificationPolicy.prototype);
|
Signals.addSignalMethods(NotificationPolicy.prototype);
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ var NotificationGenericPolicy = new Lang.Class({
|
|||||||
Name: 'NotificationGenericPolicy',
|
Name: 'NotificationGenericPolicy',
|
||||||
Extends: NotificationPolicy,
|
Extends: NotificationPolicy,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
// Don't chain to parent, it would try setting
|
// Don't chain to parent, it would try setting
|
||||||
// our properties to the defaults
|
// our properties to the defaults
|
||||||
|
|
||||||
@ -167,13 +167,13 @@ var NotificationGenericPolicy = new Lang.Class({
|
|||||||
this._masterSettings.connect('changed', Lang.bind(this, this._changed));
|
this._masterSettings.connect('changed', Lang.bind(this, this._changed));
|
||||||
},
|
},
|
||||||
|
|
||||||
store: function() { },
|
store() { },
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this._masterSettings.run_dispose();
|
this._masterSettings.run_dispose();
|
||||||
},
|
},
|
||||||
|
|
||||||
_changed: function(settings, key) {
|
_changed(settings, key) {
|
||||||
this.emit('policy-changed', key);
|
this.emit('policy-changed', key);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ var NotificationApplicationPolicy = new Lang.Class({
|
|||||||
Name: 'NotificationApplicationPolicy',
|
Name: 'NotificationApplicationPolicy',
|
||||||
Extends: NotificationPolicy,
|
Extends: NotificationPolicy,
|
||||||
|
|
||||||
_init: function(id) {
|
_init(id) {
|
||||||
// Don't chain to parent, it would try setting
|
// Don't chain to parent, it would try setting
|
||||||
// our properties to the defaults
|
// our properties to the defaults
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ var NotificationApplicationPolicy = new Lang.Class({
|
|||||||
this._settings.connect('changed', Lang.bind(this, this._changed));
|
this._settings.connect('changed', Lang.bind(this, this._changed));
|
||||||
},
|
},
|
||||||
|
|
||||||
store: function() {
|
store() {
|
||||||
this._settings.set_string('application-id', this.id + '.desktop');
|
this._settings.set_string('application-id', this.id + '.desktop');
|
||||||
|
|
||||||
let apps = this._masterSettings.get_strv('application-children');
|
let apps = this._masterSettings.get_strv('application-children');
|
||||||
@ -231,18 +231,18 @@ var NotificationApplicationPolicy = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this._masterSettings.run_dispose();
|
this._masterSettings.run_dispose();
|
||||||
this._settings.run_dispose();
|
this._settings.run_dispose();
|
||||||
},
|
},
|
||||||
|
|
||||||
_changed: function(settings, key) {
|
_changed(settings, key) {
|
||||||
this.emit('policy-changed', key);
|
this.emit('policy-changed', key);
|
||||||
if (key == 'enable')
|
if (key == 'enable')
|
||||||
this.emit('enable-changed');
|
this.emit('enable-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_canonicalizeId: function(id) {
|
_canonicalizeId(id) {
|
||||||
// Keys are restricted to lowercase alphanumeric characters and dash,
|
// Keys are restricted to lowercase alphanumeric characters and dash,
|
||||||
// and two dashes cannot be in succession
|
// and two dashes cannot be in succession
|
||||||
return id.toLowerCase().replace(/[^a-z0-9\-]/g, '-').replace(/--+/g, '-');
|
return id.toLowerCase().replace(/[^a-z0-9\-]/g, '-').replace(/--+/g, '-');
|
||||||
@ -331,7 +331,7 @@ var NotificationApplicationPolicy = new Lang.Class({
|
|||||||
var Notification = new Lang.Class({
|
var Notification = new Lang.Class({
|
||||||
Name: 'Notification',
|
Name: 'Notification',
|
||||||
|
|
||||||
_init: function(source, title, banner, params) {
|
_init(source, title, banner, params) {
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.urgency = Urgency.NORMAL;
|
this.urgency = Urgency.NORMAL;
|
||||||
@ -363,7 +363,7 @@ var Notification = new Lang.Class({
|
|||||||
// Updates the notification by regenerating its icon and updating
|
// Updates the notification by regenerating its icon and updating
|
||||||
// the title/banner. If @params.clear is %true, it will also
|
// the title/banner. If @params.clear is %true, it will also
|
||||||
// remove any additional actors/action buttons previously added.
|
// remove any additional actors/action buttons previously added.
|
||||||
update: function(title, banner, params) {
|
update(title, banner, params) {
|
||||||
params = Params.parse(params, { gicon: null,
|
params = Params.parse(params, { gicon: null,
|
||||||
secondaryGIcon: null,
|
secondaryGIcon: null,
|
||||||
bannerMarkup: false,
|
bannerMarkup: false,
|
||||||
@ -403,7 +403,7 @@ var Notification = new Lang.Class({
|
|||||||
// addAction:
|
// addAction:
|
||||||
// @label: the label for the action's button
|
// @label: the label for the action's button
|
||||||
// @callback: the callback for the action
|
// @callback: the callback for the action
|
||||||
addAction: function(label, callback) {
|
addAction(label, callback) {
|
||||||
this.actions.push({ label: label, callback: callback });
|
this.actions.push({ label: label, callback: callback });
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -418,23 +418,23 @@ var Notification = new Lang.Class({
|
|||||||
this.emit('acknowledged-changed');
|
this.emit('acknowledged-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
setUrgency: function(urgency) {
|
setUrgency(urgency) {
|
||||||
this.urgency = urgency;
|
this.urgency = urgency;
|
||||||
},
|
},
|
||||||
|
|
||||||
setResident: function(resident) {
|
setResident(resident) {
|
||||||
this.resident = resident;
|
this.resident = resident;
|
||||||
},
|
},
|
||||||
|
|
||||||
setTransient: function(isTransient) {
|
setTransient(isTransient) {
|
||||||
this.isTransient = isTransient;
|
this.isTransient = isTransient;
|
||||||
},
|
},
|
||||||
|
|
||||||
setForFeedback: function(forFeedback) {
|
setForFeedback(forFeedback) {
|
||||||
this.forFeedback = forFeedback;
|
this.forFeedback = forFeedback;
|
||||||
},
|
},
|
||||||
|
|
||||||
playSound: function() {
|
playSound() {
|
||||||
if (this._soundPlayed)
|
if (this._soundPlayed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -471,17 +471,17 @@ var Notification = new Lang.Class({
|
|||||||
// the source (which will create a NotificationBanner),
|
// the source (which will create a NotificationBanner),
|
||||||
// so customization can be done by subclassing either
|
// so customization can be done by subclassing either
|
||||||
// Notification or Source
|
// Notification or Source
|
||||||
createBanner: function() {
|
createBanner() {
|
||||||
return this.source.createBanner(this);
|
return this.source.createBanner(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function() {
|
activate() {
|
||||||
this.emit('activated');
|
this.emit('activated');
|
||||||
if (!this.resident)
|
if (!this.resident)
|
||||||
this.destroy();
|
this.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function(reason) {
|
destroy(reason) {
|
||||||
if (!reason)
|
if (!reason)
|
||||||
reason = NotificationDestroyedReason.DISMISSED;
|
reason = NotificationDestroyedReason.DISMISSED;
|
||||||
this.emit('destroy', reason);
|
this.emit('destroy', reason);
|
||||||
@ -493,7 +493,7 @@ var NotificationBanner = new Lang.Class({
|
|||||||
Name: 'NotificationBanner',
|
Name: 'NotificationBanner',
|
||||||
Extends: Calendar.NotificationMessage,
|
Extends: Calendar.NotificationMessage,
|
||||||
|
|
||||||
_init: function(notification) {
|
_init(notification) {
|
||||||
this.parent(notification);
|
this.parent(notification);
|
||||||
|
|
||||||
this.actor.can_focus = false;
|
this.actor.can_focus = false;
|
||||||
@ -514,12 +514,12 @@ var NotificationBanner = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this.parent();
|
this.parent();
|
||||||
this.notification.disconnect(this._activatedId);
|
this.notification.disconnect(this._activatedId);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUpdated: function(n, clear) {
|
_onUpdated(n, clear) {
|
||||||
this.parent(n, clear);
|
this.parent(n, clear);
|
||||||
|
|
||||||
if (clear) {
|
if (clear) {
|
||||||
@ -532,14 +532,14 @@ var NotificationBanner = new Lang.Class({
|
|||||||
this._addSecondaryIcon();
|
this._addSecondaryIcon();
|
||||||
},
|
},
|
||||||
|
|
||||||
_addActions: function() {
|
_addActions() {
|
||||||
this.notification.actions.forEach(Lang.bind(this,
|
this.notification.actions.forEach(Lang.bind(this,
|
||||||
function(action) {
|
function(action) {
|
||||||
this.addAction(action.label, action.callback);
|
this.addAction(action.label, action.callback);
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_addSecondaryIcon: function() {
|
_addSecondaryIcon() {
|
||||||
if (this.notification.secondaryGIcon) {
|
if (this.notification.secondaryGIcon) {
|
||||||
let icon = new St.Icon({ gicon: this.notification.secondaryGIcon,
|
let icon = new St.Icon({ gicon: this.notification.secondaryGIcon,
|
||||||
x_align: Clutter.ActorAlign.END });
|
x_align: Clutter.ActorAlign.END });
|
||||||
@ -547,7 +547,7 @@ var NotificationBanner = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addButton: function(button, callback) {
|
addButton(button, callback) {
|
||||||
if (!this._buttonBox) {
|
if (!this._buttonBox) {
|
||||||
this._buttonBox = new St.BoxLayout({ style_class: 'notification-actions',
|
this._buttonBox = new St.BoxLayout({ style_class: 'notification-actions',
|
||||||
x_expand: true });
|
x_expand: true });
|
||||||
@ -575,7 +575,7 @@ var NotificationBanner = new Lang.Class({
|
|||||||
return button;
|
return button;
|
||||||
},
|
},
|
||||||
|
|
||||||
addAction: function(label, callback) {
|
addAction(label, callback) {
|
||||||
let button = new St.Button({ style_class: 'notification-button',
|
let button = new St.Button({ style_class: 'notification-button',
|
||||||
label: label,
|
label: label,
|
||||||
x_expand: true,
|
x_expand: true,
|
||||||
@ -588,7 +588,7 @@ var NotificationBanner = new Lang.Class({
|
|||||||
var SourceActor = new Lang.Class({
|
var SourceActor = new Lang.Class({
|
||||||
Name: 'SourceActor',
|
Name: 'SourceActor',
|
||||||
|
|
||||||
_init: function(source, size) {
|
_init(source, size) {
|
||||||
this._source = source;
|
this._source = source;
|
||||||
this._size = size;
|
this._size = size;
|
||||||
|
|
||||||
@ -613,27 +613,27 @@ var SourceActor = new Lang.Class({
|
|||||||
this._updateIcon();
|
this._updateIcon();
|
||||||
},
|
},
|
||||||
|
|
||||||
setIcon: function(icon) {
|
setIcon(icon) {
|
||||||
this._iconBin.child = icon;
|
this._iconBin.child = icon;
|
||||||
this._iconSet = true;
|
this._iconSet = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredWidth: function (actor, forHeight, alloc) {
|
_getPreferredWidth(actor, forHeight, alloc) {
|
||||||
let [min, nat] = this._iconBin.get_preferred_width(forHeight);
|
let [min, nat] = this._iconBin.get_preferred_width(forHeight);
|
||||||
alloc.min_size = min; alloc.nat_size = nat;
|
alloc.min_size = min; alloc.nat_size = nat;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredHeight: function (actor, forWidth, alloc) {
|
_getPreferredHeight(actor, forWidth, alloc) {
|
||||||
let [min, nat] = this._iconBin.get_preferred_height(forWidth);
|
let [min, nat] = this._iconBin.get_preferred_height(forWidth);
|
||||||
alloc.min_size = min; alloc.nat_size = nat;
|
alloc.min_size = min; alloc.nat_size = nat;
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocate: function(actor, box, flags) {
|
_allocate(actor, box, flags) {
|
||||||
// the iconBin should fill our entire box
|
// the iconBin should fill our entire box
|
||||||
this._iconBin.allocate(box, flags);
|
this._iconBin.allocate(box, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateIcon: function() {
|
_updateIcon() {
|
||||||
if (this._actorDestroyed)
|
if (this._actorDestroyed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -646,7 +646,7 @@ var SourceActorWithLabel = new Lang.Class({
|
|||||||
Name: 'SourceActorWithLabel',
|
Name: 'SourceActorWithLabel',
|
||||||
Extends: SourceActor,
|
Extends: SourceActor,
|
||||||
|
|
||||||
_init: function(source, size) {
|
_init(source, size) {
|
||||||
this.parent(source, size);
|
this.parent(source, size);
|
||||||
|
|
||||||
this._counterLabel = new St.Label({ x_align: Clutter.ActorAlign.CENTER,
|
this._counterLabel = new St.Label({ x_align: Clutter.ActorAlign.CENTER,
|
||||||
@ -675,7 +675,7 @@ var SourceActorWithLabel = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocate: function(actor, box, flags) {
|
_allocate(actor, box, flags) {
|
||||||
this.parent(actor, box, flags);
|
this.parent(actor, box, flags);
|
||||||
|
|
||||||
let childBox = new Clutter.ActorBox();
|
let childBox = new Clutter.ActorBox();
|
||||||
@ -699,7 +699,7 @@ var SourceActorWithLabel = new Lang.Class({
|
|||||||
this._counterBin.allocate(childBox, flags);
|
this._counterBin.allocate(childBox, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCount: function() {
|
_updateCount() {
|
||||||
if (this._actorDestroyed)
|
if (this._actorDestroyed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -720,7 +720,7 @@ var Source = new Lang.Class({
|
|||||||
|
|
||||||
SOURCE_ICON_SIZE: 48,
|
SOURCE_ICON_SIZE: 48,
|
||||||
|
|
||||||
_init: function(title, iconName) {
|
_init(title, iconName) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.iconName = iconName;
|
this.iconName = iconName;
|
||||||
|
|
||||||
@ -743,36 +743,36 @@ var Source = new Lang.Class({
|
|||||||
return this.count > 1;
|
return this.count > 1;
|
||||||
},
|
},
|
||||||
|
|
||||||
countUpdated: function() {
|
countUpdated() {
|
||||||
this.emit('count-updated');
|
this.emit('count-updated');
|
||||||
},
|
},
|
||||||
|
|
||||||
_createPolicy: function() {
|
_createPolicy() {
|
||||||
return new NotificationPolicy();
|
return new NotificationPolicy();
|
||||||
},
|
},
|
||||||
|
|
||||||
setTitle: function(newTitle) {
|
setTitle(newTitle) {
|
||||||
this.title = newTitle;
|
this.title = newTitle;
|
||||||
this.emit('title-changed');
|
this.emit('title-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
createBanner: function(notification) {
|
createBanner(notification) {
|
||||||
return new NotificationBanner(notification);
|
return new NotificationBanner(notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Called to create a new icon actor.
|
// Called to create a new icon actor.
|
||||||
// Provides a sane default implementation, override if you need
|
// Provides a sane default implementation, override if you need
|
||||||
// something more fancy.
|
// something more fancy.
|
||||||
createIcon: function(size) {
|
createIcon(size) {
|
||||||
return new St.Icon({ gicon: this.getIcon(),
|
return new St.Icon({ gicon: this.getIcon(),
|
||||||
icon_size: size });
|
icon_size: size });
|
||||||
},
|
},
|
||||||
|
|
||||||
getIcon: function() {
|
getIcon() {
|
||||||
return new Gio.ThemedIcon({ name: this.iconName });
|
return new Gio.ThemedIcon({ name: this.iconName });
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNotificationDestroy: function(notification) {
|
_onNotificationDestroy(notification) {
|
||||||
let index = this.notifications.indexOf(notification);
|
let index = this.notifications.indexOf(notification);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return;
|
return;
|
||||||
@ -784,7 +784,7 @@ var Source = new Lang.Class({
|
|||||||
this.countUpdated();
|
this.countUpdated();
|
||||||
},
|
},
|
||||||
|
|
||||||
pushNotification: function(notification) {
|
pushNotification(notification) {
|
||||||
if (this.notifications.indexOf(notification) >= 0)
|
if (this.notifications.indexOf(notification) >= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -799,7 +799,7 @@ var Source = new Lang.Class({
|
|||||||
this.countUpdated();
|
this.countUpdated();
|
||||||
},
|
},
|
||||||
|
|
||||||
notify: function(notification) {
|
notify(notification) {
|
||||||
notification.acknowledged = false;
|
notification.acknowledged = false;
|
||||||
this.pushNotification(notification);
|
this.pushNotification(notification);
|
||||||
|
|
||||||
@ -810,7 +810,7 @@ var Source = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function(reason) {
|
destroy(reason) {
|
||||||
this.policy.destroy();
|
this.policy.destroy();
|
||||||
|
|
||||||
let notifications = this.notifications;
|
let notifications = this.notifications;
|
||||||
@ -822,15 +822,15 @@ var Source = new Lang.Class({
|
|||||||
this.emit('destroy', reason);
|
this.emit('destroy', reason);
|
||||||
},
|
},
|
||||||
|
|
||||||
iconUpdated: function() {
|
iconUpdated() {
|
||||||
this.emit('icon-updated');
|
this.emit('icon-updated');
|
||||||
},
|
},
|
||||||
|
|
||||||
// To be overridden by subclasses
|
// To be overridden by subclasses
|
||||||
open: function() {
|
open() {
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyNonResidentNotifications: function() {
|
destroyNonResidentNotifications() {
|
||||||
for (let i = this.notifications.length - 1; i >= 0; i--)
|
for (let i = this.notifications.length - 1; i >= 0; i--)
|
||||||
if (!this.notifications[i].resident)
|
if (!this.notifications[i].resident)
|
||||||
this.notifications[i].destroy();
|
this.notifications[i].destroy();
|
||||||
@ -843,7 +843,7 @@ Signals.addSignalMethods(Source.prototype);
|
|||||||
var MessageTray = new Lang.Class({
|
var MessageTray = new Lang.Class({
|
||||||
Name: 'MessageTray',
|
Name: 'MessageTray',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) {
|
this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) {
|
||||||
this._onStatusChanged(proxy.status);
|
this._onStatusChanged(proxy.status);
|
||||||
}));
|
}));
|
||||||
@ -953,15 +953,15 @@ var MessageTray = new Lang.Class({
|
|||||||
this._sessionUpdated();
|
this._sessionUpdated();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
this._updateState();
|
this._updateState();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragBegin: function() {
|
_onDragBegin() {
|
||||||
Shell.util_set_hidden_from_pick(this.actor, true);
|
Shell.util_set_hidden_from_pick(this.actor, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragEnd: function() {
|
_onDragEnd() {
|
||||||
Shell.util_set_hidden_from_pick(this.actor, false);
|
Shell.util_set_hidden_from_pick(this.actor, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -973,7 +973,7 @@ var MessageTray = new Lang.Class({
|
|||||||
this._bannerBin.set_x_align(align);
|
this._bannerBin.set_x_align(align);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNotificationKeyRelease: function(actor, event) {
|
_onNotificationKeyRelease(actor, event) {
|
||||||
if (event.get_key_symbol() == Clutter.KEY_Escape && event.get_state() == 0) {
|
if (event.get_key_symbol() == Clutter.KEY_Escape && event.get_state() == 0) {
|
||||||
this._expireNotification();
|
this._expireNotification();
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
@ -982,7 +982,7 @@ var MessageTray = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_expireNotification: function() {
|
_expireNotification() {
|
||||||
this._notificationExpired = true;
|
this._notificationExpired = true;
|
||||||
this._updateState();
|
this._updateState();
|
||||||
},
|
},
|
||||||
@ -998,11 +998,11 @@ var MessageTray = new Lang.Class({
|
|||||||
this._updateState();
|
this._updateState();
|
||||||
},
|
},
|
||||||
|
|
||||||
contains: function(source) {
|
contains(source) {
|
||||||
return this._sources.has(source);
|
return this._sources.has(source);
|
||||||
},
|
},
|
||||||
|
|
||||||
add: function(source) {
|
add(source) {
|
||||||
if (this.contains(source)) {
|
if (this.contains(source)) {
|
||||||
log('Trying to re-add source ' + source.title);
|
log('Trying to re-add source ' + source.title);
|
||||||
return;
|
return;
|
||||||
@ -1016,7 +1016,7 @@ var MessageTray = new Lang.Class({
|
|||||||
this._onSourceEnableChanged(source.policy, source);
|
this._onSourceEnableChanged(source.policy, source);
|
||||||
},
|
},
|
||||||
|
|
||||||
_addSource: function(source) {
|
_addSource(source) {
|
||||||
let obj = {
|
let obj = {
|
||||||
source: source,
|
source: source,
|
||||||
notifyId: 0,
|
notifyId: 0,
|
||||||
@ -1031,7 +1031,7 @@ var MessageTray = new Lang.Class({
|
|||||||
this.emit('source-added', source);
|
this.emit('source-added', source);
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeSource: function(source) {
|
_removeSource(source) {
|
||||||
let obj = this._sources.get(source);
|
let obj = this._sources.get(source);
|
||||||
this._sources.delete(source);
|
this._sources.delete(source);
|
||||||
|
|
||||||
@ -1041,11 +1041,11 @@ var MessageTray = new Lang.Class({
|
|||||||
this.emit('source-removed', source);
|
this.emit('source-removed', source);
|
||||||
},
|
},
|
||||||
|
|
||||||
getSources: function() {
|
getSources() {
|
||||||
return [...this._sources.keys()];
|
return [...this._sources.keys()];
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSourceEnableChanged: function(policy, source) {
|
_onSourceEnableChanged(policy, source) {
|
||||||
let wasEnabled = this.contains(source);
|
let wasEnabled = this.contains(source);
|
||||||
let shouldBeEnabled = policy.enable;
|
let shouldBeEnabled = policy.enable;
|
||||||
|
|
||||||
@ -1057,11 +1057,11 @@ var MessageTray = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSourceDestroy: function(source) {
|
_onSourceDestroy(source) {
|
||||||
this._removeSource(source);
|
this._removeSource(source);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNotificationDestroy: function(notification) {
|
_onNotificationDestroy(notification) {
|
||||||
if (this._notification == notification && (this._notificationState == State.SHOWN || this._notificationState == State.SHOWING)) {
|
if (this._notification == notification && (this._notificationState == State.SHOWN || this._notificationState == State.SHOWING)) {
|
||||||
this._updateNotificationTimeout(0);
|
this._updateNotificationTimeout(0);
|
||||||
this._notificationRemoved = true;
|
this._notificationRemoved = true;
|
||||||
@ -1076,7 +1076,7 @@ var MessageTray = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNotify: function(source, notification) {
|
_onNotify(source, notification) {
|
||||||
if (this._notification == notification) {
|
if (this._notification == notification) {
|
||||||
// If a notification that is being shown is updated, we update
|
// If a notification that is being shown is updated, we update
|
||||||
// how it is shown and extend the time until it auto-hides.
|
// how it is shown and extend the time until it auto-hides.
|
||||||
@ -1102,7 +1102,7 @@ var MessageTray = new Lang.Class({
|
|||||||
this._updateState();
|
this._updateState();
|
||||||
},
|
},
|
||||||
|
|
||||||
_resetNotificationLeftTimeout: function() {
|
_resetNotificationLeftTimeout() {
|
||||||
this._useLongerNotificationLeftTimeout = false;
|
this._useLongerNotificationLeftTimeout = false;
|
||||||
if (this._notificationLeftTimeoutId) {
|
if (this._notificationLeftTimeoutId) {
|
||||||
Mainloop.source_remove(this._notificationLeftTimeoutId);
|
Mainloop.source_remove(this._notificationLeftTimeoutId);
|
||||||
@ -1112,7 +1112,7 @@ var MessageTray = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNotificationHoverChanged: function() {
|
_onNotificationHoverChanged() {
|
||||||
if (this._bannerBin.hover == this._notificationHovered)
|
if (this._bannerBin.hover == this._notificationHovered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1156,7 +1156,7 @@ var MessageTray = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onStatusChanged: function(status) {
|
_onStatusChanged(status) {
|
||||||
if (status == GnomeSession.PresenceStatus.BUSY) {
|
if (status == GnomeSession.PresenceStatus.BUSY) {
|
||||||
// remove notification and allow the summary to be closed now
|
// remove notification and allow the summary to be closed now
|
||||||
this._updateNotificationTimeout(0);
|
this._updateNotificationTimeout(0);
|
||||||
@ -1171,7 +1171,7 @@ var MessageTray = new Lang.Class({
|
|||||||
this._updateState();
|
this._updateState();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNotificationLeftTimeout: function() {
|
_onNotificationLeftTimeout() {
|
||||||
let [x, y, mods] = global.get_pointer();
|
let [x, y, mods] = global.get_pointer();
|
||||||
// We extend the timeout once if the mouse moved no further than MOUSE_LEFT_ACTOR_THRESHOLD to either side.
|
// We extend the timeout once if the mouse moved no further than MOUSE_LEFT_ACTOR_THRESHOLD to either side.
|
||||||
if (this._notificationLeftMouseX > -1 &&
|
if (this._notificationLeftMouseX > -1 &&
|
||||||
@ -1193,7 +1193,7 @@ var MessageTray = new Lang.Class({
|
|||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_escapeTray: function() {
|
_escapeTray() {
|
||||||
this._pointerInNotification = false;
|
this._pointerInNotification = false;
|
||||||
this._updateNotificationTimeout(0);
|
this._updateNotificationTimeout(0);
|
||||||
this._updateState();
|
this._updateState();
|
||||||
@ -1204,7 +1204,7 @@ var MessageTray = new Lang.Class({
|
|||||||
// 'this._pointerInNotification', 'this._traySummoned', etc, and
|
// 'this._pointerInNotification', 'this._traySummoned', etc, and
|
||||||
// _updateState() figures out what (if anything) needs to be done
|
// _updateState() figures out what (if anything) needs to be done
|
||||||
// at the present time.
|
// at the present time.
|
||||||
_updateState: function() {
|
_updateState() {
|
||||||
let hasMonitor = Main.layoutManager.primaryMonitor != null;
|
let hasMonitor = Main.layoutManager.primaryMonitor != null;
|
||||||
this.actor.visible = !this._bannerBlocked && hasMonitor && this._banner != null;
|
this.actor.visible = !this._bannerBlocked && hasMonitor && this._banner != null;
|
||||||
if (this._bannerBlocked || !hasMonitor)
|
if (this._bannerBlocked || !hasMonitor)
|
||||||
@ -1262,7 +1262,7 @@ var MessageTray = new Lang.Class({
|
|||||||
this._notificationExpired = false;
|
this._notificationExpired = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_tween: function(actor, statevar, value, params) {
|
_tween(actor, statevar, value, params) {
|
||||||
let onComplete = params.onComplete;
|
let onComplete = params.onComplete;
|
||||||
let onCompleteScope = params.onCompleteScope;
|
let onCompleteScope = params.onCompleteScope;
|
||||||
let onCompleteParams = params.onCompleteParams;
|
let onCompleteParams = params.onCompleteParams;
|
||||||
@ -1279,24 +1279,24 @@ var MessageTray = new Lang.Class({
|
|||||||
this[statevar] = valuing;
|
this[statevar] = valuing;
|
||||||
},
|
},
|
||||||
|
|
||||||
_tweenComplete: function(statevar, value, onComplete, onCompleteScope, onCompleteParams) {
|
_tweenComplete(statevar, value, onComplete, onCompleteScope, onCompleteParams) {
|
||||||
this[statevar] = value;
|
this[statevar] = value;
|
||||||
if (onComplete)
|
if (onComplete)
|
||||||
onComplete.apply(onCompleteScope, onCompleteParams);
|
onComplete.apply(onCompleteScope, onCompleteParams);
|
||||||
this._updateState();
|
this._updateState();
|
||||||
},
|
},
|
||||||
|
|
||||||
_clampOpacity: function() {
|
_clampOpacity() {
|
||||||
this._bannerBin.opacity = Math.max(0, Math.min(this._bannerBin._opacity, 255));
|
this._bannerBin.opacity = Math.max(0, Math.min(this._bannerBin._opacity, 255));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onIdleMonitorBecameActive: function() {
|
_onIdleMonitorBecameActive() {
|
||||||
this._userActiveWhileNotificationShown = true;
|
this._userActiveWhileNotificationShown = true;
|
||||||
this._updateNotificationTimeout(2000);
|
this._updateNotificationTimeout(2000);
|
||||||
this._updateState();
|
this._updateState();
|
||||||
},
|
},
|
||||||
|
|
||||||
_showNotification: function() {
|
_showNotification() {
|
||||||
this._notification = this._notificationQueue.shift();
|
this._notification = this._notificationQueue.shift();
|
||||||
this.emit('queue-changed');
|
this.emit('queue-changed');
|
||||||
|
|
||||||
@ -1340,7 +1340,7 @@ var MessageTray = new Lang.Class({
|
|||||||
this._resetNotificationLeftTimeout();
|
this._resetNotificationLeftTimeout();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateShowingNotification: function() {
|
_updateShowingNotification() {
|
||||||
this._notification.acknowledged = true;
|
this._notification.acknowledged = true;
|
||||||
this._notification.playSound();
|
this._notification.playSound();
|
||||||
|
|
||||||
@ -1374,12 +1374,12 @@ var MessageTray = new Lang.Class({
|
|||||||
this._tween(this._bannerBin, '_notificationState', State.SHOWN, tweenParams);
|
this._tween(this._bannerBin, '_notificationState', State.SHOWN, tweenParams);
|
||||||
},
|
},
|
||||||
|
|
||||||
_showNotificationCompleted: function() {
|
_showNotificationCompleted() {
|
||||||
if (this._notification.urgency != Urgency.CRITICAL)
|
if (this._notification.urgency != Urgency.CRITICAL)
|
||||||
this._updateNotificationTimeout(NOTIFICATION_TIMEOUT * 1000);
|
this._updateNotificationTimeout(NOTIFICATION_TIMEOUT * 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateNotificationTimeout: function(timeout) {
|
_updateNotificationTimeout(timeout) {
|
||||||
if (this._notificationTimeoutId) {
|
if (this._notificationTimeoutId) {
|
||||||
Mainloop.source_remove(this._notificationTimeoutId);
|
Mainloop.source_remove(this._notificationTimeoutId);
|
||||||
this._notificationTimeoutId = 0;
|
this._notificationTimeoutId = 0;
|
||||||
@ -1392,7 +1392,7 @@ var MessageTray = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_notificationTimeout: function() {
|
_notificationTimeout() {
|
||||||
let [x, y, mods] = global.get_pointer();
|
let [x, y, mods] = global.get_pointer();
|
||||||
if (y < this._lastSeenMouseY - 10 && !this._notificationHovered) {
|
if (y < this._lastSeenMouseY - 10 && !this._notificationHovered) {
|
||||||
// The mouse is moving towards the notification, so don't
|
// The mouse is moving towards the notification, so don't
|
||||||
@ -1416,7 +1416,7 @@ var MessageTray = new Lang.Class({
|
|||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideNotification: function(animate) {
|
_hideNotification(animate) {
|
||||||
this._notificationFocusGrabber.ungrabFocus();
|
this._notificationFocusGrabber.ungrabFocus();
|
||||||
|
|
||||||
if (this._bannerClickedId) {
|
if (this._bannerClickedId) {
|
||||||
@ -1450,7 +1450,7 @@ var MessageTray = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideNotificationCompleted: function() {
|
_hideNotificationCompleted() {
|
||||||
let notification = this._notification;
|
let notification = this._notification;
|
||||||
this._notification = null;
|
this._notification = null;
|
||||||
if (notification.isTransient)
|
if (notification.isTransient)
|
||||||
@ -1464,14 +1464,14 @@ var MessageTray = new Lang.Class({
|
|||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_expandActiveNotification: function() {
|
_expandActiveNotification() {
|
||||||
if (!this._banner)
|
if (!this._banner)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._expandBanner(false);
|
this._expandBanner(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_expandBanner: function(autoExpanding) {
|
_expandBanner(autoExpanding) {
|
||||||
// Don't animate changes in notifications that are auto-expanding.
|
// Don't animate changes in notifications that are auto-expanding.
|
||||||
this._banner.expand(!autoExpanding);
|
this._banner.expand(!autoExpanding);
|
||||||
|
|
||||||
@ -1480,7 +1480,7 @@ var MessageTray = new Lang.Class({
|
|||||||
this._ensureBannerFocused();
|
this._ensureBannerFocused();
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureBannerFocused: function() {
|
_ensureBannerFocused() {
|
||||||
this._notificationFocusGrabber.grabFocus();
|
this._notificationFocusGrabber.grabFocus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1490,11 +1490,11 @@ var SystemNotificationSource = new Lang.Class({
|
|||||||
Name: 'SystemNotificationSource',
|
Name: 'SystemNotificationSource',
|
||||||
Extends: Source,
|
Extends: Source,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent(_("System Information"), 'dialog-information-symbolic');
|
this.parent(_("System Information"), 'dialog-information-symbolic');
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function() {
|
open() {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -34,7 +34,7 @@ var State = {
|
|||||||
var ModalDialog = new Lang.Class({
|
var ModalDialog = new Lang.Class({
|
||||||
Name: 'ModalDialog',
|
Name: 'ModalDialog',
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
params = Params.parse(params, { shellReactive: false,
|
params = Params.parse(params, { shellReactive: false,
|
||||||
styleClass: null,
|
styleClass: null,
|
||||||
actionMode: Shell.ActionMode.SYSTEM_MODAL,
|
actionMode: Shell.ActionMode.SYSTEM_MODAL,
|
||||||
@ -89,15 +89,15 @@ var ModalDialog = new Lang.Class({
|
|||||||
this._savedKeyFocus = null;
|
this._savedKeyFocus = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this._group.destroy();
|
this._group.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
clearButtons: function() {
|
clearButtons() {
|
||||||
this.dialogLayout.clearButtons();
|
this.dialogLayout.clearButtons();
|
||||||
},
|
},
|
||||||
|
|
||||||
setButtons: function(buttons) {
|
setButtons(buttons) {
|
||||||
this.clearButtons();
|
this.clearButtons();
|
||||||
|
|
||||||
for (let i = 0; i < buttons.length; i++) {
|
for (let i = 0; i < buttons.length; i++) {
|
||||||
@ -117,15 +117,15 @@ var ModalDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addButton: function (buttonInfo) {
|
addButton(buttonInfo) {
|
||||||
return this.dialogLayout.addButton(buttonInfo);
|
return this.dialogLayout.addButton(buttonInfo);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onGroupDestroy: function() {
|
_onGroupDestroy() {
|
||||||
this.emit('destroy');
|
this.emit('destroy');
|
||||||
},
|
},
|
||||||
|
|
||||||
_fadeOpen: function(onPrimary) {
|
_fadeOpen(onPrimary) {
|
||||||
if (onPrimary)
|
if (onPrimary)
|
||||||
this._monitorConstraint.primary = true;
|
this._monitorConstraint.primary = true;
|
||||||
else
|
else
|
||||||
@ -150,7 +150,7 @@ var ModalDialog = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
setInitialKeyFocus: function(actor) {
|
setInitialKeyFocus(actor) {
|
||||||
if (this._initialKeyFocusDestroyId)
|
if (this._initialKeyFocusDestroyId)
|
||||||
this._initialKeyFocus.disconnect(this._initialKeyFocusDestroyId);
|
this._initialKeyFocus.disconnect(this._initialKeyFocusDestroyId);
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ var ModalDialog = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function(timestamp, onPrimary) {
|
open(timestamp, onPrimary) {
|
||||||
if (this.state == State.OPENED || this.state == State.OPENING)
|
if (this.state == State.OPENED || this.state == State.OPENING)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ var ModalDialog = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_closeComplete: function() {
|
_closeComplete() {
|
||||||
this.state = State.CLOSED;
|
this.state = State.CLOSED;
|
||||||
this._group.hide();
|
this._group.hide();
|
||||||
this.emit('closed');
|
this.emit('closed');
|
||||||
@ -182,7 +182,7 @@ var ModalDialog = new Lang.Class({
|
|||||||
this.destroy();
|
this.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function(timestamp) {
|
close(timestamp) {
|
||||||
if (this.state == State.CLOSED || this.state == State.CLOSING)
|
if (this.state == State.CLOSED || this.state == State.CLOSING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ var ModalDialog = new Lang.Class({
|
|||||||
// Drop modal status without closing the dialog; this makes the
|
// Drop modal status without closing the dialog; this makes the
|
||||||
// dialog insensitive as well, so it needs to be followed shortly
|
// dialog insensitive as well, so it needs to be followed shortly
|
||||||
// by either a close() or a pushModal()
|
// by either a close() or a pushModal()
|
||||||
popModal: function(timestamp) {
|
popModal(timestamp) {
|
||||||
if (!this._hasModal)
|
if (!this._hasModal)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ var ModalDialog = new Lang.Class({
|
|||||||
this._eventBlocker.raise_top();
|
this._eventBlocker.raise_top();
|
||||||
},
|
},
|
||||||
|
|
||||||
pushModal: function (timestamp) {
|
pushModal(timestamp) {
|
||||||
if (this._hasModal)
|
if (this._hasModal)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ var ModalDialog = new Lang.Class({
|
|||||||
// e.g., if a user clicked "Log Out" then the dialog should go away
|
// e.g., if a user clicked "Log Out" then the dialog should go away
|
||||||
// imediately, but the lightbox should remain until the logout is
|
// imediately, but the lightbox should remain until the logout is
|
||||||
// complete.
|
// complete.
|
||||||
_fadeOutDialog: function(timestamp) {
|
_fadeOutDialog(timestamp) {
|
||||||
if (this.state == State.CLOSED || this.state == State.CLOSING)
|
if (this.state == State.CLOSED || this.state == State.CLOSING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ var MediaMessage = new Lang.Class({
|
|||||||
Name: 'MediaMessage',
|
Name: 'MediaMessage',
|
||||||
Extends: MessageList.Message,
|
Extends: MessageList.Message,
|
||||||
|
|
||||||
_init: function(player) {
|
_init(player) {
|
||||||
this._player = player;
|
this._player = player;
|
||||||
|
|
||||||
this.parent('', '');
|
this.parent('', '');
|
||||||
@ -79,16 +79,16 @@ var MediaMessage = new Lang.Class({
|
|||||||
this._update();
|
this._update();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onClicked: function() {
|
_onClicked() {
|
||||||
this._player.raise();
|
this._player.raise();
|
||||||
Main.panel.closeCalendar();
|
Main.panel.closeCalendar();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateNavButton: function(button, sensitive) {
|
_updateNavButton(button, sensitive) {
|
||||||
button.reactive = sensitive;
|
button.reactive = sensitive;
|
||||||
},
|
},
|
||||||
|
|
||||||
_update: function() {
|
_update() {
|
||||||
this.setTitle(this._player.trackArtists.join(', '));
|
this.setTitle(this._player.trackArtists.join(', '));
|
||||||
this.setBody(this._player.trackTitle);
|
this.setBody(this._player.trackTitle);
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ var MediaMessage = new Lang.Class({
|
|||||||
var MprisPlayer = new Lang.Class({
|
var MprisPlayer = new Lang.Class({
|
||||||
Name: 'MprisPlayer',
|
Name: 'MprisPlayer',
|
||||||
|
|
||||||
_init: function(busName) {
|
_init(busName) {
|
||||||
this._mprisProxy = new MprisProxy(Gio.DBus.session, busName,
|
this._mprisProxy = new MprisProxy(Gio.DBus.session, busName,
|
||||||
'/org/mpris/MediaPlayer2',
|
'/org/mpris/MediaPlayer2',
|
||||||
Lang.bind(this, this._onMprisProxyReady));
|
Lang.bind(this, this._onMprisProxyReady));
|
||||||
@ -144,7 +144,7 @@ var MprisPlayer = new Lang.Class({
|
|||||||
return this._trackCoverUrl;
|
return this._trackCoverUrl;
|
||||||
},
|
},
|
||||||
|
|
||||||
playPause: function() {
|
playPause() {
|
||||||
this._playerProxy.PlayPauseRemote();
|
this._playerProxy.PlayPauseRemote();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ var MprisPlayer = new Lang.Class({
|
|||||||
return this._playerProxy.CanGoNext;
|
return this._playerProxy.CanGoNext;
|
||||||
},
|
},
|
||||||
|
|
||||||
next: function() {
|
next() {
|
||||||
this._playerProxy.NextRemote();
|
this._playerProxy.NextRemote();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -160,11 +160,11 @@ var MprisPlayer = new Lang.Class({
|
|||||||
return this._playerProxy.CanGoPrevious;
|
return this._playerProxy.CanGoPrevious;
|
||||||
},
|
},
|
||||||
|
|
||||||
previous: function() {
|
previous() {
|
||||||
this._playerProxy.PreviousRemote();
|
this._playerProxy.PreviousRemote();
|
||||||
},
|
},
|
||||||
|
|
||||||
raise: function() {
|
raise() {
|
||||||
// The remote Raise() method may run into focus stealing prevention,
|
// The remote Raise() method may run into focus stealing prevention,
|
||||||
// so prefer activating the app via .desktop file if possible
|
// so prefer activating the app via .desktop file if possible
|
||||||
let app = null;
|
let app = null;
|
||||||
@ -179,7 +179,7 @@ var MprisPlayer = new Lang.Class({
|
|||||||
this._mprisProxy.RaiseRemote();
|
this._mprisProxy.RaiseRemote();
|
||||||
},
|
},
|
||||||
|
|
||||||
_close: function() {
|
_close() {
|
||||||
this._mprisProxy.disconnect(this._ownerNotifyId);
|
this._mprisProxy.disconnect(this._ownerNotifyId);
|
||||||
this._mprisProxy = null;
|
this._mprisProxy = null;
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ var MprisPlayer = new Lang.Class({
|
|||||||
this.emit('closed');
|
this.emit('closed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMprisProxyReady: function() {
|
_onMprisProxyReady() {
|
||||||
this._ownerNotifyId = this._mprisProxy.connect('notify::g-name-owner',
|
this._ownerNotifyId = this._mprisProxy.connect('notify::g-name-owner',
|
||||||
Lang.bind(this, function() {
|
Lang.bind(this, function() {
|
||||||
if (!this._mprisProxy.g_name_owner)
|
if (!this._mprisProxy.g_name_owner)
|
||||||
@ -197,13 +197,13 @@ var MprisPlayer = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPlayerProxyReady: function() {
|
_onPlayerProxyReady() {
|
||||||
this._propsChangedId = this._playerProxy.connect('g-properties-changed',
|
this._propsChangedId = this._playerProxy.connect('g-properties-changed',
|
||||||
Lang.bind(this, this._updateState));
|
Lang.bind(this, this._updateState));
|
||||||
this._updateState();
|
this._updateState();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateState: function() {
|
_updateState() {
|
||||||
let metadata = {};
|
let metadata = {};
|
||||||
for (let prop in this._playerProxy.Metadata)
|
for (let prop in this._playerProxy.Metadata)
|
||||||
metadata[prop] = this._playerProxy.Metadata[prop].deep_unpack();
|
metadata[prop] = this._playerProxy.Metadata[prop].deep_unpack();
|
||||||
@ -230,7 +230,7 @@ var MediaSection = new Lang.Class({
|
|||||||
Name: 'MediaSection',
|
Name: 'MediaSection',
|
||||||
Extends: MessageList.MessageListSection,
|
Extends: MessageList.MessageListSection,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._players = new Map();
|
this._players = new Map();
|
||||||
@ -241,11 +241,11 @@ var MediaSection = new Lang.Class({
|
|||||||
Lang.bind(this, this._onProxyReady));
|
Lang.bind(this, this._onProxyReady));
|
||||||
},
|
},
|
||||||
|
|
||||||
_shouldShow: function() {
|
_shouldShow() {
|
||||||
return !this.empty && Calendar.isToday(this._date);
|
return !this.empty && Calendar.isToday(this._date);
|
||||||
},
|
},
|
||||||
|
|
||||||
_addPlayer: function(busName) {
|
_addPlayer(busName) {
|
||||||
if (this._players.get(busName))
|
if (this._players.get(busName))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ var MediaSection = new Lang.Class({
|
|||||||
this._players.set(busName, player);
|
this._players.set(busName, player);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onProxyReady: function() {
|
_onProxyReady() {
|
||||||
this._proxy.ListNamesRemote(Lang.bind(this,
|
this._proxy.ListNamesRemote(Lang.bind(this,
|
||||||
function([names]) {
|
function([names]) {
|
||||||
names.forEach(Lang.bind(this,
|
names.forEach(Lang.bind(this,
|
||||||
@ -277,7 +277,7 @@ var MediaSection = new Lang.Class({
|
|||||||
Lang.bind(this, this._onNameOwnerChanged));
|
Lang.bind(this, this._onNameOwnerChanged));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNameOwnerChanged: function(proxy, sender, [name, oldOwner, newOwner]) {
|
_onNameOwnerChanged(proxy, sender, [name, oldOwner, newOwner]) {
|
||||||
if (!name.startsWith(MPRIS_PLAYER_PREFIX))
|
if (!name.startsWith(MPRIS_PLAYER_PREFIX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ const rewriteRules = {
|
|||||||
var FdoNotificationDaemon = new Lang.Class({
|
var FdoNotificationDaemon = new Lang.Class({
|
||||||
Name: 'FdoNotificationDaemon',
|
Name: 'FdoNotificationDaemon',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(FdoNotificationsIface, this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(FdoNotificationsIface, this);
|
||||||
this._dbusImpl.export(Gio.DBus.session, '/org/freedesktop/Notifications');
|
this._dbusImpl.export(Gio.DBus.session, '/org/freedesktop/Notifications');
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
|||||||
Lang.bind(this, this._onFocusAppChanged));
|
Lang.bind(this, this._onFocusAppChanged));
|
||||||
},
|
},
|
||||||
|
|
||||||
_imageForNotificationData: function(hints) {
|
_imageForNotificationData(hints) {
|
||||||
if (hints['image-data']) {
|
if (hints['image-data']) {
|
||||||
let [width, height, rowStride, hasAlpha,
|
let [width, height, rowStride, hasAlpha,
|
||||||
bitsPerSample, nChannels, data] = hints['image-data'];
|
bitsPerSample, nChannels, data] = hints['image-data'];
|
||||||
@ -123,7 +123,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_fallbackIconForNotificationData: function(hints) {
|
_fallbackIconForNotificationData(hints) {
|
||||||
let stockIcon;
|
let stockIcon;
|
||||||
switch (hints.urgency) {
|
switch (hints.urgency) {
|
||||||
case Urgency.LOW:
|
case Urgency.LOW:
|
||||||
@ -137,7 +137,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
|||||||
return new Gio.ThemedIcon({ name: stockIcon });
|
return new Gio.ThemedIcon({ name: stockIcon });
|
||||||
},
|
},
|
||||||
|
|
||||||
_iconForNotificationData: function(icon) {
|
_iconForNotificationData(icon) {
|
||||||
if (icon) {
|
if (icon) {
|
||||||
if (icon.substr(0, 7) == 'file://')
|
if (icon.substr(0, 7) == 'file://')
|
||||||
return new Gio.FileIcon({ file: Gio.File.new_for_uri(icon) });
|
return new Gio.FileIcon({ file: Gio.File.new_for_uri(icon) });
|
||||||
@ -149,7 +149,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_lookupSource: function(title, pid) {
|
_lookupSource(title, pid) {
|
||||||
for (let i = 0; i < this._sources.length; i++) {
|
for (let i = 0; i < this._sources.length; i++) {
|
||||||
let source = this._sources[i];
|
let source = this._sources[i];
|
||||||
if (source.pid == pid && source.initialTitle == title)
|
if (source.pid == pid && source.initialTitle == title)
|
||||||
@ -169,7 +169,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
|||||||
//
|
//
|
||||||
// Either a pid or ndata.notification is needed to retrieve or
|
// Either a pid or ndata.notification is needed to retrieve or
|
||||||
// create a source.
|
// create a source.
|
||||||
_getSource: function(title, pid, ndata, sender) {
|
_getSource(title, pid, ndata, sender) {
|
||||||
if (!pid && !(ndata && ndata.notification))
|
if (!pid && !(ndata && ndata.notification))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
|||||||
return source;
|
return source;
|
||||||
},
|
},
|
||||||
|
|
||||||
NotifyAsync: function(params, invocation) {
|
NotifyAsync(params, invocation) {
|
||||||
let [appName, replacesId, icon, summary, body, actions, hints, timeout] = params;
|
let [appName, replacesId, icon, summary, body, actions, hints, timeout] = params;
|
||||||
let id;
|
let id;
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
|||||||
return invocation.return_value(GLib.Variant.new('(u)', [id]));
|
return invocation.return_value(GLib.Variant.new('(u)', [id]));
|
||||||
},
|
},
|
||||||
|
|
||||||
_notifyForSource: function(source, ndata) {
|
_notifyForSource(source, ndata) {
|
||||||
let [id, icon, summary, body, actions, hints, notification] =
|
let [id, icon, summary, body, actions, hints, notification] =
|
||||||
[ndata.id, ndata.icon, ndata.summary, ndata.body,
|
[ndata.id, ndata.icon, ndata.summary, ndata.body,
|
||||||
ndata.actions, ndata.hints, ndata.notification];
|
ndata.actions, ndata.hints, ndata.notification];
|
||||||
@ -401,7 +401,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
|||||||
source.processNotification(notification, sourceGIcon);
|
source.processNotification(notification, sourceGIcon);
|
||||||
},
|
},
|
||||||
|
|
||||||
CloseNotification: function(id) {
|
CloseNotification(id) {
|
||||||
let ndata = this._notifications[id];
|
let ndata = this._notifications[id];
|
||||||
if (ndata) {
|
if (ndata) {
|
||||||
if (ndata.notification)
|
if (ndata.notification)
|
||||||
@ -410,7 +410,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
GetCapabilities: function() {
|
GetCapabilities() {
|
||||||
return [
|
return [
|
||||||
'actions',
|
'actions',
|
||||||
// 'action-icons',
|
// 'action-icons',
|
||||||
@ -425,7 +425,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
|||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
GetServerInformation: function() {
|
GetServerInformation() {
|
||||||
return [
|
return [
|
||||||
Config.PACKAGE_NAME,
|
Config.PACKAGE_NAME,
|
||||||
'GNOME',
|
'GNOME',
|
||||||
@ -434,7 +434,7 @@ var FdoNotificationDaemon = new Lang.Class({
|
|||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
_onFocusAppChanged: function() {
|
_onFocusAppChanged() {
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
if (!tracker.focus_app)
|
if (!tracker.focus_app)
|
||||||
return;
|
return;
|
||||||
@ -448,12 +448,12 @@ var FdoNotificationDaemon = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_emitNotificationClosed: function(id, reason) {
|
_emitNotificationClosed(id, reason) {
|
||||||
this._dbusImpl.emit_signal('NotificationClosed',
|
this._dbusImpl.emit_signal('NotificationClosed',
|
||||||
GLib.Variant.new('(uu)', [id, reason]));
|
GLib.Variant.new('(uu)', [id, reason]));
|
||||||
},
|
},
|
||||||
|
|
||||||
_emitActionInvoked: function(id, action) {
|
_emitActionInvoked(id, action) {
|
||||||
this._dbusImpl.emit_signal('ActionInvoked',
|
this._dbusImpl.emit_signal('ActionInvoked',
|
||||||
GLib.Variant.new('(us)', [id, action]));
|
GLib.Variant.new('(us)', [id, action]));
|
||||||
}
|
}
|
||||||
@ -463,7 +463,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
|||||||
Name: 'FdoNotificationDaemonSource',
|
Name: 'FdoNotificationDaemonSource',
|
||||||
Extends: MessageTray.Source,
|
Extends: MessageTray.Source,
|
||||||
|
|
||||||
_init: function(title, pid, sender, appId) {
|
_init(title, pid, sender, appId) {
|
||||||
// Need to set the app before chaining up, so
|
// Need to set the app before chaining up, so
|
||||||
// methods called from the parent constructor can find it
|
// methods called from the parent constructor can find it
|
||||||
this.pid = pid;
|
this.pid = pid;
|
||||||
@ -487,7 +487,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
|||||||
this._nameWatcherId = 0;
|
this._nameWatcherId = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_createPolicy: function() {
|
_createPolicy() {
|
||||||
if (this.app && this.app.get_app_info()) {
|
if (this.app && this.app.get_app_info()) {
|
||||||
let id = this.app.get_id().replace(/\.desktop$/,'');
|
let id = this.app.get_id().replace(/\.desktop$/,'');
|
||||||
return new MessageTray.NotificationApplicationPolicy(id);
|
return new MessageTray.NotificationApplicationPolicy(id);
|
||||||
@ -496,7 +496,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNameVanished: function() {
|
_onNameVanished() {
|
||||||
// Destroy the notification source when its sender is removed from DBus.
|
// Destroy the notification source when its sender is removed from DBus.
|
||||||
// Only do so if this.app is set to avoid removing "notify-send" sources, senders
|
// Only do so if this.app is set to avoid removing "notify-send" sources, senders
|
||||||
// of which аre removed from DBus immediately.
|
// of which аre removed from DBus immediately.
|
||||||
@ -506,7 +506,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
|||||||
this.destroy();
|
this.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
processNotification: function(notification, gicon) {
|
processNotification(notification, gicon) {
|
||||||
if (gicon)
|
if (gicon)
|
||||||
this._gicon = gicon;
|
this._gicon = gicon;
|
||||||
this.iconUpdated();
|
this.iconUpdated();
|
||||||
@ -518,7 +518,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
|||||||
this.notify(notification);
|
this.notify(notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getApp: function(appId) {
|
_getApp(appId) {
|
||||||
let app;
|
let app;
|
||||||
|
|
||||||
app = Shell.WindowTracker.get_default().get_app_from_pid(this.pid);
|
app = Shell.WindowTracker.get_default().get_app_from_pid(this.pid);
|
||||||
@ -534,7 +534,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
setTitle: function(title) {
|
setTitle(title) {
|
||||||
// Do nothing if .app is set, we don't want to override the
|
// Do nothing if .app is set, we don't want to override the
|
||||||
// app name with whatever is provided through libnotify (usually
|
// app name with whatever is provided through libnotify (usually
|
||||||
// garbage)
|
// garbage)
|
||||||
@ -544,12 +544,12 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
|||||||
this.parent(title);
|
this.parent(title);
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function() {
|
open() {
|
||||||
this.openApp();
|
this.openApp();
|
||||||
this.destroyNonResidentNotifications();
|
this.destroyNonResidentNotifications();
|
||||||
},
|
},
|
||||||
|
|
||||||
openApp: function() {
|
openApp() {
|
||||||
if (this.app == null)
|
if (this.app == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -558,7 +558,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
|||||||
Main.panel.closeCalendar();
|
Main.panel.closeCalendar();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
if (this._nameWatcherId) {
|
if (this._nameWatcherId) {
|
||||||
Gio.DBus.session.unwatch_name(this._nameWatcherId);
|
Gio.DBus.session.unwatch_name(this._nameWatcherId);
|
||||||
this._nameWatcherId = 0;
|
this._nameWatcherId = 0;
|
||||||
@ -567,7 +567,7 @@ var FdoNotificationDaemonSource = new Lang.Class({
|
|||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
createIcon: function(size) {
|
createIcon(size) {
|
||||||
if (this.app) {
|
if (this.app) {
|
||||||
return this.app.create_icon_texture(size);
|
return this.app.create_icon_texture(size);
|
||||||
} else if (this._gicon) {
|
} else if (this._gicon) {
|
||||||
@ -590,7 +590,7 @@ var GtkNotificationDaemonNotification = new Lang.Class({
|
|||||||
Name: 'GtkNotificationDaemonNotification',
|
Name: 'GtkNotificationDaemonNotification',
|
||||||
Extends: MessageTray.Notification,
|
Extends: MessageTray.Notification,
|
||||||
|
|
||||||
_init: function(source, notification) {
|
_init(source, notification) {
|
||||||
this.parent(source);
|
this.parent(source);
|
||||||
this._serialized = GLib.Variant.new('a{sv}', notification);
|
this._serialized = GLib.Variant.new('a{sv}', notification);
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ var GtkNotificationDaemonNotification = new Lang.Class({
|
|||||||
datetime : time ? GLib.DateTime.new_from_unix_local(time.unpack()) : null });
|
datetime : time ? GLib.DateTime.new_from_unix_local(time.unpack()) : null });
|
||||||
},
|
},
|
||||||
|
|
||||||
_activateAction: function(namespacedActionId, target) {
|
_activateAction(namespacedActionId, target) {
|
||||||
if (namespacedActionId) {
|
if (namespacedActionId) {
|
||||||
if (namespacedActionId.startsWith('app.')) {
|
if (namespacedActionId.startsWith('app.')) {
|
||||||
let actionId = namespacedActionId.slice('app.'.length);
|
let actionId = namespacedActionId.slice('app.'.length);
|
||||||
@ -640,17 +640,17 @@ var GtkNotificationDaemonNotification = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonClicked: function(button) {
|
_onButtonClicked(button) {
|
||||||
let { 'action': action, 'target': actionTarget } = button;
|
let { 'action': action, 'target': actionTarget } = button;
|
||||||
this._activateAction(action.unpack(), actionTarget);
|
this._activateAction(action.unpack(), actionTarget);
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function() {
|
activate() {
|
||||||
this._activateAction(this._defaultAction, this._defaultActionTarget);
|
this._activateAction(this._defaultAction, this._defaultActionTarget);
|
||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
serialize: function() {
|
serialize() {
|
||||||
return this._serialized;
|
return this._serialized;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -684,7 +684,7 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
|||||||
Name: 'GtkNotificationDaemonAppSource',
|
Name: 'GtkNotificationDaemonAppSource',
|
||||||
Extends: MessageTray.Source,
|
Extends: MessageTray.Source,
|
||||||
|
|
||||||
_init: function(appId) {
|
_init(appId) {
|
||||||
this._appId = appId;
|
this._appId = appId;
|
||||||
this._objectPath = objectPathFromAppId(appId);
|
this._objectPath = objectPathFromAppId(appId);
|
||||||
if (!GLib.Variant.is_object_path(this._objectPath))
|
if (!GLib.Variant.is_object_path(this._objectPath))
|
||||||
@ -700,19 +700,19 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
|||||||
this.parent(this._app.get_name());
|
this.parent(this._app.get_name());
|
||||||
},
|
},
|
||||||
|
|
||||||
createIcon: function(size) {
|
createIcon(size) {
|
||||||
return this._app.create_icon_texture(size);
|
return this._app.create_icon_texture(size);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createPolicy: function() {
|
_createPolicy() {
|
||||||
return new MessageTray.NotificationApplicationPolicy(this._appId);
|
return new MessageTray.NotificationApplicationPolicy(this._appId);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createApp: function(callback) {
|
_createApp(callback) {
|
||||||
return new FdoApplicationProxy(Gio.DBus.session, this._appId, this._objectPath, callback);
|
return new FdoApplicationProxy(Gio.DBus.session, this._appId, this._objectPath, callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
activateAction: function(actionId, target) {
|
activateAction(actionId, target) {
|
||||||
this._createApp(function (app, error) {
|
this._createApp(function (app, error) {
|
||||||
if (error == null)
|
if (error == null)
|
||||||
app.ActivateActionRemote(actionId, target ? [target] : [], getPlatformData());
|
app.ActivateActionRemote(actionId, target ? [target] : [], getPlatformData());
|
||||||
@ -723,7 +723,7 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
|||||||
Main.panel.closeCalendar();
|
Main.panel.closeCalendar();
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function() {
|
open() {
|
||||||
this._createApp(function (app, error) {
|
this._createApp(function (app, error) {
|
||||||
if (error == null)
|
if (error == null)
|
||||||
app.ActivateRemote(getPlatformData());
|
app.ActivateRemote(getPlatformData());
|
||||||
@ -734,7 +734,7 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
|||||||
Main.panel.closeCalendar();
|
Main.panel.closeCalendar();
|
||||||
},
|
},
|
||||||
|
|
||||||
addNotification: function(notificationId, notificationParams, showBanner) {
|
addNotification(notificationId, notificationParams, showBanner) {
|
||||||
this._notificationPending = true;
|
this._notificationPending = true;
|
||||||
|
|
||||||
if (this._notifications[notificationId])
|
if (this._notifications[notificationId])
|
||||||
@ -754,18 +754,18 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
|
|||||||
this._notificationPending = false;
|
this._notificationPending = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function(reason) {
|
destroy(reason) {
|
||||||
if (this._notificationPending)
|
if (this._notificationPending)
|
||||||
return;
|
return;
|
||||||
this.parent(reason);
|
this.parent(reason);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeNotification: function(notificationId) {
|
removeNotification(notificationId) {
|
||||||
if (this._notifications[notificationId])
|
if (this._notifications[notificationId])
|
||||||
this._notifications[notificationId].destroy(MessageTray.NotificationDestroyedReason.SOURCE_CLOSED);
|
this._notifications[notificationId].destroy(MessageTray.NotificationDestroyedReason.SOURCE_CLOSED);
|
||||||
},
|
},
|
||||||
|
|
||||||
serialize: function() {
|
serialize() {
|
||||||
let notifications = [];
|
let notifications = [];
|
||||||
for (let notificationId in this._notifications) {
|
for (let notificationId in this._notifications) {
|
||||||
let notification = this._notifications[notificationId];
|
let notification = this._notifications[notificationId];
|
||||||
@ -792,7 +792,7 @@ const GtkNotificationsIface = '<node> \
|
|||||||
var GtkNotificationDaemon = new Lang.Class({
|
var GtkNotificationDaemon = new Lang.Class({
|
||||||
Name: 'GtkNotificationDaemon',
|
Name: 'GtkNotificationDaemon',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._sources = {};
|
this._sources = {};
|
||||||
|
|
||||||
this._loadNotifications();
|
this._loadNotifications();
|
||||||
@ -803,7 +803,7 @@ var GtkNotificationDaemon = new Lang.Class({
|
|||||||
Gio.DBus.session.own_name('org.gtk.Notifications', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
Gio.DBus.session.own_name('org.gtk.Notifications', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureAppSource: function(appId) {
|
_ensureAppSource(appId) {
|
||||||
if (this._sources[appId])
|
if (this._sources[appId])
|
||||||
return this._sources[appId];
|
return this._sources[appId];
|
||||||
|
|
||||||
@ -819,7 +819,7 @@ var GtkNotificationDaemon = new Lang.Class({
|
|||||||
return source;
|
return source;
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadNotifications: function() {
|
_loadNotifications() {
|
||||||
this._isLoading = true;
|
this._isLoading = true;
|
||||||
|
|
||||||
let value = global.get_persistent_state('a(sa(sv))', 'notifications');
|
let value = global.get_persistent_state('a(sa(sv))', 'notifications');
|
||||||
@ -845,7 +845,7 @@ var GtkNotificationDaemon = new Lang.Class({
|
|||||||
this._isLoading = false;
|
this._isLoading = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_saveNotifications: function() {
|
_saveNotifications() {
|
||||||
if (this._isLoading)
|
if (this._isLoading)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -858,7 +858,7 @@ var GtkNotificationDaemon = new Lang.Class({
|
|||||||
global.set_persistent_state('notifications', new GLib.Variant('a(sa(sv))', sources));
|
global.set_persistent_state('notifications', new GLib.Variant('a(sa(sv))', sources));
|
||||||
},
|
},
|
||||||
|
|
||||||
AddNotificationAsync: function(params, invocation) {
|
AddNotificationAsync(params, invocation) {
|
||||||
let [appId, notificationId, notification] = params;
|
let [appId, notificationId, notification] = params;
|
||||||
|
|
||||||
let source;
|
let source;
|
||||||
@ -877,7 +877,7 @@ var GtkNotificationDaemon = new Lang.Class({
|
|||||||
invocation.return_value(null);
|
invocation.return_value(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
RemoveNotificationAsync: function(params, invocation) {
|
RemoveNotificationAsync(params, invocation) {
|
||||||
let [appId, notificationId] = params;
|
let [appId, notificationId] = params;
|
||||||
let source = this._sources[appId];
|
let source = this._sources[appId];
|
||||||
if (source)
|
if (source)
|
||||||
@ -890,7 +890,7 @@ var GtkNotificationDaemon = new Lang.Class({
|
|||||||
var NotificationDaemon = new Lang.Class({
|
var NotificationDaemon = new Lang.Class({
|
||||||
Name: 'NotificationDaemon',
|
Name: 'NotificationDaemon',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._fdoNotificationDaemon = new FdoNotificationDaemon();
|
this._fdoNotificationDaemon = new FdoNotificationDaemon();
|
||||||
this._gtkNotificationDaemon = new GtkNotificationDaemon();
|
this._gtkNotificationDaemon = new GtkNotificationDaemon();
|
||||||
},
|
},
|
||||||
|
@ -14,7 +14,7 @@ var FADE_TIME = 0.1;
|
|||||||
var OsdMonitorLabel = new Lang.Class({
|
var OsdMonitorLabel = new Lang.Class({
|
||||||
Name: 'OsdMonitorLabel',
|
Name: 'OsdMonitorLabel',
|
||||||
|
|
||||||
_init: function(monitor, label) {
|
_init(monitor, label) {
|
||||||
this._actor = new St.Widget({ x_expand: true,
|
this._actor = new St.Widget({ x_expand: true,
|
||||||
y_expand: true });
|
y_expand: true });
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ var OsdMonitorLabel = new Lang.Class({
|
|||||||
Meta.disable_unredirect_for_screen(global.screen);
|
Meta.disable_unredirect_for_screen(global.screen);
|
||||||
},
|
},
|
||||||
|
|
||||||
_position: function() {
|
_position() {
|
||||||
let workArea = Main.layoutManager.getWorkAreaForMonitor(this._monitor);
|
let workArea = Main.layoutManager.getWorkAreaForMonitor(this._monitor);
|
||||||
|
|
||||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||||
@ -46,7 +46,7 @@ var OsdMonitorLabel = new Lang.Class({
|
|||||||
this._box.y = workArea.y;
|
this._box.y = workArea.y;
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this._actor.destroy();
|
this._actor.destroy();
|
||||||
Meta.enable_unredirect_for_screen(global.screen);
|
Meta.enable_unredirect_for_screen(global.screen);
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ var OsdMonitorLabel = new Lang.Class({
|
|||||||
var OsdMonitorLabeler = new Lang.Class({
|
var OsdMonitorLabeler = new Lang.Class({
|
||||||
Name: 'OsdMonitorLabeler',
|
Name: 'OsdMonitorLabeler',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._monitorManager = Meta.MonitorManager.get();
|
this._monitorManager = Meta.MonitorManager.get();
|
||||||
this._client = null;
|
this._client = null;
|
||||||
this._clientWatchId = 0;
|
this._clientWatchId = 0;
|
||||||
@ -66,7 +66,7 @@ var OsdMonitorLabeler = new Lang.Class({
|
|||||||
this._reset();
|
this._reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
_reset: function() {
|
_reset() {
|
||||||
for (let i in this._osdLabels)
|
for (let i in this._osdLabels)
|
||||||
this._osdLabels[i].destroy();
|
this._osdLabels[i].destroy();
|
||||||
this._osdLabels = [];
|
this._osdLabels = [];
|
||||||
@ -76,7 +76,7 @@ var OsdMonitorLabeler = new Lang.Class({
|
|||||||
this._monitorLabels.set(monitors[i].index, []);
|
this._monitorLabels.set(monitors[i].index, []);
|
||||||
},
|
},
|
||||||
|
|
||||||
_trackClient: function(client) {
|
_trackClient(client) {
|
||||||
if (this._client)
|
if (this._client)
|
||||||
return (this._client == client);
|
return (this._client == client);
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ var OsdMonitorLabeler = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_untrackClient: function(client) {
|
_untrackClient(client) {
|
||||||
if (!this._client || this._client != client)
|
if (!this._client || this._client != client)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ var OsdMonitorLabeler = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function(client, params) {
|
show(client, params) {
|
||||||
if (!this._trackClient(client))
|
if (!this._trackClient(client))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ var OsdMonitorLabeler = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
show2: function(client, params) {
|
show2(client, params) {
|
||||||
if (!this._trackClient(client))
|
if (!this._trackClient(client))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ var OsdMonitorLabeler = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function(client) {
|
hide(client) {
|
||||||
if (!this._untrackClient(client))
|
if (!this._untrackClient(client))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ var LEVEL_ANIMATION_TIME = 0.1;
|
|||||||
var LevelBar = new Lang.Class({
|
var LevelBar = new Lang.Class({
|
||||||
Name: 'LevelBar',
|
Name: 'LevelBar',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._level = 0;
|
this._level = 0;
|
||||||
|
|
||||||
this.actor = new St.Bin({ style_class: 'level',
|
this.actor = new St.Bin({ style_class: 'level',
|
||||||
@ -49,7 +49,7 @@ var OsdWindowConstraint = new Lang.Class({
|
|||||||
Name: 'OsdWindowConstraint',
|
Name: 'OsdWindowConstraint',
|
||||||
Extends: Clutter.Constraint,
|
Extends: Clutter.Constraint,
|
||||||
|
|
||||||
_init: function(props) {
|
_init(props) {
|
||||||
this._minSize = 0;
|
this._minSize = 0;
|
||||||
this.parent(props);
|
this.parent(props);
|
||||||
},
|
},
|
||||||
@ -60,7 +60,7 @@ var OsdWindowConstraint = new Lang.Class({
|
|||||||
this.actor.queue_relayout();
|
this.actor.queue_relayout();
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_update_allocation: function(actor, actorBox) {
|
vfunc_update_allocation(actor, actorBox) {
|
||||||
// Clutter will adjust the allocation for margins,
|
// Clutter will adjust the allocation for margins,
|
||||||
// so add it to our minimum size
|
// so add it to our minimum size
|
||||||
let minSize = this._minSize + actor.margin_top + actor.margin_bottom;
|
let minSize = this._minSize + actor.margin_top + actor.margin_bottom;
|
||||||
@ -80,7 +80,7 @@ var OsdWindowConstraint = new Lang.Class({
|
|||||||
var OsdWindow = new Lang.Class({
|
var OsdWindow = new Lang.Class({
|
||||||
Name: 'OsdWindow',
|
Name: 'OsdWindow',
|
||||||
|
|
||||||
_init: function(monitorIndex) {
|
_init(monitorIndex) {
|
||||||
this.actor = new St.Widget({ x_expand: true,
|
this.actor = new St.Widget({ x_expand: true,
|
||||||
y_expand: true,
|
y_expand: true,
|
||||||
x_align: Clutter.ActorAlign.CENTER,
|
x_align: Clutter.ActorAlign.CENTER,
|
||||||
@ -117,17 +117,17 @@ var OsdWindow = new Lang.Class({
|
|||||||
Main.uiGroup.add_child(this.actor);
|
Main.uiGroup.add_child(this.actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
setIcon: function(icon) {
|
setIcon(icon) {
|
||||||
this._icon.gicon = icon;
|
this._icon.gicon = icon;
|
||||||
},
|
},
|
||||||
|
|
||||||
setLabel: function(label) {
|
setLabel(label) {
|
||||||
this._label.visible = (label != undefined);
|
this._label.visible = (label != undefined);
|
||||||
if (label)
|
if (label)
|
||||||
this._label.text = label;
|
this._label.text = label;
|
||||||
},
|
},
|
||||||
|
|
||||||
setLevel: function(level) {
|
setLevel(level) {
|
||||||
this._level.actor.visible = (level != undefined);
|
this._level.actor.visible = (level != undefined);
|
||||||
if (level != undefined) {
|
if (level != undefined) {
|
||||||
if (this.actor.visible)
|
if (this.actor.visible)
|
||||||
@ -140,7 +140,7 @@ var OsdWindow = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function() {
|
show() {
|
||||||
if (!this._icon.gicon)
|
if (!this._icon.gicon)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ var OsdWindow = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._hideTimeoutId, '[gnome-shell] this._hide');
|
GLib.Source.set_name_by_id(this._hideTimeoutId, '[gnome-shell] this._hide');
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function() {
|
cancel() {
|
||||||
if (!this._hideTimeoutId)
|
if (!this._hideTimeoutId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ var OsdWindow = new Lang.Class({
|
|||||||
this._hide();
|
this._hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_hide: function() {
|
_hide() {
|
||||||
this._hideTimeoutId = 0;
|
this._hideTimeoutId = 0;
|
||||||
Tweener.addTween(this.actor,
|
Tweener.addTween(this.actor,
|
||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
@ -185,13 +185,13 @@ var OsdWindow = new Lang.Class({
|
|||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_reset: function() {
|
_reset() {
|
||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
this.setLabel(null);
|
this.setLabel(null);
|
||||||
this.setLevel(null);
|
this.setLevel(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_relayout: function() {
|
_relayout() {
|
||||||
/* assume 110x110 on a 640x480 display and scale from there */
|
/* assume 110x110 on a 640x480 display and scale from there */
|
||||||
let monitor = Main.layoutManager.monitors[this._monitorIndex];
|
let monitor = Main.layoutManager.monitors[this._monitorIndex];
|
||||||
if (!monitor)
|
if (!monitor)
|
||||||
@ -212,14 +212,14 @@ var OsdWindow = new Lang.Class({
|
|||||||
var OsdWindowManager = new Lang.Class({
|
var OsdWindowManager = new Lang.Class({
|
||||||
Name: 'OsdWindowManager',
|
Name: 'OsdWindowManager',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._osdWindows = [];
|
this._osdWindows = [];
|
||||||
Main.layoutManager.connect('monitors-changed',
|
Main.layoutManager.connect('monitors-changed',
|
||||||
Lang.bind(this, this._monitorsChanged));
|
Lang.bind(this, this._monitorsChanged));
|
||||||
this._monitorsChanged();
|
this._monitorsChanged();
|
||||||
},
|
},
|
||||||
|
|
||||||
_monitorsChanged: function() {
|
_monitorsChanged() {
|
||||||
for (let i = 0; i < Main.layoutManager.monitors.length; i++) {
|
for (let i = 0; i < Main.layoutManager.monitors.length; i++) {
|
||||||
if (this._osdWindows[i] == undefined)
|
if (this._osdWindows[i] == undefined)
|
||||||
this._osdWindows[i] = new OsdWindow(i);
|
this._osdWindows[i] = new OsdWindow(i);
|
||||||
@ -233,14 +233,14 @@ var OsdWindowManager = new Lang.Class({
|
|||||||
this._osdWindows.length = Main.layoutManager.monitors.length;
|
this._osdWindows.length = Main.layoutManager.monitors.length;
|
||||||
},
|
},
|
||||||
|
|
||||||
_showOsdWindow: function(monitorIndex, icon, label, level) {
|
_showOsdWindow(monitorIndex, icon, label, level) {
|
||||||
this._osdWindows[monitorIndex].setIcon(icon);
|
this._osdWindows[monitorIndex].setIcon(icon);
|
||||||
this._osdWindows[monitorIndex].setLabel(label);
|
this._osdWindows[monitorIndex].setLabel(label);
|
||||||
this._osdWindows[monitorIndex].setLevel(level);
|
this._osdWindows[monitorIndex].setLevel(level);
|
||||||
this._osdWindows[monitorIndex].show();
|
this._osdWindows[monitorIndex].show();
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function(monitorIndex, icon, label, level) {
|
show(monitorIndex, icon, label, level) {
|
||||||
if (monitorIndex != -1) {
|
if (monitorIndex != -1) {
|
||||||
for (let i = 0; i < this._osdWindows.length; i++) {
|
for (let i = 0; i < this._osdWindows.length; i++) {
|
||||||
if (i == monitorIndex)
|
if (i == monitorIndex)
|
||||||
@ -254,7 +254,7 @@ var OsdWindowManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
hideAll: function() {
|
hideAll() {
|
||||||
for (let i = 0; i < this._osdWindows.length; i++)
|
for (let i = 0; i < this._osdWindows.length; i++)
|
||||||
this._osdWindows[i].cancel();
|
this._osdWindows[i].cancel();
|
||||||
}
|
}
|
||||||
|
@ -38,12 +38,12 @@ var OVERVIEW_ACTIVATION_TIMEOUT = 0.5;
|
|||||||
var ShellInfo = new Lang.Class({
|
var ShellInfo = new Lang.Class({
|
||||||
Name: 'ShellInfo',
|
Name: 'ShellInfo',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._source = null;
|
this._source = null;
|
||||||
this._undoCallback = null;
|
this._undoCallback = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUndoClicked: function() {
|
_onUndoClicked() {
|
||||||
if (this._undoCallback)
|
if (this._undoCallback)
|
||||||
this._undoCallback();
|
this._undoCallback();
|
||||||
this._undoCallback = null;
|
this._undoCallback = null;
|
||||||
@ -52,7 +52,7 @@ var ShellInfo = new Lang.Class({
|
|||||||
this._source.destroy();
|
this._source.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
setMessage: function(text, options) {
|
setMessage(text, options) {
|
||||||
options = Params.parse(options, { undoCallback: null,
|
options = Params.parse(options, { undoCallback: null,
|
||||||
forFeedback: false
|
forFeedback: false
|
||||||
});
|
});
|
||||||
@ -90,7 +90,7 @@ var ShellInfo = new Lang.Class({
|
|||||||
var Overview = new Lang.Class({
|
var Overview = new Lang.Class({
|
||||||
Name: 'Overview',
|
Name: 'Overview',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._overviewCreated = false;
|
this._overviewCreated = false;
|
||||||
this._initCalled = false;
|
this._initCalled = false;
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ var Overview = new Lang.Class({
|
|||||||
this._sessionUpdated();
|
this._sessionUpdated();
|
||||||
},
|
},
|
||||||
|
|
||||||
_createOverview: function() {
|
_createOverview() {
|
||||||
if (this._overviewCreated)
|
if (this._overviewCreated)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ var Overview = new Lang.Class({
|
|||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateBackgrounds: function() {
|
_updateBackgrounds() {
|
||||||
for (let i = 0; i < this._bgManagers.length; i++)
|
for (let i = 0; i < this._bgManagers.length; i++)
|
||||||
this._bgManagers[i].destroy();
|
this._bgManagers[i].destroy();
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ var Overview = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_unshadeBackgrounds: function() {
|
_unshadeBackgrounds() {
|
||||||
let backgrounds = this._backgroundGroup.get_children();
|
let backgrounds = this._backgroundGroup.get_children();
|
||||||
for (let i = 0; i < backgrounds.length; i++) {
|
for (let i = 0; i < backgrounds.length; i++) {
|
||||||
Tweener.addTween(backgrounds[i],
|
Tweener.addTween(backgrounds[i],
|
||||||
@ -196,7 +196,7 @@ var Overview = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_shadeBackgrounds: function() {
|
_shadeBackgrounds() {
|
||||||
let backgrounds = this._backgroundGroup.get_children();
|
let backgrounds = this._backgroundGroup.get_children();
|
||||||
for (let i = 0; i < backgrounds.length; i++) {
|
for (let i = 0; i < backgrounds.length; i++) {
|
||||||
Tweener.addTween(backgrounds[i],
|
Tweener.addTween(backgrounds[i],
|
||||||
@ -208,7 +208,7 @@ var Overview = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
this.isDummy = !Main.sessionMode.hasOverview;
|
this.isDummy = !Main.sessionMode.hasOverview;
|
||||||
this._createOverview();
|
this._createOverview();
|
||||||
},
|
},
|
||||||
@ -217,7 +217,7 @@ var Overview = new Lang.Class({
|
|||||||
// want to access the overview as Main.overview to connect
|
// want to access the overview as Main.overview to connect
|
||||||
// signal handlers and so forth. So we create them after
|
// signal handlers and so forth. So we create them after
|
||||||
// construction in this init() method.
|
// construction in this init() method.
|
||||||
init: function() {
|
init() {
|
||||||
this._initCalled = true;
|
this._initCalled = true;
|
||||||
|
|
||||||
if (this.isDummy)
|
if (this.isDummy)
|
||||||
@ -263,11 +263,11 @@ var Overview = new Lang.Class({
|
|||||||
this._relayout();
|
this._relayout();
|
||||||
},
|
},
|
||||||
|
|
||||||
addSearchProvider: function(provider) {
|
addSearchProvider(provider) {
|
||||||
this.viewSelector.addSearchProvider(provider);
|
this.viewSelector.addSearchProvider(provider);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeSearchProvider: function(provider) {
|
removeSearchProvider(provider) {
|
||||||
this.viewSelector.removeSearchProvider(provider);
|
this.viewSelector.removeSearchProvider(provider);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -276,14 +276,14 @@ var Overview = new Lang.Class({
|
|||||||
// - undoCallback (function): the callback to be called if undo support is needed
|
// - undoCallback (function): the callback to be called if undo support is needed
|
||||||
// - forFeedback (boolean): whether the message is for direct feedback of a user action
|
// - forFeedback (boolean): whether the message is for direct feedback of a user action
|
||||||
//
|
//
|
||||||
setMessage: function(text, options) {
|
setMessage(text, options) {
|
||||||
if (this.isDummy)
|
if (this.isDummy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._shellInfo.setMessage(text, options);
|
this._shellInfo.setMessage(text, options);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragBegin: function() {
|
_onDragBegin() {
|
||||||
this._inXdndDrag = true;
|
this._inXdndDrag = true;
|
||||||
|
|
||||||
DND.addDragMonitor(this._dragMonitor);
|
DND.addDragMonitor(this._dragMonitor);
|
||||||
@ -291,7 +291,7 @@ var Overview = new Lang.Class({
|
|||||||
this._lastActiveWorkspaceIndex = global.screen.get_active_workspace_index();
|
this._lastActiveWorkspaceIndex = global.screen.get_active_workspace_index();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragEnd: function(time) {
|
_onDragEnd(time) {
|
||||||
this._inXdndDrag = false;
|
this._inXdndDrag = false;
|
||||||
|
|
||||||
// In case the drag was canceled while in the overview
|
// In case the drag was canceled while in the overview
|
||||||
@ -307,7 +307,7 @@ var Overview = new Lang.Class({
|
|||||||
this.endItemDrag();
|
this.endItemDrag();
|
||||||
},
|
},
|
||||||
|
|
||||||
_resetWindowSwitchTimeout: function() {
|
_resetWindowSwitchTimeout() {
|
||||||
if (this._windowSwitchTimeoutId != 0) {
|
if (this._windowSwitchTimeoutId != 0) {
|
||||||
Mainloop.source_remove(this._windowSwitchTimeoutId);
|
Mainloop.source_remove(this._windowSwitchTimeoutId);
|
||||||
this._windowSwitchTimeoutId = 0;
|
this._windowSwitchTimeoutId = 0;
|
||||||
@ -315,7 +315,7 @@ var Overview = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_fakePointerEvent: function() {
|
_fakePointerEvent() {
|
||||||
let display = Gdk.Display.get_default();
|
let display = Gdk.Display.get_default();
|
||||||
let deviceManager = display.get_device_manager();
|
let deviceManager = display.get_device_manager();
|
||||||
let pointer = deviceManager.get_client_pointer();
|
let pointer = deviceManager.get_client_pointer();
|
||||||
@ -324,7 +324,7 @@ var Overview = new Lang.Class({
|
|||||||
pointer.warp(screen, pointerX, pointerY);
|
pointer.warp(screen, pointerX, pointerY);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragMotion: function(dragEvent) {
|
_onDragMotion(dragEvent) {
|
||||||
let targetIsWindow = dragEvent.targetActor &&
|
let targetIsWindow = dragEvent.targetActor &&
|
||||||
dragEvent.targetActor._delegate &&
|
dragEvent.targetActor._delegate &&
|
||||||
dragEvent.targetActor._delegate.metaWindow &&
|
dragEvent.targetActor._delegate.metaWindow &&
|
||||||
@ -358,19 +358,19 @@ var Overview = new Lang.Class({
|
|||||||
return DND.DragMotionResult.CONTINUE;
|
return DND.DragMotionResult.CONTINUE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onScrollEvent: function(actor, event) {
|
_onScrollEvent(actor, event) {
|
||||||
this.emit('scroll-event', event);
|
this.emit('scroll-event', event);
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
addAction: function(action) {
|
addAction(action) {
|
||||||
if (this.isDummy)
|
if (this.isDummy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._backgroundGroup.add_action(action);
|
this._backgroundGroup.add_action(action);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getDesktopClone: function() {
|
_getDesktopClone() {
|
||||||
let windows = global.get_window_actors().filter(function(w) {
|
let windows = global.get_window_actors().filter(function(w) {
|
||||||
return w.meta_window.get_window_type() == Meta.WindowType.DESKTOP;
|
return w.meta_window.get_window_type() == Meta.WindowType.DESKTOP;
|
||||||
});
|
});
|
||||||
@ -386,7 +386,7 @@ var Overview = new Lang.Class({
|
|||||||
return clone;
|
return clone;
|
||||||
},
|
},
|
||||||
|
|
||||||
_relayout: function () {
|
_relayout() {
|
||||||
// To avoid updating the position and size of the workspaces
|
// To avoid updating the position and size of the workspaces
|
||||||
// we just hide the overview. The positions will be updated
|
// we just hide the overview. The positions will be updated
|
||||||
// when it is next shown.
|
// when it is next shown.
|
||||||
@ -403,7 +403,7 @@ var Overview = new Lang.Class({
|
|||||||
this._updateBackgrounds();
|
this._updateBackgrounds();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onRestacked: function() {
|
_onRestacked() {
|
||||||
let stack = global.get_window_actors();
|
let stack = global.get_window_actors();
|
||||||
let stackIndices = {};
|
let stackIndices = {};
|
||||||
|
|
||||||
@ -415,44 +415,44 @@ var Overview = new Lang.Class({
|
|||||||
this.emit('windows-restacked', stackIndices);
|
this.emit('windows-restacked', stackIndices);
|
||||||
},
|
},
|
||||||
|
|
||||||
beginItemDrag: function(source) {
|
beginItemDrag(source) {
|
||||||
this.emit('item-drag-begin');
|
this.emit('item-drag-begin');
|
||||||
this._inItemDrag = true;
|
this._inItemDrag = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
cancelledItemDrag: function(source) {
|
cancelledItemDrag(source) {
|
||||||
this.emit('item-drag-cancelled');
|
this.emit('item-drag-cancelled');
|
||||||
},
|
},
|
||||||
|
|
||||||
endItemDrag: function(source) {
|
endItemDrag(source) {
|
||||||
if (!this._inItemDrag)
|
if (!this._inItemDrag)
|
||||||
return;
|
return;
|
||||||
this.emit('item-drag-end');
|
this.emit('item-drag-end');
|
||||||
this._inItemDrag = false;
|
this._inItemDrag = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
beginWindowDrag: function(window) {
|
beginWindowDrag(window) {
|
||||||
this.emit('window-drag-begin', window);
|
this.emit('window-drag-begin', window);
|
||||||
this._inWindowDrag = true;
|
this._inWindowDrag = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
cancelledWindowDrag: function(window) {
|
cancelledWindowDrag(window) {
|
||||||
this.emit('window-drag-cancelled', window);
|
this.emit('window-drag-cancelled', window);
|
||||||
},
|
},
|
||||||
|
|
||||||
endWindowDrag: function(window) {
|
endWindowDrag(window) {
|
||||||
if (!this._inWindowDrag)
|
if (!this._inWindowDrag)
|
||||||
return;
|
return;
|
||||||
this.emit('window-drag-end', window);
|
this.emit('window-drag-end', window);
|
||||||
this._inWindowDrag = false;
|
this._inWindowDrag = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
focusSearch: function() {
|
focusSearch() {
|
||||||
this.show();
|
this.show();
|
||||||
this._searchEntry.grab_key_focus();
|
this._searchEntry.grab_key_focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
fadeInDesktop: function() {
|
fadeInDesktop() {
|
||||||
this._desktopFade.opacity = 0;
|
this._desktopFade.opacity = 0;
|
||||||
this._desktopFade.show();
|
this._desktopFade.show();
|
||||||
Tweener.addTween(this._desktopFade,
|
Tweener.addTween(this._desktopFade,
|
||||||
@ -461,7 +461,7 @@ var Overview = new Lang.Class({
|
|||||||
transition: 'easeOutQuad' });
|
transition: 'easeOutQuad' });
|
||||||
},
|
},
|
||||||
|
|
||||||
fadeOutDesktop: function() {
|
fadeOutDesktop() {
|
||||||
if (!this._desktopFade.get_n_children()) {
|
if (!this._desktopFade.get_n_children()) {
|
||||||
let clone = this._getDesktopClone();
|
let clone = this._getDesktopClone();
|
||||||
if (!clone)
|
if (!clone)
|
||||||
@ -485,7 +485,7 @@ var Overview = new Lang.Class({
|
|||||||
// triggered will return false. This avoids opening and closing
|
// triggered will return false. This avoids opening and closing
|
||||||
// the overview if the user both triggered the hot corner and
|
// the overview if the user both triggered the hot corner and
|
||||||
// clicked the Activities button.
|
// clicked the Activities button.
|
||||||
shouldToggleByCornerOrButton: function() {
|
shouldToggleByCornerOrButton() {
|
||||||
if (this.animationInProgress)
|
if (this.animationInProgress)
|
||||||
return false;
|
return false;
|
||||||
if (this._inItemDrag || this._inWindowDrag)
|
if (this._inItemDrag || this._inWindowDrag)
|
||||||
@ -495,7 +495,7 @@ var Overview = new Lang.Class({
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncGrab: function() {
|
_syncGrab() {
|
||||||
// We delay grab changes during animation so that when removing the
|
// We delay grab changes during animation so that when removing the
|
||||||
// overview we don't have a problem with the release of a press/release
|
// overview we don't have a problem with the release of a press/release
|
||||||
// going to an application.
|
// going to an application.
|
||||||
@ -527,7 +527,7 @@ var Overview = new Lang.Class({
|
|||||||
// show:
|
// show:
|
||||||
//
|
//
|
||||||
// Animates the overview visible and grabs mouse and keyboard input
|
// Animates the overview visible and grabs mouse and keyboard input
|
||||||
show: function() {
|
show() {
|
||||||
if (this.isDummy)
|
if (this.isDummy)
|
||||||
return;
|
return;
|
||||||
if (this._shown)
|
if (this._shown)
|
||||||
@ -542,7 +542,7 @@ var Overview = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
_animateVisible: function() {
|
_animateVisible() {
|
||||||
if (this.visible || this.animationInProgress)
|
if (this.visible || this.animationInProgress)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -569,7 +569,7 @@ var Overview = new Lang.Class({
|
|||||||
this.emit('showing');
|
this.emit('showing');
|
||||||
},
|
},
|
||||||
|
|
||||||
_showDone: function() {
|
_showDone() {
|
||||||
this.animationInProgress = false;
|
this.animationInProgress = false;
|
||||||
this._desktopFade.hide();
|
this._desktopFade.hide();
|
||||||
this._coverPane.hide();
|
this._coverPane.hide();
|
||||||
@ -586,7 +586,7 @@ var Overview = new Lang.Class({
|
|||||||
// hide:
|
// hide:
|
||||||
//
|
//
|
||||||
// Reverses the effect of show()
|
// Reverses the effect of show()
|
||||||
hide: function() {
|
hide() {
|
||||||
if (this.isDummy)
|
if (this.isDummy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -610,7 +610,7 @@ var Overview = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
_animateNotVisible: function() {
|
_animateNotVisible() {
|
||||||
if (!this.visible || this.animationInProgress)
|
if (!this.visible || this.animationInProgress)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -634,7 +634,7 @@ var Overview = new Lang.Class({
|
|||||||
this.emit('hiding');
|
this.emit('hiding');
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideDone: function() {
|
_hideDone() {
|
||||||
// Re-enable unredirection
|
// Re-enable unredirection
|
||||||
Meta.enable_unredirect_for_screen(global.screen);
|
Meta.enable_unredirect_for_screen(global.screen);
|
||||||
|
|
||||||
@ -661,7 +661,7 @@ var Overview = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle: function() {
|
toggle() {
|
||||||
if (this.isDummy)
|
if (this.isDummy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -671,7 +671,7 @@ var Overview = new Lang.Class({
|
|||||||
this.show();
|
this.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
getShowAppsButton: function() {
|
getShowAppsButton() {
|
||||||
return this._dash.showAppsButton;
|
return this._dash.showAppsButton;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -34,7 +34,7 @@ var SlideLayout = new Lang.Class({
|
|||||||
Name: 'SlideLayout',
|
Name: 'SlideLayout',
|
||||||
Extends: Clutter.FixedLayout,
|
Extends: Clutter.FixedLayout,
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
this._slideX = 1;
|
this._slideX = 1;
|
||||||
this._translationX = undefined;
|
this._translationX = undefined;
|
||||||
this._direction = SlideDirection.LEFT;
|
this._direction = SlideDirection.LEFT;
|
||||||
@ -42,7 +42,7 @@ var SlideLayout = new Lang.Class({
|
|||||||
this.parent(params);
|
this.parent(params);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_width: function(container, forHeight) {
|
vfunc_get_preferred_width(container, forHeight) {
|
||||||
let child = container.get_first_child();
|
let child = container.get_first_child();
|
||||||
|
|
||||||
let [minWidth, natWidth] = child.get_preferred_width(forHeight);
|
let [minWidth, natWidth] = child.get_preferred_width(forHeight);
|
||||||
@ -53,7 +53,7 @@ var SlideLayout = new Lang.Class({
|
|||||||
return [minWidth, natWidth];
|
return [minWidth, natWidth];
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_allocate: function(container, box, flags) {
|
vfunc_allocate(container, box, flags) {
|
||||||
let child = container.get_first_child();
|
let child = container.get_first_child();
|
||||||
|
|
||||||
let availWidth = Math.round(box.x2 - box.x1);
|
let availWidth = Math.round(box.x2 - box.x1);
|
||||||
@ -107,7 +107,7 @@ var SlideLayout = new Lang.Class({
|
|||||||
var SlidingControl = new Lang.Class({
|
var SlidingControl = new Lang.Class({
|
||||||
Name: 'SlidingControl',
|
Name: 'SlidingControl',
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
params = Params.parse(params, { slideDirection: SlideDirection.LEFT });
|
params = Params.parse(params, { slideDirection: SlideDirection.LEFT });
|
||||||
|
|
||||||
this._visible = true;
|
this._visible = true;
|
||||||
@ -130,23 +130,23 @@ var SlidingControl = new Lang.Class({
|
|||||||
Main.overview.connect('window-drag-end', Lang.bind(this, this._onWindowDragEnd));
|
Main.overview.connect('window-drag-end', Lang.bind(this, this._onWindowDragEnd));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSlide: function() {
|
_getSlide() {
|
||||||
throw new Error('getSlide() must be overridden');
|
throw new Error('getSlide() must be overridden');
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSlide: function() {
|
_updateSlide() {
|
||||||
Tweener.addTween(this.layout, { slideX: this._getSlide(),
|
Tweener.addTween(this.layout, { slideX: this._getSlide(),
|
||||||
time: SIDE_CONTROLS_ANIMATION_TIME,
|
time: SIDE_CONTROLS_ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad' });
|
transition: 'easeOutQuad' });
|
||||||
},
|
},
|
||||||
|
|
||||||
getVisibleWidth: function() {
|
getVisibleWidth() {
|
||||||
let child = this.actor.get_first_child();
|
let child = this.actor.get_first_child();
|
||||||
let [, , natWidth, ] = child.get_preferred_size();
|
let [, , natWidth, ] = child.get_preferred_size();
|
||||||
return natWidth;
|
return natWidth;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getTranslation: function() {
|
_getTranslation() {
|
||||||
let child = this.actor.get_first_child();
|
let child = this.actor.get_first_child();
|
||||||
let direction = getRtlSlideDirection(this.layout.slideDirection, child);
|
let direction = getRtlSlideDirection(this.layout.slideDirection, child);
|
||||||
let visibleWidth = this.getVisibleWidth();
|
let visibleWidth = this.getVisibleWidth();
|
||||||
@ -157,7 +157,7 @@ var SlidingControl = new Lang.Class({
|
|||||||
return visibleWidth;
|
return visibleWidth;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateTranslation: function() {
|
_updateTranslation() {
|
||||||
let translationStart = 0;
|
let translationStart = 0;
|
||||||
let translationEnd = 0;
|
let translationEnd = 0;
|
||||||
let translation = this._getTranslation();
|
let translation = this._getTranslation();
|
||||||
@ -178,57 +178,57 @@ var SlidingControl = new Lang.Class({
|
|||||||
transition: 'easeOutQuad' });
|
transition: 'easeOutQuad' });
|
||||||
},
|
},
|
||||||
|
|
||||||
_onOverviewHiding: function() {
|
_onOverviewHiding() {
|
||||||
// We need to explicitly slideOut since showing pages
|
// We need to explicitly slideOut since showing pages
|
||||||
// doesn't imply sliding out, instead, hiding the overview does.
|
// doesn't imply sliding out, instead, hiding the overview does.
|
||||||
this.slideOut();
|
this.slideOut();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onWindowDragBegin: function() {
|
_onWindowDragBegin() {
|
||||||
this._onDragBegin();
|
this._onDragBegin();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onWindowDragEnd: function() {
|
_onWindowDragEnd() {
|
||||||
this._onDragEnd();
|
this._onDragEnd();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragBegin: function() {
|
_onDragBegin() {
|
||||||
this._inDrag = true;
|
this._inDrag = true;
|
||||||
this._updateTranslation();
|
this._updateTranslation();
|
||||||
this._updateSlide();
|
this._updateSlide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragEnd: function() {
|
_onDragEnd() {
|
||||||
this._inDrag = false;
|
this._inDrag = false;
|
||||||
this._updateSlide();
|
this._updateSlide();
|
||||||
},
|
},
|
||||||
|
|
||||||
fadeIn: function() {
|
fadeIn() {
|
||||||
Tweener.addTween(this.actor, { opacity: 255,
|
Tweener.addTween(this.actor, { opacity: 255,
|
||||||
time: SIDE_CONTROLS_ANIMATION_TIME / 2,
|
time: SIDE_CONTROLS_ANIMATION_TIME / 2,
|
||||||
transition: 'easeInQuad'
|
transition: 'easeInQuad'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
fadeHalf: function() {
|
fadeHalf() {
|
||||||
Tweener.addTween(this.actor, { opacity: 128,
|
Tweener.addTween(this.actor, { opacity: 128,
|
||||||
time: SIDE_CONTROLS_ANIMATION_TIME / 2,
|
time: SIDE_CONTROLS_ANIMATION_TIME / 2,
|
||||||
transition: 'easeOutQuad'
|
transition: 'easeOutQuad'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
slideIn: function() {
|
slideIn() {
|
||||||
this._visible = true;
|
this._visible = true;
|
||||||
// we will update slideX and the translation from pageEmpty
|
// we will update slideX and the translation from pageEmpty
|
||||||
},
|
},
|
||||||
|
|
||||||
slideOut: function() {
|
slideOut() {
|
||||||
this._visible = false;
|
this._visible = false;
|
||||||
this._updateTranslation();
|
this._updateTranslation();
|
||||||
// we will update slideX from pageEmpty
|
// we will update slideX from pageEmpty
|
||||||
},
|
},
|
||||||
|
|
||||||
pageEmpty: function() {
|
pageEmpty() {
|
||||||
// When pageEmpty is received, there's no visible view in the
|
// When pageEmpty is received, there's no visible view in the
|
||||||
// selector; this means we can now safely set the full slide for
|
// selector; this means we can now safely set the full slide for
|
||||||
// the next page, since slideIn or slideOut might have been called,
|
// the next page, since slideIn or slideOut might have been called,
|
||||||
@ -242,7 +242,7 @@ var ThumbnailsSlider = new Lang.Class({
|
|||||||
Name: 'ThumbnailsSlider',
|
Name: 'ThumbnailsSlider',
|
||||||
Extends: SlidingControl,
|
Extends: SlidingControl,
|
||||||
|
|
||||||
_init: function(thumbnailsBox) {
|
_init(thumbnailsBox) {
|
||||||
this.parent({ slideDirection: SlideDirection.RIGHT });
|
this.parent({ slideDirection: SlideDirection.RIGHT });
|
||||||
|
|
||||||
this._thumbnailsBox = thumbnailsBox;
|
this._thumbnailsBox = thumbnailsBox;
|
||||||
@ -257,7 +257,7 @@ var ThumbnailsSlider = new Lang.Class({
|
|||||||
this._thumbnailsBox.actor.bind_property('visible', this.actor, 'visible', GObject.BindingFlags.SYNC_CREATE);
|
this._thumbnailsBox.actor.bind_property('visible', this.actor, 'visible', GObject.BindingFlags.SYNC_CREATE);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getAlwaysZoomOut: function() {
|
_getAlwaysZoomOut() {
|
||||||
// Always show the pager on hover or during a drag
|
// Always show the pager on hover or during a drag
|
||||||
let alwaysZoomOut = this.actor.hover || this._inDrag;
|
let alwaysZoomOut = this.actor.hover || this._inDrag;
|
||||||
|
|
||||||
@ -279,12 +279,12 @@ var ThumbnailsSlider = new Lang.Class({
|
|||||||
return alwaysZoomOut;
|
return alwaysZoomOut;
|
||||||
},
|
},
|
||||||
|
|
||||||
getNonExpandedWidth: function() {
|
getNonExpandedWidth() {
|
||||||
let child = this.actor.get_first_child();
|
let child = this.actor.get_first_child();
|
||||||
return child.get_theme_node().get_length('visible-width');
|
return child.get_theme_node().get_length('visible-width');
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSlide: function() {
|
_getSlide() {
|
||||||
if (!this._visible)
|
if (!this._visible)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ var ThumbnailsSlider = new Lang.Class({
|
|||||||
return this.getNonExpandedWidth() / expandedWidth;
|
return this.getNonExpandedWidth() / expandedWidth;
|
||||||
},
|
},
|
||||||
|
|
||||||
getVisibleWidth: function() {
|
getVisibleWidth() {
|
||||||
let alwaysZoomOut = this._getAlwaysZoomOut();
|
let alwaysZoomOut = this._getAlwaysZoomOut();
|
||||||
if (alwaysZoomOut)
|
if (alwaysZoomOut)
|
||||||
return this.parent();
|
return this.parent();
|
||||||
@ -312,7 +312,7 @@ var DashSlider = new Lang.Class({
|
|||||||
Name: 'DashSlider',
|
Name: 'DashSlider',
|
||||||
Extends: SlidingControl,
|
Extends: SlidingControl,
|
||||||
|
|
||||||
_init: function(dash) {
|
_init(dash) {
|
||||||
this.parent({ slideDirection: SlideDirection.LEFT });
|
this.parent({ slideDirection: SlideDirection.LEFT });
|
||||||
|
|
||||||
this._dash = dash;
|
this._dash = dash;
|
||||||
@ -331,18 +331,18 @@ var DashSlider = new Lang.Class({
|
|||||||
this._dash.connect('icon-size-changed', Lang.bind(this, this._updateSlide));
|
this._dash.connect('icon-size-changed', Lang.bind(this, this._updateSlide));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSlide: function() {
|
_getSlide() {
|
||||||
if (this._visible || this._inDrag)
|
if (this._visible || this._inDrag)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onWindowDragBegin: function() {
|
_onWindowDragBegin() {
|
||||||
this.fadeHalf();
|
this.fadeHalf();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onWindowDragEnd: function() {
|
_onWindowDragEnd() {
|
||||||
this.fadeIn();
|
this.fadeIn();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -351,13 +351,13 @@ var DashSpacer = new Lang.Class({
|
|||||||
Name: 'DashSpacer',
|
Name: 'DashSpacer',
|
||||||
Extends: St.Widget,
|
Extends: St.Widget,
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
this.parent(params);
|
this.parent(params);
|
||||||
|
|
||||||
this._bindConstraint = null;
|
this._bindConstraint = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
setDashActor: function(dashActor) {
|
setDashActor(dashActor) {
|
||||||
if (this._bindConstraint) {
|
if (this._bindConstraint) {
|
||||||
this.remove_constraint(this._bindConstraint);
|
this.remove_constraint(this._bindConstraint);
|
||||||
this._bindConstraint = null;
|
this._bindConstraint = null;
|
||||||
@ -370,14 +370,14 @@ var DashSpacer = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_width: function(forHeight) {
|
vfunc_get_preferred_width(forHeight) {
|
||||||
let box = this.get_allocation_box();
|
let box = this.get_allocation_box();
|
||||||
let minWidth = this.parent(forHeight)[0];
|
let minWidth = this.parent(forHeight)[0];
|
||||||
let natWidth = box.x2 - box.x1;
|
let natWidth = box.x2 - box.x1;
|
||||||
return [minWidth, natWidth];
|
return [minWidth, natWidth];
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_height: function(forWidth) {
|
vfunc_get_preferred_height(forWidth) {
|
||||||
let box = this.get_allocation_box();
|
let box = this.get_allocation_box();
|
||||||
let minHeight = this.parent(forWidth)[0];
|
let minHeight = this.parent(forWidth)[0];
|
||||||
let natHeight = box.y2 - box.y1;
|
let natHeight = box.y2 - box.y1;
|
||||||
@ -390,7 +390,7 @@ var ControlsLayout = new Lang.Class({
|
|||||||
Extends: Clutter.BinLayout,
|
Extends: Clutter.BinLayout,
|
||||||
Signals: { 'allocation-changed': { flags: GObject.SignalFlags.RUN_LAST } },
|
Signals: { 'allocation-changed': { flags: GObject.SignalFlags.RUN_LAST } },
|
||||||
|
|
||||||
vfunc_allocate: function(container, box, flags) {
|
vfunc_allocate(container, box, flags) {
|
||||||
this.parent(container, box, flags);
|
this.parent(container, box, flags);
|
||||||
this.emit('allocation-changed');
|
this.emit('allocation-changed');
|
||||||
}
|
}
|
||||||
@ -399,7 +399,7 @@ var ControlsLayout = new Lang.Class({
|
|||||||
var ControlsManager = new Lang.Class({
|
var ControlsManager = new Lang.Class({
|
||||||
Name: 'ControlsManager',
|
Name: 'ControlsManager',
|
||||||
|
|
||||||
_init: function(searchEntry) {
|
_init(searchEntry) {
|
||||||
this.dash = new Dash.Dash();
|
this.dash = new Dash.Dash();
|
||||||
this._dashSlider = new DashSlider(this.dash);
|
this._dashSlider = new DashSlider(this.dash);
|
||||||
this._dashSpacer = new DashSpacer();
|
this._dashSpacer = new DashSpacer();
|
||||||
@ -447,7 +447,7 @@ var ControlsManager = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateWorkspacesGeometry: function() {
|
_updateWorkspacesGeometry() {
|
||||||
let [x, y] = this.actor.get_transformed_position();
|
let [x, y] = this.actor.get_transformed_position();
|
||||||
let [width, height] = this.actor.get_transformed_size();
|
let [width, height] = this.actor.get_transformed_size();
|
||||||
let geometry = { x: x, y: y, width: width, height: height };
|
let geometry = { x: x, y: y, width: width, height: height };
|
||||||
@ -467,7 +467,7 @@ var ControlsManager = new Lang.Class({
|
|||||||
this.viewSelector.setWorkspacesFullGeometry(geometry);
|
this.viewSelector.setWorkspacesFullGeometry(geometry);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setVisibility: function() {
|
_setVisibility() {
|
||||||
// Ignore the case when we're leaving the overview, since
|
// Ignore the case when we're leaving the overview, since
|
||||||
// actors will be made visible again when entering the overview
|
// actors will be made visible again when entering the overview
|
||||||
// next time, and animating them while doing so is just
|
// next time, and animating them while doing so is just
|
||||||
@ -492,7 +492,7 @@ var ControlsManager = new Lang.Class({
|
|||||||
this._thumbnailsSlider.slideOut();
|
this._thumbnailsSlider.slideOut();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSpacerVisibility: function() {
|
_updateSpacerVisibility() {
|
||||||
if (Main.overview.animationInProgress && !Main.overview.visibleTarget)
|
if (Main.overview.animationInProgress && !Main.overview.visibleTarget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ var ControlsManager = new Lang.Class({
|
|||||||
this._dashSpacer.visible = (activePage == ViewSelector.ViewPage.WINDOWS);
|
this._dashSpacer.visible = (activePage == ViewSelector.ViewPage.WINDOWS);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPageEmpty: function() {
|
_onPageEmpty() {
|
||||||
this._dashSlider.pageEmpty();
|
this._dashSlider.pageEmpty();
|
||||||
this._thumbnailsSlider.pageEmpty();
|
this._thumbnailsSlider.pageEmpty();
|
||||||
|
|
||||||
|
124
js/ui/padOsd.js
124
js/ui/padOsd.js
@ -33,7 +33,7 @@ const DOWN = 1;
|
|||||||
var PadChooser = new Lang.Class({
|
var PadChooser = new Lang.Class({
|
||||||
Name: 'PadChooser',
|
Name: 'PadChooser',
|
||||||
|
|
||||||
_init: function (device, groupDevices) {
|
_init(device, groupDevices) {
|
||||||
this.actor = new St.Button({ style_class: 'pad-chooser-button',
|
this.actor = new St.Button({ style_class: 'pad-chooser-button',
|
||||||
toggle_mode: true,
|
toggle_mode: true,
|
||||||
x_fill: false,
|
x_fill: false,
|
||||||
@ -62,7 +62,7 @@ var PadChooser = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureMenu: function (devices) {
|
_ensureMenu(devices) {
|
||||||
this._padChooserMenu = new PopupMenu.PopupMenu(this.actor, 0.5, St.Side.TOP);
|
this._padChooserMenu = new PopupMenu.PopupMenu(this.actor, 0.5, St.Side.TOP);
|
||||||
this._padChooserMenu.connect('menu-closed', Lang.bind(this, function() { this.actor.set_checked(false); }));
|
this._padChooserMenu.connect('menu-closed', Lang.bind(this, function() { this.actor.set_checked(false); }));
|
||||||
this._padChooserMenu.actor.hide();
|
this._padChooserMenu.actor.hide();
|
||||||
@ -79,18 +79,18 @@ var PadChooser = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function () {
|
_onDestroy() {
|
||||||
this._padChooserMenu.destroy();
|
this._padChooserMenu.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function (devices) {
|
update(devices) {
|
||||||
if (this._padChooserMenu)
|
if (this._padChooserMenu)
|
||||||
this._padChooserMenu.actor.destroy();
|
this._padChooserMenu.actor.destroy();
|
||||||
this.actor.set_checked(false);
|
this.actor.set_checked(false);
|
||||||
this._ensureMenu(devices);
|
this._ensureMenu(devices);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function () {
|
destroy() {
|
||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -99,13 +99,13 @@ Signals.addSignalMethods(PadChooser.prototype);
|
|||||||
var KeybindingEntry = new Lang.Class({
|
var KeybindingEntry = new Lang.Class({
|
||||||
Name: 'KeybindingEntry',
|
Name: 'KeybindingEntry',
|
||||||
|
|
||||||
_init: function () {
|
_init() {
|
||||||
this.actor = new St.Entry({ hint_text: _("New shortcut…"),
|
this.actor = new St.Entry({ hint_text: _("New shortcut…"),
|
||||||
style: 'width: 10em' });
|
style: 'width: 10em' });
|
||||||
this.actor.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
|
this.actor.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCapturedEvent: function (actor, event) {
|
_onCapturedEvent(actor, event) {
|
||||||
if (event.type() != Clutter.EventType.KEY_PRESS)
|
if (event.type() != Clutter.EventType.KEY_PRESS)
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ Signals.addSignalMethods(KeybindingEntry.prototype);
|
|||||||
var ActionComboBox = new Lang.Class({
|
var ActionComboBox = new Lang.Class({
|
||||||
Name: 'ActionComboBox',
|
Name: 'ActionComboBox',
|
||||||
|
|
||||||
_init: function () {
|
_init() {
|
||||||
this.actor = new St.Button({ style_class: 'button' });
|
this.actor = new St.Button({ style_class: 'button' });
|
||||||
this.actor.connect('clicked', Lang.bind(this, this._onButtonClicked));
|
this.actor.connect('clicked', Lang.bind(this, this._onButtonClicked));
|
||||||
this.actor.set_toggle_mode(true);
|
this.actor.set_toggle_mode(true);
|
||||||
@ -169,32 +169,32 @@ var ActionComboBox = new Lang.Class({
|
|||||||
this.setAction(GDesktopEnums.PadButtonAction.NONE);
|
this.setAction(GDesktopEnums.PadButtonAction.NONE);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onActionSelected: function (action) {
|
_onActionSelected(action) {
|
||||||
this.setAction(action);
|
this.setAction(action);
|
||||||
this.popdown();
|
this.popdown();
|
||||||
this.emit('action-selected', action);
|
this.emit('action-selected', action);
|
||||||
},
|
},
|
||||||
|
|
||||||
setAction: function (action) {
|
setAction(action) {
|
||||||
this._label.set_text(this._actionLabels.get(action));
|
this._label.set_text(this._actionLabels.get(action));
|
||||||
},
|
},
|
||||||
|
|
||||||
popup: function () {
|
popup() {
|
||||||
this._editMenu.open(true);
|
this._editMenu.open(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
popdown: function () {
|
popdown() {
|
||||||
this._editMenu.close(true);
|
this._editMenu.close(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonClicked: function () {
|
_onButtonClicked() {
|
||||||
if (this.actor.get_checked())
|
if (this.actor.get_checked())
|
||||||
this.popup();
|
this.popup();
|
||||||
else
|
else
|
||||||
this.popdown();
|
this.popdown();
|
||||||
},
|
},
|
||||||
|
|
||||||
setButtonActionsActive: function (active) {
|
setButtonActionsActive(active) {
|
||||||
this._buttonItems.forEach(item => { item.setSensitive(active); });
|
this._buttonItems.forEach(item => { item.setSensitive(active); });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -203,7 +203,7 @@ Signals.addSignalMethods(ActionComboBox.prototype);
|
|||||||
var ActionEditor = new Lang.Class({
|
var ActionEditor = new Lang.Class({
|
||||||
Name: 'ActionEditor',
|
Name: 'ActionEditor',
|
||||||
|
|
||||||
_init: function () {
|
_init() {
|
||||||
let boxLayout = new Clutter.BoxLayout({ orientation: Clutter.Orientation.HORIZONTAL,
|
let boxLayout = new Clutter.BoxLayout({ orientation: Clutter.Orientation.HORIZONTAL,
|
||||||
spacing: 12 });
|
spacing: 12 });
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ var ActionEditor = new Lang.Class({
|
|||||||
this.actor.add_actor(this._doneButton);
|
this.actor.add_actor(this._doneButton);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateKeybindingEntryState: function () {
|
_updateKeybindingEntryState() {
|
||||||
if (this._currentAction == GDesktopEnums.PadButtonAction.KEYBINDING) {
|
if (this._currentAction == GDesktopEnums.PadButtonAction.KEYBINDING) {
|
||||||
this._keybindingEdit.actor.set_text(this._currentKeybinding);
|
this._keybindingEdit.actor.set_text(this._currentKeybinding);
|
||||||
this._keybindingEdit.actor.show();
|
this._keybindingEdit.actor.show();
|
||||||
@ -234,7 +234,7 @@ var ActionEditor = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setSettings: function (settings, action) {
|
setSettings(settings, action) {
|
||||||
this._buttonSettings = settings;
|
this._buttonSettings = settings;
|
||||||
|
|
||||||
this._currentAction = this._buttonSettings.get_enum('action');
|
this._currentAction = this._buttonSettings.get_enum('action');
|
||||||
@ -246,21 +246,21 @@ var ActionEditor = new Lang.Class({
|
|||||||
this._actionComboBox.setButtonActionsActive(isButton);
|
this._actionComboBox.setButtonActionsActive(isButton);
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function() {
|
close() {
|
||||||
this._actionComboBox.popdown();
|
this._actionComboBox.popdown();
|
||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeybindingEdited: function (entry, keybinding) {
|
_onKeybindingEdited(entry, keybinding) {
|
||||||
this._currentKeybinding = keybinding;
|
this._currentKeybinding = keybinding;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onActionSelected: function (menu, action) {
|
_onActionSelected(menu, action) {
|
||||||
this._currentAction = action;
|
this._currentAction = action;
|
||||||
this._updateKeybindingEntryState();
|
this._updateKeybindingEntryState();
|
||||||
},
|
},
|
||||||
|
|
||||||
_storeSettings: function () {
|
_storeSettings() {
|
||||||
if (!this._buttonSettings)
|
if (!this._buttonSettings)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ var ActionEditor = new Lang.Class({
|
|||||||
this._buttonSettings.reset('keybinding');
|
this._buttonSettings.reset('keybinding');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEditingDone: function () {
|
_onEditingDone() {
|
||||||
this._storeSettings();
|
this._storeSettings();
|
||||||
this.close();
|
this.close();
|
||||||
this.emit('done');
|
this.emit('done');
|
||||||
@ -304,7 +304,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
GObject.ParamFlags.CONSTRUCT_ONLY,
|
GObject.ParamFlags.CONSTRUCT_ONLY,
|
||||||
Clutter.Actor.$gtype) },
|
Clutter.Actor.$gtype) },
|
||||||
|
|
||||||
_init: function (params) {
|
_init(params) {
|
||||||
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/pad-osd.css');
|
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/pad-osd.css');
|
||||||
let [success, css, etag] = file.load_contents(null);
|
let [success, css, etag] = file.load_contents(null);
|
||||||
this._curEdited = null;
|
this._curEdited = null;
|
||||||
@ -347,7 +347,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
this.add_actor(actor);
|
this.add_actor(actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_wrappingSvgHeader: function () {
|
_wrappingSvgHeader() {
|
||||||
return ('<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
|
return ('<?xml version="1.0" encoding="UTF-8" standalone="no"?>' +
|
||||||
'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" ' +
|
'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" ' +
|
||||||
'xmlns:xi="http://www.w3.org/2001/XInclude" ' +
|
'xmlns:xi="http://www.w3.org/2001/XInclude" ' +
|
||||||
@ -355,13 +355,13 @@ var PadDiagram = new Lang.Class({
|
|||||||
'<style type="text/css">');
|
'<style type="text/css">');
|
||||||
},
|
},
|
||||||
|
|
||||||
_wrappingSvgFooter: function () {
|
_wrappingSvgFooter() {
|
||||||
return ('</style>' +
|
return ('</style>' +
|
||||||
'<xi:include href="' + this._imagePath + '" />' +
|
'<xi:include href="' + this._imagePath + '" />' +
|
||||||
'</svg>');
|
'</svg>');
|
||||||
},
|
},
|
||||||
|
|
||||||
_cssString: function () {
|
_cssString() {
|
||||||
let css = this._css;
|
let css = this._css;
|
||||||
|
|
||||||
for (let i = 0; i < this._activeButtons.length; i++) {
|
for (let i = 0; i < this._activeButtons.length; i++) {
|
||||||
@ -375,7 +375,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
return css;
|
return css;
|
||||||
},
|
},
|
||||||
|
|
||||||
_composeStyledDiagram: function () {
|
_composeStyledDiagram() {
|
||||||
let svgData = '';
|
let svgData = '';
|
||||||
|
|
||||||
if (!GLib.file_test(this._imagePath, GLib.FileTest.EXISTS))
|
if (!GLib.file_test(this._imagePath, GLib.FileTest.EXISTS))
|
||||||
@ -393,7 +393,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
return handle;
|
return handle;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateDiagramScale: function () {
|
_updateDiagramScale() {
|
||||||
if (this._handle == null)
|
if (this._handle == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -404,7 +404,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
this._scale = Math.min(scaleX, scaleY);
|
this._scale = Math.min(scaleX, scaleY);
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocateChild: function (child, x, y, direction) {
|
_allocateChild(child, x, y, direction) {
|
||||||
let [prefHeight, natHeight] = child.get_preferred_height(-1);
|
let [prefHeight, natHeight] = child.get_preferred_height(-1);
|
||||||
let [prefWidth, natWidth] = child.get_preferred_width(natHeight);
|
let [prefWidth, natWidth] = child.get_preferred_width(natHeight);
|
||||||
let childBox = new Clutter.ActorBox();
|
let childBox = new Clutter.ActorBox();
|
||||||
@ -422,7 +422,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
child.allocate(childBox, 0);
|
child.allocate(childBox, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_allocate: function (box, flags) {
|
vfunc_allocate(box, flags) {
|
||||||
this.parent(box, flags);
|
this.parent(box, flags);
|
||||||
this._updateDiagramScale();
|
this._updateDiagramScale();
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_repaint: function () {
|
vfunc_repaint() {
|
||||||
if (this._handle == null)
|
if (this._handle == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
cr.$dispose();
|
cr.$dispose();
|
||||||
},
|
},
|
||||||
|
|
||||||
_transformPoint: function (x, y) {
|
_transformPoint(x, y) {
|
||||||
if (this._handle == null || this._scale == null)
|
if (this._handle == null || this._scale == null)
|
||||||
return [x, y];
|
return [x, y];
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
return [Math.round(x), Math.round(y)];
|
return [Math.round(x), Math.round(y)];
|
||||||
},
|
},
|
||||||
|
|
||||||
_getItemLabelCoords: function (labelName, leaderName) {
|
_getItemLabelCoords(labelName, leaderName) {
|
||||||
if (this._handle == null)
|
if (this._handle == null)
|
||||||
return [false];
|
return [false];
|
||||||
|
|
||||||
@ -504,7 +504,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
return [true, x, y, direction];
|
return [true, x, y, direction];
|
||||||
},
|
},
|
||||||
|
|
||||||
getButtonLabelCoords: function (button) {
|
getButtonLabelCoords(button) {
|
||||||
let ch = String.fromCharCode('A'.charCodeAt() + button);
|
let ch = String.fromCharCode('A'.charCodeAt() + button);
|
||||||
let labelName = 'Label' + ch;
|
let labelName = 'Label' + ch;
|
||||||
let leaderName = 'Leader' + ch;
|
let leaderName = 'Leader' + ch;
|
||||||
@ -512,7 +512,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
return this._getItemLabelCoords(labelName, leaderName);
|
return this._getItemLabelCoords(labelName, leaderName);
|
||||||
},
|
},
|
||||||
|
|
||||||
getRingLabelCoords: function (number, dir) {
|
getRingLabelCoords(number, dir) {
|
||||||
let numStr = number > 0 ? (number + 1).toString() : '';
|
let numStr = number > 0 ? (number + 1).toString() : '';
|
||||||
let dirStr = dir == CW ? 'CW' : 'CCW';
|
let dirStr = dir == CW ? 'CW' : 'CCW';
|
||||||
let labelName = 'LabelRing' + numStr + dirStr;
|
let labelName = 'LabelRing' + numStr + dirStr;
|
||||||
@ -521,7 +521,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
return this._getItemLabelCoords(labelName, leaderName);
|
return this._getItemLabelCoords(labelName, leaderName);
|
||||||
},
|
},
|
||||||
|
|
||||||
getStripLabelCoords: function (number, dir) {
|
getStripLabelCoords(number, dir) {
|
||||||
let numStr = number > 0 ? (number + 1).toString() : '';
|
let numStr = number > 0 ? (number + 1).toString() : '';
|
||||||
let dirStr = dir == UP ? 'Up' : 'Down';
|
let dirStr = dir == UP ? 'Up' : 'Down';
|
||||||
let labelName = 'LabelStrip' + numStr + dirStr;
|
let labelName = 'LabelStrip' + numStr + dirStr;
|
||||||
@ -530,7 +530,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
return this._getItemLabelCoords(labelName, leaderName);
|
return this._getItemLabelCoords(labelName, leaderName);
|
||||||
},
|
},
|
||||||
|
|
||||||
getLabelCoords: function (action, idx, dir) {
|
getLabelCoords(action, idx, dir) {
|
||||||
if (action == Meta.PadActionType.BUTTON)
|
if (action == Meta.PadActionType.BUTTON)
|
||||||
return this.getButtonLabelCoords(idx);
|
return this.getButtonLabelCoords(idx);
|
||||||
else if (action == Meta.PadActionType.RING)
|
else if (action == Meta.PadActionType.RING)
|
||||||
@ -541,19 +541,19 @@ var PadDiagram = new Lang.Class({
|
|||||||
return [false];
|
return [false];
|
||||||
},
|
},
|
||||||
|
|
||||||
_invalidateSvg: function () {
|
_invalidateSvg() {
|
||||||
if (this._handle == null)
|
if (this._handle == null)
|
||||||
return;
|
return;
|
||||||
this._handle = this._composeStyledDiagram();
|
this._handle = this._composeStyledDiagram();
|
||||||
this.queue_repaint();
|
this.queue_repaint();
|
||||||
},
|
},
|
||||||
|
|
||||||
activateButton: function (button) {
|
activateButton(button) {
|
||||||
this._activeButtons.push(button);
|
this._activeButtons.push(button);
|
||||||
this._invalidateSvg();
|
this._invalidateSvg();
|
||||||
},
|
},
|
||||||
|
|
||||||
deactivateButton: function (button) {
|
deactivateButton(button) {
|
||||||
for (let i = 0; i < this._activeButtons.length; i++) {
|
for (let i = 0; i < this._activeButtons.length; i++) {
|
||||||
if (this._activeButtons[i] == button)
|
if (this._activeButtons[i] == button)
|
||||||
this._activeButtons.splice(i, 1);
|
this._activeButtons.splice(i, 1);
|
||||||
@ -561,12 +561,12 @@ var PadDiagram = new Lang.Class({
|
|||||||
this._invalidateSvg();
|
this._invalidateSvg();
|
||||||
},
|
},
|
||||||
|
|
||||||
addLabel: function (label, type, idx, dir) {
|
addLabel(label, type, idx, dir) {
|
||||||
this._labels.push([label, type, idx, dir]);
|
this._labels.push([label, type, idx, dir]);
|
||||||
this.add_actor(label);
|
this.add_actor(label);
|
||||||
},
|
},
|
||||||
|
|
||||||
_applyLabel: function(label, action, idx, dir, str) {
|
_applyLabel(label, action, idx, dir, str) {
|
||||||
if (str != null) {
|
if (str != null) {
|
||||||
label.set_text(str);
|
label.set_text(str);
|
||||||
|
|
||||||
@ -576,7 +576,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
label.show();
|
label.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
stopEdition: function (continues, str) {
|
stopEdition(continues, str) {
|
||||||
this._editorActor.hide();
|
this._editorActor.hide();
|
||||||
|
|
||||||
if (this._prevEdited) {
|
if (this._prevEdited) {
|
||||||
@ -594,7 +594,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
startEdition: function(action, idx, dir) {
|
startEdition(action, idx, dir) {
|
||||||
let editedLabel;
|
let editedLabel;
|
||||||
|
|
||||||
if (this._curEdited)
|
if (this._curEdited)
|
||||||
@ -622,7 +622,7 @@ var PadDiagram = new Lang.Class({
|
|||||||
var PadOsd = new Lang.Class({
|
var PadOsd = new Lang.Class({
|
||||||
Name: 'PadOsd',
|
Name: 'PadOsd',
|
||||||
|
|
||||||
_init: function (padDevice, settings, imagePath, editionMode, monitorIndex) {
|
_init(padDevice, settings, imagePath, editionMode, monitorIndex) {
|
||||||
this.padDevice = padDevice;
|
this.padDevice = padDevice;
|
||||||
this._groupPads = [ padDevice ];
|
this._groupPads = [ padDevice ];
|
||||||
this._settings = settings;
|
this._settings = settings;
|
||||||
@ -742,7 +742,7 @@ var PadOsd = new Lang.Class({
|
|||||||
Main.pushModal(this.actor);
|
Main.pushModal(this.actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePadChooser: function () {
|
_updatePadChooser() {
|
||||||
if (this._groupPads.length > 1) {
|
if (this._groupPads.length > 1) {
|
||||||
if (this._padChooser == null) {
|
if (this._padChooser == null) {
|
||||||
this._padChooser = new PadChooser(this.padDevice, this._groupPads)
|
this._padChooser = new PadChooser(this.padDevice, this._groupPads)
|
||||||
@ -759,7 +759,7 @@ var PadOsd = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_requestForOtherPad: function (pad) {
|
_requestForOtherPad(pad) {
|
||||||
if (pad == this.padDevice ||
|
if (pad == this.padDevice ||
|
||||||
this._groupPads.indexOf(pad) == -1)
|
this._groupPads.indexOf(pad) == -1)
|
||||||
return;
|
return;
|
||||||
@ -769,13 +769,13 @@ var PadOsd = new Lang.Class({
|
|||||||
global.display.request_pad_osd(pad, editionMode);
|
global.display.request_pad_osd(pad, editionMode);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createLabel: function (type, number, dir) {
|
_createLabel(type, number, dir) {
|
||||||
let str = global.display.get_pad_action_label(this.padDevice, type, number);
|
let str = global.display.get_pad_action_label(this.padDevice, type, number);
|
||||||
let label = new St.Label({ text: str ? str : _("None") });
|
let label = new St.Label({ text: str ? str : _("None") });
|
||||||
this._padDiagram.addLabel(label, type, number, dir);
|
this._padDiagram.addLabel(label, type, number, dir);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCapturedEvent : function (actor, event) {
|
_onCapturedEvent(actor, event) {
|
||||||
if (event.type() == Clutter.EventType.PAD_BUTTON_PRESS &&
|
if (event.type() == Clutter.EventType.PAD_BUTTON_PRESS &&
|
||||||
event.get_source_device() == this.padDevice) {
|
event.get_source_device() == this.padDevice) {
|
||||||
this._padDiagram.activateButton(event.get_button());
|
this._padDiagram.activateButton(event.get_button());
|
||||||
@ -820,7 +820,7 @@ var PadOsd = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncEditionMode: function () {
|
_syncEditionMode() {
|
||||||
this._editButton.set_reactive(!this._editionMode);
|
this._editButton.set_reactive(!this._editionMode);
|
||||||
this._editButton.save_easing_state();
|
this._editButton.save_easing_state();
|
||||||
this._editButton.set_easing_duration(200);
|
this._editButton.set_easing_duration(200);
|
||||||
@ -840,7 +840,7 @@ var PadOsd = new Lang.Class({
|
|||||||
this._titleLabel.clutter_text.set_markup('<span size="larger"><b>' + title + '</b></span>');
|
this._titleLabel.clutter_text.set_markup('<span size="larger"><b>' + title + '</b></span>');
|
||||||
},
|
},
|
||||||
|
|
||||||
_isEditedAction: function (type, number, dir) {
|
_isEditedAction(type, number, dir) {
|
||||||
if (!this._editedAction)
|
if (!this._editedAction)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -849,7 +849,7 @@ var PadOsd = new Lang.Class({
|
|||||||
this._editedAction.dir == dir);
|
this._editedAction.dir == dir);
|
||||||
},
|
},
|
||||||
|
|
||||||
_followUpActionEdition: function (str) {
|
_followUpActionEdition(str) {
|
||||||
let { type, dir, number, mode } = this._editedAction;
|
let { type, dir, number, mode } = this._editedAction;
|
||||||
let hasNextAction = (type == Meta.PadActionType.RING && dir == CCW ||
|
let hasNextAction = (type == Meta.PadActionType.RING && dir == CCW ||
|
||||||
type == Meta.PadActionType.STRIP && dir == UP);
|
type == Meta.PadActionType.STRIP && dir == UP);
|
||||||
@ -866,7 +866,7 @@ var PadOsd = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_endActionEdition: function () {
|
_endActionEdition() {
|
||||||
this._actionEditor.close();
|
this._actionEditor.close();
|
||||||
|
|
||||||
if (this._editedAction != null) {
|
if (this._editedAction != null) {
|
||||||
@ -883,7 +883,7 @@ var PadOsd = new Lang.Class({
|
|||||||
this._editedActionSettings = null;
|
this._editedActionSettings = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_startActionEdition: function (key, type, number, dir, mode) {
|
_startActionEdition(key, type, number, dir, mode) {
|
||||||
if (this._isEditedAction(type, number, dir))
|
if (this._isEditedAction(type, number, dir))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -897,25 +897,25 @@ var PadOsd = new Lang.Class({
|
|||||||
this._padDiagram.startEdition(type, number, dir);
|
this._padDiagram.startEdition(type, number, dir);
|
||||||
},
|
},
|
||||||
|
|
||||||
_startButtonActionEdition: function (button) {
|
_startButtonActionEdition(button) {
|
||||||
let ch = String.fromCharCode('A'.charCodeAt() + button);
|
let ch = String.fromCharCode('A'.charCodeAt() + button);
|
||||||
let key = 'button' + ch;
|
let key = 'button' + ch;
|
||||||
this._startActionEdition(key, Meta.PadActionType.BUTTON, button);
|
this._startActionEdition(key, Meta.PadActionType.BUTTON, button);
|
||||||
},
|
},
|
||||||
|
|
||||||
_startRingActionEdition: function (ring, dir, mode) {
|
_startRingActionEdition(ring, dir, mode) {
|
||||||
let ch = String.fromCharCode('A'.charCodeAt() + ring);
|
let ch = String.fromCharCode('A'.charCodeAt() + ring);
|
||||||
let key = 'ring%s-%s-mode-%d'.format(ch, dir == CCW ? 'ccw' : 'cw', mode);
|
let key = 'ring%s-%s-mode-%d'.format(ch, dir == CCW ? 'ccw' : 'cw', mode);
|
||||||
this._startActionEdition(key, Meta.PadActionType.RING, ring, dir, mode);
|
this._startActionEdition(key, Meta.PadActionType.RING, ring, dir, mode);
|
||||||
},
|
},
|
||||||
|
|
||||||
_startStripActionEdition: function (strip, dir, mode) {
|
_startStripActionEdition(strip, dir, mode) {
|
||||||
let ch = String.fromCharCode('A'.charCodeAt() + strip);
|
let ch = String.fromCharCode('A'.charCodeAt() + strip);
|
||||||
let key = 'strip%s-%s-mode-%d'.format(ch, dir == UP ? 'up' : 'down', mode);
|
let key = 'strip%s-%s-mode-%d'.format(ch, dir == UP ? 'up' : 'down', mode);
|
||||||
this._startActionEdition(key, Meta.PadActionType.STRIP, strip, dir, mode);
|
this._startActionEdition(key, Meta.PadActionType.STRIP, strip, dir, mode);
|
||||||
},
|
},
|
||||||
|
|
||||||
setEditionMode: function (editionMode) {
|
setEditionMode(editionMode) {
|
||||||
if (this._editionMode == editionMode)
|
if (this._editionMode == editionMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -923,11 +923,11 @@ var PadOsd = new Lang.Class({
|
|||||||
this._syncEditionMode();
|
this._syncEditionMode();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function () {
|
destroy() {
|
||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function () {
|
_onDestroy() {
|
||||||
Main.popModal(this.actor);
|
Main.popModal(this.actor);
|
||||||
this._actionEditor.close();
|
this._actionEditor.close();
|
||||||
|
|
||||||
@ -964,13 +964,13 @@ const PadOsdIface = '<node> \
|
|||||||
var PadOsdService = new Lang.Class({
|
var PadOsdService = new Lang.Class({
|
||||||
Name: 'PadOsdService',
|
Name: 'PadOsdService',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(PadOsdIface, this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(PadOsdIface, this);
|
||||||
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell/Wacom');
|
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell/Wacom');
|
||||||
Gio.DBus.session.own_name('org.gnome.Shell.Wacom.PadOsd', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
Gio.DBus.session.own_name('org.gnome.Shell.Wacom.PadOsd', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
ShowAsync: function(params, invocation) {
|
ShowAsync(params, invocation) {
|
||||||
let [deviceNode, editionMode] = params;
|
let [deviceNode, editionMode] = params;
|
||||||
let deviceManager = Clutter.DeviceManager.get_default();
|
let deviceManager = Clutter.DeviceManager.get_default();
|
||||||
let devices = deviceManager.list_devices();
|
let devices = deviceManager.list_devices();
|
||||||
|
108
js/ui/panel.js
108
js/ui/panel.js
@ -87,7 +87,7 @@ var AppMenuButton = new Lang.Class({
|
|||||||
Name: 'AppMenuButton',
|
Name: 'AppMenuButton',
|
||||||
Extends: PanelMenu.Button,
|
Extends: PanelMenu.Button,
|
||||||
|
|
||||||
_init: function(panel) {
|
_init(panel) {
|
||||||
this.parent(0.0, null, true);
|
this.parent(0.0, null, true);
|
||||||
|
|
||||||
this.actor.accessible_role = Atk.Role.MENU;
|
this.actor.accessible_role = Atk.Role.MENU;
|
||||||
@ -149,7 +149,7 @@ var AppMenuButton = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function() {
|
show() {
|
||||||
if (this._visible)
|
if (this._visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ var AppMenuButton = new Lang.Class({
|
|||||||
transition: 'easeOutQuad' });
|
transition: 'easeOutQuad' });
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide() {
|
||||||
if (!this._visible)
|
if (!this._visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -174,13 +174,13 @@ var AppMenuButton = new Lang.Class({
|
|||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
time: Overview.ANIMATION_TIME,
|
time: Overview.ANIMATION_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
},
|
},
|
||||||
onCompleteScope: this });
|
onCompleteScope: this });
|
||||||
},
|
},
|
||||||
|
|
||||||
_onStyleChanged: function(actor) {
|
_onStyleChanged(actor) {
|
||||||
let node = actor.get_theme_node();
|
let node = actor.get_theme_node();
|
||||||
let [success, icon] = node.lookup_url('spinner-image', false);
|
let [success, icon] = node.lookup_url('spinner-image', false);
|
||||||
if (!success || (this._spinnerIcon && this._spinnerIcon.equal(icon)))
|
if (!success || (this._spinnerIcon && this._spinnerIcon.equal(icon)))
|
||||||
@ -191,7 +191,7 @@ var AppMenuButton = new Lang.Class({
|
|||||||
this._spinner.actor.hide();
|
this._spinner.actor.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncIcon: function() {
|
_syncIcon() {
|
||||||
if (!this._targetApp)
|
if (!this._targetApp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -199,14 +199,14 @@ var AppMenuButton = new Lang.Class({
|
|||||||
this._iconBox.set_child(icon);
|
this._iconBox.set_child(icon);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onIconThemeChanged: function() {
|
_onIconThemeChanged() {
|
||||||
if (this._iconBox.child == null)
|
if (this._iconBox.child == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._syncIcon();
|
this._syncIcon();
|
||||||
},
|
},
|
||||||
|
|
||||||
stopAnimation: function() {
|
stopAnimation() {
|
||||||
if (this._stop)
|
if (this._stop)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ var AppMenuButton = new Lang.Class({
|
|||||||
time: SPINNER_ANIMATION_TIME,
|
time: SPINNER_ANIMATION_TIME,
|
||||||
transition: "easeOutQuad",
|
transition: "easeOutQuad",
|
||||||
onCompleteScope: this,
|
onCompleteScope: this,
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
this._spinner.stop();
|
this._spinner.stop();
|
||||||
this._spinner.actor.opacity = 255;
|
this._spinner.actor.opacity = 255;
|
||||||
this._spinner.actor.hide();
|
this._spinner.actor.hide();
|
||||||
@ -228,7 +228,7 @@ var AppMenuButton = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
startAnimation: function() {
|
startAnimation() {
|
||||||
this._stop = false;
|
this._stop = false;
|
||||||
|
|
||||||
if (this._spinner == null)
|
if (this._spinner == null)
|
||||||
@ -238,7 +238,7 @@ var AppMenuButton = new Lang.Class({
|
|||||||
this._spinner.actor.show();
|
this._spinner.actor.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAppStateChanged: function(appSys, app) {
|
_onAppStateChanged(appSys, app) {
|
||||||
let state = app.state;
|
let state = app.state;
|
||||||
if (state != Shell.AppState.STARTING) {
|
if (state != Shell.AppState.STARTING) {
|
||||||
this._startingApps = this._startingApps.filter(function(a) {
|
this._startingApps = this._startingApps.filter(function(a) {
|
||||||
@ -254,7 +254,7 @@ var AppMenuButton = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_focusAppChanged: function() {
|
_focusAppChanged() {
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
let focusedApp = tracker.focus_app;
|
let focusedApp = tracker.focus_app;
|
||||||
if (!focusedApp) {
|
if (!focusedApp) {
|
||||||
@ -267,7 +267,7 @@ var AppMenuButton = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_findTargetApp: function() {
|
_findTargetApp() {
|
||||||
let workspace = global.screen.get_active_workspace();
|
let workspace = global.screen.get_active_workspace();
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
let focusedApp = tracker.focus_app;
|
let focusedApp = tracker.focus_app;
|
||||||
@ -281,7 +281,7 @@ var AppMenuButton = new Lang.Class({
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let targetApp = this._findTargetApp();
|
let targetApp = this._findTargetApp();
|
||||||
|
|
||||||
if (this._targetApp != targetApp) {
|
if (this._targetApp != targetApp) {
|
||||||
@ -332,7 +332,7 @@ var AppMenuButton = new Lang.Class({
|
|||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_maybeSetMenu: function() {
|
_maybeSetMenu() {
|
||||||
let menu;
|
let menu;
|
||||||
|
|
||||||
if (this._targetApp == null) {
|
if (this._targetApp == null) {
|
||||||
@ -365,7 +365,7 @@ var AppMenuButton = new Lang.Class({
|
|||||||
this._menuManager.addMenu(menu);
|
this._menuManager.addMenu(menu);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
if (this._appStateChangedSignalId > 0) {
|
if (this._appStateChangedSignalId > 0) {
|
||||||
let appSys = Shell.AppSystem.get_default();
|
let appSys = Shell.AppSystem.get_default();
|
||||||
appSys.disconnect(this._appStateChangedSignalId);
|
appSys.disconnect(this._appStateChangedSignalId);
|
||||||
@ -403,7 +403,7 @@ var ActivitiesButton = new Lang.Class({
|
|||||||
Name: 'ActivitiesButton',
|
Name: 'ActivitiesButton',
|
||||||
Extends: PanelMenu.Button,
|
Extends: PanelMenu.Button,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent(0.0, null, true);
|
this.parent(0.0, null, true);
|
||||||
this.actor.accessible_role = Atk.Role.TOGGLE_BUTTON;
|
this.actor.accessible_role = Atk.Role.TOGGLE_BUTTON;
|
||||||
|
|
||||||
@ -432,7 +432,7 @@ var ActivitiesButton = new Lang.Class({
|
|||||||
this._xdndTimeOut = 0;
|
this._xdndTimeOut = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleDragOver: function(source, actor, x, y, time) {
|
handleDragOver(source, actor, x, y, time) {
|
||||||
if (source != Main.xdndHandler)
|
if (source != Main.xdndHandler)
|
||||||
return DND.DragMotionResult.CONTINUE;
|
return DND.DragMotionResult.CONTINUE;
|
||||||
|
|
||||||
@ -445,7 +445,7 @@ var ActivitiesButton = new Lang.Class({
|
|||||||
return DND.DragMotionResult.CONTINUE;
|
return DND.DragMotionResult.CONTINUE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCapturedEvent: function(actor, event) {
|
_onCapturedEvent(actor, event) {
|
||||||
if (event.type() == Clutter.EventType.BUTTON_PRESS ||
|
if (event.type() == Clutter.EventType.BUTTON_PRESS ||
|
||||||
event.type() == Clutter.EventType.TOUCH_BEGIN) {
|
event.type() == Clutter.EventType.TOUCH_BEGIN) {
|
||||||
if (!Main.overview.shouldToggleByCornerOrButton())
|
if (!Main.overview.shouldToggleByCornerOrButton())
|
||||||
@ -454,7 +454,7 @@ var ActivitiesButton = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEvent: function(actor, event) {
|
_onEvent(actor, event) {
|
||||||
this.parent(actor, event);
|
this.parent(actor, event);
|
||||||
|
|
||||||
if (event.type() == Clutter.EventType.TOUCH_END ||
|
if (event.type() == Clutter.EventType.TOUCH_END ||
|
||||||
@ -465,7 +465,7 @@ var ActivitiesButton = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyRelease: function(actor, event) {
|
_onKeyRelease(actor, event) {
|
||||||
let symbol = event.get_key_symbol();
|
let symbol = event.get_key_symbol();
|
||||||
if (symbol == Clutter.KEY_Return || symbol == Clutter.KEY_space) {
|
if (symbol == Clutter.KEY_Return || symbol == Clutter.KEY_space) {
|
||||||
if (Main.overview.shouldToggleByCornerOrButton())
|
if (Main.overview.shouldToggleByCornerOrButton())
|
||||||
@ -474,7 +474,7 @@ var ActivitiesButton = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_xdndToggleOverview: function(actor) {
|
_xdndToggleOverview(actor) {
|
||||||
let [x, y, mask] = global.get_pointer();
|
let [x, y, mask] = global.get_pointer();
|
||||||
let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
|
let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ var ActivitiesButton = new Lang.Class({
|
|||||||
var PanelCorner = new Lang.Class({
|
var PanelCorner = new Lang.Class({
|
||||||
Name: 'PanelCorner',
|
Name: 'PanelCorner',
|
||||||
|
|
||||||
_init: function(side) {
|
_init(side) {
|
||||||
this._side = side;
|
this._side = side;
|
||||||
|
|
||||||
this.actor = new St.DrawingArea({ style_class: 'panel-corner' });
|
this.actor = new St.DrawingArea({ style_class: 'panel-corner' });
|
||||||
@ -498,7 +498,7 @@ var PanelCorner = new Lang.Class({
|
|||||||
this.actor.connect('repaint', Lang.bind(this, this._repaint));
|
this.actor.connect('repaint', Lang.bind(this, this._repaint));
|
||||||
},
|
},
|
||||||
|
|
||||||
_findRightmostButton: function(container) {
|
_findRightmostButton(container) {
|
||||||
if (!container.get_children)
|
if (!container.get_children)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -523,7 +523,7 @@ var PanelCorner = new Lang.Class({
|
|||||||
return children[index];
|
return children[index];
|
||||||
},
|
},
|
||||||
|
|
||||||
_findLeftmostButton: function(container) {
|
_findLeftmostButton(container) {
|
||||||
if (!container.get_children)
|
if (!container.get_children)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -548,7 +548,7 @@ var PanelCorner = new Lang.Class({
|
|||||||
return children[index];
|
return children[index];
|
||||||
},
|
},
|
||||||
|
|
||||||
setStyleParent: function(box) {
|
setStyleParent(box) {
|
||||||
let side = this._side;
|
let side = this._side;
|
||||||
|
|
||||||
let rtlAwareContainer = box instanceof St.BoxLayout;
|
let rtlAwareContainer = box instanceof St.BoxLayout;
|
||||||
@ -595,7 +595,7 @@ var PanelCorner = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_repaint: function() {
|
_repaint() {
|
||||||
let node = this.actor.get_theme_node();
|
let node = this.actor.get_theme_node();
|
||||||
|
|
||||||
let cornerRadius = node.get_length("-panel-corner-radius");
|
let cornerRadius = node.get_length("-panel-corner-radius");
|
||||||
@ -643,7 +643,7 @@ var PanelCorner = new Lang.Class({
|
|||||||
cr.$dispose();
|
cr.$dispose();
|
||||||
},
|
},
|
||||||
|
|
||||||
_styleChanged: function() {
|
_styleChanged() {
|
||||||
let node = this.actor.get_theme_node();
|
let node = this.actor.get_theme_node();
|
||||||
|
|
||||||
let cornerRadius = node.get_length("-panel-corner-radius");
|
let cornerRadius = node.get_length("-panel-corner-radius");
|
||||||
@ -658,7 +658,7 @@ var AggregateLayout = new Lang.Class({
|
|||||||
Name: 'AggregateLayout',
|
Name: 'AggregateLayout',
|
||||||
Extends: Clutter.BoxLayout,
|
Extends: Clutter.BoxLayout,
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
if (!params)
|
if (!params)
|
||||||
params = {};
|
params = {};
|
||||||
params['orientation'] = Clutter.Orientation.VERTICAL;
|
params['orientation'] = Clutter.Orientation.VERTICAL;
|
||||||
@ -667,12 +667,12 @@ var AggregateLayout = new Lang.Class({
|
|||||||
this._sizeChildren = [];
|
this._sizeChildren = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
addSizeChild: function(actor) {
|
addSizeChild(actor) {
|
||||||
this._sizeChildren.push(actor);
|
this._sizeChildren.push(actor);
|
||||||
this.layout_changed();
|
this.layout_changed();
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_preferred_width: function(container, forHeight) {
|
vfunc_get_preferred_width(container, forHeight) {
|
||||||
let themeNode = container.get_theme_node();
|
let themeNode = container.get_theme_node();
|
||||||
let minWidth = themeNode.get_min_width();
|
let minWidth = themeNode.get_min_width();
|
||||||
let natWidth = minWidth;
|
let natWidth = minWidth;
|
||||||
@ -691,7 +691,7 @@ var AggregateMenu = new Lang.Class({
|
|||||||
Name: 'AggregateMenu',
|
Name: 'AggregateMenu',
|
||||||
Extends: PanelMenu.Button,
|
Extends: PanelMenu.Button,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent(0.0, C_("System menu in the top bar", "System"), false);
|
this.parent(0.0, C_("System menu in the top bar", "System"), false);
|
||||||
this.menu.actor.add_style_class_name('aggregate-menu');
|
this.menu.actor.add_style_class_name('aggregate-menu');
|
||||||
|
|
||||||
@ -771,7 +771,7 @@ const PANEL_ITEM_IMPLEMENTATIONS = {
|
|||||||
var Panel = new Lang.Class({
|
var Panel = new Lang.Class({
|
||||||
Name: 'Panel',
|
Name: 'Panel',
|
||||||
|
|
||||||
_init : function() {
|
_init() {
|
||||||
this.actor = new Shell.GenericContainer({ name: 'panel',
|
this.actor = new Shell.GenericContainer({ name: 'panel',
|
||||||
reactive: true });
|
reactive: true });
|
||||||
this.actor._delegate = this;
|
this.actor._delegate = this;
|
||||||
@ -825,7 +825,7 @@ var Panel = new Lang.Class({
|
|||||||
this._updatePanel();
|
this._updatePanel();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onWindowActorAdded: function(container, metaWindowActor) {
|
_onWindowActorAdded(container, metaWindowActor) {
|
||||||
let signalIds = [];
|
let signalIds = [];
|
||||||
['allocation-changed', 'notify::visible'].forEach(s => {
|
['allocation-changed', 'notify::visible'].forEach(s => {
|
||||||
signalIds.push(metaWindowActor.connect(s, Lang.bind(this, this._updateSolidStyle)));
|
signalIds.push(metaWindowActor.connect(s, Lang.bind(this, this._updateSolidStyle)));
|
||||||
@ -833,7 +833,7 @@ var Panel = new Lang.Class({
|
|||||||
this._trackedWindows.set(metaWindowActor, signalIds);
|
this._trackedWindows.set(metaWindowActor, signalIds);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onWindowActorRemoved: function(container, metaWindowActor) {
|
_onWindowActorRemoved(container, metaWindowActor) {
|
||||||
this._trackedWindows.get(metaWindowActor).forEach(id => {
|
this._trackedWindows.get(metaWindowActor).forEach(id => {
|
||||||
metaWindowActor.disconnect(id);
|
metaWindowActor.disconnect(id);
|
||||||
});
|
});
|
||||||
@ -841,7 +841,7 @@ var Panel = new Lang.Class({
|
|||||||
this._updateSolidStyle();
|
this._updateSolidStyle();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredWidth: function(actor, forHeight, alloc) {
|
_getPreferredWidth(actor, forHeight, alloc) {
|
||||||
let primaryMonitor = Main.layoutManager.primaryMonitor;
|
let primaryMonitor = Main.layoutManager.primaryMonitor;
|
||||||
|
|
||||||
alloc.min_size = -1;
|
alloc.min_size = -1;
|
||||||
@ -852,13 +852,13 @@ var Panel = new Lang.Class({
|
|||||||
alloc.natural_size = -1;
|
alloc.natural_size = -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredHeight: function(actor, forWidth, alloc) {
|
_getPreferredHeight(actor, forWidth, alloc) {
|
||||||
// We don't need to implement this; it's forced by the CSS
|
// We don't need to implement this; it's forced by the CSS
|
||||||
alloc.min_size = -1;
|
alloc.min_size = -1;
|
||||||
alloc.natural_size = -1;
|
alloc.natural_size = -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocate: function(actor, box, flags) {
|
_allocate(actor, box, flags) {
|
||||||
let allocWidth = box.x2 - box.x1;
|
let allocWidth = box.x2 - box.x1;
|
||||||
let allocHeight = box.y2 - box.y1;
|
let allocHeight = box.y2 - box.y1;
|
||||||
|
|
||||||
@ -935,7 +935,7 @@ var Panel = new Lang.Class({
|
|||||||
this._rightCorner.actor.allocate(childBox, flags);
|
this._rightCorner.actor.allocate(childBox, flags);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonPress: function(actor, event) {
|
_onButtonPress(actor, event) {
|
||||||
if (Main.modalCount > 0)
|
if (Main.modalCount > 0)
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
|
||||||
@ -977,7 +977,7 @@ var Panel = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyPress: function(actor, event) {
|
_onKeyPress(actor, event) {
|
||||||
let symbol = event.get_key_symbol();
|
let symbol = event.get_key_symbol();
|
||||||
if (symbol == Clutter.KEY_Escape) {
|
if (symbol == Clutter.KEY_Escape) {
|
||||||
global.screen.focus_default_window(event.get_time());
|
global.screen.focus_default_window(event.get_time());
|
||||||
@ -987,7 +987,7 @@ var Panel = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_toggleMenu: function(indicator) {
|
_toggleMenu(indicator) {
|
||||||
if (!indicator) // menu not supported by current session mode
|
if (!indicator) // menu not supported by current session mode
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1000,15 +1000,15 @@ var Panel = new Lang.Class({
|
|||||||
menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleAppMenu: function() {
|
toggleAppMenu() {
|
||||||
this._toggleMenu(this.statusArea.appMenu);
|
this._toggleMenu(this.statusArea.appMenu);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleCalendar: function() {
|
toggleCalendar() {
|
||||||
this._toggleMenu(this.statusArea.dateMenu);
|
this._toggleMenu(this.statusArea.dateMenu);
|
||||||
},
|
},
|
||||||
|
|
||||||
closeCalendar: function() {
|
closeCalendar() {
|
||||||
let indicator = this.statusArea.dateMenu;
|
let indicator = this.statusArea.dateMenu;
|
||||||
if (!indicator) // calendar not supported by current session mode
|
if (!indicator) // calendar not supported by current session mode
|
||||||
return;
|
return;
|
||||||
@ -1035,7 +1035,7 @@ var Panel = new Lang.Class({
|
|||||||
return this._leftBox.opacity;
|
return this._leftBox.opacity;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePanel: function() {
|
_updatePanel() {
|
||||||
let panel = Main.sessionMode.panel;
|
let panel = Main.sessionMode.panel;
|
||||||
this._hideIndicators();
|
this._hideIndicators();
|
||||||
this._updateBox(panel.left, this._leftBox);
|
this._updateBox(panel.left, this._leftBox);
|
||||||
@ -1068,7 +1068,7 @@ var Panel = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSolidStyle: function() {
|
_updateSolidStyle() {
|
||||||
if (this.actor.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) {
|
if (this.actor.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) {
|
||||||
this._removeStyleClassName('solid');
|
this._removeStyleClassName('solid');
|
||||||
return;
|
return;
|
||||||
@ -1101,7 +1101,7 @@ var Panel = new Lang.Class({
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideIndicators: function() {
|
_hideIndicators() {
|
||||||
for (let role in PANEL_ITEM_IMPLEMENTATIONS) {
|
for (let role in PANEL_ITEM_IMPLEMENTATIONS) {
|
||||||
let indicator = this.statusArea[role];
|
let indicator = this.statusArea[role];
|
||||||
if (!indicator)
|
if (!indicator)
|
||||||
@ -1110,7 +1110,7 @@ var Panel = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureIndicator: function(role) {
|
_ensureIndicator(role) {
|
||||||
let indicator = this.statusArea[role];
|
let indicator = this.statusArea[role];
|
||||||
if (!indicator) {
|
if (!indicator) {
|
||||||
let constructor = PANEL_ITEM_IMPLEMENTATIONS[role];
|
let constructor = PANEL_ITEM_IMPLEMENTATIONS[role];
|
||||||
@ -1124,7 +1124,7 @@ var Panel = new Lang.Class({
|
|||||||
return indicator;
|
return indicator;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateBox: function(elements, box) {
|
_updateBox(elements, box) {
|
||||||
let nChildren = box.get_n_children();
|
let nChildren = box.get_n_children();
|
||||||
|
|
||||||
for (let i = 0; i < elements.length; i++) {
|
for (let i = 0; i < elements.length; i++) {
|
||||||
@ -1137,7 +1137,7 @@ var Panel = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_addToPanelBox: function(role, indicator, position, box) {
|
_addToPanelBox(role, indicator, position, box) {
|
||||||
let container = indicator.container;
|
let container = indicator.container;
|
||||||
container.show();
|
container.show();
|
||||||
|
|
||||||
@ -1159,7 +1159,7 @@ var Panel = new Lang.Class({
|
|||||||
this._onMenuSet(indicator);
|
this._onMenuSet(indicator);
|
||||||
},
|
},
|
||||||
|
|
||||||
addToStatusArea: function(role, indicator, position, box) {
|
addToStatusArea(role, indicator, position, box) {
|
||||||
if (this.statusArea[role])
|
if (this.statusArea[role])
|
||||||
throw new Error('Extension point conflict: there is already a status indicator for role ' + role);
|
throw new Error('Extension point conflict: there is already a status indicator for role ' + role);
|
||||||
|
|
||||||
@ -1178,19 +1178,19 @@ var Panel = new Lang.Class({
|
|||||||
return indicator;
|
return indicator;
|
||||||
},
|
},
|
||||||
|
|
||||||
_addStyleClassName: function(className) {
|
_addStyleClassName(className) {
|
||||||
this.actor.add_style_class_name(className);
|
this.actor.add_style_class_name(className);
|
||||||
this._rightCorner.actor.add_style_class_name(className);
|
this._rightCorner.actor.add_style_class_name(className);
|
||||||
this._leftCorner.actor.add_style_class_name(className);
|
this._leftCorner.actor.add_style_class_name(className);
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeStyleClassName: function(className) {
|
_removeStyleClassName(className) {
|
||||||
this.actor.remove_style_class_name(className);
|
this.actor.remove_style_class_name(className);
|
||||||
this._rightCorner.actor.remove_style_class_name(className);
|
this._rightCorner.actor.remove_style_class_name(className);
|
||||||
this._leftCorner.actor.remove_style_class_name(className);
|
this._leftCorner.actor.remove_style_class_name(className);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMenuSet: function(indicator) {
|
_onMenuSet(indicator) {
|
||||||
if (!indicator.menu || indicator.menu.hasOwnProperty('_openChangedId'))
|
if (!indicator.menu || indicator.menu.hasOwnProperty('_openChangedId'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ const PopupMenu = imports.ui.popupMenu;
|
|||||||
var ButtonBox = new Lang.Class({
|
var ButtonBox = new Lang.Class({
|
||||||
Name: 'ButtonBox',
|
Name: 'ButtonBox',
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
params = Params.parse(params, { style_class: 'panel-button' }, true);
|
params = Params.parse(params, { style_class: 'panel-button' }, true);
|
||||||
this.actor = new Shell.GenericContainer(params);
|
this.actor = new Shell.GenericContainer(params);
|
||||||
this.actor._delegate = this;
|
this.actor._delegate = this;
|
||||||
@ -33,14 +33,14 @@ var ButtonBox = new Lang.Class({
|
|||||||
this._minHPadding = this._natHPadding = 0.0;
|
this._minHPadding = this._natHPadding = 0.0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onStyleChanged: function(actor) {
|
_onStyleChanged(actor) {
|
||||||
let themeNode = actor.get_theme_node();
|
let themeNode = actor.get_theme_node();
|
||||||
|
|
||||||
this._minHPadding = themeNode.get_length('-minimum-hpadding');
|
this._minHPadding = themeNode.get_length('-minimum-hpadding');
|
||||||
this._natHPadding = themeNode.get_length('-natural-hpadding');
|
this._natHPadding = themeNode.get_length('-natural-hpadding');
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredWidth: function(actor, forHeight, alloc) {
|
_getPreferredWidth(actor, forHeight, alloc) {
|
||||||
let child = actor.get_first_child();
|
let child = actor.get_first_child();
|
||||||
|
|
||||||
if (child) {
|
if (child) {
|
||||||
@ -53,7 +53,7 @@ var ButtonBox = new Lang.Class({
|
|||||||
alloc.natural_size += 2 * this._natHPadding;
|
alloc.natural_size += 2 * this._natHPadding;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredHeight: function(actor, forWidth, alloc) {
|
_getPreferredHeight(actor, forWidth, alloc) {
|
||||||
let child = actor.get_first_child();
|
let child = actor.get_first_child();
|
||||||
|
|
||||||
if (child) {
|
if (child) {
|
||||||
@ -63,7 +63,7 @@ var ButtonBox = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_allocate: function(actor, box, flags) {
|
_allocate(actor, box, flags) {
|
||||||
let child = actor.get_first_child();
|
let child = actor.get_first_child();
|
||||||
if (!child)
|
if (!child)
|
||||||
return;
|
return;
|
||||||
@ -93,7 +93,7 @@ var Button = new Lang.Class({
|
|||||||
Name: 'PanelMenuButton',
|
Name: 'PanelMenuButton',
|
||||||
Extends: ButtonBox,
|
Extends: ButtonBox,
|
||||||
|
|
||||||
_init: function(menuAlignment, nameText, dontCreateMenu) {
|
_init(menuAlignment, nameText, dontCreateMenu) {
|
||||||
this.parent({ reactive: true,
|
this.parent({ reactive: true,
|
||||||
can_focus: true,
|
can_focus: true,
|
||||||
track_hover: true,
|
track_hover: true,
|
||||||
@ -109,13 +109,13 @@ var Button = new Lang.Class({
|
|||||||
this.setMenu(new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP, 0));
|
this.setMenu(new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP, 0));
|
||||||
},
|
},
|
||||||
|
|
||||||
setSensitive: function(sensitive) {
|
setSensitive(sensitive) {
|
||||||
this.actor.reactive = sensitive;
|
this.actor.reactive = sensitive;
|
||||||
this.actor.can_focus = sensitive;
|
this.actor.can_focus = sensitive;
|
||||||
this.actor.track_hover = sensitive;
|
this.actor.track_hover = sensitive;
|
||||||
},
|
},
|
||||||
|
|
||||||
setMenu: function(menu) {
|
setMenu(menu) {
|
||||||
if (this.menu)
|
if (this.menu)
|
||||||
this.menu.destroy();
|
this.menu.destroy();
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ var Button = new Lang.Class({
|
|||||||
this.emit('menu-set');
|
this.emit('menu-set');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEvent: function(actor, event) {
|
_onEvent(actor, event) {
|
||||||
if (this.menu &&
|
if (this.menu &&
|
||||||
(event.type() == Clutter.EventType.TOUCH_BEGIN ||
|
(event.type() == Clutter.EventType.TOUCH_BEGIN ||
|
||||||
event.type() == Clutter.EventType.BUTTON_PRESS))
|
event.type() == Clutter.EventType.BUTTON_PRESS))
|
||||||
@ -140,7 +140,7 @@ var Button = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onVisibilityChanged: function() {
|
_onVisibilityChanged() {
|
||||||
if (!this.menu)
|
if (!this.menu)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ var Button = new Lang.Class({
|
|||||||
this.menu.close();
|
this.menu.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMenuKeyPress: function(actor, event) {
|
_onMenuKeyPress(actor, event) {
|
||||||
if (global.focus_manager.navigate_from_event(event))
|
if (global.focus_manager.navigate_from_event(event))
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ var Button = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onOpenStateChanged: function(menu, open) {
|
_onOpenStateChanged(menu, open) {
|
||||||
if (open)
|
if (open)
|
||||||
this.actor.add_style_pseudo_class('active');
|
this.actor.add_style_pseudo_class('active');
|
||||||
else
|
else
|
||||||
@ -184,7 +184,7 @@ var Button = new Lang.Class({
|
|||||||
this.menu.actor.style = ('max-height: %spx;').format(maxHeight);
|
this.menu.actor.style = ('max-height: %spx;').format(maxHeight);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this.actor._delegate = null;
|
this.actor._delegate = null;
|
||||||
|
|
||||||
if (this.menu)
|
if (this.menu)
|
||||||
@ -206,20 +206,20 @@ Signals.addSignalMethods(Button.prototype);
|
|||||||
var SystemIndicator = new Lang.Class({
|
var SystemIndicator = new Lang.Class({
|
||||||
Name: 'SystemIndicator',
|
Name: 'SystemIndicator',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box',
|
this.indicators = new St.BoxLayout({ style_class: 'panel-status-indicators-box',
|
||||||
reactive: true });
|
reactive: true });
|
||||||
this.indicators.hide();
|
this.indicators.hide();
|
||||||
this.menu = new PopupMenu.PopupMenuSection();
|
this.menu = new PopupMenu.PopupMenuSection();
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncIndicatorsVisible: function() {
|
_syncIndicatorsVisible() {
|
||||||
this.indicators.visible = this.indicators.get_children().some(function(actor) {
|
this.indicators.visible = this.indicators.get_children().some(function(actor) {
|
||||||
return actor.visible;
|
return actor.visible;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_addIndicator: function() {
|
_addIndicator() {
|
||||||
let icon = new St.Icon({ style_class: 'system-status-icon' });
|
let icon = new St.Icon({ style_class: 'system-status-icon' });
|
||||||
this.indicators.add_actor(icon);
|
this.indicators.add_actor(icon);
|
||||||
icon.connect('notify::visible', Lang.bind(this, this._syncIndicatorsVisible));
|
icon.connect('notify::visible', Lang.bind(this, this._syncIndicatorsVisible));
|
||||||
|
@ -25,7 +25,7 @@ function getPointerWatcher() {
|
|||||||
var PointerWatch = new Lang.Class({
|
var PointerWatch = new Lang.Class({
|
||||||
Name: 'PointerWatch',
|
Name: 'PointerWatch',
|
||||||
|
|
||||||
_init: function(watcher, interval, callback) {
|
_init(watcher, interval, callback) {
|
||||||
this.watcher = watcher;
|
this.watcher = watcher;
|
||||||
this.interval = interval;
|
this.interval = interval;
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
@ -34,7 +34,7 @@ var PointerWatch = new Lang.Class({
|
|||||||
// remove:
|
// remove:
|
||||||
// remove this watch. This function may safely be called
|
// remove this watch. This function may safely be called
|
||||||
// while the callback is executing.
|
// while the callback is executing.
|
||||||
remove: function() {
|
remove() {
|
||||||
this.watcher._removeWatch(this);
|
this.watcher._removeWatch(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -42,7 +42,7 @@ var PointerWatch = new Lang.Class({
|
|||||||
var PointerWatcher = new Lang.Class({
|
var PointerWatcher = new Lang.Class({
|
||||||
Name: 'PointerWatcher',
|
Name: 'PointerWatcher',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._idleMonitor = Meta.IdleMonitor.get_core();
|
this._idleMonitor = Meta.IdleMonitor.get_core();
|
||||||
this._idleMonitor.add_idle_watch(IDLE_TIME, Lang.bind(this, this._onIdleMonitorBecameIdle));
|
this._idleMonitor.add_idle_watch(IDLE_TIME, Lang.bind(this, this._onIdleMonitorBecameIdle));
|
||||||
this._idle = this._idleMonitor.get_idletime() > IDLE_TIME;
|
this._idle = this._idleMonitor.get_idletime() > IDLE_TIME;
|
||||||
@ -55,12 +55,12 @@ var PointerWatcher = new Lang.Class({
|
|||||||
// @interval: hint as to the time resolution needed. When the user is
|
// @interval: hint as to the time resolution needed. When the user is
|
||||||
// not idle, the position of the pointer will be queried at least
|
// not idle, the position of the pointer will be queried at least
|
||||||
// once every this many milliseconds.
|
// once every this many milliseconds.
|
||||||
// @callback: function to call when the pointer position changes - takes
|
// @callback to call when the pointer position changes - takes
|
||||||
// two arguments, X and Y.
|
// two arguments, X and Y.
|
||||||
//
|
//
|
||||||
// Set up a watch on the position of the mouse pointer. Returns a
|
// Set up a watch on the position of the mouse pointer. Returns a
|
||||||
// PointerWatch object which has a remove() method to remove the watch.
|
// PointerWatch object which has a remove() method to remove the watch.
|
||||||
addWatch: function(interval, callback) {
|
addWatch(interval, callback) {
|
||||||
// Avoid unreliably calling the watch for the current position
|
// Avoid unreliably calling the watch for the current position
|
||||||
this._updatePointer();
|
this._updatePointer();
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ var PointerWatcher = new Lang.Class({
|
|||||||
return watch;
|
return watch;
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeWatch: function(watch) {
|
_removeWatch(watch) {
|
||||||
for (let i = 0; i < this._watches.length; i++) {
|
for (let i = 0; i < this._watches.length; i++) {
|
||||||
if (this._watches[i] == watch) {
|
if (this._watches[i] == watch) {
|
||||||
this._watches.splice(i, 1);
|
this._watches.splice(i, 1);
|
||||||
@ -80,19 +80,19 @@ var PointerWatcher = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onIdleMonitorBecameActive: function(monitor) {
|
_onIdleMonitorBecameActive(monitor) {
|
||||||
this._idle = false;
|
this._idle = false;
|
||||||
this._updatePointer();
|
this._updatePointer();
|
||||||
this._updateTimeout();
|
this._updateTimeout();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onIdleMonitorBecameIdle: function(monitor) {
|
_onIdleMonitorBecameIdle(monitor) {
|
||||||
this._idle = true;
|
this._idle = true;
|
||||||
this._idleMonitor.add_user_active_watch(Lang.bind(this, this._onIdleMonitorBecameActive));
|
this._idleMonitor.add_user_active_watch(Lang.bind(this, this._onIdleMonitorBecameActive));
|
||||||
this._updateTimeout();
|
this._updateTimeout();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateTimeout: function() {
|
_updateTimeout() {
|
||||||
if (this._timeoutId) {
|
if (this._timeoutId) {
|
||||||
Mainloop.source_remove(this._timeoutId);
|
Mainloop.source_remove(this._timeoutId);
|
||||||
this._timeoutId = 0;
|
this._timeoutId = 0;
|
||||||
@ -110,12 +110,12 @@ var PointerWatcher = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
|
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._onTimeout');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onTimeout: function() {
|
_onTimeout() {
|
||||||
this._updatePointer();
|
this._updatePointer();
|
||||||
return GLib.SOURCE_CONTINUE;
|
return GLib.SOURCE_CONTINUE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePointer: function() {
|
_updatePointer() {
|
||||||
let [x, y, mods] = global.get_pointer();
|
let [x, y, mods] = global.get_pointer();
|
||||||
if (this.pointerX == x && this.pointerY == y)
|
if (this.pointerX == x && this.pointerY == y)
|
||||||
return;
|
return;
|
||||||
|
@ -61,7 +61,7 @@ function arrowIcon(side) {
|
|||||||
var PopupBaseMenuItem = new Lang.Class({
|
var PopupBaseMenuItem = new Lang.Class({
|
||||||
Name: 'PopupBaseMenuItem',
|
Name: 'PopupBaseMenuItem',
|
||||||
|
|
||||||
_init: function (params) {
|
_init(params) {
|
||||||
params = Params.parse (params, { reactive: true,
|
params = Params.parse (params, { reactive: true,
|
||||||
activate: true,
|
activate: true,
|
||||||
hover: true,
|
hover: true,
|
||||||
@ -105,30 +105,30 @@ var PopupBaseMenuItem = new Lang.Class({
|
|||||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getTopMenu: function() {
|
_getTopMenu() {
|
||||||
if (this._parent)
|
if (this._parent)
|
||||||
return this._parent._getTopMenu();
|
return this._parent._getTopMenu();
|
||||||
else
|
else
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setParent: function(parent) {
|
_setParent(parent) {
|
||||||
this._parent = parent;
|
this._parent = parent;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonPressEvent: function (actor, event) {
|
_onButtonPressEvent(actor, event) {
|
||||||
// This is the CSS active state
|
// This is the CSS active state
|
||||||
this.actor.add_style_pseudo_class ('active');
|
this.actor.add_style_pseudo_class ('active');
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonReleaseEvent: function (actor, event) {
|
_onButtonReleaseEvent(actor, event) {
|
||||||
this.actor.remove_style_pseudo_class ('active');
|
this.actor.remove_style_pseudo_class ('active');
|
||||||
this.activate(event);
|
this.activate(event);
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onTouchEvent: function (actor, event) {
|
_onTouchEvent(actor, event) {
|
||||||
if (event.type() == Clutter.EventType.TOUCH_END) {
|
if (event.type() == Clutter.EventType.TOUCH_END) {
|
||||||
this.actor.remove_style_pseudo_class ('active');
|
this.actor.remove_style_pseudo_class ('active');
|
||||||
this.activate(event);
|
this.activate(event);
|
||||||
@ -140,7 +140,7 @@ var PopupBaseMenuItem = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyPressEvent: function (actor, event) {
|
_onKeyPressEvent(actor, event) {
|
||||||
let symbol = event.get_key_symbol();
|
let symbol = event.get_key_symbol();
|
||||||
|
|
||||||
if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) {
|
if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) {
|
||||||
@ -150,23 +150,23 @@ var PopupBaseMenuItem = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyFocusIn: function (actor) {
|
_onKeyFocusIn(actor) {
|
||||||
this.setActive(true);
|
this.setActive(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyFocusOut: function (actor) {
|
_onKeyFocusOut(actor) {
|
||||||
this.setActive(false);
|
this.setActive(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onHoverChanged: function (actor) {
|
_onHoverChanged(actor) {
|
||||||
this.setActive(actor.hover);
|
this.setActive(actor.hover);
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function (event) {
|
activate(event) {
|
||||||
this.emit('activate', event);
|
this.emit('activate', event);
|
||||||
},
|
},
|
||||||
|
|
||||||
setActive: function (active) {
|
setActive(active) {
|
||||||
let activeChanged = active != this.active;
|
let activeChanged = active != this.active;
|
||||||
if (activeChanged) {
|
if (activeChanged) {
|
||||||
this.active = active;
|
this.active = active;
|
||||||
@ -187,7 +187,7 @@ var PopupBaseMenuItem = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
syncSensitive: function() {
|
syncSensitive() {
|
||||||
let sensitive = this.getSensitive();
|
let sensitive = this.getSensitive();
|
||||||
this.actor.reactive = sensitive;
|
this.actor.reactive = sensitive;
|
||||||
this.actor.can_focus = sensitive;
|
this.actor.can_focus = sensitive;
|
||||||
@ -195,12 +195,12 @@ var PopupBaseMenuItem = new Lang.Class({
|
|||||||
return sensitive;
|
return sensitive;
|
||||||
},
|
},
|
||||||
|
|
||||||
getSensitive: function() {
|
getSensitive() {
|
||||||
let parentSensitive = this._parent ? this._parent.getSensitive() : true;
|
let parentSensitive = this._parent ? this._parent.getSensitive() : true;
|
||||||
return this._activatable && this._sensitive && parentSensitive;
|
return this._activatable && this._sensitive && parentSensitive;
|
||||||
},
|
},
|
||||||
|
|
||||||
setSensitive: function(sensitive) {
|
setSensitive(sensitive) {
|
||||||
if (this._sensitive == sensitive)
|
if (this._sensitive == sensitive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -208,15 +208,15 @@ var PopupBaseMenuItem = new Lang.Class({
|
|||||||
this.syncSensitive();
|
this.syncSensitive();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this.emit('destroy');
|
this.emit('destroy');
|
||||||
},
|
},
|
||||||
|
|
||||||
setOrnament: function(ornament) {
|
setOrnament(ornament) {
|
||||||
if (ornament == this._ornament)
|
if (ornament == this._ornament)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ var PopupMenuItem = new Lang.Class({
|
|||||||
Name: 'PopupMenuItem',
|
Name: 'PopupMenuItem',
|
||||||
Extends: PopupBaseMenuItem,
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
_init: function (text, params) {
|
_init(text, params) {
|
||||||
this.parent(params);
|
this.parent(params);
|
||||||
|
|
||||||
this.label = new St.Label({ text: text });
|
this.label = new St.Label({ text: text });
|
||||||
@ -253,7 +253,7 @@ var PopupSeparatorMenuItem = new Lang.Class({
|
|||||||
Name: 'PopupSeparatorMenuItem',
|
Name: 'PopupSeparatorMenuItem',
|
||||||
Extends: PopupBaseMenuItem,
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
_init: function (text) {
|
_init(text) {
|
||||||
this.parent({ reactive: false,
|
this.parent({ reactive: false,
|
||||||
can_focus: false});
|
can_focus: false});
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ var PopupSeparatorMenuItem = new Lang.Class({
|
|||||||
this.actor.add(this._separator, { expand: true });
|
this.actor.add(this._separator, { expand: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncVisibility: function() {
|
_syncVisibility() {
|
||||||
this.label.visible = this.label.text != '';
|
this.label.visible = this.label.text != '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -279,7 +279,7 @@ var PopupSeparatorMenuItem = new Lang.Class({
|
|||||||
var Switch = new Lang.Class({
|
var Switch = new Lang.Class({
|
||||||
Name: 'Switch',
|
Name: 'Switch',
|
||||||
|
|
||||||
_init: function(state) {
|
_init(state) {
|
||||||
this.actor = new St.Bin({ style_class: 'toggle-switch',
|
this.actor = new St.Bin({ style_class: 'toggle-switch',
|
||||||
accessible_role: Atk.Role.CHECK_BOX,
|
accessible_role: Atk.Role.CHECK_BOX,
|
||||||
can_focus: true });
|
can_focus: true });
|
||||||
@ -292,7 +292,7 @@ var Switch = new Lang.Class({
|
|||||||
this.setToggleState(state);
|
this.setToggleState(state);
|
||||||
},
|
},
|
||||||
|
|
||||||
setToggleState: function(state) {
|
setToggleState(state) {
|
||||||
if (state)
|
if (state)
|
||||||
this.actor.add_style_pseudo_class('checked');
|
this.actor.add_style_pseudo_class('checked');
|
||||||
else
|
else
|
||||||
@ -300,7 +300,7 @@ var Switch = new Lang.Class({
|
|||||||
this.state = state;
|
this.state = state;
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle: function() {
|
toggle() {
|
||||||
this.setToggleState(!this.state);
|
this.setToggleState(!this.state);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -309,7 +309,7 @@ var PopupSwitchMenuItem = new Lang.Class({
|
|||||||
Name: 'PopupSwitchMenuItem',
|
Name: 'PopupSwitchMenuItem',
|
||||||
Extends: PopupBaseMenuItem,
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
_init: function(text, active, params) {
|
_init(text, active, params) {
|
||||||
this.parent(params);
|
this.parent(params);
|
||||||
|
|
||||||
this.label = new St.Label({ text: text });
|
this.label = new St.Label({ text: text });
|
||||||
@ -330,7 +330,7 @@ var PopupSwitchMenuItem = new Lang.Class({
|
|||||||
this._statusBin.child = this._switch.actor;
|
this._statusBin.child = this._switch.actor;
|
||||||
},
|
},
|
||||||
|
|
||||||
setStatus: function(text) {
|
setStatus(text) {
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
this._statusLabel.text = text;
|
this._statusLabel.text = text;
|
||||||
this._statusBin.child = this._statusLabel;
|
this._statusBin.child = this._statusLabel;
|
||||||
@ -344,7 +344,7 @@ var PopupSwitchMenuItem = new Lang.Class({
|
|||||||
this.checkAccessibleState();
|
this.checkAccessibleState();
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function(event) {
|
activate(event) {
|
||||||
if (this._switch.actor.mapped) {
|
if (this._switch.actor.mapped) {
|
||||||
this.toggle();
|
this.toggle();
|
||||||
}
|
}
|
||||||
@ -358,7 +358,7 @@ var PopupSwitchMenuItem = new Lang.Class({
|
|||||||
this.parent(event);
|
this.parent(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle: function() {
|
toggle() {
|
||||||
this._switch.toggle();
|
this._switch.toggle();
|
||||||
this.emit('toggled', this._switch.state);
|
this.emit('toggled', this._switch.state);
|
||||||
this.checkAccessibleState();
|
this.checkAccessibleState();
|
||||||
@ -368,12 +368,12 @@ var PopupSwitchMenuItem = new Lang.Class({
|
|||||||
return this._switch.state;
|
return this._switch.state;
|
||||||
},
|
},
|
||||||
|
|
||||||
setToggleState: function(state) {
|
setToggleState(state) {
|
||||||
this._switch.setToggleState(state);
|
this._switch.setToggleState(state);
|
||||||
this.checkAccessibleState();
|
this.checkAccessibleState();
|
||||||
},
|
},
|
||||||
|
|
||||||
checkAccessibleState: function() {
|
checkAccessibleState() {
|
||||||
switch (this.actor.accessible_role) {
|
switch (this.actor.accessible_role) {
|
||||||
case Atk.Role.CHECK_MENU_ITEM:
|
case Atk.Role.CHECK_MENU_ITEM:
|
||||||
if (this._switch.state)
|
if (this._switch.state)
|
||||||
@ -391,7 +391,7 @@ var PopupImageMenuItem = new Lang.Class({
|
|||||||
Name: 'PopupImageMenuItem',
|
Name: 'PopupImageMenuItem',
|
||||||
Extends: PopupBaseMenuItem,
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
_init: function (text, icon, params) {
|
_init(text, icon, params) {
|
||||||
this.parent(params);
|
this.parent(params);
|
||||||
|
|
||||||
this._icon = new St.Icon({ style_class: 'popup-menu-icon' });
|
this._icon = new St.Icon({ style_class: 'popup-menu-icon' });
|
||||||
@ -403,7 +403,7 @@ var PopupImageMenuItem = new Lang.Class({
|
|||||||
this.setIcon(icon);
|
this.setIcon(icon);
|
||||||
},
|
},
|
||||||
|
|
||||||
setIcon: function(icon) {
|
setIcon(icon) {
|
||||||
// The 'icon' parameter can be either a Gio.Icon or a string.
|
// The 'icon' parameter can be either a Gio.Icon or a string.
|
||||||
if (icon instanceof GObject.Object && GObject.type_is_a(icon, Gio.Icon))
|
if (icon instanceof GObject.Object && GObject.type_is_a(icon, Gio.Icon))
|
||||||
this._icon.gicon = icon;
|
this._icon.gicon = icon;
|
||||||
@ -416,7 +416,7 @@ var PopupMenuBase = new Lang.Class({
|
|||||||
Name: 'PopupMenuBase',
|
Name: 'PopupMenuBase',
|
||||||
Abstract: true,
|
Abstract: true,
|
||||||
|
|
||||||
_init: function(sourceActor, styleClass) {
|
_init(sourceActor, styleClass) {
|
||||||
this.sourceActor = sourceActor;
|
this.sourceActor = sourceActor;
|
||||||
this._parent = null;
|
this._parent = null;
|
||||||
|
|
||||||
@ -442,33 +442,33 @@ var PopupMenuBase = new Lang.Class({
|
|||||||
this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
this._sessionUpdatedId = Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getTopMenu: function() {
|
_getTopMenu() {
|
||||||
if (this._parent)
|
if (this._parent)
|
||||||
return this._parent._getTopMenu();
|
return this._parent._getTopMenu();
|
||||||
else
|
else
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setParent: function(parent) {
|
_setParent(parent) {
|
||||||
this._parent = parent;
|
this._parent = parent;
|
||||||
},
|
},
|
||||||
|
|
||||||
getSensitive: function() {
|
getSensitive() {
|
||||||
let parentSensitive = this._parent ? this._parent.getSensitive() : true;
|
let parentSensitive = this._parent ? this._parent.getSensitive() : true;
|
||||||
return this._sensitive && parentSensitive;
|
return this._sensitive && parentSensitive;
|
||||||
},
|
},
|
||||||
|
|
||||||
setSensitive: function(sensitive) {
|
setSensitive(sensitive) {
|
||||||
this._sensitive = sensitive;
|
this._sensitive = sensitive;
|
||||||
this.emit('sensitive-changed');
|
this.emit('sensitive-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
this._setSettingsVisibility(Main.sessionMode.allowSettings);
|
this._setSettingsVisibility(Main.sessionMode.allowSettings);
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
addAction: function(title, callback, icon) {
|
addAction(title, callback, icon) {
|
||||||
let menuItem;
|
let menuItem;
|
||||||
if (icon != undefined)
|
if (icon != undefined)
|
||||||
menuItem = new PopupImageMenuItem(title, icon);
|
menuItem = new PopupImageMenuItem(title, icon);
|
||||||
@ -483,7 +483,7 @@ var PopupMenuBase = new Lang.Class({
|
|||||||
return menuItem;
|
return menuItem;
|
||||||
},
|
},
|
||||||
|
|
||||||
addSettingsAction: function(title, desktopFile) {
|
addSettingsAction(title, desktopFile) {
|
||||||
let menuItem = this.addAction(title, function() {
|
let menuItem = this.addAction(title, function() {
|
||||||
let app = Shell.AppSystem.get_default().lookup_app(desktopFile);
|
let app = Shell.AppSystem.get_default().lookup_app(desktopFile);
|
||||||
|
|
||||||
@ -502,14 +502,14 @@ var PopupMenuBase = new Lang.Class({
|
|||||||
return menuItem;
|
return menuItem;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setSettingsVisibility: function(visible) {
|
_setSettingsVisibility(visible) {
|
||||||
for (let id in this._settingsActions) {
|
for (let id in this._settingsActions) {
|
||||||
let item = this._settingsActions[id];
|
let item = this._settingsActions[id];
|
||||||
item.actor.visible = visible;
|
item.actor.visible = visible;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
isEmpty: function() {
|
isEmpty() {
|
||||||
let hasVisibleChildren = this.box.get_children().some(function(child) {
|
let hasVisibleChildren = this.box.get_children().some(function(child) {
|
||||||
if (child._delegate instanceof PopupSeparatorMenuItem)
|
if (child._delegate instanceof PopupSeparatorMenuItem)
|
||||||
return false;
|
return false;
|
||||||
@ -519,21 +519,21 @@ var PopupMenuBase = new Lang.Class({
|
|||||||
return !hasVisibleChildren;
|
return !hasVisibleChildren;
|
||||||
},
|
},
|
||||||
|
|
||||||
itemActivated: function(animate) {
|
itemActivated(animate) {
|
||||||
if (animate == undefined)
|
if (animate == undefined)
|
||||||
animate = BoxPointer.PopupAnimation.FULL;
|
animate = BoxPointer.PopupAnimation.FULL;
|
||||||
|
|
||||||
this._getTopMenu().close(animate);
|
this._getTopMenu().close(animate);
|
||||||
},
|
},
|
||||||
|
|
||||||
_subMenuActiveChanged: function(submenu, submenuItem) {
|
_subMenuActiveChanged(submenu, submenuItem) {
|
||||||
if (this._activeMenuItem && this._activeMenuItem != submenuItem)
|
if (this._activeMenuItem && this._activeMenuItem != submenuItem)
|
||||||
this._activeMenuItem.setActive(false);
|
this._activeMenuItem.setActive(false);
|
||||||
this._activeMenuItem = submenuItem;
|
this._activeMenuItem = submenuItem;
|
||||||
this.emit('active-changed', submenuItem);
|
this.emit('active-changed', submenuItem);
|
||||||
},
|
},
|
||||||
|
|
||||||
_connectItemSignals: function(menuItem) {
|
_connectItemSignals(menuItem) {
|
||||||
menuItem._activeChangeId = menuItem.connect('active-changed', Lang.bind(this, function (menuItem, active) {
|
menuItem._activeChangeId = menuItem.connect('active-changed', Lang.bind(this, function (menuItem, active) {
|
||||||
if (active && this._activeMenuItem != menuItem) {
|
if (active && this._activeMenuItem != menuItem) {
|
||||||
if (this._activeMenuItem)
|
if (this._activeMenuItem)
|
||||||
@ -581,7 +581,7 @@ var PopupMenuBase = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSeparatorVisibility: function(menuItem) {
|
_updateSeparatorVisibility(menuItem) {
|
||||||
if (menuItem.label.text)
|
if (menuItem.label.text)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -617,7 +617,7 @@ var PopupMenuBase = new Lang.Class({
|
|||||||
menuItem.actor.show();
|
menuItem.actor.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
moveMenuItem: function(menuItem, position) {
|
moveMenuItem(menuItem, position) {
|
||||||
let items = this._getMenuItems();
|
let items = this._getMenuItems();
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
@ -635,7 +635,7 @@ var PopupMenuBase = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addMenuItem: function(menuItem, position) {
|
addMenuItem(menuItem, position) {
|
||||||
let before_item = null;
|
let before_item = null;
|
||||||
if (position == undefined) {
|
if (position == undefined) {
|
||||||
this.box.add(menuItem.actor);
|
this.box.add(menuItem.actor);
|
||||||
@ -710,7 +710,7 @@ var PopupMenuBase = new Lang.Class({
|
|||||||
this.length++;
|
this.length++;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMenuItems: function() {
|
_getMenuItems() {
|
||||||
return this.box.get_children().map(function (actor) {
|
return this.box.get_children().map(function (actor) {
|
||||||
return actor._delegate;
|
return actor._delegate;
|
||||||
}).filter(function(item) {
|
}).filter(function(item) {
|
||||||
@ -730,7 +730,7 @@ var PopupMenuBase = new Lang.Class({
|
|||||||
return this._getMenuItems().length;
|
return this._getMenuItems().length;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeAll: function() {
|
removeAll() {
|
||||||
let children = this._getMenuItems();
|
let children = this._getMenuItems();
|
||||||
for (let i = 0; i < children.length; i++) {
|
for (let i = 0; i < children.length; i++) {
|
||||||
let item = children[i];
|
let item = children[i];
|
||||||
@ -738,14 +738,14 @@ var PopupMenuBase = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggle: function() {
|
toggle() {
|
||||||
if (this.isOpen)
|
if (this.isOpen)
|
||||||
this.close(BoxPointer.PopupAnimation.FULL);
|
this.close(BoxPointer.PopupAnimation.FULL);
|
||||||
else
|
else
|
||||||
this.open(BoxPointer.PopupAnimation.FULL);
|
this.open(BoxPointer.PopupAnimation.FULL);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this.close();
|
this.close();
|
||||||
this.removeAll();
|
this.removeAll();
|
||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
@ -762,7 +762,7 @@ var PopupMenu = new Lang.Class({
|
|||||||
Name: 'PopupMenu',
|
Name: 'PopupMenu',
|
||||||
Extends: PopupMenuBase,
|
Extends: PopupMenuBase,
|
||||||
|
|
||||||
_init: function(sourceActor, arrowAlignment, arrowSide) {
|
_init(sourceActor, arrowAlignment, arrowSide) {
|
||||||
this.parent(sourceActor, 'popup-menu-content');
|
this.parent(sourceActor, 'popup-menu-content');
|
||||||
|
|
||||||
this._arrowAlignment = arrowAlignment;
|
this._arrowAlignment = arrowAlignment;
|
||||||
@ -789,14 +789,14 @@ var PopupMenu = new Lang.Class({
|
|||||||
this._openedSubMenu = null;
|
this._openedSubMenu = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setOpenedSubMenu: function(submenu) {
|
_setOpenedSubMenu(submenu) {
|
||||||
if (this._openedSubMenu)
|
if (this._openedSubMenu)
|
||||||
this._openedSubMenu.close(true);
|
this._openedSubMenu.close(true);
|
||||||
|
|
||||||
this._openedSubMenu = submenu;
|
this._openedSubMenu = submenu;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyPress: function(actor, event) {
|
_onKeyPress(actor, event) {
|
||||||
// Disable toggling the menu by keyboard
|
// Disable toggling the menu by keyboard
|
||||||
// when it cannot be toggled by pointer
|
// when it cannot be toggled by pointer
|
||||||
if (!actor.reactive)
|
if (!actor.reactive)
|
||||||
@ -845,15 +845,15 @@ var PopupMenu = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
setArrowOrigin: function(origin) {
|
setArrowOrigin(origin) {
|
||||||
this._boxPointer.setArrowOrigin(origin);
|
this._boxPointer.setArrowOrigin(origin);
|
||||||
},
|
},
|
||||||
|
|
||||||
setSourceAlignment: function(alignment) {
|
setSourceAlignment(alignment) {
|
||||||
this._boxPointer.setSourceAlignment(alignment);
|
this._boxPointer.setSourceAlignment(alignment);
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function(animate) {
|
open(animate) {
|
||||||
if (this.isOpen)
|
if (this.isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -870,7 +870,7 @@ var PopupMenu = new Lang.Class({
|
|||||||
this.emit('open-state-changed', true);
|
this.emit('open-state-changed', true);
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function(animate) {
|
close(animate) {
|
||||||
if (this._activeMenuItem)
|
if (this._activeMenuItem)
|
||||||
this._activeMenuItem.setActive(false);
|
this._activeMenuItem.setActive(false);
|
||||||
|
|
||||||
@ -887,7 +887,7 @@ var PopupMenu = new Lang.Class({
|
|||||||
this.emit('open-state-changed', false);
|
this.emit('open-state-changed', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
if (this._keyPressId)
|
if (this._keyPressId)
|
||||||
this.sourceActor.disconnect(this._keyPressId);
|
this.sourceActor.disconnect(this._keyPressId);
|
||||||
this.parent();
|
this.parent();
|
||||||
@ -897,20 +897,20 @@ var PopupMenu = new Lang.Class({
|
|||||||
var PopupDummyMenu = new Lang.Class({
|
var PopupDummyMenu = new Lang.Class({
|
||||||
Name: 'PopupDummyMenu',
|
Name: 'PopupDummyMenu',
|
||||||
|
|
||||||
_init: function(sourceActor) {
|
_init(sourceActor) {
|
||||||
this.sourceActor = sourceActor;
|
this.sourceActor = sourceActor;
|
||||||
this.actor = sourceActor;
|
this.actor = sourceActor;
|
||||||
this.actor._delegate = this;
|
this.actor._delegate = this;
|
||||||
},
|
},
|
||||||
|
|
||||||
getSensitive: function() {
|
getSensitive() {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function() { this.emit('open-state-changed', true); },
|
open() { this.emit('open-state-changed', true); },
|
||||||
close: function() { this.emit('open-state-changed', false); },
|
close() { this.emit('open-state-changed', false); },
|
||||||
toggle: function() {},
|
toggle() {},
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this.emit('destroy');
|
this.emit('destroy');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -920,7 +920,7 @@ var PopupSubMenu = new Lang.Class({
|
|||||||
Name: 'PopupSubMenu',
|
Name: 'PopupSubMenu',
|
||||||
Extends: PopupMenuBase,
|
Extends: PopupMenuBase,
|
||||||
|
|
||||||
_init: function(sourceActor, sourceArrow) {
|
_init(sourceActor, sourceArrow) {
|
||||||
this.parent(sourceActor);
|
this.parent(sourceActor);
|
||||||
|
|
||||||
this._arrow = sourceArrow;
|
this._arrow = sourceArrow;
|
||||||
@ -939,7 +939,7 @@ var PopupSubMenu = new Lang.Class({
|
|||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_needsScrollbar: function() {
|
_needsScrollbar() {
|
||||||
let topMenu = this._getTopMenu();
|
let topMenu = this._getTopMenu();
|
||||||
let [topMinHeight, topNaturalHeight] = topMenu.actor.get_preferred_height(-1);
|
let [topMinHeight, topNaturalHeight] = topMenu.actor.get_preferred_height(-1);
|
||||||
let topThemeNode = topMenu.actor.get_theme_node();
|
let topThemeNode = topMenu.actor.get_theme_node();
|
||||||
@ -948,11 +948,11 @@ var PopupSubMenu = new Lang.Class({
|
|||||||
return topMaxHeight >= 0 && topNaturalHeight >= topMaxHeight;
|
return topMaxHeight >= 0 && topNaturalHeight >= topMaxHeight;
|
||||||
},
|
},
|
||||||
|
|
||||||
getSensitive: function() {
|
getSensitive() {
|
||||||
return this._sensitive && this.sourceActor._delegate.getSensitive();
|
return this._sensitive && this.sourceActor._delegate.getSensitive();
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function(animate) {
|
open(animate) {
|
||||||
if (this.isOpen)
|
if (this.isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -995,11 +995,11 @@ var PopupSubMenu = new Lang.Class({
|
|||||||
height: naturalHeight,
|
height: naturalHeight,
|
||||||
time: 0.25,
|
time: 0.25,
|
||||||
onUpdateScope: this,
|
onUpdateScope: this,
|
||||||
onUpdate: function() {
|
onUpdate() {
|
||||||
this._arrow.rotation_angle_z = this.actor._arrowRotation;
|
this._arrow.rotation_angle_z = this.actor._arrowRotation;
|
||||||
},
|
},
|
||||||
onCompleteScope: this,
|
onCompleteScope: this,
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
this.actor.set_height(-1);
|
this.actor.set_height(-1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1008,7 +1008,7 @@ var PopupSubMenu = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function(animate) {
|
close(animate) {
|
||||||
if (!this.isOpen)
|
if (!this.isOpen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1028,11 +1028,11 @@ var PopupSubMenu = new Lang.Class({
|
|||||||
height: 0,
|
height: 0,
|
||||||
time: 0.25,
|
time: 0.25,
|
||||||
onUpdateScope: this,
|
onUpdateScope: this,
|
||||||
onUpdate: function() {
|
onUpdate() {
|
||||||
this._arrow.rotation_angle_z = this.actor._arrowRotation;
|
this._arrow.rotation_angle_z = this.actor._arrowRotation;
|
||||||
},
|
},
|
||||||
onCompleteScope: this,
|
onCompleteScope: this,
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
this.actor.set_height(-1);
|
this.actor.set_height(-1);
|
||||||
},
|
},
|
||||||
@ -1043,7 +1043,7 @@ var PopupSubMenu = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyPressEvent: function(actor, event) {
|
_onKeyPressEvent(actor, event) {
|
||||||
// Move focus back to parent menu if the user types Left.
|
// Move focus back to parent menu if the user types Left.
|
||||||
|
|
||||||
if (this.isOpen && event.get_key_symbol() == Clutter.KEY_Left) {
|
if (this.isOpen && event.get_key_symbol() == Clutter.KEY_Left) {
|
||||||
@ -1068,7 +1068,7 @@ var PopupMenuSection = new Lang.Class({
|
|||||||
Name: 'PopupMenuSection',
|
Name: 'PopupMenuSection',
|
||||||
Extends: PopupMenuBase,
|
Extends: PopupMenuBase,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this.actor = this.box;
|
this.actor = this.box;
|
||||||
@ -1078,15 +1078,15 @@ var PopupMenuSection = new Lang.Class({
|
|||||||
|
|
||||||
// deliberately ignore any attempt to open() or close(), but emit the
|
// deliberately ignore any attempt to open() or close(), but emit the
|
||||||
// corresponding signal so children can still pick it up
|
// corresponding signal so children can still pick it up
|
||||||
open: function() { this.emit('open-state-changed', true); },
|
open() { this.emit('open-state-changed', true); },
|
||||||
close: function() { this.emit('open-state-changed', false); },
|
close() { this.emit('open-state-changed', false); },
|
||||||
});
|
});
|
||||||
|
|
||||||
var PopupSubMenuMenuItem = new Lang.Class({
|
var PopupSubMenuMenuItem = new Lang.Class({
|
||||||
Name: 'PopupSubMenuMenuItem',
|
Name: 'PopupSubMenuMenuItem',
|
||||||
Extends: PopupBaseMenuItem,
|
Extends: PopupBaseMenuItem,
|
||||||
|
|
||||||
_init: function(text, wantIcon) {
|
_init(text, wantIcon) {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this.actor.add_style_class_name('popup-submenu-menu-item');
|
this.actor.add_style_class_name('popup-submenu-menu-item');
|
||||||
@ -1119,19 +1119,19 @@ var PopupSubMenuMenuItem = new Lang.Class({
|
|||||||
this.menu.connect('open-state-changed', Lang.bind(this, this._subMenuOpenStateChanged));
|
this.menu.connect('open-state-changed', Lang.bind(this, this._subMenuOpenStateChanged));
|
||||||
},
|
},
|
||||||
|
|
||||||
_setParent: function(parent) {
|
_setParent(parent) {
|
||||||
this.parent(parent);
|
this.parent(parent);
|
||||||
this.menu._setParent(parent);
|
this.menu._setParent(parent);
|
||||||
},
|
},
|
||||||
|
|
||||||
syncSensitive: function() {
|
syncSensitive() {
|
||||||
let sensitive = this.parent();
|
let sensitive = this.parent();
|
||||||
this._triangle.visible = sensitive;
|
this._triangle.visible = sensitive;
|
||||||
if (!sensitive)
|
if (!sensitive)
|
||||||
this.menu.close(false);
|
this.menu.close(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_subMenuOpenStateChanged: function(menu, open) {
|
_subMenuOpenStateChanged(menu, open) {
|
||||||
if (open) {
|
if (open) {
|
||||||
this.actor.add_style_pseudo_class('open');
|
this.actor.add_style_pseudo_class('open');
|
||||||
this._getTopMenu()._setOpenedSubMenu(this.menu);
|
this._getTopMenu()._setOpenedSubMenu(this.menu);
|
||||||
@ -1145,28 +1145,28 @@ var PopupSubMenuMenuItem = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this.menu.destroy();
|
this.menu.destroy();
|
||||||
|
|
||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
setSubmenuShown: function(open) {
|
setSubmenuShown(open) {
|
||||||
if (open)
|
if (open)
|
||||||
this.menu.open(BoxPointer.PopupAnimation.FULL);
|
this.menu.open(BoxPointer.PopupAnimation.FULL);
|
||||||
else
|
else
|
||||||
this.menu.close(BoxPointer.PopupAnimation.FULL);
|
this.menu.close(BoxPointer.PopupAnimation.FULL);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setOpenState: function(open) {
|
_setOpenState(open) {
|
||||||
this.setSubmenuShown(open);
|
this.setSubmenuShown(open);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getOpenState: function() {
|
_getOpenState() {
|
||||||
return this.menu.isOpen;
|
return this.menu.isOpen;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyPressEvent: function(actor, event) {
|
_onKeyPressEvent(actor, event) {
|
||||||
let symbol = event.get_key_symbol();
|
let symbol = event.get_key_symbol();
|
||||||
|
|
||||||
if (symbol == Clutter.KEY_Right) {
|
if (symbol == Clutter.KEY_Right) {
|
||||||
@ -1181,11 +1181,11 @@ var PopupSubMenuMenuItem = new Lang.Class({
|
|||||||
return this.parent(actor, event);
|
return this.parent(actor, event);
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function(event) {
|
activate(event) {
|
||||||
this._setOpenState(true);
|
this._setOpenState(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonReleaseEvent: function(actor) {
|
_onButtonReleaseEvent(actor) {
|
||||||
// Since we override the parent, we need to manage what the parent does
|
// Since we override the parent, we need to manage what the parent does
|
||||||
// with the active style class
|
// with the active style class
|
||||||
this.actor.remove_style_pseudo_class ('active');
|
this.actor.remove_style_pseudo_class ('active');
|
||||||
@ -1193,7 +1193,7 @@ var PopupSubMenuMenuItem = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onTouchEvent: function(actor, event) {
|
_onTouchEvent(actor, event) {
|
||||||
if (event.type() == Clutter.EventType.TOUCH_END) {
|
if (event.type() == Clutter.EventType.TOUCH_END) {
|
||||||
// Since we override the parent, we need to manage what the parent does
|
// Since we override the parent, we need to manage what the parent does
|
||||||
// with the active style class
|
// with the active style class
|
||||||
@ -1210,7 +1210,7 @@ var PopupSubMenuMenuItem = new Lang.Class({
|
|||||||
var PopupMenuManager = new Lang.Class({
|
var PopupMenuManager = new Lang.Class({
|
||||||
Name: 'PopupMenuManager',
|
Name: 'PopupMenuManager',
|
||||||
|
|
||||||
_init: function(owner, grabParams) {
|
_init(owner, grabParams) {
|
||||||
grabParams = Params.parse(grabParams,
|
grabParams = Params.parse(grabParams,
|
||||||
{ actionMode: Shell.ActionMode.POPUP });
|
{ actionMode: Shell.ActionMode.POPUP });
|
||||||
this._owner = owner;
|
this._owner = owner;
|
||||||
@ -1218,7 +1218,7 @@ var PopupMenuManager = new Lang.Class({
|
|||||||
this._menus = [];
|
this._menus = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
addMenu: function(menu, position) {
|
addMenu(menu, position) {
|
||||||
if (this._findMenu(menu) > -1)
|
if (this._findMenu(menu) > -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1244,7 +1244,7 @@ var PopupMenuManager = new Lang.Class({
|
|||||||
this._menus.splice(position, 0, menudata);
|
this._menus.splice(position, 0, menudata);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeMenu: function(menu) {
|
removeMenu(menu) {
|
||||||
if (menu == this.activeMenu)
|
if (menu == this.activeMenu)
|
||||||
this._closeMenu(false, menu);
|
this._closeMenu(false, menu);
|
||||||
|
|
||||||
@ -1274,11 +1274,11 @@ var PopupMenuManager = new Lang.Class({
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
ignoreRelease: function() {
|
ignoreRelease() {
|
||||||
return this._grabHelper.ignoreRelease();
|
return this._grabHelper.ignoreRelease();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMenuOpenState: function(menu, open) {
|
_onMenuOpenState(menu, open) {
|
||||||
if (open) {
|
if (open) {
|
||||||
if (this.activeMenu)
|
if (this.activeMenu)
|
||||||
this.activeMenu.close(BoxPointer.PopupAnimation.FADE);
|
this.activeMenu.close(BoxPointer.PopupAnimation.FADE);
|
||||||
@ -1289,12 +1289,12 @@ var PopupMenuManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_changeMenu: function(newMenu) {
|
_changeMenu(newMenu) {
|
||||||
newMenu.open(this.activeMenu ? BoxPointer.PopupAnimation.FADE
|
newMenu.open(this.activeMenu ? BoxPointer.PopupAnimation.FADE
|
||||||
: BoxPointer.PopupAnimation.FULL);
|
: BoxPointer.PopupAnimation.FULL);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMenuSourceEnter: function(menu) {
|
_onMenuSourceEnter(menu) {
|
||||||
if (!this._grabHelper.grabbed)
|
if (!this._grabHelper.grabbed)
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
|
||||||
@ -1305,11 +1305,11 @@ var PopupMenuManager = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMenuDestroy: function(menu) {
|
_onMenuDestroy(menu) {
|
||||||
this.removeMenu(menu);
|
this.removeMenu(menu);
|
||||||
},
|
},
|
||||||
|
|
||||||
_findMenu: function(item) {
|
_findMenu(item) {
|
||||||
for (let i = 0; i < this._menus.length; i++) {
|
for (let i = 0; i < this._menus.length; i++) {
|
||||||
let menudata = this._menus[i];
|
let menudata = this._menus[i];
|
||||||
if (item == menudata.menu)
|
if (item == menudata.menu)
|
||||||
@ -1318,7 +1318,7 @@ var PopupMenuManager = new Lang.Class({
|
|||||||
return -1;
|
return -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
_closeMenu: function(isUser, menu) {
|
_closeMenu(isUser, menu) {
|
||||||
// If this isn't a user action, we called close()
|
// If this isn't a user action, we called close()
|
||||||
// on the BoxPointer ourselves, so we shouldn't
|
// on the BoxPointer ourselves, so we shouldn't
|
||||||
// reanimate.
|
// reanimate.
|
||||||
|
@ -41,7 +41,7 @@ function _removeItem(menu, position) {
|
|||||||
var RemoteMenuSeparatorItemMapper = new Lang.Class({
|
var RemoteMenuSeparatorItemMapper = new Lang.Class({
|
||||||
Name: 'RemoteMenuSeparatorItemMapper',
|
Name: 'RemoteMenuSeparatorItemMapper',
|
||||||
|
|
||||||
_init: function(trackerItem) {
|
_init(trackerItem) {
|
||||||
this._trackerItem = trackerItem;
|
this._trackerItem = trackerItem;
|
||||||
this.menuItem = new PopupMenu.PopupSeparatorMenuItem();
|
this.menuItem = new PopupMenu.PopupSeparatorMenuItem();
|
||||||
this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel));
|
this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel));
|
||||||
@ -52,7 +52,7 @@ var RemoteMenuSeparatorItemMapper = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLabel: function() {
|
_updateLabel() {
|
||||||
this.menuItem.label.text = stripMnemonics(this._trackerItem.label);
|
this.menuItem.label.text = stripMnemonics(this._trackerItem.label);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -61,17 +61,17 @@ var RequestSubMenu = new Lang.Class({
|
|||||||
Name: 'RequestSubMenu',
|
Name: 'RequestSubMenu',
|
||||||
Extends: PopupMenu.PopupSubMenuMenuItem,
|
Extends: PopupMenu.PopupSubMenuMenuItem,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent('');
|
this.parent('');
|
||||||
this._requestOpen = false;
|
this._requestOpen = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setOpenState: function(open) {
|
_setOpenState(open) {
|
||||||
this.emit('request-open', open);
|
this.emit('request-open', open);
|
||||||
this._requestOpen = open;
|
this._requestOpen = open;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getOpenState: function() {
|
_getOpenState() {
|
||||||
return this._requestOpen;
|
return this._requestOpen;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -79,7 +79,7 @@ var RequestSubMenu = new Lang.Class({
|
|||||||
var RemoteMenuSubmenuItemMapper = new Lang.Class({
|
var RemoteMenuSubmenuItemMapper = new Lang.Class({
|
||||||
Name: 'RemoteMenuSubmenuItemMapper',
|
Name: 'RemoteMenuSubmenuItemMapper',
|
||||||
|
|
||||||
_init: function(trackerItem) {
|
_init(trackerItem) {
|
||||||
this._trackerItem = trackerItem;
|
this._trackerItem = trackerItem;
|
||||||
this.menuItem = new RequestSubMenu();
|
this.menuItem = new RequestSubMenu();
|
||||||
this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel));
|
this._trackerItem.connect('notify::label', Lang.bind(this, this._updateLabel));
|
||||||
@ -102,12 +102,12 @@ var RemoteMenuSubmenuItemMapper = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this._tracker.destroy();
|
this._tracker.destroy();
|
||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLabel: function() {
|
_updateLabel() {
|
||||||
this.menuItem.label.text = stripMnemonics(this._trackerItem.label);
|
this.menuItem.label.text = stripMnemonics(this._trackerItem.label);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -115,7 +115,7 @@ var RemoteMenuSubmenuItemMapper = new Lang.Class({
|
|||||||
var RemoteMenuItemMapper = new Lang.Class({
|
var RemoteMenuItemMapper = new Lang.Class({
|
||||||
Name: 'RemoteMenuItemMapper',
|
Name: 'RemoteMenuItemMapper',
|
||||||
|
|
||||||
_init: function(trackerItem) {
|
_init(trackerItem) {
|
||||||
this._trackerItem = trackerItem;
|
this._trackerItem = trackerItem;
|
||||||
|
|
||||||
this.menuItem = new PopupMenu.PopupBaseMenuItem();
|
this.menuItem = new PopupMenu.PopupBaseMenuItem();
|
||||||
@ -143,15 +143,15 @@ var RemoteMenuItemMapper = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateLabel: function() {
|
_updateLabel() {
|
||||||
this._label.text = stripMnemonics(this._trackerItem.label);
|
this._label.text = stripMnemonics(this._trackerItem.label);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSensitivity: function() {
|
_updateSensitivity() {
|
||||||
this.menuItem.setSensitive(this._trackerItem.sensitive);
|
this.menuItem.setSensitive(this._trackerItem.sensitive);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateDecoration: function() {
|
_updateDecoration() {
|
||||||
let ornamentForRole = {};
|
let ornamentForRole = {};
|
||||||
ornamentForRole[ShellMenu.MenuTrackerItemRole.RADIO] = PopupMenu.Ornament.DOT;
|
ornamentForRole[ShellMenu.MenuTrackerItemRole.RADIO] = PopupMenu.Ornament.DOT;
|
||||||
ornamentForRole[ShellMenu.MenuTrackerItemRole.CHECK] = PopupMenu.Ornament.CHECK;
|
ornamentForRole[ShellMenu.MenuTrackerItemRole.CHECK] = PopupMenu.Ornament.CHECK;
|
||||||
@ -163,7 +163,7 @@ var RemoteMenuItemMapper = new Lang.Class({
|
|||||||
this.menuItem.setOrnament(ornament);
|
this.menuItem.setOrnament(ornament);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateRole: function() {
|
_updateRole() {
|
||||||
let a11yRoles = {};
|
let a11yRoles = {};
|
||||||
a11yRoles[ShellMenu.MenuTrackerItemRole.NORMAL] = Atk.Role.MENU_ITEM;
|
a11yRoles[ShellMenu.MenuTrackerItemRole.NORMAL] = Atk.Role.MENU_ITEM;
|
||||||
a11yRoles[ShellMenu.MenuTrackerItemRole.RADIO] = Atk.Role.RADIO_MENU_ITEM;
|
a11yRoles[ShellMenu.MenuTrackerItemRole.RADIO] = Atk.Role.RADIO_MENU_ITEM;
|
||||||
@ -180,7 +180,7 @@ var RemoteMenu = new Lang.Class({
|
|||||||
Name: 'RemoteMenu',
|
Name: 'RemoteMenu',
|
||||||
Extends: PopupMenu.PopupMenu,
|
Extends: PopupMenu.PopupMenu,
|
||||||
|
|
||||||
_init: function(sourceActor, model, actionGroup) {
|
_init(sourceActor, model, actionGroup) {
|
||||||
this.parent(sourceActor, 0.0, St.Side.TOP);
|
this.parent(sourceActor, 0.0, St.Side.TOP);
|
||||||
|
|
||||||
this._model = model;
|
this._model = model;
|
||||||
@ -196,7 +196,7 @@ var RemoteMenu = new Lang.Class({
|
|||||||
return this._actionGroup;
|
return this._actionGroup;
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this._tracker.destroy();
|
this._tracker.destroy();
|
||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
@ -191,7 +191,7 @@ function loadRemoteSearchProviders(searchSettings, callback) {
|
|||||||
var RemoteSearchProvider = new Lang.Class({
|
var RemoteSearchProvider = new Lang.Class({
|
||||||
Name: 'RemoteSearchProvider',
|
Name: 'RemoteSearchProvider',
|
||||||
|
|
||||||
_init: function(appInfo, dbusName, dbusPath, autoStart, proxyInfo) {
|
_init(appInfo, dbusName, dbusPath, autoStart, proxyInfo) {
|
||||||
if (!proxyInfo)
|
if (!proxyInfo)
|
||||||
proxyInfo = SearchProviderProxyInfo;
|
proxyInfo = SearchProviderProxyInfo;
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ var RemoteSearchProvider = new Lang.Class({
|
|||||||
this.canLaunchSearch = false;
|
this.canLaunchSearch = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
createIcon: function(size, meta) {
|
createIcon(size, meta) {
|
||||||
let gicon = null;
|
let gicon = null;
|
||||||
let icon = null;
|
let icon = null;
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ var RemoteSearchProvider = new Lang.Class({
|
|||||||
return icon;
|
return icon;
|
||||||
},
|
},
|
||||||
|
|
||||||
filterResults: function(results, maxNumber) {
|
filterResults(results, maxNumber) {
|
||||||
if (results.length <= maxNumber)
|
if (results.length <= maxNumber)
|
||||||
return results;
|
return results;
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ var RemoteSearchProvider = new Lang.Class({
|
|||||||
return regularResults.slice(0, maxNumber).concat(specialResults.slice(0, maxNumber));
|
return regularResults.slice(0, maxNumber).concat(specialResults.slice(0, maxNumber));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getResultsFinished: function(results, error, callback) {
|
_getResultsFinished(results, error, callback) {
|
||||||
if (error) {
|
if (error) {
|
||||||
if (error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
if (error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||||
return;
|
return;
|
||||||
@ -259,19 +259,19 @@ var RemoteSearchProvider = new Lang.Class({
|
|||||||
callback(results[0]);
|
callback(results[0]);
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialResultSet: function(terms, callback, cancellable) {
|
getInitialResultSet(terms, callback, cancellable) {
|
||||||
this.proxy.GetInitialResultSetRemote(terms,
|
this.proxy.GetInitialResultSetRemote(terms,
|
||||||
Lang.bind(this, this._getResultsFinished, callback),
|
Lang.bind(this, this._getResultsFinished, callback),
|
||||||
cancellable);
|
cancellable);
|
||||||
},
|
},
|
||||||
|
|
||||||
getSubsearchResultSet: function(previousResults, newTerms, callback, cancellable) {
|
getSubsearchResultSet(previousResults, newTerms, callback, cancellable) {
|
||||||
this.proxy.GetSubsearchResultSetRemote(previousResults, newTerms,
|
this.proxy.GetSubsearchResultSetRemote(previousResults, newTerms,
|
||||||
Lang.bind(this, this._getResultsFinished, callback),
|
Lang.bind(this, this._getResultsFinished, callback),
|
||||||
cancellable);
|
cancellable);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getResultMetasFinished: function(results, error, callback) {
|
_getResultMetasFinished(results, error, callback) {
|
||||||
if (error) {
|
if (error) {
|
||||||
if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||||
log('Received error from DBus search provider %s during GetResultMetas: %s'.format(this.id, String(error)));
|
log('Received error from DBus search provider %s during GetResultMetas: %s'.format(this.id, String(error)));
|
||||||
@ -297,17 +297,17 @@ var RemoteSearchProvider = new Lang.Class({
|
|||||||
callback(resultMetas);
|
callback(resultMetas);
|
||||||
},
|
},
|
||||||
|
|
||||||
getResultMetas: function(ids, callback, cancellable) {
|
getResultMetas(ids, callback, cancellable) {
|
||||||
this.proxy.GetResultMetasRemote(ids,
|
this.proxy.GetResultMetasRemote(ids,
|
||||||
Lang.bind(this, this._getResultMetasFinished, callback),
|
Lang.bind(this, this._getResultMetasFinished, callback),
|
||||||
cancellable);
|
cancellable);
|
||||||
},
|
},
|
||||||
|
|
||||||
activateResult: function(id) {
|
activateResult(id) {
|
||||||
this.proxy.ActivateResultRemote(id);
|
this.proxy.ActivateResultRemote(id);
|
||||||
},
|
},
|
||||||
|
|
||||||
launchSearch: function(terms) {
|
launchSearch(terms) {
|
||||||
// the provider is not compatible with the new version of the interface, launch
|
// the provider is not compatible with the new version of the interface, launch
|
||||||
// the app itself but warn so we can catch the error in logs
|
// the app itself but warn so we can catch the error in logs
|
||||||
log('Search provider ' + this.appInfo.get_id() + ' does not implement LaunchSearch');
|
log('Search provider ' + this.appInfo.get_id() + ' does not implement LaunchSearch');
|
||||||
@ -319,17 +319,17 @@ var RemoteSearchProvider2 = new Lang.Class({
|
|||||||
Name: 'RemoteSearchProvider2',
|
Name: 'RemoteSearchProvider2',
|
||||||
Extends: RemoteSearchProvider,
|
Extends: RemoteSearchProvider,
|
||||||
|
|
||||||
_init: function(appInfo, dbusName, dbusPath, autoStart) {
|
_init(appInfo, dbusName, dbusPath, autoStart) {
|
||||||
this.parent(appInfo, dbusName, dbusPath, autoStart, SearchProvider2ProxyInfo);
|
this.parent(appInfo, dbusName, dbusPath, autoStart, SearchProvider2ProxyInfo);
|
||||||
|
|
||||||
this.canLaunchSearch = true;
|
this.canLaunchSearch = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
activateResult: function(id, terms) {
|
activateResult(id, terms) {
|
||||||
this.proxy.ActivateResultRemote(id, terms, global.get_current_time());
|
this.proxy.ActivateResultRemote(id, terms, global.get_current_time());
|
||||||
},
|
},
|
||||||
|
|
||||||
launchSearch: function(terms) {
|
launchSearch(terms) {
|
||||||
this.proxy.LaunchSearchRemote(terms, global.get_current_time());
|
this.proxy.LaunchSearchRemote(terms, global.get_current_time());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -34,7 +34,7 @@ var RunDialog = new Lang.Class({
|
|||||||
Name: 'RunDialog',
|
Name: 'RunDialog',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init : function() {
|
_init() {
|
||||||
this.parent({ styleClass: 'run-dialog',
|
this.parent({ styleClass: 'run-dialog',
|
||||||
destroyOnClose: false });
|
destroyOnClose: false });
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ var RunDialog = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getCommandCompletion: function(text) {
|
_getCommandCompletion(text) {
|
||||||
function _getCommon(s1, s2) {
|
function _getCommon(s1, s2) {
|
||||||
if (s1 == null)
|
if (s1 == null)
|
||||||
return s2;
|
return s2;
|
||||||
@ -191,7 +191,7 @@ var RunDialog = new Lang.Class({
|
|||||||
return common.substr(text.length);
|
return common.substr(text.length);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getCompletion : function(text) {
|
_getCompletion(text) {
|
||||||
if (text.indexOf('/') != -1) {
|
if (text.indexOf('/') != -1) {
|
||||||
return this._pathCompleter.get_completion_suffix(text);
|
return this._pathCompleter.get_completion_suffix(text);
|
||||||
} else {
|
} else {
|
||||||
@ -199,7 +199,7 @@ var RunDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_run : function(input, inTerminal) {
|
_run(input, inTerminal) {
|
||||||
let command = input;
|
let command = input;
|
||||||
|
|
||||||
this._history.addItem(input);
|
this._history.addItem(input);
|
||||||
@ -250,7 +250,7 @@ var RunDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_showError : function(message) {
|
_showError(message) {
|
||||||
this._commandError = true;
|
this._commandError = true;
|
||||||
|
|
||||||
this._errorMessage.set_text(message);
|
this._errorMessage.set_text(message);
|
||||||
@ -272,7 +272,7 @@ var RunDialog = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_restart: function() {
|
_restart() {
|
||||||
if (Meta.is_wayland_compositor()) {
|
if (Meta.is_wayland_compositor()) {
|
||||||
this._showError(_("Restart is not available on Wayland"));
|
this._showError(_("Restart is not available on Wayland"));
|
||||||
return;
|
return;
|
||||||
@ -282,7 +282,7 @@ var RunDialog = new Lang.Class({
|
|||||||
Meta.restart(_("Restarting…"));
|
Meta.restart(_("Restarting…"));
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function() {
|
open() {
|
||||||
this._history.lastItem();
|
this._history.lastItem();
|
||||||
this._errorBox.hide();
|
this._errorBox.hide();
|
||||||
this._entryText.set_text('');
|
this._entryText.set_text('');
|
||||||
|
@ -63,7 +63,7 @@ var CURTAIN_SLIDE_TIME = 0.3;
|
|||||||
var Clock = new Lang.Class({
|
var Clock = new Lang.Class({
|
||||||
Name: 'ScreenShieldClock',
|
Name: 'ScreenShieldClock',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.BoxLayout({ style_class: 'screen-shield-clock',
|
this.actor = new St.BoxLayout({ style_class: 'screen-shield-clock',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ var Clock = new Lang.Class({
|
|||||||
this._updateClock();
|
this._updateClock();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateClock: function() {
|
_updateClock() {
|
||||||
this._time.text = this._wallClock.clock;
|
this._time.text = this._wallClock.clock;
|
||||||
|
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
@ -89,7 +89,7 @@ var Clock = new Lang.Class({
|
|||||||
this._date.text = date.toLocaleFormat(dateFormat);
|
this._date.text = date.toLocaleFormat(dateFormat);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
this._wallClock.run_dispose();
|
this._wallClock.run_dispose();
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ var Clock = new Lang.Class({
|
|||||||
var NotificationsBox = new Lang.Class({
|
var NotificationsBox = new Lang.Class({
|
||||||
Name: 'NotificationsBox',
|
Name: 'NotificationsBox',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.BoxLayout({ vertical: true,
|
this.actor = new St.BoxLayout({ vertical: true,
|
||||||
name: 'screenShieldNotifications',
|
name: 'screenShieldNotifications',
|
||||||
style_class: 'screen-shield-notifications-container' });
|
style_class: 'screen-shield-notifications-container' });
|
||||||
@ -120,7 +120,7 @@ var NotificationsBox = new Lang.Class({
|
|||||||
this._sourceAddedId = Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded));
|
this._sourceAddedId = Main.messageTray.connect('source-added', Lang.bind(this, this._sourceAdded));
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
if (this._sourceAddedId) {
|
if (this._sourceAddedId) {
|
||||||
Main.messageTray.disconnect(this._sourceAddedId);
|
Main.messageTray.disconnect(this._sourceAddedId);
|
||||||
this._sourceAddedId = 0;
|
this._sourceAddedId = 0;
|
||||||
@ -134,7 +134,7 @@ var NotificationsBox = new Lang.Class({
|
|||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateVisibility: function() {
|
_updateVisibility() {
|
||||||
this._notificationBox.visible = this._notificationBox.get_children().some(function(a) {
|
this._notificationBox.visible = this._notificationBox.get_children().some(function(a) {
|
||||||
return a.visible;
|
return a.visible;
|
||||||
});
|
});
|
||||||
@ -142,14 +142,14 @@ var NotificationsBox = new Lang.Class({
|
|||||||
this.actor.visible = this._notificationBox.visible;
|
this.actor.visible = this._notificationBox.visible;
|
||||||
},
|
},
|
||||||
|
|
||||||
_makeNotificationCountText: function(count, isChat) {
|
_makeNotificationCountText(count, isChat) {
|
||||||
if (isChat)
|
if (isChat)
|
||||||
return ngettext("%d new message", "%d new messages", count).format(count);
|
return ngettext("%d new message", "%d new messages", count).format(count);
|
||||||
else
|
else
|
||||||
return ngettext("%d new notification", "%d new notifications", count).format(count);
|
return ngettext("%d new notification", "%d new notifications", count).format(count);
|
||||||
},
|
},
|
||||||
|
|
||||||
_makeNotificationSource: function(source, box) {
|
_makeNotificationSource(source, box) {
|
||||||
let sourceActor = new MessageTray.SourceActor(source, SUMMARY_ICON_SIZE);
|
let sourceActor = new MessageTray.SourceActor(source, SUMMARY_ICON_SIZE);
|
||||||
box.add(sourceActor.actor, { y_fill: true });
|
box.add(sourceActor.actor, { y_fill: true });
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ var NotificationsBox = new Lang.Class({
|
|||||||
return [title, countLabel];
|
return [title, countLabel];
|
||||||
},
|
},
|
||||||
|
|
||||||
_makeNotificationDetailedSource: function(source, box) {
|
_makeNotificationDetailedSource(source, box) {
|
||||||
let sourceActor = new MessageTray.SourceActor(source, SUMMARY_ICON_SIZE);
|
let sourceActor = new MessageTray.SourceActor(source, SUMMARY_ICON_SIZE);
|
||||||
let sourceBin = new St.Bin({ y_align: St.Align.START,
|
let sourceBin = new St.Bin({ y_align: St.Align.START,
|
||||||
x_align: St.Align.START,
|
x_align: St.Align.START,
|
||||||
@ -207,7 +207,7 @@ var NotificationsBox = new Lang.Class({
|
|||||||
return [title, null];
|
return [title, null];
|
||||||
},
|
},
|
||||||
|
|
||||||
_showSource: function(source, obj, box) {
|
_showSource(source, obj, box) {
|
||||||
if (obj.detailed) {
|
if (obj.detailed) {
|
||||||
[obj.titleLabel, obj.countLabel] = this._makeNotificationDetailedSource(source, box);
|
[obj.titleLabel, obj.countLabel] = this._makeNotificationDetailedSource(source, box);
|
||||||
} else {
|
} else {
|
||||||
@ -217,7 +217,7 @@ var NotificationsBox = new Lang.Class({
|
|||||||
box.visible = obj.visible && (source.unseenCount > 0);
|
box.visible = obj.visible && (source.unseenCount > 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
_sourceAdded: function(tray, source, initial) {
|
_sourceAdded(tray, source, initial) {
|
||||||
let obj = {
|
let obj = {
|
||||||
visible: source.policy.showInLockScreen,
|
visible: source.policy.showInLockScreen,
|
||||||
detailed: source.policy.detailsInLockScreen,
|
detailed: source.policy.detailsInLockScreen,
|
||||||
@ -266,7 +266,7 @@ var NotificationsBox = new Lang.Class({
|
|||||||
{ height: natHeight,
|
{ height: natHeight,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
time: 0.25,
|
time: 0.25,
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
this._scrollView.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
|
this._scrollView.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC;
|
||||||
widget.set_height(-1);
|
widget.set_height(-1);
|
||||||
},
|
},
|
||||||
@ -279,11 +279,11 @@ var NotificationsBox = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_titleChanged: function(source, obj) {
|
_titleChanged(source, obj) {
|
||||||
obj.titleLabel.text = source.title;
|
obj.titleLabel.text = source.title;
|
||||||
},
|
},
|
||||||
|
|
||||||
_countChanged: function(source, obj) {
|
_countChanged(source, obj) {
|
||||||
if (obj.detailed) {
|
if (obj.detailed) {
|
||||||
// A new notification was pushed, or a previous notification was destroyed.
|
// A new notification was pushed, or a previous notification was destroyed.
|
||||||
// Give up, and build the list again.
|
// Give up, and build the list again.
|
||||||
@ -303,7 +303,7 @@ var NotificationsBox = new Lang.Class({
|
|||||||
this.emit('wake-up-screen');
|
this.emit('wake-up-screen');
|
||||||
},
|
},
|
||||||
|
|
||||||
_visibleChanged: function(source, obj) {
|
_visibleChanged(source, obj) {
|
||||||
if (obj.visible == source.policy.showInLockScreen)
|
if (obj.visible == source.policy.showInLockScreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -315,7 +315,7 @@ var NotificationsBox = new Lang.Class({
|
|||||||
this.emit('wake-up-screen');
|
this.emit('wake-up-screen');
|
||||||
},
|
},
|
||||||
|
|
||||||
_detailedChanged: function(source, obj) {
|
_detailedChanged(source, obj) {
|
||||||
if (obj.detailed == source.policy.detailsInLockScreen)
|
if (obj.detailed == source.policy.detailsInLockScreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -326,12 +326,12 @@ var NotificationsBox = new Lang.Class({
|
|||||||
this._showSource(source, obj, obj.sourceBox);
|
this._showSource(source, obj, obj.sourceBox);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSourceDestroy: function(source, obj) {
|
_onSourceDestroy(source, obj) {
|
||||||
this._removeSource(source, obj);
|
this._removeSource(source, obj);
|
||||||
this._updateVisibility();
|
this._updateVisibility();
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeSource: function(source, obj) {
|
_removeSource(source, obj) {
|
||||||
obj.sourceBox.destroy();
|
obj.sourceBox.destroy();
|
||||||
obj.sourceBox = obj.titleLabel = obj.countLabel = null;
|
obj.sourceBox = obj.titleLabel = obj.countLabel = null;
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ var Arrow = new Lang.Class({
|
|||||||
Name: 'Arrow',
|
Name: 'Arrow',
|
||||||
Extends: St.Bin,
|
Extends: St.Bin,
|
||||||
|
|
||||||
_init: function(params) {
|
_init(params) {
|
||||||
this.parent(params);
|
this.parent(params);
|
||||||
this.x_fill = this.y_fill = true;
|
this.x_fill = this.y_fill = true;
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ var Arrow = new Lang.Class({
|
|||||||
this._shadowWidth = this._shadowHeight = 0;
|
this._shadowWidth = this._shadowHeight = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_drawArrow: function(arrow) {
|
_drawArrow(arrow) {
|
||||||
let cr = arrow.get_context();
|
let cr = arrow.get_context();
|
||||||
let [w, h] = arrow.get_surface_size();
|
let [w, h] = arrow.get_surface_size();
|
||||||
let node = this.get_theme_node();
|
let node = this.get_theme_node();
|
||||||
@ -379,7 +379,7 @@ var Arrow = new Lang.Class({
|
|||||||
cr.$dispose();
|
cr.$dispose();
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_get_paint_volume: function(volume) {
|
vfunc_get_paint_volume(volume) {
|
||||||
if (!this.parent(volume))
|
if (!this.parent(volume))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ var Arrow = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_style_changed: function() {
|
vfunc_style_changed() {
|
||||||
let node = this.get_theme_node();
|
let node = this.get_theme_node();
|
||||||
this._shadow = node.get_shadow('-arrow-shadow');
|
this._shadow = node.get_shadow('-arrow-shadow');
|
||||||
if (this._shadow)
|
if (this._shadow)
|
||||||
@ -406,7 +406,7 @@ var Arrow = new Lang.Class({
|
|||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
||||||
vfunc_paint: function() {
|
vfunc_paint() {
|
||||||
if (this._shadowHelper) {
|
if (this._shadowHelper) {
|
||||||
this._shadowHelper.update(this._drawingArea);
|
this._shadowHelper.update(this._drawingArea);
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ function clamp(value, min, max) {
|
|||||||
var ScreenShield = new Lang.Class({
|
var ScreenShield = new Lang.Class({
|
||||||
Name: 'ScreenShield',
|
Name: 'ScreenShield',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = Main.layoutManager.screenShieldGroup;
|
this.actor = Main.layoutManager.screenShieldGroup;
|
||||||
|
|
||||||
this._lockScreenState = MessageTray.State.HIDDEN;
|
this._lockScreenState = MessageTray.State.HIDDEN;
|
||||||
@ -575,7 +575,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
this._syncInhibitor();
|
this._syncInhibitor();
|
||||||
},
|
},
|
||||||
|
|
||||||
_setActive: function(active) {
|
_setActive(active) {
|
||||||
let prevIsActive = this._isActive;
|
let prevIsActive = this._isActive;
|
||||||
this._isActive = active;
|
this._isActive = active;
|
||||||
|
|
||||||
@ -588,7 +588,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
this._syncInhibitor();
|
this._syncInhibitor();
|
||||||
},
|
},
|
||||||
|
|
||||||
_createBackground: function(monitorIndex) {
|
_createBackground(monitorIndex) {
|
||||||
let monitor = Main.layoutManager.monitors[monitorIndex];
|
let monitor = Main.layoutManager.monitors[monitorIndex];
|
||||||
let widget = new St.Widget({ style_class: 'screen-shield-background',
|
let widget = new St.Widget({ style_class: 'screen-shield-background',
|
||||||
x: monitor.x,
|
x: monitor.x,
|
||||||
@ -606,7 +606,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
this._backgroundGroup.add_child(widget);
|
this._backgroundGroup.add_child(widget);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateBackgrounds: function() {
|
_updateBackgrounds() {
|
||||||
for (let i = 0; i < this._bgManagers.length; i++)
|
for (let i = 0; i < this._bgManagers.length; i++)
|
||||||
this._bgManagers[i].destroy();
|
this._bgManagers[i].destroy();
|
||||||
|
|
||||||
@ -617,7 +617,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
this._createBackground(i);
|
this._createBackground(i);
|
||||||
},
|
},
|
||||||
|
|
||||||
_liftShield: function(onPrimary, velocity) {
|
_liftShield(onPrimary, velocity) {
|
||||||
if (this._isLocked) {
|
if (this._isLocked) {
|
||||||
if (this._ensureUnlockDialog(onPrimary, true /* allowCancel */))
|
if (this._ensureUnlockDialog(onPrimary, true /* allowCancel */))
|
||||||
this._hideLockScreen(true /* animate */, velocity);
|
this._hideLockScreen(true /* animate */, velocity);
|
||||||
@ -626,7 +626,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_maybeCancelDialog: function() {
|
_maybeCancelDialog() {
|
||||||
if (!this._dialog)
|
if (!this._dialog)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_becomeModal: function() {
|
_becomeModal() {
|
||||||
if (this._isModal)
|
if (this._isModal)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -656,7 +656,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
return this._isModal;
|
return this._isModal;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLockScreenKeyPress: function(actor, event) {
|
_onLockScreenKeyPress(actor, event) {
|
||||||
let symbol = event.get_key_symbol();
|
let symbol = event.get_key_symbol();
|
||||||
let unichar = event.get_key_unicode();
|
let unichar = event.get_key_unicode();
|
||||||
|
|
||||||
@ -686,7 +686,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLockScreenScroll: function(actor, event) {
|
_onLockScreenScroll(actor, event) {
|
||||||
if (this._lockScreenState != MessageTray.State.SHOWN)
|
if (this._lockScreenState != MessageTray.State.SHOWN)
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
|
||||||
@ -706,7 +706,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncInhibitor: function() {
|
_syncInhibitor() {
|
||||||
let lockEnabled = this._settings.get_boolean(LOCK_ENABLED_KEY);
|
let lockEnabled = this._settings.get_boolean(LOCK_ENABLED_KEY);
|
||||||
let lockLocked = this._lockSettings.get_boolean(DISABLE_LOCK_KEY);
|
let lockLocked = this._lockSettings.get_boolean(DISABLE_LOCK_KEY);
|
||||||
let inhibit = (this._loginSession && this._loginSession.Active &&
|
let inhibit = (this._loginSession && this._loginSession.Active &&
|
||||||
@ -725,7 +725,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_prepareForSleep: function(loginManager, aboutToSuspend) {
|
_prepareForSleep(loginManager, aboutToSuspend) {
|
||||||
if (aboutToSuspend) {
|
if (aboutToSuspend) {
|
||||||
if (this._settings.get_boolean(LOCK_ENABLED_KEY))
|
if (this._settings.get_boolean(LOCK_ENABLED_KEY))
|
||||||
this.lock(true);
|
this.lock(true);
|
||||||
@ -734,7 +734,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_animateArrows: function() {
|
_animateArrows() {
|
||||||
let arrows = this._arrowContainer.get_children();
|
let arrows = this._arrowContainer.get_children();
|
||||||
let unitaryDelay = ARROW_ANIMATION_TIME / (arrows.length + 1);
|
let unitaryDelay = ARROW_ANIMATION_TIME / (arrows.length + 1);
|
||||||
let maxOpacity = 255 * ARROW_ANIMATION_PEAK_OPACITY;
|
let maxOpacity = 255 * ARROW_ANIMATION_PEAK_OPACITY;
|
||||||
@ -744,7 +744,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
delay: unitaryDelay * (N_ARROWS - (i + 1)),
|
delay: unitaryDelay * (N_ARROWS - (i + 1)),
|
||||||
time: ARROW_ANIMATION_TIME,
|
time: ARROW_ANIMATION_TIME,
|
||||||
transition: function(t, b, c, d) {
|
transition(t, b, c, d) {
|
||||||
if (t < d/2)
|
if (t < d/2)
|
||||||
return TweenerEquations.easeOutQuad(t, 0, maxOpacity, d/2);
|
return TweenerEquations.easeOutQuad(t, 0, maxOpacity, d/2);
|
||||||
else
|
else
|
||||||
@ -756,7 +756,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
return GLib.SOURCE_CONTINUE;
|
return GLib.SOURCE_CONTINUE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragBegin: function() {
|
_onDragBegin() {
|
||||||
Tweener.removeTweens(this._lockScreenGroup);
|
Tweener.removeTweens(this._lockScreenGroup);
|
||||||
this._lockScreenState = MessageTray.State.HIDING;
|
this._lockScreenState = MessageTray.State.HIDING;
|
||||||
|
|
||||||
@ -766,7 +766,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragMotion: function() {
|
_onDragMotion() {
|
||||||
let [origX, origY] = this._dragAction.get_press_coords(0);
|
let [origX, origY] = this._dragAction.get_press_coords(0);
|
||||||
let [currentX, currentY] = this._dragAction.get_motion_coords(0);
|
let [currentX, currentY] = this._dragAction.get_motion_coords(0);
|
||||||
|
|
||||||
@ -778,7 +778,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDragEnd: function(action, actor, eventX, eventY, modifiers) {
|
_onDragEnd(action, actor, eventX, eventY, modifiers) {
|
||||||
if (this._lockScreenState != MessageTray.State.HIDING)
|
if (this._lockScreenState != MessageTray.State.HIDING)
|
||||||
return;
|
return;
|
||||||
if (this._lockScreenGroup.y < -(ARROW_DRAG_THRESHOLD * global.stage.height)) {
|
if (this._lockScreenGroup.y < -(ARROW_DRAG_THRESHOLD * global.stage.height)) {
|
||||||
@ -795,7 +795,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
{ y: 0,
|
{ y: 0,
|
||||||
time: time,
|
time: time,
|
||||||
transition: 'easeInQuad',
|
transition: 'easeInQuad',
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
this._lockScreenGroup.fixed_position_set = false;
|
this._lockScreenGroup.fixed_position_set = false;
|
||||||
this._lockScreenState = MessageTray.State.SHOWN;
|
this._lockScreenState = MessageTray.State.SHOWN;
|
||||||
},
|
},
|
||||||
@ -806,7 +806,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onStatusChanged: function(status) {
|
_onStatusChanged(status) {
|
||||||
if (status != GnomeSession.PresenceStatus.IDLE)
|
if (status != GnomeSession.PresenceStatus.IDLE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -857,7 +857,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
this._activateFade(this._longLightbox, STANDARD_FADE_TIME);
|
this._activateFade(this._longLightbox, STANDARD_FADE_TIME);
|
||||||
},
|
},
|
||||||
|
|
||||||
_activateFade: function(lightbox, time) {
|
_activateFade(lightbox, time) {
|
||||||
Main.uiGroup.set_child_above_sibling(lightbox.actor, null);
|
Main.uiGroup.set_child_above_sibling(lightbox.actor, null);
|
||||||
lightbox.show(time);
|
lightbox.show(time);
|
||||||
|
|
||||||
@ -865,7 +865,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
this._becameActiveId = this.idleMonitor.add_user_active_watch(Lang.bind(this, this._onUserBecameActive));
|
this._becameActiveId = this.idleMonitor.add_user_active_watch(Lang.bind(this, this._onUserBecameActive));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUserBecameActive: function() {
|
_onUserBecameActive() {
|
||||||
// This function gets called here when the user becomes active
|
// This function gets called here when the user becomes active
|
||||||
// after we activated a lightbox
|
// after we activated a lightbox
|
||||||
// There are two possibilities here:
|
// There are two possibilities here:
|
||||||
@ -895,15 +895,15 @@ var ScreenShield = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLongLightboxShown: function() {
|
_onLongLightboxShown() {
|
||||||
this.activate(false);
|
this.activate(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onShortLightboxShown: function() {
|
_onShortLightboxShown() {
|
||||||
this._completeLockScreenShown();
|
this._completeLockScreenShown();
|
||||||
},
|
},
|
||||||
|
|
||||||
showDialog: function() {
|
showDialog() {
|
||||||
if (!this._becomeModal()) {
|
if (!this._becomeModal()) {
|
||||||
// In the login screen, this is a hard error. Fail-whale
|
// In the login screen, this is a hard error. Fail-whale
|
||||||
log('Could not acquire modal grab for the login screen. Aborting login process.');
|
log('Could not acquire modal grab for the login screen. Aborting login process.');
|
||||||
@ -917,7 +917,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
this._hideLockScreen(false, 0);
|
this._hideLockScreen(false, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideLockScreenComplete: function() {
|
_hideLockScreenComplete() {
|
||||||
if (Main.sessionMode.currentMode == 'lock-screen')
|
if (Main.sessionMode.currentMode == 'lock-screen')
|
||||||
Main.sessionMode.popMode('lock-screen');
|
Main.sessionMode.popMode('lock-screen');
|
||||||
|
|
||||||
@ -930,7 +930,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_hideLockScreen: function(animate, velocity) {
|
_hideLockScreen(animate, velocity) {
|
||||||
if (this._lockScreenState == MessageTray.State.HIDDEN)
|
if (this._lockScreenState == MessageTray.State.HIDDEN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -963,7 +963,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
this._cursorTracker.set_pointer_visible(true);
|
this._cursorTracker.set_pointer_visible(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureUnlockDialog: function(onPrimary, allowCancel) {
|
_ensureUnlockDialog(onPrimary, allowCancel) {
|
||||||
if (!this._dialog) {
|
if (!this._dialog) {
|
||||||
let constructor = Main.sessionMode.unlockDialog;
|
let constructor = Main.sessionMode.unlockDialog;
|
||||||
if (!constructor) {
|
if (!constructor) {
|
||||||
@ -991,12 +991,12 @@ var ScreenShield = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUnlockFailed: function() {
|
_onUnlockFailed() {
|
||||||
this._resetLockScreen({ animateLockScreen: true,
|
this._resetLockScreen({ animateLockScreen: true,
|
||||||
fadeToBlack: false });
|
fadeToBlack: false });
|
||||||
},
|
},
|
||||||
|
|
||||||
_resetLockScreen: function(params) {
|
_resetLockScreen(params) {
|
||||||
// Don't reset the lock screen unless it is completely hidden
|
// Don't reset the lock screen unless it is completely hidden
|
||||||
// This prevents the shield going down if the lock-delay timeout
|
// This prevents the shield going down if the lock-delay timeout
|
||||||
// fires while the user is dragging (which has the potential
|
// fires while the user is dragging (which has the potential
|
||||||
@ -1020,7 +1020,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
{ y: 0,
|
{ y: 0,
|
||||||
time: MANUAL_FADE_TIME,
|
time: MANUAL_FADE_TIME,
|
||||||
transition: 'easeOutQuad',
|
transition: 'easeOutQuad',
|
||||||
onComplete: function() {
|
onComplete() {
|
||||||
this._lockScreenShown({ fadeToBlack: fadeToBlack,
|
this._lockScreenShown({ fadeToBlack: fadeToBlack,
|
||||||
animateFade: true });
|
animateFade: true });
|
||||||
},
|
},
|
||||||
@ -1038,7 +1038,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
Main.sessionMode.pushMode('lock-screen');
|
Main.sessionMode.pushMode('lock-screen');
|
||||||
},
|
},
|
||||||
|
|
||||||
_startArrowAnimation: function() {
|
_startArrowAnimation() {
|
||||||
this._arrowActiveWatchId = 0;
|
this._arrowActiveWatchId = 0;
|
||||||
|
|
||||||
if (!this._arrowAnimationId) {
|
if (!this._arrowAnimationId) {
|
||||||
@ -1052,7 +1052,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
Lang.bind(this, this._pauseArrowAnimation));
|
Lang.bind(this, this._pauseArrowAnimation));
|
||||||
},
|
},
|
||||||
|
|
||||||
_pauseArrowAnimation: function() {
|
_pauseArrowAnimation() {
|
||||||
if (this._arrowAnimationId) {
|
if (this._arrowAnimationId) {
|
||||||
Mainloop.source_remove(this._arrowAnimationId);
|
Mainloop.source_remove(this._arrowAnimationId);
|
||||||
this._arrowAnimationId = 0;
|
this._arrowAnimationId = 0;
|
||||||
@ -1062,7 +1062,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
this._arrowActiveWatchId = this.idleMonitor.add_user_active_watch(Lang.bind(this, this._startArrowAnimation));
|
this._arrowActiveWatchId = this.idleMonitor.add_user_active_watch(Lang.bind(this, this._startArrowAnimation));
|
||||||
},
|
},
|
||||||
|
|
||||||
_stopArrowAnimation: function() {
|
_stopArrowAnimation() {
|
||||||
if (this._arrowAnimationId) {
|
if (this._arrowAnimationId) {
|
||||||
Mainloop.source_remove(this._arrowAnimationId);
|
Mainloop.source_remove(this._arrowAnimationId);
|
||||||
this._arrowAnimationId = 0;
|
this._arrowAnimationId = 0;
|
||||||
@ -1077,7 +1077,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkArrowAnimation: function() {
|
_checkArrowAnimation() {
|
||||||
let idleTime = this.idleMonitor.get_idletime();
|
let idleTime = this.idleMonitor.get_idletime();
|
||||||
|
|
||||||
if (idleTime < ARROW_IDLE_TIME)
|
if (idleTime < ARROW_IDLE_TIME)
|
||||||
@ -1086,7 +1086,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
this._pauseArrowAnimation();
|
this._pauseArrowAnimation();
|
||||||
},
|
},
|
||||||
|
|
||||||
_lockScreenShown: function(params) {
|
_lockScreenShown(params) {
|
||||||
if (this._dialog && !this._isGreeter) {
|
if (this._dialog && !this._isGreeter) {
|
||||||
this._dialog.destroy();
|
this._dialog.destroy();
|
||||||
this._dialog = null;
|
this._dialog = null;
|
||||||
@ -1124,14 +1124,14 @@ var ScreenShield = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_completeLockScreenShown: function() {
|
_completeLockScreenShown() {
|
||||||
this._setActive(true);
|
this._setActive(true);
|
||||||
this.emit('lock-screen-shown');
|
this.emit('lock-screen-shown');
|
||||||
},
|
},
|
||||||
|
|
||||||
// Some of the actors in the lock screen are heavy in
|
// Some of the actors in the lock screen are heavy in
|
||||||
// resources, so we only create them when needed
|
// resources, so we only create them when needed
|
||||||
_ensureLockScreen: function() {
|
_ensureLockScreen() {
|
||||||
if (this._hasLockScreen)
|
if (this._hasLockScreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1156,12 +1156,12 @@ var ScreenShield = new Lang.Class({
|
|||||||
this._hasLockScreen = true;
|
this._hasLockScreen = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_wakeUpScreen: function() {
|
_wakeUpScreen() {
|
||||||
this._onUserBecameActive();
|
this._onUserBecameActive();
|
||||||
this.emit('wake-up-screen');
|
this.emit('wake-up-screen');
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearLockScreen: function() {
|
_clearLockScreen() {
|
||||||
this._clock.destroy();
|
this._clock.destroy();
|
||||||
this._clock = null;
|
this._clock = null;
|
||||||
|
|
||||||
@ -1190,7 +1190,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
return this._activationTime;
|
return this._activationTime;
|
||||||
},
|
},
|
||||||
|
|
||||||
deactivate: function(animate) {
|
deactivate(animate) {
|
||||||
if (this._dialog)
|
if (this._dialog)
|
||||||
this._dialog.finish(Lang.bind(this, function() {
|
this._dialog.finish(Lang.bind(this, function() {
|
||||||
this._continueDeactivate(animate);
|
this._continueDeactivate(animate);
|
||||||
@ -1199,7 +1199,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
this._continueDeactivate(animate);
|
this._continueDeactivate(animate);
|
||||||
},
|
},
|
||||||
|
|
||||||
_continueDeactivate: function(animate) {
|
_continueDeactivate(animate) {
|
||||||
this._hideLockScreen(animate, 0);
|
this._hideLockScreen(animate, 0);
|
||||||
|
|
||||||
if (this._hasLockScreen)
|
if (this._hasLockScreen)
|
||||||
@ -1241,7 +1241,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_completeDeactivate: function() {
|
_completeDeactivate() {
|
||||||
if (this._dialog) {
|
if (this._dialog) {
|
||||||
this._dialog.destroy();
|
this._dialog.destroy();
|
||||||
this._dialog = null;
|
this._dialog = null;
|
||||||
@ -1268,7 +1268,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
global.set_runtime_state(LOCKED_STATE_STR, null);
|
global.set_runtime_state(LOCKED_STATE_STR, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function(animate) {
|
activate(animate) {
|
||||||
if (this._activationTime == 0)
|
if (this._activationTime == 0)
|
||||||
this._activationTime = GLib.get_monotonic_time();
|
this._activationTime = GLib.get_monotonic_time();
|
||||||
|
|
||||||
@ -1300,7 +1300,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
// activate without animation in that case.
|
// activate without animation in that case.
|
||||||
},
|
},
|
||||||
|
|
||||||
lock: function(animate) {
|
lock(animate) {
|
||||||
if (this._lockSettings.get_boolean(DISABLE_LOCK_KEY)) {
|
if (this._lockSettings.get_boolean(DISABLE_LOCK_KEY)) {
|
||||||
log('Screen lock is locked down, not locking') // lock, lock - who's there?
|
log('Screen lock is locked down, not locking') // lock, lock - who's there?
|
||||||
return;
|
return;
|
||||||
@ -1333,7 +1333,7 @@ var ScreenShield = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// If the previous shell crashed, and gnome-session restarted us, then re-lock
|
// If the previous shell crashed, and gnome-session restarted us, then re-lock
|
||||||
lockIfWasLocked: function() {
|
lockIfWasLocked() {
|
||||||
if (!this._settings.get_boolean(LOCK_ENABLED_KEY))
|
if (!this._settings.get_boolean(LOCK_ENABLED_KEY))
|
||||||
return;
|
return;
|
||||||
let wasLocked = global.get_runtime_state('b', LOCKED_STATE_STR);
|
let wasLocked = global.get_runtime_state('b', LOCKED_STATE_STR);
|
||||||
|
@ -35,7 +35,7 @@ const ScreencastIface = '<node> \
|
|||||||
var ScreencastService = new Lang.Class({
|
var ScreencastService = new Lang.Class({
|
||||||
Name: 'ScreencastService',
|
Name: 'ScreencastService',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ScreencastIface, this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ScreencastIface, this);
|
||||||
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell/Screencast');
|
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell/Screencast');
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ var ScreencastService = new Lang.Class({
|
|||||||
return this._recorders.size > 0;
|
return this._recorders.size > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureRecorderForSender: function(sender) {
|
_ensureRecorderForSender(sender) {
|
||||||
let recorder = this._recorders.get(sender);
|
let recorder = this._recorders.get(sender);
|
||||||
if (!recorder) {
|
if (!recorder) {
|
||||||
recorder = new Shell.Recorder({ stage: global.stage,
|
recorder = new Shell.Recorder({ stage: global.stage,
|
||||||
@ -66,7 +66,7 @@ var ScreencastService = new Lang.Class({
|
|||||||
return recorder;
|
return recorder;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
if (Main.sessionMode.allowScreencast)
|
if (Main.sessionMode.allowScreencast)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -74,11 +74,11 @@ var ScreencastService = new Lang.Class({
|
|||||||
this._stopRecordingForSender(sender);
|
this._stopRecordingForSender(sender);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNameVanished: function(connection, name) {
|
_onNameVanished(connection, name) {
|
||||||
this._stopRecordingForSender(name);
|
this._stopRecordingForSender(name);
|
||||||
},
|
},
|
||||||
|
|
||||||
_stopRecordingForSender: function(sender) {
|
_stopRecordingForSender(sender) {
|
||||||
let recorder = this._recorders.get(sender);
|
let recorder = this._recorders.get(sender);
|
||||||
if (!recorder)
|
if (!recorder)
|
||||||
return false;
|
return false;
|
||||||
@ -91,7 +91,7 @@ var ScreencastService = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_applyOptionalParameters: function(recorder, options) {
|
_applyOptionalParameters(recorder, options) {
|
||||||
for (let option in options)
|
for (let option in options)
|
||||||
options[option] = options[option].deep_unpack();
|
options[option] = options[option].deep_unpack();
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ var ScreencastService = new Lang.Class({
|
|||||||
recorder.set_draw_cursor(options['draw-cursor']);
|
recorder.set_draw_cursor(options['draw-cursor']);
|
||||||
},
|
},
|
||||||
|
|
||||||
ScreencastAsync: function(params, invocation) {
|
ScreencastAsync(params, invocation) {
|
||||||
let returnValue = [false, ''];
|
let returnValue = [false, ''];
|
||||||
if (!Main.sessionMode.allowScreencast ||
|
if (!Main.sessionMode.allowScreencast ||
|
||||||
this._lockdownSettings.get_boolean('disable-save-to-disk')) {
|
this._lockdownSettings.get_boolean('disable-save-to-disk')) {
|
||||||
@ -127,7 +127,7 @@ var ScreencastService = new Lang.Class({
|
|||||||
invocation.return_value(GLib.Variant.new('(bs)', returnValue));
|
invocation.return_value(GLib.Variant.new('(bs)', returnValue));
|
||||||
},
|
},
|
||||||
|
|
||||||
ScreencastAreaAsync: function(params, invocation) {
|
ScreencastAreaAsync(params, invocation) {
|
||||||
let returnValue = [false, ''];
|
let returnValue = [false, ''];
|
||||||
if (!Main.sessionMode.allowScreencast ||
|
if (!Main.sessionMode.allowScreencast ||
|
||||||
this._lockdownSettings.get_boolean('disable-save-to-disk')) {
|
this._lockdownSettings.get_boolean('disable-save-to-disk')) {
|
||||||
@ -163,7 +163,7 @@ var ScreencastService = new Lang.Class({
|
|||||||
invocation.return_value(GLib.Variant.new('(bs)', returnValue));
|
invocation.return_value(GLib.Variant.new('(bs)', returnValue));
|
||||||
},
|
},
|
||||||
|
|
||||||
StopScreencastAsync: function(params, invocation) {
|
StopScreencastAsync(params, invocation) {
|
||||||
let success = this._stopRecordingForSender(invocation.get_sender());
|
let success = this._stopRecordingForSender(invocation.get_sender());
|
||||||
invocation.return_value(GLib.Variant.new('(b)', [success]));
|
invocation.return_value(GLib.Variant.new('(b)', [success]));
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ const ScreenshotIface = '<node> \
|
|||||||
var ScreenshotService = new Lang.Class({
|
var ScreenshotService = new Lang.Class({
|
||||||
Name: 'ScreenshotService',
|
Name: 'ScreenshotService',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ScreenshotIface, this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(ScreenshotIface, this);
|
||||||
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell/Screenshot');
|
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell/Screenshot');
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ var ScreenshotService = new Lang.Class({
|
|||||||
Gio.DBus.session.own_name('org.gnome.Shell.Screenshot', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
Gio.DBus.session.own_name('org.gnome.Shell.Screenshot', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_createScreenshot: function(invocation) {
|
_createScreenshot(invocation) {
|
||||||
let sender = invocation.get_sender();
|
let sender = invocation.get_sender();
|
||||||
if (this._screenShooter.has(sender) ||
|
if (this._screenShooter.has(sender) ||
|
||||||
this._lockdownSettings.get_boolean('disable-save-to-disk')) {
|
this._lockdownSettings.get_boolean('disable-save-to-disk')) {
|
||||||
@ -90,11 +90,11 @@ var ScreenshotService = new Lang.Class({
|
|||||||
return shooter;
|
return shooter;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onNameVanished: function(connection, name) {
|
_onNameVanished(connection, name) {
|
||||||
this._removeShooterForSender(name);
|
this._removeShooterForSender(name);
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeShooterForSender: function(sender) {
|
_removeShooterForSender(sender) {
|
||||||
let shooter = this._screenShooter.get(sender);
|
let shooter = this._screenShooter.get(sender);
|
||||||
if (!shooter)
|
if (!shooter)
|
||||||
return;
|
return;
|
||||||
@ -103,14 +103,14 @@ var ScreenshotService = new Lang.Class({
|
|||||||
this._screenShooter.delete(sender);
|
this._screenShooter.delete(sender);
|
||||||
},
|
},
|
||||||
|
|
||||||
_checkArea: function(x, y, width, height) {
|
_checkArea(x, y, width, height) {
|
||||||
return x >= 0 && y >= 0 &&
|
return x >= 0 && y >= 0 &&
|
||||||
width > 0 && height > 0 &&
|
width > 0 && height > 0 &&
|
||||||
x + width <= global.screen_width &&
|
x + width <= global.screen_width &&
|
||||||
y + height <= global.screen_height;
|
y + height <= global.screen_height;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onScreenshotComplete: function(obj, result, area, filenameUsed, flash, invocation) {
|
_onScreenshotComplete(obj, result, area, filenameUsed, flash, invocation) {
|
||||||
if (result) {
|
if (result) {
|
||||||
if (flash) {
|
if (flash) {
|
||||||
let flashspot = new Flashspot(area);
|
let flashspot = new Flashspot(area);
|
||||||
@ -126,7 +126,7 @@ var ScreenshotService = new Lang.Class({
|
|||||||
invocation.return_value(retval);
|
invocation.return_value(retval);
|
||||||
},
|
},
|
||||||
|
|
||||||
_scaleArea: function(x, y, width, height) {
|
_scaleArea(x, y, width, height) {
|
||||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||||
x *= scaleFactor;
|
x *= scaleFactor;
|
||||||
y *= scaleFactor;
|
y *= scaleFactor;
|
||||||
@ -135,7 +135,7 @@ var ScreenshotService = new Lang.Class({
|
|||||||
return [x, y, width, height];
|
return [x, y, width, height];
|
||||||
},
|
},
|
||||||
|
|
||||||
_unscaleArea: function(x, y, width, height) {
|
_unscaleArea(x, y, width, height) {
|
||||||
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||||
x /= scaleFactor;
|
x /= scaleFactor;
|
||||||
y /= scaleFactor;
|
y /= scaleFactor;
|
||||||
@ -144,7 +144,7 @@ var ScreenshotService = new Lang.Class({
|
|||||||
return [x, y, width, height];
|
return [x, y, width, height];
|
||||||
},
|
},
|
||||||
|
|
||||||
ScreenshotAreaAsync : function (params, invocation) {
|
ScreenshotAreaAsync(params, invocation) {
|
||||||
let [x, y, width, height, flash, filename, callback] = params;
|
let [x, y, width, height, flash, filename, callback] = params;
|
||||||
[x, y, width, height] = this._scaleArea(x, y, width, height);
|
[x, y, width, height] = this._scaleArea(x, y, width, height);
|
||||||
if (!this._checkArea(x, y, width, height)) {
|
if (!this._checkArea(x, y, width, height)) {
|
||||||
@ -161,7 +161,7 @@ var ScreenshotService = new Lang.Class({
|
|||||||
flash, invocation));
|
flash, invocation));
|
||||||
},
|
},
|
||||||
|
|
||||||
ScreenshotWindowAsync : function (params, invocation) {
|
ScreenshotWindowAsync(params, invocation) {
|
||||||
let [include_frame, include_cursor, flash, filename] = params;
|
let [include_frame, include_cursor, flash, filename] = params;
|
||||||
let screenshot = this._createScreenshot(invocation);
|
let screenshot = this._createScreenshot(invocation);
|
||||||
if (!screenshot)
|
if (!screenshot)
|
||||||
@ -171,7 +171,7 @@ var ScreenshotService = new Lang.Class({
|
|||||||
flash, invocation));
|
flash, invocation));
|
||||||
},
|
},
|
||||||
|
|
||||||
ScreenshotAsync : function (params, invocation) {
|
ScreenshotAsync(params, invocation) {
|
||||||
let [include_cursor, flash, filename] = params;
|
let [include_cursor, flash, filename] = params;
|
||||||
let screenshot = this._createScreenshot(invocation);
|
let screenshot = this._createScreenshot(invocation);
|
||||||
if (!screenshot)
|
if (!screenshot)
|
||||||
@ -181,7 +181,7 @@ var ScreenshotService = new Lang.Class({
|
|||||||
flash, invocation));
|
flash, invocation));
|
||||||
},
|
},
|
||||||
|
|
||||||
SelectAreaAsync: function (params, invocation) {
|
SelectAreaAsync(params, invocation) {
|
||||||
let selectArea = new SelectArea();
|
let selectArea = new SelectArea();
|
||||||
selectArea.show();
|
selectArea.show();
|
||||||
selectArea.connect('finished', Lang.bind(this,
|
selectArea.connect('finished', Lang.bind(this,
|
||||||
@ -198,7 +198,7 @@ var ScreenshotService = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
FlashAreaAsync: function(params, invocation) {
|
FlashAreaAsync(params, invocation) {
|
||||||
let [x, y, width, height] = params;
|
let [x, y, width, height] = params;
|
||||||
[x, y, width, height] = this._scaleArea(x, y, width, height);
|
[x, y, width, height] = this._scaleArea(x, y, width, height);
|
||||||
if (!this._checkArea(x, y, width, height)) {
|
if (!this._checkArea(x, y, width, height)) {
|
||||||
@ -216,7 +216,7 @@ var ScreenshotService = new Lang.Class({
|
|||||||
var SelectArea = new Lang.Class({
|
var SelectArea = new Lang.Class({
|
||||||
Name: 'SelectArea',
|
Name: 'SelectArea',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._startX = -1;
|
this._startX = -1;
|
||||||
this._startY = -1;
|
this._startY = -1;
|
||||||
this._lastX = 0;
|
this._lastX = 0;
|
||||||
@ -251,7 +251,7 @@ var SelectArea = new Lang.Class({
|
|||||||
this._group.add_actor(this._rubberband);
|
this._group.add_actor(this._rubberband);
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function() {
|
show() {
|
||||||
if (!this._grabHelper.grab({ actor: this._group,
|
if (!this._grabHelper.grab({ actor: this._group,
|
||||||
onUngrab: Lang.bind(this, this._onUngrab) }))
|
onUngrab: Lang.bind(this, this._onUngrab) }))
|
||||||
return;
|
return;
|
||||||
@ -261,7 +261,7 @@ var SelectArea = new Lang.Class({
|
|||||||
this._group.visible = true;
|
this._group.visible = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_initRubberbandColors: function() {
|
_initRubberbandColors() {
|
||||||
function colorFromRGBA(rgba) {
|
function colorFromRGBA(rgba) {
|
||||||
return new Clutter.Color({ red: rgba.red * 255,
|
return new Clutter.Color({ red: rgba.red * 255,
|
||||||
green: rgba.green * 255,
|
green: rgba.green * 255,
|
||||||
@ -280,14 +280,14 @@ var SelectArea = new Lang.Class({
|
|||||||
this._border = colorFromRGBA(context.get_border_color(Gtk.StateFlags.NORMAL));
|
this._border = colorFromRGBA(context.get_border_color(Gtk.StateFlags.NORMAL));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getGeometry: function() {
|
_getGeometry() {
|
||||||
return { x: Math.min(this._startX, this._lastX),
|
return { x: Math.min(this._startX, this._lastX),
|
||||||
y: Math.min(this._startY, this._lastY),
|
y: Math.min(this._startY, this._lastY),
|
||||||
width: Math.abs(this._startX - this._lastX) + 1,
|
width: Math.abs(this._startX - this._lastX) + 1,
|
||||||
height: Math.abs(this._startY - this._lastY) + 1 };
|
height: Math.abs(this._startY - this._lastY) + 1 };
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMotionEvent: function(actor, event) {
|
_onMotionEvent(actor, event) {
|
||||||
if (this._startX == -1 || this._startY == -1)
|
if (this._startX == -1 || this._startY == -1)
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ var SelectArea = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonPress: function(actor, event) {
|
_onButtonPress(actor, event) {
|
||||||
[this._startX, this._startY] = event.get_coords();
|
[this._startX, this._startY] = event.get_coords();
|
||||||
this._startX = Math.floor(this._startX);
|
this._startX = Math.floor(this._startX);
|
||||||
this._startY = Math.floor(this._startY);
|
this._startY = Math.floor(this._startY);
|
||||||
@ -311,7 +311,7 @@ var SelectArea = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onButtonRelease: function(actor, event) {
|
_onButtonRelease(actor, event) {
|
||||||
this._result = this._getGeometry();
|
this._result = this._getGeometry();
|
||||||
Tweener.addTween(this._group,
|
Tweener.addTween(this._group,
|
||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
@ -325,7 +325,7 @@ var SelectArea = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUngrab: function() {
|
_onUngrab() {
|
||||||
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
global.screen.set_cursor(Meta.Cursor.DEFAULT);
|
||||||
this.emit('finished', this._result);
|
this.emit('finished', this._result);
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ var Flashspot = new Lang.Class({
|
|||||||
Name: 'Flashspot',
|
Name: 'Flashspot',
|
||||||
Extends: Lightbox.Lightbox,
|
Extends: Lightbox.Lightbox,
|
||||||
|
|
||||||
_init: function(area) {
|
_init(area) {
|
||||||
this.parent(Main.uiGroup, { inhibitEvents: true,
|
this.parent(Main.uiGroup, { inhibitEvents: true,
|
||||||
width: area.width,
|
width: area.width,
|
||||||
height: area.height });
|
height: area.height });
|
||||||
@ -353,7 +353,7 @@ var Flashspot = new Lang.Class({
|
|||||||
this.actor.set_position(area.x, area.y);
|
this.actor.set_position(area.x, area.y);
|
||||||
},
|
},
|
||||||
|
|
||||||
fire: function(doneCallback) {
|
fire(doneCallback) {
|
||||||
this.actor.show();
|
this.actor.show();
|
||||||
this.actor.opacity = 255;
|
this.actor.opacity = 255;
|
||||||
Tweener.addTween(this.actor,
|
Tweener.addTween(this.actor,
|
||||||
|
110
js/ui/search.js
110
js/ui/search.js
@ -28,7 +28,7 @@ var MaxWidthBin = new Lang.Class({
|
|||||||
Name: 'MaxWidthBin',
|
Name: 'MaxWidthBin',
|
||||||
Extends: St.Bin,
|
Extends: St.Bin,
|
||||||
|
|
||||||
vfunc_allocate: function(box, flags) {
|
vfunc_allocate(box, flags) {
|
||||||
let themeNode = this.get_theme_node();
|
let themeNode = this.get_theme_node();
|
||||||
let maxWidth = themeNode.get_max_width();
|
let maxWidth = themeNode.get_max_width();
|
||||||
let availWidth = box.x2 - box.x1;
|
let availWidth = box.x2 - box.x1;
|
||||||
@ -47,7 +47,7 @@ var MaxWidthBin = new Lang.Class({
|
|||||||
var SearchResult = new Lang.Class({
|
var SearchResult = new Lang.Class({
|
||||||
Name: 'SearchResult',
|
Name: 'SearchResult',
|
||||||
|
|
||||||
_init: function(provider, metaInfo, resultsView) {
|
_init(provider, metaInfo, resultsView) {
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.metaInfo = metaInfo;
|
this.metaInfo = metaInfo;
|
||||||
this._resultsView = resultsView;
|
this._resultsView = resultsView;
|
||||||
@ -62,7 +62,7 @@ var SearchResult = new Lang.Class({
|
|||||||
this.actor.connect('clicked', Lang.bind(this, this.activate));
|
this.actor.connect('clicked', Lang.bind(this, this.activate));
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function() {
|
activate() {
|
||||||
this.emit('activate', this.metaInfo.id);
|
this.emit('activate', this.metaInfo.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -74,7 +74,7 @@ var ListSearchResult = new Lang.Class({
|
|||||||
|
|
||||||
ICON_SIZE: 24,
|
ICON_SIZE: 24,
|
||||||
|
|
||||||
_init: function(provider, metaInfo, resultsView) {
|
_init(provider, metaInfo, resultsView) {
|
||||||
this.parent(provider, metaInfo, resultsView);
|
this.parent(provider, metaInfo, resultsView);
|
||||||
|
|
||||||
this.actor.style_class = 'list-search-result';
|
this.actor.style_class = 'list-search-result';
|
||||||
@ -124,12 +124,12 @@ var ListSearchResult = new Lang.Class({
|
|||||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
},
|
},
|
||||||
|
|
||||||
_highlightTerms: function() {
|
_highlightTerms() {
|
||||||
let markup = this._resultsView.highlightTerms(this.metaInfo['description'].split('\n')[0]);
|
let markup = this._resultsView.highlightTerms(this.metaInfo['description'].split('\n')[0]);
|
||||||
this._descriptionLabel.clutter_text.set_markup(markup);
|
this._descriptionLabel.clutter_text.set_markup(markup);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
if (this._termsChangedId)
|
if (this._termsChangedId)
|
||||||
this._resultsView.disconnect(this._termsChangedId);
|
this._resultsView.disconnect(this._termsChangedId);
|
||||||
this._termsChangedId = 0;
|
this._termsChangedId = 0;
|
||||||
@ -140,7 +140,7 @@ var GridSearchResult = new Lang.Class({
|
|||||||
Name: 'GridSearchResult',
|
Name: 'GridSearchResult',
|
||||||
Extends: SearchResult,
|
Extends: SearchResult,
|
||||||
|
|
||||||
_init: function(provider, metaInfo, resultsView) {
|
_init(provider, metaInfo, resultsView) {
|
||||||
this.parent(provider, metaInfo, resultsView);
|
this.parent(provider, metaInfo, resultsView);
|
||||||
|
|
||||||
this.actor.style_class = 'grid-search-result';
|
this.actor.style_class = 'grid-search-result';
|
||||||
@ -156,7 +156,7 @@ var GridSearchResult = new Lang.Class({
|
|||||||
var SearchResultsBase = new Lang.Class({
|
var SearchResultsBase = new Lang.Class({
|
||||||
Name: 'SearchResultsBase',
|
Name: 'SearchResultsBase',
|
||||||
|
|
||||||
_init: function(provider, resultsView) {
|
_init(provider, resultsView) {
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this._resultsView = resultsView;
|
this._resultsView = resultsView;
|
||||||
|
|
||||||
@ -179,19 +179,19 @@ var SearchResultsBase = new Lang.Class({
|
|||||||
this._cancellable = new Gio.Cancellable();
|
this._cancellable = new Gio.Cancellable();
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy() {
|
||||||
this.actor.destroy();
|
this.actor.destroy();
|
||||||
this._terms = [];
|
this._terms = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
_createResultDisplay: function(meta) {
|
_createResultDisplay(meta) {
|
||||||
if (this.provider.createResultObject)
|
if (this.provider.createResultObject)
|
||||||
return this.provider.createResultObject(meta, this._resultsView);
|
return this.provider.createResultObject(meta, this._resultsView);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
clear: function() {
|
clear() {
|
||||||
for (let resultId in this._resultDisplays)
|
for (let resultId in this._resultDisplays)
|
||||||
this._resultDisplays[resultId].actor.destroy();
|
this._resultDisplays[resultId].actor.destroy();
|
||||||
this._resultDisplays = {};
|
this._resultDisplays = {};
|
||||||
@ -199,21 +199,21 @@ var SearchResultsBase = new Lang.Class({
|
|||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyFocusIn: function(actor) {
|
_keyFocusIn(actor) {
|
||||||
this.emit('key-focus-in', actor);
|
this.emit('key-focus-in', actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_activateResult: function(result, id) {
|
_activateResult(result, id) {
|
||||||
this.provider.activateResult(id, this._terms);
|
this.provider.activateResult(id, this._terms);
|
||||||
if (result.metaInfo.clipboardText)
|
if (result.metaInfo.clipboardText)
|
||||||
this._clipboard.set_text(St.ClipboardType.CLIPBOARD, result.metaInfo.clipboardText);
|
this._clipboard.set_text(St.ClipboardType.CLIPBOARD, result.metaInfo.clipboardText);
|
||||||
Main.overview.toggle();
|
Main.overview.toggle();
|
||||||
},
|
},
|
||||||
|
|
||||||
_setMoreCount: function(count) {
|
_setMoreCount(count) {
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureResultActors: function(results, callback) {
|
_ensureResultActors(results, callback) {
|
||||||
let metasNeeded = results.filter(Lang.bind(this, function(resultId) {
|
let metasNeeded = results.filter(Lang.bind(this, function(resultId) {
|
||||||
return this._resultDisplays[resultId] === undefined;
|
return this._resultDisplays[resultId] === undefined;
|
||||||
}));
|
}));
|
||||||
@ -251,7 +251,7 @@ var SearchResultsBase = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateSearch: function(providerResults, terms, callback) {
|
updateSearch(providerResults, terms, callback) {
|
||||||
this._terms = terms;
|
this._terms = terms;
|
||||||
if (providerResults.length == 0) {
|
if (providerResults.length == 0) {
|
||||||
this._clearResultDisplay();
|
this._clearResultDisplay();
|
||||||
@ -289,7 +289,7 @@ var ListSearchResults = new Lang.Class({
|
|||||||
Name: 'ListSearchResults',
|
Name: 'ListSearchResults',
|
||||||
Extends: SearchResultsBase,
|
Extends: SearchResultsBase,
|
||||||
|
|
||||||
_init: function(provider, resultsView) {
|
_init(provider, resultsView) {
|
||||||
this.parent(provider, resultsView);
|
this.parent(provider, resultsView);
|
||||||
|
|
||||||
this._container = new St.BoxLayout({ style_class: 'search-section-content' });
|
this._container = new St.BoxLayout({ style_class: 'search-section-content' });
|
||||||
@ -314,28 +314,28 @@ var ListSearchResults = new Lang.Class({
|
|||||||
this._resultDisplayBin.set_child(this._container);
|
this._resultDisplayBin.set_child(this._container);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setMoreCount: function(count) {
|
_setMoreCount(count) {
|
||||||
this.providerInfo.setMoreCount(count);
|
this.providerInfo.setMoreCount(count);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMaxDisplayedResults: function() {
|
_getMaxDisplayedResults() {
|
||||||
return MAX_LIST_SEARCH_RESULTS_ROWS;
|
return MAX_LIST_SEARCH_RESULTS_ROWS;
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearResultDisplay: function () {
|
_clearResultDisplay() {
|
||||||
this._content.remove_all_children();
|
this._content.remove_all_children();
|
||||||
},
|
},
|
||||||
|
|
||||||
_createResultDisplay: function(meta) {
|
_createResultDisplay(meta) {
|
||||||
return this.parent(meta, this._resultsView) ||
|
return this.parent(meta, this._resultsView) ||
|
||||||
new ListSearchResult(this.provider, meta, this._resultsView);
|
new ListSearchResult(this.provider, meta, this._resultsView);
|
||||||
},
|
},
|
||||||
|
|
||||||
_addItem: function(display) {
|
_addItem(display) {
|
||||||
this._content.add_actor(display.actor);
|
this._content.add_actor(display.actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
getFirstResult: function() {
|
getFirstResult() {
|
||||||
if (this._content.get_n_children() > 0)
|
if (this._content.get_n_children() > 0)
|
||||||
return this._content.get_child_at_index(0)._delegate;
|
return this._content.get_child_at_index(0)._delegate;
|
||||||
else
|
else
|
||||||
@ -348,7 +348,7 @@ var GridSearchResults = new Lang.Class({
|
|||||||
Name: 'GridSearchResults',
|
Name: 'GridSearchResults',
|
||||||
Extends: SearchResultsBase,
|
Extends: SearchResultsBase,
|
||||||
|
|
||||||
_init: function(provider, resultsView) {
|
_init(provider, resultsView) {
|
||||||
this.parent(provider, resultsView);
|
this.parent(provider, resultsView);
|
||||||
// We need to use the parent container to know how much results we can show.
|
// We need to use the parent container to know how much results we can show.
|
||||||
// None of the actors in this class can be used for that, since the main actor
|
// None of the actors in this class can be used for that, since the main actor
|
||||||
@ -365,26 +365,26 @@ var GridSearchResults = new Lang.Class({
|
|||||||
this._resultDisplayBin.set_child(this._bin);
|
this._resultDisplayBin.set_child(this._bin);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMaxDisplayedResults: function() {
|
_getMaxDisplayedResults() {
|
||||||
let parentThemeNode = this._parentContainer.get_theme_node();
|
let parentThemeNode = this._parentContainer.get_theme_node();
|
||||||
let availableWidth = parentThemeNode.adjust_for_width(this._parentContainer.width);
|
let availableWidth = parentThemeNode.adjust_for_width(this._parentContainer.width);
|
||||||
return this._grid.columnsForWidth(availableWidth) * this._grid.getRowLimit();
|
return this._grid.columnsForWidth(availableWidth) * this._grid.getRowLimit();
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearResultDisplay: function () {
|
_clearResultDisplay() {
|
||||||
this._grid.removeAll();
|
this._grid.removeAll();
|
||||||
},
|
},
|
||||||
|
|
||||||
_createResultDisplay: function(meta) {
|
_createResultDisplay(meta) {
|
||||||
return this.parent(meta, this._resultsView) ||
|
return this.parent(meta, this._resultsView) ||
|
||||||
new GridSearchResult(this.provider, meta, this._resultsView);
|
new GridSearchResult(this.provider, meta, this._resultsView);
|
||||||
},
|
},
|
||||||
|
|
||||||
_addItem: function(display) {
|
_addItem(display) {
|
||||||
this._grid.addItem(display);
|
this._grid.addItem(display);
|
||||||
},
|
},
|
||||||
|
|
||||||
getFirstResult: function() {
|
getFirstResult() {
|
||||||
if (this._grid.visibleItemsCount() > 0)
|
if (this._grid.visibleItemsCount() > 0)
|
||||||
return this._grid.getItemAtIndex(0)._delegate;
|
return this._grid.getItemAtIndex(0)._delegate;
|
||||||
else
|
else
|
||||||
@ -396,7 +396,7 @@ Signals.addSignalMethods(GridSearchResults.prototype);
|
|||||||
var SearchResults = new Lang.Class({
|
var SearchResults = new Lang.Class({
|
||||||
Name: 'SearchResults',
|
Name: 'SearchResults',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.actor = new St.BoxLayout({ name: 'searchResults',
|
this.actor = new St.BoxLayout({ name: 'searchResults',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
|
|
||||||
@ -456,7 +456,7 @@ var SearchResults = new Lang.Class({
|
|||||||
this._reloadRemoteProviders();
|
this._reloadRemoteProviders();
|
||||||
},
|
},
|
||||||
|
|
||||||
_reloadRemoteProviders: function() {
|
_reloadRemoteProviders() {
|
||||||
let remoteProviders = this._providers.filter(function(provider) {
|
let remoteProviders = this._providers.filter(function(provider) {
|
||||||
return provider.isRemoteProvider;
|
return provider.isRemoteProvider;
|
||||||
});
|
});
|
||||||
@ -469,12 +469,12 @@ var SearchResults = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_registerProvider: function (provider) {
|
_registerProvider(provider) {
|
||||||
this._providers.push(provider);
|
this._providers.push(provider);
|
||||||
this._ensureProviderDisplay(provider);
|
this._ensureProviderDisplay(provider);
|
||||||
},
|
},
|
||||||
|
|
||||||
_unregisterProvider: function (provider) {
|
_unregisterProvider(provider) {
|
||||||
let index = this._providers.indexOf(provider);
|
let index = this._providers.indexOf(provider);
|
||||||
this._providers.splice(index, 1);
|
this._providers.splice(index, 1);
|
||||||
|
|
||||||
@ -482,19 +482,19 @@ var SearchResults = new Lang.Class({
|
|||||||
provider.display.destroy();
|
provider.display.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
_gotResults: function(results, provider) {
|
_gotResults(results, provider) {
|
||||||
this._results[provider.id] = results;
|
this._results[provider.id] = results;
|
||||||
this._updateResults(provider, results);
|
this._updateResults(provider, results);
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearSearchTimeout: function() {
|
_clearSearchTimeout() {
|
||||||
if (this._searchTimeoutId > 0) {
|
if (this._searchTimeoutId > 0) {
|
||||||
GLib.source_remove(this._searchTimeoutId);
|
GLib.source_remove(this._searchTimeoutId);
|
||||||
this._searchTimeoutId = 0;
|
this._searchTimeoutId = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_reset: function() {
|
_reset() {
|
||||||
this._terms = [];
|
this._terms = [];
|
||||||
this._results = {};
|
this._results = {};
|
||||||
this._clearDisplay();
|
this._clearDisplay();
|
||||||
@ -505,7 +505,7 @@ var SearchResults = new Lang.Class({
|
|||||||
this._updateSearchProgress();
|
this._updateSearchProgress();
|
||||||
},
|
},
|
||||||
|
|
||||||
_doSearch: function() {
|
_doSearch() {
|
||||||
this._startingSearch = false;
|
this._startingSearch = false;
|
||||||
|
|
||||||
let previousResults = this._results;
|
let previousResults = this._results;
|
||||||
@ -526,13 +526,13 @@ var SearchResults = new Lang.Class({
|
|||||||
this._clearSearchTimeout();
|
this._clearSearchTimeout();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSearchTimeout: function() {
|
_onSearchTimeout() {
|
||||||
this._searchTimeoutId = 0;
|
this._searchTimeoutId = 0;
|
||||||
this._doSearch();
|
this._doSearch();
|
||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
|
||||||
setTerms: function(terms) {
|
setTerms(terms) {
|
||||||
// Check for the case of making a duplicate previous search before
|
// Check for the case of making a duplicate previous search before
|
||||||
// setting state of the current search or cancelling the search.
|
// setting state of the current search or cancelling the search.
|
||||||
// This will prevent incorrect state being as a result of a duplicate
|
// This will prevent incorrect state being as a result of a duplicate
|
||||||
@ -569,18 +569,18 @@ var SearchResults = new Lang.Class({
|
|||||||
this.emit('terms-changed');
|
this.emit('terms-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPan: function(action) {
|
_onPan(action) {
|
||||||
let [dist, dx, dy] = action.get_motion_delta(0);
|
let [dist, dx, dy] = action.get_motion_delta(0);
|
||||||
let adjustment = this._scrollView.vscroll.adjustment;
|
let adjustment = this._scrollView.vscroll.adjustment;
|
||||||
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
|
adjustment.value -= (dy / this.actor.height) * adjustment.page_size;
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyFocusIn: function(provider, actor) {
|
_keyFocusIn(provider, actor) {
|
||||||
Util.ensureActorVisibleInScrollView(this._scrollView, actor);
|
Util.ensureActorVisibleInScrollView(this._scrollView, actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureProviderDisplay: function(provider) {
|
_ensureProviderDisplay(provider) {
|
||||||
if (provider.display)
|
if (provider.display)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -596,13 +596,13 @@ var SearchResults = new Lang.Class({
|
|||||||
provider.display = providerDisplay;
|
provider.display = providerDisplay;
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearDisplay: function() {
|
_clearDisplay() {
|
||||||
this._providers.forEach(function(provider) {
|
this._providers.forEach(function(provider) {
|
||||||
provider.display.clear();
|
provider.display.clear();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_maybeSetInitialSelection: function() {
|
_maybeSetInitialSelection() {
|
||||||
let newDefaultResult = null;
|
let newDefaultResult = null;
|
||||||
|
|
||||||
let providers = this._providers;
|
let providers = this._providers;
|
||||||
@ -637,7 +637,7 @@ var SearchResults = new Lang.Class({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSearchProgress: function () {
|
_updateSearchProgress() {
|
||||||
let haveResults = this._providers.some(function(provider) {
|
let haveResults = this._providers.some(function(provider) {
|
||||||
let display = provider.display;
|
let display = provider.display;
|
||||||
return (display.getFirstResult() != null);
|
return (display.getFirstResult() != null);
|
||||||
@ -655,7 +655,7 @@ var SearchResults = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateResults: function(provider, results) {
|
_updateResults(provider, results) {
|
||||||
let terms = this._terms;
|
let terms = this._terms;
|
||||||
let display = provider.display;
|
let display = provider.display;
|
||||||
|
|
||||||
@ -667,7 +667,7 @@ var SearchResults = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
activateDefault: function() {
|
activateDefault() {
|
||||||
// If we have a search queued up, force the search now.
|
// If we have a search queued up, force the search now.
|
||||||
if (this._searchTimeoutId > 0)
|
if (this._searchTimeoutId > 0)
|
||||||
this._doSearch();
|
this._doSearch();
|
||||||
@ -676,12 +676,12 @@ var SearchResults = new Lang.Class({
|
|||||||
this._defaultResult.activate();
|
this._defaultResult.activate();
|
||||||
},
|
},
|
||||||
|
|
||||||
highlightDefault: function(highlight) {
|
highlightDefault(highlight) {
|
||||||
this._highlightDefault = highlight;
|
this._highlightDefault = highlight;
|
||||||
this._setSelected(this._defaultResult, highlight);
|
this._setSelected(this._defaultResult, highlight);
|
||||||
},
|
},
|
||||||
|
|
||||||
popupMenuDefault: function() {
|
popupMenuDefault() {
|
||||||
// If we have a search queued up, force the search now.
|
// If we have a search queued up, force the search now.
|
||||||
if (this._searchTimeoutId > 0)
|
if (this._searchTimeoutId > 0)
|
||||||
this._doSearch();
|
this._doSearch();
|
||||||
@ -690,7 +690,7 @@ var SearchResults = new Lang.Class({
|
|||||||
this._defaultResult.actor.popup_menu();
|
this._defaultResult.actor.popup_menu();
|
||||||
},
|
},
|
||||||
|
|
||||||
navigateFocus: function(direction) {
|
navigateFocus(direction) {
|
||||||
let rtl = this.actor.get_text_direction() == Clutter.TextDirection.RTL;
|
let rtl = this.actor.get_text_direction() == Clutter.TextDirection.RTL;
|
||||||
if (direction == Gtk.DirectionType.TAB_BACKWARD ||
|
if (direction == Gtk.DirectionType.TAB_BACKWARD ||
|
||||||
direction == (rtl ? Gtk.DirectionType.RIGHT
|
direction == (rtl ? Gtk.DirectionType.RIGHT
|
||||||
@ -704,7 +704,7 @@ var SearchResults = new Lang.Class({
|
|||||||
this.actor.navigate_focus(from, direction, false);
|
this.actor.navigate_focus(from, direction, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_setSelected: function(result, selected) {
|
_setSelected(result, selected) {
|
||||||
if (!result)
|
if (!result)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -716,7 +716,7 @@ var SearchResults = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
highlightTerms: function(description) {
|
highlightTerms(description) {
|
||||||
if (!description)
|
if (!description)
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
@ -734,7 +734,7 @@ var ProviderInfo = new Lang.Class({
|
|||||||
|
|
||||||
PROVIDER_ICON_SIZE: 32,
|
PROVIDER_ICON_SIZE: 32,
|
||||||
|
|
||||||
_init: function(provider) {
|
_init(provider) {
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
this.parent({ style_class: 'search-provider-icon',
|
this.parent({ style_class: 'search-provider-icon',
|
||||||
reactive: true,
|
reactive: true,
|
||||||
@ -766,14 +766,14 @@ var ProviderInfo = new Lang.Class({
|
|||||||
this._content.add_actor(detailsBox);
|
this._content.add_actor(detailsBox);
|
||||||
},
|
},
|
||||||
|
|
||||||
animateLaunch: function() {
|
animateLaunch() {
|
||||||
let appSys = Shell.AppSystem.get_default();
|
let appSys = Shell.AppSystem.get_default();
|
||||||
let app = appSys.lookup_app(this.provider.appInfo.get_id());
|
let app = appSys.lookup_app(this.provider.appInfo.get_id());
|
||||||
if (app.state == Shell.AppState.STOPPED)
|
if (app.state == Shell.AppState.STOPPED)
|
||||||
IconGrid.zoomOutActor(this._content);
|
IconGrid.zoomOutActor(this._content);
|
||||||
},
|
},
|
||||||
|
|
||||||
setMoreCount: function(count) {
|
setMoreCount(count) {
|
||||||
this._moreLabel.text = ngettext("%d more", "%d more", count).format(count);
|
this._moreLabel.text = ngettext("%d more", "%d more", count).format(count);
|
||||||
this._moreLabel.visible = count > 0;
|
this._moreLabel.visible = count > 0;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ function listModes() {
|
|||||||
var SessionMode = new Lang.Class({
|
var SessionMode = new Lang.Class({
|
||||||
Name: 'SessionMode',
|
Name: 'SessionMode',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
_loadModes();
|
_loadModes();
|
||||||
let isPrimary = (_modes[global.session_mode] &&
|
let isPrimary = (_modes[global.session_mode] &&
|
||||||
_modes[global.session_mode].isPrimary);
|
_modes[global.session_mode].isPrimary);
|
||||||
@ -161,19 +161,19 @@ var SessionMode = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
pushMode: function(mode) {
|
pushMode(mode) {
|
||||||
this._modeStack.push(mode);
|
this._modeStack.push(mode);
|
||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
popMode: function(mode) {
|
popMode(mode) {
|
||||||
if (this.currentMode != mode || this._modeStack.length === 1)
|
if (this.currentMode != mode || this._modeStack.length === 1)
|
||||||
throw new Error("Invalid SessionMode.popMode");
|
throw new Error("Invalid SessionMode.popMode");
|
||||||
this._modeStack.pop();
|
this._modeStack.pop();
|
||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
switchMode: function(to) {
|
switchMode(to) {
|
||||||
if (this.currentMode == to)
|
if (this.currentMode == to)
|
||||||
return;
|
return;
|
||||||
this._modeStack[this._modeStack.length - 1] = to;
|
this._modeStack[this._modeStack.length - 1] = to;
|
||||||
@ -184,7 +184,7 @@ var SessionMode = new Lang.Class({
|
|||||||
return this._modeStack[this._modeStack.length - 1];
|
return this._modeStack[this._modeStack.length - 1];
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let params = _modes[this.currentMode];
|
let params = _modes[this.currentMode];
|
||||||
let defaults;
|
let defaults;
|
||||||
if (params.parentMode)
|
if (params.parentMode)
|
||||||
|
@ -82,7 +82,7 @@ const ScreenSaverIface = '<node> \
|
|||||||
var GnomeShell = new Lang.Class({
|
var GnomeShell = new Lang.Class({
|
||||||
Name: 'GnomeShellDBus',
|
Name: 'GnomeShellDBus',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellIface, this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellIface, this);
|
||||||
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell');
|
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell');
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ var GnomeShell = new Lang.Class({
|
|||||||
* [false, JSON.stringify(exception)];
|
* [false, JSON.stringify(exception)];
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Eval: function(code) {
|
Eval(code) {
|
||||||
if (!global.settings.get_boolean('development-tools'))
|
if (!global.settings.get_boolean('development-tools'))
|
||||||
return [false, ''];
|
return [false, ''];
|
||||||
|
|
||||||
@ -137,11 +137,11 @@ var GnomeShell = new Lang.Class({
|
|||||||
return [success, returnValue];
|
return [success, returnValue];
|
||||||
},
|
},
|
||||||
|
|
||||||
FocusSearch: function() {
|
FocusSearch() {
|
||||||
Main.overview.focusSearch();
|
Main.overview.focusSearch();
|
||||||
},
|
},
|
||||||
|
|
||||||
ShowOSD: function(params) {
|
ShowOSD(params) {
|
||||||
for (let param in params)
|
for (let param in params)
|
||||||
params[param] = params[param].deep_unpack();
|
params[param] = params[param].deep_unpack();
|
||||||
|
|
||||||
@ -156,23 +156,23 @@ var GnomeShell = new Lang.Class({
|
|||||||
Main.osdWindowManager.show(monitorIndex, icon, label, level);
|
Main.osdWindowManager.show(monitorIndex, icon, label, level);
|
||||||
},
|
},
|
||||||
|
|
||||||
FocusApp: function(id) {
|
FocusApp(id) {
|
||||||
this.ShowApplications();
|
this.ShowApplications();
|
||||||
Main.overview.viewSelector.appDisplay.selectApp(id);
|
Main.overview.viewSelector.appDisplay.selectApp(id);
|
||||||
},
|
},
|
||||||
|
|
||||||
ShowApplications: function() {
|
ShowApplications() {
|
||||||
Main.overview.viewSelector.showApps();
|
Main.overview.viewSelector.showApps();
|
||||||
},
|
},
|
||||||
|
|
||||||
GrabAcceleratorAsync: function(params, invocation) {
|
GrabAcceleratorAsync(params, invocation) {
|
||||||
let [accel, flags] = params;
|
let [accel, flags] = params;
|
||||||
let sender = invocation.get_sender();
|
let sender = invocation.get_sender();
|
||||||
let bindingAction = this._grabAcceleratorForSender(accel, flags, sender);
|
let bindingAction = this._grabAcceleratorForSender(accel, flags, sender);
|
||||||
return invocation.return_value(GLib.Variant.new('(u)', [bindingAction]));
|
return invocation.return_value(GLib.Variant.new('(u)', [bindingAction]));
|
||||||
},
|
},
|
||||||
|
|
||||||
GrabAcceleratorsAsync: function(params, invocation) {
|
GrabAcceleratorsAsync(params, invocation) {
|
||||||
let [accels] = params;
|
let [accels] = params;
|
||||||
let sender = invocation.get_sender();
|
let sender = invocation.get_sender();
|
||||||
let bindingActions = [];
|
let bindingActions = [];
|
||||||
@ -183,7 +183,7 @@ var GnomeShell = new Lang.Class({
|
|||||||
return invocation.return_value(GLib.Variant.new('(au)', [bindingActions]));
|
return invocation.return_value(GLib.Variant.new('(au)', [bindingActions]));
|
||||||
},
|
},
|
||||||
|
|
||||||
UngrabAcceleratorAsync: function(params, invocation) {
|
UngrabAcceleratorAsync(params, invocation) {
|
||||||
let [action] = params;
|
let [action] = params;
|
||||||
let grabbedBy = this._grabbedAccelerators.get(action);
|
let grabbedBy = this._grabbedAccelerators.get(action);
|
||||||
if (invocation.get_sender() != grabbedBy)
|
if (invocation.get_sender() != grabbedBy)
|
||||||
@ -195,7 +195,7 @@ var GnomeShell = new Lang.Class({
|
|||||||
return invocation.return_value(GLib.Variant.new('(b)', [ungrabSucceeded]));
|
return invocation.return_value(GLib.Variant.new('(b)', [ungrabSucceeded]));
|
||||||
},
|
},
|
||||||
|
|
||||||
_emitAcceleratorActivated: function(action, deviceid, timestamp) {
|
_emitAcceleratorActivated(action, deviceid, timestamp) {
|
||||||
let destination = this._grabbedAccelerators.get(action);
|
let destination = this._grabbedAccelerators.get(action);
|
||||||
if (!destination)
|
if (!destination)
|
||||||
return;
|
return;
|
||||||
@ -212,7 +212,7 @@ var GnomeShell = new Lang.Class({
|
|||||||
GLib.Variant.new('(ua{sv})', [action, params]));
|
GLib.Variant.new('(ua{sv})', [action, params]));
|
||||||
},
|
},
|
||||||
|
|
||||||
_grabAcceleratorForSender: function(accelerator, flags, sender) {
|
_grabAcceleratorForSender(accelerator, flags, sender) {
|
||||||
let bindingAction = global.display.grab_accelerator(accelerator);
|
let bindingAction = global.display.grab_accelerator(accelerator);
|
||||||
if (bindingAction == Meta.KeyBindingAction.NONE)
|
if (bindingAction == Meta.KeyBindingAction.NONE)
|
||||||
return Meta.KeyBindingAction.NONE;
|
return Meta.KeyBindingAction.NONE;
|
||||||
@ -231,13 +231,13 @@ var GnomeShell = new Lang.Class({
|
|||||||
return bindingAction;
|
return bindingAction;
|
||||||
},
|
},
|
||||||
|
|
||||||
_ungrabAccelerator: function(action) {
|
_ungrabAccelerator(action) {
|
||||||
let ungrabSucceeded = global.display.ungrab_accelerator(action);
|
let ungrabSucceeded = global.display.ungrab_accelerator(action);
|
||||||
if (ungrabSucceeded)
|
if (ungrabSucceeded)
|
||||||
this._grabbedAccelerators.delete(action);
|
this._grabbedAccelerators.delete(action);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onGrabberBusNameVanished: function(connection, name) {
|
_onGrabberBusNameVanished(connection, name) {
|
||||||
let grabs = this._grabbedAccelerators.entries();
|
let grabs = this._grabbedAccelerators.entries();
|
||||||
for (let [action, sender] of grabs) {
|
for (let [action, sender] of grabs) {
|
||||||
if (sender == name)
|
if (sender == name)
|
||||||
@ -247,19 +247,19 @@ var GnomeShell = new Lang.Class({
|
|||||||
this._grabbers.delete(name);
|
this._grabbers.delete(name);
|
||||||
},
|
},
|
||||||
|
|
||||||
ShowMonitorLabelsAsync: function(params, invocation) {
|
ShowMonitorLabelsAsync(params, invocation) {
|
||||||
let sender = invocation.get_sender();
|
let sender = invocation.get_sender();
|
||||||
let [dict] = params;
|
let [dict] = params;
|
||||||
Main.osdMonitorLabeler.show(sender, dict);
|
Main.osdMonitorLabeler.show(sender, dict);
|
||||||
},
|
},
|
||||||
|
|
||||||
ShowMonitorLabels2Async: function(params, invocation) {
|
ShowMonitorLabels2Async(params, invocation) {
|
||||||
let sender = invocation.get_sender();
|
let sender = invocation.get_sender();
|
||||||
let [dict] = params;
|
let [dict] = params;
|
||||||
Main.osdMonitorLabeler.show2(sender, dict);
|
Main.osdMonitorLabeler.show2(sender, dict);
|
||||||
},
|
},
|
||||||
|
|
||||||
HideMonitorLabelsAsync: function(params, invocation) {
|
HideMonitorLabelsAsync(params, invocation) {
|
||||||
let sender = invocation.get_sender();
|
let sender = invocation.get_sender();
|
||||||
Main.osdMonitorLabeler.hide(sender);
|
Main.osdMonitorLabeler.hide(sender);
|
||||||
},
|
},
|
||||||
@ -267,7 +267,7 @@ var GnomeShell = new Lang.Class({
|
|||||||
|
|
||||||
Mode: global.session_mode,
|
Mode: global.session_mode,
|
||||||
|
|
||||||
_checkOverviewVisibleChanged: function() {
|
_checkOverviewVisibleChanged() {
|
||||||
if (Main.overview.visible !== this._cachedOverviewVisible) {
|
if (Main.overview.visible !== this._cachedOverviewVisible) {
|
||||||
this._cachedOverviewVisible = Main.overview.visible;
|
this._cachedOverviewVisible = Main.overview.visible;
|
||||||
this._dbusImpl.emit_property_changed('OverviewActive', new GLib.Variant('b', this._cachedOverviewVisible));
|
this._dbusImpl.emit_property_changed('OverviewActive', new GLib.Variant('b', this._cachedOverviewVisible));
|
||||||
@ -329,7 +329,7 @@ const GnomeShellExtensionsIface = '<node> \
|
|||||||
var GnomeShellExtensions = new Lang.Class({
|
var GnomeShellExtensions = new Lang.Class({
|
||||||
Name: 'GnomeShellExtensionsDBus',
|
Name: 'GnomeShellExtensionsDBus',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellExtensionsIface, this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellExtensionsIface, this);
|
||||||
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell');
|
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell');
|
||||||
ExtensionSystem.connect('extension-state-changed',
|
ExtensionSystem.connect('extension-state-changed',
|
||||||
@ -337,7 +337,7 @@ var GnomeShellExtensions = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
ListExtensions: function() {
|
ListExtensions() {
|
||||||
let out = {};
|
let out = {};
|
||||||
for (let uuid in ExtensionUtils.extensions) {
|
for (let uuid in ExtensionUtils.extensions) {
|
||||||
let dbusObj = this.GetExtensionInfo(uuid);
|
let dbusObj = this.GetExtensionInfo(uuid);
|
||||||
@ -346,7 +346,7 @@ var GnomeShellExtensions = new Lang.Class({
|
|||||||
return out;
|
return out;
|
||||||
},
|
},
|
||||||
|
|
||||||
GetExtensionInfo: function(uuid) {
|
GetExtensionInfo(uuid) {
|
||||||
let extension = ExtensionUtils.extensions[uuid];
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
if (!extension)
|
if (!extension)
|
||||||
return {};
|
return {};
|
||||||
@ -384,7 +384,7 @@ var GnomeShellExtensions = new Lang.Class({
|
|||||||
return out;
|
return out;
|
||||||
},
|
},
|
||||||
|
|
||||||
GetExtensionErrors: function(uuid) {
|
GetExtensionErrors(uuid) {
|
||||||
let extension = ExtensionUtils.extensions[uuid];
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
if (!extension)
|
if (!extension)
|
||||||
return [];
|
return [];
|
||||||
@ -395,15 +395,15 @@ var GnomeShellExtensions = new Lang.Class({
|
|||||||
return extension.errors;
|
return extension.errors;
|
||||||
},
|
},
|
||||||
|
|
||||||
InstallRemoteExtensionAsync: function([uuid], invocation) {
|
InstallRemoteExtensionAsync([uuid], invocation) {
|
||||||
return ExtensionDownloader.installExtension(uuid, invocation);
|
return ExtensionDownloader.installExtension(uuid, invocation);
|
||||||
},
|
},
|
||||||
|
|
||||||
UninstallExtension: function(uuid) {
|
UninstallExtension(uuid) {
|
||||||
return ExtensionDownloader.uninstallExtension(uuid);
|
return ExtensionDownloader.uninstallExtension(uuid);
|
||||||
},
|
},
|
||||||
|
|
||||||
LaunchExtensionPrefs: function(uuid) {
|
LaunchExtensionPrefs(uuid) {
|
||||||
let appSys = Shell.AppSystem.get_default();
|
let appSys = Shell.AppSystem.get_default();
|
||||||
let app = appSys.lookup_app('gnome-shell-extension-prefs.desktop');
|
let app = appSys.lookup_app('gnome-shell-extension-prefs.desktop');
|
||||||
let info = app.get_app_info();
|
let info = app.get_app_info();
|
||||||
@ -412,7 +412,7 @@ var GnomeShellExtensions = new Lang.Class({
|
|||||||
global.create_app_launch_context(timestamp, -1));
|
global.create_app_launch_context(timestamp, -1));
|
||||||
},
|
},
|
||||||
|
|
||||||
ReloadExtension: function(uuid) {
|
ReloadExtension(uuid) {
|
||||||
let extension = ExtensionUtils.extensions[uuid];
|
let extension = ExtensionUtils.extensions[uuid];
|
||||||
if (!extension)
|
if (!extension)
|
||||||
return;
|
return;
|
||||||
@ -420,13 +420,13 @@ var GnomeShellExtensions = new Lang.Class({
|
|||||||
ExtensionSystem.reloadExtension(extension);
|
ExtensionSystem.reloadExtension(extension);
|
||||||
},
|
},
|
||||||
|
|
||||||
CheckForUpdates: function() {
|
CheckForUpdates() {
|
||||||
ExtensionDownloader.checkForUpdates();
|
ExtensionDownloader.checkForUpdates();
|
||||||
},
|
},
|
||||||
|
|
||||||
ShellVersion: Config.PACKAGE_VERSION,
|
ShellVersion: Config.PACKAGE_VERSION,
|
||||||
|
|
||||||
_extensionStateChanged: function(_, newState) {
|
_extensionStateChanged(_, newState) {
|
||||||
this._dbusImpl.emit_signal('ExtensionStatusChanged',
|
this._dbusImpl.emit_signal('ExtensionStatusChanged',
|
||||||
GLib.Variant.new('(sis)', [newState.uuid, newState.state, newState.error]));
|
GLib.Variant.new('(sis)', [newState.uuid, newState.state, newState.error]));
|
||||||
}
|
}
|
||||||
@ -435,7 +435,7 @@ var GnomeShellExtensions = new Lang.Class({
|
|||||||
var ScreenSaverDBus = new Lang.Class({
|
var ScreenSaverDBus = new Lang.Class({
|
||||||
Name: 'ScreenSaverDBus',
|
Name: 'ScreenSaverDBus',
|
||||||
|
|
||||||
_init: function(screenShield) {
|
_init(screenShield) {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._screenShield = screenShield;
|
this._screenShield = screenShield;
|
||||||
@ -452,7 +452,7 @@ var ScreenSaverDBus = new Lang.Class({
|
|||||||
Gio.DBus.session.own_name('org.gnome.ScreenSaver', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
Gio.DBus.session.own_name('org.gnome.ScreenSaver', Gio.BusNameOwnerFlags.REPLACE, null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
LockAsync: function(parameters, invocation) {
|
LockAsync(parameters, invocation) {
|
||||||
let tmpId = this._screenShield.connect('lock-screen-shown', Lang.bind(this, function() {
|
let tmpId = this._screenShield.connect('lock-screen-shown', Lang.bind(this, function() {
|
||||||
this._screenShield.disconnect(tmpId);
|
this._screenShield.disconnect(tmpId);
|
||||||
|
|
||||||
@ -462,18 +462,18 @@ var ScreenSaverDBus = new Lang.Class({
|
|||||||
this._screenShield.lock(true);
|
this._screenShield.lock(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
SetActive: function(active) {
|
SetActive(active) {
|
||||||
if (active)
|
if (active)
|
||||||
this._screenShield.activate(true);
|
this._screenShield.activate(true);
|
||||||
else
|
else
|
||||||
this._screenShield.deactivate(false);
|
this._screenShield.deactivate(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
GetActive: function() {
|
GetActive() {
|
||||||
return this._screenShield.active;
|
return this._screenShield.active;
|
||||||
},
|
},
|
||||||
|
|
||||||
GetActiveTime: function() {
|
GetActiveTime() {
|
||||||
let started = this._screenShield.activationTime;
|
let started = this._screenShield.activationTime;
|
||||||
if (started > 0)
|
if (started > 0)
|
||||||
return Math.floor((GLib.get_monotonic_time() - started) / 1000000);
|
return Math.floor((GLib.get_monotonic_time() - started) / 1000000);
|
||||||
|
@ -14,7 +14,7 @@ var EntryMenu = new Lang.Class({
|
|||||||
Name: 'ShellEntryMenu',
|
Name: 'ShellEntryMenu',
|
||||||
Extends: PopupMenu.PopupMenu,
|
Extends: PopupMenu.PopupMenu,
|
||||||
|
|
||||||
_init: function(entry) {
|
_init(entry) {
|
||||||
this.parent(entry, 0, St.Side.TOP);
|
this.parent(entry, 0, St.Side.TOP);
|
||||||
|
|
||||||
this._entry = entry;
|
this._entry = entry;
|
||||||
@ -38,7 +38,7 @@ var EntryMenu = new Lang.Class({
|
|||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_makePasswordItem: function() {
|
_makePasswordItem() {
|
||||||
let item = new PopupMenu.PopupMenuItem('');
|
let item = new PopupMenu.PopupMenuItem('');
|
||||||
item.connect('activate', Lang.bind(this,
|
item.connect('activate', Lang.bind(this,
|
||||||
this._onPasswordActivated));
|
this._onPasswordActivated));
|
||||||
@ -64,7 +64,7 @@ var EntryMenu = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function(animate) {
|
open(animate) {
|
||||||
this._updatePasteItem();
|
this._updatePasteItem();
|
||||||
this._updateCopyItem();
|
this._updateCopyItem();
|
||||||
if (this._passwordItem)
|
if (this._passwordItem)
|
||||||
@ -78,20 +78,20 @@ var EntryMenu = new Lang.Class({
|
|||||||
this.actor.grab_key_focus();
|
this.actor.grab_key_focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateCopyItem: function() {
|
_updateCopyItem() {
|
||||||
let selection = this._entry.clutter_text.get_selection();
|
let selection = this._entry.clutter_text.get_selection();
|
||||||
this._copyItem.setSensitive(!this._entry.clutter_text.password_char &&
|
this._copyItem.setSensitive(!this._entry.clutter_text.password_char &&
|
||||||
selection && selection != '');
|
selection && selection != '');
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePasteItem: function() {
|
_updatePasteItem() {
|
||||||
this._clipboard.get_text(St.ClipboardType.CLIPBOARD, Lang.bind(this,
|
this._clipboard.get_text(St.ClipboardType.CLIPBOARD, Lang.bind(this,
|
||||||
function(clipboard, text) {
|
function(clipboard, text) {
|
||||||
this._pasteItem.setSensitive(text && text != '');
|
this._pasteItem.setSensitive(text && text != '');
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePasswordItem: function() {
|
_updatePasswordItem() {
|
||||||
let textHidden = (this._entry.clutter_text.password_char);
|
let textHidden = (this._entry.clutter_text.password_char);
|
||||||
if (textHidden)
|
if (textHidden)
|
||||||
this._passwordItem.label.set_text(_("Show Text"));
|
this._passwordItem.label.set_text(_("Show Text"));
|
||||||
@ -99,12 +99,12 @@ var EntryMenu = new Lang.Class({
|
|||||||
this._passwordItem.label.set_text(_("Hide Text"));
|
this._passwordItem.label.set_text(_("Hide Text"));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCopyActivated: function() {
|
_onCopyActivated() {
|
||||||
let selection = this._entry.clutter_text.get_selection();
|
let selection = this._entry.clutter_text.get_selection();
|
||||||
this._clipboard.set_text(St.ClipboardType.CLIPBOARD, selection);
|
this._clipboard.set_text(St.ClipboardType.CLIPBOARD, selection);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPasteActivated: function() {
|
_onPasteActivated() {
|
||||||
this._clipboard.get_text(St.ClipboardType.CLIPBOARD, Lang.bind(this,
|
this._clipboard.get_text(St.ClipboardType.CLIPBOARD, Lang.bind(this,
|
||||||
function(clipboard, text) {
|
function(clipboard, text) {
|
||||||
if (!text)
|
if (!text)
|
||||||
@ -115,7 +115,7 @@ var EntryMenu = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPasswordActivated: function() {
|
_onPasswordActivated() {
|
||||||
let visible = !!(this._entry.clutter_text.password_char);
|
let visible = !!(this._entry.clutter_text.password_char);
|
||||||
this._entry.clutter_text.set_password_char(visible ? '' : '\u25cf');
|
this._entry.clutter_text.set_password_char(visible ? '' : '\u25cf');
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ function _createIcon(gicon) {
|
|||||||
var ListItem = new Lang.Class({
|
var ListItem = new Lang.Class({
|
||||||
Name: 'ListItem',
|
Name: 'ListItem',
|
||||||
|
|
||||||
_init: function(app) {
|
_init(app) {
|
||||||
this._app = app;
|
this._app = app;
|
||||||
|
|
||||||
let layout = new St.BoxLayout({ vertical: false});
|
let layout = new St.BoxLayout({ vertical: false});
|
||||||
@ -91,7 +91,7 @@ var ListItem = new Lang.Class({
|
|||||||
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onClicked: function() {
|
_onClicked() {
|
||||||
this.emit('activate');
|
this.emit('activate');
|
||||||
this._app.activate();
|
this._app.activate();
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ Signals.addSignalMethods(ListItem.prototype);
|
|||||||
var ShellMountOperation = new Lang.Class({
|
var ShellMountOperation = new Lang.Class({
|
||||||
Name: 'ShellMountOperation',
|
Name: 'ShellMountOperation',
|
||||||
|
|
||||||
_init: function(source, params) {
|
_init(source, params) {
|
||||||
params = Params.parse(params, { existingDialog: null });
|
params = Params.parse(params, { existingDialog: null });
|
||||||
|
|
||||||
this._dialog = null;
|
this._dialog = null;
|
||||||
@ -125,7 +125,7 @@ var ShellMountOperation = new Lang.Class({
|
|||||||
this._gicon = source.get_icon();
|
this._gicon = source.get_icon();
|
||||||
},
|
},
|
||||||
|
|
||||||
_closeExistingDialog: function() {
|
_closeExistingDialog() {
|
||||||
if (!this._existingDialog)
|
if (!this._existingDialog)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ var ShellMountOperation = new Lang.Class({
|
|||||||
this._existingDialog = null;
|
this._existingDialog = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAskQuestion: function(op, message, choices) {
|
_onAskQuestion(op, message, choices) {
|
||||||
this._closeExistingDialog();
|
this._closeExistingDialog();
|
||||||
this._dialog = new ShellMountQuestionDialog(this._gicon);
|
this._dialog = new ShellMountQuestionDialog(this._gicon);
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ var ShellMountOperation = new Lang.Class({
|
|||||||
this._dialog.open();
|
this._dialog.open();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAskPassword: function(op, message, defaultUser, defaultDomain, flags) {
|
_onAskPassword(op, message, defaultUser, defaultDomain, flags) {
|
||||||
if (this._existingDialog) {
|
if (this._existingDialog) {
|
||||||
this._dialog = this._existingDialog;
|
this._dialog = this._existingDialog;
|
||||||
this._dialog.reaskPassword();
|
this._dialog.reaskPassword();
|
||||||
@ -174,7 +174,7 @@ var ShellMountOperation = new Lang.Class({
|
|||||||
this._dialog.open();
|
this._dialog.open();
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function(op) {
|
close(op) {
|
||||||
this._closeExistingDialog();
|
this._closeExistingDialog();
|
||||||
this._processesDialog = null;
|
this._processesDialog = null;
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ var ShellMountOperation = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onShowProcesses2: function(op) {
|
_onShowProcesses2(op) {
|
||||||
this._closeExistingDialog();
|
this._closeExistingDialog();
|
||||||
|
|
||||||
let processes = op.get_show_processes_pids();
|
let processes = op.get_show_processes_pids();
|
||||||
@ -217,7 +217,7 @@ var ShellMountOperation = new Lang.Class({
|
|||||||
this._processesDialog.update(message, processes, choices);
|
this._processesDialog.update(message, processes, choices);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onShowUnmountProgress: function(op, message, timeLeft, bytesLeft) {
|
_onShowUnmountProgress(op, message, timeLeft, bytesLeft) {
|
||||||
if (!this._notifier)
|
if (!this._notifier)
|
||||||
this._notifier = new ShellUnmountNotifier();
|
this._notifier = new ShellUnmountNotifier();
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ var ShellMountOperation = new Lang.Class({
|
|||||||
this._notifier.show(message);
|
this._notifier.show(message);
|
||||||
},
|
},
|
||||||
|
|
||||||
borrowDialog: function() {
|
borrowDialog() {
|
||||||
if (this._dialogId != 0) {
|
if (this._dialogId != 0) {
|
||||||
this._dialog.disconnect(this._dialogId);
|
this._dialog.disconnect(this._dialogId);
|
||||||
this._dialogId = 0;
|
this._dialogId = 0;
|
||||||
@ -241,14 +241,14 @@ var ShellUnmountNotifier = new Lang.Class({
|
|||||||
Name: 'ShellUnmountNotifier',
|
Name: 'ShellUnmountNotifier',
|
||||||
Extends: MessageTray.Source,
|
Extends: MessageTray.Source,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent('', 'media-removable');
|
this.parent('', 'media-removable');
|
||||||
|
|
||||||
this._notification = null;
|
this._notification = null;
|
||||||
Main.messageTray.add(this);
|
Main.messageTray.add(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function(message) {
|
show(message) {
|
||||||
let [header, text] = message.split('\n', 2);
|
let [header, text] = message.split('\n', 2);
|
||||||
|
|
||||||
if (!this._notification) {
|
if (!this._notification) {
|
||||||
@ -262,7 +262,7 @@ var ShellUnmountNotifier = new Lang.Class({
|
|||||||
this.notify(this._notification);
|
this.notify(this._notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
done: function(message) {
|
done(message) {
|
||||||
if (this._notification) {
|
if (this._notification) {
|
||||||
this._notification.destroy();
|
this._notification.destroy();
|
||||||
this._notification = null;
|
this._notification = null;
|
||||||
@ -281,14 +281,14 @@ var ShellMountQuestionDialog = new Lang.Class({
|
|||||||
Name: 'ShellMountQuestionDialog',
|
Name: 'ShellMountQuestionDialog',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function(icon) {
|
_init(icon) {
|
||||||
this.parent({ styleClass: 'mount-dialog' });
|
this.parent({ styleClass: 'mount-dialog' });
|
||||||
|
|
||||||
this._content = new Dialog.MessageDialogContent({ icon });
|
this._content = new Dialog.MessageDialogContent({ icon });
|
||||||
this.contentLayout.add(this._content, { x_fill: true, y_fill: false });
|
this.contentLayout.add(this._content, { x_fill: true, y_fill: false });
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function(message, choices) {
|
update(message, choices) {
|
||||||
_setLabelsForMessage(this._content, message);
|
_setLabelsForMessage(this._content, message);
|
||||||
_setButtonsForChoices(this, choices);
|
_setButtonsForChoices(this, choices);
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ var ShellMountPasswordDialog = new Lang.Class({
|
|||||||
Name: 'ShellMountPasswordDialog',
|
Name: 'ShellMountPasswordDialog',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function(message, icon, flags) {
|
_init(message, icon, flags) {
|
||||||
let strings = message.split('\n');
|
let strings = message.split('\n');
|
||||||
let title = strings.shift() || null;
|
let title = strings.shift() || null;
|
||||||
let body = strings.shift() || null;
|
let body = strings.shift() || null;
|
||||||
@ -353,20 +353,20 @@ var ShellMountPasswordDialog = new Lang.Class({
|
|||||||
this.setButtons(buttons);
|
this.setButtons(buttons);
|
||||||
},
|
},
|
||||||
|
|
||||||
reaskPassword: function() {
|
reaskPassword() {
|
||||||
this._passwordEntry.set_text('');
|
this._passwordEntry.set_text('');
|
||||||
this._errorMessageLabel.show();
|
this._errorMessageLabel.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCancelButton: function() {
|
_onCancelButton() {
|
||||||
this.emit('response', -1, '', false);
|
this.emit('response', -1, '', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onUnlockButton: function() {
|
_onUnlockButton() {
|
||||||
this._onEntryActivate();
|
this._onEntryActivate();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEntryActivate: function() {
|
_onEntryActivate() {
|
||||||
global.settings.set_boolean(REMEMBER_MOUNT_PASSWORD_KEY,
|
global.settings.set_boolean(REMEMBER_MOUNT_PASSWORD_KEY,
|
||||||
this._rememberChoice && this._rememberChoice.actor.checked);
|
this._rememberChoice && this._rememberChoice.actor.checked);
|
||||||
this.emit('response', 1,
|
this.emit('response', 1,
|
||||||
@ -380,7 +380,7 @@ var ShellProcessesDialog = new Lang.Class({
|
|||||||
Name: 'ShellProcessesDialog',
|
Name: 'ShellProcessesDialog',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function(icon) {
|
_init(icon) {
|
||||||
this.parent({ styleClass: 'mount-dialog' });
|
this.parent({ styleClass: 'mount-dialog' });
|
||||||
|
|
||||||
this._content = new Dialog.MessageDialogContent({ icon });
|
this._content = new Dialog.MessageDialogContent({ icon });
|
||||||
@ -410,7 +410,7 @@ var ShellProcessesDialog = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_setAppsForPids: function(pids) {
|
_setAppsForPids(pids) {
|
||||||
// remove all the items
|
// remove all the items
|
||||||
this._applicationList.destroy_all_children();
|
this._applicationList.destroy_all_children();
|
||||||
|
|
||||||
@ -432,7 +432,7 @@ var ShellProcessesDialog = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function(message, processes, choices) {
|
update(message, processes, choices) {
|
||||||
this._setAppsForPids(processes);
|
this._setAppsForPids(processes);
|
||||||
_setLabelsForMessage(this._content, message);
|
_setLabelsForMessage(this._content, message);
|
||||||
_setButtonsForChoices(this, choices);
|
_setButtonsForChoices(this, choices);
|
||||||
@ -483,7 +483,7 @@ var ShellMountOperationType = {
|
|||||||
var GnomeShellMountOpHandler = new Lang.Class({
|
var GnomeShellMountOpHandler = new Lang.Class({
|
||||||
Name: 'GnomeShellMountOpHandler',
|
Name: 'GnomeShellMountOpHandler',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellMountOpIface, this);
|
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellMountOpIface, this);
|
||||||
this._dbusImpl.export(Gio.DBus.session, '/org/gtk/MountOperationHandler');
|
this._dbusImpl.export(Gio.DBus.session, '/org/gtk/MountOperationHandler');
|
||||||
Gio.bus_own_name_on_connection(Gio.DBus.session, 'org.gtk.MountOperationHandler',
|
Gio.bus_own_name_on_connection(Gio.DBus.session, 'org.gtk.MountOperationHandler',
|
||||||
@ -495,13 +495,13 @@ var GnomeShellMountOpHandler = new Lang.Class({
|
|||||||
this._ensureEmptyRequest();
|
this._ensureEmptyRequest();
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureEmptyRequest: function() {
|
_ensureEmptyRequest() {
|
||||||
this._currentId = null;
|
this._currentId = null;
|
||||||
this._currentInvocation = null;
|
this._currentInvocation = null;
|
||||||
this._currentType = ShellMountOperationType.NONE;
|
this._currentType = ShellMountOperationType.NONE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearCurrentRequest: function(response, details) {
|
_clearCurrentRequest(response, details) {
|
||||||
if (this._currentInvocation) {
|
if (this._currentInvocation) {
|
||||||
this._currentInvocation.return_value(
|
this._currentInvocation.return_value(
|
||||||
GLib.Variant.new('(ua{sv})', [response, details]));
|
GLib.Variant.new('(ua{sv})', [response, details]));
|
||||||
@ -510,7 +510,7 @@ var GnomeShellMountOpHandler = new Lang.Class({
|
|||||||
this._ensureEmptyRequest();
|
this._ensureEmptyRequest();
|
||||||
},
|
},
|
||||||
|
|
||||||
_setCurrentRequest: function(invocation, id, type) {
|
_setCurrentRequest(invocation, id, type) {
|
||||||
let oldId = this._currentId;
|
let oldId = this._currentId;
|
||||||
let oldType = this._currentType;
|
let oldType = this._currentType;
|
||||||
let requestId = id + '@' + invocation.get_sender();
|
let requestId = id + '@' + invocation.get_sender();
|
||||||
@ -527,14 +527,14 @@ var GnomeShellMountOpHandler = new Lang.Class({
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_closeDialog: function() {
|
_closeDialog() {
|
||||||
if (this._dialog) {
|
if (this._dialog) {
|
||||||
this._dialog.close();
|
this._dialog.close();
|
||||||
this._dialog = null;
|
this._dialog = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_createGIcon: function(iconName) {
|
_createGIcon(iconName) {
|
||||||
let realIconName = iconName ? iconName : 'drive-harddisk';
|
let realIconName = iconName ? iconName : 'drive-harddisk';
|
||||||
return new Gio.ThemedIcon({ name: realIconName,
|
return new Gio.ThemedIcon({ name: realIconName,
|
||||||
use_default_fallbacks: true });
|
use_default_fallbacks: true });
|
||||||
@ -561,7 +561,7 @@ var GnomeShellMountOpHandler = new Lang.Class({
|
|||||||
* the existing dialog and update it with a message indicating the previous
|
* the existing dialog and update it with a message indicating the previous
|
||||||
* attempt went wrong.
|
* attempt went wrong.
|
||||||
*/
|
*/
|
||||||
AskPasswordAsync: function(params, invocation) {
|
AskPasswordAsync(params, invocation) {
|
||||||
let [id, message, iconName, defaultUser, defaultDomain, flags] = params;
|
let [id, message, iconName, defaultUser, defaultDomain, flags] = params;
|
||||||
|
|
||||||
if (this._setCurrentRequest(invocation, id, ShellMountOperationType.ASK_PASSWORD)) {
|
if (this._setCurrentRequest(invocation, id, ShellMountOperationType.ASK_PASSWORD)) {
|
||||||
@ -610,7 +610,7 @@ var GnomeShellMountOpHandler = new Lang.Class({
|
|||||||
* Calling AskQuestion again for the same id will have the effect to clear
|
* Calling AskQuestion again for the same id will have the effect to clear
|
||||||
* update the dialog with the new question.
|
* update the dialog with the new question.
|
||||||
*/
|
*/
|
||||||
AskQuestionAsync: function(params, invocation) {
|
AskQuestionAsync(params, invocation) {
|
||||||
let [id, message, iconName, choices] = params;
|
let [id, message, iconName, choices] = params;
|
||||||
|
|
||||||
if (this._setCurrentRequest(invocation, id, ShellMountOperationType.ASK_QUESTION)) {
|
if (this._setCurrentRequest(invocation, id, ShellMountOperationType.ASK_QUESTION)) {
|
||||||
@ -650,7 +650,7 @@ var GnomeShellMountOpHandler = new Lang.Class({
|
|||||||
* the existing dialog and update it with the new message and the new list
|
* the existing dialog and update it with the new message and the new list
|
||||||
* of processes.
|
* of processes.
|
||||||
*/
|
*/
|
||||||
ShowProcessesAsync: function(params, invocation) {
|
ShowProcessesAsync(params, invocation) {
|
||||||
let [id, message, iconName, applicationPids, choices] = params;
|
let [id, message, iconName, applicationPids, choices] = params;
|
||||||
|
|
||||||
if (this._setCurrentRequest(invocation, id, ShellMountOperationType.SHOW_PROCESSES)) {
|
if (this._setCurrentRequest(invocation, id, ShellMountOperationType.SHOW_PROCESSES)) {
|
||||||
@ -686,7 +686,7 @@ var GnomeShellMountOpHandler = new Lang.Class({
|
|||||||
* Closes a dialog previously opened by AskPassword, AskQuestion or ShowProcesses.
|
* Closes a dialog previously opened by AskPassword, AskQuestion or ShowProcesses.
|
||||||
* If no dialog is open, does nothing.
|
* If no dialog is open, does nothing.
|
||||||
*/
|
*/
|
||||||
Close: function(params, invocation) {
|
Close(params, invocation) {
|
||||||
this._clearCurrentRequest(Gio.MountOperationResult.UNHANDLED, {});
|
this._clearCurrentRequest(Gio.MountOperationResult.UNHANDLED, {});
|
||||||
this._closeDialog();
|
this._closeDialog();
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ var SLIDER_SCROLL_STEP = 0.02; /* Slider scrolling step in % */
|
|||||||
var Slider = new Lang.Class({
|
var Slider = new Lang.Class({
|
||||||
Name: "Slider",
|
Name: "Slider",
|
||||||
|
|
||||||
_init: function(value) {
|
_init(value) {
|
||||||
if (isNaN(value))
|
if (isNaN(value))
|
||||||
// Avoid spreading NaNs around
|
// Avoid spreading NaNs around
|
||||||
throw TypeError('The slider value must be a number');
|
throw TypeError('The slider value must be a number');
|
||||||
@ -47,7 +47,7 @@ var Slider = new Lang.Class({
|
|||||||
this.connect('value-changed', Lang.bind(this, this._valueChanged));
|
this.connect('value-changed', Lang.bind(this, this._valueChanged));
|
||||||
},
|
},
|
||||||
|
|
||||||
setValue: function(value) {
|
setValue(value) {
|
||||||
if (isNaN(value))
|
if (isNaN(value))
|
||||||
throw TypeError('The slider value must be a number');
|
throw TypeError('The slider value must be a number');
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ var Slider = new Lang.Class({
|
|||||||
this.actor.queue_repaint();
|
this.actor.queue_repaint();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sliderRepaint: function(area) {
|
_sliderRepaint(area) {
|
||||||
let cr = area.get_context();
|
let cr = area.get_context();
|
||||||
let themeNode = area.get_theme_node();
|
let themeNode = area.get_theme_node();
|
||||||
let [width, height] = area.get_surface_size();
|
let [width, height] = area.get_surface_size();
|
||||||
@ -115,11 +115,11 @@ var Slider = new Lang.Class({
|
|||||||
cr.$dispose();
|
cr.$dispose();
|
||||||
},
|
},
|
||||||
|
|
||||||
_startDragging: function(actor, event) {
|
_startDragging(actor, event) {
|
||||||
return this.startDragging(event);
|
return this.startDragging(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
startDragging: function(event) {
|
startDragging(event) {
|
||||||
if (this._dragging)
|
if (this._dragging)
|
||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ var Slider = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_endDragging: function() {
|
_endDragging() {
|
||||||
if (this._dragging) {
|
if (this._dragging) {
|
||||||
if (this._releaseId)
|
if (this._releaseId)
|
||||||
this.actor.disconnect(this._releaseId);
|
this.actor.disconnect(this._releaseId);
|
||||||
@ -172,7 +172,7 @@ var Slider = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_touchDragging: function(actor, event) {
|
_touchDragging(actor, event) {
|
||||||
let device = event.get_device();
|
let device = event.get_device();
|
||||||
let sequence = event.get_event_sequence();
|
let sequence = event.get_event_sequence();
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ var Slider = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
scroll: function(event) {
|
scroll(event) {
|
||||||
let direction = event.get_scroll_direction();
|
let direction = event.get_scroll_direction();
|
||||||
let delta;
|
let delta;
|
||||||
|
|
||||||
@ -215,18 +215,18 @@ var Slider = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onScrollEvent: function(actor, event) {
|
_onScrollEvent(actor, event) {
|
||||||
return this.scroll(event);
|
return this.scroll(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
_motionEvent: function(actor, event) {
|
_motionEvent(actor, event) {
|
||||||
let absX, absY;
|
let absX, absY;
|
||||||
[absX, absY] = event.get_coords();
|
[absX, absY] = event.get_coords();
|
||||||
this._moveHandle(absX, absY);
|
this._moveHandle(absX, absY);
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
onKeyPressEvent: function (actor, event) {
|
onKeyPressEvent(actor, event) {
|
||||||
let key = event.get_key_symbol();
|
let key = event.get_key_symbol();
|
||||||
if (key == Clutter.KEY_Right || key == Clutter.KEY_Left) {
|
if (key == Clutter.KEY_Right || key == Clutter.KEY_Left) {
|
||||||
let delta = key == Clutter.KEY_Right ? 0.1 : -0.1;
|
let delta = key == Clutter.KEY_Right ? 0.1 : -0.1;
|
||||||
@ -240,7 +240,7 @@ var Slider = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_moveHandle: function(absX, absY) {
|
_moveHandle(absX, absY) {
|
||||||
let relX, relY, sliderX, sliderY;
|
let relX, relY, sliderX, sliderY;
|
||||||
[sliderX, sliderY] = this.actor.get_transformed_position();
|
[sliderX, sliderY] = this.actor.get_transformed_position();
|
||||||
relX = absX - sliderX;
|
relX = absX - sliderX;
|
||||||
@ -261,27 +261,27 @@ var Slider = new Lang.Class({
|
|||||||
this.emit('value-changed', this._value);
|
this.emit('value-changed', this._value);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getCurrentValue: function (actor) {
|
_getCurrentValue(actor) {
|
||||||
return this._value;
|
return this._value;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMinimumValue: function (actor) {
|
_getMinimumValue(actor) {
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMaximumValue: function (actor) {
|
_getMaximumValue(actor) {
|
||||||
return 1;
|
return 1;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMinimumIncrement: function (actor) {
|
_getMinimumIncrement(actor) {
|
||||||
return 0.1;
|
return 0.1;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setCurrentValue: function (actor, value) {
|
_setCurrentValue(actor, value) {
|
||||||
this._value = value;
|
this._value = value;
|
||||||
},
|
},
|
||||||
|
|
||||||
_valueChanged: function (slider, value, property) {
|
_valueChanged(slider, value, property) {
|
||||||
this._customAccessible.notify ("accessible-value");
|
this._customAccessible.notify ("accessible-value");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ var ATIndicator = new Lang.Class({
|
|||||||
Name: 'ATIndicator',
|
Name: 'ATIndicator',
|
||||||
Extends: PanelMenu.Button,
|
Extends: PanelMenu.Button,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent(0.0, _("Accessibility"));
|
this.parent(0.0, _("Accessibility"));
|
||||||
|
|
||||||
this._hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' });
|
this._hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' });
|
||||||
@ -87,7 +87,7 @@ var ATIndicator = new Lang.Class({
|
|||||||
this._syncMenuVisibility();
|
this._syncMenuVisibility();
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncMenuVisibility: function() {
|
_syncMenuVisibility() {
|
||||||
this._syncMenuVisibilityIdle = 0;
|
this._syncMenuVisibilityIdle = 0;
|
||||||
|
|
||||||
let alwaysShow = this._a11ySettings.get_boolean(KEY_ALWAYS_SHOW);
|
let alwaysShow = this._a11ySettings.get_boolean(KEY_ALWAYS_SHOW);
|
||||||
@ -98,7 +98,7 @@ var ATIndicator = new Lang.Class({
|
|||||||
return GLib.SOURCE_REMOVE;
|
return GLib.SOURCE_REMOVE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_queueSyncMenuVisibility: function() {
|
_queueSyncMenuVisibility() {
|
||||||
if (this._syncMenuVisibilityIdle)
|
if (this._syncMenuVisibilityIdle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ var ATIndicator = new Lang.Class({
|
|||||||
GLib.Source.set_name_by_id(this._syncMenuVisibilityIdle, '[gnome-shell] this._syncMenuVisibility');
|
GLib.Source.set_name_by_id(this._syncMenuVisibilityIdle, '[gnome-shell] this._syncMenuVisibility');
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildItemExtended: function(string, initial_value, writable, on_set) {
|
_buildItemExtended(string, initial_value, writable, on_set) {
|
||||||
let widget = new PopupMenu.PopupSwitchMenuItem(string, initial_value);
|
let widget = new PopupMenu.PopupSwitchMenuItem(string, initial_value);
|
||||||
if (!writable)
|
if (!writable)
|
||||||
widget.actor.reactive = false;
|
widget.actor.reactive = false;
|
||||||
@ -117,7 +117,7 @@ var ATIndicator = new Lang.Class({
|
|||||||
return widget;
|
return widget;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildItem: function(string, schema, key) {
|
_buildItem(string, schema, key) {
|
||||||
let settings = new Gio.Settings({ schema_id: schema });
|
let settings = new Gio.Settings({ schema_id: schema });
|
||||||
settings.connect('changed::'+key, Lang.bind(this, function() {
|
settings.connect('changed::'+key, Lang.bind(this, function() {
|
||||||
widget.setToggleState(settings.get_boolean(key));
|
widget.setToggleState(settings.get_boolean(key));
|
||||||
@ -134,7 +134,7 @@ var ATIndicator = new Lang.Class({
|
|||||||
return widget;
|
return widget;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildHCItem: function() {
|
_buildHCItem() {
|
||||||
let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
|
let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
|
||||||
let wmSettings = new Gio.Settings({ schema_id: WM_SCHEMA });
|
let wmSettings = new Gio.Settings({ schema_id: WM_SCHEMA });
|
||||||
interfaceSettings.connect('changed::' + KEY_GTK_THEME, Lang.bind(this, function() {
|
interfaceSettings.connect('changed::' + KEY_GTK_THEME, Lang.bind(this, function() {
|
||||||
@ -187,7 +187,7 @@ var ATIndicator = new Lang.Class({
|
|||||||
return highContrast;
|
return highContrast;
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildFontItem: function() {
|
_buildFontItem() {
|
||||||
let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
|
let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
|
||||||
settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, Lang.bind(this, function() {
|
settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, Lang.bind(this, function() {
|
||||||
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
|
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
|
||||||
|
@ -27,7 +27,7 @@ var Indicator = new Lang.Class({
|
|||||||
Name: 'BTIndicator',
|
Name: 'BTIndicator',
|
||||||
Extends: PanelMenu.SystemIndicator,
|
Extends: PanelMenu.SystemIndicator,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._indicator = this._addIndicator();
|
this._indicator = this._addIndicator();
|
||||||
@ -66,7 +66,7 @@ var Indicator = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getDefaultAdapter: function() {
|
_getDefaultAdapter() {
|
||||||
let [ret, iter] = this._model.get_iter_first();
|
let [ret, iter] = this._model.get_iter_first();
|
||||||
while (ret) {
|
while (ret) {
|
||||||
let isDefault = this._model.get_value(iter,
|
let isDefault = this._model.get_value(iter,
|
||||||
@ -87,7 +87,7 @@ var Indicator = new Lang.Class({
|
|||||||
//
|
//
|
||||||
// nConnectedDevices is the number of devices connected to the default
|
// nConnectedDevices is the number of devices connected to the default
|
||||||
// adapter if one exists and is powered, or -1 if it's not available.
|
// adapter if one exists and is powered, or -1 if it's not available.
|
||||||
_getNDevices: function() {
|
_getNDevices() {
|
||||||
let adapter = this._getDefaultAdapter();
|
let adapter = this._getDefaultAdapter();
|
||||||
if (!adapter)
|
if (!adapter)
|
||||||
return [ this._hadSetupDevices ? 1 : -1, -1 ];
|
return [ this._hadSetupDevices ? 1 : -1, -1 ];
|
||||||
@ -118,7 +118,7 @@ var Indicator = new Lang.Class({
|
|||||||
return [ nDevices, nConnectedDevices];
|
return [ nDevices, nConnectedDevices];
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let [ nDevices, nConnectedDevices ] = this._getNDevices();
|
let [ nDevices, nConnectedDevices ] = this._getNDevices();
|
||||||
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ var Indicator = new Lang.Class({
|
|||||||
Name: 'BrightnessIndicator',
|
Name: 'BrightnessIndicator',
|
||||||
Extends: PanelMenu.SystemIndicator,
|
Extends: PanelMenu.SystemIndicator,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent('display-brightness-symbolic');
|
this.parent('display-brightness-symbolic');
|
||||||
this._proxy = new BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
|
this._proxy = new BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
|
||||||
Lang.bind(this, function(proxy, error) {
|
Lang.bind(this, function(proxy, error) {
|
||||||
@ -56,12 +56,12 @@ var Indicator = new Lang.Class({
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_sliderChanged: function(slider, value) {
|
_sliderChanged(slider, value) {
|
||||||
let percent = value * 100;
|
let percent = value * 100;
|
||||||
this._proxy.Brightness = percent;
|
this._proxy.Brightness = percent;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let visible = this._proxy.Brightness >= 0;
|
let visible = this._proxy.Brightness >= 0;
|
||||||
this._item.actor.visible = visible;
|
this._item.actor.visible = visible;
|
||||||
if (visible)
|
if (visible)
|
||||||
|
@ -26,7 +26,7 @@ var LayoutMenuItem = new Lang.Class({
|
|||||||
Name: 'LayoutMenuItem',
|
Name: 'LayoutMenuItem',
|
||||||
Extends: PopupMenu.PopupBaseMenuItem,
|
Extends: PopupMenu.PopupBaseMenuItem,
|
||||||
|
|
||||||
_init: function(displayName, shortName) {
|
_init(displayName, shortName) {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this.label = new St.Label({ text: displayName });
|
this.label = new St.Label({ text: displayName });
|
||||||
@ -40,7 +40,7 @@ var LayoutMenuItem = new Lang.Class({
|
|||||||
var InputSource = new Lang.Class({
|
var InputSource = new Lang.Class({
|
||||||
Name: 'InputSource',
|
Name: 'InputSource',
|
||||||
|
|
||||||
_init: function(type, id, displayName, shortName, index) {
|
_init(type, id, displayName, shortName, index) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
@ -61,11 +61,11 @@ var InputSource = new Lang.Class({
|
|||||||
this.emit('changed');
|
this.emit('changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
activate: function(interactive) {
|
activate(interactive) {
|
||||||
this.emit('activate', !!interactive);
|
this.emit('activate', !!interactive);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getXkbId: function() {
|
_getXkbId() {
|
||||||
let engineDesc = IBusManager.getIBusManager().getEngineDesc(this.id);
|
let engineDesc = IBusManager.getIBusManager().getEngineDesc(this.id);
|
||||||
if (!engineDesc)
|
if (!engineDesc)
|
||||||
return this.id;
|
return this.id;
|
||||||
@ -82,7 +82,7 @@ var InputSourcePopup = new Lang.Class({
|
|||||||
Name: 'InputSourcePopup',
|
Name: 'InputSourcePopup',
|
||||||
Extends: SwitcherPopup.SwitcherPopup,
|
Extends: SwitcherPopup.SwitcherPopup,
|
||||||
|
|
||||||
_init: function(items, action, actionBackward) {
|
_init(items, action, actionBackward) {
|
||||||
this.parent(items);
|
this.parent(items);
|
||||||
|
|
||||||
this._action = action;
|
this._action = action;
|
||||||
@ -91,7 +91,7 @@ var InputSourcePopup = new Lang.Class({
|
|||||||
this._switcherList = new InputSourceSwitcher(this._items);
|
this._switcherList = new InputSourceSwitcher(this._items);
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyPressHandler: function(keysym, action) {
|
_keyPressHandler(keysym, action) {
|
||||||
if (action == this._action)
|
if (action == this._action)
|
||||||
this._select(this._next());
|
this._select(this._next());
|
||||||
else if (action == this._actionBackward)
|
else if (action == this._actionBackward)
|
||||||
@ -106,7 +106,7 @@ var InputSourcePopup = new Lang.Class({
|
|||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
},
|
},
|
||||||
|
|
||||||
_finish : function() {
|
_finish() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._items[this._selectedIndex].activate(true);
|
this._items[this._selectedIndex].activate(true);
|
||||||
@ -117,14 +117,14 @@ var InputSourceSwitcher = new Lang.Class({
|
|||||||
Name: 'InputSourceSwitcher',
|
Name: 'InputSourceSwitcher',
|
||||||
Extends: SwitcherPopup.SwitcherList,
|
Extends: SwitcherPopup.SwitcherList,
|
||||||
|
|
||||||
_init: function(items) {
|
_init(items) {
|
||||||
this.parent(true);
|
this.parent(true);
|
||||||
|
|
||||||
for (let i = 0; i < items.length; i++)
|
for (let i = 0; i < items.length; i++)
|
||||||
this._addIcon(items[i]);
|
this._addIcon(items[i]);
|
||||||
},
|
},
|
||||||
|
|
||||||
_addIcon: function(item) {
|
_addIcon(item) {
|
||||||
let box = new St.BoxLayout({ vertical: true });
|
let box = new St.BoxLayout({ vertical: true });
|
||||||
|
|
||||||
let bin = new St.Bin({ style_class: 'input-source-switcher-symbol' });
|
let bin = new St.Bin({ style_class: 'input-source-switcher-symbol' });
|
||||||
@ -143,15 +143,15 @@ var InputSourceSettings = new Lang.Class({
|
|||||||
Name: 'InputSourceSettings',
|
Name: 'InputSourceSettings',
|
||||||
Abstract: true,
|
Abstract: true,
|
||||||
|
|
||||||
_emitInputSourcesChanged: function() {
|
_emitInputSourcesChanged() {
|
||||||
this.emit('input-sources-changed');
|
this.emit('input-sources-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_emitKeyboardOptionsChanged: function() {
|
_emitKeyboardOptionsChanged() {
|
||||||
this.emit('keyboard-options-changed');
|
this.emit('keyboard-options-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
_emitPerWindowChanged: function() {
|
_emitPerWindowChanged() {
|
||||||
this.emit('per-window-changed');
|
this.emit('per-window-changed');
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ var InputSourceSystemSettings = new Lang.Class({
|
|||||||
_BUS_IFACE: 'org.freedesktop.locale1',
|
_BUS_IFACE: 'org.freedesktop.locale1',
|
||||||
_BUS_PROPS_IFACE: 'org.freedesktop.DBus.Properties',
|
_BUS_PROPS_IFACE: 'org.freedesktop.DBus.Properties',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._layouts = '';
|
this._layouts = '';
|
||||||
this._variants = '';
|
this._variants = '';
|
||||||
this._options = '';
|
this._options = '';
|
||||||
@ -202,7 +202,7 @@ var InputSourceSystemSettings = new Lang.Class({
|
|||||||
Lang.bind(this, this._reload));
|
Lang.bind(this, this._reload));
|
||||||
},
|
},
|
||||||
|
|
||||||
_reload: function() {
|
_reload() {
|
||||||
Gio.DBus.system.call(this._BUS_NAME,
|
Gio.DBus.system.call(this._BUS_NAME,
|
||||||
this._BUS_PATH,
|
this._BUS_PATH,
|
||||||
this._BUS_PROPS_IFACE,
|
this._BUS_PROPS_IFACE,
|
||||||
@ -263,14 +263,14 @@ var InputSourceSessionSettings = new Lang.Class({
|
|||||||
_KEY_KEYBOARD_OPTIONS: 'xkb-options',
|
_KEY_KEYBOARD_OPTIONS: 'xkb-options',
|
||||||
_KEY_PER_WINDOW: 'per-window',
|
_KEY_PER_WINDOW: 'per-window',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._settings = new Gio.Settings({ schema_id: this._DESKTOP_INPUT_SOURCES_SCHEMA });
|
this._settings = new Gio.Settings({ schema_id: this._DESKTOP_INPUT_SOURCES_SCHEMA });
|
||||||
this._settings.connect('changed::' + this._KEY_INPUT_SOURCES, Lang.bind(this, this._emitInputSourcesChanged));
|
this._settings.connect('changed::' + this._KEY_INPUT_SOURCES, Lang.bind(this, this._emitInputSourcesChanged));
|
||||||
this._settings.connect('changed::' + this._KEY_KEYBOARD_OPTIONS, Lang.bind(this, this._emitKeyboardOptionsChanged));
|
this._settings.connect('changed::' + this._KEY_KEYBOARD_OPTIONS, Lang.bind(this, this._emitKeyboardOptionsChanged));
|
||||||
this._settings.connect('changed::' + this._KEY_PER_WINDOW, Lang.bind(this, this._emitPerWindowChanged));
|
this._settings.connect('changed::' + this._KEY_PER_WINDOW, Lang.bind(this, this._emitPerWindowChanged));
|
||||||
},
|
},
|
||||||
|
|
||||||
_getSourcesList: function(key) {
|
_getSourcesList(key) {
|
||||||
let sourcesList = [];
|
let sourcesList = [];
|
||||||
let sources = this._settings.get_value(key);
|
let sources = this._settings.get_value(key);
|
||||||
let nSources = sources.n_children();
|
let nSources = sources.n_children();
|
||||||
@ -307,7 +307,7 @@ var InputSourceSessionSettings = new Lang.Class({
|
|||||||
var InputSourceManager = new Lang.Class({
|
var InputSourceManager = new Lang.Class({
|
||||||
Name: 'InputSourceManager',
|
Name: 'InputSourceManager',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
// All valid input sources currently in the gsettings
|
// All valid input sources currently in the gsettings
|
||||||
// KEY_INPUT_SOURCES list indexed by their index there
|
// KEY_INPUT_SOURCES list indexed by their index there
|
||||||
this._inputSources = {};
|
this._inputSources = {};
|
||||||
@ -362,12 +362,12 @@ var InputSourceManager = new Lang.Class({
|
|||||||
this._disableIBus = false;
|
this._disableIBus = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
reload: function() {
|
reload() {
|
||||||
this._keyboardManager.setKeyboardOptions(this._settings.keyboardOptions);
|
this._keyboardManager.setKeyboardOptions(this._settings.keyboardOptions);
|
||||||
this._inputSourcesChanged();
|
this._inputSourcesChanged();
|
||||||
},
|
},
|
||||||
|
|
||||||
_ibusReadyCallback: function(im, ready) {
|
_ibusReadyCallback(im, ready) {
|
||||||
if (this._ibusReady == ready)
|
if (this._ibusReady == ready)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -376,7 +376,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
this._inputSourcesChanged();
|
this._inputSourcesChanged();
|
||||||
},
|
},
|
||||||
|
|
||||||
_modifiersSwitcher: function() {
|
_modifiersSwitcher() {
|
||||||
let sourceIndexes = Object.keys(this._inputSources);
|
let sourceIndexes = Object.keys(this._inputSources);
|
||||||
if (sourceIndexes.length == 0) {
|
if (sourceIndexes.length == 0) {
|
||||||
KeyboardManager.releaseKeyboard();
|
KeyboardManager.releaseKeyboard();
|
||||||
@ -398,7 +398,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_switchInputSource: function(display, screen, window, binding) {
|
_switchInputSource(display, screen, window, binding) {
|
||||||
if (this._mruSources.length < 2)
|
if (this._mruSources.length < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -417,12 +417,12 @@ var InputSourceManager = new Lang.Class({
|
|||||||
popup.destroy();
|
popup.destroy();
|
||||||
},
|
},
|
||||||
|
|
||||||
_keyboardOptionsChanged: function() {
|
_keyboardOptionsChanged() {
|
||||||
this._keyboardManager.setKeyboardOptions(this._settings.keyboardOptions);
|
this._keyboardManager.setKeyboardOptions(this._settings.keyboardOptions);
|
||||||
this._keyboardManager.reapply();
|
this._keyboardManager.reapply();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateMruSettings: function() {
|
_updateMruSettings() {
|
||||||
// If IBus is not ready we don't have a full picture of all
|
// If IBus is not ready we don't have a full picture of all
|
||||||
// the available sources, so don't update the setting
|
// the available sources, so don't update the setting
|
||||||
if (!this._ibusReady)
|
if (!this._ibusReady)
|
||||||
@ -441,7 +441,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
this._settings.mruSources = sourcesList;
|
this._settings.mruSources = sourcesList;
|
||||||
},
|
},
|
||||||
|
|
||||||
_currentInputSourceChanged: function(newSource) {
|
_currentInputSourceChanged(newSource) {
|
||||||
let oldSource;
|
let oldSource;
|
||||||
[oldSource, this._currentSource] = [this._currentSource, newSource];
|
[oldSource, this._currentSource] = [this._currentSource, newSource];
|
||||||
|
|
||||||
@ -457,7 +457,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
this._changePerWindowSource();
|
this._changePerWindowSource();
|
||||||
},
|
},
|
||||||
|
|
||||||
activateInputSource: function(is, interactive) {
|
activateInputSource(is, interactive) {
|
||||||
KeyboardManager.holdKeyboard();
|
KeyboardManager.holdKeyboard();
|
||||||
this._keyboardManager.apply(is.xkbId);
|
this._keyboardManager.apply(is.xkbId);
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
this._updateMruSettings();
|
this._updateMruSettings();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateMruSources: function() {
|
_updateMruSources() {
|
||||||
let sourcesList = [];
|
let sourcesList = [];
|
||||||
for (let i in this._inputSources)
|
for (let i in this._inputSources)
|
||||||
sourcesList.push(this._inputSources[i]);
|
sourcesList.push(this._inputSources[i]);
|
||||||
@ -525,7 +525,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
this._mruSources = mruSources.concat(sourcesList);
|
this._mruSources = mruSources.concat(sourcesList);
|
||||||
},
|
},
|
||||||
|
|
||||||
_inputSourcesChanged: function() {
|
_inputSourcesChanged() {
|
||||||
let sources = this._settings.inputSources;
|
let sources = this._settings.inputSources;
|
||||||
let nSources = sources.length;
|
let nSources = sources.length;
|
||||||
|
|
||||||
@ -610,7 +610,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
this._ibusManager.preloadEngines(Object.keys(this._ibusSources));
|
this._ibusManager.preloadEngines(Object.keys(this._ibusSources));
|
||||||
},
|
},
|
||||||
|
|
||||||
_makeEngineShortName: function(engineDesc) {
|
_makeEngineShortName(engineDesc) {
|
||||||
let symbol = engineDesc.get_symbol();
|
let symbol = engineDesc.get_symbol();
|
||||||
if (symbol && symbol[0])
|
if (symbol && symbol[0])
|
||||||
return symbol;
|
return symbol;
|
||||||
@ -622,7 +622,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
return String.fromCharCode(0x2328); // keyboard glyph
|
return String.fromCharCode(0x2328); // keyboard glyph
|
||||||
},
|
},
|
||||||
|
|
||||||
_ibusPropertiesRegistered: function(im, engineName, props) {
|
_ibusPropertiesRegistered(im, engineName, props) {
|
||||||
let source = this._ibusSources[engineName];
|
let source = this._ibusSources[engineName];
|
||||||
if (!source)
|
if (!source)
|
||||||
return;
|
return;
|
||||||
@ -633,7 +633,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
this.emit('current-source-changed', null);
|
this.emit('current-source-changed', null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_ibusPropertyUpdated: function(im, engineName, prop) {
|
_ibusPropertyUpdated(im, engineName, prop) {
|
||||||
let source = this._ibusSources[engineName];
|
let source = this._ibusSources[engineName];
|
||||||
if (!source)
|
if (!source)
|
||||||
return;
|
return;
|
||||||
@ -643,7 +643,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
this.emit('current-source-changed', null);
|
this.emit('current-source-changed', null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSubProperty: function(props, prop) {
|
_updateSubProperty(props, prop) {
|
||||||
if (!props)
|
if (!props)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -660,7 +660,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_ibusSetContentType: function(im, purpose, hints) {
|
_ibusSetContentType(im, purpose, hints) {
|
||||||
if (purpose == IBus.InputPurpose.PASSWORD) {
|
if (purpose == IBus.InputPurpose.PASSWORD) {
|
||||||
if (Object.keys(this._inputSources).length == Object.keys(this._ibusSources).length)
|
if (Object.keys(this._inputSources).length == Object.keys(this._ibusSources).length)
|
||||||
return;
|
return;
|
||||||
@ -677,7 +677,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
this.reload();
|
this.reload();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getNewInputSource: function(current) {
|
_getNewInputSource(current) {
|
||||||
let sourceIndexes = Object.keys(this._inputSources);
|
let sourceIndexes = Object.keys(this._inputSources);
|
||||||
if (sourceIndexes.length == 0)
|
if (sourceIndexes.length == 0)
|
||||||
return null;
|
return null;
|
||||||
@ -694,14 +694,14 @@ var InputSourceManager = new Lang.Class({
|
|||||||
return this._inputSources[sourceIndexes[0]];
|
return this._inputSources[sourceIndexes[0]];
|
||||||
},
|
},
|
||||||
|
|
||||||
_getCurrentWindow: function() {
|
_getCurrentWindow() {
|
||||||
if (Main.overview.visible)
|
if (Main.overview.visible)
|
||||||
return Main.overview;
|
return Main.overview;
|
||||||
else
|
else
|
||||||
return global.display.focus_window;
|
return global.display.focus_window;
|
||||||
},
|
},
|
||||||
|
|
||||||
_setPerWindowInputSource: function() {
|
_setPerWindowInputSource() {
|
||||||
let window = this._getCurrentWindow();
|
let window = this._getCurrentWindow();
|
||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
@ -715,7 +715,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
window._currentSource.activate(false);
|
window._currentSource.activate(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
_sourcesPerWindowChanged: function() {
|
_sourcesPerWindowChanged() {
|
||||||
this._sourcesPerWindow = this._settings.perWindow;
|
this._sourcesPerWindow = this._settings.perWindow;
|
||||||
|
|
||||||
if (this._sourcesPerWindow && this._focusWindowNotifyId == 0) {
|
if (this._sourcesPerWindow && this._focusWindowNotifyId == 0) {
|
||||||
@ -745,7 +745,7 @@ var InputSourceManager = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_changePerWindowSource: function() {
|
_changePerWindowSource() {
|
||||||
if (!this._sourcesPerWindow)
|
if (!this._sourcesPerWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -779,7 +779,7 @@ var InputSourceIndicator = new Lang.Class({
|
|||||||
Name: 'InputSourceIndicator',
|
Name: 'InputSourceIndicator',
|
||||||
Extends: PanelMenu.Button,
|
Extends: PanelMenu.Button,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent(0.0, _("Keyboard"));
|
this.parent(0.0, _("Keyboard"));
|
||||||
|
|
||||||
this._menuItems = {};
|
this._menuItems = {};
|
||||||
@ -814,7 +814,7 @@ var InputSourceIndicator = new Lang.Class({
|
|||||||
this._inputSourceManager.reload();
|
this._inputSourceManager.reload();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
// re-using "allowSettings" for the keyboard layout is a bit shady,
|
// re-using "allowSettings" for the keyboard layout is a bit shady,
|
||||||
// but at least for now it is used as "allow popping up windows
|
// but at least for now it is used as "allow popping up windows
|
||||||
// from shell menus"; we can always add a separate sessionMode
|
// from shell menus"; we can always add a separate sessionMode
|
||||||
@ -822,7 +822,7 @@ var InputSourceIndicator = new Lang.Class({
|
|||||||
this._showLayoutItem.actor.visible = Main.sessionMode.allowSettings;
|
this._showLayoutItem.actor.visible = Main.sessionMode.allowSettings;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sourcesChanged: function() {
|
_sourcesChanged() {
|
||||||
for (let i in this._menuItems)
|
for (let i in this._menuItems)
|
||||||
this._menuItems[i].destroy();
|
this._menuItems[i].destroy();
|
||||||
for (let i in this._indicatorLabels)
|
for (let i in this._indicatorLabels)
|
||||||
@ -855,7 +855,7 @@ var InputSourceIndicator = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_currentSourceChanged: function(manager, oldSource) {
|
_currentSourceChanged(manager, oldSource) {
|
||||||
let nVisibleSources = Object.keys(this._inputSourceManager.inputSources).length;
|
let nVisibleSources = Object.keys(this._inputSourceManager.inputSources).length;
|
||||||
let newSource = this._inputSourceManager.currentSource;
|
let newSource = this._inputSourceManager.currentSource;
|
||||||
|
|
||||||
@ -884,7 +884,7 @@ var InputSourceIndicator = new Lang.Class({
|
|||||||
this._indicatorLabels[newSource.index].show();
|
this._indicatorLabels[newSource.index].show();
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildPropSection: function(properties) {
|
_buildPropSection(properties) {
|
||||||
this._propSeparator.actor.hide();
|
this._propSeparator.actor.hide();
|
||||||
this._propSection.actor.hide();
|
this._propSection.actor.hide();
|
||||||
this._propSection.removeAll();
|
this._propSection.removeAll();
|
||||||
@ -897,7 +897,7 @@ var InputSourceIndicator = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_buildPropSubMenu: function(menu, props) {
|
_buildPropSubMenu(menu, props) {
|
||||||
if (!props)
|
if (!props)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -999,7 +999,7 @@ var InputSourceIndicator = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_showLayout: function() {
|
_showLayout() {
|
||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
|
|
||||||
let source = this._inputSourceManager.currentSource;
|
let source = this._inputSourceManager.currentSource;
|
||||||
@ -1026,7 +1026,7 @@ var InputSourceIndicator = new Lang.Class({
|
|||||||
Util.spawn(['gkbd-keyboard-display', '-l', description]);
|
Util.spawn(['gkbd-keyboard-display', '-l', description]);
|
||||||
},
|
},
|
||||||
|
|
||||||
_containerGetPreferredWidth: function(container, for_height, alloc) {
|
_containerGetPreferredWidth(container, for_height, alloc) {
|
||||||
// Here, and in _containerGetPreferredHeight, we need to query
|
// Here, and in _containerGetPreferredHeight, we need to query
|
||||||
// for the height of all children, but we ignore the results
|
// for the height of all children, but we ignore the results
|
||||||
// for those we don't actually display.
|
// for those we don't actually display.
|
||||||
@ -1043,7 +1043,7 @@ var InputSourceIndicator = new Lang.Class({
|
|||||||
alloc.natural_size = max_natural_width;
|
alloc.natural_size = max_natural_width;
|
||||||
},
|
},
|
||||||
|
|
||||||
_containerGetPreferredHeight: function(container, for_width, alloc) {
|
_containerGetPreferredHeight(container, for_width, alloc) {
|
||||||
let max_min_height = 0, max_natural_height = 0;
|
let max_min_height = 0, max_natural_height = 0;
|
||||||
|
|
||||||
for (let i in this._inputSourceManager.inputSources) {
|
for (let i in this._inputSourceManager.inputSources) {
|
||||||
@ -1057,7 +1057,7 @@ var InputSourceIndicator = new Lang.Class({
|
|||||||
alloc.natural_size = max_natural_height;
|
alloc.natural_size = max_natural_height;
|
||||||
},
|
},
|
||||||
|
|
||||||
_containerAllocate: function(container, box, flags) {
|
_containerAllocate(container, box, flags) {
|
||||||
// translate box to (0, 0)
|
// translate box to (0, 0)
|
||||||
box.x2 -= box.x1;
|
box.x2 -= box.x1;
|
||||||
box.x1 = 0;
|
box.x1 = 0;
|
||||||
|
@ -68,7 +68,7 @@ var Indicator = new Lang.Class({
|
|||||||
Name: 'LocationIndicator',
|
Name: 'LocationIndicator',
|
||||||
Extends: PanelMenu.SystemIndicator,
|
Extends: PanelMenu.SystemIndicator,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._settings = new Gio.Settings({ schema_id: LOCATION_SCHEMA });
|
this._settings = new Gio.Settings({ schema_id: LOCATION_SCHEMA });
|
||||||
@ -108,7 +108,7 @@ var Indicator = new Lang.Class({
|
|||||||
return this._getMaxAccuracyLevel();
|
return this._getMaxAccuracyLevel();
|
||||||
},
|
},
|
||||||
|
|
||||||
AuthorizeAppAsync: function(params, invocation) {
|
AuthorizeAppAsync(params, invocation) {
|
||||||
let [desktopId, reqAccuracyLevel] = params;
|
let [desktopId, reqAccuracyLevel] = params;
|
||||||
|
|
||||||
let authorizer = new AppAuthorizer(desktopId,
|
let authorizer = new AppAuthorizer(desktopId,
|
||||||
@ -123,7 +123,7 @@ var Indicator = new Lang.Class({
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
_syncIndicator: function() {
|
_syncIndicator() {
|
||||||
if (this._managerProxy == null) {
|
if (this._managerProxy == null) {
|
||||||
this._indicator.visible = false;
|
this._indicator.visible = false;
|
||||||
this._item.actor.visible = false;
|
this._item.actor.visible = false;
|
||||||
@ -135,7 +135,7 @@ var Indicator = new Lang.Class({
|
|||||||
this._updateMenuLabels();
|
this._updateMenuLabels();
|
||||||
},
|
},
|
||||||
|
|
||||||
_connectToGeoclue: function() {
|
_connectToGeoclue() {
|
||||||
if (this._managerProxy != null || this._connecting)
|
if (this._managerProxy != null || this._connecting)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ var Indicator = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onManagerProxyReady: function(proxy, error) {
|
_onManagerProxyReady(proxy, error) {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
log(error.message);
|
log(error.message);
|
||||||
this._connecting = false;
|
this._connecting = false;
|
||||||
@ -163,7 +163,7 @@ var Indicator = new Lang.Class({
|
|||||||
this._managerProxy.AddAgentRemote('gnome-shell', Lang.bind(this, this._onAgentRegistered));
|
this._managerProxy.AddAgentRemote('gnome-shell', Lang.bind(this, this._onAgentRegistered));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onAgentRegistered: function(result, error) {
|
_onAgentRegistered(result, error) {
|
||||||
this._connecting = false;
|
this._connecting = false;
|
||||||
this._notifyMaxAccuracyLevel();
|
this._notifyMaxAccuracyLevel();
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ var Indicator = new Lang.Class({
|
|||||||
log(error.message);
|
log(error.message);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onGeoclueVanished: function() {
|
_onGeoclueVanished() {
|
||||||
if (this._propertiesChangedId) {
|
if (this._propertiesChangedId) {
|
||||||
this._managerProxy.disconnect(this._propertiesChangedId);
|
this._managerProxy.disconnect(this._propertiesChangedId);
|
||||||
this._propertiesChangedId = 0;
|
this._propertiesChangedId = 0;
|
||||||
@ -181,17 +181,17 @@ var Indicator = new Lang.Class({
|
|||||||
this._syncIndicator();
|
this._syncIndicator();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onOnOffAction: function() {
|
_onOnOffAction() {
|
||||||
let enabled = this._settings.get_boolean(ENABLED);
|
let enabled = this._settings.get_boolean(ENABLED);
|
||||||
this._settings.set_boolean(ENABLED, !enabled);
|
this._settings.set_boolean(ENABLED, !enabled);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSessionUpdated: function() {
|
_onSessionUpdated() {
|
||||||
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
||||||
this.menu.setSensitive(sensitive);
|
this.menu.setSensitive(sensitive);
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateMenuLabels: function() {
|
_updateMenuLabels() {
|
||||||
if (this._settings.get_boolean(ENABLED)) {
|
if (this._settings.get_boolean(ENABLED)) {
|
||||||
this._item.label.text = this._indicator.visible ? _("Location In Use")
|
this._item.label.text = this._indicator.visible ? _("Location In Use")
|
||||||
: _("Location Enabled");
|
: _("Location Enabled");
|
||||||
@ -202,7 +202,7 @@ var Indicator = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMaxAccuracyLevelChanged: function() {
|
_onMaxAccuracyLevelChanged() {
|
||||||
this._updateMenuLabels();
|
this._updateMenuLabels();
|
||||||
|
|
||||||
// Gotta ensure geoclue is up and we are registered as agent to it
|
// Gotta ensure geoclue is up and we are registered as agent to it
|
||||||
@ -211,7 +211,7 @@ var Indicator = new Lang.Class({
|
|||||||
this._notifyMaxAccuracyLevel();
|
this._notifyMaxAccuracyLevel();
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMaxAccuracyLevel: function() {
|
_getMaxAccuracyLevel() {
|
||||||
if (this._settings.get_boolean(ENABLED)) {
|
if (this._settings.get_boolean(ENABLED)) {
|
||||||
let level = this._settings.get_string(MAX_ACCURACY_LEVEL);
|
let level = this._settings.get_string(MAX_ACCURACY_LEVEL);
|
||||||
|
|
||||||
@ -222,23 +222,23 @@ var Indicator = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_notifyMaxAccuracyLevel: function() {
|
_notifyMaxAccuracyLevel() {
|
||||||
let variant = new GLib.Variant('u', this._getMaxAccuracyLevel());
|
let variant = new GLib.Variant('u', this._getMaxAccuracyLevel());
|
||||||
this._agent.emit_property_changed('MaxAccuracyLevel', variant);
|
this._agent.emit_property_changed('MaxAccuracyLevel', variant);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onGeocluePropsChanged: function(proxy, properties) {
|
_onGeocluePropsChanged(proxy, properties) {
|
||||||
let unpacked = properties.deep_unpack();
|
let unpacked = properties.deep_unpack();
|
||||||
if ("InUse" in unpacked)
|
if ("InUse" in unpacked)
|
||||||
this._syncIndicator();
|
this._syncIndicator();
|
||||||
},
|
},
|
||||||
|
|
||||||
_connectToPermissionStore: function() {
|
_connectToPermissionStore() {
|
||||||
this._permStoreProxy = null;
|
this._permStoreProxy = null;
|
||||||
new PermissionStore.PermissionStore(Lang.bind(this, this._onPermStoreProxyReady), null);
|
new PermissionStore.PermissionStore(Lang.bind(this, this._onPermStoreProxyReady), null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPermStoreProxyReady: function(proxy, error) {
|
_onPermStoreProxyReady(proxy, error) {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
log(error.message);
|
log(error.message);
|
||||||
return;
|
return;
|
||||||
@ -255,7 +255,7 @@ function clamp(value, min, max) {
|
|||||||
var AppAuthorizer = new Lang.Class({
|
var AppAuthorizer = new Lang.Class({
|
||||||
Name: 'LocationAppAuthorizer',
|
Name: 'LocationAppAuthorizer',
|
||||||
|
|
||||||
_init: function(desktopId,
|
_init(desktopId,
|
||||||
reqAccuracyLevel,
|
reqAccuracyLevel,
|
||||||
permStoreProxy,
|
permStoreProxy,
|
||||||
maxAccuracyLevel) {
|
maxAccuracyLevel) {
|
||||||
@ -268,7 +268,7 @@ var AppAuthorizer = new Lang.Class({
|
|||||||
this._accuracyLevel = GeoclueAccuracyLevel.NONE;
|
this._accuracyLevel = GeoclueAccuracyLevel.NONE;
|
||||||
},
|
},
|
||||||
|
|
||||||
authorize: function(onAuthDone) {
|
authorize(onAuthDone) {
|
||||||
this._onAuthDone = onAuthDone;
|
this._onAuthDone = onAuthDone;
|
||||||
|
|
||||||
let appSystem = Shell.AppSystem.get_default();
|
let appSystem = Shell.AppSystem.get_default();
|
||||||
@ -285,7 +285,7 @@ var AppAuthorizer = new Lang.Class({
|
|||||||
this._onPermLookupDone));
|
this._onPermLookupDone));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPermLookupDone: function(result, error) {
|
_onPermLookupDone(result, error) {
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
if (error.domain == Gio.DBusError) {
|
if (error.domain == Gio.DBusError) {
|
||||||
// Likely no xdg-app installed, just authorize the app
|
// Likely no xdg-app installed, just authorize the app
|
||||||
@ -318,7 +318,7 @@ var AppAuthorizer = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_userAuthorizeApp: function() {
|
_userAuthorizeApp() {
|
||||||
let name = this._app.get_name();
|
let name = this._app.get_name();
|
||||||
let appInfo = this._app.get_app_info();
|
let appInfo = this._app.get_app_info();
|
||||||
let reason = appInfo.get_locale_string("X-Geoclue-Reason");
|
let reason = appInfo.get_locale_string("X-Geoclue-Reason");
|
||||||
@ -326,7 +326,7 @@ var AppAuthorizer = new Lang.Class({
|
|||||||
this._showAppAuthDialog(name, reason);
|
this._showAppAuthDialog(name, reason);
|
||||||
},
|
},
|
||||||
|
|
||||||
_showAppAuthDialog: function(name, reason) {
|
_showAppAuthDialog(name, reason) {
|
||||||
this._dialog = new GeolocationDialog(name,
|
this._dialog = new GeolocationDialog(name,
|
||||||
reason,
|
reason,
|
||||||
this.reqAccuracyLevel);
|
this.reqAccuracyLevel);
|
||||||
@ -341,7 +341,7 @@ var AppAuthorizer = new Lang.Class({
|
|||||||
this._dialog.open();
|
this._dialog.open();
|
||||||
},
|
},
|
||||||
|
|
||||||
_completeAuth: function() {
|
_completeAuth() {
|
||||||
if (this._accuracyLevel != GeoclueAccuracyLevel.NONE) {
|
if (this._accuracyLevel != GeoclueAccuracyLevel.NONE) {
|
||||||
this._accuracyLevel = clamp(this._accuracyLevel,
|
this._accuracyLevel = clamp(this._accuracyLevel,
|
||||||
0,
|
0,
|
||||||
@ -352,7 +352,7 @@ var AppAuthorizer = new Lang.Class({
|
|||||||
this._onAuthDone(this._accuracyLevel);
|
this._onAuthDone(this._accuracyLevel);
|
||||||
},
|
},
|
||||||
|
|
||||||
_saveToPermissionStore: function() {
|
_saveToPermissionStore() {
|
||||||
if (this._permStoreProxy == null)
|
if (this._permStoreProxy == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -378,7 +378,7 @@ var GeolocationDialog = new Lang.Class({
|
|||||||
Name: 'GeolocationDialog',
|
Name: 'GeolocationDialog',
|
||||||
Extends: ModalDialog.ModalDialog,
|
Extends: ModalDialog.ModalDialog,
|
||||||
|
|
||||||
_init: function(name, subtitle, reqAccuracyLevel) {
|
_init(name, subtitle, reqAccuracyLevel) {
|
||||||
this.parent({ styleClass: 'geolocation-dialog' });
|
this.parent({ styleClass: 'geolocation-dialog' });
|
||||||
this.reqAccuracyLevel = reqAccuracyLevel;
|
this.reqAccuracyLevel = reqAccuracyLevel;
|
||||||
|
|
||||||
@ -401,12 +401,12 @@ var GeolocationDialog = new Lang.Class({
|
|||||||
this.setInitialKeyFocus(button);
|
this.setInitialKeyFocus(button);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onGrantClicked: function() {
|
_onGrantClicked() {
|
||||||
this.emit('response', this.reqAccuracyLevel);
|
this.emit('response', this.reqAccuracyLevel);
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDenyClicked: function() {
|
_onDenyClicked() {
|
||||||
this.emit('response', GeoclueAccuracyLevel.NONE);
|
this.emit('response', GeoclueAccuracyLevel.NONE);
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -23,7 +23,7 @@ var Indicator = new Lang.Class({
|
|||||||
Name: 'NightLightIndicator',
|
Name: 'NightLightIndicator',
|
||||||
Extends: PanelMenu.SystemIndicator,
|
Extends: PanelMenu.SystemIndicator,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._indicator = this._addIndicator();
|
this._indicator = this._addIndicator();
|
||||||
@ -56,12 +56,12 @@ var Indicator = new Lang.Class({
|
|||||||
this._sync();
|
this._sync();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
||||||
this.menu.setSensitive(sensitive);
|
this.menu.setSensitive(sensitive);
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let visible = this._proxy.NightLightActive;
|
let visible = this._proxy.NightLightActive;
|
||||||
let disabled = this._proxy.DisabledUntilTomorrow;
|
let disabled = this._proxy.DisabledUntilTomorrow;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ var Indicator = new Lang.Class({
|
|||||||
Name: 'PowerIndicator',
|
Name: 'PowerIndicator',
|
||||||
Extends: PanelMenu.SystemIndicator,
|
Extends: PanelMenu.SystemIndicator,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
|
this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
|
||||||
@ -65,12 +65,12 @@ var Indicator = new Lang.Class({
|
|||||||
this._sessionUpdated();
|
this._sessionUpdated();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
||||||
this.menu.setSensitive(sensitive);
|
this.menu.setSensitive(sensitive);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getStatus: function() {
|
_getStatus() {
|
||||||
let seconds = 0;
|
let seconds = 0;
|
||||||
|
|
||||||
if (this._proxy.State == UPower.DeviceState.FULLY_CHARGED)
|
if (this._proxy.State == UPower.DeviceState.FULLY_CHARGED)
|
||||||
@ -106,7 +106,7 @@ var Indicator = new Lang.Class({
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
// Do we have batteries or a UPS?
|
// Do we have batteries or a UPS?
|
||||||
let visible = this._proxy.IsPresent;
|
let visible = this._proxy.IsPresent;
|
||||||
if (visible) {
|
if (visible) {
|
||||||
|
@ -24,7 +24,7 @@ const RfkillManagerProxy = Gio.DBusProxy.makeProxyWrapper(RfkillManagerInterface
|
|||||||
var RfkillManager = new Lang.Class({
|
var RfkillManager = new Lang.Class({
|
||||||
Name: 'RfkillManager',
|
Name: 'RfkillManager',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
|
this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
|
||||||
Lang.bind(this, function(proxy, error) {
|
Lang.bind(this, function(proxy, error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -53,7 +53,7 @@ var RfkillManager = new Lang.Class({
|
|||||||
return this._proxy.ShouldShowAirplaneMode;
|
return this._proxy.ShouldShowAirplaneMode;
|
||||||
},
|
},
|
||||||
|
|
||||||
_changed: function() {
|
_changed() {
|
||||||
this.emit('airplane-mode-changed');
|
this.emit('airplane-mode-changed');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -72,7 +72,7 @@ var Indicator = new Lang.Class({
|
|||||||
Name: 'RfkillIndicator',
|
Name: 'RfkillIndicator',
|
||||||
Extends: PanelMenu.SystemIndicator,
|
Extends: PanelMenu.SystemIndicator,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._manager = getRfkillManager();
|
this._manager = getRfkillManager();
|
||||||
@ -97,12 +97,12 @@ var Indicator = new Lang.Class({
|
|||||||
this._sessionUpdated();
|
this._sessionUpdated();
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
||||||
this.menu.setSensitive(sensitive);
|
this.menu.setSensitive(sensitive);
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let airplaneMode = this._manager.airplaneMode;
|
let airplaneMode = this._manager.airplaneMode;
|
||||||
let hwAirplaneMode = this._manager.hwAirplaneMode;
|
let hwAirplaneMode = this._manager.hwAirplaneMode;
|
||||||
let showAirplaneMode = this._manager.shouldShowAirplaneMode;
|
let showAirplaneMode = this._manager.shouldShowAirplaneMode;
|
||||||
|
@ -9,7 +9,7 @@ var Indicator = new Lang.Class({
|
|||||||
Name: 'ScreencastIndicator',
|
Name: 'ScreencastIndicator',
|
||||||
Extends: PanelMenu.SystemIndicator,
|
Extends: PanelMenu.SystemIndicator,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._indicator = this._addIndicator();
|
this._indicator = this._addIndicator();
|
||||||
@ -20,7 +20,7 @@ var Indicator = new Lang.Class({
|
|||||||
Main.screencastService.connect('updated', Lang.bind(this, this._sync));
|
Main.screencastService.connect('updated', Lang.bind(this, this._sync));
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
this._indicator.visible = Main.screencastService.isRecording;
|
this._indicator.visible = Main.screencastService.isRecording;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@ const PopupMenu = imports.ui.popupMenu;
|
|||||||
var AltSwitcher = new Lang.Class({
|
var AltSwitcher = new Lang.Class({
|
||||||
Name: 'AltSwitcher',
|
Name: 'AltSwitcher',
|
||||||
|
|
||||||
_init: function(standard, alternate) {
|
_init(standard, alternate) {
|
||||||
this._standard = standard;
|
this._standard = standard;
|
||||||
this._standard.connect('notify::visible', Lang.bind(this, this._sync));
|
this._standard.connect('notify::visible', Lang.bind(this, this._sync));
|
||||||
if (this._standard instanceof St.Button)
|
if (this._standard instanceof St.Button)
|
||||||
@ -44,7 +44,7 @@ var AltSwitcher = new Lang.Class({
|
|||||||
this.actor.connect('notify::mapped', () => { this._flipped = false; });
|
this.actor.connect('notify::mapped', () => { this._flipped = false; });
|
||||||
},
|
},
|
||||||
|
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let childToShow = null;
|
let childToShow = null;
|
||||||
|
|
||||||
if (this._standard.visible && this._alternate.visible) {
|
if (this._standard.visible && this._alternate.visible) {
|
||||||
@ -82,14 +82,14 @@ var AltSwitcher = new Lang.Class({
|
|||||||
this.actor.visible = (childToShow != null);
|
this.actor.visible = (childToShow != null);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
if (this._capturedEventId > 0) {
|
if (this._capturedEventId > 0) {
|
||||||
global.stage.disconnect(this._capturedEventId);
|
global.stage.disconnect(this._capturedEventId);
|
||||||
this._capturedEventId = 0;
|
this._capturedEventId = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onCapturedEvent: function(actor, event) {
|
_onCapturedEvent(actor, event) {
|
||||||
let type = event.type();
|
let type = event.type();
|
||||||
if (type == Clutter.EventType.KEY_PRESS || type == Clutter.EventType.KEY_RELEASE) {
|
if (type == Clutter.EventType.KEY_PRESS || type == Clutter.EventType.KEY_RELEASE) {
|
||||||
let key = event.get_key_symbol();
|
let key = event.get_key_symbol();
|
||||||
@ -100,7 +100,7 @@ var AltSwitcher = new Lang.Class({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLongPress: function(action, actor, state) {
|
_onLongPress(action, actor, state) {
|
||||||
if (state == Clutter.LongPressState.QUERY ||
|
if (state == Clutter.LongPressState.QUERY ||
|
||||||
state == Clutter.LongPressState.CANCEL)
|
state == Clutter.LongPressState.CANCEL)
|
||||||
return true;
|
return true;
|
||||||
@ -115,7 +115,7 @@ var Indicator = new Lang.Class({
|
|||||||
Name: 'SystemIndicator',
|
Name: 'SystemIndicator',
|
||||||
Extends: PanelMenu.SystemIndicator,
|
Extends: PanelMenu.SystemIndicator,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
let userManager = AccountsService.UserManager.get_default();
|
let userManager = AccountsService.UserManager.get_default();
|
||||||
@ -146,7 +146,7 @@ var Indicator = new Lang.Class({
|
|||||||
this._sessionUpdated();
|
this._sessionUpdated();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateActionsVisibility: function() {
|
_updateActionsVisibility() {
|
||||||
let visible = (this._settingsAction.visible ||
|
let visible = (this._settingsAction.visible ||
|
||||||
this._orientationLockAction.visible ||
|
this._orientationLockAction.visible ||
|
||||||
this._lockScreenAction.visible ||
|
this._lockScreenAction.visible ||
|
||||||
@ -155,18 +155,18 @@ var Indicator = new Lang.Class({
|
|||||||
this._actionsItem.actor.visible = visible;
|
this._actionsItem.actor.visible = visible;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sessionUpdated: function() {
|
_sessionUpdated() {
|
||||||
this._settingsAction.visible = Main.sessionMode.allowSettings;
|
this._settingsAction.visible = Main.sessionMode.allowSettings;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateMultiUser: function() {
|
_updateMultiUser() {
|
||||||
let hasSwitchUser = this._loginScreenItem.actor.visible;
|
let hasSwitchUser = this._loginScreenItem.actor.visible;
|
||||||
let hasLogout = this._logoutItem.actor.visible;
|
let hasLogout = this._logoutItem.actor.visible;
|
||||||
|
|
||||||
this._switchUserSubMenu.actor.visible = hasSwitchUser || hasLogout;
|
this._switchUserSubMenu.actor.visible = hasSwitchUser || hasLogout;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSwitchUserSubMenu: function() {
|
_updateSwitchUserSubMenu() {
|
||||||
this._switchUserSubMenu.label.text = this._user.get_real_name();
|
this._switchUserSubMenu.label.text = this._user.get_real_name();
|
||||||
let clutterText = this._switchUserSubMenu.label.clutter_text;
|
let clutterText = this._switchUserSubMenu.label.clutter_text;
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ var Indicator = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_createActionButton: function(iconName, accessibleName) {
|
_createActionButton(iconName, accessibleName) {
|
||||||
let icon = new St.Button({ reactive: true,
|
let icon = new St.Button({ reactive: true,
|
||||||
can_focus: true,
|
can_focus: true,
|
||||||
track_hover: true,
|
track_hover: true,
|
||||||
@ -209,7 +209,7 @@ var Indicator = new Lang.Class({
|
|||||||
return icon;
|
return icon;
|
||||||
},
|
},
|
||||||
|
|
||||||
_createSubMenu: function() {
|
_createSubMenu() {
|
||||||
let bindFlags = GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE;
|
let bindFlags = GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE;
|
||||||
let item;
|
let item;
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ var Indicator = new Lang.Class({
|
|||||||
() => { this._updateActionsVisibility(); });
|
() => { this._updateActionsVisibility(); });
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSettingsClicked: function() {
|
_onSettingsClicked() {
|
||||||
this.menu.itemActivated();
|
this.menu.itemActivated();
|
||||||
let app = Shell.AppSystem.get_default().lookup_app('gnome-control-center.desktop');
|
let app = Shell.AppSystem.get_default().lookup_app('gnome-control-center.desktop');
|
||||||
Main.overview.hide();
|
Main.overview.hide();
|
||||||
|
@ -75,7 +75,7 @@ const BOLT_DBUS_PATH = '/org/freedesktop/bolt';
|
|||||||
var Client = new Lang.Class({
|
var Client = new Lang.Class({
|
||||||
Name: 'BoltClient',
|
Name: 'BoltClient',
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
|
|
||||||
this._proxy = null;
|
this._proxy = null;
|
||||||
new BoltClientProxy(
|
new BoltClientProxy(
|
||||||
@ -88,7 +88,7 @@ var Client = new Lang.Class({
|
|||||||
this.probing = false;
|
this.probing = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onProxyReady: function(proxy, error) {
|
_onProxyReady(proxy, error) {
|
||||||
if (error !== null) {
|
if (error !== null) {
|
||||||
log('error creating bolt proxy: %s'.format(error.message));
|
log('error creating bolt proxy: %s'.format(error.message));
|
||||||
return;
|
return;
|
||||||
@ -103,7 +103,7 @@ var Client = new Lang.Class({
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPropertiesChanged: function(proxy, properties) {
|
_onPropertiesChanged(proxy, properties) {
|
||||||
let unpacked = properties.deep_unpack();
|
let unpacked = properties.deep_unpack();
|
||||||
if (!('Probing' in unpacked))
|
if (!('Probing' in unpacked))
|
||||||
return;
|
return;
|
||||||
@ -112,7 +112,7 @@ var Client = new Lang.Class({
|
|||||||
this.emit('probing-changed', this.probing);
|
this.emit('probing-changed', this.probing);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDeviceAdded: function(proxy, emitter, params) {
|
_onDeviceAdded(proxy, emitter, params) {
|
||||||
let [path] = params;
|
let [path] = params;
|
||||||
let device = new BoltDeviceProxy(Gio.DBus.system,
|
let device = new BoltDeviceProxy(Gio.DBus.system,
|
||||||
BOLT_DBUS_NAME,
|
BOLT_DBUS_NAME,
|
||||||
@ -121,7 +121,7 @@ var Client = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
/* public methods */
|
/* public methods */
|
||||||
close: function() {
|
close() {
|
||||||
if (!this._proxy)
|
if (!this._proxy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ var Client = new Lang.Class({
|
|||||||
this._proxy = null;
|
this._proxy = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
enrollDevice: function(id, policy, callback) {
|
enrollDevice(id, policy, callback) {
|
||||||
this._proxy.EnrollDeviceRemote(id, policy, AuthFlags.NONE,
|
this._proxy.EnrollDeviceRemote(id, policy, AuthFlags.NONE,
|
||||||
Lang.bind(this, function (res, error) {
|
Lang.bind(this, function (res, error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -154,7 +154,7 @@ Signals.addSignalMethods(Client.prototype);
|
|||||||
var AuthRobot = new Lang.Class({
|
var AuthRobot = new Lang.Class({
|
||||||
Name: 'BoltAuthRobot',
|
Name: 'BoltAuthRobot',
|
||||||
|
|
||||||
_init: function(client) {
|
_init(client) {
|
||||||
|
|
||||||
this._client = client;
|
this._client = client;
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ var AuthRobot = new Lang.Class({
|
|||||||
this._client.connect('device-added', Lang.bind(this, this._onDeviceAdded));
|
this._client.connect('device-added', Lang.bind(this, this._onDeviceAdded));
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function() {
|
close() {
|
||||||
this.disconnectAll();
|
this.disconnectAll();
|
||||||
this._client = null;
|
this._client = null;
|
||||||
},
|
},
|
||||||
@ -173,7 +173,7 @@ var AuthRobot = new Lang.Class({
|
|||||||
* device that is not currently stored in the database. We are
|
* device that is not currently stored in the database. We are
|
||||||
* only interested in those devices, because all known devices
|
* only interested in those devices, because all known devices
|
||||||
* will be handled by the user himself */
|
* will be handled by the user himself */
|
||||||
_onDeviceAdded: function(cli, dev) {
|
_onDeviceAdded(cli, dev) {
|
||||||
if (dev.Status !== Status.CONNECTED)
|
if (dev.Status !== Status.CONNECTED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ var AuthRobot = new Lang.Class({
|
|||||||
* calling itself as long as there a devices to be
|
* calling itself as long as there a devices to be
|
||||||
* enrolled.
|
* enrolled.
|
||||||
*/
|
*/
|
||||||
_enrollDevices: function() {
|
_enrollDevices() {
|
||||||
if (this._enrolling)
|
if (this._enrolling)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ var AuthRobot = new Lang.Class({
|
|||||||
Lang.bind(this, this._enrollDevicesIdle));
|
Lang.bind(this, this._enrollDevicesIdle));
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEnrollDone: function(device, error) {
|
_onEnrollDone(device, error) {
|
||||||
if (error)
|
if (error)
|
||||||
this.emit('enroll-failed', error, device);
|
this.emit('enroll-failed', error, device);
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ var AuthRobot = new Lang.Class({
|
|||||||
Lang.bind(this, this._enrollDevicesIdle));
|
Lang.bind(this, this._enrollDevicesIdle));
|
||||||
},
|
},
|
||||||
|
|
||||||
_enrollDevicesIdle: function() {
|
_enrollDevicesIdle() {
|
||||||
let devices = this._devicesToEnroll;
|
let devices = this._devicesToEnroll;
|
||||||
|
|
||||||
let dev = devices.shift();
|
let dev = devices.shift();
|
||||||
@ -242,7 +242,7 @@ var Indicator = new Lang.Class({
|
|||||||
Name: 'ThunderboltIndicator',
|
Name: 'ThunderboltIndicator',
|
||||||
Extends: PanelMenu.SystemIndicator,
|
Extends: PanelMenu.SystemIndicator,
|
||||||
|
|
||||||
_init: function() {
|
_init() {
|
||||||
this.parent();
|
this.parent();
|
||||||
|
|
||||||
this._indicator = this._addIndicator();
|
this._indicator = this._addIndicator();
|
||||||
@ -262,12 +262,12 @@ var Indicator = new Lang.Class({
|
|||||||
this._source = null;
|
this._source = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onDestroy: function() {
|
_onDestroy() {
|
||||||
this._robot.close();
|
this._robot.close();
|
||||||
this._client.close();
|
this._client.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
_ensureSource: function() {
|
_ensureSource() {
|
||||||
if (!this._source) {
|
if (!this._source) {
|
||||||
this._source = new MessageTray.Source(_("Thunderbolt"),
|
this._source = new MessageTray.Source(_("Thunderbolt"),
|
||||||
'thunderbolt-symbolic');
|
'thunderbolt-symbolic');
|
||||||
@ -281,7 +281,7 @@ var Indicator = new Lang.Class({
|
|||||||
return this._source;
|
return this._source;
|
||||||
},
|
},
|
||||||
|
|
||||||
_notify: function(title, body) {
|
_notify(title, body) {
|
||||||
if (this._notification)
|
if (this._notification)
|
||||||
this._notification.destroy();
|
this._notification.destroy();
|
||||||
|
|
||||||
@ -301,14 +301,14 @@ var Indicator = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
/* Session callbacks */
|
/* Session callbacks */
|
||||||
_sync: function() {
|
_sync() {
|
||||||
let active = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
let active = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
||||||
this._indicator.visible = active && this._client.probing;
|
this._indicator.visible = active && this._client.probing;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/* Bolt.Client callbacks */
|
/* Bolt.Client callbacks */
|
||||||
_onProbing: function(cli, probing) {
|
_onProbing(cli, probing) {
|
||||||
if (probing)
|
if (probing)
|
||||||
this._indicator.icon_name = 'thunderbolt-acquiring-symbolic';
|
this._indicator.icon_name = 'thunderbolt-acquiring-symbolic';
|
||||||
else
|
else
|
||||||
@ -319,7 +319,7 @@ var Indicator = new Lang.Class({
|
|||||||
|
|
||||||
|
|
||||||
/* AuthRobot callbacks */
|
/* AuthRobot callbacks */
|
||||||
_onEnrollDevice: function(obj, device, policy) {
|
_onEnrollDevice(obj, device, policy) {
|
||||||
let auth = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
let auth = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
|
||||||
policy[0] = auth;
|
policy[0] = auth;
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ var Indicator = new Lang.Class({
|
|||||||
this._notify(title, body);
|
this._notify(title, body);
|
||||||
},
|
},
|
||||||
|
|
||||||
_onEnrollFailed: function (obj, device, error) {
|
_onEnrollFailed(obj, device, error) {
|
||||||
const title = _('Thunderbolt authorization error');
|
const title = _('Thunderbolt authorization error');
|
||||||
const body = _('Could not authorize the thunderbolt device: %s'.format(error.message));
|
const body = _('Could not authorize the thunderbolt device: %s'.format(error.message));
|
||||||
this._notify(title, body);
|
this._notify(title, body);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user