FilenameCompleter


Object Hierarchy:

GLib.FilenameCompleter GLib.FilenameCompleter GLib.FilenameCompleter GLib.Object GLib.Object GLib.Object->GLib.FilenameCompleter

Description:

[ CCode ( type_id = "g_filename_completer_get_type ()" ) ]
public class FilenameCompleter : Object

Completes partial file and directory names given a partial string by looking in the file system for clues.

Can return a list of possible completion strings for widget implementations.

Example: Filename completion:

Note:

Use control c to exit the program.

private void print_array (string title, string[] arr) {
print ("%s:\n", title);
foreach (string str in arr) {
print (" %s\n", str);
}
}

public static int main (string[] args) {
if (args.length != 2) {
print ("%s [PATH-PREFIX]\n", args[0]);
return 0;
}

// Example output:
// ./GLib.FilenameCompleter "/usr/s"
// ``Init:``
// ``Got:``
// `` /usr/sbin/``
// `` /usr/share/``
// `` /usr/src/``

FilenameCompleter completer = new FilenameCompleter ();
string[] arr = completer.get_completions (args[1]);
print_array ("Init", arr);

completer.got_completion_data.connect (() => {
arr = completer.get_completions (args[1]);
print_array ("Got", arr);
});

MainLoop loop = new MainLoop ();
loop.run ();
return 0;
}

valac --pkg gio-2.0 GLib.FilenameCompleter.vala

Namespace: GLib
Package: gio-2.0

Content:

Creation methods:

Methods:

Signals:

Inherited Members:

All known members inherited from class GLib.Object



2022 vala-language.org