-
-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathProjectFolderItem.vala
More file actions
738 lines (642 loc) · 29.5 KB
/
ProjectFolderItem.vala
File metadata and controls
738 lines (642 loc) · 29.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
/*-
* Copyright (c) 2018 elementary LLC. (https://elementary.io),
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranties of
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: David Hewitt <davidmhewitt@gmail.com>
*/
namespace Scratch.FolderManager {
public class ProjectFolderItem : FolderItem {
struct VisibleItem {
public string rel_path;
public Item item;
}
private static Icon added_icon;
private static Icon modified_icon;
private SimpleAction checkout_local_branch_action;
private SimpleAction checkout_remote_branch_action;
public signal void closed ();
public Scratch.Services.MonitoredRepository? monitored_repo { get; private set; default = null; }
// Cache the visible item in the project.
private List<VisibleItem?> visible_item_list = null;
public bool is_git_repo {
get {
return monitored_repo != null;
}
}
private Ggit.Repository? git_repo {
get {
return (is_git_repo ? monitored_repo.git_repo : null);
}
}
public ProjectFolderItem (File file, FileView view) requires (file.is_valid_directory) {
Object (file: file, view: view);
}
static construct {
added_icon = new ThemedIcon ("emblem-git-new-symbolic");
modified_icon = new ThemedIcon ("emblem-git-modified-symbolic");
}
construct {
monitored_repo = Scratch.Services.GitManager.get_instance ().add_project (this);
notify["name"].connect (branch_or_name_changed);
if (monitored_repo != null) {
checkout_local_branch_action = new SimpleAction.stateful (
FileView.ACTION_CHECKOUT_LOCAL_BRANCH,
GLib.VariantType.STRING,
""
);
checkout_remote_branch_action = new SimpleAction.stateful (
FileView.ACTION_CHECKOUT_REMOTE_BRANCH,
GLib.VariantType.STRING,
""
);
monitored_repo.branch_changed.connect (branch_or_name_changed);
monitored_repo.ignored_changed.connect ((deprioritize_git_ignored));
monitored_repo.file_status_change.connect (() => update_item_status (null));
monitored_repo.update_status_map ();
monitored_repo.branch_changed ();
checkout_local_branch_action.activate.connect (handle_checkout_local_branch_action);
checkout_remote_branch_action.activate.connect (handle_checkout_remote_branch_action);
}
ProjectInfoManager.get_project_info (this);
}
private void branch_or_name_changed () {
if (monitored_repo != null) {
//As SourceList items are not widgets we have to use markup to change appearance of text.
if (monitored_repo.head_is_branch) {
markup = "%s\n<span size='small' weight='normal'>%s</span>".printf (
name, monitored_repo.branch_name
);
} else { //Distinguish detached heads visually
markup = "%s\n <span size='small' weight='normal' style='italic'>%s</span>".printf (
name, monitored_repo.branch_name
);
}
checkout_local_branch_action.set_state (monitored_repo.branch_name);
}
}
protected override void on_changed (GLib.File source, GLib.File? dest, GLib.FileMonitorEvent event) {
if (source.equal (file.file) && event == DELETED) {
closed ();
} else {
base.on_changed (source, dest, event);
}
}
public void child_folder_changed (FolderItem folder) {
if (monitored_repo != null) {
monitored_repo.update_status_map ();
}
}
public void child_folder_loaded (FolderItem folder) {
foreach (var child in folder.children) {
if (child is Item) {
var item = (Item)child;
var rel_path = this.file.file.get_relative_path (item.file.file);
if (rel_path != null && rel_path != "") {
visible_item_list.prepend ({rel_path, item});
}
}
}
if (monitored_repo != null) {
monitored_repo.update_status_map ();
update_item_status (folder);
deprioritize_git_ignored ();
}
}
public override GLib.Menu? get_context_menu () {
string file_type = "";
try {
var info = file.file.query_info (GLib.FileAttribute.STANDARD_CONTENT_TYPE, GLib.FileQueryInfoFlags.NONE);
if (info.has_attribute (GLib.FileAttribute.STANDARD_CONTENT_TYPE)) {
file_type = info.get_content_type ();
}
} catch (Error e) {
warning (e.message);
}
MenuItem set_active_folder_item;
if (is_git_repo) {
set_active_folder_item = new GLib.MenuItem (
_("Set as Active Project"),
GLib.Action.print_detailed_name (
MainWindow.ACTION_PREFIX + MainWindow.ACTION_SET_ACTIVE_PROJECT,
new Variant.string (file.path)
)
);
} else {
set_active_folder_item = new GLib.MenuItem (
_("Open in Terminal Pane"),
GLib.Action.print_detailed_name (
MainWindow.ACTION_PREFIX + MainWindow.ACTION_OPEN_IN_TERMINAL,
new Variant.string (
Services.GitManager.get_instance ().get_default_build_dir (path)
)
)
);
}
set_active_folder_item.set_attribute_value (
"accel",
Utils.get_accel_for_action (
GLib.Action.print_detailed_name (
MainWindow.ACTION_PREFIX + MainWindow.ACTION_OPEN_IN_TERMINAL,
""
)
)
);
var external_actions_section = new GLib.Menu ();
external_actions_section.append_item (set_active_folder_item);
external_actions_section.append_item (create_submenu_for_open_in (file_type));
var folder_actions_section = new GLib.Menu ();
folder_actions_section.append_item (create_submenu_for_new ());
if (monitored_repo != null) {
folder_actions_section.append_item (create_submenu_for_branch ());
}
var close_folder_item = new GLib.MenuItem (
_("Close Folder"),
GLib.Action.print_detailed_name (
FileView.ACTION_PREFIX + FileView.ACTION_CLOSE_FOLDER,
new Variant.string (file.path)
)
);
var close_all_except_item = new GLib.MenuItem (
_("Close Other Folders"),
GLib.Action.print_detailed_name (
FileView.ACTION_PREFIX + FileView.ACTION_CLOSE_OTHER_FOLDERS,
new Variant.string (file.path)
)
);
var close_other_folders_action = Utils.action_from_group (
FileView.ACTION_CLOSE_OTHER_FOLDERS,
view.actions
);
close_other_folders_action.set_enabled (view.root.children.size > 1);
var close_actions_section = new GLib.Menu ();
close_actions_section.append_item (close_folder_item);
close_actions_section.append_item (close_all_except_item);
var n_open = Scratch.Services.DocumentManager.get_instance ().open_for_project (path);
var open_text = ngettext ("Close %u Open Document",
"Close %u Open Documents",
n_open).printf (n_open);
var close_item = new GLib.MenuItem (
open_text,
GLib.Action.print_detailed_name (
MainWindow.ACTION_PREFIX + MainWindow.ACTION_CLOSE_PROJECT_DOCS,
new Variant.string (file.file.get_path ())
)
);
var hide_text = ngettext ("Hide %u Open Document",
"Hide %u Open Documents",
n_open).printf (n_open);
var hide_item = new GLib.MenuItem (
hide_text,
GLib.Action.print_detailed_name (
MainWindow.ACTION_PREFIX + MainWindow.ACTION_HIDE_PROJECT_DOCS,
new Variant.string (file.file.get_path ())
)
);
hide_item.set_attribute_value (
"accel",
Utils.get_accel_for_action (
GLib.Action.print_detailed_name (
MainWindow.ACTION_PREFIX + MainWindow.ACTION_HIDE_PROJECT_DOCS,
""
)
)
);
var n_restorable = Scratch.Services.DocumentManager.get_instance ().restorable_for_project (path);
var restore_text = ngettext ("Restore %u Hidden Document",
"Restore %u Hidden Documents",
n_restorable).printf (n_restorable);
var restore_item = new GLib.MenuItem (
restore_text,
GLib.Action.print_detailed_name (
MainWindow.ACTION_PREFIX + MainWindow.ACTION_RESTORE_PROJECT_DOCS,
new Variant.string (file.file.get_path ())
)
);
restore_item.set_attribute_value (
"accel",
Utils.get_accel_for_action (
GLib.Action.print_detailed_name (
MainWindow.ACTION_PREFIX + MainWindow.ACTION_RESTORE_PROJECT_DOCS,
""
)
)
);
var direct_actions_section = new GLib.Menu ();
if (n_restorable > 0) {
direct_actions_section.append_item (restore_item);
}
if (n_open > 0) {
direct_actions_section.append_item (hide_item);
direct_actions_section.append_item (close_item);
}
var search_item = new GLib.MenuItem (
_("Find in Project…"),
GLib.Action.print_detailed_name (
MainWindow.ACTION_PREFIX + MainWindow.ACTION_FIND_GLOBAL,
new Variant.string (file.file.get_path ())
)
);
search_item.set_attribute_value (
"accel",
Utils.get_accel_for_action (
GLib.Action.print_detailed_name (
MainWindow.ACTION_PREFIX + MainWindow.ACTION_FIND_GLOBAL,
""
)
)
);
var search_actions_section = new GLib.Menu ();
search_actions_section.append_item (search_item);
var menu_model = new GLib.Menu ();
menu_model.append_section (null, external_actions_section);
menu_model.append_section (null, folder_actions_section);
menu_model.append_section (null, close_actions_section);
menu_model.append_section (null, direct_actions_section);
menu_model.append_section (null, search_actions_section);
return menu_model;
}
protected GLib.MenuItem create_submenu_for_branch () {
// Ensures that action for relevant project is being used
view.actions.add_action (checkout_local_branch_action);
view.actions.add_action (checkout_remote_branch_action);
unowned var local_branches = monitored_repo.get_local_branches ();
var local_branch_submenu = new Menu ();
var local_branch_menu = new Menu ();
if (local_branches.length () > 0) {
local_branch_submenu.append_submenu (_("Local"), local_branch_menu);
foreach (unowned var branch_name in local_branches) {
local_branch_menu.append (
branch_name,
GLib.Action.print_detailed_name (
FileView.ACTION_PREFIX + FileView.ACTION_CHECKOUT_LOCAL_BRANCH,
branch_name
)
);
}
}
unowned var remote_branches = monitored_repo.get_remote_branches ();
var remote_branch_submenu = new Menu ();
var remote_branch_menu = new Menu ();
if (remote_branches.length () > 0) {
remote_branch_submenu.append_submenu (_("Remote"), remote_branch_menu);
foreach (unowned var branch_name in remote_branches) {
remote_branch_menu.append (
branch_name,
GLib.Action.print_detailed_name (
FileView.ACTION_PREFIX + FileView.ACTION_CHECKOUT_REMOTE_BRANCH,
branch_name
)
);
}
}
var new_branch_item = new GLib.MenuItem (
_("New Branch…"),
GLib.Action.print_detailed_name (
MainWindow.ACTION_PREFIX + MainWindow.ACTION_NEW_BRANCH,
file.path
)
);
new_branch_item.set_attribute_value (
"accel",
Utils.get_accel_for_action (
GLib.Action.print_detailed_name (
MainWindow.ACTION_PREFIX + MainWindow.ACTION_NEW_BRANCH,
""
)
)
);
GLib.Menu bottom_section = new GLib.Menu ();
bottom_section.append_item (new_branch_item);
var menu = new GLib.Menu ();
menu.append_section (null, local_branch_submenu);
menu.append_section (null, remote_branch_submenu);
menu.append_section (null, bottom_section);
var menu_item = new GLib.MenuItem.submenu (_("Branch"), menu);
return menu_item;
}
private void handle_checkout_local_branch_action (GLib.Variant? param) {
var branch_name = param != null ? param.get_string () : "";
try {
monitored_repo.change_local_branch (branch_name);
} catch (GLib.Error e) {
warning ("Failed to change branch to %s. %s", branch_name, e.message);
}
}
private void handle_checkout_remote_branch_action (GLib.Variant? param) {
var branch_name = param != null ? param.get_string () : "";
if (branch_name == "") {
return;
}
try {
monitored_repo.checkout_remote_branch (branch_name);
} catch (GLib.Error e) {
warning ("Failed to change branch to %s. %s", branch_name, e.message);
}
}
public void update_item_status (FolderItem? start_folder) {
if (monitored_repo == null) {
debug ("Ignore non-git folders");
return;
}
bool is_new = false;
string start_path = start_folder != null ? start_folder.path : "";
visible_item_list.@foreach ((visible_item) => {
if (start_path.has_prefix (visible_item.rel_path)) {
return; //Only need to update status for start_folder and its children
}
var item = visible_item.item;
item.activatable = null;
monitored_repo.non_current_entries.@foreach ((entry) => {
// Match non_current_path with parent folder as well as itself
var match = entry.key.has_prefix (visible_item.rel_path);
if (match) {
is_new = (entry.@value & (Ggit.StatusFlags.WORKING_TREE_NEW | Ggit.StatusFlags.INDEX_NEW)) > 0;
// Only mark folders new if only contains new items otherwise mark modified
if (item is FolderItem &&
is_new && item.activatable == null) {
item.activatable = added_icon;
item.activatable_tooltip = _("New");
return true; // scan all children
}
if (!(item is FolderItem) || !item.expanded) { //No need to show status when children shown
item.activatable = is_new ? added_icon : modified_icon;
item.activatable_tooltip = is_new ? _("New") : _("Modified");
}
return false;
} else {
return true;
}
});
});
}
public bool contains_file (GLib.File descendant) {
return file.file.get_relative_path (descendant) != null;
}
private void deprioritize_git_ignored () requires (monitored_repo != null) {
visible_item_list.@foreach ((visible_item) => {
var item = visible_item.item;
try {
if (monitored_repo.path_is_ignored (visible_item.rel_path)) {
item.markup = Markup.printf_escaped ("<span fgalpha='75%'><i>%s</i></span>", item.name);
} else {
item.markup = item.name;
}
} catch (Error e) {
warning ("An error occurred while checking if item '%s' is git-ignored: %s", item.name, e.message);
}
});
}
public void new_branch (string branch_name) {
try {
if (monitored_repo.head_is_branch) {
monitored_repo.create_new_branch (branch_name);
} else {
throw new IOError.NOT_FOUND ("Cannot create a new branch when head is detached");
}
} catch (Error e) {
var dialog = new Granite.MessageDialog (
_("Error while creating new branch: “%s”").printf (branch_name),
e.message,
new ThemedIcon ("git"),
Gtk.ButtonsType.CLOSE
) {
badge_icon = new ThemedIcon ("dialog-error")
};
dialog.transient_for = (Gtk.Window)(view.get_toplevel ());
dialog.response.connect (() => {
dialog.destroy ();
});
dialog.run ();
}
}
public unowned List<string> get_branch_names () {
return is_git_repo ? monitored_repo.get_local_branches () : null;
}
public bool has_local_branch_name (string name) {
return is_git_repo ? monitored_repo.has_local_branch_name (name) : false;
}
public string get_current_branch_name () {
return is_git_repo ? monitored_repo.branch_name : "";
}
public bool is_valid_new_branch_name (string new_name) {
return is_git_repo ? monitored_repo.is_valid_new_local_branch_name (new_name) : false;
}
// The parameter "is_explicit" indicates whether a global search was requested
// via a context menu on an explicitly chosen folder, in which case everything in that
// folder will be searched, or whether the hot-key was used in which case the search will
// take place on the active project and will omit certain folders
public void global_search (
GLib.File start_folder = this.file.file,
string? term = null,
bool is_explicit = false
) {
/* For now set all options to the most inclusive (except case).
* The ability to set these in the dialog (or by parameter) may be added later. */
string? search_term = null;
bool search_tracked_only = false;
bool recurse_subfolders = true;
bool check_is_text = true;
string[] path_spec = {"*.*"};
bool modified_only = false;
bool case_sensitive = false;
Regex? pattern = null;
var wholeword_search = Scratch.settings.get_boolean ("wholeword-search");
var case_mode = (CaseSensitiveMode)(Scratch.settings.get_enum ("case-sensitive-search"));
var use_regex = Scratch.settings.get_boolean ("regex-search");
switch (case_mode) {
case NEVER:
case_sensitive = false;
break;
case MIXED:
case_sensitive = (term != term.ascii_up () && term != term.ascii_down ());
break;
case ALWAYS:
case_sensitive = true;
break;
default:
assert_not_reached ();
}
var folder_name = start_folder.get_basename ();
if (this.file.file.equal (start_folder)) {
folder_name = name;
}
var dialog = new Scratch.Dialogs.GlobalSearchDialog (
folder_name,
monitored_repo != null && monitored_repo.git_repo != null,
case_sensitive,
wholeword_search,
use_regex
) {
search_term = term
};
dialog.response.connect ((response) => {
switch (response) {
case Gtk.ResponseType.ACCEPT:
search_term = dialog.search_term;
break;
default:
term = null;
break;
}
dialog.destroy ();
});
dialog.run ();
if (search_term != null) {
// Remove results of previous search before attempting a new one
remove_all_badges ();
collapse_all ();
/* Put search term in search bar to help user locate the position of the matches in each doc */
var search_variant = new Variant.string (search_term);
var app = (Gtk.Application)GLib.Application.get_default ();
var win = (Scratch.MainWindow)(app.get_active_window ());
win.actions.lookup_action ("action-find").activate (search_variant);
if (!use_regex) {
search_term = Regex.escape_string (search_term);
if (wholeword_search) {
search_term = "\\b%s\\b".printf (search_term);
}
} // else use search_term as is - TODO do we need to escape it?
try {
var flags = RegexCompileFlags.MULTILINE;
if (!case_sensitive) {
flags |= RegexCompileFlags.CASELESS;
}
pattern = new Regex (search_term, flags);
} catch (Error e) {
critical ("Error creating regex from '%s': %s", search_term, e.message);
return;
}
} else {
return;
}
var status_scope = Ggit.StatusOption.DEFAULT;
if (!modified_only) {
status_scope |= Ggit.StatusOption.INCLUDE_UNMODIFIED;
}
if (!search_tracked_only) {
status_scope |= Ggit.StatusOption.INCLUDE_UNTRACKED;
}
var status_options = new Ggit.StatusOptions (
status_scope,
Ggit.StatusShow.WORKDIR_ONLY,
path_spec
);
if (monitored_repo != null && !is_explicit) {
try {
monitored_repo.git_repo.file_status_foreach (status_options, (rel_path, status) => {
var target = file.file.resolve_relative_path (rel_path);
if (check_is_text && rel_path.has_prefix ("po/")) { // Ignore translation files
return 0;
}
if ((recurse_subfolders && start_folder.get_relative_path (target) != null) ||
start_folder.equal (target.get_parent ())) {
perform_match (target, pattern, check_is_text);
}
return 0; //TODO Allow cancelling?
});
} catch (Error err) {
warning ("Error getting file status: %s", err.message);
}
} else {
search_folder_children (start_folder, pattern, recurse_subfolders);
}
return;
}
private void search_folder_children (GLib.File start_folder, Regex pattern, bool recurse_subfolders) {
try {
var enumerator = start_folder.enumerate_children (
FileAttribute.STANDARD_CONTENT_TYPE + "," + FileAttribute.STANDARD_TYPE,
FileQueryInfoFlags.NOFOLLOW_SYMLINKS,
null
);
unowned FileInfo info = null;
unowned GLib.File child = null;
while (enumerator.iterate (out info, out child, null) && info != null) {
if (info != null && info.has_attribute (FileAttribute.STANDARD_TYPE)) {
if (info.get_file_type () == FileType.DIRECTORY) {
if (recurse_subfolders) {
search_folder_children (child, pattern, recurse_subfolders);
}
} else {
perform_match (child, pattern, true, info);
}
}
}
} catch (Error enumerate_error) {
warning ("Error enumerating children of %s: %s", start_folder.get_path (), enumerate_error.message);
}
}
private void perform_match (GLib.File target,
Regex search_regex,
bool check_is_text = false,
FileInfo? target_info = null) {
string contents;
string target_path = target.get_path ();
if (check_is_text) {
FileInfo? info = null;
if (target_info == null) {
try {
info = target.query_info (
FileAttribute.STANDARD_CONTENT_TYPE,
FileQueryInfoFlags.NOFOLLOW_SYMLINKS,
null
);
} catch (Error query_error) {
warning (
"Error getting file info for %s: %s. Ignoring.", target.get_path (), query_error.message
);
}
} else {
info = target_info;
}
if (info == null) {
return;
}
var type = info.get_content_type ();
if (!ContentType.is_mime_type (type, "text/*") ||
ContentType.is_mime_type (type, "image/*")) { //Do not search svg images
return;
}
}
try {
FileUtils.get_contents (target_path, out contents);
} catch (Error e) {
warning ("error getting contents: %s", e.message);
return;
}
MatchInfo? match_info = null;
int match_count = 0;
try {
for (search_regex.match (contents, RegexMatchFlags.NOTEMPTY, out match_info);
match_info.matches ();
match_info.next ()) {
match_count++;
}
} catch (RegexError next_error) {
critical ("Error getting next match: %s", next_error.message);
}
if (match_count > 0) {
unowned var item = view.expand_to_path (target_path);
if (item != null) {
item.badge = match_count.to_string ();
}
}
return;
}
public void refresh_diff (ref Gee.HashMap<int, Services.VCStatus> line_status_map, string doc_path) {
monitored_repo.refresh_diff (doc_path, ref line_status_map);
}
}
}