[polari/wip/fmuellner/window-experiments: 23/24] app: Implement 'new-window' action
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/window-experiments: 23/24] app: Implement 'new-window' action
- Date: Mon, 18 Jul 2016 20:05:36 +0000 (UTC)
commit b134178549f9ee663df2ad3585155a5ed4e54efd
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jul 14 18:27:05 2016 +0200
app: Implement 'new-window' action
Now that all code has been adapted to deal with more than a single
main window, we can provide a 'new-window' action and expose it in
desktop actions and app menu.
data/org.gnome.Polari.desktop.in | 6 +++++-
data/resources/menus.ui | 4 ++++
src/application.js | 8 ++++++++
3 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/data/org.gnome.Polari.desktop.in b/data/org.gnome.Polari.desktop.in
index 6a6e1f1..2ef7c96 100644
--- a/data/org.gnome.Polari.desktop.in
+++ b/data/org.gnome.Polari.desktop.in
@@ -7,7 +7,7 @@ Type=Application
MimeType=x-scheme-handler/irc;
StartupNotify=true
DBusActivatable=true
-Actions=run-in-background
+Actions=new-window;run-in-background;
X-GNOME-UsesNotifications=true
Categories=GNOME;GTK;Network;IRCClient;
Keywords=IRC;Internet;Relay;Chat;
@@ -15,3 +15,7 @@ Keywords=IRC;Internet;Relay;Chat;
[Desktop Action run-in-background]
Name=Run in Background
Exec=gapplication action org.gnome.Polari run-in-background
+
+[Desktop Action new-window]
+Name=New Window
+Exec=gapplication action org.gnome.Polari new-window
diff --git a/data/resources/menus.ui b/data/resources/menus.ui
index eff8d78..7b43493 100644
--- a/data/resources/menus.ui
+++ b/data/resources/menus.ui
@@ -2,6 +2,10 @@
<menu id="app-menu">
<section>
<item>
+ <attribute name="action">app.new-window</attribute>
+ <attribute name="label" translatable="yes">New Window</attribute>
+ </item>
+ <item>
<attribute name="action">app.run-in-background</attribute>
<attribute name="label" translatable="yes">Run in Background</attribute>
</item>
diff --git a/src/application.js b/src/application.js
index 66e7d46..e9dea77 100644
--- a/src/application.js
+++ b/src/application.js
@@ -78,6 +78,8 @@ const Application = new Lang.Class({
{ name: 'edit-connection',
activate: Lang.bind(this, this._onEditConnection),
parameter_type: GLib.VariantType.new('o') },
+ { name: 'new-window',
+ activate: Lang.bind(this, this._onNewWindow) },
{ name: 'run-in-background',
activate: Lang.bind(this, this._onRunInBackground) },
{ name: 'help',
@@ -517,6 +519,12 @@ const Application = new Lang.Class({
dialog.show();
},
+ _onNewWindow: function() {
+ this.get_windows().reverse().forEach(w => { w.show(); });
+ let window = new MainWindow.MainWindow({ application: this });
+ window.present();
+ },
+
_onRunInBackground: function() {
if (this.active_window) {
this.get_windows().forEach(w => { w.hide(); });
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]