Blob Blame History Raw
From d9837ecc12258ee93a7cbf4ce8b8c09b77a44f5d Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 21 Jan 2014 16:48:17 -0500
Subject: [PATCH] apps-menu: add logo icon to Applications menu

Brand requested it.
---
 extensions/apps-menu/extension.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

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