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
=== modified file 'src/Services/Document.vala'
--- src/Services/Document.vala 2014-05-26 06:40:54 +0000
+++ src/Services/Document.vala 2014-06-23 21:25:28 +0000
@@ -93,13 +93,14 @@
93 }93 }
9494
95 public void toggle_changed_handlers (bool enabled) {95 public void toggle_changed_handlers (bool enabled) {
96 if (onchange_handler_id == 0)
97 return;
98 if (enabled) {96 if (enabled) {
99 onchange_handler_id = this.source_view.buffer.changed.connect (() => {97 onchange_handler_id = this.source_view.buffer.changed.connect (() => {
100 this.source_view.buffer.disconnect(onchange_handler_id);98 if (onchange_handler_id != 0) {
99 this.source_view.buffer.disconnect (onchange_handler_id);
100 }
101 // Signals for SourceView101 // Signals for SourceView
102 uint timeout_saving = -1;102 uint timeout_saving = -1;
103 check_undoable_actions ();
103 this.source_view.buffer.changed.connect (() => {104 this.source_view.buffer.changed.connect (() => {
104 check_undoable_actions ();105 check_undoable_actions ();
105 // Save if autosave is ON106 // Save if autosave is ON
@@ -118,7 +119,7 @@
118 this.set_saved_status (false);119 this.set_saved_status (false);
119 });120 });
120 });121 });
121 } else {122 } else if (onchange_handler_id != 0) {
122 this.source_view.buffer.disconnect(onchange_handler_id);123 this.source_view.buffer.disconnect(onchange_handler_id);
123 }124 }
124 }125 }
125126
=== modified file 'src/Widgets/SearchManager.vala'
--- src/Widgets/SearchManager.vala 2014-05-29 06:44:13 +0000
+++ src/Widgets/SearchManager.vala 2014-06-23 21:25:28 +0000
@@ -169,9 +169,6 @@
169 this.search_context = new Gtk.SourceSearchContext (text_buffer as Gtk.SourceBuffer, null);169 this.search_context = new Gtk.SourceSearchContext (text_buffer as Gtk.SourceBuffer, null);
170 search_context.settings.wrap_around = cycle_search;170 search_context.settings.wrap_around = cycle_search;
171 search_context.settings.regex_enabled = false;171 search_context.settings.regex_enabled = false;
172 search_context.notify["occurrences-count"].connect ((context, property) => {
173 message ("%d occurrences found", (context as Gtk.SourceSearchContext).occurrences_count);
174 });
175172
176 // Determine the search entry color173 // Determine the search entry color
177 bool found = (search_entry.text != "" && search_entry.text in this.text_buffer.text);174 bool found = (search_entry.text != "" && search_entry.text in this.text_buffer.text);

Subscribers

People subscribed via source and target branches