[polari] app: Add optional message parameter to 'leave-room' action
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] app: Add optional message parameter to 'leave-room' action
- Date: Wed, 30 Oct 2013 05:31:14 +0000 (UTC)
commit 5cb60b9a9fa3dccb6a0e5bd5967d6840dbfc55d8
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Oct 30 06:04:07 2013 +0100
app: Add optional message parameter to 'leave-room' action
Users may pass a custom leave message to the /part command, add
support for this.
src/application.js | 10 ++++++----
src/ircParser.js | 3 ++-
src/roomList.js | 5 +++--
3 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 8b15943..bfeed82 100644
--- a/src/application.js
+++ b/src/application.js
@@ -86,7 +86,7 @@ const Application = new Lang.Class({
parameter_type: GLib.VariantType.new('(ssu)') },
{ name: 'leave-room',
activate: Lang.bind(this, this._onLeaveRoom),
- parameter_type: GLib.VariantType.new('s') },
+ parameter_type: GLib.VariantType.new('(ss)') },
{ name: 'leave-current-room',
activate: Lang.bind(this, this._onLeaveCurrentRoom),
create_hook: Lang.bind(this, this._leaveRoomCreateHook),
@@ -353,11 +353,13 @@ const Application = new Lang.Class({
},
_onLeaveRoom: function(action, parameter) {
+ let [roomId, message] = parameter.deep_unpack();
let reason = Tp.ChannelGroupChangeReason.NONE;
- let message = _("Good Bye"); // TODO - our first setting!
- let room = this._chatroomManager.getRoomById(parameter.deep_unpack());
+ let room = this._chatroomManager.getRoomById(roomId);
if (!room)
return;
+ if (!message.length)
+ message = _("Good Bye"); // TODO - our first setting?
room.channel.leave_async(reason, message, Lang.bind(this,
function(c, res) {
try {
@@ -375,7 +377,7 @@ const Application = new Lang.Class({
if (!room)
return;
let action = this.lookup_action('leave-room');
- action.activate(GLib.Variant.new('s', room.id));
+ action.activate(GLib.Variant.new('(ss)', [room.id, '']));
},
_onToggleAction: function(action) {
diff --git a/src/ircParser.js b/src/ircParser.js
index 3380e39..63bba71 100644
--- a/src/ircParser.js
+++ b/src/ircParser.js
@@ -217,7 +217,8 @@ const IrcParser = new Lang.Class({
let app = Gio.Application.get_default();
let action = app.lookup_action('leave-room');
- action.activate(GLib.Variant.new('s', room.id));
+ let param = GLib.Variant.new('(ss)', [room.id, argv.join(' ')]);
+ action.activate(param);
break;
}
case 'QUERY': {
diff --git a/src/roomList.js b/src/roomList.js
index dfaff95..7949acd 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -198,13 +198,14 @@ const RoomList = new Lang.Class({
for (let id in this._roomRows)
if (this._roomRows[id].selection_button.active) {
let room = this._roomRows[id].widget.room;
- this._leaveAction.activate(GLib.Variant.new('s', room.id));
+ let param = GLib.Variant.new('(ss)', [room.id, '']);
+ this._leaveAction.activate(param);
}
this._selectionModeAction.change_state(GLib.Variant.new('b', false));
},
_onLeaveActivated: function(action, param) {
- let id = param.deep_unpack();
+ let [id, ] = param.deep_unpack();
let row = this._roomRows[id].widget;
let activeRoom = this._roomManager.getActiveRoom();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]