|
|
3614ae |
From d9837ecc12258ee93a7cbf4ce8b8c09b77a44f5d Mon Sep 17 00:00:00 2001
|
|
|
3614ae |
From: Ray Strode <rstrode@redhat.com>
|
|
|
3614ae |
Date: Tue, 21 Jan 2014 16:48:17 -0500
|
|
|
3614ae |
Subject: [PATCH] apps-menu: add logo icon to Applications menu
|
|
|
3614ae |
|
|
|
3614ae |
Brand requested it.
|
|
|
3614ae |
---
|
|
|
3614ae |
extensions/apps-menu/extension.js | 10 +++++++++-
|
|
|
3614ae |
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
3614ae |
|
|
|
3614ae |
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
|
|
|
3614ae |
index cef443d..1de1c70 100644
|
|
|
3614ae |
--- a/extensions/apps-menu/extension.js
|
|
|
3614ae |
+++ b/extensions/apps-menu/extension.js
|
|
|
3614ae |
@@ -1,33 +1,34 @@
|
|
|
3614ae |
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
|
3614ae |
|
|
|
3614ae |
const Atk = imports.gi.Atk;
|
|
|
3614ae |
+const Gio = imports.gi.Gio;
|
|
|
3614ae |
const GMenu = imports.gi.GMenu;
|
|
|
3614ae |
const Lang = imports.lang;
|
|
|
3614ae |
const Shell = imports.gi.Shell;
|
|
|
3614ae |
const St = imports.gi.St;
|
|
|
3614ae |
const Clutter = imports.gi.Clutter;
|
|
|
3614ae |
const Main = imports.ui.main;
|
|
|
3614ae |
const PanelMenu = imports.ui.panelMenu;
|
|
|
3614ae |
const PopupMenu = imports.ui.popupMenu;
|
|
|
3614ae |
const Gtk = imports.gi.Gtk;
|
|
|
3614ae |
const GLib = imports.gi.GLib;
|
|
|
3614ae |
const Signals = imports.signals;
|
|
|
3614ae |
const Layout = imports.ui.layout;
|
|
|
3614ae |
const Pango = imports.gi.Pango;
|
|
|
3614ae |
|
|
|
3614ae |
const Gettext = imports.gettext.domain('gnome-shell-extensions');
|
|
|
3614ae |
const _ = Gettext.gettext;
|
|
|
3614ae |
|
|
|
3614ae |
const ExtensionUtils = imports.misc.extensionUtils;
|
|
|
3614ae |
const Me = ExtensionUtils.getCurrentExtension();
|
|
|
3614ae |
const Convenience = Me.imports.convenience;
|
|
|
3614ae |
|
|
|
3614ae |
const appSys = Shell.AppSystem.get_default();
|
|
|
3614ae |
|
|
|
3614ae |
const APPLICATION_ICON_SIZE = 32;
|
|
|
3614ae |
const HORIZ_FACTOR = 5;
|
|
|
3614ae |
const MENU_HEIGHT_OFFSET = 132;
|
|
|
3614ae |
const NAVIGATION_REGION_OVERSHOOT = 50;
|
|
|
3614ae |
|
|
|
3614ae |
const ActivitiesMenuItem = new Lang.Class({
|
|
|
3614ae |
Name: 'ActivitiesMenuItem',
|
|
|
3614ae |
@@ -246,63 +247,70 @@ const ApplicationsMenu = new Lang.Class({
|
|
|
3614ae |
this._button.hotCorner.actor.show();
|
|
|
3614ae |
this.parent(animate);
|
|
|
3614ae |
},
|
|
|
3614ae |
|
|
|
3614ae |
toggle: function() {
|
|
|
3614ae |
if (this.isOpen) {
|
|
|
3614ae |
this._button.selectCategory(null, null);
|
|
|
3614ae |
} else {
|
|
|
3614ae |
if (Main.overview.visible)
|
|
|
3614ae |
Main.overview.hide();
|
|
|
3614ae |
}
|
|
|
3614ae |
this.parent();
|
|
|
3614ae |
}
|
|
|
3614ae |
});
|
|
|
3614ae |
|
|
|
3614ae |
const ApplicationsButton = new Lang.Class({
|
|
|
3614ae |
Name: 'ApplicationsButton',
|
|
|
3614ae |
Extends: PanelMenu.Button,
|
|
|
3614ae |
|
|
|
3614ae |
_init: function() {
|
|
|
3614ae |
this.parent(1.0, null, false);
|
|
|
3614ae |
|
|
|
3614ae |
this.setMenu(new ApplicationsMenu(this.actor, 1.0, St.Side.TOP, this));
|
|
|
3614ae |
Main.panel.menuManager.addMenu(this.menu);
|
|
|
3614ae |
|
|
|
3614ae |
// At this moment applications menu is not keyboard navigable at
|
|
|
3614ae |
// all (so not accessible), so it doesn't make sense to set as
|
|
|
3614ae |
// role ATK_ROLE_MENU like other elements of the panel.
|
|
|
3614ae |
this.actor.accessible_role = Atk.Role.LABEL;
|
|
|
3614ae |
|
|
|
3614ae |
+ let box = new St.BoxLayout();
|
|
|
3614ae |
+ this.actor.add_actor(box);
|
|
|
3614ae |
+ let iconFile = Gio.File.new_for_path('/usr/share/icons/hicolor/scalable/apps/start-here.svg');
|
|
|
3614ae |
+ this._icon = new St.Icon({ gicon: new Gio.FileIcon({ file: iconFile }),
|
|
|
3614ae |
+ style_class: 'panel-logo-icon' });
|
|
|
3614ae |
+ box.add_actor(this._icon);
|
|
|
3614ae |
+
|
|
|
3614ae |
this._label = new St.Label({ text: _("Applications") });
|
|
|
3614ae |
|
|
|
3614ae |
- this.actor.add_actor(this._label);
|
|
|
3614ae |
+ box.add_actor(this._label);
|
|
|
3614ae |
this.actor.name = 'panelApplications';
|
|
|
3614ae |
this.actor.label_actor = this._label;
|
|
|
3614ae |
|
|
|
3614ae |
this.actor.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
|
|
|
3614ae |
|
|
|
3614ae |
_showingId = Main.overview.connect('showing', Lang.bind(this, function() {
|
|
|
3614ae |
this.actor.add_accessible_state (Atk.StateType.CHECKED);
|
|
|
3614ae |
}));
|
|
|
3614ae |
_hidingId = Main.overview.connect('hiding', Lang.bind(this, function() {
|
|
|
3614ae |
this.actor.remove_accessible_state (Atk.StateType.CHECKED);
|
|
|
3614ae |
}));
|
|
|
3614ae |
|
|
|
3614ae |
this.reloadFlag = false;
|
|
|
3614ae |
this._createLayout();
|
|
|
3614ae |
this._display();
|
|
|
3614ae |
_installedChangedId = appSys.connect('installed-changed', Lang.bind(this, function() {
|
|
|
3614ae |
if (this.menu.isOpen) {
|
|
|
3614ae |
this._redisplay();
|
|
|
3614ae |
this.mainBox.show();
|
|
|
3614ae |
} else {
|
|
|
3614ae |
this.reloadFlag = true;
|
|
|
3614ae |
}
|
|
|
3614ae |
}));
|
|
|
3614ae |
|
|
|
3614ae |
// Since the hot corner uses stage coordinates, Clutter won't
|
|
|
3614ae |
// queue relayouts for us when the panel moves. Queue a relayout
|
|
|
3614ae |
// when that happens.
|
|
|
3614ae |
_panelBoxChangedId = Main.layoutManager.connect('panel-box-changed', Lang.bind(this, function() {
|
|
|
3614ae |
container.queue_relayout();
|
|
|
3614ae |
}));
|
|
|
3614ae |
--
|
|
|
3614ae |
1.8.3.1
|
|
|
3614ae |
|