1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
/*
* Arc Menu - A traditional application menu for GNOME 3
*
* Arc Menu Lead Developer
* Andrew Zaech https://gitlab.com/AndrewZaech
*
* Arc Menu Founder/Maintainer/Graphic Designer
* LinxGem33 https://gitlab.com/LinxGem33
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const Me = imports.misc.extensionUtils.getCurrentExtension();
const {Clutter, Gtk, St} = imports.gi;
const BaseMenuLayout = Me.imports.menulayouts.baseMenuLayout;
const Constants = Me.imports.constants;
const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']);
const MW = Me.imports.menuWidgets;
const Utils = Me.imports.utils;
const _ = Gettext.gettext;
const COLUMN_SPACING = 15;
const ROW_SPACING = 15;
const COLUMN_COUNT = 6;
var createMenu = class extends BaseMenuLayout.BaseLayout{
constructor(mainButton) {
super(mainButton, {
Search: true,
SearchType: Constants.SearchType.GRID_VIEW,
VerticalMainBox: true
});
}
createLayout(){
this.searchBox = new MW.SearchBox(this);
this.searchBox._stEntry.style = "min-height: 0px; border-radius: 18px; padding: 7px 12px;";
this._searchBoxChangedId = this.searchBox.connect('changed', this._onSearchBoxChanged.bind(this));
this._searchBoxKeyPressId = this.searchBox.connect('key-press-event', this._onSearchBoxKeyPress.bind(this));
this._searchBoxKeyFocusInId = this.searchBox.connect('key-focus-in', this._onSearchBoxKeyFocusIn.bind(this));
if(this._settings.get_enum('searchbar-default-top-location') === Constants.SearchbarLocation.TOP){
this.searchBox.actor.style = "margin: 10px; padding-top: 0.0em; padding-bottom: 0.5em;padding-left: 0.4em;padding-right: 0.4em;";
this.mainBox.add(this.searchBox.actor);
}
this.subMainBox= new St.BoxLayout({
vertical: false,
x_expand: true,
y_expand: true,
y_align: Clutter.ActorAlign.START,
x_align: Clutter.ActorAlign.START
});
this.mainBox.add(this.subMainBox);
this.applicationsBox = new St.BoxLayout({
vertical: true
});
let layout = new Clutter.GridLayout({
orientation: Clutter.Orientation.VERTICAL,
column_spacing: COLUMN_SPACING,
row_spacing: ROW_SPACING
});
this.grid = new St.Widget({
x_expand: true,
x_align: Clutter.ActorAlign.CENTER,
layout_manager: layout
});
layout.hookup_style(this.grid);
this.applicationsScrollBox = this._createScrollBox({
x_expand: true,
y_expand: true,
y_align: Clutter.ActorAlign.START,
x_align: Clutter.ActorAlign.START,
overlay_scrollbars: true,
style_class: 'apps-menu vfade',
reactive:true
});
this.applicationsScrollBox.style = "width:750px;";
this.applicationsScrollBox.add_actor(this.applicationsBox);
this.subMainBox.add(this.applicationsScrollBox);
if(this._settings.get_enum('searchbar-default-top-location') === Constants.SearchbarLocation.BOTTOM){
this.searchBox.actor.style = "margin: 10px 10px 0px 10px; padding-left: 0.4em;padding-right: 0.4em;";
this.mainBox.add(this.searchBox.actor);
}
this.loadCategories();
this.displayAllApps();
this.setDefaultMenuView();
}
setDefaultMenuView(){
super.setDefaultMenuView();
this._displayAppIcons();
}
loadCategories() {
this.categoryDirectories = null;
this.categoryDirectories = new Map();
let isIconGrid = true;
super.loadCategories(MW.CategoryMenuItem, isIconGrid);
}
_displayAppList(apps) {
super._displayAppGridList(apps, COLUMN_COUNT);
}
_displayAppIcons(){
this.activeMenuItem = this.grid.layout_manager.get_child_at(0, 0);
this.applicationsBox.add(this.grid);
if(this.arcMenu.isOpen){
this.mainBox.grab_key_focus();
}
}
}
|