-
-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathAbstractSlot.vala
More file actions
115 lines (97 loc) · 3.99 KB
/
AbstractSlot.vala
File metadata and controls
115 lines (97 loc) · 3.99 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
/*
* SPDX-FileCopyrightText: 2015-2025 elementary, Inc. (https://elementary.io)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Authors : Lucas Baudin <xapantu@gmail.com>
* Jeremy Wootten <jeremywootten@gmail.com>
*/
public abstract class Files.AbstractSlot : GLib.Object {
private Files.Directory _directory;
public Files.Directory? directory {
get {
AbstractSlot? current = get_current_slot ();
if (current != null) {
return current._directory;
} else {
return null;
}
}
protected set { _directory = value; }
}
// Directory may be destroyed before the slot so handle case that it is null
public Files.File? file {
get { return directory != null ? directory.file : null; }
}
public GLib.File? location {
get {
return directory != null ? directory.location : null;
}
set construct {
directory = Directory.from_gfile (value);
}
}
public string uri {
get { return directory != null ? directory.file.uri : ""; }
}
public virtual bool locked_focus {
get { return false; }
}
public virtual bool is_frozen { get; set; default = true; }
protected Gtk.Box extra_location_widgets;
protected Gtk.Box extra_action_widgets;
protected Gtk.Box content_box;
public Gtk.Overlay overlay { get; protected set; }
public int slot_number { get; protected set; }
protected int width;
public signal void active (bool scroll = true, bool animate = true);
public signal void inactive ();
public signal void path_changed ();
public signal void new_container_request (GLib.File loc, Files.OpenFlag flag);
public signal void selection_changed (GLib.List<Files.File> files);
public signal void directory_loaded (Files.Directory dir);
public void add_extra_widget (Gtk.Widget widget) {
extra_location_widgets.add (widget);
}
public void add_extra_action_widget (Gtk.Widget widget) {
extra_action_widgets.add (widget);
}
public void add_overlay (Gtk.Widget widget) {
overlay = new Gtk.Overlay () {
hexpand = true,
vexpand = true,
child = widget
};
content_box.add (overlay);
}
construct {
content_box = new Gtk.Box (VERTICAL, 0) {
vexpand = true,
hexpand = true
};
extra_location_widgets = new Gtk.Box (VERTICAL, 0);
content_box.add (extra_location_widgets);
extra_action_widgets = new Gtk.Box (VERTICAL, 0);
content_box.add (extra_action_widgets);
slot_number = -1;
}
public abstract void initialize_directory ();
public abstract unowned GLib.List<Files.File>? get_selected_files ();
public abstract void set_active_state (bool set_active, bool animate = true);
public abstract unowned AbstractSlot? get_current_slot ();
public abstract void reload (bool non_local_only = false);
public abstract void grab_focus ();
public abstract void user_path_change_request (GLib.File loc, bool make_root);
public abstract void focus_first_for_empty_selection (bool select);
public abstract void select_glib_files (GLib.List<GLib.File> locations, GLib.File? focus_location);
public abstract void close ();
public abstract FileInfo? lookup_file_info (GLib.File loc);
public virtual void zoom_out () {}
public virtual void zoom_in () {}
public virtual void zoom_normal () {}
public virtual bool set_all_selected (bool all_selected) { return false; }
public virtual Gtk.Widget get_content_box () { return content_box as Gtk.Widget; }
public virtual string? get_root_uri () { return directory.file.uri; }
public virtual string? get_tip_uri () { return null; }
public virtual bool get_realized () { return content_box.get_realized (); }
public virtual void handle_drop_on_tab (Gdk.DragContext ctx, Gtk.SelectionData data, uint info, uint time) {}
}