[polari/wip/fmuellner/window-experiments: 12/15] roomList: Add "Open in Window" to context menu
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/window-experiments: 12/15] roomList: Add "Open in Window" to context menu
- Date: Thu, 21 Jul 2016 02:57:20 +0000 (UTC)
commit 5ebab797eaf93d34780c97738e8bafb0d9666c93
Author: Florian Müllner <fmuellner gnome org>
Date: Tue Jul 19 18:46:13 2016 +0200
roomList: Add "Open in Window" to context menu
src/application.js | 14 ++++++++++++++
src/mainWindow.js | 5 +++++
src/roomList.js | 2 ++
3 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index a1c4ce1..89951f8 100644
--- a/src/application.js
+++ b/src/application.js
@@ -82,6 +82,9 @@ const Application = new Lang.Class({
activate: Lang.bind(this, this._onNewWindow) },
{ name: 'run-in-background',
activate: Lang.bind(this, this._onRunInBackground) },
+ { name: 'open-in-window',
+ parameter_type: GLib.VariantType.new('s'),
+ activate: Lang.bind(this, this._onOpenInWindow) },
{ name: 'help',
activate: Lang.bind(this, this._onShowHelp),
accels: ['F1'] },
@@ -537,6 +540,17 @@ const Application = new Lang.Class({
}
},
+ _onOpenInWindow: function(action, param) {
+ let [roomId] = param.get_string();
+ let room = this._chatroomManager.getRoomById(roomId);
+ if (!room)
+ return;
+ let window = new MainWindow.MainWindow({ application: this,
+ active_room: room,
+ single_room: true });
+ window.present();
+ },
+
_onShowHelp: function() {
Utils.openURL('help:org.gnome.Polari', Gtk.get_current_event_time());
},
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 1455e29..1126de2 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -327,6 +327,11 @@ const MainWindow = new Lang.Class({
this._membersChangedId = 0;
this._channelChangedId = 0;
+ if (this._singleRoom) {
+ if (this._room && (!room || this._room.id != room.id))
+ this.destroy();
+ }
+
this._room = room;
this._updateTitlebar();
diff --git a/src/roomList.js b/src/roomList.js
index 72994c0..4e50e16 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -132,6 +132,8 @@ const RoomRow = new Lang.Class({
let isRoom = this._room.type == Tp.HandleType.ROOM;
menu.append(isRoom ? _("Leave chatroom") : _("End conversation"),
'app.leave-room(("%s", ""))'.format(this._room.id));
+ menu.append(_("Open in Window"),
+ 'app.open-in-window("%s")'.format(this._room.id));
this._popover = Gtk.Popover.new_from_model(this, menu);
this._popover.connect('notify::visible', _onPopoverVisibleChanged);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]