Compare commits

..

3 Commits

Author SHA1 Message Date
986afdc0c5 Port client side code to GDBus
This continues the series of patches for GDBus porting, affecting
all code that accesses remote DBus objects. This includes modemManager,
automount, autorun (for the hotplug sniffer), calendar, network (for
nm-applet only), power, scripting (for perf monitor interface)

https://bugzilla.gnome.org/show_bug.cgi?id=648651
2011-11-15 08:55:53 -05:00
e6dc843786 notificationDaemon, magnifierDBus: port to GDBus
Move /org/freedesktop/Notifications and /org/gnome/Magnifier to the
GDBus connection, so they're matched with the appropriate DBus name.

https://bugzilla.gnome.org/show_bug.cgi?id=648651
2011-11-15 08:55:35 -05:00
9eb671bb08 screensaver, gnomesession: port to GDBus based bindings
Port org.gnome.ScreenSaver and org.gnome.SessionManager glue code
to use GDBus, and move /org/gnome/Shell/EndSessionDialog to the
GDBus connection, so it is backed by the org.gnome.Shell name.

https://bugzilla.gnome.org/show_bug.cgi?id=648651
2011-11-15 08:54:39 -05:00
81 changed files with 2347 additions and 3393 deletions

63
NEWS
View File

@ -1,66 +1,3 @@
3.3.2
=====
* Port D-Bus usage in the shell to GDBus [Giovanni, Marc-Antoine, Florian,
Jasper, Matthias; #648651, #658078, #663902, #663941]
* Message tray
- Add right-click option to chats to mute the conversation [Ana; #659962]
- Don't steal the focus when popping up under the pointer [Rui; #661358]
* Looking Glass
- Add alt-Tab completion [Jason; #661054]
- Show errors from extensions in the extensions tab [Jasper; #660546]
- Allow switching tabs with <Control>PageUp/PageDown
- Theme consistently with the rest of the shell [Jason; 650900]
* Extension system
- Don't try to load disabled extensions at all [Jasper; #661815, #662704]
- Enable and disable plugins in a consistent order [Jasper; #661815, #662704]
- Add options to enable/disable extensions to gnome-shell-extension-tool
[Jasper; #661815]
* Adapt to Mutter change to GSettings [Florian, Matthias; #663429]
* Allow creating a new workspace by dragging a window or launcher in the
middle of two existing ones [Jasper; #646409]
* Allow using Alt-Tab while during drag-and-drop and other operations
that grab the pointer [Adel; #660457]
* Do a better job of finding the right user to authenticate
as when showing a PolKit dialog [Matthias; #651547]
* Control the D-Bus Eval() method by the developer-tools GSetting which
is used for looking glass and screen recorder. [Jasper; #662891]
* Fix browser plugin to work under WebKit-based browser [Jasper; #663823]
* Fix certain stacking issues with alt-Tab [Jasper; #660650]
* Fixes for GLib deprecations [Jasper; #662011]p
* Fixes for GTK+ deprecations [Florian, Rico; #662245]p
* Fixes for Clutter deprecations [Jasper; #662627]
* Visual improvements and UI tweaks [Florian, Jakub, Jasper;
#662800, #658096, #662226]
* Hard-code "Home" as the name for the home dir, rather than looking
it up via GSettings; avoids schema dependency [Cosimo; #559895]
* Don't show "Switch User" on single user machines [Florian; #657011]
* Generate documentation for St toolkit [Florian]
* Improve marking of strings for translation [Matthias, Piotr; #658664]
* Networking menu bug fixes [Giovanni; #650007, #651378, #659277, #663278]
* Code cleanups and leak fixes to StTextureCache
[Jasper, Florian; #660968, #662998]
* Code cleanups [Adel, Florian, Jasper; #662238, #663584]
* Build fixes [Adel, Colin, Florian, Ming Han]
* Misc bug fixes [Adel, Florian, "Fry", Jasper, Giovanni, Ray, Rui, Stefan;
#660520, #661029, #661231, #661623, #661921, #662235, #662236, #662502,
#662394, #662799, #662969, #663175, #663277, #663815, #663891, #662967]
Contributors:
Giovanni Campagna, Cosimo Cecchi, Matthias Clasen, Piotr Drąg, Adel Gadllah,
Rui Matos, Florian Müllner, Marc-Antoine Perennou, Ana Risteska,
Jason Siefken, Jakub Steiner, Ray Strode, Jasper St. Pierre, Ming Han Teh,
Rico Tzschichholz, Colin Walters, Stefan Zwanenburg
Translation:
Alexander Shopov [bg], Marek Černocký [cs], Mario Blättermann [de],
Kostas Papadimas [el], Bruce Cowan [en_GB], Kristjan Schmidt [eo],
Jorge González, Daniel Mustieles, Benjamín Valero Espinosa [es],
Mattias Põldaru [et], Arash Mousavi [fa], Ville-Pekka Vainio [fi],
Fran Diéguez [gl], Yaron Shahrabani [he], Hideki Yamane [ja],
Algimantas Margevičius [lt], Kjartan Maraas [nb], Daniel Nylander [se],
Matej Urbančič [sl], Praveen Illa [te], Muhammet Kara [tr],
Nguyễn Thái Ngọc Duy [vi], Cheng-Chia Tseng [zh_HK, zh_TW]
3.2.1
=====
* Restore the IM state on startup - if you were available in when you logged

View File

@ -1,5 +1,5 @@
AC_PREREQ(2.63)
AC_INIT([gnome-shell],[3.3.2],[https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell],[gnome-shell])
AC_INIT([gnome-shell],[3.2.1],[https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell],[gnome-shell])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/shell-global.c])
@ -63,7 +63,7 @@ AM_CONDITIONAL(BUILD_RECORDER, $build_recorder)
CLUTTER_MIN_VERSION=1.7.5
GOBJECT_INTROSPECTION_MIN_VERSION=0.10.1
GJS_MIN_VERSION=1.29.18
MUTTER_MIN_VERSION=3.3.2
MUTTER_MIN_VERSION=3.2.1
FOLKS_MIN_VERSION=0.5.2
GTK_MIN_VERSION=3.0.0
GIO_MIN_VERSION=2.31.0
@ -82,7 +82,7 @@ PKG_CHECK_MODULES(GNOME_SHELL, gio-unix-2.0 >= $GIO_MIN_VERSION
folks >= $FOLKS_MIN_VERSION
libmutter >= $MUTTER_MIN_VERSION
gjs-internals-1.0 >= $GJS_MIN_VERSION
libgnome-menu-3.0 $recorder_modules
libgnome-menu-3.0 $recorder_modules gconf-2.0
gdk-x11-3.0 libsoup-2.4
clutter-x11-1.0 >= $CLUTTER_MIN_VERSION
clutter-glx-1.0 >= $CLUTTER_MIN_VERSION
@ -117,6 +117,7 @@ CFLAGS=$saved_CFLAGS
LIBS=$saved_LIBS
PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-3.0 libcroco-0.6 >= 0.6.2 gnome-desktop-3.0 >= 2.90.0 x11)
PKG_CHECK_MODULES(GDMUSER, dbus-glib-1 gtk+-3.0)
PKG_CHECK_MODULES(TRAY, gtk+-3.0)
PKG_CHECK_MODULES(GVC, libpulse libpulse-mainloop-glib gobject-2.0)
PKG_CHECK_MODULES(DESKTOP_SCHEMAS, gsettings-desktop-schemas >= 0.1.7)

View File

@ -1267,8 +1267,7 @@ StTooltip StLabel {
}
.notification-icon-button > StIcon {
icon-size: 16px;
padding: 8px;
icon-size: 36px;
}
.hotplug-transient-box {

View File

@ -21,9 +21,11 @@
const Lang = imports.lang;
const Signals = imports.signals;
const Task = new Lang.Class({
Name: 'Task',
function Task() {
this._init.apply(this, arguments);
}
Task.prototype = {
_init: function(scope, handler) {
if (scope)
this.scope = scope;
@ -39,17 +41,22 @@ const Task = new Lang.Class({
return null;
},
});
};
Signals.addSignalMethods(Task.prototype);
const Hold = new Lang.Class({
Name: 'Hold',
Extends: Task,
function Hold() {
this._init.apply(this, arguments);
}
Hold.prototype = {
__proto__: Task.prototype,
_init: function() {
this.parent(this, function () {
return this;
});
Task.prototype._init.call(this,
this,
function () {
return this;
});
this._acquisitions = 1;
},
@ -81,15 +88,18 @@ const Hold = new Lang.Class({
isAcquired: function() {
return this._acquisitions > 0;
}
});
}
Signals.addSignalMethods(Hold.prototype);
const Batch = new Lang.Class({
Name: 'Batch',
Extends: Task,
function Batch() {
this._init.apply(this, arguments);
}
Batch.prototype = {
__proto__: Task.prototype,
_init: function(scope, tasks) {
this.parent();
Task.prototype._init.call(this);
this.tasks = [];
@ -156,12 +166,20 @@ const Batch = new Lang.Class({
cancel: function() {
this.tasks = this.tasks.splice(0, this._currentTaskIndex + 1);
}
});
};
Signals.addSignalMethods(Batch.prototype);
const ConcurrentBatch = new Lang.Class({
Name: 'ConcurrentBatch',
Extends: Batch,
function ConcurrentBatch() {
this._init.apply(this, arguments);
}
ConcurrentBatch.prototype = {
__proto__: Batch.prototype,
_init: function(scope, tasks) {
Batch.prototype._init.call(this, scope, tasks);
},
process: function() {
let hold = this.runTask();
@ -175,12 +193,19 @@ const ConcurrentBatch = new Lang.Class({
// concurrently.
this.nextTask();
}
});
};
Signals.addSignalMethods(ConcurrentBatch.prototype);
const ConsecutiveBatch = new Lang.Class({
Name: 'ConsecutiveBatch',
Extends: Batch,
function ConsecutiveBatch() {
this._init.apply(this, arguments);
}
ConsecutiveBatch.prototype = {
__proto__: Batch.prototype,
_init: function(scope, tasks) {
Batch.prototype._init.call(this, scope, tasks);
},
process: function() {
let hold = this.runTask();
@ -199,5 +224,5 @@ const ConsecutiveBatch = new Lang.Class({
this.nextTask();
}
}
});
};
Signals.addSignalMethods(ConsecutiveBatch.prototype);

View File

@ -1,22 +1,32 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Gio = imports.gi.Gio;
const DBus = imports.dbus;
const ConsoleKitManagerIface = <interface name='org.freedesktop.ConsoleKit.Manager'>
<method name='CanRestart'>
<arg type='b' direction='out'/>
</method>
<method name='CanStop'>
<arg type='b' direction='out'/>
</method>
<method name='Restart' />
<method name='Stop' />
</interface>;
const ConsoleKitProxy = Gio.DBusProxy.makeProxyWrapper(ConsoleKitManagerIface);
const ConsoleKitManagerIface = {
name: 'org.freedesktop.ConsoleKit.Manager',
methods: [{ name: 'CanRestart',
inSignature: '',
outSignature: 'b' },
{ name: 'CanStop',
inSignature: '',
outSignature: 'b' },
{ name: 'Restart',
inSignature: '',
outSignature: '' },
{ name: 'Stop',
inSignature: '',
outSignature: '' }]
};
function ConsoleKitManager() {
return new ConsoleKitProxy(Gio.DBus.system,
'org.freedesktop.ConsoleKit',
'/org/freedesktop/ConsoleKit/Manager');
this._init();
};
ConsoleKitManager.prototype = {
_init: function() {
DBus.system.proxifyObject(this,
'org.freedesktop.ConsoleKit',
'/org/freedesktop/ConsoleKit/Manager');
}
};
DBus.proxifyPrototype(ConsoleKitManager.prototype, ConsoleKitManagerIface);

View File

@ -1,20 +1,26 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Gio = imports.gi.Gio;
const DBus = imports.dbus;
const Lang = imports.lang;
const Shell = imports.gi.Shell;
const Signals = imports.signals;
const FprintManagerIface = <interface name='net.reactivated.Fprint.Manager'>
<method name='GetDefaultDevice'>
<arg type='o' direction='out' />
</method>
</interface>;
const FprintManagerProxy = Gio.DBusProxy.makeProxyWrapper(FprintManagerIface);
const FprintManagerIface = {
name: 'net.reactivated.Fprint.Manager',
methods: [{ name: 'GetDefaultDevice',
inSignature: '',
outSignature: 'o' }]
};
function FprintManager() {
return new FprintManagerProxy(Gio.DBus.system,
'net.reactivated.Fprint',
'/net/reactivated/Fprint/Manager');
this._init();
};
FprintManager.prototype = {
_init: function() {
DBus.system.proxifyObject(this,
'net.reactivated.Fprint',
'/net/reactivated/Fprint/Manager');
}
};
DBus.proxifyPrototype(FprintManager.prototype, FprintManagerIface);

View File

@ -33,6 +33,7 @@ const St = imports.gi.St;
const GdmGreeter = imports.gi.GdmGreeter;
const Batch = imports.gdm.batch;
const DBus = imports.dbus;
const Fprint = imports.gdm.fingerprint;
const Lightbox = imports.ui.lightbox;
const Main = imports.ui.main;
@ -140,9 +141,11 @@ function _smoothlyResizeActor(actor, width, height) {
return hold;
}
const UserListItem = new Lang.Class({
Name: 'UserListItem',
function UserListItem(user, reason) {
this._init(user, reason);
}
UserListItem.prototype = {
_init: function(user) {
this.user = user;
this._userChangedId = this.user.connect('changed',
@ -271,12 +274,15 @@ const UserListItem = new Lang.Class({
});
return hold;
}
});
};
Signals.addSignalMethods(UserListItem.prototype);
const UserList = new Lang.Class({
Name: 'UserList',
function UserList() {
this._init.apply(this, arguments);
}
UserList.prototype = {
_init: function() {
this.actor = new St.ScrollView({ style_class: 'login-dialog-user-list-view'});
this.actor.set_policy(Gtk.PolicyType.NEVER,
@ -532,12 +538,14 @@ const UserList = new Lang.Class({
item.actor.destroy();
delete this._items[userName];
}
});
};
Signals.addSignalMethods(UserList.prototype);
const SessionListItem = new Lang.Class({
Name: 'SessionListItem',
function SessionListItem(id, name) {
this._init(id, name);
}
SessionListItem.prototype = {
_init: function(id, name) {
this.id = id;
@ -592,12 +600,14 @@ const SessionListItem = new Lang.Class({
_onClicked: function() {
this.emit('activate');
}
});
};
Signals.addSignalMethods(SessionListItem.prototype);
const SessionList = new Lang.Class({
Name: 'SessionList',
function SessionList() {
this._init();
}
SessionList.prototype = {
_init: function() {
this.actor = new St.Bin();
@ -728,15 +738,24 @@ const SessionList = new Lang.Class({
}));
}
}
});
};
Signals.addSignalMethods(SessionList.prototype);
const LoginDialog = new Lang.Class({
Name: 'LoginDialog',
Extends: ModalDialog.ModalDialog,
function LoginDialog() {
if (_loginDialog == null) {
this._init();
_loginDialog = this;
}
return _loginDialog;
}
LoginDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
_init: function() {
this.parent({ shellReactive: true, styleClass: 'login-dialog' });
ModalDialog.ModalDialog.prototype._init.call(this, { shellReactive: true,
styleClass: 'login-dialog' });
this.connect('destroy',
Lang.bind(this, this._onDestroy));
this.connect('opened',
@ -889,7 +908,7 @@ const LoginDialog = new Lang.Class({
if (!this._settings.get_boolean(_FINGERPRINT_AUTHENTICATION_KEY))
return;
this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, Lang.bind(this,
this._fprintManager.GetDefaultDeviceRemote(DBus.CALL_FLAG_START, Lang.bind(this,
function(device, error) {
if (!error && device)
this._haveFingerprintReader = true;
@ -1380,8 +1399,8 @@ const LoginDialog = new Lang.Class({
},
close: function() {
this.parent();
ModalDialog.ModalDialog.prototype.close.call(this);
Main.ctrlAltTabManager.removeGroup(this._group);
}
});
};

View File

@ -25,12 +25,15 @@ const ConsoleKit = imports.gdm.consoleKit;
const PanelMenu = imports.ui.panelMenu;
const PopupMenu = imports.ui.popupMenu;
const PowerMenuButton = new Lang.Class({
Name: 'PowerMenuButton',
Extends: PanelMenu.SystemStatusButton,
function PowerMenuButton() {
this._init();
}
PowerMenuButton.prototype = {
__proto__: PanelMenu.SystemStatusButton.prototype,
_init: function() {
this.parent('system-shutdown', null);
PanelMenu.SystemStatusButton.prototype._init.call(this, 'system-shutdown', null);
this._consoleKitManager = new ConsoleKit.ConsoleKitManager();
this._upClient = new UPowerGlib.Client();
@ -140,4 +143,4 @@ const PowerMenuButton = new Lang.Class({
if (this._haveShutdown)
this._consoleKitManager.StopRemote();
}
});
};

View File

@ -8,9 +8,11 @@ const Search = imports.ui.search;
const THUMBNAIL_ICON_MARGIN = 2;
const DocInfo = new Lang.Class({
Name: 'DocInfo',
function DocInfo(recentInfo) {
this._init(recentInfo);
}
DocInfo.prototype = {
_init : function(recentInfo) {
this.recentInfo = recentInfo;
// We actually used get_modified() instead of get_visited()
@ -47,7 +49,7 @@ const DocInfo = new Lang.Class({
}
return mtype;
}
});
};
var docManagerInstance = null;
@ -60,9 +62,11 @@ function getDocManager() {
/**
* DocManager wraps the DocSystem, primarily to expose DocInfo objects.
*/
const DocManager = new Lang.Class({
Name: 'DocManager',
function DocManager() {
this._init();
}
DocManager.prototype = {
_init: function() {
this._docSystem = Shell.DocSystem.get_default();
this._infosByTimestamp = [];
@ -131,6 +135,6 @@ const DocManager = new Lang.Class({
return this._infosByUri[url];
})), terms);
}
});
};
Signals.addSignalMethods(DocManager.prototype);

View File

@ -7,9 +7,11 @@ const Params = imports.misc.params;
const DEFAULT_LIMIT = 512;
const HistoryManager = new Lang.Class({
Name: 'HistoryManager',
function HistoryManager(params) {
this._init(params);
}
HistoryManager.prototype = {
_init: function(params) {
params = Params.parse(params, { gsettingsKey: null,
limit: DEFAULT_LIMIT,
@ -109,5 +111,5 @@ const HistoryManager = new Lang.Class({
if (this._key)
global.settings.set_strv(this._key, this._history);
}
});
};
Signals.addSignalMethods(HistoryManager.prototype);

View File

@ -54,9 +54,11 @@ function _getProvidersTable() {
return _providersTable = providers;
}
const ModemGsm = new Lang.Class({
Name: 'ModemGsm',
function ModemGsm() {
this._init.apply(this, arguments);
}
ModemGsm.prototype = {
_init: function(path) {
this._proxy = new ModemGsmNetworkProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
@ -154,12 +156,14 @@ const ModemGsm = new Lang.Class({
return name3 || name2 || null;
}
});
}
Signals.addSignalMethods(ModemGsm.prototype);
const ModemCdma = new Lang.Class({
Name: 'ModemCdma',
function ModemCdma() {
this._init.apply(this, arguments);
}
ModemCdma.prototype = {
_init: function(path) {
this._proxy = new ModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
@ -227,5 +231,5 @@ const ModemCdma = new Lang.Class({
return null;
}
});
};
Signals.addSignalMethods(ModemCdma.prototype);

View File

@ -43,9 +43,11 @@ function primaryModifier(mask) {
return primary;
}
const AltTabPopup = new Lang.Class({
Name: 'AltTabPopup',
function AltTabPopup() {
this._init();
}
AltTabPopup.prototype = {
_init : function() {
this.actor = new Shell.GenericContainer({ name: 'altTabPopup',
reactive: true,
@ -538,11 +540,13 @@ const AltTabPopup = new Lang.Class({
onComplete: Lang.bind(this, function () { this.thumbnailsVisible = true; })
});
}
});
};
const SwitcherList = new Lang.Class({
Name: 'SwitcherList',
function SwitcherList(squareItems) {
this._init(squareItems);
}
SwitcherList.prototype = {
_init : function(squareItems) {
this.actor = new Shell.GenericContainer({ style_class: 'switcher-list' });
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
@ -847,13 +851,15 @@ const SwitcherList = new Lang.Class({
// Clip the area for scrolling
this._clipBin.set_clip(0, -topPadding, (this.actor.allocation.x2 - this.actor.allocation.x1) - leftPadding - rightPadding, this.actor.height + bottomPadding);
}
});
};
Signals.addSignalMethods(SwitcherList.prototype);
const AppIcon = new Lang.Class({
Name: 'AppIcon',
function AppIcon(app) {
this._init(app);
}
AppIcon.prototype = {
_init: function(app) {
this.app = app;
this.actor = new St.BoxLayout({ style_class: 'alt-tab-app',
@ -871,14 +877,17 @@ const AppIcon = new Lang.Class({
this._iconBin.set_size(size, size);
this._iconBin.child = this.icon;
}
});
};
const AppSwitcher = new Lang.Class({
Name: 'AppSwitcher',
Extends: SwitcherList,
function AppSwitcher() {
this._init.apply(this, arguments);
}
AppSwitcher.prototype = {
__proto__ : SwitcherList.prototype,
_init : function(localApps, otherApps, altTabPopup) {
this.parent(true);
SwitcherList.prototype._init.call(this, true);
// Construct the AppIcons, add to the popup
let activeWorkspace = global.screen.get_active_workspace();
@ -957,7 +966,7 @@ const AppSwitcher = new Lang.Class({
_allocate: function (actor, box, flags) {
// Allocate the main list items
this.parent(actor, box, flags);
SwitcherList.prototype._allocate.call(this, actor, box, flags);
let arrowHeight = Math.floor(this.actor.get_theme_node().get_padding(St.Side.BOTTOM) / 3);
let arrowWidth = arrowHeight * 2;
@ -1012,7 +1021,7 @@ const AppSwitcher = new Lang.Class({
this._arrows[this._curApp].remove_style_pseudo_class('highlighted');
}
this.parent(n, justOutline);
SwitcherList.prototype.highlight.call(this, n, justOutline);
this._curApp = n;
if (this._curApp != -1) {
@ -1036,14 +1045,17 @@ const AppSwitcher = new Lang.Class({
if (appIcon.cachedWindows.length == 1)
arrow.hide();
}
});
};
const ThumbnailList = new Lang.Class({
Name: 'ThumbnailList',
Extends: SwitcherList,
function ThumbnailList(windows) {
this._init(windows);
}
ThumbnailList.prototype = {
__proto__ : SwitcherList.prototype,
_init : function(windows) {
this.parent(false);
SwitcherList.prototype._init.call(this);
let activeWorkspace = global.screen.get_active_workspace();
@ -1121,7 +1133,7 @@ const ThumbnailList = new Lang.Class({
// Make sure we only do this once
this._thumbnailBins = new Array();
}
});
};
function _drawArrow(area, side) {
let themeNode = area.get_theme_node();

View File

@ -26,9 +26,11 @@ const MAX_APPLICATION_WORK_MILLIS = 75;
const MENU_POPUP_TIMEOUT = 600;
const SCROLL_TIME = 0.1;
const AlphabeticalView = new Lang.Class({
Name: 'AlphabeticalView',
function AlphabeticalView() {
this._init();
}
AlphabeticalView.prototype = {
_init: function() {
this._grid = new IconGrid.IconGrid({ xAlign: St.Align.START });
this._appSystem = Shell.AppSystem.get_default();
@ -128,11 +130,13 @@ const AlphabeticalView = new Lang.Class({
this._addApp(app);
}
}
});
};
const ViewByCategories = new Lang.Class({
Name: 'ViewByCategories',
function ViewByCategories() {
this._init();
}
ViewByCategories.prototype = {
_init: function() {
this._appSystem = Shell.AppSystem.get_default();
this.actor = new St.BoxLayout({ style_class: 'all-app' });
@ -277,14 +281,16 @@ const ViewByCategories = new Lang.Class({
this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
}
}
});
};
/* This class represents a display containing a collection of application items.
* The applications are sorted based on their name.
*/
const AllAppDisplay = new Lang.Class({
Name: 'AllAppDisplay',
function AllAppDisplay() {
this._init();
}
AllAppDisplay.prototype = {
_init: function() {
this._appSystem = Shell.AppSystem.get_default();
this._appSystem.connect('installed-changed', Lang.bind(this, function() {
@ -300,15 +306,17 @@ const AllAppDisplay = new Lang.Class({
_redisplay: function() {
this._appView.refresh();
}
});
};
const AppSearchProvider = new Lang.Class({
Name: 'AppSearchProvider',
Extends: Search.SearchProvider,
function AppSearchProvider() {
this._init();
}
AppSearchProvider.prototype = {
__proto__: Search.SearchProvider.prototype,
_init: function() {
this.parent(_("APPLICATIONS"));
Search.SearchProvider.prototype._init.call(this, _("APPLICATIONS"));
this._appSys = Shell.AppSystem.get_default();
},
@ -356,15 +364,17 @@ const AppSearchProvider = new Lang.Class({
let icon = new AppWellIcon(app);
return icon.actor;
}
});
};
const SettingsSearchProvider = new Lang.Class({
Name: 'SettingsSearchProvider',
Extends: Search.SearchProvider,
function SettingsSearchProvider() {
this._init();
}
SettingsSearchProvider.prototype = {
__proto__: Search.SearchProvider.prototype,
_init: function() {
this.parent(_("SETTINGS"));
Search.SearchProvider.prototype._init.call(this, _("SETTINGS"));
this._appSys = Shell.AppSystem.get_default();
this._gnomecc = this._appSys.lookup_app('gnome-control-center.desktop');
},
@ -402,28 +412,35 @@ const SettingsSearchProvider = new Lang.Class({
let icon = new AppWellIcon(app);
return icon.actor;
}
});
};
const AppIcon = new Lang.Class({
Name: 'AppIcon',
Extends: IconGrid.BaseIcon,
function AppIcon(app, params) {
this._init(app, params);
}
AppIcon.prototype = {
__proto__: IconGrid.BaseIcon.prototype,
_init : function(app, params) {
this.app = app;
let label = this.app.get_name();
this.parent(label, params);
IconGrid.BaseIcon.prototype._init.call(this,
label,
params);
},
createIcon: function(iconSize) {
return this.app.create_icon_texture(iconSize);
}
});
};
const AppWellIcon = new Lang.Class({
Name: 'AppWellIcon',
function AppWellIcon(app, iconParams, onActivateOverride) {
this._init(app, iconParams, onActivateOverride);
}
AppWellIcon.prototype = {
_init : function(app, iconParams, onActivateOverride) {
this.app = app;
this.actor = new St.Button({ style_class: 'app-well-app',
@ -603,19 +620,22 @@ const AppWellIcon = new Lang.Class({
getDragActorSource: function() {
return this.icon.icon;
}
});
};
Signals.addSignalMethods(AppWellIcon.prototype);
const AppIconMenu = new Lang.Class({
Name: 'AppIconMenu',
Extends: PopupMenu.PopupMenu,
function AppIconMenu(source) {
this._init(source);
}
AppIconMenu.prototype = {
__proto__: PopupMenu.PopupMenu.prototype,
_init: function(source) {
let side = St.Side.LEFT;
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
side = St.Side.RIGHT;
this.parent(source.actor, 0.5, side);
PopupMenu.PopupMenu.prototype._init.call(this, source.actor, 0.5, side);
// We want to keep the item hovered while the menu is up
this.blockSourceEvents = true;
@ -703,5 +723,5 @@ const AppIconMenu = new Lang.Class({
}
this.close();
}
});
};
Signals.addSignalMethods(AppIconMenu.prototype);

View File

@ -6,9 +6,11 @@ const Signals = imports.signals;
const Main = imports.ui.main;
const AppFavorites = new Lang.Class({
Name: 'AppFavorites',
function AppFavorites() {
this._init();
}
AppFavorites.prototype = {
FAVORITE_APPS_KEY: 'favorite-apps',
_init: function() {
@ -120,7 +122,7 @@ const AppFavorites = new Lang.Class({
this._addFavorite(appId, pos);
}));
}
});
};
Signals.addSignalMethods(AppFavorites.prototype);
var appFavoritesInstance = null;

View File

@ -64,9 +64,11 @@ function ConsoleKitManager() {
return self;
}
const AutomountManager = new Lang.Class({
Name: 'AutomountManager',
function AutomountManager() {
this._init();
}
AutomountManager.prototype = {
_init: function() {
this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
this._volumeQueue = [];
@ -266,4 +268,4 @@ const AutomountManager = new Lang.Class({
return false;
});
}
});
}

View File

@ -75,9 +75,11 @@ function HotplugSniffer() {
'/org/gnome/Shell/HotplugSniffer');
}
const ContentTypeDiscoverer = new Lang.Class({
Name: 'ContentTypeDiscoverer',
function ContentTypeDiscoverer(callback) {
this._init(callback);
}
ContentTypeDiscoverer.prototype = {
_init: function(callback) {
this._callback = callback;
},
@ -134,11 +136,13 @@ const ContentTypeDiscoverer = new Lang.Class({
this._callback(mount, apps, contentTypes);
}
});
}
const AutorunManager = new Lang.Class({
Name: 'AutorunManager',
function AutorunManager() {
this._init();
}
AutorunManager.prototype = {
_init: function() {
this._volumeMonitor = Gio.VolumeMonitor.get();
@ -255,14 +259,17 @@ const AutorunManager = new Lang.Class({
+ ': ' + e.toString());
}
},
});
}
const AutorunResidentSource = new Lang.Class({
Name: 'AutorunResidentSource',
Extends: MessageTray.Source,
function AutorunResidentSource() {
this._init();
}
AutorunResidentSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function() {
this.parent(_("Removable Devices"));
MessageTray.Source.prototype._init.call(this, _("Removable Devices"));
this._mounts = [];
@ -317,14 +324,19 @@ const AutorunResidentSource = new Lang.Class({
icon_type: St.IconType.FULLCOLOR,
icon_size: this.ICON_SIZE });
}
});
}
const AutorunResidentNotification = new Lang.Class({
Name: 'AutorunResidentNotification',
Extends: MessageTray.Notification,
function AutorunResidentNotification(source) {
this._init(source);
}
AutorunResidentNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source) {
this.parent(source, source.title, null, { customContent: true });
MessageTray.Notification.prototype._init.call(this, source,
source.title, null,
{ customContent: true });
// set the notification as resident
this.setResident(true);
@ -398,11 +410,13 @@ const AutorunResidentNotification = new Lang.Class({
return item;
},
});
}
const AutorunTransientDispatcher = new Lang.Class({
Name: 'AutorunTransientDispatcher',
function AutorunTransientDispatcher() {
this._init();
}
AutorunTransientDispatcher.prototype = {
_init: function() {
this._sources = [];
this._settings = new Gio.Settings({ schema: SETTINGS_SCHEMA });
@ -493,14 +507,17 @@ const AutorunTransientDispatcher = new Lang.Class({
// destroy the notification source
source.destroy();
}
});
}
const AutorunTransientSource = new Lang.Class({
Name: 'AutorunTransientSource',
Extends: MessageTray.Source,
function AutorunTransientSource(mount, apps) {
this._init(mount, apps);
}
AutorunTransientSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(mount, apps) {
this.parent(mount.get_name());
MessageTray.Source.prototype._init.call(this, mount.get_name());
this.mount = mount;
this.apps = apps;
@ -517,14 +534,19 @@ const AutorunTransientSource = new Lang.Class({
return new St.Icon({ gicon: this.mount.get_icon(),
icon_size: this.ICON_SIZE });
}
});
}
const AutorunTransientNotification = new Lang.Class({
Name: 'AutorunTransientNotification',
Extends: MessageTray.Notification,
function AutorunTransientNotification(source) {
this._init(source);
}
AutorunTransientNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source) {
this.parent(source, source.title, null, { customContent: true });
MessageTray.Notification.prototype._init.call(this, source,
source.title, null,
{ customContent: true });
this._box = new St.BoxLayout({ style_class: 'hotplug-transient-box',
vertical: true });
@ -599,5 +621,5 @@ const AutorunTransientNotification = new Lang.Class({
return button;
}
});
}

View File

@ -21,9 +21,11 @@ const POPUP_ANIMATION_TIME = 0.15;
* placed. The arrow position may be controlled via setArrowOrigin().
*
*/
const BoxPointer = new Lang.Class({
Name: 'BoxPointer',
function BoxPointer(side, binProperties) {
this._init(side, binProperties);
}
BoxPointer.prototype = {
_init: function(arrowSide, binProperties) {
this._arrowSide = arrowSide;
this._arrowOrigin = 0;
@ -450,4 +452,4 @@ const BoxPointer = new Lang.Class({
get opacity() {
return this.actor.opacity;
}
});
};

View File

@ -155,24 +155,28 @@ function _getEventDayAbbreviation(dayNumber) {
// Abstraction for an appointment/event in a calendar
const CalendarEvent = new Lang.Class({
Name: 'CalendarEvent',
function CalendarEvent(date, end, summary, allDay) {
this._init(date, end, summary, allDay);
}
CalendarEvent.prototype = {
_init: function(date, end, summary, allDay) {
this.date = date;
this.end = end;
this.summary = summary;
this.allDay = allDay;
}
});
};
// Interface for appointments/events - e.g. the contents of a calendar
//
// First, an implementation with no events
const EmptyEventSource = new Lang.Class({
Name: 'EmptyEventSource',
function EmptyEventSource() {
this._init();
}
EmptyEventSource.prototype = {
_init: function() {
},
@ -187,7 +191,7 @@ const EmptyEventSource = new Lang.Class({
hasEvents: function(day) {
return false;
}
});
};
Signals.addSignalMethods(EmptyEventSource.prototype);
const CalendarServerIface = <interface name="org.gnome.Shell.CalendarServer">
@ -215,6 +219,11 @@ function CalendarServer() {
return self;
}
// an implementation that reads data from a session bus service
function DBusEventSource() {
this._init();
}
function _datesEqual(a, b) {
if (a < b)
return false;
@ -233,10 +242,8 @@ function _dateIntervalsOverlap(a0, a1, b0, b1)
return true;
}
// an implementation that reads data from a session bus service
const DBusEventSource = new Lang.Class({
Name: 'DBusEventSource',
DBusEventSource.prototype = {
_init: function() {
this._resetCache();
@ -337,15 +344,17 @@ const DBusEventSource = new Lang.Class({
return true;
}
});
};
Signals.addSignalMethods(DBusEventSource.prototype);
// Calendar:
// @eventSource: is an object implementing the EventSource API, e.g. the
// requestRange(), getEvents(), hasEvents() methods and the ::changed signal.
const Calendar = new Lang.Class({
Name: 'Calendar',
function Calendar(eventSource) {
this._init(eventSource);
}
Calendar.prototype = {
_init: function(eventSource) {
if (eventSource) {
this._eventSource = eventSource;
@ -611,13 +620,15 @@ const Calendar = new Lang.Class({
if (this._eventSource)
this._eventSource.requestRange(beginDate, iter, forceReload);
}
});
};
Signals.addSignalMethods(Calendar.prototype);
const EventsList = new Lang.Class({
Name: 'EventsList',
function EventsList(eventSource) {
this._init(eventSource);
}
EventsList.prototype = {
_init: function(eventSource) {
this.actor = new St.BoxLayout({ vertical: true, style_class: 'events-header-vbox'});
this._date = new Date();
@ -748,4 +759,4 @@ const EventsList = new Lang.Class({
this._showOtherDay(this._date);
}
}
});
};

View File

@ -20,9 +20,11 @@ function launchContact(id) {
/* This class represents a shown contact search result in the overview */
const Contact = new Lang.Class({
Name: 'Contact',
function Contact(id) {
this._init(id);
}
Contact.prototype = {
_init: function(id) {
this._contactSys = Shell.ContactSystem.get_default();
this.individual = this._contactSys.get_individual(id);
@ -129,16 +131,19 @@ const Contact = new Lang.Class({
return tc.load_icon_name(null, 'avatar-default', St.IconType.FULLCOLOR, size);
}
},
});
};
/* Searches for and returns contacts */
const ContactSearchProvider = new Lang.Class({
Name: 'ContactSearchProvider',
Extends: Search.SearchProvider,
function ContactSearchProvider() {
this._init();
}
ContactSearchProvider.prototype = {
__proto__: Search.SearchProvider.prototype,
_init: function() {
this.parent(_("CONTACTS"));
Search.SearchProvider.prototype._init.call(this, _("CONTACTS"));
this._contactSys = Shell.ContactSystem.get_default();
},
@ -177,4 +182,4 @@ const ContactSearchProvider = new Lang.Class({
activateResult: function(id, params) {
launchContact(id);
}
});
};

View File

@ -22,9 +22,11 @@ const SortGroup = {
BOTTOM: 2
};
const CtrlAltTabManager = new Lang.Class({
Name: 'CtrlAltTabManager',
function CtrlAltTabManager() {
this._init();
}
CtrlAltTabManager.prototype = {
_init: function() {
this._items = [];
this._focusManager = St.FocusManager.get_for_stage(global.stage);
@ -132,15 +134,17 @@ const CtrlAltTabManager = new Lang.Class({
}));
}
}
});
};
function mod(a, b) {
return (a + b) % b;
}
const CtrlAltTabPopup = new Lang.Class({
Name: 'CtrlAltTabPopup',
function CtrlAltTabPopup() {
this._init();
}
CtrlAltTabPopup.prototype = {
_init : function() {
this.actor = new Shell.GenericContainer({ name: 'ctrlAltTabPopup',
reactive: true });
@ -299,14 +303,17 @@ const CtrlAltTabPopup = new Lang.Class({
this._selection = num;
this._switcher.highlight(num);
}
});
};
const CtrlAltTabSwitcher = new Lang.Class({
Name: 'CtrlAltTabSwitcher',
Extends: AltTab.SwitcherList,
function CtrlAltTabSwitcher(items) {
this._init(items);
}
CtrlAltTabSwitcher.prototype = {
__proto__ : AltTab.SwitcherList.prototype,
_init : function(items) {
this.parent(true);
AltTab.SwitcherList.prototype._init.call(this, true);
for (let i = 0; i < items.length; i++)
this._addIcon(items[i]);
@ -329,4 +336,4 @@ const CtrlAltTabSwitcher = new Lang.Class({
this.addItem(box, text);
}
});
};

View File

@ -19,9 +19,11 @@ const DASH_ANIMATION_TIME = 0.2;
// A container like StBin, but taking the child's scale into account
// when requesting a size
const DashItemContainer = new Lang.Class({
Name: 'DashItemContainer',
function DashItemContainer() {
this._init();
}
DashItemContainer.prototype = {
_init: function() {
this.actor = new Shell.GenericContainer({ style_class: 'dash-item-container' });
this.actor.connect('get-preferred-width',
@ -155,14 +157,17 @@ const DashItemContainer = new Lang.Class({
get childOpacity() {
return this._childOpacity;
}
});
};
const RemoveFavoriteIcon = new Lang.Class({
Name: 'RemoveFavoriteIcon',
Extends: DashItemContainer,
function RemoveFavoriteIcon() {
this._init();
}
RemoveFavoriteIcon.prototype = {
__proto__: DashItemContainer.prototype,
_init: function() {
this.parent();
DashItemContainer.prototype._init.call(this);
this._iconBin = new St.Bin({ style_class: 'remove-favorite' });
this._iconActor = null;
@ -214,21 +219,28 @@ const RemoveFavoriteIcon = new Lang.Class({
return true;
}
});
};
const DragPlaceholderItem = new Lang.Class({
Name: 'DragPlaceholderItem',
Extends: DashItemContainer,
function DragPlaceholderItem() {
this._init();
}
DragPlaceholderItem.prototype = {
__proto__: DashItemContainer.prototype,
_init: function() {
this.parent();
DashItemContainer.prototype._init.call(this);
this.setChild(new St.Bin({ style_class: 'placeholder' }));
}
});
};
const Dash = new Lang.Class({
Name: 'Dash',
function Dash() {
this._init();
}
Dash.prototype = {
_init : function() {
this._maxHeight = -1;
this.iconSize = 64;
@ -750,6 +762,6 @@ const Dash = new Lang.Class({
return true;
}
});
};
Signals.addSignalMethods(Dash.prototype);

View File

@ -40,9 +40,12 @@ function _onVertSepRepaint (area)
cr.stroke();
};
const DateMenuButton = new Lang.Class({
Name: 'DateMenuButton',
Extends: PanelMenu.Button,
function DateMenuButton() {
this._init.apply(this, arguments);
}
DateMenuButton.prototype = {
__proto__: PanelMenu.Button.prototype,
_init: function(params) {
params = Params.parse(params, { showEvents: true });
@ -54,7 +57,7 @@ const DateMenuButton = new Lang.Class({
let menuAlignment = 0.25;
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
menuAlignment = 1.0 - menuAlignment;
this.parent(menuAlignment);
PanelMenu.Button.prototype._init.call(this, menuAlignment);
this._clock = new St.Label();
this.actor.add_actor(this._clock);
@ -236,4 +239,4 @@ const DateMenuButton = new Lang.Class({
}
}
}
});
};

View File

@ -69,9 +69,11 @@ function removeDragMonitor(monitor) {
}
}
const _Draggable = new Lang.Class({
Name: 'Draggable',
function _Draggable(actor, params) {
this._init(actor, params);
}
_Draggable.prototype = {
_init : function(actor, params) {
params = Params.parse(params, { manualMode: false,
restoreOnSuccess: false,
@ -594,7 +596,7 @@ const _Draggable = new Lang.Class({
this._dragActor = undefined;
currentDraggable = null;
}
});
};
Signals.addSignalMethods(_Draggable.prototype);

View File

@ -1,16 +1,19 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const DocInfo = imports.misc.docInfo;
const Lang = imports.lang;
const Params = imports.misc.params;
const Search = imports.ui.search;
const DocSearchProvider = new Lang.Class({
Name: 'DocSearchProvider',
Extends: Search.SearchProvider,
function DocSearchProvider() {
this._init();
}
DocSearchProvider.prototype = {
__proto__: Search.SearchProvider.prototype,
_init: function(name) {
this.parent(_("RECENT ITEMS"));
Search.SearchProvider.prototype._init.call(this, _("RECENT ITEMS"));
this._docManager = DocInfo.getDocManager();
},
@ -41,4 +44,4 @@ const DocSearchProvider = new Lang.Class({
getSubsearchResultSet: function(previousResults, terms) {
return this._docManager.subsearch(previousResults, terms);
}
});
};

View File

@ -142,9 +142,11 @@ function findAppFromInhibitor(inhibitor) {
return app;
}
const ListItem = new Lang.Class({
Name: 'ListItem',
function ListItem(app, reason) {
this._init(app, reason);
}
ListItem.prototype = {
_init: function(app, reason) {
this._app = app;
this._reason = reason;
@ -190,7 +192,7 @@ const ListItem = new Lang.Class({
this.emit('activate');
this._app.activate();
}
});
};
Signals.addSignalMethods(ListItem.prototype);
// The logout timer only shows updates every 10 seconds
@ -228,19 +230,27 @@ function _setLabelText(label, text) {
}
}
function EndSessionDialog() {
if (_endSessionDialog == null) {
this._init();
_endSessionDialog = this;
}
return _endSessionDialog;
}
function init() {
// This always returns the same singleton object
// By instantiating it initially, we register the
// bus object, etc.
_endSessionDialog = new EndSessionDialog();
let dialog = new EndSessionDialog();
}
const EndSessionDialog = new Lang.Class({
Name: 'EndSessionDialog',
Extends: ModalDialog.ModalDialog,
EndSessionDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
_init: function() {
this.parent({ styleClass: 'end-session-dialog' });
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'end-session-dialog' });
this._user = AccountsService.UserManager.get_default().get_user(GLib.get_user_name());
@ -431,7 +441,7 @@ const EndSessionDialog = new Lang.Class({
},
close: function() {
this.parent();
ModalDialog.ModalDialog.prototype.close.call(this);
this._dbusImpl.emit_signal('Closed', null);
},
@ -533,4 +543,4 @@ const EndSessionDialog = new Lang.Class({
this.disconnect(signalId);
}));
}
});
};

View File

@ -502,12 +502,15 @@ function loadExtensions() {
_loadExtensionsIn(userExtensionsDir, ExtensionType.PER_USER);
}
const InstallExtensionDialog = new Lang.Class({
Name: 'InstallExtensionDialog',
Extends: ModalDialog.ModalDialog,
function InstallExtensionDialog(uuid, version_tag, name) {
this._init(uuid, version_tag, name);
}
InstallExtensionDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
_init: function(uuid, version_tag, name) {
this.parent({ styleClass: 'extension-dialog' });
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'extension-dialog' });
this._uuid = uuid;
this._version_tag = version_tag;
@ -567,4 +570,4 @@ const InstallExtensionDialog = new Lang.Class({
this.close(global.get_current_time());
}
});
};

View File

@ -10,9 +10,11 @@ const Params = imports.misc.params;
const ICON_SIZE = 48;
const BaseIcon = new Lang.Class({
Name: 'BaseIcon',
function BaseIcon(label, createIcon) {
this._init(label, createIcon);
}
BaseIcon.prototype = {
_init : function(label, params) {
params = Params.parse(params, { createIcon: null,
setSizeManually: false,
@ -147,11 +149,13 @@ const BaseIcon = new Lang.Class({
this._createIconTexture(size);
}
});
};
const IconGrid = new Lang.Class({
Name: 'IconGrid',
function IconGrid(params) {
this._init(params);
}
IconGrid.prototype = {
_init: function(params) {
params = Params.parse(params, { rowLimit: null,
columnLimit: null,
@ -320,4 +324,4 @@ const IconGrid = new Lang.Class({
visibleItemsCount: function() {
return this._grid.get_children().length - this._grid.get_n_skip_paint();
}
});
};

View File

@ -39,31 +39,34 @@ const PRETTY_KEYS = {
'Alt_L': 'Alt'
};
const CaribouKeyboardIface = <interface name='org.gnome.Caribou.Keyboard'>
<method name='Show'>
<arg type='u' direction='in' />
</method>
<method name='Hide'>
<arg type='u' direction='in' />
</method>
<method name='SetCursorLocation'>
<arg type='i' direction='in' />
<arg type='i' direction='in' />
<arg type='i' direction='in' />
<arg type='i' direction='in' />
</method>
<method name='SetEntryLocation'>
<arg type='i' direction='in' />
<arg type='i' direction='in' />
<arg type='i' direction='in' />
<arg type='i' direction='in' />
</method>
<property name='Name' access='read' type='s' />
</interface>;
const CaribouKeyboardIface = {
name: 'org.gnome.Caribou.Keyboard',
methods: [ { name: 'Show',
inSignature: 'u',
outSignature: ''
},
{ name: 'Hide',
inSignature: 'u',
outSignature: ''
},
{ name: 'SetCursorLocation',
inSignature: 'iiii',
outSignature: ''
},
{ name: 'SetEntryLocation',
inSignature: 'iiii',
outSignature: ''
} ],
properties: [ { name: 'Name',
signature: 's',
access: 'read' } ]
};
const Key = new Lang.Class({
Name: 'Key',
function Key() {
this._init.apply(this, arguments);
}
Key.prototype = {
_init : function(key) {
this._key = key;
@ -189,15 +192,15 @@ const Key = new Lang.Class({
this._boxPointer.hide(true);
}
}
});
};
const Keyboard = new Lang.Class({
// HACK: we can't set Name, because it collides with Name dbus property
// Name: 'Keyboard',
function Keyboard() {
this._init.apply(this, arguments);
}
Keyboard.prototype = {
_init: function () {
this._impl = Gio.DBusExportedObject.wrapJSObject(CaribouKeyboardIface, this);
this._impl.export(Gio.DBus.session, '/org/gnome/Caribou/Keyboard');
DBus.session.exportObject('/org/gnome/Caribou/Keyboard', this);
this.actor = null;
@ -529,15 +532,19 @@ const Keyboard = new Lang.Class({
get Name() {
return 'gnome-shell';
}
});
};
DBus.conformExport(Keyboard.prototype, CaribouKeyboardIface);
const KeyboardSource = new Lang.Class({
Name: 'KeyboardSource',
Extends: MessageTray.Source,
function KeyboardSource() {
this._init.apply(this, arguments);
}
KeyboardSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(keyboard) {
this.parent(_("Keyboard"));
this._keyboard = keyboard;
MessageTray.Source.prototype._init.call(this, _("Keyboard"));
this._setSummaryIcon(this.createNotificationIcon());
},
@ -548,7 +555,7 @@ const KeyboardSource = new Lang.Class({
icon_size: this.ICON_SIZE });
},
handleSummaryClick: function() {
handleSummaryClick: function() {
let event = Clutter.get_current_event();
if (event.type() != Clutter.EventType.BUTTON_RELEASE)
return false;
@ -560,4 +567,4 @@ const KeyboardSource = new Lang.Class({
open: function() {
this._keyboard.show();
}
});
};

View File

@ -17,9 +17,11 @@ const HOT_CORNER_ACTIVATION_TIMEOUT = 0.5;
const STARTUP_ANIMATION_TIME = 0.2;
const KEYBOARD_ANIMATION_TIME = 0.5;
const LayoutManager = new Lang.Class({
Name: 'LayoutManager',
function LayoutManager() {
this._init.apply(this, arguments);
}
LayoutManager.prototype = {
_init: function () {
this._rtl = (St.Widget.get_default_direction() == St.TextDirection.RTL);
this.monitors = [];
@ -372,7 +374,7 @@ const LayoutManager = new Lang.Class({
findMonitorForActor: function(actor) {
return this._chrome.findMonitorForActor(actor);
}
});
};
Signals.addSignalMethods(LayoutManager.prototype);
@ -380,9 +382,11 @@ Signals.addSignalMethods(LayoutManager.prototype);
//
// This class manages a "hot corner" that can toggle switching to
// overview.
const HotCorner = new Lang.Class({
Name: 'HotCorner',
function HotCorner() {
this._init();
}
HotCorner.prototype = {
_init : function() {
// 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
@ -544,7 +548,7 @@ const HotCorner = new Lang.Class({
return true;
return false;
}
});
};
// This manages the shell "chrome"; the UI that's visible in the
@ -557,9 +561,11 @@ const defaultParams = {
affectsInputRegion: true
};
const Chrome = new Lang.Class({
Name: 'Chrome',
function Chrome() {
this._init.apply(this, arguments);
}
Chrome.prototype = {
_init: function(layoutManager) {
this._layoutManager = layoutManager;
@ -975,4 +981,4 @@ const Chrome = new Lang.Class({
return false;
}
});
};

View File

@ -30,9 +30,11 @@ const Tweener = imports.ui.tweener;
* @container and will track any changes in its size. You can override
* this by passing an explicit width and height in @params.
*/
const Lightbox = new Lang.Class({
Name: 'Lightbox',
function Lightbox(container, params) {
this._init(container, params);
}
Lightbox.prototype = {
_init : function(container, params) {
params = Params.parse(params, { inhibitEvents: false,
width: null,
@ -194,4 +196,4 @@ const Lightbox = new Lang.Class({
this.highlight(null);
}
});
};

View File

@ -4,9 +4,11 @@ const Lang = imports.lang;
const Signals = imports.signals;
const St = imports.gi.St;
const Link = new Lang.Class({
Name: 'Link',
function Link(props) {
this._init(props);
}
Link.prototype = {
_init : function(props) {
let realProps = { reactive: true,
track_hover: true,
@ -17,5 +19,6 @@ const Link = new Lang.Class({
this.actor = new St.Button(realProps);
}
});
};
Signals.addSignalMethods(Link.prototype);

View File

@ -55,9 +55,11 @@ function _getAutoCompleteGlobalKeywords() {
return keywords.concat(windowProperties).concat(headerProperties);
}
const AutoComplete = new Lang.Class({
Name: 'AutoComplete',
function AutoComplete(entry) {
this._init(entry);
}
AutoComplete.prototype = {
_init: function(entry) {
this._entry = entry;
this._entry.connect('key-press-event', Lang.bind(this, this._entryKeyPressEvent));
@ -116,13 +118,15 @@ const AutoComplete = new Lang.Class({
this._entry.clutter_text.insert_text(additionalCompletionText, cursorPos);
}
});
};
Signals.addSignalMethods(AutoComplete.prototype);
const Notebook = new Lang.Class({
Name: 'Notebook',
function Notebook() {
this._init();
}
Notebook.prototype = {
_init: function() {
this.actor = new St.BoxLayout({ vertical: true });
@ -246,7 +250,7 @@ const Notebook = new Lang.Class({
this.selectIndex(prevIndex);
}
});
};
Signals.addSignalMethods(Notebook.prototype);
function objectToString(o) {
@ -258,9 +262,12 @@ function objectToString(o) {
}
}
const ObjLink = new Lang.Class({
Name: 'ObjLink',
Extends: Link.Link,
function ObjLink(o, title) {
this._init(o, title);
}
ObjLink.prototype = {
__proto__: Link.Link,
_init: function(o, title) {
let text;
@ -270,8 +277,7 @@ const ObjLink = new Lang.Class({
text = objectToString(o);
text = GLib.markup_escape_text(text, -1);
this._obj = o;
this.parent({ label: text });
Link.Link.prototype._init.call(this, { label: text });
this.actor.get_child().single_line_mode = true;
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
},
@ -279,11 +285,13 @@ const ObjLink = new Lang.Class({
_onClicked: function (link) {
Main.lookingGlass.inspectObject(this._obj, this.actor);
}
});
};
const Result = new Lang.Class({
Name: 'Result',
function Result(command, o, index) {
this._init(command, o, index);
}
Result.prototype = {
_init : function(command, o, index) {
this.index = index;
this.o = o;
@ -305,11 +313,13 @@ const Result = new Lang.Class({
padBin.add_actor(line);
this.actor.add(padBin);
}
});
};
const WindowList = new Lang.Class({
Name: 'WindowList',
function WindowList() {
this._init();
}
WindowList.prototype = {
_init : function () {
this.actor = new St.BoxLayout({ name: 'Windows', vertical: true, style: 'spacing: 8px' });
let tracker = Shell.WindowTracker.get_default();
@ -350,12 +360,14 @@ const WindowList = new Lang.Class({
}
}
}
});
};
Signals.addSignalMethods(WindowList.prototype);
const ObjInspector = new Lang.Class({
Name: 'ObjInspector',
function ObjInspector() {
this._init();
}
ObjInspector.prototype = {
_init : function () {
this._obj = null;
this._previousObj = null;
@ -455,7 +467,7 @@ const ObjInspector = new Lang.Class({
_onBack: function() {
this.selectObject(this._previousObj, true);
}
});
};
function addBorderPaintHook(actor) {
let signalId = actor.connect_after('paint',
@ -481,9 +493,11 @@ function addBorderPaintHook(actor) {
return signalId;
}
const Inspector = new Lang.Class({
Name: 'Inspector',
function Inspector() {
this._init();
}
Inspector.prototype = {
_init: function() {
let container = new Shell.GenericContainer({ width: 0,
height: 0 });
@ -622,13 +636,15 @@ const Inspector = new Lang.Class({
this._borderPaintId = addBorderPaintHook(this._target);
}
}
});
};
Signals.addSignalMethods(Inspector.prototype);
const ErrorLog = new Lang.Class({
Name: 'ErrorLog',
function ErrorLog() {
this._init();
}
ErrorLog.prototype = {
_init: function() {
this.actor = new St.BoxLayout();
this.text = new St.Label();
@ -663,11 +679,13 @@ const ErrorLog = new Lang.Class({
}
this.text.text = text;
}
});
};
const Memory = new Lang.Class({
Name: 'Memory',
function Memory() {
this._init();
}
Memory.prototype = {
_init: function() {
this.actor = new St.BoxLayout({ vertical: true });
this._glibc_uordblks = new St.Label();
@ -712,11 +730,13 @@ const Memory = new Lang.Class({
this._gjs_closure.text = 'gjs_closure: ' + memInfo.gjs_closure;
this._last_gc_seconds_ago.text = 'last_gc_seconds_ago: ' + memInfo.last_gc_seconds_ago;
}
});
};
const Extensions = new Lang.Class({
Name: 'Extensions',
function Extensions() {
this._init();
}
Extensions.prototype = {
_init: function() {
this.actor = new St.BoxLayout({ vertical: true,
name: 'lookingGlassExtensions' });
@ -846,11 +866,13 @@ const Extensions = new Lang.Class({
return box;
}
});
};
const LookingGlass = new Lang.Class({
Name: 'LookingGlass',
function LookingGlass() {
this._init();
}
LookingGlass.prototype = {
_init : function() {
this._borderPaintTarget = null;
this._borderPaintId = 0;
@ -867,8 +889,7 @@ const LookingGlass = new Lang.Class({
this.actor = new St.BoxLayout({ name: 'LookingGlassDialog',
style_class: 'lg-dialog',
vertical: true,
visible: false,
reactive: true });
visible: false });
this.actor.connect('key-press-event', Lang.bind(this, this._globalKeyPressEvent));
this._interfaceSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
@ -1207,5 +1228,5 @@ const LookingGlass = new Lang.Class({
})
});
}
});
};
Signals.addSignalMethods(LookingGlass.prototype);

View File

@ -36,9 +36,11 @@ const CROSS_HAIRS_CLIP_KEY = 'cross-hairs-clip';
let magDBusService = null;
const Magnifier = new Lang.Class({
Name: 'Magnifier',
function Magnifier() {
this._init();
}
Magnifier.prototype = {
_init: function() {
// Magnifier is a manager of ZoomRegions.
this._zoomRegions = [];
@ -541,12 +543,14 @@ const Magnifier = new Lang.Class({
);
}
}
});
};
Signals.addSignalMethods(Magnifier.prototype);
const ZoomRegion = new Lang.Class({
Name: 'ZoomRegion',
function ZoomRegion(magnifier, mouseSourceActor) {
this._init(magnifier, mouseSourceActor);
}
ZoomRegion.prototype = {
_init: function(magnifier, mouseSourceActor) {
this._magnifier = magnifier;
@ -1146,11 +1150,13 @@ const ZoomRegion = new Lang.Class({
yMagMouse - groupHeight / 2);
}
}
});
};
const Crosshairs = new Lang.Class({
Name: 'Crosshairs',
function Crosshairs() {
this._init();
}
Crosshairs.prototype = {
_init: function() {
// Set the group containing the crosshairs to three times the desktop
@ -1406,4 +1412,4 @@ const Crosshairs = new Lang.Class({
this._vertTopHair.set_position((groupWidth - thickness) / 2, top);
this._vertBottomHair.set_position((groupWidth - thickness) / 2, bottom);
}
});
};

View File

@ -1,7 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Gio = imports.gi.Gio;
const Lang = imports.lang;
const GLib = imports.gi.GLib;
const Main = imports.ui.main;
const MAG_SERVICE_NAME = 'org.gnome.Magnifier';
@ -96,9 +96,11 @@ const ZoomRegionIface = <interface name={ZOOM_SERVICE_NAME}>
// '/org/gnome/Magnifier/ZoomRegion/zoomer1', etc.
let _zoomRegionInstanceCount = 0;
const ShellMagnifier = new Lang.Class({
Name: 'ShellMagnifier',
function ShellMagnifier() {
this._init();
}
ShellMagnifier.prototype = {
_init: function() {
this._zoomers = {};
@ -324,7 +326,7 @@ const ShellMagnifier = new Lang.Class({
// Drop the leading '#'.
return parseInt(colorString.slice(1), 16);
}
});
};
/**
* ShellMagnifierZoomRegion:
@ -332,9 +334,11 @@ const ShellMagnifier = new Lang.Class({
* @zoomerObjectPath: String that is the path to a DBus ZoomRegion.
* @zoomRegion: The actual zoom region associated with the object path.
*/
const ShellMagnifierZoomRegion = new Lang.Class({
Name: 'ShellMagnifierZoomRegion',
function ShellMagnifierZoomRegion(zoomerObjectPath, zoomRegion) {
this._init(zoomerObjectPath, zoomRegion);
}
ShellMagnifierZoomRegion.prototype = {
_init: function(zoomerObjectPath, zoomRegion) {
this._zoomRegion = zoomRegion;
@ -419,4 +423,4 @@ const ShellMagnifierZoomRegion = new Lang.Class({
destroy: function() {
this._dbusImpl.unexport();
}
});
};

View File

@ -132,11 +132,15 @@ function _initUserSession() {
ExtensionSystem.init();
ExtensionSystem.loadExtensions();
Meta.keybindings_set_custom_handler('panel-run-dialog', function() {
let shellwm = global.window_manager;
shellwm.takeover_keybinding('panel-run-dialog');
shellwm.connect('keybinding::panel-run-dialog', function () {
getRunDialog().open();
});
Meta.keybindings_set_custom_handler('panel-main-menu', function () {
shellwm.takeover_keybinding('panel-main-menu');
shellwm.connect('keybinding::panel-main-menu', function () {
overview.toggle();
});

View File

@ -83,9 +83,11 @@ function _fixMarkup(text, allowMarkup) {
return GLib.markup_escape_text(text, -1);
}
const URLHighlighter = new Lang.Class({
Name: 'URLHighlighter',
function URLHighlighter(text, lineWrap, allowMarkup) {
this._init(text, lineWrap, allowMarkup);
}
URLHighlighter.prototype = {
_init: function(text, lineWrap, allowMarkup) {
if (!text)
text = '';
@ -209,11 +211,13 @@ const URLHighlighter = new Lang.Class({
}
return -1;
}
});
};
const FocusGrabber = new Lang.Class({
Name: 'FocusGrabber',
function FocusGrabber() {
this._init();
}
FocusGrabber.prototype = {
_init: function() {
this.actor = null;
@ -347,7 +351,7 @@ const FocusGrabber = new Lang.Class({
this._togglingFocusGrabMode = false;
}
}
});
}
Signals.addSignalMethods(FocusGrabber.prototype);
// Notification:
@ -404,9 +408,11 @@ Signals.addSignalMethods(FocusGrabber.prototype);
// the content and the action area of the notification will be cleared.
// The content area is also always cleared if 'customContent' is false
// because it might contain the @banner that didn't fit in the banner mode.
const Notification = new Lang.Class({
Name: 'Notification',
function Notification(source, title, banner, params) {
this._init(source, title, banner, params);
}
Notification.prototype = {
IMAGE_SIZE: 125,
_init: function(source, title, banner, params) {
@ -947,12 +953,14 @@ const Notification = new Lang.Class({
this.actor.destroy();
this.actor._delegate = null;
}
});
};
Signals.addSignalMethods(Notification.prototype);
const Source = new Lang.Class({
Name: 'MessageTraySource',
function Source(title) {
this._init(title);
}
Source.prototype = {
ICON_SIZE: 24,
_init: function(title) {
@ -1134,12 +1142,14 @@ const Source = new Lang.Class({
_lastNotificationRemoved: function() {
this.destroy();
}
});
};
Signals.addSignalMethods(Source.prototype);
const SummaryItem = new Lang.Class({
Name: 'SummaryItem',
function SummaryItem(source) {
this._init(source);
}
SummaryItem.prototype = {
_init: function(source) {
this.source = source;
this.source.connect('notification-added', Lang.bind(this, this._notificationAddedToSource));
@ -1330,12 +1340,14 @@ const SummaryItem = new Lang.Class({
if (this.notificationStack.get_children().length > 0)
this.notificationStack.get_children()[0]._delegate.setIconVisible(true);
}
});
};
Signals.addSignalMethods(SummaryItem.prototype);
const MessageTray = new Lang.Class({
Name: 'MessageTray',
function MessageTray() {
this._init();
}
MessageTray.prototype = {
_init: function() {
this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) {
this._onStatusChanged(proxy.status);
@ -2414,14 +2426,17 @@ const MessageTray = new Lang.Class({
if (this._clickedSummaryItem)
this._updateState();
}
});
};
const SystemNotificationSource = new Lang.Class({
Name: 'SystemNotificationSource',
Extends: Source,
function SystemNotificationSource() {
this._init();
}
SystemNotificationSource.prototype = {
__proto__: Source.prototype,
_init: function() {
this.parent(_("System Information"));
Source.prototype._init.call(this, _("System Information"));
this._setSummaryIcon(this.createNotificationIcon());
},
@ -2435,4 +2450,4 @@ const SystemNotificationSource = new Lang.Class({
open: function() {
this.destroy();
}
});
};

View File

@ -29,9 +29,11 @@ const State = {
FADED_OUT: 4
};
const ModalDialog = new Lang.Class({
Name: 'ModalDialog',
function ModalDialog() {
this._init();
}
ModalDialog.prototype = {
_init: function(params) {
params = Params.parse(params, { shellReactive: false,
styleClass: null });
@ -301,5 +303,5 @@ const ModalDialog = new Lang.Class({
})
});
}
});
};
Signals.addSignalMethods(ModalDialog.prototype);

View File

@ -32,12 +32,15 @@ const ModalDialog = imports.ui.modalDialog;
const PopupMenu = imports.ui.popupMenu;
const ShellEntry = imports.ui.shellEntry;
const NetworkSecretDialog = new Lang.Class({
Name: 'NetworkSecretDialog',
Extends: ModalDialog.ModalDialog,
function NetworkSecretDialog() {
this._init.apply(this, arguments);
}
NetworkSecretDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
_init: function(agent, requestId, connection, settingName, hints) {
this.parent({ styleClass: 'polkit-dialog' });
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'polkit-dialog' });
this._agent = agent;
this._requestId = requestId;
@ -355,11 +358,13 @@ const NetworkSecretDialog = new Lang.Class({
return content;
}
});
};
const NetworkAgent = new Lang.Class({
Name: 'NetworkAgent',
function NetworkAgent() {
this._init.apply(this, arguments);
}
NetworkAgent.prototype = {
_init: function() {
this._native = new Shell.NetworkAgent({ auto_register: true,
identifier: 'org.gnome.Shell.NetworkAgent' });
@ -382,4 +387,4 @@ const NetworkAgent = new Lang.Class({
this._dialogs[requestId].close(global.get_current_time());
this._dialogs[requestId].destroy();
}
});
};

View File

@ -87,9 +87,11 @@ const rewriteRules = {
]
};
const NotificationDaemon = new Lang.Class({
Name: 'NotificationDaemon',
function NotificationDaemon() {
this._init();
}
NotificationDaemon.prototype = {
_init: function() {
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(NotificationDaemonIface, this);
this._dbusImpl.export(Gio.DBus.session, '/org/freedesktop/Notifications');
@ -472,14 +474,17 @@ const NotificationDaemon = new Lang.Class({
if (source)
source.destroy();
}
});
};
const Source = new Lang.Class({
Name: 'NotificationDaemonSource',
Extends: MessageTray.Source,
function Source(title, pid, sender) {
this._init(title, pid, sender);
}
Source.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(title, pid, sender) {
this.parent(title);
MessageTray.Source.prototype._init.call(this, title);
this._pid = pid;
if (sender)
@ -601,6 +606,6 @@ const Source = new Lang.Class({
this._nameWatcherId = 0;
}
this.parent();
MessageTray.Source.prototype.destroy.call(this);
}
});
};

View File

@ -46,9 +46,11 @@ const SwipeScrollResult = {
CLICK: 2
};
const ShellInfo = new Lang.Class({
Name: 'ShellInfo',
function ShellInfo() {
this._init();
}
ShellInfo.prototype = {
_init: function() {
this._source = null;
this._undoCallback = null;
@ -93,11 +95,13 @@ const ShellInfo = new Lang.Class({
this._source.notify(notification);
}
});
};
const Overview = new Lang.Class({
Name: 'Overview',
function Overview() {
this._init.apply(this, arguments);
}
Overview.prototype = {
_init : function(params) {
params = Params.parse(params, { isDummy: false });
@ -807,5 +811,5 @@ const Overview = new Lang.Class({
this._needsFakePointerEvent = false;
}
}
});
};
Signals.addSignalMethods(Overview.prototype);

View File

@ -3,7 +3,6 @@
const Cairo = imports.cairo;
const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Pango = imports.gi.Pango;
@ -99,9 +98,11 @@ function _unpremultiply(color) {
};
const AnimatedIcon = new Lang.Class({
Name: 'AnimatedIcon',
function AnimatedIcon(name, size) {
this._init(name, size);
}
AnimatedIcon.prototype = {
_init: function(name, size) {
this.actor = new St.Bin({ visible: false });
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
@ -138,11 +139,13 @@ const AnimatedIcon = new Lang.Class({
if (this._timeoutId)
Mainloop.source_remove(this._timeoutId);
}
});
};
const TextShadower = new Lang.Class({
Name: 'TextShadower',
function TextShadower() {
this._init();
}
TextShadower.prototype = {
_init: function() {
this.actor = new Shell.GenericContainer();
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
@ -222,7 +225,7 @@ const TextShadower = new Lang.Class({
child.allocate(childBox, flags);
}
}
});
};
/**
* AppMenuButton:
@ -232,16 +235,17 @@ const TextShadower = new Lang.Class({
* this menu also handles startup notification for it. So when we
* have an active startup notification, we switch modes to display that.
*/
const AppMenuButton = new Lang.Class({
Name: 'AppMenuButton',
Extends: PanelMenu.Button,
function AppMenuButton() {
this._init();
}
_init: function(menuManager) {
this.parent(0.0, true);
AppMenuButton.prototype = {
__proto__: PanelMenu.Button.prototype,
_init: function() {
PanelMenu.Button.prototype._init.call(this, 0.0);
this._startingApps = [];
this._menuManager = menuManager;
this._targetApp = null;
let bin = new St.Bin({ name: 'appMenu' });
@ -267,6 +271,10 @@ const AppMenuButton = new Lang.Class({
this._iconBottomClip = 0;
this._quitMenu = new PopupMenu.PopupMenuItem('');
this.menu.addMenuItem(this._quitMenu);
this._quitMenu.connect('activate', Lang.bind(this, this._onQuit));
this._visible = !Main.overview.visible;
if (!this._visible)
this.actor.hide();
@ -445,6 +453,12 @@ const AppMenuButton = new Lang.Class({
}
},
_onQuit: function() {
if (this._targetApp == null)
return;
this._targetApp.request_quit();
},
_onAppStateChanged: function(appSys, app) {
let state = app.state;
if (state != Shell.AppState.STARTING) {
@ -506,10 +520,8 @@ const AppMenuButton = new Lang.Class({
}
if (targetApp == this._targetApp) {
if (targetApp && targetApp.get_state() != Shell.AppState.STARTING) {
if (targetApp && targetApp.get_state() != Shell.AppState.STARTING)
this.stopAnimation();
this._maybeSetMenu();
}
return;
}
@ -523,54 +535,33 @@ const AppMenuButton = new Lang.Class({
let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);
this._label.setText(targetApp.get_name());
// TODO - _quit() doesn't really work on apps in state STARTING yet
this._quitMenu.label.set_text(_("Quit %s").format(targetApp.get_name()));
this._iconBox.set_child(icon);
this._iconBox.show();
if (targetApp.get_state() == Shell.AppState.STARTING)
this.startAnimation();
else
this._maybeSetMenu();
this.emit('changed');
},
_maybeSetMenu: function() {
let menu;
if (this._targetApp.action_group) {
if (this.menu instanceof PopupMenu.RemoteMenu &&
this.menu.actionGroup == this._targetApp.action_group)
return;
menu = new PopupMenu.RemoteMenu(this.actor, this._targetApp.menu, this._targetApp.action_group);
} else {
if (this.menu && !(this.menu instanceof PopupMenu.RemoteMenu))
return;
// fallback to older menu
menu = new PopupMenu.PopupMenu(this.actor, 0.0, St.Side.TOP, 0);
menu.addAction(_("Quit"), Lang.bind(this, function() {
this._targetApp.request_quit();
}));
}
this.setMenu(menu);
this._menuManager.addMenu(menu);
}
});
};
Signals.addSignalMethods(AppMenuButton.prototype);
// Activities button. Because everything else in the top bar is a
// PanelMenu.Button, it simplifies some things to make this be one too.
// We just hack it up to not actually have a menu attached to it.
const ActivitiesButton = new Lang.Class({
Name: 'ActivitiesButton',
Extends: PanelMenu.Button,
function ActivitiesButton() {
this._init.apply(this, arguments);
}
ActivitiesButton.prototype = {
__proto__: PanelMenu.Button.prototype,
_init: function() {
this.parent(0.0);
PanelMenu.Button.prototype._init.call(this, 0.0);
let container = new Shell.GenericContainer();
container.connect('get-preferred-width', Lang.bind(this, this._containerGetPreferredWidth));
@ -707,11 +698,13 @@ const ActivitiesButton = new Lang.Class({
Mainloop.source_remove(this._xdndTimeOut);
this._xdndTimeOut = 0;
}
});
};
const PanelCorner = new Lang.Class({
Name: 'PanelCorner',
function PanelCorner(panel, side) {
this._init(panel, side);
}
PanelCorner.prototype = {
_init: function(box, side) {
this._side = side;
@ -887,12 +880,14 @@ const PanelCorner = new Lang.Class({
this.actor.set_size(cornerRadius, innerBorderWidth + cornerRadius);
this.actor.set_anchor_point(0, innerBorderWidth);
}
});
};
const Panel = new Lang.Class({
Name: 'Panel',
function Panel() {
this._init();
}
Panel.prototype = {
_init : function() {
this.actor = new Shell.GenericContainer({ name: 'panel',
reactive: true });
@ -943,8 +938,9 @@ const Panel = new Lang.Class({
// more cleanly with the rest of the panel
this._menus.addMenu(this._activitiesButton.menu);
this._appMenu = new AppMenuButton(this._menus);
this._appMenu = new AppMenuButton();
this._leftBox.add(this._appMenu.actor);
this._menus.addMenu(this._appMenu.menu);
}
/* center */
@ -1118,4 +1114,5 @@ const Panel = new Lang.Class({
if (box && box._delegate instanceof PanelMenu.ButtonBox)
box.destroy();
},
});
};

View File

@ -11,9 +11,11 @@ const Main = imports.ui.main;
const Params = imports.misc.params;
const PopupMenu = imports.ui.popupMenu;
const ButtonBox = new Lang.Class({
Name: 'ButtonBox',
function ButtonBox(params) {
this._init.apply(this, arguments);
};
ButtonBox.prototype = {
_init: function(params) {
params = Params.parse(params, { style_class: 'panel-button' }, true);
this.actor = new Shell.GenericContainer(params);
@ -90,45 +92,31 @@ const ButtonBox = new Lang.Class({
child.allocate(childBox, flags);
},
});
}
const Button = new Lang.Class({
Name: 'PanelMenuButton',
Extends: ButtonBox,
function Button(menuAlignment) {
this._init(menuAlignment);
}
_init: function(menuAlignment, dontCreateMenu) {
this.parent({ reactive: true,
can_focus: true,
track_hover: true });
Button.prototype = {
__proto__: ButtonBox.prototype,
_init: function(menuAlignment) {
ButtonBox.prototype._init.call(this, { reactive: true,
can_focus: true,
track_hover: true });
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
this.actor.connect('key-press-event', Lang.bind(this, this._onSourceKeyPress));
if (dontCreateMenu)
this.menu = null;
else
this.setMenu(new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP, 0));
},
setMenu: function(menu) {
if (this.menu)
this.menu.destroy();
this.menu = menu;
if (this.menu) {
this.menu.actor.add_style_class_name('panel-menu');
this.menu.connect('open-state-changed', Lang.bind(this, this._onOpenStateChanged));
this.menu.actor.connect('key-press-event', Lang.bind(this, this._onMenuKeyPress));
Main.uiGroup.add_actor(this.menu.actor);
this.menu.actor.hide();
}
this.menu = new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP);
this.menu.actor.add_style_class_name('panel-menu');
this.menu.connect('open-state-changed', Lang.bind(this, this._onOpenStateChanged));
this.menu.actor.connect('key-press-event', Lang.bind(this, this._onMenuKeyPress));
Main.uiGroup.add_actor(this.menu.actor);
this.menu.actor.hide();
},
_onButtonPress: function(actor, event) {
if (!this.menu)
return;
if (!this.menu.isOpen) {
// Setting the max-height won't do any good if the minimum height of the
// menu is higher then the screen; it's useful if part of the menu is
@ -142,9 +130,6 @@ const Button = new Lang.Class({
},
_onSourceKeyPress: function(actor, event) {
if (!this.menu)
return false;
let symbol = event.get_key_symbol();
if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) {
this.menu.toggle();
@ -190,7 +175,7 @@ const Button = new Lang.Class({
this.emit('destroy');
}
});
};
Signals.addSignalMethods(Button.prototype);
/* SystemStatusButton:
@ -199,13 +184,15 @@ Signals.addSignalMethods(Button.prototype);
* volume, bluetooth...), which is just a PanelMenuButton with an
* icon and a tooltip
*/
const SystemStatusButton = new Lang.Class({
Name: 'SystemStatusButton',
Extends: Button,
function SystemStatusButton() {
this._init.apply(this, arguments);
}
SystemStatusButton.prototype = {
__proto__: Button.prototype,
_init: function(iconName,tooltipText) {
this.parent(0.0);
Button.prototype._init.call(this, 0.0);
this._iconActor = new St.Icon({ icon_name: iconName,
icon_type: St.IconType.SYMBOLIC,
style_class: 'system-status-icon' });
@ -232,4 +219,4 @@ const SystemStatusButton = new Lang.Class({
this.tooltip = null;
}
}
});
};

View File

@ -22,9 +22,11 @@ const Util = imports.misc.util;
* @iconFactory: A JavaScript callback which will create an icon texture given a size parameter
* @launch: A JavaScript callback to launch the entry
*/
const PlaceInfo = new Lang.Class({
Name: 'PlaceInfo',
function PlaceInfo(id, name, iconFactory, launch) {
this._init(id, name, iconFactory, launch);
}
PlaceInfo.prototype = {
_init: function(id, name, iconFactory, launch) {
this.id = id;
this.name = name;
@ -53,7 +55,7 @@ const PlaceInfo = new Lang.Class({
isRemovable: function() {
return false;
}
});
};
// Helper function to translate launch parameters into a GAppLaunchContext
function _makeLaunchContext(params)
@ -70,9 +72,12 @@ function _makeLaunchContext(params)
return launchContext;
}
const PlaceDeviceInfo = new Lang.Class({
Name: 'PlaceDeviceInfo',
Extends: PlaceInfo,
function PlaceDeviceInfo(mount) {
this._init(mount);
}
PlaceDeviceInfo.prototype = {
__proto__: PlaceInfo.prototype,
_init: function(mount) {
this._mount = mount;
@ -118,11 +123,13 @@ const PlaceDeviceInfo = new Lang.Class({
_("Retry"));
}
}
});
};
const PlacesManager = new Lang.Class({
Name: 'PlacesManager',
function PlacesManager() {
this._init();
}
PlacesManager.prototype = {
_init: function() {
this._defaultPlaces = [];
this._mounts = [];
@ -353,15 +360,19 @@ const PlacesManager = new Lang.Class({
_removeById: function(sourceArray, id) {
sourceArray.splice(this._lookupIndexById(sourceArray, id), 1);
}
});
};
Signals.addSignalMethods(PlacesManager.prototype);
const PlaceSearchProvider = new Lang.Class({
Name: 'PlaceSearchProvider',
Extends: Search.SearchProvider,
function PlaceSearchProvider() {
this._init();
}
PlaceSearchProvider.prototype = {
__proto__: Search.SearchProvider.prototype,
_init: function() {
this.parent(_("PLACES & DEVICES"));
Search.SearchProvider.prototype._init.call(this, _("PLACES & DEVICES"));
},
getResultMeta: function(resultId) {
@ -423,4 +434,4 @@ const PlaceSearchProvider = new Lang.Class({
let places = previousResults.map(function (id) { return Main.placesManager.lookupPlaceById(id); });
return this._searchPlaces(places, terms);
}
});
};

View File

@ -27,7 +27,6 @@ const AccountsService = imports.gi.AccountsService;
const Clutter = imports.gi.Clutter;
const St = imports.gi.St;
const Pango = imports.gi.Pango;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const Mainloop = imports.mainloop;
const Polkit = imports.gi.Polkit;
@ -36,12 +35,15 @@ const PolkitAgent = imports.gi.PolkitAgent;
const ModalDialog = imports.ui.modalDialog;
const ShellEntry = imports.ui.shellEntry;
const AuthenticationDialog = new Lang.Class({
Name: 'AuthenticationDialog',
Extends: ModalDialog.ModalDialog,
function AuthenticationDialog(actionId, message, cookie, userNames) {
this._init(actionId, message, cookie, userNames);
}
AuthenticationDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
_init: function(actionId, message, cookie, userNames) {
this.parent({ styleClass: 'polkit-dialog' });
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'polkit-dialog' });
this.actionId = actionId;
this.message = message;
@ -86,14 +88,10 @@ const AuthenticationDialog = new Lang.Class({
if (userNames.length > 1) {
log('polkitAuthenticationAgent: Received ' + userNames.length +
' identities that can be used for authentication. Only ' +
'considering one.');
'considering the first one.');
}
let userName = GLib.get_user_name();
if (userNames.indexOf(userName) < 0)
userName = 'root';
if (userNames.indexOf(userName) < 0)
userName = userNames[0];
let userName = userNames[0];
this._user = AccountsService.UserManager.get_default().get_user(userName);
let userRealName = this._user.get_real_name()
@ -332,12 +330,15 @@ const AuthenticationDialog = new Lang.Class({
this.close(global.get_current_time());
this._emitDone(false, true);
},
});
};
Signals.addSignalMethods(AuthenticationDialog.prototype);
const AuthenticationAgent = new Lang.Class({
Name: 'AuthenticationAgent',
function AuthenticationAgent() {
this._init();
}
AuthenticationAgent.prototype = {
_init: function() {
this._native = new Shell.PolkitAuthenticationAgent();
this._native.connect('initiate', Lang.bind(this, this._onInitiate));
@ -398,7 +399,7 @@ const AuthenticationAgent = new Lang.Class({
this._reallyCompleteRequest(wasDismissed);
}
}
});
}
function init() {
let agent = new AuthenticationAgent();

View File

@ -2,9 +2,7 @@
const Cairo = imports.cairo;
const Clutter = imports.gi.Clutter;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
const Gio = imports.gi.Gio;
const Lang = imports.lang;
const Shell = imports.gi.Shell;
const Signals = imports.signals;
@ -28,9 +26,11 @@ function _ensureStyle(actor) {
actor.ensure_style();
}
const PopupBaseMenuItem = new Lang.Class({
Name: 'PopupBaseMenuItem',
function PopupBaseMenuItem(params) {
this._init(params);
}
PopupBaseMenuItem.prototype = {
_init: function (params) {
params = Params.parse (params, { reactive: true,
activate: true,
@ -377,27 +377,33 @@ const PopupBaseMenuItem = new Lang.Class({
x -= availWidth + this._spacing;
}
}
});
};
Signals.addSignalMethods(PopupBaseMenuItem.prototype);
const PopupMenuItem = new Lang.Class({
Name: 'PopupMenuItem',
Extends: PopupBaseMenuItem,
function PopupMenuItem() {
this._init.apply(this, arguments);
}
PopupMenuItem.prototype = {
__proto__: PopupBaseMenuItem.prototype,
_init: function (text, params) {
this.parent(params);
PopupBaseMenuItem.prototype._init.call(this, params);
this.label = new St.Label({ text: text });
this.addActor(this.label);
}
});
};
const PopupSeparatorMenuItem = new Lang.Class({
Name: 'PopupSeparatorMenuItem',
Extends: PopupBaseMenuItem,
function PopupSeparatorMenuItem() {
this._init();
}
PopupSeparatorMenuItem.prototype = {
__proto__: PopupBaseMenuItem.prototype,
_init: function () {
this.parent({ reactive: false });
PopupBaseMenuItem.prototype._init.call(this, { reactive: false });
this._drawingArea = new St.DrawingArea({ style_class: 'popup-separator-menu-item' });
this.addActor(this._drawingArea, { span: -1, expand: true });
@ -423,19 +429,22 @@ const PopupSeparatorMenuItem = new Lang.Class({
cr.rectangle(margin, gradientOffset, gradientWidth, gradientHeight);
cr.fill();
}
});
};
const PopupAlternatingMenuItemState = {
DEFAULT: 0,
ALTERNATIVE: 1
}
const PopupAlternatingMenuItem = new Lang.Class({
Name: 'PopupAlternatingMenuItem',
Extends: PopupBaseMenuItem,
function PopupAlternatingMenuItem() {
this._init.apply(this, arguments);
}
PopupAlternatingMenuItem.prototype = {
__proto__: PopupBaseMenuItem.prototype,
_init: function(text, alternateText, params) {
this.parent(params);
PopupBaseMenuItem.prototype._init.call(this, params);
this.actor.add_style_class_name('popup-alternating-menu-item');
this._text = text;
@ -521,14 +530,17 @@ const PopupAlternatingMenuItem = new Lang.Class({
this._updateLabel();
}
});
};
const PopupSliderMenuItem = new Lang.Class({
Name: 'PopupSliderMenuItem',
Extends: PopupBaseMenuItem,
function PopupSliderMenuItem() {
this._init.apply(this, arguments);
}
PopupSliderMenuItem.prototype = {
__proto__: PopupBaseMenuItem.prototype,
_init: function(value) {
this.parent({ activate: false });
PopupBaseMenuItem.prototype._init.call(this, { activate: false });
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
@ -704,11 +716,13 @@ const PopupSliderMenuItem = new Lang.Class({
}
return false;
}
});
};
const Switch = new Lang.Class({
Name: 'Switch',
function Switch() {
this._init.apply(this, arguments);
}
Switch.prototype = {
_init: function(state) {
this.actor = new St.Bin({ style_class: 'toggle-switch' });
// Translators: this MUST be either "toggle-switch-us"
@ -731,14 +745,17 @@ const Switch = new Lang.Class({
toggle: function() {
this.setToggleState(!this.state);
}
});
};
const PopupSwitchMenuItem = new Lang.Class({
Name: 'PopupSwitchMenuItem',
Extends: PopupBaseMenuItem,
function PopupSwitchMenuItem() {
this._init.apply(this, arguments);
}
PopupSwitchMenuItem.prototype = {
__proto__: PopupBaseMenuItem.prototype,
_init: function(text, active, params) {
this.parent(params);
PopupBaseMenuItem.prototype._init.call(this, params);
this.label = new St.Label({ text: text });
this._switch = new Switch(active);
@ -773,7 +790,7 @@ const PopupSwitchMenuItem = new Lang.Class({
this.toggle();
}
this.parent(event);
PopupBaseMenuItem.prototype.activate.call(this, event);
},
toggle: function() {
@ -788,14 +805,17 @@ const PopupSwitchMenuItem = new Lang.Class({
setToggleState: function(state) {
this._switch.setToggleState(state);
}
});
};
const PopupImageMenuItem = new Lang.Class({
Name: 'PopupImageMenuItem',
Extends: PopupBaseMenuItem,
function PopupImageMenuItem() {
this._init.apply(this, arguments);
}
PopupImageMenuItem.prototype = {
__proto__: PopupBaseMenuItem.prototype,
_init: function (text, iconName, params) {
this.parent(params);
PopupBaseMenuItem.prototype._init.call(this, params);
this.label = new St.Label({ text: text });
this.addActor(this.label);
@ -808,12 +828,13 @@ const PopupImageMenuItem = new Lang.Class({
setIcon: function(name) {
this._icon.icon_name = name;
}
});
};
const PopupMenuBase = new Lang.Class({
Name: 'PopupMenuBase',
Abstract: true,
function PopupMenuBase() {
throw new TypeError('Trying to instantiate abstract class PopupMenuBase');
}
PopupMenuBase.prototype = {
_init: function(sourceActor, styleClass) {
this.sourceActor = sourceActor;
@ -1118,15 +1139,18 @@ const PopupMenuBase = new Lang.Class({
this.emit('destroy');
}
});
};
Signals.addSignalMethods(PopupMenuBase.prototype);
const PopupMenu = new Lang.Class({
Name: 'PopupMenu',
Extends: PopupMenuBase,
function PopupMenu() {
this._init.apply(this, arguments);
}
PopupMenu.prototype = {
__proto__: PopupMenuBase.prototype,
_init: function(sourceActor, arrowAlignment, arrowSide) {
this.parent(sourceActor, 'popup-menu-content');
PopupMenuBase.prototype._init.call (this, sourceActor, 'popup-menu-content');
this._arrowAlignment = arrowAlignment;
this._arrowSide = arrowSide;
@ -1211,14 +1235,17 @@ const PopupMenu = new Lang.Class({
this.isOpen = false;
this.emit('open-state-changed', false);
}
});
};
const PopupSubMenu = new Lang.Class({
Name: 'PopupSubMenu',
Extends: PopupMenuBase,
function PopupSubMenu() {
this._init.apply(this, arguments);
}
PopupSubMenu.prototype = {
__proto__: PopupMenuBase.prototype,
_init: function(sourceActor, sourceArrow) {
this.parent(sourceActor);
PopupMenuBase.prototype._init.call(this, sourceActor);
this._arrow = sourceArrow;
this._arrow.rotation_center_z_gravity = Clutter.Gravity.CENTER;
@ -1373,7 +1400,7 @@ const PopupSubMenu = new Lang.Class({
return false;
}
});
};
/**
* PopupMenuSection:
@ -1383,12 +1410,15 @@ const PopupSubMenu = new Lang.Class({
* can add it to another menu), but is completely transparent
* to the user
*/
const PopupMenuSection = new Lang.Class({
Name: 'PopupMenuSection',
Extends: PopupMenuBase,
function PopupMenuSection() {
this._init.apply(this, arguments);
}
PopupMenuSection.prototype = {
__proto__: PopupMenuBase.prototype,
_init: function() {
this.parent();
PopupMenuBase.prototype._init.call(this);
this.actor = this.box;
this.actor._delegate = this;
@ -1399,14 +1429,17 @@ const PopupMenuSection = new Lang.Class({
// corresponding signal so children can still pick it up
open: function(animate) { this.emit('open-state-changed', true); },
close: function() { this.emit('open-state-changed', false); },
});
}
const PopupSubMenuMenuItem = new Lang.Class({
Name: 'PopupSubMenuMenuItem',
Extends: PopupBaseMenuItem,
function PopupSubMenuMenuItem() {
this._init.apply(this, arguments);
}
PopupSubMenuMenuItem.prototype = {
__proto__: PopupBaseMenuItem.prototype,
_init: function(text) {
this.parent();
PopupBaseMenuItem.prototype._init.call(this);
this.actor.add_style_class_name('popup-submenu-menu-item');
@ -1428,8 +1461,7 @@ const PopupSubMenuMenuItem = new Lang.Class({
destroy: function() {
this.menu.destroy();
this.parent();
PopupBaseMenuItem.prototype.destroy.call(this);
},
_onKeyPressEvent: function(actor, event) {
@ -1444,7 +1476,7 @@ const PopupSubMenuMenuItem = new Lang.Class({
return true;
}
return this.parent(actor, event);
return PopupBaseMenuItem.prototype._onKeyPressEvent.call(this, actor, event);
},
activate: function(event) {
@ -1454,15 +1486,18 @@ const PopupSubMenuMenuItem = new Lang.Class({
_onButtonReleaseEvent: function(actor) {
this.menu.toggle();
}
});
};
const PopupComboMenu = new Lang.Class({
Name: 'PopupComboMenu',
Extends: PopupMenuBase,
function PopupComboMenu() {
this._init.apply(this, arguments);
}
PopupComboMenu.prototype = {
__proto__: PopupMenuBase.prototype,
_init: function(sourceActor) {
this.parent(sourceActor, 'popup-combo-menu');
PopupMenuBase.prototype._init.call(this,
sourceActor, 'popup-combo-menu');
this.actor = this.box;
this.actor._delegate = this;
this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent));
@ -1567,14 +1602,17 @@ const PopupComboMenu = new Lang.Class({
getItemVisible: function(position) {
return this._getMenuItems()[position].actor.visible;
}
});
};
const PopupComboBoxMenuItem = new Lang.Class({
Name: 'PopupComboBoxMenuItem',
Extends: PopupBaseMenuItem,
function PopupComboBoxMenuItem() {
this._init.apply(this, arguments);
}
PopupComboBoxMenuItem.prototype = {
__proto__: PopupBaseMenuItem.prototype,
_init: function (params) {
this.parent(params);
PopupBaseMenuItem.prototype._init.call(this, params);
this._itemBox = new Shell.Stack();
this.addActor(this._itemBox);
@ -1692,262 +1730,16 @@ const PopupComboBoxMenuItem = new Lang.Class({
this.setActiveItem(position);
this.emit('active-item-changed', position);
}
});
/**
* RemoteMenu:
*
* A PopupMenu that tracks a GMenuModel and shows its actions
* (exposed by GApplication/GActionGroup)
*/
const RemoteMenu = new Lang.Class({
Name: 'RemoteMenu',
Extends: PopupMenu,
_init: function(sourceActor, model, actionGroup) {
this.parent(sourceActor, 0.0, St.Side.TOP);
this.model = model;
this.actionGroup = actionGroup;
this._actions = { };
this._modelChanged(this.model, 0, 0, this.model.get_n_items(), this);
this._actionStateChangeId = this.actionGroup.connect('action-state-changed', Lang.bind(this, this._actionStateChanged));
this._actionEnableChangeId = this.actionGroup.connect('action-enabled-changed', Lang.bind(this, this._actionEnabledChanged));
},
destroy: function() {
if (this._actionStateChangeId) {
this.actionGroup.disconnect(this._actionStateChangeId);
this._actionStateChangeId = 0;
}
if (this._actionEnableChangeId) {
this.actionGroup.disconnect(this._actionEnableChangeId);
this._actionEnableChangeId = 0;
}
this.parent();
},
_createMenuItem: function(model, index) {
let section_link = model.get_item_link(index, Gio.MENU_LINK_SECTION);
if (section_link) {
let item = new PopupMenuSection();
this._modelChanged(section_link, 0, 0, section_link.get_n_items(), item);
return [item, true, ''];
}
// labels are not checked for existance, as they're required for all items
let label = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_LABEL, null).deep_unpack();
// remove all underscores that are not followed by another underscore
label = label.replace(/_([^_])/, '$1');
let submenu_link = model.get_item_link(index, Gio.MENU_LINK_SUBMENU);
if (submenu_link) {
let item = new PopupSubMenuMenuItem(label);
this._modelChanged(submenu_link, 0, 0, submenu_link.get_n_items(), item.menu);
return [item, false, ''];
}
let action_id = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_ACTION, null).deep_unpack();
if (!this.actionGroup.has_action(action_id)) {
// the action may not be there yet, wait for action-added
return [null, false, 'action-added'];
}
if (!this._actions[action_id])
this._actions[action_id] = { enabled: this.actionGroup.get_action_enabled(action_id),
state: this.actionGroup.get_action_state(action_id),
items: [ ],
};
let action = this._actions[action_id];
let item, target, destroyId, specificSignalId;
if (action.state) {
// Docs have get_state_hint(), except that the DBus protocol
// has no provision for it (so ShellApp does not implement it,
// and neither GApplication), and g_action_get_state_hint()
// always returns null
// Funny :)
switch (String.fromCharCode(action.state.classify())) {
case 'b':
item = new PopupSwitchMenuItem(label, action.state.get_boolean());
action.items.push(item);
specificSignalId = item.connect('toggled', Lang.bind(this, function(item) {
this.actionGroup.change_action_state(action_id, GLib.Variant.new_boolean(item.state));
}));
break;
case 'd':
item = new PopupSliderMenuItem(label, action.state.get_double());
action.items.push(item);
// value-changed is emitted for each motion-event, maybe an idle is more appropriate here?
specificSignalId = item.connect('value-changed', Lang.bind(this, function(item) {
this.actionGroup.change_action_state(action_id, GLib.Variant.new_double(item.value));
}));
break;
case 's':
item = new PopupMenuItem(label);
item._remoteTarget = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_TARGET, null).deep_unpack();
action.items.push(item);
item.setShowDot(action.state.deep_unpack() == item._remoteTarget);
specificSignalId = item.connect('activate', Lang.bind(this, function(item) {
this.actionGroup.change_action_state(action_id, GLib.Variant.new_string(item._remoteTarget));
}));
break;
default:
log('Action "%s" has state of type %s, which is not supported'.format(action_id, action.state.get_type_string()));
return [null, false, 'action-state-changed'];
}
} else {
target = model.get_item_attribute_value(index, Gio.MENU_ATTRIBUTE_TARGET, null);
item = new PopupMenuItem(label);
action.items.push(item);
specificSignalId = item.connect('activate', Lang.bind(this, function() {
this.actionGroup.activate_action(action_id, target);
}));
}
item.actor.reactive = item.actor.can_focus = action.enabled;
if (action.enabled)
item.actor.remove_style_pseudo_class('insensitive');
else
item.actor.add_style_pseudo_class('insensitive');
destroyId = item.connect('destroy', Lang.bind(this, function() {
item.disconnect(destroyId);
item.disconnect(specificSignalId);
let pos = action.items.indexOf(item);
if (pos != -1)
action.items.splice(pos, 1);
}));
return [item, false, ''];
},
_modelChanged: function(model, position, removed, added, target) {
let j, k;
let j0, k0;
let currentItems = target._getMenuItems();
for (j0 = 0, k0 = 0; j0 < position; j0++, k0++) {
if (currentItems[k0] instanceof PopupSeparatorMenuItem)
k0++;
}
if (removed == -1) {
// special flag to indicate we should destroy everything
for (k = k0; k < currentItems.length; k++)
currentItems[k].destroy();
} else {
for (j = j0, k = k0; j < j0 + removed; j++, k++) {
currentItems[k].destroy();
if (currentItems[k] instanceof PopupSeparatorMenuItem)
j--;
}
}
for (j = j0, k = k0; j < j0 + added; j++, k++) {
let [item, addSeparator, changeSignal] = this._createMenuItem(model, j);
if (item) {
// separators must be added in the parent to make autohiding work
if (addSeparator) {
target.addMenuItem(new PopupSeparatorMenuItem(), k+1);
k++;
}
target.addMenuItem(item, k);
if (addSeparator) {
target.addMenuItem(new PopupSeparatorMenuItem(), k+1);
k++;
}
} else if (changeSignal) {
let signalId = this.actionGroup.connect(changeSignal, Lang.bind(this, function() {
this.actionGroup.disconnect(signalId);
// force a full update
this._modelChanged(model, 0, -1, model.get_n_items(), target);
}));
}
}
if (!model._changedId) {
model._changedId = model.connect('items-changed', Lang.bind(this, this._modelChanged, target));
model._destroyId = target.connect('destroy', function() {
if (model._changedId)
model.disconnect(model._changedId);
if (model._destroyId)
target.disconnect(model._destroyId);
model._changedId = 0;
model._destroyId = 0;
});
}
if (target instanceof PopupMenuSection) {
target.actor.visible = target.numMenuItems != 0;
} else {
let sourceItem = target.sourceActor._delegate;
if (sourceItem instanceof PopupSubMenuMenuItem)
sourceItem.actor.visible = target.numMenuItems != 0;
}
},
_actionStateChanged: function(actionGroup, action_id) {
let action = this._actions[action_id];
if (!action)
return;
action.state = actionGroup.get_action_state(action_id);
if (action.items.length) {
switch (String.fromCharCode(action.state.classify())) {
case 'b':
for (let i = 0; i < action.items.length; i++)
action.items[i].setToggleState(action.state.get_boolean());
break;
case 'd':
for (let i = 0; i < action.items.length; i++)
action.items[i].setValue(action.state.get_double());
break;
case 's':
for (let i = 0; i < action.items.length; i++)
action.items[i].setShowDot(action.items[i]._remoteTarget == action.state.deep_unpack());
}
}
},
_actionEnabledChanged: function(actionGroup, action_id) {
let action = this._actions[action_id];
if (!action)
return;
action.enabled = actionGroup.get_action_enabled(action_id);
if (action.items.length) {
for (let i = 0; i < action.items.length; i++) {
let item = action.items[i];
item.actor.reactive = item.actor.can_focus = action.enabled;
if (action.enabled)
item.actor.remove_style_pseudo_class('insensitive');
else
item.actor.add_style_pseudo_class('insensitive');
}
}
}
});
};
/* Basic implementation of a menu manager.
* Call addMenu to add menus
*/
const PopupMenuManager = new Lang.Class({
Name: 'PopupMenuManager',
function PopupMenuManager(owner) {
this._init(owner);
}
PopupMenuManager.prototype = {
_init: function(owner) {
this._owner = owner;
this.grabbed = false;
@ -2219,4 +2011,4 @@ const PopupMenuManager = new Lang.Class({
if (this._activeMenu != null)
this._activeMenu.close(true);
}
});
};

View File

@ -30,9 +30,11 @@ const EXEC_ARG_KEY = 'exec-arg';
const DIALOG_GROW_TIME = 0.1;
const CommandCompleter = new Lang.Class({
Name: 'CommandCompleter',
function CommandCompleter() {
this._init();
}
CommandCompleter.prototype = {
_init : function() {
this._changedCount = 0;
this._paths = GLib.getenv('PATH').split(':');
@ -160,14 +162,16 @@ const CommandCompleter = new Lang.Class({
return common.substr(text.length);
return common;
}
});
};
const RunDialog = new Lang.Class({
Name: 'RunDialog',
Extends: ModalDialog.ModalDialog,
function RunDialog() {
this._init();
}
RunDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
_init : function() {
this.parent({ styleClass: 'run-dialog' });
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'run-dialog' });
this._lockdownSettings = new Gio.Settings({ schema: LOCKDOWN_SCHEMA });
this._terminalSettings = new Gio.Settings({ schema: TERMINAL_SCHEMA });
@ -380,7 +384,8 @@ const RunDialog = new Lang.Class({
if (this._lockdownSettings.get_boolean(DISABLE_COMMAND_LINE_KEY))
return;
this.parent();
ModalDialog.ModalDialog.prototype.open.call(this);
},
});
};
Signals.addSignalMethods(RunDialog.prototype);

View File

@ -23,9 +23,11 @@ const MatchType = {
MULTIPLE_PREFIX: 4
};
const SearchResultDisplay = new Lang.Class({
Name: 'SearchResultDisplay',
function SearchResultDisplay(provider) {
this._init(provider);
}
SearchResultDisplay.prototype = {
_init: function(provider) {
this.provider = provider;
this.actor = null;
@ -94,7 +96,7 @@ const SearchResultDisplay = new Lang.Class({
activateSelected: function() {
throw new Error('Not implemented');
}
});
};
/**
* SearchProvider:
@ -103,9 +105,11 @@ const SearchResultDisplay = new Lang.Class({
* to the search system, then call registerProvider()
* in SearchSystem with an instance.
*/
const SearchProvider = new Lang.Class({
Name: 'SearchProvider',
function SearchProvider(title) {
this._init(title);
}
SearchProvider.prototype = {
_init: function(title) {
this.title = title;
this.searchSystem = null;
@ -239,12 +243,14 @@ const SearchProvider = new Lang.Class({
activateResult: function(id) {
throw new Error('Not implemented');
}
});
};
Signals.addSignalMethods(SearchProvider.prototype);
const OpenSearchSystem = new Lang.Class({
Name: 'OpenSearchSystem',
function OpenSearchSystem() {
this._init();
}
OpenSearchSystem.prototype = {
_init: function() {
this._providers = [];
global.settings.connect('changed::' + DISABLED_OPEN_SEARCH_PROVIDERS_KEY, Lang.bind(this, this._refresh));
@ -332,12 +338,14 @@ const OpenSearchSystem = new Lang.Class({
}
}));
}
});
}
Signals.addSignalMethods(OpenSearchSystem.prototype);
const SearchSystem = new Lang.Class({
Name: 'SearchSystem',
function SearchSystem() {
this._init();
}
SearchSystem.prototype = {
_init: function() {
this._providers = [];
this.reset();
@ -425,5 +433,5 @@ const SearchSystem = new Lang.Class({
this._previousResults = results;
this.emit('search-completed', results);
},
});
};
Signals.addSignalMethods(SearchSystem.prototype);

View File

@ -15,9 +15,11 @@ const Search = imports.ui.search;
const MAX_SEARCH_RESULTS_ROWS = 1;
const SearchResult = new Lang.Class({
Name: 'SearchResult',
function SearchResult(provider, metaInfo, terms) {
this._init(provider, metaInfo, terms);
}
SearchResult.prototype = {
_init: function(provider, metaInfo, terms) {
this.provider = provider;
this.metaInfo = metaInfo;
@ -95,16 +97,18 @@ const SearchResult = new Lang.Class({
else
this.provider.activateResult(this.metaInfo.id, params);
}
});
};
const GridSearchResults = new Lang.Class({
Name: 'GridSearchResults',
Extends: Search.SearchResultDisplay,
function GridSearchResults(provider, grid) {
this._init(provider, grid);
}
GridSearchResults.prototype = {
__proto__: Search.SearchResultDisplay.prototype,
_init: function(provider, grid) {
this.parent(provider);
Search.SearchResultDisplay.prototype._init.call(this, provider);
this._grid = grid || new IconGrid.IconGrid({ rowLimit: MAX_SEARCH_RESULTS_ROWS,
xAlign: St.Align.START });
this.actor = new St.Bin({ x_align: St.Align.START });
@ -175,11 +179,14 @@ const GridSearchResults = new Lang.Class({
let targetActor = this._grid.getItemAtIndex(this.selectionIndex);
targetActor._delegate.activate();
}
});
};
const SearchResults = new Lang.Class({
Name: 'SearchResults',
function SearchResults(searchSystem, openSearchSystem) {
this._init(searchSystem, openSearchSystem);
}
SearchResults.prototype = {
_init: function(searchSystem, openSearchSystem) {
this._searchSystem = searchSystem;
this._searchSystem.connect('search-updated', Lang.bind(this, this._updateCurrentResults));
@ -479,4 +486,4 @@ const SearchResults = new Lang.Class({
resultDisplay.activateSelected();
Main.overview.hide();
}
});
};

View File

@ -66,9 +66,11 @@ const GnomeShellIface = <interface name="org.gnome.Shell">
</signal>
</interface>;
const GnomeShell = new Lang.Class({
Name: 'GnomeShellDBus',
function GnomeShell() {
this._init();
}
GnomeShell.prototype = {
_init: function() {
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(GnomeShellIface, this);
this._dbusImpl.export(Gio.DBus.session, '/org/gnome/Shell');
@ -154,7 +156,7 @@ const GnomeShell = new Lang.Class({
},
ListExtensions: function() {
let out = {};
let out;
for (let uuid in ExtensionSystem.extensionMeta) {
let dbusObj = this.GetExtensionInfo(uuid);
out[uuid] = dbusObj;
@ -164,19 +166,19 @@ const GnomeShell = new Lang.Class({
GetExtensionInfo: function(uuid) {
let meta = ExtensionSystem.extensionMeta[uuid] || {};
let out = {};
let out;
for (let key in meta) {
let val = meta[key];
let type;
switch (typeof val) {
case 'object':
throw Error('Extension had a nested object in the metadata. This is not supported');
case 'string':
type = 's';
break;
case 'number':
type = 'd';
break;
default:
continue;
}
out[key] = GLib.Variant.new(type, val);
}
@ -228,4 +230,4 @@ const GnomeShell = new Lang.Class({
this._dbusImpl.emit_signal('ExtensionStatusChanged',
GLib.Variant.new('(sis)', [newState.uuid, newState.state, newState.error]));
}
});
};

View File

@ -7,14 +7,18 @@ const Main = imports.ui.main;
const Params = imports.misc.params;
const PopupMenu = imports.ui.popupMenu;
const _EntryMenu = new Lang.Class({
Name: 'ShellEntryMenu',
Extends: PopupMenu.PopupMenu,
function _EntryMenu(entry, params) {
this._init(entry, params);
};
_EntryMenu.prototype = {
__proto__: PopupMenu.PopupMenu.prototype,
_init: function(entry, params) {
params = Params.parse (params, { isPassword: false });
this.parent(entry, 0, St.Side.TOP);
PopupMenu.PopupMenu.prototype._init.call(this, entry, 0, St.Side.TOP);
this.actor.add_style_class_name('entry-context-menu');
@ -56,7 +60,7 @@ const _EntryMenu = new Lang.Class({
if (!this.actor.navigate_focus(null, direction, false))
this.actor.grab_key_focus();
this.parent();
PopupMenu.PopupMenu.prototype.open.call(this);
},
_updateCopyItem: function() {
@ -99,7 +103,8 @@ const _EntryMenu = new Lang.Class({
let visible = !!(this._entry.clutter_text.password_char);
this._entry.clutter_text.set_password_char(visible ? '' : '\u25cf');
}
});
};
function _setMenuAlignment(entry, stageX) {
let [success, entryX, entryY] = entry.transform_stage_point(stageX, 0);

View File

@ -50,9 +50,11 @@ function _setLabelsForMessage(dialog, message) {
/* -------------------------------------------------------- */
const ListItem = new Lang.Class({
Name: 'ListItem',
function ListItem(app) {
this._init(app);
}
ListItem.prototype = {
_init: function(app) {
this._app = app;
@ -84,12 +86,14 @@ const ListItem = new Lang.Class({
this.emit('activate');
this._app.activate();
}
});
};
Signals.addSignalMethods(ListItem.prototype);
const ShellMountOperation = new Lang.Class({
Name: 'ShellMountOperation',
function ShellMountOperation(source, params) {
this._init(source, params);
}
ShellMountOperation.prototype = {
_init: function(source, params) {
params = Params.parse(params, { reaskPassword: false });
@ -186,14 +190,17 @@ const ShellMountOperation = new Lang.Class({
this._processesDialog.update(message, processes, choices);
},
});
}
const ShellMountQuestionDialog = new Lang.Class({
Name: 'ShellMountQuestionDialog',
Extends: ModalDialog.ModalDialog,
function ShellMountQuestionDialog(icon) {
this._init(icon);
}
ShellMountQuestionDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
_init: function(icon) {
this.parent({ styleClass: 'mount-question-dialog' });
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'mount-question-dialog' });
let mainContentLayout = new St.BoxLayout();
this.contentLayout.add(mainContentLayout, { x_fill: true,
@ -229,16 +236,19 @@ const ShellMountQuestionDialog = new Lang.Class({
_setLabelsForMessage(this, message);
_setButtonsForChoices(this, choices);
}
});
}
Signals.addSignalMethods(ShellMountQuestionDialog.prototype);
const ShellMountPasswordSource = new Lang.Class({
Name: 'ShellMountPasswordSource',
Extends: MessageTray.Source,
function ShellMountPasswordSource(message, icon, reaskPassword) {
this._init(message, icon, reaskPassword);
}
ShellMountPasswordSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(message, icon, reaskPassword) {
let strings = message.split('\n');
this.parent(strings[0]);
MessageTray.Source.prototype._init.call(this, strings[0]);
this._notification = new ShellMountPasswordNotification(this, strings, icon, reaskPassword);
@ -246,15 +256,21 @@ const ShellMountPasswordSource = new Lang.Class({
Main.messageTray.add(this);
this.notify(this._notification);
},
});
}
Signals.addSignalMethods(ShellMountPasswordSource.prototype);
const ShellMountPasswordNotification = new Lang.Class({
Name: 'ShellMountPasswordNotification',
Extends: MessageTray.Notification,
function ShellMountPasswordNotification(source, strings, icon, reaskPassword) {
this._init(source, strings, icon, reaskPassword);
}
ShellMountPasswordNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, strings, icon, reaskPassword) {
this.parent(source, strings[0], null, { customContent: true, icon: icon });
MessageTray.Notification.prototype._init.call(this, source,
strings[0], null,
{ customContent: true,
icon: icon });
// set the notification to transient and urgent, so that it
// expands out
@ -289,14 +305,17 @@ const ShellMountPasswordNotification = new Lang.Class({
this.source.emit('password-ready', text);
}
});
}
const ShellProcessesDialog = new Lang.Class({
Name: 'ShellProcessesDialog',
Extends: ModalDialog.ModalDialog,
function ShellProcessesDialog(icon) {
this._init(icon);
}
ShellProcessesDialog.prototype = {
__proto__: ModalDialog.ModalDialog.prototype,
_init: function(icon) {
this.parent({ styleClass: 'show-processes-dialog' });
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'show-processes-dialog' });
let mainContentLayout = new St.BoxLayout();
this.contentLayout.add(mainContentLayout, { x_fill: true,
@ -382,5 +401,5 @@ const ShellProcessesDialog = new Lang.Class({
_setLabelsForMessage(this, message);
_setButtonsForChoices(this, choices);
}
});
}
Signals.addSignalMethods(ShellProcessesDialog.prototype);

View File

@ -1,5 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const DBus = imports.dbus;
const GDesktopEnums = imports.gi.GDesktopEnums;
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
@ -39,12 +40,15 @@ const KEY_TEXT_SCALING_FACTOR = 'text-scaling-factor';
const HIGH_CONTRAST_THEME = 'HighContrast';
const ATIndicator = new Lang.Class({
Name: 'ATIndicator',
Extends: PanelMenu.SystemStatusButton,
function ATIndicator() {
this._init.apply(this, arguments);
}
ATIndicator.prototype = {
__proto__: PanelMenu.SystemStatusButton.prototype,
_init: function() {
this.parent('preferences-desktop-accessibility', null);
PanelMenu.SystemStatusButton.prototype._init.call(this, 'preferences-desktop-accessibility', null);
let highContrast = this._buildHCItem();
this.menu.addMenuItem(highContrast);
@ -168,4 +172,5 @@ const ATIndicator = new Lang.Class({
});
return widget;
}
});
};
Signals.addSignalMethods(ATIndicator.prototype);

View File

@ -23,12 +23,15 @@ const ConnectionState = {
CONNECTING: 3
}
const Indicator = new Lang.Class({
Name: 'BTIndicator',
Extends: PanelMenu.SystemStatusButton,
function Indicator() {
this._init.apply(this, arguments);
}
Indicator.prototype = {
__proto__: PanelMenu.SystemStatusButton.prototype,
_init: function() {
this.parent('bluetooth-disabled', null);
PanelMenu.SystemStatusButton.prototype._init.call(this, 'bluetooth-disabled', null);
GLib.spawn_command_line_sync ('pkill -f "^bluetooth-applet$"');
this._applet = new GnomeBluetoothApplet.Applet();
@ -332,14 +335,17 @@ const Indicator = new Lang.Class({
_cancelRequest: function() {
this._source.destroy();
}
});
}
const Source = new Lang.Class({
Name: 'BluetoothSource',
Extends: MessageTray.Source,
function Source() {
this._init.apply(this, arguments);
}
Source.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function() {
this.parent(_("Bluetooth"));
MessageTray.Source.prototype._init.call(this, _("Bluetooth"));
this._setSummaryIcon(this.createNotificationIcon());
},
@ -353,7 +359,7 @@ const Source = new Lang.Class({
}
}));
this.parent(notification);
MessageTray.Source.prototype.notify.call(this, notification);
},
createNotificationIcon: function() {
@ -361,17 +367,21 @@ const Source = new Lang.Class({
icon_type: St.IconType.SYMBOLIC,
icon_size: this.ICON_SIZE });
}
});
}
const AuthNotification = new Lang.Class({
Name: 'AuthNotification',
Extends: MessageTray.Notification,
function AuthNotification() {
this._init.apply(this, arguments);
}
AuthNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, applet, device_path, name, long_name, uuid) {
this.parent(source,
_("Bluetooth"),
_("Authorization request from %s").format(name),
{ customContent: true });
MessageTray.Notification.prototype._init.call(this,
source,
_("Bluetooth"),
_("Authorization request from %s").format(name),
{ customContent: true });
this.setResident(true);
this._applet = applet;
@ -397,17 +407,21 @@ const AuthNotification = new Lang.Class({
this.destroy();
}));
}
});
}
const ConfirmNotification = new Lang.Class({
Name: 'ConfirmNotification',
Extends: MessageTray.Notification,
function ConfirmNotification() {
this._init.apply(this, arguments);
}
ConfirmNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, applet, device_path, name, long_name, pin) {
this.parent(source,
_("Bluetooth"),
_("Pairing confirmation for %s").format(name),
{ customContent: true });
MessageTray.Notification.prototype._init.call(this,
source,
_("Bluetooth"),
_("Pairing confirmation for %s").format(name),
{ customContent: true });
this.setResident(true);
this._applet = applet;
@ -426,17 +440,21 @@ const ConfirmNotification = new Lang.Class({
this.destroy();
}));
}
});
}
const PinNotification = new Lang.Class({
Name: 'PinNotification',
Extends: MessageTray.Notification,
function PinNotification() {
this._init.apply(this, arguments);
}
PinNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, applet, device_path, name, long_name, numeric) {
this.parent(source,
_("Bluetooth"),
_("Pairing request for %s").format(name),
{ customContent: true });
MessageTray.Notification.prototype._init.call(this,
source,
_("Bluetooth"),
_("Pairing request for %s").format(name),
{ customContent: true });
this.setResident(true);
this._applet = applet;
@ -485,7 +503,7 @@ const PinNotification = new Lang.Class({
},
grabFocus: function(lockTray) {
this.parent(lockTray);
MessageTray.Notification.prototype.grabFocus.call(this, lockTray);
global.stage.set_key_focus(this._entry);
}
});
}

View File

@ -14,12 +14,15 @@ const PopupMenu = imports.ui.popupMenu;
const PanelMenu = imports.ui.panelMenu;
const Util = imports.misc.util;
const LayoutMenuItem = new Lang.Class({
Name: 'LayoutMenuItem',
Extends: PopupMenu.PopupBaseMenuItem,
function LayoutMenuItem() {
this._init.apply(this, arguments);
}
LayoutMenuItem.prototype = {
__proto__: PopupMenu.PopupBaseMenuItem.prototype,
_init: function(config, id, indicator, long_name) {
this.parent();
PopupMenu.PopupBaseMenuItem.prototype._init.call(this);
this._config = config;
this._id = id;
@ -30,18 +33,20 @@ const LayoutMenuItem = new Lang.Class({
},
activate: function(event) {
this.parent(event);
PopupMenu.PopupBaseMenuItem.prototype.activate.call(this);
this._config.lock_group(this._id);
}
});
};
const XKBIndicator = new Lang.Class({
Name: 'XKBIndicator',
Extends: PanelMenu.Button,
function XKBIndicator() {
this._init.call(this);
}
XKBIndicator.prototype = {
__proto__: PanelMenu.Button.prototype,
_init: function() {
this.parent(0.0);
PanelMenu.Button.prototype._init.call(this, St.Align.START);
this._container = new Shell.GenericContainer();
this._container.connect('get-preferred-width', Lang.bind(this, this._containerGetPreferredWidth));
@ -216,4 +221,4 @@ const XKBIndicator = new Lang.Class({
for (let i = 0; i < this._labelActors.length; i++)
this._labelActors[i].allocate_align_fill(box, 0.5, 0, false, false, flags);
}
});
};

View File

@ -1,6 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const ByteArray = imports.byteArray;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
@ -97,12 +98,15 @@ function ssidToLabel(ssid) {
return label;
}
const NMNetworkMenuItem = new Lang.Class({
Name: 'NMNetworkMenuItem',
Extends: PopupMenu.PopupBaseMenuItem,
function NMNetworkMenuItem() {
this._init.apply(this, arguments);
}
NMNetworkMenuItem.prototype = {
__proto__: PopupMenu.PopupBaseMenuItem.prototype,
_init: function(accessPoints, title, params) {
this.parent(params);
PopupMenu.PopupBaseMenuItem.prototype._init.call(this, params);
accessPoints = sortAccessPoints(accessPoints);
this.bestAP = accessPoints[0];
@ -181,18 +185,21 @@ const NMNetworkMenuItem = new Lang.Class({
apObj.updateId = 0;
}
this.parent();
PopupMenu.PopupBaseMenuItem.prototype.destroy.call(this);
}
});
};
const NMWiredSectionTitleMenuItem = new Lang.Class({
Name: 'NMWiredSectionTitleMenuItem',
Extends: PopupMenu.PopupSwitchMenuItem,
function NMWiredSectionTitleMenuItem() {
this._init.apply(this, arguments);
}
NMWiredSectionTitleMenuItem.prototype = {
__proto__: PopupMenu.PopupSwitchMenuItem.prototype,
_init: function(label, params) {
params = params || { };
params.style_class = 'popup-subtitle-menu-item';
this.parent(label, false, params);
PopupMenu.PopupSwitchMenuItem.prototype._init.call(this, label, false, params);
},
updateForDevice: function(device) {
@ -205,7 +212,7 @@ const NMWiredSectionTitleMenuItem = new Lang.Class({
},
activate: function(event) {
this.parent(event);
PopupMenu.PopupSwitchMenuItem.prototype.activate.call(this, event);
if (!this._device) {
log('Section title activated when there is more than one device, should be non reactive');
@ -224,16 +231,19 @@ const NMWiredSectionTitleMenuItem = new Lang.Class({
else
this._device.deactivate();
}
});
};
const NMWirelessSectionTitleMenuItem = new Lang.Class({
Name: 'NMWirelessSectionTitleMenuItem',
Extends: PopupMenu.PopupSwitchMenuItem,
function NMWirelessSectionTitleMenuItem() {
this._init.apply(this, arguments);
}
NMWirelessSectionTitleMenuItem.prototype = {
__proto__: PopupMenu.PopupSwitchMenuItem.prototype,
_init: function(client, property, title, params) {
params = params || { };
params.style_class = 'popup-subtitle-menu-item';
this.parent(title, false, params);
PopupMenu.PopupSwitchMenuItem.prototype._init.call(this, title, false, params);
this._client = client;
this._property = property + '_enabled';
@ -259,7 +269,7 @@ const NMWirelessSectionTitleMenuItem = new Lang.Class({
},
activate: function(event) {
this.parent(event);
PopupMenu.PopupSwitchMenuItem.prototype.activate.call(this, event);
this._client[this._setEnabledFunc](this._switch.state);
},
@ -276,12 +286,13 @@ const NMWirelessSectionTitleMenuItem = new Lang.Class({
this.emit('enabled-changed', enabled);
}
});
};
const NMDevice = new Lang.Class({
Name: 'NMDevice',
Abstract: true,
function NMDevice() {
throw new TypeError('Instantanting abstract class NMDevice');
}
NMDevice.prototype = {
_init: function(client, device, connections) {
this.device = device;
if (device) {
@ -663,23 +674,26 @@ const NMDevice = new Lang.Class({
return out;
}
});
};
Signals.addSignalMethods(NMDevice.prototype);
const NMDeviceWired = new Lang.Class({
Name: 'NMDeviceWired',
Extends: NMDevice,
function NMDeviceWired() {
this._init.apply(this, arguments);
}
NMDeviceWired.prototype = {
__proto__: NMDevice.prototype,
_init: function(client, device, connections) {
this._autoConnectionName = _("Auto Ethernet");
this.category = NMConnectionCategory.WIRED;
this.parent(client, device, connections);
NMDevice.prototype._init.call(this, client, device, connections);
},
_createSection: function() {
this.parent();
NMDevice.prototype._createSection.call(this);
// if we have only one connection (normal or automatic)
// we hide the connection list, and use the switch to control
@ -704,11 +718,14 @@ const NMDeviceWired = new Lang.Class({
}));
return connection;
}
});
};
const NMDeviceModem = new Lang.Class({
Name: 'NMDeviceModem',
Extends: NMDevice,
function NMDeviceModem() {
this._init.apply(this, arguments);
}
NMDeviceModem.prototype = {
__proto__: NMDevice.prototype,
_init: function(client, device, connections) {
let is_wwan = false;
@ -757,7 +774,7 @@ const NMDeviceModem = new Lang.Class({
}));
}
this.parent(client, device, connections);
NMDevice.prototype._init.call(this, client, device, connections);
},
setEnabled: function(enabled) {
@ -770,7 +787,7 @@ const NMDeviceModem = new Lang.Class({
this.statusItem.setStatus(this.getStatusLabel());
}
this.parent(enabled);
NMDevice.prototype.setEnabled.call(this, enabled);
},
get connected() {
@ -787,7 +804,7 @@ const NMDeviceModem = new Lang.Class({
this._signalQualityId = 0;
}
this.parent();
NMDevice.prototype.destroy.call(this);
},
_getSignalIcon: function() {
@ -808,13 +825,13 @@ const NMDeviceModem = new Lang.Class({
this.section.addMenuItem(this._operatorItem);
}
this.parent();
NMDevice.prototype._createSection.call(this);
},
_clearSection: function() {
this._operatorItem = null;
this.parent();
NMDevice.prototype._clearSection.call(this);
},
_createAutomaticConnection: function() {
@ -824,11 +841,14 @@ const NMDeviceModem = new Lang.Class({
'connect-3g', this.device.get_path()]);
return null;
}
});
};
const NMDeviceBluetooth = new Lang.Class({
Name: 'NMDeviceBluetooth',
Extends: NMDevice,
function NMDeviceBluetooth() {
this._init.apply(this, arguments);
}
NMDeviceBluetooth.prototype = {
__proto__: NMDevice.prototype,
_init: function(client, device, connections) {
this._autoConnectionName = this._makeConnectionName(device);
@ -836,7 +856,7 @@ const NMDeviceBluetooth = new Lang.Class({
this.category = NMConnectionCategory.WWAN;
this.parent(client, device, connections);
NMDevice.prototype._init.call(this, client, device, connections);
},
_createAutomaticConnection: function() {
@ -866,20 +886,23 @@ const NMDeviceBluetooth = new Lang.Class({
this._clearSection();
this._createSection();
}
});
};
// Not a real device, but I save a lot code this way
const NMDeviceVPN = new Lang.Class({
Name: 'NMDeviceVPN',
Extends: NMDevice,
function NMDeviceVPN() {
this._init.apply(this, arguments);
}
NMDeviceVPN.prototype = {
__proto__: NMDevice.prototype,
_init: function(client) {
// Disable autoconnections
this._autoConnectionName = null;
this.category = NMConnectionCategory.VPN;
this.parent(client, null, [ ]);
NMDevice.prototype._init.call(this, client, null, [ ]);
},
connectionValid: function(connection) {
@ -895,7 +918,7 @@ const NMDeviceVPN = new Lang.Class({
},
setActiveConnection: function(activeConnection) {
this.parent(activeConnection);
NMDevice.prototype.setActiveConnection.call(this, activeConnection);
this.emit('active-connection-changed');
},
@ -912,11 +935,14 @@ const NMDeviceVPN = new Lang.Class({
getStatusLabel: function() {
return null;
}
});
};
const NMDeviceWireless = new Lang.Class({
Name: 'NMDeviceWireless',
Extends: NMDevice,
function NMDeviceWireless() {
this._init.apply(this, arguments);
}
NMDeviceWireless.prototype = {
__proto__: NMDevice.prototype,
_init: function(client, device, connections) {
this.category = NMConnectionCategory.WIRELESS;
@ -988,7 +1014,7 @@ const NMDeviceWireless = new Lang.Class({
this._apAddedId = device.connect('access-point-added', Lang.bind(this, this._accessPointAdded));
this._apRemovedId = device.connect('access-point-removed', Lang.bind(this, this._accessPointRemoved));
this.parent(client, device, validConnections);
NMDevice.prototype._init.call(this, client, device, validConnections);
},
destroy: function() {
@ -1008,7 +1034,7 @@ const NMDeviceWireless = new Lang.Class({
this._apRemovedId = 0;
}
this.parent();
NMDevice.prototype.destroy.call(this);
},
setEnabled: function(enabled) {
@ -1322,7 +1348,7 @@ const NMDeviceWireless = new Lang.Class({
},
_clearSection: function() {
this.parent();
NMDevice.prototype._clearSection.call(this);
for (let i = 0; i < this._networks.length; i++)
this._networks[i].item = null;
@ -1530,14 +1556,16 @@ const NMDeviceWireless = new Lang.Class({
this._createNetworkItem(apObj, j + activeOffset);
}
},
});
};
const NMApplet = new Lang.Class({
Name: 'NMApplet',
Extends: PanelMenu.SystemStatusButton,
function NMApplet() {
this._init.apply(this, arguments);
}
NMApplet.prototype = {
__proto__: PanelMenu.SystemStatusButton.prototype,
_init: function() {
this.parent('network-error', null);
PanelMenu.SystemStatusButton.prototype._init.call(this, 'network-error');
this._client = NMClient.Client.new();
@ -2103,14 +2131,17 @@ const NMApplet = new Lang.Class({
this._mobileUpdateId = 0;
}
}
});
};
const NMMessageTraySource = new Lang.Class({
Name: 'NMMessageTraySource',
Extends: MessageTray.Source,
function NMMessageTraySource() {
this._init();
}
NMMessageTraySource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function() {
this.parent(_("Network Manager"));
MessageTray.Source.prototype._init.call(this, _("Network Manager"));
let icon = new St.Icon({ icon_name: 'network-transmit-receive',
icon_type: St.IconType.SYMBOLIC,
@ -2118,4 +2149,4 @@ const NMMessageTraySource = new Lang.Class({
});
this._setSummaryIcon(icon);
}
});
};

View File

@ -1,6 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Shell = imports.gi.Shell;
@ -52,13 +53,15 @@ const PowerManagerInterface = <interface name="org.gnome.SettingsDaemon.Power">
const PowerManagerProxy = Gio.DBusProxy.makeProxyWrapper(PowerManagerInterface);
const Indicator = new Lang.Class({
Name: 'PowerIndicator',
Extends: PanelMenu.SystemStatusButton,
function Indicator() {
this._init.apply(this, arguments);
}
Indicator.prototype = {
__proto__: PanelMenu.SystemStatusButton.prototype,
_init: function() {
this.parent('battery-missing', null);
PanelMenu.SystemStatusButton.prototype._init.call(this, 'battery-missing');
this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH);
this._deviceItems = [ ];
@ -161,14 +164,17 @@ const Indicator = new Lang.Class({
this._readPrimaryDevice();
this._readOtherDevices();
}
});
};
const DeviceItem = new Lang.Class({
Name: 'DeviceItem',
Extends: PopupMenu.PopupBaseMenuItem,
function DeviceItem() {
this._init.apply(this, arguments);
}
DeviceItem.prototype = {
__proto__: PopupMenu.PopupBaseMenuItem.prototype,
_init: function(device) {
this.parent({ reactive: false });
PopupMenu.PopupBaseMenuItem.prototype._init.call(this, { reactive: false });
let [device_id, device_type, icon, percentage, state, time] = device;
@ -215,4 +221,4 @@ const DeviceItem = new Lang.Class({
return _("Unknown");
}
}
});
}

View File

@ -17,12 +17,15 @@ const VOLUME_ADJUSTMENT_STEP = 0.05; /* Volume adjustment step in % */
const VOLUME_NOTIFY_ID = 1;
const Indicator = new Lang.Class({
Name: 'VolumeIndicator',
Extends: PanelMenu.SystemStatusButton,
function Indicator() {
this._init.apply(this, arguments);
}
Indicator.prototype = {
__proto__: PanelMenu.SystemStatusButton.prototype,
_init: function() {
this.parent('audio-volume-muted', null);
PanelMenu.SystemStatusButton.prototype._init.call(this, 'audio-volume-muted', null);
this._control = new Gvc.MixerControl({ name: 'GNOME Shell Volume Control' });
this._control.connect('state-changed', Lang.bind(this, this._onControlStateChanged));
@ -211,4 +214,4 @@ const Indicator = new Lang.Class({
if (property == '_output' && !this._output.is_muted)
this.setIcon(this._volumeToIcon(this._output.volume));
}
});
};

View File

@ -23,9 +23,11 @@ const STANDARD_TRAY_ICON_IMPLEMENTATIONS = {
'ibus-ui-gtk': 'input-method'
};
const StatusIconDispatcher = new Lang.Class({
Name: 'StatusIconDispatcher',
function StatusIconDispatcher() {
this._init();
}
StatusIconDispatcher.prototype = {
_init: function() {
this._traymanager = new Shell.TrayManager();
this._traymanager.connect('tray-icon-added', Lang.bind(this, this._onTrayIconAdded));
@ -59,5 +61,5 @@ const StatusIconDispatcher = new Lang.Class({
else
this.emit('message-icon-removed', icon);
}
});
};
Signals.addSignalMethods(StatusIconDispatcher.prototype);

View File

@ -72,9 +72,11 @@ function makeMessageFromTplEvent(event) {
};
}
const Client = new Lang.Class({
Name: 'Client',
function Client() {
this._init();
};
Client.prototype = {
_init : function() {
// channel path -> ChatSource
this._chatSources = {};
@ -477,14 +479,17 @@ const Client = new Lang.Class({
return this._accountSource;
}
});
};
const ChatSource = new Lang.Class({
Name: 'ChatSource',
Extends: MessageTray.Source,
function ChatSource(account, conn, channel, contact, client) {
this._init(account, conn, channel, contact, client);
}
ChatSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(account, conn, channel, contact, client) {
this.parent(contact.get_alias());
MessageTray.Source.prototype._init.call(this, contact.get_alias());
this.isChat = true;
@ -692,7 +697,7 @@ const ChatSource = new Lang.Class({
},
notify: function() {
this.parent(this._notification);
MessageTray.Source.prototype.notify.call(this, this._notification);
},
respond: function(text) {
@ -793,14 +798,17 @@ const ChatSource = new Lang.Class({
this._shouldAck = false;
}
});
};
const ChatNotification = new Lang.Class({
Name: 'ChatNotification',
Extends: MessageTray.Notification,
function ChatNotification(source) {
this._init(source);
}
ChatNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source) {
this.parent(source, source.title, null, { customContent: true });
MessageTray.Notification.prototype._init.call(this, source, source.title, null, { customContent: true });
this.setResident(true);
this._responseEntry = new St.Entry({ style_class: 'chat-response',
@ -1083,14 +1091,17 @@ const ChatNotification = new Lang.Class({
this.source.setChatState(Tp.ChannelChatState.ACTIVE);
}
}
});
};
const ApproverSource = new Lang.Class({
Name: 'ApproverSource',
Extends: MessageTray.Source,
function ApproverSource(dispatchOp, text, gicon) {
this._init(dispatchOp, text, gicon);
}
ApproverSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(dispatchOp, text, gicon) {
this.parent(text);
MessageTray.Source.prototype._init.call(this, text);
this._gicon = gicon;
this._setSummaryIcon(this.createNotificationIcon());
@ -1111,7 +1122,7 @@ const ApproverSource = new Lang.Class({
this._invalidId = 0;
}
this.parent();
MessageTray.Source.prototype.destroy.call(this);
},
createNotificationIcon: function() {
@ -1119,19 +1130,23 @@ const ApproverSource = new Lang.Class({
icon_type: St.IconType.FULLCOLOR,
icon_size: this.ICON_SIZE });
}
});
}
const RoomInviteNotification = new Lang.Class({
Name: 'RoomInviteNotification',
Extends: MessageTray.Notification,
function RoomInviteNotification(source, dispatchOp, channel, inviter) {
this._init(source, dispatchOp, channel, inviter);
}
RoomInviteNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, dispatchOp, channel, inviter) {
this.parent(source,
/* translators: argument is a room name like
* room@jabber.org for example. */
_("Invitation to %s").format(channel.get_identifier()),
null,
{ customContent: true });
MessageTray.Notification.prototype._init.call(this,
source,
/* translators: argument is a room name like
* room@jabber.org for example. */
_("Invitation to %s").format(channel.get_identifier()),
null,
{ customContent: true });
this.setResident(true);
/* translators: first argument is the name of a contact and the second
@ -1158,12 +1173,15 @@ const RoomInviteNotification = new Lang.Class({
this.destroy();
}));
}
});
};
// Audio Video
const AudioVideoNotification = new Lang.Class({
Name: 'AudioVideoNotification',
Extends: MessageTray.Notification,
function AudioVideoNotification(source, dispatchOp, channel, contact, isVideo) {
this._init(source, dispatchOp, channel, contact, isVideo);
}
AudioVideoNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, dispatchOp, channel, contact, isVideo) {
let title = '';
@ -1175,7 +1193,11 @@ const AudioVideoNotification = new Lang.Class({
/* translators: argument is a contact name like Alice for example. */
title = _("Call from %s").format(contact.get_alias());
this.parent(this, source, title, null, { customContent: true });
MessageTray.Notification.prototype._init.call(this,
source,
title,
null,
{ customContent: true });
this.setResident(true);
this.addButton('reject', _("Reject"));
@ -1198,25 +1220,28 @@ const AudioVideoNotification = new Lang.Class({
this.destroy();
}));
}
});
};
// File Transfer
const FileTransferNotification = new Lang.Class({
Name: 'FileTransferNotification',
Extends: MessageTray.Notification,
function FileTransferNotification(source, dispatchOp, channel, contact) {
this._init(source, dispatchOp, channel, contact);
}
FileTransferNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, dispatchOp, channel, contact) {
this.parent(this,
source,
/* To translators: The first parameter is
* the contact's alias and the second one is the
* file name. The string will be something
* like: "Alice is sending you test.ogg"
*/
_("%s is sending you %s").format(contact.get_alias(),
channel.get_filename()),
null,
{ customContent: true });
MessageTray.Notification.prototype._init.call(this,
source,
/* To translators: The first parameter is
* the contact's alias and the second one is the
* file name. The string will be something
* like: "Alice is sending you test.ogg"
*/
_("%s is sending you %s").format(contact.get_alias(),
channel.get_filename()),
null,
{ customContent: true });
this.setResident(true);
this.addButton('decline', _("Decline"));
@ -1238,15 +1263,18 @@ const FileTransferNotification = new Lang.Class({
this.destroy();
}));
}
});
};
// A notification source that can embed multiple notifications
const MultiNotificationSource = new Lang.Class({
Name: 'MultiNotificationSource',
Extends: MessageTray.Source,
function MultiNotificationSource(title, icon) {
this._init(title, icon);
}
MultiNotificationSource.prototype = {
__proto__: MessageTray.Source.prototype,
_init: function(title, icon) {
this.parent(title);
MessageTray.Source.prototype._init.call(this, title);
this._icon = icon;
this._setSummaryIcon(this.createNotificationIcon());
@ -1254,7 +1282,7 @@ const MultiNotificationSource = new Lang.Class({
},
notify: function(notification) {
this.parent(notification);
MessageTray.Source.prototype.notify.call(this, notification);
this._nbNotifications += 1;
@ -1272,18 +1300,21 @@ const MultiNotificationSource = new Lang.Class({
icon_type: St.IconType.FULLCOLOR,
icon_size: this.ICON_SIZE });
}
});
};
// Subscription request
const SubscriptionRequestNotification = new Lang.Class({
Name: 'SubscriptionRequestNotification',
Extends: MessageTray.Notification,
function SubscriptionRequestNotification(source, contact) {
this._init(source, contact);
}
SubscriptionRequestNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, contact) {
this.parent(this, source,
/* To translators: The parameter is the contact's alias */
_("%s would like permission to see when you are online").format(contact.get_alias()),
null, { customContent: true });
MessageTray.Notification.prototype._init.call(this, source,
/* To translators: The parameter is the contact's alias */
_("%s would like permission to see when you are online").format(contact.get_alias()),
null, { customContent: true });
this._contact = contact;
this._connection = contact.get_connection();
@ -1357,7 +1388,7 @@ const SubscriptionRequestNotification = new Lang.Class({
this._invalidatedId = 0;
}
this.parent();
MessageTray.Notification.prototype.destroy.call(this);
},
_subscriptionStatesChangedCb: function(contact, subscribe, publish, msg) {
@ -1366,7 +1397,12 @@ const SubscriptionRequestNotification = new Lang.Class({
if (publish != Tp.SubscriptionState.ASK)
this.destroy();
}
});
};
function AccountNotification(source, account, connectionError) {
this._init(source, account, connectionError);
}
// Messages from empathy/libempathy/empathy-utils.c
// create_errors_to_message_hash()
@ -1421,16 +1457,15 @@ _connectionErrorMessages[Tp.error_get_dbus_name(Tp.Error.CERT_INSECURE)]
_connectionErrorMessages[Tp.error_get_dbus_name(Tp.Error.CERT_LIMIT_EXCEEDED)]
= _("The length of the server certificate, or the depth of the server certificate chain, exceed the limits imposed by the cryptography library");
const AccountNotification = new Lang.Class({
Name: 'AccountNotification',
Extends: MessageTray.Notification,
AccountNotification.prototype = {
__proto__: MessageTray.Notification.prototype,
_init: function(source, account, connectionError) {
this.parent(source,
/* translators: argument is the account name, like
* name@jabber.org for example. */
_("Connection to %s failed").format(account.get_display_name()),
null, { customContent: true });
MessageTray.Notification.prototype._init.call(this, source,
/* translators: argument is the account name, like
* name@jabber.org for example. */
_("Connection to %s failed").format(account.get_display_name()),
null, { customContent: true });
this._label = new St.Label();
this.addActor(this._label);
@ -1506,6 +1541,6 @@ const AccountNotification = new Lang.Class({
this._connectionStatusId = 0;
}
this.parent();
MessageTray.Notification.prototype.destroy.call(this);
}
});
};

View File

@ -202,9 +202,11 @@ function registerSpecialPropertySplitter(name, splitFunction, parameters) {
// time updates; even better is to pay attention to the vertical
// vblank and sync to that when possible.)
//
const ClutterFrameTicker = new Lang.Class({
Name: 'ClutterFrameTicker',
function ClutterFrameTicker() {
this._init();
}
ClutterFrameTicker.prototype = {
FRAME_RATE : 60,
_init : function() {
@ -259,6 +261,6 @@ const ClutterFrameTicker = new Lang.Class({
this._startTime = -1;
global.end_work();
}
});
};
Signals.addSignalMethods(ClutterFrameTicker.prototype);

View File

@ -40,12 +40,15 @@ const IMStatus = {
// Copyright (C) 2008,2009 Red Hat, Inc.
const IMStatusItem = new Lang.Class({
Name: 'IMStatusItem',
Extends: PopupMenu.PopupBaseMenuItem,
function IMStatusItem(label, iconName) {
this._init(label, iconName);
}
IMStatusItem.prototype = {
__proto__: PopupMenu.PopupBaseMenuItem.prototype,
_init: function(label, iconName) {
this.parent();
PopupMenu.PopupBaseMenuItem.prototype._init.call(this);
this.actor.add_style_class_name('status-chooser-status-item');
@ -58,15 +61,19 @@ const IMStatusItem = new Lang.Class({
this.label = new St.Label({ text: label });
this.addActor(this.label);
}
});
};
const IMUserNameItem = new Lang.Class({
Name: 'IMUserNameItem',
Extends: PopupMenu.PopupBaseMenuItem,
function IMUserNameItem() {
this._init();
}
IMUserNameItem.prototype = {
__proto__: PopupMenu.PopupBaseMenuItem.prototype,
_init: function() {
this.parent({ reactive: false,
style_class: 'status-chooser-user-name' });
PopupMenu.PopupBaseMenuItem.prototype._init.call(this,
{ reactive: false,
style_class: 'status-chooser-user-name' });
this._wrapper = new Shell.GenericContainer();
this._wrapper.connect('get-preferred-width',
@ -95,15 +102,19 @@ const IMUserNameItem = new Lang.Class({
_wrapperAllocate: function(actor, box, flags) {
this.label.allocate(box, flags);
}
});
};
const IMStatusChooserItem = new Lang.Class({
Name: 'IMStatusChooserItem',
Extends: PopupMenu.PopupBaseMenuItem,
function IMStatusChooserItem() {
this._init();
}
IMStatusChooserItem.prototype = {
__proto__: PopupMenu.PopupBaseMenuItem.prototype,
_init: function() {
this.parent({ reactive: false,
style_class: 'status-chooser' });
PopupMenu.PopupBaseMenuItem.prototype._init.call (this,
{ reactive: false,
style_class: 'status-chooser' });
this._iconBin = new St.Button({ style_class: 'status-chooser-user-icon' });
this.addActor(this._iconBin);
@ -209,7 +220,7 @@ const IMStatusChooserItem = new Lang.Class({
this._userChangedId = 0;
}
this.parent();
PopupMenu.PopupBaseMenuItem.prototype.destroy.call(this);
},
// Override getColumnWidths()/setColumnWidths() to make the item
@ -298,7 +309,9 @@ const IMStatusChooserItem = new Lang.Class({
this._setComboboxPresence(presence);
if (!this._sessionPresenceRestored) {
this._sessionStatusChanged(this._presence.status);
this._presence.connectSignal('StatusChanged', Lang.bind(this, function (proxy, senderName, [status]) {
this._sessionStatusChanged(status);
}));
return;
}
@ -411,16 +424,18 @@ const IMStatusChooserItem = new Lang.Class({
this._expectedPresence = newPresence;
this._accountMgr.set_all_requested_presences(newPresence, status, msg);
}
});
};
const UserMenuButton = new Lang.Class({
Name: 'UserMenuButton',
Extends: PanelMenu.Button,
function UserMenuButton() {
this._init();
}
UserMenuButton.prototype = {
__proto__: PanelMenu.Button.prototype,
_init: function() {
this.parent(0.0);
PanelMenu.Button.prototype._init.call(this, 0.0);
let box = new St.BoxLayout({ name: 'panelUserMenu' });
this.actor.add_actor(box);
@ -456,6 +471,10 @@ const UserMenuButton = new Lang.Class({
this._idleIcon = new St.Icon({ icon_name: 'user-idle',
style_class: 'popup-menu-icon' });
this._presence.connectSignal('StatusChanged', Lang.bind(this, function (proxy, senderName, [status]) {
this._updateSwitch(status);
}));
this._accountMgr.connect('most-available-presence-changed',
Lang.bind(this, this._updatePresenceIcon));
this._accountMgr.prepare_async(null, Lang.bind(this,
@ -723,4 +742,4 @@ const UserMenuButton = new Lang.Class({
this._session.ShutdownRemote();
}
}
});
};

View File

@ -15,9 +15,11 @@ const SearchDisplay = imports.ui.searchDisplay;
const ShellEntry = imports.ui.shellEntry;
const Tweener = imports.ui.tweener;
const BaseTab = new Lang.Class({
Name: 'BaseTab',
function BaseTab(titleActor, pageActor, name, a11yIcon) {
this._init(titleActor, pageActor, name, a11yIcon);
}
BaseTab.prototype = {
_init: function(titleActor, pageActor, name, a11yIcon) {
this.title = titleActor;
this.page = new St.Bin({ child: pageActor,
@ -73,13 +75,16 @@ const BaseTab = new Lang.Class({
_activate: function() {
this.emit('activated');
}
});
};
Signals.addSignalMethods(BaseTab.prototype);
const ViewTab = new Lang.Class({
Name: 'ViewTab',
Extends: BaseTab,
function ViewTab(id, label, pageActor, a11yIcon) {
this._init(id, label, pageActor, a11yIcon);
}
ViewTab.prototype = {
__proto__: BaseTab.prototype,
_init: function(id, label, pageActor, a11yIcon) {
this.id = id;
@ -88,14 +93,17 @@ const ViewTab = new Lang.Class({
style_class: 'view-tab-title' });
titleActor.connect('clicked', Lang.bind(this, this._activate));
this.parent(titleActor, pageActor, label, a11yIcon);
BaseTab.prototype._init.call(this, titleActor, pageActor, label, a11yIcon);
}
});
};
const SearchTab = new Lang.Class({
Name: 'SearchTab',
Extends: BaseTab,
function SearchTab() {
this._init();
}
SearchTab.prototype = {
__proto__: BaseTab.prototype,
_init: function() {
this.active = false;
@ -128,7 +136,11 @@ const SearchTab = new Lang.Class({
this._iconClickedId = 0;
this._searchResults = new SearchDisplay.SearchResults(this._searchSystem, this._openSearchSystem);
this.parent(this._entry, this._searchResults.actor, _("Search"), 'edit-find');
BaseTab.prototype._init.call(this,
this._entry,
this._searchResults.actor,
_("Search"),
'edit-find');
this._text.connect('text-changed', Lang.bind(this, this._onTextChanged));
this._text.connect('key-press-event', Lang.bind(this, function (o, e) {
@ -154,7 +166,7 @@ const SearchTab = new Lang.Class({
},
hide: function() {
this.parent();
BaseTab.prototype.hide.call(this);
// Leave the entry focused when it doesn't have any text;
// when replacing a selected search term, Clutter emits
@ -298,12 +310,14 @@ const SearchTab = new Lang.Class({
return false;
}
});
};
const ViewSelector = new Lang.Class({
Name: 'ViewSelector',
function ViewSelector() {
this._init();
}
ViewSelector.prototype = {
_init : function() {
this.actor = new St.BoxLayout({ name: 'viewSelector',
vertical: true });
@ -563,5 +577,5 @@ const ViewSelector = new Lang.Class({
removeSearchProvider: function(provider) {
this._searchTab.removeSearchProvider(provider);
}
});
};
Signals.addSignalMethods(ViewSelector.prototype);

View File

@ -6,9 +6,11 @@ const Shell = imports.gi.Shell;
const Main = imports.ui.main;
const MessageTray = imports.ui.messageTray;
const WindowAttentionHandler = new Lang.Class({
Name: 'WindowAttentionHandler',
function WindowAttentionHandler() {
this._init();
}
WindowAttentionHandler.prototype = {
_init : function() {
this._tracker = Shell.WindowTracker.get_default();
global.display.connect('window-demands-attention', Lang.bind(this, this._onWindowDemandsAttention));
@ -41,14 +43,17 @@ const WindowAttentionHandler = new Lang.Class({
notification.update(title, banner);
})));
}
});
};
const Source = new Lang.Class({
Name: 'WindowAttentionSource',
Extends: MessageTray.Source,
function Source(app, window) {
this._init(app, window);
}
Source.prototype = {
__proto__ : MessageTray.Source.prototype,
_init: function(app, window) {
this.parent(app.get_name());
MessageTray.Source.prototype._init.call(this, app.get_name());
this._window = window;
this._app = app;
this._setSummaryIcon(this.createNotificationIcon());
@ -76,4 +81,4 @@ const Source = new Lang.Class({
Main.activateWindow(this._window);
this.destroy();
}
});
};

View File

@ -31,9 +31,11 @@ function getTopInvisibleBorder(metaWindow) {
return outerRect.y - inputRect.y;
}
const WindowDimmer = new Lang.Class({
Name: 'WindowDimmer',
function WindowDimmer(actor) {
this._init(actor);
}
WindowDimmer.prototype = {
_init: function(actor) {
if (Clutter.feature_available(Clutter.FeatureFlags.SHADERS_GLSL)) {
this._effect = new Clutter.ShaderEffect({ shader_type: Clutter.ShaderType.FRAGMENT_SHADER });
@ -73,7 +75,7 @@ const WindowDimmer = new Lang.Class({
},
_dimFraction: 0.0
});
};
function getWindowDimmer(actor) {
if (!actor._windowDimmer)
@ -82,12 +84,15 @@ function getWindowDimmer(actor) {
return actor._windowDimmer;
}
const WindowManager = new Lang.Class({
Name: 'WindowManager',
function WindowManager() {
this._init();
}
WindowManager.prototype = {
_init : function() {
this._shellwm = global.window_manager;
this._keyBindingHandlers = [];
this._minimizing = [];
this._maximizing = [];
this._unmaximizing = [];
@ -116,24 +121,15 @@ const WindowManager = new Lang.Class({
this._shellwm.connect('destroy', Lang.bind(this, this._destroyWindow));
this._workspaceSwitcherPopup = null;
Meta.keybindings_set_custom_handler('switch-to-workspace-left',
Lang.bind(this, this._showWorkspaceSwitcher));
Meta.keybindings_set_custom_handler('switch-to-workspace-right',
Lang.bind(this, this._showWorkspaceSwitcher));
Meta.keybindings_set_custom_handler('switch-to-workspace-up',
Lang.bind(this, this._showWorkspaceSwitcher));
Meta.keybindings_set_custom_handler('switch-to-workspace-down',
Lang.bind(this, this._showWorkspaceSwitcher));
Meta.keybindings_set_custom_handler('switch-windows',
Lang.bind(this, this._startAppSwitcher));
Meta.keybindings_set_custom_handler('switch-group',
Lang.bind(this, this._startAppSwitcher));
Meta.keybindings_set_custom_handler('switch-windows-backward',
Lang.bind(this, this._startAppSwitcher));
Meta.keybindings_set_custom_handler('switch-group-backward',
Lang.bind(this, this._startAppSwitcher));
Meta.keybindings_set_custom_handler('switch-panels',
Lang.bind(this, this._startA11ySwitcher));
this.setKeybindingHandler('switch-to-workspace-left', Lang.bind(this, this._showWorkspaceSwitcher));
this.setKeybindingHandler('switch-to-workspace-right', Lang.bind(this, this._showWorkspaceSwitcher));
this.setKeybindingHandler('switch-to-workspace-up', Lang.bind(this, this._showWorkspaceSwitcher));
this.setKeybindingHandler('switch-to-workspace-down', Lang.bind(this, this._showWorkspaceSwitcher));
this.setKeybindingHandler('switch-windows', Lang.bind(this, this._startAppSwitcher));
this.setKeybindingHandler('switch-group', Lang.bind(this, this._startAppSwitcher));
this.setKeybindingHandler('switch-windows-backward', Lang.bind(this, this._startAppSwitcher));
this.setKeybindingHandler('switch-group-backward', Lang.bind(this, this._startAppSwitcher));
this.setKeybindingHandler('switch-panels', Lang.bind(this, this._startA11ySwitcher));
Main.overview.connect('showing', Lang.bind(this, function() {
for (let i = 0; i < this._dimmedWindows.length; i++)
@ -145,6 +141,16 @@ const WindowManager = new Lang.Class({
}));
},
setKeybindingHandler: function(keybinding, handler){
if (this._keyBindingHandlers[keybinding])
this._shellwm.disconnect(this._keyBindingHandlers[keybinding]);
else
this._shellwm.takeover_keybinding(keybinding);
this._keyBindingHandlers[keybinding] =
this._shellwm.connect('keybinding::' + keybinding, handler);
},
blockAnimations: function() {
this._animationBlockCount++;
},
@ -528,41 +534,37 @@ const WindowManager = new Lang.Class({
shellwm.completed_switch_workspace();
},
_startAppSwitcher : function(display, screen, window, binding) {
_startAppSwitcher : function(shellwm, binding, mask, window, backwards) {
/* prevent a corner case where both popups show up at once */
if (this._workspaceSwitcherPopup != null)
this._workspaceSwitcherPopup.actor.hide();
let tabPopup = new AltTab.AltTabPopup();
let modifiers = binding.get_modifiers();
let backwards = modifiers & Meta.VirtualModifier.SHIFT_MASK;
if (!tabPopup.show(backwards, binding.get_name(), binding.get_mask()))
if (!tabPopup.show(backwards, binding, mask))
tabPopup.destroy();
},
_startA11ySwitcher : function(display, screen, window, binding) {
let modifiers = binding.get_modifiers();
let backwards = modifiers & Meta.VirtualModifier.SHIFT_MASK;
Main.ctrlAltTabManager.popup(backwards, binding.get_mask());
_startA11ySwitcher : function(shellwm, binding, mask, window, backwards) {
Main.ctrlAltTabManager.popup(backwards, mask);
},
_showWorkspaceSwitcher : function(display, screen, window, binding) {
if (screen.n_workspaces == 1)
_showWorkspaceSwitcher : function(shellwm, binding, mask, window, backwards) {
if (global.screen.n_workspaces == 1)
return;
if (this._workspaceSwitcherPopup == null)
this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
if (binding.get_name() == 'switch-to-workspace-up')
if (binding == 'switch-to-workspace-up')
this.actionMoveWorkspaceUp();
else if (binding.get_name() == 'switch-to-workspace-down')
else if (binding == 'switch-to-workspace-down')
this.actionMoveWorkspaceDown();
// left/right would effectively act as synonyms for up/down if we enabled them;
// but that could be considered confusing.
// else if (binding.get_name() == 'switch-to-workspace-left')
// else if (binding == 'switch-to-workspace-left')
// this.actionMoveWorkspaceLeft();
// else if (binding.get_name() == 'switch-to-workspace-right')
// else if (binding == 'switch-to-workspace-right')
// this.actionMoveWorkspaceRight();
},
@ -623,4 +625,4 @@ const WindowManager = new Lang.Class({
if (!Main.overview.visible)
this._workspaceSwitcherPopup.display(WorkspaceSwitcherPopup.DOWN, indexToActivate);
}
});
};

View File

@ -56,13 +56,11 @@ function _clamp(value, min, max) {
}
const ScaledPoint = new Lang.Class({
Name: 'ScaledPoint',
_init: function(x, y, scaleX, scaleY) {
[this.x, this.y, this.scaleX, this.scaleY] = arguments;
},
function ScaledPoint(x, y, scaleX, scaleY) {
[this.x, this.y, this.scaleX, this.scaleY] = arguments;
}
ScaledPoint.prototype = {
getPosition : function() {
return [this.x, this.y];
},
@ -88,12 +86,14 @@ const ScaledPoint = new Lang.Class({
return [_interpolate(this.scaleX, other.scaleX, step),
_interpolate(this.scaleY, other.scaleY, step)];
}
});
};
const WindowClone = new Lang.Class({
Name: 'WindowClone',
function WindowClone(realWindow) {
this._init(realWindow);
}
WindowClone.prototype = {
_init : function(realWindow) {
this.realWindow = realWindow;
this.metaWindow = realWindow.meta_window;
@ -418,7 +418,7 @@ const WindowClone = new Lang.Class({
this.emit('drag-end');
}
});
};
Signals.addSignalMethods(WindowClone.prototype);
@ -427,9 +427,11 @@ Signals.addSignalMethods(WindowClone.prototype);
* @parentActor: The actor which will be the parent of all overlay items
* such as app icon and window caption
*/
const WindowOverlay = new Lang.Class({
Name: 'WindowOverlay',
function WindowOverlay(windowClone, parentActor) {
this._init(windowClone, parentActor);
}
WindowOverlay.prototype = {
_init : function(windowClone, parentActor) {
let metaWindow = windowClone.metaWindow;
@ -640,7 +642,7 @@ const WindowOverlay = new Lang.Class({
this._parentActor.queue_relayout();
}
});
};
Signals.addSignalMethods(WindowOverlay.prototype);
const WindowPositionFlags = {
@ -651,9 +653,11 @@ const WindowPositionFlags = {
/**
* @metaWorkspace: a #Meta.Workspace, or null
*/
const Workspace = new Lang.Class({
Name: 'Workspace',
function Workspace(metaWorkspace, monitorIndex) {
this._init(metaWorkspace, monitorIndex);
}
Workspace.prototype = {
_init : function(metaWorkspace, monitorIndex) {
// When dragging a window, we use this slot for reserve space.
this._reservedSlot = null;
@ -1514,6 +1518,6 @@ const Workspace = new Lang.Class({
return false;
}
});
};
Signals.addSignalMethods(Workspace.prototype);

View File

@ -15,9 +15,11 @@ const DISPLAY_TIMEOUT = 600;
const UP = -1;
const DOWN = 1;
const WorkspaceSwitcherPopup = new Lang.Class({
Name: 'WorkspaceSwitcherPopup',
function WorkspaceSwitcherPopup() {
this._init();
}
WorkspaceSwitcherPopup.prototype = {
_init : function() {
this.actor = new St.Group({ reactive: true,
x: 0,
@ -156,4 +158,4 @@ const WorkspaceSwitcherPopup = new Lang.Class({
onCompleteScope: this
});
}
});
};

View File

@ -25,9 +25,11 @@ const SLIDE_ANIMATION_TIME = 0.2;
// placeholder exactly.
const WORKSPACE_CUT_SIZE = 10;
const WindowClone = new Lang.Class({
Name: 'WindowClone',
function WindowClone(realWindow) {
this._init(realWindow);
}
WindowClone.prototype = {
_init : function(realWindow) {
this.actor = new Clutter.Clone({ source: realWindow.get_texture(),
reactive: true });
@ -124,7 +126,7 @@ const WindowClone = new Lang.Class({
this.emit('drag-end');
}
});
};
Signals.addSignalMethods(WindowClone.prototype);
@ -142,9 +144,11 @@ const ThumbnailState = {
/**
* @metaWorkspace: a #Meta.Workspace
*/
const WorkspaceThumbnail = new Lang.Class({
Name: 'WorkspaceThumbnail',
function WorkspaceThumbnail(metaWorkspace) {
this._init(metaWorkspace);
}
WorkspaceThumbnail.prototype = {
_init : function(metaWorkspace) {
this.metaWorkspace = metaWorkspace;
this.monitorIndex = Main.layoutManager.primaryIndex;
@ -465,14 +469,16 @@ const WorkspaceThumbnail = new Lang.Class({
return false;
}
});
};
Signals.addSignalMethods(WorkspaceThumbnail.prototype);
const ThumbnailsBox = new Lang.Class({
Name: 'ThumbnailsBox',
function ThumbnailsBox() {
this._init();
}
ThumbnailsBox.prototype = {
_init: function() {
this.actor = new Shell.GenericContainer({ style_class: 'workspace-thumbnails',
request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT });
@ -591,7 +597,7 @@ const ThumbnailsBox = new Lang.Class({
// ... and bam, a workspace, good as new.
source.metaWindow.change_workspace_by_index(newWorkspaceIndex,
true, time);
else if (source.shellWorkspaceLaunch)
else (source.shellWorkspaceLaunch)
source.shellWorkspaceLaunch({ workspace: newWorkspaceIndex,
timestamp: time });
@ -1022,4 +1028,4 @@ const ThumbnailsBox = new Lang.Class({
onCompleteScope: this
});
}
});
};

View File

@ -23,9 +23,11 @@ const MAX_WORKSPACES = 16;
const CONTROLS_POP_IN_TIME = 0.1;
const WorkspacesView = new Lang.Class({
Name: 'WorkspacesView',
function WorkspacesView(workspaces) {
this._init(workspaces);
}
WorkspacesView.prototype = {
_init: function(workspaces) {
this.actor = new St.Group({ style_class: 'workspaces-view' });
@ -450,13 +452,15 @@ const WorkspacesView = new Lang.Class({
_getWorkspaceIndexToRemove: function() {
return global.screen.get_active_workspace_index();
}
});
};
Signals.addSignalMethods(WorkspacesView.prototype);
const WorkspacesDisplay = new Lang.Class({
Name: 'WorkspacesDisplay',
function WorkspacesDisplay() {
this._init();
}
WorkspacesDisplay.prototype = {
_init: function() {
this.actor = new Shell.GenericContainer();
this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
@ -848,5 +852,5 @@ const WorkspacesDisplay = new Lang.Class({
break;
}
}
});
};
Signals.addSignalMethods(WorkspacesDisplay.prototype);

View File

@ -6,9 +6,11 @@ const Shell = imports.gi.Shell;
const Signals = imports.signals;
const DND = imports.ui.dnd;
const XdndHandler = new Lang.Class({
Name: 'XdndHandler',
function XdndHandler() {
this._init();
}
XdndHandler.prototype = {
_init: function() {
// Used to display a clone of the cursor window when the
// window group is hidden (like it happens in the overview)
@ -123,6 +125,6 @@ const XdndHandler = new Lang.Class({
pickedActor = pickedActor.get_parent();
}
}
});
}
Signals.addSignalMethods(XdndHandler.prototype);

1405
po/el.po

File diff suppressed because it is too large Load Diff

504
po/es.po

File diff suppressed because it is too large Load Diff

298
po/fi.po
View File

@ -19,20 +19,18 @@
msgid ""
msgstr ""
"Project-Id-Version: gnome-shell\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-"
"shell&keywords=I18N+L10N&component=general\n"
"POT-Creation-Date: 2011-10-18 19:39+0000\n"
"PO-Revision-Date: 2011-11-15 22:19+0200\n"
"Last-Translator: Ville-Pekka Vainio <vpvainio@iki.fi>\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-09-26 15:40+0300\n"
"PO-Revision-Date: 2011-09-26 15:39+0300\n"
"Last-Translator: Tommi Vainikainen <thv@iki.fi>\n"
"Language-Team: Finnish <gnome-fi-laatu@lists.sourceforge.net>\n"
"Language: fi\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Virtaal 0.7.1-rc1\n"
"X-Generator: Virtaal 0.6.1\n"
"X-DamnedLies-Scope: partial\n"
"X-Project-Style: gnome\n"
#: ../data/gnome-shell.desktop.in.in.h:1
msgid "GNOME Shell"
@ -42,7 +40,6 @@ msgstr "Gnomen ikkunanhallinta"
msgid "Window management and application launching"
msgstr "Ikkunanhallinta ja sovelluksien käynnistäminen"
#: ../data/org.gnome.shell.gschema.xml.in.h:1
msgid ""
"Allows access to internal debugging and monitoring tools using the Alt-F2 "
"dialog."
@ -50,20 +47,16 @@ msgstr ""
"Salli pääsy sisäiseen vianselvitys- ja monitorointityökaluun Alt-F2-ikkunan "
"kautta."
#: ../data/org.gnome.shell.gschema.xml.in.h:2
msgid "Enable internal tools useful for developers and testers from Alt-F2"
msgstr ""
"Ota käyttöön sisäiset kehittäjiä ja testaajia hyödyttävät työkalut Alt-F2:sta"
#: ../data/org.gnome.shell.gschema.xml.in.h:3
msgid "File extension used for storing the screencast"
msgstr "Tiedostopääte ruutunauhoitusten tallentamiseen"
#: ../data/org.gnome.shell.gschema.xml.in.h:4
msgid "Framerate used for recording screencasts."
msgstr "Ruutunauhoitusten kuvataajuus."
#: ../data/org.gnome.shell.gschema.xml.in.h:5
msgid ""
"GNOME Shell extensions have a uuid property; this key lists extensions which "
"should be loaded. disabled-extensions overrides this setting for extensions "
@ -74,31 +67,24 @@ msgstr ""
"kytketyt laajennukset) ylittää tämän asetuksen mikäli laajennus esiintyy "
"molemmissa luetteloissa."
#: ../data/org.gnome.shell.gschema.xml.in.h:6
msgid "History for command (Alt-F2) dialog"
msgstr "Historia komentoikkunalle (Alt-F2)"
#: ../data/org.gnome.shell.gschema.xml.in.h:7
msgid "History for the looking glass dialog"
msgstr "Historia näyttölasi-ikkunalle"
#: ../data/org.gnome.shell.gschema.xml.in.h:8
msgid "If true, display date in the clock, in addition to time."
msgstr "Jos tosi, näytä päivämäärä kellossa ajan lisäksi."
#: ../data/org.gnome.shell.gschema.xml.in.h:9
msgid "If true, display seconds in time."
msgstr "Jos tosi, näytä sekunnit ajassa."
#: ../data/org.gnome.shell.gschema.xml.in.h:10
msgid "If true, display the ISO week date in the calendar."
msgstr "Jos tosi, näytä ISO-viikonpäivät kalenterissa."
#: ../data/org.gnome.shell.gschema.xml.in.h:11
msgid "List of desktop file IDs for favorite applications"
msgstr "Luettelo työpöytätiedostojen tunnisteista lempisovelluksille"
#: ../data/org.gnome.shell.gschema.xml.in.h:13
#, no-c-format
msgid ""
"Sets the GStreamer pipeline used to encode recordings. It follows the syntax "
@ -124,25 +110,20 @@ msgstr ""
"muotoon VP8-koodekilla. %T korvautuu arvauksella parhaan suorituskyvy "
"antavasta säiemäärästä järjestelmässä."
#: ../data/org.gnome.shell.gschema.xml.in.h:14
msgid "Show date in clock"
msgstr "Näytä päivämäärä kellossa"
#: ../data/org.gnome.shell.gschema.xml.in.h:15
msgid "Show the week date in the calendar"
msgstr "Näytä viikonpäivä kalenterissa"
#: ../data/org.gnome.shell.gschema.xml.in.h:16
msgid "Show time with seconds"
msgstr "Näytä aika sekuntien kera"
#: ../data/org.gnome.shell.gschema.xml.in.h:17
msgid ""
"The applications corresponding to these identifiers will be displayed in the "
"favorites area."
msgstr "Näitä tunnisteita vastaavat sovellukset näytetään suosikkien alueella."
#: ../data/org.gnome.shell.gschema.xml.in.h:18
msgid ""
"The filename for recorded screencasts will be a unique filename based on the "
"current date, and use this extension. It should be changed when recording to "
@ -152,7 +133,6 @@ msgstr ""
"nykyisen päivämäärän ja tämän tiedostopäätteen mukaisesti. Tiedostopääte "
"tulisi vaihtaa mikäli nauhoitetaan eri tallennusmuotoon."
#: ../data/org.gnome.shell.gschema.xml.in.h:19
msgid ""
"The framerate of the resulting screencast recordered by GNOME Shell's "
"screencast recorder in frames-per-second."
@ -160,11 +140,9 @@ msgstr ""
"Nauhoituksesta tuloksena saatavan ruutunauhoituksen kuvataajuus kun käytössä "
"on GNOMEn ikkunanhallinnan nauhoitin, kuvaa per sekunti."
#: ../data/org.gnome.shell.gschema.xml.in.h:20
msgid "The gstreamer pipeline used to encode the screencast"
msgstr "Gstreamer-liukuhihna jolla ruutunauhoitukset pakataan"
#: ../data/org.gnome.shell.gschema.xml.in.h:21
msgid ""
"The shell normally monitors active applications in order to present the most "
"used ones (e.g. in launchers). While this data will be kept private, you may "
@ -177,72 +155,52 @@ msgstr ""
"yksityisyyden vuoksi. Huomaa että pois kytkeminen ei poista aiemmin "
"tallennettuja tietoja."
#: ../data/org.gnome.shell.gschema.xml.in.h:22
msgid "The type of keyboard to use."
msgstr "Käytettävän näppäimistön tyyppi."
#: ../data/org.gnome.shell.gschema.xml.in.h:23
msgid "Uuids of extensions to enable"
msgstr "Käyttöön otettavien laajennosten UUID:t"
#: ../data/org.gnome.shell.gschema.xml.in.h:24
msgid "Whether to collect stats about applications usage"
msgstr "Kerätäänkö sovellusten käytöstä tilastoja"
#: ../data/org.gnome.shell.gschema.xml.in.h:25
msgid "Which keyboard to use"
msgstr "Mitä näppäimistöä käytetään"
#: ../data/org.gnome.shell.gschema.xml.in.h:26
msgid "disabled OpenSearch providers"
msgstr "käytöstä poistetut OpenSearch-tarjoajat"
#: ../js/gdm/loginDialog.js:633
msgid "Session..."
msgstr "Istunto…"
#: ../js/gdm/loginDialog.js:804
msgctxt "title"
msgid "Sign In"
msgstr "Kirjaudu sisään"
#. translators: this message is shown below the password entry field
#. to indicate the user can swipe their finger instead
#: ../js/gdm/loginDialog.js:849
msgid "(or swipe finger)"
msgstr "(tai pyyhkäise sormella)"
#: ../js/gdm/loginDialog.js:867
msgid "Not listed?"
msgstr "Ei luettelossa?"
#: ../js/gdm/loginDialog.js:1035 ../js/ui/endSessionDialog.js:426
#: ../js/ui/extensionSystem.js:477 ../js/ui/networkAgent.js:148
#: ../js/ui/polkitAuthenticationAgent.js:173 ../js/ui/status/bluetooth.js:480
msgid "Cancel"
msgstr "Peru"
#: ../js/gdm/loginDialog.js:1040
msgctxt "button"
msgid "Sign In"
msgstr "Kirjaudu sisään"
#: ../js/gdm/loginDialog.js:1392
msgid "Login Window"
msgstr "Kirjautumisikkuna"
#: ../js/gdm/powerMenu.js:116 ../js/ui/userMenu.js:554
#: ../js/ui/userMenu.js:556 ../js/ui/userMenu.js:625
msgid "Suspend"
msgstr "Valmiustila"
#: ../js/gdm/powerMenu.js:121 ../js/ui/endSessionDialog.js:89
#: ../js/ui/endSessionDialog.js:97 ../js/ui/endSessionDialog.js:106
msgid "Restart"
msgstr "Käynnistä uudelleen"
#: ../js/gdm/powerMenu.js:126 ../js/ui/endSessionDialog.js:80
#: ../js/ui/endSessionDialog.js:91
msgid "Power Off"
msgstr "Sammuta"
@ -296,16 +254,13 @@ msgstr "%s on lisätty suosikkeihin."
msgid "%s has been removed from your favorites."
msgstr "%s on poistettu suosikeista."
#: ../js/ui/autorunManager.js:280
msgid "Removable Devices"
msgstr "Irroitettavat laitteet"
#: ../js/ui/autorunManager.js:590
#, c-format
msgid "Open with %s"
msgstr "Avaa käyttäen sovellusta %s"
msgstr "Avaa käyttäen %s"
#: ../js/ui/autorunManager.js:616
msgid "Eject"
msgstr "Poista asemasta"
@ -457,32 +412,28 @@ msgstr "Tällä viikolla"
msgid "Next week"
msgstr "Ensi viikolla"
#: ../js/ui/contactDisplay.js:65 ../js/ui/notificationDaemon.js:459
#: ../js/ui/status/power.js:223 ../src/shell-app.c:353
#: ../js/ui/contactDisplay.js:59 ../js/ui/notificationDaemon.js:444
#: ../js/ui/status/power.js:223 ../src/shell-app.c:355
msgid "Unknown"
msgstr "Tuntematon"
#: ../js/ui/contactDisplay.js:86 ../js/ui/userMenu.js:139
msgid "Available"
msgstr "Tavoitettavissa"
#: ../js/ui/contactDisplay.js:91 ../js/ui/userMenu.js:148
msgid "Away"
msgstr "Poissa"
#: ../js/ui/contactDisplay.js:95 ../js/ui/userMenu.js:142
msgid "Busy"
msgstr "Kiireinen"
#: ../js/ui/contactDisplay.js:99
#: ../js/ui/contactDisplay.js:93
msgid "Offline"
msgstr "Ei linjoilla"
#: ../js/ui/contactDisplay.js:146
#: ../js/ui/contactDisplay.js:140
msgid "CONTACTS"
msgstr "YHTEYSTIEDOT"
#: ../js/ui/dash.js:174 ../js/ui/messageTray.js:1206
msgid "Remove"
msgstr "Poista"
@ -632,131 +583,108 @@ msgstr "Asenna"
msgid "Download and install '%s' from extensions.gnome.org?"
msgstr "Lataa ja asenna ”%s” sivustolta extensions.gnome.org?"
#: ../js/ui/keyboard.js:325
msgid "tray"
msgstr "ilmoitusalue"
#: ../js/ui/keyboard.js:547 ../js/ui/status/power.js:211
msgid "Keyboard"
msgstr "Näppäimistö"
#: ../js/ui/lookingGlass.js:646
#: ../js/ui/lookingGlass.js:645
msgid "No extensions installed"
msgstr "Laajennuksia ei asennettu"
#: ../js/ui/lookingGlass.js:692
#: ../js/ui/lookingGlass.js:691
msgid "Enabled"
msgstr "Käytössä"
#. translators:
#. * The device has been disabled
#: ../js/ui/lookingGlass.js:694 ../src/gvc/gvc-mixer-control.c:1093
#: ../js/ui/lookingGlass.js:693 ../src/gvc/gvc-mixer-control.c:1093
msgid "Disabled"
msgstr "Ei käytössä"
#: ../js/ui/lookingGlass.js:696
#: ../js/ui/lookingGlass.js:695
msgid "Error"
msgstr "Virhe"
#: ../js/ui/lookingGlass.js:698
#: ../js/ui/lookingGlass.js:697
msgid "Out of date"
msgstr "Ei ajan tasalla"
#: ../js/ui/lookingGlass.js:700
#: ../js/ui/lookingGlass.js:699
msgid "Downloading"
msgstr "Noudetaan"
#: ../js/ui/lookingGlass.js:721
#: ../js/ui/lookingGlass.js:724
msgid "View Source"
msgstr "Näytä lähde"
#: ../js/ui/lookingGlass.js:727
#: ../js/ui/lookingGlass.js:730
msgid "Web Page"
msgstr "WWW-sivu"
#: ../js/ui/messageTray.js:1199
msgid "Open"
msgstr "Avaa"
#: ../js/ui/messageTray.js:2408
msgid "System Information"
msgstr "Järjestelmän tiedot"
#: ../js/ui/networkAgent.js:143
msgid "Show password"
msgstr "Näytä salasana"
msgid "Connect"
msgstr "Yhdistä"
#. Cisco LEAP
#: ../js/ui/networkAgent.js:238 ../js/ui/networkAgent.js:250
#: ../js/ui/networkAgent.js:277 ../js/ui/networkAgent.js:297
#: ../js/ui/networkAgent.js:307
msgid "Password: "
msgstr "Salasana: "
#. static WEP
#: ../js/ui/networkAgent.js:243
msgid "Key: "
msgstr "Avain: "
#. TTLS and PEAP are actually much more complicated, but this complication
#. is not visible here since we only care about phase2 authentication
#. (and don't even care of which one)
#: ../js/ui/networkAgent.js:275 ../js/ui/networkAgent.js:293
msgid "Username: "
msgstr "Käyttäjänimi: "
#: ../js/ui/networkAgent.js:281
msgid "Identity: "
msgstr "Henkilöllisyys: "
#: ../js/ui/networkAgent.js:283
msgid "Private key password: "
msgstr "Salaisen avaimen salasana: "
#: ../js/ui/networkAgent.js:295
msgid "Service: "
msgstr "Palvelu: "
#: ../js/ui/networkAgent.js:324
msgid "Authentication required by wireless network"
msgstr "Langaton verkko vaatii tunnistautumisen"
#: ../js/ui/networkAgent.js:325
#, c-format
msgid ""
"Passwords or encryption keys are required to access the wireless network '%"
"s'."
"Passwords or encryption keys are required to access the wireless network "
"'%s'."
msgstr "Langaton verkko %s vaatii salasanan tai salausavaimia."
#: ../js/ui/networkAgent.js:329
msgid "Wired 802.1X authentication"
msgstr "Kiinteän 802.1X-yhteyden tunnistautuminen"
#: ../js/ui/networkAgent.js:331
msgid "Network name: "
msgstr "Verkon nimi: "
#: ../js/ui/networkAgent.js:336
msgid "DSL authentication"
msgstr "DSL-tunnistautuminen"
#: ../js/ui/networkAgent.js:343
msgid "PIN code required"
msgstr "PIN-koodi vaaditaan"
#: ../js/ui/networkAgent.js:344
msgid "PIN code is needed for the mobile broadband device"
msgstr "Mobiililaajakaista vaatii PIN-koodin"
#: ../js/ui/networkAgent.js:345
msgid "PIN: "
msgstr "PIN: "
#: ../js/ui/networkAgent.js:351
msgid "Mobile broadband network password"
msgstr "Mobiililaajakaistan verkkosalasana"
#: ../js/ui/networkAgent.js:352
#, c-format
msgid "A password is required to connect to '%s'."
msgstr "Salasana vaaditaan kohteeseen %s yhdistämiseksi."
@ -780,18 +708,15 @@ msgid "Dash"
msgstr "Pikavalikko"
#. TODO - _quit() doesn't really work on apps in state STARTING yet
#: ../js/ui/panel.js:539
#, c-format
msgid "Quit %s"
msgstr "Lopeta %s"
#. Translators: If there is no suitable word for "Activities"
#. in your language, you can use the word for "Overview".
#: ../js/ui/panel.js:575
msgid "Activities"
msgstr "Toiminnot"
#: ../js/ui/panel.js:967
msgid "Top Bar"
msgstr "Yläpalkki"
@ -812,15 +737,14 @@ msgstr "Yhdistä…"
msgid "PLACES & DEVICES"
msgstr "SIJAINNIT JA LAITTEET"
#: ../js/ui/polkitAuthenticationAgent.js:73
#: ../js/ui/polkitAuthenticationAgent.js:72
msgid "Authentication Required"
msgstr "Tunnistautuminen vaaditaan"
#: ../js/ui/polkitAuthenticationAgent.js:107
#: ../js/ui/polkitAuthenticationAgent.js:106
msgid "Administrator"
msgstr "Ylläpitäjä"
#: ../js/ui/polkitAuthenticationAgent.js:177
msgid "Authenticate"
msgstr "Tunnistaudu"
@ -828,11 +752,9 @@ msgstr "Tunnistaudu"
#. * requested authentication was not gained; this can happen
#. * because of an authentication error (like invalid password),
#. * for instance.
#: ../js/ui/polkitAuthenticationAgent.js:258
msgid "Sorry, that didn't work. Please try again."
msgstr "Tunnistautuminen epäonnistui. Yritä uudelleen."
#: ../js/ui/polkitAuthenticationAgent.js:270
msgid "Password:"
msgstr "Salasana:"
@ -841,11 +763,10 @@ msgstr "Salasana:"
#. "ON" and "OFF") or "toggle-switch-intl" (for toggle
#. switches containing "◯" and "|"). Other values will
#. simply result in invisible toggle switches.
#: ../js/ui/popupMenu.js:731
msgid "toggle-switch-us"
msgstr "toggle-switch-intl"
#: ../js/ui/runDialog.js:209
#: ../js/ui/runDialog.js:208
msgid "Please enter a command:"
msgstr "Syötä komento:"
@ -857,22 +778,6 @@ msgstr "Haetaan…"
msgid "No matching results."
msgstr "Ei tuloksia."
#: ../js/ui/shellEntry.js:30
msgid "Copy"
msgstr "Kopioi"
#: ../js/ui/shellEntry.js:35
msgid "Paste"
msgstr "Liitä"
#: ../js/ui/shellEntry.js:81
msgid "Show Text"
msgstr "Näytä teksti"
#: ../js/ui/shellEntry.js:83
msgid "Hide Text"
msgstr "Piilota teksti"
#: ../js/ui/shellMountOperation.js:285
msgid "Wrong password, please try again"
msgstr "Väärä salasana, yritä uudelleen"
@ -884,7 +789,6 @@ msgstr "Lähennys"
#. let screenReader = this._buildItem(_("Screen Reader"), APPLICATIONS_SCHEMA,
#. 'screen-reader-enabled');
#. this.menu.addMenuItem(screenReader);
#: ../js/ui/status/accessibility.js:71
msgid "Screen Keyboard"
msgstr "Näyttönäppäimistö"
@ -1006,7 +910,7 @@ msgstr "Salli pääsy aina"
msgid "Grant this time only"
msgstr "Salli vain tällä kerralla"
#: ../js/ui/status/bluetooth.js:392 ../js/ui/telepathyClient.js:1204
#: ../js/ui/status/bluetooth.js:392 ../js/ui/telepathyClient.js:1196
msgid "Reject"
msgstr "Hylkää"
@ -1046,11 +950,9 @@ msgstr "Kirjoita laitteella mainittu PIN-koodi."
msgid "OK"
msgstr "OK"
#: ../js/ui/status/keyboard.js:73
msgid "Show Keyboard Layout"
msgstr "Näytä näppäimistön asettelu"
#: ../js/ui/status/keyboard.js:78
msgid "Region and Language Settings"
msgstr "Kielen ja alueen asetukset"
@ -1095,13 +997,11 @@ msgstr "ei käytettävissä"
msgid "connection failed"
msgstr "yhteys katkesi"
#: ../js/ui/status/network.js:575 ../js/ui/status/network.js:1523
msgid "More..."
msgstr "Lisää…"
#. TRANSLATORS: this is the indication that a connection for another logged in user is active,
#. and we cannot access its settings (including the name)
#: ../js/ui/status/network.js:611 ../js/ui/status/network.js:1458
msgid "Connected (private)"
msgstr "Yhdistetty (yksityinen)"
@ -1118,7 +1018,6 @@ msgid "Auto dial-up"
msgstr "Automaattinen, puhelinverkko"
#. TRANSLATORS: this the automatic wireless connection name (including the network name)
#: ../js/ui/status/network.js:878 ../js/ui/status/network.js:1470
#, c-format
msgid "Auto %s"
msgstr "Automaattinen: %s"
@ -1127,47 +1026,36 @@ msgstr "Automaattinen: %s"
msgid "Auto bluetooth"
msgstr "Automaattinen: Bluetooth"
#: ../js/ui/status/network.js:1472
msgid "Auto wireless"
msgstr "Automaattinen: langaton"
#: ../js/ui/status/network.js:1566
msgid "Enable networking"
msgstr "Ota verkko käyttöön"
#: ../js/ui/status/network.js:1578
msgid "Wired"
msgstr "Kiinteä"
#: ../js/ui/status/network.js:1589
msgid "Wireless"
msgstr "Langaton"
#: ../js/ui/status/network.js:1599
msgid "Mobile broadband"
msgstr "Mobiililaajakaista"
#: ../js/ui/status/network.js:1609
msgid "VPN Connections"
msgstr "VPN-yhteydet"
#: ../js/ui/status/network.js:1620
msgid "Network Settings"
msgstr "Verkkoasetukset"
#: ../js/ui/status/network.js:1757
msgid "Connection failed"
msgstr "Yhteys epäonnistui"
#: ../js/ui/status/network.js:1758
msgid "Activation of network connection failed"
msgstr "Verkkoyhteyden aktivointi epäonnistui"
#: ../js/ui/status/network.js:2008
msgid "Networking is disabled"
msgstr "Verkko ei ole käytössä"
#: ../js/ui/status/network.js:2133
msgid "Network Manager"
msgstr "Verkon hallinta"
@ -1275,39 +1163,39 @@ msgid "Invitation"
msgstr "Kutsu"
#. We got the TpContact
#: ../js/ui/telepathyClient.js:327
#: ../js/ui/telepathyClient.js:325
msgid "Call"
msgstr "Soita"
#. We got the TpContact
#: ../js/ui/telepathyClient.js:357
#: ../js/ui/telepathyClient.js:353
msgid "File Transfer"
msgstr "Tiedostonsiirto"
#: ../js/ui/telepathyClient.js:438
#: ../js/ui/telepathyClient.js:434
msgid "Subscription request"
msgstr "Tilauspyyntö"
#: ../js/ui/telepathyClient.js:474
#: ../js/ui/telepathyClient.js:470
msgid "Connection error"
msgstr "Yhteysvirhe"
#: ../js/ui/telepathyClient.js:741
#: ../js/ui/telepathyClient.js:733
#, c-format
msgid "%s is online."
msgstr "%s on linjoilla."
#: ../js/ui/telepathyClient.js:746
#: ../js/ui/telepathyClient.js:738
#, c-format
msgid "%s is offline."
msgstr "%s on poissa linjoilta."
#: ../js/ui/telepathyClient.js:749
#: ../js/ui/telepathyClient.js:741
#, c-format
msgid "%s is away."
msgstr "%s on poissa."
#: ../js/ui/telepathyClient.js:752
#: ../js/ui/telepathyClient.js:744
#, c-format
msgid "%s is busy."
msgstr "%s on kiireinen."
@ -1315,35 +1203,35 @@ msgstr "%s on kiireinen."
#. Translators: this is a time format string followed by a date.
#. If applicable, replace %X with a strftime format valid for your
#. locale, without seconds.
#: ../js/ui/telepathyClient.js:986
#: ../js/ui/telepathyClient.js:978
#, no-c-format
msgid "Sent at <b>%X</b> on <b>%A</b>"
msgstr "Lähetetty <b>%Ana</b> kello <b>%H.%M</b>"
#. Translators: this is a time format in the style of "Wednesday, May 25",
#. shown when you get a chat message in the same year.
#: ../js/ui/telepathyClient.js:992
#: ../js/ui/telepathyClient.js:984
#, no-c-format
msgid "Sent on <b>%A</b>, <b>%B %d</b>"
msgstr "Lähetetty <b>%Ana</b> <b>%d. %Bta</b>"
#. Translators: this is a time format in the style of "Wednesday, May 25, 2012",
#. shown when you get a chat message in a different year.
#: ../js/ui/telepathyClient.js:997
#: ../js/ui/telepathyClient.js:989
#, no-c-format
msgid "Sent on <b>%A</b>, <b>%B %d</b>, %Y"
msgstr "Lähetetty <b>%Ana</b> <b>%d. %Bta</b> %Y"
#. Translators: this is the other person changing their old IM name to their new
#. IM name.
#: ../js/ui/telepathyClient.js:1039
#: ../js/ui/telepathyClient.js:1031
#, c-format
msgid "%s is now known as %s"
msgstr "%s on nyt nimeltään %s"
#. translators: argument is a room name like
#. * room@jabber.org for example.
#: ../js/ui/telepathyClient.js:1148
#: ../js/ui/telepathyClient.js:1140
#, c-format
msgid "Invitation to %s"
msgstr "Kutsu huoneeseen %s"
@ -1351,35 +1239,34 @@ msgstr "Kutsu huoneeseen %s"
#. translators: first argument is the name of a contact and the second
#. * one the name of a room. "Alice is inviting you to join room@jabber.org
#. * for example.
#: ../js/ui/telepathyClient.js:1156
#: ../js/ui/telepathyClient.js:1148
#, c-format
msgid "%s is inviting you to join %s"
msgstr "%s kutsuu sinut huoneeseen %s"
#: ../js/ui/telepathyClient.js:1158 ../js/ui/telepathyClient.js:1248
#: ../js/ui/telepathyClient.js:1352
#: ../js/ui/telepathyClient.js:1150 ../js/ui/telepathyClient.js:1239
#: ../js/ui/telepathyClient.js:1343
msgid "Decline"
msgstr "Kieltäydy"
#: ../js/ui/telepathyClient.js:1159 ../js/ui/telepathyClient.js:1249
#: ../js/ui/telepathyClient.js:1353
#: ../js/ui/telepathyClient.js:1151 ../js/ui/telepathyClient.js:1240
#: ../js/ui/telepathyClient.js:1344
msgid "Accept"
msgstr "Hyväksy"
#. translators: argument is a contact name like Alice for example.
#: ../js/ui/telepathyClient.js:1192
#: ../js/ui/telepathyClient.js:1184
#, c-format
msgid "Video call from %s"
msgstr "Videopuhelu käyttäjältä %s"
#. translators: argument is a contact name like Alice for example.
#: ../js/ui/telepathyClient.js:1195
#: ../js/ui/telepathyClient.js:1187
#, c-format
msgid "Call from %s"
msgstr "Puhelu käyttäjältä %s"
#. translators: this is a button label (verb), not a noun
#: ../js/ui/telepathyClient.js:1206
#: ../js/ui/telepathyClient.js:1197
msgid "Answer"
msgstr "Vastaa"
@ -1388,108 +1275,108 @@ msgstr "Vastaa"
#. * file name. The string will be something
#. * like: "Alice is sending you test.ogg"
#.
#: ../js/ui/telepathyClient.js:1242
#: ../js/ui/telepathyClient.js:1233
#, c-format
msgid "%s is sending you %s"
msgstr "%s on lähettämässä sinulle tiedostoa %s"
#. To translators: The parameter is the contact's alias
#: ../js/ui/telepathyClient.js:1317
#: ../js/ui/telepathyClient.js:1308
#, c-format
msgid "%s would like permission to see when you are online"
msgstr "%s haluaisi saada luvan nähdä, milloin olet linjoilla"
#: ../js/ui/telepathyClient.js:1415
#: ../js/ui/telepathyClient.js:1406
msgid "Network error"
msgstr "Verkkovirhe"
#: ../js/ui/telepathyClient.js:1417
#: ../js/ui/telepathyClient.js:1408
msgid "Authentication failed"
msgstr "Tunnistautuminen epäonnistui"
#: ../js/ui/telepathyClient.js:1419
#: ../js/ui/telepathyClient.js:1410
msgid "Encryption error"
msgstr "Salausvirhe"
#: ../js/ui/telepathyClient.js:1421
#: ../js/ui/telepathyClient.js:1412
msgid "Certificate not provided"
msgstr "Varmennetta ei annettu"
#: ../js/ui/telepathyClient.js:1423
#: ../js/ui/telepathyClient.js:1414
msgid "Certificate untrusted"
msgstr "Varmenteeseen ei luoteta"
#: ../js/ui/telepathyClient.js:1425
#: ../js/ui/telepathyClient.js:1416
msgid "Certificate expired"
msgstr "Varmenne on vanhentunut"
#: ../js/ui/telepathyClient.js:1427
#: ../js/ui/telepathyClient.js:1418
msgid "Certificate not activated"
msgstr "Varmennetta ei ole aktivoitu"
#: ../js/ui/telepathyClient.js:1429
#: ../js/ui/telepathyClient.js:1420
msgid "Certificate hostname mismatch"
msgstr "Varmenteen konenimiristiriita"
#: ../js/ui/telepathyClient.js:1431
#: ../js/ui/telepathyClient.js:1422
msgid "Certificate fingerprint mismatch"
msgstr "Varmenteen sormenjälkiristiriita"
#: ../js/ui/telepathyClient.js:1433
#: ../js/ui/telepathyClient.js:1424
msgid "Certificate self-signed"
msgstr "Varmenne on itseallekirjoitettu"
#: ../js/ui/telepathyClient.js:1435
#: ../js/ui/telepathyClient.js:1426
msgid "Status is set to offline"
msgstr "Tilaksi on asetettu ”poissa linjoilta”"
#: ../js/ui/telepathyClient.js:1437
#: ../js/ui/telepathyClient.js:1428
msgid "Encryption is not available"
msgstr "Salaus ei ole käytettävissä"
#: ../js/ui/telepathyClient.js:1439
#: ../js/ui/telepathyClient.js:1430
msgid "Certificate is invalid"
msgstr "Varmenne ei kelpaa"
#: ../js/ui/telepathyClient.js:1441
#: ../js/ui/telepathyClient.js:1432
msgid "Connection has been refused"
msgstr "Yhteys on evätty"
#: ../js/ui/telepathyClient.js:1443
#: ../js/ui/telepathyClient.js:1434
msgid "Connection can't be established"
msgstr "Yhteyttä ei voida muodostaa"
#: ../js/ui/telepathyClient.js:1445
#: ../js/ui/telepathyClient.js:1436
msgid "Connection has been lost"
msgstr "Yhteys on katkennut"
#: ../js/ui/telepathyClient.js:1447
#: ../js/ui/telepathyClient.js:1438
msgid "This resource is already connected to the server"
msgstr "Tämä resurssi on jo yhteydessä palvelimeen"
#: ../js/ui/telepathyClient.js:1449
#: ../js/ui/telepathyClient.js:1440
msgid ""
"Connection has been replaced by a new connection using the same resource"
msgstr "Yhteys on korvattu uudella samaa resurssia käyttävällä yhteydellä"
#: ../js/ui/telepathyClient.js:1451
#: ../js/ui/telepathyClient.js:1442
msgid "The account already exists on the server"
msgstr "Tili on jo olemassa palvelimella"
#: ../js/ui/telepathyClient.js:1453
#: ../js/ui/telepathyClient.js:1444
msgid "Server is currently too busy to handle the connection"
msgstr "Palvelin on tällä hetkellä liian kiireinen käsittelemään yhteyttä"
#: ../js/ui/telepathyClient.js:1455
#: ../js/ui/telepathyClient.js:1446
msgid "Certificate has been revoked"
msgstr "Varmenne on kumottu"
#: ../js/ui/telepathyClient.js:1457
#: ../js/ui/telepathyClient.js:1448
msgid ""
"Certificate uses an insecure cipher algorithm or is cryptographically weak"
msgstr "Varmenne käyttää turvatonta salausmenetelmää"
#: ../js/ui/telepathyClient.js:1459
#: ../js/ui/telepathyClient.js:1450
msgid ""
"The length of the server certificate, or the depth of the server certificate "
"chain, exceed the limits imposed by the cryptography library"
@ -1498,68 +1385,56 @@ msgstr ""
#. translators: argument is the account name, like
#. * name@jabber.org for example.
#: ../js/ui/telepathyClient.js:1468
#: ../js/ui/telepathyClient.js:1459
#, c-format
msgid "Connection to %s failed"
msgstr "Yhteys kohteeseen %s katkesi"
#: ../js/ui/telepathyClient.js:1477
#: ../js/ui/telepathyClient.js:1468
msgid "Reconnect"
msgstr "Yhdistä uudelleen"
#: ../js/ui/telepathyClient.js:1478
#: ../js/ui/telepathyClient.js:1469
msgid "Edit account"
msgstr "Muokkaa tiliä"
#: ../js/ui/telepathyClient.js:1524
#: ../js/ui/telepathyClient.js:1515
msgid "Unknown reason"
msgstr "Tuntematon syy"
#: ../js/ui/userMenu.js:145
msgid "Hidden"
msgstr "Piilotettu"
#: ../js/ui/userMenu.js:151
msgid "Idle"
msgstr "Jouten"
#: ../js/ui/userMenu.js:154
msgid "Unavailable"
msgstr "Ei tavoitettavissa"
#: ../js/ui/userMenu.js:552 ../js/ui/userMenu.js:556 ../js/ui/userMenu.js:626
msgid "Power Off..."
msgstr "Sammuta…"
#: ../js/ui/userMenu.js:588
msgid "Notifications"
msgstr "Ilmoitukset"
#: ../js/ui/userMenu.js:596
msgid "Online Accounts"
msgstr "Verkkotilit"
#: ../js/ui/userMenu.js:600
msgid "System Settings"
msgstr "Järjestelmän asetukset"
#: ../js/ui/userMenu.js:607
msgid "Lock Screen"
msgstr "Lukitse näyttö"
#: ../js/ui/userMenu.js:612
msgid "Switch User"
msgstr "Vaihda käyttäjää"
#: ../js/ui/userMenu.js:617
msgid "Log Out..."
msgstr "Kirjaudu ulos…"
#: ../js/ui/userMenu.js:645
msgid "Your chat status will be set to busy"
msgstr "Pikaviestitilaksi asetetaan ”kiireinen”"
#: ../js/ui/userMenu.js:646
msgid ""
"Notifications are now disabled, including chat messages. Your online status "
"has been adjusted to let others know that you might not see their messages."
@ -1572,15 +1447,20 @@ msgstr ""
#. in the search entry when no search is
#. active; it should not exceed ~30
#. characters.
#: ../js/ui/viewSelector.js:121
#: ../js/ui/viewSelector.js:120
msgid "Type to search..."
msgstr "Kirjoita hakeaksesi…"
#: ../js/ui/viewSelector.js:142 ../src/shell-util.c:261
#: ../js/ui/viewSelector.js:140 ../src/shell-util.c:261
msgid "Search"
msgstr "Haku"
#: ../js/ui/windowAttentionHandler.js:35
#: ../js/ui/windowAttentionHandler.js:39
#, c-format
msgid "%s has finished starting"
msgstr "%s on käynnistynyt"
#: ../js/ui/windowAttentionHandler.js:41
#, c-format
msgid "'%s' is ready"
msgstr "%s on valmis"
@ -1615,7 +1495,7 @@ msgstr "Tulosta versio"
msgid "Mode used by GDM for login screen"
msgstr "GDM:n kirjautumisruudussa käyttämä tila"
#: ../src/shell-app.c:579
#: ../src/shell-app.c:581
#, c-format
msgid "Failed to launch '%s'"
msgstr "Sovelluksen ”%s” käynnistäminen epäonnistui"
@ -1652,12 +1532,6 @@ msgstr "Tiedostojärjestelmä"
msgid "%1$s: %2$s"
msgstr "%1$s: %2$s"
#~ msgid "Show password"
#~ msgstr "Näytä salasana"
#~ msgid "%s has finished starting"
#~ msgstr "%s on käynnistynyt"
#~ msgid "Connectivity lost"
#~ msgstr "Yhteys katkesi"

View File

@ -58,9 +58,7 @@ shell_dbus_acquire_name (GDBusProxy *bus,
NULL, /* cancellable */
&error)))
{
g_printerr ("failed to acquire %s: %s\n", name, error->message);
if (!fatal)
return;
g_printerr ("failed to acquire org.gnome.Shell: %s\n", error->message);
exit (1);
}
g_variant_get (request_name_variant, "(u)", request_name_result);

View File

@ -27,9 +27,6 @@ void _shell_app_do_match (ShellApp *app,
GSList **prefix_results,
GSList **substring_results);
void _shell_app_set_dbus_name (ShellApp *app,
const char *name);
G_END_DECLS
#endif /* __SHELL_APP_PRIVATE_H__ */

View File

@ -37,13 +37,6 @@ typedef struct {
/* Whether or not we need to resort the windows; this is done on demand */
gboolean window_sort_stale : 1;
/* See GApplication documentation */
guint name_watcher_id;
gchar *dbus_name;
GDBusActionGroup *remote_actions;
GMenuProxy *remote_menu;
GCancellable *dbus_cancellable;
} ShellAppRunningState;
/**
@ -79,13 +72,11 @@ struct _ShellApp
char *casefolded_exec;
};
G_DEFINE_TYPE (ShellApp, shell_app, G_TYPE_OBJECT);
enum {
PROP_0,
PROP_STATE,
PROP_ID,
PROP_DBUS_ID,
PROP_ACTION_GROUP,
PROP_MENU
PROP_STATE
};
enum {
@ -98,8 +89,6 @@ static guint shell_app_signals[LAST_SIGNAL] = { 0 };
static void create_running_state (ShellApp *app);
static void unref_running_state (ShellAppRunningState *state);
G_DEFINE_TYPE (ShellApp, shell_app, G_TYPE_OBJECT)
static void
shell_app_get_property (GObject *gobject,
guint prop_id,
@ -113,20 +102,6 @@ shell_app_get_property (GObject *gobject,
case PROP_STATE:
g_value_set_enum (value, app->state);
break;
case PROP_ID:
g_value_set_string (value, shell_app_get_id (app));
break;
case PROP_DBUS_ID:
g_value_set_string (value, shell_app_get_dbus_id (app));
break;
case PROP_ACTION_GROUP:
if (app->running_state)
g_value_set_object (value, app->running_state->remote_actions);
break;
case PROP_MENU:
if (app->running_state)
g_value_set_object (value, app->running_state->remote_menu);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -176,15 +151,6 @@ window_backed_app_get_icon (ShellApp *app,
return actor;
}
const char *
shell_app_get_dbus_id (ShellApp *app)
{
if (app->running_state)
return app->running_state->dbus_name;
else
return NULL;
}
/**
* shell_app_create_icon_texture:
*
@ -982,142 +948,6 @@ _shell_app_remove_window (ShellApp *app,
g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0);
}
static void
on_action_group_acquired (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
ShellApp *self = SHELL_APP (user_data);
ShellAppRunningState *state = self->running_state;
GError *error = NULL;
char *object_path;
state->remote_actions = g_dbus_action_group_new_finish (result,
&error);
if (error)
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
!g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD))
{
g_warning ("Unexpected error while reading application actions: %s", error->message);
}
g_clear_error (&error);
g_clear_object (&state->dbus_cancellable);
if (state->name_watcher_id)
{
g_bus_unwatch_name (state->name_watcher_id);
state->name_watcher_id = 0;
}
g_free (state->dbus_name);
state->dbus_name = NULL;
g_object_unref (self);
return;
}
object_path = g_strconcat ("/", state->dbus_name, NULL);
g_strdelimit (object_path, ".", '/');
state->remote_menu = g_menu_proxy_get (g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL),
state->dbus_name,
object_path);
g_object_notify (G_OBJECT (self), "dbus-id");
g_object_notify (G_OBJECT (self), "action-group");
g_object_notify (G_OBJECT (self), "menu");
g_object_unref (self);
g_free (object_path);
}
static void
on_dbus_name_appeared (GDBusConnection *bus,
const gchar *name,
const gchar *name_owner,
gpointer user_data)
{
ShellApp *self = SHELL_APP (user_data);
ShellAppRunningState *state = self->running_state;
char *object_path;
g_assert (state != NULL);
object_path = g_strconcat ("/", name, NULL);
g_strdelimit (object_path, ".", '/');
if (!state->dbus_cancellable)
state->dbus_cancellable = g_cancellable_new ();
g_dbus_action_group_new (bus,
name,
object_path,
G_DBUS_ACTION_GROUP_FLAGS_NONE,
state->dbus_cancellable,
on_action_group_acquired,
g_object_ref (self));
g_free (object_path);
}
static void
on_dbus_name_disappeared (GDBusConnection *bus,
const gchar *name,
gpointer user_data)
{
ShellApp *self = SHELL_APP (user_data);
ShellAppRunningState *state = self->running_state;
g_assert (state != NULL);
if (state->dbus_cancellable)
{
g_cancellable_cancel (state->dbus_cancellable);
g_clear_object (&state->dbus_cancellable);
}
g_clear_object (&state->remote_actions);
g_clear_object (&state->remote_menu);
g_free (state->dbus_name);
state->dbus_name = NULL;
g_bus_unwatch_name (state->name_watcher_id);
state->name_watcher_id = 0;
}
void
_shell_app_set_dbus_name (ShellApp *app,
const char *bus_name)
{
g_return_if_fail (app->running_state != NULL);
if (app->running_state->dbus_name != NULL)
{
/* already associating with another name
(can only happen if you restart the shell in the
middle of the session, in which case it will try
all names seen on the bus; otherwise, it uses
the Hello signal from GApplication and thus knows
for sure which name is the right one)
*/
return;
}
app->running_state->dbus_name = g_strdup (bus_name);
app->running_state->name_watcher_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
bus_name,
G_BUS_NAME_WATCHER_FLAGS_NONE,
on_dbus_name_appeared,
on_dbus_name_disappeared,
g_object_ref (app),
g_object_unref);
}
/**
* shell_app_get_pids:
* @app: a #ShellApp
@ -1337,28 +1167,13 @@ unref_running_state (ShellAppRunningState *state)
{
MetaScreen *screen;
g_assert (state->refcount > 0);
state->refcount--;
if (state->refcount > 0)
return;
screen = shell_global_get_screen (shell_global_get ());
g_signal_handler_disconnect (screen, state->workspace_switch_id);
if (state->dbus_cancellable)
{
g_cancellable_cancel (state->dbus_cancellable);
g_object_unref (state->dbus_cancellable);
}
g_clear_object (&state->remote_actions);
g_clear_object (&state->remote_menu);
g_free (state->dbus_name);
if (state->name_watcher_id)
g_bus_unwatch_name (state->name_watcher_id);
g_slice_free (ShellAppRunningState, state);
}
@ -1534,9 +1349,6 @@ shell_app_dispose (GObject *object)
while (app->running_state->windows)
_shell_app_remove_window (app, app->running_state->windows->data);
}
/* We should have been transitioned when we removed all of our windows */
g_assert (app->state == SHELL_APP_STATE_STOPPED);
g_assert (app->running_state == NULL);
G_OBJECT_CLASS(shell_app_parent_class)->dispose (object);
}
@ -1587,60 +1399,4 @@ shell_app_class_init(ShellAppClass *klass)
SHELL_TYPE_APP_STATE,
SHELL_APP_STATE_STOPPED,
G_PARAM_READABLE));
/**
* ShellApp:id:
*
* The id of this application (a desktop filename, or a special string
* like window:0xabcd1234)
*/
g_object_class_install_property (gobject_class,
PROP_ID,
g_param_spec_string ("id",
"Application id",
"The desktop file id of this ShellApp",
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
* ShellApp:dbus-id:
*
* The DBus well-known name of the application, if one can be associated
* to this ShellApp (it means that the application is using GApplication)
*/
g_object_class_install_property (gobject_class,
PROP_DBUS_ID,
g_param_spec_string ("dbus-id",
"Application DBus Id",
"The DBus well-known name of the application",
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
* ShellApp:action-group:
*
* The #GDBusActionGroup associated with this ShellApp, if any. See the
* documentation of #GApplication and #GActionGroup for details.
*/
g_object_class_install_property (gobject_class,
PROP_ACTION_GROUP,
g_param_spec_object ("action-group",
"Application Action Group",
"The action group exported by the remote application",
G_TYPE_DBUS_ACTION_GROUP,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
* ShellApp:menu:
*
* The #GMenuProxy associated with this ShellApp, if any. See the
* documentation of #GMenuModel for details.
*/
g_object_class_install_property (gobject_class,
PROP_MENU,
g_param_spec_object ("menu",
"Application Menu",
"The primary menu exported by the remote application",
G_TYPE_MENU_PROXY,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}

View File

@ -13,7 +13,6 @@ G_BEGIN_DECLS
typedef struct _ShellApp ShellApp;
typedef struct _ShellAppClass ShellAppClass;
typedef struct _ShellAppPrivate ShellAppPrivate;
typedef struct _ShellAppAction ShellAppAction;
#define SHELL_TYPE_APP (shell_app_get_type ())
#define SHELL_APP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SHELL_TYPE_APP, ShellApp))
@ -37,12 +36,9 @@ typedef enum {
GType shell_app_get_type (void) G_GNUC_CONST;
const char *shell_app_get_id (ShellApp *app);
GMenuTreeEntry *shell_app_get_tree_entry (ShellApp *app);
GDesktopAppInfo *shell_app_get_app_info (ShellApp *app);
const char *shell_app_get_dbus_id (ShellApp *app);
ClutterActor *shell_app_create_icon_texture (ShellApp *app, int size);
ClutterActor *shell_app_get_faded_icon (ShellApp *app, int size);
const char *shell_app_get_name (ShellApp *app);

View File

@ -49,9 +49,6 @@ struct _ShellWindowTracker
/* <MetaWindow * window, ShellApp *app> */
GHashTable *window_to_app;
/* <int, gchar *> */
GHashTable *pid_to_dbus_connection;
/* <int, ShellApp *app> */
GHashTable *launched_pid_to_app;
};
@ -439,8 +436,6 @@ track_window (ShellWindowTracker *self,
MetaWindow *window)
{
ShellApp *app;
GPid pid;
gchar *dbus_name;
if (!shell_window_tracker_is_window_interesting (window))
return;
@ -456,15 +451,6 @@ track_window (ShellWindowTracker *self,
_shell_app_add_window (app, window);
/* Try to associate this ShellApp with a GApplication id, if one exists */
pid = meta_window_get_pid (window);
dbus_name = g_hash_table_lookup (self->pid_to_dbus_connection, GINT_TO_POINTER ((int) pid));
if (dbus_name != NULL)
{
_shell_app_set_dbus_name (app, dbus_name);
g_hash_table_remove (self->pid_to_dbus_connection, GINT_TO_POINTER ((int) pid));
}
g_signal_emit (self, signals[TRACKED_WINDOWS_CHANGED], 0);
}
@ -595,161 +581,13 @@ on_startup_sequence_changed (MetaScreen *screen,
g_signal_emit (G_OBJECT (self), signals[STARTUP_SEQUENCE_CHANGED], 0, sequence);
}
typedef struct {
ShellWindowTracker *tracker;
gchar *bus_name;
} LookupAppDBusData;
static void
on_get_connection_unix_pid_reply (GObject *connection,
GAsyncResult *result,
gpointer user_data)
{
LookupAppDBusData *data = user_data;
GError *error = NULL;
GVariant *reply;
guint32 pid;
ShellApp *app;
reply = g_dbus_connection_call_finish (G_DBUS_CONNECTION (connection), result, &error);
if (!reply)
{
if (!g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_NAME_HAS_NO_OWNER))
g_warning ("%s\n", error->message);
g_clear_error (&error);
goto out;
}
if (!g_variant_is_of_type (reply, G_VARIANT_TYPE ("(u)")))
{
g_variant_unref (reply);
goto out;
}
g_variant_get (reply, "(u)", &pid);
g_variant_unref (reply);
app = shell_window_tracker_get_app_from_pid (data->tracker, (int)pid);
if (app)
_shell_app_set_dbus_name (app, data->bus_name);
else
{
g_hash_table_insert (data->tracker->pid_to_dbus_connection,
GINT_TO_POINTER ((int) pid),
data->bus_name);
data->bus_name = NULL;
}
out:
g_object_unref (data->tracker);
g_free (data->bus_name);
g_slice_free (LookupAppDBusData, data);
}
static void
lookup_application_from_name (ShellWindowTracker *self,
GDBusConnection *connection,
const gchar *bus_name)
{
LookupAppDBusData *data;
data = g_slice_new0 (LookupAppDBusData);
data->tracker = g_object_ref (self);
data->bus_name = g_strdup (bus_name);
/*
* TODO: Add something to GtkApplication so it definitely knows the .desktop file.
*/
g_dbus_connection_call (connection,
"org.freedesktop.DBus",
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
"GetConnectionUnixProcessID",
g_variant_new ("(s)", bus_name),
NULL, 0, -1, NULL, on_get_connection_unix_pid_reply, data);
}
static void
on_application_signal (GDBusConnection *connection,
const gchar *sender_name,
const gchar *object_path,
const gchar *interface_name,
const gchar *signal_name,
GVariant *parameters,
gpointer user_data)
{
ShellWindowTracker *tracker = SHELL_WINDOW_TRACKER (user_data);
gchar *bus_name = NULL;
g_variant_get (parameters, "(&s)", &bus_name);
lookup_application_from_name (tracker, connection, bus_name);
g_variant_unref (parameters);
}
static void
on_list_names_end (GObject *object,
GAsyncResult *result,
gpointer user_data)
{
GDBusConnection *connection = G_DBUS_CONNECTION (object);
ShellWindowTracker *self = SHELL_WINDOW_TRACKER (user_data);
GError *error = NULL;
GVariantIter iter;
gchar *bus_name = NULL;
GVariant *res = g_dbus_connection_call_finish (connection, result, &error);
if (!res)
{
g_warning ("ListNames failed: %s", error->message);
g_error_free (error);
return;
}
g_variant_iter_init (&iter, g_variant_get_child_value (res, 0));
while (g_variant_iter_loop (&iter, "s", &bus_name))
{
if (bus_name[0] == ':')
{
/* unique name, uninteresting */
continue;
}
lookup_application_from_name (self, connection, bus_name);
}
g_variant_unref (res);
}
static void
shell_window_tracker_init (ShellWindowTracker *self)
{
MetaScreen *screen;
g_dbus_connection_signal_subscribe (g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL),
NULL,
"org.gtk.Application",
"Hello",
NULL,
NULL,
G_DBUS_SIGNAL_FLAGS_NONE,
on_application_signal,
self, NULL);
g_dbus_connection_call (g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL),
"org.freedesktop.DBus",
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
"ListNames",
NULL, /* parameters */
G_VARIANT_TYPE ("(as)"),
G_DBUS_CALL_FLAGS_NONE,
-1, /* timeout */
NULL, /* cancellable */
on_list_names_end, self);
self->window_to_app = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
self->pid_to_dbus_connection = g_hash_table_new_full (NULL, NULL, NULL, g_free);
self->window_to_app = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) g_object_unref);
self->launched_pid_to_app = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_object_unref);
@ -769,7 +607,6 @@ shell_window_tracker_finalize (GObject *object)
g_hash_table_destroy (self->window_to_app);
g_hash_table_destroy (self->launched_pid_to_app);
g_hash_table_destroy (self->pid_to_dbus_connection);
G_OBJECT_CLASS (shell_window_tracker_parent_class)->finalize(object);
}

View File

@ -28,6 +28,8 @@ enum
KILL_SWITCH_WORKSPACE,
KILL_WINDOW_EFFECTS,
KEYBINDING,
LAST_SIGNAL
};
@ -124,6 +126,34 @@ shell_wm_class_init (ShellWMClass *klass)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
META_TYPE_WINDOW_ACTOR);
/**
* ShellWM::keybinding:
* @shellwm: the #ShellWM
* @binding: the keybinding name
* @mask: the modifier mask used
* @window: for window keybindings, the #MetaWindow
* @backwards: for "reversible" keybindings, whether or not
* the backwards (Shifted) variant was invoked
*
* Emitted when a keybinding captured via
* shell_wm_takeover_keybinding() is invoked. The keybinding name
* (which has underscores, not hyphens) is also included as the
* detail of the signal name, so you can connect just specific
* keybindings.
*/
shell_wm_signals[KEYBINDING] =
g_signal_new ("keybinding",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
0,
NULL, NULL,
_shell_marshal_VOID__STRING_UINT_OBJECT_BOOLEAN,
G_TYPE_NONE, 4,
G_TYPE_STRING,
G_TYPE_UINT,
META_TYPE_WINDOW,
G_TYPE_BOOLEAN);
}
void
@ -294,3 +324,37 @@ shell_wm_new (MetaPlugin *plugin)
return wm;
}
static void
shell_wm_key_handler (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
XEvent *event,
MetaKeyBinding *binding,
gpointer data)
{
ShellWM *wm = data;
gboolean backwards = (event->xkey.state & ShiftMask);
g_signal_emit (wm, shell_wm_signals[KEYBINDING],
g_quark_from_string (binding->name),
binding->name, binding->mask, window, backwards);
}
/**
* shell_wm_takeover_keybinding:
* @wm: the #ShellWM
* @binding_name: a meta keybinding name
*
* Tells mutter to forward keypresses for @binding_name to the shell
* rather than processing them internally. This will cause a
* #ShellWM::keybinding signal to be emitted when that key is pressed.
*/
void
shell_wm_takeover_keybinding (ShellWM *wm,
const char *binding_name)
{
meta_keybindings_set_custom_handler (binding_name,
shell_wm_key_handler,
wm, NULL);
}

View File

@ -39,6 +39,10 @@ void shell_wm_completed_destroy (ShellWM *wm,
MetaWindowActor *actor);
void shell_wm_completed_switch_workspace (ShellWM *wm);
/* Keybinding stuff */
void shell_wm_takeover_keybinding (ShellWM *wm,
const char *binding_name);
G_END_DECLS
#endif /* __SHELL_WM_H__ */

View File

@ -1,99 +0,0 @@
#!/usr/bin/env gjs
const Gdk = imports.gi.Gdk;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
function do_action(action, parameter) {
print ("Action '" + action.name + "' invoked");
}
function do_action_param(action, parameter) {
print ("Action '" + action.name + "' invoked with parameter " + parameter.print(true));
}
function do_action_state_change(action) {
print ("Action '" + action.name + "' has now state '" + action.state.deep_unpack() + "'");
}
function main() {
Gtk.init(null, null);
let app = new Gtk.Application({ application_id: 'org.gnome.Shell.GtkApplicationTest' });
app.connect('activate', function() {
print ("Activated");
});
let group = new Gio.SimpleActionGroup();
let action = Gio.SimpleAction.new('one', null);
action.connect('activate', do_action);
group.insert(action);
let action = Gio.SimpleAction.new('two', null);
action.connect('activate', do_action);
group.insert(action);
let action = Gio.SimpleAction.new_stateful('toggle', null, GLib.Variant.new('b', false));
action.connect('activate', do_action);
action.connect('notify::state', do_action_state_change);
group.insert(action);
let action = Gio.SimpleAction.new('disable', null);
action.set_enabled(false);
action.connect('activate', do_action);
group.insert(action);
let action = Gio.SimpleAction.new('parameter-int', GLib.VariantType.new('u'));
action.connect('activate', do_action_param);
group.insert(action);
let action = Gio.SimpleAction.new('parameter-string', GLib.VariantType.new('s'));
action.connect('activate', do_action_param);
group.insert(action);
app.action_group = group;
let menu = new Gio.Menu();
menu.append('An action', 'one');
let section = new Gio.Menu();
section.append('Another action', 'two');
section.append('Same as above', 'two');
menu.append_section(null, section);
// another section, to check separators
section = new Gio.Menu();
section.append('Checkbox', 'toggle');
section.append('Disabled', 'disable');
menu.append_section(null, section);
// empty sections or submenus should be invisible
menu.append_section('Empty section', new Gio.Menu());
menu.append_submenu('Empty submenu', new Gio.Menu());
let submenu = new Gio.Menu();
submenu.append('Open c:\\', 'parameter-string::c:\\');
submenu.append('Open /home', 'parameter-string::/home');
menu.append_submenu('Recent files', submenu);
let item = Gio.MenuItem.new('Say 42', null);
item.set_action_and_target_value('parameter-int', GLib.Variant.new('u', 42));
menu.append_item(item);
let item = Gio.MenuItem.new('Say 43', null);
item.set_action_and_target_value('parameter-int', GLib.Variant.new('u', 43));
menu.append_item(item);
app.menu = menu;
app.connect('startup', function(app) {
let window = new Gtk.Window({ title: "Test Application", application: app });
window.present();
});
app.run(null);
}
main();

View File

@ -21,7 +21,6 @@ TEST_JS = \
testcommon/ui.js \
unit/format.js \
unit/markup.js \
unit/jsParse.js \
unit/url.js
EXTRA_DIST += $(TEST_JS)