@@ -12,18 +12,18 @@ use crate::models;
1212
1313pub mod model {
1414 use super :: * ;
15- use row_data:: ConversationRowData ;
15+ use row_data:: FolderRowData ;
1616 mod imp {
1717 use super :: * ;
1818
1919 #[ derive( Debug ) ]
20- pub struct FolderModel ( pub RefCell < Vec < ConversationRowData > > ) ;
20+ pub struct FolderListModel ( pub RefCell < Vec < FolderRowData > > ) ;
2121 // Basic declaration of our type for the GObject type system
2222
2323 #[ glib:: object_subclass]
24- impl ObjectSubclass for FolderModel {
25- const NAME : & ' static str = "FolderModel " ;
26- type Type = super :: FolderModel ;
24+ impl ObjectSubclass for FolderListModel {
25+ const NAME : & ' static str = "FolderListModel " ;
26+ type Type = super :: FolderListModel ;
2727 type ParentType = glib:: Object ;
2828 type Interfaces = ( gio:: ListModel , ) ;
2929
@@ -32,10 +32,10 @@ pub mod model {
3232 Self ( RefCell :: new ( Vec :: new ( ) ) )
3333 }
3434 }
35- impl ObjectImpl for FolderModel { }
36- impl ListModelImpl for FolderModel {
35+ impl ObjectImpl for FolderListModel { }
36+ impl ListModelImpl for FolderListModel {
3737 fn item_type ( & self , _list_model : & Self :: Type ) -> glib:: Type {
38- ConversationRowData :: static_type ( )
38+ FolderRowData :: static_type ( )
3939 }
4040 fn n_items ( & self , _list_model : & Self :: Type ) -> u32 {
4141 self . 0 . borrow ( ) . len ( ) as u32
@@ -47,16 +47,16 @@ pub mod model {
4747 }
4848 // Public part of the Model type.
4949 glib:: wrapper! {
50- pub struct FolderModel ( ObjectSubclass <imp:: FolderModel >) @implements gio:: ListModel ;
50+ pub struct FolderListModel ( ObjectSubclass <imp:: FolderListModel >) @implements gio:: ListModel ;
5151 }
5252 // Constructor for new instances. This simply calls glib::Object::new()
53- impl FolderModel {
53+ impl FolderListModel {
5454 #[ allow( clippy:: new_without_default) ]
55- pub fn new ( ) -> FolderModel {
56- glib:: Object :: new ( & [ ] ) . expect ( "Failed to create FolderModel " )
55+ pub fn new ( ) -> FolderListModel {
56+ glib:: Object :: new ( & [ ] ) . expect ( "Failed to create FolderListModel " )
5757 }
58- pub fn append ( & self , obj : & ConversationRowData ) {
59- let self_ = imp:: FolderModel :: from_instance ( self ) ;
58+ pub fn append ( & self , obj : & FolderRowData ) {
59+ let self_ = imp:: FolderListModel :: from_instance ( self ) ;
6060 let index = {
6161 // Borrow the data only once and ensure the borrow guard is dropped
6262 // before we emit the items_changed signal because the view
@@ -69,15 +69,15 @@ pub mod model {
6969 self . items_changed ( index as u32 , 0 , 1 ) ;
7070 }
7171 pub fn remove ( & self , index : u32 ) {
72- let self_ = imp:: FolderModel :: from_instance ( self ) ;
72+ let self_ = imp:: FolderListModel :: from_instance ( self ) ;
7373 self_. 0 . borrow_mut ( ) . remove ( index as usize ) ;
7474 // Emits a signal that 1 item was removed, 0 added at the position index
7575 self . items_changed ( index, 1 , 0 ) ;
7676 }
7777 }
7878}
7979
80- // This row data wrapper is needed because the FolderModel get_item_type method
80+ // This row data wrapper is needed because the FolderListModel get_item_type method
8181// needs to have a GObject type to return to the bind_model method
8282pub mod row_data {
8383 use super :: * ;
@@ -88,42 +88,42 @@ pub mod row_data {
8888
8989 // The actual data structure that stores our values. This is not accessible
9090 // directly from the outside.
91- pub struct ConversationRowData {
92- pub conversation : Rc < RefCell < Option < models:: Message > > > ,
91+ pub struct FolderRowData {
92+ pub folder : Rc < RefCell < Option < models:: Folder > > > ,
9393 }
9494
9595 // Basic declaration of our type for the GObject type system
9696 #[ glib:: object_subclass]
97- impl ObjectSubclass for ConversationRowData {
98- const NAME : & ' static str = "ConversationRowData " ;
99- type Type = super :: ConversationRowData ;
97+ impl ObjectSubclass for FolderRowData {
98+ const NAME : & ' static str = "FolderRowData " ;
99+ type Type = super :: FolderRowData ;
100100 type ParentType = glib:: Object ;
101101 // Called once at the very beginning of instantiation of each instance and
102102 // creates the data structure that contains all our state
103103 fn new ( ) -> Self {
104104 Self {
105- conversation : Default :: default ( ) ,
105+ folder : Default :: default ( ) ,
106106 }
107107 }
108108 }
109- impl ObjectImpl for ConversationRowData { }
109+ impl ObjectImpl for FolderRowData { }
110110 }
111111
112112 // The public part
113113 glib:: wrapper! {
114- pub struct ConversationRowData ( ObjectSubclass <imp:: ConversationRowData >) ;
114+ pub struct FolderRowData ( ObjectSubclass <imp:: FolderRowData >) ;
115115 }
116- impl ConversationRowData {
117- pub fn new ( ) -> ConversationRowData {
116+ impl FolderRowData {
117+ pub fn new ( ) -> FolderRowData {
118118 glib:: Object :: new ( & [ ] ) . expect ( "Failed to create row data" )
119119 }
120- pub fn set_conversation ( & self , conversation : models:: Message ) {
121- let self_ = imp:: ConversationRowData :: from_instance ( self ) ;
122- self_. conversation . replace ( Some ( conversation ) ) ;
120+ pub fn set_folder ( & self , folder : models:: Folder ) {
121+ let self_ = imp:: FolderRowData :: from_instance ( self ) ;
122+ self_. folder . replace ( Some ( folder ) ) ;
123123 }
124- pub fn get_conversation ( & self ) -> Rc < RefCell < Option < models:: Message > > > {
125- let self_ = imp:: ConversationRowData :: from_instance ( self ) ;
126- self_. conversation . clone ( )
124+ pub fn get_folder ( & self ) -> Rc < RefCell < Option < models:: Folder > > > {
125+ let self_ = imp:: FolderRowData :: from_instance ( self ) ;
126+ self_. folder . clone ( )
127127 }
128128 }
129129}
0 commit comments