[gnome-shell/T29763: 86/249] discoveryFeed: Add Discovery Feed component
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/T29763: 86/249] discoveryFeed: Add Discovery Feed component
- Date: Thu, 21 May 2020 18:16:23 +0000 (UTC)
commit cb756b8455b2739cc2d997d28fd4006fbb781e2c
Author: Mario Sanchez Prada <mario endlessm com>
Date: Wed Jan 31 15:50:44 2018 +0000
discoveryFeed: Add Discovery Feed component
Also, add integration with the side component.
* 2020-03-18: Code style cleanups, rebase conflicts
* 2019-09-24: move D-Bus interface to XML file.
https://phabricator.endlessm.com/T18601
.../dbus-interfaces/com.endlessm.DiscoveryFeed.xml | 11 ++++
data/gnome-shell-dbus-interfaces.gresource.xml | 1 +
js/js-resources.gresource.xml | 1 +
js/ui/components/discoveryFeed.js | 39 ++++++++++++
js/ui/main.js | 1 +
js/ui/sessionMode.js | 4 +-
js/ui/sideComponent.js | 16 ++++-
js/ui/windowManager.js | 71 ++++++++++++++--------
8 files changed, 115 insertions(+), 29 deletions(-)
---
diff --git a/data/dbus-interfaces/com.endlessm.DiscoveryFeed.xml
b/data/dbus-interfaces/com.endlessm.DiscoveryFeed.xml
new file mode 100644
index 0000000000..2df0c9756c
--- /dev/null
+++ b/data/dbus-interfaces/com.endlessm.DiscoveryFeed.xml
@@ -0,0 +1,11 @@
+<node>
+ <interface name="com.endlessm.DiscoveryFeed">
+ <method name="show">
+ <arg type="u" direction="in" name="timestamp"/>
+ </method>
+ <method name="hide">
+ <arg type="u" direction="in" name="timestamp"/>
+ </method>
+ <property name="Visible" type="b" access="read"/>
+ </interface>
+</node>
diff --git a/data/gnome-shell-dbus-interfaces.gresource.xml b/data/gnome-shell-dbus-interfaces.gresource.xml
index 314e854a8f..1967295d13 100644
--- a/data/gnome-shell-dbus-interfaces.gresource.xml
+++ b/data/gnome-shell-dbus-interfaces.gresource.xml
@@ -2,6 +2,7 @@
<gresources>
<gresource prefix="/org/gnome/shell/dbus-interfaces">
<file preprocess="xml-stripblanks">com.endlessm.AppStore.xml</file>
+ <file preprocess="xml-stripblanks">com.endlessm.DiscoveryFeed.xml</file>
<file preprocess="xml-stripblanks">com.endlessm.Speedwagon.xml</file>
<file preprocess="xml-stripblanks">net.hadess.SensorProxy.xml</file>
<file preprocess="xml-stripblanks">net.hadess.SwitcherooControl.xml</file>
diff --git a/js/js-resources.gresource.xml b/js/js-resources.gresource.xml
index b1099c4d77..67ec3ec414 100644
--- a/js/js-resources.gresource.xml
+++ b/js/js-resources.gresource.xml
@@ -144,6 +144,7 @@
<file>ui/appActivation.js</file>
<file>ui/appIconBar.js</file>
<file>ui/components/appStore.js</file>
+ <file>ui/components/discoveryFeed.js</file>
<file>ui/endlessButton.js</file>
<file>ui/forceAppExitDialog.js</file>
<file>ui/hotCorner.js</file>
diff --git a/js/ui/components/discoveryFeed.js b/js/ui/components/discoveryFeed.js
new file mode 100644
index 0000000000..b37e864af4
--- /dev/null
+++ b/js/ui/components/discoveryFeed.js
@@ -0,0 +1,39 @@
+// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
+
+const { GObject } = imports.gi;
+
+const { loadInterfaceXML } = imports.misc.fileUtils;
+
+const Main = imports.ui.main;
+const SideComponent = imports.ui.sideComponent;
+
+const DISCOVERY_FEED_NAME = 'com.endlessm.DiscoveryFeed';
+const DISCOVERY_FEED_PATH = '/com/endlessm/DiscoveryFeed';
+
+const DiscoveryFeedIface = loadInterfaceXML('com.endlessm.DiscoveryFeed');
+
+var DiscoveryFeed = GObject.registerClass(
+class DiscoveryFeed extends SideComponent.SideComponent {
+ _init() {
+ super._init(DiscoveryFeedIface, DISCOVERY_FEED_NAME, DISCOVERY_FEED_PATH);
+ }
+
+ enable() {
+ super.enable();
+ Main.discoveryFeed = this;
+ }
+
+ disable() {
+ super.disable();
+ Main.discoveryFeed = null;
+ }
+
+ callShow(timestamp) {
+ this.proxy.showRemote(timestamp);
+ }
+
+ callHide(timestamp) {
+ this.proxy.hideRemote(timestamp);
+ }
+});
+var Component = DiscoveryFeed;
diff --git a/js/ui/main.js b/js/ui/main.js
index 103ab2badf..0df23c0ef4 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -89,6 +89,7 @@ var kbdA11yDialog = null;
var inputMethod = null;
var introspectService = null;
var locatePointer = null;
+var discoveryFeed = null;
var workspaceMonitor = null;
let _startDate;
let _defaultCssStylesheet = null;
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
index 32fba1025f..e7d1d8cbb6 100644
--- a/js/ui/sessionMode.js
+++ b/js/ui/sessionMode.js
@@ -82,9 +82,9 @@ const _modes = {
unlockDialog: imports.ui.unlockDialog.UnlockDialog,
components: Config.HAVE_NETWORKMANAGER
? ['networkAgent', 'polkitAgent', 'telepathyClient',
- 'keyring', 'autorunManager', 'automountManager', 'appStore']
+ 'keyring', 'autorunManager', 'automountManager', 'discoveryFeed', 'appStore']
: ['polkitAgent', 'telepathyClient',
- 'keyring', 'autorunManager', 'automountManager', 'appStore'],
+ 'keyring', 'autorunManager', 'automountManager', 'discoveryFeed', 'appStore'],
panel: {
left: ['endlessButton', 'appIcons'],
diff --git a/js/ui/sideComponent.js b/js/ui/sideComponent.js
index ad4883f030..74e5415cb7 100644
--- a/js/ui/sideComponent.js
+++ b/js/ui/sideComponent.js
@@ -25,7 +25,8 @@ function isSideComponentWindow(metaWindow) {
* @returns {bool} Whether other windows should be hidden while this one is open
*/
function shouldHideOtherWindows(metaWindow) {
- return isSideComponentWindow(metaWindow);
+ return isSideComponentWindow(metaWindow) &&
+ Main.discoveryFeed.launchedFromDesktop;
}
/**
@@ -35,8 +36,17 @@ function shouldHideOtherWindows(metaWindow) {
*/
function launchedFromDesktop(metaWindow) {
return isSideComponentWindow(metaWindow) &&
- metaWindow.get_wm_class() === 'Eos-app-store' &&
- Main.appStore.launchedFromDesktop;
+ ((metaWindow.get_wm_class() === 'Eos-app-store' && Main.appStore.launchedFromDesktop) ||
+ (isDiscoveryFeedWindow(metaWindow) && Main.discoveryFeed.launchedFromDesktop));
+}
+
+/**
+ * isDiscoveryFeedWindow:
+ * @param {Meta.Window} metaWindow an instance of #Meta.Window
+ * @returns {bool} whether the #Meta.Window is from the DiscoveryFeed application
+ */
+function isDiscoveryFeedWindow(metaWindow) {
+ return metaWindow && (metaWindow.get_wm_class() === 'Com.endlessm.DiscoveryFeed');
}
var SideComponent = GObject.registerClass(
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 5646c3474c..a30566a299 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -1444,18 +1444,28 @@ var WindowManager = class {
actor.opacity = 255;
actor.show();
- let endX;
- if (actor.x <= monitor.x)
- endX = monitor.x - actor.width;
- else
- endX = monitor.x + monitor.width;
+ if (SideComponent.isDiscoveryFeedWindow(actor.meta_window)) {
+ let endY = monitor.y - actor.height;
+ actor.ease({
+ y: endY,
+ duration: WINDOW_ANIMATION_TIME,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ onComplete: () => onComplete(shellwm, actor),
+ });
+ } else {
+ let endX;
+ if (actor.x <= monitor.x)
+ endX = monitor.x - actor.width;
+ else
+ endX = monitor.x + monitor.width;
- actor.ease({
- x: endX,
- duration: WINDOW_ANIMATION_TIME,
- mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- onComplete: () => onComplete(shellwm, actor),
- });
+ actor.ease({
+ x: endX,
+ duration: WINDOW_ANIMATION_TIME,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ onComplete: () => onComplete(shellwm, actor),
+ });
+ }
}
_minimizeWindow(shellwm, actor) {
@@ -1769,21 +1779,34 @@ var WindowManager = class {
return;
}
- let origX = actor.x;
- if (origX === monitor.x) {
- // the side bar will appear from the left side
- actor.set_position(monitor.x - actor.width, actor.y);
+ if (SideComponent.isDiscoveryFeedWindow(actor.meta_window)) {
+ // the DiscoveryFeed window will appear from the top center
+ let origY = actor.y;
+ actor.set_position(actor.x, monitor.y - actor.height);
+
+ actor.ease({
+ y: origY,
+ duration: WINDOW_ANIMATION_TIME,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ onComplete: this._mapWindowDone.bind(this),
+ });
} else {
- // ... from the right side
- actor.set_position(monitor.x + monitor.width, actor.y);
- }
+ let origX = actor.x;
+ if (origX === monitor.x) {
+ // the side bar will appear from the left side
+ actor.set_position(monitor.x - actor.width, actor.y);
+ } else {
+ // ... from the right side
+ actor.set_position(monitor.x + monitor.width, actor.y);
+ }
- actor.ease({
- x: origX,
- duration: WINDOW_ANIMATION_TIME,
- mode: Clutter.AnimationMode.EASE_OUT_QUAD,
- onComplete: this._mapWindowDone.bind(this),
- });
+ actor.ease({
+ x: origX,
+ duration: WINDOW_ANIMATION_TIME,
+ mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+ onComplete: this._mapWindowDone.bind(this),
+ });
+ }
actor.opacity = 255;
actor.show();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]