diff --git a/debian/changelog b/debian/changelog index 5b9aa14..3ecd552 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +gnome-shell-extensions (3.27.92-2kali1) UNRELEASED; urgency=medium + + * Sync with Debian. Remaining changes: + - apps-menu with multiple levels + + -- Sophie Brun Tue, 20 Mar 2018 10:15:42 +0100 + gnome-shell-extensions (3.27.92-2) unstable; urgency=medium * Release to unstable diff --git a/debian/patches/apps-menu-with-multiple-levels.patch b/debian/patches/apps-menu-with-multiple-levels.patch index 91e81f4..180ffad 100644 --- a/debian/patches/apps-menu-with-multiple-levels.patch +++ b/debian/patches/apps-menu-with-multiple-levels.patch @@ -5,37 +5,34 @@ --- a/extensions/apps-menu/extension.js +++ b/extensions/apps-menu/extension.js -@@ -124,10 +124,9 @@ const ApplicationMenuItem = new Lang.Cla - - const CategoryMenuItem = new Lang.Class({ - Name: 'CategoryMenuItem', -- Extends: PopupMenu.PopupBaseMenuItem, -+ Extends: PopupMenu.PopupMenuItem, - - _init: function(button, category) { -- this.parent(); - this._category = category; - this._button = button; - -@@ -140,8 +139,121 @@ const CategoryMenuItem = new Lang.Class( +@@ -114,7 +114,7 @@ class ApplicationMenuItem extends PopupM + } + }; + +-class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem { ++class CategoryMenuItem extends PopupMenu.PopupMenuItem { + constructor(button, category) { + super(); + this._category = category; +@@ -129,8 +129,121 @@ class CategoryMenuItem extends PopupMenu else name = _("Favorites"); - this.actor.add_child(new St.Label({ text: name })); -- this.actor.connect('motion-event', Lang.bind(this, this._onMotionEvent)); -+ this.parent(name); +- this.actor.connect('motion-event', this._onMotionEvent.bind(this)); ++ this._init(name); + + //this.actor.connect('motion-event', Lang.bind(this, this._onMotionEvent)); -+ }, -+ -+ activate: function(event) { ++ } ++ ++ activate(event) { + this._button.selectCategory(this._category, this); + //this._button.scrollToCatButton(this); + // we don't chain up here so that clicking on a category doesn't + // close the menu -+ }, -+ -+ _isNavigatingSubmenu: function([x, y]) { ++ } ++ ++ _isNavigatingSubmenu([x, y]) { + let [posX, posY] = this.actor.get_transformed_position(); + + if (this._oldX == -1) { @@ -90,9 +87,9 @@ + return true; + + return false; -+ }, -+ -+ _onMotionEvent: function(actor, event) { ++ } ++ ++ _onMotionEvent(actor, event) { + if (!Clutter.get_pointer_grab()) { + this._oldX = -1; + this._oldY = -1; @@ -108,22 +105,21 @@ + this.actor.hover = false; + Clutter.ungrab_pointer(); + return false; -+ }, -+ -+ setActive: function(active, params) { ++ } ++ ++ setActive(active, params) { + if (active) { + this._button.selectCategory(this._category, this); + //this._button.scrollToCatButton(this); + } -+ this.parent(active, params); -+ } -+}); -+const ParentCategoryMenuItem = new Lang.Class({ -+ Name: 'ParentCategoryMenuItem', -+ Extends: PopupMenu.PopupSubMenuMenuItem, -+ -+ _init: function(button, category) { -+ this._category = category; ++ super.setActive(active, params); ++ } ++}; ++ ++class ParentCategoryMenuItem extends PopupMenu.PopupSubMenuMenuItem { ++ constructor(text, wantIcon, button, category) { ++ super(text, wantIcon); ++ this._category = category; + this._button = button; + + this._oldX = -1; @@ -135,29 +131,27 @@ + else + name = _("Favorites"); + -+ this.parent(name, false); ++ this._init(name, false); + + //this.actor.connect('motion-event', Lang.bind(this, this._onMotionEvent)); - }, - - activate: function(event) { -@@ -233,12 +345,29 @@ const CategoryMenuItem = new Lang.Class( - setActive: function(active, params) { ++ + } + + activate(event) { +@@ -222,12 +335,26 @@ class CategoryMenuItem extends PopupMenu + setActive(active, params) { if (active) { this._button.selectCategory(this._category, this); - this._button.scrollToCatButton(this); + //this._button.scrollToCatButton(this); } - this.parent(active, params); - } - }); - -+const PopupMenuScrollView = new Lang.Class({ -+ Name: 'PopupMenuScrollView', -+ Extends: PopupMenu.PopupMenuSection, -+ -+ _init: function() { -+ this.parent(); + super.setActive(active, params); + } + }; + ++class PopupMenuScrollView extends PopupMenu.PopupMenuSection { ++ constructor() { ++ super(); + + this.actor = new St.ScrollView({ style_class: 'vfade', + hscrollbar_policy: Gtk.PolicyType.NEVER, @@ -166,22 +160,22 @@ + this.actor.add_actor(this.box); + this.actor._delegate = this; + this.actor.clip_to_allocation = true; -+ }, -+}); -+ - const ApplicationsMenu = new Lang.Class({ - Name: 'ApplicationsMenu', - Extends: PopupMenu.PopupMenu, -@@ -473,7 +602,7 @@ const ApplicationsButton = new Lang.Clas - this._installedChangedId = appSys.connect('installed-changed', Lang.bind(this, function() { - if (this.menu.isOpen) { - this._redisplay(); -- this.mainBox.show(); -+ this.mainBox.actor.show(); - } else { - this.reloadFlag = true; - } -@@ -546,7 +675,8 @@ const ApplicationsButton = new Lang.Clas ++ } ++}; ++ + class ApplicationsMenu extends PopupMenu.PopupMenu { + constructor(sourceActor, arrowAlignment, arrowSide, button) { + super(sourceActor, arrowAlignment, arrowSide); +@@ -462,7 +589,7 @@ class ApplicationsButton extends PanelMe + _onTreeChanged() { + if (this.menu.isOpen) { + this._redisplay(); +- this.mainBox.show(); ++ this.mainBox.actor.show(); + } else { + this.reloadFlag = true; + } +@@ -536,7 +663,8 @@ class ApplicationsButton extends PanelMe this._redisplay(); this.reloadFlag = false; } @@ -189,32 +183,24 @@ + //this.categoriesBox.box.width = this._menuContainerGetPreferredWidth(this.categoriesBox.box); + this.mainBox.actor.show(); } - this.parent(menu, open); - }, -@@ -562,11 +692,11 @@ const ApplicationsButton = new Lang.Clas - - _redisplay: function() { + super._onOpenStateChanged(menu, open); + } +@@ -550,11 +678,11 @@ class ApplicationsButton extends PanelMe + + _redisplay() { this.applicationsBox.destroy_all_children(); - this.categoriesBox.destroy_all_children(); + this.categoriesBox.box.destroy_all_children(); this._display(); - }, - -- _loadCategory: function(categoryId, dir) { -+ _loadCategory: function(dir, parentCategory) { + } + +- _loadCategory(categoryId, dir) { ++ _loadCategory(dir, parentCategory) { let iter = dir.iter(); let nextType; while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) { -@@ -581,12 +711,24 @@ const ApplicationsButton = new Lang.Clas - let app = appSys.lookup_app(id); - if (!app) - app = new Shell.App({ app_info: entry.get_app_info() }); -- if (app.get_app_info().should_show()) -- this.applicationsByCategory[categoryId].push(app); -+ if (app.get_app_info().should_show()) { -+ let menu_id = dir.get_menu_id(); -+ this.applicationsByCategory[menu_id].push(app); -+ } +@@ -575,8 +703,18 @@ class ApplicationsButton extends PanelMe + this.applicationsByCategory[categoryId].push('separator'); } else if (nextType == GMenu.TreeItemType.DIRECTORY) { let subdir = iter.get_directory(); - if (!subdir.get_is_nodisplay()) @@ -233,11 +219,11 @@ + } } - }, -@@ -607,8 +749,8 @@ const ApplicationsButton = new Lang.Clas - }, - - scrollToCatButton: function(button) { + } +@@ -597,8 +735,8 @@ class ApplicationsButton extends PanelMe + } + + scrollToCatButton(button) { - let catsScrollBoxAdj = this.categoriesScrollBox.get_vscroll_bar().get_adjustment(); - let catsScrollBoxAlloc = this.categoriesScrollBox.get_allocation_box(); + let catsScrollBoxAdj = this.categoriesBox.actor.get_vscroll_bar().get_adjustment(); @@ -245,14 +231,14 @@ let currentScrollValue = catsScrollBoxAdj.get_value(); let boxHeight = catsScrollBoxAlloc.y2 - catsScrollBoxAlloc.y1; let buttonAlloc = button.actor.get_allocation_box(); -@@ -622,10 +764,16 @@ const ApplicationsButton = new Lang.Clas - }, - - _createLayout: function() { +@@ -612,10 +750,16 @@ class ApplicationsButton extends PanelMe + } + + _createLayout() { + // https://mail.gnome.org/archives/gnome-shell-list/2014-January/msg00010.html -+ this.menu._setOpenedSubMenu = Lang.bind(this, function(submenu) { ++ this.menu._setOpenedSubMenu = (submenu) => { + this._openedSubMenu = submenu; -+ }); ++ }; + let section = new PopupMenu.PopupMenuSection(); this.menu.addMenuItem(section); @@ -264,47 +250,58 @@ this.applicationsScrollBox = new St.ScrollView({ x_fill: true, y_fill: false, y_align: St.Align.START, style_class: 'apps-menu vfade' }); -@@ -637,41 +785,54 @@ const ApplicationsButton = new Lang.Clas - vscroll.connect('scroll-stop', Lang.bind(this, function() { +@@ -627,44 +771,77 @@ class ApplicationsButton extends PanelMe + vscroll.connect('scroll-stop', () => { this.menu.passEvents = false; - })); + }); - this.categoriesScrollBox = new St.ScrollView({ x_fill: true, y_fill: false, - y_align: St.Align.START, - style_class: 'vfade' }); - this.categoriesScrollBox.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); - vscroll = this.categoriesScrollBox.get_vscroll_bar(); -- vscroll.connect('scroll-start', Lang.bind(this, function() { -- this.menu.passEvents = true; -- })); -- vscroll.connect('scroll-stop', Lang.bind(this, function() { -- this.menu.passEvents = false; -- })); +- vscroll.connect('scroll-start', () => { this.menu.passEvents = true; }); +- vscroll.connect('scroll-stop', () => { this.menu.passEvents = false; }); - this.leftBox.add(this.categoriesScrollBox, { expand: true, - x_fill: true, y_fill: true, - y_align: St.Align.START }); ++// this.categoriesScrollBox = new St.ScrollView({ x_fill: true, y_fill: false, ++// y_align: St.Align.START, ++ // style_class: 'vfade' }); ++// this.categoriesScrollBox.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); ++// vscroll = this.categoriesScrollBox.get_vscroll_bar(); ++// vscroll.connect('scroll-start', () => { this.menu.passEvents = true; }); ++// vscroll.connect('scroll-stop', () => { this.menu.passEvents = false; }); ++// this.leftBox.add(this.categoriesScrollBox, { expand: true, ++// x_fill: true, y_fill: true, ++// y_align: St.Align.START }); let activities = new ActivitiesMenuItem(this); - this.leftBox.add(activities.actor, { expand: false, - x_fill: true, y_fill: false, - y_align: St.Align.START }); ++// this.leftBox.add(activities.actor, { expand: false, ++// x_fill: true, y_fill: false, ++// y_align: St.Align.START }); this.applicationsBox = new St.BoxLayout({ vertical: true }); this.applicationsScrollBox.add_actor(this.applicationsBox); - this.categoriesBox = new St.BoxLayout({ vertical: true }); - this.categoriesScrollBox.add_actor(this.categoriesBox); -- ++// this.categoriesBox = new St.BoxLayout({ vertical: true }); ++// this.categoriesScrollBox.add_actor(this.categoriesBox); + - this.mainBox.add(this.leftBox); - this.mainBox.add(this._createVertSeparator(), { expand: false, x_fill: false, y_fill: true}); - this.mainBox.add(this.applicationsScrollBox, { expand: true, x_fill: true, y_fill: true }); - section.actor.add_actor(this.mainBox); ++// this.mainBox.add(this.leftBox); ++// this.mainBox.add(this._createVertSeparator(), { expand: false, x_fill: false, y_fill: true}); ++// this.mainBox.add(this.applicationsScrollBox, { expand: true, x_fill: true, y_fill: true }); ++// section.actor.add_actor(this.mainBox); + this.categoriesBox = new PopupMenuScrollView(); + vscroll = this.categoriesBox.actor.get_vscroll_bar(); -+ vscroll.connect('scroll-start', Lang.bind(this, function() { -+ this.menu.passEvents = true; -+ })); -+ vscroll.connect('scroll-stop', Lang.bind(this, function() { -+ this.menu.passEvents = false; -+ })); ++ vscroll.connect('scroll-start', () => { this.menu.passEvents = true; }); ++ vscroll.connect('scroll-stop', () => { this.menu.passEvents = false; }); + this.leftBox.addMenuItem(this.categoriesBox); + // FIXME we re-add it to apply the right properties, but re-adding + // it causes a warning @@ -321,9 +318,9 @@ + this.mainBox.actor.add(this.applicationsScrollBox, { expand: true, + x_fill: true, y_fill: true }); + section.addMenuItem(this.mainBox); -+ }, -+ -+ _menuContainerGetPreferredWidth: function(container) { ++ } ++ ++ _menuContainerGetPreferredWidth(container) { + let max_width = 0; + for (let child = container.get_first_child(); + child; @@ -334,9 +331,9 @@ + max_width = Math.max(max_width, child.width); + } + return max_width; - }, - - _display: function() { + } + + _display() { this._applicationsButtons.clear(); - this.mainBox.style=('width: 35em;'); - this.mainBox.hide(); @@ -345,16 +342,15 @@ //Load categories this.applicationsByCategory = {}; -@@ -679,7 +840,7 @@ const ApplicationsButton = new Lang.Clas - tree.load_sync(); - let root = tree.get_root_directory(); + this._tree.load_sync(); + let root = this._tree.get_root_directory(); let categoryMenuItem = new CategoryMenuItem(this, null); - this.categoriesBox.add_actor(categoryMenuItem.actor); + this.categoriesBox.addMenuItem(categoryMenuItem); let iter = root.iter(); let nextType; while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) { -@@ -688,10 +849,12 @@ const ApplicationsButton = new Lang.Clas +@@ -673,10 +850,12 @@ class ApplicationsButton extends PanelMe if (!dir.get_is_nodisplay()) { let categoryId = dir.get_menu_id(); this.applicationsByCategory[categoryId] = []; @@ -371,7 +367,7 @@ } } } -@@ -700,8 +863,9 @@ const ApplicationsButton = new Lang.Clas +@@ -685,8 +864,9 @@ class ApplicationsButton extends PanelMe //Load applications this._displayButtons(this._listApplications(null)); @@ -380,6 +376,6 @@ + let height = this.categoriesBox.actor.height + MENU_HEIGHT_OFFSET + 'px'; + this.mainBox.actor.style+=('height: ' + height); + this.categoriesBox.box.width = 300; - }, - - _clearApplicationsBox: function(selectedActor) { + } + + selectCategory(dir, categoryMenuItem) {