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

glib: Fix compilation of listbox_model example #355

Merged
merged 1 commit into from
Mar 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions examples/src/bin/listbox_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,32 @@
//!
//! In addition it is possible to add new rows and delete old ones.

use gtk::{gio, glib::clone, ResponseType};
use gtk::{
gio,
glib::{self, clone},
prelude::*,
ResponseType,
};

use std::env::args;

use row_data::RowData;

mod model {
use super::*;
use gio::subclass::ObjectSubclass;
use glib::subclass::prelude::*;
use row_data::RowData;

mod imp {
use super::*;
use gio::subclass::ListModelImpl;
use glib::subclass;
use glib::subclass::prelude::*;
use gio::subclass::prelude::*;
use std::cell::RefCell;

#[derive(Debug, Default)]
pub struct Model(pub RefCell<Vec<RowData>>);

// Basic declaration of our type for the GObject type system
#[glib::object_subclass]
impl ObjectSubclass for Model {
const NAME: &'static str = "Model";
type Type = super::Model;
Expand Down Expand Up @@ -277,7 +283,6 @@ fn main() {
mod row_data {
use super::*;

use glib::subclass;
use glib::subclass::prelude::*;

// Implementation sub-module of the GObject
Expand All @@ -294,6 +299,7 @@ mod row_data {
}

// Basic declaration of our type for the GObject type system
#[glib::object_subclass]
impl ObjectSubclass for RowData {
const NAME: &'static str = "RowData";
type Type = super::RowData;
Expand Down