[polari] roomList: Show a context popover on right-click



commit 8917c471debe60dd1983cbfe81f31679253463f0
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Feb 21 23:50:51 2015 +0100

    roomList: Show a context popover on right-click
    
    Currently right-clicking a room will select the room and switch to
    selection mode. However as it is very uncommon to leave more than
    one room at once, so this behavior is far more cumbersome than
    helpful. So instead, just open a context popover that allows to
    directly leave the room in question.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736481

 src/roomList.js |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/roomList.js b/src/roomList.js
index d3baf14..7d82fae 100644
--- a/src/roomList.js
+++ b/src/roomList.js
@@ -18,6 +18,13 @@ const RoomRow = new Lang.Class({
         let app = Gio.Application.get_default();
         this.widget.room = room;
 
+        let menu = new Gio.Menu();
+        menu.append(room.type == Tp.HandleType.ROOM ? _("Leave chatroom")
+                                                    : _("End conversation"),
+                    'app.leave-room(("%s", ""))'.format(this.widget.room.id));
+
+        this._popover = Gtk.Popover.new_from_model(this.widget, menu);
+        this._popover.position = Gtk.PositionType.BOTTOM;
         this._eventBox.connect('button-release-event',
                             Lang.bind(this, this._onButtonRelease));
 
@@ -88,7 +95,7 @@ const RoomRow = new Lang.Class({
         if (button != Gdk.BUTTON_SECONDARY)
             return Gdk.EVENT_PROPAGATE;
 
-        this.selection_button.active = !this.selection_button.active;
+        this._popover.show();
 
         return Gdk.EVENT_STOP;
     },


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]