mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 22:02:44 +00:00 
			
		
		
		
	Welcome: Port to LibMain :^)
This commit is contained in:
		
							parent
							
								
									ca23644397
								
							
						
					
					
						commit
						db79f1cb78
					
				
					 2 changed files with 12 additions and 34 deletions
				
			
		|  | @ -13,4 +13,4 @@ set(SOURCES | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| serenity_app(Welcome ICON app-welcome) | serenity_app(Welcome ICON app-welcome) | ||||||
| target_link_libraries(Welcome LibGUI LibWeb) | target_link_libraries(Welcome LibGUI LibWeb LibMain) | ||||||
|  |  | ||||||
|  | @ -6,50 +6,28 @@ | ||||||
| 
 | 
 | ||||||
| #include "WelcomeWidget.h" | #include "WelcomeWidget.h" | ||||||
| #include <LibConfig/Client.h> | #include <LibConfig/Client.h> | ||||||
|  | #include <LibCore/System.h> | ||||||
| #include <LibGUI/Application.h> | #include <LibGUI/Application.h> | ||||||
| #include <LibGUI/Icon.h> | #include <LibGUI/Icon.h> | ||||||
| #include <LibGUI/Window.h> | #include <LibGUI/Window.h> | ||||||
|  | #include <LibMain/Main.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| 
 | 
 | ||||||
| int main(int argc, char** argv) | ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||||
| { | { | ||||||
|     if (pledge("stdio recvfd sendfd rpath unix proc exec", nullptr) < 0) { |     TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec", nullptr)); | ||||||
|         perror("pledge"); |     auto app = TRY(GUI::Application::try_create(arguments)); | ||||||
|         return 1; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     auto app = GUI::Application::construct(argc, argv); |  | ||||||
| 
 | 
 | ||||||
|     Config::pledge_domains("SystemServer"); |     Config::pledge_domains("SystemServer"); | ||||||
| 
 | 
 | ||||||
|     if (unveil("/res", "r") < 0) { |     TRY(Core::System::unveil("/res", "r")); | ||||||
|         perror("unveil"); |     TRY(Core::System::unveil("/home", "r")); | ||||||
|         return 1; |     TRY(Core::System::unveil("/tmp/portal/webcontent", "rw")); | ||||||
|     } |     TRY(Core::System::unveil("/bin/Help", "x")); | ||||||
| 
 |     TRY(Core::System::unveil(nullptr, nullptr)); | ||||||
|     if (unveil("/home", "r") < 0) { |  | ||||||
|         perror("unveil"); |  | ||||||
|         return 1; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     if (unveil("/tmp/portal/webcontent", "rw") < 0) { |  | ||||||
|         perror("unveil"); |  | ||||||
|         return 1; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     if (unveil("/bin/Help", "x") < 0) { |  | ||||||
|         perror("unveil"); |  | ||||||
|         return 1; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     if (unveil(nullptr, nullptr) < 0) { |  | ||||||
|         perror("unveil"); |  | ||||||
|         return 1; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     auto app_icon = GUI::Icon::default_icon("app-welcome"); |     auto app_icon = GUI::Icon::default_icon("app-welcome"); | ||||||
| 
 | 
 | ||||||
|     auto window = GUI::Window::construct(); |     auto window = TRY(GUI::Window::try_create()); | ||||||
|     window->resize(480, 250); |     window->resize(480, 250); | ||||||
|     window->center_on_screen(); |     window->center_on_screen(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling