FilenameCompleter
Object Hierarchy:
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
Content:
Creation methods:
Methods:
- public string? get_completion_suffix (string initial_text)
Obtains a completion for initial_text
from
this.
- public string[] get_completions (string initial_text)
Gets an array of completion strings for a given initial text.
- public void set_dirs_only (bool dirs_only)
If dirs_only
is true,
this will only complete directory names, and not file names.
Signals:
Inherited Members:
All known members inherited from class GLib.Object
- @get
- @new
- @ref
- @set
- add_toggle_ref
- add_weak_pointer
- bind_property
- connect
- constructed
- disconnect
- dispose
- dup_data
- dup_qdata
- force_floating
- freeze_notify
- get_class
- get_data
- get_property
- get_qdata
- get_type
- getv
- interface_find_property
- interface_install_property
- interface_list_properties
- is_floating
- new_valist
- new_with_properties
- newv
- notify
- notify_property
- ref_count
- ref_sink
- remove_toggle_ref
- remove_weak_pointer
- replace_data
- replace_qdata
- set_data
- set_data_full
- set_property
- set_qdata
- set_qdata_full
- set_valist
- setv
- steal_data
- steal_qdata
- thaw_notify
- unref
- watch_closure
- weak_ref
- weak_unref