Skip to content

Commit ef4adc0

Browse files
committed
Implement submenus for actions.
- allow submenus, separators - allow nested menus - menu editor - drag-and-drop - allow submenus to have icons - allow overriding action labels, icons - enable/disable actions - refactor blank-desktop-view, treeview-sidebar and places- sidebar to utilize GtkActions - refactor action manager to work everywhere, not just the primary view - refactor nemo-actions.c to clean up, reduce code.
1 parent 086a29d commit ef4adc0

26 files changed

Lines changed: 3463 additions & 1627 deletions
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
2+
## Actions layout JSON format
3+
4+
- The layout file is saved as `~/.config/nemo/actions/actions-tree.json`.
5+
- A missing or invalid layout will result in a flat list of all actions.
6+
- Definition requirements may change...
7+
8+
#### Structure and node elements
9+
10+
##### The definition must have a 'toplevel' root object, which contains an array of objects (with these possibly having arrays of children also):
11+
```json
12+
{
13+
"toplevel": [
14+
]
15+
}
16+
```
17+
18+
##### Children must adhere to the following definitions:
19+
- `'uuid': string` - For valid 'spices'-based actions, this will be their UUID. For legacy/non-spice actions, it will be the action file's basename, suffixed by `@untracked`. For submenus, it will be the submenu's label.
20+
- `'type': string` - `action`, `submenu` or `separator`
21+
- `'position': integer` - The action or submenu's position at the current tree depth. This is currently for reference only, as the order is preserved when parsing or creating json files, and saved position is ignored.
22+
- `'user-label': string` - can be `null` - The action or submenu's label. In the case of actions, this will be `null` initially, and the action's `Name` field will be used. It can be overridden, and the new value is kept here.
23+
- `'user-icon': string` - can be `null` or empty - The action or submenu's icon. In the case of actions, this will be `null` initially, and the icon string will be drawn from the action's `Icon-Name` field. It can be overridden - the new value is kept here. The special value of `""` (empty string) will suppress any icon altogether.
24+
- `'children': array` (submenu types only) - contains another level of actions and possibly submenus.
25+
26+
##### Example
27+
```json
28+
{
29+
"toplevel": [
30+
{
31+
"uuid": "sample@untracked",
32+
"type": "action",
33+
"position": 0,
34+
"user-label": null,
35+
"user-icon": null
36+
},
37+
{
38+
"uuid": "mint_dev_tool_make_thumbnail@untracked",
39+
"type": "action",
40+
"position": 1,
41+
"user-label": null,
42+
"user-icon": null
43+
},
44+
{
45+
"uuid": "92_show-expo@untracked",
46+
"type": "action",
47+
"position": 2,
48+
"user-label": "Manage workspaces",
49+
"user-icon": "address-book-new-symbolic"
50+
},
51+
{
52+
"uuid": "Test category",
53+
"type": "submenu",
54+
"position": 3,
55+
"user-label": "Test category",
56+
"user-icon": "face-smile",
57+
"children": [
58+
{
59+
"uuid": "change-background@untracked",
60+
"type": "action",
61+
"position": 0,
62+
"user-label": null,
63+
"user-icon": null
64+
},
65+
{
66+
"uuid": "Sub test category",
67+
"type": "submenu",
68+
"position": 1,
69+
"user-label": "Sub test category",
70+
"user-icon": null,
71+
"children": [
72+
{
73+
"uuid": "mint_dev_tool_show_file_metadata@untracked",
74+
"type": "action",
75+
"position": 0,
76+
"user-label": null,
77+
"user-icon": null
78+
}
79+
]
80+
},
81+
{
82+
"uuid": "mint_dev_tool_add_shadow@untracked",
83+
"type": "action",
84+
"position": 2,
85+
"user-label": null,
86+
"user-icon": null
87+
}
88+
]
89+
},
90+
{
91+
"uuid": "91_delete-workspace@untracked",
92+
"type": "action",
93+
"position": 4,
94+
"user-label": null,
95+
"user-icon": null
96+
}
97+
]
98+
}
99+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Generated file - DO NOT EDIT. Edit config.py.in instead.
2+
3+
LOCALE_DIR=@LOCALE_DIR@
4+
PACKAGE=@PACKAGE@
5+
VERSION=@VERSION@
6+
PKG_DATADIR=@PKG_DATADIR@

action-layout-editor/meson.build

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
conf = configuration_data()
2+
conf.set_quoted('PKG_DATADIR', nemoDataPath)
3+
conf.set_quoted('LOCALE_DIR', join_paths(get_option('prefix'), get_option('localedir')))
4+
conf.set_quoted('PACKAGE', meson.project_name())
5+
conf.set_quoted('VERSION', meson.project_version())
6+
7+
config_py = configure_file(
8+
input: 'leconfig.py.in',
9+
output: 'leconfig.py',
10+
configuration: conf,
11+
install: true,
12+
install_dir: nemoDataPath / 'layout-editor',
13+
)
14+
15+
bin_conf = configuration_data()
16+
bin_conf.set('PKG_DATADIR', nemoDataPath)
17+
18+
bin = configure_file(
19+
input: 'nemo-action-layout-editor.in',
20+
output: 'nemo-action-layout-editor',
21+
configuration: bin_conf,
22+
install: true,
23+
install_dir: get_option('bindir'),
24+
install_mode: 'rwxr-xr-x'
25+
)
26+
27+
install_data(
28+
'nemo-action-layout-editor.py',
29+
install_dir: nemoDataPath / 'layout-editor',
30+
install_mode: 'rwxr-xr-x'
31+
)
32+
33+
install_data(
34+
'nemo-action-layout-editor.glade',
35+
install_dir: nemoDataPath / 'layout-editor'
36+
)

0 commit comments

Comments
 (0)