mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:02:45 +00:00 
			
		
		
		
	LibGUI: Put all classes in the GUI namespace and remove the leading G
This took me a moment. Welcome to the new world of GUI::Widget! :^)
This commit is contained in:
		
							parent
							
								
									2d39da5405
								
							
						
					
					
						commit
						c5bd9d4ed1
					
				
					 337 changed files with 5400 additions and 4816 deletions
				
			
		|  | @ -74,14 +74,14 @@ int main(int argc, char** argv) | |||
| 
 | ||||
|     RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("FileManager"); | ||||
| 
 | ||||
|     GApplication app(argc, argv); | ||||
|     GUI::Application app(argc, argv); | ||||
| 
 | ||||
|     if (pledge("stdio thread shared_buffer accept cpath rpath wpath fattr proc exec", nullptr) < 0) { | ||||
|         perror("pledge"); | ||||
|         return 1; | ||||
|     } | ||||
| 
 | ||||
|     auto window = GWindow::construct(); | ||||
|     auto window = GUI::Window::construct(); | ||||
|     window->set_title("File Manager"); | ||||
| 
 | ||||
|     auto left = config->read_num_entry("Window", "Left", 150); | ||||
|  | @ -90,41 +90,41 @@ int main(int argc, char** argv) | |||
|     auto heigth = config->read_num_entry("Window", "Heigth", 480); | ||||
|     window->set_rect({ left, top, width, heigth }); | ||||
| 
 | ||||
|     auto widget = GWidget::construct(); | ||||
|     widget->set_layout(make<GVBoxLayout>()); | ||||
|     auto widget = GUI::Widget::construct(); | ||||
|     widget->set_layout(make<GUI::VBoxLayout>()); | ||||
|     widget->layout()->set_spacing(0); | ||||
| 
 | ||||
|     auto main_toolbar = GToolBar::construct(widget); | ||||
|     auto location_toolbar = GToolBar::construct(widget); | ||||
|     auto main_toolbar = GUI::ToolBar::construct(widget); | ||||
|     auto location_toolbar = GUI::ToolBar::construct(widget); | ||||
|     location_toolbar->layout()->set_margins({ 6, 3, 6, 3 }); | ||||
|     location_toolbar->set_preferred_size(0, 25); | ||||
| 
 | ||||
|     auto location_label = GLabel::construct("Location: ", location_toolbar); | ||||
|     auto location_label = GUI::Label::construct("Location: ", location_toolbar); | ||||
|     location_label->size_to_fit(); | ||||
| 
 | ||||
|     auto location_textbox = GTextEditor::construct(GTextEditor::SingleLine, location_toolbar); | ||||
|     auto location_textbox = GUI::TextEditor::construct(GUI::TextEditor::SingleLine, location_toolbar); | ||||
| 
 | ||||
|     auto splitter = GSplitter::construct(Orientation::Horizontal, widget); | ||||
|     auto tree_view = GTreeView::construct(splitter); | ||||
|     auto directories_model = GFileSystemModel::create("/", GFileSystemModel::Mode::DirectoriesOnly); | ||||
|     auto splitter = GUI::Splitter::construct(Orientation::Horizontal, widget); | ||||
|     auto tree_view = GUI::TreeView::construct(splitter); | ||||
|     auto directories_model = GUI::FileSystemModel::create("/", GUI::FileSystemModel::Mode::DirectoriesOnly); | ||||
|     tree_view->set_model(directories_model); | ||||
|     tree_view->set_column_hidden(GFileSystemModel::Column::Icon, true); | ||||
|     tree_view->set_column_hidden(GFileSystemModel::Column::Size, true); | ||||
|     tree_view->set_column_hidden(GFileSystemModel::Column::Owner, true); | ||||
|     tree_view->set_column_hidden(GFileSystemModel::Column::Group, true); | ||||
|     tree_view->set_column_hidden(GFileSystemModel::Column::Permissions, true); | ||||
|     tree_view->set_column_hidden(GFileSystemModel::Column::ModificationTime, true); | ||||
|     tree_view->set_column_hidden(GFileSystemModel::Column::Inode, true); | ||||
|     tree_view->set_column_hidden(GFileSystemModel::Column::SymlinkTarget, true); | ||||
|     tree_view->set_size_policy(SizePolicy::Fixed, SizePolicy::Fill); | ||||
|     tree_view->set_column_hidden(GUI::FileSystemModel::Column::Icon, true); | ||||
|     tree_view->set_column_hidden(GUI::FileSystemModel::Column::Size, true); | ||||
|     tree_view->set_column_hidden(GUI::FileSystemModel::Column::Owner, true); | ||||
|     tree_view->set_column_hidden(GUI::FileSystemModel::Column::Group, true); | ||||
|     tree_view->set_column_hidden(GUI::FileSystemModel::Column::Permissions, true); | ||||
|     tree_view->set_column_hidden(GUI::FileSystemModel::Column::ModificationTime, true); | ||||
|     tree_view->set_column_hidden(GUI::FileSystemModel::Column::Inode, true); | ||||
|     tree_view->set_column_hidden(GUI::FileSystemModel::Column::SymlinkTarget, true); | ||||
|     tree_view->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill); | ||||
|     tree_view->set_preferred_size(150, 0); | ||||
|     auto directory_view = DirectoryView::construct(splitter); | ||||
| 
 | ||||
|     auto statusbar = GStatusBar::construct(widget); | ||||
|     auto statusbar = GUI::StatusBar::construct(widget); | ||||
| 
 | ||||
|     auto progressbar = GProgressBar::construct(statusbar); | ||||
|     auto progressbar = GUI::ProgressBar::construct(statusbar); | ||||
|     progressbar->set_caption("Generating thumbnails: "); | ||||
|     progressbar->set_format(GProgressBar::Format::ValueSlashMax); | ||||
|     progressbar->set_format(GUI::ProgressBar::Format::ValueSlashMax); | ||||
|     progressbar->set_visible(false); | ||||
|     progressbar->set_frame_shape(FrameShape::Panel); | ||||
|     progressbar->set_frame_shadow(FrameShadow::Sunken); | ||||
|  | @ -150,7 +150,7 @@ int main(int argc, char** argv) | |||
|         } | ||||
| 
 | ||||
|         // Reselect the existing folder in the tree.
 | ||||
|         auto new_index = directories_model->index(current_path, GFileSystemModel::Column::Name); | ||||
|         auto new_index = directories_model->index(current_path, GUI::FileSystemModel::Column::Name); | ||||
|         tree_view->selection().set(new_index); | ||||
|         tree_view->scroll_into_view(new_index, Orientation::Vertical); | ||||
|         tree_view->update(); | ||||
|  | @ -158,37 +158,37 @@ int main(int argc, char** argv) | |||
|         directory_view->refresh(); | ||||
|     }; | ||||
| 
 | ||||
|     auto directory_context_menu = GMenu::construct("Directory View Directory"); | ||||
|     auto file_context_menu = GMenu::construct("Directory View File"); | ||||
|     auto directory_view_context_menu = GMenu::construct("Directory View"); | ||||
|     auto tree_view_directory_context_menu = GMenu::construct("Tree View Directory"); | ||||
|     auto tree_view_context_menu = GMenu::construct("Tree View"); | ||||
|     auto directory_context_menu = GUI::Menu::construct("Directory View Directory"); | ||||
|     auto file_context_menu = GUI::Menu::construct("Directory View File"); | ||||
|     auto directory_view_context_menu = GUI::Menu::construct("Directory View"); | ||||
|     auto tree_view_directory_context_menu = GUI::Menu::construct("Tree View Directory"); | ||||
|     auto tree_view_context_menu = GUI::Menu::construct("Tree View"); | ||||
| 
 | ||||
|     auto open_parent_directory_action = GAction::create("Open parent directory", { Mod_Alt, Key_Up }, GraphicsBitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"), [&](const GAction&) { | ||||
|     auto open_parent_directory_action = GUI::Action::create("Open parent directory", { Mod_Alt, Key_Up }, GraphicsBitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"), [&](const GUI::Action&) { | ||||
|         directory_view->open_parent_directory(); | ||||
|     }); | ||||
| 
 | ||||
|     auto mkdir_action = GAction::create("New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/mkdir.png"), [&](const GAction&) { | ||||
|         auto input_box = GInputBox::construct("Enter name:", "New directory", window); | ||||
|         if (input_box->exec() == GInputBox::ExecOK && !input_box->text_value().is_empty()) { | ||||
|     auto mkdir_action = GUI::Action::create("New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/mkdir.png"), [&](const GUI::Action&) { | ||||
|         auto input_box = GUI::InputBox::construct("Enter name:", "New directory", window); | ||||
|         if (input_box->exec() == GUI::InputBox::ExecOK && !input_box->text_value().is_empty()) { | ||||
|             auto new_dir_path = canonicalized_path( | ||||
|                 String::format("%s/%s", | ||||
|                     directory_view->path().characters(), | ||||
|                     input_box->text_value().characters())); | ||||
|             int rc = mkdir(new_dir_path.characters(), 0777); | ||||
|             if (rc < 0) { | ||||
|                 GMessageBox::show(String::format("mkdir(\"%s\") failed: %s", new_dir_path.characters(), strerror(errno)), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window); | ||||
|                 GUI::MessageBox::show(String::format("mkdir(\"%s\") failed: %s", new_dir_path.characters(), strerror(errno)), "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window); | ||||
|             } else { | ||||
|                 refresh_tree_view(); | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
| 
 | ||||
|     RefPtr<GAction> view_as_table_action; | ||||
|     RefPtr<GAction> view_as_icons_action; | ||||
|     RefPtr<GAction> view_as_columns_action; | ||||
|     RefPtr<GUI::Action> view_as_table_action; | ||||
|     RefPtr<GUI::Action> view_as_icons_action; | ||||
|     RefPtr<GUI::Action> view_as_columns_action; | ||||
| 
 | ||||
|     view_as_table_action = GAction::create("Table view", { Mod_Ctrl, KeyCode::Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GAction&) { | ||||
|     view_as_table_action = GUI::Action::create("Table view", { Mod_Ctrl, KeyCode::Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GUI::Action&) { | ||||
|         directory_view->set_view_mode(DirectoryView::ViewMode::List); | ||||
|         view_as_table_action->set_checked(true); | ||||
| 
 | ||||
|  | @ -197,7 +197,7 @@ int main(int argc, char** argv) | |||
|     }, window); | ||||
|     view_as_table_action->set_checkable(true); | ||||
| 
 | ||||
|     view_as_icons_action = GAction::create("Icon view", { Mod_Ctrl, KeyCode::Key_I }, GraphicsBitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&](const GAction&) { | ||||
|     view_as_icons_action = GUI::Action::create("Icon view", { Mod_Ctrl, KeyCode::Key_I }, GraphicsBitmap::load_from_file("/res/icons/16x16/icon-view.png"), [&](const GUI::Action&) { | ||||
|         directory_view->set_view_mode(DirectoryView::ViewMode::Icon); | ||||
|         view_as_icons_action->set_checked(true); | ||||
| 
 | ||||
|  | @ -206,7 +206,7 @@ int main(int argc, char** argv) | |||
|     }, window); | ||||
|     view_as_icons_action->set_checkable(true); | ||||
| 
 | ||||
|     view_as_columns_action = GAction::create("Columns view", GraphicsBitmap::load_from_file("/res/icons/16x16/columns-view.png"), [&](const GAction&) { | ||||
|     view_as_columns_action = GUI::Action::create("Columns view", GraphicsBitmap::load_from_file("/res/icons/16x16/columns-view.png"), [&](const GUI::Action&) { | ||||
|         directory_view->set_view_mode(DirectoryView::ViewMode::Columns); | ||||
|         view_as_columns_action->set_checked(true); | ||||
| 
 | ||||
|  | @ -215,7 +215,7 @@ int main(int argc, char** argv) | |||
|     }, window); | ||||
|     view_as_columns_action->set_checkable(true); | ||||
| 
 | ||||
|     auto view_type_action_group = make<GActionGroup>(); | ||||
|     auto view_type_action_group = make<GUI::ActionGroup>(); | ||||
|     view_type_action_group->set_exclusive(true); | ||||
|     view_type_action_group->add_action(*view_as_table_action); | ||||
|     view_type_action_group->add_action(*view_as_icons_action); | ||||
|  | @ -225,10 +225,10 @@ int main(int argc, char** argv) | |||
|         Vector<String> paths; | ||||
|         auto& view = directory_view->current_view(); | ||||
|         auto& model = *view.model(); | ||||
|         view.selection().for_each_index([&](const GModelIndex& index) { | ||||
|         view.selection().for_each_index([&](const GUI::ModelIndex& index) { | ||||
|             auto parent_index = model.parent_index(index); | ||||
|             auto name_index = model.index(index.row(), GFileSystemModel::Column::Name, parent_index); | ||||
|             auto path = model.data(name_index, GModel::Role::Custom).to_string(); | ||||
|             auto name_index = model.index(index.row(), GUI::FileSystemModel::Column::Name, parent_index); | ||||
|             auto path = model.data(name_index, GUI::Model::Role::Custom).to_string(); | ||||
|             paths.append(path); | ||||
|         }); | ||||
|         return paths; | ||||
|  | @ -237,17 +237,17 @@ int main(int argc, char** argv) | |||
|     auto tree_view_selected_file_paths = [&] { | ||||
|         Vector<String> paths; | ||||
|         auto& view = tree_view; | ||||
|         view->selection().for_each_index([&](const GModelIndex& index) { | ||||
|         view->selection().for_each_index([&](const GUI::ModelIndex& index) { | ||||
|             paths.append(directories_model->full_path(index)); | ||||
|         }); | ||||
|         return paths; | ||||
|     }; | ||||
| 
 | ||||
|     auto select_all_action = GAction::create("Select all", { Mod_Ctrl, KeyCode::Key_A }, [&](const GAction&) { | ||||
|     auto select_all_action = GUI::Action::create("Select all", { Mod_Ctrl, KeyCode::Key_A }, [&](const GUI::Action&) { | ||||
|         directory_view->current_view().select_all(); | ||||
|     }); | ||||
| 
 | ||||
|     auto copy_action = GCommonActions::make_copy_action([&](const GAction& action) { | ||||
|     auto copy_action = GUI::CommonActions::make_copy_action([&](const GUI::Action& action) { | ||||
|         Vector<String> paths; | ||||
|         if (action.activator() == directory_context_menu || directory_view->active_widget()->is_focused()) { | ||||
|             paths = selected_file_paths(); | ||||
|  | @ -260,12 +260,12 @@ int main(int argc, char** argv) | |||
|         for (auto& path : paths) { | ||||
|             copy_text.appendf("%s\n", path.characters()); | ||||
|         } | ||||
|         GClipboard::the().set_data(copy_text.build(), "file-list"); | ||||
|         GUI::Clipboard::the().set_data(copy_text.build(), "file-list"); | ||||
|     }, window); | ||||
|     copy_action->set_enabled(false); | ||||
| 
 | ||||
|     auto paste_action = GCommonActions::make_paste_action([&](const GAction&) { | ||||
|         auto data_and_type = GClipboard::the().data_and_type(); | ||||
|     auto paste_action = GUI::CommonActions::make_paste_action([&](const GUI::Action&) { | ||||
|         auto data_and_type = GUI::Clipboard::the().data_and_type(); | ||||
|         if (data_and_type.type != "file-list") { | ||||
|             dbg() << "Cannot paste clipboard type " << data_and_type.type; | ||||
|             return; | ||||
|  | @ -285,20 +285,20 @@ int main(int argc, char** argv) | |||
|             if (!FileUtils::copy_file_or_directory(current_path, new_path)) { | ||||
|                 auto error_message = String::format("Could not paste %s.", | ||||
|                     current_path.characters()); | ||||
|                 GMessageBox::show(error_message, "File Manager", GMessageBox::Type::Error); | ||||
|                 GUI::MessageBox::show(error_message, "File Manager", GUI::MessageBox::Type::Error); | ||||
|             } else { | ||||
|                 refresh_tree_view(); | ||||
|             } | ||||
|         } | ||||
|     }, window); | ||||
|     paste_action->set_enabled(GClipboard::the().type() == "file-list"); | ||||
|     paste_action->set_enabled(GUI::Clipboard::the().type() == "file-list"); | ||||
| 
 | ||||
|     GClipboard::the().on_content_change = [&](const String& data_type) { | ||||
|     GUI::Clipboard::the().on_content_change = [&](const String& data_type) { | ||||
|         paste_action->set_enabled(data_type == "file-list"); | ||||
|     }; | ||||
| 
 | ||||
|     auto properties_action | ||||
|         = GAction::create("Properties...", { Mod_Alt, Key_Return }, GraphicsBitmap::load_from_file("/res/icons/16x16/properties.png"), [&](const GAction& action) { | ||||
|         = GUI::Action::create("Properties...", { Mod_Alt, Key_Return }, GraphicsBitmap::load_from_file("/res/icons/16x16/properties.png"), [&](const GUI::Action& action) { | ||||
|               auto& model = directory_view->model(); | ||||
|               String path; | ||||
|               Vector<String> selected; | ||||
|  | @ -325,7 +325,7 @@ int main(int argc, char** argv) | |||
|         Yes | ||||
|     }; | ||||
| 
 | ||||
|     auto do_delete = [&](ConfirmBeforeDelete confirm, const GAction& action) { | ||||
|     auto do_delete = [&](ConfirmBeforeDelete confirm, const GUI::Action& action) { | ||||
|         Vector<String> paths; | ||||
|         if (action.activator() == directory_context_menu || directory_view->active_widget()->is_focused()) { | ||||
|             paths = selected_file_paths(); | ||||
|  | @ -343,13 +343,13 @@ int main(int argc, char** argv) | |||
|             } | ||||
| 
 | ||||
|             if (confirm == ConfirmBeforeDelete::Yes) { | ||||
|                 auto result = GMessageBox::show( | ||||
|                 auto result = GUI::MessageBox::show( | ||||
|                     message, | ||||
|                     "Confirm deletion", | ||||
|                     GMessageBox::Type::Warning, | ||||
|                     GMessageBox::InputType::OKCancel, | ||||
|                     GUI::MessageBox::Type::Warning, | ||||
|                     GUI::MessageBox::InputType::OKCancel, | ||||
|                     window); | ||||
|                 if (result == GMessageBox::ExecCancel) | ||||
|                 if (result == GUI::MessageBox::ExecCancel) | ||||
|                     return; | ||||
|             } | ||||
|         } | ||||
|  | @ -357,11 +357,11 @@ int main(int argc, char** argv) | |||
|         for (auto& path : paths) { | ||||
|             struct stat st; | ||||
|             if (lstat(path.characters(), &st)) { | ||||
|                 GMessageBox::show( | ||||
|                 GUI::MessageBox::show( | ||||
|                     String::format("lstat(%s) failed: %s", path.characters(), strerror(errno)), | ||||
|                     "Delete failed", | ||||
|                     GMessageBox::Type::Error, | ||||
|                     GMessageBox::InputType::OK, | ||||
|                     GUI::MessageBox::Type::Error, | ||||
|                     GUI::MessageBox::InputType::OK, | ||||
|                     window); | ||||
|                 break; | ||||
|             } else { | ||||
|  | @ -373,11 +373,11 @@ int main(int argc, char** argv) | |||
|                 int error = FileUtils::delete_directory(path, error_path); | ||||
| 
 | ||||
|                 if (error) { | ||||
|                     GMessageBox::show( | ||||
|                     GUI::MessageBox::show( | ||||
|                         String::format("Failed to delete directory \"%s\": %s", error_path.characters(), strerror(error)), | ||||
|                         "Delete failed", | ||||
|                         GMessageBox::Type::Error, | ||||
|                         GMessageBox::InputType::OK, | ||||
|                         GUI::MessageBox::Type::Error, | ||||
|                         GUI::MessageBox::InputType::OK, | ||||
|                         window); | ||||
|                     break; | ||||
|                 } else { | ||||
|  | @ -385,67 +385,67 @@ int main(int argc, char** argv) | |||
|                 } | ||||
|             } else if (unlink(path.characters()) < 0) { | ||||
|                 int saved_errno = errno; | ||||
|                 GMessageBox::show( | ||||
|                 GUI::MessageBox::show( | ||||
|                     String::format("unlink(%s) failed: %s", path.characters(), strerror(saved_errno)), | ||||
|                     "Delete failed", | ||||
|                     GMessageBox::Type::Error, | ||||
|                     GMessageBox::InputType::OK, | ||||
|                     GUI::MessageBox::Type::Error, | ||||
|                     GUI::MessageBox::InputType::OK, | ||||
|                     window); | ||||
|                 break; | ||||
|             } | ||||
|         } | ||||
|     }; | ||||
| 
 | ||||
|     auto force_delete_action = GAction::create("Delete without confirmation", { Mod_Shift, Key_Delete }, [&](const GAction& action) { | ||||
|     auto force_delete_action = GUI::Action::create("Delete without confirmation", { Mod_Shift, Key_Delete }, [&](const GUI::Action& action) { | ||||
|         do_delete(ConfirmBeforeDelete::No, action); | ||||
|     }, window); | ||||
| 
 | ||||
|     auto delete_action = GCommonActions::make_delete_action([&](const GAction& action) { | ||||
|     auto delete_action = GUI::CommonActions::make_delete_action([&](const GUI::Action& action) { | ||||
|         do_delete(ConfirmBeforeDelete::Yes, action); | ||||
|     }, window); | ||||
|     delete_action->set_enabled(false); | ||||
| 
 | ||||
|     auto go_back_action = GCommonActions::make_go_back_action([&](auto&) { | ||||
|     auto go_back_action = GUI::CommonActions::make_go_back_action([&](auto&) { | ||||
|         directory_view->open_previous_directory(); | ||||
|     }, window); | ||||
| 
 | ||||
|     auto go_forward_action = GCommonActions::make_go_forward_action([&](auto&) { | ||||
|     auto go_forward_action = GUI::CommonActions::make_go_forward_action([&](auto&) { | ||||
|         directory_view->open_next_directory(); | ||||
|     }, window); | ||||
| 
 | ||||
|     auto go_home_action = GCommonActions::make_go_home_action([&](auto&) { | ||||
|     auto go_home_action = GUI::CommonActions::make_go_home_action([&](auto&) { | ||||
|         directory_view->open(get_current_user_home_path()); | ||||
|     }, window); | ||||
| 
 | ||||
|     auto menubar = make<GMenuBar>(); | ||||
|     auto menubar = make<GUI::MenuBar>(); | ||||
| 
 | ||||
|     auto app_menu = GMenu::construct("File Manager"); | ||||
|     auto app_menu = GUI::Menu::construct("File Manager"); | ||||
|     app_menu->add_action(mkdir_action); | ||||
|     app_menu->add_action(copy_action); | ||||
|     app_menu->add_action(paste_action); | ||||
|     app_menu->add_action(delete_action); | ||||
|     app_menu->add_separator(); | ||||
|     app_menu->add_action(GCommonActions::make_quit_action([](auto&) { | ||||
|         GApplication::the().quit(0); | ||||
|     app_menu->add_action(GUI::CommonActions::make_quit_action([](auto&) { | ||||
|         GUI::Application::the().quit(0); | ||||
|     })); | ||||
|     menubar->add_menu(move(app_menu)); | ||||
| 
 | ||||
|     auto view_menu = GMenu::construct("View"); | ||||
|     auto view_menu = GUI::Menu::construct("View"); | ||||
|     view_menu->add_action(*view_as_icons_action); | ||||
|     view_menu->add_action(*view_as_table_action); | ||||
|     view_menu->add_action(*view_as_columns_action); | ||||
|     menubar->add_menu(move(view_menu)); | ||||
| 
 | ||||
|     auto go_menu = GMenu::construct("Go"); | ||||
|     auto go_menu = GUI::Menu::construct("Go"); | ||||
|     go_menu->add_action(go_back_action); | ||||
|     go_menu->add_action(go_forward_action); | ||||
|     go_menu->add_action(open_parent_directory_action); | ||||
|     go_menu->add_action(go_home_action); | ||||
|     menubar->add_menu(move(go_menu)); | ||||
| 
 | ||||
|     auto help_menu = GMenu::construct("Help"); | ||||
|     help_menu->add_action(GAction::create("About", [&](const GAction&) { | ||||
|         GAboutDialog::show("File Manager", load_png("/res/icons/32x32/filetype-folder.png"), window); | ||||
|     auto help_menu = GUI::Menu::construct("Help"); | ||||
|     help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) { | ||||
|         GUI::AboutDialog::show("File Manager", load_png("/res/icons/32x32/filetype-folder.png"), window); | ||||
|     })); | ||||
|     menubar->add_menu(move(help_menu)); | ||||
| 
 | ||||
|  | @ -470,7 +470,7 @@ int main(int argc, char** argv) | |||
|     directory_view->on_path_change = [&](const String& new_path) { | ||||
|         window->set_title(String::format("File Manager: %s", new_path.characters())); | ||||
|         location_textbox->set_text(new_path); | ||||
|         auto new_index = directories_model->index(new_path, GFileSystemModel::Column::Name); | ||||
|         auto new_index = directories_model->index(new_path, GUI::FileSystemModel::Column::Name); | ||||
|         if (new_index.is_valid()) { | ||||
|             tree_view->selection().set(new_index); | ||||
|             tree_view->scroll_into_view(new_index, Orientation::Vertical); | ||||
|  | @ -496,13 +496,13 @@ int main(int argc, char** argv) | |||
|         progressbar->set_visible(true); | ||||
|     }; | ||||
| 
 | ||||
|     directory_view->on_selection_change = [&](GAbstractView& view) { | ||||
|     directory_view->on_selection_change = [&](GUI::AbstractView& view) { | ||||
|         // FIXME: Figure out how we can enable/disable the paste action, based on clipboard contents.
 | ||||
|         copy_action->set_enabled(!view.selection().is_empty()); | ||||
|         delete_action->set_enabled(!view.selection().is_empty()); | ||||
|     }; | ||||
| 
 | ||||
|     auto open_in_text_editor_action = GAction::create("Open in TextEditor...", GraphicsBitmap::load_from_file("/res/icons/TextEditor16.png"), [&](auto&) { | ||||
|     auto open_in_text_editor_action = GUI::Action::create("Open in TextEditor...", GraphicsBitmap::load_from_file("/res/icons/TextEditor16.png"), [&](auto&) { | ||||
|         for (auto& path : selected_file_paths()) { | ||||
|             if (!fork()) { | ||||
|                 int rc = execl("/bin/TextEditor", "TextEditor", path.characters(), nullptr); | ||||
|  | @ -537,7 +537,7 @@ int main(int argc, char** argv) | |||
|     tree_view_directory_context_menu->add_separator(); | ||||
|     tree_view_directory_context_menu->add_action(mkdir_action); | ||||
| 
 | ||||
|     directory_view->on_context_menu_request = [&](const GAbstractView&, const GModelIndex& index, const GContextMenuEvent& event) { | ||||
|     directory_view->on_context_menu_request = [&](const GUI::AbstractView&, const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) { | ||||
|         if (index.is_valid()) { | ||||
|             auto& node = directory_view->model().node(index); | ||||
| 
 | ||||
|  | @ -559,7 +559,7 @@ int main(int argc, char** argv) | |||
|         delete_action->set_enabled(!tree_view->selection().is_empty()); | ||||
|     }; | ||||
| 
 | ||||
|     tree_view->on_context_menu_request = [&](const GModelIndex& index, const GContextMenuEvent& event) { | ||||
|     tree_view->on_context_menu_request = [&](const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) { | ||||
|         if (index.is_valid()) { | ||||
|             tree_view_directory_context_menu->popup(event.screen_position()); | ||||
|         } | ||||
|  | @ -611,7 +611,7 @@ int main(int argc, char** argv) | |||
|         config->write_num_entry("Window", "Heigth", window->height()); | ||||
|         config->sync(); | ||||
| 
 | ||||
|         return GWindow::CloseRequestDecision::Close; | ||||
|         return GUI::Window::CloseRequestDecision::Close; | ||||
|     }; | ||||
| 
 | ||||
|     return app.exec(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling