save window maximized state
This commit is contained in:
		
							parent
							
								
									10e552b6ed
								
							
						
					
					
						commit
						01538d3154
					
				
					 1 changed files with 16 additions and 9 deletions
				
			
		|  | @ -85,14 +85,16 @@ namespace Webpin { | ||||||
|             var height = info.get_string ("WebpinWindowHeight"); |             var height = info.get_string ("WebpinWindowHeight"); | ||||||
|             var state = info.get_string ("WebpinWindowMaximized"); |             var state = info.get_string ("WebpinWindowMaximized"); | ||||||
| 
 | 
 | ||||||
|             if (state != null && state == "max") { |             if (width != null && height != null) { | ||||||
|                 this.maximize (); |  | ||||||
|             } else if (width != null && height != null) { |  | ||||||
|                 set_default_size (int.parse(width), int.parse(height)); |                 set_default_size (int.parse(width), int.parse(height)); | ||||||
|             } else { |             } else { | ||||||
|                 set_default_size (1000, 600); |                 set_default_size (1000, 600); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  |             if (state != null && state == "max") { | ||||||
|  |                 this.maximize (); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|             this.delete_event.connect (() => { |             this.delete_event.connect (() => { | ||||||
|                 update_window_state(this.get_allocated_width (), this.get_allocated_height (), this.is_maximized); |                 update_window_state(this.get_allocated_width (), this.get_allocated_height (), this.is_maximized); | ||||||
|                 return false; |                 return false; | ||||||
|  | @ -141,9 +143,14 @@ namespace Webpin { | ||||||
| 
 | 
 | ||||||
|         public void update_window_state (int width, int height, bool is_maximized) { |         public void update_window_state (int width, int height, bool is_maximized) { | ||||||
|             var file = web_app.get_desktop_file(); |             var file = web_app.get_desktop_file(); | ||||||
|  | 
 | ||||||
|  |             if (is_maximized) { | ||||||
|  |                 file.edit_propertie ("WebpinWindowMaximized", "max"); | ||||||
|  |             } else { | ||||||
|                 file.edit_propertie ("WebpinWindowWidth", width.to_string()); |                 file.edit_propertie ("WebpinWindowWidth", width.to_string()); | ||||||
|                 file.edit_propertie ("WebpinWindowHeight", height.to_string()); |                 file.edit_propertie ("WebpinWindowHeight", height.to_string()); | ||||||
|           file.edit_propertie ("WebpinWindowMaximized", is_maximized == true ? "max" : "norm"); |                 file.edit_propertie ("WebpinWindowMaximized", "norm"); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public override bool key_press_event (Gdk.EventKey event) { |         public override bool key_press_event (Gdk.EventKey event) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Artem Anufrij
						Artem Anufrij