[sushi] text: improve selection handling for text previewer
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi] text: improve selection handling for text previewer
- Date: Sat, 2 Jul 2011 05:07:15 +0000 (UTC)
commit adea213eac0566e350724a0c5ec159f813841468
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat Jul 2 00:43:19 2011 -0400
text: improve selection handling for text previewer
Includes a very ugly workaround for the lack of GdkEventButton
introspection.
src/js/viewers/text.js | 21 ++++++++-------------
1 files changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/src/js/viewers/text.js b/src/js/viewers/text.js
index 4790786..7584460 100644
--- a/src/js/viewers/text.js
+++ b/src/js/viewers/text.js
@@ -44,23 +44,17 @@ TextRenderer.prototype = {
this._view = new GtkSource.View({ buffer: this._buffer,
editable: false,
"cursor-visible": false });
+ this._view.set_can_focus(false);
if (this._buffer.get_language())
this._view.set_show_line_numbers(true);
- /* block any button press event */
- this._view.connect("button-press-event",
- Lang.bind(this, function() {
- return true;
- }));
-
- /* we don't want the ibeam cursor, since we don't allow
- * editing/selecting
- */
- this._view.connect("realize",
- Lang.bind(this, function() {
- let window = this._view.get_window(Gtk.TextWindowType.TEXT);
- window.set_cursor(null);
+ // FIXME: *very* ugly wokaround to the fact that we can't
+ // access event.button from a button-press callback to block
+ // right click
+ this._view.connect("populate-popup",
+ Lang.bind(this, function(widget, menu) {
+ menu.destroy();
}));
this._scrolledWin = Gtk.ScrolledWindow.new(null, null);
@@ -68,6 +62,7 @@ TextRenderer.prototype = {
this._scrolledWin.show_all();
this._actor = new GtkClutter.Actor({ contents: this._scrolledWin });
+ this._actor.set_reactive(true);
this._callback();
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]