Merge lp:~evfool/scratch/lp1302887 into lp:~elementary-apps/scratch/scratch

Proposed by Robert Roth
Status: Merged
Approved by: Corentin Noël
Approved revision: 1309
Merged at revision: 1309
Proposed branch: lp:~evfool/scratch/lp1302887
Merge into: lp:~elementary-apps/scratch/scratch
Diff against target: 44 lines (+5/-7)
2 files modified
src/Services/Document.vala (+5/-4)
src/Widgets/SearchManager.vala (+0/-3)
To merge this branch: bzr merge lp:~evfool/scratch/lp1302887
Reviewer Review Type Date Requested Status
Corentin Noël Approve
Review via email: mp+221973@code.launchpad.net

Commit message

Fixed textbuffer changed events for correct revert button sensitivity after opening a file (lp:1302887)

Description of the change

This branch does:
* fix the textbuffer changed event handler registration (in its current state it did not work since my SearchManager changes for GtkSourceView based search) and adds an additional check for file changes on text change (to make the revert button correctly insensitive on file open, fixing bug 1302887)
* remove spamming searchmanager occurrence cound debug logging

To post a comment you must log in.
Revision history for this message
Corentin Noël (tintou) wrote :

I approve, it's saving the document after each change.

Revision history for this message
Corentin Noël (tintou) :
review: Approve
lp:~evfool/scratch/lp1302887 updated
1309. By Robert Roth

Added missing space

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Services/Document.vala'
2--- src/Services/Document.vala 2014-05-26 06:40:54 +0000
3+++ src/Services/Document.vala 2014-06-23 21:25:28 +0000
4@@ -93,13 +93,14 @@
5 }
6
7 public void toggle_changed_handlers (bool enabled) {
8- if (onchange_handler_id == 0)
9- return;
10 if (enabled) {
11 onchange_handler_id = this.source_view.buffer.changed.connect (() => {
12- this.source_view.buffer.disconnect(onchange_handler_id);
13+ if (onchange_handler_id != 0) {
14+ this.source_view.buffer.disconnect (onchange_handler_id);
15+ }
16 // Signals for SourceView
17 uint timeout_saving = -1;
18+ check_undoable_actions ();
19 this.source_view.buffer.changed.connect (() => {
20 check_undoable_actions ();
21 // Save if autosave is ON
22@@ -118,7 +119,7 @@
23 this.set_saved_status (false);
24 });
25 });
26- } else {
27+ } else if (onchange_handler_id != 0) {
28 this.source_view.buffer.disconnect(onchange_handler_id);
29 }
30 }
31
32=== modified file 'src/Widgets/SearchManager.vala'
33--- src/Widgets/SearchManager.vala 2014-05-29 06:44:13 +0000
34+++ src/Widgets/SearchManager.vala 2014-06-23 21:25:28 +0000
35@@ -169,9 +169,6 @@
36 this.search_context = new Gtk.SourceSearchContext (text_buffer as Gtk.SourceBuffer, null);
37 search_context.settings.wrap_around = cycle_search;
38 search_context.settings.regex_enabled = false;
39- search_context.notify["occurrences-count"].connect ((context, property) => {
40- message ("%d occurrences found", (context as Gtk.SourceSearchContext).occurrences_count);
41- });
42
43 // Determine the search entry color
44 bool found = (search_entry.text != "" && search_entry.text in this.text_buffer.text);

Subscribers

People subscribed via source and target branches