This file is indexed.

/usr/include/d/gtkd-3/gsv/SourceCompletion.d is in libgtkdsv-3-dev 3.7.5-2build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module gsv.SourceCompletion;

private import glib.ErrorG;
private import glib.GException;
private import glib.ListG;
private import gobject.ObjectG;
private import gobject.Signals;
private import gsv.SourceCompletionContext;
private import gsv.SourceCompletionInfo;
private import gsv.SourceCompletionProviderIF;
private import gsv.SourceView;
private import gsv.c.functions;
public  import gsv.c.types;
public  import gsvc.gsvtypes;
private import gtk.BuildableIF;
private import gtk.BuildableT;
private import gtk.TextIter;
private import std.algorithm;


/** */
public class SourceCompletion : ObjectG, BuildableIF
{
	/** the main Gtk struct */
	protected GtkSourceCompletion* gtkSourceCompletion;

	/** Get the main Gtk struct */
	public GtkSourceCompletion* getSourceCompletionStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return gtkSourceCompletion;
	}

	/** the main Gtk struct as a void* */
	protected override void* getStruct()
	{
		return cast(void*)gtkSourceCompletion;
	}

	protected override void setStruct(GObject* obj)
	{
		gtkSourceCompletion = cast(GtkSourceCompletion*)obj;
		super.setStruct(obj);
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GtkSourceCompletion* gtkSourceCompletion, bool ownedRef = false)
	{
		this.gtkSourceCompletion = gtkSourceCompletion;
		super(cast(GObject*)gtkSourceCompletion, ownedRef);
	}

	// add the Buildable capabilities
	mixin BuildableT!(GtkSourceCompletion);


	/** */
	public static GType getType()
	{
		return gtk_source_completion_get_type();
	}

	/**
	 * Add a new #GtkSourceCompletionProvider to the completion object. This will
	 * add a reference @provider, so make sure to unref your own copy when you
	 * no longer need it.
	 *
	 * Params:
	 *     provider = a #GtkSourceCompletionProvider.
	 *
	 * Returns: %TRUE if @provider was successfully added, otherwise if @error
	 *     is provided, it will be set with the error and %FALSE is returned.
	 *
	 * Throws: GException on failure.
	 */
	public bool addProvider(SourceCompletionProviderIF provider)
	{
		GError* err = null;

		auto p = gtk_source_completion_add_provider(gtkSourceCompletion, (provider is null) ? null : provider.getSourceCompletionProviderStruct(), &err) != 0;

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Block interactive completion. This can be used to disable interactive
	 * completion when inserting or deleting text from the buffer associated with
	 * the completion. Use gtk_source_completion_unblock_interactive() to enable
	 * interactive completion again.
	 *
	 * This function may be called multiple times. It will continue to block
	 * interactive completion until gtk_source_completion_unblock_interactive()
	 * has been called the same number of times.
	 */
	public void blockInteractive()
	{
		gtk_source_completion_block_interactive(gtkSourceCompletion);
	}

	/**
	 * Create a new #GtkSourceCompletionContext for @completion. The position where
	 * the completion occurs can be specified by @position. If @position is %NULL,
	 * the current cursor position will be used.
	 *
	 * Params:
	 *     position = a #GtkTextIter, or %NULL.
	 *
	 * Returns: a new #GtkSourceCompletionContext.
	 *     The reference being returned is a 'floating' reference,
	 *     so if you invoke gtk_source_completion_show() with this context
	 *     you don't need to unref it.
	 */
	public SourceCompletionContext createContext(TextIter position)
	{
		auto p = gtk_source_completion_create_context(gtkSourceCompletion, (position is null) ? null : position.getTextIterStruct());

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(SourceCompletionContext)(cast(GtkSourceCompletionContext*) p);
	}

	/**
	 * The info widget is the window where the completion displays optional extra
	 * information of the proposal.
	 *
	 * Returns: The #GtkSourceCompletionInfo window
	 *     associated with @completion.
	 */
	public SourceCompletionInfo getInfoWindow()
	{
		auto p = gtk_source_completion_get_info_window(gtkSourceCompletion);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(SourceCompletionInfo)(cast(GtkSourceCompletionInfo*) p);
	}

	/**
	 * Get list of providers registered on @completion. The returned list is owned
	 * by the completion and should not be freed.
	 *
	 * Returns: list of #GtkSourceCompletionProvider.
	 */
	public ListG getProviders()
	{
		auto p = gtk_source_completion_get_providers(gtkSourceCompletion);

		if(p is null)
		{
			return null;
		}

		return new ListG(cast(GList*) p);
	}

	/**
	 * The #GtkSourceView associated with @completion, or %NULL if the view has been
	 * destroyed.
	 *
	 * Returns: The #GtkSourceView associated with
	 *     @completion, or %NULL.
	 */
	public SourceView getView()
	{
		auto p = gtk_source_completion_get_view(gtkSourceCompletion);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(SourceView)(cast(GtkSourceView*) p);
	}

	/**
	 * Hides the completion if it is active (visible).
	 */
	public void hide()
	{
		gtk_source_completion_hide(gtkSourceCompletion);
	}

	/**
	 * Move the completion window to a specific iter.
	 *
	 * Deprecated: Use gtk_source_completion_provider_get_start_iter() instead.
	 *
	 * Params:
	 *     iter = a #GtkTextIter.
	 */
	public void moveWindow(TextIter iter)
	{
		gtk_source_completion_move_window(gtkSourceCompletion, (iter is null) ? null : iter.getTextIterStruct());
	}

	/**
	 * Remove @provider from the completion.
	 *
	 * Params:
	 *     provider = a #GtkSourceCompletionProvider.
	 *
	 * Returns: %TRUE if @provider was successfully removed, otherwise if @error
	 *     is provided, it will be set with the error and %FALSE is returned.
	 *
	 * Throws: GException on failure.
	 */
	public bool removeProvider(SourceCompletionProviderIF provider)
	{
		GError* err = null;

		auto p = gtk_source_completion_remove_provider(gtkSourceCompletion, (provider is null) ? null : provider.getSourceCompletionProviderStruct(), &err) != 0;

		if (err !is null)
		{
			throw new GException( new ErrorG(err) );
		}

		return p;
	}

	/**
	 * Starts a new completion with the specified #GtkSourceCompletionContext and
	 * a list of potential candidate providers for completion.
	 *
	 * It can be convenient for showing a completion on-the-fly, without the need to
	 * add or remove providers to the #GtkSourceCompletion.
	 *
	 * Another solution is to add providers with
	 * gtk_source_completion_add_provider(), and implement
	 * gtk_source_completion_provider_match() for each provider.
	 *
	 * Params:
	 *     providers = a list of #GtkSourceCompletionProvider, or %NULL.
	 *     context = The #GtkSourceCompletionContext
	 *         with which to start the completion.
	 *
	 * Returns: %TRUE if it was possible to the show completion window.
	 */
	public bool show(ListG providers, SourceCompletionContext context)
	{
		return gtk_source_completion_show(gtkSourceCompletion, (providers is null) ? null : providers.getListGStruct(), (context is null) ? null : context.getSourceCompletionContextStruct()) != 0;
	}

	/**
	 * Unblock interactive completion. This can be used after using
	 * gtk_source_completion_block_interactive() to enable interactive completion
	 * again.
	 */
	public void unblockInteractive()
	{
		gtk_source_completion_unblock_interactive(gtkSourceCompletion);
	}

	protected class OnActivateProposalDelegateWrapper
	{
		void delegate(SourceCompletion) dlg;
		gulong handlerId;

		this(void delegate(SourceCompletion) dlg)
		{
			this.dlg = dlg;
			onActivateProposalListeners ~= this;
		}

		void remove(OnActivateProposalDelegateWrapper source)
		{
			foreach(index, wrapper; onActivateProposalListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onActivateProposalListeners[index] = null;
					onActivateProposalListeners = std.algorithm.remove(onActivateProposalListeners, index);
					break;
				}
			}
		}
	}
	OnActivateProposalDelegateWrapper[] onActivateProposalListeners;

	/**
	 * The #GtkSourceCompletion::activate-proposal signal is a
	 * keybinding signal which gets emitted when the user initiates
	 * a proposal activation.
	 *
	 * Applications should not connect to it, but may emit it with
	 * g_signal_emit_by_name() if they need to control the proposal
	 * activation programmatically.
	 */
	gulong addOnActivateProposal(void delegate(SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnActivateProposalDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"activate-proposal",
			cast(GCallback)&callBackActivateProposal,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackActivateProposalDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackActivateProposal(GtkSourceCompletion* sourcecompletionStruct, OnActivateProposalDelegateWrapper wrapper)
	{
		wrapper.dlg(wrapper.outer);
	}

	extern(C) static void callBackActivateProposalDestroy(OnActivateProposalDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnHideDelegateWrapper
	{
		void delegate(SourceCompletion) dlg;
		gulong handlerId;

		this(void delegate(SourceCompletion) dlg)
		{
			this.dlg = dlg;
			onHideListeners ~= this;
		}

		void remove(OnHideDelegateWrapper source)
		{
			foreach(index, wrapper; onHideListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onHideListeners[index] = null;
					onHideListeners = std.algorithm.remove(onHideListeners, index);
					break;
				}
			}
		}
	}
	OnHideDelegateWrapper[] onHideListeners;

	/**
	 * Emitted when the completion window is hidden. The default handler
	 * will actually hide the window.
	 */
	gulong addOnHide(void delegate(SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnHideDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"hide",
			cast(GCallback)&callBackHide,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackHideDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackHide(GtkSourceCompletion* sourcecompletionStruct, OnHideDelegateWrapper wrapper)
	{
		wrapper.dlg(wrapper.outer);
	}

	extern(C) static void callBackHideDestroy(OnHideDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnMoveCursorDelegateWrapper
	{
		void delegate(GtkScrollStep, int, SourceCompletion) dlg;
		gulong handlerId;

		this(void delegate(GtkScrollStep, int, SourceCompletion) dlg)
		{
			this.dlg = dlg;
			onMoveCursorListeners ~= this;
		}

		void remove(OnMoveCursorDelegateWrapper source)
		{
			foreach(index, wrapper; onMoveCursorListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onMoveCursorListeners[index] = null;
					onMoveCursorListeners = std.algorithm.remove(onMoveCursorListeners, index);
					break;
				}
			}
		}
	}
	OnMoveCursorDelegateWrapper[] onMoveCursorListeners;

	/**
	 * The #GtkSourceCompletion::move-cursor signal is a keybinding
	 * signal which gets emitted when the user initiates a cursor
	 * movement.
	 *
	 * The <keycap>Up</keycap>, <keycap>Down</keycap>,
	 * <keycap>PageUp</keycap>, <keycap>PageDown</keycap>,
	 * <keycap>Home</keycap> and <keycap>End</keycap> keys are bound to the
	 * normal behavior expected by those keys.
	 *
	 * When @step is equal to %GTK_SCROLL_PAGES, the page size is defined by
	 * the #GtkSourceCompletion:proposal-page-size property. It is used for
	 * the <keycap>PageDown</keycap> and <keycap>PageUp</keycap> keys.
	 *
	 * Applications should not connect to it, but may emit it with
	 * g_signal_emit_by_name() if they need to control the cursor
	 * programmatically.
	 *
	 * Params:
	 *     step = The #GtkScrollStep by which to move the cursor
	 *     num = The amount of steps to move the cursor
	 */
	gulong addOnMoveCursor(void delegate(GtkScrollStep, int, SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnMoveCursorDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"move-cursor",
			cast(GCallback)&callBackMoveCursor,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackMoveCursorDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackMoveCursor(GtkSourceCompletion* sourcecompletionStruct, GtkScrollStep step, int num, OnMoveCursorDelegateWrapper wrapper)
	{
		wrapper.dlg(step, num, wrapper.outer);
	}

	extern(C) static void callBackMoveCursorDestroy(OnMoveCursorDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnMovePageDelegateWrapper
	{
		void delegate(GtkScrollStep, int, SourceCompletion) dlg;
		gulong handlerId;

		this(void delegate(GtkScrollStep, int, SourceCompletion) dlg)
		{
			this.dlg = dlg;
			onMovePageListeners ~= this;
		}

		void remove(OnMovePageDelegateWrapper source)
		{
			foreach(index, wrapper; onMovePageListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onMovePageListeners[index] = null;
					onMovePageListeners = std.algorithm.remove(onMovePageListeners, index);
					break;
				}
			}
		}
	}
	OnMovePageDelegateWrapper[] onMovePageListeners;

	/**
	 * The #GtkSourceCompletion::move-page signal is a keybinding
	 * signal which gets emitted when the user initiates a page
	 * movement (i.e. switches between provider pages).
	 *
	 * <keycombo><keycap>Control</keycap><keycap>Left</keycap></keycombo>
	 * is for going to the previous provider.
	 * <keycombo><keycap>Control</keycap><keycap>Right</keycap></keycombo>
	 * is for going to the next provider.
	 * <keycombo><keycap>Control</keycap><keycap>Home</keycap></keycombo>
	 * is for displaying all the providers.
	 * <keycombo><keycap>Control</keycap><keycap>End</keycap></keycombo>
	 * is for going to the last provider.
	 *
	 * When @step is equal to #GTK_SCROLL_PAGES, the page size is defined by
	 * the #GtkSourceCompletion:provider-page-size property.
	 *
	 * Applications should not connect to it, but may emit it with
	 * g_signal_emit_by_name() if they need to control the page selection
	 * programmatically.
	 *
	 * Params:
	 *     step = The #GtkScrollStep by which to move the page
	 *     num = The amount of steps to move the page
	 */
	gulong addOnMovePage(void delegate(GtkScrollStep, int, SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnMovePageDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"move-page",
			cast(GCallback)&callBackMovePage,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackMovePageDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackMovePage(GtkSourceCompletion* sourcecompletionStruct, GtkScrollStep step, int num, OnMovePageDelegateWrapper wrapper)
	{
		wrapper.dlg(step, num, wrapper.outer);
	}

	extern(C) static void callBackMovePageDestroy(OnMovePageDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnPopulateContextDelegateWrapper
	{
		void delegate(SourceCompletionContext, SourceCompletion) dlg;
		gulong handlerId;

		this(void delegate(SourceCompletionContext, SourceCompletion) dlg)
		{
			this.dlg = dlg;
			onPopulateContextListeners ~= this;
		}

		void remove(OnPopulateContextDelegateWrapper source)
		{
			foreach(index, wrapper; onPopulateContextListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onPopulateContextListeners[index] = null;
					onPopulateContextListeners = std.algorithm.remove(onPopulateContextListeners, index);
					break;
				}
			}
		}
	}
	OnPopulateContextDelegateWrapper[] onPopulateContextListeners;

	/**
	 * Emitted just before starting to populate the completion with providers.
	 * You can use this signal to add additional attributes in the context.
	 *
	 * Params:
	 *     context = The #GtkSourceCompletionContext for the current completion
	 */
	gulong addOnPopulateContext(void delegate(SourceCompletionContext, SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnPopulateContextDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"populate-context",
			cast(GCallback)&callBackPopulateContext,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackPopulateContextDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackPopulateContext(GtkSourceCompletion* sourcecompletionStruct, GtkSourceCompletionContext* context, OnPopulateContextDelegateWrapper wrapper)
	{
		wrapper.dlg(ObjectG.getDObject!(SourceCompletionContext)(context), wrapper.outer);
	}

	extern(C) static void callBackPopulateContextDestroy(OnPopulateContextDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnShowDelegateWrapper
	{
		void delegate(SourceCompletion) dlg;
		gulong handlerId;

		this(void delegate(SourceCompletion) dlg)
		{
			this.dlg = dlg;
			onShowListeners ~= this;
		}

		void remove(OnShowDelegateWrapper source)
		{
			foreach(index, wrapper; onShowListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onShowListeners[index] = null;
					onShowListeners = std.algorithm.remove(onShowListeners, index);
					break;
				}
			}
		}
	}
	OnShowDelegateWrapper[] onShowListeners;

	/**
	 * Emitted when the completion window is shown. The default handler
	 * will actually show the window.
	 */
	gulong addOnShow(void delegate(SourceCompletion) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnShowDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"show",
			cast(GCallback)&callBackShow,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackShowDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackShow(GtkSourceCompletion* sourcecompletionStruct, OnShowDelegateWrapper wrapper)
	{
		wrapper.dlg(wrapper.outer);
	}

	extern(C) static void callBackShowDestroy(OnShowDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}
}