[gitg] Set normal cursor on diff with handles_selection
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Set normal cursor on diff with handles_selection
- Date: Thu, 17 Dec 2015 22:43:08 +0000 (UTC)
commit 65e3fd2e1c2833293844353fe71d3425a2e10a0a
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Thu Dec 17 23:42:46 2015 +0100
Set normal cursor on diff with handles_selection
libgitg/gitg-diff-view-hunk.vala | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/libgitg/gitg-diff-view-hunk.vala b/libgitg/gitg-diff-view-hunk.vala
index b66400e..b5bf5d2 100644
--- a/libgitg/gitg-diff-view-hunk.vala
+++ b/libgitg/gitg-diff-view-hunk.vala
@@ -131,6 +131,9 @@ class Gitg.DiffViewHunk : Gtk.Grid
d_sourceview_hunk.button_release_event.connect(button_release_event_on_view);
d_sourceview_hunk.get_style_context().add_class("handle-selection");
+
+ d_sourceview_hunk.realize.connect(update_cursor);
+ d_sourceview_hunk.notify["state-flags"].connect(update_cursor);
}
update_hunk_label();
@@ -147,6 +150,17 @@ class Gitg.DiffViewHunk : Gtk.Grid
update_theme();
}
+ private void update_cursor() {
+ var window = d_sourceview_hunk.get_window(Gtk.TextWindowType.TEXT);
+
+ if (window == null) {
+ return;
+ }
+
+ var cursor = new Gdk.Cursor.for_display(d_sourceview_hunk.get_display(),
Gdk.CursorType.LEFT_PTR);
+ window.set_cursor(cursor);
+ }
+
private void update_theme()
{
var selection_attributes = new Gtk.SourceMarkAttributes();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]