Debian Codegraph @

podcasts-gtk/src/widgets/empty_view.rs

raw symbols SCIP
1 // empty_view.rs
2 //
3 // Copyright 2017 Jordan Petridis <[email protected]>
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // SPDX-License-Identifier: GPL-3.0-or-later
19
20 use crate::config::APP_ID;
21
22 use adw::subclass::prelude::*;
23 use gtk::{CompositeTemplate, glib};
24
25 #[derive(Debug, CompositeTemplate)]
26 #[template(resource = "/org/gnome/Podcasts/gtk/empty_view.ui")]
27 pub struct EmptyViewPriv {
28 #[template_child]
29 pub status_page: TemplateChild<adw::StatusPage>,
30 }
31
32 #[glib::object_subclass]
33 impl ObjectSubclass for EmptyViewPriv {
34 const NAME: &'static str = "PdEmptyView";
35 type Type = EmptyView;
36 type ParentType = adw::Bin;
37
38 fn new() -> Self {
39 Self {
40 status_page: TemplateChild::default(),
41 }
42 }
43
44 fn class_init(klass: &mut Self::Class) {
45 klass.bind_template();
46 }
47
48 // You must call `Widget`'s `init_template()` within `instance_init()`.
49 fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
50 obj.init_template();
51 }
52 }
53
54 impl ObjectImpl for EmptyViewPriv {
55 fn constructed(&self) {
56 self.parent_constructed();
57 self.status_page.set_icon_name(Some(APP_ID));
58 }
59 }
60
61 impl WidgetImpl for EmptyViewPriv {}
62 impl BinImpl for EmptyViewPriv {}
63
64 glib::wrapper! {
65 pub struct EmptyView(ObjectSubclass<EmptyViewPriv>)
66 @extends gtk::Widget, adw::Bin,
67 @implements gtk::ConstraintTarget, gtk::Buildable, gtk::Accessible;
68 }
69
70 impl Default for EmptyView {
71 fn default() -> Self {
72 glib::Object::new()
73 }
74 }