Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit e3c205d

Browse files
committed
Move examples to separate folders
Also add READMEs per example with screenshots
1 parent f5e0161 commit e3c205d

File tree

140 files changed

+755
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+755
-347
lines changed

examples/Cargo.toml

+170-3
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,185 @@ optional = true
3131
[build-dependencies.gio]
3232
path = "../gio"
3333

34+
35+
[[bin]]
36+
name = "accessibility"
37+
path = "accessibility/main.rs"
38+
39+
[[bin]]
40+
name = "basic_subclass"
41+
path = "basic_subclass/main.rs"
42+
43+
[[bin]]
44+
name = "basics"
45+
path = "basics/main.rs"
46+
47+
[[bin]]
48+
name = "builder_pattern"
49+
path = "builder_pattern/main.rs"
50+
3451
[[bin]]
3552
name = "cairo_png"
53+
path = "cairo_png/main.rs"
3654
required-features = ["cairo"]
3755

3856
[[bin]]
39-
name = "listbox_model"
57+
name = "cairo_test"
58+
path = "cairo_test/main.rs"
59+
60+
[[bin]]
61+
name = "cairo_threads"
62+
path = "cairo_threads/main.rs"
63+
64+
[[bin]]
65+
name = "child_properties"
66+
path = "child_properties/main.rs"
67+
68+
[[bin]]
69+
name = "clipboard_simple"
70+
path = "clipboard_simple/main.rs"
71+
72+
[[bin]]
73+
name = "clock"
74+
path = "clock/main.rs"
75+
76+
[[bin]]
77+
name = "clone_macro"
78+
path = "clone_macro/main.rs"
79+
80+
[[bin]]
81+
name = "communication_thread"
82+
path = "communication_thread/main.rs"
83+
84+
[[bin]]
85+
name = "composite_template"
86+
path = "composite_template/main.rs"
87+
88+
[[bin]]
89+
name = "css"
90+
path = "css/main.rs"
91+
92+
[[bin]]
93+
name = "dialog"
94+
path = "dialog/main.rs"
95+
96+
[[bin]]
97+
name = "drag_drop"
98+
path = "drag_drop/main.rs"
99+
100+
[[bin]]
101+
name = "drag_drop_text_view"
102+
path = "drag_drop_text_view/main.rs"
103+
104+
[[bin]]
105+
name = "entry_completion"
106+
path = "entry_completion/main.rs"
107+
108+
[[bin]]
109+
name = "gio_async_tls"
110+
path = "gio_async_tls/main.rs"
111+
required-features = ["async-tls"]
112+
113+
[[bin]]
114+
name = "gio_futures"
115+
path = "gio_futures/main.rs"
116+
117+
[[bin]]
118+
name = "gio_futures_await"
119+
path = "gio_futures_await/main.rs"
120+
121+
[[bin]]
122+
name = "gio_task"
123+
path = "gio_task/main.rs"
124+
125+
[[bin]]
126+
name = "grid"
127+
path = "grid/main.rs"
128+
129+
[[bin]]
130+
name = "gtk_builder_basics"
131+
path = "gtk_builder_basics/main.rs"
132+
133+
[[bin]]
134+
name = "gtk_builder_signal"
135+
path = "gtk_builder_signal/main.rs"
136+
137+
[[bin]]
138+
name = "gtk_test"
139+
path = "gtk_test/main.rs"
140+
141+
[[bin]]
142+
name = "icon_view"
143+
path = "icon_view/main.rs"
144+
145+
[[bin]]
146+
name = "list_box_model"
147+
path = "list_box_model/main.rs"
40148
required-features = ["gtk/v3_16"]
41149

150+
[[bin]]
151+
name = "list_store"
152+
path = "list_store/main.rs"
153+
154+
[[bin]]
155+
name = "menu_bar"
156+
path = "menu_bar/main.rs"
157+
158+
[[bin]]
159+
name = "menu_bar_system"
160+
path = "menu_bar_system/main.rs"
161+
162+
[[bin]]
163+
name = "multi_threading_context"
164+
path = "multi_threading_context/main.rs"
165+
166+
[[bin]]
167+
name = "multi_window"
168+
path = "multi_window/main.rs"
169+
170+
[[bin]]
171+
name = "notebook"
172+
path = "notebook/main.rs"
173+
174+
[[bin]]
175+
name = "overlay"
176+
path = "overlay/main.rs"
177+
178+
[[bin]]
179+
name = "pango_attributes"
180+
path = "pango_attributes/main.rs"
181+
42182
[[bin]]
43183
name = "printing"
184+
path = "printing/main.rs"
44185
required-features = ["pangocairo"]
45186

46187
[[bin]]
47-
name = "gio_async_tls"
48-
required-features = ["async-tls"]
188+
name = "progress_tracker"
189+
path = "progress_tracker/main.rs"
190+
191+
[[bin]]
192+
name = "sync_widget"
193+
path = "sync_widget/main.rs"
194+
195+
[[bin]]
196+
name = "text_viewer"
197+
path = "text_viewer/main.rs"
198+
199+
[[bin]]
200+
name = "transparent_main_window"
201+
path = "transparent_main_window/main.rs"
202+
203+
[[bin]]
204+
name = "tree_view"
205+
path = "tree_view/main.rs"
206+
207+
[[bin]]
208+
name = "tree_view_model_sort"
209+
path = "tree_view_model_sort/main.rs"
210+
211+
[[bin]]
212+
name = "tree_view_simple"
213+
path = "tree_view_simple/main.rs"
214+
215+

examples/README.md

+49-126
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,51 @@
1-
# gtk-rs examples
2-
3-
A few gtk-rs examples. To build, just do:
4-
5-
```Shell
6-
> cargo build
7-
```
8-
9-
or to enable GTK 3.x depending on the version needed by the example (check Cargo.toml `[features]` to see all specific GTK compile features available):
10-
11-
```Shell
12-
> cargo build --features gtk_3_18
13-
> cargo build --all-features
14-
```
15-
16-
And then run the executables with:
17-
18-
``` Shell
19-
./target/debug/EXAMPLE-NAME
20-
```
21-
22-
or with cargo run (repeating the compilation features used above), example:
23-
24-
``` Shell
25-
cargo run --all-features --bin EXAMPLE-NAME
26-
```
27-
28-
Please be sure to have installed all the required libraries before building examples (the list is available on the [gtk-rs](https://github.com/gtk-rs/gtk/) repository).
29-
30-
## Example Screenshots
31-
32-
Screenshots of examples using cairo or futures are missing.
33-
34-
#### Full GTK Example
35-
<img src="images/GTKTest.png">
36-
37-
#### Accessibility
38-
<img src="images/Accessibility.png">
39-
40-
#### A Basic Screen
41-
<img src="images/Basic.png">
42-
43-
#### Basic Subclassing
44-
<img src="images/BasicSubclass.png">
45-
46-
#### Builder Basics
47-
<img src="images/BuilderBasics.png">
48-
49-
#### Builders
50-
<img src="images/Builders.png">
51-
52-
#### Builder Signal
53-
<img src="images/BuilderSignal.png">
54-
55-
#### Child Properties
56-
<img src="images/ChildProperties.png">
57-
58-
#### Simple Clipboard
59-
<img src="images/ClipboardSimple.png">
60-
61-
#### Clock
62-
<img src="images/Clock.png">
63-
64-
#### Clone Macros
65-
<img src="images/CloneMacros.png">
66-
67-
#### Communication Thread
68-
<img src="images/CommunicationThread.png">
69-
70-
#### Complex Drag and Drop
71-
<img src="images/ComplexDragDrop.png">
72-
73-
#### CSS
74-
<img src="images/CSS.png">
75-
76-
#### Entry Completion
77-
<img src="images/EntryCompletion.png">
78-
79-
#### Grid
80-
<img src="images/Grid.png">
81-
82-
#### Icon View
83-
<img src="images/Iconview.png">
84-
85-
#### List Box
86-
<img src="images/ListBox.png">
87-
88-
#### List Store
89-
<img src="images/ListStore.png">
90-
91-
#### Menu
92-
<img src="images/Menu.png">
93-
94-
#### Multithreading
95-
<img src="images/Multithreading.png">
96-
97-
#### Multi Window
98-
<img src="images/MultiWindow.png">
99-
100-
#### Notebook
101-
<img src="images/Notebook.png">
102-
103-
#### Overlay
104-
<img src="images/Overlay.png">
105-
106-
#### Progress Tracker
107-
<img src="images/ProgressTracker.png">
108-
109-
#### Simple Drag and Drop
110-
<img src="images/SimpleDragDrop.png">
111-
112-
#### Sync Widgets
113-
<img src="images/SyncWidget.png">
114-
115-
#### System Menu
116-
<img src="images/SystemMenu.png">
117-
118-
#### Text Viewer
119-
<img src="images/Textviewer.png">
120-
121-
#### Tree View
122-
<img src="images/Treeview.png">
123-
124-
#### Tree View with Sort
125-
<img src="images/TreeviewModelSort.png">
1+
# Examples
2+
3+
Consists of various examples to get familiar with writing applications using the `gtk-rs` bindings.
4+
Please be sure to have installed all the required libraries before building the examples (the list is available on the [gtk-rs](https://github.com/gtk-rs/gtk/) repository).
5+
6+
- [Accessibility](./accessibility/)
7+
- [Basic Subclass](./basic_subclass/)
8+
- [Basics](./basics/)
9+
- [Builder Pattern](./builder_pattern/)
10+
- [Cairo PNG](./cairo_png/)
11+
- [Cairo Test](./cairo_test/)
12+
- [Child Properties](./child_properties/)
13+
- [Clipboard Simple](./clipboard/)
14+
- [Clock](./clock/)
15+
- [Clone Macro](./clone_macro/)
16+
- [Communication Thread](./communication_thread/)
17+
- [Composite Template](./composite_template/)
18+
- [CSS](./css/)
19+
- [Dialog](./dialog/)
20+
- [Drag and Drop](./drag_drop/)
21+
- [Drag and Drop TextView](./drag_drop_text_view/)
22+
- [Entry Completion](./entry_completion/)
23+
- [GIO Async TLS](./gio_async_tls/)
24+
- [GIO Futures](./gio_futures/)
25+
- [GIO Futures Await](./gio_futures_await/)
26+
- [GIO Task](./gio_task/)
27+
- [Grid](./grid/)
28+
- [GTK Builder Basics](./gtk_builder_basics/)
29+
- [GTK Builder Signal](./gtk_builder_signal/)
30+
- [GTK Test](./gtk_test/)
31+
- [Icon View](./icon_view/)
32+
- [List Box Model](./list_box_model/)
33+
- [List Store](./list_store/)
34+
- [Menu Bar](./menu_bar/)
35+
- [Menu Bar System](./menu_bar_system/)
36+
- [Multi Threading Context](./multi_threading_context/)
37+
- [Multi Window](./multi_window/)
38+
- [Notebook](./notebook/)
39+
- [Overlay](./overlay/)
40+
- [Pango Attributes](./pango_attributes/)
41+
- [Printing](./printing/)
42+
- [Progress Tracker](./progress_tracker/)
43+
- [Sync Widget](./sync_widget/)
44+
- [Text Viewer](./text_viewer/)
45+
- [Transparent Main Window](./transparent_main_window/)
46+
- [Tree View](./tree_view/)
47+
- [Tree View Model Sort](./tree_view_model_sort/)
48+
- [Tree View Simple](./tree_view_simple/)
12649

12750
## LICENSE
128-
The gtk-rs examples repository is licensed under the MIT license, please refer to the LICENSE and COPYRIGHT files for more information.
51+
The gtk-rs examples are licensed under the MIT license, please refer to the LICENSE and COPYRIGHT files for more information.

examples/accessibility/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Accessibility
2+
3+
This example demonstrates how to make an application more accessible.
4+
5+
Run it by executing:
6+
7+
```console
8+
cargo run --bin accessibility
9+
```
10+
11+
![screenshot](screenshot.png)

examples/src/bin/accessibility.rs renamed to examples/accessibility/main.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
//! # Accessibility example
2-
//!
3-
//! This sample demonstrates how to make an application more accessible.
4-
51
use gtk::prelude::*;
62
use gtk::{atk, gio};
73

0 commit comments

Comments
 (0)