mirror of
				https://github.com/johrpan/musicus.git
				synced 2025-10-26 11:47:25 +01:00 
			
		
		
		
	Add work and recording detail screens
This commit is contained in:
		
							parent
							
								
									cca722dcba
								
							
						
					
					
						commit
						d741f463f5
					
				
					 4 changed files with 657 additions and 382 deletions
				
			
		
							
								
								
									
										416
									
								
								res/ui/window.ui
									
										
									
									
									
								
							
							
						
						
									
										416
									
								
								res/ui/window.ui
									
										
									
									
									
								
							|  | @ -21,7 +21,7 @@ | ||||||
|             <property name="hexpand">False</property> |             <property name="hexpand">False</property> | ||||||
|             <property name="orientation">vertical</property> |             <property name="orientation">vertical</property> | ||||||
|             <child> |             <child> | ||||||
|               <object class="HdyHeaderBar" id="left_header"> |               <object class="HdyHeaderBar" id="sidebar_header"> | ||||||
|                 <property name="visible">True</property> |                 <property name="visible">True</property> | ||||||
|                 <property name="can-focus">False</property> |                 <property name="can-focus">False</property> | ||||||
|                 <property name="show-close-button">True</property> |                 <property name="show-close-button">True</property> | ||||||
|  | @ -128,7 +128,7 @@ | ||||||
|                               <object class="GtkLabel"> |                               <object class="GtkLabel"> | ||||||
|                                 <property name="visible">True</property> |                                 <property name="visible">True</property> | ||||||
|                                 <property name="can-focus">False</property> |                                 <property name="can-focus">False</property> | ||||||
|                                 <property name="label" translatable="yes">No persons found.</property> |                                 <property name="label" translatable="yes">No persons or ensembles found.</property> | ||||||
|                               </object> |                               </object> | ||||||
|                             </child> |                             </child> | ||||||
|                           </object> |                           </object> | ||||||
|  | @ -137,7 +137,7 @@ | ||||||
|                     </child> |                     </child> | ||||||
|                   </object> |                   </object> | ||||||
|                   <packing> |                   <packing> | ||||||
|                     <property name="name">persons_list</property> |                     <property name="name">content</property> | ||||||
|                     <property name="position">1</property> |                     <property name="position">1</property> | ||||||
|                   </packing> |                   </packing> | ||||||
|                 </child> |                 </child> | ||||||
|  | @ -167,13 +167,13 @@ | ||||||
|           </packing> |           </packing> | ||||||
|         </child> |         </child> | ||||||
|         <child> |         <child> | ||||||
|           <object class="GtkStack" id="stack"> |           <object class="GtkStack" id="main_stack"> | ||||||
|             <property name="visible">True</property> |             <property name="visible">True</property> | ||||||
|             <property name="can-focus">False</property> |             <property name="can-focus">False</property> | ||||||
|             <property name="hexpand">True</property> |             <property name="hexpand">True</property> | ||||||
|             <property name="transition-type">crossfade</property> |             <property name="transition-type">crossfade</property> | ||||||
|             <child> |             <child> | ||||||
|               <object class="GtkBox" id="empty_screen"> |               <object class="GtkBox"> | ||||||
|                 <property name="visible">True</property> |                 <property name="visible">True</property> | ||||||
|                 <property name="can-focus">False</property> |                 <property name="can-focus">False</property> | ||||||
|                 <property name="orientation">vertical</property> |                 <property name="orientation">vertical</property> | ||||||
|  | @ -263,7 +263,7 @@ | ||||||
|                 <property name="can-focus">False</property> |                 <property name="can-focus">False</property> | ||||||
|                 <property name="orientation">vertical</property> |                 <property name="orientation">vertical</property> | ||||||
|                 <child> |                 <child> | ||||||
|                   <object class="HdyHeaderBar" id="header"> |                   <object class="HdyHeaderBar" id="overview_header"> | ||||||
|                     <property name="visible">True</property> |                     <property name="visible">True</property> | ||||||
|                     <property name="can-focus">False</property> |                     <property name="can-focus">False</property> | ||||||
|                     <property name="show-close-button">True</property> |                     <property name="show-close-button">True</property> | ||||||
|  | @ -275,7 +275,7 @@ | ||||||
|                         <property name="transition-duration" bind-source="leaflet" bind-property="mode-transition-duration" bind-flags="bidirectional|sync-create">0</property> |                         <property name="transition-duration" bind-source="leaflet" bind-property="mode-transition-duration" bind-flags="bidirectional|sync-create">0</property> | ||||||
|                         <property name="reveal-child" bind-source="leaflet" bind-property="folded" bind-flags="sync-create">False</property> |                         <property name="reveal-child" bind-source="leaflet" bind-property="folded" bind-flags="sync-create">False</property> | ||||||
|                         <child> |                         <child> | ||||||
|                           <object class="GtkButton" id="back_button"> |                           <object class="GtkButton" id="overview_back_button"> | ||||||
|                             <property name="visible">True</property> |                             <property name="visible">True</property> | ||||||
|                             <property name="can-focus">True</property> |                             <property name="can-focus">True</property> | ||||||
|                             <property name="receives-default">True</property> |                             <property name="receives-default">True</property> | ||||||
|  | @ -292,7 +292,7 @@ | ||||||
|                       </object> |                       </object> | ||||||
|                     </child> |                     </child> | ||||||
|                     <child> |                     <child> | ||||||
|                       <object class="GtkMenuButton" id="header_menu_button"> |                       <object class="GtkMenuButton" id="overview_header_menu_button"> | ||||||
|                         <property name="visible">True</property> |                         <property name="visible">True</property> | ||||||
|                         <property name="can-focus">True</property> |                         <property name="can-focus">True</property> | ||||||
|                         <property name="focus-on-click">False</property> |                         <property name="focus-on-click">False</property> | ||||||
|  | @ -311,7 +311,7 @@ | ||||||
|                       </packing> |                       </packing> | ||||||
|                     </child> |                     </child> | ||||||
|                     <child> |                     <child> | ||||||
|                       <object class="GtkToggleButton" id="search_button"> |                       <object class="GtkToggleButton" id="overview_search_button"> | ||||||
|                         <property name="visible">True</property> |                         <property name="visible">True</property> | ||||||
|                         <property name="can-focus">True</property> |                         <property name="can-focus">True</property> | ||||||
|                         <property name="receives-default">True</property> |                         <property name="receives-default">True</property> | ||||||
|  | @ -339,14 +339,14 @@ | ||||||
|                   <object class="HdySearchBar"> |                   <object class="HdySearchBar"> | ||||||
|                     <property name="visible">True</property> |                     <property name="visible">True</property> | ||||||
|                     <property name="can-focus">False</property> |                     <property name="can-focus">False</property> | ||||||
|                     <property name="search-mode-enabled" bind-source="search_button" bind-property="active" bind-flags="bidirectional|sync-create">False</property> |                     <property name="search-mode-enabled" bind-source="overview_search_button" bind-property="active" bind-flags="bidirectional|sync-create">False</property> | ||||||
|                     <child> |                     <child> | ||||||
|                       <object class="HdyClamp"> |                       <object class="HdyClamp"> | ||||||
|                         <property name="visible">True</property> |                         <property name="visible">True</property> | ||||||
|                         <property name="can-focus">False</property> |                         <property name="can-focus">False</property> | ||||||
|                         <property name="maximum-size">400</property> |                         <property name="maximum-size">400</property> | ||||||
|                         <child> |                         <child> | ||||||
|                           <object class="GtkSearchEntry" id="search_entry"> |                           <object class="GtkSearchEntry" id="overview_search_entry"> | ||||||
|                             <property name="visible">True</property> |                             <property name="visible">True</property> | ||||||
|                             <property name="can-focus">True</property> |                             <property name="can-focus">True</property> | ||||||
|                             <property name="primary-icon-name">edit-find-symbolic</property> |                             <property name="primary-icon-name">edit-find-symbolic</property> | ||||||
|  | @ -365,7 +365,7 @@ | ||||||
|                   </packing> |                   </packing> | ||||||
|                 </child> |                 </child> | ||||||
|                 <child> |                 <child> | ||||||
|                   <object class="GtkStack" id="content_stack"> |                   <object class="GtkStack" id="overview_stack"> | ||||||
|                     <property name="visible">True</property> |                     <property name="visible">True</property> | ||||||
|                     <property name="can-focus">False</property> |                     <property name="can-focus">False</property> | ||||||
|                     <property name="transition-type">crossfade</property> |                     <property name="transition-type">crossfade</property> | ||||||
|  | @ -379,11 +379,6 @@ | ||||||
|                         <property name="name">loading</property> |                         <property name="name">loading</property> | ||||||
|                       </packing> |                       </packing> | ||||||
|                     </child> |                     </child> | ||||||
|                     <child> |  | ||||||
|                       <object class="GtkBox"> |  | ||||||
|                         <property name="visible">True</property> |  | ||||||
|                         <property name="can-focus">False</property> |  | ||||||
|                         <property name="orientation">vertical</property> |  | ||||||
|                     <child> |                     <child> | ||||||
|                       <object class="GtkScrolledWindow"> |                       <object class="GtkScrolledWindow"> | ||||||
|                         <property name="visible">True</property> |                         <property name="visible">True</property> | ||||||
|  | @ -401,7 +396,7 @@ | ||||||
|                                 <property name="orientation">vertical</property> |                                 <property name="orientation">vertical</property> | ||||||
|                                 <property name="spacing">18</property> |                                 <property name="spacing">18</property> | ||||||
|                                 <child> |                                 <child> | ||||||
|                                       <object class="GtkBox" id="work_box"> |                                   <object class="GtkBox" id="overview_work_box"> | ||||||
|                                     <property name="visible">True</property> |                                     <property name="visible">True</property> | ||||||
|                                     <property name="can-focus">False</property> |                                     <property name="can-focus">False</property> | ||||||
|                                     <property name="orientation">vertical</property> |                                     <property name="orientation">vertical</property> | ||||||
|  | @ -429,17 +424,19 @@ | ||||||
|                                         <property name="label-xalign">0</property> |                                         <property name="label-xalign">0</property> | ||||||
|                                         <property name="shadow-type">in</property> |                                         <property name="shadow-type">in</property> | ||||||
|                                         <child> |                                         <child> | ||||||
|                                               <object class="GtkListBox" id="work_list"> |                                           <object class="GtkListBox" id="overview_work_list"> | ||||||
|                                             <property name="visible">True</property> |                                             <property name="visible">True</property> | ||||||
|                                             <property name="can-focus">False</property> |                                             <property name="can-focus">False</property> | ||||||
|                                             <child type="placeholder"> |                                             <child type="placeholder"> | ||||||
|                                               <object class="GtkLabel"> |                                               <object class="GtkLabel"> | ||||||
|                                                 <property name="visible">True</property> |                                                 <property name="visible">True</property> | ||||||
|                                                 <property name="can-focus">False</property> |                                                 <property name="can-focus">False</property> | ||||||
|                                                     <property name="margin_top">6</property> |                                                 <property name="margin-left">6</property> | ||||||
|                                                     <property name="margin_bottom">6</property> |                                                 <property name="margin-right">6</property> | ||||||
|                                                     <property name="margin_start">6</property> |                                                 <property name="margin-start">6</property> | ||||||
|                                                     <property name="margin_end">6</property> |                                                 <property name="margin-end">6</property> | ||||||
|  |                                                 <property name="margin-top">6</property> | ||||||
|  |                                                 <property name="margin-bottom">6</property> | ||||||
|                                                 <property name="label" translatable="yes">No works found.</property> |                                                 <property name="label" translatable="yes">No works found.</property> | ||||||
|                                               </object> |                                               </object> | ||||||
|                                             </child> |                                             </child> | ||||||
|  | @ -460,7 +457,7 @@ | ||||||
|                                   </packing> |                                   </packing> | ||||||
|                                 </child> |                                 </child> | ||||||
|                                 <child> |                                 <child> | ||||||
|                                       <object class="GtkBox" id="recording_box"> |                                   <object class="GtkBox" id="overview_recording_box"> | ||||||
|                                     <property name="visible">True</property> |                                     <property name="visible">True</property> | ||||||
|                                     <property name="can-focus">False</property> |                                     <property name="can-focus">False</property> | ||||||
|                                     <property name="orientation">vertical</property> |                                     <property name="orientation">vertical</property> | ||||||
|  | @ -488,17 +485,19 @@ | ||||||
|                                         <property name="label-xalign">0</property> |                                         <property name="label-xalign">0</property> | ||||||
|                                         <property name="shadow-type">in</property> |                                         <property name="shadow-type">in</property> | ||||||
|                                         <child> |                                         <child> | ||||||
|                                               <object class="GtkListBox" id="recording_list"> |                                           <object class="GtkListBox" id="overview_recording_list"> | ||||||
|                                             <property name="visible">True</property> |                                             <property name="visible">True</property> | ||||||
|                                             <property name="can-focus">False</property> |                                             <property name="can-focus">False</property> | ||||||
|                                             <child type="placeholder"> |                                             <child type="placeholder"> | ||||||
|                                               <object class="GtkLabel"> |                                               <object class="GtkLabel"> | ||||||
|                                                 <property name="visible">True</property> |                                                 <property name="visible">True</property> | ||||||
|                                                 <property name="can-focus">False</property> |                                                 <property name="can-focus">False</property> | ||||||
|                                                     <property name="margin_top">6</property> |                                                 <property name="margin-left">6</property> | ||||||
|                                                     <property name="margin_bottom">6</property> |                                                 <property name="margin-right">6</property> | ||||||
|                                                     <property name="margin_start">6</property> |                                                 <property name="margin-start">6</property> | ||||||
|                                                     <property name="margin_end">6</property> |                                                 <property name="margin-end">6</property> | ||||||
|  |                                                 <property name="margin-top">6</property> | ||||||
|  |                                                 <property name="margin-bottom">6</property> | ||||||
|                                                 <property name="label" translatable="yes">No recordings found.</property> |                                                 <property name="label" translatable="yes">No recordings found.</property> | ||||||
|                                               </object> |                                               </object> | ||||||
|                                             </child> |                                             </child> | ||||||
|  | @ -524,60 +523,112 @@ | ||||||
|                         </child> |                         </child> | ||||||
|                       </object> |                       </object> | ||||||
|                       <packing> |                       <packing> | ||||||
|                             <property name="expand">True</property> |                         <property name="name">content</property> | ||||||
|                             <property name="fill">True</property> |                         <property name="position">1</property> | ||||||
|                             <property name="position">0</property> |  | ||||||
|                       </packing> |                       </packing> | ||||||
|                     </child> |                     </child> | ||||||
|                         <child> |  | ||||||
|                           <object class="GtkRevealer" id="actions_revealer"> |  | ||||||
|                             <property name="visible">True</property> |  | ||||||
|                             <property name="can-focus">False</property> |  | ||||||
|                             <property name="transition-type">slide-up</property> |  | ||||||
|                             <property name="reveal-child">False</property> |  | ||||||
|                             <child> |  | ||||||
|                               <object class="GtkActionBar"> |  | ||||||
|                                 <property name="visible">True</property> |  | ||||||
|                                 <property name="can-focus">False</property> |  | ||||||
|                                 <child> |  | ||||||
|                                   <object class="GtkButton" id="edit_button"> |  | ||||||
|                                     <property name="visible">True</property> |  | ||||||
|                                     <property name="can-focus">True</property> |  | ||||||
|                                     <property name="receives-default">True</property> |  | ||||||
|                                     <child> |  | ||||||
|                                       <object class="GtkImage"> |  | ||||||
|                                         <property name="visible">True</property> |  | ||||||
|                                         <property name="can-focus">False</property> |  | ||||||
|                                         <property name="icon-name">document-edit-symbolic</property> |  | ||||||
|                                       </object> |  | ||||||
|                                     </child> |  | ||||||
|                   </object> |                   </object> | ||||||
|                   <packing> |                   <packing> | ||||||
|                                     <property name="pack-type">start</property> |                     <property name="expand">True</property> | ||||||
|                                     <property name="position">0</property> |                     <property name="fill">True</property> | ||||||
|  |                     <property name="position">2</property> | ||||||
|  |                   </packing> | ||||||
|  |                 </child> | ||||||
|  |               </object> | ||||||
|  |               <packing> | ||||||
|  |                 <property name="name">overview_screen</property> | ||||||
|  |                 <property name="title" translatable="yes">page0</property> | ||||||
|  |                 <property name="position">1</property> | ||||||
|               </packing> |               </packing> | ||||||
|             </child> |             </child> | ||||||
|             <child> |             <child> | ||||||
|                                   <object class="GtkButton" id="delete_button"> |               <object class="GtkBox"> | ||||||
|  |                 <property name="visible">True</property> | ||||||
|  |                 <property name="can-focus">False</property> | ||||||
|  |                 <property name="orientation">vertical</property> | ||||||
|  |                 <child> | ||||||
|  |                   <object class="HdyHeaderBar" id="work_details_header"> | ||||||
|  |                     <property name="visible">True</property> | ||||||
|  |                     <property name="can-focus">False</property> | ||||||
|  |                     <property name="show-close-button">True</property> | ||||||
|  |                     <child> | ||||||
|  |                       <object class="GtkButton" id="work_details_back_button"> | ||||||
|                         <property name="visible">True</property> |                         <property name="visible">True</property> | ||||||
|                         <property name="can-focus">True</property> |                         <property name="can-focus">True</property> | ||||||
|                         <property name="receives-default">True</property> |                         <property name="receives-default">True</property> | ||||||
|                                     <style> |  | ||||||
|                                       <class name="destructive-action" /> |  | ||||||
|                                     </style> |  | ||||||
|                         <child> |                         <child> | ||||||
|                           <object class="GtkImage"> |                           <object class="GtkImage"> | ||||||
|                             <property name="visible">True</property> |                             <property name="visible">True</property> | ||||||
|                             <property name="can-focus">False</property> |                             <property name="can-focus">False</property> | ||||||
|                                         <property name="icon-name">user-trash-symbolic</property> |                             <property name="icon-name">go-previous-symbolic</property> | ||||||
|  |                           </object> | ||||||
|  |                         </child> | ||||||
|  |                       </object> | ||||||
|  |                     </child> | ||||||
|  |                     <child> | ||||||
|  |                       <object class="GtkMenuButton" id="work_details_header_menu_button"> | ||||||
|  |                         <property name="visible">True</property> | ||||||
|  |                         <property name="can-focus">True</property> | ||||||
|  |                         <property name="focus-on-click">False</property> | ||||||
|  |                         <property name="receives-default">True</property> | ||||||
|  |                         <child> | ||||||
|  |                           <object class="GtkImage"> | ||||||
|  |                             <property name="visible">True</property> | ||||||
|  |                             <property name="can-focus">False</property> | ||||||
|  |                             <property name="icon-name">view-more-symbolic</property> | ||||||
|                           </object> |                           </object> | ||||||
|                         </child> |                         </child> | ||||||
|                       </object> |                       </object> | ||||||
|                       <packing> |                       <packing> | ||||||
|                         <property name="pack-type">end</property> |                         <property name="pack-type">end</property> | ||||||
|  |                         <property name="position">1</property> | ||||||
|  |                       </packing> | ||||||
|  |                     </child> | ||||||
|  |                     <child> | ||||||
|  |                       <object class="GtkToggleButton" id="work_details_search_button"> | ||||||
|  |                         <property name="visible">True</property> | ||||||
|  |                         <property name="can-focus">True</property> | ||||||
|  |                         <property name="receives-default">True</property> | ||||||
|  |                         <child> | ||||||
|  |                           <object class="GtkImage"> | ||||||
|  |                             <property name="visible">True</property> | ||||||
|  |                             <property name="can-focus">False</property> | ||||||
|  |                             <property name="icon-name">edit-find-symbolic</property> | ||||||
|  |                           </object> | ||||||
|  |                         </child> | ||||||
|  |                       </object> | ||||||
|  |                       <packing> | ||||||
|  |                         <property name="pack-type">end</property> | ||||||
|  |                         <property name="position">1</property> | ||||||
|  |                       </packing> | ||||||
|  |                     </child> | ||||||
|  |                   </object> | ||||||
|  |                   <packing> | ||||||
|  |                     <property name="expand">False</property> | ||||||
|  |                     <property name="fill">True</property> | ||||||
|                     <property name="position">0</property> |                     <property name="position">0</property> | ||||||
|                   </packing> |                   </packing> | ||||||
|                 </child> |                 </child> | ||||||
|  |                 <child> | ||||||
|  |                   <object class="HdySearchBar"> | ||||||
|  |                     <property name="visible">True</property> | ||||||
|  |                     <property name="can-focus">False</property> | ||||||
|  |                     <property name="search-mode-enabled" bind-source="work_details_search_button" bind-property="active" bind-flags="bidirectional|sync-create">False</property> | ||||||
|  |                     <child> | ||||||
|  |                       <object class="HdyClamp"> | ||||||
|  |                         <property name="visible">True</property> | ||||||
|  |                         <property name="can-focus">False</property> | ||||||
|  |                         <property name="maximum-size">400</property> | ||||||
|  |                         <child> | ||||||
|  |                           <object class="GtkSearchEntry" id="work_details_search_entry"> | ||||||
|  |                             <property name="visible">True</property> | ||||||
|  |                             <property name="can-focus">True</property> | ||||||
|  |                             <property name="primary-icon-name">edit-find-symbolic</property> | ||||||
|  |                             <property name="primary-icon-activatable">False</property> | ||||||
|  |                             <property name="primary-icon-sensitive">False</property> | ||||||
|  |                             <property name="placeholder-text" translatable="yes">Search recordings …</property> | ||||||
|  |                           </object> | ||||||
|  |                         </child> | ||||||
|                       </object> |                       </object> | ||||||
|                     </child> |                     </child> | ||||||
|                   </object> |                   </object> | ||||||
|  | @ -587,6 +638,89 @@ | ||||||
|                     <property name="position">1</property> |                     <property name="position">1</property> | ||||||
|                   </packing> |                   </packing> | ||||||
|                 </child> |                 </child> | ||||||
|  |                 <child> | ||||||
|  |                   <object class="GtkStack" id="work_details_stack"> | ||||||
|  |                     <property name="visible">True</property> | ||||||
|  |                     <property name="can-focus">False</property> | ||||||
|  |                     <property name="transition-type">crossfade</property> | ||||||
|  |                     <child> | ||||||
|  |                       <object class="GtkSpinner"> | ||||||
|  |                         <property name="visible">True</property> | ||||||
|  |                         <property name="can-focus">False</property> | ||||||
|  |                         <property name="active">True</property> | ||||||
|  |                       </object> | ||||||
|  |                       <packing> | ||||||
|  |                         <property name="name">loading</property> | ||||||
|  |                       </packing> | ||||||
|  |                     </child> | ||||||
|  |                     <child> | ||||||
|  |                       <object class="GtkScrolledWindow"> | ||||||
|  |                         <property name="visible">True</property> | ||||||
|  |                         <property name="can-focus">True</property> | ||||||
|  |                         <child> | ||||||
|  |                           <object class="GtkViewport"> | ||||||
|  |                             <property name="visible">True</property> | ||||||
|  |                             <property name="can-focus">False</property> | ||||||
|  |                             <property name="shadow-type">none</property> | ||||||
|  |                             <child> | ||||||
|  |                               <object class="GtkBox"> | ||||||
|  |                                 <property name="visible">True</property> | ||||||
|  |                                 <property name="can-focus">False</property> | ||||||
|  |                                 <property name="border-width">18</property> | ||||||
|  |                                 <property name="orientation">vertical</property> | ||||||
|  |                                 <property name="spacing">12</property> | ||||||
|  |                                 <child> | ||||||
|  |                                   <object class="GtkLabel"> | ||||||
|  |                                     <property name="visible">True</property> | ||||||
|  |                                     <property name="can-focus">False</property> | ||||||
|  |                                     <property name="halign">start</property> | ||||||
|  |                                     <property name="label" translatable="yes">Recordings</property> | ||||||
|  |                                     <attributes> | ||||||
|  |                                       <attribute name="size" value="12288" /> | ||||||
|  |                                     </attributes> | ||||||
|  |                                   </object> | ||||||
|  |                                   <packing> | ||||||
|  |                                     <property name="expand">False</property> | ||||||
|  |                                     <property name="fill">True</property> | ||||||
|  |                                     <property name="position">0</property> | ||||||
|  |                                   </packing> | ||||||
|  |                                 </child> | ||||||
|  |                                 <child> | ||||||
|  |                                   <object class="GtkFrame"> | ||||||
|  |                                     <property name="visible">True</property> | ||||||
|  |                                     <property name="can-focus">False</property> | ||||||
|  |                                     <property name="label-xalign">0</property> | ||||||
|  |                                     <property name="shadow-type">in</property> | ||||||
|  |                                     <child> | ||||||
|  |                                       <object class="GtkListBox" id="work_details_recording_list"> | ||||||
|  |                                         <property name="visible">True</property> | ||||||
|  |                                         <property name="can-focus">False</property> | ||||||
|  |                                         <child type="placeholder"> | ||||||
|  |                                           <object class="GtkLabel"> | ||||||
|  |                                             <property name="visible">True</property> | ||||||
|  |                                             <property name="can-focus">False</property> | ||||||
|  |                                             <property name="margin-left">6</property> | ||||||
|  |                                             <property name="margin-right">6</property> | ||||||
|  |                                             <property name="margin-start">6</property> | ||||||
|  |                                             <property name="margin-end">6</property> | ||||||
|  |                                             <property name="margin-top">6</property> | ||||||
|  |                                             <property name="margin-bottom">6</property> | ||||||
|  |                                             <property name="label" translatable="yes">No recordings found.</property> | ||||||
|  |                                           </object> | ||||||
|  |                                         </child> | ||||||
|  |                                       </object> | ||||||
|  |                                     </child> | ||||||
|  |                                   </object> | ||||||
|  |                                   <packing> | ||||||
|  |                                     <property name="expand">False</property> | ||||||
|  |                                     <property name="fill">True</property> | ||||||
|  |                                     <property name="position">1</property> | ||||||
|  |                                   </packing> | ||||||
|  |                                 </child> | ||||||
|  |                               </object> | ||||||
|  |                             </child> | ||||||
|  |                           </object> | ||||||
|  |                         </child> | ||||||
|                       </object> |                       </object> | ||||||
|                       <packing> |                       <packing> | ||||||
|                         <property name="name">content</property> |                         <property name="name">content</property> | ||||||
|  | @ -602,11 +736,163 @@ | ||||||
|                 </child> |                 </child> | ||||||
|               </object> |               </object> | ||||||
|               <packing> |               <packing> | ||||||
|                 <property name="name">person_screen</property> |                 <property name="name">work_details_screen</property> | ||||||
|  |                 <property name="position">2</property> | ||||||
|  |               </packing> | ||||||
|  |             </child> | ||||||
|  |             <child> | ||||||
|  |               <object class="GtkBox"> | ||||||
|  |                 <property name="visible">True</property> | ||||||
|  |                 <property name="can-focus">False</property> | ||||||
|  |                 <property name="orientation">vertical</property> | ||||||
|  |                 <child> | ||||||
|  |                   <object class="HdyHeaderBar" id="recording_details_header"> | ||||||
|  |                     <property name="visible">True</property> | ||||||
|  |                     <property name="can-focus">False</property> | ||||||
|  |                     <property name="show-close-button">True</property> | ||||||
|  |                     <child> | ||||||
|  |                       <object class="GtkButton" id="recording_details_back_button"> | ||||||
|  |                         <property name="visible">True</property> | ||||||
|  |                         <property name="can-focus">True</property> | ||||||
|  |                         <property name="receives-default">True</property> | ||||||
|  |                         <child> | ||||||
|  |                           <object class="GtkImage"> | ||||||
|  |                             <property name="visible">True</property> | ||||||
|  |                             <property name="can-focus">False</property> | ||||||
|  |                             <property name="icon-name">go-previous-symbolic</property> | ||||||
|  |                           </object> | ||||||
|  |                         </child> | ||||||
|  |                       </object> | ||||||
|  |                     </child> | ||||||
|  |                     <child> | ||||||
|  |                       <object class="GtkMenuButton" id="recording_details_header_menu_button"> | ||||||
|  |                         <property name="visible">True</property> | ||||||
|  |                         <property name="can-focus">True</property> | ||||||
|  |                         <property name="focus-on-click">False</property> | ||||||
|  |                         <property name="receives-default">True</property> | ||||||
|  |                         <child> | ||||||
|  |                           <object class="GtkImage"> | ||||||
|  |                             <property name="visible">True</property> | ||||||
|  |                             <property name="can-focus">False</property> | ||||||
|  |                             <property name="icon-name">view-more-symbolic</property> | ||||||
|  |                           </object> | ||||||
|  |                         </child> | ||||||
|  |                       </object> | ||||||
|  |                       <packing> | ||||||
|  |                         <property name="pack-type">end</property> | ||||||
|                         <property name="position">1</property> |                         <property name="position">1</property> | ||||||
|                       </packing> |                       </packing> | ||||||
|                     </child> |                     </child> | ||||||
|                   </object> |                   </object> | ||||||
|  |                   <packing> | ||||||
|  |                     <property name="expand">False</property> | ||||||
|  |                     <property name="fill">True</property> | ||||||
|  |                     <property name="position">0</property> | ||||||
|  |                   </packing> | ||||||
|  |                 </child> | ||||||
|  |                 <child> | ||||||
|  |                   <object class="GtkStack" id="recording_details_stack"> | ||||||
|  |                     <property name="visible">True</property> | ||||||
|  |                     <property name="can-focus">False</property> | ||||||
|  |                     <property name="transition-type">crossfade</property> | ||||||
|  |                     <child> | ||||||
|  |                       <object class="GtkSpinner"> | ||||||
|  |                         <property name="visible">True</property> | ||||||
|  |                         <property name="can-focus">False</property> | ||||||
|  |                         <property name="active">True</property> | ||||||
|  |                       </object> | ||||||
|  |                       <packing> | ||||||
|  |                         <property name="name">loading</property> | ||||||
|  |                       </packing> | ||||||
|  |                     </child> | ||||||
|  |                     <child> | ||||||
|  |                       <object class="GtkScrolledWindow"> | ||||||
|  |                         <property name="visible">True</property> | ||||||
|  |                         <property name="can-focus">True</property> | ||||||
|  |                         <child> | ||||||
|  |                           <object class="GtkViewport"> | ||||||
|  |                             <property name="visible">True</property> | ||||||
|  |                             <property name="can-focus">False</property> | ||||||
|  |                             <property name="shadow-type">none</property> | ||||||
|  |                             <child> | ||||||
|  |                               <object class="GtkBox"> | ||||||
|  |                                 <property name="visible">True</property> | ||||||
|  |                                 <property name="can-focus">False</property> | ||||||
|  |                                 <property name="border-width">18</property> | ||||||
|  |                                 <property name="orientation">vertical</property> | ||||||
|  |                                 <property name="spacing">12</property> | ||||||
|  |                                 <child> | ||||||
|  |                                   <object class="GtkLabel"> | ||||||
|  |                                     <property name="visible">True</property> | ||||||
|  |                                     <property name="can-focus">False</property> | ||||||
|  |                                     <property name="halign">start</property> | ||||||
|  |                                     <property name="label" translatable="yes">Tracks</property> | ||||||
|  |                                     <attributes> | ||||||
|  |                                       <attribute name="size" value="12288" /> | ||||||
|  |                                     </attributes> | ||||||
|  |                                   </object> | ||||||
|  |                                   <packing> | ||||||
|  |                                     <property name="expand">False</property> | ||||||
|  |                                     <property name="fill">True</property> | ||||||
|  |                                     <property name="position">0</property> | ||||||
|  |                                   </packing> | ||||||
|  |                                 </child> | ||||||
|  |                                 <child> | ||||||
|  |                                   <object class="GtkFrame"> | ||||||
|  |                                     <property name="visible">True</property> | ||||||
|  |                                     <property name="can-focus">False</property> | ||||||
|  |                                     <property name="label-xalign">0</property> | ||||||
|  |                                     <property name="shadow-type">in</property> | ||||||
|  |                                     <child> | ||||||
|  |                                       <object class="GtkListBox" id="recording_details_track_list"> | ||||||
|  |                                         <property name="visible">True</property> | ||||||
|  |                                         <property name="can-focus">False</property> | ||||||
|  |                                         <child type="placeholder"> | ||||||
|  |                                           <object class="GtkLabel"> | ||||||
|  |                                             <property name="visible">True</property> | ||||||
|  |                                             <property name="can-focus">False</property> | ||||||
|  |                                             <property name="margin-left">6</property> | ||||||
|  |                                             <property name="margin-right">6</property> | ||||||
|  |                                             <property name="margin-start">6</property> | ||||||
|  |                                             <property name="margin-end">6</property> | ||||||
|  |                                             <property name="margin-top">6</property> | ||||||
|  |                                             <property name="margin-bottom">6</property> | ||||||
|  |                                             <property name="label" translatable="yes">No tracks found.</property> | ||||||
|  |                                           </object> | ||||||
|  |                                         </child> | ||||||
|  |                                       </object> | ||||||
|  |                                     </child> | ||||||
|  |                                   </object> | ||||||
|  |                                   <packing> | ||||||
|  |                                     <property name="expand">False</property> | ||||||
|  |                                     <property name="fill">True</property> | ||||||
|  |                                     <property name="position">1</property> | ||||||
|  |                                   </packing> | ||||||
|  |                                 </child> | ||||||
|  |                               </object> | ||||||
|  |                             </child> | ||||||
|  |                           </object> | ||||||
|  |                         </child> | ||||||
|  |                       </object> | ||||||
|  |                       <packing> | ||||||
|  |                         <property name="name">content</property> | ||||||
|  |                         <property name="position">1</property> | ||||||
|  |                       </packing> | ||||||
|  |                     </child> | ||||||
|  |                   </object> | ||||||
|  |                   <packing> | ||||||
|  |                     <property name="expand">True</property> | ||||||
|  |                     <property name="fill">True</property> | ||||||
|  |                     <property name="position">2</property> | ||||||
|  |                   </packing> | ||||||
|  |                 </child> | ||||||
|  |               </object> | ||||||
|  |               <packing> | ||||||
|  |                 <property name="name">recording_details_screen</property> | ||||||
|  |                 <property name="position">3</property> | ||||||
|  |               </packing> | ||||||
|  |             </child> | ||||||
|  |           </object> | ||||||
|           <packing> |           <packing> | ||||||
|             <property name="name">content</property> |             <property name="name">content</property> | ||||||
|           </packing> |           </packing> | ||||||
|  | @ -617,12 +903,14 @@ | ||||||
|   <object class="HdyHeaderGroup" id="inner_header_group"> |   <object class="HdyHeaderGroup" id="inner_header_group"> | ||||||
|     <headerbars> |     <headerbars> | ||||||
|       <headerbar name="empty_header" /> |       <headerbar name="empty_header" /> | ||||||
|       <headerbar name="header" /> |       <headerbar name="overview_header" /> | ||||||
|  |       <headerbar name="work_details_header" /> | ||||||
|  |       <headerbar name="recording_details_header" /> | ||||||
|     </headerbars> |     </headerbars> | ||||||
|   </object> |   </object> | ||||||
|   <object class="HdyHeaderGroup"> |   <object class="HdyHeaderGroup"> | ||||||
|     <headerbars> |     <headerbars> | ||||||
|       <headerbar name="left_header" /> |       <headerbar name="sidebar_header" /> | ||||||
|       <headerbar name="inner_header_group" /> |       <headerbar name="inner_header_group" /> | ||||||
|     </headerbars> |     </headerbars> | ||||||
|   </object> |   </object> | ||||||
|  |  | ||||||
|  | @ -24,6 +24,12 @@ pub struct WorkDescription { | ||||||
|     pub sections: Vec<WorkSectionDescription>, |     pub sections: Vec<WorkSectionDescription>, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | impl WorkDescription { | ||||||
|  |     pub fn get_title(&self) -> String { | ||||||
|  |         format!("{}: {}", self.composer.name_fl(), self.title) | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| #[derive(Debug, Clone)] | #[derive(Debug, Clone)] | ||||||
| pub struct WorkPartInsertion { | pub struct WorkPartInsertion { | ||||||
|     pub part: WorkPart, |     pub part: WorkPart, | ||||||
|  |  | ||||||
|  | @ -51,7 +51,7 @@ where | ||||||
|         let (id, work, performers) = match recording { |         let (id, work, performers) = match recording { | ||||||
|             Some(recording) => { |             Some(recording) => { | ||||||
|                 save_button.set_sensitive(true); |                 save_button.set_sensitive(true); | ||||||
|                 work_label.set_text(&format!("{}: {}", recording.work.composer.name_fl(), recording.work.title)); |                 work_label.set_text(&recording.work.get_title()); | ||||||
|                 comment_entry.set_text(&recording.comment); |                 comment_entry.set_text(&recording.comment); | ||||||
|                 (recording.id, Some(recording.work), recording.performances) |                 (recording.id, Some(recording.work), recording.performances) | ||||||
|             } |             } | ||||||
|  |  | ||||||
							
								
								
									
										333
									
								
								src/window.rs
									
										
									
									
									
								
							
							
						
						
									
										333
									
								
								src/window.rs
									
										
									
									
									
								
							|  | @ -30,9 +30,15 @@ impl PersonOrEnsemble { | ||||||
| enum WindowState { | enum WindowState { | ||||||
|     Loading, |     Loading, | ||||||
|     Selection(Vec<PersonOrEnsemble>), |     Selection(Vec<PersonOrEnsemble>), | ||||||
|     PersonLoading(Person), |     OverviewScreenLoading(PersonOrEnsemble), | ||||||
|     EnsembleLoading(Ensemble), |     OverviewScreen( | ||||||
|     Selected(Vec<WorkDescription>, Vec<RecordingDescription>, String), |         PersonOrEnsemble, | ||||||
|  |         Vec<WorkDescription>, | ||||||
|  |         Vec<RecordingDescription>, | ||||||
|  |         String, | ||||||
|  |     ), | ||||||
|  |     WorkScreenLoading(PersonOrEnsemble, WorkDescription), | ||||||
|  |     RecordingScreenLoading(PersonOrEnsemble, RecordingDescription), | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| pub struct Window { | pub struct Window { | ||||||
|  | @ -43,23 +49,22 @@ pub struct Window { | ||||||
|     sidebar_stack: gtk::Stack, |     sidebar_stack: gtk::Stack, | ||||||
|     person_search_entry: gtk::SearchEntry, |     person_search_entry: gtk::SearchEntry, | ||||||
|     sidebar_list: gtk::ListBox, |     sidebar_list: gtk::ListBox, | ||||||
|     stack: gtk::Stack, |     main_stack: gtk::Stack, | ||||||
|     header: libhandy::HeaderBar, |     overview_header: libhandy::HeaderBar, | ||||||
|     header_menu_button: gtk::MenuButton, |     overview_header_menu_button: gtk::MenuButton, | ||||||
|     search_entry: gtk::SearchEntry, |     overview_search_entry: gtk::SearchEntry, | ||||||
|     content_stack: gtk::Stack, |     overview_stack: gtk::Stack, | ||||||
|     work_box: gtk::Box, |     overview_work_box: gtk::Box, | ||||||
|     work_list: gtk::ListBox, |     overview_work_list: gtk::ListBox, | ||||||
|     recording_box: gtk::Box, |     overview_recording_box: gtk::Box, | ||||||
|     recording_list: gtk::ListBox, |     overview_recording_list: gtk::ListBox, | ||||||
|     actions_revealer: gtk::Revealer, |     work_details_header: libhandy::HeaderBar, | ||||||
|     edit_button: gtk::Button, |     work_details_stack: gtk::Stack, | ||||||
|     delete_button: gtk::Button, |     recording_details_header: libhandy::HeaderBar, | ||||||
|     person_list_row_activated_handler_id: Cell<Option<glib::SignalHandlerId>>, |     recording_details_stack: gtk::Stack, | ||||||
|     work_list_row_activated_handler_id: Cell<Option<glib::SignalHandlerId>>, |     sidebar_list_row_activated_handler_id: Cell<Option<glib::SignalHandlerId>>, | ||||||
|     recording_list_row_activated_handler_id: Cell<Option<glib::SignalHandlerId>>, |     overview_work_list_row_activated_handler_id: Cell<Option<glib::SignalHandlerId>>, | ||||||
|     edit_button_clicked_handler_id: Cell<Option<glib::SignalHandlerId>>, |     overview_recording_list_row_activated_handler_id: Cell<Option<glib::SignalHandlerId>>, | ||||||
|     delete_button_clicked_handler_id: Cell<Option<glib::SignalHandlerId>>, |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl Window { | impl Window { | ||||||
|  | @ -73,18 +78,21 @@ impl Window { | ||||||
|         get_widget!(builder, gtk::SearchEntry, person_search_entry); |         get_widget!(builder, gtk::SearchEntry, person_search_entry); | ||||||
|         get_widget!(builder, gtk::Stack, sidebar_stack); |         get_widget!(builder, gtk::Stack, sidebar_stack); | ||||||
|         get_widget!(builder, gtk::ListBox, sidebar_list); |         get_widget!(builder, gtk::ListBox, sidebar_list); | ||||||
|         get_widget!(builder, gtk::Stack, stack); |         get_widget!(builder, gtk::Stack, main_stack); | ||||||
|         get_widget!(builder, libhandy::HeaderBar, header); |         get_widget!(builder, libhandy::HeaderBar, overview_header); | ||||||
|         get_widget!(builder, gtk::MenuButton, header_menu_button); |         get_widget!(builder, gtk::MenuButton, overview_header_menu_button); | ||||||
|         get_widget!(builder, gtk::SearchEntry, search_entry); |         get_widget!(builder, gtk::SearchEntry, overview_search_entry); | ||||||
|         get_widget!(builder, gtk::Stack, content_stack); |         get_widget!(builder, gtk::Stack, overview_stack); | ||||||
|         get_widget!(builder, gtk::Box, work_box); |         get_widget!(builder, gtk::Box, overview_work_box); | ||||||
|         get_widget!(builder, gtk::ListBox, work_list); |         get_widget!(builder, gtk::ListBox, overview_work_list); | ||||||
|         get_widget!(builder, gtk::Box, recording_box); |         get_widget!(builder, gtk::Box, overview_recording_box); | ||||||
|         get_widget!(builder, gtk::ListBox, recording_list); |         get_widget!(builder, gtk::ListBox, overview_recording_list); | ||||||
|         get_widget!(builder, gtk::Revealer, actions_revealer); |         get_widget!(builder, libhandy::HeaderBar, work_details_header); | ||||||
|         get_widget!(builder, gtk::Button, edit_button); |         get_widget!(builder, gtk::Button, work_details_back_button); | ||||||
|         get_widget!(builder, gtk::Button, delete_button); |         get_widget!(builder, gtk::Stack, work_details_stack); | ||||||
|  |         get_widget!(builder, libhandy::HeaderBar, recording_details_header); | ||||||
|  |         get_widget!(builder, gtk::Button, recording_details_back_button); | ||||||
|  |         get_widget!(builder, gtk::Stack, recording_details_stack); | ||||||
| 
 | 
 | ||||||
|         let backend = Backend::new("test.sqlite"); |         let backend = Backend::new("test.sqlite"); | ||||||
| 
 | 
 | ||||||
|  | @ -96,23 +104,22 @@ impl Window { | ||||||
|             sidebar_stack: sidebar_stack, |             sidebar_stack: sidebar_stack, | ||||||
|             sidebar_list: sidebar_list, |             sidebar_list: sidebar_list, | ||||||
|             person_search_entry: person_search_entry, |             person_search_entry: person_search_entry, | ||||||
|             stack: stack, |             main_stack: main_stack, | ||||||
|             header: header, |             overview_header: overview_header, | ||||||
|             header_menu_button: header_menu_button, |             overview_header_menu_button: overview_header_menu_button, | ||||||
|             search_entry: search_entry, |             overview_search_entry: overview_search_entry, | ||||||
|             content_stack: content_stack, |             overview_stack: overview_stack, | ||||||
|             work_box: work_box, |             overview_work_box: overview_work_box, | ||||||
|             work_list: work_list, |             overview_work_list: overview_work_list, | ||||||
|             recording_box: recording_box, |             overview_recording_box: overview_recording_box, | ||||||
|             recording_list: recording_list, |             overview_recording_list: overview_recording_list, | ||||||
|             actions_revealer: actions_revealer, |             work_details_header: work_details_header, | ||||||
|             edit_button: edit_button, |             work_details_stack: work_details_stack, | ||||||
|             delete_button: delete_button, |             recording_details_header: recording_details_header, | ||||||
|             person_list_row_activated_handler_id: Cell::new(None), |             recording_details_stack: recording_details_stack, | ||||||
|             work_list_row_activated_handler_id: Cell::new(None), |             sidebar_list_row_activated_handler_id: Cell::new(None), | ||||||
|             recording_list_row_activated_handler_id: Cell::new(None), |             overview_work_list_row_activated_handler_id: Cell::new(None), | ||||||
|             edit_button_clicked_handler_id: Cell::new(None), |             overview_recording_list_row_activated_handler_id: Cell::new(None), | ||||||
|             delete_button_clicked_handler_id: Cell::new(None), |  | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         action!( |         action!( | ||||||
|  | @ -229,11 +236,29 @@ impl Window { | ||||||
|                 result.sidebar_list.invalidate_filter(); |                 result.sidebar_list.invalidate_filter(); | ||||||
|             })); |             })); | ||||||
| 
 | 
 | ||||||
|         result.search_entry.connect_search_changed(clone!(@strong result => move |_| { |         result.overview_search_entry.connect_search_changed(clone!(@strong result => move |_| { | ||||||
|             match result.get_state() { |             match result.get_state() { | ||||||
|                 Selected(works, recordings, _) => { |                 OverviewScreen(poe, works, recordings, _) => { | ||||||
|                     result.clone().set_state(Selected(works.clone(), recordings.clone(), result.search_entry.get_text().to_string())); |                     result.clone().set_state(OverviewScreen(poe, works.clone(), recordings.clone(), result.overview_search_entry.get_text().to_string())); | ||||||
|  |                 }, | ||||||
|  |                 _ => (), | ||||||
|             } |             } | ||||||
|  |         })); | ||||||
|  | 
 | ||||||
|  |         work_details_back_button.connect_clicked(clone!(@strong result => move |_| { | ||||||
|  |             match result.get_state() { | ||||||
|  |                 WorkScreenLoading(poe, _) => { | ||||||
|  |                     result.clone().set_state(OverviewScreenLoading(poe)); | ||||||
|  |                 }, | ||||||
|  |                 _ => (), | ||||||
|  |             } | ||||||
|  |         })); | ||||||
|  | 
 | ||||||
|  |         recording_details_back_button.connect_clicked(clone!(@strong result => move |_| { | ||||||
|  |             match result.get_state() { | ||||||
|  |                 RecordingScreenLoading(poe, _) => { | ||||||
|  |                     result.clone().set_state(OverviewScreenLoading(poe)); | ||||||
|  |                 }, | ||||||
|                 _ => (), |                 _ => (), | ||||||
|             } |             } | ||||||
|         })); |         })); | ||||||
|  | @ -276,9 +301,8 @@ impl Window { | ||||||
|                         })); |                         })); | ||||||
|                     })); |                     })); | ||||||
| 
 | 
 | ||||||
|                 self.actions_revealer.set_reveal_child(false); |  | ||||||
|                 self.sidebar_stack.set_visible_child_name("loading"); |                 self.sidebar_stack.set_visible_child_name("loading"); | ||||||
|                 self.stack.set_visible_child_name("empty_screen"); |                 self.main_stack.set_visible_child_name("empty_screen"); | ||||||
|                 self.leaflet.set_visible_child_name("sidebar"); |                 self.leaflet.set_visible_child_name("sidebar"); | ||||||
|             } |             } | ||||||
|             Selection(poes) => { |             Selection(poes) => { | ||||||
|  | @ -295,7 +319,7 @@ impl Window { | ||||||
|                     self.sidebar_list.insert(&row, -1); |                     self.sidebar_list.insert(&row, -1); | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 match self.person_list_row_activated_handler_id.take() { |                 match self.sidebar_list_row_activated_handler_id.take() { | ||||||
|                     Some(id) => self.sidebar_list.disconnect(id), |                     Some(id) => self.sidebar_list.disconnect(id), | ||||||
|                     None => (), |                     None => (), | ||||||
|                 } |                 } | ||||||
|  | @ -305,14 +329,11 @@ impl Window { | ||||||
|                         let row = row.get_child().unwrap().downcast::<SelectorRow>().unwrap(); |                         let row = row.get_child().unwrap().downcast::<SelectorRow>().unwrap(); | ||||||
|                         let index: usize = row.get_index().try_into().unwrap(); |                         let index: usize = row.get_index().try_into().unwrap(); | ||||||
|                         let poe = poes[index].clone(); |                         let poe = poes[index].clone(); | ||||||
|                         self_.clone().set_state(match poe { |                         self_.clone().set_state(OverviewScreenLoading(poe)); | ||||||
|                             PersonOrEnsemble::Person(person) => PersonLoading(person), |  | ||||||
|                             PersonOrEnsemble::Ensemble(ensemble) => EnsembleLoading(ensemble), |  | ||||||
|                         }); |  | ||||||
|                     }), |                     }), | ||||||
|                 ); |                 ); | ||||||
| 
 | 
 | ||||||
|                 self.person_list_row_activated_handler_id |                 self.sidebar_list_row_activated_handler_id | ||||||
|                     .set(Some(handler_id)); |                     .set(Some(handler_id)); | ||||||
| 
 | 
 | ||||||
|                 self.sidebar_list.set_filter_func(Some(Box::new( |                 self.sidebar_list.set_filter_func(Some(Box::new( | ||||||
|  | @ -328,15 +349,14 @@ impl Window { | ||||||
|                     }), |                     }), | ||||||
|                 ))); |                 ))); | ||||||
| 
 | 
 | ||||||
| 
 |                 self.sidebar_stack.set_visible_child_name("content"); | ||||||
|                 self.actions_revealer.set_reveal_child(false); |                 self.main_stack.set_visible_child_name("empty_screen"); | ||||||
|                 self.sidebar_stack.set_visible_child_name("persons_list"); |  | ||||||
|                 self.stack.set_visible_child_name("empty_screen"); |  | ||||||
|                 self.leaflet.set_visible_child_name("sidebar"); |                 self.leaflet.set_visible_child_name("sidebar"); | ||||||
|             } |             } | ||||||
|             PersonLoading(person) => { |             OverviewScreenLoading(poe) => { | ||||||
|                 self.header.set_title(Some(&person.name_fl())); |                 match poe.clone() { | ||||||
|                 self.search_entry.set_text(""); |                     PersonOrEnsemble::Person(person) => { | ||||||
|  |                         self.overview_header.set_title(Some(&person.name_fl())); | ||||||
| 
 | 
 | ||||||
|                         let edit_menu_item = gio::MenuItem::new(Some("Edit person"), None); |                         let edit_menu_item = gio::MenuItem::new(Some("Edit person"), None); | ||||||
|                         edit_menu_item.set_action_and_target_value( |                         edit_menu_item.set_action_and_target_value( | ||||||
|  | @ -354,28 +374,22 @@ impl Window { | ||||||
|                         menu.append_item(&edit_menu_item); |                         menu.append_item(&edit_menu_item); | ||||||
|                         menu.append_item(&delete_menu_item); |                         menu.append_item(&delete_menu_item); | ||||||
| 
 | 
 | ||||||
|                 self.header_menu_button.set_menu_model(Some(&menu)); |                         self.overview_header_menu_button.set_menu_model(Some(&menu)); | ||||||
| 
 | 
 | ||||||
|                         self.backend.get_work_descriptions( |                         self.backend.get_work_descriptions( | ||||||
|                             person.id, |                             person.id, | ||||||
|                     clone!(@strong self as self_ => move |works| { |                             clone!(@strong self as self_, @strong poe => move |works| { | ||||||
|                                 self_.backend.get_recordings_for_person( |                                 self_.backend.get_recordings_for_person( | ||||||
|                                     person.id, |                                     person.id, | ||||||
|                             clone!(@strong self_ => move |recordings| { |                                     clone!(@strong self_, @strong poe => move |recordings| { | ||||||
|                                 self_.clone().set_state(Selected(works.clone(), recordings, String::from(""))); |                                         self_.clone().set_state(OverviewScreen(poe.clone(), works.clone(), recordings, String::from(""))); | ||||||
|                                     }), |                                     }), | ||||||
|                                 ); |                                 ); | ||||||
|                             }), |                             }), | ||||||
|                         ); |                         ); | ||||||
| 
 |  | ||||||
|                 self.actions_revealer.set_reveal_child(false); |  | ||||||
|                 self.content_stack.set_visible_child_name("loading"); |  | ||||||
|                 self.stack.set_visible_child_name("person_screen"); |  | ||||||
|                 self.leaflet.set_visible_child_name("content"); |  | ||||||
|                     } |                     } | ||||||
|             EnsembleLoading(ensemble) => { |                     PersonOrEnsemble::Ensemble(ensemble) => { | ||||||
|                 self.header.set_title(Some(&ensemble.name)); |                         self.overview_header.set_title(Some(&ensemble.name)); | ||||||
|                 self.search_entry.set_text(""); |  | ||||||
| 
 | 
 | ||||||
|                         let edit_menu_item = gio::MenuItem::new(Some("Edit ensemble"), None); |                         let edit_menu_item = gio::MenuItem::new(Some("Edit ensemble"), None); | ||||||
|                         edit_menu_item.set_action_and_target_value( |                         edit_menu_item.set_action_and_target_value( | ||||||
|  | @ -393,33 +407,36 @@ impl Window { | ||||||
|                         menu.append_item(&edit_menu_item); |                         menu.append_item(&edit_menu_item); | ||||||
|                         menu.append_item(&delete_menu_item); |                         menu.append_item(&delete_menu_item); | ||||||
| 
 | 
 | ||||||
|                 self.header_menu_button.set_menu_model(Some(&menu)); |                         self.overview_header_menu_button.set_menu_model(Some(&menu)); | ||||||
| 
 | 
 | ||||||
|                         self.backend.get_recordings_for_ensemble( |                         self.backend.get_recordings_for_ensemble( | ||||||
|                             ensemble.id, |                             ensemble.id, | ||||||
|                             clone!(@strong self as self_ => move |recordings| { |                             clone!(@strong self as self_ => move |recordings| { | ||||||
|                         self_.clone().set_state(Selected(Vec::new(), recordings, String::from(""))); |                                 self_.clone().set_state(OverviewScreen(poe.clone(), Vec::new(), recordings, String::from(""))); | ||||||
|                             }), |                             }), | ||||||
|                         ); |                         ); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|                 self.actions_revealer.set_reveal_child(false); |                 self.overview_search_entry.set_text(""); | ||||||
|                 self.content_stack.set_visible_child_name("loading"); | 
 | ||||||
|                 self.stack.set_visible_child_name("person_screen"); |                 self.overview_stack.set_visible_child_name("loading"); | ||||||
|  |                 self.main_stack.set_visible_child_name("overview_screen"); | ||||||
|                 self.leaflet.set_visible_child_name("content"); |                 self.leaflet.set_visible_child_name("content"); | ||||||
|             } |             } | ||||||
|             Selected(works, recordings, search) => { |             OverviewScreen(poe, works, recordings, search) => { | ||||||
|                 for child in self.work_list.get_children() { |                 for child in self.overview_work_list.get_children() { | ||||||
|                     self.work_list.remove(&child); |                     self.overview_work_list.remove(&child); | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 for child in self.recording_list.get_children() { |                 for child in self.overview_recording_list.get_children() { | ||||||
|                     self.recording_list.remove(&child); |                     self.overview_recording_list.remove(&child); | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 if works.is_empty() { |                 if works.is_empty() { | ||||||
|                     self.work_box.hide(); |                     self.overview_work_box.hide(); | ||||||
|                 } else { |                 } else { | ||||||
|                     self.work_box.show(); |                     self.overview_work_box.show(); | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 for (index, work) in works.iter().enumerate() { |                 for (index, work) in works.iter().enumerate() { | ||||||
|  | @ -429,71 +446,44 @@ impl Window { | ||||||
|                         label.set_halign(gtk::Align::Start); |                         label.set_halign(gtk::Align::Start); | ||||||
|                         let row = SelectorRow::new(index.try_into().unwrap(), &label); |                         let row = SelectorRow::new(index.try_into().unwrap(), &label); | ||||||
|                         row.show_all(); |                         row.show_all(); | ||||||
|                         self.work_list.insert(&row, -1); |                         self.overview_work_list.insert(&row, -1); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 match self.work_list_row_activated_handler_id.take() { |                 match self.overview_work_list_row_activated_handler_id.take() { | ||||||
|                     Some(id) => self.work_list.disconnect(id), |                     Some(id) => self.overview_work_list.disconnect(id), | ||||||
|                     None => (), |                     None => (), | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 let handler_id = self.work_list.connect_row_activated( |                 let handler_id = self.overview_work_list.connect_row_activated( | ||||||
|                     clone!(@strong self as self_, @strong works => move |_, row| { |                     clone!(@strong self as self_, @strong works, @strong poe => move |_, row| { | ||||||
|                         self_.recording_list.unselect_all(); |                         self_.overview_recording_list.unselect_all(); | ||||||
| 
 | 
 | ||||||
|                         let row = row.get_child().unwrap().downcast::<SelectorRow>().unwrap(); |                         let row = row.get_child().unwrap().downcast::<SelectorRow>().unwrap(); | ||||||
|                         let index: usize = row.get_index().try_into().unwrap(); |                         let index: usize = row.get_index().try_into().unwrap(); | ||||||
|                         let work = works[index].clone(); |                         let work = works[index].clone(); | ||||||
| 
 | 
 | ||||||
|                         match self_.edit_button_clicked_handler_id.take() { |                         self_.clone().set_state(WorkScreenLoading(poe.clone(), work)); | ||||||
|                             Some(id) => self_.edit_button.disconnect(id), |  | ||||||
|                             None => (), |  | ||||||
|                         } |  | ||||||
|         
 |  | ||||||
|                         let handler_id = self_.edit_button.connect_clicked( |  | ||||||
|                             clone!(@strong self_ => move |_| { |  | ||||||
|                                 WorkEditor::new(self_.backend.clone(), &self_.window, Some(work.clone()), clone!(@strong self_ => move |_| { |  | ||||||
|                                         self_.clone().set_state(Loading); |  | ||||||
|                                     })).show(); |  | ||||||
|                     }), |                     }), | ||||||
|                 ); |                 ); | ||||||
| 
 | 
 | ||||||
|                         self_.edit_button_clicked_handler_id |                 self.overview_work_list_row_activated_handler_id | ||||||
|                             .set(Some(handler_id)); |  | ||||||
| 
 |  | ||||||
|                         match self_.delete_button_clicked_handler_id.take() { |  | ||||||
|                             Some(id) => self_.delete_button.disconnect(id), |  | ||||||
|                             None => (), |  | ||||||
|                         } |  | ||||||
|         
 |  | ||||||
|                         let handler_id = self_.delete_button.connect_clicked( |  | ||||||
|                             clone!(@strong self_ => move |_| { |  | ||||||
|                                // self_.backend.delete_work(work.id);
 |  | ||||||
|                             }), |  | ||||||
|                         ); |  | ||||||
|         
 |  | ||||||
|                         self_.delete_button_clicked_handler_id |  | ||||||
|                             .set(Some(handler_id)); |  | ||||||
| 
 |  | ||||||
|                         self_.actions_revealer.set_reveal_child(true); |  | ||||||
|                     }), |  | ||||||
|                 ); |  | ||||||
| 
 |  | ||||||
|                 self.work_list_row_activated_handler_id |  | ||||||
|                     .set(Some(handler_id)); |                     .set(Some(handler_id)); | ||||||
| 
 | 
 | ||||||
|                 if recordings.is_empty() { |                 if recordings.is_empty() { | ||||||
|                     self.recording_box.hide(); |                     self.overview_recording_box.hide(); | ||||||
|                 } else { |                 } else { | ||||||
|                     self.recording_box.show(); |                     self.overview_recording_box.show(); | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 for (index, recording) in recordings.iter().enumerate() { |                 for (index, recording) in recordings.iter().enumerate() { | ||||||
|                     let work_text = format!("{}: {}", recording.work.composer.name_fl(), recording.work.title); |                     let work_text = recording.work.get_title(); | ||||||
|                     let performers_text = recording.get_performers(); |                     let performers_text = recording.get_performers(); | ||||||
| 
 | 
 | ||||||
|                     if search.is_empty() || (work_text.to_lowercase().contains(&search) || performers_text.to_lowercase().contains(&search)) { |                     if search.is_empty() | ||||||
|  |                         || (work_text.to_lowercase().contains(&search) | ||||||
|  |                             || performers_text.to_lowercase().contains(&search)) | ||||||
|  |                     { | ||||||
|                         let work_label = gtk::Label::new(Some(&work_text)); |                         let work_label = gtk::Label::new(Some(&work_text)); | ||||||
| 
 | 
 | ||||||
|                         work_label.set_ellipsize(pango::EllipsizeMode::End); |                         work_label.set_ellipsize(pango::EllipsizeMode::End); | ||||||
|  | @ -510,70 +500,61 @@ impl Window { | ||||||
| 
 | 
 | ||||||
|                         let row = SelectorRow::new(index.try_into().unwrap(), &vbox); |                         let row = SelectorRow::new(index.try_into().unwrap(), &vbox); | ||||||
|                         row.show_all(); |                         row.show_all(); | ||||||
|                         self.recording_list.insert(&row, -1); |                         self.overview_recording_list.insert(&row, -1); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 match self.recording_list_row_activated_handler_id.take() { |                 match self.overview_recording_list_row_activated_handler_id.take() { | ||||||
|                     Some(id) => self.recording_list.disconnect(id), |                     Some(id) => self.overview_recording_list.disconnect(id), | ||||||
|                     None => (), |                     None => (), | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 let handler_id = self.recording_list.connect_row_activated( |                 let handler_id = self.overview_recording_list.connect_row_activated( | ||||||
|                     clone!(@strong self as self_, @strong recordings => move |_, row| { |                     clone!(@strong self as self_, @strong recordings, @strong poe => move |_, row| { | ||||||
|                         self_.work_list.unselect_all(); |                         self_.overview_work_list.unselect_all(); | ||||||
| 
 | 
 | ||||||
|                         let row = row.get_child().unwrap().downcast::<SelectorRow>().unwrap(); |                         let row = row.get_child().unwrap().downcast::<SelectorRow>().unwrap(); | ||||||
|                         let index: usize = row.get_index().try_into().unwrap(); |                         let index: usize = row.get_index().try_into().unwrap(); | ||||||
|                         let recording = recordings[index].clone(); |                         let recording = recordings[index].clone(); | ||||||
| 
 | 
 | ||||||
|                         match self_.edit_button_clicked_handler_id.take() { |                         self_.clone().set_state(RecordingScreenLoading(poe.clone(), recording)); | ||||||
|                             Some(id) => self_.edit_button.disconnect(id), |                     }), | ||||||
|                             None => (), |                 ); | ||||||
|  | 
 | ||||||
|  |                 self.overview_recording_list_row_activated_handler_id | ||||||
|  |                     .set(Some(handler_id)); | ||||||
|  | 
 | ||||||
|  |                 self.overview_stack.set_visible_child_name("content"); | ||||||
|  |                 self.main_stack.set_visible_child_name("overview_screen"); | ||||||
|  |                 self.leaflet.set_visible_child_name("content"); | ||||||
|             } |             } | ||||||
|  |             WorkScreenLoading(poe, work) => { | ||||||
|  |                 self.work_details_header | ||||||
|  |                     .set_title(Some(&work.composer.name_fl())); | ||||||
|  |                 self.work_details_header.set_subtitle(Some(&work.title)); | ||||||
| 
 | 
 | ||||||
|                         let handler_id = self_.edit_button.connect_clicked( |                 self.work_details_stack.set_visible_child_name("loading"); | ||||||
|                             clone!(@strong self_ => move |_| { |                 self.main_stack | ||||||
|                                 RecordingEditor::new(self_.backend.clone(), &self_.window, Some(recording.clone()), clone!(@strong self_ => move |_| { |                     .set_visible_child_name("work_details_screen"); | ||||||
|                                         self_.clone().set_state(Loading); |                 self.leaflet.set_visible_child_name("content"); | ||||||
|                                     })).show(); |  | ||||||
|                             }), |  | ||||||
|                         ); |  | ||||||
|         
 |  | ||||||
|                         self_.edit_button_clicked_handler_id |  | ||||||
|                             .set(Some(handler_id)); |  | ||||||
| 
 |  | ||||||
|                         match self_.delete_button_clicked_handler_id.take() { |  | ||||||
|                             Some(id) => self_.delete_button.disconnect(id), |  | ||||||
|                             None => (), |  | ||||||
|             } |             } | ||||||
|  |             RecordingScreenLoading(poe, recording) => { | ||||||
|  |                 self.recording_details_header | ||||||
|  |                     .set_title(Some(&recording.work.get_title())); | ||||||
|  |                 self.recording_details_header | ||||||
|  |                     .set_subtitle(Some(&recording.get_performers())); | ||||||
| 
 | 
 | ||||||
|                         let handler_id = self_.delete_button.connect_clicked( |                 self.recording_details_stack | ||||||
|                             clone!(@strong self_ => move |_| { |                     .set_visible_child_name("loading"); | ||||||
|                                // self_.backend.delete_recording(recording.id);
 |                 self.main_stack | ||||||
|                             }), |                     .set_visible_child_name("recording_details_screen"); | ||||||
|                         ); |  | ||||||
|         
 |  | ||||||
|                         self_.delete_button_clicked_handler_id |  | ||||||
|                             .set(Some(handler_id)); |  | ||||||
| 
 |  | ||||||
|                         self_.actions_revealer.set_reveal_child(true); |  | ||||||
|                     }), |  | ||||||
|                 ); |  | ||||||
| 
 |  | ||||||
|                 self.recording_list_row_activated_handler_id |  | ||||||
|                     .set(Some(handler_id)); |  | ||||||
| 
 |  | ||||||
|                 self.content_stack.set_visible_child_name("content"); |  | ||||||
|                 self.stack.set_visible_child_name("person_screen"); |  | ||||||
|                 self.leaflet.set_visible_child_name("content"); |                 self.leaflet.set_visible_child_name("content"); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     fn back(&self) { |     fn back(&self) { | ||||||
|         self.actions_revealer.set_reveal_child(false); |         self.main_stack.set_visible_child_name("empty_screen"); | ||||||
|         self.stack.set_visible_child_name("empty_screen"); |  | ||||||
|         self.leaflet.set_visible_child_name("sidebar"); |         self.leaflet.set_visible_child_name("sidebar"); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Elias Projahn
						Elias Projahn